@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,288 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.BottomNavigation = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
|
10
|
+
var _index = require("../../theme/index.js");
|
|
11
|
+
var _index2 = require("../../utils/index.js");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
|
+
const ICON_SIZE = 24;
|
|
15
|
+
const PILL_HEIGHT = 36;
|
|
16
|
+
const UNDERLINE_HEIGHT = 3;
|
|
17
|
+
const formatBadge = value => {
|
|
18
|
+
if (value === null || value === undefined || value === false) return null;
|
|
19
|
+
if (value === true || value === '·') return {
|
|
20
|
+
text: '',
|
|
21
|
+
isDot: true
|
|
22
|
+
};
|
|
23
|
+
if (typeof value === 'number') {
|
|
24
|
+
if (value <= 0) return null;
|
|
25
|
+
return {
|
|
26
|
+
text: value > 99 ? '99+' : String(value),
|
|
27
|
+
isDot: false
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
if (typeof value === 'string') {
|
|
31
|
+
if (value.length === 0) return null;
|
|
32
|
+
return {
|
|
33
|
+
text: value,
|
|
34
|
+
isDot: false
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
};
|
|
39
|
+
const badgeAccessibilitySuffix = value => {
|
|
40
|
+
if (value === null || value === undefined || value === false) return '';
|
|
41
|
+
if (typeof value === 'number') {
|
|
42
|
+
return value > 0 ? `, ${value} unread` : '';
|
|
43
|
+
}
|
|
44
|
+
if (value === true || value === '·') return ', new updates';
|
|
45
|
+
if (typeof value === 'string' && value.length > 0) return `, ${value}`;
|
|
46
|
+
return '';
|
|
47
|
+
};
|
|
48
|
+
const BottomNavigation = exports.BottomNavigation = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
49
|
+
const {
|
|
50
|
+
tabs,
|
|
51
|
+
activeTab,
|
|
52
|
+
onTabPress,
|
|
53
|
+
haptic = 'selection',
|
|
54
|
+
showLabels = true,
|
|
55
|
+
variant = 'pill',
|
|
56
|
+
style,
|
|
57
|
+
indicatorStyle,
|
|
58
|
+
labelStyle,
|
|
59
|
+
testID
|
|
60
|
+
} = props;
|
|
61
|
+
const theme = (0, _index.useTheme)();
|
|
62
|
+
const insets = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
|
|
63
|
+
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
64
|
+
const activeIndex = Math.max(0, tabs.findIndex(tab => tab.key === activeTab));
|
|
65
|
+
const [tabWidth, setTabWidth] = _react.default.useState(0);
|
|
66
|
+
const indicatorTranslateX = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
|
|
67
|
+
const iconScales = (0, _react.useRef)({});
|
|
68
|
+
|
|
69
|
+
// Ensure each tab has a persistent scale value
|
|
70
|
+
tabs.forEach(tab => {
|
|
71
|
+
if (!iconScales.current[tab.key]) {
|
|
72
|
+
iconScales.current[tab.key] = new _reactNative.Animated.Value(1);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Animate indicator when active tab changes or layout settles
|
|
77
|
+
(0, _react.useEffect)(() => {
|
|
78
|
+
if (tabWidth <= 0) return;
|
|
79
|
+
_reactNative.Animated.spring(indicatorTranslateX, {
|
|
80
|
+
toValue: activeIndex * tabWidth,
|
|
81
|
+
tension: 120,
|
|
82
|
+
friction: 14,
|
|
83
|
+
useNativeDriver: true
|
|
84
|
+
}).start();
|
|
85
|
+
}, [activeIndex, tabWidth, indicatorTranslateX]);
|
|
86
|
+
const handleLayout = e => {
|
|
87
|
+
const total = e.nativeEvent.layout.width;
|
|
88
|
+
if (tabs.length > 0) {
|
|
89
|
+
setTabWidth(total / tabs.length);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const handlePress = tab => {
|
|
93
|
+
if (tab.key !== activeTab && haptic !== false) {
|
|
94
|
+
(0, _index2.triggerHaptic)(haptic);
|
|
95
|
+
}
|
|
96
|
+
const scale = iconScales.current[tab.key];
|
|
97
|
+
if (scale) {
|
|
98
|
+
_reactNative.Animated.sequence([_reactNative.Animated.timing(scale, {
|
|
99
|
+
toValue: 1.15,
|
|
100
|
+
duration: 120,
|
|
101
|
+
useNativeDriver: true
|
|
102
|
+
}), _reactNative.Animated.spring(scale, {
|
|
103
|
+
toValue: 1,
|
|
104
|
+
tension: 200,
|
|
105
|
+
friction: 8,
|
|
106
|
+
useNativeDriver: true
|
|
107
|
+
})]).start();
|
|
108
|
+
}
|
|
109
|
+
onTabPress(tab.key);
|
|
110
|
+
};
|
|
111
|
+
const paddingBottom = Math.max(8, insets.bottom);
|
|
112
|
+
|
|
113
|
+
// Pill width is intrinsic; we compute its rendered offset to keep it centered
|
|
114
|
+
// within each tab cell when it animates.
|
|
115
|
+
const pillWidth = tabWidth > 0 ? Math.min(tabWidth - 16, 120) : 0;
|
|
116
|
+
const pillOffset = tabWidth > 0 ? (tabWidth - pillWidth) / 2 : 0;
|
|
117
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
118
|
+
ref: ref,
|
|
119
|
+
testID: testID,
|
|
120
|
+
accessibilityRole: "tablist",
|
|
121
|
+
style: [styles.container, theme.shadows.lg, {
|
|
122
|
+
backgroundColor: theme.colors.background.elevated,
|
|
123
|
+
borderTopColor: theme.colors.border.primary,
|
|
124
|
+
paddingBottom
|
|
125
|
+
}, style],
|
|
126
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
127
|
+
style: styles.tabRow,
|
|
128
|
+
onLayout: handleLayout,
|
|
129
|
+
children: [variant === 'pill' && pillWidth > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
|
|
130
|
+
pointerEvents: "none",
|
|
131
|
+
style: [styles.pill, {
|
|
132
|
+
width: pillWidth,
|
|
133
|
+
height: PILL_HEIGHT,
|
|
134
|
+
backgroundColor: theme.colors.primaryMuted,
|
|
135
|
+
borderRadius: theme.radius.full,
|
|
136
|
+
transform: [{
|
|
137
|
+
translateX: _reactNative.Animated.add(indicatorTranslateX, new _reactNative.Animated.Value(pillOffset))
|
|
138
|
+
}]
|
|
139
|
+
}, indicatorStyle]
|
|
140
|
+
}) : null, tabs.map((tab, index) => {
|
|
141
|
+
const isActive = tab.key === activeTab;
|
|
142
|
+
const color = isActive ? theme.colors.primary : theme.colors.text.tertiary;
|
|
143
|
+
const renderIcon = isActive && tab.activeIcon ? tab.activeIcon : tab.icon;
|
|
144
|
+
const scale = iconScales.current[tab.key];
|
|
145
|
+
const badge = formatBadge(tab.badge ?? null);
|
|
146
|
+
const a11ySuffix = badgeAccessibilitySuffix(tab.badge ?? null);
|
|
147
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
|
|
148
|
+
onPress: () => handlePress(tab),
|
|
149
|
+
accessibilityRole: "tab",
|
|
150
|
+
accessibilityState: {
|
|
151
|
+
selected: isActive
|
|
152
|
+
},
|
|
153
|
+
accessibilityLabel: `${tab.label}${a11ySuffix}`,
|
|
154
|
+
accessibilityHint: `Switches to ${tab.label}`,
|
|
155
|
+
hitSlop: {
|
|
156
|
+
top: 6,
|
|
157
|
+
bottom: 6,
|
|
158
|
+
left: 6,
|
|
159
|
+
right: 6
|
|
160
|
+
},
|
|
161
|
+
style: ({
|
|
162
|
+
pressed
|
|
163
|
+
}) => [styles.tab, pressed ? {
|
|
164
|
+
opacity: 0.85
|
|
165
|
+
} : null],
|
|
166
|
+
testID: testID ? `${testID}-tab-${tab.key}` : undefined,
|
|
167
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Animated.View, {
|
|
168
|
+
style: [styles.iconWrap, {
|
|
169
|
+
transform: [{
|
|
170
|
+
scale
|
|
171
|
+
}]
|
|
172
|
+
}],
|
|
173
|
+
children: [renderIcon({
|
|
174
|
+
color,
|
|
175
|
+
size: ICON_SIZE,
|
|
176
|
+
focused: isActive
|
|
177
|
+
}), badge ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
178
|
+
style: [badge.isDot ? styles.badgeDot : styles.badgePill, {
|
|
179
|
+
backgroundColor: theme.colors.error,
|
|
180
|
+
borderColor: theme.colors.background.elevated
|
|
181
|
+
}],
|
|
182
|
+
children: badge.isDot ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
183
|
+
style: [styles.badgeText, {
|
|
184
|
+
color: theme.colors.text.inverse
|
|
185
|
+
}],
|
|
186
|
+
numberOfLines: 1,
|
|
187
|
+
children: badge.text
|
|
188
|
+
})
|
|
189
|
+
}) : null]
|
|
190
|
+
}), showLabels ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
191
|
+
numberOfLines: 1,
|
|
192
|
+
style: [styles.label, {
|
|
193
|
+
color,
|
|
194
|
+
fontWeight: isActive ? theme.typography.fontWeight.semibold : theme.typography.fontWeight.normal
|
|
195
|
+
}, labelStyle],
|
|
196
|
+
children: tab.label
|
|
197
|
+
}) : null]
|
|
198
|
+
}, tab.key);
|
|
199
|
+
}), variant === 'underline' && tabWidth > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
|
|
200
|
+
pointerEvents: "none",
|
|
201
|
+
style: [styles.underline, {
|
|
202
|
+
width: tabWidth,
|
|
203
|
+
backgroundColor: theme.colors.primary,
|
|
204
|
+
transform: [{
|
|
205
|
+
translateX: indicatorTranslateX
|
|
206
|
+
}]
|
|
207
|
+
}, indicatorStyle]
|
|
208
|
+
}) : null]
|
|
209
|
+
})
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
BottomNavigation.displayName = 'BottomNavigation';
|
|
213
|
+
const buildStyles = theme => _reactNative.StyleSheet.create({
|
|
214
|
+
container: {
|
|
215
|
+
borderTopWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
216
|
+
paddingTop: 6,
|
|
217
|
+
paddingHorizontal: 4
|
|
218
|
+
},
|
|
219
|
+
tabRow: {
|
|
220
|
+
flexDirection: 'row',
|
|
221
|
+
alignItems: 'stretch',
|
|
222
|
+
position: 'relative'
|
|
223
|
+
},
|
|
224
|
+
tab: {
|
|
225
|
+
flex: 1,
|
|
226
|
+
minHeight: 44,
|
|
227
|
+
alignItems: 'center',
|
|
228
|
+
justifyContent: 'center',
|
|
229
|
+
paddingVertical: 6,
|
|
230
|
+
gap: 2
|
|
231
|
+
},
|
|
232
|
+
iconWrap: {
|
|
233
|
+
width: ICON_SIZE + 8,
|
|
234
|
+
height: ICON_SIZE + 8,
|
|
235
|
+
alignItems: 'center',
|
|
236
|
+
justifyContent: 'center',
|
|
237
|
+
position: 'relative'
|
|
238
|
+
},
|
|
239
|
+
label: {
|
|
240
|
+
fontSize: theme.typography.fontSize.xs,
|
|
241
|
+
lineHeight: theme.typography.fontSize.xs * theme.typography.lineHeight.tight,
|
|
242
|
+
textAlign: 'center'
|
|
243
|
+
},
|
|
244
|
+
pill: {
|
|
245
|
+
position: 'absolute',
|
|
246
|
+
top: 4,
|
|
247
|
+
left: 0
|
|
248
|
+
},
|
|
249
|
+
underline: {
|
|
250
|
+
position: 'absolute',
|
|
251
|
+
bottom: -6,
|
|
252
|
+
left: 0,
|
|
253
|
+
height: UNDERLINE_HEIGHT,
|
|
254
|
+
borderTopLeftRadius: 2,
|
|
255
|
+
borderTopRightRadius: 2
|
|
256
|
+
},
|
|
257
|
+
badgePill: {
|
|
258
|
+
position: 'absolute',
|
|
259
|
+
top: -4,
|
|
260
|
+
right: -8,
|
|
261
|
+
minWidth: 18,
|
|
262
|
+
height: 18,
|
|
263
|
+
borderRadius: 9,
|
|
264
|
+
paddingHorizontal: 4,
|
|
265
|
+
paddingVertical: 2,
|
|
266
|
+
alignItems: 'center',
|
|
267
|
+
justifyContent: 'center',
|
|
268
|
+
borderWidth: 1.5
|
|
269
|
+
},
|
|
270
|
+
badgeDot: {
|
|
271
|
+
position: 'absolute',
|
|
272
|
+
top: -2,
|
|
273
|
+
right: -2,
|
|
274
|
+
width: 10,
|
|
275
|
+
height: 10,
|
|
276
|
+
borderRadius: 5,
|
|
277
|
+
borderWidth: 1.5
|
|
278
|
+
},
|
|
279
|
+
badgeText: {
|
|
280
|
+
fontSize: 10,
|
|
281
|
+
fontWeight: '700',
|
|
282
|
+
lineHeight: 12,
|
|
283
|
+
textAlign: 'center',
|
|
284
|
+
includeFontPadding: false
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
var _default = exports.default = BottomNavigation;
|
|
288
|
+
//# sourceMappingURL=BottomNavigation.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "BottomNavigation", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _BottomNavigation.BottomNavigation;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "default", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _BottomNavigation.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _BottomNavigation = _interopRequireWildcard(require("./BottomNavigation.js"));
|
|
19
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.BottomSheet = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeGestureHandler = require("react-native-gesture-handler");
|
|
10
|
+
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
11
|
+
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
|
12
|
+
var _index = require("../../theme/index.js");
|
|
13
|
+
var _index2 = require("../../utils/index.js");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
+
/**
|
|
17
|
+
* BottomSheet — Reanimated 3 + Gesture Handler 2 implementation.
|
|
18
|
+
*
|
|
19
|
+
* A polished, theme-aware bottom sheet with multi-snap-point support,
|
|
20
|
+
* UI-thread driven pan gestures, and native-driver spring animations.
|
|
21
|
+
*
|
|
22
|
+
* USAGE:
|
|
23
|
+
*
|
|
24
|
+
* const ref = useRef<BottomSheetRef>(null);
|
|
25
|
+
* <BottomSheet ref={ref} snapPoints={[200, '50%', '90%']}>
|
|
26
|
+
* <YourContent />
|
|
27
|
+
* </BottomSheet>
|
|
28
|
+
*
|
|
29
|
+
* ref.current?.expand(); // open at first snap point (or `index` prop)
|
|
30
|
+
* ref.current?.expand(2); // open at specific index
|
|
31
|
+
* ref.current?.collapse(); // animate to smallest snap point
|
|
32
|
+
* ref.current?.close(); // dismiss
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
const SPRING_CONFIG = {
|
|
36
|
+
damping: 20,
|
|
37
|
+
stiffness: 240,
|
|
38
|
+
mass: 1
|
|
39
|
+
};
|
|
40
|
+
const CLOSE_VELOCITY_THRESHOLD = 1000;
|
|
41
|
+
const DRAG_ACTIVATION_OFFSET = 10;
|
|
42
|
+
const BottomSheet = exports.BottomSheet = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
43
|
+
const {
|
|
44
|
+
snapPoints,
|
|
45
|
+
index: controlledIndex,
|
|
46
|
+
onChange,
|
|
47
|
+
onAnimate,
|
|
48
|
+
enablePanDownToClose = true,
|
|
49
|
+
enableBackdropPress = true,
|
|
50
|
+
backdropOpacity = 0.5,
|
|
51
|
+
handleIndicatorStyle,
|
|
52
|
+
containerStyle,
|
|
53
|
+
children,
|
|
54
|
+
accessibilityLabel,
|
|
55
|
+
accessibilityViewIsModal,
|
|
56
|
+
testID
|
|
57
|
+
} = props;
|
|
58
|
+
const theme = (0, _index.useTheme)();
|
|
59
|
+
const insets = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
|
|
60
|
+
const [screenHeight, setScreenHeight] = (0, _react.useState)(() => _reactNative.Dimensions.get('window').height);
|
|
61
|
+
|
|
62
|
+
// Resolve snap points (px values), sorted ascending so larger height = smaller translateY.
|
|
63
|
+
const resolvedSnapPoints = (0, _react.useMemo)(() => resolveSnapPoints(snapPoints, screenHeight), [snapPoints, screenHeight]);
|
|
64
|
+
|
|
65
|
+
// Listen for orientation / window changes so % snap points stay accurate.
|
|
66
|
+
(0, _react.useEffect)(() => {
|
|
67
|
+
const sub = _reactNative.Dimensions.addEventListener('change', ({
|
|
68
|
+
window
|
|
69
|
+
}) => {
|
|
70
|
+
setScreenHeight(window.height);
|
|
71
|
+
});
|
|
72
|
+
return () => sub.remove();
|
|
73
|
+
}, []);
|
|
74
|
+
const closedY = screenHeight; // fully off-screen
|
|
75
|
+
const minSnapPoint = resolvedSnapPoints[0] ?? 0;
|
|
76
|
+
const maxSnapPoint = resolvedSnapPoints[resolvedSnapPoints.length - 1] ?? 0;
|
|
77
|
+
|
|
78
|
+
// translateY: 0 = top of screen, screenHeight = fully closed.
|
|
79
|
+
const translateY = (0, _reactNativeReanimated.useSharedValue)(closedY);
|
|
80
|
+
// Captures the translateY at gesture start so onUpdate can be additive.
|
|
81
|
+
const dragStartY = (0, _reactNativeReanimated.useSharedValue)(closedY);
|
|
82
|
+
// Tracks current snap index on the JS thread (mirrored to a shared value for worklets).
|
|
83
|
+
const currentIndexShared = (0, _reactNativeReanimated.useSharedValue)(-1);
|
|
84
|
+
const [currentIndex, setCurrentIndex] = (0, _react.useState)(-1);
|
|
85
|
+
const isAnimatingRef = (0, _react.useRef)(false);
|
|
86
|
+
|
|
87
|
+
// Convert a snap-point index → translateY position. -1 = closed.
|
|
88
|
+
const yForIndex = (0, _react.useCallback)(idx => {
|
|
89
|
+
if (idx < 0 || idx >= resolvedSnapPoints.length) return closedY;
|
|
90
|
+
const sheetHeight = resolvedSnapPoints[idx];
|
|
91
|
+
return screenHeight - sheetHeight;
|
|
92
|
+
}, [resolvedSnapPoints, screenHeight, closedY]);
|
|
93
|
+
const setIndexJS = (0, _react.useCallback)(next => {
|
|
94
|
+
const previous = currentIndex;
|
|
95
|
+
if (previous === next) return;
|
|
96
|
+
setCurrentIndex(next);
|
|
97
|
+
currentIndexShared.value = next;
|
|
98
|
+
onChange?.(next);
|
|
99
|
+
}, [currentIndex, currentIndexShared, onChange]);
|
|
100
|
+
const animateTo = (0, _react.useCallback)((to, fromIndex, toIndex) => {
|
|
101
|
+
isAnimatingRef.current = true;
|
|
102
|
+
onAnimate?.(fromIndex, toIndex);
|
|
103
|
+
translateY.value = (0, _reactNativeReanimated.withSpring)(to, SPRING_CONFIG, finished => {
|
|
104
|
+
'worklet';
|
|
105
|
+
|
|
106
|
+
if (finished) {
|
|
107
|
+
(0, _reactNativeReanimated.runOnJS)(markAnimationDone)();
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}, [onAnimate, translateY]);
|
|
111
|
+
const markAnimationDone = (0, _react.useCallback)(() => {
|
|
112
|
+
isAnimatingRef.current = false;
|
|
113
|
+
}, []);
|
|
114
|
+
const expand = (0, _react.useCallback)(idx => {
|
|
115
|
+
const target = typeof idx === 'number' ? clamp(idx, 0, resolvedSnapPoints.length - 1) : currentIndex >= 0 ? currentIndex : 0;
|
|
116
|
+
const fromIndex = currentIndexShared.value;
|
|
117
|
+
const to = yForIndex(target);
|
|
118
|
+
setIndexJS(target);
|
|
119
|
+
animateTo(to, fromIndex, target);
|
|
120
|
+
}, [animateTo, currentIndex, currentIndexShared, resolvedSnapPoints.length, setIndexJS, yForIndex]);
|
|
121
|
+
const collapse = (0, _react.useCallback)(() => {
|
|
122
|
+
if (resolvedSnapPoints.length === 0) return;
|
|
123
|
+
const fromIndex = currentIndexShared.value;
|
|
124
|
+
const to = yForIndex(0);
|
|
125
|
+
setIndexJS(0);
|
|
126
|
+
animateTo(to, fromIndex, 0);
|
|
127
|
+
}, [animateTo, currentIndexShared, resolvedSnapPoints.length, setIndexJS, yForIndex]);
|
|
128
|
+
const close = (0, _react.useCallback)(() => {
|
|
129
|
+
const fromIndex = currentIndexShared.value;
|
|
130
|
+
setIndexJS(-1);
|
|
131
|
+
isAnimatingRef.current = true;
|
|
132
|
+
onAnimate?.(fromIndex, -1);
|
|
133
|
+
translateY.value = (0, _reactNativeReanimated.withTiming)(closedY, {
|
|
134
|
+
duration: 220
|
|
135
|
+
}, finished => {
|
|
136
|
+
'worklet';
|
|
137
|
+
|
|
138
|
+
if (finished) {
|
|
139
|
+
(0, _reactNativeReanimated.runOnJS)(markAnimationDone)();
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}, [closedY, currentIndexShared, markAnimationDone, onAnimate, setIndexJS, translateY]);
|
|
143
|
+
(0, _react.useImperativeHandle)(ref, () => ({
|
|
144
|
+
expand,
|
|
145
|
+
collapse,
|
|
146
|
+
close
|
|
147
|
+
}), [expand, collapse, close]);
|
|
148
|
+
|
|
149
|
+
// Drive the controlled `index` prop.
|
|
150
|
+
(0, _react.useEffect)(() => {
|
|
151
|
+
if (typeof controlledIndex !== 'number') return;
|
|
152
|
+
if (controlledIndex === currentIndex) return;
|
|
153
|
+
if (controlledIndex === -1) {
|
|
154
|
+
close();
|
|
155
|
+
} else {
|
|
156
|
+
expand(controlledIndex);
|
|
157
|
+
}
|
|
158
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
159
|
+
}, [controlledIndex]);
|
|
160
|
+
|
|
161
|
+
// ───────── Gesture (UI thread) ─────────
|
|
162
|
+
// Worklet helpers must be declared inline so they capture shared values correctly.
|
|
163
|
+
const minTopY = screenHeight - maxSnapPoint; // smallest translateY (sheet fully expanded)
|
|
164
|
+
const snapTargets = (0, _react.useMemo)(() => resolvedSnapPoints.map(h => screenHeight - h), [resolvedSnapPoints, screenHeight]);
|
|
165
|
+
const handleSnapEnd = (0, _react.useCallback)((toIndex, toY) => {
|
|
166
|
+
const fromIndex = currentIndexShared.value;
|
|
167
|
+
if (toIndex === -1) {
|
|
168
|
+
(0, _index2.triggerHaptic)('selection');
|
|
169
|
+
setIndexJS(-1);
|
|
170
|
+
isAnimatingRef.current = true;
|
|
171
|
+
onAnimate?.(fromIndex, -1);
|
|
172
|
+
translateY.value = (0, _reactNativeReanimated.withTiming)(closedY, {
|
|
173
|
+
duration: 220
|
|
174
|
+
}, finished => {
|
|
175
|
+
'worklet';
|
|
176
|
+
|
|
177
|
+
if (finished) {
|
|
178
|
+
(0, _reactNativeReanimated.runOnJS)(markAnimationDone)();
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
setIndexJS(toIndex);
|
|
184
|
+
animateTo(toY, fromIndex, toIndex);
|
|
185
|
+
}, [animateTo, closedY, currentIndexShared, markAnimationDone, onAnimate, setIndexJS, translateY]);
|
|
186
|
+
const panGesture = (0, _react.useMemo)(() => {
|
|
187
|
+
const targets = snapTargets;
|
|
188
|
+
const closed = closedY;
|
|
189
|
+
const top = minTopY;
|
|
190
|
+
const canPanDownToClose = enablePanDownToClose;
|
|
191
|
+
return _reactNativeGestureHandler.Gesture.Pan().activeOffsetY([-DRAG_ACTIVATION_OFFSET, DRAG_ACTIVATION_OFFSET]).failOffsetX([-15, 15]).onStart(() => {
|
|
192
|
+
'worklet';
|
|
193
|
+
|
|
194
|
+
dragStartY.value = translateY.value;
|
|
195
|
+
}).onUpdate(event => {
|
|
196
|
+
'worklet';
|
|
197
|
+
|
|
198
|
+
const next = dragStartY.value + event.translationY;
|
|
199
|
+
// Clamp at the top (most-expanded) snap point with a touch of rubber-banding.
|
|
200
|
+
if (next < top) {
|
|
201
|
+
translateY.value = top + (next - top) * 0.25;
|
|
202
|
+
} else {
|
|
203
|
+
translateY.value = next;
|
|
204
|
+
}
|
|
205
|
+
}).onEnd(event => {
|
|
206
|
+
'worklet';
|
|
207
|
+
|
|
208
|
+
const releaseY = translateY.value;
|
|
209
|
+
const velocity = event.velocityY;
|
|
210
|
+
|
|
211
|
+
// Fast downward swipe → close (if allowed) or snap to smallest.
|
|
212
|
+
if (velocity > CLOSE_VELOCITY_THRESHOLD) {
|
|
213
|
+
if (canPanDownToClose) {
|
|
214
|
+
(0, _reactNativeReanimated.runOnJS)(handleSnapEnd)(-1, closed);
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
(0, _reactNativeReanimated.runOnJS)(handleSnapEnd)(0, targets[0]);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Find nearest snap target by distance.
|
|
222
|
+
let nearestIdx = 0;
|
|
223
|
+
let nearestDist = Math.abs(releaseY - targets[0]);
|
|
224
|
+
for (let i = 1; i < targets.length; i++) {
|
|
225
|
+
const d = Math.abs(releaseY - targets[i]);
|
|
226
|
+
if (d < nearestDist) {
|
|
227
|
+
nearestDist = d;
|
|
228
|
+
nearestIdx = i;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// If user dragged below smallest snap point past threshold and pan-to-close is on, dismiss.
|
|
233
|
+
const smallest = targets[0];
|
|
234
|
+
const overshoot = releaseY - smallest;
|
|
235
|
+
if (canPanDownToClose && overshoot > 80) {
|
|
236
|
+
(0, _reactNativeReanimated.runOnJS)(handleSnapEnd)(-1, closed);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
(0, _reactNativeReanimated.runOnJS)(handleSnapEnd)(nearestIdx, targets[nearestIdx]);
|
|
240
|
+
});
|
|
241
|
+
}, [closedY, dragStartY, enablePanDownToClose, handleSnapEnd, minTopY, snapTargets, translateY]);
|
|
242
|
+
|
|
243
|
+
// ───────── Animated styles ─────────
|
|
244
|
+
const sheetStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
245
|
+
transform: [{
|
|
246
|
+
translateY: translateY.value
|
|
247
|
+
}]
|
|
248
|
+
}));
|
|
249
|
+
const backdropStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
250
|
+
// 0 opacity when sheet is closed, full backdropOpacity at minSnap height (and above).
|
|
251
|
+
const closedAt = screenHeight;
|
|
252
|
+
const openAt = screenHeight - minSnapPoint;
|
|
253
|
+
const opacity = (0, _reactNativeReanimated.interpolate)(translateY.value, [closedAt, openAt], [0, backdropOpacity], _reactNativeReanimated.Extrapolation.CLAMP);
|
|
254
|
+
return {
|
|
255
|
+
opacity,
|
|
256
|
+
// Disable hit-test entirely when fully closed so it doesn't swallow taps.
|
|
257
|
+
pointerEvents: translateY.value >= closedAt - 0.5 ? 'none' : 'auto'
|
|
258
|
+
};
|
|
259
|
+
}, [backdropOpacity, minSnapPoint, screenHeight]);
|
|
260
|
+
const isExpanded = currentIndex >= 0;
|
|
261
|
+
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
262
|
+
const handleBackdropPress = (0, _react.useCallback)(() => {
|
|
263
|
+
if (!enableBackdropPress) return;
|
|
264
|
+
(0, _index2.triggerHaptic)('selection');
|
|
265
|
+
close();
|
|
266
|
+
}, [enableBackdropPress, close]);
|
|
267
|
+
|
|
268
|
+
// Don't render the heavy gesture tree at all when nothing's been opened yet.
|
|
269
|
+
// We still mount once `currentIndex` ≥ 0 OR an animation has started.
|
|
270
|
+
// For controlled `index`, we treat any value ≠ -1 as "opened".
|
|
271
|
+
const everOpenedRef = (0, _react.useRef)(false);
|
|
272
|
+
if (isExpanded || controlledIndex !== undefined) {
|
|
273
|
+
everOpenedRef.current = true;
|
|
274
|
+
}
|
|
275
|
+
if (!everOpenedRef.current) {
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
279
|
+
style: _reactNative.StyleSheet.absoluteFill,
|
|
280
|
+
pointerEvents: "box-none",
|
|
281
|
+
testID: testID,
|
|
282
|
+
accessibilityViewIsModal: accessibilityViewIsModal ?? isExpanded,
|
|
283
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
284
|
+
style: [styles.backdrop, {
|
|
285
|
+
backgroundColor: theme.colors.background.overlay
|
|
286
|
+
}, backdropStyle],
|
|
287
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
288
|
+
style: _reactNative.StyleSheet.absoluteFill,
|
|
289
|
+
onPress: handleBackdropPress,
|
|
290
|
+
accessibilityRole: "button",
|
|
291
|
+
accessibilityLabel: "Close bottom sheet",
|
|
292
|
+
disabled: !enableBackdropPress || !isExpanded
|
|
293
|
+
})
|
|
294
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector, {
|
|
295
|
+
gesture: panGesture,
|
|
296
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeReanimated.default.View, {
|
|
297
|
+
// 'dialog' is a valid platform role on web/iOS; RN's typings list it as a string union
|
|
298
|
+
// that varies by platform — cast keeps strict-mode happy.
|
|
299
|
+
accessibilityRole: 'dialog',
|
|
300
|
+
accessibilityLabel: accessibilityLabel,
|
|
301
|
+
accessibilityViewIsModal: accessibilityViewIsModal ?? isExpanded,
|
|
302
|
+
style: [styles.sheet, {
|
|
303
|
+
height: maxSnapPoint,
|
|
304
|
+
backgroundColor: theme.colors.background.elevated,
|
|
305
|
+
borderTopLeftRadius: theme.radius['2xl'],
|
|
306
|
+
borderTopRightRadius: theme.radius['2xl'],
|
|
307
|
+
paddingBottom: insets.bottom,
|
|
308
|
+
...theme.shadows.xl
|
|
309
|
+
}, containerStyle, sheetStyle],
|
|
310
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
311
|
+
style: styles.handleRow,
|
|
312
|
+
pointerEvents: "box-none",
|
|
313
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
314
|
+
style: [styles.handle, {
|
|
315
|
+
backgroundColor: theme.colors.border.primary
|
|
316
|
+
}, handleIndicatorStyle]
|
|
317
|
+
})
|
|
318
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
319
|
+
style: styles.content,
|
|
320
|
+
children: children
|
|
321
|
+
})]
|
|
322
|
+
})
|
|
323
|
+
})]
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
BottomSheet.displayName = 'BottomSheet';
|
|
327
|
+
|
|
328
|
+
// ───────── Helpers ─────────
|
|
329
|
+
|
|
330
|
+
const resolveSnapPoints = (points, screenH) => {
|
|
331
|
+
const resolved = points.map(p => {
|
|
332
|
+
if (typeof p === 'number') return p;
|
|
333
|
+
const pct = parseFloat(p);
|
|
334
|
+
if (Number.isNaN(pct)) return 0;
|
|
335
|
+
return pct / 100 * screenH;
|
|
336
|
+
});
|
|
337
|
+
return [...resolved].sort((a, b) => a - b);
|
|
338
|
+
};
|
|
339
|
+
const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
340
|
+
const buildStyles = _theme => _reactNative.StyleSheet.create({
|
|
341
|
+
backdrop: {
|
|
342
|
+
..._reactNative.StyleSheet.absoluteFillObject
|
|
343
|
+
},
|
|
344
|
+
sheet: {
|
|
345
|
+
position: 'absolute',
|
|
346
|
+
left: 0,
|
|
347
|
+
right: 0,
|
|
348
|
+
top: 0,
|
|
349
|
+
overflow: 'hidden'
|
|
350
|
+
},
|
|
351
|
+
handleRow: {
|
|
352
|
+
alignItems: 'center',
|
|
353
|
+
justifyContent: 'center',
|
|
354
|
+
paddingTop: 10,
|
|
355
|
+
paddingBottom: 8
|
|
356
|
+
},
|
|
357
|
+
handle: {
|
|
358
|
+
width: 36,
|
|
359
|
+
height: 4,
|
|
360
|
+
borderRadius: 2
|
|
361
|
+
},
|
|
362
|
+
content: {
|
|
363
|
+
flex: 1
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
var _default = exports.default = BottomSheet;
|
|
367
|
+
//# sourceMappingURL=BottomSheet.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "BottomSheet", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _BottomSheet.BottomSheet;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "default", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _BottomSheet.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _BottomSheet = _interopRequireWildcard(require("./BottomSheet.js"));
|
|
19
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
20
|
+
//# sourceMappingURL=index.js.map
|