@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,808 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { AccessibilityInfo, Animated, Easing, Modal, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
5
|
+
import { useTheme } from "../../theme/index.js";
|
|
6
|
+
import { triggerHaptic } from "../../utils/index.js";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
8
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
9
|
+
const GRID_SIZE = 12; // 4 cols x 3 rows for year / decade grids
|
|
10
|
+
const DECADE_SPAN = 10;
|
|
11
|
+
const startOfDay = date => {
|
|
12
|
+
const d = new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
13
|
+
return d;
|
|
14
|
+
};
|
|
15
|
+
const isSameDay = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
16
|
+
const toIso = date => {
|
|
17
|
+
const y = date.getFullYear();
|
|
18
|
+
const m = String(date.getMonth() + 1).padStart(2, '0');
|
|
19
|
+
const d = String(date.getDate()).padStart(2, '0');
|
|
20
|
+
return `${y}-${m}-${d}`;
|
|
21
|
+
};
|
|
22
|
+
const addMonths = (date, delta) => new Date(date.getFullYear(), date.getMonth() + delta, 1);
|
|
23
|
+
const buildMonthMatrix = (anchor, weekStartsOn) => {
|
|
24
|
+
const year = anchor.getFullYear();
|
|
25
|
+
const month = anchor.getMonth();
|
|
26
|
+
const firstOfMonth = new Date(year, month, 1);
|
|
27
|
+
const firstWeekday = firstOfMonth.getDay();
|
|
28
|
+
const offset = (firstWeekday - weekStartsOn + 7) % 7;
|
|
29
|
+
const gridStart = new Date(year, month, 1 - offset);
|
|
30
|
+
const cells = [];
|
|
31
|
+
for (let i = 0; i < 42; i += 1) {
|
|
32
|
+
const d = new Date(gridStart.getTime() + i * DAY_MS);
|
|
33
|
+
cells.push({
|
|
34
|
+
date: d,
|
|
35
|
+
inMonth: d.getMonth() === month,
|
|
36
|
+
iso: toIso(d)
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return cells;
|
|
40
|
+
};
|
|
41
|
+
const weekdayLabels = (locale, weekStartsOn) => {
|
|
42
|
+
// Reference Sunday Jan 4 1970 (weekday 0) — pick 7 consecutive days starting at weekStartsOn.
|
|
43
|
+
const fmt = new Intl.DateTimeFormat(locale, {
|
|
44
|
+
weekday: 'short'
|
|
45
|
+
});
|
|
46
|
+
const labels = [];
|
|
47
|
+
for (let i = 0; i < 7; i += 1) {
|
|
48
|
+
const day = (weekStartsOn + i) % 7;
|
|
49
|
+
// Jan 4 1970 = Sunday (day 0); shift to the right weekday.
|
|
50
|
+
const ref = new Date(1970, 0, 4 + day);
|
|
51
|
+
labels.push(fmt.format(ref));
|
|
52
|
+
}
|
|
53
|
+
return labels;
|
|
54
|
+
};
|
|
55
|
+
const formatMonthYear = (date, locale) => new Intl.DateTimeFormat(locale, {
|
|
56
|
+
month: 'long',
|
|
57
|
+
year: 'numeric'
|
|
58
|
+
}).format(date);
|
|
59
|
+
const formatLongDate = (date, locale) => new Intl.DateTimeFormat(locale, {
|
|
60
|
+
weekday: 'long',
|
|
61
|
+
year: 'numeric',
|
|
62
|
+
month: 'long',
|
|
63
|
+
day: 'numeric'
|
|
64
|
+
}).format(date);
|
|
65
|
+
const decadeStartFor = year => Math.floor(year / DECADE_SPAN) * DECADE_SPAN;
|
|
66
|
+
|
|
67
|
+
// 12 years centered on the anchor year: 4 prior, anchor, 7 following.
|
|
68
|
+
const buildYearCells = anchorYear => {
|
|
69
|
+
const start = anchorYear - 4;
|
|
70
|
+
return Array.from({
|
|
71
|
+
length: GRID_SIZE
|
|
72
|
+
}, (_, i) => start + i);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// 12 decades centered on the anchor decade: 4 prior, anchor decade, 7 following.
|
|
76
|
+
const buildDecadeCells = anchorYear => {
|
|
77
|
+
const startDecade = decadeStartFor(anchorYear) - 4 * DECADE_SPAN;
|
|
78
|
+
return Array.from({
|
|
79
|
+
length: GRID_SIZE
|
|
80
|
+
}, (_, i) => startDecade + i * DECADE_SPAN);
|
|
81
|
+
};
|
|
82
|
+
const DatePicker = props => {
|
|
83
|
+
const {
|
|
84
|
+
visible,
|
|
85
|
+
value,
|
|
86
|
+
onSelect,
|
|
87
|
+
onClose,
|
|
88
|
+
minDate,
|
|
89
|
+
maxDate,
|
|
90
|
+
disabledDates,
|
|
91
|
+
mode = 'modal',
|
|
92
|
+
locale = 'en-IN',
|
|
93
|
+
weekStartsOn = 0,
|
|
94
|
+
title = 'Select Date',
|
|
95
|
+
confirmLabel = 'Confirm',
|
|
96
|
+
cancelLabel = 'Cancel',
|
|
97
|
+
style,
|
|
98
|
+
testID
|
|
99
|
+
} = props;
|
|
100
|
+
const theme = useTheme();
|
|
101
|
+
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
102
|
+
const today = useMemo(() => startOfDay(new Date()), []);
|
|
103
|
+
const initialAnchor = value ? startOfDay(value) : today;
|
|
104
|
+
const [anchor, setAnchor] = useState(initialAnchor);
|
|
105
|
+
const [pendingDate, setPendingDate] = useState(value ? startOfDay(value) : null);
|
|
106
|
+
const [viewMode, setViewMode] = useState('days');
|
|
107
|
+
|
|
108
|
+
// Animations
|
|
109
|
+
const backdrop = useRef(new Animated.Value(0)).current;
|
|
110
|
+
const sheet = useRef(new Animated.Value(0)).current;
|
|
111
|
+
const monthSlide = useRef(new Animated.Value(0)).current;
|
|
112
|
+
const monthFade = useRef(new Animated.Value(1)).current;
|
|
113
|
+
const selectScale = useRef(new Animated.Value(1)).current;
|
|
114
|
+
const viewFade = useRef(new Animated.Value(1)).current;
|
|
115
|
+
const viewScale = useRef(new Animated.Value(1)).current;
|
|
116
|
+
const headerScale = useRef(new Animated.Value(1)).current;
|
|
117
|
+
|
|
118
|
+
// Sync anchor / pending when value prop changes.
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (value) {
|
|
121
|
+
const d = startOfDay(value);
|
|
122
|
+
setPendingDate(d);
|
|
123
|
+
setAnchor(d);
|
|
124
|
+
} else {
|
|
125
|
+
setPendingDate(null);
|
|
126
|
+
}
|
|
127
|
+
}, [value]);
|
|
128
|
+
|
|
129
|
+
// Modal open / close animation.
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
if (mode !== 'modal') return;
|
|
132
|
+
if (visible) {
|
|
133
|
+
backdrop.setValue(0);
|
|
134
|
+
sheet.setValue(0);
|
|
135
|
+
Animated.parallel([Animated.timing(backdrop, {
|
|
136
|
+
toValue: 1,
|
|
137
|
+
duration: theme.motion.duration.normal,
|
|
138
|
+
easing: Easing.out(Easing.cubic),
|
|
139
|
+
useNativeDriver: true
|
|
140
|
+
}), Animated.spring(sheet, {
|
|
141
|
+
toValue: 1,
|
|
142
|
+
damping: theme.motion.spring.gentle.damping,
|
|
143
|
+
stiffness: theme.motion.spring.gentle.stiffness,
|
|
144
|
+
mass: theme.motion.spring.gentle.mass,
|
|
145
|
+
useNativeDriver: true
|
|
146
|
+
})]).start();
|
|
147
|
+
}
|
|
148
|
+
}, [visible, mode, backdrop, sheet, theme.motion]);
|
|
149
|
+
const disabledIsoSet = useMemo(() => {
|
|
150
|
+
const set = new Set();
|
|
151
|
+
disabledDates?.forEach(d => set.add(toIso(startOfDay(d))));
|
|
152
|
+
return set;
|
|
153
|
+
}, [disabledDates]);
|
|
154
|
+
const minDay = useMemo(() => minDate ? startOfDay(minDate) : null, [minDate]);
|
|
155
|
+
const maxDay = useMemo(() => maxDate ? startOfDay(maxDate) : null, [maxDate]);
|
|
156
|
+
const isDisabled = useCallback(date => {
|
|
157
|
+
if (minDay && date.getTime() < minDay.getTime()) return true;
|
|
158
|
+
if (maxDay && date.getTime() > maxDay.getTime()) return true;
|
|
159
|
+
if (disabledIsoSet.has(toIso(date))) return true;
|
|
160
|
+
return false;
|
|
161
|
+
}, [minDay, maxDay, disabledIsoSet]);
|
|
162
|
+
const cells = useMemo(() => buildMonthMatrix(anchor, weekStartsOn), [anchor, weekStartsOn]);
|
|
163
|
+
const yearCells = useMemo(() => buildYearCells(anchor.getFullYear()), [anchor]);
|
|
164
|
+
const decadeCells = useMemo(() => buildDecadeCells(anchor.getFullYear()), [anchor]);
|
|
165
|
+
const weekdays = useMemo(() => weekdayLabels(locale, weekStartsOn), [locale, weekStartsOn]);
|
|
166
|
+
const headerLabel = useMemo(() => {
|
|
167
|
+
if (viewMode === 'days') return formatMonthYear(anchor, locale);
|
|
168
|
+
if (viewMode === 'years') {
|
|
169
|
+
const first = yearCells[0];
|
|
170
|
+
const last = yearCells[yearCells.length - 1];
|
|
171
|
+
return `${first} - ${last}`;
|
|
172
|
+
}
|
|
173
|
+
const first = decadeCells[0];
|
|
174
|
+
const last = decadeCells[decadeCells.length - 1] + (DECADE_SPAN - 1);
|
|
175
|
+
return `${first} - ${last}`;
|
|
176
|
+
}, [anchor, decadeCells, locale, viewMode, yearCells]);
|
|
177
|
+
const isYearDisabled = useCallback(year => {
|
|
178
|
+
if (minDay && year < minDay.getFullYear()) return true;
|
|
179
|
+
if (maxDay && year > maxDay.getFullYear()) return true;
|
|
180
|
+
return false;
|
|
181
|
+
}, [minDay, maxDay]);
|
|
182
|
+
const isDecadeDisabled = useCallback(decadeStart => {
|
|
183
|
+
const decadeEnd = decadeStart + DECADE_SPAN - 1;
|
|
184
|
+
if (minDay && decadeEnd < minDay.getFullYear()) return true;
|
|
185
|
+
if (maxDay && decadeStart > maxDay.getFullYear()) return true;
|
|
186
|
+
return false;
|
|
187
|
+
}, [minDay, maxDay]);
|
|
188
|
+
const animateMonthChange = useCallback(delta => {
|
|
189
|
+
triggerHaptic('impactLight');
|
|
190
|
+
const direction = delta > 0 ? 1 : -1;
|
|
191
|
+
const distance = 32;
|
|
192
|
+
Animated.sequence([Animated.parallel([Animated.timing(monthSlide, {
|
|
193
|
+
toValue: -direction * distance,
|
|
194
|
+
duration: 140,
|
|
195
|
+
easing: Easing.out(Easing.quad),
|
|
196
|
+
useNativeDriver: true
|
|
197
|
+
}), Animated.timing(monthFade, {
|
|
198
|
+
toValue: 0,
|
|
199
|
+
duration: 140,
|
|
200
|
+
useNativeDriver: true
|
|
201
|
+
})]), Animated.timing(monthSlide, {
|
|
202
|
+
toValue: direction * distance,
|
|
203
|
+
duration: 0,
|
|
204
|
+
useNativeDriver: true
|
|
205
|
+
}), Animated.parallel([Animated.timing(monthSlide, {
|
|
206
|
+
toValue: 0,
|
|
207
|
+
duration: 160,
|
|
208
|
+
easing: Easing.out(Easing.cubic),
|
|
209
|
+
useNativeDriver: true
|
|
210
|
+
}), Animated.timing(monthFade, {
|
|
211
|
+
toValue: 1,
|
|
212
|
+
duration: 160,
|
|
213
|
+
useNativeDriver: true
|
|
214
|
+
})])]).start();
|
|
215
|
+
const next = addMonths(anchor, delta);
|
|
216
|
+
setAnchor(next);
|
|
217
|
+
AccessibilityInfo.announceForAccessibility(formatMonthYear(next, locale));
|
|
218
|
+
}, [anchor, locale, monthFade, monthSlide]);
|
|
219
|
+
const goPrev = useCallback(() => {
|
|
220
|
+
if (viewMode === 'days') {
|
|
221
|
+
animateMonthChange(-1);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
triggerHaptic('impactLight');
|
|
225
|
+
if (viewMode === 'years') {
|
|
226
|
+
setAnchor(prev => new Date(prev.getFullYear() - GRID_SIZE, prev.getMonth(), 1));
|
|
227
|
+
} else {
|
|
228
|
+
setAnchor(prev => new Date(prev.getFullYear() - GRID_SIZE * DECADE_SPAN, prev.getMonth(), 1));
|
|
229
|
+
}
|
|
230
|
+
}, [animateMonthChange, viewMode]);
|
|
231
|
+
const goNext = useCallback(() => {
|
|
232
|
+
if (viewMode === 'days') {
|
|
233
|
+
animateMonthChange(1);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
triggerHaptic('impactLight');
|
|
237
|
+
if (viewMode === 'years') {
|
|
238
|
+
setAnchor(prev => new Date(prev.getFullYear() + GRID_SIZE, prev.getMonth(), 1));
|
|
239
|
+
} else {
|
|
240
|
+
setAnchor(prev => new Date(prev.getFullYear() + GRID_SIZE * DECADE_SPAN, prev.getMonth(), 1));
|
|
241
|
+
}
|
|
242
|
+
}, [animateMonthChange, viewMode]);
|
|
243
|
+
|
|
244
|
+
// View-mode transition: fade + scale (200ms, native driver).
|
|
245
|
+
const animateViewTransition = useCallback(() => {
|
|
246
|
+
viewFade.setValue(0);
|
|
247
|
+
viewScale.setValue(0.9);
|
|
248
|
+
Animated.parallel([Animated.timing(viewFade, {
|
|
249
|
+
toValue: 1,
|
|
250
|
+
duration: 200,
|
|
251
|
+
easing: Easing.out(Easing.cubic),
|
|
252
|
+
useNativeDriver: true
|
|
253
|
+
}), Animated.timing(viewScale, {
|
|
254
|
+
toValue: 1,
|
|
255
|
+
duration: 200,
|
|
256
|
+
easing: Easing.out(Easing.cubic),
|
|
257
|
+
useNativeDriver: true
|
|
258
|
+
})]).start();
|
|
259
|
+
}, [viewFade, viewScale]);
|
|
260
|
+
const cycleViewMode = useCallback(() => {
|
|
261
|
+
triggerHaptic('selection');
|
|
262
|
+
Animated.sequence([Animated.timing(headerScale, {
|
|
263
|
+
toValue: 0.96,
|
|
264
|
+
duration: 80,
|
|
265
|
+
useNativeDriver: true
|
|
266
|
+
}), Animated.timing(headerScale, {
|
|
267
|
+
toValue: 1,
|
|
268
|
+
duration: 100,
|
|
269
|
+
useNativeDriver: true
|
|
270
|
+
})]).start();
|
|
271
|
+
setViewMode(prev => {
|
|
272
|
+
if (prev === 'days') return 'years';
|
|
273
|
+
if (prev === 'years') return 'decades';
|
|
274
|
+
return 'years';
|
|
275
|
+
});
|
|
276
|
+
animateViewTransition();
|
|
277
|
+
}, [animateViewTransition, headerScale]);
|
|
278
|
+
const pickYear = useCallback(year => {
|
|
279
|
+
triggerHaptic('selection');
|
|
280
|
+
setAnchor(prev => new Date(year, prev.getMonth(), 1));
|
|
281
|
+
setViewMode('days');
|
|
282
|
+
animateViewTransition();
|
|
283
|
+
}, [animateViewTransition]);
|
|
284
|
+
const pickDecade = useCallback(decadeStart => {
|
|
285
|
+
triggerHaptic('selection');
|
|
286
|
+
// Anchor mid-decade so the year grid centers nicely on this decade.
|
|
287
|
+
setAnchor(prev => new Date(decadeStart + 4, prev.getMonth(), 1));
|
|
288
|
+
setViewMode('years');
|
|
289
|
+
animateViewTransition();
|
|
290
|
+
}, [animateViewTransition]);
|
|
291
|
+
const pressDay = useCallback(cell => {
|
|
292
|
+
if (isDisabled(cell.date)) return;
|
|
293
|
+
triggerHaptic('selection');
|
|
294
|
+
setPendingDate(cell.date);
|
|
295
|
+
if (!cell.inMonth) {
|
|
296
|
+
setAnchor(new Date(cell.date.getFullYear(), cell.date.getMonth(), 1));
|
|
297
|
+
}
|
|
298
|
+
selectScale.setValue(0.7);
|
|
299
|
+
Animated.spring(selectScale, {
|
|
300
|
+
toValue: 1,
|
|
301
|
+
damping: theme.motion.spring.bouncy.damping,
|
|
302
|
+
stiffness: theme.motion.spring.bouncy.stiffness,
|
|
303
|
+
mass: theme.motion.spring.bouncy.mass,
|
|
304
|
+
useNativeDriver: true
|
|
305
|
+
}).start();
|
|
306
|
+
}, [isDisabled, selectScale, theme.motion.spring.bouncy]);
|
|
307
|
+
const handleClose = useCallback(() => {
|
|
308
|
+
if (mode !== 'modal') {
|
|
309
|
+
onClose();
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
Animated.parallel([Animated.timing(backdrop, {
|
|
313
|
+
toValue: 0,
|
|
314
|
+
duration: theme.motion.duration.fast,
|
|
315
|
+
easing: Easing.in(Easing.cubic),
|
|
316
|
+
useNativeDriver: true
|
|
317
|
+
}), Animated.timing(sheet, {
|
|
318
|
+
toValue: 0,
|
|
319
|
+
duration: theme.motion.duration.fast,
|
|
320
|
+
easing: Easing.in(Easing.cubic),
|
|
321
|
+
useNativeDriver: true
|
|
322
|
+
})]).start(() => {
|
|
323
|
+
onClose();
|
|
324
|
+
});
|
|
325
|
+
}, [backdrop, mode, onClose, sheet, theme.motion.duration.fast]);
|
|
326
|
+
const handleCancel = useCallback(() => {
|
|
327
|
+
triggerHaptic('selection');
|
|
328
|
+
handleClose();
|
|
329
|
+
}, [handleClose]);
|
|
330
|
+
const handleConfirm = useCallback(() => {
|
|
331
|
+
if (!pendingDate) return;
|
|
332
|
+
triggerHaptic('notificationSuccess');
|
|
333
|
+
onSelect(pendingDate);
|
|
334
|
+
handleClose();
|
|
335
|
+
}, [handleClose, onSelect, pendingDate]);
|
|
336
|
+
const sheetTranslate = sheet.interpolate({
|
|
337
|
+
inputRange: [0, 1],
|
|
338
|
+
outputRange: [320, 0]
|
|
339
|
+
});
|
|
340
|
+
const calendar = /*#__PURE__*/_jsxs(View, {
|
|
341
|
+
style: [styles.card, style],
|
|
342
|
+
accessibilityRole: mode === 'modal' ? undefined : 'none',
|
|
343
|
+
accessible: false,
|
|
344
|
+
testID: testID,
|
|
345
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
346
|
+
style: styles.titleRow,
|
|
347
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
348
|
+
style: styles.title,
|
|
349
|
+
accessibilityRole: "header",
|
|
350
|
+
children: title
|
|
351
|
+
})
|
|
352
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
353
|
+
style: styles.headerRow,
|
|
354
|
+
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
355
|
+
onPress: goPrev,
|
|
356
|
+
style: ({
|
|
357
|
+
pressed
|
|
358
|
+
}) => [styles.navBtn, pressed && styles.navBtnPressed],
|
|
359
|
+
accessibilityRole: "button",
|
|
360
|
+
accessibilityLabel: viewMode === 'days' ? 'Previous month' : viewMode === 'years' ? 'Previous years' : 'Previous decades',
|
|
361
|
+
hitSlop: 8,
|
|
362
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
363
|
+
style: styles.navText,
|
|
364
|
+
children: '‹'
|
|
365
|
+
})
|
|
366
|
+
}), /*#__PURE__*/_jsx(Pressable, {
|
|
367
|
+
onPress: cycleViewMode,
|
|
368
|
+
style: styles.headerLabelWrap,
|
|
369
|
+
accessibilityRole: "button",
|
|
370
|
+
accessibilityLabel: viewMode === 'days' ? `${headerLabel}, switch to year selection` : viewMode === 'years' ? `${headerLabel}, switch to decade selection` : `${headerLabel}, switch to year selection`,
|
|
371
|
+
hitSlop: 8,
|
|
372
|
+
children: /*#__PURE__*/_jsxs(Animated.View, {
|
|
373
|
+
style: [styles.headerLabelInner, {
|
|
374
|
+
transform: [{
|
|
375
|
+
scale: headerScale
|
|
376
|
+
}],
|
|
377
|
+
opacity: viewMode === 'days' ? monthFade : 1
|
|
378
|
+
}],
|
|
379
|
+
children: [/*#__PURE__*/_jsx(Animated.Text, {
|
|
380
|
+
style: [styles.headerLabel, viewMode === 'days' ? {
|
|
381
|
+
transform: [{
|
|
382
|
+
translateX: monthSlide
|
|
383
|
+
}]
|
|
384
|
+
} : null],
|
|
385
|
+
accessibilityLiveRegion: "polite",
|
|
386
|
+
children: headerLabel
|
|
387
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
388
|
+
style: styles.headerCaret,
|
|
389
|
+
allowFontScaling: false,
|
|
390
|
+
children: ' ▾'
|
|
391
|
+
})]
|
|
392
|
+
})
|
|
393
|
+
}), /*#__PURE__*/_jsx(Pressable, {
|
|
394
|
+
onPress: goNext,
|
|
395
|
+
style: ({
|
|
396
|
+
pressed
|
|
397
|
+
}) => [styles.navBtn, pressed && styles.navBtnPressed],
|
|
398
|
+
accessibilityRole: "button",
|
|
399
|
+
accessibilityLabel: viewMode === 'days' ? 'Next month' : viewMode === 'years' ? 'Next years' : 'Next decades',
|
|
400
|
+
hitSlop: 8,
|
|
401
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
402
|
+
style: styles.navText,
|
|
403
|
+
children: '›'
|
|
404
|
+
})
|
|
405
|
+
})]
|
|
406
|
+
}), viewMode === 'days' ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
407
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
408
|
+
style: styles.weekdayRow,
|
|
409
|
+
children: weekdays.map((wd, idx) => /*#__PURE__*/_jsx(View, {
|
|
410
|
+
style: styles.weekdayCell,
|
|
411
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
412
|
+
style: styles.weekdayText,
|
|
413
|
+
children: wd
|
|
414
|
+
})
|
|
415
|
+
}, `${wd}-${idx}`))
|
|
416
|
+
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
417
|
+
style: [styles.grid, {
|
|
418
|
+
opacity: monthFade,
|
|
419
|
+
transform: [{
|
|
420
|
+
translateX: monthSlide
|
|
421
|
+
}]
|
|
422
|
+
}],
|
|
423
|
+
children: Array.from({
|
|
424
|
+
length: 6
|
|
425
|
+
}).map((_, row) => /*#__PURE__*/_jsx(View, {
|
|
426
|
+
style: styles.gridRow,
|
|
427
|
+
children: cells.slice(row * 7, row * 7 + 7).map(cell => {
|
|
428
|
+
const disabled = isDisabled(cell.date);
|
|
429
|
+
const selected = pendingDate ? isSameDay(cell.date, pendingDate) : false;
|
|
430
|
+
const todayCell = isSameDay(cell.date, today);
|
|
431
|
+
const cellBg = selected ? theme.colors.primary : todayCell ? 'transparent' : 'transparent';
|
|
432
|
+
const borderColor = todayCell && !selected ? theme.colors.primary : 'transparent';
|
|
433
|
+
const textColor = selected ? theme.colors.text.inverse : !cell.inMonth ? theme.colors.text.tertiary : disabled ? theme.colors.text.disabled : theme.colors.text.primary;
|
|
434
|
+
const opacity = disabled ? 0.3 : !cell.inMonth ? 0.4 : 1;
|
|
435
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
436
|
+
disabled: disabled,
|
|
437
|
+
onPress: () => pressDay(cell),
|
|
438
|
+
accessibilityRole: "button",
|
|
439
|
+
accessibilityLabel: formatLongDate(cell.date, locale),
|
|
440
|
+
accessibilityState: {
|
|
441
|
+
selected,
|
|
442
|
+
disabled
|
|
443
|
+
},
|
|
444
|
+
style: styles.dayCell,
|
|
445
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
446
|
+
style: [styles.dayInner, {
|
|
447
|
+
backgroundColor: cellBg,
|
|
448
|
+
borderColor,
|
|
449
|
+
borderWidth: todayCell && !selected ? 1.5 : 0,
|
|
450
|
+
opacity,
|
|
451
|
+
transform: selected ? [{
|
|
452
|
+
scale: selectScale
|
|
453
|
+
}] : undefined
|
|
454
|
+
}],
|
|
455
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
456
|
+
style: [styles.dayText, {
|
|
457
|
+
color: textColor
|
|
458
|
+
}],
|
|
459
|
+
children: cell.date.getDate()
|
|
460
|
+
})
|
|
461
|
+
})
|
|
462
|
+
}, cell.iso);
|
|
463
|
+
})
|
|
464
|
+
}, `r-${row}`))
|
|
465
|
+
})]
|
|
466
|
+
}) : viewMode === 'years' ? /*#__PURE__*/_jsx(Animated.View, {
|
|
467
|
+
style: [styles.yearGrid, {
|
|
468
|
+
opacity: viewFade,
|
|
469
|
+
transform: [{
|
|
470
|
+
scale: viewScale
|
|
471
|
+
}]
|
|
472
|
+
}],
|
|
473
|
+
children: Array.from({
|
|
474
|
+
length: 3
|
|
475
|
+
}).map((_, row) => /*#__PURE__*/_jsx(View, {
|
|
476
|
+
style: styles.gridRow,
|
|
477
|
+
children: yearCells.slice(row * 4, row * 4 + 4).map(year => {
|
|
478
|
+
const disabled = isYearDisabled(year);
|
|
479
|
+
const selected = pendingDate ? pendingDate.getFullYear() === year : false;
|
|
480
|
+
const isToday = today.getFullYear() === year;
|
|
481
|
+
const cellBg = selected ? theme.colors.primary : 'transparent';
|
|
482
|
+
const borderColor = isToday && !selected ? theme.colors.primary : 'transparent';
|
|
483
|
+
const textColor = selected ? theme.colors.text.inverse : disabled ? theme.colors.text.disabled : theme.colors.text.primary;
|
|
484
|
+
const opacity = disabled ? 0.3 : 1;
|
|
485
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
486
|
+
disabled: disabled,
|
|
487
|
+
onPress: () => pickYear(year),
|
|
488
|
+
accessibilityRole: "button",
|
|
489
|
+
accessibilityLabel: `Year ${year}`,
|
|
490
|
+
accessibilityState: {
|
|
491
|
+
selected,
|
|
492
|
+
disabled
|
|
493
|
+
},
|
|
494
|
+
style: styles.yearCell,
|
|
495
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
496
|
+
style: [styles.yearInner, {
|
|
497
|
+
backgroundColor: cellBg,
|
|
498
|
+
borderColor,
|
|
499
|
+
borderWidth: isToday && !selected ? 1.5 : 0,
|
|
500
|
+
opacity
|
|
501
|
+
}],
|
|
502
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
503
|
+
style: [styles.yearText, {
|
|
504
|
+
color: textColor
|
|
505
|
+
}],
|
|
506
|
+
children: year
|
|
507
|
+
})
|
|
508
|
+
})
|
|
509
|
+
}, `year-${year}`);
|
|
510
|
+
})
|
|
511
|
+
}, `yr-${row}`))
|
|
512
|
+
}) : /*#__PURE__*/_jsx(Animated.View, {
|
|
513
|
+
style: [styles.yearGrid, {
|
|
514
|
+
opacity: viewFade,
|
|
515
|
+
transform: [{
|
|
516
|
+
scale: viewScale
|
|
517
|
+
}]
|
|
518
|
+
}],
|
|
519
|
+
children: Array.from({
|
|
520
|
+
length: 3
|
|
521
|
+
}).map((_, row) => /*#__PURE__*/_jsx(View, {
|
|
522
|
+
style: styles.gridRow,
|
|
523
|
+
children: decadeCells.slice(row * 4, row * 4 + 4).map(decadeStart => {
|
|
524
|
+
const decadeEnd = decadeStart + DECADE_SPAN - 1;
|
|
525
|
+
const disabled = isDecadeDisabled(decadeStart);
|
|
526
|
+
const selected = pendingDate ? decadeStartFor(pendingDate.getFullYear()) === decadeStart : false;
|
|
527
|
+
const isCurrent = decadeStartFor(today.getFullYear()) === decadeStart;
|
|
528
|
+
const cellBg = selected ? theme.colors.primary : 'transparent';
|
|
529
|
+
const borderColor = isCurrent && !selected ? theme.colors.primary : 'transparent';
|
|
530
|
+
const textColor = selected ? theme.colors.text.inverse : disabled ? theme.colors.text.disabled : theme.colors.text.primary;
|
|
531
|
+
const opacity = disabled ? 0.3 : 1;
|
|
532
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
533
|
+
disabled: disabled,
|
|
534
|
+
onPress: () => pickDecade(decadeStart),
|
|
535
|
+
accessibilityRole: "button",
|
|
536
|
+
accessibilityLabel: `Decade ${decadeStart} to ${decadeEnd}`,
|
|
537
|
+
accessibilityState: {
|
|
538
|
+
selected,
|
|
539
|
+
disabled
|
|
540
|
+
},
|
|
541
|
+
style: styles.yearCell,
|
|
542
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
543
|
+
style: [styles.yearInner, {
|
|
544
|
+
backgroundColor: cellBg,
|
|
545
|
+
borderColor,
|
|
546
|
+
borderWidth: isCurrent && !selected ? 1.5 : 0,
|
|
547
|
+
opacity
|
|
548
|
+
}],
|
|
549
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
550
|
+
style: [styles.yearText, {
|
|
551
|
+
color: textColor
|
|
552
|
+
}],
|
|
553
|
+
children: `${decadeStart}s`
|
|
554
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
555
|
+
style: [styles.decadeRangeText, {
|
|
556
|
+
color: selected ? theme.colors.text.inverse : theme.colors.text.tertiary
|
|
557
|
+
}],
|
|
558
|
+
children: `${decadeStart}-${decadeEnd}`
|
|
559
|
+
})]
|
|
560
|
+
})
|
|
561
|
+
}, `decade-${decadeStart}`);
|
|
562
|
+
})
|
|
563
|
+
}, `dec-${row}`))
|
|
564
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
565
|
+
style: styles.footer,
|
|
566
|
+
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
567
|
+
onPress: handleCancel,
|
|
568
|
+
style: ({
|
|
569
|
+
pressed
|
|
570
|
+
}) => [styles.footerBtn, styles.footerCancel, pressed && styles.footerBtnPressed],
|
|
571
|
+
accessibilityRole: "button",
|
|
572
|
+
accessibilityLabel: cancelLabel,
|
|
573
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
574
|
+
style: [styles.footerBtnText, {
|
|
575
|
+
color: theme.colors.text.secondary
|
|
576
|
+
}],
|
|
577
|
+
children: cancelLabel
|
|
578
|
+
})
|
|
579
|
+
}), /*#__PURE__*/_jsx(Pressable, {
|
|
580
|
+
onPress: handleConfirm,
|
|
581
|
+
disabled: !pendingDate,
|
|
582
|
+
style: ({
|
|
583
|
+
pressed
|
|
584
|
+
}) => [styles.footerBtn, styles.footerConfirm, {
|
|
585
|
+
backgroundColor: theme.colors.primary,
|
|
586
|
+
opacity: !pendingDate ? 0.5 : 1
|
|
587
|
+
}, pressed && {
|
|
588
|
+
backgroundColor: theme.colors.primaryHover
|
|
589
|
+
}],
|
|
590
|
+
accessibilityRole: "button",
|
|
591
|
+
accessibilityLabel: confirmLabel,
|
|
592
|
+
accessibilityState: {
|
|
593
|
+
disabled: !pendingDate
|
|
594
|
+
},
|
|
595
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
596
|
+
style: [styles.footerBtnText, {
|
|
597
|
+
color: theme.colors.text.inverse
|
|
598
|
+
}],
|
|
599
|
+
children: confirmLabel
|
|
600
|
+
})
|
|
601
|
+
})]
|
|
602
|
+
})]
|
|
603
|
+
});
|
|
604
|
+
if (mode === 'inline') {
|
|
605
|
+
if (!visible) return null;
|
|
606
|
+
return calendar;
|
|
607
|
+
}
|
|
608
|
+
return /*#__PURE__*/_jsxs(Modal, {
|
|
609
|
+
visible: visible,
|
|
610
|
+
transparent: true,
|
|
611
|
+
statusBarTranslucent: true,
|
|
612
|
+
animationType: "none",
|
|
613
|
+
onRequestClose: handleClose,
|
|
614
|
+
children: [/*#__PURE__*/_jsx(Animated.View, {
|
|
615
|
+
style: [styles.backdrop, {
|
|
616
|
+
opacity: backdrop,
|
|
617
|
+
backgroundColor: theme.colors.background.overlay
|
|
618
|
+
}],
|
|
619
|
+
children: /*#__PURE__*/_jsx(Pressable, {
|
|
620
|
+
style: StyleSheet.absoluteFill,
|
|
621
|
+
onPress: handleClose,
|
|
622
|
+
accessibilityLabel: "Dismiss"
|
|
623
|
+
})
|
|
624
|
+
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
625
|
+
style: [styles.sheetWrap, {
|
|
626
|
+
opacity: sheet,
|
|
627
|
+
transform: [{
|
|
628
|
+
translateY: sheetTranslate
|
|
629
|
+
}]
|
|
630
|
+
}],
|
|
631
|
+
accessibilityViewIsModal: true,
|
|
632
|
+
accessibilityRole: "none",
|
|
633
|
+
children: calendar
|
|
634
|
+
})]
|
|
635
|
+
});
|
|
636
|
+
};
|
|
637
|
+
const buildStyles = theme => {
|
|
638
|
+
const cardShadow = theme.shadows.lg;
|
|
639
|
+
return StyleSheet.create({
|
|
640
|
+
backdrop: {
|
|
641
|
+
...StyleSheet.absoluteFillObject
|
|
642
|
+
},
|
|
643
|
+
sheetWrap: {
|
|
644
|
+
position: 'absolute',
|
|
645
|
+
left: 0,
|
|
646
|
+
right: 0,
|
|
647
|
+
bottom: 0,
|
|
648
|
+
paddingHorizontal: theme.spacing.md,
|
|
649
|
+
paddingBottom: theme.spacing.lg
|
|
650
|
+
},
|
|
651
|
+
card: {
|
|
652
|
+
backgroundColor: theme.colors.background.elevated,
|
|
653
|
+
borderRadius: theme.radius.xl,
|
|
654
|
+
padding: theme.spacing.lg,
|
|
655
|
+
shadowColor: cardShadow.shadowColor,
|
|
656
|
+
shadowOffset: cardShadow.shadowOffset,
|
|
657
|
+
shadowOpacity: cardShadow.shadowOpacity,
|
|
658
|
+
shadowRadius: cardShadow.shadowRadius,
|
|
659
|
+
elevation: cardShadow.elevation
|
|
660
|
+
},
|
|
661
|
+
titleRow: {
|
|
662
|
+
marginBottom: theme.spacing.sm
|
|
663
|
+
},
|
|
664
|
+
title: {
|
|
665
|
+
fontSize: theme.typography.fontSize.lg,
|
|
666
|
+
fontWeight: theme.typography.fontWeight.semibold,
|
|
667
|
+
color: theme.colors.text.primary
|
|
668
|
+
},
|
|
669
|
+
headerRow: {
|
|
670
|
+
flexDirection: 'row',
|
|
671
|
+
alignItems: 'center',
|
|
672
|
+
justifyContent: 'space-between',
|
|
673
|
+
marginBottom: theme.spacing.md
|
|
674
|
+
},
|
|
675
|
+
navBtn: {
|
|
676
|
+
width: 36,
|
|
677
|
+
height: 36,
|
|
678
|
+
borderRadius: theme.radius.full,
|
|
679
|
+
alignItems: 'center',
|
|
680
|
+
justifyContent: 'center',
|
|
681
|
+
backgroundColor: theme.colors.background.secondary
|
|
682
|
+
},
|
|
683
|
+
navBtnPressed: {
|
|
684
|
+
backgroundColor: theme.colors.surface.pressed
|
|
685
|
+
},
|
|
686
|
+
navText: {
|
|
687
|
+
fontSize: 22,
|
|
688
|
+
lineHeight: 24,
|
|
689
|
+
color: theme.colors.text.primary,
|
|
690
|
+
fontWeight: theme.typography.fontWeight.semibold
|
|
691
|
+
},
|
|
692
|
+
headerLabelWrap: {
|
|
693
|
+
flex: 1,
|
|
694
|
+
alignItems: 'center'
|
|
695
|
+
},
|
|
696
|
+
headerLabelInner: {
|
|
697
|
+
flexDirection: 'row',
|
|
698
|
+
alignItems: 'center',
|
|
699
|
+
justifyContent: 'center'
|
|
700
|
+
},
|
|
701
|
+
headerLabel: {
|
|
702
|
+
fontSize: theme.typography.fontSize.base,
|
|
703
|
+
fontWeight: theme.typography.fontWeight.semibold,
|
|
704
|
+
color: theme.colors.text.primary
|
|
705
|
+
},
|
|
706
|
+
headerCaret: {
|
|
707
|
+
fontSize: theme.typography.fontSize.sm,
|
|
708
|
+
color: theme.colors.text.secondary,
|
|
709
|
+
fontWeight: theme.typography.fontWeight.semibold
|
|
710
|
+
},
|
|
711
|
+
weekdayRow: {
|
|
712
|
+
flexDirection: 'row',
|
|
713
|
+
marginBottom: theme.spacing.xs
|
|
714
|
+
},
|
|
715
|
+
weekdayCell: {
|
|
716
|
+
flex: 1,
|
|
717
|
+
alignItems: 'center',
|
|
718
|
+
paddingVertical: theme.spacing.xs
|
|
719
|
+
},
|
|
720
|
+
weekdayText: {
|
|
721
|
+
fontSize: theme.typography.fontSize.xs,
|
|
722
|
+
fontWeight: theme.typography.fontWeight.medium,
|
|
723
|
+
color: theme.colors.text.tertiary,
|
|
724
|
+
letterSpacing: theme.typography.letterSpacing.wide
|
|
725
|
+
},
|
|
726
|
+
grid: {
|
|
727
|
+
// Animated container; rows are children.
|
|
728
|
+
},
|
|
729
|
+
gridRow: {
|
|
730
|
+
flexDirection: 'row'
|
|
731
|
+
},
|
|
732
|
+
dayCell: {
|
|
733
|
+
flex: 1,
|
|
734
|
+
aspectRatio: 1,
|
|
735
|
+
alignItems: 'center',
|
|
736
|
+
justifyContent: 'center',
|
|
737
|
+
padding: 2
|
|
738
|
+
},
|
|
739
|
+
dayInner: {
|
|
740
|
+
width: '100%',
|
|
741
|
+
height: '100%',
|
|
742
|
+
borderRadius: theme.radius.full,
|
|
743
|
+
alignItems: 'center',
|
|
744
|
+
justifyContent: 'center'
|
|
745
|
+
},
|
|
746
|
+
dayText: {
|
|
747
|
+
fontSize: theme.typography.fontSize.sm,
|
|
748
|
+
fontWeight: theme.typography.fontWeight.medium
|
|
749
|
+
},
|
|
750
|
+
yearGrid: {
|
|
751
|
+
// Animated container; rows are children.
|
|
752
|
+
},
|
|
753
|
+
yearCell: {
|
|
754
|
+
flex: 1,
|
|
755
|
+
aspectRatio: 1.6,
|
|
756
|
+
alignItems: 'center',
|
|
757
|
+
justifyContent: 'center',
|
|
758
|
+
padding: 4
|
|
759
|
+
},
|
|
760
|
+
yearInner: {
|
|
761
|
+
width: '100%',
|
|
762
|
+
height: '100%',
|
|
763
|
+
borderRadius: theme.radius.lg,
|
|
764
|
+
alignItems: 'center',
|
|
765
|
+
justifyContent: 'center'
|
|
766
|
+
},
|
|
767
|
+
yearText: {
|
|
768
|
+
fontSize: theme.typography.fontSize.base,
|
|
769
|
+
fontWeight: theme.typography.fontWeight.semibold
|
|
770
|
+
},
|
|
771
|
+
decadeRangeText: {
|
|
772
|
+
fontSize: theme.typography.fontSize.xs,
|
|
773
|
+
fontWeight: theme.typography.fontWeight.medium,
|
|
774
|
+
marginTop: 2
|
|
775
|
+
},
|
|
776
|
+
footer: {
|
|
777
|
+
flexDirection: 'row',
|
|
778
|
+
justifyContent: 'flex-end',
|
|
779
|
+
alignItems: 'center',
|
|
780
|
+
marginTop: theme.spacing.lg,
|
|
781
|
+
gap: theme.spacing.sm
|
|
782
|
+
},
|
|
783
|
+
footerBtn: {
|
|
784
|
+
paddingHorizontal: theme.spacing.lg,
|
|
785
|
+
paddingVertical: theme.spacing.sm,
|
|
786
|
+
borderRadius: theme.radius.md,
|
|
787
|
+
minHeight: 40,
|
|
788
|
+
alignItems: 'center',
|
|
789
|
+
justifyContent: 'center'
|
|
790
|
+
},
|
|
791
|
+
footerCancel: {
|
|
792
|
+
backgroundColor: 'transparent'
|
|
793
|
+
},
|
|
794
|
+
footerConfirm: {
|
|
795
|
+
// backgroundColor set inline from theme.
|
|
796
|
+
},
|
|
797
|
+
footerBtnPressed: {
|
|
798
|
+
opacity: 0.85
|
|
799
|
+
},
|
|
800
|
+
footerBtnText: {
|
|
801
|
+
fontSize: theme.typography.fontSize.sm,
|
|
802
|
+
fontWeight: theme.typography.fontWeight.semibold
|
|
803
|
+
}
|
|
804
|
+
});
|
|
805
|
+
};
|
|
806
|
+
export { DatePicker };
|
|
807
|
+
export default DatePicker;
|
|
808
|
+
//# sourceMappingURL=DatePicker.js.map
|