@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,278 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { Children, cloneElement, forwardRef, isValidElement, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { Animated, Easing, Image, 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 sizeMap = {
|
|
8
|
+
xs: 24,
|
|
9
|
+
sm: 32,
|
|
10
|
+
md: 48,
|
|
11
|
+
lg: 64,
|
|
12
|
+
xl: 80
|
|
13
|
+
};
|
|
14
|
+
const resolveSize = size => typeof size === 'number' ? size : sizeMap[size];
|
|
15
|
+
const resolveRadius = (shape, dimension) => {
|
|
16
|
+
switch (shape) {
|
|
17
|
+
case 'circle':
|
|
18
|
+
return dimension / 2;
|
|
19
|
+
case 'rounded':
|
|
20
|
+
return Math.max(6, Math.round(dimension * 0.22));
|
|
21
|
+
case 'square':
|
|
22
|
+
default:
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const initialsFromName = name => {
|
|
27
|
+
if (!name) return '';
|
|
28
|
+
const parts = name.trim().split(/\s+/u).filter(Boolean);
|
|
29
|
+
if (parts.length === 0) return '';
|
|
30
|
+
if (parts.length === 1) return parts[0].charAt(0).toUpperCase();
|
|
31
|
+
return (parts[0].charAt(0) + parts[1].charAt(0)).toUpperCase();
|
|
32
|
+
};
|
|
33
|
+
const PALETTE = ['#5B5BD6', '#0EA5A4', '#D97706', '#DB2777', '#2563EB', '#7C3AED', '#059669', '#DC2626'];
|
|
34
|
+
const hashColor = seed => {
|
|
35
|
+
if (!seed) return PALETTE[0];
|
|
36
|
+
let hash = 0;
|
|
37
|
+
for (let i = 0; i < seed.length; i += 1) {
|
|
38
|
+
hash = (hash << 5) - hash + seed.charCodeAt(i);
|
|
39
|
+
hash |= 0;
|
|
40
|
+
}
|
|
41
|
+
const idx = Math.abs(hash) % PALETTE.length;
|
|
42
|
+
return PALETTE[idx];
|
|
43
|
+
};
|
|
44
|
+
const statusColor = (theme, status) => {
|
|
45
|
+
switch (status) {
|
|
46
|
+
case 'online':
|
|
47
|
+
return theme.colors.success;
|
|
48
|
+
case 'busy':
|
|
49
|
+
return theme.colors.error;
|
|
50
|
+
case 'away':
|
|
51
|
+
return theme.colors.warning;
|
|
52
|
+
case 'offline':
|
|
53
|
+
default:
|
|
54
|
+
return theme.colors.text.tertiary;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const Avatar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
58
|
+
const {
|
|
59
|
+
source,
|
|
60
|
+
name,
|
|
61
|
+
size = 'md',
|
|
62
|
+
shape = 'circle',
|
|
63
|
+
status = null,
|
|
64
|
+
statusPosition = 'bottomRight',
|
|
65
|
+
backgroundColor,
|
|
66
|
+
color,
|
|
67
|
+
accessibilityLabel,
|
|
68
|
+
style,
|
|
69
|
+
textStyle,
|
|
70
|
+
testID
|
|
71
|
+
} = props;
|
|
72
|
+
const theme = useTheme();
|
|
73
|
+
const [imageFailed, setImageFailed] = useState(false);
|
|
74
|
+
const dimension = useMemo(() => resolveSize(size), [size]);
|
|
75
|
+
const borderRadius = useMemo(() => resolveRadius(shape, dimension), [shape, dimension]);
|
|
76
|
+
const initials = useMemo(() => initialsFromName(name), [name]);
|
|
77
|
+
const resolvedBackground = useMemo(() => {
|
|
78
|
+
if (backgroundColor) return backgroundColor;
|
|
79
|
+
return hashColor(name ?? '');
|
|
80
|
+
}, [backgroundColor, name]);
|
|
81
|
+
const resolvedTextColor = color ?? theme.colors.text.inverse;
|
|
82
|
+
const showImage = !!source && !imageFailed;
|
|
83
|
+
const fontSize = Math.max(10, Math.round(dimension * 0.4));
|
|
84
|
+
const statusSize = Math.max(8, Math.round(dimension * 0.25));
|
|
85
|
+
const statusBorder = 2;
|
|
86
|
+
const a11yLabel = accessibilityLabel ?? (name ? `${name}'s avatar` : 'Avatar');
|
|
87
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
88
|
+
ref: ref,
|
|
89
|
+
style: [styles.root, {
|
|
90
|
+
width: dimension,
|
|
91
|
+
height: dimension,
|
|
92
|
+
borderRadius,
|
|
93
|
+
backgroundColor: showImage ? theme.colors.background.tertiary : resolvedBackground
|
|
94
|
+
}, style],
|
|
95
|
+
accessible: true,
|
|
96
|
+
accessibilityRole: "image",
|
|
97
|
+
accessibilityLabel: a11yLabel,
|
|
98
|
+
testID: testID,
|
|
99
|
+
children: [showImage ? /*#__PURE__*/_jsx(Image, {
|
|
100
|
+
source: source,
|
|
101
|
+
onError: () => setImageFailed(true),
|
|
102
|
+
style: {
|
|
103
|
+
width: dimension,
|
|
104
|
+
height: dimension,
|
|
105
|
+
borderRadius
|
|
106
|
+
},
|
|
107
|
+
resizeMode: "cover",
|
|
108
|
+
accessibilityIgnoresInvertColors: true
|
|
109
|
+
}) : /*#__PURE__*/_jsx(Text, {
|
|
110
|
+
style: [styles.initials, {
|
|
111
|
+
color: resolvedTextColor,
|
|
112
|
+
fontSize,
|
|
113
|
+
fontWeight: theme.typography.fontWeight.semibold
|
|
114
|
+
}, textStyle],
|
|
115
|
+
numberOfLines: 1,
|
|
116
|
+
allowFontScaling: false,
|
|
117
|
+
children: initials
|
|
118
|
+
}), status ? /*#__PURE__*/_jsx(View, {
|
|
119
|
+
style: [styles.status, statusPosition === 'topRight' ? styles.statusTopRight : styles.statusBottomRight, {
|
|
120
|
+
width: statusSize,
|
|
121
|
+
height: statusSize,
|
|
122
|
+
borderRadius: statusSize / 2,
|
|
123
|
+
backgroundColor: statusColor(theme, status),
|
|
124
|
+
borderWidth: statusBorder,
|
|
125
|
+
borderColor: theme.colors.background.elevated
|
|
126
|
+
}],
|
|
127
|
+
accessible: false,
|
|
128
|
+
pointerEvents: "none"
|
|
129
|
+
}) : null]
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
Avatar.displayName = 'Avatar';
|
|
133
|
+
const styles = StyleSheet.create({
|
|
134
|
+
root: {
|
|
135
|
+
alignItems: 'center',
|
|
136
|
+
justifyContent: 'center',
|
|
137
|
+
overflow: 'visible',
|
|
138
|
+
position: 'relative'
|
|
139
|
+
},
|
|
140
|
+
initials: {
|
|
141
|
+
textAlign: 'center'
|
|
142
|
+
},
|
|
143
|
+
status: {
|
|
144
|
+
position: 'absolute'
|
|
145
|
+
},
|
|
146
|
+
statusTopRight: {
|
|
147
|
+
top: 0,
|
|
148
|
+
right: 0
|
|
149
|
+
},
|
|
150
|
+
statusBottomRight: {
|
|
151
|
+
bottom: 0,
|
|
152
|
+
right: 0
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
const SPACING_OFFSET = {
|
|
156
|
+
tight: -16,
|
|
157
|
+
normal: -12,
|
|
158
|
+
loose: -8
|
|
159
|
+
};
|
|
160
|
+
const STAGGER_MS = 50;
|
|
161
|
+
const ENTRANCE_DURATION_MS = 220;
|
|
162
|
+
const AvatarGroupItem = ({
|
|
163
|
+
delay,
|
|
164
|
+
marginLeft,
|
|
165
|
+
borderColor,
|
|
166
|
+
borderWidth,
|
|
167
|
+
children
|
|
168
|
+
}) => {
|
|
169
|
+
const opacity = useRef(new Animated.Value(0)).current;
|
|
170
|
+
useEffect(() => {
|
|
171
|
+
Animated.timing(opacity, {
|
|
172
|
+
toValue: 1,
|
|
173
|
+
duration: ENTRANCE_DURATION_MS,
|
|
174
|
+
delay,
|
|
175
|
+
easing: Easing.out(Easing.cubic),
|
|
176
|
+
useNativeDriver: true
|
|
177
|
+
}).start();
|
|
178
|
+
}, [delay, opacity]);
|
|
179
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
180
|
+
style: [groupStyles.item, {
|
|
181
|
+
marginLeft,
|
|
182
|
+
borderColor,
|
|
183
|
+
borderWidth,
|
|
184
|
+
opacity
|
|
185
|
+
}],
|
|
186
|
+
children: children
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
const AvatarGroup = props => {
|
|
190
|
+
const {
|
|
191
|
+
children,
|
|
192
|
+
max = 4,
|
|
193
|
+
size = 'md',
|
|
194
|
+
spacing = 'normal',
|
|
195
|
+
overflowVariant = 'count',
|
|
196
|
+
accessibilityLabel,
|
|
197
|
+
style,
|
|
198
|
+
testID
|
|
199
|
+
} = props;
|
|
200
|
+
const theme = useTheme();
|
|
201
|
+
const validChildren = useMemo(() => Children.toArray(children).filter(c => /*#__PURE__*/isValidElement(c)), [children]);
|
|
202
|
+
const total = validChildren.length;
|
|
203
|
+
const visible = validChildren.slice(0, max);
|
|
204
|
+
const overflow = Math.max(0, total - max);
|
|
205
|
+
const showOverflow = overflow > 0;
|
|
206
|
+
const offset = SPACING_OFFSET[spacing];
|
|
207
|
+
const borderColor = theme.colors.background.elevated;
|
|
208
|
+
const borderWidth = 1.5;
|
|
209
|
+
const a11yLabel = accessibilityLabel ?? `Group of ${total} ${total === 1 ? 'person' : 'people'}`;
|
|
210
|
+
|
|
211
|
+
// Render the "+N" / "+" overflow avatar styled to match.
|
|
212
|
+
const overflowDimension = useMemo(() => resolveSize(size), [size]);
|
|
213
|
+
const overflowFontSize = Math.max(10, Math.round(overflowDimension * 0.34));
|
|
214
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
215
|
+
style: [groupStyles.row, style],
|
|
216
|
+
accessible: true,
|
|
217
|
+
accessibilityLabel: a11yLabel,
|
|
218
|
+
accessibilityRole: "summary",
|
|
219
|
+
testID: testID,
|
|
220
|
+
children: [visible.map((child, index) => {
|
|
221
|
+
const childKey = child.key ?? `avatar-${index}`;
|
|
222
|
+
const cloned = /*#__PURE__*/cloneElement(child, {
|
|
223
|
+
size
|
|
224
|
+
});
|
|
225
|
+
return /*#__PURE__*/_jsx(AvatarGroupItem, {
|
|
226
|
+
delay: index * STAGGER_MS,
|
|
227
|
+
marginLeft: index === 0 ? 0 : offset,
|
|
228
|
+
borderColor: borderColor,
|
|
229
|
+
borderWidth: borderWidth,
|
|
230
|
+
children: cloned
|
|
231
|
+
}, childKey);
|
|
232
|
+
}), showOverflow ? /*#__PURE__*/_jsx(AvatarGroupItem, {
|
|
233
|
+
delay: visible.length * STAGGER_MS,
|
|
234
|
+
marginLeft: visible.length === 0 ? 0 : offset,
|
|
235
|
+
borderColor: borderColor,
|
|
236
|
+
borderWidth: borderWidth,
|
|
237
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
238
|
+
style: [groupStyles.overflow, {
|
|
239
|
+
width: overflowDimension,
|
|
240
|
+
height: overflowDimension,
|
|
241
|
+
borderRadius: overflowDimension / 2,
|
|
242
|
+
backgroundColor: theme.colors.surface.disabled
|
|
243
|
+
}],
|
|
244
|
+
accessible: true,
|
|
245
|
+
accessibilityRole: "text",
|
|
246
|
+
accessibilityLabel: overflowVariant === 'count' ? `${overflow} more` : 'More avatars',
|
|
247
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
248
|
+
style: {
|
|
249
|
+
color: theme.colors.text.secondary,
|
|
250
|
+
fontSize: overflowFontSize,
|
|
251
|
+
fontWeight: theme.typography.fontWeight.semibold
|
|
252
|
+
},
|
|
253
|
+
numberOfLines: 1,
|
|
254
|
+
allowFontScaling: false,
|
|
255
|
+
children: overflowVariant === 'count' ? `+${overflow}` : '+'
|
|
256
|
+
})
|
|
257
|
+
})
|
|
258
|
+
}, "avatar-overflow") : null]
|
|
259
|
+
});
|
|
260
|
+
};
|
|
261
|
+
const groupStyles = StyleSheet.create({
|
|
262
|
+
row: {
|
|
263
|
+
flexDirection: 'row',
|
|
264
|
+
alignItems: 'center'
|
|
265
|
+
},
|
|
266
|
+
item: {
|
|
267
|
+
borderRadius: 9999
|
|
268
|
+
},
|
|
269
|
+
overflow: {
|
|
270
|
+
alignItems: 'center',
|
|
271
|
+
justifyContent: 'center'
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
const AvatarWithGroup = Avatar;
|
|
275
|
+
AvatarWithGroup.Group = AvatarGroup;
|
|
276
|
+
export { Avatar, AvatarGroup };
|
|
277
|
+
export default AvatarWithGroup;
|
|
278
|
+
//# sourceMappingURL=Avatar.js.map
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef, useEffect, useMemo, useRef } from 'react';
|
|
4
|
+
import { Animated, Easing, 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 toneFor = (theme, tone) => {
|
|
8
|
+
switch (tone) {
|
|
9
|
+
case 'primary':
|
|
10
|
+
return {
|
|
11
|
+
background: theme.colors.primary,
|
|
12
|
+
text: theme.colors.text.inverse
|
|
13
|
+
};
|
|
14
|
+
case 'success':
|
|
15
|
+
return {
|
|
16
|
+
background: theme.colors.success,
|
|
17
|
+
text: theme.colors.text.inverse
|
|
18
|
+
};
|
|
19
|
+
case 'warning':
|
|
20
|
+
return {
|
|
21
|
+
background: theme.colors.warning,
|
|
22
|
+
text: theme.colors.text.inverse
|
|
23
|
+
};
|
|
24
|
+
case 'info':
|
|
25
|
+
return {
|
|
26
|
+
background: theme.colors.info,
|
|
27
|
+
text: theme.colors.text.inverse
|
|
28
|
+
};
|
|
29
|
+
case 'neutral':
|
|
30
|
+
return {
|
|
31
|
+
background: theme.colors.background.tertiary,
|
|
32
|
+
text: theme.colors.text.primary
|
|
33
|
+
};
|
|
34
|
+
case 'error':
|
|
35
|
+
default:
|
|
36
|
+
return {
|
|
37
|
+
background: theme.colors.error,
|
|
38
|
+
text: theme.colors.text.inverse
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const sizeMap = {
|
|
43
|
+
sm: {
|
|
44
|
+
fontSize: 10,
|
|
45
|
+
minWidth: 16,
|
|
46
|
+
height: 16,
|
|
47
|
+
paddingH: 5,
|
|
48
|
+
dot: 8
|
|
49
|
+
},
|
|
50
|
+
md: {
|
|
51
|
+
fontSize: 11,
|
|
52
|
+
minWidth: 20,
|
|
53
|
+
height: 20,
|
|
54
|
+
paddingH: 6,
|
|
55
|
+
dot: 10
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const anchorPosition = anchor => {
|
|
59
|
+
switch (anchor) {
|
|
60
|
+
case 'topLeft':
|
|
61
|
+
return {
|
|
62
|
+
top: -4,
|
|
63
|
+
left: -4
|
|
64
|
+
};
|
|
65
|
+
case 'bottomRight':
|
|
66
|
+
return {
|
|
67
|
+
bottom: -4,
|
|
68
|
+
right: -4
|
|
69
|
+
};
|
|
70
|
+
case 'bottomLeft':
|
|
71
|
+
return {
|
|
72
|
+
bottom: -4,
|
|
73
|
+
left: -4
|
|
74
|
+
};
|
|
75
|
+
case 'topRight':
|
|
76
|
+
default:
|
|
77
|
+
return {
|
|
78
|
+
top: -4,
|
|
79
|
+
right: -4
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const formatValue = (value, max) => {
|
|
84
|
+
if (value === undefined || value === null) return null;
|
|
85
|
+
if (typeof value === 'number') {
|
|
86
|
+
if (value <= 0) return null;
|
|
87
|
+
return value > max ? `${max}+` : String(value);
|
|
88
|
+
}
|
|
89
|
+
const str = String(value);
|
|
90
|
+
return str.length === 0 ? null : str;
|
|
91
|
+
};
|
|
92
|
+
const Badge = /*#__PURE__*/forwardRef((props, ref) => {
|
|
93
|
+
const {
|
|
94
|
+
value,
|
|
95
|
+
max = 99,
|
|
96
|
+
variant = 'standard',
|
|
97
|
+
tone = 'error',
|
|
98
|
+
size = 'sm',
|
|
99
|
+
invisible = false,
|
|
100
|
+
children,
|
|
101
|
+
anchor = 'topRight',
|
|
102
|
+
pulse = false,
|
|
103
|
+
accessibilityLabel,
|
|
104
|
+
style,
|
|
105
|
+
badgeStyle,
|
|
106
|
+
textStyle,
|
|
107
|
+
testID
|
|
108
|
+
} = props;
|
|
109
|
+
const theme = useTheme();
|
|
110
|
+
const tones = useMemo(() => toneFor(theme, tone), [theme, tone]);
|
|
111
|
+
const sz = sizeMap[size];
|
|
112
|
+
const formatted = variant === 'dot' ? null : formatValue(value, max);
|
|
113
|
+
const shouldRender = !invisible && (variant === 'dot' || formatted !== null);
|
|
114
|
+
const pulseScale = useRef(new Animated.Value(1)).current;
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
if (!pulse || !shouldRender) {
|
|
117
|
+
pulseScale.setValue(1);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const loop = Animated.loop(Animated.sequence([Animated.timing(pulseScale, {
|
|
121
|
+
toValue: 1.15,
|
|
122
|
+
duration: theme.motion.duration.slow,
|
|
123
|
+
easing: Easing.bezier(...theme.motion.easing.standard),
|
|
124
|
+
useNativeDriver: true
|
|
125
|
+
}), Animated.timing(pulseScale, {
|
|
126
|
+
toValue: 1,
|
|
127
|
+
duration: theme.motion.duration.slow,
|
|
128
|
+
easing: Easing.bezier(...theme.motion.easing.standard),
|
|
129
|
+
useNativeDriver: true
|
|
130
|
+
})]));
|
|
131
|
+
loop.start();
|
|
132
|
+
return () => {
|
|
133
|
+
loop.stop();
|
|
134
|
+
};
|
|
135
|
+
}, [pulse, shouldRender, pulseScale, theme]);
|
|
136
|
+
const isDot = variant === 'dot';
|
|
137
|
+
const a11yRole = isDot ? 'image' : 'text';
|
|
138
|
+
const a11yLabel = accessibilityLabel ?? (isDot ? 'Notification indicator' : formatted ? `${formatted} unread` : undefined);
|
|
139
|
+
const badgeContent = shouldRender ? /*#__PURE__*/_jsx(Animated.View, {
|
|
140
|
+
style: [styles.badge, isDot ? {
|
|
141
|
+
width: sz.dot,
|
|
142
|
+
height: sz.dot,
|
|
143
|
+
borderRadius: sz.dot / 2,
|
|
144
|
+
paddingHorizontal: 0
|
|
145
|
+
} : {
|
|
146
|
+
minWidth: sz.minWidth,
|
|
147
|
+
height: sz.height,
|
|
148
|
+
borderRadius: theme.radius.full,
|
|
149
|
+
paddingHorizontal: sz.paddingH
|
|
150
|
+
}, {
|
|
151
|
+
backgroundColor: tones.background,
|
|
152
|
+
transform: [{
|
|
153
|
+
scale: pulseScale
|
|
154
|
+
}]
|
|
155
|
+
}, children ? {
|
|
156
|
+
position: 'absolute',
|
|
157
|
+
borderWidth: 1.5,
|
|
158
|
+
borderColor: theme.colors.background.elevated,
|
|
159
|
+
...anchorPosition(anchor)
|
|
160
|
+
} : null, badgeStyle],
|
|
161
|
+
accessible: true,
|
|
162
|
+
accessibilityRole: a11yRole,
|
|
163
|
+
accessibilityLabel: a11yLabel,
|
|
164
|
+
children: !isDot && formatted !== null ? /*#__PURE__*/_jsx(Text, {
|
|
165
|
+
style: [styles.text, {
|
|
166
|
+
color: tones.text,
|
|
167
|
+
fontSize: sz.fontSize,
|
|
168
|
+
fontWeight: theme.typography.fontWeight.bold
|
|
169
|
+
}, textStyle],
|
|
170
|
+
numberOfLines: 1,
|
|
171
|
+
allowFontScaling: false,
|
|
172
|
+
children: formatted
|
|
173
|
+
}) : null
|
|
174
|
+
}) : null;
|
|
175
|
+
if (children) {
|
|
176
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
177
|
+
ref: ref,
|
|
178
|
+
style: [styles.wrapper, style],
|
|
179
|
+
testID: testID,
|
|
180
|
+
children: [children, badgeContent]
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
return /*#__PURE__*/_jsx(View, {
|
|
184
|
+
ref: ref,
|
|
185
|
+
style: style,
|
|
186
|
+
testID: testID,
|
|
187
|
+
children: badgeContent
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
Badge.displayName = 'Badge';
|
|
191
|
+
const styles = StyleSheet.create({
|
|
192
|
+
wrapper: {
|
|
193
|
+
position: 'relative',
|
|
194
|
+
alignSelf: 'flex-start'
|
|
195
|
+
},
|
|
196
|
+
badge: {
|
|
197
|
+
alignItems: 'center',
|
|
198
|
+
justifyContent: 'center',
|
|
199
|
+
flexDirection: 'row'
|
|
200
|
+
},
|
|
201
|
+
text: {
|
|
202
|
+
textAlign: 'center',
|
|
203
|
+
includeFontPadding: false
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
export { Badge };
|
|
207
|
+
export default Badge;
|
|
208
|
+
//# sourceMappingURL=Badge.js.map
|