@retray-dev/ui-kit 6.2.0 → 9.0.0
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/COMPONENTS.md +997 -20
- package/EXAMPLES.md +250 -2
- package/README.md +21 -14
- package/dist/Accordion.d.mts +28 -0
- package/dist/Accordion.d.ts +28 -0
- package/dist/Accordion.js +392 -0
- package/dist/Accordion.mjs +7 -0
- package/dist/AlertBanner.d.mts +16 -0
- package/dist/AlertBanner.d.ts +16 -0
- package/dist/AlertBanner.js +250 -0
- package/dist/AlertBanner.mjs +6 -0
- package/dist/AppHeader.d.mts +40 -0
- package/dist/AppHeader.d.ts +40 -0
- package/dist/AppHeader.js +515 -0
- package/dist/AppHeader.mjs +10 -0
- package/dist/Avatar.d.mts +20 -0
- package/dist/Avatar.d.ts +20 -0
- package/dist/Avatar.js +244 -0
- package/dist/Avatar.mjs +4 -0
- package/dist/Badge.d.mts +26 -0
- package/dist/Badge.d.ts +26 -0
- package/dist/Badge.js +257 -0
- package/dist/Badge.mjs +5 -0
- package/dist/Button.d.mts +30 -0
- package/dist/Button.d.ts +30 -0
- package/dist/Button.js +432 -0
- package/dist/Button.mjs +9 -0
- package/dist/ButtonGroup.d.mts +26 -0
- package/dist/ButtonGroup.d.ts +26 -0
- package/dist/ButtonGroup.js +52 -0
- package/dist/ButtonGroup.mjs +3 -0
- package/dist/Card.d.mts +39 -0
- package/dist/Card.d.ts +39 -0
- package/dist/Card.js +349 -0
- package/dist/Card.mjs +8 -0
- package/dist/CategoryStrip.d.mts +26 -0
- package/dist/CategoryStrip.d.ts +26 -0
- package/dist/CategoryStrip.js +453 -0
- package/dist/CategoryStrip.mjs +9 -0
- package/dist/Checkbox.d.mts +14 -0
- package/dist/Checkbox.d.ts +14 -0
- package/dist/Checkbox.js +336 -0
- package/dist/Checkbox.mjs +7 -0
- package/dist/Chip.d.mts +31 -0
- package/dist/Chip.d.ts +31 -0
- package/dist/Chip.js +403 -0
- package/dist/Chip.mjs +8 -0
- package/dist/ConfirmDialog.d.mts +15 -0
- package/dist/ConfirmDialog.d.ts +15 -0
- package/dist/ConfirmDialog.js +560 -0
- package/dist/ConfirmDialog.mjs +10 -0
- package/dist/CurrencyDisplay.d.mts +24 -0
- package/dist/CurrencyDisplay.d.ts +24 -0
- package/dist/CurrencyDisplay.js +189 -0
- package/dist/CurrencyDisplay.mjs +4 -0
- package/dist/CurrencyInput.d.mts +26 -0
- package/dist/CurrencyInput.d.ts +26 -0
- package/dist/CurrencyInput.js +408 -0
- package/dist/CurrencyInput.mjs +8 -0
- package/dist/DetailRow.d.mts +32 -0
- package/dist/DetailRow.d.ts +32 -0
- package/dist/DetailRow.js +275 -0
- package/dist/DetailRow.mjs +5 -0
- package/dist/EmptyState.d.mts +27 -0
- package/dist/EmptyState.d.ts +27 -0
- package/dist/EmptyState.js +523 -0
- package/dist/EmptyState.mjs +10 -0
- package/dist/ErrorBoundary.d.mts +42 -0
- package/dist/ErrorBoundary.d.ts +42 -0
- package/dist/ErrorBoundary.js +351 -0
- package/dist/ErrorBoundary.mjs +7 -0
- package/dist/Form.d.mts +52 -0
- package/dist/Form.d.ts +52 -0
- package/dist/Form.js +204 -0
- package/dist/Form.mjs +4 -0
- package/dist/HolographicCard.d.mts +55 -0
- package/dist/HolographicCard.d.ts +55 -0
- package/dist/HolographicCard.js +316 -0
- package/dist/HolographicCard.mjs +191 -0
- package/dist/IconButton.d.mts +27 -0
- package/dist/IconButton.d.ts +27 -0
- package/dist/IconButton.js +400 -0
- package/dist/IconButton.mjs +8 -0
- package/dist/ImageViewer.d.mts +23 -0
- package/dist/ImageViewer.d.ts +23 -0
- package/dist/ImageViewer.js +582 -0
- package/dist/ImageViewer.mjs +8 -0
- package/dist/Input.d.mts +23 -0
- package/dist/Input.d.ts +23 -0
- package/dist/Input.js +351 -0
- package/dist/Input.mjs +7 -0
- package/dist/LabelValue.d.mts +16 -0
- package/dist/LabelValue.d.ts +16 -0
- package/dist/LabelValue.js +225 -0
- package/dist/LabelValue.mjs +5 -0
- package/dist/ListGroup.d.mts +34 -0
- package/dist/ListGroup.d.ts +34 -0
- package/dist/ListGroup.js +217 -0
- package/dist/ListGroup.mjs +5 -0
- package/dist/ListItem.d.mts +64 -0
- package/dist/ListItem.d.ts +64 -0
- package/dist/ListItem.js +444 -0
- package/dist/ListItem.mjs +9 -0
- package/dist/MediaCard.d.mts +39 -0
- package/dist/MediaCard.d.ts +39 -0
- package/dist/MediaCard.js +475 -0
- package/dist/MediaCard.mjs +9 -0
- package/dist/MenuGroup.d.mts +34 -0
- package/dist/MenuGroup.d.ts +34 -0
- package/dist/MenuGroup.js +217 -0
- package/dist/MenuGroup.mjs +5 -0
- package/dist/MenuItem.d.mts +48 -0
- package/dist/MenuItem.d.ts +48 -0
- package/dist/MenuItem.js +415 -0
- package/dist/MenuItem.mjs +9 -0
- package/dist/MonthPicker.d.mts +28 -0
- package/dist/MonthPicker.d.ts +28 -0
- package/dist/MonthPicker.js +297 -0
- package/dist/MonthPicker.mjs +5 -0
- package/dist/PagerDots.d.mts +35 -0
- package/dist/PagerDots.d.ts +35 -0
- package/dist/PagerDots.js +392 -0
- package/dist/PagerDots.mjs +7 -0
- package/dist/Pressable.d.mts +34 -0
- package/dist/Pressable.d.ts +34 -0
- package/dist/Pressable.js +143 -0
- package/dist/Pressable.mjs +5 -0
- package/dist/PricingCard.d.mts +50 -0
- package/dist/PricingCard.d.ts +50 -0
- package/dist/PricingCard.js +636 -0
- package/dist/PricingCard.mjs +11 -0
- package/dist/Progress.d.mts +14 -0
- package/dist/Progress.d.ts +14 -0
- package/dist/Progress.js +191 -0
- package/dist/Progress.mjs +5 -0
- package/dist/RadioGroup.d.mts +19 -0
- package/dist/RadioGroup.d.ts +19 -0
- package/dist/RadioGroup.js +392 -0
- package/dist/RadioGroup.mjs +7 -0
- package/dist/RetrayProvider.d.mts +2 -0
- package/dist/RetrayProvider.d.ts +2 -0
- package/dist/RetrayProvider.js +214 -0
- package/dist/RetrayProvider.mjs +5 -0
- package/dist/Select.d.mts +22 -0
- package/dist/Select.d.ts +22 -0
- package/dist/Select.js +488 -0
- package/dist/Select.mjs +7 -0
- package/dist/SelectableGrid.d.mts +44 -0
- package/dist/SelectableGrid.d.ts +44 -0
- package/dist/SelectableGrid.js +448 -0
- package/dist/SelectableGrid.mjs +9 -0
- package/dist/Separator.d.mts +10 -0
- package/dist/Separator.d.ts +10 -0
- package/dist/Separator.js +156 -0
- package/dist/Separator.mjs +3 -0
- package/dist/Sheet.d.mts +93 -0
- package/dist/Sheet.d.ts +93 -0
- package/dist/Sheet.js +450 -0
- package/dist/Sheet.mjs +6 -0
- package/dist/Skeleton.d.mts +67 -0
- package/dist/Skeleton.d.ts +67 -0
- package/dist/Skeleton.js +266 -0
- package/dist/Skeleton.mjs +6 -0
- package/dist/Slider.d.mts +20 -0
- package/dist/Slider.d.ts +20 -0
- package/dist/Slider.js +279 -0
- package/dist/Slider.mjs +5 -0
- package/dist/Spinner.d.mts +12 -0
- package/dist/Spinner.d.ts +12 -0
- package/dist/Spinner.js +193 -0
- package/dist/Spinner.mjs +4 -0
- package/dist/Switch.d.mts +13 -0
- package/dist/Switch.d.ts +13 -0
- package/dist/Switch.js +311 -0
- package/dist/Switch.mjs +6 -0
- package/dist/TabBar.d.mts +42 -0
- package/dist/TabBar.d.ts +42 -0
- package/dist/TabBar.js +361 -0
- package/dist/TabBar.mjs +6 -0
- package/dist/Tabs.d.mts +27 -0
- package/dist/Tabs.d.ts +27 -0
- package/dist/Tabs.js +419 -0
- package/dist/Tabs.mjs +7 -0
- package/dist/Text.d.mts +12 -0
- package/dist/Text.d.ts +12 -0
- package/dist/Text.js +327 -0
- package/dist/Text.mjs +5 -0
- package/dist/Textarea.d.mts +16 -0
- package/dist/Textarea.d.ts +16 -0
- package/dist/Textarea.js +333 -0
- package/dist/Textarea.mjs +7 -0
- package/dist/Toast.d.mts +47 -0
- package/dist/Toast.d.ts +47 -0
- package/dist/Toast.js +185 -0
- package/dist/Toast.mjs +4 -0
- package/dist/Toggle.d.mts +36 -0
- package/dist/Toggle.d.ts +36 -0
- package/dist/Toggle.js +412 -0
- package/dist/Toggle.mjs +8 -0
- package/dist/VirtualList.d.mts +19 -0
- package/dist/VirtualList.d.ts +19 -0
- package/dist/VirtualList.js +38 -0
- package/dist/VirtualList.mjs +2 -0
- package/dist/chunk-26BCI223.mjs +14 -0
- package/dist/chunk-2CE3TQVY.mjs +11 -0
- package/dist/chunk-2TFTAWVJ.mjs +131 -0
- package/dist/chunk-2UYENBLV.mjs +49 -0
- package/dist/chunk-3BBOZ3OQ.mjs +41 -0
- package/dist/chunk-3DKJ2GIC.mjs +30 -0
- package/dist/chunk-3U4SSNWP.mjs +120 -0
- package/dist/chunk-4I7D47FH.mjs +139 -0
- package/dist/chunk-4K625MVM.mjs +142 -0
- package/dist/chunk-6OAZJ577.mjs +98 -0
- package/dist/chunk-6Q64UFIA.mjs +71 -0
- package/dist/chunk-756RAKE4.mjs +145 -0
- package/dist/chunk-7QHVVCB3.mjs +115 -0
- package/dist/chunk-A3A6KNQN.mjs +245 -0
- package/dist/chunk-A4MDAP7G.mjs +42 -0
- package/dist/chunk-AJ7ZDNBT.mjs +120 -0
- package/dist/chunk-AV4EMIRH.mjs +94 -0
- package/dist/chunk-AZJF2BLK.mjs +115 -0
- package/dist/chunk-BNP626TY.mjs +159 -0
- package/dist/chunk-BRKYVJVV.mjs +60 -0
- package/dist/chunk-DVK4G2GT.mjs +59 -0
- package/dist/chunk-EH745HE5.mjs +127 -0
- package/dist/chunk-EJ7ZPXOH.mjs +163 -0
- package/dist/chunk-GD6KXMG5.mjs +106 -0
- package/dist/chunk-GQYFLP3D.mjs +187 -0
- package/dist/chunk-ID72TK46.mjs +111 -0
- package/dist/chunk-IRRY3CRZ.mjs +82 -0
- package/dist/chunk-JB67UOB5.mjs +92 -0
- package/dist/chunk-JMOZEC77.mjs +90 -0
- package/dist/chunk-JT7HKXRB.mjs +114 -0
- package/dist/chunk-KIHCWCWL.mjs +124 -0
- package/dist/chunk-LXJIIOYQ.mjs +104 -0
- package/dist/chunk-M6ZXVBTK.mjs +64 -0
- package/dist/chunk-MAC465BB.mjs +61 -0
- package/dist/chunk-MBMXYJJV.mjs +36 -0
- package/dist/chunk-MLF3EZFW.mjs +119 -0
- package/dist/chunk-MX6HRKMI.mjs +29 -0
- package/dist/chunk-NA7PARID.mjs +147 -0
- package/dist/chunk-NC5ZTR2Y.mjs +32 -0
- package/dist/chunk-O3HA6TYM.mjs +139 -0
- package/dist/chunk-OB4JUQ3O.mjs +51 -0
- package/dist/chunk-PFZTM6D5.mjs +238 -0
- package/dist/chunk-QKH5ZOD5.mjs +97 -0
- package/dist/chunk-QY3X2UYR.mjs +191 -0
- package/dist/chunk-SOA2Z4RB.mjs +82 -0
- package/dist/chunk-SOYNZDVY.mjs +151 -0
- package/dist/chunk-T7XZ7H7Y.mjs +57 -0
- package/dist/chunk-TERDKCLE.mjs +74 -0
- package/dist/chunk-UREA2GYY.mjs +113 -0
- package/dist/chunk-VGTDN7SW.mjs +164 -0
- package/dist/chunk-VQ57HWPL.mjs +144 -0
- package/dist/chunk-WBOOUHSS.mjs +62 -0
- package/dist/chunk-WJLKJMKR.mjs +78 -0
- package/dist/chunk-X4G6APW6.mjs +134 -0
- package/dist/chunk-Y6FXYEAI.mjs +8 -0
- package/dist/chunk-YFZ3ELX5.mjs +16 -0
- package/dist/chunk-YNROWHQJ.mjs +46 -0
- package/dist/chunk-Z4BVUWW6.mjs +196 -0
- package/dist/chunk-ZJKGQMYH.mjs +131 -0
- package/dist/index-wt-orHUi.d.mts +85 -0
- package/dist/index-wt-orHUi.d.ts +85 -0
- package/dist/index.d.mts +149 -920
- package/dist/index.d.ts +149 -920
- package/dist/index.js +2560 -970
- package/dist/index.mjs +60 -3895
- package/package.json +55 -16
- package/src/assets/fonts/Sohne-Bold.otf +0 -0
- package/src/assets/fonts/Sohne-BoldItalic.otf +0 -0
- package/src/assets/fonts/Sohne-ExtraBold.otf +0 -0
- package/src/assets/fonts/Sohne-ExtraBoldItalic.otf +0 -0
- package/src/assets/fonts/Sohne-ExtraLight.otf +0 -0
- package/src/assets/fonts/Sohne-ExtraLightItalic.otf +0 -0
- package/src/assets/fonts/Sohne-Italic.otf +0 -0
- package/src/assets/fonts/Sohne-Light.otf +0 -0
- package/src/assets/fonts/Sohne-LightItalic.otf +0 -0
- package/src/assets/fonts/Sohne-Medium.otf +0 -0
- package/src/assets/fonts/Sohne-MediumItalic.otf +0 -0
- package/src/assets/fonts/Sohne-Regular.otf +0 -0
- package/src/assets/fonts/Sohne-SemiBold.otf +0 -0
- package/src/assets/fonts/Sohne-SemiBoldItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-Bold.otf +0 -0
- package/src/assets/fonts/SohneMono-BoldItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-ExtraBold.otf +0 -0
- package/src/assets/fonts/SohneMono-ExtraBoldItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-ExtraLight.otf +0 -0
- package/src/assets/fonts/SohneMono-ExtraLightItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-Italic.otf +0 -0
- package/src/assets/fonts/SohneMono-Light.otf +0 -0
- package/src/assets/fonts/SohneMono-LightItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-Medium.otf +0 -0
- package/src/assets/fonts/SohneMono-MediumItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-Regular.otf +0 -0
- package/src/assets/fonts/SohneMono-SemiBold.otf +0 -0
- package/src/assets/fonts/SohneMono-SemiBoldItalic.otf +0 -0
- package/src/components/Accordion/Accordion.tsx +15 -4
- package/src/components/AlertBanner/AlertBanner.tsx +38 -12
- package/src/components/AppHeader/AppHeader.tsx +172 -0
- package/src/components/AppHeader/index.ts +1 -0
- package/src/components/Avatar/Avatar.tsx +14 -4
- package/src/components/Badge/Badge.tsx +12 -3
- package/src/components/Button/Button.tsx +30 -38
- package/src/components/ButtonGroup/ButtonGroup.tsx +13 -10
- package/src/components/Card/Card.tsx +29 -57
- package/src/components/CategoryStrip/CategoryStrip.tsx +41 -42
- package/src/components/Checkbox/Checkbox.tsx +36 -45
- package/src/components/Chip/Chip.tsx +41 -48
- package/src/components/ConfirmDialog/ConfirmDialog.tsx +2 -2
- package/src/components/CurrencyDisplay/CurrencyDisplay.tsx +4 -2
- package/src/components/CurrencyInput/CurrencyInput.tsx +12 -10
- package/src/components/DetailRow/DetailRow.tsx +9 -7
- package/src/components/EmptyState/EmptyState.tsx +4 -3
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +153 -0
- package/src/components/ErrorBoundary/index.ts +1 -0
- package/src/components/Form/Form.tsx +149 -0
- package/src/components/Form/index.ts +1 -0
- package/src/components/HolographicCard/HolographicCard.tsx +315 -0
- package/src/components/HolographicCard/index.ts +1 -0
- package/src/components/IconButton/IconButton.tsx +23 -29
- package/src/components/ImageViewer/ImageViewer.tsx +290 -0
- package/src/components/ImageViewer/index.ts +1 -0
- package/src/components/Input/Input.tsx +27 -31
- package/src/components/LabelValue/LabelValue.tsx +6 -4
- package/src/components/ListGroup/ListGroup.tsx +145 -0
- package/src/components/ListGroup/index.ts +1 -0
- package/src/components/ListItem/ListItem.tsx +78 -76
- package/src/components/MediaCard/MediaCard.tsx +15 -7
- package/src/components/MenuGroup/MenuGroup.tsx +145 -0
- package/src/components/MenuGroup/index.ts +1 -0
- package/src/components/MenuItem/MenuItem.tsx +16 -33
- package/src/components/MonthPicker/MonthPicker.tsx +41 -15
- package/src/components/MonthPicker/index.ts +1 -1
- package/src/components/PagerDots/PagerDots.tsx +200 -0
- package/src/components/PagerDots/index.ts +1 -0
- package/src/components/Pressable/Pressable.tsx +19 -35
- package/src/components/PricingCard/PricingCard.tsx +220 -0
- package/src/components/PricingCard/index.ts +1 -0
- package/src/components/RadioGroup/RadioGroup.tsx +23 -39
- package/src/components/RetrayProvider/RetrayProvider.tsx +59 -0
- package/src/components/RetrayProvider/index.ts +1 -0
- package/src/components/Select/Select.tsx +6 -6
- package/src/components/SelectableGrid/SelectableGrid.tsx +205 -0
- package/src/components/SelectableGrid/index.ts +1 -0
- package/src/components/Separator/Separator.tsx +1 -3
- package/src/components/Sheet/Sheet.tsx +146 -18
- package/src/components/Skeleton/Skeleton.tsx +143 -2
- package/src/components/Slider/Slider.tsx +2 -2
- package/src/components/Spinner/Spinner.tsx +18 -3
- package/src/components/Switch/Switch.tsx +44 -49
- package/src/components/TabBar/TabBar.tsx +169 -0
- package/src/components/TabBar/index.ts +1 -0
- package/src/components/Tabs/Tabs.tsx +45 -44
- package/src/components/Text/Text.tsx +5 -1
- package/src/components/Textarea/Textarea.tsx +18 -14
- package/src/components/Toast/Toast.tsx +6 -6
- package/src/components/Toggle/Toggle.tsx +80 -72
- package/src/components/VirtualList/VirtualList.tsx +60 -0
- package/src/components/VirtualList/index.ts +1 -0
- package/src/fonts.ts +41 -20
- package/src/index.ts +28 -3
- package/src/theme/colors.ts +53 -39
- package/src/theme/types.ts +3 -0
- package/src/tokens.ts +49 -39
- package/src/utils/animations.ts +29 -1
- package/src/utils/fontGuard.ts +34 -0
- package/src/utils/haptics.ts +211 -9
- package/src/utils/icons.ts +47 -20
- package/src/utils/pressable.ts +66 -0
- package/src/utils/usePressScale.ts +2 -0
- package/src/assets/fonts/Poppins-Black.ttf +0 -0
- package/src/assets/fonts/Poppins-BlackItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Bold.ttf +0 -0
- package/src/assets/fonts/Poppins-BoldItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-ExtraBold.ttf +0 -0
- package/src/assets/fonts/Poppins-ExtraBoldItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-ExtraLight.ttf +0 -0
- package/src/assets/fonts/Poppins-ExtraLightItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Italic.ttf +0 -0
- package/src/assets/fonts/Poppins-Light.ttf +0 -0
- package/src/assets/fonts/Poppins-LightItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Medium.ttf +0 -0
- package/src/assets/fonts/Poppins-MediumItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Regular.ttf +0 -0
- package/src/assets/fonts/Poppins-SemiBold.ttf +0 -0
- package/src/assets/fonts/Poppins-SemiBoldItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Thin.ttf +0 -0
- package/src/assets/fonts/Poppins-ThinItalic.ttf +0 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { usePressScale } from './chunk-YNROWHQJ.mjs';
|
|
2
|
+
import { selectionAsync } from './chunk-EJ7ZPXOH.mjs';
|
|
3
|
+
import { PRESS_SCALE, COLOR_TRANSITION } from './chunk-DVK4G2GT.mjs';
|
|
4
|
+
import { RADIUS } from './chunk-QY3X2UYR.mjs';
|
|
5
|
+
import { renderIcon } from './chunk-T7XZ7H7Y.mjs';
|
|
6
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
7
|
+
import { ms, s, vs } from './chunk-2CE3TQVY.mjs';
|
|
8
|
+
import React, { useCallback } from 'react';
|
|
9
|
+
import { TouchableOpacity, View, Text, StyleSheet, ScrollView } from 'react-native';
|
|
10
|
+
import Animated from 'react-native-reanimated';
|
|
11
|
+
import { EaseView } from 'react-native-ease';
|
|
12
|
+
|
|
13
|
+
var CategoryChip = React.memo(function CategoryChip2({
|
|
14
|
+
item,
|
|
15
|
+
selected,
|
|
16
|
+
onSelect
|
|
17
|
+
}) {
|
|
18
|
+
const { colors } = useTheme();
|
|
19
|
+
const { animatedStyle: scaleStyle, onPressIn, onPressOut, hoverHandlers } = usePressScale({
|
|
20
|
+
pressScale: PRESS_SCALE.chip
|
|
21
|
+
});
|
|
22
|
+
const iconColor = selected ? colors.primaryForeground : colors.foregroundSubtle;
|
|
23
|
+
const resolvedIcon = typeof item.icon === "string" ? renderIcon(item.icon, 16, iconColor) : item.icon ?? null;
|
|
24
|
+
return /* @__PURE__ */ React.createElement(Animated.View, { style: scaleStyle, ...hoverHandlers }, /* @__PURE__ */ React.createElement(
|
|
25
|
+
TouchableOpacity,
|
|
26
|
+
{
|
|
27
|
+
onPress: () => onSelect(item.value),
|
|
28
|
+
onPressIn,
|
|
29
|
+
onPressOut,
|
|
30
|
+
activeOpacity: 1,
|
|
31
|
+
touchSoundDisabled: true,
|
|
32
|
+
accessibilityRole: "button",
|
|
33
|
+
accessibilityLabel: item.label,
|
|
34
|
+
accessibilityState: { selected }
|
|
35
|
+
},
|
|
36
|
+
/* @__PURE__ */ React.createElement(
|
|
37
|
+
EaseView,
|
|
38
|
+
{
|
|
39
|
+
style: styles.chip,
|
|
40
|
+
animate: {
|
|
41
|
+
backgroundColor: selected ? colors.primary : colors.surface,
|
|
42
|
+
borderColor: selected ? colors.primary : colors.border
|
|
43
|
+
},
|
|
44
|
+
transition: COLOR_TRANSITION
|
|
45
|
+
},
|
|
46
|
+
resolvedIcon && /* @__PURE__ */ React.createElement(View, { style: styles.chipIcon }, resolvedIcon),
|
|
47
|
+
/* @__PURE__ */ React.createElement(
|
|
48
|
+
Text,
|
|
49
|
+
{
|
|
50
|
+
style: [styles.chipLabel, { color: selected ? colors.primaryForeground : colors.foregroundSubtle }],
|
|
51
|
+
allowFontScaling: true
|
|
52
|
+
},
|
|
53
|
+
item.label
|
|
54
|
+
),
|
|
55
|
+
item.badge !== void 0 && item.badge > 0 && /* @__PURE__ */ React.createElement(View, { style: [styles.chipBadge, { backgroundColor: colors.primary }] }, /* @__PURE__ */ React.createElement(Text, { style: [styles.chipBadgeText, { color: colors.primaryForeground }] }, Math.min(item.badge, 99)))
|
|
56
|
+
)
|
|
57
|
+
));
|
|
58
|
+
});
|
|
59
|
+
function CategoryStrip({
|
|
60
|
+
categories,
|
|
61
|
+
value,
|
|
62
|
+
onValueChange,
|
|
63
|
+
multiSelect = false,
|
|
64
|
+
style,
|
|
65
|
+
itemStyle,
|
|
66
|
+
accessibilityLabel
|
|
67
|
+
}) {
|
|
68
|
+
const selected = Array.isArray(value) ? value : value ? [value] : [];
|
|
69
|
+
const handlePress = useCallback(
|
|
70
|
+
(v) => {
|
|
71
|
+
selectionAsync();
|
|
72
|
+
if (multiSelect) {
|
|
73
|
+
const current = Array.isArray(value) ? value : value ? [value] : [];
|
|
74
|
+
const next = current.includes(v) ? current.filter((x) => x !== v) : [...current, v];
|
|
75
|
+
onValueChange?.(next);
|
|
76
|
+
} else {
|
|
77
|
+
onValueChange?.(v === value ? "" : v);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
[multiSelect, value, onValueChange]
|
|
81
|
+
);
|
|
82
|
+
return /* @__PURE__ */ React.createElement(
|
|
83
|
+
ScrollView,
|
|
84
|
+
{
|
|
85
|
+
horizontal: true,
|
|
86
|
+
showsHorizontalScrollIndicator: false,
|
|
87
|
+
contentContainerStyle: [styles.container, style],
|
|
88
|
+
style: styles.scroll,
|
|
89
|
+
accessibilityRole: multiSelect ? void 0 : "radiogroup",
|
|
90
|
+
accessibilityLabel
|
|
91
|
+
},
|
|
92
|
+
categories.map((cat) => /* @__PURE__ */ React.createElement(View, { key: cat.value, style: itemStyle }, /* @__PURE__ */ React.createElement(
|
|
93
|
+
CategoryChip,
|
|
94
|
+
{
|
|
95
|
+
item: cat,
|
|
96
|
+
selected: selected.includes(cat.value),
|
|
97
|
+
onSelect: handlePress
|
|
98
|
+
}
|
|
99
|
+
)))
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
var styles = StyleSheet.create({
|
|
103
|
+
scroll: {
|
|
104
|
+
flexGrow: 0
|
|
105
|
+
},
|
|
106
|
+
container: {
|
|
107
|
+
flexDirection: "row",
|
|
108
|
+
gap: s(8),
|
|
109
|
+
paddingHorizontal: s(4),
|
|
110
|
+
paddingVertical: vs(4)
|
|
111
|
+
},
|
|
112
|
+
chip: {
|
|
113
|
+
flexDirection: "row",
|
|
114
|
+
alignItems: "center",
|
|
115
|
+
borderRadius: RADIUS.full,
|
|
116
|
+
borderWidth: 1,
|
|
117
|
+
paddingHorizontal: s(14),
|
|
118
|
+
paddingVertical: vs(8),
|
|
119
|
+
gap: s(6)
|
|
120
|
+
},
|
|
121
|
+
chipIcon: {
|
|
122
|
+
alignItems: "center",
|
|
123
|
+
justifyContent: "center"
|
|
124
|
+
},
|
|
125
|
+
chipLabel: {
|
|
126
|
+
fontFamily: "Sohne-Medium",
|
|
127
|
+
fontSize: ms(13)
|
|
128
|
+
},
|
|
129
|
+
chipBadge: {
|
|
130
|
+
minWidth: 16,
|
|
131
|
+
height: 16,
|
|
132
|
+
borderRadius: 9999,
|
|
133
|
+
paddingHorizontal: 3,
|
|
134
|
+
alignItems: "center",
|
|
135
|
+
justifyContent: "center"
|
|
136
|
+
},
|
|
137
|
+
chipBadgeText: {
|
|
138
|
+
fontFamily: "Sohne-Bold",
|
|
139
|
+
fontSize: ms(9),
|
|
140
|
+
lineHeight: 14
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
export { CategoryStrip };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
2
|
+
import { ms, mvs, vs } from './chunk-2CE3TQVY.mjs';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { StyleSheet, View, ActivityIndicator, Text } from 'react-native';
|
|
5
|
+
|
|
6
|
+
var sizeMap = {
|
|
7
|
+
sm: "small",
|
|
8
|
+
md: "small",
|
|
9
|
+
lg: "large"
|
|
10
|
+
};
|
|
11
|
+
var labelFontSize = {
|
|
12
|
+
sm: ms(11),
|
|
13
|
+
md: ms(13),
|
|
14
|
+
lg: ms(14)
|
|
15
|
+
};
|
|
16
|
+
function Spinner({ size = "md", color, label, ...props }) {
|
|
17
|
+
const { colors } = useTheme();
|
|
18
|
+
const a11yLabel = label || "Loading";
|
|
19
|
+
if (label) {
|
|
20
|
+
return /* @__PURE__ */ React.createElement(
|
|
21
|
+
View,
|
|
22
|
+
{
|
|
23
|
+
style: styles.wrapper,
|
|
24
|
+
accessibilityRole: "progressbar",
|
|
25
|
+
accessibilityLabel: a11yLabel,
|
|
26
|
+
accessibilityState: { busy: true }
|
|
27
|
+
},
|
|
28
|
+
/* @__PURE__ */ React.createElement(ActivityIndicator, { size: sizeMap[size], color: color ?? colors.primary, ...props }),
|
|
29
|
+
/* @__PURE__ */ React.createElement(
|
|
30
|
+
Text,
|
|
31
|
+
{
|
|
32
|
+
style: [styles.label, { color: colors.foregroundMuted, fontSize: labelFontSize[size] }],
|
|
33
|
+
allowFontScaling: true
|
|
34
|
+
},
|
|
35
|
+
label
|
|
36
|
+
)
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
return /* @__PURE__ */ React.createElement(
|
|
40
|
+
ActivityIndicator,
|
|
41
|
+
{
|
|
42
|
+
size: sizeMap[size],
|
|
43
|
+
color: color ?? colors.primary,
|
|
44
|
+
accessibilityRole: "progressbar",
|
|
45
|
+
accessibilityLabel: a11yLabel,
|
|
46
|
+
accessibilityState: { busy: true },
|
|
47
|
+
...props
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
var styles = StyleSheet.create({
|
|
52
|
+
wrapper: {
|
|
53
|
+
alignItems: "center",
|
|
54
|
+
gap: vs(6)
|
|
55
|
+
},
|
|
56
|
+
label: {
|
|
57
|
+
fontFamily: "Sohne-Regular",
|
|
58
|
+
lineHeight: mvs(18)
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export { Spinner };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { TYPOGRAPHY } from './chunk-QY3X2UYR.mjs';
|
|
2
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
3
|
+
import { mvs, ms } from './chunk-2CE3TQVY.mjs';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { Text as Text$1 } from 'react-native';
|
|
6
|
+
import { isLoaded } from 'expo-font';
|
|
7
|
+
|
|
8
|
+
var warned = false;
|
|
9
|
+
function warnIfFontsMissing() {
|
|
10
|
+
if (warned) return;
|
|
11
|
+
if (typeof __DEV__ !== "undefined" && !__DEV__) return;
|
|
12
|
+
warned = true;
|
|
13
|
+
try {
|
|
14
|
+
if (!isLoaded("Sohne-Regular")) {
|
|
15
|
+
console.warn(
|
|
16
|
+
"[retray-ui-kit] Sohne fonts are not loaded \u2014 text will fall back to the system font. Load them at your app root before rendering any UI kit component:\n\n import { useFonts } from 'expo-font'\n import { SohneFonts } from '@retray-dev/ui-kit/fonts'\n\n const [fontsLoaded] = useFonts(SohneFonts)\n if (!fontsLoaded) return null\n"
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
} catch {
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/components/Text/Text.tsx
|
|
24
|
+
var variantStyles = {
|
|
25
|
+
"display-hero": { ...TYPOGRAPHY["display-hero"], fontSize: ms(TYPOGRAPHY["display-hero"].fontSize), lineHeight: mvs(TYPOGRAPHY["display-hero"].lineHeight) },
|
|
26
|
+
"display-xl": { ...TYPOGRAPHY["display-xl"], fontSize: ms(TYPOGRAPHY["display-xl"].fontSize), lineHeight: mvs(TYPOGRAPHY["display-xl"].lineHeight) },
|
|
27
|
+
"display-lg": { ...TYPOGRAPHY["display-lg"], fontSize: ms(TYPOGRAPHY["display-lg"].fontSize), lineHeight: mvs(TYPOGRAPHY["display-lg"].lineHeight) },
|
|
28
|
+
"display-md": { ...TYPOGRAPHY["display-md"], fontSize: ms(TYPOGRAPHY["display-md"].fontSize), lineHeight: mvs(TYPOGRAPHY["display-md"].lineHeight) },
|
|
29
|
+
"display-sm": { ...TYPOGRAPHY["display-sm"], fontSize: ms(TYPOGRAPHY["display-sm"].fontSize), lineHeight: mvs(TYPOGRAPHY["display-sm"].lineHeight) },
|
|
30
|
+
"title-md": { ...TYPOGRAPHY["title-md"], fontSize: ms(TYPOGRAPHY["title-md"].fontSize), lineHeight: mvs(TYPOGRAPHY["title-md"].lineHeight) },
|
|
31
|
+
"title-sm": { ...TYPOGRAPHY["title-sm"], fontSize: ms(TYPOGRAPHY["title-sm"].fontSize), lineHeight: mvs(TYPOGRAPHY["title-sm"].lineHeight) },
|
|
32
|
+
"body-md": { ...TYPOGRAPHY["body-md"], fontSize: ms(TYPOGRAPHY["body-md"].fontSize), lineHeight: mvs(TYPOGRAPHY["body-md"].lineHeight) },
|
|
33
|
+
"body-sm": { ...TYPOGRAPHY["body-sm"], fontSize: ms(TYPOGRAPHY["body-sm"].fontSize), lineHeight: mvs(TYPOGRAPHY["body-sm"].lineHeight) },
|
|
34
|
+
caption: { ...TYPOGRAPHY["caption"], fontSize: ms(TYPOGRAPHY["caption"].fontSize), lineHeight: mvs(TYPOGRAPHY["caption"].lineHeight) },
|
|
35
|
+
"caption-sm": { ...TYPOGRAPHY["caption-sm"], fontSize: ms(TYPOGRAPHY["caption-sm"].fontSize), lineHeight: mvs(TYPOGRAPHY["caption-sm"].lineHeight) },
|
|
36
|
+
"badge-text": { ...TYPOGRAPHY["badge-text"], fontSize: ms(TYPOGRAPHY["badge-text"].fontSize), lineHeight: mvs(TYPOGRAPHY["badge-text"].lineHeight) },
|
|
37
|
+
"micro-label": { ...TYPOGRAPHY["micro-label"], fontSize: ms(TYPOGRAPHY["micro-label"].fontSize), lineHeight: mvs(TYPOGRAPHY["micro-label"].lineHeight) },
|
|
38
|
+
"uppercase-tag": { ...TYPOGRAPHY["uppercase-tag"], fontSize: ms(TYPOGRAPHY["uppercase-tag"].fontSize), lineHeight: mvs(TYPOGRAPHY["uppercase-tag"].lineHeight) },
|
|
39
|
+
"button-lg": { ...TYPOGRAPHY["button-lg"], fontSize: ms(TYPOGRAPHY["button-lg"].fontSize), lineHeight: mvs(TYPOGRAPHY["button-lg"].lineHeight) },
|
|
40
|
+
"button-sm": { ...TYPOGRAPHY["button-sm"], fontSize: ms(TYPOGRAPHY["button-sm"].fontSize), lineHeight: mvs(TYPOGRAPHY["button-sm"].lineHeight) }
|
|
41
|
+
};
|
|
42
|
+
var defaultColorVariant = {
|
|
43
|
+
"display-hero": "foreground",
|
|
44
|
+
"display-xl": "foreground",
|
|
45
|
+
"display-lg": "foreground",
|
|
46
|
+
"display-md": "foreground",
|
|
47
|
+
"display-sm": "foreground",
|
|
48
|
+
"title-md": "foreground",
|
|
49
|
+
"title-sm": "foreground",
|
|
50
|
+
"body-md": "foregroundSubtle",
|
|
51
|
+
// running text — slightly softer
|
|
52
|
+
"body-sm": "foregroundSubtle",
|
|
53
|
+
caption: "foregroundMuted",
|
|
54
|
+
"caption-sm": "foregroundMuted",
|
|
55
|
+
"badge-text": "foreground",
|
|
56
|
+
"micro-label": "foreground",
|
|
57
|
+
"uppercase-tag": "foregroundMuted",
|
|
58
|
+
"button-lg": "foreground",
|
|
59
|
+
"button-sm": "foreground"
|
|
60
|
+
};
|
|
61
|
+
function TextBase({ variant = "body-md", color, style, children, ...props }) {
|
|
62
|
+
warnIfFontsMissing();
|
|
63
|
+
const { colors } = useTheme();
|
|
64
|
+
const colorKey = defaultColorVariant[variant] ?? "foreground";
|
|
65
|
+
const resolvedColor = color ?? colors[colorKey];
|
|
66
|
+
return /* @__PURE__ */ React.createElement(
|
|
67
|
+
Text$1,
|
|
68
|
+
{
|
|
69
|
+
style: [variantStyles[variant], { color: resolvedColor }, style],
|
|
70
|
+
allowFontScaling: true,
|
|
71
|
+
...props
|
|
72
|
+
},
|
|
73
|
+
children
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
var Text = React.memo(TextBase);
|
|
77
|
+
|
|
78
|
+
export { Text };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { usePressScale } from './chunk-YNROWHQJ.mjs';
|
|
2
|
+
import { selectionAsync } from './chunk-EJ7ZPXOH.mjs';
|
|
3
|
+
import { PRESS_SCALE, COLOR_TRANSITION, SPRING_ELASTIC } from './chunk-DVK4G2GT.mjs';
|
|
4
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
5
|
+
import { mvs, ms, s, vs } from './chunk-2CE3TQVY.mjs';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { StyleSheet, View, TouchableOpacity, Text } from 'react-native';
|
|
8
|
+
import Animated from 'react-native-reanimated';
|
|
9
|
+
import { EaseView } from 'react-native-ease';
|
|
10
|
+
|
|
11
|
+
function RadioItem({
|
|
12
|
+
option,
|
|
13
|
+
selected,
|
|
14
|
+
onSelect
|
|
15
|
+
}) {
|
|
16
|
+
const { colors } = useTheme();
|
|
17
|
+
const { animatedStyle: scaleStyle, onPressIn, onPressOut } = usePressScale({
|
|
18
|
+
pressScale: PRESS_SCALE.button,
|
|
19
|
+
disabled: option.disabled
|
|
20
|
+
});
|
|
21
|
+
return (
|
|
22
|
+
// AUDIT FIX: opacity was applied only to the radio circle, leaving the label
|
|
23
|
+
// at full opacity when disabled. The whole row now dims uniformly so users
|
|
24
|
+
// get a single, consistent disabled signal across the entire item.
|
|
25
|
+
/* @__PURE__ */ React.createElement(
|
|
26
|
+
TouchableOpacity,
|
|
27
|
+
{
|
|
28
|
+
style: [styles.row, option.disabled && styles.rowDisabled],
|
|
29
|
+
onPress: () => {
|
|
30
|
+
if (!option.disabled) {
|
|
31
|
+
selectionAsync();
|
|
32
|
+
onSelect();
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
onPressIn,
|
|
36
|
+
onPressOut,
|
|
37
|
+
activeOpacity: 1,
|
|
38
|
+
touchSoundDisabled: true,
|
|
39
|
+
disabled: option.disabled,
|
|
40
|
+
accessibilityRole: "radio",
|
|
41
|
+
accessibilityLabel: option.label,
|
|
42
|
+
accessibilityState: { checked: selected, disabled: !!option.disabled }
|
|
43
|
+
},
|
|
44
|
+
/* @__PURE__ */ React.createElement(Animated.View, { style: scaleStyle }, /* @__PURE__ */ React.createElement(
|
|
45
|
+
EaseView,
|
|
46
|
+
{
|
|
47
|
+
style: styles.radio,
|
|
48
|
+
animate: { borderColor: selected ? colors.primary : colors.border },
|
|
49
|
+
transition: COLOR_TRANSITION
|
|
50
|
+
},
|
|
51
|
+
/* @__PURE__ */ React.createElement(
|
|
52
|
+
EaseView,
|
|
53
|
+
{
|
|
54
|
+
style: [styles.dot, { backgroundColor: colors.primary }],
|
|
55
|
+
animate: { scale: selected ? 1 : 0, opacity: selected ? 1 : 0 },
|
|
56
|
+
transition: SPRING_ELASTIC
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
)),
|
|
60
|
+
/* @__PURE__ */ React.createElement(
|
|
61
|
+
Text,
|
|
62
|
+
{
|
|
63
|
+
style: [styles.label, { color: colors.foreground }],
|
|
64
|
+
allowFontScaling: true
|
|
65
|
+
},
|
|
66
|
+
option.label
|
|
67
|
+
)
|
|
68
|
+
)
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
function RadioGroup({
|
|
72
|
+
options,
|
|
73
|
+
value,
|
|
74
|
+
onValueChange,
|
|
75
|
+
orientation = "vertical",
|
|
76
|
+
style,
|
|
77
|
+
accessibilityLabel
|
|
78
|
+
}) {
|
|
79
|
+
return /* @__PURE__ */ React.createElement(
|
|
80
|
+
View,
|
|
81
|
+
{
|
|
82
|
+
style: [styles.container, orientation === "horizontal" && styles.horizontal, style],
|
|
83
|
+
accessibilityRole: "radiogroup",
|
|
84
|
+
accessibilityLabel
|
|
85
|
+
},
|
|
86
|
+
options.map((option) => /* @__PURE__ */ React.createElement(
|
|
87
|
+
RadioItem,
|
|
88
|
+
{
|
|
89
|
+
key: option.value,
|
|
90
|
+
option,
|
|
91
|
+
selected: option.value === value,
|
|
92
|
+
onSelect: () => onValueChange?.(option.value)
|
|
93
|
+
}
|
|
94
|
+
))
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
var styles = StyleSheet.create({
|
|
98
|
+
container: {
|
|
99
|
+
gap: vs(12)
|
|
100
|
+
},
|
|
101
|
+
horizontal: {
|
|
102
|
+
flexDirection: "row",
|
|
103
|
+
flexWrap: "wrap"
|
|
104
|
+
},
|
|
105
|
+
row: {
|
|
106
|
+
flexDirection: "row",
|
|
107
|
+
alignItems: "center",
|
|
108
|
+
gap: s(12)
|
|
109
|
+
},
|
|
110
|
+
// AUDIT FIX: was opacity on the inner circle only
|
|
111
|
+
rowDisabled: {
|
|
112
|
+
opacity: 0.45
|
|
113
|
+
},
|
|
114
|
+
radio: {
|
|
115
|
+
width: s(24),
|
|
116
|
+
height: s(24),
|
|
117
|
+
borderRadius: s(12),
|
|
118
|
+
borderWidth: 1.5,
|
|
119
|
+
alignItems: "center",
|
|
120
|
+
justifyContent: "center"
|
|
121
|
+
},
|
|
122
|
+
dot: {
|
|
123
|
+
width: s(10),
|
|
124
|
+
height: s(10),
|
|
125
|
+
borderRadius: s(5)
|
|
126
|
+
},
|
|
127
|
+
label: {
|
|
128
|
+
fontFamily: "Sohne-Regular",
|
|
129
|
+
fontSize: ms(14),
|
|
130
|
+
lineHeight: mvs(20)
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
export { RadioGroup };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export { __require };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ToastProvider } from './chunk-2UYENBLV.mjs';
|
|
2
|
+
import { ThemeProvider } from './chunk-SOYNZDVY.mjs';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { StyleSheet } from 'react-native';
|
|
5
|
+
import { SafeAreaProvider, initialWindowMetrics } from 'react-native-safe-area-context';
|
|
6
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
7
|
+
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
|
|
8
|
+
|
|
9
|
+
function RetrayProvider({ children, theme, colorScheme = "system" }) {
|
|
10
|
+
return /* @__PURE__ */ React.createElement(SafeAreaProvider, { initialMetrics: initialWindowMetrics }, /* @__PURE__ */ React.createElement(GestureHandlerRootView, { style: styles.root }, /* @__PURE__ */ React.createElement(ThemeProvider, { theme, colorScheme }, /* @__PURE__ */ React.createElement(BottomSheetModalProvider, null, /* @__PURE__ */ React.createElement(ToastProvider, null, children)))));
|
|
11
|
+
}
|
|
12
|
+
var styles = StyleSheet.create({
|
|
13
|
+
root: { flex: 1 }
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export { RetrayProvider };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { PRESS_SCALE, SPRINGS } from './chunk-DVK4G2GT.mjs';
|
|
2
|
+
import { useState, useCallback } from 'react';
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
import { useSharedValue, withSpring, useAnimatedStyle } from 'react-native-reanimated';
|
|
5
|
+
|
|
6
|
+
function useHover() {
|
|
7
|
+
const [hovered, setHovered] = useState(false);
|
|
8
|
+
const onMouseEnter = useCallback(() => setHovered(true), []);
|
|
9
|
+
const onMouseLeave = useCallback(() => setHovered(false), []);
|
|
10
|
+
if (Platform.OS !== "web") {
|
|
11
|
+
return { hovered: false, hoverHandlers: {} };
|
|
12
|
+
}
|
|
13
|
+
return { hovered, hoverHandlers: { onMouseEnter, onMouseLeave } };
|
|
14
|
+
}
|
|
15
|
+
function usePressScale({
|
|
16
|
+
pressScale = PRESS_SCALE.button,
|
|
17
|
+
hoverScale = 1.02,
|
|
18
|
+
pressInSpring = SPRINGS.pressIn,
|
|
19
|
+
pressOutSpring = SPRINGS.pressOut,
|
|
20
|
+
disabled = false
|
|
21
|
+
} = {}) {
|
|
22
|
+
const scale = useSharedValue(1);
|
|
23
|
+
const { hovered, hoverHandlers } = useHover();
|
|
24
|
+
const onPressIn = useCallback(() => {
|
|
25
|
+
if (disabled) return;
|
|
26
|
+
scale.value = withSpring(pressScale, pressInSpring);
|
|
27
|
+
}, [disabled, pressScale, pressInSpring, scale]);
|
|
28
|
+
const onPressOut = useCallback(() => {
|
|
29
|
+
if (disabled) return;
|
|
30
|
+
scale.value = withSpring(1, pressOutSpring);
|
|
31
|
+
}, [disabled, pressOutSpring, scale]);
|
|
32
|
+
const hoverActive = Platform.OS === "web" && hovered && hoverScale !== 1 && !disabled;
|
|
33
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
34
|
+
transform: [
|
|
35
|
+
{ scale: scale.value * (hoverActive ? hoverScale : 1) }
|
|
36
|
+
]
|
|
37
|
+
}));
|
|
38
|
+
return {
|
|
39
|
+
animatedStyle,
|
|
40
|
+
onPressIn,
|
|
41
|
+
onPressOut,
|
|
42
|
+
hoverHandlers
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { useHover, usePressScale };
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { PagerDots } from './chunk-4K625MVM.mjs';
|
|
2
|
+
import { renderIcon } from './chunk-T7XZ7H7Y.mjs';
|
|
3
|
+
import { s, vs } from './chunk-2CE3TQVY.mjs';
|
|
4
|
+
import React, { useState, useCallback } from 'react';
|
|
5
|
+
import { StyleSheet, useWindowDimensions, Modal, ScrollView, TouchableOpacity, View } from 'react-native';
|
|
6
|
+
import { Gesture, GestureHandlerRootView, GestureDetector } from 'react-native-gesture-handler';
|
|
7
|
+
import Animated, { useSharedValue, runOnJS, withTiming, useAnimatedStyle } from 'react-native-reanimated';
|
|
8
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
9
|
+
|
|
10
|
+
var MAX_SCALE = 3;
|
|
11
|
+
var DOUBLE_TAP_SCALE = 2.5;
|
|
12
|
+
function ZoomableImage({ source, width, height, onZoomChange }) {
|
|
13
|
+
const scale = useSharedValue(1);
|
|
14
|
+
const savedScale = useSharedValue(1);
|
|
15
|
+
const translateX = useSharedValue(0);
|
|
16
|
+
const translateY = useSharedValue(0);
|
|
17
|
+
const savedX = useSharedValue(0);
|
|
18
|
+
const savedY = useSharedValue(0);
|
|
19
|
+
const reportZoom = useCallback((zoomed) => onZoomChange(zoomed), [onZoomChange]);
|
|
20
|
+
const reset = () => {
|
|
21
|
+
"worklet";
|
|
22
|
+
scale.value = withTiming(1);
|
|
23
|
+
savedScale.value = 1;
|
|
24
|
+
translateX.value = withTiming(0);
|
|
25
|
+
translateY.value = withTiming(0);
|
|
26
|
+
savedX.value = 0;
|
|
27
|
+
savedY.value = 0;
|
|
28
|
+
runOnJS(reportZoom)(false);
|
|
29
|
+
};
|
|
30
|
+
const pinch = Gesture.Pinch().onUpdate((e) => {
|
|
31
|
+
scale.value = Math.max(1, Math.min(savedScale.value * e.scale, MAX_SCALE));
|
|
32
|
+
}).onEnd(() => {
|
|
33
|
+
savedScale.value = scale.value;
|
|
34
|
+
if (scale.value <= 1) {
|
|
35
|
+
reset();
|
|
36
|
+
} else {
|
|
37
|
+
runOnJS(reportZoom)(true);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const pan = Gesture.Pan().onUpdate((e) => {
|
|
41
|
+
if (scale.value <= 1) return;
|
|
42
|
+
translateX.value = savedX.value + e.translationX;
|
|
43
|
+
translateY.value = savedY.value + e.translationY;
|
|
44
|
+
}).onEnd(() => {
|
|
45
|
+
savedX.value = translateX.value;
|
|
46
|
+
savedY.value = translateY.value;
|
|
47
|
+
});
|
|
48
|
+
const doubleTap = Gesture.Tap().numberOfTaps(2).onEnd(() => {
|
|
49
|
+
if (scale.value > 1) {
|
|
50
|
+
reset();
|
|
51
|
+
} else {
|
|
52
|
+
scale.value = withTiming(DOUBLE_TAP_SCALE);
|
|
53
|
+
savedScale.value = DOUBLE_TAP_SCALE;
|
|
54
|
+
runOnJS(reportZoom)(true);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const composed = Gesture.Exclusive(doubleTap, Gesture.Simultaneous(pinch, pan));
|
|
58
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
59
|
+
transform: [
|
|
60
|
+
{ translateX: translateX.value },
|
|
61
|
+
{ translateY: translateY.value },
|
|
62
|
+
{ scale: scale.value }
|
|
63
|
+
]
|
|
64
|
+
}));
|
|
65
|
+
return /* @__PURE__ */ React.createElement(GestureDetector, { gesture: composed }, /* @__PURE__ */ React.createElement(Animated.View, { style: [{ width, height }, styles.imageWrap] }, /* @__PURE__ */ React.createElement(
|
|
66
|
+
Animated.Image,
|
|
67
|
+
{
|
|
68
|
+
source,
|
|
69
|
+
style: [{ width, height }, animatedStyle],
|
|
70
|
+
resizeMode: "contain"
|
|
71
|
+
}
|
|
72
|
+
)));
|
|
73
|
+
}
|
|
74
|
+
function ImageViewer({ images, visible, onClose, initialIndex = 0 }) {
|
|
75
|
+
const { width, height } = useWindowDimensions();
|
|
76
|
+
const insets = useSafeAreaInsets();
|
|
77
|
+
const [index, setIndex] = useState(initialIndex);
|
|
78
|
+
const [pagingEnabled, setPagingEnabled] = useState(true);
|
|
79
|
+
const scrollRef = React.useRef(null);
|
|
80
|
+
React.useEffect(() => {
|
|
81
|
+
if (!visible) return;
|
|
82
|
+
const handle = requestAnimationFrame(() => {
|
|
83
|
+
setIndex(initialIndex);
|
|
84
|
+
setPagingEnabled(true);
|
|
85
|
+
scrollRef.current?.scrollTo({ x: initialIndex * width, animated: false });
|
|
86
|
+
});
|
|
87
|
+
return () => cancelAnimationFrame(handle);
|
|
88
|
+
}, [visible, initialIndex, width]);
|
|
89
|
+
const dragY = useSharedValue(0);
|
|
90
|
+
const DISMISS_THRESHOLD = height * 0.18;
|
|
91
|
+
const closeViewer = useCallback(() => onClose(), [onClose]);
|
|
92
|
+
const swipeDown = Gesture.Pan().enabled(pagingEnabled).activeOffsetY(12).failOffsetX([-16, 16]).onUpdate((e) => {
|
|
93
|
+
dragY.value = Math.max(0, e.translationY);
|
|
94
|
+
}).onEnd((e) => {
|
|
95
|
+
if (e.translationY > DISMISS_THRESHOLD || e.velocityY > 800) {
|
|
96
|
+
runOnJS(closeViewer)();
|
|
97
|
+
} else {
|
|
98
|
+
dragY.value = withTiming(0);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
React.useEffect(() => {
|
|
102
|
+
if (visible) dragY.value = 0;
|
|
103
|
+
}, [visible, dragY]);
|
|
104
|
+
const dismissStyle = useAnimatedStyle(() => ({
|
|
105
|
+
transform: [{ translateY: dragY.value }]
|
|
106
|
+
}));
|
|
107
|
+
const backdropStyle = useAnimatedStyle(() => ({
|
|
108
|
+
opacity: 1 - Math.min(dragY.value / (height * 0.5), 0.85)
|
|
109
|
+
}));
|
|
110
|
+
const onMomentumEnd = (e) => {
|
|
111
|
+
const page = Math.round(e.nativeEvent.contentOffset.x / width);
|
|
112
|
+
setIndex(page);
|
|
113
|
+
};
|
|
114
|
+
const goTo = (page) => {
|
|
115
|
+
scrollRef.current?.scrollTo({ x: page * width, animated: true });
|
|
116
|
+
setIndex(page);
|
|
117
|
+
};
|
|
118
|
+
return /* @__PURE__ */ React.createElement(Modal, { visible, transparent: false, animationType: "fade", onRequestClose: onClose, statusBarTranslucent: true }, /* @__PURE__ */ React.createElement(GestureHandlerRootView, { style: styles.root }, /* @__PURE__ */ React.createElement(Animated.View, { style: [styles.backdrop, backdropStyle], pointerEvents: "none" }), /* @__PURE__ */ React.createElement(Animated.View, { style: [styles.container, dismissStyle] }, /* @__PURE__ */ React.createElement(GestureDetector, { gesture: swipeDown }, /* @__PURE__ */ React.createElement(Animated.View, { style: styles.root }, /* @__PURE__ */ React.createElement(
|
|
119
|
+
ScrollView,
|
|
120
|
+
{
|
|
121
|
+
ref: scrollRef,
|
|
122
|
+
horizontal: true,
|
|
123
|
+
pagingEnabled: true,
|
|
124
|
+
scrollEnabled: pagingEnabled,
|
|
125
|
+
showsHorizontalScrollIndicator: false,
|
|
126
|
+
onMomentumScrollEnd: onMomentumEnd,
|
|
127
|
+
bounces: false
|
|
128
|
+
},
|
|
129
|
+
images.map((source, i) => /* @__PURE__ */ React.createElement(
|
|
130
|
+
ZoomableImage,
|
|
131
|
+
{
|
|
132
|
+
key: i,
|
|
133
|
+
source,
|
|
134
|
+
width,
|
|
135
|
+
height,
|
|
136
|
+
onZoomChange: (zoomed) => setPagingEnabled(!zoomed)
|
|
137
|
+
}
|
|
138
|
+
))
|
|
139
|
+
))), /* @__PURE__ */ React.createElement(
|
|
140
|
+
TouchableOpacity,
|
|
141
|
+
{
|
|
142
|
+
style: [styles.closeButton, { top: insets.top + vs(8) }],
|
|
143
|
+
onPress: onClose,
|
|
144
|
+
activeOpacity: 0.7,
|
|
145
|
+
touchSoundDisabled: true,
|
|
146
|
+
accessibilityRole: "button",
|
|
147
|
+
accessibilityLabel: "Close",
|
|
148
|
+
hitSlop: { top: 12, bottom: 12, left: 12, right: 12 }
|
|
149
|
+
},
|
|
150
|
+
renderIcon("x", 26, "#fff")
|
|
151
|
+
), images.length > 1 ? /* @__PURE__ */ React.createElement(View, { style: [styles.dots, { bottom: insets.bottom + vs(16) }], pointerEvents: "box-none" }, /* @__PURE__ */ React.createElement(
|
|
152
|
+
PagerDots,
|
|
153
|
+
{
|
|
154
|
+
count: images.length,
|
|
155
|
+
activeIndex: index,
|
|
156
|
+
onDotPress: goTo,
|
|
157
|
+
activeColor: "#fff",
|
|
158
|
+
inactiveColor: "rgba(255,255,255,0.4)"
|
|
159
|
+
}
|
|
160
|
+
)) : null)));
|
|
161
|
+
}
|
|
162
|
+
var styles = StyleSheet.create({
|
|
163
|
+
root: {
|
|
164
|
+
flex: 1
|
|
165
|
+
},
|
|
166
|
+
container: {
|
|
167
|
+
flex: 1
|
|
168
|
+
},
|
|
169
|
+
backdrop: {
|
|
170
|
+
...StyleSheet.absoluteFillObject,
|
|
171
|
+
backgroundColor: "#000"
|
|
172
|
+
},
|
|
173
|
+
imageWrap: {
|
|
174
|
+
alignItems: "center",
|
|
175
|
+
justifyContent: "center",
|
|
176
|
+
overflow: "hidden"
|
|
177
|
+
},
|
|
178
|
+
closeButton: {
|
|
179
|
+
position: "absolute",
|
|
180
|
+
right: s(12),
|
|
181
|
+
width: s(40),
|
|
182
|
+
height: s(40),
|
|
183
|
+
borderRadius: s(20),
|
|
184
|
+
backgroundColor: "rgba(0,0,0,0.4)",
|
|
185
|
+
alignItems: "center",
|
|
186
|
+
justifyContent: "center"
|
|
187
|
+
},
|
|
188
|
+
dots: {
|
|
189
|
+
position: "absolute",
|
|
190
|
+
left: 0,
|
|
191
|
+
right: 0,
|
|
192
|
+
alignItems: "center"
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
export { ImageViewer };
|