@web-lite/scroll-picker
Advanced tools
Comparing version 0.0.0-alpha.0.1 to 0.0.0-alpha.0.2
@@ -88,3 +88,3 @@ var $8zHUo$reactjsxruntime = require("react/jsx-runtime"); | ||
element.scrollTo({ | ||
top: initialSnappedIndex * itemHeight | ||
top: snappedIndex * itemHeight | ||
}); | ||
@@ -127,3 +127,2 @@ }, deps); | ||
}, [ | ||
selectedItem, | ||
items | ||
@@ -235,3 +234,2 @@ ]); | ||
const newYear = (0, $bc9413b8138629cd$export$630528fb1bc2a69c)(newValue); | ||
console.log(newValue); | ||
const daysInNewMonth = (0, ($parcel$interopDefault($8zHUo$dayjs)))([ | ||
@@ -250,5 +248,5 @@ +newYear, | ||
const onMonthValueChangeHandler = (newIndex)=>{ | ||
const newValue = $72a75b6a0ee99415$var$rangeOfValidMonth(selectedDate)[newIndex]; | ||
const newValue = $72a75b6a0ee99415$var$rangeOfValidMonth(selectedDate)[newIndex + 1]; | ||
const months = (0, ($parcel$interopDefault($8zHUo$dayjs))).months(); | ||
const newMonth = months.indexOf(newValue) + 1; | ||
const newMonth = months.indexOf(newValue) - 1; | ||
const daysInNewMonth = (0, ($parcel$interopDefault($8zHUo$dayjs)))([ | ||
@@ -268,3 +266,3 @@ selectedDate.year(), | ||
const newValue = $72a75b6a0ee99415$var$rangeOfValidDays(selectedDate)[newIndex]; | ||
const newDay = Number((0, $bc9413b8138629cd$export$630528fb1bc2a69c)(newValue)); | ||
const newDay = Number((0, $bc9413b8138629cd$export$630528fb1bc2a69c)(newValue)) + 1; | ||
const newDate = (0, ($parcel$interopDefault($8zHUo$dayjs)))([ | ||
@@ -281,3 +279,3 @@ selectedDate.year(), | ||
{ | ||
selectedItem: (0, $bc9413b8138629cd$export$10e31d74b47a44fa)(selectedDate.year(), false), | ||
selectedItem: (0, $bc9413b8138629cd$export$10e31d74b47a44fa)((0, ($parcel$interopDefault($8zHUo$dayjs)))(defaultValue).year(), false), | ||
items: $72a75b6a0ee99415$var$rangeOfValidYears(), | ||
@@ -287,3 +285,3 @@ onUpdate: onYearValueChangeHandler | ||
{ | ||
selectedItem: $72a75b6a0ee99415$var$rangeOfValidMonth(selectedDate)[selectedDate.month() - 1], | ||
selectedItem: $72a75b6a0ee99415$var$rangeOfValidMonth((0, ($parcel$interopDefault($8zHUo$dayjs)))(defaultValue))[(0, ($parcel$interopDefault($8zHUo$dayjs)))(defaultValue).month() - 1], | ||
items: $72a75b6a0ee99415$var$rangeOfValidMonth(selectedDate), | ||
@@ -293,3 +291,3 @@ onUpdate: onMonthValueChangeHandler | ||
{ | ||
selectedItem: (0, $bc9413b8138629cd$export$10e31d74b47a44fa)(selectedDate.date()), | ||
selectedItem: (0, $bc9413b8138629cd$export$10e31d74b47a44fa)((0, ($parcel$interopDefault($8zHUo$dayjs)))(defaultValue).date()), | ||
items: $72a75b6a0ee99415$var$rangeOfValidDays(selectedDate), | ||
@@ -528,3 +526,2 @@ onUpdate: onDayValueChangeHandler | ||
const currentDate = new (0, ($parcel$interopDefault($8zHUo$persiandate)))(new Date()); | ||
// Because the greatest range of picking days is just one month, simply checking for the same day is sufficient. | ||
const startHour = selectedDate.date() === currentDate.date() ? currentDate.hour() : 0; | ||
@@ -531,0 +528,0 @@ return $8zHUo$ramda.range(startHour, 24).map((number)=>String(number).padStart(2, "0")).map((number)=>(0, $bc9413b8138629cd$export$10e31d74b47a44fa)(number)); |
{ | ||
"name": "@web-lite/scroll-picker", | ||
"version": "0.0.0-alpha.0.1", | ||
"version": "0.0.0-alpha.0.2", | ||
"source": "src/index.ts", | ||
@@ -5,0 +5,0 @@ "main": "dist/main.js", |
@@ -17,3 +17,3 @@ import React, { useState, useEffect, useCallback } from 'react' | ||
) { | ||
const [snappedIndex, setSnappedIndex] = useState(initialSnappedIndex) | ||
const [snappedIndex, setSnappedIndex] = useState<number>(initialSnappedIndex) | ||
@@ -31,3 +31,3 @@ const updateSnappedIndex = useCallback( | ||
element.scrollTo({ top: initialSnappedIndex * itemHeight }) | ||
element.scrollTo({ top: snappedIndex * itemHeight }) | ||
}, deps) | ||
@@ -34,0 +34,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54975
25
1309
1