@webority-technologies/mobile 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +399 -0
- package/lib/commonjs/api/publicClient.js +73 -0
- package/lib/commonjs/api/userClient.js +290 -0
- package/lib/commonjs/auth/authStore.js +107 -0
- package/lib/commonjs/auth/index.js +44 -0
- package/lib/commonjs/auth/jwt.js +84 -0
- package/lib/commonjs/components/Accordion/Accordion.js +257 -0
- package/lib/commonjs/components/Accordion/index.js +26 -0
- package/lib/commonjs/components/Avatar/Avatar.js +283 -0
- package/lib/commonjs/components/Avatar/index.js +26 -0
- package/lib/commonjs/components/Badge/Badge.js +212 -0
- package/lib/commonjs/components/Badge/index.js +20 -0
- package/lib/commonjs/components/Banner/Banner.js +276 -0
- package/lib/commonjs/components/Banner/index.js +20 -0
- package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +288 -0
- package/lib/commonjs/components/BottomNavigation/index.js +20 -0
- package/lib/commonjs/components/BottomSheet/BottomSheet.js +367 -0
- package/lib/commonjs/components/BottomSheet/index.js +20 -0
- package/lib/commonjs/components/Button/Button.js +281 -0
- package/lib/commonjs/components/Button/index.js +20 -0
- package/lib/commonjs/components/Card/Card.js +194 -0
- package/lib/commonjs/components/Card/index.js +20 -0
- package/lib/commonjs/components/Carousel/Carousel.js +475 -0
- package/lib/commonjs/components/Carousel/index.js +20 -0
- package/lib/commonjs/components/Checkbox/Checkbox.js +165 -0
- package/lib/commonjs/components/Checkbox/index.js +20 -0
- package/lib/commonjs/components/Chip/Chip.js +272 -0
- package/lib/commonjs/components/Chip/index.js +20 -0
- package/lib/commonjs/components/DatePicker/DatePicker.js +813 -0
- package/lib/commonjs/components/DatePicker/index.js +20 -0
- package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +622 -0
- package/lib/commonjs/components/DateRangePicker/index.js +20 -0
- package/lib/commonjs/components/Dialog/Dialog.js +215 -0
- package/lib/commonjs/components/Dialog/index.js +20 -0
- package/lib/commonjs/components/Divider/Divider.js +118 -0
- package/lib/commonjs/components/Divider/index.js +20 -0
- package/lib/commonjs/components/Drawer/Drawer.js +344 -0
- package/lib/commonjs/components/Drawer/index.js +20 -0
- package/lib/commonjs/components/EmptyState/EmptyState.js +201 -0
- package/lib/commonjs/components/EmptyState/index.js +20 -0
- package/lib/commonjs/components/FAB/FAB.js +457 -0
- package/lib/commonjs/components/FAB/index.js +26 -0
- package/lib/commonjs/components/Field/Field.js +127 -0
- package/lib/commonjs/components/Field/index.js +20 -0
- package/lib/commonjs/components/ForceUpdateDialog/ForceUpdateDialog.js +81 -0
- package/lib/commonjs/components/ForceUpdateDialog/index.js +20 -0
- package/lib/commonjs/components/Header/Header.js +339 -0
- package/lib/commonjs/components/Header/index.js +20 -0
- package/lib/commonjs/components/Icon/Icon.js +120 -0
- package/lib/commonjs/components/Icon/index.js +20 -0
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +463 -0
- package/lib/commonjs/components/ImageGallery/index.js +20 -0
- package/lib/commonjs/components/Input/Input.js +390 -0
- package/lib/commonjs/components/Input/index.js +20 -0
- package/lib/commonjs/components/ListItem/ListItem.js +241 -0
- package/lib/commonjs/components/ListItem/index.js +20 -0
- package/lib/commonjs/components/LoadingSpinner/LoadingSpinner.js +183 -0
- package/lib/commonjs/components/LoadingSpinner/index.js +20 -0
- package/lib/commonjs/components/Modal/Modal.js +239 -0
- package/lib/commonjs/components/Modal/index.js +20 -0
- package/lib/commonjs/components/NumberInput/NumberInput.js +392 -0
- package/lib/commonjs/components/NumberInput/index.js +20 -0
- package/lib/commonjs/components/OTPInput/OTPInput.js +375 -0
- package/lib/commonjs/components/OTPInput/index.js +20 -0
- package/lib/commonjs/components/ProgressBar/ProgressBar.js +149 -0
- package/lib/commonjs/components/ProgressBar/index.js +20 -0
- package/lib/commonjs/components/Radio/Radio.js +160 -0
- package/lib/commonjs/components/Radio/RadioGroup.js +43 -0
- package/lib/commonjs/components/Radio/index.js +39 -0
- package/lib/commonjs/components/Rating/Rating.js +236 -0
- package/lib/commonjs/components/Rating/index.js +20 -0
- package/lib/commonjs/components/SearchBar/SearchBar.js +274 -0
- package/lib/commonjs/components/SearchBar/index.js +20 -0
- package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +184 -0
- package/lib/commonjs/components/SegmentedControl/index.js +20 -0
- package/lib/commonjs/components/Select/Select.js +540 -0
- package/lib/commonjs/components/Select/index.js +20 -0
- package/lib/commonjs/components/SkeletonLoader/SkeletonContent.js +191 -0
- package/lib/commonjs/components/SkeletonLoader/SkeletonLoader.js +311 -0
- package/lib/commonjs/components/SkeletonLoader/index.js +57 -0
- package/lib/commonjs/components/Slider/Slider.js +443 -0
- package/lib/commonjs/components/Slider/index.js +20 -0
- package/lib/commonjs/components/Stepper/Stepper.js +403 -0
- package/lib/commonjs/components/Stepper/index.js +20 -0
- package/lib/commonjs/components/Swipeable/Swipeable.js +349 -0
- package/lib/commonjs/components/Swipeable/index.js +20 -0
- package/lib/commonjs/components/Switch/Switch.js +173 -0
- package/lib/commonjs/components/Switch/index.js +20 -0
- package/lib/commonjs/components/Tabs/Tabs.js +204 -0
- package/lib/commonjs/components/Tabs/index.js +20 -0
- package/lib/commonjs/components/TimePicker/TimePicker.js +551 -0
- package/lib/commonjs/components/TimePicker/index.js +20 -0
- package/lib/commonjs/components/Toast/Toast.js +273 -0
- package/lib/commonjs/components/Toast/ToastProvider.js +195 -0
- package/lib/commonjs/components/Toast/index.js +39 -0
- package/lib/commonjs/components/Tooltip/Tooltip.js +363 -0
- package/lib/commonjs/components/Tooltip/index.js +20 -0
- package/lib/commonjs/components/index.js +392 -0
- package/lib/commonjs/config/index.js +63 -0
- package/lib/commonjs/formatters/currency.js +61 -0
- package/lib/commonjs/formatters/date.js +156 -0
- package/lib/commonjs/formatters/index.js +77 -0
- package/lib/commonjs/formatters/initials.js +28 -0
- package/lib/commonjs/formatters/number.js +76 -0
- package/lib/commonjs/formatters/phone.js +59 -0
- package/lib/commonjs/hooks/index.js +27 -0
- package/lib/commonjs/hooks/useDebounce.js +17 -0
- package/lib/commonjs/hooks/usePressAnimation.js +44 -0
- package/lib/commonjs/hooks/useToggle.js +22 -0
- package/lib/commonjs/index.js +628 -0
- package/lib/commonjs/initSDK.js +47 -0
- package/lib/commonjs/initUI.js +24 -0
- package/lib/commonjs/initUserAuth.js +40 -0
- package/lib/commonjs/logger/index.js +127 -0
- package/lib/commonjs/network/NetworkStatusBanner.js +89 -0
- package/lib/commonjs/network/index.js +32 -0
- package/lib/commonjs/network/networkStatus.js +88 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/permissions/index.js +180 -0
- package/lib/commonjs/storage/index.js +187 -0
- package/lib/commonjs/theme/ThemeContext.js +73 -0
- package/lib/commonjs/theme/index.js +93 -0
- package/lib/commonjs/theme/merge.js +30 -0
- package/lib/commonjs/theme/tokens.js +319 -0
- package/lib/commonjs/theme/types.js +6 -0
- package/lib/commonjs/types/vector-icons.d.js +2 -0
- package/lib/commonjs/utils/dimensions.js +31 -0
- package/lib/commonjs/utils/hapticUtils.js +57 -0
- package/lib/commonjs/utils/imageCompression.js +51 -0
- package/lib/commonjs/utils/index.js +83 -0
- package/lib/commonjs/utils/responsive.js +48 -0
- package/lib/commonjs/utils/shadows.js +12 -0
- package/lib/commonjs/utils/spacing.js +86 -0
- package/lib/commonjs/validators/index.js +165 -0
- package/lib/commonjs/versionCheck/index.js +338 -0
- package/lib/module/api/publicClient.js +69 -0
- package/lib/module/api/userClient.js +283 -0
- package/lib/module/auth/authStore.js +100 -0
- package/lib/module/auth/index.js +5 -0
- package/lib/module/auth/jwt.js +78 -0
- package/lib/module/components/Accordion/Accordion.js +251 -0
- package/lib/module/components/Accordion/index.js +4 -0
- package/lib/module/components/Avatar/Avatar.js +278 -0
- package/lib/module/components/Avatar/index.js +4 -0
- package/lib/module/components/Badge/Badge.js +208 -0
- package/lib/module/components/Badge/index.js +4 -0
- package/lib/module/components/Banner/Banner.js +272 -0
- package/lib/module/components/Banner/index.js +4 -0
- package/lib/module/components/BottomNavigation/BottomNavigation.js +284 -0
- package/lib/module/components/BottomNavigation/index.js +4 -0
- package/lib/module/components/BottomSheet/BottomSheet.js +363 -0
- package/lib/module/components/BottomSheet/index.js +4 -0
- package/lib/module/components/Button/Button.js +277 -0
- package/lib/module/components/Button/index.js +4 -0
- package/lib/module/components/Card/Card.js +190 -0
- package/lib/module/components/Card/index.js +4 -0
- package/lib/module/components/Carousel/Carousel.js +471 -0
- package/lib/module/components/Carousel/index.js +4 -0
- package/lib/module/components/Checkbox/Checkbox.js +161 -0
- package/lib/module/components/Checkbox/index.js +4 -0
- package/lib/module/components/Chip/Chip.js +268 -0
- package/lib/module/components/Chip/index.js +4 -0
- package/lib/module/components/DatePicker/DatePicker.js +808 -0
- package/lib/module/components/DatePicker/index.js +4 -0
- package/lib/module/components/DateRangePicker/DateRangePicker.js +618 -0
- package/lib/module/components/DateRangePicker/index.js +4 -0
- package/lib/module/components/Dialog/Dialog.js +210 -0
- package/lib/module/components/Dialog/index.js +4 -0
- package/lib/module/components/Divider/Divider.js +114 -0
- package/lib/module/components/Divider/index.js +4 -0
- package/lib/module/components/Drawer/Drawer.js +340 -0
- package/lib/module/components/Drawer/index.js +4 -0
- package/lib/module/components/EmptyState/EmptyState.js +197 -0
- package/lib/module/components/EmptyState/index.js +4 -0
- package/lib/module/components/FAB/FAB.js +452 -0
- package/lib/module/components/FAB/index.js +4 -0
- package/lib/module/components/Field/Field.js +123 -0
- package/lib/module/components/Field/index.js +4 -0
- package/lib/module/components/ForceUpdateDialog/ForceUpdateDialog.js +75 -0
- package/lib/module/components/ForceUpdateDialog/index.js +4 -0
- package/lib/module/components/Header/Header.js +335 -0
- package/lib/module/components/Header/index.js +4 -0
- package/lib/module/components/Icon/Icon.js +111 -0
- package/lib/module/components/Icon/index.js +4 -0
- package/lib/module/components/ImageGallery/ImageGallery.js +458 -0
- package/lib/module/components/ImageGallery/index.js +4 -0
- package/lib/module/components/Input/Input.js +384 -0
- package/lib/module/components/Input/index.js +4 -0
- package/lib/module/components/ListItem/ListItem.js +237 -0
- package/lib/module/components/ListItem/index.js +4 -0
- package/lib/module/components/LoadingSpinner/LoadingSpinner.js +179 -0
- package/lib/module/components/LoadingSpinner/index.js +4 -0
- package/lib/module/components/Modal/Modal.js +235 -0
- package/lib/module/components/Modal/index.js +4 -0
- package/lib/module/components/NumberInput/NumberInput.js +388 -0
- package/lib/module/components/NumberInput/index.js +4 -0
- package/lib/module/components/OTPInput/OTPInput.js +371 -0
- package/lib/module/components/OTPInput/index.js +4 -0
- package/lib/module/components/ProgressBar/ProgressBar.js +145 -0
- package/lib/module/components/ProgressBar/index.js +4 -0
- package/lib/module/components/Radio/Radio.js +155 -0
- package/lib/module/components/Radio/RadioGroup.js +38 -0
- package/lib/module/components/Radio/index.js +5 -0
- package/lib/module/components/Rating/Rating.js +232 -0
- package/lib/module/components/Rating/index.js +4 -0
- package/lib/module/components/SearchBar/SearchBar.js +270 -0
- package/lib/module/components/SearchBar/index.js +4 -0
- package/lib/module/components/SegmentedControl/SegmentedControl.js +180 -0
- package/lib/module/components/SegmentedControl/index.js +4 -0
- package/lib/module/components/Select/Select.js +536 -0
- package/lib/module/components/Select/index.js +4 -0
- package/lib/module/components/SkeletonLoader/SkeletonContent.js +186 -0
- package/lib/module/components/SkeletonLoader/SkeletonLoader.js +301 -0
- package/lib/module/components/SkeletonLoader/index.js +5 -0
- package/lib/module/components/Slider/Slider.js +439 -0
- package/lib/module/components/Slider/index.js +4 -0
- package/lib/module/components/Stepper/Stepper.js +399 -0
- package/lib/module/components/Stepper/index.js +4 -0
- package/lib/module/components/Swipeable/Swipeable.js +344 -0
- package/lib/module/components/Swipeable/index.js +4 -0
- package/lib/module/components/Switch/Switch.js +169 -0
- package/lib/module/components/Switch/index.js +4 -0
- package/lib/module/components/Tabs/Tabs.js +200 -0
- package/lib/module/components/Tabs/index.js +4 -0
- package/lib/module/components/TimePicker/TimePicker.js +545 -0
- package/lib/module/components/TimePicker/index.js +4 -0
- package/lib/module/components/Toast/Toast.js +268 -0
- package/lib/module/components/Toast/ToastProvider.js +187 -0
- package/lib/module/components/Toast/index.js +5 -0
- package/lib/module/components/Tooltip/Tooltip.js +358 -0
- package/lib/module/components/Tooltip/index.js +4 -0
- package/lib/module/components/index.js +47 -0
- package/lib/module/config/index.js +55 -0
- package/lib/module/formatters/currency.js +56 -0
- package/lib/module/formatters/date.js +148 -0
- package/lib/module/formatters/index.js +8 -0
- package/lib/module/formatters/initials.js +23 -0
- package/lib/module/formatters/number.js +69 -0
- package/lib/module/formatters/phone.js +53 -0
- package/lib/module/hooks/index.js +6 -0
- package/lib/module/hooks/useDebounce.js +12 -0
- package/lib/module/hooks/usePressAnimation.js +39 -0
- package/lib/module/hooks/useToggle.js +17 -0
- package/lib/module/index.js +37 -0
- package/lib/module/initSDK.js +42 -0
- package/lib/module/initUI.js +19 -0
- package/lib/module/initUserAuth.js +36 -0
- package/lib/module/logger/index.js +123 -0
- package/lib/module/network/NetworkStatusBanner.js +83 -0
- package/lib/module/network/index.js +5 -0
- package/lib/module/network/networkStatus.js +81 -0
- package/lib/module/package.json +1 -0
- package/lib/module/permissions/index.js +177 -0
- package/lib/module/storage/index.js +183 -0
- package/lib/module/theme/ThemeContext.js +65 -0
- package/lib/module/theme/index.js +48 -0
- package/lib/module/theme/merge.js +25 -0
- package/lib/module/theme/tokens.js +315 -0
- package/lib/module/theme/types.js +4 -0
- package/lib/module/types/vector-icons.d.js +2 -0
- package/lib/module/utils/dimensions.js +4 -0
- package/lib/module/utils/hapticUtils.js +51 -0
- package/lib/module/utils/imageCompression.js +46 -0
- package/lib/module/utils/index.js +8 -0
- package/lib/module/utils/responsive.js +42 -0
- package/lib/module/utils/shadows.js +7 -0
- package/lib/module/utils/spacing.js +82 -0
- package/lib/module/validators/index.js +143 -0
- package/lib/module/versionCheck/index.js +334 -0
- package/lib/typescript/commonjs/api/publicClient.d.ts +11 -0
- package/lib/typescript/commonjs/api/userClient.d.ts +18 -0
- package/lib/typescript/commonjs/auth/authStore.d.ts +20 -0
- package/lib/typescript/commonjs/auth/index.d.ts +5 -0
- package/lib/typescript/commonjs/auth/jwt.d.ts +31 -0
- package/lib/typescript/commonjs/components/Accordion/Accordion.d.ts +33 -0
- package/lib/typescript/commonjs/components/Accordion/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Avatar/Avatar.d.ts +42 -0
- package/lib/typescript/commonjs/components/Avatar/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Badge/Badge.d.ts +27 -0
- package/lib/typescript/commonjs/components/Badge/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Banner/Banner.d.ts +27 -0
- package/lib/typescript/commonjs/components/Banner/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/BottomNavigation/BottomNavigation.d.ts +34 -0
- package/lib/typescript/commonjs/components/BottomNavigation/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/BottomSheet/BottomSheet.d.ts +45 -0
- package/lib/typescript/commonjs/components/BottomSheet/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Button/Button.d.ts +29 -0
- package/lib/typescript/commonjs/components/Button/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Card/Card.d.ts +29 -0
- package/lib/typescript/commonjs/components/Card/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Carousel/Carousel.d.ts +66 -0
- package/lib/typescript/commonjs/components/Carousel/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Checkbox/Checkbox.d.ts +24 -0
- package/lib/typescript/commonjs/components/Checkbox/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Chip/Chip.d.ts +25 -0
- package/lib/typescript/commonjs/components/Chip/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/DatePicker/DatePicker.d.ts +25 -0
- package/lib/typescript/commonjs/components/DatePicker/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/DateRangePicker/DateRangePicker.d.ts +32 -0
- package/lib/typescript/commonjs/components/DateRangePicker/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Dialog/Dialog.d.ts +25 -0
- package/lib/typescript/commonjs/components/Dialog/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Divider/Divider.d.ts +21 -0
- package/lib/typescript/commonjs/components/Divider/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Drawer/Drawer.d.ts +53 -0
- package/lib/typescript/commonjs/components/Drawer/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/EmptyState/EmptyState.d.ts +25 -0
- package/lib/typescript/commonjs/components/EmptyState/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/FAB/FAB.d.ts +53 -0
- package/lib/typescript/commonjs/components/FAB/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Field/Field.d.ts +28 -0
- package/lib/typescript/commonjs/components/Field/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/ForceUpdateDialog/ForceUpdateDialog.d.ts +39 -0
- package/lib/typescript/commonjs/components/ForceUpdateDialog/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Header/Header.d.ts +36 -0
- package/lib/typescript/commonjs/components/Header/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Icon/Icon.d.ts +20 -0
- package/lib/typescript/commonjs/components/Icon/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/ImageGallery/ImageGallery.d.ts +41 -0
- package/lib/typescript/commonjs/components/ImageGallery/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Input/Input.d.ts +34 -0
- package/lib/typescript/commonjs/components/Input/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/ListItem/ListItem.d.ts +30 -0
- package/lib/typescript/commonjs/components/ListItem/index.d.ts +4 -0
- package/lib/typescript/commonjs/components/LoadingSpinner/LoadingSpinner.d.ts +20 -0
- package/lib/typescript/commonjs/components/LoadingSpinner/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Modal/Modal.d.ts +29 -0
- package/lib/typescript/commonjs/components/Modal/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/NumberInput/NumberInput.d.ts +35 -0
- package/lib/typescript/commonjs/components/NumberInput/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/OTPInput/OTPInput.d.ts +29 -0
- package/lib/typescript/commonjs/components/OTPInput/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/ProgressBar/ProgressBar.d.ts +21 -0
- package/lib/typescript/commonjs/components/ProgressBar/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Radio/Radio.d.ts +32 -0
- package/lib/typescript/commonjs/components/Radio/RadioGroup.d.ts +16 -0
- package/lib/typescript/commonjs/components/Radio/index.d.ts +5 -0
- package/lib/typescript/commonjs/components/Rating/Rating.d.ts +22 -0
- package/lib/typescript/commonjs/components/Rating/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/SearchBar/SearchBar.d.ts +28 -0
- package/lib/typescript/commonjs/components/SearchBar/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/SegmentedControl/SegmentedControl.d.ts +36 -0
- package/lib/typescript/commonjs/components/SegmentedControl/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Select/Select.d.ts +48 -0
- package/lib/typescript/commonjs/components/Select/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/SkeletonLoader/SkeletonContent.d.ts +29 -0
- package/lib/typescript/commonjs/components/SkeletonLoader/SkeletonLoader.d.ts +42 -0
- package/lib/typescript/commonjs/components/SkeletonLoader/index.d.ts +5 -0
- package/lib/typescript/commonjs/components/Slider/Slider.d.ts +33 -0
- package/lib/typescript/commonjs/components/Slider/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Stepper/Stepper.d.ts +25 -0
- package/lib/typescript/commonjs/components/Stepper/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Swipeable/Swipeable.d.ts +45 -0
- package/lib/typescript/commonjs/components/Swipeable/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Switch/Switch.d.ts +24 -0
- package/lib/typescript/commonjs/components/Switch/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Tabs/Tabs.d.ts +37 -0
- package/lib/typescript/commonjs/components/Tabs/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/TimePicker/TimePicker.d.ts +26 -0
- package/lib/typescript/commonjs/components/TimePicker/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Toast/Toast.d.ts +30 -0
- package/lib/typescript/commonjs/components/Toast/ToastProvider.d.ts +26 -0
- package/lib/typescript/commonjs/components/Toast/index.d.ts +5 -0
- package/lib/typescript/commonjs/components/Tooltip/Tooltip.d.ts +22 -0
- package/lib/typescript/commonjs/components/Tooltip/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/index.d.ts +89 -0
- package/lib/typescript/commonjs/config/index.d.ts +40 -0
- package/lib/typescript/commonjs/formatters/currency.d.ts +24 -0
- package/lib/typescript/commonjs/formatters/date.d.ts +22 -0
- package/lib/typescript/commonjs/formatters/index.d.ts +8 -0
- package/lib/typescript/commonjs/formatters/initials.d.ts +11 -0
- package/lib/typescript/commonjs/formatters/number.d.ts +15 -0
- package/lib/typescript/commonjs/formatters/phone.d.ts +13 -0
- package/lib/typescript/commonjs/hooks/index.d.ts +6 -0
- package/lib/typescript/commonjs/hooks/useDebounce.d.ts +2 -0
- package/lib/typescript/commonjs/hooks/usePressAnimation.d.ts +14 -0
- package/lib/typescript/commonjs/hooks/useToggle.d.ts +9 -0
- package/lib/typescript/commonjs/index.d.ts +37 -0
- package/lib/typescript/commonjs/initSDK.d.ts +40 -0
- package/lib/typescript/commonjs/initUI.d.ts +12 -0
- package/lib/typescript/commonjs/initUserAuth.d.ts +22 -0
- package/lib/typescript/commonjs/logger/index.d.ts +42 -0
- package/lib/typescript/commonjs/network/NetworkStatusBanner.d.ts +19 -0
- package/lib/typescript/commonjs/network/index.d.ts +5 -0
- package/lib/typescript/commonjs/network/networkStatus.d.ts +27 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/permissions/index.d.ts +20 -0
- package/lib/typescript/commonjs/storage/index.d.ts +42 -0
- package/lib/typescript/commonjs/theme/ThemeContext.d.ts +18 -0
- package/lib/typescript/commonjs/theme/index.d.ts +13 -0
- package/lib/typescript/commonjs/theme/merge.d.ts +3 -0
- package/lib/typescript/commonjs/theme/tokens.d.ts +4 -0
- package/lib/typescript/commonjs/theme/types.d.ts +161 -0
- package/lib/typescript/commonjs/utils/dimensions.d.ts +3 -0
- package/lib/typescript/commonjs/utils/hapticUtils.d.ts +4 -0
- package/lib/typescript/commonjs/utils/imageCompression.d.ts +15 -0
- package/lib/typescript/commonjs/utils/index.d.ts +10 -0
- package/lib/typescript/commonjs/utils/responsive.d.ts +23 -0
- package/lib/typescript/commonjs/utils/shadows.d.ts +4 -0
- package/lib/typescript/commonjs/utils/spacing.d.ts +61 -0
- package/lib/typescript/commonjs/validators/index.d.ts +46 -0
- package/lib/typescript/commonjs/versionCheck/index.d.ts +59 -0
- package/lib/typescript/module/api/publicClient.d.ts +11 -0
- package/lib/typescript/module/api/userClient.d.ts +18 -0
- package/lib/typescript/module/auth/authStore.d.ts +20 -0
- package/lib/typescript/module/auth/index.d.ts +5 -0
- package/lib/typescript/module/auth/jwt.d.ts +31 -0
- package/lib/typescript/module/components/Accordion/Accordion.d.ts +33 -0
- package/lib/typescript/module/components/Accordion/index.d.ts +3 -0
- package/lib/typescript/module/components/Avatar/Avatar.d.ts +42 -0
- package/lib/typescript/module/components/Avatar/index.d.ts +3 -0
- package/lib/typescript/module/components/Badge/Badge.d.ts +27 -0
- package/lib/typescript/module/components/Badge/index.d.ts +3 -0
- package/lib/typescript/module/components/Banner/Banner.d.ts +27 -0
- package/lib/typescript/module/components/Banner/index.d.ts +3 -0
- package/lib/typescript/module/components/BottomNavigation/BottomNavigation.d.ts +34 -0
- package/lib/typescript/module/components/BottomNavigation/index.d.ts +3 -0
- package/lib/typescript/module/components/BottomSheet/BottomSheet.d.ts +45 -0
- package/lib/typescript/module/components/BottomSheet/index.d.ts +3 -0
- package/lib/typescript/module/components/Button/Button.d.ts +29 -0
- package/lib/typescript/module/components/Button/index.d.ts +3 -0
- package/lib/typescript/module/components/Card/Card.d.ts +29 -0
- package/lib/typescript/module/components/Card/index.d.ts +3 -0
- package/lib/typescript/module/components/Carousel/Carousel.d.ts +66 -0
- package/lib/typescript/module/components/Carousel/index.d.ts +3 -0
- package/lib/typescript/module/components/Checkbox/Checkbox.d.ts +24 -0
- package/lib/typescript/module/components/Checkbox/index.d.ts +3 -0
- package/lib/typescript/module/components/Chip/Chip.d.ts +25 -0
- package/lib/typescript/module/components/Chip/index.d.ts +3 -0
- package/lib/typescript/module/components/DatePicker/DatePicker.d.ts +25 -0
- package/lib/typescript/module/components/DatePicker/index.d.ts +3 -0
- package/lib/typescript/module/components/DateRangePicker/DateRangePicker.d.ts +32 -0
- package/lib/typescript/module/components/DateRangePicker/index.d.ts +3 -0
- package/lib/typescript/module/components/Dialog/Dialog.d.ts +25 -0
- package/lib/typescript/module/components/Dialog/index.d.ts +3 -0
- package/lib/typescript/module/components/Divider/Divider.d.ts +21 -0
- package/lib/typescript/module/components/Divider/index.d.ts +3 -0
- package/lib/typescript/module/components/Drawer/Drawer.d.ts +53 -0
- package/lib/typescript/module/components/Drawer/index.d.ts +3 -0
- package/lib/typescript/module/components/EmptyState/EmptyState.d.ts +25 -0
- package/lib/typescript/module/components/EmptyState/index.d.ts +3 -0
- package/lib/typescript/module/components/FAB/FAB.d.ts +53 -0
- package/lib/typescript/module/components/FAB/index.d.ts +3 -0
- package/lib/typescript/module/components/Field/Field.d.ts +28 -0
- package/lib/typescript/module/components/Field/index.d.ts +3 -0
- package/lib/typescript/module/components/ForceUpdateDialog/ForceUpdateDialog.d.ts +39 -0
- package/lib/typescript/module/components/ForceUpdateDialog/index.d.ts +3 -0
- package/lib/typescript/module/components/Header/Header.d.ts +36 -0
- package/lib/typescript/module/components/Header/index.d.ts +3 -0
- package/lib/typescript/module/components/Icon/Icon.d.ts +20 -0
- package/lib/typescript/module/components/Icon/index.d.ts +3 -0
- package/lib/typescript/module/components/ImageGallery/ImageGallery.d.ts +41 -0
- package/lib/typescript/module/components/ImageGallery/index.d.ts +3 -0
- package/lib/typescript/module/components/Input/Input.d.ts +34 -0
- package/lib/typescript/module/components/Input/index.d.ts +3 -0
- package/lib/typescript/module/components/ListItem/ListItem.d.ts +30 -0
- package/lib/typescript/module/components/ListItem/index.d.ts +4 -0
- package/lib/typescript/module/components/LoadingSpinner/LoadingSpinner.d.ts +20 -0
- package/lib/typescript/module/components/LoadingSpinner/index.d.ts +3 -0
- package/lib/typescript/module/components/Modal/Modal.d.ts +29 -0
- package/lib/typescript/module/components/Modal/index.d.ts +3 -0
- package/lib/typescript/module/components/NumberInput/NumberInput.d.ts +35 -0
- package/lib/typescript/module/components/NumberInput/index.d.ts +3 -0
- package/lib/typescript/module/components/OTPInput/OTPInput.d.ts +29 -0
- package/lib/typescript/module/components/OTPInput/index.d.ts +3 -0
- package/lib/typescript/module/components/ProgressBar/ProgressBar.d.ts +21 -0
- package/lib/typescript/module/components/ProgressBar/index.d.ts +3 -0
- package/lib/typescript/module/components/Radio/Radio.d.ts +32 -0
- package/lib/typescript/module/components/Radio/RadioGroup.d.ts +16 -0
- package/lib/typescript/module/components/Radio/index.d.ts +5 -0
- package/lib/typescript/module/components/Rating/Rating.d.ts +22 -0
- package/lib/typescript/module/components/Rating/index.d.ts +3 -0
- package/lib/typescript/module/components/SearchBar/SearchBar.d.ts +28 -0
- package/lib/typescript/module/components/SearchBar/index.d.ts +3 -0
- package/lib/typescript/module/components/SegmentedControl/SegmentedControl.d.ts +36 -0
- package/lib/typescript/module/components/SegmentedControl/index.d.ts +3 -0
- package/lib/typescript/module/components/Select/Select.d.ts +48 -0
- package/lib/typescript/module/components/Select/index.d.ts +3 -0
- package/lib/typescript/module/components/SkeletonLoader/SkeletonContent.d.ts +29 -0
- package/lib/typescript/module/components/SkeletonLoader/SkeletonLoader.d.ts +42 -0
- package/lib/typescript/module/components/SkeletonLoader/index.d.ts +5 -0
- package/lib/typescript/module/components/Slider/Slider.d.ts +33 -0
- package/lib/typescript/module/components/Slider/index.d.ts +3 -0
- package/lib/typescript/module/components/Stepper/Stepper.d.ts +25 -0
- package/lib/typescript/module/components/Stepper/index.d.ts +3 -0
- package/lib/typescript/module/components/Swipeable/Swipeable.d.ts +45 -0
- package/lib/typescript/module/components/Swipeable/index.d.ts +3 -0
- package/lib/typescript/module/components/Switch/Switch.d.ts +24 -0
- package/lib/typescript/module/components/Switch/index.d.ts +3 -0
- package/lib/typescript/module/components/Tabs/Tabs.d.ts +37 -0
- package/lib/typescript/module/components/Tabs/index.d.ts +3 -0
- package/lib/typescript/module/components/TimePicker/TimePicker.d.ts +26 -0
- package/lib/typescript/module/components/TimePicker/index.d.ts +3 -0
- package/lib/typescript/module/components/Toast/Toast.d.ts +30 -0
- package/lib/typescript/module/components/Toast/ToastProvider.d.ts +26 -0
- package/lib/typescript/module/components/Toast/index.d.ts +5 -0
- package/lib/typescript/module/components/Tooltip/Tooltip.d.ts +22 -0
- package/lib/typescript/module/components/Tooltip/index.d.ts +3 -0
- package/lib/typescript/module/components/index.d.ts +89 -0
- package/lib/typescript/module/config/index.d.ts +40 -0
- package/lib/typescript/module/formatters/currency.d.ts +24 -0
- package/lib/typescript/module/formatters/date.d.ts +22 -0
- package/lib/typescript/module/formatters/index.d.ts +8 -0
- package/lib/typescript/module/formatters/initials.d.ts +11 -0
- package/lib/typescript/module/formatters/number.d.ts +15 -0
- package/lib/typescript/module/formatters/phone.d.ts +13 -0
- package/lib/typescript/module/hooks/index.d.ts +6 -0
- package/lib/typescript/module/hooks/useDebounce.d.ts +2 -0
- package/lib/typescript/module/hooks/usePressAnimation.d.ts +14 -0
- package/lib/typescript/module/hooks/useToggle.d.ts +9 -0
- package/lib/typescript/module/index.d.ts +37 -0
- package/lib/typescript/module/initSDK.d.ts +40 -0
- package/lib/typescript/module/initUI.d.ts +12 -0
- package/lib/typescript/module/initUserAuth.d.ts +22 -0
- package/lib/typescript/module/logger/index.d.ts +42 -0
- package/lib/typescript/module/network/NetworkStatusBanner.d.ts +19 -0
- package/lib/typescript/module/network/index.d.ts +5 -0
- package/lib/typescript/module/network/networkStatus.d.ts +27 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/permissions/index.d.ts +20 -0
- package/lib/typescript/module/storage/index.d.ts +42 -0
- package/lib/typescript/module/theme/ThemeContext.d.ts +18 -0
- package/lib/typescript/module/theme/index.d.ts +13 -0
- package/lib/typescript/module/theme/merge.d.ts +3 -0
- package/lib/typescript/module/theme/tokens.d.ts +4 -0
- package/lib/typescript/module/theme/types.d.ts +161 -0
- package/lib/typescript/module/utils/dimensions.d.ts +3 -0
- package/lib/typescript/module/utils/hapticUtils.d.ts +4 -0
- package/lib/typescript/module/utils/imageCompression.d.ts +15 -0
- package/lib/typescript/module/utils/index.d.ts +10 -0
- package/lib/typescript/module/utils/responsive.d.ts +23 -0
- package/lib/typescript/module/utils/shadows.d.ts +4 -0
- package/lib/typescript/module/utils/spacing.d.ts +61 -0
- package/lib/typescript/module/validators/index.d.ts +46 -0
- package/lib/typescript/module/versionCheck/index.d.ts +59 -0
- package/package.json +137 -0
|
@@ -0,0 +1,545 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { AccessibilityInfo, Animated, Easing, FlatList, Modal, Platform, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
5
|
+
import { useTheme } from "../../theme/index.js";
|
|
6
|
+
import { triggerHaptic } from "../../utils/hapticUtils.js";
|
|
7
|
+
import Button from "../Button/Button.js";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
|
+
const ITEM_HEIGHT = 40;
|
|
10
|
+
const VISIBLE_ITEMS = 5;
|
|
11
|
+
const PICKER_HEIGHT = ITEM_HEIGHT * VISIBLE_ITEMS;
|
|
12
|
+
const CENTER_OFFSET = Math.floor(VISIBLE_ITEMS / 2);
|
|
13
|
+
const HAPTIC_DEBOUNCE_MS = 35;
|
|
14
|
+
const range = (start, endInclusive, step = 1) => {
|
|
15
|
+
const out = [];
|
|
16
|
+
for (let v = start; v <= endInclusive; v += step) out.push(v);
|
|
17
|
+
return out;
|
|
18
|
+
};
|
|
19
|
+
const pad2 = n => n.toString().padStart(2, '0');
|
|
20
|
+
const to24h = (hour, period, format) => {
|
|
21
|
+
if (format === '24h') return hour;
|
|
22
|
+
if (period === 'AM') return hour === 12 ? 0 : hour;
|
|
23
|
+
return hour === 12 ? 12 : hour + 12;
|
|
24
|
+
};
|
|
25
|
+
const from24h = (hour, format) => {
|
|
26
|
+
if (format === '24h') return {
|
|
27
|
+
displayHour: hour,
|
|
28
|
+
period: 'AM'
|
|
29
|
+
};
|
|
30
|
+
if (hour === 0) return {
|
|
31
|
+
displayHour: 12,
|
|
32
|
+
period: 'AM'
|
|
33
|
+
};
|
|
34
|
+
if (hour === 12) return {
|
|
35
|
+
displayHour: 12,
|
|
36
|
+
period: 'PM'
|
|
37
|
+
};
|
|
38
|
+
if (hour > 12) return {
|
|
39
|
+
displayHour: hour - 12,
|
|
40
|
+
period: 'PM'
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
displayHour: hour,
|
|
44
|
+
period: 'AM'
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
const clampMinuteToStep = (minute, step) => {
|
|
48
|
+
const rounded = Math.round(minute / step) * step;
|
|
49
|
+
return Math.min(59, Math.max(0, rounded));
|
|
50
|
+
};
|
|
51
|
+
const Wheel = ({
|
|
52
|
+
kind,
|
|
53
|
+
label,
|
|
54
|
+
data,
|
|
55
|
+
selectedIndex,
|
|
56
|
+
onIndexChange,
|
|
57
|
+
formatItem,
|
|
58
|
+
theme,
|
|
59
|
+
testID
|
|
60
|
+
}) => {
|
|
61
|
+
const listRef = useRef(null);
|
|
62
|
+
const scrollY = useRef(new Animated.Value(selectedIndex * ITEM_HEIGHT)).current;
|
|
63
|
+
const lastIndexRef = useRef(selectedIndex);
|
|
64
|
+
const lastHapticAtRef = useRef(0);
|
|
65
|
+
|
|
66
|
+
// Keep list aligned when selectedIndex changes externally (e.g. value prop, format flip).
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (lastIndexRef.current !== selectedIndex) {
|
|
69
|
+
lastIndexRef.current = selectedIndex;
|
|
70
|
+
const offset = selectedIndex * ITEM_HEIGHT;
|
|
71
|
+
scrollY.setValue(offset);
|
|
72
|
+
// Defer to next frame so FlatList has measured.
|
|
73
|
+
requestAnimationFrame(() => {
|
|
74
|
+
listRef.current?.scrollToOffset({
|
|
75
|
+
offset,
|
|
76
|
+
animated: false
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}, [selectedIndex, scrollY]);
|
|
81
|
+
const onScroll = useMemo(() => Animated.event([{
|
|
82
|
+
nativeEvent: {
|
|
83
|
+
contentOffset: {
|
|
84
|
+
y: scrollY
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}], {
|
|
88
|
+
useNativeDriver: true,
|
|
89
|
+
listener: event => {
|
|
90
|
+
const y = event.nativeEvent.contentOffset.y;
|
|
91
|
+
const idx = Math.round(y / ITEM_HEIGHT);
|
|
92
|
+
if (idx !== lastIndexRef.current && idx >= 0 && idx < data.length) {
|
|
93
|
+
const now = Date.now();
|
|
94
|
+
if (now - lastHapticAtRef.current >= HAPTIC_DEBOUNCE_MS) {
|
|
95
|
+
triggerHaptic('selection');
|
|
96
|
+
lastHapticAtRef.current = now;
|
|
97
|
+
}
|
|
98
|
+
lastIndexRef.current = idx;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}), [scrollY, data.length]);
|
|
102
|
+
const onMomentumScrollEnd = useCallback(event => {
|
|
103
|
+
const y = event.nativeEvent.contentOffset.y;
|
|
104
|
+
const idx = Math.max(0, Math.min(data.length - 1, Math.round(y / ITEM_HEIGHT)));
|
|
105
|
+
if (idx !== selectedIndex) onIndexChange(idx);
|
|
106
|
+
}, [data.length, onIndexChange, selectedIndex]);
|
|
107
|
+
const handleA11yAction = useCallback(event => {
|
|
108
|
+
const action = event.nativeEvent.actionName;
|
|
109
|
+
if (action === 'increment') {
|
|
110
|
+
const next = Math.min(data.length - 1, selectedIndex + 1);
|
|
111
|
+
if (next !== selectedIndex) onIndexChange(next);
|
|
112
|
+
} else if (action === 'decrement') {
|
|
113
|
+
const next = Math.max(0, selectedIndex - 1);
|
|
114
|
+
if (next !== selectedIndex) onIndexChange(next);
|
|
115
|
+
}
|
|
116
|
+
}, [data.length, onIndexChange, selectedIndex]);
|
|
117
|
+
const renderItem = useCallback(({
|
|
118
|
+
item,
|
|
119
|
+
index
|
|
120
|
+
}) => {
|
|
121
|
+
const distance = Animated.subtract(Animated.divide(scrollY, ITEM_HEIGHT), index);
|
|
122
|
+
const opacity = distance.interpolate({
|
|
123
|
+
inputRange: [-2, -1, 0, 1, 2],
|
|
124
|
+
outputRange: [0.3, 0.6, 1, 0.6, 0.3],
|
|
125
|
+
extrapolate: 'clamp'
|
|
126
|
+
});
|
|
127
|
+
const scale = distance.interpolate({
|
|
128
|
+
inputRange: [-2, -1, 0, 1, 2],
|
|
129
|
+
outputRange: [0.85, 0.95, 1.05, 0.95, 0.85],
|
|
130
|
+
extrapolate: 'clamp'
|
|
131
|
+
});
|
|
132
|
+
const isSelected = index === selectedIndex;
|
|
133
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
134
|
+
style: [styles.wheelItem, {
|
|
135
|
+
opacity,
|
|
136
|
+
transform: [{
|
|
137
|
+
scale
|
|
138
|
+
}]
|
|
139
|
+
}],
|
|
140
|
+
accessible: false,
|
|
141
|
+
importantForAccessibility: "no",
|
|
142
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
143
|
+
style: [{
|
|
144
|
+
fontSize: theme.typography.fontSize.xl,
|
|
145
|
+
color: isSelected ? theme.colors.text.primary : theme.colors.text.secondary,
|
|
146
|
+
fontWeight: isSelected ? theme.typography.fontWeight.semibold : theme.typography.fontWeight.medium,
|
|
147
|
+
letterSpacing: theme.typography.letterSpacing.normal
|
|
148
|
+
}],
|
|
149
|
+
children: formatItem(item)
|
|
150
|
+
})
|
|
151
|
+
});
|
|
152
|
+
}, [scrollY, selectedIndex, theme, formatItem]);
|
|
153
|
+
const keyExtractor = useCallback((item, index) => `${kind}-${String(item)}-${index}`, [kind]);
|
|
154
|
+
const getItemLayout = useCallback((_data, index) => ({
|
|
155
|
+
length: ITEM_HEIGHT,
|
|
156
|
+
offset: ITEM_HEIGHT * index,
|
|
157
|
+
index
|
|
158
|
+
}), []);
|
|
159
|
+
const currentValueText = formatItem(data[selectedIndex] ?? '');
|
|
160
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
161
|
+
style: styles.wheelColumn,
|
|
162
|
+
testID: testID,
|
|
163
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
164
|
+
style: styles.wheelA11yLayer,
|
|
165
|
+
accessible: true,
|
|
166
|
+
accessibilityRole: "adjustable",
|
|
167
|
+
accessibilityLabel: label,
|
|
168
|
+
accessibilityValue: {
|
|
169
|
+
text: currentValueText
|
|
170
|
+
},
|
|
171
|
+
accessibilityActions: [{
|
|
172
|
+
name: 'increment'
|
|
173
|
+
}, {
|
|
174
|
+
name: 'decrement'
|
|
175
|
+
}],
|
|
176
|
+
onAccessibilityAction: handleA11yAction
|
|
177
|
+
}), /*#__PURE__*/_jsx(FlatList, {
|
|
178
|
+
ref: listRef,
|
|
179
|
+
data: data,
|
|
180
|
+
keyExtractor: keyExtractor,
|
|
181
|
+
renderItem: renderItem,
|
|
182
|
+
getItemLayout: getItemLayout,
|
|
183
|
+
showsVerticalScrollIndicator: false,
|
|
184
|
+
snapToInterval: ITEM_HEIGHT,
|
|
185
|
+
snapToAlignment: "start",
|
|
186
|
+
decelerationRate: "fast",
|
|
187
|
+
bounces: false,
|
|
188
|
+
scrollEventThrottle: 16,
|
|
189
|
+
onScroll: onScroll,
|
|
190
|
+
onMomentumScrollEnd: onMomentumScrollEnd,
|
|
191
|
+
contentContainerStyle: {
|
|
192
|
+
paddingVertical: ITEM_HEIGHT * CENTER_OFFSET
|
|
193
|
+
},
|
|
194
|
+
initialScrollIndex: selectedIndex,
|
|
195
|
+
style: styles.wheelList,
|
|
196
|
+
importantForAccessibility: "no-hide-descendants"
|
|
197
|
+
})]
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
const TimePicker = ({
|
|
201
|
+
visible,
|
|
202
|
+
value,
|
|
203
|
+
onSelect,
|
|
204
|
+
onClose,
|
|
205
|
+
format = '12h',
|
|
206
|
+
minuteStep = 1,
|
|
207
|
+
title = 'Select Time',
|
|
208
|
+
confirmLabel = 'Confirm',
|
|
209
|
+
cancelLabel = 'Cancel',
|
|
210
|
+
testID,
|
|
211
|
+
style
|
|
212
|
+
}) => {
|
|
213
|
+
const theme = useTheme();
|
|
214
|
+
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
215
|
+
const hours = useMemo(() => format === '24h' ? range(0, 23) : range(1, 12), [format]);
|
|
216
|
+
const minutes = useMemo(() => range(0, 59, minuteStep), [minuteStep]);
|
|
217
|
+
const periods = useMemo(() => ['AM', 'PM'], []);
|
|
218
|
+
const initial = useMemo(() => {
|
|
219
|
+
const h24 = value && Number.isFinite(value.hour) ? value.hour : new Date().getHours();
|
|
220
|
+
const m = value && Number.isFinite(value.minute) ? value.minute : new Date().getMinutes();
|
|
221
|
+
const minute = clampMinuteToStep(m, minuteStep);
|
|
222
|
+
const {
|
|
223
|
+
displayHour,
|
|
224
|
+
period
|
|
225
|
+
} = from24h(h24, format);
|
|
226
|
+
return {
|
|
227
|
+
displayHour,
|
|
228
|
+
minute,
|
|
229
|
+
period,
|
|
230
|
+
hour24: h24
|
|
231
|
+
};
|
|
232
|
+
}, [value, format, minuteStep]);
|
|
233
|
+
const [hourIndex, setHourIndex] = useState(() => {
|
|
234
|
+
const idx = hours.indexOf(initial.displayHour);
|
|
235
|
+
return idx >= 0 ? idx : 0;
|
|
236
|
+
});
|
|
237
|
+
const [minuteIndex, setMinuteIndex] = useState(() => {
|
|
238
|
+
const idx = minutes.indexOf(initial.minute);
|
|
239
|
+
return idx >= 0 ? idx : 0;
|
|
240
|
+
});
|
|
241
|
+
const [periodIndex, setPeriodIndex] = useState(() => initial.period === 'PM' ? 1 : 0);
|
|
242
|
+
|
|
243
|
+
// Re-sync on visible toggle / value change / format / step.
|
|
244
|
+
useEffect(() => {
|
|
245
|
+
if (!visible) return;
|
|
246
|
+
const h24 = value && Number.isFinite(value.hour) ? value.hour : new Date().getHours();
|
|
247
|
+
const m = value && Number.isFinite(value.minute) ? value.minute : new Date().getMinutes();
|
|
248
|
+
const stepped = clampMinuteToStep(m, minuteStep);
|
|
249
|
+
const {
|
|
250
|
+
displayHour,
|
|
251
|
+
period
|
|
252
|
+
} = from24h(h24, format);
|
|
253
|
+
const hIdx = hours.indexOf(displayHour);
|
|
254
|
+
setHourIndex(hIdx >= 0 ? hIdx : 0);
|
|
255
|
+
const mIdx = minutes.indexOf(stepped);
|
|
256
|
+
setMinuteIndex(mIdx >= 0 ? mIdx : 0);
|
|
257
|
+
setPeriodIndex(period === 'PM' ? 1 : 0);
|
|
258
|
+
}, [visible, value, format, minuteStep, hours, minutes]);
|
|
259
|
+
|
|
260
|
+
// Sheet animations.
|
|
261
|
+
const opacity = useRef(new Animated.Value(0)).current;
|
|
262
|
+
const translateY = useRef(new Animated.Value(40)).current;
|
|
263
|
+
useEffect(() => {
|
|
264
|
+
if (visible) {
|
|
265
|
+
Animated.parallel([Animated.timing(opacity, {
|
|
266
|
+
toValue: 1,
|
|
267
|
+
duration: theme.motion.duration.normal,
|
|
268
|
+
easing: Easing.out(Easing.cubic),
|
|
269
|
+
useNativeDriver: true
|
|
270
|
+
}), Animated.spring(translateY, {
|
|
271
|
+
toValue: 0,
|
|
272
|
+
damping: theme.motion.spring.snappy.damping,
|
|
273
|
+
stiffness: theme.motion.spring.snappy.stiffness,
|
|
274
|
+
mass: theme.motion.spring.snappy.mass,
|
|
275
|
+
useNativeDriver: true
|
|
276
|
+
})]).start();
|
|
277
|
+
} else {
|
|
278
|
+
opacity.setValue(0);
|
|
279
|
+
translateY.setValue(40);
|
|
280
|
+
}
|
|
281
|
+
}, [visible, opacity, translateY, theme.motion]);
|
|
282
|
+
const announce = useCallback(msg => {
|
|
283
|
+
if (Platform.OS === 'ios' || Platform.OS === 'android') {
|
|
284
|
+
AccessibilityInfo.announceForAccessibility(msg);
|
|
285
|
+
}
|
|
286
|
+
}, []);
|
|
287
|
+
const handleHourIndex = useCallback(idx => {
|
|
288
|
+
setHourIndex(idx);
|
|
289
|
+
announce(`Hour ${hours[idx]}`);
|
|
290
|
+
}, [hours, announce]);
|
|
291
|
+
const handleMinuteIndex = useCallback(idx => {
|
|
292
|
+
setMinuteIndex(idx);
|
|
293
|
+
announce(`${minutes[idx]} minutes`);
|
|
294
|
+
}, [minutes, announce]);
|
|
295
|
+
const handlePeriodIndex = useCallback(idx => {
|
|
296
|
+
setPeriodIndex(idx);
|
|
297
|
+
announce(periods[idx] ?? '');
|
|
298
|
+
}, [periods, announce]);
|
|
299
|
+
const handleCancel = useCallback(() => {
|
|
300
|
+
triggerHaptic('selection');
|
|
301
|
+
onClose();
|
|
302
|
+
}, [onClose]);
|
|
303
|
+
const handleConfirm = useCallback(() => {
|
|
304
|
+
const displayHour = hours[hourIndex] ?? 0;
|
|
305
|
+
const period = periods[periodIndex] ?? 'AM';
|
|
306
|
+
const hour24 = to24h(displayHour, period, format);
|
|
307
|
+
const minute = minutes[minuteIndex] ?? 0;
|
|
308
|
+
triggerHaptic('notificationSuccess');
|
|
309
|
+
onSelect({
|
|
310
|
+
hour: hour24,
|
|
311
|
+
minute
|
|
312
|
+
});
|
|
313
|
+
onClose();
|
|
314
|
+
}, [hours, hourIndex, periods, periodIndex, minutes, minuteIndex, format, onSelect, onClose]);
|
|
315
|
+
const summary = useMemo(() => {
|
|
316
|
+
const displayHour = hours[hourIndex] ?? 0;
|
|
317
|
+
const minute = minutes[minuteIndex] ?? 0;
|
|
318
|
+
if (format === '24h') return `${pad2(displayHour)}:${pad2(minute)}`;
|
|
319
|
+
const period = periods[periodIndex] ?? 'AM';
|
|
320
|
+
return `${pad2(displayHour)}:${pad2(minute)} ${period}`;
|
|
321
|
+
}, [hours, hourIndex, minutes, minuteIndex, periods, periodIndex, format]);
|
|
322
|
+
const formatHourItem = useCallback(item => pad2(Number(item)), []);
|
|
323
|
+
const formatMinuteItem = useCallback(item => pad2(Number(item)), []);
|
|
324
|
+
const formatPeriodItem = useCallback(item => String(item), []);
|
|
325
|
+
return /*#__PURE__*/_jsx(Modal, {
|
|
326
|
+
visible: visible,
|
|
327
|
+
transparent: true,
|
|
328
|
+
statusBarTranslucent: true,
|
|
329
|
+
animationType: "none",
|
|
330
|
+
onRequestClose: onClose,
|
|
331
|
+
testID: testID,
|
|
332
|
+
children: /*#__PURE__*/_jsxs(Animated.View, {
|
|
333
|
+
style: [styles.backdrop, {
|
|
334
|
+
opacity
|
|
335
|
+
}],
|
|
336
|
+
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
337
|
+
style: StyleSheet.absoluteFill,
|
|
338
|
+
onPress: onClose,
|
|
339
|
+
accessibilityLabel: "Close time picker",
|
|
340
|
+
accessibilityRole: "button"
|
|
341
|
+
}), /*#__PURE__*/_jsxs(Animated.View, {
|
|
342
|
+
style: [styles.sheet, {
|
|
343
|
+
transform: [{
|
|
344
|
+
translateY
|
|
345
|
+
}]
|
|
346
|
+
}, style],
|
|
347
|
+
accessibilityViewIsModal: true,
|
|
348
|
+
accessible: true,
|
|
349
|
+
accessibilityRole: "none",
|
|
350
|
+
accessibilityLabel: title,
|
|
351
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
352
|
+
style: styles.handle
|
|
353
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
354
|
+
style: styles.title,
|
|
355
|
+
accessibilityRole: "header",
|
|
356
|
+
children: title
|
|
357
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
358
|
+
style: styles.summaryWrap,
|
|
359
|
+
accessibilityLiveRegion: "polite",
|
|
360
|
+
accessibilityLabel: `Selected ${summary}`,
|
|
361
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
362
|
+
style: styles.summary,
|
|
363
|
+
children: summary
|
|
364
|
+
})
|
|
365
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
366
|
+
style: styles.wheelsRow,
|
|
367
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
368
|
+
pointerEvents: "none",
|
|
369
|
+
style: styles.selectionBand,
|
|
370
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
371
|
+
style: styles.bandLine
|
|
372
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
373
|
+
style: [styles.bandLine, styles.bandLineBottom]
|
|
374
|
+
})]
|
|
375
|
+
}), /*#__PURE__*/_jsx(Wheel, {
|
|
376
|
+
kind: "hour",
|
|
377
|
+
label: "Hour",
|
|
378
|
+
data: hours,
|
|
379
|
+
selectedIndex: hourIndex,
|
|
380
|
+
onIndexChange: handleHourIndex,
|
|
381
|
+
formatItem: formatHourItem,
|
|
382
|
+
theme: theme,
|
|
383
|
+
testID: "time-picker-hour"
|
|
384
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
385
|
+
style: styles.separator,
|
|
386
|
+
children: ":"
|
|
387
|
+
}), /*#__PURE__*/_jsx(Wheel, {
|
|
388
|
+
kind: "minute",
|
|
389
|
+
label: "Minute",
|
|
390
|
+
data: minutes,
|
|
391
|
+
selectedIndex: minuteIndex,
|
|
392
|
+
onIndexChange: handleMinuteIndex,
|
|
393
|
+
formatItem: formatMinuteItem,
|
|
394
|
+
theme: theme,
|
|
395
|
+
testID: "time-picker-minute"
|
|
396
|
+
}), format === '12h' ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
397
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
398
|
+
style: styles.spacer
|
|
399
|
+
}), /*#__PURE__*/_jsx(Wheel, {
|
|
400
|
+
kind: "period",
|
|
401
|
+
label: "Period",
|
|
402
|
+
data: periods,
|
|
403
|
+
selectedIndex: periodIndex,
|
|
404
|
+
onIndexChange: handlePeriodIndex,
|
|
405
|
+
formatItem: formatPeriodItem,
|
|
406
|
+
theme: theme,
|
|
407
|
+
testID: "time-picker-period"
|
|
408
|
+
})]
|
|
409
|
+
}) : null]
|
|
410
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
411
|
+
style: styles.footer,
|
|
412
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
413
|
+
title: cancelLabel,
|
|
414
|
+
variant: "ghost",
|
|
415
|
+
tone: "neutral",
|
|
416
|
+
onPress: handleCancel,
|
|
417
|
+
style: styles.footerBtn,
|
|
418
|
+
accessibilityHint: "Dismiss without changes",
|
|
419
|
+
testID: "time-picker-cancel"
|
|
420
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
421
|
+
title: confirmLabel,
|
|
422
|
+
variant: "solid",
|
|
423
|
+
tone: "primary",
|
|
424
|
+
haptic: false,
|
|
425
|
+
onPress: handleConfirm,
|
|
426
|
+
style: styles.footerBtn,
|
|
427
|
+
accessibilityHint: "Confirm selected time",
|
|
428
|
+
testID: "time-picker-confirm"
|
|
429
|
+
})]
|
|
430
|
+
})]
|
|
431
|
+
})]
|
|
432
|
+
})
|
|
433
|
+
});
|
|
434
|
+
};
|
|
435
|
+
const styles = StyleSheet.create({
|
|
436
|
+
wheelColumn: {
|
|
437
|
+
width: 64,
|
|
438
|
+
height: PICKER_HEIGHT,
|
|
439
|
+
overflow: 'hidden'
|
|
440
|
+
},
|
|
441
|
+
wheelList: {
|
|
442
|
+
flexGrow: 0,
|
|
443
|
+
height: PICKER_HEIGHT
|
|
444
|
+
},
|
|
445
|
+
wheelItem: {
|
|
446
|
+
height: ITEM_HEIGHT,
|
|
447
|
+
alignItems: 'center',
|
|
448
|
+
justifyContent: 'center'
|
|
449
|
+
},
|
|
450
|
+
wheelA11yLayer: {
|
|
451
|
+
...StyleSheet.absoluteFillObject,
|
|
452
|
+
zIndex: 2
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
const buildStyles = theme => {
|
|
456
|
+
const sheetShadow = theme.shadows.xl;
|
|
457
|
+
return StyleSheet.create({
|
|
458
|
+
backdrop: {
|
|
459
|
+
flex: 1,
|
|
460
|
+
backgroundColor: theme.colors.background.overlay,
|
|
461
|
+
justifyContent: 'flex-end'
|
|
462
|
+
},
|
|
463
|
+
sheet: {
|
|
464
|
+
backgroundColor: theme.colors.background.elevated,
|
|
465
|
+
borderTopLeftRadius: theme.radius.xl,
|
|
466
|
+
borderTopRightRadius: theme.radius.xl,
|
|
467
|
+
paddingTop: theme.spacing.sm,
|
|
468
|
+
paddingHorizontal: theme.spacing.lg,
|
|
469
|
+
paddingBottom: theme.spacing.xl,
|
|
470
|
+
shadowColor: sheetShadow.shadowColor,
|
|
471
|
+
shadowOffset: sheetShadow.shadowOffset,
|
|
472
|
+
shadowOpacity: sheetShadow.shadowOpacity,
|
|
473
|
+
shadowRadius: sheetShadow.shadowRadius,
|
|
474
|
+
elevation: sheetShadow.elevation
|
|
475
|
+
},
|
|
476
|
+
handle: {
|
|
477
|
+
alignSelf: 'center',
|
|
478
|
+
width: 36,
|
|
479
|
+
height: 4,
|
|
480
|
+
borderRadius: theme.radius.full,
|
|
481
|
+
backgroundColor: theme.colors.border.secondary,
|
|
482
|
+
marginBottom: theme.spacing.sm
|
|
483
|
+
},
|
|
484
|
+
title: {
|
|
485
|
+
textAlign: 'center',
|
|
486
|
+
fontSize: theme.typography.fontSize.lg,
|
|
487
|
+
fontWeight: theme.typography.fontWeight.semibold,
|
|
488
|
+
color: theme.colors.text.primary,
|
|
489
|
+
marginBottom: theme.spacing.sm
|
|
490
|
+
},
|
|
491
|
+
summaryWrap: {
|
|
492
|
+
alignItems: 'center',
|
|
493
|
+
marginBottom: theme.spacing.md
|
|
494
|
+
},
|
|
495
|
+
summary: {
|
|
496
|
+
fontSize: theme.typography.fontSize['2xl'],
|
|
497
|
+
fontWeight: theme.typography.fontWeight.bold,
|
|
498
|
+
color: theme.colors.primary,
|
|
499
|
+
letterSpacing: theme.typography.letterSpacing.wide
|
|
500
|
+
},
|
|
501
|
+
wheelsRow: {
|
|
502
|
+
flexDirection: 'row',
|
|
503
|
+
alignItems: 'center',
|
|
504
|
+
justifyContent: 'center',
|
|
505
|
+
height: PICKER_HEIGHT,
|
|
506
|
+
position: 'relative',
|
|
507
|
+
marginBottom: theme.spacing.lg
|
|
508
|
+
},
|
|
509
|
+
selectionBand: {
|
|
510
|
+
position: 'absolute',
|
|
511
|
+
left: 0,
|
|
512
|
+
right: 0,
|
|
513
|
+
top: ITEM_HEIGHT * CENTER_OFFSET,
|
|
514
|
+
height: ITEM_HEIGHT,
|
|
515
|
+
justifyContent: 'space-between'
|
|
516
|
+
},
|
|
517
|
+
bandLine: {
|
|
518
|
+
height: StyleSheet.hairlineWidth * 2,
|
|
519
|
+
backgroundColor: theme.colors.primary,
|
|
520
|
+
opacity: 0.85
|
|
521
|
+
},
|
|
522
|
+
bandLineBottom: {
|
|
523
|
+
// visual rhythm only — same color as top
|
|
524
|
+
},
|
|
525
|
+
separator: {
|
|
526
|
+
fontSize: theme.typography.fontSize['2xl'],
|
|
527
|
+
fontWeight: theme.typography.fontWeight.bold,
|
|
528
|
+
color: theme.colors.text.primary,
|
|
529
|
+
paddingHorizontal: theme.spacing.xs
|
|
530
|
+
},
|
|
531
|
+
spacer: {
|
|
532
|
+
width: theme.spacing.md
|
|
533
|
+
},
|
|
534
|
+
footer: {
|
|
535
|
+
flexDirection: 'row',
|
|
536
|
+
gap: theme.spacing.sm
|
|
537
|
+
},
|
|
538
|
+
footerBtn: {
|
|
539
|
+
flex: 1
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
|
+
};
|
|
543
|
+
export { TimePicker };
|
|
544
|
+
export default TimePicker;
|
|
545
|
+
//# sourceMappingURL=TimePicker.js.map
|