@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,268 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useEffect, useMemo, useRef } from 'react';
|
|
4
|
+
import { Animated, PanResponder, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
5
|
+
import { useTheme } from "../../theme/index.js";
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const SWIPE_DISMISS_THRESHOLD = 80;
|
|
8
|
+
const SWIPE_VELOCITY_THRESHOLD = 0.5;
|
|
9
|
+
const STACK_OFFSET = 8;
|
|
10
|
+
const STACK_SCALE_STEP = 0.04;
|
|
11
|
+
const Toast = ({
|
|
12
|
+
toast,
|
|
13
|
+
index,
|
|
14
|
+
onDismiss
|
|
15
|
+
}) => {
|
|
16
|
+
const theme = useTheme();
|
|
17
|
+
const variant = toast.variant ?? 'default';
|
|
18
|
+
const position = toast.position ?? 'bottom';
|
|
19
|
+
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
20
|
+
const tint = useMemo(() => tintFor(theme, variant), [theme, variant]);
|
|
21
|
+
const enterFrom = position === 'top' ? -120 : 120;
|
|
22
|
+
const translateY = useRef(new Animated.Value(enterFrom)).current;
|
|
23
|
+
const translateX = useRef(new Animated.Value(0)).current;
|
|
24
|
+
const opacity = useRef(new Animated.Value(0)).current;
|
|
25
|
+
const dismissedRef = useRef(false);
|
|
26
|
+
const dismiss = (animateOut = true) => {
|
|
27
|
+
if (dismissedRef.current) return;
|
|
28
|
+
dismissedRef.current = true;
|
|
29
|
+
if (animateOut) {
|
|
30
|
+
Animated.parallel([Animated.timing(opacity, {
|
|
31
|
+
toValue: 0,
|
|
32
|
+
duration: theme.motion.duration.fast,
|
|
33
|
+
useNativeDriver: true
|
|
34
|
+
}), Animated.timing(translateY, {
|
|
35
|
+
toValue: enterFrom,
|
|
36
|
+
duration: theme.motion.duration.fast,
|
|
37
|
+
useNativeDriver: true
|
|
38
|
+
})]).start(() => onDismiss(toast.id));
|
|
39
|
+
} else {
|
|
40
|
+
onDismiss(toast.id);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
Animated.parallel([Animated.spring(translateY, {
|
|
45
|
+
toValue: 0,
|
|
46
|
+
damping: 18,
|
|
47
|
+
stiffness: 180,
|
|
48
|
+
mass: 1,
|
|
49
|
+
useNativeDriver: true
|
|
50
|
+
}), Animated.timing(opacity, {
|
|
51
|
+
toValue: 1,
|
|
52
|
+
duration: theme.motion.duration.fast,
|
|
53
|
+
useNativeDriver: true
|
|
54
|
+
})]).start();
|
|
55
|
+
const duration = toast.duration ?? 3000;
|
|
56
|
+
if (duration > 0) {
|
|
57
|
+
const timer = setTimeout(() => dismiss(true), duration);
|
|
58
|
+
return () => clearTimeout(timer);
|
|
59
|
+
}
|
|
60
|
+
return undefined;
|
|
61
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
62
|
+
}, []);
|
|
63
|
+
const panResponder = useMemo(() => PanResponder.create({
|
|
64
|
+
onMoveShouldSetPanResponder: (_evt, gesture) => Math.abs(gesture.dx) > Math.abs(gesture.dy) && Math.abs(gesture.dx) > 6,
|
|
65
|
+
onPanResponderMove: (_evt, gesture) => {
|
|
66
|
+
translateX.setValue(gesture.dx);
|
|
67
|
+
const fade = 1 - Math.min(Math.abs(gesture.dx) / 200, 1) * 0.7;
|
|
68
|
+
opacity.setValue(fade);
|
|
69
|
+
},
|
|
70
|
+
onPanResponderRelease: (_evt, gesture) => {
|
|
71
|
+
if (Math.abs(gesture.dx) > SWIPE_DISMISS_THRESHOLD || Math.abs(gesture.vx) > SWIPE_VELOCITY_THRESHOLD) {
|
|
72
|
+
const direction = gesture.dx >= 0 ? 1 : -1;
|
|
73
|
+
Animated.parallel([Animated.timing(translateX, {
|
|
74
|
+
toValue: direction * 500,
|
|
75
|
+
duration: theme.motion.duration.fast,
|
|
76
|
+
useNativeDriver: true
|
|
77
|
+
}), Animated.timing(opacity, {
|
|
78
|
+
toValue: 0,
|
|
79
|
+
duration: theme.motion.duration.fast,
|
|
80
|
+
useNativeDriver: true
|
|
81
|
+
})]).start(() => {
|
|
82
|
+
dismissedRef.current = true;
|
|
83
|
+
onDismiss(toast.id);
|
|
84
|
+
});
|
|
85
|
+
} else {
|
|
86
|
+
Animated.parallel([Animated.spring(translateX, {
|
|
87
|
+
toValue: 0,
|
|
88
|
+
useNativeDriver: true
|
|
89
|
+
}), Animated.spring(opacity, {
|
|
90
|
+
toValue: 1,
|
|
91
|
+
useNativeDriver: true
|
|
92
|
+
})]).start();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}),
|
|
96
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
97
|
+
[]);
|
|
98
|
+
const stackTranslate = position === 'top' ? index * STACK_OFFSET : -index * STACK_OFFSET;
|
|
99
|
+
const stackScale = Math.max(1 - index * STACK_SCALE_STEP, 0.9);
|
|
100
|
+
const handleActionPress = () => {
|
|
101
|
+
toast.action?.onPress();
|
|
102
|
+
dismiss(true);
|
|
103
|
+
};
|
|
104
|
+
const renderIcon = () => {
|
|
105
|
+
if (toast.icon) return toast.icon;
|
|
106
|
+
const glyph = defaultGlyph(variant);
|
|
107
|
+
if (!glyph) return null;
|
|
108
|
+
return /*#__PURE__*/_jsx(View, {
|
|
109
|
+
style: [styles.iconCircle, {
|
|
110
|
+
backgroundColor: tint + '22'
|
|
111
|
+
}],
|
|
112
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
113
|
+
style: [styles.iconGlyph, {
|
|
114
|
+
color: tint
|
|
115
|
+
}],
|
|
116
|
+
accessible: false,
|
|
117
|
+
children: glyph
|
|
118
|
+
})
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
const a11yLabel = toast.description ? `${toast.message}. ${toast.description}` : toast.message;
|
|
122
|
+
return /*#__PURE__*/_jsxs(Animated.View, {
|
|
123
|
+
...panResponder.panHandlers,
|
|
124
|
+
accessibilityRole: "alert",
|
|
125
|
+
accessibilityLiveRegion: "assertive",
|
|
126
|
+
accessibilityLabel: a11yLabel,
|
|
127
|
+
style: [styles.container, {
|
|
128
|
+
backgroundColor: theme.colors.background.elevated,
|
|
129
|
+
borderRadius: theme.radius.lg,
|
|
130
|
+
padding: theme.spacing.md,
|
|
131
|
+
...theme.shadows.md,
|
|
132
|
+
shadowColor: theme.shadows.md.shadowColor,
|
|
133
|
+
opacity,
|
|
134
|
+
transform: [{
|
|
135
|
+
translateY: Animated.add(translateY, new Animated.Value(stackTranslate))
|
|
136
|
+
}, {
|
|
137
|
+
translateX
|
|
138
|
+
}, {
|
|
139
|
+
scale: stackScale
|
|
140
|
+
}]
|
|
141
|
+
}],
|
|
142
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
143
|
+
style: [styles.tintBar, {
|
|
144
|
+
backgroundColor: tint
|
|
145
|
+
}]
|
|
146
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
147
|
+
style: styles.row,
|
|
148
|
+
children: [renderIcon(), /*#__PURE__*/_jsxs(View, {
|
|
149
|
+
style: styles.textBlock,
|
|
150
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
151
|
+
style: [styles.message, {
|
|
152
|
+
color: theme.colors.text.primary,
|
|
153
|
+
fontSize: theme.typography.fontSize.base,
|
|
154
|
+
fontWeight: theme.typography.fontWeight.semibold
|
|
155
|
+
}],
|
|
156
|
+
numberOfLines: 2,
|
|
157
|
+
children: toast.message
|
|
158
|
+
}), toast.description ? /*#__PURE__*/_jsx(Text, {
|
|
159
|
+
style: [styles.description, {
|
|
160
|
+
color: theme.colors.text.secondary,
|
|
161
|
+
fontSize: theme.typography.fontSize.sm
|
|
162
|
+
}],
|
|
163
|
+
numberOfLines: 3,
|
|
164
|
+
children: toast.description
|
|
165
|
+
}) : null]
|
|
166
|
+
}), toast.action ? /*#__PURE__*/_jsx(Pressable, {
|
|
167
|
+
accessibilityRole: "button",
|
|
168
|
+
accessibilityLabel: toast.action.label,
|
|
169
|
+
onPress: handleActionPress,
|
|
170
|
+
style: ({
|
|
171
|
+
pressed
|
|
172
|
+
}) => [styles.actionBtn, {
|
|
173
|
+
backgroundColor: pressed ? theme.colors.surface.pressed : 'transparent'
|
|
174
|
+
}],
|
|
175
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
176
|
+
style: {
|
|
177
|
+
color: tint,
|
|
178
|
+
fontSize: theme.typography.fontSize.sm,
|
|
179
|
+
fontWeight: theme.typography.fontWeight.semibold
|
|
180
|
+
},
|
|
181
|
+
numberOfLines: 1,
|
|
182
|
+
children: toast.action.label
|
|
183
|
+
})
|
|
184
|
+
}) : null]
|
|
185
|
+
})]
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
const tintFor = (theme, variant) => {
|
|
189
|
+
switch (variant) {
|
|
190
|
+
case 'success':
|
|
191
|
+
return theme.colors.success;
|
|
192
|
+
case 'error':
|
|
193
|
+
return theme.colors.error;
|
|
194
|
+
case 'warning':
|
|
195
|
+
return theme.colors.warning;
|
|
196
|
+
case 'info':
|
|
197
|
+
return theme.colors.info;
|
|
198
|
+
case 'default':
|
|
199
|
+
default:
|
|
200
|
+
return theme.colors.text.primary;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
const defaultGlyph = variant => {
|
|
204
|
+
switch (variant) {
|
|
205
|
+
case 'success':
|
|
206
|
+
return '✓';
|
|
207
|
+
case 'error':
|
|
208
|
+
return '×';
|
|
209
|
+
case 'warning':
|
|
210
|
+
return '!';
|
|
211
|
+
case 'info':
|
|
212
|
+
return 'i';
|
|
213
|
+
case 'default':
|
|
214
|
+
default:
|
|
215
|
+
return '';
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
const buildStyles = _theme => StyleSheet.create({
|
|
219
|
+
container: {
|
|
220
|
+
overflow: 'hidden',
|
|
221
|
+
marginVertical: 4
|
|
222
|
+
},
|
|
223
|
+
tintBar: {
|
|
224
|
+
position: 'absolute',
|
|
225
|
+
left: 0,
|
|
226
|
+
top: 0,
|
|
227
|
+
bottom: 0,
|
|
228
|
+
width: 4
|
|
229
|
+
},
|
|
230
|
+
row: {
|
|
231
|
+
flexDirection: 'row',
|
|
232
|
+
alignItems: 'center',
|
|
233
|
+
paddingLeft: 8
|
|
234
|
+
},
|
|
235
|
+
iconCircle: {
|
|
236
|
+
width: 28,
|
|
237
|
+
height: 28,
|
|
238
|
+
borderRadius: 14,
|
|
239
|
+
alignItems: 'center',
|
|
240
|
+
justifyContent: 'center',
|
|
241
|
+
marginRight: 12
|
|
242
|
+
},
|
|
243
|
+
iconGlyph: {
|
|
244
|
+
fontSize: 16,
|
|
245
|
+
fontWeight: '700',
|
|
246
|
+
lineHeight: 18
|
|
247
|
+
},
|
|
248
|
+
textBlock: {
|
|
249
|
+
flex: 1,
|
|
250
|
+
paddingRight: 8
|
|
251
|
+
},
|
|
252
|
+
message: {
|
|
253
|
+
lineHeight: 20
|
|
254
|
+
},
|
|
255
|
+
description: {
|
|
256
|
+
marginTop: 2,
|
|
257
|
+
lineHeight: 18
|
|
258
|
+
},
|
|
259
|
+
actionBtn: {
|
|
260
|
+
paddingHorizontal: 10,
|
|
261
|
+
paddingVertical: 6,
|
|
262
|
+
borderRadius: 8,
|
|
263
|
+
marginLeft: 8
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
export { Toast };
|
|
267
|
+
export default Toast;
|
|
268
|
+
//# sourceMappingURL=Toast.js.map
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { StyleSheet, View } from 'react-native';
|
|
5
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
|
+
import { useTheme } from "../../theme/index.js";
|
|
7
|
+
import { triggerHaptic } from "../../utils/hapticUtils.js";
|
|
8
|
+
import Toast from "./Toast.js";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
const MAX_VISIBLE = 3;
|
|
11
|
+
const ToastContext = /*#__PURE__*/createContext(null);
|
|
12
|
+
let nextId = 0;
|
|
13
|
+
const makeId = () => {
|
|
14
|
+
nextId += 1;
|
|
15
|
+
return `toast-${Date.now().toString(36)}-${nextId.toString(36)}`;
|
|
16
|
+
};
|
|
17
|
+
const defaultHaptic = variant => {
|
|
18
|
+
switch (variant) {
|
|
19
|
+
case 'error':
|
|
20
|
+
return 'notificationError';
|
|
21
|
+
case 'success':
|
|
22
|
+
return 'notificationSuccess';
|
|
23
|
+
case 'warning':
|
|
24
|
+
return 'notificationWarning';
|
|
25
|
+
case 'info':
|
|
26
|
+
return 'selection';
|
|
27
|
+
case 'default':
|
|
28
|
+
default:
|
|
29
|
+
return 'selection';
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
let providerCount = 0;
|
|
33
|
+
let activeApi = null;
|
|
34
|
+
const setActiveApi = api => {
|
|
35
|
+
activeApi = api;
|
|
36
|
+
};
|
|
37
|
+
const getActiveApi = () => activeApi;
|
|
38
|
+
export const ToastProvider = ({
|
|
39
|
+
children,
|
|
40
|
+
maxVisible = MAX_VISIBLE,
|
|
41
|
+
topOffset,
|
|
42
|
+
bottomOffset
|
|
43
|
+
}) => {
|
|
44
|
+
const theme = useTheme();
|
|
45
|
+
const insets = useSafeAreaInsets();
|
|
46
|
+
const [queue, setQueue] = useState([]);
|
|
47
|
+
const queueRef = useRef([]);
|
|
48
|
+
queueRef.current = queue;
|
|
49
|
+
const hide = useCallback(id => {
|
|
50
|
+
setQueue(prev => prev.filter(t => t.id !== id));
|
|
51
|
+
}, []);
|
|
52
|
+
const hideAll = useCallback(() => {
|
|
53
|
+
setQueue([]);
|
|
54
|
+
}, []);
|
|
55
|
+
const show = useCallback(opts => {
|
|
56
|
+
const id = makeId();
|
|
57
|
+
const item = {
|
|
58
|
+
...opts,
|
|
59
|
+
id
|
|
60
|
+
};
|
|
61
|
+
const haptic = opts.haptic === undefined ? defaultHaptic(opts.variant) : opts.haptic;
|
|
62
|
+
if (haptic !== false) triggerHaptic(haptic);
|
|
63
|
+
setQueue(prev => {
|
|
64
|
+
const next = [...prev, item];
|
|
65
|
+
// FIFO trim if exceeding maxVisible
|
|
66
|
+
if (next.length > maxVisible) {
|
|
67
|
+
return next.slice(next.length - maxVisible);
|
|
68
|
+
}
|
|
69
|
+
return next;
|
|
70
|
+
});
|
|
71
|
+
return id;
|
|
72
|
+
}, [maxVisible]);
|
|
73
|
+
const api = useMemo(() => ({
|
|
74
|
+
show,
|
|
75
|
+
hide,
|
|
76
|
+
hideAll
|
|
77
|
+
}), [show, hide, hideAll]);
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
providerCount += 1;
|
|
80
|
+
setActiveApi(api);
|
|
81
|
+
return () => {
|
|
82
|
+
providerCount -= 1;
|
|
83
|
+
if (providerCount <= 0) {
|
|
84
|
+
providerCount = 0;
|
|
85
|
+
setActiveApi(null);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}, [api]);
|
|
89
|
+
const topToasts = queue.filter(t => (t.position ?? 'bottom') === 'top');
|
|
90
|
+
const bottomToasts = queue.filter(t => (t.position ?? 'bottom') === 'bottom');
|
|
91
|
+
const styles = useMemo(() => buildStyles(), []);
|
|
92
|
+
return /*#__PURE__*/_jsxs(ToastContext.Provider, {
|
|
93
|
+
value: api,
|
|
94
|
+
children: [children, /*#__PURE__*/_jsx(View, {
|
|
95
|
+
pointerEvents: "box-none",
|
|
96
|
+
style: [styles.layer, styles.top, {
|
|
97
|
+
top: (topOffset ?? insets.top) + theme.spacing.sm,
|
|
98
|
+
paddingHorizontal: theme.spacing.md
|
|
99
|
+
}],
|
|
100
|
+
children: topToasts.map((toast, idx) => /*#__PURE__*/_jsx(Toast, {
|
|
101
|
+
toast: toast,
|
|
102
|
+
index: topToasts.length - 1 - idx,
|
|
103
|
+
onDismiss: hide
|
|
104
|
+
}, toast.id))
|
|
105
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
106
|
+
pointerEvents: "box-none",
|
|
107
|
+
style: [styles.layer, styles.bottom, {
|
|
108
|
+
bottom: (bottomOffset ?? insets.bottom) + theme.spacing.sm,
|
|
109
|
+
paddingHorizontal: theme.spacing.md
|
|
110
|
+
}],
|
|
111
|
+
children: bottomToasts.map((toast, idx) => /*#__PURE__*/_jsx(Toast, {
|
|
112
|
+
toast: toast,
|
|
113
|
+
index: bottomToasts.length - 1 - idx,
|
|
114
|
+
onDismiss: hide
|
|
115
|
+
}, toast.id))
|
|
116
|
+
})]
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
export const useToast = () => {
|
|
120
|
+
const ctx = useContext(ToastContext);
|
|
121
|
+
if (!ctx) {
|
|
122
|
+
throw new Error('useToast must be used within a <ToastProvider>.');
|
|
123
|
+
}
|
|
124
|
+
return ctx;
|
|
125
|
+
};
|
|
126
|
+
let warned = false;
|
|
127
|
+
const warnNoProvider = () => {
|
|
128
|
+
if (warned) return;
|
|
129
|
+
warned = true;
|
|
130
|
+
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
131
|
+
console.warn('[toast] No <ToastProvider /> mounted; toast() calls are no-ops. Mount a provider near your app root.');
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
const proxy = fn => {
|
|
135
|
+
const api = getActiveApi();
|
|
136
|
+
if (!api) {
|
|
137
|
+
warnNoProvider();
|
|
138
|
+
return '';
|
|
139
|
+
}
|
|
140
|
+
const result = fn(api);
|
|
141
|
+
return typeof result === 'string' ? result : '';
|
|
142
|
+
};
|
|
143
|
+
export const toast = {
|
|
144
|
+
show: opts => proxy(api => api.show(opts)),
|
|
145
|
+
success: (message, opts) => proxy(api => api.show({
|
|
146
|
+
...opts,
|
|
147
|
+
message,
|
|
148
|
+
variant: 'success'
|
|
149
|
+
})),
|
|
150
|
+
error: (message, opts) => proxy(api => api.show({
|
|
151
|
+
...opts,
|
|
152
|
+
message,
|
|
153
|
+
variant: 'error'
|
|
154
|
+
})),
|
|
155
|
+
warning: (message, opts) => proxy(api => api.show({
|
|
156
|
+
...opts,
|
|
157
|
+
message,
|
|
158
|
+
variant: 'warning'
|
|
159
|
+
})),
|
|
160
|
+
info: (message, opts) => proxy(api => api.show({
|
|
161
|
+
...opts,
|
|
162
|
+
message,
|
|
163
|
+
variant: 'info'
|
|
164
|
+
})),
|
|
165
|
+
hideAll: () => {
|
|
166
|
+
const api = getActiveApi();
|
|
167
|
+
if (!api) {
|
|
168
|
+
warnNoProvider();
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
api.hideAll();
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const buildStyles = () => StyleSheet.create({
|
|
175
|
+
layer: {
|
|
176
|
+
position: 'absolute',
|
|
177
|
+
left: 0,
|
|
178
|
+
right: 0
|
|
179
|
+
},
|
|
180
|
+
top: {
|
|
181
|
+
alignItems: 'stretch'
|
|
182
|
+
},
|
|
183
|
+
bottom: {
|
|
184
|
+
alignItems: 'stretch'
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
//# sourceMappingURL=ToastProvider.js.map
|