@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,98 @@
|
|
|
1
|
+
import { Button } from './chunk-2TFTAWVJ.mjs';
|
|
2
|
+
import { renderIcon } from './chunk-T7XZ7H7Y.mjs';
|
|
3
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
4
|
+
import { s, vs, mvs, ms } from './chunk-2CE3TQVY.mjs';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { StyleSheet, View, Text } from 'react-native';
|
|
7
|
+
|
|
8
|
+
function EmptyState({ icon, iconName, iconColor, title, description, action, actionLabel, onAction, size = "default", style }) {
|
|
9
|
+
const { colors } = useTheme();
|
|
10
|
+
const isCompact = size === "compact";
|
|
11
|
+
const effectiveIcon = iconName ? renderIcon(iconName, isCompact ? 32 : 48, iconColor ?? colors.foregroundMuted) : icon;
|
|
12
|
+
return /* @__PURE__ */ React.createElement(
|
|
13
|
+
View,
|
|
14
|
+
{
|
|
15
|
+
style: [
|
|
16
|
+
styles.container,
|
|
17
|
+
isCompact && styles.containerCompact,
|
|
18
|
+
{ borderColor: colors.border },
|
|
19
|
+
style
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
effectiveIcon ? /* @__PURE__ */ React.createElement(
|
|
23
|
+
View,
|
|
24
|
+
{
|
|
25
|
+
style: [
|
|
26
|
+
styles.iconWrapper,
|
|
27
|
+
isCompact && styles.iconWrapperCompact,
|
|
28
|
+
{ backgroundColor: colors.surface }
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
effectiveIcon
|
|
32
|
+
) : null,
|
|
33
|
+
/* @__PURE__ */ React.createElement(View, { style: styles.textWrapper }, /* @__PURE__ */ React.createElement(
|
|
34
|
+
Text,
|
|
35
|
+
{
|
|
36
|
+
style: [styles.title, isCompact && styles.titleCompact, { color: colors.foreground }],
|
|
37
|
+
allowFontScaling: true
|
|
38
|
+
},
|
|
39
|
+
title
|
|
40
|
+
), description && !isCompact ? /* @__PURE__ */ React.createElement(Text, { style: [styles.description, { color: colors.foregroundMuted }], allowFontScaling: true }, description) : null),
|
|
41
|
+
!isCompact && (action ? /* @__PURE__ */ React.createElement(View, { style: styles.action }, action) : actionLabel && onAction ? /* @__PURE__ */ React.createElement(View, { style: styles.action }, /* @__PURE__ */ React.createElement(Button, { label: actionLabel, variant: "primary", onPress: onAction })) : null)
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
var styles = StyleSheet.create({
|
|
45
|
+
container: {
|
|
46
|
+
alignItems: "center",
|
|
47
|
+
justifyContent: "center",
|
|
48
|
+
borderWidth: 1,
|
|
49
|
+
borderStyle: "dashed",
|
|
50
|
+
borderRadius: ms(12),
|
|
51
|
+
paddingBottom: vs(32)
|
|
52
|
+
},
|
|
53
|
+
containerCompact: {
|
|
54
|
+
paddingBottom: vs(20)
|
|
55
|
+
},
|
|
56
|
+
iconWrapper: {
|
|
57
|
+
width: s(80),
|
|
58
|
+
height: s(80),
|
|
59
|
+
borderRadius: ms(20),
|
|
60
|
+
alignItems: "center",
|
|
61
|
+
justifyContent: "center",
|
|
62
|
+
marginTop: s(32)
|
|
63
|
+
},
|
|
64
|
+
iconWrapperCompact: {
|
|
65
|
+
width: s(56),
|
|
66
|
+
height: s(56),
|
|
67
|
+
borderRadius: ms(14),
|
|
68
|
+
marginTop: s(20)
|
|
69
|
+
},
|
|
70
|
+
textWrapper: {
|
|
71
|
+
alignItems: "center",
|
|
72
|
+
gap: vs(8),
|
|
73
|
+
maxWidth: s(320),
|
|
74
|
+
paddingHorizontal: s(32),
|
|
75
|
+
marginTop: vs(16)
|
|
76
|
+
},
|
|
77
|
+
title: {
|
|
78
|
+
fontFamily: "Sohne-Medium",
|
|
79
|
+
fontSize: ms(18),
|
|
80
|
+
textAlign: "center"
|
|
81
|
+
},
|
|
82
|
+
titleCompact: {
|
|
83
|
+
fontSize: ms(15),
|
|
84
|
+
marginTop: vs(10)
|
|
85
|
+
},
|
|
86
|
+
description: {
|
|
87
|
+
fontFamily: "Sohne-Regular",
|
|
88
|
+
fontSize: ms(14),
|
|
89
|
+
lineHeight: mvs(20),
|
|
90
|
+
textAlign: "center"
|
|
91
|
+
},
|
|
92
|
+
action: {
|
|
93
|
+
marginTop: vs(8),
|
|
94
|
+
paddingHorizontal: s(32)
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
export { EmptyState };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
2
|
+
import { vs, s } from './chunk-2CE3TQVY.mjs';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { StyleSheet, View, Text } from 'react-native';
|
|
5
|
+
|
|
6
|
+
function Form({ children, style }) {
|
|
7
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.form, style] }, children);
|
|
8
|
+
}
|
|
9
|
+
function FormField({
|
|
10
|
+
children,
|
|
11
|
+
label,
|
|
12
|
+
error,
|
|
13
|
+
required,
|
|
14
|
+
style,
|
|
15
|
+
labelStyle,
|
|
16
|
+
errorStyle
|
|
17
|
+
}) {
|
|
18
|
+
const { colors } = useTheme();
|
|
19
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.field, style] }, label ? /* @__PURE__ */ React.createElement(Text, { style: [styles.label, { color: colors.foreground }, labelStyle], allowFontScaling: true }, label, required ? /* @__PURE__ */ React.createElement(Text, { style: { color: colors.destructive } }, " *") : null) : null, children, error ? /* @__PURE__ */ React.createElement(Text, { style: [styles.error, { color: colors.destructive }, errorStyle], allowFontScaling: true }, error) : null);
|
|
20
|
+
}
|
|
21
|
+
function FormSection({ children, title, description, style }) {
|
|
22
|
+
const { colors } = useTheme();
|
|
23
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.section, style] }, title ? /* @__PURE__ */ React.createElement(View, { style: styles.sectionHeader }, /* @__PURE__ */ React.createElement(Text, { style: [styles.sectionTitle, { color: colors.foreground }], allowFontScaling: true }, title), description ? /* @__PURE__ */ React.createElement(Text, { style: [styles.sectionDescription, { color: colors.foregroundMuted }], allowFontScaling: true }, description) : null) : null, children);
|
|
24
|
+
}
|
|
25
|
+
function FormFooter({ children, style }) {
|
|
26
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.footer, style] }, children);
|
|
27
|
+
}
|
|
28
|
+
Form.Field = FormField;
|
|
29
|
+
Form.Section = FormSection;
|
|
30
|
+
Form.Footer = FormFooter;
|
|
31
|
+
var styles = StyleSheet.create({
|
|
32
|
+
form: {
|
|
33
|
+
gap: vs(16)
|
|
34
|
+
},
|
|
35
|
+
field: {
|
|
36
|
+
gap: vs(6)
|
|
37
|
+
},
|
|
38
|
+
label: {
|
|
39
|
+
fontFamily: "Sohne-Medium",
|
|
40
|
+
fontSize: 14,
|
|
41
|
+
lineHeight: 20
|
|
42
|
+
},
|
|
43
|
+
error: {
|
|
44
|
+
fontFamily: "Sohne-Regular",
|
|
45
|
+
fontSize: 12,
|
|
46
|
+
lineHeight: 16
|
|
47
|
+
},
|
|
48
|
+
section: {
|
|
49
|
+
gap: vs(16)
|
|
50
|
+
},
|
|
51
|
+
sectionHeader: {
|
|
52
|
+
gap: vs(4)
|
|
53
|
+
},
|
|
54
|
+
sectionTitle: {
|
|
55
|
+
fontFamily: "Sohne-SemiBold",
|
|
56
|
+
fontSize: 16,
|
|
57
|
+
lineHeight: 24
|
|
58
|
+
},
|
|
59
|
+
sectionDescription: {
|
|
60
|
+
fontFamily: "Sohne-Regular",
|
|
61
|
+
fontSize: 14,
|
|
62
|
+
lineHeight: 20
|
|
63
|
+
},
|
|
64
|
+
footer: {
|
|
65
|
+
flexDirection: "row",
|
|
66
|
+
gap: s(12),
|
|
67
|
+
paddingTop: vs(8)
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export { Form, FormField, FormFooter, FormSection };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { useColorTransition } from './chunk-26BCI223.mjs';
|
|
2
|
+
import { TIMINGS } from './chunk-DVK4G2GT.mjs';
|
|
3
|
+
import { renderIcon } from './chunk-T7XZ7H7Y.mjs';
|
|
4
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
5
|
+
import { ms, s, vs } from './chunk-2CE3TQVY.mjs';
|
|
6
|
+
import React, { useState } from 'react';
|
|
7
|
+
import { Platform, StyleSheet, TouchableOpacity, View, Text, TextInput } from 'react-native';
|
|
8
|
+
import Animated, { useAnimatedStyle, interpolate, interpolateColor } from 'react-native-reanimated';
|
|
9
|
+
import { AntDesign } from '@expo/vector-icons';
|
|
10
|
+
|
|
11
|
+
var webInputResetStyle = Platform.OS === "web" ? { outlineStyle: "none", outlineWidth: 0, outlineColor: "transparent", boxShadow: "none" } : {};
|
|
12
|
+
function Input({ label, error, hint, disabled, prefix, suffix, prefixStyle, suffixStyle, prefixIcon, suffixIcon, prefixIconColor, suffixIconColor, type = "text", containerStyle, inputWrapperStyle, style, onFocus, onBlur, secureTextEntry, editable, accessibilityLabel, ...props }) {
|
|
13
|
+
const { colors } = useTheme();
|
|
14
|
+
const [focused, setFocused] = useState(false);
|
|
15
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
16
|
+
const focusProgress = useColorTransition(focused, {
|
|
17
|
+
duration: focused ? TIMINGS.focusIn.duration : TIMINGS.focusOut.duration
|
|
18
|
+
});
|
|
19
|
+
const isDisabled = disabled || editable === false;
|
|
20
|
+
const isPassword = type === "password";
|
|
21
|
+
const effectiveSecure = isPassword ? !showPassword : secureTextEntry;
|
|
22
|
+
const effectivePrefix = prefixIcon ? renderIcon(prefixIcon, 20, prefixIconColor ?? colors.foregroundMuted) : prefix;
|
|
23
|
+
const effectiveSuffix = isPassword && !suffix && !suffixIcon ? /* @__PURE__ */ React.createElement(
|
|
24
|
+
TouchableOpacity,
|
|
25
|
+
{
|
|
26
|
+
onPress: () => setShowPassword(!showPassword),
|
|
27
|
+
style: styles.passwordToggle,
|
|
28
|
+
activeOpacity: 0.6,
|
|
29
|
+
accessibilityRole: "button",
|
|
30
|
+
accessibilityLabel: showPassword ? "Hide password" : "Show password"
|
|
31
|
+
},
|
|
32
|
+
/* @__PURE__ */ React.createElement(AntDesign, { name: showPassword ? "eye" : "eye-invisible", size: 20, color: colors.foregroundMuted })
|
|
33
|
+
) : suffixIcon ? renderIcon(suffixIcon, 20, suffixIconColor ?? colors.foregroundMuted) : suffix;
|
|
34
|
+
const borderAnimStyle = useAnimatedStyle(() => ({
|
|
35
|
+
borderColor: error ? colors.destructive : interpolateColor(focusProgress.value, [0, 1], [colors.border, colors.primary]),
|
|
36
|
+
borderWidth: error ? 2 : interpolate(focusProgress.value, [0, 1], [1, 2])
|
|
37
|
+
}));
|
|
38
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.container, isDisabled && styles.containerDisabled, containerStyle] }, label ? /* @__PURE__ */ React.createElement(Text, { style: [styles.label, { color: colors.foreground }], allowFontScaling: true }, label) : null, /* @__PURE__ */ React.createElement(
|
|
39
|
+
Animated.View,
|
|
40
|
+
{
|
|
41
|
+
style: [
|
|
42
|
+
styles.inputWrapper,
|
|
43
|
+
{ backgroundColor: isDisabled ? colors.surface : colors.background },
|
|
44
|
+
inputWrapperStyle
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
/* @__PURE__ */ React.createElement(Animated.View, { style: [styles.borderOverlay, borderAnimStyle], pointerEvents: "none" }),
|
|
48
|
+
effectivePrefix ? typeof effectivePrefix === "string" ? /* @__PURE__ */ React.createElement(Text, { style: [styles.prefixText, { color: colors.foregroundMuted }, prefixStyle], allowFontScaling: true }, effectivePrefix) : /* @__PURE__ */ React.createElement(View, { style: styles.prefixContainer }, effectivePrefix) : null,
|
|
49
|
+
/* @__PURE__ */ React.createElement(
|
|
50
|
+
TextInput,
|
|
51
|
+
{
|
|
52
|
+
style: [
|
|
53
|
+
styles.input,
|
|
54
|
+
{ color: colors.foreground },
|
|
55
|
+
webInputResetStyle,
|
|
56
|
+
style
|
|
57
|
+
],
|
|
58
|
+
onFocus: (e) => {
|
|
59
|
+
setFocused(true);
|
|
60
|
+
onFocus?.(e);
|
|
61
|
+
},
|
|
62
|
+
onBlur: (e) => {
|
|
63
|
+
setFocused(false);
|
|
64
|
+
onBlur?.(e);
|
|
65
|
+
},
|
|
66
|
+
placeholderTextColor: colors.foregroundMuted,
|
|
67
|
+
allowFontScaling: true,
|
|
68
|
+
secureTextEntry: effectiveSecure,
|
|
69
|
+
editable: isDisabled ? false : editable,
|
|
70
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
71
|
+
...props
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
effectiveSuffix ? typeof effectiveSuffix === "string" ? /* @__PURE__ */ React.createElement(Text, { style: [styles.suffixText, { color: colors.foregroundMuted }, suffixStyle], allowFontScaling: true }, effectiveSuffix) : /* @__PURE__ */ React.createElement(View, { style: styles.suffixContainer }, effectiveSuffix) : null
|
|
75
|
+
), error ? /* @__PURE__ */ React.createElement(
|
|
76
|
+
Text,
|
|
77
|
+
{
|
|
78
|
+
style: [styles.helperText, { color: colors.destructive }],
|
|
79
|
+
allowFontScaling: true,
|
|
80
|
+
accessibilityLiveRegion: "polite"
|
|
81
|
+
},
|
|
82
|
+
error
|
|
83
|
+
) : null, !error && hint ? /* @__PURE__ */ React.createElement(Text, { style: [styles.helperText, { color: colors.foregroundMuted }], allowFontScaling: true }, hint) : null);
|
|
84
|
+
}
|
|
85
|
+
var styles = StyleSheet.create({
|
|
86
|
+
container: {
|
|
87
|
+
gap: vs(8)
|
|
88
|
+
},
|
|
89
|
+
containerDisabled: {
|
|
90
|
+
opacity: 0.6
|
|
91
|
+
},
|
|
92
|
+
label: {
|
|
93
|
+
fontFamily: "Sohne-Medium",
|
|
94
|
+
fontSize: ms(14)
|
|
95
|
+
},
|
|
96
|
+
inputWrapper: {
|
|
97
|
+
flexDirection: "row",
|
|
98
|
+
alignItems: "center",
|
|
99
|
+
// Border lives on borderOverlay (absolute) so its 1px→2px focus change
|
|
100
|
+
// never resizes this box. Wrapper itself carries no border.
|
|
101
|
+
borderRadius: 8,
|
|
102
|
+
paddingHorizontal: s(14),
|
|
103
|
+
paddingVertical: vs(11),
|
|
104
|
+
minHeight: 48
|
|
105
|
+
},
|
|
106
|
+
borderOverlay: {
|
|
107
|
+
...StyleSheet.absoluteFillObject,
|
|
108
|
+
borderRadius: 8
|
|
109
|
+
},
|
|
110
|
+
input: {
|
|
111
|
+
fontFamily: "Sohne-Regular",
|
|
112
|
+
flex: 1,
|
|
113
|
+
fontSize: ms(16),
|
|
114
|
+
paddingVertical: vs(2),
|
|
115
|
+
includeFontPadding: false
|
|
116
|
+
},
|
|
117
|
+
prefixContainer: {
|
|
118
|
+
marginRight: s(8)
|
|
119
|
+
},
|
|
120
|
+
prefixText: {
|
|
121
|
+
fontFamily: "Sohne-Regular",
|
|
122
|
+
fontSize: ms(15),
|
|
123
|
+
marginRight: s(8)
|
|
124
|
+
},
|
|
125
|
+
suffixContainer: {
|
|
126
|
+
marginLeft: s(8)
|
|
127
|
+
},
|
|
128
|
+
suffixText: {
|
|
129
|
+
fontFamily: "Sohne-Regular",
|
|
130
|
+
fontSize: ms(15),
|
|
131
|
+
marginLeft: s(8)
|
|
132
|
+
},
|
|
133
|
+
// AUDIT FIX: was padding: s(4) → ~28px tap target. Now 12px padding → ~44px.
|
|
134
|
+
// Negative margin compensates so the visual icon position is unchanged.
|
|
135
|
+
passwordToggle: {
|
|
136
|
+
padding: s(12),
|
|
137
|
+
margin: -s(8)
|
|
138
|
+
},
|
|
139
|
+
helperText: {
|
|
140
|
+
fontFamily: "Sohne-Regular",
|
|
141
|
+
fontSize: ms(13)
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
export { Input };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Button } from './chunk-2TFTAWVJ.mjs';
|
|
2
|
+
import { impactMedium, notificationSuccess, selectionAsync } from './chunk-EJ7ZPXOH.mjs';
|
|
3
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
4
|
+
import { vs, mvs, ms, s } from './chunk-2CE3TQVY.mjs';
|
|
5
|
+
import React, { useRef, useEffect } from 'react';
|
|
6
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
7
|
+
import { BottomSheetModal, BottomSheetView, BottomSheetBackdrop } from '@gorhom/bottom-sheet';
|
|
8
|
+
import { Feather } from '@expo/vector-icons';
|
|
9
|
+
|
|
10
|
+
function ConfirmDialog({
|
|
11
|
+
visible,
|
|
12
|
+
title,
|
|
13
|
+
description,
|
|
14
|
+
confirmLabel = "Confirm",
|
|
15
|
+
cancelLabel = "Cancel",
|
|
16
|
+
confirmVariant = "primary",
|
|
17
|
+
onConfirm,
|
|
18
|
+
onCancel
|
|
19
|
+
}) {
|
|
20
|
+
const { colors } = useTheme();
|
|
21
|
+
const ref = useRef(null);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (visible) {
|
|
24
|
+
impactMedium();
|
|
25
|
+
ref.current?.present();
|
|
26
|
+
} else {
|
|
27
|
+
ref.current?.dismiss();
|
|
28
|
+
}
|
|
29
|
+
}, [visible]);
|
|
30
|
+
const renderBackdrop = (props) => /* @__PURE__ */ React.createElement(
|
|
31
|
+
BottomSheetBackdrop,
|
|
32
|
+
{
|
|
33
|
+
...props,
|
|
34
|
+
disappearsOnIndex: -1,
|
|
35
|
+
appearsOnIndex: 0,
|
|
36
|
+
pressBehavior: "close"
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
return /* @__PURE__ */ React.createElement(
|
|
40
|
+
BottomSheetModal,
|
|
41
|
+
{
|
|
42
|
+
ref,
|
|
43
|
+
enableDynamicSizing: true,
|
|
44
|
+
onDismiss: onCancel,
|
|
45
|
+
backdropComponent: renderBackdrop,
|
|
46
|
+
backgroundStyle: [styles.background, { backgroundColor: colors.card }],
|
|
47
|
+
handleIndicatorStyle: [styles.handle, { backgroundColor: colors.border }],
|
|
48
|
+
enablePanDownToClose: true
|
|
49
|
+
},
|
|
50
|
+
/* @__PURE__ */ React.createElement(BottomSheetView, { style: styles.content }, /* @__PURE__ */ React.createElement(Text, { style: [styles.title, { color: colors.foreground }], allowFontScaling: true }, title), description ? /* @__PURE__ */ React.createElement(Text, { style: [styles.description, { color: colors.foregroundMuted }], allowFontScaling: true }, description) : null, /* @__PURE__ */ React.createElement(View, { style: styles.actions }, /* @__PURE__ */ React.createElement(
|
|
51
|
+
Button,
|
|
52
|
+
{
|
|
53
|
+
label: confirmLabel,
|
|
54
|
+
variant: confirmVariant,
|
|
55
|
+
fullWidth: true,
|
|
56
|
+
onPress: () => {
|
|
57
|
+
notificationSuccess();
|
|
58
|
+
onConfirm();
|
|
59
|
+
},
|
|
60
|
+
icon: /* @__PURE__ */ React.createElement(
|
|
61
|
+
Feather,
|
|
62
|
+
{
|
|
63
|
+
name: confirmVariant === "destructive" ? "trash-2" : "check",
|
|
64
|
+
size: 15,
|
|
65
|
+
color: confirmVariant === "destructive" ? colors.destructiveForeground : colors.primaryForeground
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
), /* @__PURE__ */ React.createElement(
|
|
70
|
+
Button,
|
|
71
|
+
{
|
|
72
|
+
label: cancelLabel,
|
|
73
|
+
variant: "secondary",
|
|
74
|
+
fullWidth: true,
|
|
75
|
+
onPress: () => {
|
|
76
|
+
selectionAsync();
|
|
77
|
+
onCancel();
|
|
78
|
+
},
|
|
79
|
+
icon: /* @__PURE__ */ React.createElement(Feather, { name: "x", size: 15, color: colors.foreground })
|
|
80
|
+
}
|
|
81
|
+
)))
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
var styles = StyleSheet.create({
|
|
85
|
+
background: {
|
|
86
|
+
borderTopLeftRadius: ms(16),
|
|
87
|
+
borderTopRightRadius: ms(16)
|
|
88
|
+
},
|
|
89
|
+
handle: {
|
|
90
|
+
width: s(36),
|
|
91
|
+
height: vs(4),
|
|
92
|
+
borderRadius: ms(2)
|
|
93
|
+
},
|
|
94
|
+
content: {
|
|
95
|
+
paddingHorizontal: s(24),
|
|
96
|
+
paddingBottom: vs(32),
|
|
97
|
+
gap: vs(12)
|
|
98
|
+
},
|
|
99
|
+
title: {
|
|
100
|
+
fontFamily: "Sohne-SemiBold",
|
|
101
|
+
fontSize: ms(18),
|
|
102
|
+
lineHeight: mvs(26)
|
|
103
|
+
},
|
|
104
|
+
description: {
|
|
105
|
+
fontFamily: "Sohne-Regular",
|
|
106
|
+
fontSize: ms(15),
|
|
107
|
+
lineHeight: mvs(22)
|
|
108
|
+
},
|
|
109
|
+
actions: {
|
|
110
|
+
gap: vs(10),
|
|
111
|
+
marginTop: vs(8)
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
export { ConfirmDialog };
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { usePressScale } from './chunk-YNROWHQJ.mjs';
|
|
2
|
+
import { selectionAsync } from './chunk-EJ7ZPXOH.mjs';
|
|
3
|
+
import { PRESS_SCALE } from './chunk-DVK4G2GT.mjs';
|
|
4
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
5
|
+
import { ms, vs, s } from './chunk-2CE3TQVY.mjs';
|
|
6
|
+
import React, { useState, useRef } from 'react';
|
|
7
|
+
import { Platform, StyleSheet, View, Text, TouchableOpacity, Modal } from 'react-native';
|
|
8
|
+
import Animated from 'react-native-reanimated';
|
|
9
|
+
import { Picker } from '@react-native-picker/picker';
|
|
10
|
+
import { Entypo } from '@expo/vector-icons';
|
|
11
|
+
|
|
12
|
+
var isIOS = Platform.OS === "ios";
|
|
13
|
+
var isAndroid = Platform.OS === "android";
|
|
14
|
+
var isWeb = Platform.OS === "web";
|
|
15
|
+
function Select({
|
|
16
|
+
options,
|
|
17
|
+
value,
|
|
18
|
+
onValueChange,
|
|
19
|
+
placeholder = "Select an option",
|
|
20
|
+
label,
|
|
21
|
+
error,
|
|
22
|
+
disabled,
|
|
23
|
+
style,
|
|
24
|
+
accessibilityLabel
|
|
25
|
+
}) {
|
|
26
|
+
const { colors } = useTheme();
|
|
27
|
+
const { animatedStyle, onPressIn, onPressOut } = usePressScale({
|
|
28
|
+
pressScale: PRESS_SCALE.button,
|
|
29
|
+
disabled
|
|
30
|
+
});
|
|
31
|
+
const [pickerVisible, setPickerVisible] = useState(false);
|
|
32
|
+
const [pendingValue, setPendingValue] = useState(value);
|
|
33
|
+
const pickerRef = useRef(null);
|
|
34
|
+
const selected = options.find((o) => o.value === value);
|
|
35
|
+
const handleOpen = () => {
|
|
36
|
+
if (disabled) return;
|
|
37
|
+
selectionAsync();
|
|
38
|
+
if (isIOS) {
|
|
39
|
+
setPendingValue(value);
|
|
40
|
+
setPickerVisible(true);
|
|
41
|
+
} else if (isAndroid) {
|
|
42
|
+
pickerRef.current?.focus?.();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const handleDismiss = () => {
|
|
46
|
+
setPickerVisible(false);
|
|
47
|
+
};
|
|
48
|
+
const handleConfirm = () => {
|
|
49
|
+
if (pendingValue !== void 0 && pendingValue !== "") {
|
|
50
|
+
selectionAsync();
|
|
51
|
+
onValueChange?.(pendingValue);
|
|
52
|
+
}
|
|
53
|
+
setPickerVisible(false);
|
|
54
|
+
};
|
|
55
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.container, style] }, label ? /* @__PURE__ */ React.createElement(Text, { style: [styles.label, { color: colors.foreground }], allowFontScaling: true }, label) : null, !isWeb ? /* @__PURE__ */ React.createElement(Animated.View, { style: [animatedStyle, { opacity: disabled ? 0.45 : 1 }] }, /* @__PURE__ */ React.createElement(
|
|
56
|
+
TouchableOpacity,
|
|
57
|
+
{
|
|
58
|
+
style: [
|
|
59
|
+
styles.trigger,
|
|
60
|
+
{
|
|
61
|
+
borderColor: error ? colors.destructive : colors.border,
|
|
62
|
+
backgroundColor: colors.background
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
onPress: handleOpen,
|
|
66
|
+
onPressIn,
|
|
67
|
+
onPressOut,
|
|
68
|
+
activeOpacity: 1,
|
|
69
|
+
touchSoundDisabled: true,
|
|
70
|
+
accessibilityRole: "combobox",
|
|
71
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
72
|
+
accessibilityValue: { text: selected?.label ?? placeholder },
|
|
73
|
+
accessibilityState: { disabled: !!disabled, expanded: pickerVisible }
|
|
74
|
+
},
|
|
75
|
+
/* @__PURE__ */ React.createElement(
|
|
76
|
+
Text,
|
|
77
|
+
{
|
|
78
|
+
style: [
|
|
79
|
+
styles.triggerText,
|
|
80
|
+
{ color: selected ? colors.foreground : colors.foregroundMuted }
|
|
81
|
+
],
|
|
82
|
+
numberOfLines: 1,
|
|
83
|
+
allowFontScaling: true
|
|
84
|
+
},
|
|
85
|
+
selected?.label ?? placeholder
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ React.createElement(Entypo, { name: "chevron-down", size: 20, color: colors.foregroundMuted })
|
|
88
|
+
)) : null, isIOS ? /* @__PURE__ */ React.createElement(
|
|
89
|
+
Modal,
|
|
90
|
+
{
|
|
91
|
+
visible: pickerVisible,
|
|
92
|
+
transparent: true,
|
|
93
|
+
animationType: "slide",
|
|
94
|
+
onRequestClose: handleDismiss
|
|
95
|
+
},
|
|
96
|
+
/* @__PURE__ */ React.createElement(TouchableOpacity, { style: styles.iosBackdrop, activeOpacity: 1, onPress: handleDismiss }),
|
|
97
|
+
/* @__PURE__ */ React.createElement(View, { style: [styles.iosSheet, { backgroundColor: colors.card }] }, /* @__PURE__ */ React.createElement(View, { style: [styles.iosToolbar, { borderBottomColor: colors.border }] }, label ? /* @__PURE__ */ React.createElement(Text, { style: [styles.iosToolbarTitle, { color: colors.foreground }], allowFontScaling: true }, label) : /* @__PURE__ */ React.createElement(View, null), /* @__PURE__ */ React.createElement(TouchableOpacity, { onPress: handleConfirm, style: styles.iosDoneBtn, hitSlop: { top: 8, bottom: 8, left: 8, right: 8 } }, /* @__PURE__ */ React.createElement(Text, { style: [styles.iosDoneBtnText, { color: colors.primary }], allowFontScaling: true }, "Done"))), /* @__PURE__ */ React.createElement(
|
|
98
|
+
Picker,
|
|
99
|
+
{
|
|
100
|
+
selectedValue: pendingValue ?? "",
|
|
101
|
+
onValueChange: (val) => setPendingValue(val),
|
|
102
|
+
itemStyle: { color: colors.foreground }
|
|
103
|
+
},
|
|
104
|
+
!value ? /* @__PURE__ */ React.createElement(Picker.Item, { label: placeholder, value: "", color: colors.foregroundMuted, enabled: false }) : null,
|
|
105
|
+
options.map((o) => /* @__PURE__ */ React.createElement(
|
|
106
|
+
Picker.Item,
|
|
107
|
+
{
|
|
108
|
+
key: o.value,
|
|
109
|
+
label: o.label,
|
|
110
|
+
value: o.value,
|
|
111
|
+
enabled: !o.disabled,
|
|
112
|
+
color: o.disabled ? colors.foregroundMuted : colors.foreground
|
|
113
|
+
}
|
|
114
|
+
))
|
|
115
|
+
))
|
|
116
|
+
) : null, isAndroid ? /* @__PURE__ */ React.createElement(
|
|
117
|
+
Picker,
|
|
118
|
+
{
|
|
119
|
+
ref: pickerRef,
|
|
120
|
+
selectedValue: value ?? "",
|
|
121
|
+
onValueChange: (val) => {
|
|
122
|
+
if (val !== "") {
|
|
123
|
+
selectionAsync();
|
|
124
|
+
onValueChange?.(val);
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
mode: "dialog",
|
|
128
|
+
enabled: !disabled,
|
|
129
|
+
prompt: label,
|
|
130
|
+
style: styles.androidHiddenPicker
|
|
131
|
+
},
|
|
132
|
+
!value ? /* @__PURE__ */ React.createElement(Picker.Item, { label: placeholder, value: "", enabled: false }) : null,
|
|
133
|
+
options.map((o) => /* @__PURE__ */ React.createElement(
|
|
134
|
+
Picker.Item,
|
|
135
|
+
{
|
|
136
|
+
key: o.value,
|
|
137
|
+
label: o.label,
|
|
138
|
+
value: o.value,
|
|
139
|
+
enabled: !o.disabled
|
|
140
|
+
}
|
|
141
|
+
))
|
|
142
|
+
) : null, isWeb ? /* @__PURE__ */ React.createElement(
|
|
143
|
+
Picker,
|
|
144
|
+
{
|
|
145
|
+
selectedValue: value ?? "",
|
|
146
|
+
onValueChange: (val) => {
|
|
147
|
+
if (val !== "") {
|
|
148
|
+
onValueChange?.(val);
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
enabled: !disabled,
|
|
152
|
+
style: [
|
|
153
|
+
styles.webPicker,
|
|
154
|
+
{
|
|
155
|
+
borderColor: error ? colors.destructive : colors.border,
|
|
156
|
+
color: selected ? colors.foreground : colors.foregroundMuted,
|
|
157
|
+
backgroundColor: colors.background,
|
|
158
|
+
opacity: disabled ? 0.45 : 1
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
/* @__PURE__ */ React.createElement(Picker.Item, { label: placeholder, value: "", enabled: false }),
|
|
163
|
+
options.map((o) => /* @__PURE__ */ React.createElement(
|
|
164
|
+
Picker.Item,
|
|
165
|
+
{
|
|
166
|
+
key: o.value,
|
|
167
|
+
label: o.label,
|
|
168
|
+
value: o.value,
|
|
169
|
+
enabled: !o.disabled
|
|
170
|
+
}
|
|
171
|
+
))
|
|
172
|
+
) : null, error ? /* @__PURE__ */ React.createElement(Text, { style: [styles.helperText, { color: colors.destructive }], allowFontScaling: true }, error) : null);
|
|
173
|
+
}
|
|
174
|
+
var styles = StyleSheet.create({
|
|
175
|
+
container: {
|
|
176
|
+
gap: vs(8)
|
|
177
|
+
},
|
|
178
|
+
label: {
|
|
179
|
+
fontFamily: "Sohne-Medium",
|
|
180
|
+
fontSize: ms(13)
|
|
181
|
+
},
|
|
182
|
+
trigger: {
|
|
183
|
+
flexDirection: "row",
|
|
184
|
+
alignItems: "center",
|
|
185
|
+
justifyContent: "space-between",
|
|
186
|
+
borderWidth: 1,
|
|
187
|
+
borderRadius: ms(8),
|
|
188
|
+
paddingHorizontal: s(14),
|
|
189
|
+
paddingVertical: vs(11)
|
|
190
|
+
},
|
|
191
|
+
triggerText: {
|
|
192
|
+
fontFamily: "Sohne-Regular",
|
|
193
|
+
fontSize: ms(15),
|
|
194
|
+
flex: 1
|
|
195
|
+
},
|
|
196
|
+
chevron: {
|
|
197
|
+
marginLeft: s(8)
|
|
198
|
+
},
|
|
199
|
+
helperText: {
|
|
200
|
+
fontFamily: "Sohne-Regular",
|
|
201
|
+
fontSize: ms(13)
|
|
202
|
+
},
|
|
203
|
+
iosBackdrop: {
|
|
204
|
+
flex: 1,
|
|
205
|
+
backgroundColor: "rgba(0,0,0,0.4)"
|
|
206
|
+
},
|
|
207
|
+
iosSheet: {
|
|
208
|
+
borderTopLeftRadius: ms(16),
|
|
209
|
+
borderTopRightRadius: ms(16),
|
|
210
|
+
paddingBottom: vs(32)
|
|
211
|
+
},
|
|
212
|
+
iosToolbar: {
|
|
213
|
+
flexDirection: "row",
|
|
214
|
+
alignItems: "center",
|
|
215
|
+
justifyContent: "space-between",
|
|
216
|
+
paddingHorizontal: s(16),
|
|
217
|
+
paddingVertical: vs(12),
|
|
218
|
+
borderBottomWidth: 1
|
|
219
|
+
},
|
|
220
|
+
iosToolbarTitle: {
|
|
221
|
+
fontFamily: "Sohne-SemiBold",
|
|
222
|
+
fontSize: ms(17)
|
|
223
|
+
},
|
|
224
|
+
iosDoneBtn: {
|
|
225
|
+
padding: s(4)
|
|
226
|
+
},
|
|
227
|
+
iosDoneBtnText: {
|
|
228
|
+
fontFamily: "Sohne-SemiBold",
|
|
229
|
+
fontSize: ms(17)
|
|
230
|
+
},
|
|
231
|
+
androidHiddenPicker: {
|
|
232
|
+
height: 0,
|
|
233
|
+
opacity: 0,
|
|
234
|
+
position: "absolute"
|
|
235
|
+
},
|
|
236
|
+
webPicker: {
|
|
237
|
+
borderWidth: 1,
|
|
238
|
+
borderRadius: ms(8),
|
|
239
|
+
paddingHorizontal: s(14),
|
|
240
|
+
paddingVertical: vs(11),
|
|
241
|
+
fontSize: ms(15)
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
export { Select };
|