@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,618 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef, 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 } from "react/jsx-runtime";
|
|
8
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
9
|
+
const startOfDay = date => new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
10
|
+
const isSameDay = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
11
|
+
const toIso = date => {
|
|
12
|
+
const y = date.getFullYear();
|
|
13
|
+
const m = String(date.getMonth() + 1).padStart(2, '0');
|
|
14
|
+
const d = String(date.getDate()).padStart(2, '0');
|
|
15
|
+
return `${y}-${m}-${d}`;
|
|
16
|
+
};
|
|
17
|
+
const addMonths = (date, delta) => new Date(date.getFullYear(), date.getMonth() + delta, 1);
|
|
18
|
+
const daysBetween = (a, b) => {
|
|
19
|
+
const diffMs = startOfDay(b).getTime() - startOfDay(a).getTime();
|
|
20
|
+
return Math.round(diffMs / DAY_MS);
|
|
21
|
+
};
|
|
22
|
+
const buildMonthMatrix = (anchor, weekStartsOn) => {
|
|
23
|
+
const year = anchor.getFullYear();
|
|
24
|
+
const month = anchor.getMonth();
|
|
25
|
+
const firstOfMonth = new Date(year, month, 1);
|
|
26
|
+
const firstWeekday = firstOfMonth.getDay();
|
|
27
|
+
const offset = (firstWeekday - weekStartsOn + 7) % 7;
|
|
28
|
+
const gridStart = new Date(year, month, 1 - offset);
|
|
29
|
+
const cells = [];
|
|
30
|
+
for (let i = 0; i < 42; i += 1) {
|
|
31
|
+
const d = new Date(gridStart.getTime() + i * DAY_MS);
|
|
32
|
+
cells.push({
|
|
33
|
+
date: d,
|
|
34
|
+
inMonth: d.getMonth() === month,
|
|
35
|
+
iso: toIso(d)
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return cells;
|
|
39
|
+
};
|
|
40
|
+
const weekdayLabels = (locale, weekStartsOn) => {
|
|
41
|
+
const fmt = new Intl.DateTimeFormat(locale, {
|
|
42
|
+
weekday: 'short'
|
|
43
|
+
});
|
|
44
|
+
const labels = [];
|
|
45
|
+
for (let i = 0; i < 7; i += 1) {
|
|
46
|
+
const day = (weekStartsOn + i) % 7;
|
|
47
|
+
const ref = new Date(1970, 0, 4 + day);
|
|
48
|
+
labels.push(fmt.format(ref));
|
|
49
|
+
}
|
|
50
|
+
return labels;
|
|
51
|
+
};
|
|
52
|
+
const formatMonthYear = (date, locale) => new Intl.DateTimeFormat(locale, {
|
|
53
|
+
month: 'long',
|
|
54
|
+
year: 'numeric'
|
|
55
|
+
}).format(date);
|
|
56
|
+
const formatRangePart = (date, locale) => new Intl.DateTimeFormat(locale, {
|
|
57
|
+
weekday: 'short',
|
|
58
|
+
day: 'numeric',
|
|
59
|
+
month: 'short'
|
|
60
|
+
}).format(date);
|
|
61
|
+
const formatLongDate = (date, locale) => new Intl.DateTimeFormat(locale, {
|
|
62
|
+
weekday: 'long',
|
|
63
|
+
year: 'numeric',
|
|
64
|
+
month: 'long',
|
|
65
|
+
day: 'numeric'
|
|
66
|
+
}).format(date);
|
|
67
|
+
const DateRangePicker = /*#__PURE__*/forwardRef((props, ref) => {
|
|
68
|
+
const {
|
|
69
|
+
visible,
|
|
70
|
+
value,
|
|
71
|
+
onChange,
|
|
72
|
+
onClose,
|
|
73
|
+
minDate,
|
|
74
|
+
maxDate,
|
|
75
|
+
disabledDates,
|
|
76
|
+
locale = 'en-IN',
|
|
77
|
+
weekStartsOn = 0,
|
|
78
|
+
title = 'Select Date Range',
|
|
79
|
+
confirmLabel = 'Confirm',
|
|
80
|
+
cancelLabel = 'Cancel',
|
|
81
|
+
maxRange,
|
|
82
|
+
style,
|
|
83
|
+
testID
|
|
84
|
+
} = props;
|
|
85
|
+
const theme = useTheme();
|
|
86
|
+
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
87
|
+
const today = useMemo(() => startOfDay(new Date()), []);
|
|
88
|
+
const initialAnchor = value.start ? startOfDay(value.start) : today;
|
|
89
|
+
const [anchor, setAnchor] = useState(initialAnchor);
|
|
90
|
+
const [pendingStart, setPendingStart] = useState(value.start ? startOfDay(value.start) : null);
|
|
91
|
+
const [pendingEnd, setPendingEnd] = useState(value.end ? startOfDay(value.end) : null);
|
|
92
|
+
|
|
93
|
+
// Animations
|
|
94
|
+
const backdrop = useRef(new Animated.Value(0)).current;
|
|
95
|
+
const sheet = useRef(new Animated.Value(0)).current;
|
|
96
|
+
const monthSlide = useRef(new Animated.Value(0)).current;
|
|
97
|
+
const monthFade = useRef(new Animated.Value(1)).current;
|
|
98
|
+
|
|
99
|
+
// Sync external value -> pending state when it changes.
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
if (value.start) {
|
|
102
|
+
const s = startOfDay(value.start);
|
|
103
|
+
setPendingStart(s);
|
|
104
|
+
setAnchor(s);
|
|
105
|
+
} else {
|
|
106
|
+
setPendingStart(null);
|
|
107
|
+
}
|
|
108
|
+
if (value.end) {
|
|
109
|
+
setPendingEnd(startOfDay(value.end));
|
|
110
|
+
} else {
|
|
111
|
+
setPendingEnd(null);
|
|
112
|
+
}
|
|
113
|
+
}, [value.start, value.end]);
|
|
114
|
+
|
|
115
|
+
// Modal open / close animation.
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (visible) {
|
|
118
|
+
backdrop.setValue(0);
|
|
119
|
+
sheet.setValue(0);
|
|
120
|
+
Animated.parallel([Animated.timing(backdrop, {
|
|
121
|
+
toValue: 1,
|
|
122
|
+
duration: theme.motion.duration.normal,
|
|
123
|
+
easing: Easing.out(Easing.cubic),
|
|
124
|
+
useNativeDriver: true
|
|
125
|
+
}), Animated.spring(sheet, {
|
|
126
|
+
toValue: 1,
|
|
127
|
+
damping: theme.motion.spring.gentle.damping,
|
|
128
|
+
stiffness: theme.motion.spring.gentle.stiffness,
|
|
129
|
+
mass: theme.motion.spring.gentle.mass,
|
|
130
|
+
useNativeDriver: true
|
|
131
|
+
})]).start();
|
|
132
|
+
}
|
|
133
|
+
}, [visible, backdrop, sheet, theme.motion]);
|
|
134
|
+
const disabledIsoSet = useMemo(() => {
|
|
135
|
+
const set = new Set();
|
|
136
|
+
disabledDates?.forEach(d => set.add(toIso(startOfDay(d))));
|
|
137
|
+
return set;
|
|
138
|
+
}, [disabledDates]);
|
|
139
|
+
const minDay = useMemo(() => minDate ? startOfDay(minDate) : null, [minDate]);
|
|
140
|
+
const maxDay = useMemo(() => maxDate ? startOfDay(maxDate) : null, [maxDate]);
|
|
141
|
+
const isDisabled = useCallback(date => {
|
|
142
|
+
if (minDay && date.getTime() < minDay.getTime()) return true;
|
|
143
|
+
if (maxDay && date.getTime() > maxDay.getTime()) return true;
|
|
144
|
+
if (disabledIsoSet.has(toIso(date))) return true;
|
|
145
|
+
return false;
|
|
146
|
+
}, [minDay, maxDay, disabledIsoSet]);
|
|
147
|
+
const cells = useMemo(() => buildMonthMatrix(anchor, weekStartsOn), [anchor, weekStartsOn]);
|
|
148
|
+
const headerLabel = useMemo(() => formatMonthYear(anchor, locale), [anchor, locale]);
|
|
149
|
+
const weekdays = useMemo(() => weekdayLabels(locale, weekStartsOn), [locale, weekStartsOn]);
|
|
150
|
+
const animateMonthChange = useCallback(delta => {
|
|
151
|
+
triggerHaptic('impactLight');
|
|
152
|
+
const direction = delta > 0 ? 1 : -1;
|
|
153
|
+
const distance = 32;
|
|
154
|
+
Animated.sequence([Animated.parallel([Animated.timing(monthSlide, {
|
|
155
|
+
toValue: -direction * distance,
|
|
156
|
+
duration: 140,
|
|
157
|
+
easing: Easing.out(Easing.quad),
|
|
158
|
+
useNativeDriver: true
|
|
159
|
+
}), Animated.timing(monthFade, {
|
|
160
|
+
toValue: 0,
|
|
161
|
+
duration: 140,
|
|
162
|
+
useNativeDriver: true
|
|
163
|
+
})]), Animated.timing(monthSlide, {
|
|
164
|
+
toValue: direction * distance,
|
|
165
|
+
duration: 0,
|
|
166
|
+
useNativeDriver: true
|
|
167
|
+
}), Animated.parallel([Animated.timing(monthSlide, {
|
|
168
|
+
toValue: 0,
|
|
169
|
+
duration: 160,
|
|
170
|
+
easing: Easing.out(Easing.cubic),
|
|
171
|
+
useNativeDriver: true
|
|
172
|
+
}), Animated.timing(monthFade, {
|
|
173
|
+
toValue: 1,
|
|
174
|
+
duration: 160,
|
|
175
|
+
useNativeDriver: true
|
|
176
|
+
})])]).start();
|
|
177
|
+
const next = addMonths(anchor, delta);
|
|
178
|
+
setAnchor(next);
|
|
179
|
+
AccessibilityInfo.announceForAccessibility(formatMonthYear(next, locale));
|
|
180
|
+
}, [anchor, locale, monthFade, monthSlide]);
|
|
181
|
+
const goPrev = useCallback(() => animateMonthChange(-1), [animateMonthChange]);
|
|
182
|
+
const goNext = useCallback(() => animateMonthChange(1), [animateMonthChange]);
|
|
183
|
+
const pressDay = useCallback(cell => {
|
|
184
|
+
if (isDisabled(cell.date)) return;
|
|
185
|
+
triggerHaptic('selection');
|
|
186
|
+
const target = cell.date;
|
|
187
|
+
|
|
188
|
+
// First tap: pick start. Or, when there's already a complete range, restart.
|
|
189
|
+
if (!pendingStart || pendingStart && pendingEnd) {
|
|
190
|
+
setPendingStart(target);
|
|
191
|
+
setPendingEnd(null);
|
|
192
|
+
} else {
|
|
193
|
+
// We have a start but no end.
|
|
194
|
+
if (target.getTime() < pendingStart.getTime()) {
|
|
195
|
+
// Earlier than start — reset so this becomes the new start.
|
|
196
|
+
setPendingStart(target);
|
|
197
|
+
setPendingEnd(null);
|
|
198
|
+
} else if (isSameDay(target, pendingStart)) {
|
|
199
|
+
// Tapping start again — single-day range.
|
|
200
|
+
setPendingEnd(target);
|
|
201
|
+
} else {
|
|
202
|
+
if (maxRange && daysBetween(pendingStart, target) + 1 > maxRange) {
|
|
203
|
+
// Reject ranges longer than maxRange — restart from the new tap.
|
|
204
|
+
triggerHaptic('notificationWarning');
|
|
205
|
+
setPendingStart(target);
|
|
206
|
+
setPendingEnd(null);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
setPendingEnd(target);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (!cell.inMonth) {
|
|
213
|
+
setAnchor(new Date(cell.date.getFullYear(), cell.date.getMonth(), 1));
|
|
214
|
+
}
|
|
215
|
+
}, [isDisabled, pendingStart, pendingEnd, maxRange]);
|
|
216
|
+
const handleClose = useCallback(() => {
|
|
217
|
+
Animated.parallel([Animated.timing(backdrop, {
|
|
218
|
+
toValue: 0,
|
|
219
|
+
duration: theme.motion.duration.fast,
|
|
220
|
+
easing: Easing.in(Easing.cubic),
|
|
221
|
+
useNativeDriver: true
|
|
222
|
+
}), Animated.timing(sheet, {
|
|
223
|
+
toValue: 0,
|
|
224
|
+
duration: theme.motion.duration.fast,
|
|
225
|
+
easing: Easing.in(Easing.cubic),
|
|
226
|
+
useNativeDriver: true
|
|
227
|
+
})]).start(() => {
|
|
228
|
+
onClose();
|
|
229
|
+
});
|
|
230
|
+
}, [backdrop, onClose, sheet, theme.motion.duration.fast]);
|
|
231
|
+
const handleCancel = useCallback(() => {
|
|
232
|
+
triggerHaptic('selection');
|
|
233
|
+
handleClose();
|
|
234
|
+
}, [handleClose]);
|
|
235
|
+
const handleConfirm = useCallback(() => {
|
|
236
|
+
if (!pendingStart || !pendingEnd) return;
|
|
237
|
+
triggerHaptic('notificationSuccess');
|
|
238
|
+
onChange({
|
|
239
|
+
start: pendingStart,
|
|
240
|
+
end: pendingEnd
|
|
241
|
+
});
|
|
242
|
+
handleClose();
|
|
243
|
+
}, [handleClose, onChange, pendingStart, pendingEnd]);
|
|
244
|
+
const sheetTranslate = sheet.interpolate({
|
|
245
|
+
inputRange: [0, 1],
|
|
246
|
+
outputRange: [320, 0]
|
|
247
|
+
});
|
|
248
|
+
const rangeHeader = useMemo(() => {
|
|
249
|
+
if (pendingStart && pendingEnd) {
|
|
250
|
+
return `${formatRangePart(pendingStart, locale)} — ${formatRangePart(pendingEnd, locale)}`;
|
|
251
|
+
}
|
|
252
|
+
if (pendingStart) {
|
|
253
|
+
return `${formatRangePart(pendingStart, locale)} — …`;
|
|
254
|
+
}
|
|
255
|
+
return '—';
|
|
256
|
+
}, [pendingStart, pendingEnd, locale]);
|
|
257
|
+
const isInRangeInclusive = useCallback(d => {
|
|
258
|
+
if (!pendingStart || !pendingEnd) return false;
|
|
259
|
+
const t = startOfDay(d).getTime();
|
|
260
|
+
return t >= pendingStart.getTime() && t <= pendingEnd.getTime();
|
|
261
|
+
}, [pendingStart, pendingEnd]);
|
|
262
|
+
const confirmDisabled = !pendingStart || !pendingEnd;
|
|
263
|
+
const calendar = /*#__PURE__*/_jsxs(View, {
|
|
264
|
+
style: [styles.card, style],
|
|
265
|
+
ref: ref,
|
|
266
|
+
accessible: false,
|
|
267
|
+
testID: testID,
|
|
268
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
269
|
+
style: styles.titleRow,
|
|
270
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
271
|
+
style: styles.title,
|
|
272
|
+
accessibilityRole: "header",
|
|
273
|
+
children: title
|
|
274
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
275
|
+
style: styles.subtitle,
|
|
276
|
+
accessibilityLiveRegion: "polite",
|
|
277
|
+
children: rangeHeader
|
|
278
|
+
})]
|
|
279
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
280
|
+
style: styles.headerRow,
|
|
281
|
+
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
282
|
+
onPress: goPrev,
|
|
283
|
+
style: ({
|
|
284
|
+
pressed
|
|
285
|
+
}) => [styles.navBtn, pressed && styles.navBtnPressed],
|
|
286
|
+
accessibilityRole: "button",
|
|
287
|
+
accessibilityLabel: "Previous month",
|
|
288
|
+
hitSlop: 8,
|
|
289
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
290
|
+
style: styles.navText,
|
|
291
|
+
children: '‹'
|
|
292
|
+
})
|
|
293
|
+
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
294
|
+
style: [styles.headerLabelWrap, {
|
|
295
|
+
opacity: monthFade,
|
|
296
|
+
transform: [{
|
|
297
|
+
translateX: monthSlide
|
|
298
|
+
}]
|
|
299
|
+
}],
|
|
300
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
301
|
+
style: styles.headerLabel,
|
|
302
|
+
accessibilityLiveRegion: "polite",
|
|
303
|
+
children: headerLabel
|
|
304
|
+
})
|
|
305
|
+
}), /*#__PURE__*/_jsx(Pressable, {
|
|
306
|
+
onPress: goNext,
|
|
307
|
+
style: ({
|
|
308
|
+
pressed
|
|
309
|
+
}) => [styles.navBtn, pressed && styles.navBtnPressed],
|
|
310
|
+
accessibilityRole: "button",
|
|
311
|
+
accessibilityLabel: "Next month",
|
|
312
|
+
hitSlop: 8,
|
|
313
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
314
|
+
style: styles.navText,
|
|
315
|
+
children: '›'
|
|
316
|
+
})
|
|
317
|
+
})]
|
|
318
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
319
|
+
style: styles.weekdayRow,
|
|
320
|
+
children: weekdays.map((wd, idx) => /*#__PURE__*/_jsx(View, {
|
|
321
|
+
style: styles.weekdayCell,
|
|
322
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
323
|
+
style: styles.weekdayText,
|
|
324
|
+
children: wd
|
|
325
|
+
})
|
|
326
|
+
}, `${wd}-${idx}`))
|
|
327
|
+
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
328
|
+
style: [styles.grid, {
|
|
329
|
+
opacity: monthFade,
|
|
330
|
+
transform: [{
|
|
331
|
+
translateX: monthSlide
|
|
332
|
+
}]
|
|
333
|
+
}],
|
|
334
|
+
children: Array.from({
|
|
335
|
+
length: 6
|
|
336
|
+
}).map((_, row) => /*#__PURE__*/_jsx(View, {
|
|
337
|
+
style: styles.gridRow,
|
|
338
|
+
children: cells.slice(row * 7, row * 7 + 7).map(cell => {
|
|
339
|
+
const disabled = isDisabled(cell.date);
|
|
340
|
+
const isStart = pendingStart ? isSameDay(cell.date, pendingStart) : false;
|
|
341
|
+
const isEnd = pendingEnd ? isSameDay(cell.date, pendingEnd) : false;
|
|
342
|
+
const inRange = isInRangeInclusive(cell.date);
|
|
343
|
+
const isMidRange = inRange && !isStart && !isEnd;
|
|
344
|
+
const todayCell = isSameDay(cell.date, today);
|
|
345
|
+
const edgeColor = theme.colors.primary;
|
|
346
|
+
const midColor = theme.colors.primaryMuted;
|
|
347
|
+
const textColor = isStart || isEnd ? theme.colors.text.inverse : !cell.inMonth ? theme.colors.text.tertiary : disabled ? theme.colors.text.disabled : theme.colors.text.primary;
|
|
348
|
+
const opacity = disabled ? 0.3 : !cell.inMonth ? 0.4 : 1;
|
|
349
|
+
|
|
350
|
+
// For middle days connect via a full-width bar background on the cell;
|
|
351
|
+
// edges connect on one side (right for start, left for end).
|
|
352
|
+
const showLeftBar = inRange && !!pendingStart && !!pendingEnd && (isEnd || isMidRange);
|
|
353
|
+
const showRightBar = inRange && !!pendingStart && !!pendingEnd && (isStart || isMidRange);
|
|
354
|
+
const a11ySuffix = isStart ? ', start of range' : isEnd ? ', end of range' : isMidRange ? ', in selected range' : '';
|
|
355
|
+
return /*#__PURE__*/_jsxs(Pressable, {
|
|
356
|
+
disabled: disabled,
|
|
357
|
+
onPress: () => pressDay(cell),
|
|
358
|
+
accessibilityRole: "button",
|
|
359
|
+
accessibilityLabel: `${formatLongDate(cell.date, locale)}${a11ySuffix}`,
|
|
360
|
+
accessibilityState: {
|
|
361
|
+
selected: isStart || isEnd,
|
|
362
|
+
disabled,
|
|
363
|
+
busy: isMidRange
|
|
364
|
+
},
|
|
365
|
+
style: styles.dayCell,
|
|
366
|
+
children: [showLeftBar ? /*#__PURE__*/_jsx(View, {
|
|
367
|
+
style: [styles.barLeft, {
|
|
368
|
+
backgroundColor: midColor
|
|
369
|
+
}],
|
|
370
|
+
pointerEvents: "none"
|
|
371
|
+
}) : null, showRightBar ? /*#__PURE__*/_jsx(View, {
|
|
372
|
+
style: [styles.barRight, {
|
|
373
|
+
backgroundColor: midColor
|
|
374
|
+
}],
|
|
375
|
+
pointerEvents: "none"
|
|
376
|
+
}) : null, /*#__PURE__*/_jsx(View, {
|
|
377
|
+
style: [styles.dayInner, {
|
|
378
|
+
backgroundColor: isStart || isEnd ? edgeColor : isMidRange ? midColor : 'transparent',
|
|
379
|
+
borderColor: todayCell && !(isStart || isEnd) ? edgeColor : 'transparent',
|
|
380
|
+
borderWidth: todayCell && !(isStart || isEnd) ? 1.5 : 0,
|
|
381
|
+
borderRadius: isMidRange ? theme.radius.none : theme.radius.full,
|
|
382
|
+
opacity
|
|
383
|
+
}],
|
|
384
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
385
|
+
style: [styles.dayText, {
|
|
386
|
+
color: textColor
|
|
387
|
+
}],
|
|
388
|
+
children: cell.date.getDate()
|
|
389
|
+
})
|
|
390
|
+
})]
|
|
391
|
+
}, cell.iso);
|
|
392
|
+
})
|
|
393
|
+
}, `r-${row}`))
|
|
394
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
395
|
+
style: styles.footer,
|
|
396
|
+
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
397
|
+
onPress: handleCancel,
|
|
398
|
+
style: ({
|
|
399
|
+
pressed
|
|
400
|
+
}) => [styles.footerBtn, styles.footerCancel, pressed && styles.footerBtnPressed],
|
|
401
|
+
accessibilityRole: "button",
|
|
402
|
+
accessibilityLabel: cancelLabel,
|
|
403
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
404
|
+
style: [styles.footerBtnText, {
|
|
405
|
+
color: theme.colors.text.secondary
|
|
406
|
+
}],
|
|
407
|
+
children: cancelLabel
|
|
408
|
+
})
|
|
409
|
+
}), /*#__PURE__*/_jsx(Pressable, {
|
|
410
|
+
onPress: handleConfirm,
|
|
411
|
+
disabled: confirmDisabled,
|
|
412
|
+
style: ({
|
|
413
|
+
pressed
|
|
414
|
+
}) => [styles.footerBtn, styles.footerConfirm, {
|
|
415
|
+
backgroundColor: theme.colors.primary,
|
|
416
|
+
opacity: confirmDisabled ? 0.5 : 1
|
|
417
|
+
}, pressed && {
|
|
418
|
+
backgroundColor: theme.colors.primaryHover
|
|
419
|
+
}],
|
|
420
|
+
accessibilityRole: "button",
|
|
421
|
+
accessibilityLabel: confirmLabel,
|
|
422
|
+
accessibilityState: {
|
|
423
|
+
disabled: confirmDisabled
|
|
424
|
+
},
|
|
425
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
426
|
+
style: [styles.footerBtnText, {
|
|
427
|
+
color: theme.colors.text.inverse
|
|
428
|
+
}],
|
|
429
|
+
children: confirmLabel
|
|
430
|
+
})
|
|
431
|
+
})]
|
|
432
|
+
})]
|
|
433
|
+
});
|
|
434
|
+
return /*#__PURE__*/_jsxs(Modal, {
|
|
435
|
+
visible: visible,
|
|
436
|
+
transparent: true,
|
|
437
|
+
statusBarTranslucent: true,
|
|
438
|
+
animationType: "none",
|
|
439
|
+
onRequestClose: handleClose,
|
|
440
|
+
children: [/*#__PURE__*/_jsx(Animated.View, {
|
|
441
|
+
style: [styles.backdrop, {
|
|
442
|
+
opacity: backdrop,
|
|
443
|
+
backgroundColor: theme.colors.background.overlay
|
|
444
|
+
}],
|
|
445
|
+
children: /*#__PURE__*/_jsx(Pressable, {
|
|
446
|
+
style: StyleSheet.absoluteFill,
|
|
447
|
+
onPress: handleClose,
|
|
448
|
+
accessibilityLabel: "Dismiss"
|
|
449
|
+
})
|
|
450
|
+
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
451
|
+
style: [styles.sheetWrap, {
|
|
452
|
+
opacity: sheet,
|
|
453
|
+
transform: [{
|
|
454
|
+
translateY: sheetTranslate
|
|
455
|
+
}]
|
|
456
|
+
}],
|
|
457
|
+
accessibilityViewIsModal: true,
|
|
458
|
+
accessibilityRole: "none",
|
|
459
|
+
children: calendar
|
|
460
|
+
})]
|
|
461
|
+
});
|
|
462
|
+
});
|
|
463
|
+
DateRangePicker.displayName = 'DateRangePicker';
|
|
464
|
+
const buildStyles = theme => {
|
|
465
|
+
const cardShadow = theme.shadows.lg;
|
|
466
|
+
return StyleSheet.create({
|
|
467
|
+
backdrop: {
|
|
468
|
+
...StyleSheet.absoluteFillObject
|
|
469
|
+
},
|
|
470
|
+
sheetWrap: {
|
|
471
|
+
position: 'absolute',
|
|
472
|
+
left: 0,
|
|
473
|
+
right: 0,
|
|
474
|
+
bottom: 0,
|
|
475
|
+
paddingHorizontal: theme.spacing.md,
|
|
476
|
+
paddingBottom: theme.spacing.lg
|
|
477
|
+
},
|
|
478
|
+
card: {
|
|
479
|
+
backgroundColor: theme.colors.background.elevated,
|
|
480
|
+
borderRadius: theme.radius.xl,
|
|
481
|
+
padding: theme.spacing.lg,
|
|
482
|
+
shadowColor: cardShadow.shadowColor,
|
|
483
|
+
shadowOffset: cardShadow.shadowOffset,
|
|
484
|
+
shadowOpacity: cardShadow.shadowOpacity,
|
|
485
|
+
shadowRadius: cardShadow.shadowRadius,
|
|
486
|
+
elevation: cardShadow.elevation
|
|
487
|
+
},
|
|
488
|
+
titleRow: {
|
|
489
|
+
marginBottom: theme.spacing.sm
|
|
490
|
+
},
|
|
491
|
+
title: {
|
|
492
|
+
fontSize: theme.typography.fontSize.lg,
|
|
493
|
+
fontWeight: theme.typography.fontWeight.semibold,
|
|
494
|
+
color: theme.colors.text.primary
|
|
495
|
+
},
|
|
496
|
+
subtitle: {
|
|
497
|
+
marginTop: theme.spacing.xxs,
|
|
498
|
+
fontSize: theme.typography.fontSize.sm,
|
|
499
|
+
color: theme.colors.text.secondary
|
|
500
|
+
},
|
|
501
|
+
headerRow: {
|
|
502
|
+
flexDirection: 'row',
|
|
503
|
+
alignItems: 'center',
|
|
504
|
+
justifyContent: 'space-between',
|
|
505
|
+
marginBottom: theme.spacing.md
|
|
506
|
+
},
|
|
507
|
+
navBtn: {
|
|
508
|
+
width: 36,
|
|
509
|
+
height: 36,
|
|
510
|
+
borderRadius: theme.radius.full,
|
|
511
|
+
alignItems: 'center',
|
|
512
|
+
justifyContent: 'center',
|
|
513
|
+
backgroundColor: theme.colors.background.secondary
|
|
514
|
+
},
|
|
515
|
+
navBtnPressed: {
|
|
516
|
+
backgroundColor: theme.colors.surface.pressed
|
|
517
|
+
},
|
|
518
|
+
navText: {
|
|
519
|
+
fontSize: 22,
|
|
520
|
+
lineHeight: 24,
|
|
521
|
+
color: theme.colors.text.primary,
|
|
522
|
+
fontWeight: theme.typography.fontWeight.semibold
|
|
523
|
+
},
|
|
524
|
+
headerLabelWrap: {
|
|
525
|
+
flex: 1,
|
|
526
|
+
alignItems: 'center'
|
|
527
|
+
},
|
|
528
|
+
headerLabel: {
|
|
529
|
+
fontSize: theme.typography.fontSize.base,
|
|
530
|
+
fontWeight: theme.typography.fontWeight.semibold,
|
|
531
|
+
color: theme.colors.text.primary
|
|
532
|
+
},
|
|
533
|
+
weekdayRow: {
|
|
534
|
+
flexDirection: 'row',
|
|
535
|
+
marginBottom: theme.spacing.xs
|
|
536
|
+
},
|
|
537
|
+
weekdayCell: {
|
|
538
|
+
flex: 1,
|
|
539
|
+
alignItems: 'center',
|
|
540
|
+
paddingVertical: theme.spacing.xs
|
|
541
|
+
},
|
|
542
|
+
weekdayText: {
|
|
543
|
+
fontSize: theme.typography.fontSize.xs,
|
|
544
|
+
fontWeight: theme.typography.fontWeight.medium,
|
|
545
|
+
color: theme.colors.text.tertiary,
|
|
546
|
+
letterSpacing: theme.typography.letterSpacing.wide
|
|
547
|
+
},
|
|
548
|
+
grid: {
|
|
549
|
+
// Animated wrapper.
|
|
550
|
+
},
|
|
551
|
+
gridRow: {
|
|
552
|
+
flexDirection: 'row'
|
|
553
|
+
},
|
|
554
|
+
dayCell: {
|
|
555
|
+
flex: 1,
|
|
556
|
+
aspectRatio: 1,
|
|
557
|
+
alignItems: 'center',
|
|
558
|
+
justifyContent: 'center',
|
|
559
|
+
padding: 2,
|
|
560
|
+
position: 'relative'
|
|
561
|
+
},
|
|
562
|
+
barLeft: {
|
|
563
|
+
position: 'absolute',
|
|
564
|
+
left: 0,
|
|
565
|
+
right: '50%',
|
|
566
|
+
top: '15%',
|
|
567
|
+
bottom: '15%'
|
|
568
|
+
},
|
|
569
|
+
barRight: {
|
|
570
|
+
position: 'absolute',
|
|
571
|
+
left: '50%',
|
|
572
|
+
right: 0,
|
|
573
|
+
top: '15%',
|
|
574
|
+
bottom: '15%'
|
|
575
|
+
},
|
|
576
|
+
dayInner: {
|
|
577
|
+
width: '100%',
|
|
578
|
+
height: '100%',
|
|
579
|
+
alignItems: 'center',
|
|
580
|
+
justifyContent: 'center'
|
|
581
|
+
},
|
|
582
|
+
dayText: {
|
|
583
|
+
fontSize: theme.typography.fontSize.sm,
|
|
584
|
+
fontWeight: theme.typography.fontWeight.medium
|
|
585
|
+
},
|
|
586
|
+
footer: {
|
|
587
|
+
flexDirection: 'row',
|
|
588
|
+
justifyContent: 'flex-end',
|
|
589
|
+
alignItems: 'center',
|
|
590
|
+
marginTop: theme.spacing.lg,
|
|
591
|
+
gap: theme.spacing.sm
|
|
592
|
+
},
|
|
593
|
+
footerBtn: {
|
|
594
|
+
paddingHorizontal: theme.spacing.lg,
|
|
595
|
+
paddingVertical: theme.spacing.sm,
|
|
596
|
+
borderRadius: theme.radius.md,
|
|
597
|
+
minHeight: 40,
|
|
598
|
+
alignItems: 'center',
|
|
599
|
+
justifyContent: 'center'
|
|
600
|
+
},
|
|
601
|
+
footerCancel: {
|
|
602
|
+
backgroundColor: 'transparent'
|
|
603
|
+
},
|
|
604
|
+
footerConfirm: {
|
|
605
|
+
// backgroundColor set inline.
|
|
606
|
+
},
|
|
607
|
+
footerBtnPressed: {
|
|
608
|
+
opacity: 0.85
|
|
609
|
+
},
|
|
610
|
+
footerBtnText: {
|
|
611
|
+
fontSize: theme.typography.fontSize.sm,
|
|
612
|
+
fontWeight: theme.typography.fontWeight.semibold
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
};
|
|
616
|
+
export { DateRangePicker };
|
|
617
|
+
export default DateRangePicker;
|
|
618
|
+
//# sourceMappingURL=DateRangePicker.js.map
|