@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,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
4
|
+
import { Animated, Image, Pressable, StyleSheet, View } from 'react-native';
|
|
5
|
+
import { useTheme } from "../../theme/index.js";
|
|
6
|
+
import { usePressAnimation } from "../../hooks/usePressAnimation.js";
|
|
7
|
+
import { triggerHaptic } from "../../utils/hapticUtils.js";
|
|
8
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const paddingMap = {
|
|
10
|
+
none: 'none',
|
|
11
|
+
sm: 'sm',
|
|
12
|
+
md: 'lg',
|
|
13
|
+
lg: 'xl',
|
|
14
|
+
xl: '2xl'
|
|
15
|
+
};
|
|
16
|
+
const Card = /*#__PURE__*/forwardRef((props, ref) => {
|
|
17
|
+
const {
|
|
18
|
+
children,
|
|
19
|
+
variant = 'elevated',
|
|
20
|
+
elevation = 'sm',
|
|
21
|
+
radius = 'lg',
|
|
22
|
+
padding = 'md',
|
|
23
|
+
interactive = false,
|
|
24
|
+
header,
|
|
25
|
+
footer,
|
|
26
|
+
imageSource,
|
|
27
|
+
imageHeight = 160,
|
|
28
|
+
imageAspectRatio,
|
|
29
|
+
imageOverlay,
|
|
30
|
+
onPress,
|
|
31
|
+
accessibilityLabel,
|
|
32
|
+
accessibilityHint,
|
|
33
|
+
accessibilityRole,
|
|
34
|
+
style,
|
|
35
|
+
testID,
|
|
36
|
+
...rest
|
|
37
|
+
} = props;
|
|
38
|
+
const theme = useTheme();
|
|
39
|
+
const isInteractive = interactive || typeof onPress === 'function';
|
|
40
|
+
const {
|
|
41
|
+
scale,
|
|
42
|
+
pressIn,
|
|
43
|
+
pressOut
|
|
44
|
+
} = usePressAnimation({
|
|
45
|
+
enabled: isInteractive
|
|
46
|
+
});
|
|
47
|
+
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
48
|
+
const hasImage = Boolean(imageSource);
|
|
49
|
+
const contentPadding = theme.spacing[paddingMap[padding]];
|
|
50
|
+
const containerStyle = useMemo(() => {
|
|
51
|
+
const base = {
|
|
52
|
+
borderRadius: theme.radius[radius],
|
|
53
|
+
// When an image header is present we move padding to the inner content
|
|
54
|
+
// wrapper so the image can occupy the card's full top edge.
|
|
55
|
+
padding: hasImage ? 0 : contentPadding,
|
|
56
|
+
overflow: 'hidden'
|
|
57
|
+
};
|
|
58
|
+
switch (variant) {
|
|
59
|
+
case 'outlined':
|
|
60
|
+
return {
|
|
61
|
+
...base,
|
|
62
|
+
backgroundColor: theme.colors.background.elevated,
|
|
63
|
+
borderWidth: 1,
|
|
64
|
+
borderColor: theme.colors.border.primary
|
|
65
|
+
};
|
|
66
|
+
case 'filled':
|
|
67
|
+
return {
|
|
68
|
+
...base,
|
|
69
|
+
backgroundColor: theme.colors.background.secondary
|
|
70
|
+
};
|
|
71
|
+
case 'elevated':
|
|
72
|
+
default:
|
|
73
|
+
return {
|
|
74
|
+
...base,
|
|
75
|
+
backgroundColor: theme.colors.background.elevated,
|
|
76
|
+
...theme.shadows[elevation]
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}, [theme, variant, elevation, radius, padding, hasImage, contentPadding]);
|
|
80
|
+
const imageStyle = useMemo(() => {
|
|
81
|
+
const topRadius = theme.radius[radius];
|
|
82
|
+
const dimensions = typeof imageAspectRatio === 'number' ? {
|
|
83
|
+
width: '100%',
|
|
84
|
+
aspectRatio: imageAspectRatio
|
|
85
|
+
} : {
|
|
86
|
+
width: '100%',
|
|
87
|
+
height: imageHeight
|
|
88
|
+
};
|
|
89
|
+
return {
|
|
90
|
+
...dimensions,
|
|
91
|
+
borderTopLeftRadius: topRadius,
|
|
92
|
+
borderTopRightRadius: topRadius,
|
|
93
|
+
borderBottomLeftRadius: 0,
|
|
94
|
+
borderBottomRightRadius: 0
|
|
95
|
+
};
|
|
96
|
+
}, [theme, radius, imageAspectRatio, imageHeight]);
|
|
97
|
+
const innerContent = /*#__PURE__*/_jsxs(_Fragment, {
|
|
98
|
+
children: [header ? /*#__PURE__*/_jsx(View, {
|
|
99
|
+
style: styles.header,
|
|
100
|
+
children: header
|
|
101
|
+
}) : null, /*#__PURE__*/_jsx(View, {
|
|
102
|
+
style: header || footer ? styles.body : null,
|
|
103
|
+
children: children
|
|
104
|
+
}), footer ? /*#__PURE__*/_jsx(View, {
|
|
105
|
+
style: styles.footer,
|
|
106
|
+
children: footer
|
|
107
|
+
}) : null]
|
|
108
|
+
});
|
|
109
|
+
const content = hasImage ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
110
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
111
|
+
style: styles.imageWrapper,
|
|
112
|
+
children: [/*#__PURE__*/_jsx(Image, {
|
|
113
|
+
source: imageSource,
|
|
114
|
+
resizeMode: "cover",
|
|
115
|
+
style: imageStyle,
|
|
116
|
+
accessibilityLabel: "",
|
|
117
|
+
accessible: false
|
|
118
|
+
}), imageOverlay ? /*#__PURE__*/_jsx(View, {
|
|
119
|
+
pointerEvents: "box-none",
|
|
120
|
+
style: styles.imageOverlay,
|
|
121
|
+
children: imageOverlay
|
|
122
|
+
}) : null]
|
|
123
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
124
|
+
style: {
|
|
125
|
+
padding: contentPadding
|
|
126
|
+
},
|
|
127
|
+
children: innerContent
|
|
128
|
+
})]
|
|
129
|
+
}) : innerContent;
|
|
130
|
+
if (isInteractive) {
|
|
131
|
+
const handlePress = event => {
|
|
132
|
+
triggerHaptic('selection');
|
|
133
|
+
onPress?.(event);
|
|
134
|
+
};
|
|
135
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
136
|
+
style: [{
|
|
137
|
+
transform: [{
|
|
138
|
+
scale
|
|
139
|
+
}]
|
|
140
|
+
}],
|
|
141
|
+
children: /*#__PURE__*/_jsx(Pressable, {
|
|
142
|
+
ref: ref,
|
|
143
|
+
onPress: handlePress,
|
|
144
|
+
onPressIn: pressIn,
|
|
145
|
+
onPressOut: pressOut,
|
|
146
|
+
android_ripple: {
|
|
147
|
+
color: theme.colors.surface.pressed,
|
|
148
|
+
borderless: false
|
|
149
|
+
},
|
|
150
|
+
accessibilityRole: accessibilityRole ?? 'button',
|
|
151
|
+
accessibilityLabel: accessibilityLabel,
|
|
152
|
+
accessibilityHint: accessibilityHint,
|
|
153
|
+
testID: testID,
|
|
154
|
+
style: [containerStyle, style],
|
|
155
|
+
...rest,
|
|
156
|
+
children: content
|
|
157
|
+
})
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
return /*#__PURE__*/_jsx(View, {
|
|
161
|
+
ref: ref,
|
|
162
|
+
accessibilityLabel: accessibilityLabel,
|
|
163
|
+
accessibilityHint: accessibilityHint,
|
|
164
|
+
accessibilityRole: accessibilityRole,
|
|
165
|
+
testID: testID,
|
|
166
|
+
style: [containerStyle, style],
|
|
167
|
+
children: content
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
Card.displayName = 'Card';
|
|
171
|
+
const buildStyles = theme => StyleSheet.create({
|
|
172
|
+
header: {
|
|
173
|
+
marginBottom: theme.spacing.md
|
|
174
|
+
},
|
|
175
|
+
body: {
|
|
176
|
+
flexShrink: 1
|
|
177
|
+
},
|
|
178
|
+
footer: {
|
|
179
|
+
marginTop: theme.spacing.md
|
|
180
|
+
},
|
|
181
|
+
imageWrapper: {
|
|
182
|
+
position: 'relative'
|
|
183
|
+
},
|
|
184
|
+
imageOverlay: {
|
|
185
|
+
...StyleSheet.absoluteFillObject
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
export { Card };
|
|
189
|
+
export default Card;
|
|
190
|
+
//# sourceMappingURL=Card.js.map
|
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Carousel — generic horizontal carousel with pagination, auto-play, and looping.
|
|
5
|
+
*
|
|
6
|
+
* Backed by a virtualized FlatList for memory efficiency. Pagination is driven
|
|
7
|
+
* by `Animated.event` with `useNativeDriver` so the indicator tracks the scroll
|
|
8
|
+
* gesture frame-perfectly without round-tripping to JS.
|
|
9
|
+
*
|
|
10
|
+
* USAGE:
|
|
11
|
+
*
|
|
12
|
+
* const ref = useRef<CarouselRef>(null);
|
|
13
|
+
* <Carousel
|
|
14
|
+
* data={items}
|
|
15
|
+
* renderItem={(item) => <Card {...item} />}
|
|
16
|
+
* autoPlay
|
|
17
|
+
* loop
|
|
18
|
+
* />
|
|
19
|
+
*
|
|
20
|
+
* ref.current?.scrollTo(2);
|
|
21
|
+
* ref.current?.next();
|
|
22
|
+
* ref.current?.prev();
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
26
|
+
import { Animated, Dimensions, FlatList, Image, Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
|
|
27
|
+
import { useTheme } from "../../theme/index.js";
|
|
28
|
+
import { triggerHaptic } from "../../utils/index.js";
|
|
29
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
30
|
+
// We intentionally use a generic forwardRef wrapper — the inner component is
|
|
31
|
+
// untyped at the generic level (forwardRef can't preserve generics in TS yet),
|
|
32
|
+
// so we cast via a typed factory below.
|
|
33
|
+
const CarouselInner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
34
|
+
const {
|
|
35
|
+
data,
|
|
36
|
+
renderItem,
|
|
37
|
+
keyExtractor,
|
|
38
|
+
index: controlledIndex,
|
|
39
|
+
defaultIndex = 0,
|
|
40
|
+
onIndexChange,
|
|
41
|
+
autoPlay = false,
|
|
42
|
+
autoPlayInterval = 4000,
|
|
43
|
+
loop = false,
|
|
44
|
+
showPagination = true,
|
|
45
|
+
paginationStyle = 'dots',
|
|
46
|
+
itemWidth = 'screen',
|
|
47
|
+
spacing = 0,
|
|
48
|
+
containerStyle,
|
|
49
|
+
accessibilityLabel,
|
|
50
|
+
testID,
|
|
51
|
+
showThumbnails = false,
|
|
52
|
+
renderThumbnail
|
|
53
|
+
} = props;
|
|
54
|
+
const theme = useTheme();
|
|
55
|
+
const isControlled = typeof controlledIndex === 'number';
|
|
56
|
+
const isLooping = loop || autoPlay;
|
|
57
|
+
const [containerWidth, setContainerWidth] = useState(() => Dimensions.get('window').width);
|
|
58
|
+
const resolvedItemWidth = itemWidth === 'screen' ? containerWidth : itemWidth;
|
|
59
|
+
const slideStride = resolvedItemWidth + spacing;
|
|
60
|
+
const flatListRef = useRef(null);
|
|
61
|
+
const scrollX = useRef(new Animated.Value(0)).current;
|
|
62
|
+
const initialIndex = clamp(isControlled ? controlledIndex : defaultIndex, 0, Math.max(0, data.length - 1));
|
|
63
|
+
const [currentIndex, setCurrentIndex] = useState(initialIndex);
|
|
64
|
+
|
|
65
|
+
// Refs for auto-play & idle resume.
|
|
66
|
+
const autoPlayTimerRef = useRef(null);
|
|
67
|
+
const resumeTimerRef = useRef(null);
|
|
68
|
+
const isUserDraggingRef = useRef(false);
|
|
69
|
+
const currentIndexRef = useRef(currentIndex);
|
|
70
|
+
currentIndexRef.current = currentIndex;
|
|
71
|
+
const setIndexJS = useCallback(next => {
|
|
72
|
+
const safe = clamp(next, 0, Math.max(0, data.length - 1));
|
|
73
|
+
setCurrentIndex(prev => {
|
|
74
|
+
if (prev === safe) return prev;
|
|
75
|
+
onIndexChange?.(safe);
|
|
76
|
+
return safe;
|
|
77
|
+
});
|
|
78
|
+
}, [data.length, onIndexChange]);
|
|
79
|
+
const scrollTo = useCallback((target, animated = true) => {
|
|
80
|
+
if (data.length === 0) return;
|
|
81
|
+
const safe = clamp(target, 0, data.length - 1);
|
|
82
|
+
flatListRef.current?.scrollToOffset({
|
|
83
|
+
offset: safe * slideStride,
|
|
84
|
+
animated
|
|
85
|
+
});
|
|
86
|
+
setIndexJS(safe);
|
|
87
|
+
}, [data.length, slideStride, setIndexJS]);
|
|
88
|
+
const next = useCallback(() => {
|
|
89
|
+
if (data.length === 0) return;
|
|
90
|
+
const target = currentIndexRef.current + 1;
|
|
91
|
+
if (target >= data.length) {
|
|
92
|
+
if (isLooping) scrollTo(0, false);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
scrollTo(target, true);
|
|
96
|
+
}, [data.length, isLooping, scrollTo]);
|
|
97
|
+
const prev = useCallback(() => {
|
|
98
|
+
if (data.length === 0) return;
|
|
99
|
+
const target = currentIndexRef.current - 1;
|
|
100
|
+
if (target < 0) {
|
|
101
|
+
if (isLooping) scrollTo(data.length - 1, false);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
scrollTo(target, true);
|
|
105
|
+
}, [data.length, isLooping, scrollTo]);
|
|
106
|
+
useImperativeHandle(ref, () => ({
|
|
107
|
+
scrollTo,
|
|
108
|
+
next,
|
|
109
|
+
prev
|
|
110
|
+
}), [scrollTo, next, prev]);
|
|
111
|
+
|
|
112
|
+
// Drive controlled `index` prop.
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (!isControlled) return;
|
|
115
|
+
if (controlledIndex === currentIndex) return;
|
|
116
|
+
scrollTo(controlledIndex, true);
|
|
117
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
118
|
+
}, [controlledIndex]);
|
|
119
|
+
|
|
120
|
+
// ─── Auto-play ───
|
|
121
|
+
const clearAutoPlay = useCallback(() => {
|
|
122
|
+
if (autoPlayTimerRef.current) {
|
|
123
|
+
clearInterval(autoPlayTimerRef.current);
|
|
124
|
+
autoPlayTimerRef.current = null;
|
|
125
|
+
}
|
|
126
|
+
}, []);
|
|
127
|
+
const startAutoPlay = useCallback(() => {
|
|
128
|
+
if (!autoPlay || data.length <= 1) return;
|
|
129
|
+
clearAutoPlay();
|
|
130
|
+
autoPlayTimerRef.current = setInterval(() => {
|
|
131
|
+
if (isUserDraggingRef.current) return;
|
|
132
|
+
const cur = currentIndexRef.current;
|
|
133
|
+
const target = cur + 1;
|
|
134
|
+
if (target >= data.length) {
|
|
135
|
+
scrollTo(0, false);
|
|
136
|
+
} else {
|
|
137
|
+
scrollTo(target, true);
|
|
138
|
+
}
|
|
139
|
+
}, autoPlayInterval);
|
|
140
|
+
}, [autoPlay, autoPlayInterval, data.length, scrollTo, clearAutoPlay]);
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
startAutoPlay();
|
|
143
|
+
return () => {
|
|
144
|
+
clearAutoPlay();
|
|
145
|
+
if (resumeTimerRef.current) clearTimeout(resumeTimerRef.current);
|
|
146
|
+
};
|
|
147
|
+
}, [startAutoPlay, clearAutoPlay]);
|
|
148
|
+
|
|
149
|
+
// ─── Scroll handlers ───
|
|
150
|
+
const onScroll = useMemo(() => Animated.event([{
|
|
151
|
+
nativeEvent: {
|
|
152
|
+
contentOffset: {
|
|
153
|
+
x: scrollX
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}], {
|
|
157
|
+
useNativeDriver: false
|
|
158
|
+
} // pagination width interpolation needs JS driver
|
|
159
|
+
), [scrollX]);
|
|
160
|
+
const onMomentumScrollEnd = useCallback(e => {
|
|
161
|
+
if (slideStride <= 0) return;
|
|
162
|
+
const offsetX = e.nativeEvent.contentOffset.x;
|
|
163
|
+
const idx = Math.round(offsetX / slideStride);
|
|
164
|
+
setIndexJS(idx);
|
|
165
|
+
}, [slideStride, setIndexJS]);
|
|
166
|
+
const onScrollBeginDrag = useCallback(() => {
|
|
167
|
+
isUserDraggingRef.current = true;
|
|
168
|
+
clearAutoPlay();
|
|
169
|
+
if (resumeTimerRef.current) {
|
|
170
|
+
clearTimeout(resumeTimerRef.current);
|
|
171
|
+
resumeTimerRef.current = null;
|
|
172
|
+
}
|
|
173
|
+
}, [clearAutoPlay]);
|
|
174
|
+
const onScrollEndDrag = useCallback(() => {
|
|
175
|
+
isUserDraggingRef.current = false;
|
|
176
|
+
if (!autoPlay) return;
|
|
177
|
+
if (resumeTimerRef.current) clearTimeout(resumeTimerRef.current);
|
|
178
|
+
resumeTimerRef.current = setTimeout(() => {
|
|
179
|
+
startAutoPlay();
|
|
180
|
+
}, 1000);
|
|
181
|
+
}, [autoPlay, startAutoPlay]);
|
|
182
|
+
|
|
183
|
+
// ─── A11y ───
|
|
184
|
+
const onAccessibilityAction = useCallback(event => {
|
|
185
|
+
switch (event.nativeEvent.actionName) {
|
|
186
|
+
case 'increment':
|
|
187
|
+
next();
|
|
188
|
+
break;
|
|
189
|
+
case 'decrement':
|
|
190
|
+
prev();
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
}, [next, prev]);
|
|
194
|
+
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
195
|
+
const flatListRenderItem = useCallback(({
|
|
196
|
+
item,
|
|
197
|
+
index: i
|
|
198
|
+
}) => /*#__PURE__*/_jsx(View, {
|
|
199
|
+
style: {
|
|
200
|
+
width: resolvedItemWidth,
|
|
201
|
+
marginRight: i === data.length - 1 ? 0 : spacing
|
|
202
|
+
},
|
|
203
|
+
accessibilityElementsHidden: i !== currentIndex,
|
|
204
|
+
importantForAccessibility: i === currentIndex ? 'yes' : 'no-hide-descendants',
|
|
205
|
+
children: renderItem(item, i)
|
|
206
|
+
}), [renderItem, resolvedItemWidth, spacing, data.length, currentIndex]);
|
|
207
|
+
const defaultKeyExtractor = useCallback((_, i) => String(i), []);
|
|
208
|
+
const getItemLayout = useCallback((_data, i) => ({
|
|
209
|
+
length: slideStride,
|
|
210
|
+
offset: slideStride * i,
|
|
211
|
+
index: i
|
|
212
|
+
}), [slideStride]);
|
|
213
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
214
|
+
style: [styles.container, containerStyle],
|
|
215
|
+
onLayout: e => setContainerWidth(e.nativeEvent.layout.width),
|
|
216
|
+
accessibilityRole: 'adjustable',
|
|
217
|
+
accessibilityLabel: accessibilityLabel ?? 'Carousel',
|
|
218
|
+
accessibilityValue: {
|
|
219
|
+
min: 0,
|
|
220
|
+
max: Math.max(0, data.length - 1),
|
|
221
|
+
now: currentIndex,
|
|
222
|
+
text: `Slide ${currentIndex + 1} of ${data.length}`
|
|
223
|
+
},
|
|
224
|
+
accessibilityActions: [{
|
|
225
|
+
name: 'increment'
|
|
226
|
+
}, {
|
|
227
|
+
name: 'decrement'
|
|
228
|
+
}],
|
|
229
|
+
onAccessibilityAction: onAccessibilityAction,
|
|
230
|
+
testID: testID,
|
|
231
|
+
children: [/*#__PURE__*/_jsx(FlatList, {
|
|
232
|
+
ref: flatListRef,
|
|
233
|
+
data: data,
|
|
234
|
+
keyExtractor: keyExtractor ?? defaultKeyExtractor,
|
|
235
|
+
renderItem: flatListRenderItem,
|
|
236
|
+
horizontal: true,
|
|
237
|
+
pagingEnabled: itemWidth === 'screen' && spacing === 0,
|
|
238
|
+
snapToInterval: slideStride,
|
|
239
|
+
snapToAlignment: "start",
|
|
240
|
+
decelerationRate: "fast",
|
|
241
|
+
showsHorizontalScrollIndicator: false,
|
|
242
|
+
onScroll: onScroll,
|
|
243
|
+
scrollEventThrottle: 16,
|
|
244
|
+
onMomentumScrollEnd: onMomentumScrollEnd,
|
|
245
|
+
onScrollBeginDrag: onScrollBeginDrag,
|
|
246
|
+
onScrollEndDrag: onScrollEndDrag,
|
|
247
|
+
getItemLayout: getItemLayout,
|
|
248
|
+
initialScrollIndex: initialIndex,
|
|
249
|
+
bounces: false
|
|
250
|
+
}), showPagination && data.length > 1 ? /*#__PURE__*/_jsx(Pagination, {
|
|
251
|
+
count: data.length,
|
|
252
|
+
currentIndex: currentIndex,
|
|
253
|
+
scrollX: scrollX,
|
|
254
|
+
slideStride: slideStride,
|
|
255
|
+
variant: paginationStyle,
|
|
256
|
+
theme: theme
|
|
257
|
+
}) : null, showThumbnails && data.length > 0 ? /*#__PURE__*/_jsx(ThumbnailStrip, {
|
|
258
|
+
data: data,
|
|
259
|
+
currentIndex: currentIndex,
|
|
260
|
+
renderThumbnail: renderThumbnail,
|
|
261
|
+
onSelect: idx => {
|
|
262
|
+
triggerHaptic('selection');
|
|
263
|
+
scrollTo(idx, true);
|
|
264
|
+
},
|
|
265
|
+
theme: theme
|
|
266
|
+
}) : null]
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
CarouselInner.displayName = 'Carousel';
|
|
270
|
+
|
|
271
|
+
// Public typed factory — preserves the generic signature.
|
|
272
|
+
const Carousel = CarouselInner;
|
|
273
|
+
|
|
274
|
+
// ───────── Pagination ─────────
|
|
275
|
+
|
|
276
|
+
const Pagination = ({
|
|
277
|
+
count,
|
|
278
|
+
currentIndex,
|
|
279
|
+
scrollX,
|
|
280
|
+
slideStride,
|
|
281
|
+
variant,
|
|
282
|
+
theme
|
|
283
|
+
}) => {
|
|
284
|
+
if (variant === 'numbers') {
|
|
285
|
+
return /*#__PURE__*/_jsx(View, {
|
|
286
|
+
style: paginationStyles.numbersWrap,
|
|
287
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
288
|
+
style: [paginationStyles.numbersText, {
|
|
289
|
+
color: theme.colors.text.secondary,
|
|
290
|
+
fontSize: theme.typography.fontSize.sm,
|
|
291
|
+
fontWeight: theme.typography.fontWeight.medium
|
|
292
|
+
}],
|
|
293
|
+
accessibilityLabel: `Slide ${currentIndex + 1} of ${count}`,
|
|
294
|
+
children: `${currentIndex + 1} / ${count}`
|
|
295
|
+
})
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
const items = Array.from({
|
|
299
|
+
length: count
|
|
300
|
+
}, (_, i) => i);
|
|
301
|
+
const isBars = variant === 'bars';
|
|
302
|
+
const baseSize = isBars ? 24 : 6;
|
|
303
|
+
const expandedSize = isBars ? 36 : 16;
|
|
304
|
+
const height = isBars ? 3 : 6;
|
|
305
|
+
return /*#__PURE__*/_jsx(View, {
|
|
306
|
+
style: paginationStyles.dotRow,
|
|
307
|
+
accessibilityElementsHidden: true,
|
|
308
|
+
importantForAccessibility: "no-hide-descendants",
|
|
309
|
+
children: items.map(i => {
|
|
310
|
+
const inputRange = [(i - 1) * slideStride, i * slideStride, (i + 1) * slideStride];
|
|
311
|
+
const widthAnim = scrollX.interpolate({
|
|
312
|
+
inputRange,
|
|
313
|
+
outputRange: [baseSize, expandedSize, baseSize],
|
|
314
|
+
extrapolate: 'clamp'
|
|
315
|
+
});
|
|
316
|
+
const opacityAnim = scrollX.interpolate({
|
|
317
|
+
inputRange,
|
|
318
|
+
outputRange: [0.5, 1, 0.5],
|
|
319
|
+
extrapolate: 'clamp'
|
|
320
|
+
});
|
|
321
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
322
|
+
style: [{
|
|
323
|
+
width: widthAnim,
|
|
324
|
+
height,
|
|
325
|
+
marginHorizontal: 4,
|
|
326
|
+
borderRadius: height / 2,
|
|
327
|
+
backgroundColor: i === currentIndex ? theme.colors.primary : theme.colors.border.primary,
|
|
328
|
+
opacity: opacityAnim
|
|
329
|
+
}]
|
|
330
|
+
}, i);
|
|
331
|
+
})
|
|
332
|
+
});
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
// ───────── Thumbnail Strip ─────────
|
|
336
|
+
|
|
337
|
+
const ThumbnailStrip = ({
|
|
338
|
+
data,
|
|
339
|
+
currentIndex,
|
|
340
|
+
renderThumbnail,
|
|
341
|
+
onSelect,
|
|
342
|
+
theme
|
|
343
|
+
}) => {
|
|
344
|
+
return /*#__PURE__*/_jsx(ScrollView, {
|
|
345
|
+
horizontal: true,
|
|
346
|
+
showsHorizontalScrollIndicator: false,
|
|
347
|
+
contentContainerStyle: thumbStyles.row,
|
|
348
|
+
accessibilityRole: "tablist",
|
|
349
|
+
children: data.map((item, i) => /*#__PURE__*/_jsx(ThumbnailItem, {
|
|
350
|
+
item: item,
|
|
351
|
+
index: i,
|
|
352
|
+
isActive: i === currentIndex,
|
|
353
|
+
renderThumbnail: renderThumbnail,
|
|
354
|
+
onPress: () => onSelect(i),
|
|
355
|
+
theme: theme
|
|
356
|
+
}, i))
|
|
357
|
+
});
|
|
358
|
+
};
|
|
359
|
+
const ThumbnailItem = ({
|
|
360
|
+
item,
|
|
361
|
+
index,
|
|
362
|
+
isActive,
|
|
363
|
+
renderThumbnail,
|
|
364
|
+
onPress,
|
|
365
|
+
theme
|
|
366
|
+
}) => {
|
|
367
|
+
const scale = useRef(new Animated.Value(isActive ? 1.1 : 1)).current;
|
|
368
|
+
useEffect(() => {
|
|
369
|
+
Animated.spring(scale, {
|
|
370
|
+
toValue: isActive ? 1.1 : 1,
|
|
371
|
+
useNativeDriver: true,
|
|
372
|
+
friction: 6,
|
|
373
|
+
tension: 80
|
|
374
|
+
}).start();
|
|
375
|
+
}, [isActive, scale]);
|
|
376
|
+
const content = useMemo(() => {
|
|
377
|
+
if (renderThumbnail) return renderThumbnail(item, index);
|
|
378
|
+
if (item && typeof item === 'object' && 'uri' in item && typeof item.uri === 'string') {
|
|
379
|
+
return /*#__PURE__*/_jsx(Image, {
|
|
380
|
+
source: {
|
|
381
|
+
uri: item.uri
|
|
382
|
+
},
|
|
383
|
+
style: thumbStyles.image,
|
|
384
|
+
resizeMode: "cover"
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
return /*#__PURE__*/_jsx(View, {
|
|
388
|
+
style: [thumbStyles.placeholder, {
|
|
389
|
+
backgroundColor: theme.colors.background.secondary
|
|
390
|
+
}],
|
|
391
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
392
|
+
style: {
|
|
393
|
+
color: theme.colors.text.secondary,
|
|
394
|
+
fontSize: theme.typography.fontSize.xs,
|
|
395
|
+
fontWeight: theme.typography.fontWeight.semibold
|
|
396
|
+
},
|
|
397
|
+
children: index + 1
|
|
398
|
+
})
|
|
399
|
+
});
|
|
400
|
+
}, [item, index, renderThumbnail, theme]);
|
|
401
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
402
|
+
onPress: onPress,
|
|
403
|
+
accessibilityRole: "tab",
|
|
404
|
+
accessibilityState: {
|
|
405
|
+
selected: isActive
|
|
406
|
+
},
|
|
407
|
+
accessibilityLabel: `Go to slide ${index + 1}`,
|
|
408
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
409
|
+
style: [thumbStyles.thumb, {
|
|
410
|
+
borderColor: isActive ? theme.colors.primary : 'transparent',
|
|
411
|
+
transform: [{
|
|
412
|
+
scale
|
|
413
|
+
}]
|
|
414
|
+
}],
|
|
415
|
+
children: content
|
|
416
|
+
})
|
|
417
|
+
});
|
|
418
|
+
};
|
|
419
|
+
const thumbStyles = StyleSheet.create({
|
|
420
|
+
row: {
|
|
421
|
+
flexDirection: 'row',
|
|
422
|
+
alignItems: 'center',
|
|
423
|
+
paddingHorizontal: 8,
|
|
424
|
+
paddingVertical: 8
|
|
425
|
+
},
|
|
426
|
+
thumb: {
|
|
427
|
+
width: 40,
|
|
428
|
+
height: 40,
|
|
429
|
+
marginHorizontal: 4,
|
|
430
|
+
borderRadius: 6,
|
|
431
|
+
borderWidth: 2,
|
|
432
|
+
overflow: 'hidden'
|
|
433
|
+
},
|
|
434
|
+
image: {
|
|
435
|
+
width: '100%',
|
|
436
|
+
height: '100%'
|
|
437
|
+
},
|
|
438
|
+
placeholder: {
|
|
439
|
+
flex: 1,
|
|
440
|
+
alignItems: 'center',
|
|
441
|
+
justifyContent: 'center'
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
// ───────── Helpers ─────────
|
|
446
|
+
|
|
447
|
+
const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
448
|
+
const buildStyles = _theme => StyleSheet.create({
|
|
449
|
+
container: {
|
|
450
|
+
width: '100%'
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
const paginationStyles = StyleSheet.create({
|
|
454
|
+
dotRow: {
|
|
455
|
+
flexDirection: 'row',
|
|
456
|
+
alignItems: 'center',
|
|
457
|
+
justifyContent: 'center',
|
|
458
|
+
paddingVertical: 12
|
|
459
|
+
},
|
|
460
|
+
numbersWrap: {
|
|
461
|
+
alignItems: 'center',
|
|
462
|
+
justifyContent: 'center',
|
|
463
|
+
paddingVertical: 12
|
|
464
|
+
},
|
|
465
|
+
numbersText: {
|
|
466
|
+
textAlign: 'center'
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
export { Carousel };
|
|
470
|
+
export default Carousel;
|
|
471
|
+
//# sourceMappingURL=Carousel.js.map
|