@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,61 @@
|
|
|
1
|
+
import { Input } from './chunk-756RAKE4.mjs';
|
|
2
|
+
import { ms, vs } from './chunk-2CE3TQVY.mjs';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
function formatCurrency(raw, separator) {
|
|
6
|
+
const digits = raw.replace(/\D/g, "");
|
|
7
|
+
if (!digits) return "";
|
|
8
|
+
return digits.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
|
|
9
|
+
}
|
|
10
|
+
function CurrencyInput({
|
|
11
|
+
value,
|
|
12
|
+
onChangeText,
|
|
13
|
+
onChangeValue,
|
|
14
|
+
prefix = "$",
|
|
15
|
+
thousandsSeparator = ".",
|
|
16
|
+
size = "default",
|
|
17
|
+
label,
|
|
18
|
+
error,
|
|
19
|
+
hint,
|
|
20
|
+
placeholder,
|
|
21
|
+
editable,
|
|
22
|
+
containerStyle,
|
|
23
|
+
style
|
|
24
|
+
}) {
|
|
25
|
+
const handleChange = (text) => {
|
|
26
|
+
const withoutPrefix = prefix && text.startsWith(prefix) ? text.slice(prefix.length) : text;
|
|
27
|
+
const formatted = formatCurrency(withoutPrefix, thousandsSeparator);
|
|
28
|
+
const display = formatted;
|
|
29
|
+
onChangeText?.(display);
|
|
30
|
+
const separatorRegex = new RegExp(`\\${thousandsSeparator}`, "g");
|
|
31
|
+
const raw = parseFloat(formatted.replace(separatorRegex, "") || "0");
|
|
32
|
+
onChangeValue?.(isNaN(raw) ? 0 : raw);
|
|
33
|
+
};
|
|
34
|
+
const isLarge = size === "large";
|
|
35
|
+
const inputStyle = isLarge ? { fontFamily: "Sohne-Regular", fontSize: ms(36) } : { fontFamily: "Sohne-Regular" };
|
|
36
|
+
const prefixStyle = {
|
|
37
|
+
fontFamily: "Sohne-Regular",
|
|
38
|
+
fontSize: isLarge ? ms(32) : ms(17)
|
|
39
|
+
};
|
|
40
|
+
const displayValue = value && prefix && value.startsWith(prefix) ? value.slice(prefix.length) : value;
|
|
41
|
+
return /* @__PURE__ */ React.createElement(
|
|
42
|
+
Input,
|
|
43
|
+
{
|
|
44
|
+
value: displayValue,
|
|
45
|
+
onChangeText: handleChange,
|
|
46
|
+
keyboardType: "numeric",
|
|
47
|
+
label,
|
|
48
|
+
error,
|
|
49
|
+
hint,
|
|
50
|
+
placeholder: placeholder ?? "0",
|
|
51
|
+
editable,
|
|
52
|
+
prefix,
|
|
53
|
+
prefixStyle,
|
|
54
|
+
containerStyle,
|
|
55
|
+
inputWrapperStyle: isLarge ? { paddingVertical: vs(16), minHeight: 72 } : void 0,
|
|
56
|
+
style: [inputStyle, style]
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { CurrencyInput };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { PressableCard } from './chunk-3DKJ2GIC.mjs';
|
|
2
|
+
import { impactLight } from './chunk-EJ7ZPXOH.mjs';
|
|
3
|
+
import { PRESS_SCALE } from './chunk-DVK4G2GT.mjs';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
function Pressable({
|
|
7
|
+
children,
|
|
8
|
+
onPress,
|
|
9
|
+
pressScale: _pressScale = PRESS_SCALE.card,
|
|
10
|
+
haptics = true,
|
|
11
|
+
style,
|
|
12
|
+
disabled,
|
|
13
|
+
hoverScale: _hoverScale = 1.02
|
|
14
|
+
}) {
|
|
15
|
+
const handlePress = () => {
|
|
16
|
+
if (disabled || !onPress) return;
|
|
17
|
+
if (haptics) impactLight();
|
|
18
|
+
onPress();
|
|
19
|
+
};
|
|
20
|
+
return /* @__PURE__ */ React.createElement(
|
|
21
|
+
PressableCard,
|
|
22
|
+
{
|
|
23
|
+
style,
|
|
24
|
+
onPress: handlePress,
|
|
25
|
+
enabled: !disabled,
|
|
26
|
+
rippleColor: "transparent",
|
|
27
|
+
touchSoundDisabled: true,
|
|
28
|
+
activateOnHover: true,
|
|
29
|
+
accessibilityRole: "button",
|
|
30
|
+
accessibilityState: { disabled: !!disabled }
|
|
31
|
+
},
|
|
32
|
+
children
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { Pressable };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { selectionAsync } from './chunk-EJ7ZPXOH.mjs';
|
|
2
|
+
import { renderIcon } from './chunk-T7XZ7H7Y.mjs';
|
|
3
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
4
|
+
import { ms, s, vs, mvs } from './chunk-2CE3TQVY.mjs';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { StyleSheet, View, TouchableOpacity, Text } from 'react-native';
|
|
7
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
8
|
+
|
|
9
|
+
function TabBar({
|
|
10
|
+
items,
|
|
11
|
+
activeKey,
|
|
12
|
+
onTabPress,
|
|
13
|
+
activeColor,
|
|
14
|
+
inactiveColor,
|
|
15
|
+
withSafeArea = true,
|
|
16
|
+
style
|
|
17
|
+
}) {
|
|
18
|
+
const { colors } = useTheme();
|
|
19
|
+
const insets = useSafeAreaInsets();
|
|
20
|
+
const resolvedActive = activeColor ?? colors.primary;
|
|
21
|
+
const resolvedInactive = inactiveColor ?? colors.foregroundMuted;
|
|
22
|
+
return /* @__PURE__ */ React.createElement(
|
|
23
|
+
View,
|
|
24
|
+
{
|
|
25
|
+
style: [
|
|
26
|
+
styles.container,
|
|
27
|
+
{
|
|
28
|
+
backgroundColor: colors.card,
|
|
29
|
+
borderTopColor: colors.border,
|
|
30
|
+
paddingBottom: withSafeArea ? insets.bottom : 0
|
|
31
|
+
},
|
|
32
|
+
style
|
|
33
|
+
],
|
|
34
|
+
accessibilityRole: "tablist"
|
|
35
|
+
},
|
|
36
|
+
items.map((item) => {
|
|
37
|
+
const active = item.key === activeKey;
|
|
38
|
+
const tint = active ? resolvedActive : resolvedInactive;
|
|
39
|
+
const iconNode = item.icon ?? (item.iconName ? renderIcon(item.iconName, ms(24), tint) : null);
|
|
40
|
+
const showBadge = item.badge !== void 0 && item.badge !== false;
|
|
41
|
+
const badgeCount = typeof item.badge === "number" ? item.badge : void 0;
|
|
42
|
+
return /* @__PURE__ */ React.createElement(
|
|
43
|
+
TouchableOpacity,
|
|
44
|
+
{
|
|
45
|
+
key: item.key,
|
|
46
|
+
style: styles.tab,
|
|
47
|
+
onPress: () => {
|
|
48
|
+
if (!active) selectionAsync();
|
|
49
|
+
onTabPress(item.key);
|
|
50
|
+
},
|
|
51
|
+
activeOpacity: 0.7,
|
|
52
|
+
touchSoundDisabled: true,
|
|
53
|
+
accessibilityRole: "tab",
|
|
54
|
+
accessibilityState: { selected: active },
|
|
55
|
+
accessibilityLabel: item.label ?? item.key
|
|
56
|
+
},
|
|
57
|
+
/* @__PURE__ */ React.createElement(View, null, iconNode, showBadge ? /* @__PURE__ */ React.createElement(
|
|
58
|
+
View,
|
|
59
|
+
{
|
|
60
|
+
style: [
|
|
61
|
+
styles.badge,
|
|
62
|
+
{ backgroundColor: colors.destructive, borderColor: colors.card },
|
|
63
|
+
badgeCount === void 0 && styles.badgeDot
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
badgeCount !== void 0 ? /* @__PURE__ */ React.createElement(Text, { style: [styles.badgeText, { color: colors.destructiveForeground }], allowFontScaling: false }, badgeCount > 99 ? "99+" : badgeCount) : null
|
|
67
|
+
) : null),
|
|
68
|
+
item.label ? /* @__PURE__ */ React.createElement(Text, { style: [styles.label, { color: tint }], numberOfLines: 1, allowFontScaling: true }, item.label) : null
|
|
69
|
+
);
|
|
70
|
+
})
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
var styles = StyleSheet.create({
|
|
74
|
+
container: {
|
|
75
|
+
flexDirection: "row",
|
|
76
|
+
borderTopWidth: StyleSheet.hairlineWidth
|
|
77
|
+
},
|
|
78
|
+
tab: {
|
|
79
|
+
flex: 1,
|
|
80
|
+
alignItems: "center",
|
|
81
|
+
justifyContent: "center",
|
|
82
|
+
paddingTop: vs(8),
|
|
83
|
+
paddingBottom: vs(6),
|
|
84
|
+
gap: vs(2),
|
|
85
|
+
minHeight: vs(48)
|
|
86
|
+
},
|
|
87
|
+
label: {
|
|
88
|
+
fontFamily: "Sohne-Medium",
|
|
89
|
+
fontSize: ms(11),
|
|
90
|
+
lineHeight: mvs(14)
|
|
91
|
+
},
|
|
92
|
+
badge: {
|
|
93
|
+
position: "absolute",
|
|
94
|
+
top: -vs(4),
|
|
95
|
+
right: -s(10),
|
|
96
|
+
minWidth: s(16),
|
|
97
|
+
height: s(16),
|
|
98
|
+
borderRadius: s(8),
|
|
99
|
+
borderWidth: 1.5,
|
|
100
|
+
alignItems: "center",
|
|
101
|
+
justifyContent: "center",
|
|
102
|
+
paddingHorizontal: s(3)
|
|
103
|
+
},
|
|
104
|
+
badgeDot: {
|
|
105
|
+
minWidth: s(10),
|
|
106
|
+
height: s(10),
|
|
107
|
+
borderRadius: s(5),
|
|
108
|
+
top: -vs(2),
|
|
109
|
+
right: -s(6),
|
|
110
|
+
paddingHorizontal: 0
|
|
111
|
+
},
|
|
112
|
+
badgeText: {
|
|
113
|
+
fontFamily: "Sohne-SemiBold",
|
|
114
|
+
fontSize: ms(9),
|
|
115
|
+
lineHeight: ms(11)
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
export { TabBar };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
|
+
|
|
5
|
+
function Separator({ orientation = "horizontal", style }) {
|
|
6
|
+
const { colors } = useTheme();
|
|
7
|
+
return /* @__PURE__ */ React.createElement(
|
|
8
|
+
View,
|
|
9
|
+
{
|
|
10
|
+
style: [
|
|
11
|
+
orientation === "horizontal" ? styles.horizontal : styles.vertical,
|
|
12
|
+
{ backgroundColor: colors.separator },
|
|
13
|
+
style
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
var styles = StyleSheet.create({
|
|
19
|
+
horizontal: {
|
|
20
|
+
height: 1,
|
|
21
|
+
width: "100%"
|
|
22
|
+
},
|
|
23
|
+
vertical: {
|
|
24
|
+
width: 1,
|
|
25
|
+
height: "100%"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export { Separator };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { usePressScale } from './chunk-YNROWHQJ.mjs';
|
|
2
|
+
import { selectionAsync } from './chunk-EJ7ZPXOH.mjs';
|
|
3
|
+
import { PRESS_SCALE } 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 { mvs, ms, vs, s } from './chunk-2CE3TQVY.mjs';
|
|
8
|
+
import React, { useState } from 'react';
|
|
9
|
+
import { StyleSheet, ScrollView, View, TouchableOpacity, Text } from 'react-native';
|
|
10
|
+
import Animated from 'react-native-reanimated';
|
|
11
|
+
|
|
12
|
+
function isSelected(value, candidate) {
|
|
13
|
+
if (value == null) return false;
|
|
14
|
+
return Array.isArray(value) ? value.includes(candidate) : value === candidate;
|
|
15
|
+
}
|
|
16
|
+
function Cell({ item, selected, width, onPress }) {
|
|
17
|
+
const { colors } = useTheme();
|
|
18
|
+
const { animatedStyle, onPressIn, onPressOut, hoverHandlers } = usePressScale({
|
|
19
|
+
pressScale: PRESS_SCALE.chip,
|
|
20
|
+
disabled: item.disabled
|
|
21
|
+
});
|
|
22
|
+
const iconColor = selected ? colors.primary : colors.foregroundSubtle;
|
|
23
|
+
const iconNode = item.icon ?? (item.iconName ? renderIcon(item.iconName, ms(24), iconColor) : null);
|
|
24
|
+
return /* @__PURE__ */ React.createElement(Animated.View, { style: [{ width }, animatedStyle] }, /* @__PURE__ */ React.createElement(
|
|
25
|
+
TouchableOpacity,
|
|
26
|
+
{
|
|
27
|
+
onPress,
|
|
28
|
+
onPressIn,
|
|
29
|
+
onPressOut,
|
|
30
|
+
disabled: item.disabled,
|
|
31
|
+
activeOpacity: 1,
|
|
32
|
+
touchSoundDisabled: true,
|
|
33
|
+
accessibilityRole: "button",
|
|
34
|
+
accessibilityState: { selected, disabled: item.disabled },
|
|
35
|
+
accessibilityLabel: item.label ?? String(item.value),
|
|
36
|
+
...hoverHandlers,
|
|
37
|
+
style: [
|
|
38
|
+
styles.cell,
|
|
39
|
+
{
|
|
40
|
+
backgroundColor: selected ? colors.primary + "14" : colors.surface,
|
|
41
|
+
borderColor: selected ? colors.primary : "transparent"
|
|
42
|
+
},
|
|
43
|
+
item.disabled && styles.cellDisabled
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
iconNode,
|
|
47
|
+
item.label ? /* @__PURE__ */ React.createElement(
|
|
48
|
+
Text,
|
|
49
|
+
{
|
|
50
|
+
style: [styles.label, { color: selected ? colors.primary : colors.foreground }],
|
|
51
|
+
numberOfLines: 1,
|
|
52
|
+
allowFontScaling: true
|
|
53
|
+
},
|
|
54
|
+
item.label
|
|
55
|
+
) : null
|
|
56
|
+
));
|
|
57
|
+
}
|
|
58
|
+
function SelectableGrid({
|
|
59
|
+
items,
|
|
60
|
+
value,
|
|
61
|
+
onChange,
|
|
62
|
+
multiple = false,
|
|
63
|
+
numColumns = 4,
|
|
64
|
+
gap = 12,
|
|
65
|
+
orientation = "grid",
|
|
66
|
+
style
|
|
67
|
+
}) {
|
|
68
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
69
|
+
const gapPx = s(gap);
|
|
70
|
+
const cellWidth = containerWidth > 0 ? (containerWidth - gapPx * (numColumns - 1)) / numColumns - 0.5 : 0;
|
|
71
|
+
const horizCellWidth = s(72);
|
|
72
|
+
const handlePress = (item) => {
|
|
73
|
+
if (item.disabled) return;
|
|
74
|
+
selectionAsync();
|
|
75
|
+
onChange(item.value);
|
|
76
|
+
};
|
|
77
|
+
if (orientation === "horizontal") {
|
|
78
|
+
return /* @__PURE__ */ React.createElement(
|
|
79
|
+
ScrollView,
|
|
80
|
+
{
|
|
81
|
+
horizontal: true,
|
|
82
|
+
showsHorizontalScrollIndicator: false,
|
|
83
|
+
contentContainerStyle: [styles.horizontal, { gap: gapPx }, style],
|
|
84
|
+
accessibilityRole: multiple ? void 0 : "radiogroup"
|
|
85
|
+
},
|
|
86
|
+
items.map((item) => /* @__PURE__ */ React.createElement(
|
|
87
|
+
Cell,
|
|
88
|
+
{
|
|
89
|
+
key: String(item.value),
|
|
90
|
+
item,
|
|
91
|
+
selected: isSelected(value, item.value),
|
|
92
|
+
width: horizCellWidth,
|
|
93
|
+
onPress: () => handlePress(item)
|
|
94
|
+
}
|
|
95
|
+
))
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
return /* @__PURE__ */ React.createElement(
|
|
99
|
+
View,
|
|
100
|
+
{
|
|
101
|
+
style: [styles.grid, { gap: gapPx }, style],
|
|
102
|
+
onLayout: (e) => setContainerWidth(e.nativeEvent.layout.width),
|
|
103
|
+
accessibilityRole: multiple ? void 0 : "radiogroup"
|
|
104
|
+
},
|
|
105
|
+
cellWidth > 0 ? items.map((item) => /* @__PURE__ */ React.createElement(
|
|
106
|
+
Cell,
|
|
107
|
+
{
|
|
108
|
+
key: String(item.value),
|
|
109
|
+
item,
|
|
110
|
+
selected: isSelected(value, item.value),
|
|
111
|
+
width: cellWidth,
|
|
112
|
+
onPress: () => handlePress(item)
|
|
113
|
+
}
|
|
114
|
+
)) : null
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
var styles = StyleSheet.create({
|
|
118
|
+
grid: {
|
|
119
|
+
flexDirection: "row",
|
|
120
|
+
flexWrap: "wrap"
|
|
121
|
+
},
|
|
122
|
+
horizontal: {
|
|
123
|
+
flexDirection: "row",
|
|
124
|
+
paddingHorizontal: s(4)
|
|
125
|
+
},
|
|
126
|
+
cell: {
|
|
127
|
+
flex: 1,
|
|
128
|
+
borderRadius: RADIUS.md,
|
|
129
|
+
borderWidth: 2,
|
|
130
|
+
alignItems: "center",
|
|
131
|
+
justifyContent: "center",
|
|
132
|
+
gap: vs(4),
|
|
133
|
+
paddingHorizontal: s(12),
|
|
134
|
+
paddingVertical: vs(12)
|
|
135
|
+
},
|
|
136
|
+
cellDisabled: {
|
|
137
|
+
opacity: 0.4
|
|
138
|
+
},
|
|
139
|
+
label: {
|
|
140
|
+
fontFamily: "Sohne-Medium",
|
|
141
|
+
fontSize: ms(12),
|
|
142
|
+
lineHeight: mvs(15),
|
|
143
|
+
textAlign: "center"
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
export { SelectableGrid };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { FlatList } from 'react-native';
|
|
3
|
+
|
|
4
|
+
// src/components/VirtualList/VirtualList.tsx
|
|
5
|
+
var defaultKeyExtractor = (item, index) => {
|
|
6
|
+
const id = item?.id;
|
|
7
|
+
return id !== void 0 ? String(id) : String(index);
|
|
8
|
+
};
|
|
9
|
+
function VirtualListInner({ itemHeight, keyExtractor, renderItem, ...props }, ref) {
|
|
10
|
+
const getItemLayout = useCallback(
|
|
11
|
+
(_data, index) => ({
|
|
12
|
+
length: itemHeight ?? 0,
|
|
13
|
+
offset: (itemHeight ?? 0) * index,
|
|
14
|
+
index
|
|
15
|
+
}),
|
|
16
|
+
[itemHeight]
|
|
17
|
+
);
|
|
18
|
+
return /* @__PURE__ */ React.createElement(
|
|
19
|
+
FlatList,
|
|
20
|
+
{
|
|
21
|
+
ref,
|
|
22
|
+
keyExtractor: keyExtractor ?? defaultKeyExtractor,
|
|
23
|
+
renderItem,
|
|
24
|
+
getItemLayout: itemHeight !== void 0 ? getItemLayout : void 0,
|
|
25
|
+
removeClippedSubviews: true,
|
|
26
|
+
...props
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
var VirtualList = React.forwardRef(VirtualListInner);
|
|
31
|
+
|
|
32
|
+
export { VirtualList };
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { selectionAsync } from './chunk-EJ7ZPXOH.mjs';
|
|
2
|
+
import { EASINGS, TIMINGS } from './chunk-DVK4G2GT.mjs';
|
|
3
|
+
import { renderIcon } from './chunk-T7XZ7H7Y.mjs';
|
|
4
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
5
|
+
import { ms, vs, s } from './chunk-2CE3TQVY.mjs';
|
|
6
|
+
import React, { useState } from 'react';
|
|
7
|
+
import { StyleSheet, View, Pressable, Text } from 'react-native';
|
|
8
|
+
import Animated, { useSharedValue, useDerivedValue, withTiming, useAnimatedStyle } from 'react-native-reanimated';
|
|
9
|
+
import { Entypo } from '@expo/vector-icons';
|
|
10
|
+
|
|
11
|
+
function AccordionItemComponent({
|
|
12
|
+
item,
|
|
13
|
+
isOpen,
|
|
14
|
+
onToggle
|
|
15
|
+
}) {
|
|
16
|
+
const { colors } = useTheme();
|
|
17
|
+
const resolvedIcon = item.iconName ? renderIcon(item.iconName, ms(16), item.iconColor ?? colors.foregroundMuted) : item.icon;
|
|
18
|
+
const isExpanded = useSharedValue(isOpen);
|
|
19
|
+
const height = useSharedValue(0);
|
|
20
|
+
React.useEffect(() => {
|
|
21
|
+
isExpanded.value = isOpen;
|
|
22
|
+
}, [isOpen, isExpanded]);
|
|
23
|
+
const derivedHeight = useDerivedValue(
|
|
24
|
+
() => withTiming(height.value * Number(isExpanded.value), {
|
|
25
|
+
duration: isExpanded.value ? TIMINGS.expand.duration : TIMINGS.collapse.duration,
|
|
26
|
+
easing: isExpanded.value ? EASINGS.expand : EASINGS.collapse
|
|
27
|
+
})
|
|
28
|
+
);
|
|
29
|
+
const derivedRotation = useDerivedValue(
|
|
30
|
+
() => withTiming(isExpanded.value ? 1 : 0, {
|
|
31
|
+
duration: isExpanded.value ? TIMINGS.expand.duration : TIMINGS.collapse.duration,
|
|
32
|
+
easing: isExpanded.value ? EASINGS.expand : EASINGS.collapse
|
|
33
|
+
})
|
|
34
|
+
);
|
|
35
|
+
const bodyStyle = useAnimatedStyle(() => ({
|
|
36
|
+
height: derivedHeight.value,
|
|
37
|
+
overflow: "hidden"
|
|
38
|
+
}));
|
|
39
|
+
const rotationStyle = useAnimatedStyle(() => ({
|
|
40
|
+
transform: [{ rotate: `${derivedRotation.value * 180}deg` }]
|
|
41
|
+
}));
|
|
42
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.item, { backgroundColor: colors.card, borderColor: colors.border }] }, /* @__PURE__ */ React.createElement(
|
|
43
|
+
Pressable,
|
|
44
|
+
{
|
|
45
|
+
style: ({ pressed }) => [styles.trigger, { opacity: pressed ? 0.6 : 1 }],
|
|
46
|
+
onPress: () => {
|
|
47
|
+
selectionAsync();
|
|
48
|
+
onToggle();
|
|
49
|
+
},
|
|
50
|
+
accessibilityRole: "button",
|
|
51
|
+
accessibilityState: { expanded: isOpen },
|
|
52
|
+
accessibilityLabel: item.trigger
|
|
53
|
+
},
|
|
54
|
+
/* @__PURE__ */ React.createElement(View, { style: styles.triggerContent }, resolvedIcon ? /* @__PURE__ */ React.createElement(View, { style: styles.icon }, resolvedIcon) : null, /* @__PURE__ */ React.createElement(Text, { style: [styles.triggerText, { color: colors.foreground }], allowFontScaling: true }, item.trigger)),
|
|
55
|
+
/* @__PURE__ */ React.createElement(Animated.View, { style: [styles.chevron, rotationStyle] }, /* @__PURE__ */ React.createElement(Entypo, { name: "chevron-down", size: 18, color: colors.foregroundMuted }))
|
|
56
|
+
), /* @__PURE__ */ React.createElement(Animated.View, { style: bodyStyle }, /* @__PURE__ */ React.createElement(
|
|
57
|
+
View,
|
|
58
|
+
{
|
|
59
|
+
style: styles.content,
|
|
60
|
+
onLayout: (e) => {
|
|
61
|
+
height.value = e.nativeEvent.layout.height;
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
typeof item.content === "string" || typeof item.content === "number" ? /* @__PURE__ */ React.createElement(Text, { style: [styles.contentText, { color: colors.foregroundMuted }], allowFontScaling: true }, item.content) : item.content
|
|
65
|
+
)));
|
|
66
|
+
}
|
|
67
|
+
function Accordion({ items, type = "single", defaultValue, style }) {
|
|
68
|
+
const [openValues, setOpenValues] = useState(() => {
|
|
69
|
+
if (!defaultValue) return [];
|
|
70
|
+
return Array.isArray(defaultValue) ? defaultValue : [defaultValue];
|
|
71
|
+
});
|
|
72
|
+
const toggle = (value) => {
|
|
73
|
+
if (type === "single") {
|
|
74
|
+
setOpenValues((prev) => prev.includes(value) ? [] : [value]);
|
|
75
|
+
} else {
|
|
76
|
+
setOpenValues(
|
|
77
|
+
(prev) => prev.includes(value) ? prev.filter((v) => v !== value) : [...prev, value]
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.list, style] }, items.map((item) => /* @__PURE__ */ React.createElement(
|
|
82
|
+
AccordionItemComponent,
|
|
83
|
+
{
|
|
84
|
+
key: item.value,
|
|
85
|
+
item,
|
|
86
|
+
isOpen: openValues.includes(item.value),
|
|
87
|
+
onToggle: () => toggle(item.value)
|
|
88
|
+
}
|
|
89
|
+
)));
|
|
90
|
+
}
|
|
91
|
+
var styles = StyleSheet.create({
|
|
92
|
+
list: {
|
|
93
|
+
gap: s(6)
|
|
94
|
+
},
|
|
95
|
+
item: {
|
|
96
|
+
borderWidth: 1,
|
|
97
|
+
borderRadius: ms(10),
|
|
98
|
+
overflow: "hidden"
|
|
99
|
+
},
|
|
100
|
+
trigger: {
|
|
101
|
+
flexDirection: "row",
|
|
102
|
+
justifyContent: "space-between",
|
|
103
|
+
alignItems: "center",
|
|
104
|
+
paddingHorizontal: s(14),
|
|
105
|
+
paddingVertical: vs(12)
|
|
106
|
+
},
|
|
107
|
+
triggerContent: {
|
|
108
|
+
flexDirection: "row",
|
|
109
|
+
alignItems: "center",
|
|
110
|
+
gap: s(8),
|
|
111
|
+
flex: 1
|
|
112
|
+
},
|
|
113
|
+
icon: {
|
|
114
|
+
alignItems: "center",
|
|
115
|
+
justifyContent: "center"
|
|
116
|
+
},
|
|
117
|
+
triggerText: {
|
|
118
|
+
fontFamily: "Sohne-Medium",
|
|
119
|
+
fontSize: ms(14)
|
|
120
|
+
},
|
|
121
|
+
chevron: {
|
|
122
|
+
marginLeft: s(8)
|
|
123
|
+
},
|
|
124
|
+
// position:'absolute' is the key — the inner View escapes the animated wrapper's
|
|
125
|
+
// clipped height so onLayout always reports the true content height.
|
|
126
|
+
content: {
|
|
127
|
+
paddingHorizontal: s(8),
|
|
128
|
+
paddingBottom: vs(12),
|
|
129
|
+
position: "absolute",
|
|
130
|
+
width: "100%"
|
|
131
|
+
},
|
|
132
|
+
contentText: {
|
|
133
|
+
fontFamily: "Sohne-Regular",
|
|
134
|
+
fontSize: ms(14),
|
|
135
|
+
lineHeight: ms(20)
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export { Accordion };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { SPRINGS } from './chunk-DVK4G2GT.mjs';
|
|
2
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
3
|
+
import { vs } from './chunk-2CE3TQVY.mjs';
|
|
4
|
+
import React, { useState, useEffect } from 'react';
|
|
5
|
+
import { StyleSheet, View } from 'react-native';
|
|
6
|
+
import Animated, { useSharedValue, withSpring, useAnimatedStyle } from 'react-native-reanimated';
|
|
7
|
+
|
|
8
|
+
function Progress({ value = 0, max = 100, variant = "default", style, accessibilityLabel }) {
|
|
9
|
+
const { colors } = useTheme();
|
|
10
|
+
const percent = Math.min(Math.max(value / max * 100, 0), 100);
|
|
11
|
+
const [trackWidth, setTrackWidth] = useState(0);
|
|
12
|
+
const animatedWidth = useSharedValue(0);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (trackWidth === 0) return;
|
|
15
|
+
animatedWidth.value = withSpring(percent / 100 * trackWidth, SPRINGS.glide);
|
|
16
|
+
}, [percent, trackWidth, animatedWidth]);
|
|
17
|
+
const indicatorAnimatedStyle = useAnimatedStyle(() => ({
|
|
18
|
+
width: animatedWidth.value
|
|
19
|
+
}));
|
|
20
|
+
const indicatorColor = variant === "success" ? colors.success : variant === "warning" ? colors.warning : variant === "destructive" ? colors.destructive : colors.primary;
|
|
21
|
+
return /* @__PURE__ */ React.createElement(
|
|
22
|
+
View,
|
|
23
|
+
{
|
|
24
|
+
style: [styles.track, { backgroundColor: colors.surface }, style],
|
|
25
|
+
onLayout: (e) => setTrackWidth(e.nativeEvent.layout.width),
|
|
26
|
+
accessibilityRole: "progressbar",
|
|
27
|
+
accessibilityLabel,
|
|
28
|
+
accessibilityValue: { min: 0, max: 100, now: Math.round(percent) }
|
|
29
|
+
},
|
|
30
|
+
/* @__PURE__ */ React.createElement(
|
|
31
|
+
Animated.View,
|
|
32
|
+
{
|
|
33
|
+
style: [styles.indicator, { backgroundColor: indicatorColor }, indicatorAnimatedStyle]
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
var styles = StyleSheet.create({
|
|
39
|
+
track: {
|
|
40
|
+
height: vs(8),
|
|
41
|
+
borderRadius: 9999,
|
|
42
|
+
overflow: "hidden",
|
|
43
|
+
width: "100%"
|
|
44
|
+
},
|
|
45
|
+
indicator: {
|
|
46
|
+
height: "100%",
|
|
47
|
+
borderRadius: 9999
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export { Progress };
|