@retray-dev/ui-kit 7.0.1 → 9.1.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 +567 -14
- package/EXAMPLES.md +21 -14
- package/README.md +14 -8
- package/dist/Accordion.js +57 -5
- package/dist/Accordion.mjs +4 -3
- package/dist/AlertBanner.js +4 -1
- package/dist/AlertBanner.mjs +3 -2
- 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.js +39 -29
- package/dist/Avatar.mjs +2 -1
- package/dist/Badge.js +11 -1
- package/dist/Badge.mjs +2 -1
- package/dist/Button.d.mts +8 -3
- package/dist/Button.d.ts +8 -3
- package/dist/Button.js +126 -108
- package/dist/Button.mjs +6 -5
- package/dist/ButtonGroup.mjs +1 -0
- package/dist/Card.js +90 -70
- package/dist/Card.mjs +5 -4
- package/dist/CategoryStrip.js +79 -22
- package/dist/CategoryStrip.mjs +6 -6
- package/dist/Checkbox.js +118 -86
- package/dist/Checkbox.mjs +5 -5
- package/dist/Chip.js +113 -80
- package/dist/Chip.mjs +5 -5
- package/dist/ConfirmDialog.js +140 -110
- package/dist/ConfirmDialog.mjs +7 -6
- package/dist/CurrencyDisplay.mjs +1 -0
- package/dist/CurrencyInput.d.mts +1 -1
- package/dist/CurrencyInput.d.ts +1 -1
- package/dist/CurrencyInput.js +9 -5
- package/dist/CurrencyInput.mjs +5 -4
- package/dist/DetailRow.mjs +1 -0
- package/dist/EmptyState.js +131 -111
- package/dist/EmptyState.mjs +7 -6
- 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.mjs +1 -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 +8 -3
- package/dist/IconButton.d.ts +8 -3
- package/dist/IconButton.js +115 -98
- package/dist/IconButton.mjs +5 -4
- 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.mjs +4 -3
- package/dist/LabelValue.mjs +1 -0
- package/dist/ListGroup.mjs +1 -0
- package/dist/ListItem.js +131 -117
- package/dist/ListItem.mjs +6 -5
- package/dist/MediaCard.js +54 -6
- package/dist/MediaCard.mjs +6 -5
- package/dist/MenuGroup.mjs +1 -0
- package/dist/MenuItem.js +91 -79
- package/dist/MenuItem.mjs +6 -5
- package/dist/MonthPicker.d.mts +10 -2
- package/dist/MonthPicker.d.ts +10 -2
- package/dist/MonthPicker.js +80 -17
- package/dist/MonthPicker.mjs +3 -2
- 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 +5 -5
- package/dist/Pressable.d.ts +5 -5
- package/dist/Pressable.js +97 -86
- package/dist/Pressable.mjs +5 -4
- 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.mjs +3 -2
- package/dist/RadioGroup.js +81 -30
- package/dist/RadioGroup.mjs +5 -5
- 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.js +51 -4
- package/dist/Select.mjs +5 -4
- 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.mjs +1 -0
- package/dist/Sheet.d.mts +13 -1
- package/dist/Sheet.d.ts +13 -1
- package/dist/Sheet.js +115 -5
- package/dist/Sheet.mjs +4 -2
- package/dist/Skeleton.d.mts +50 -0
- package/dist/Skeleton.d.ts +50 -0
- package/dist/Skeleton.js +61 -0
- package/dist/Skeleton.mjs +4 -2
- package/dist/Slider.js +51 -4
- package/dist/Slider.mjs +3 -2
- package/dist/Spinner.js +28 -7
- package/dist/Spinner.mjs +2 -1
- package/dist/Switch.js +98 -48
- package/dist/Switch.mjs +4 -3
- 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.js +92 -62
- package/dist/Tabs.mjs +5 -4
- package/dist/Text.js +16 -0
- package/dist/Text.mjs +2 -1
- package/dist/Textarea.mjs +4 -3
- package/dist/Toast.d.mts +7 -7
- package/dist/Toast.d.ts +7 -7
- package/dist/Toast.mjs +1 -0
- package/dist/Toggle.d.mts +6 -3
- package/dist/Toggle.d.ts +6 -3
- package/dist/Toggle.js +135 -120
- package/dist/Toggle.mjs +5 -5
- package/dist/VirtualList.mjs +1 -0
- package/dist/{chunk-7H2OR44A.mjs → chunk-26BCI223.mjs} +1 -1
- package/dist/{chunk-CRYBX2CM.mjs → chunk-2TFTAWVJ.mjs} +44 -59
- package/dist/chunk-3DKJ2GIC.mjs +30 -0
- package/dist/{chunk-KWCPOM6W.mjs → chunk-3U4SSNWP.mjs} +32 -48
- package/dist/chunk-4I7D47FH.mjs +139 -0
- package/dist/chunk-4K625MVM.mjs +142 -0
- package/dist/{chunk-MN7OG7IY.mjs → chunk-6OAZJ577.mjs} +6 -4
- package/dist/{chunk-L7E7TVEZ.mjs → chunk-756RAKE4.mjs} +2 -2
- package/dist/{chunk-HSPSMN6U.mjs → chunk-7QHVVCB3.mjs} +2 -2
- package/dist/{chunk-URLL5JBR.mjs → chunk-A3A6KNQN.mjs} +3 -3
- package/dist/chunk-AJ7ZDNBT.mjs +120 -0
- package/dist/{chunk-FTLJOUOQ.mjs → chunk-AV4EMIRH.mjs} +25 -28
- package/dist/chunk-AZJF2BLK.mjs +115 -0
- package/dist/chunk-BNP626TY.mjs +159 -0
- package/dist/{chunk-5IKW3VNC.mjs → chunk-DVK4G2GT.mjs} +17 -1
- package/dist/{chunk-6LQYY7HC.mjs → chunk-EH745HE5.mjs} +2 -2
- package/dist/chunk-EJ7ZPXOH.mjs +163 -0
- package/dist/{chunk-RKLHUDZS.mjs → chunk-GD6KXMG5.mjs} +29 -15
- package/dist/{chunk-RR2VQLKE.mjs → chunk-GQYFLP3D.mjs} +14 -17
- package/dist/{chunk-Y6MXOREN.mjs → chunk-ID72TK46.mjs} +8 -17
- package/dist/{chunk-NQGVLMWG.mjs → chunk-JMOZEC77.mjs} +1 -1
- package/dist/{chunk-GCWOGZYL.mjs → chunk-JT7HKXRB.mjs} +39 -29
- package/dist/{chunk-LWG526VX.mjs → chunk-KIHCWCWL.mjs} +47 -62
- package/dist/chunk-LXJIIOYQ.mjs +104 -0
- package/dist/{chunk-SBZYEV4S.mjs → chunk-M6ZXVBTK.mjs} +5 -2
- package/dist/{chunk-XDMN67KV.mjs → chunk-MAC465BB.mjs} +10 -8
- package/dist/chunk-MBMXYJJV.mjs +36 -0
- package/dist/chunk-MLF3EZFW.mjs +119 -0
- package/dist/chunk-NA7PARID.mjs +147 -0
- package/dist/{chunk-QXGYKWI7.mjs → chunk-O3HA6TYM.mjs} +9 -4
- package/dist/{chunk-63357L2X.mjs → chunk-OB4JUQ3O.mjs} +1 -1
- package/dist/{chunk-AU2VDY4P.mjs → chunk-PFZTM6D5.mjs} +52 -4
- package/dist/chunk-QKH5ZOD5.mjs +97 -0
- package/dist/{chunk-KZJRQOIU.mjs → chunk-TERDKCLE.mjs} +11 -1
- package/dist/{chunk-U4N7WF4Z.mjs → chunk-UREA2GYY.mjs} +28 -23
- package/dist/{chunk-TAJ2PQ2O.mjs → chunk-VGTDN7SW.mjs} +7 -6
- package/dist/{chunk-URDE3EUU.mjs → chunk-VQ57HWPL.mjs} +27 -15
- package/dist/chunk-WBOOUHSS.mjs +62 -0
- package/dist/{chunk-GNGLDL6Z.mjs → chunk-WJLKJMKR.mjs} +18 -0
- package/dist/{chunk-YZJAFS4P.mjs → chunk-X4G6APW6.mjs} +22 -19
- package/dist/chunk-Y6FXYEAI.mjs +8 -0
- package/dist/chunk-YFZ3ELX5.mjs +16 -0
- package/dist/{chunk-QCNARS3X.mjs → chunk-YNROWHQJ.mjs} +1 -1
- package/dist/chunk-Z4BVUWW6.mjs +196 -0
- package/dist/{chunk-GPOUINK5.mjs → chunk-ZJKGQMYH.mjs} +10 -27
- package/dist/index-wt-orHUi.d.mts +85 -0
- package/dist/index-wt-orHUi.d.ts +85 -0
- package/dist/index.d.mts +59 -51
- package/dist/index.d.ts +59 -51
- package/dist/index.js +1940 -744
- package/dist/index.mjs +49 -39
- package/package.json +35 -5
- package/src/components/Accordion/Accordion.tsx +12 -1
- package/src/components/AlertBanner/AlertBanner.tsx +5 -0
- package/src/components/AppHeader/AppHeader.tsx +172 -0
- package/src/components/AppHeader/index.ts +1 -0
- package/src/components/Avatar/Avatar.tsx +10 -2
- package/src/components/Badge/Badge.tsx +8 -1
- package/src/components/Button/Button.tsx +20 -27
- package/src/components/Card/Card.tsx +12 -23
- package/src/components/CategoryStrip/CategoryStrip.tsx +17 -21
- package/src/components/Checkbox/Checkbox.tsx +26 -40
- package/src/components/Chip/Chip.tsx +24 -33
- package/src/components/CurrencyInput/CurrencyInput.tsx +10 -8
- package/src/components/EmptyState/EmptyState.tsx +2 -1
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +153 -0
- package/src/components/ErrorBoundary/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 +19 -27
- package/src/components/ImageViewer/ImageViewer.tsx +290 -0
- package/src/components/ImageViewer/index.ts +1 -0
- package/src/components/ListItem/ListItem.tsx +70 -67
- package/src/components/MediaCard/MediaCard.tsx +8 -2
- package/src/components/MenuItem/MenuItem.tsx +10 -25
- package/src/components/MonthPicker/MonthPicker.tsx +39 -13
- 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 +14 -27
- package/src/components/RetrayProvider/RetrayProvider.tsx +59 -0
- package/src/components/RetrayProvider/index.ts +1 -0
- package/src/components/SelectableGrid/SelectableGrid.tsx +205 -0
- package/src/components/SelectableGrid/index.ts +1 -0
- package/src/components/Sheet/Sheet.tsx +65 -1
- package/src/components/Skeleton/Skeleton.tsx +142 -1
- package/src/components/Spinner/Spinner.tsx +17 -2
- package/src/components/Switch/Switch.tsx +30 -58
- package/src/components/TabBar/TabBar.tsx +169 -0
- package/src/components/TabBar/index.ts +1 -0
- package/src/components/Tabs/Tabs.tsx +23 -26
- package/src/components/Text/Text.tsx +2 -0
- package/src/components/Toggle/Toggle.tsx +35 -51
- package/src/fonts.ts +4 -1
- package/src/index.ts +23 -2
- package/src/utils/animations.ts +29 -1
- package/src/utils/fontGuard.ts +34 -0
- package/src/utils/haptics.ts +211 -9
- package/src/utils/pressable.ts +66 -0
- package/dist/chunk-76PFOSM2.mjs +0 -41
- package/dist/chunk-DITNP6PL.mjs +0 -106
- package/dist/chunk-JBLL7U3U.mjs +0 -64
- package/dist/chunk-LG4DO3DK.mjs +0 -174
- package/dist/chunk-RMMK64W5.mjs +0 -54
- package/dist/chunk-RTC3CFXF.mjs +0 -29
|
@@ -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 };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { selectionAsync } from './chunk-EJ7ZPXOH.mjs';
|
|
2
|
+
import { EASINGS, TIMINGS } from './chunk-DVK4G2GT.mjs';
|
|
1
3
|
import { renderIcon } from './chunk-T7XZ7H7Y.mjs';
|
|
2
|
-
import { selectionAsync } from './chunk-RTC3CFXF.mjs';
|
|
3
|
-
import { EASINGS, TIMINGS } from './chunk-5IKW3VNC.mjs';
|
|
4
4
|
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
5
|
-
import { vs, s
|
|
5
|
+
import { ms, vs, s } from './chunk-2CE3TQVY.mjs';
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
7
|
import { StyleSheet, View, Pressable, Text } from 'react-native';
|
|
8
8
|
import Animated, { useSharedValue, useDerivedValue, withTiming, useAnimatedStyle } from 'react-native-reanimated';
|
|
@@ -61,7 +61,7 @@ function AccordionItemComponent({
|
|
|
61
61
|
height.value = e.nativeEvent.layout.height;
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
|
-
item.content
|
|
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
65
|
)));
|
|
66
66
|
}
|
|
67
67
|
function Accordion({ items, type = "single", defaultValue, style }) {
|
|
@@ -128,6 +128,11 @@ var styles = StyleSheet.create({
|
|
|
128
128
|
paddingBottom: vs(12),
|
|
129
129
|
position: "absolute",
|
|
130
130
|
width: "100%"
|
|
131
|
+
},
|
|
132
|
+
contentText: {
|
|
133
|
+
fontFamily: "Sohne-Regular",
|
|
134
|
+
fontSize: ms(14),
|
|
135
|
+
lineHeight: ms(20)
|
|
131
136
|
}
|
|
132
137
|
});
|
|
133
138
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { impactMedium } from './chunk-
|
|
1
|
+
import { impactMedium } from './chunk-EJ7ZPXOH.mjs';
|
|
2
|
+
import { SHADOWS, RADIUS, BREAKPOINTS } from './chunk-QY3X2UYR.mjs';
|
|
2
3
|
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
3
|
-
import {
|
|
4
|
+
import { vs, s, mvs, ms } from './chunk-2CE3TQVY.mjs';
|
|
4
5
|
import React, { useRef, useEffect, useCallback } from 'react';
|
|
5
|
-
import { Dimensions, Platform, StyleSheet, View, Text, TouchableOpacity } from 'react-native';
|
|
6
|
+
import { Dimensions, Platform, StyleSheet, useWindowDimensions, View, Text, TouchableOpacity, Modal, Pressable, ScrollView } from 'react-native';
|
|
6
7
|
import { BottomSheetBackdrop, BottomSheetFooter, BottomSheetModal, BottomSheetScrollView, BottomSheetView } from '@gorhom/bottom-sheet';
|
|
7
8
|
export { BottomSheetModalProvider, BottomSheetTextInput } from '@gorhom/bottom-sheet';
|
|
8
9
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
@@ -38,11 +39,15 @@ function Sheet({
|
|
|
38
39
|
enableBlurKeyboardOnGesture = true,
|
|
39
40
|
android_keyboardInputMode = "adjustPan",
|
|
40
41
|
footer,
|
|
41
|
-
snapPoints
|
|
42
|
+
snapPoints,
|
|
43
|
+
responsive = false,
|
|
44
|
+
dialogMaxWidth = 480
|
|
42
45
|
}) {
|
|
43
46
|
const { colors } = useTheme();
|
|
44
47
|
const insets = useSafeAreaInsets();
|
|
48
|
+
const { width: windowWidth } = useWindowDimensions();
|
|
45
49
|
const ref = useRef(null);
|
|
50
|
+
const asDialog = responsive && windowWidth >= BREAKPOINTS.wide;
|
|
46
51
|
const effectiveKeyboardBehavior = keyboardBehavior ?? "interactive";
|
|
47
52
|
useEffect(() => {
|
|
48
53
|
if (open) {
|
|
@@ -89,6 +94,31 @@ function Sheet({
|
|
|
89
94
|
if (!effectiveFooter) return null;
|
|
90
95
|
return /* @__PURE__ */ React.createElement(BottomSheetFooter, { ...props }, effectiveFooter);
|
|
91
96
|
}, [effectiveFooter]);
|
|
97
|
+
if (asDialog) {
|
|
98
|
+
return /* @__PURE__ */ React.createElement(Modal, { visible: open, transparent: true, animationType: "fade", onRequestClose: onClose }, /* @__PURE__ */ React.createElement(Pressable, { style: styles.dialogBackdrop, onPress: onClose, accessibilityRole: "button", accessibilityLabel: "Close" }, /* @__PURE__ */ React.createElement(
|
|
99
|
+
Pressable,
|
|
100
|
+
{
|
|
101
|
+
style: [
|
|
102
|
+
styles.dialogCard,
|
|
103
|
+
{ backgroundColor: colors.card, maxWidth: dialogMaxWidth, maxHeight: SCREEN_HEIGHT * 0.85 }
|
|
104
|
+
],
|
|
105
|
+
onPress: () => {
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
headerNode,
|
|
109
|
+
/* @__PURE__ */ React.createElement(
|
|
110
|
+
ScrollView,
|
|
111
|
+
{
|
|
112
|
+
contentContainerStyle: [styles.dialogContent, style],
|
|
113
|
+
style: contentStyle,
|
|
114
|
+
showsVerticalScrollIndicator: true,
|
|
115
|
+
bounces: false
|
|
116
|
+
},
|
|
117
|
+
contentNode
|
|
118
|
+
),
|
|
119
|
+
effectiveFooter
|
|
120
|
+
)));
|
|
121
|
+
}
|
|
92
122
|
const useScroll = scrollable || !!maxHeight;
|
|
93
123
|
const effectiveMaxHeight = maxHeight ?? DEFAULT_MAX_HEIGHT;
|
|
94
124
|
const useDynamicSizing = !snapPoints;
|
|
@@ -184,6 +214,24 @@ var styles = StyleSheet.create({
|
|
|
184
214
|
borderTopWidth: 1,
|
|
185
215
|
flexDirection: "row",
|
|
186
216
|
gap: s(12)
|
|
217
|
+
},
|
|
218
|
+
dialogBackdrop: {
|
|
219
|
+
flex: 1,
|
|
220
|
+
backgroundColor: "rgba(0,0,0,0.5)",
|
|
221
|
+
alignItems: "center",
|
|
222
|
+
justifyContent: "center",
|
|
223
|
+
padding: s(24)
|
|
224
|
+
},
|
|
225
|
+
dialogCard: {
|
|
226
|
+
width: "100%",
|
|
227
|
+
borderRadius: RADIUS.lg,
|
|
228
|
+
paddingTop: vs(16),
|
|
229
|
+
overflow: "hidden",
|
|
230
|
+
...SHADOWS.xl
|
|
231
|
+
},
|
|
232
|
+
dialogContent: {
|
|
233
|
+
paddingHorizontal: s(16),
|
|
234
|
+
paddingBottom: vs(16)
|
|
187
235
|
}
|
|
188
236
|
});
|
|
189
237
|
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { selectionAsync } from './chunk-EJ7ZPXOH.mjs';
|
|
2
|
+
import { COLOR_TRANSITION, SPRING_ELASTIC, OPACITY_TRANSITION } from './chunk-DVK4G2GT.mjs';
|
|
3
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
4
|
+
import { s } from './chunk-2CE3TQVY.mjs';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { StyleSheet, View, TouchableOpacity } from 'react-native';
|
|
7
|
+
import { EaseView } from 'react-native-ease';
|
|
8
|
+
import { Feather } from '@expo/vector-icons';
|
|
9
|
+
|
|
10
|
+
var TRACK_WIDTH = s(52);
|
|
11
|
+
var TRACK_HEIGHT = s(30);
|
|
12
|
+
var THUMB_SIZE = s(24);
|
|
13
|
+
var THUMB_OFFSET = s(3);
|
|
14
|
+
var THUMB_TRAVEL = TRACK_WIDTH - THUMB_SIZE - THUMB_OFFSET * 2;
|
|
15
|
+
var ICON_SIZE = s(13);
|
|
16
|
+
function Switch({ checked = false, onCheckedChange, disabled, style, accessibilityLabel }) {
|
|
17
|
+
const { colors } = useTheme();
|
|
18
|
+
return /* @__PURE__ */ React.createElement(View, { style: [{ opacity: disabled ? 0.45 : 1, alignSelf: "flex-start" }, style] }, /* @__PURE__ */ React.createElement(
|
|
19
|
+
TouchableOpacity,
|
|
20
|
+
{
|
|
21
|
+
onPress: () => {
|
|
22
|
+
selectionAsync();
|
|
23
|
+
onCheckedChange?.(!checked);
|
|
24
|
+
},
|
|
25
|
+
disabled,
|
|
26
|
+
activeOpacity: 0.8,
|
|
27
|
+
touchSoundDisabled: true,
|
|
28
|
+
accessibilityRole: "switch",
|
|
29
|
+
accessibilityLabel,
|
|
30
|
+
accessibilityState: { checked, disabled: !!disabled },
|
|
31
|
+
style: styles.touchable
|
|
32
|
+
},
|
|
33
|
+
/* @__PURE__ */ React.createElement(
|
|
34
|
+
EaseView,
|
|
35
|
+
{
|
|
36
|
+
style: styles.track,
|
|
37
|
+
animate: { backgroundColor: checked ? colors.primary : colors.surfaceStrong },
|
|
38
|
+
transition: COLOR_TRANSITION
|
|
39
|
+
},
|
|
40
|
+
/* @__PURE__ */ React.createElement(
|
|
41
|
+
EaseView,
|
|
42
|
+
{
|
|
43
|
+
style: [styles.trackBorder, { borderWidth: 1.5 }],
|
|
44
|
+
pointerEvents: "none",
|
|
45
|
+
animate: { borderColor: checked ? "transparent" : colors.border },
|
|
46
|
+
transition: COLOR_TRANSITION
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
/* @__PURE__ */ React.createElement(
|
|
50
|
+
EaseView,
|
|
51
|
+
{
|
|
52
|
+
style: [styles.thumb, { backgroundColor: colors.primaryForeground }],
|
|
53
|
+
animate: { translateX: checked ? THUMB_TRAVEL : 0 },
|
|
54
|
+
transition: SPRING_ELASTIC
|
|
55
|
+
},
|
|
56
|
+
/* @__PURE__ */ React.createElement(EaseView, { style: styles.iconWrapper, animate: { opacity: checked ? 1 : 0 }, transition: OPACITY_TRANSITION }, /* @__PURE__ */ React.createElement(Feather, { name: "check", size: ICON_SIZE, color: colors.primary })),
|
|
57
|
+
/* @__PURE__ */ React.createElement(EaseView, { style: styles.iconWrapper, animate: { opacity: checked ? 0 : 1 }, transition: OPACITY_TRANSITION }, /* @__PURE__ */ React.createElement(Feather, { name: "x", size: ICON_SIZE, color: colors.foregroundMuted }))
|
|
58
|
+
)
|
|
59
|
+
)
|
|
60
|
+
));
|
|
61
|
+
}
|
|
62
|
+
var styles = StyleSheet.create({
|
|
63
|
+
touchable: {
|
|
64
|
+
alignSelf: "flex-start"
|
|
65
|
+
},
|
|
66
|
+
track: {
|
|
67
|
+
width: TRACK_WIDTH,
|
|
68
|
+
height: TRACK_HEIGHT,
|
|
69
|
+
borderRadius: TRACK_HEIGHT / 2
|
|
70
|
+
},
|
|
71
|
+
trackBorder: {
|
|
72
|
+
...StyleSheet.absoluteFillObject,
|
|
73
|
+
borderRadius: TRACK_HEIGHT / 2
|
|
74
|
+
},
|
|
75
|
+
thumb: {
|
|
76
|
+
position: "absolute",
|
|
77
|
+
top: THUMB_OFFSET,
|
|
78
|
+
left: THUMB_OFFSET,
|
|
79
|
+
width: THUMB_SIZE,
|
|
80
|
+
height: THUMB_SIZE,
|
|
81
|
+
borderRadius: THUMB_SIZE / 2,
|
|
82
|
+
shadowColor: "#000",
|
|
83
|
+
shadowOffset: { width: 0, height: 1 },
|
|
84
|
+
shadowOpacity: 0.15,
|
|
85
|
+
shadowRadius: 2,
|
|
86
|
+
elevation: 2,
|
|
87
|
+
alignItems: "center",
|
|
88
|
+
justifyContent: "center"
|
|
89
|
+
},
|
|
90
|
+
iconWrapper: {
|
|
91
|
+
position: "absolute",
|
|
92
|
+
alignItems: "center",
|
|
93
|
+
justifyContent: "center"
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
export { Switch };
|
|
@@ -46,7 +46,17 @@ function BadgeBase({ label, children, variant = "default", size = "md", icon, ic
|
|
|
46
46
|
}[variant];
|
|
47
47
|
const effectiveIcon = iconName ? renderIcon(iconName, sizeIconSize[size], iconColor ?? textColor) : icon;
|
|
48
48
|
const content = children ?? label;
|
|
49
|
-
|
|
49
|
+
const a11yLabel = typeof content === "string" ? content : label;
|
|
50
|
+
return /* @__PURE__ */ React.createElement(
|
|
51
|
+
View,
|
|
52
|
+
{
|
|
53
|
+
style: [styles.container, containerStyle, sizePadding[size], { gap: sizeIconGap[size] }, style],
|
|
54
|
+
accessibilityRole: "text",
|
|
55
|
+
accessibilityLabel: a11yLabel
|
|
56
|
+
},
|
|
57
|
+
effectiveIcon,
|
|
58
|
+
typeof content === "string" ? /* @__PURE__ */ React.createElement(Text, { style: [styles.label, { color: textColor }, sizeFontSize[size]], allowFontScaling: true }, content) : content
|
|
59
|
+
);
|
|
50
60
|
}
|
|
51
61
|
var Badge = React.memo(BadgeBase);
|
|
52
62
|
var styles = StyleSheet.create({
|
|
@@ -1,45 +1,50 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PressableChip } from './chunk-3DKJ2GIC.mjs';
|
|
2
|
+
import { selectionAsync } from './chunk-EJ7ZPXOH.mjs';
|
|
3
|
+
import { COLOR_TRANSITION } from './chunk-DVK4G2GT.mjs';
|
|
2
4
|
import { renderIcon } from './chunk-T7XZ7H7Y.mjs';
|
|
3
|
-
import { usePressScale } from './chunk-QCNARS3X.mjs';
|
|
4
|
-
import { selectionAsync } from './chunk-RTC3CFXF.mjs';
|
|
5
|
-
import { PRESS_SCALE } from './chunk-5IKW3VNC.mjs';
|
|
6
5
|
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
7
6
|
import { s, mvs, ms, vs } from './chunk-2CE3TQVY.mjs';
|
|
8
7
|
import React from 'react';
|
|
9
|
-
import { StyleSheet,
|
|
10
|
-
import
|
|
8
|
+
import { StyleSheet, View, Text } from 'react-native';
|
|
9
|
+
import { EaseView } from 'react-native-ease';
|
|
11
10
|
|
|
12
11
|
function ChipBase({ label, selected = false, onPress, icon, iconName, style, accessibilityLabel }) {
|
|
13
12
|
const { colors } = useTheme();
|
|
14
|
-
const { animatedStyle: scaleStyle, onPressIn, onPressOut, hoverHandlers } = usePressScale({
|
|
15
|
-
pressScale: PRESS_SCALE.chip
|
|
16
|
-
});
|
|
17
|
-
const colorProgress = useColorTransition(selected);
|
|
18
|
-
const surfaceStyle = useAnimatedStyle(() => ({
|
|
19
|
-
backgroundColor: interpolateColor(colorProgress.value, [0, 1], [colors.surface, colors.primary]),
|
|
20
|
-
borderColor: interpolateColor(colorProgress.value, [0, 1], [colors.border, colors.primary])
|
|
21
|
-
}));
|
|
22
|
-
const textStyle = useAnimatedStyle(() => ({
|
|
23
|
-
color: interpolateColor(colorProgress.value, [0, 1], [colors.foreground, colors.primaryForeground])
|
|
24
|
-
}));
|
|
25
13
|
const handlePress = () => {
|
|
26
14
|
selectionAsync();
|
|
27
15
|
onPress?.();
|
|
28
16
|
};
|
|
29
17
|
const resolvedIcon = iconName ? renderIcon(iconName, ms(13), selected ? colors.primaryForeground : colors.foreground) : icon;
|
|
30
|
-
return /* @__PURE__ */ React.createElement(
|
|
31
|
-
|
|
18
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.wrapper, style] }, /* @__PURE__ */ React.createElement(
|
|
19
|
+
PressableChip,
|
|
32
20
|
{
|
|
33
21
|
onPress: handlePress,
|
|
34
|
-
|
|
35
|
-
onPressOut,
|
|
36
|
-
activeOpacity: 1,
|
|
22
|
+
rippleColor: "transparent",
|
|
37
23
|
touchSoundDisabled: true,
|
|
38
24
|
accessibilityRole: "button",
|
|
39
25
|
accessibilityLabel: accessibilityLabel ?? label,
|
|
40
26
|
accessibilityState: { selected }
|
|
41
27
|
},
|
|
42
|
-
/* @__PURE__ */ React.createElement(
|
|
28
|
+
/* @__PURE__ */ React.createElement(
|
|
29
|
+
EaseView,
|
|
30
|
+
{
|
|
31
|
+
style: styles.chip,
|
|
32
|
+
animate: {
|
|
33
|
+
backgroundColor: selected ? colors.primary : colors.surface,
|
|
34
|
+
borderColor: selected ? colors.primary : colors.border
|
|
35
|
+
},
|
|
36
|
+
transition: COLOR_TRANSITION
|
|
37
|
+
},
|
|
38
|
+
resolvedIcon ? /* @__PURE__ */ React.createElement(View, { style: styles.chipIcon }, resolvedIcon) : null,
|
|
39
|
+
/* @__PURE__ */ React.createElement(
|
|
40
|
+
Text,
|
|
41
|
+
{
|
|
42
|
+
style: [styles.label, { color: selected ? colors.primaryForeground : colors.foreground }],
|
|
43
|
+
allowFontScaling: true
|
|
44
|
+
},
|
|
45
|
+
label
|
|
46
|
+
)
|
|
47
|
+
)
|
|
43
48
|
));
|
|
44
49
|
}
|
|
45
50
|
var Chip = React.memo(ChipBase);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { SPRINGS, PRESS_SCALE } from './chunk-5IKW3VNC.mjs';
|
|
1
|
+
import { useHover, usePressScale } from './chunk-YNROWHQJ.mjs';
|
|
2
|
+
import { impactLight } from './chunk-EJ7ZPXOH.mjs';
|
|
3
|
+
import { SPRINGS, PRESS_SCALE } from './chunk-DVK4G2GT.mjs';
|
|
5
4
|
import { RADIUS, SHADOWS } from './chunk-QY3X2UYR.mjs';
|
|
5
|
+
import { renderIcon } from './chunk-T7XZ7H7Y.mjs';
|
|
6
6
|
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
7
7
|
import { mvs, ms, vs, s } from './chunk-2CE3TQVY.mjs';
|
|
8
8
|
import React from 'react';
|
|
@@ -70,13 +70,14 @@ function MediaCardBase({
|
|
|
70
70
|
TouchableOpacity,
|
|
71
71
|
{
|
|
72
72
|
style: [styles.actionButton, { backgroundColor: "rgba(0,0,0,0.24)" }],
|
|
73
|
-
onPress: () => {
|
|
73
|
+
onPress: (e) => {
|
|
74
|
+
e?.stopPropagation?.();
|
|
74
75
|
impactLight();
|
|
75
76
|
onActionPress?.();
|
|
76
77
|
},
|
|
77
78
|
activeOpacity: 0.8,
|
|
78
79
|
touchSoundDisabled: true,
|
|
79
|
-
accessibilityRole: "button",
|
|
80
|
+
accessibilityRole: Platform.OS === "web" && onPress ? void 0 : "button",
|
|
80
81
|
accessibilityLabel: actionIconName ?? "action",
|
|
81
82
|
accessibilityState: { selected: actionActive }
|
|
82
83
|
},
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { selectionAsync } from './chunk-RTC3CFXF.mjs';
|
|
5
|
-
import { PRESS_SCALE } from './chunk-5IKW3VNC.mjs';
|
|
1
|
+
import { usePressScale } from './chunk-YNROWHQJ.mjs';
|
|
2
|
+
import { selectionAsync } from './chunk-EJ7ZPXOH.mjs';
|
|
3
|
+
import { PRESS_SCALE, COLOR_TRANSITION } from './chunk-DVK4G2GT.mjs';
|
|
6
4
|
import { RADIUS } from './chunk-QY3X2UYR.mjs';
|
|
5
|
+
import { renderIcon } from './chunk-T7XZ7H7Y.mjs';
|
|
7
6
|
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
8
7
|
import { ms, s, vs } from './chunk-2CE3TQVY.mjs';
|
|
9
8
|
import React, { useCallback } from 'react';
|
|
10
9
|
import { TouchableOpacity, View, Text, StyleSheet, ScrollView } from 'react-native';
|
|
11
|
-
import Animated
|
|
10
|
+
import Animated from 'react-native-reanimated';
|
|
11
|
+
import { EaseView } from 'react-native-ease';
|
|
12
12
|
|
|
13
13
|
var CategoryChip = React.memo(function CategoryChip2({
|
|
14
14
|
item,
|
|
@@ -19,14 +19,6 @@ var CategoryChip = React.memo(function CategoryChip2({
|
|
|
19
19
|
const { animatedStyle: scaleStyle, onPressIn, onPressOut, hoverHandlers } = usePressScale({
|
|
20
20
|
pressScale: PRESS_SCALE.chip
|
|
21
21
|
});
|
|
22
|
-
const progress = useColorTransition(selected);
|
|
23
|
-
const surfaceStyle = useAnimatedStyle(() => ({
|
|
24
|
-
backgroundColor: interpolateColor(progress.value, [0, 1], [colors.surface, colors.primary]),
|
|
25
|
-
borderColor: interpolateColor(progress.value, [0, 1], [colors.border, colors.primary])
|
|
26
|
-
}));
|
|
27
|
-
const textColorStyle = useAnimatedStyle(() => ({
|
|
28
|
-
color: interpolateColor(progress.value, [0, 1], [colors.foregroundSubtle, colors.primaryForeground])
|
|
29
|
-
}));
|
|
30
22
|
const iconColor = selected ? colors.primaryForeground : colors.foregroundSubtle;
|
|
31
23
|
const resolvedIcon = typeof item.icon === "string" ? renderIcon(item.icon, 16, iconColor) : item.icon ?? null;
|
|
32
24
|
return /* @__PURE__ */ React.createElement(Animated.View, { style: scaleStyle, ...hoverHandlers }, /* @__PURE__ */ React.createElement(
|
|
@@ -41,7 +33,27 @@ var CategoryChip = React.memo(function CategoryChip2({
|
|
|
41
33
|
accessibilityLabel: item.label,
|
|
42
34
|
accessibilityState: { selected }
|
|
43
35
|
},
|
|
44
|
-
/* @__PURE__ */ React.createElement(
|
|
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
|
+
)
|
|
45
57
|
));
|
|
46
58
|
});
|
|
47
59
|
function 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 };
|
|
@@ -3,7 +3,24 @@ import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
|
3
3
|
import { mvs, ms } from './chunk-2CE3TQVY.mjs';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { Text as Text$1 } from 'react-native';
|
|
6
|
+
import { isLoaded } from 'expo-font';
|
|
6
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
|
|
7
24
|
var variantStyles = {
|
|
8
25
|
"display-hero": { ...TYPOGRAPHY["display-hero"], fontSize: ms(TYPOGRAPHY["display-hero"].fontSize), lineHeight: mvs(TYPOGRAPHY["display-hero"].lineHeight) },
|
|
9
26
|
"display-xl": { ...TYPOGRAPHY["display-xl"], fontSize: ms(TYPOGRAPHY["display-xl"].fontSize), lineHeight: mvs(TYPOGRAPHY["display-xl"].lineHeight) },
|
|
@@ -42,6 +59,7 @@ var defaultColorVariant = {
|
|
|
42
59
|
"button-sm": "foreground"
|
|
43
60
|
};
|
|
44
61
|
function TextBase({ variant = "body-md", color, style, children, ...props }) {
|
|
62
|
+
warnIfFontsMissing();
|
|
45
63
|
const { colors } = useTheme();
|
|
46
64
|
const colorKey = defaultColorVariant[variant] ?? "foreground";
|
|
47
65
|
const resolvedColor = color ?? colors[colorKey];
|