@entropix/react-native 0.3.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion.cjs +26 -0
- package/dist/accordion.d.cts +34 -0
- package/dist/accordion.d.ts +34 -0
- package/dist/accordion.js +5 -0
- package/dist/button.cjs +14 -0
- package/dist/button.d.cts +35 -0
- package/dist/button.d.ts +35 -0
- package/dist/button.js +5 -0
- package/dist/checkbox.cjs +14 -0
- package/dist/checkbox.d.cts +41 -0
- package/dist/checkbox.d.ts +41 -0
- package/dist/checkbox.js +5 -0
- package/dist/chunk-2SQB7RNT.cjs +110 -0
- package/dist/chunk-3MHE2C74.js +143 -0
- package/dist/chunk-45KMMZUT.js +131 -0
- package/dist/chunk-64DK6YFL.js +164 -0
- package/dist/chunk-73BDGPZT.js +89 -0
- package/dist/chunk-B5YFEA66.cjs +243 -0
- package/dist/chunk-BOUIB4OY.cjs +56 -0
- package/dist/chunk-C6HF6QXK.js +154 -0
- package/dist/chunk-CXQNNEPC.js +249 -0
- package/dist/chunk-EFRYMWJB.js +86 -0
- package/dist/chunk-FQUZIDVS.cjs +174 -0
- package/dist/chunk-G7WPUTB6.cjs +258 -0
- package/dist/chunk-HH3CEDSH.js +122 -0
- package/dist/chunk-IRQWSFCZ.cjs +156 -0
- package/dist/chunk-KU24A5PQ.js +92 -0
- package/dist/chunk-OMKUPSHJ.cjs +95 -0
- package/dist/chunk-P5NAXMSC.cjs +91 -0
- package/dist/chunk-PKDXWKLO.cjs +245 -0
- package/dist/chunk-PVTPOJRU.js +155 -0
- package/dist/chunk-Q7TEJ62Q.cjs +160 -0
- package/dist/chunk-THX22NZW.cjs +146 -0
- package/dist/chunk-UHVTF2Y4.js +172 -0
- package/dist/chunk-UYXJHKYK.cjs +166 -0
- package/dist/chunk-VP567WZL.js +237 -0
- package/dist/chunk-XBNX4SLA.js +105 -0
- package/dist/chunk-XND7AIKO.cjs +133 -0
- package/dist/chunk-XSOLJOBG.js +238 -0
- package/dist/chunk-Z2MBHXUQ.cjs +127 -0
- package/dist/chunk-ZPAOLIIG.cjs +88 -0
- package/dist/chunk-ZYOTKLBG.js +52 -0
- package/dist/dialog.cjs +38 -0
- package/dist/dialog.d.cts +83 -0
- package/dist/dialog.d.ts +83 -0
- package/dist/dialog.js +5 -0
- package/dist/index.cjs +187 -2063
- package/dist/index.d.cts +21 -651
- package/dist/index.d.ts +21 -651
- package/dist/index.js +15 -2025
- package/dist/input.cjs +14 -0
- package/dist/input.d.cts +57 -0
- package/dist/input.d.ts +57 -0
- package/dist/input.js +5 -0
- package/dist/layout.cjs +25 -0
- package/dist/layout.d.cts +108 -0
- package/dist/layout.d.ts +108 -0
- package/dist/layout.js +4 -0
- package/dist/menu.cjs +26 -0
- package/dist/menu.d.cts +34 -0
- package/dist/menu.d.ts +34 -0
- package/dist/menu.js +5 -0
- package/dist/radio.cjs +18 -0
- package/dist/radio.d.cts +55 -0
- package/dist/radio.d.ts +55 -0
- package/dist/radio.js +5 -0
- package/dist/select.cjs +26 -0
- package/dist/select.d.cts +86 -0
- package/dist/select.d.ts +86 -0
- package/dist/select.js +5 -0
- package/dist/switch.cjs +14 -0
- package/dist/switch.d.cts +27 -0
- package/dist/switch.d.ts +27 -0
- package/dist/switch.js +5 -0
- package/dist/tabs.cjs +26 -0
- package/dist/tabs.d.cts +33 -0
- package/dist/tabs.d.ts +33 -0
- package/dist/tabs.js +5 -0
- package/dist/textarea.cjs +14 -0
- package/dist/textarea.d.cts +55 -0
- package/dist/textarea.d.ts +55 -0
- package/dist/textarea.js +5 -0
- package/dist/theme.cjs +20 -0
- package/dist/theme.d.cts +59 -0
- package/dist/theme.d.ts +59 -0
- package/dist/theme.js +3 -0
- package/dist/toggle.cjs +18 -0
- package/dist/toggle.d.cts +41 -0
- package/dist/toggle.d.ts +41 -0
- package/dist/toggle.js +5 -0
- package/package.json +146 -4
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,2027 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
mode = "light",
|
|
17
|
-
children
|
|
18
|
-
}) {
|
|
19
|
-
const value = useMemo(
|
|
20
|
-
() => ({
|
|
21
|
-
mode,
|
|
22
|
-
tokens: mode === "dark" ? tokens$2 : tokens$1,
|
|
23
|
-
baseTokens: tokens
|
|
24
|
-
}),
|
|
25
|
-
[mode]
|
|
26
|
-
);
|
|
27
|
-
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value, children });
|
|
28
|
-
}
|
|
29
|
-
function useTheme() {
|
|
30
|
-
return useContext(ThemeContext);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// src/utils/map-accessibility-to-rn.ts
|
|
34
|
-
var RN_ROLE_MAP = {
|
|
35
|
-
button: "button",
|
|
36
|
-
checkbox: "checkbox",
|
|
37
|
-
switch: "switch",
|
|
38
|
-
dialog: "none",
|
|
39
|
-
// Modal component handles dialog semantics
|
|
40
|
-
alertdialog: "alert",
|
|
41
|
-
link: "link",
|
|
42
|
-
tab: "tab",
|
|
43
|
-
tablist: "tablist",
|
|
44
|
-
menu: "menu",
|
|
45
|
-
menuitem: "menuitem",
|
|
46
|
-
radio: "radio",
|
|
47
|
-
radiogroup: "radiogroup",
|
|
48
|
-
slider: "adjustable",
|
|
49
|
-
spinbutton: "spinbutton",
|
|
50
|
-
textbox: "text",
|
|
51
|
-
combobox: "combobox",
|
|
52
|
-
progressbar: "progressbar",
|
|
53
|
-
alert: "alert",
|
|
54
|
-
status: "text",
|
|
55
|
-
tooltip: "text",
|
|
56
|
-
none: "none",
|
|
57
|
-
presentation: "none"
|
|
58
|
-
};
|
|
59
|
-
function mapAccessibilityToRN(props) {
|
|
60
|
-
const result = { accessible: true };
|
|
61
|
-
if (props.role) {
|
|
62
|
-
result.accessibilityRole = RN_ROLE_MAP[props.role] ?? props.role;
|
|
63
|
-
}
|
|
64
|
-
if (props.label) {
|
|
65
|
-
result.accessibilityLabel = props.label;
|
|
66
|
-
}
|
|
67
|
-
if (props.describedBy) {
|
|
68
|
-
result.accessibilityHint = props.describedBy;
|
|
69
|
-
}
|
|
70
|
-
if (props.labelledBy) {
|
|
71
|
-
result.accessibilityLabelledBy = props.labelledBy;
|
|
72
|
-
}
|
|
73
|
-
const state = {};
|
|
74
|
-
let hasState = false;
|
|
75
|
-
if (props.disabled !== void 0) {
|
|
76
|
-
state.disabled = props.disabled;
|
|
77
|
-
hasState = true;
|
|
78
|
-
}
|
|
79
|
-
if (props.expanded !== void 0) {
|
|
80
|
-
state.expanded = props.expanded;
|
|
81
|
-
hasState = true;
|
|
82
|
-
}
|
|
83
|
-
if (props.selected !== void 0) {
|
|
84
|
-
state.selected = props.selected;
|
|
85
|
-
hasState = true;
|
|
86
|
-
}
|
|
87
|
-
if (props.checked !== void 0) {
|
|
88
|
-
state.checked = props.checked;
|
|
89
|
-
hasState = true;
|
|
90
|
-
}
|
|
91
|
-
if (props.busy !== void 0) {
|
|
92
|
-
state.busy = props.busy;
|
|
93
|
-
hasState = true;
|
|
94
|
-
}
|
|
95
|
-
if (hasState) {
|
|
96
|
-
result.accessibilityState = state;
|
|
97
|
-
}
|
|
98
|
-
if (props.valueNow !== void 0 || props.valueMin !== void 0 || props.valueMax !== void 0 || props.valueText !== void 0) {
|
|
99
|
-
result.accessibilityValue = {};
|
|
100
|
-
if (props.valueNow !== void 0)
|
|
101
|
-
result.accessibilityValue.now = props.valueNow;
|
|
102
|
-
if (props.valueMin !== void 0)
|
|
103
|
-
result.accessibilityValue.min = props.valueMin;
|
|
104
|
-
if (props.valueMax !== void 0)
|
|
105
|
-
result.accessibilityValue.max = props.valueMax;
|
|
106
|
-
if (props.valueText !== void 0)
|
|
107
|
-
result.accessibilityValue.text = props.valueText;
|
|
108
|
-
}
|
|
109
|
-
if (props.live) {
|
|
110
|
-
result.accessibilityLiveRegion = props.live === "off" ? "none" : props.live;
|
|
111
|
-
}
|
|
112
|
-
if (props.hidden) {
|
|
113
|
-
result.accessibilityElementsHidden = true;
|
|
114
|
-
result.importantForAccessibility = "no-hide-descendants";
|
|
115
|
-
}
|
|
116
|
-
return result;
|
|
117
|
-
}
|
|
118
|
-
function Button({
|
|
119
|
-
onPress,
|
|
120
|
-
disabled,
|
|
121
|
-
loading,
|
|
122
|
-
variant = "primary",
|
|
123
|
-
size = "md",
|
|
124
|
-
style,
|
|
125
|
-
textStyle,
|
|
126
|
-
children,
|
|
127
|
-
...rest
|
|
128
|
-
}) {
|
|
129
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
130
|
-
const { isDisabled, isLoading, getButtonProps } = useButton({
|
|
131
|
-
disabled,
|
|
132
|
-
loading,
|
|
133
|
-
onPress,
|
|
134
|
-
elementType: "div"
|
|
135
|
-
});
|
|
136
|
-
const propGetterReturn = getButtonProps();
|
|
137
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
138
|
-
const handlePress = useCallback(() => {
|
|
139
|
-
propGetterReturn.onAction?.();
|
|
140
|
-
}, [propGetterReturn.onAction]);
|
|
141
|
-
const sizeStyles = getSizeStyle(size, bt);
|
|
142
|
-
const variantStyles = getVariantStyle(variant, t);
|
|
143
|
-
const labelColor = getVariantTextColor(variant, t);
|
|
144
|
-
const isInactive = isDisabled || isLoading;
|
|
145
|
-
return /* @__PURE__ */ jsx(
|
|
146
|
-
Pressable,
|
|
147
|
-
{
|
|
148
|
-
...rnAccessibility,
|
|
149
|
-
...rest,
|
|
150
|
-
disabled: isInactive,
|
|
151
|
-
onPress: isInactive ? void 0 : handlePress,
|
|
152
|
-
style: [
|
|
153
|
-
baseStyle,
|
|
154
|
-
sizeStyles.container,
|
|
155
|
-
variantStyles,
|
|
156
|
-
isInactive && { opacity: 0.5 },
|
|
157
|
-
style
|
|
158
|
-
],
|
|
159
|
-
children: typeof children === "string" ? /* @__PURE__ */ jsx(
|
|
160
|
-
Text,
|
|
161
|
-
{
|
|
162
|
-
style: [
|
|
163
|
-
{ color: labelColor, fontSize: sizeStyles.fontSize, fontWeight: "500" },
|
|
164
|
-
textStyle
|
|
165
|
-
],
|
|
166
|
-
children
|
|
167
|
-
}
|
|
168
|
-
) : children
|
|
169
|
-
}
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
var baseStyle = {
|
|
173
|
-
flexDirection: "row",
|
|
174
|
-
alignItems: "center",
|
|
175
|
-
justifyContent: "center"
|
|
176
|
-
};
|
|
177
|
-
function getSizeStyle(size, bt) {
|
|
178
|
-
switch (size) {
|
|
179
|
-
case "sm":
|
|
180
|
-
return {
|
|
181
|
-
container: {
|
|
182
|
-
paddingVertical: bt.entropixSpacing1,
|
|
183
|
-
paddingHorizontal: bt.entropixSpacing3,
|
|
184
|
-
borderRadius: bt.entropixRadiusSm,
|
|
185
|
-
gap: bt.entropixButtonGap
|
|
186
|
-
},
|
|
187
|
-
fontSize: bt.entropixFontSizeXs
|
|
188
|
-
};
|
|
189
|
-
case "lg":
|
|
190
|
-
return {
|
|
191
|
-
container: {
|
|
192
|
-
paddingVertical: bt.entropixSpacing3,
|
|
193
|
-
paddingHorizontal: bt.entropixSpacing6,
|
|
194
|
-
borderRadius: bt.entropixRadiusLg,
|
|
195
|
-
gap: bt.entropixButtonGap
|
|
196
|
-
},
|
|
197
|
-
fontSize: bt.entropixFontSizeBase
|
|
198
|
-
};
|
|
199
|
-
default:
|
|
200
|
-
return {
|
|
201
|
-
container: {
|
|
202
|
-
paddingVertical: bt.entropixButtonPaddingY,
|
|
203
|
-
paddingHorizontal: bt.entropixButtonPaddingX,
|
|
204
|
-
borderRadius: bt.entropixButtonBorderRadius,
|
|
205
|
-
gap: bt.entropixButtonGap
|
|
206
|
-
},
|
|
207
|
-
fontSize: bt.entropixButtonFontSize
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
function getVariantStyle(variant, t) {
|
|
212
|
-
switch (variant) {
|
|
213
|
-
case "primary":
|
|
214
|
-
return { backgroundColor: t.entropixButtonPrimaryBg, borderWidth: 1, borderColor: t.entropixButtonPrimaryBorder };
|
|
215
|
-
case "secondary":
|
|
216
|
-
return { backgroundColor: t.entropixButtonSecondaryBg, borderWidth: 1, borderColor: t.entropixButtonSecondaryBorder };
|
|
217
|
-
case "outline":
|
|
218
|
-
return { backgroundColor: "transparent", borderWidth: 1, borderColor: t.entropixColorBorderDefault };
|
|
219
|
-
case "ghost":
|
|
220
|
-
return { backgroundColor: "transparent", borderWidth: 1, borderColor: "transparent" };
|
|
221
|
-
case "danger":
|
|
222
|
-
return { backgroundColor: t.entropixButtonDangerBg, borderWidth: 1, borderColor: t.entropixButtonDangerBorder };
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
function getVariantTextColor(variant, t) {
|
|
226
|
-
switch (variant) {
|
|
227
|
-
case "primary":
|
|
228
|
-
return t.entropixButtonPrimaryText;
|
|
229
|
-
case "secondary":
|
|
230
|
-
return t.entropixButtonSecondaryText;
|
|
231
|
-
case "outline":
|
|
232
|
-
case "ghost":
|
|
233
|
-
return t.entropixColorTextPrimary;
|
|
234
|
-
case "danger":
|
|
235
|
-
return t.entropixButtonDangerText;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
function Toggle(props) {
|
|
239
|
-
return /* @__PURE__ */ jsx(ToggleInner, { ...props, role: "checkbox" });
|
|
240
|
-
}
|
|
241
|
-
function ToggleInner({
|
|
242
|
-
checked,
|
|
243
|
-
defaultChecked,
|
|
244
|
-
onChange,
|
|
245
|
-
disabled,
|
|
246
|
-
label,
|
|
247
|
-
role = "checkbox",
|
|
248
|
-
style,
|
|
249
|
-
textStyle,
|
|
250
|
-
children,
|
|
251
|
-
...rest
|
|
252
|
-
}) {
|
|
253
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
254
|
-
const { isDisabled, getToggleProps } = useToggle({
|
|
255
|
-
checked,
|
|
256
|
-
defaultChecked,
|
|
257
|
-
onChange,
|
|
258
|
-
disabled,
|
|
259
|
-
role
|
|
260
|
-
});
|
|
261
|
-
const propGetterReturn = getToggleProps();
|
|
262
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
263
|
-
const isChecked = propGetterReturn.accessibility.checked === true;
|
|
264
|
-
if (label) {
|
|
265
|
-
rnAccessibility.accessibilityLabel = label;
|
|
266
|
-
}
|
|
267
|
-
const handlePress = useCallback(() => {
|
|
268
|
-
propGetterReturn.onAction?.();
|
|
269
|
-
}, [propGetterReturn.onAction]);
|
|
270
|
-
return /* @__PURE__ */ jsx(
|
|
271
|
-
Pressable,
|
|
272
|
-
{
|
|
273
|
-
...rnAccessibility,
|
|
274
|
-
...rest,
|
|
275
|
-
disabled: isDisabled,
|
|
276
|
-
onPress: isDisabled ? void 0 : handlePress,
|
|
277
|
-
style: [
|
|
278
|
-
{
|
|
279
|
-
flexDirection: "row",
|
|
280
|
-
alignItems: "center",
|
|
281
|
-
justifyContent: "center",
|
|
282
|
-
paddingVertical: bt.entropixSpacing2,
|
|
283
|
-
paddingHorizontal: bt.entropixSpacing3,
|
|
284
|
-
borderWidth: 1,
|
|
285
|
-
borderColor: isChecked ? "transparent" : t.entropixColorBorderDefault,
|
|
286
|
-
borderRadius: bt.entropixRadiusMd,
|
|
287
|
-
backgroundColor: isChecked ? t.entropixColorActionPrimaryDefault : t.entropixColorBgPrimary
|
|
288
|
-
},
|
|
289
|
-
isDisabled && { opacity: 0.5 },
|
|
290
|
-
style
|
|
291
|
-
],
|
|
292
|
-
children: typeof children === "string" ? /* @__PURE__ */ jsx(
|
|
293
|
-
Text,
|
|
294
|
-
{
|
|
295
|
-
style: [
|
|
296
|
-
{
|
|
297
|
-
fontSize: bt.entropixFontSizeSm,
|
|
298
|
-
fontWeight: "500",
|
|
299
|
-
color: isChecked ? t.entropixColorTextInverse : t.entropixColorTextPrimary
|
|
300
|
-
},
|
|
301
|
-
textStyle
|
|
302
|
-
],
|
|
303
|
-
children
|
|
304
|
-
}
|
|
305
|
-
) : children != null ? children : /* @__PURE__ */ jsx(
|
|
306
|
-
Text,
|
|
307
|
-
{
|
|
308
|
-
style: {
|
|
309
|
-
fontSize: bt.entropixFontSizeSm,
|
|
310
|
-
fontWeight: "500",
|
|
311
|
-
color: isChecked ? t.entropixColorTextInverse : t.entropixColorTextPrimary
|
|
312
|
-
},
|
|
313
|
-
children: isChecked ? "On" : "Off"
|
|
314
|
-
}
|
|
315
|
-
)
|
|
316
|
-
}
|
|
317
|
-
);
|
|
318
|
-
}
|
|
319
|
-
var TRACK_WIDTH = 44;
|
|
320
|
-
var TRACK_HEIGHT = 24;
|
|
321
|
-
var TRACK_PADDING = 2;
|
|
322
|
-
var THUMB_SIZE = TRACK_HEIGHT - TRACK_PADDING * 2;
|
|
323
|
-
var THUMB_TRAVEL = TRACK_WIDTH - TRACK_PADDING * 2 - THUMB_SIZE;
|
|
324
|
-
function Switch({
|
|
325
|
-
checked,
|
|
326
|
-
defaultChecked,
|
|
327
|
-
onChange,
|
|
328
|
-
disabled,
|
|
329
|
-
label,
|
|
330
|
-
style,
|
|
331
|
-
...rest
|
|
332
|
-
}) {
|
|
333
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
334
|
-
const { isDisabled, getToggleProps } = useToggle({
|
|
335
|
-
checked,
|
|
336
|
-
defaultChecked,
|
|
337
|
-
onChange,
|
|
338
|
-
disabled,
|
|
339
|
-
role: "switch"
|
|
340
|
-
});
|
|
341
|
-
const propGetterReturn = getToggleProps();
|
|
342
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
343
|
-
const isChecked = propGetterReturn.accessibility.checked === true;
|
|
344
|
-
if (label) {
|
|
345
|
-
rnAccessibility.accessibilityLabel = label;
|
|
346
|
-
}
|
|
347
|
-
const handlePress = useCallback(() => {
|
|
348
|
-
propGetterReturn.onAction?.();
|
|
349
|
-
}, [propGetterReturn.onAction]);
|
|
350
|
-
const thumbAnim = useRef(
|
|
351
|
-
new Animated.Value(defaultChecked || checked ? THUMB_TRAVEL : 0)
|
|
352
|
-
).current;
|
|
353
|
-
useEffect(() => {
|
|
354
|
-
Animated.timing(thumbAnim, {
|
|
355
|
-
toValue: isChecked ? THUMB_TRAVEL : 0,
|
|
356
|
-
duration: 150,
|
|
357
|
-
useNativeDriver: false
|
|
358
|
-
}).start();
|
|
359
|
-
}, [isChecked, thumbAnim]);
|
|
360
|
-
return /* @__PURE__ */ jsx(
|
|
361
|
-
Pressable,
|
|
362
|
-
{
|
|
363
|
-
...rnAccessibility,
|
|
364
|
-
...rest,
|
|
365
|
-
disabled: isDisabled,
|
|
366
|
-
onPress: isDisabled ? void 0 : handlePress,
|
|
367
|
-
style: [
|
|
368
|
-
{
|
|
369
|
-
width: TRACK_WIDTH,
|
|
370
|
-
height: TRACK_HEIGHT,
|
|
371
|
-
borderRadius: bt.entropixRadiusFull,
|
|
372
|
-
backgroundColor: isChecked ? t.entropixColorActionPrimaryDefault : t.entropixColorGray300,
|
|
373
|
-
padding: TRACK_PADDING,
|
|
374
|
-
justifyContent: "center"
|
|
375
|
-
},
|
|
376
|
-
isDisabled && { opacity: 0.5 },
|
|
377
|
-
style
|
|
378
|
-
],
|
|
379
|
-
children: /* @__PURE__ */ jsx(
|
|
380
|
-
Animated.View,
|
|
381
|
-
{
|
|
382
|
-
style: {
|
|
383
|
-
width: THUMB_SIZE,
|
|
384
|
-
height: THUMB_SIZE,
|
|
385
|
-
borderRadius: bt.entropixRadiusFull,
|
|
386
|
-
backgroundColor: t.entropixColorWhite,
|
|
387
|
-
transform: [{ translateX: thumbAnim }]
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
)
|
|
391
|
-
}
|
|
392
|
-
);
|
|
393
|
-
}
|
|
394
|
-
var DialogContext = createContext(null);
|
|
395
|
-
function useDialogContext() {
|
|
396
|
-
const context = useContext(DialogContext);
|
|
397
|
-
if (!context) {
|
|
398
|
-
throw new Error(
|
|
399
|
-
"Dialog compound components must be used within a <Dialog> provider."
|
|
400
|
-
);
|
|
401
|
-
}
|
|
402
|
-
return context;
|
|
403
|
-
}
|
|
404
|
-
function Dialog({
|
|
405
|
-
children,
|
|
406
|
-
isOpen,
|
|
407
|
-
defaultOpen,
|
|
408
|
-
onOpenChange,
|
|
409
|
-
closeOnOverlayPress,
|
|
410
|
-
closeOnEscape,
|
|
411
|
-
modal,
|
|
412
|
-
role
|
|
413
|
-
}) {
|
|
414
|
-
const dialog = useDialog({
|
|
415
|
-
isOpen,
|
|
416
|
-
defaultOpen,
|
|
417
|
-
onOpenChange,
|
|
418
|
-
closeOnOverlayPress,
|
|
419
|
-
closeOnEscape,
|
|
420
|
-
modal,
|
|
421
|
-
role
|
|
422
|
-
});
|
|
423
|
-
return /* @__PURE__ */ jsx(DialogContext.Provider, { value: dialog, children });
|
|
424
|
-
}
|
|
425
|
-
function DialogTrigger({
|
|
426
|
-
children,
|
|
427
|
-
style,
|
|
428
|
-
...rest
|
|
429
|
-
}) {
|
|
430
|
-
const { getTriggerProps } = useDialogContext();
|
|
431
|
-
const propGetterReturn = getTriggerProps();
|
|
432
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
433
|
-
const handlePress = useCallback(() => {
|
|
434
|
-
propGetterReturn.onAction?.();
|
|
435
|
-
}, [propGetterReturn.onAction]);
|
|
436
|
-
return /* @__PURE__ */ jsx(
|
|
437
|
-
Pressable,
|
|
438
|
-
{
|
|
439
|
-
...rnAccessibility,
|
|
440
|
-
...rest,
|
|
441
|
-
onPress: handlePress,
|
|
442
|
-
style,
|
|
443
|
-
children
|
|
444
|
-
}
|
|
445
|
-
);
|
|
446
|
-
}
|
|
447
|
-
function DialogContent({
|
|
448
|
-
children,
|
|
449
|
-
style,
|
|
450
|
-
cardStyle,
|
|
451
|
-
animationType = "fade",
|
|
452
|
-
transparent = true,
|
|
453
|
-
...rest
|
|
454
|
-
}) {
|
|
455
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
456
|
-
const { isOpen, close, ids, getContentProps } = useDialogContext();
|
|
457
|
-
const propGetterReturn = getContentProps();
|
|
458
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
459
|
-
return /* @__PURE__ */ jsx(
|
|
460
|
-
Modal,
|
|
461
|
-
{
|
|
462
|
-
visible: isOpen,
|
|
463
|
-
transparent,
|
|
464
|
-
animationType,
|
|
465
|
-
onRequestClose: close,
|
|
466
|
-
supportedOrientations: ["portrait", "landscape"],
|
|
467
|
-
children: /* @__PURE__ */ jsx(
|
|
468
|
-
View,
|
|
469
|
-
{
|
|
470
|
-
...rest,
|
|
471
|
-
style: [
|
|
472
|
-
{
|
|
473
|
-
flex: 1,
|
|
474
|
-
justifyContent: "center",
|
|
475
|
-
alignItems: "center",
|
|
476
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
477
|
-
},
|
|
478
|
-
style
|
|
479
|
-
],
|
|
480
|
-
children: /* @__PURE__ */ jsx(
|
|
481
|
-
View,
|
|
482
|
-
{
|
|
483
|
-
...rnAccessibility,
|
|
484
|
-
nativeID: ids.content,
|
|
485
|
-
style: [
|
|
486
|
-
{
|
|
487
|
-
backgroundColor: t.entropixColorBgPrimary,
|
|
488
|
-
borderRadius: bt.entropixRadiusLg,
|
|
489
|
-
padding: bt.entropixSpacing6,
|
|
490
|
-
width: "90%",
|
|
491
|
-
maxWidth: 480,
|
|
492
|
-
shadowColor: "#000",
|
|
493
|
-
shadowOffset: { width: 0, height: 4 },
|
|
494
|
-
shadowOpacity: 0.15,
|
|
495
|
-
shadowRadius: 12,
|
|
496
|
-
elevation: 8
|
|
497
|
-
},
|
|
498
|
-
cardStyle
|
|
499
|
-
],
|
|
500
|
-
children
|
|
501
|
-
}
|
|
502
|
-
)
|
|
503
|
-
}
|
|
504
|
-
)
|
|
505
|
-
}
|
|
506
|
-
);
|
|
507
|
-
}
|
|
508
|
-
function DialogTitle({ children, style, ...rest }) {
|
|
509
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
510
|
-
const { ids } = useDialogContext();
|
|
511
|
-
return /* @__PURE__ */ jsx(
|
|
512
|
-
Text,
|
|
513
|
-
{
|
|
514
|
-
...rest,
|
|
515
|
-
nativeID: ids.title,
|
|
516
|
-
style: [
|
|
517
|
-
{
|
|
518
|
-
fontSize: 18,
|
|
519
|
-
fontWeight: "600",
|
|
520
|
-
color: t.entropixColorTextPrimary,
|
|
521
|
-
marginBottom: bt.entropixSpacing2
|
|
522
|
-
},
|
|
523
|
-
style
|
|
524
|
-
],
|
|
525
|
-
accessibilityRole: "header",
|
|
526
|
-
children
|
|
527
|
-
}
|
|
528
|
-
);
|
|
529
|
-
}
|
|
530
|
-
function DialogDescription({
|
|
531
|
-
children,
|
|
532
|
-
style,
|
|
533
|
-
...rest
|
|
534
|
-
}) {
|
|
535
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
536
|
-
const { ids } = useDialogContext();
|
|
537
|
-
return /* @__PURE__ */ jsx(
|
|
538
|
-
Text,
|
|
539
|
-
{
|
|
540
|
-
...rest,
|
|
541
|
-
nativeID: ids.description,
|
|
542
|
-
style: [
|
|
543
|
-
{
|
|
544
|
-
fontSize: bt.entropixFontSizeSm,
|
|
545
|
-
color: t.entropixColorTextSecondary,
|
|
546
|
-
lineHeight: 20,
|
|
547
|
-
marginBottom: bt.entropixSpacing4
|
|
548
|
-
},
|
|
549
|
-
style
|
|
550
|
-
],
|
|
551
|
-
children
|
|
552
|
-
}
|
|
553
|
-
);
|
|
554
|
-
}
|
|
555
|
-
function DialogClose({ children, style, ...rest }) {
|
|
556
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
557
|
-
const { getCloseProps } = useDialogContext();
|
|
558
|
-
const propGetterReturn = getCloseProps();
|
|
559
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
560
|
-
const handlePress = useCallback(() => {
|
|
561
|
-
propGetterReturn.onAction?.();
|
|
562
|
-
}, [propGetterReturn.onAction]);
|
|
563
|
-
return /* @__PURE__ */ jsx(
|
|
564
|
-
Pressable,
|
|
565
|
-
{
|
|
566
|
-
...rnAccessibility,
|
|
567
|
-
...rest,
|
|
568
|
-
onPress: handlePress,
|
|
569
|
-
style: [
|
|
570
|
-
{
|
|
571
|
-
position: "absolute",
|
|
572
|
-
top: bt.entropixSpacing3,
|
|
573
|
-
right: bt.entropixSpacing3,
|
|
574
|
-
width: 32,
|
|
575
|
-
height: 32,
|
|
576
|
-
alignItems: "center",
|
|
577
|
-
justifyContent: "center",
|
|
578
|
-
borderRadius: bt.entropixRadiusSm
|
|
579
|
-
},
|
|
580
|
-
style
|
|
581
|
-
],
|
|
582
|
-
accessibilityRole: "button",
|
|
583
|
-
children: children ?? /* @__PURE__ */ jsx(
|
|
584
|
-
Text,
|
|
585
|
-
{
|
|
586
|
-
style: {
|
|
587
|
-
fontSize: 16,
|
|
588
|
-
color: t.entropixColorTextSecondary
|
|
589
|
-
},
|
|
590
|
-
children: "\u2715"
|
|
591
|
-
}
|
|
592
|
-
)
|
|
593
|
-
}
|
|
594
|
-
);
|
|
595
|
-
}
|
|
596
|
-
function DialogOverlay({ style, testID }) {
|
|
597
|
-
const { isOpen, getOverlayProps } = useDialogContext();
|
|
598
|
-
const propGetterReturn = getOverlayProps();
|
|
599
|
-
const handlePress = useCallback(() => {
|
|
600
|
-
propGetterReturn.onAction?.();
|
|
601
|
-
}, [propGetterReturn.onAction]);
|
|
602
|
-
if (!isOpen) return null;
|
|
603
|
-
return /* @__PURE__ */ jsx(
|
|
604
|
-
Pressable,
|
|
605
|
-
{
|
|
606
|
-
testID,
|
|
607
|
-
accessible: false,
|
|
608
|
-
importantForAccessibility: "no",
|
|
609
|
-
onPress: propGetterReturn.onAction ? handlePress : void 0,
|
|
610
|
-
style: [
|
|
611
|
-
{
|
|
612
|
-
...StyleSheet.absoluteFillObject,
|
|
613
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
614
|
-
},
|
|
615
|
-
style
|
|
616
|
-
]
|
|
617
|
-
}
|
|
618
|
-
);
|
|
619
|
-
}
|
|
620
|
-
var TabsContext = createContext(null);
|
|
621
|
-
function useTabsContext() {
|
|
622
|
-
const context = useContext(TabsContext);
|
|
623
|
-
if (!context) {
|
|
624
|
-
throw new Error(
|
|
625
|
-
"Tabs compound components must be used within a <Tabs> provider."
|
|
626
|
-
);
|
|
627
|
-
}
|
|
628
|
-
return context;
|
|
629
|
-
}
|
|
630
|
-
function Tabs({ children, style, ...options }) {
|
|
631
|
-
const tabs = useTabs(options);
|
|
632
|
-
return /* @__PURE__ */ jsx(TabsContext.Provider, { value: tabs, children: /* @__PURE__ */ jsx(View, { style, children }) });
|
|
633
|
-
}
|
|
634
|
-
function TabList({ children, style }) {
|
|
635
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
636
|
-
const { getTabListProps } = useTabsContext();
|
|
637
|
-
const propGetterReturn = getTabListProps();
|
|
638
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
639
|
-
return /* @__PURE__ */ jsx(
|
|
640
|
-
View,
|
|
641
|
-
{
|
|
642
|
-
...rnAccessibility,
|
|
643
|
-
style: [
|
|
644
|
-
{
|
|
645
|
-
flexDirection: "row",
|
|
646
|
-
gap: bt.entropixSpacing1,
|
|
647
|
-
borderBottomWidth: 1,
|
|
648
|
-
borderBottomColor: t.entropixColorBorderDefault
|
|
649
|
-
},
|
|
650
|
-
style
|
|
651
|
-
],
|
|
652
|
-
children
|
|
653
|
-
}
|
|
654
|
-
);
|
|
655
|
-
}
|
|
656
|
-
function Tab({ value, children, style, textStyle, ...rest }) {
|
|
657
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
658
|
-
const { getTabProps, selectedKey } = useTabsContext();
|
|
659
|
-
const propGetterReturn = getTabProps(value);
|
|
660
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
661
|
-
const isActive = selectedKey === value;
|
|
662
|
-
const isDisabled = propGetterReturn.accessibility.disabled === true;
|
|
663
|
-
const handlePress = useCallback(() => {
|
|
664
|
-
propGetterReturn.onAction?.();
|
|
665
|
-
}, [propGetterReturn.onAction]);
|
|
666
|
-
return /* @__PURE__ */ jsx(
|
|
667
|
-
Pressable,
|
|
668
|
-
{
|
|
669
|
-
...rnAccessibility,
|
|
670
|
-
...rest,
|
|
671
|
-
onPress: propGetterReturn.onAction ? handlePress : void 0,
|
|
672
|
-
style: [
|
|
673
|
-
{
|
|
674
|
-
paddingVertical: bt.entropixSpacing2,
|
|
675
|
-
paddingHorizontal: bt.entropixSpacing4,
|
|
676
|
-
borderBottomWidth: 2,
|
|
677
|
-
borderBottomColor: isActive ? t.entropixColorActionPrimaryDefault : "transparent"
|
|
678
|
-
},
|
|
679
|
-
isDisabled && { opacity: 0.5 },
|
|
680
|
-
style
|
|
681
|
-
],
|
|
682
|
-
children: typeof children === "string" ? /* @__PURE__ */ jsx(
|
|
683
|
-
Text,
|
|
684
|
-
{
|
|
685
|
-
style: [
|
|
686
|
-
{
|
|
687
|
-
fontSize: bt.entropixFontSizeSm,
|
|
688
|
-
fontWeight: "500",
|
|
689
|
-
color: isActive ? t.entropixColorActionPrimaryDefault : t.entropixColorTextSecondary
|
|
690
|
-
},
|
|
691
|
-
textStyle
|
|
692
|
-
],
|
|
693
|
-
children
|
|
694
|
-
}
|
|
695
|
-
) : children
|
|
696
|
-
}
|
|
697
|
-
);
|
|
698
|
-
}
|
|
699
|
-
function TabPanel({ value, children, style }) {
|
|
700
|
-
const { baseTokens: bt } = useTheme();
|
|
701
|
-
const { getTabPanelProps, selectedKey } = useTabsContext();
|
|
702
|
-
const propGetterReturn = getTabPanelProps(value);
|
|
703
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
704
|
-
if (selectedKey !== value) return null;
|
|
705
|
-
return /* @__PURE__ */ jsx(
|
|
706
|
-
View,
|
|
707
|
-
{
|
|
708
|
-
...rnAccessibility,
|
|
709
|
-
style: [{ padding: bt.entropixSpacing4 }, style],
|
|
710
|
-
children
|
|
711
|
-
}
|
|
712
|
-
);
|
|
713
|
-
}
|
|
714
|
-
var AccordionContext = createContext(null);
|
|
715
|
-
function useAccordionContext() {
|
|
716
|
-
const context = useContext(AccordionContext);
|
|
717
|
-
if (!context) {
|
|
718
|
-
throw new Error(
|
|
719
|
-
"Accordion compound components must be used within an <Accordion> provider."
|
|
720
|
-
);
|
|
721
|
-
}
|
|
722
|
-
return context;
|
|
723
|
-
}
|
|
724
|
-
var AccordionItemContext = createContext(null);
|
|
725
|
-
function useAccordionItemContext() {
|
|
726
|
-
const context = useContext(AccordionItemContext);
|
|
727
|
-
if (context === null) {
|
|
728
|
-
throw new Error(
|
|
729
|
-
"AccordionTrigger and AccordionPanel must be used within an <AccordionItem>."
|
|
730
|
-
);
|
|
731
|
-
}
|
|
732
|
-
return context;
|
|
733
|
-
}
|
|
734
|
-
function Accordion({ children, style, ...options }) {
|
|
735
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
736
|
-
const accordion = useAccordion(options);
|
|
737
|
-
return /* @__PURE__ */ jsx(AccordionContext.Provider, { value: accordion, children: /* @__PURE__ */ jsx(
|
|
738
|
-
View,
|
|
739
|
-
{
|
|
740
|
-
style: [
|
|
741
|
-
{
|
|
742
|
-
borderWidth: 1,
|
|
743
|
-
borderColor: t.entropixColorBorderDefault,
|
|
744
|
-
borderRadius: bt.entropixRadiusLg,
|
|
745
|
-
overflow: "hidden"
|
|
746
|
-
},
|
|
747
|
-
style
|
|
748
|
-
],
|
|
749
|
-
children
|
|
750
|
-
}
|
|
751
|
-
) });
|
|
752
|
-
}
|
|
753
|
-
function AccordionItem({
|
|
754
|
-
value,
|
|
755
|
-
isLast = false,
|
|
756
|
-
children,
|
|
757
|
-
style
|
|
758
|
-
}) {
|
|
759
|
-
const { tokens: t } = useTheme();
|
|
760
|
-
return /* @__PURE__ */ jsx(AccordionItemContext.Provider, { value, children: /* @__PURE__ */ jsx(
|
|
761
|
-
View,
|
|
762
|
-
{
|
|
763
|
-
style: [
|
|
764
|
-
{
|
|
765
|
-
borderBottomWidth: isLast ? 0 : 1,
|
|
766
|
-
borderBottomColor: t.entropixColorBorderDefault
|
|
767
|
-
},
|
|
768
|
-
style
|
|
769
|
-
],
|
|
770
|
-
children
|
|
771
|
-
}
|
|
772
|
-
) });
|
|
773
|
-
}
|
|
774
|
-
function AccordionTrigger({
|
|
775
|
-
children,
|
|
776
|
-
style,
|
|
777
|
-
textStyle,
|
|
778
|
-
...rest
|
|
779
|
-
}) {
|
|
780
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
781
|
-
const itemKey = useAccordionItemContext();
|
|
782
|
-
const { getItemTriggerProps, isExpanded } = useAccordionContext();
|
|
783
|
-
const propGetterReturn = getItemTriggerProps(itemKey);
|
|
784
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
785
|
-
const expanded = isExpanded(itemKey);
|
|
786
|
-
const handlePress = useCallback(() => {
|
|
787
|
-
propGetterReturn.onAction?.();
|
|
788
|
-
}, [propGetterReturn.onAction]);
|
|
789
|
-
return /* @__PURE__ */ jsxs(
|
|
790
|
-
Pressable,
|
|
791
|
-
{
|
|
792
|
-
...rnAccessibility,
|
|
793
|
-
...rest,
|
|
794
|
-
onPress: propGetterReturn.onAction ? handlePress : void 0,
|
|
795
|
-
style: [
|
|
796
|
-
{
|
|
797
|
-
flexDirection: "row",
|
|
798
|
-
alignItems: "center",
|
|
799
|
-
justifyContent: "space-between",
|
|
800
|
-
paddingVertical: bt.entropixSpacing4,
|
|
801
|
-
paddingHorizontal: bt.entropixSpacing4
|
|
802
|
-
},
|
|
803
|
-
style
|
|
804
|
-
],
|
|
805
|
-
children: [
|
|
806
|
-
typeof children === "string" ? /* @__PURE__ */ jsx(
|
|
807
|
-
Text,
|
|
808
|
-
{
|
|
809
|
-
style: [
|
|
810
|
-
{
|
|
811
|
-
fontSize: bt.entropixFontSizeSm,
|
|
812
|
-
fontWeight: "500",
|
|
813
|
-
color: t.entropixColorTextPrimary,
|
|
814
|
-
flex: 1
|
|
815
|
-
},
|
|
816
|
-
textStyle
|
|
817
|
-
],
|
|
818
|
-
children
|
|
819
|
-
}
|
|
820
|
-
) : children,
|
|
821
|
-
/* @__PURE__ */ jsx(
|
|
822
|
-
Text,
|
|
823
|
-
{
|
|
824
|
-
style: {
|
|
825
|
-
fontSize: 12,
|
|
826
|
-
color: t.entropixColorTextSecondary,
|
|
827
|
-
marginLeft: bt.entropixSpacing2
|
|
828
|
-
},
|
|
829
|
-
children: expanded ? "\u2212" : "+"
|
|
830
|
-
}
|
|
831
|
-
)
|
|
832
|
-
]
|
|
833
|
-
}
|
|
834
|
-
);
|
|
835
|
-
}
|
|
836
|
-
function AccordionPanel({ children, style }) {
|
|
837
|
-
const { baseTokens: bt } = useTheme();
|
|
838
|
-
const itemKey = useAccordionItemContext();
|
|
839
|
-
const { getItemPanelProps, isExpanded } = useAccordionContext();
|
|
840
|
-
const propGetterReturn = getItemPanelProps(itemKey);
|
|
841
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
842
|
-
if (!isExpanded(itemKey)) return null;
|
|
843
|
-
return /* @__PURE__ */ jsx(
|
|
844
|
-
View,
|
|
845
|
-
{
|
|
846
|
-
...rnAccessibility,
|
|
847
|
-
style: [
|
|
848
|
-
{
|
|
849
|
-
paddingHorizontal: bt.entropixSpacing4,
|
|
850
|
-
paddingBottom: bt.entropixSpacing4
|
|
851
|
-
},
|
|
852
|
-
style
|
|
853
|
-
],
|
|
854
|
-
children
|
|
855
|
-
}
|
|
856
|
-
);
|
|
857
|
-
}
|
|
858
|
-
var MenuContext = createContext(null);
|
|
859
|
-
function useMenuContext() {
|
|
860
|
-
const context = useContext(MenuContext);
|
|
861
|
-
if (!context) {
|
|
862
|
-
throw new Error(
|
|
863
|
-
"Menu compound components must be used within a <Menu> provider."
|
|
864
|
-
);
|
|
865
|
-
}
|
|
866
|
-
return context;
|
|
867
|
-
}
|
|
868
|
-
function Menu({ children, ...options }) {
|
|
869
|
-
const menu = useMenu(options);
|
|
870
|
-
return /* @__PURE__ */ jsx(MenuContext.Provider, { value: menu, children });
|
|
871
|
-
}
|
|
872
|
-
function MenuTrigger({ children, style, ...rest }) {
|
|
873
|
-
const { getTriggerProps } = useMenuContext();
|
|
874
|
-
const propGetterReturn = getTriggerProps();
|
|
875
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
876
|
-
const handlePress = useCallback(() => {
|
|
877
|
-
propGetterReturn.onAction?.();
|
|
878
|
-
}, [propGetterReturn.onAction]);
|
|
879
|
-
return /* @__PURE__ */ jsx(
|
|
880
|
-
Pressable,
|
|
881
|
-
{
|
|
882
|
-
...rnAccessibility,
|
|
883
|
-
...rest,
|
|
884
|
-
onPress: handlePress,
|
|
885
|
-
style,
|
|
886
|
-
children
|
|
887
|
-
}
|
|
888
|
-
);
|
|
889
|
-
}
|
|
890
|
-
function MenuContent({ children, style, testID }) {
|
|
891
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
892
|
-
const { isOpen, getMenuProps } = useMenuContext();
|
|
893
|
-
const propGetterReturn = getMenuProps();
|
|
894
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
895
|
-
if (!isOpen) return null;
|
|
896
|
-
return /* @__PURE__ */ jsx(
|
|
897
|
-
View,
|
|
898
|
-
{
|
|
899
|
-
...rnAccessibility,
|
|
900
|
-
testID,
|
|
901
|
-
style: [
|
|
902
|
-
{
|
|
903
|
-
minWidth: 160,
|
|
904
|
-
padding: bt.entropixSpacing1,
|
|
905
|
-
backgroundColor: t.entropixColorBgPrimary,
|
|
906
|
-
borderWidth: 1,
|
|
907
|
-
borderColor: t.entropixColorBorderDefault,
|
|
908
|
-
borderRadius: bt.entropixRadiusMd,
|
|
909
|
-
shadowColor: "#000",
|
|
910
|
-
shadowOffset: { width: 0, height: 2 },
|
|
911
|
-
shadowOpacity: 0.1,
|
|
912
|
-
shadowRadius: 8,
|
|
913
|
-
elevation: 4
|
|
914
|
-
},
|
|
915
|
-
style
|
|
916
|
-
],
|
|
917
|
-
children
|
|
918
|
-
}
|
|
919
|
-
);
|
|
920
|
-
}
|
|
921
|
-
function wrapStringChildren(children, style) {
|
|
922
|
-
if (typeof children === "string" || typeof children === "number") {
|
|
923
|
-
return /* @__PURE__ */ jsx(Text, { style, children });
|
|
924
|
-
}
|
|
925
|
-
return children;
|
|
926
|
-
}
|
|
927
|
-
function MenuItem({
|
|
928
|
-
index,
|
|
929
|
-
onSelect,
|
|
930
|
-
disabled,
|
|
931
|
-
children,
|
|
932
|
-
style,
|
|
933
|
-
textStyle,
|
|
934
|
-
...rest
|
|
935
|
-
}) {
|
|
936
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
937
|
-
const { getItemProps } = useMenuContext();
|
|
938
|
-
const propGetterReturn = getItemProps(index, { onSelect, disabled });
|
|
939
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
940
|
-
const handlePress = useCallback(() => {
|
|
941
|
-
propGetterReturn.onAction?.();
|
|
942
|
-
}, [propGetterReturn.onAction]);
|
|
943
|
-
return /* @__PURE__ */ jsx(
|
|
944
|
-
Pressable,
|
|
945
|
-
{
|
|
946
|
-
...rnAccessibility,
|
|
947
|
-
...rest,
|
|
948
|
-
disabled,
|
|
949
|
-
onPress: propGetterReturn.onAction ? handlePress : void 0,
|
|
950
|
-
style: [
|
|
951
|
-
{
|
|
952
|
-
flexDirection: "row",
|
|
953
|
-
alignItems: "center",
|
|
954
|
-
paddingVertical: bt.entropixSpacing2,
|
|
955
|
-
paddingHorizontal: bt.entropixSpacing3,
|
|
956
|
-
borderRadius: bt.entropixRadiusSm,
|
|
957
|
-
opacity: disabled ? 0.5 : 1
|
|
958
|
-
},
|
|
959
|
-
style
|
|
960
|
-
],
|
|
961
|
-
children: wrapStringChildren(children, {
|
|
962
|
-
fontSize: bt.entropixFontSizeSm,
|
|
963
|
-
color: t.entropixColorTextPrimary,
|
|
964
|
-
...textStyle
|
|
965
|
-
})
|
|
966
|
-
}
|
|
967
|
-
);
|
|
968
|
-
}
|
|
969
|
-
var KEYBOARD_TYPE_MAP = {
|
|
970
|
-
text: "default",
|
|
971
|
-
email: "email-address",
|
|
972
|
-
password: "default",
|
|
973
|
-
number: "numeric",
|
|
974
|
-
tel: "phone-pad",
|
|
975
|
-
url: "url",
|
|
976
|
-
search: "default"
|
|
977
|
-
};
|
|
978
|
-
function Input({
|
|
979
|
-
value,
|
|
980
|
-
defaultValue,
|
|
981
|
-
onChange,
|
|
982
|
-
disabled,
|
|
983
|
-
readOnly,
|
|
984
|
-
required,
|
|
985
|
-
invalid,
|
|
986
|
-
label,
|
|
987
|
-
helperText,
|
|
988
|
-
errorMessage,
|
|
989
|
-
placeholder,
|
|
990
|
-
type = "text",
|
|
991
|
-
size = "md",
|
|
992
|
-
style,
|
|
993
|
-
inputStyle,
|
|
994
|
-
textStyle,
|
|
995
|
-
testID
|
|
996
|
-
}) {
|
|
997
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
998
|
-
const {
|
|
999
|
-
value: inputValue,
|
|
1000
|
-
isDisabled,
|
|
1001
|
-
isReadOnly,
|
|
1002
|
-
isInvalid,
|
|
1003
|
-
setValue,
|
|
1004
|
-
getInputProps
|
|
1005
|
-
} = useInput({
|
|
1006
|
-
value,
|
|
1007
|
-
defaultValue,
|
|
1008
|
-
onChange,
|
|
1009
|
-
disabled,
|
|
1010
|
-
readOnly,
|
|
1011
|
-
required,
|
|
1012
|
-
invalid,
|
|
1013
|
-
type,
|
|
1014
|
-
placeholder
|
|
1015
|
-
});
|
|
1016
|
-
const propGetterReturn = getInputProps();
|
|
1017
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
1018
|
-
const handleChangeText = useCallback(
|
|
1019
|
-
(text) => {
|
|
1020
|
-
setValue(text);
|
|
1021
|
-
},
|
|
1022
|
-
[setValue]
|
|
1023
|
-
);
|
|
1024
|
-
const sizeStyles = getSizeStyles(size, bt);
|
|
1025
|
-
const showError = isInvalid && errorMessage;
|
|
1026
|
-
return /* @__PURE__ */ jsxs(View, { style: [{ gap: bt.entropixSpacing1 }, style], children: [
|
|
1027
|
-
label ? /* @__PURE__ */ jsxs(
|
|
1028
|
-
Text,
|
|
1029
|
-
{
|
|
1030
|
-
style: [
|
|
1031
|
-
{
|
|
1032
|
-
fontSize: sizeStyles.labelFontSize,
|
|
1033
|
-
fontWeight: "500",
|
|
1034
|
-
color: t.entropixColorTextPrimary
|
|
1035
|
-
},
|
|
1036
|
-
textStyle
|
|
1037
|
-
],
|
|
1038
|
-
children: [
|
|
1039
|
-
label,
|
|
1040
|
-
required ? " *" : ""
|
|
1041
|
-
]
|
|
1042
|
-
}
|
|
1043
|
-
) : null,
|
|
1044
|
-
/* @__PURE__ */ jsx(
|
|
1045
|
-
TextInput,
|
|
1046
|
-
{
|
|
1047
|
-
...rnAccessibility,
|
|
1048
|
-
testID,
|
|
1049
|
-
value: inputValue,
|
|
1050
|
-
onChangeText: handleChangeText,
|
|
1051
|
-
placeholder,
|
|
1052
|
-
placeholderTextColor: t.entropixColorTextTertiary,
|
|
1053
|
-
editable: !isDisabled && !isReadOnly,
|
|
1054
|
-
secureTextEntry: type === "password",
|
|
1055
|
-
keyboardType: KEYBOARD_TYPE_MAP[type] ?? "default",
|
|
1056
|
-
style: [
|
|
1057
|
-
{
|
|
1058
|
-
paddingVertical: sizeStyles.paddingVertical,
|
|
1059
|
-
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
1060
|
-
fontSize: sizeStyles.fontSize,
|
|
1061
|
-
borderWidth: 1,
|
|
1062
|
-
borderColor: showError ? t.entropixColorBorderDanger : t.entropixColorBorderDefault,
|
|
1063
|
-
borderRadius: bt.entropixRadiusMd,
|
|
1064
|
-
backgroundColor: t.entropixColorBgPrimary,
|
|
1065
|
-
color: t.entropixColorTextPrimary
|
|
1066
|
-
},
|
|
1067
|
-
isDisabled && { opacity: 0.5 },
|
|
1068
|
-
inputStyle
|
|
1069
|
-
]
|
|
1070
|
-
}
|
|
1071
|
-
),
|
|
1072
|
-
showError ? /* @__PURE__ */ jsx(
|
|
1073
|
-
Text,
|
|
1074
|
-
{
|
|
1075
|
-
style: [
|
|
1076
|
-
{
|
|
1077
|
-
fontSize: sizeStyles.helperFontSize,
|
|
1078
|
-
color: t.entropixColorTextDanger
|
|
1079
|
-
},
|
|
1080
|
-
textStyle
|
|
1081
|
-
],
|
|
1082
|
-
accessibilityRole: "alert",
|
|
1083
|
-
accessibilityLiveRegion: "polite",
|
|
1084
|
-
children: errorMessage
|
|
1085
|
-
}
|
|
1086
|
-
) : helperText ? /* @__PURE__ */ jsx(
|
|
1087
|
-
Text,
|
|
1088
|
-
{
|
|
1089
|
-
style: [
|
|
1090
|
-
{
|
|
1091
|
-
fontSize: sizeStyles.helperFontSize,
|
|
1092
|
-
color: t.entropixColorTextSecondary
|
|
1093
|
-
},
|
|
1094
|
-
textStyle
|
|
1095
|
-
],
|
|
1096
|
-
children: helperText
|
|
1097
|
-
}
|
|
1098
|
-
) : null
|
|
1099
|
-
] });
|
|
1100
|
-
}
|
|
1101
|
-
function getSizeStyles(size, bt) {
|
|
1102
|
-
switch (size) {
|
|
1103
|
-
case "sm":
|
|
1104
|
-
return {
|
|
1105
|
-
paddingVertical: bt.entropixSpacing1,
|
|
1106
|
-
paddingHorizontal: bt.entropixSpacing2,
|
|
1107
|
-
fontSize: bt.entropixFontSizeXs,
|
|
1108
|
-
labelFontSize: bt.entropixFontSizeXs,
|
|
1109
|
-
helperFontSize: bt.entropixFontSizeXs - 1
|
|
1110
|
-
};
|
|
1111
|
-
case "lg":
|
|
1112
|
-
return {
|
|
1113
|
-
paddingVertical: bt.entropixSpacing3,
|
|
1114
|
-
paddingHorizontal: bt.entropixSpacing4,
|
|
1115
|
-
fontSize: bt.entropixFontSizeBase,
|
|
1116
|
-
labelFontSize: bt.entropixFontSizeBase,
|
|
1117
|
-
helperFontSize: bt.entropixFontSizeSm
|
|
1118
|
-
};
|
|
1119
|
-
default:
|
|
1120
|
-
return {
|
|
1121
|
-
paddingVertical: bt.entropixSpacing2,
|
|
1122
|
-
paddingHorizontal: bt.entropixSpacing3,
|
|
1123
|
-
fontSize: bt.entropixFontSizeSm,
|
|
1124
|
-
labelFontSize: bt.entropixFontSizeSm,
|
|
1125
|
-
helperFontSize: bt.entropixFontSizeXs
|
|
1126
|
-
};
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
function Textarea({
|
|
1130
|
-
value,
|
|
1131
|
-
defaultValue,
|
|
1132
|
-
onChange,
|
|
1133
|
-
disabled,
|
|
1134
|
-
readOnly,
|
|
1135
|
-
required,
|
|
1136
|
-
invalid,
|
|
1137
|
-
label,
|
|
1138
|
-
helperText,
|
|
1139
|
-
errorMessage,
|
|
1140
|
-
placeholder,
|
|
1141
|
-
numberOfLines = 4,
|
|
1142
|
-
size = "md",
|
|
1143
|
-
style,
|
|
1144
|
-
inputStyle,
|
|
1145
|
-
textStyle,
|
|
1146
|
-
testID
|
|
1147
|
-
}) {
|
|
1148
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
1149
|
-
const {
|
|
1150
|
-
value: inputValue,
|
|
1151
|
-
isDisabled,
|
|
1152
|
-
isReadOnly,
|
|
1153
|
-
isInvalid,
|
|
1154
|
-
setValue,
|
|
1155
|
-
getInputProps
|
|
1156
|
-
} = useInput({
|
|
1157
|
-
value,
|
|
1158
|
-
defaultValue,
|
|
1159
|
-
onChange,
|
|
1160
|
-
disabled,
|
|
1161
|
-
readOnly,
|
|
1162
|
-
required,
|
|
1163
|
-
invalid,
|
|
1164
|
-
type: "text",
|
|
1165
|
-
placeholder
|
|
1166
|
-
});
|
|
1167
|
-
const propGetterReturn = getInputProps();
|
|
1168
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
1169
|
-
const handleChangeText = useCallback(
|
|
1170
|
-
(text) => {
|
|
1171
|
-
setValue(text);
|
|
1172
|
-
},
|
|
1173
|
-
[setValue]
|
|
1174
|
-
);
|
|
1175
|
-
const sizeStyles = getSizeStyles2(size, bt);
|
|
1176
|
-
const showError = isInvalid && errorMessage;
|
|
1177
|
-
return /* @__PURE__ */ jsxs(View, { style: [{ gap: bt.entropixSpacing1 }, style], children: [
|
|
1178
|
-
label ? /* @__PURE__ */ jsxs(
|
|
1179
|
-
Text,
|
|
1180
|
-
{
|
|
1181
|
-
style: [
|
|
1182
|
-
{
|
|
1183
|
-
fontSize: sizeStyles.labelFontSize,
|
|
1184
|
-
fontWeight: "500",
|
|
1185
|
-
color: t.entropixColorTextPrimary
|
|
1186
|
-
},
|
|
1187
|
-
textStyle
|
|
1188
|
-
],
|
|
1189
|
-
children: [
|
|
1190
|
-
label,
|
|
1191
|
-
required ? " *" : ""
|
|
1192
|
-
]
|
|
1193
|
-
}
|
|
1194
|
-
) : null,
|
|
1195
|
-
/* @__PURE__ */ jsx(
|
|
1196
|
-
TextInput,
|
|
1197
|
-
{
|
|
1198
|
-
...rnAccessibility,
|
|
1199
|
-
testID,
|
|
1200
|
-
value: inputValue,
|
|
1201
|
-
onChangeText: handleChangeText,
|
|
1202
|
-
placeholder,
|
|
1203
|
-
placeholderTextColor: t.entropixColorTextTertiary,
|
|
1204
|
-
editable: !isDisabled && !isReadOnly,
|
|
1205
|
-
multiline: true,
|
|
1206
|
-
numberOfLines,
|
|
1207
|
-
textAlignVertical: "top",
|
|
1208
|
-
style: [
|
|
1209
|
-
{
|
|
1210
|
-
paddingVertical: sizeStyles.paddingVertical,
|
|
1211
|
-
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
1212
|
-
fontSize: sizeStyles.fontSize,
|
|
1213
|
-
borderWidth: 1,
|
|
1214
|
-
borderColor: showError ? t.entropixColorBorderDanger : t.entropixColorBorderDefault,
|
|
1215
|
-
borderRadius: bt.entropixRadiusMd,
|
|
1216
|
-
backgroundColor: t.entropixColorBgPrimary,
|
|
1217
|
-
color: t.entropixColorTextPrimary,
|
|
1218
|
-
minHeight: numberOfLines * (sizeStyles.fontSize + 8)
|
|
1219
|
-
},
|
|
1220
|
-
isDisabled && { opacity: 0.5 },
|
|
1221
|
-
inputStyle
|
|
1222
|
-
]
|
|
1223
|
-
}
|
|
1224
|
-
),
|
|
1225
|
-
showError ? /* @__PURE__ */ jsx(
|
|
1226
|
-
Text,
|
|
1227
|
-
{
|
|
1228
|
-
style: [
|
|
1229
|
-
{
|
|
1230
|
-
fontSize: sizeStyles.helperFontSize,
|
|
1231
|
-
color: t.entropixColorTextDanger
|
|
1232
|
-
},
|
|
1233
|
-
textStyle
|
|
1234
|
-
],
|
|
1235
|
-
accessibilityRole: "alert",
|
|
1236
|
-
accessibilityLiveRegion: "polite",
|
|
1237
|
-
children: errorMessage
|
|
1238
|
-
}
|
|
1239
|
-
) : helperText ? /* @__PURE__ */ jsx(
|
|
1240
|
-
Text,
|
|
1241
|
-
{
|
|
1242
|
-
style: [
|
|
1243
|
-
{
|
|
1244
|
-
fontSize: sizeStyles.helperFontSize,
|
|
1245
|
-
color: t.entropixColorTextSecondary
|
|
1246
|
-
},
|
|
1247
|
-
textStyle
|
|
1248
|
-
],
|
|
1249
|
-
children: helperText
|
|
1250
|
-
}
|
|
1251
|
-
) : null
|
|
1252
|
-
] });
|
|
1253
|
-
}
|
|
1254
|
-
function getSizeStyles2(size, bt) {
|
|
1255
|
-
switch (size) {
|
|
1256
|
-
case "sm":
|
|
1257
|
-
return {
|
|
1258
|
-
paddingVertical: bt.entropixSpacing1,
|
|
1259
|
-
paddingHorizontal: bt.entropixSpacing2,
|
|
1260
|
-
fontSize: bt.entropixFontSizeXs,
|
|
1261
|
-
labelFontSize: bt.entropixFontSizeXs,
|
|
1262
|
-
helperFontSize: bt.entropixFontSizeXs - 1
|
|
1263
|
-
};
|
|
1264
|
-
case "lg":
|
|
1265
|
-
return {
|
|
1266
|
-
paddingVertical: bt.entropixSpacing3,
|
|
1267
|
-
paddingHorizontal: bt.entropixSpacing4,
|
|
1268
|
-
fontSize: bt.entropixFontSizeBase,
|
|
1269
|
-
labelFontSize: bt.entropixFontSizeBase,
|
|
1270
|
-
helperFontSize: bt.entropixFontSizeSm
|
|
1271
|
-
};
|
|
1272
|
-
default:
|
|
1273
|
-
return {
|
|
1274
|
-
paddingVertical: bt.entropixSpacing2,
|
|
1275
|
-
paddingHorizontal: bt.entropixSpacing3,
|
|
1276
|
-
fontSize: bt.entropixFontSizeSm,
|
|
1277
|
-
labelFontSize: bt.entropixFontSizeSm,
|
|
1278
|
-
helperFontSize: bt.entropixFontSizeXs
|
|
1279
|
-
};
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
function Checkbox({
|
|
1283
|
-
checked,
|
|
1284
|
-
defaultChecked,
|
|
1285
|
-
onChange,
|
|
1286
|
-
disabled,
|
|
1287
|
-
indeterminate,
|
|
1288
|
-
label,
|
|
1289
|
-
size = "md",
|
|
1290
|
-
style,
|
|
1291
|
-
textStyle,
|
|
1292
|
-
children,
|
|
1293
|
-
...rest
|
|
1294
|
-
}) {
|
|
1295
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
1296
|
-
const { isChecked, isDisabled, getToggleProps } = useToggle({
|
|
1297
|
-
checked,
|
|
1298
|
-
defaultChecked,
|
|
1299
|
-
onChange,
|
|
1300
|
-
disabled,
|
|
1301
|
-
role: "checkbox"
|
|
1302
|
-
});
|
|
1303
|
-
const propGetterReturn = getToggleProps();
|
|
1304
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
1305
|
-
if (indeterminate) {
|
|
1306
|
-
rnAccessibility.accessibilityState = {
|
|
1307
|
-
...rnAccessibility.accessibilityState,
|
|
1308
|
-
checked: "mixed"
|
|
1309
|
-
};
|
|
1310
|
-
}
|
|
1311
|
-
if (label) {
|
|
1312
|
-
rnAccessibility.accessibilityLabel = label;
|
|
1313
|
-
}
|
|
1314
|
-
const handlePress = useCallback(() => {
|
|
1315
|
-
propGetterReturn.onAction?.();
|
|
1316
|
-
}, [propGetterReturn.onAction]);
|
|
1317
|
-
const sizeStyles = getSizeStyles3(size, bt);
|
|
1318
|
-
const isActive = indeterminate || isChecked;
|
|
1319
|
-
return /* @__PURE__ */ jsxs(
|
|
1320
|
-
Pressable,
|
|
1321
|
-
{
|
|
1322
|
-
...rnAccessibility,
|
|
1323
|
-
...rest,
|
|
1324
|
-
disabled: isDisabled,
|
|
1325
|
-
onPress: isDisabled ? void 0 : handlePress,
|
|
1326
|
-
style: [
|
|
1327
|
-
{
|
|
1328
|
-
flexDirection: "row",
|
|
1329
|
-
alignItems: "center",
|
|
1330
|
-
gap: bt.entropixSpacing2
|
|
1331
|
-
},
|
|
1332
|
-
isDisabled && { opacity: 0.5 },
|
|
1333
|
-
style
|
|
1334
|
-
],
|
|
1335
|
-
children: [
|
|
1336
|
-
/* @__PURE__ */ jsx(
|
|
1337
|
-
View,
|
|
1338
|
-
{
|
|
1339
|
-
style: {
|
|
1340
|
-
width: sizeStyles.boxSize,
|
|
1341
|
-
height: sizeStyles.boxSize,
|
|
1342
|
-
borderWidth: 2,
|
|
1343
|
-
borderColor: isActive ? t.entropixColorActionPrimaryDefault : t.entropixColorBorderDefault,
|
|
1344
|
-
borderRadius: bt.entropixRadiusSm,
|
|
1345
|
-
backgroundColor: isActive ? t.entropixColorActionPrimaryDefault : "transparent",
|
|
1346
|
-
alignItems: "center",
|
|
1347
|
-
justifyContent: "center"
|
|
1348
|
-
},
|
|
1349
|
-
children: indeterminate ? /* @__PURE__ */ jsx(
|
|
1350
|
-
Text,
|
|
1351
|
-
{
|
|
1352
|
-
style: {
|
|
1353
|
-
fontSize: sizeStyles.indicatorFontSize,
|
|
1354
|
-
fontWeight: "700",
|
|
1355
|
-
color: t.entropixColorTextInverse,
|
|
1356
|
-
lineHeight: sizeStyles.boxSize - 2
|
|
1357
|
-
},
|
|
1358
|
-
children: "\u2013"
|
|
1359
|
-
}
|
|
1360
|
-
) : isChecked ? /* @__PURE__ */ jsx(
|
|
1361
|
-
Text,
|
|
1362
|
-
{
|
|
1363
|
-
style: {
|
|
1364
|
-
fontSize: sizeStyles.indicatorFontSize,
|
|
1365
|
-
fontWeight: "700",
|
|
1366
|
-
color: t.entropixColorTextInverse,
|
|
1367
|
-
lineHeight: sizeStyles.boxSize - 2
|
|
1368
|
-
},
|
|
1369
|
-
children: "\u2713"
|
|
1370
|
-
}
|
|
1371
|
-
) : null
|
|
1372
|
-
}
|
|
1373
|
-
),
|
|
1374
|
-
typeof children === "string" ? /* @__PURE__ */ jsx(
|
|
1375
|
-
Text,
|
|
1376
|
-
{
|
|
1377
|
-
style: [
|
|
1378
|
-
{
|
|
1379
|
-
fontSize: sizeStyles.fontSize,
|
|
1380
|
-
color: t.entropixColorTextPrimary
|
|
1381
|
-
},
|
|
1382
|
-
textStyle
|
|
1383
|
-
],
|
|
1384
|
-
children
|
|
1385
|
-
}
|
|
1386
|
-
) : children != null ? children : label ? /* @__PURE__ */ jsx(
|
|
1387
|
-
Text,
|
|
1388
|
-
{
|
|
1389
|
-
style: [
|
|
1390
|
-
{
|
|
1391
|
-
fontSize: sizeStyles.fontSize,
|
|
1392
|
-
color: t.entropixColorTextPrimary
|
|
1393
|
-
},
|
|
1394
|
-
textStyle
|
|
1395
|
-
],
|
|
1396
|
-
children: label
|
|
1397
|
-
}
|
|
1398
|
-
) : null
|
|
1399
|
-
]
|
|
1400
|
-
}
|
|
1401
|
-
);
|
|
1402
|
-
}
|
|
1403
|
-
function getSizeStyles3(size, bt) {
|
|
1404
|
-
switch (size) {
|
|
1405
|
-
case "sm":
|
|
1406
|
-
return {
|
|
1407
|
-
boxSize: 16,
|
|
1408
|
-
indicatorFontSize: 10,
|
|
1409
|
-
fontSize: bt.entropixFontSizeXs
|
|
1410
|
-
};
|
|
1411
|
-
case "lg":
|
|
1412
|
-
return {
|
|
1413
|
-
boxSize: 24,
|
|
1414
|
-
indicatorFontSize: 16,
|
|
1415
|
-
fontSize: bt.entropixFontSizeBase
|
|
1416
|
-
};
|
|
1417
|
-
default:
|
|
1418
|
-
return {
|
|
1419
|
-
boxSize: 20,
|
|
1420
|
-
indicatorFontSize: 13,
|
|
1421
|
-
fontSize: bt.entropixFontSizeSm
|
|
1422
|
-
};
|
|
1423
|
-
}
|
|
1424
|
-
}
|
|
1425
|
-
var RadioGroupContext = createContext(null);
|
|
1426
|
-
function useRadioGroupContext() {
|
|
1427
|
-
const context = useContext(RadioGroupContext);
|
|
1428
|
-
if (!context) {
|
|
1429
|
-
throw new Error(
|
|
1430
|
-
"Radio compound components must be used within a <RadioGroup> provider."
|
|
1431
|
-
);
|
|
1432
|
-
}
|
|
1433
|
-
return context;
|
|
1434
|
-
}
|
|
1435
|
-
function RadioGroup({
|
|
1436
|
-
label,
|
|
1437
|
-
style,
|
|
1438
|
-
textStyle,
|
|
1439
|
-
children,
|
|
1440
|
-
testID,
|
|
1441
|
-
...options
|
|
1442
|
-
}) {
|
|
1443
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
1444
|
-
const radioGroup = useRadioGroup(options);
|
|
1445
|
-
const propGetterReturn = radioGroup.getRadioGroupProps();
|
|
1446
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
1447
|
-
if (label) {
|
|
1448
|
-
rnAccessibility.accessibilityLabel = label;
|
|
1449
|
-
}
|
|
1450
|
-
return /* @__PURE__ */ jsx(RadioGroupContext.Provider, { value: radioGroup, children: /* @__PURE__ */ jsxs(
|
|
1451
|
-
View,
|
|
1452
|
-
{
|
|
1453
|
-
...rnAccessibility,
|
|
1454
|
-
testID,
|
|
1455
|
-
style: [
|
|
1456
|
-
{
|
|
1457
|
-
gap: bt.entropixSpacing2
|
|
1458
|
-
},
|
|
1459
|
-
style
|
|
1460
|
-
],
|
|
1461
|
-
children: [
|
|
1462
|
-
label ? /* @__PURE__ */ jsx(
|
|
1463
|
-
Text,
|
|
1464
|
-
{
|
|
1465
|
-
style: [
|
|
1466
|
-
{
|
|
1467
|
-
fontSize: bt.entropixFontSizeSm,
|
|
1468
|
-
fontWeight: "500",
|
|
1469
|
-
color: t.entropixColorTextPrimary
|
|
1470
|
-
},
|
|
1471
|
-
textStyle
|
|
1472
|
-
],
|
|
1473
|
-
children: label
|
|
1474
|
-
}
|
|
1475
|
-
) : null,
|
|
1476
|
-
children
|
|
1477
|
-
]
|
|
1478
|
-
}
|
|
1479
|
-
) });
|
|
1480
|
-
}
|
|
1481
|
-
function RadioItem({
|
|
1482
|
-
value,
|
|
1483
|
-
disabled,
|
|
1484
|
-
style,
|
|
1485
|
-
textStyle,
|
|
1486
|
-
children,
|
|
1487
|
-
...rest
|
|
1488
|
-
}) {
|
|
1489
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
1490
|
-
const { getRadioProps } = useRadioGroupContext();
|
|
1491
|
-
const propGetterReturn = getRadioProps(value, { disabled });
|
|
1492
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
1493
|
-
const isChecked = propGetterReturn.accessibility.checked === true;
|
|
1494
|
-
const isDisabled = propGetterReturn.accessibility.disabled === true;
|
|
1495
|
-
const handlePress = useCallback(() => {
|
|
1496
|
-
propGetterReturn.onAction?.();
|
|
1497
|
-
}, [propGetterReturn.onAction]);
|
|
1498
|
-
return /* @__PURE__ */ jsxs(
|
|
1499
|
-
Pressable,
|
|
1500
|
-
{
|
|
1501
|
-
...rnAccessibility,
|
|
1502
|
-
...rest,
|
|
1503
|
-
disabled: isDisabled,
|
|
1504
|
-
onPress: isDisabled ? void 0 : handlePress,
|
|
1505
|
-
style: [
|
|
1506
|
-
{
|
|
1507
|
-
flexDirection: "row",
|
|
1508
|
-
alignItems: "center",
|
|
1509
|
-
gap: bt.entropixSpacing2
|
|
1510
|
-
},
|
|
1511
|
-
isDisabled && { opacity: 0.5 },
|
|
1512
|
-
style
|
|
1513
|
-
],
|
|
1514
|
-
children: [
|
|
1515
|
-
/* @__PURE__ */ jsx(
|
|
1516
|
-
View,
|
|
1517
|
-
{
|
|
1518
|
-
style: {
|
|
1519
|
-
width: 20,
|
|
1520
|
-
height: 20,
|
|
1521
|
-
borderRadius: 10,
|
|
1522
|
-
borderWidth: 2,
|
|
1523
|
-
borderColor: isChecked ? t.entropixColorActionPrimaryDefault : t.entropixColorBorderDefault,
|
|
1524
|
-
alignItems: "center",
|
|
1525
|
-
justifyContent: "center"
|
|
1526
|
-
},
|
|
1527
|
-
children: isChecked ? /* @__PURE__ */ jsx(
|
|
1528
|
-
View,
|
|
1529
|
-
{
|
|
1530
|
-
style: {
|
|
1531
|
-
width: 10,
|
|
1532
|
-
height: 10,
|
|
1533
|
-
borderRadius: 5,
|
|
1534
|
-
backgroundColor: t.entropixColorActionPrimaryDefault
|
|
1535
|
-
}
|
|
1536
|
-
}
|
|
1537
|
-
) : null
|
|
1538
|
-
}
|
|
1539
|
-
),
|
|
1540
|
-
typeof children === "string" ? /* @__PURE__ */ jsx(
|
|
1541
|
-
Text,
|
|
1542
|
-
{
|
|
1543
|
-
style: [
|
|
1544
|
-
{
|
|
1545
|
-
fontSize: bt.entropixFontSizeSm,
|
|
1546
|
-
color: t.entropixColorTextPrimary
|
|
1547
|
-
},
|
|
1548
|
-
textStyle
|
|
1549
|
-
],
|
|
1550
|
-
children
|
|
1551
|
-
}
|
|
1552
|
-
) : children
|
|
1553
|
-
]
|
|
1554
|
-
}
|
|
1555
|
-
);
|
|
1556
|
-
}
|
|
1557
|
-
var SelectContext = createContext(null);
|
|
1558
|
-
function useSelectContext() {
|
|
1559
|
-
const context = useContext(SelectContext);
|
|
1560
|
-
if (!context) {
|
|
1561
|
-
throw new Error(
|
|
1562
|
-
"Select compound components must be used within a <Select> provider."
|
|
1563
|
-
);
|
|
1564
|
-
}
|
|
1565
|
-
return context;
|
|
1566
|
-
}
|
|
1567
|
-
function Select({
|
|
1568
|
-
label,
|
|
1569
|
-
style,
|
|
1570
|
-
textStyle,
|
|
1571
|
-
children,
|
|
1572
|
-
testID,
|
|
1573
|
-
...options
|
|
1574
|
-
}) {
|
|
1575
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
1576
|
-
const select = useSelect(options);
|
|
1577
|
-
return /* @__PURE__ */ jsx(SelectContext.Provider, { value: select, children: /* @__PURE__ */ jsxs(
|
|
1578
|
-
View,
|
|
1579
|
-
{
|
|
1580
|
-
testID,
|
|
1581
|
-
style: [{ gap: bt.entropixSpacing1 }, style],
|
|
1582
|
-
children: [
|
|
1583
|
-
label ? /* @__PURE__ */ jsx(
|
|
1584
|
-
Text,
|
|
1585
|
-
{
|
|
1586
|
-
style: [
|
|
1587
|
-
{
|
|
1588
|
-
fontSize: bt.entropixFontSizeSm,
|
|
1589
|
-
fontWeight: "500",
|
|
1590
|
-
color: t.entropixColorTextPrimary
|
|
1591
|
-
},
|
|
1592
|
-
textStyle
|
|
1593
|
-
],
|
|
1594
|
-
children: label
|
|
1595
|
-
}
|
|
1596
|
-
) : null,
|
|
1597
|
-
children
|
|
1598
|
-
]
|
|
1599
|
-
}
|
|
1600
|
-
) });
|
|
1601
|
-
}
|
|
1602
|
-
function SelectTrigger({
|
|
1603
|
-
placeholder = "Select...",
|
|
1604
|
-
displayValue,
|
|
1605
|
-
style,
|
|
1606
|
-
textStyle,
|
|
1607
|
-
...rest
|
|
1608
|
-
}) {
|
|
1609
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
1610
|
-
const { selectedValue, isDisabled, isOpen, getTriggerProps } = useSelectContext();
|
|
1611
|
-
const propGetterReturn = getTriggerProps();
|
|
1612
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
1613
|
-
const handlePress = useCallback(() => {
|
|
1614
|
-
propGetterReturn.onAction?.();
|
|
1615
|
-
}, [propGetterReturn.onAction]);
|
|
1616
|
-
const hasValue = selectedValue !== "";
|
|
1617
|
-
const label = displayValue ?? (hasValue ? selectedValue : placeholder);
|
|
1618
|
-
return /* @__PURE__ */ jsxs(
|
|
1619
|
-
Pressable,
|
|
1620
|
-
{
|
|
1621
|
-
...rnAccessibility,
|
|
1622
|
-
...rest,
|
|
1623
|
-
disabled: isDisabled,
|
|
1624
|
-
onPress: isDisabled ? void 0 : handlePress,
|
|
1625
|
-
style: [
|
|
1626
|
-
{
|
|
1627
|
-
flexDirection: "row",
|
|
1628
|
-
alignItems: "center",
|
|
1629
|
-
justifyContent: "space-between",
|
|
1630
|
-
paddingVertical: bt.entropixSpacing2,
|
|
1631
|
-
paddingHorizontal: bt.entropixSpacing3,
|
|
1632
|
-
borderWidth: 1,
|
|
1633
|
-
borderColor: isOpen ? t.entropixColorActionPrimaryDefault : t.entropixColorBorderDefault,
|
|
1634
|
-
borderRadius: bt.entropixRadiusMd,
|
|
1635
|
-
backgroundColor: t.entropixColorBgPrimary
|
|
1636
|
-
},
|
|
1637
|
-
isDisabled && { opacity: 0.5 },
|
|
1638
|
-
style
|
|
1639
|
-
],
|
|
1640
|
-
children: [
|
|
1641
|
-
/* @__PURE__ */ jsx(
|
|
1642
|
-
Text,
|
|
1643
|
-
{
|
|
1644
|
-
style: [
|
|
1645
|
-
{
|
|
1646
|
-
fontSize: bt.entropixFontSizeSm,
|
|
1647
|
-
color: hasValue ? t.entropixColorTextPrimary : t.entropixColorTextTertiary,
|
|
1648
|
-
flex: 1
|
|
1649
|
-
},
|
|
1650
|
-
textStyle
|
|
1651
|
-
],
|
|
1652
|
-
numberOfLines: 1,
|
|
1653
|
-
children: label
|
|
1654
|
-
}
|
|
1655
|
-
),
|
|
1656
|
-
/* @__PURE__ */ jsx(
|
|
1657
|
-
Text,
|
|
1658
|
-
{
|
|
1659
|
-
style: {
|
|
1660
|
-
fontSize: bt.entropixFontSizeXs,
|
|
1661
|
-
color: t.entropixColorTextSecondary,
|
|
1662
|
-
marginLeft: bt.entropixSpacing2
|
|
1663
|
-
},
|
|
1664
|
-
children: "\u25BC"
|
|
1665
|
-
}
|
|
1666
|
-
)
|
|
1667
|
-
]
|
|
1668
|
-
}
|
|
1669
|
-
);
|
|
1670
|
-
}
|
|
1671
|
-
function SelectContent({ children, style, testID }) {
|
|
1672
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
1673
|
-
const { isOpen, close, getListboxProps } = useSelectContext();
|
|
1674
|
-
const propGetterReturn = getListboxProps();
|
|
1675
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
1676
|
-
if (!isOpen) return null;
|
|
1677
|
-
return /* @__PURE__ */ jsx(
|
|
1678
|
-
Modal,
|
|
1679
|
-
{
|
|
1680
|
-
visible: isOpen,
|
|
1681
|
-
transparent: true,
|
|
1682
|
-
animationType: "fade",
|
|
1683
|
-
onRequestClose: close,
|
|
1684
|
-
children: /* @__PURE__ */ jsx(
|
|
1685
|
-
Pressable,
|
|
1686
|
-
{
|
|
1687
|
-
style: {
|
|
1688
|
-
flex: 1,
|
|
1689
|
-
justifyContent: "center",
|
|
1690
|
-
alignItems: "center",
|
|
1691
|
-
backgroundColor: "rgba(0,0,0,0.3)"
|
|
1692
|
-
},
|
|
1693
|
-
onPress: close,
|
|
1694
|
-
children: /* @__PURE__ */ jsx(
|
|
1695
|
-
Pressable,
|
|
1696
|
-
{
|
|
1697
|
-
onPress: () => {
|
|
1698
|
-
},
|
|
1699
|
-
children: /* @__PURE__ */ jsx(
|
|
1700
|
-
View,
|
|
1701
|
-
{
|
|
1702
|
-
...rnAccessibility,
|
|
1703
|
-
testID,
|
|
1704
|
-
style: [
|
|
1705
|
-
{
|
|
1706
|
-
minWidth: 240,
|
|
1707
|
-
maxHeight: 300,
|
|
1708
|
-
padding: bt.entropixSpacing1,
|
|
1709
|
-
backgroundColor: t.entropixColorBgPrimary,
|
|
1710
|
-
borderWidth: 1,
|
|
1711
|
-
borderColor: t.entropixColorBorderDefault,
|
|
1712
|
-
borderRadius: bt.entropixRadiusMd,
|
|
1713
|
-
shadowColor: "#000",
|
|
1714
|
-
shadowOffset: { width: 0, height: 4 },
|
|
1715
|
-
shadowOpacity: 0.15,
|
|
1716
|
-
shadowRadius: 12,
|
|
1717
|
-
elevation: 8
|
|
1718
|
-
},
|
|
1719
|
-
style
|
|
1720
|
-
],
|
|
1721
|
-
children
|
|
1722
|
-
}
|
|
1723
|
-
)
|
|
1724
|
-
}
|
|
1725
|
-
)
|
|
1726
|
-
}
|
|
1727
|
-
)
|
|
1728
|
-
}
|
|
1729
|
-
);
|
|
1730
|
-
}
|
|
1731
|
-
function SelectOption({
|
|
1732
|
-
value,
|
|
1733
|
-
index,
|
|
1734
|
-
disabled,
|
|
1735
|
-
style,
|
|
1736
|
-
textStyle,
|
|
1737
|
-
children,
|
|
1738
|
-
...rest
|
|
1739
|
-
}) {
|
|
1740
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
1741
|
-
const { getOptionProps } = useSelectContext();
|
|
1742
|
-
const propGetterReturn = getOptionProps(value, index ?? 0, { disabled });
|
|
1743
|
-
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
1744
|
-
const isSelected = propGetterReturn.accessibility.selected === true;
|
|
1745
|
-
const handlePress = useCallback(() => {
|
|
1746
|
-
propGetterReturn.onAction?.();
|
|
1747
|
-
}, [propGetterReturn.onAction]);
|
|
1748
|
-
return /* @__PURE__ */ jsx(
|
|
1749
|
-
Pressable,
|
|
1750
|
-
{
|
|
1751
|
-
...rnAccessibility,
|
|
1752
|
-
...rest,
|
|
1753
|
-
disabled,
|
|
1754
|
-
onPress: propGetterReturn.onAction ? handlePress : void 0,
|
|
1755
|
-
style: [
|
|
1756
|
-
{
|
|
1757
|
-
flexDirection: "row",
|
|
1758
|
-
alignItems: "center",
|
|
1759
|
-
paddingVertical: bt.entropixSpacing2,
|
|
1760
|
-
paddingHorizontal: bt.entropixSpacing3,
|
|
1761
|
-
borderRadius: bt.entropixRadiusSm,
|
|
1762
|
-
backgroundColor: isSelected ? t.entropixColorBgSecondary : "transparent"
|
|
1763
|
-
},
|
|
1764
|
-
disabled && { opacity: 0.5 },
|
|
1765
|
-
style
|
|
1766
|
-
],
|
|
1767
|
-
children: typeof children === "string" ? /* @__PURE__ */ jsx(
|
|
1768
|
-
Text,
|
|
1769
|
-
{
|
|
1770
|
-
style: [
|
|
1771
|
-
{
|
|
1772
|
-
fontSize: bt.entropixFontSizeSm,
|
|
1773
|
-
fontWeight: isSelected ? "600" : "400",
|
|
1774
|
-
color: t.entropixColorTextPrimary
|
|
1775
|
-
},
|
|
1776
|
-
textStyle
|
|
1777
|
-
],
|
|
1778
|
-
children
|
|
1779
|
-
}
|
|
1780
|
-
) : children
|
|
1781
|
-
}
|
|
1782
|
-
);
|
|
1783
|
-
}
|
|
1784
|
-
var BREAKPOINTS = {
|
|
1785
|
-
sm: 640,
|
|
1786
|
-
md: 768,
|
|
1787
|
-
lg: 1024,
|
|
1788
|
-
xl: 1280,
|
|
1789
|
-
"2xl": 1536
|
|
1790
|
-
};
|
|
1791
|
-
var BREAKPOINT_ORDER = ["base", "sm", "md", "lg", "xl", "2xl"];
|
|
1792
|
-
function useBreakpoint() {
|
|
1793
|
-
const getBreakpoint = useCallback(() => {
|
|
1794
|
-
const { width } = Dimensions.get("window");
|
|
1795
|
-
if (width >= BREAKPOINTS["2xl"]) return "2xl";
|
|
1796
|
-
if (width >= BREAKPOINTS.xl) return "xl";
|
|
1797
|
-
if (width >= BREAKPOINTS.lg) return "lg";
|
|
1798
|
-
if (width >= BREAKPOINTS.md) return "md";
|
|
1799
|
-
if (width >= BREAKPOINTS.sm) return "sm";
|
|
1800
|
-
return "base";
|
|
1801
|
-
}, []);
|
|
1802
|
-
const [breakpoint, setBreakpoint] = useState(getBreakpoint);
|
|
1803
|
-
useEffect(() => {
|
|
1804
|
-
const subscription = Dimensions.addEventListener("change", ({ window }) => {
|
|
1805
|
-
const width = window.width;
|
|
1806
|
-
let next = "base";
|
|
1807
|
-
if (width >= BREAKPOINTS["2xl"]) next = "2xl";
|
|
1808
|
-
else if (width >= BREAKPOINTS.xl) next = "xl";
|
|
1809
|
-
else if (width >= BREAKPOINTS.lg) next = "lg";
|
|
1810
|
-
else if (width >= BREAKPOINTS.md) next = "md";
|
|
1811
|
-
else if (width >= BREAKPOINTS.sm) next = "sm";
|
|
1812
|
-
setBreakpoint((prev) => prev !== next ? next : prev);
|
|
1813
|
-
});
|
|
1814
|
-
return () => subscription.remove();
|
|
1815
|
-
}, []);
|
|
1816
|
-
return breakpoint;
|
|
1817
|
-
}
|
|
1818
|
-
function useBreakpointValue(breakpoint) {
|
|
1819
|
-
const current = useBreakpoint();
|
|
1820
|
-
const currentIndex = BREAKPOINT_ORDER.indexOf(current);
|
|
1821
|
-
const targetIndex = BREAKPOINT_ORDER.indexOf(breakpoint);
|
|
1822
|
-
return currentIndex >= targetIndex;
|
|
1823
|
-
}
|
|
1824
|
-
function useScreenDimensions() {
|
|
1825
|
-
const [dimensions, setDimensions] = useState(() => Dimensions.get("window"));
|
|
1826
|
-
useEffect(() => {
|
|
1827
|
-
const subscription = Dimensions.addEventListener("change", ({ window }) => {
|
|
1828
|
-
setDimensions(window);
|
|
1829
|
-
});
|
|
1830
|
-
return () => subscription.remove();
|
|
1831
|
-
}, []);
|
|
1832
|
-
return { width: dimensions.width, height: dimensions.height };
|
|
1833
|
-
}
|
|
1834
|
-
function Stack({
|
|
1835
|
-
gap,
|
|
1836
|
-
align,
|
|
1837
|
-
fullWidth,
|
|
1838
|
-
style,
|
|
1839
|
-
children,
|
|
1840
|
-
...rest
|
|
1841
|
-
}) {
|
|
1842
|
-
const { baseTokens: bt } = useTheme();
|
|
1843
|
-
const gapValue = getGapValue(gap, bt);
|
|
1844
|
-
const alignMap = {
|
|
1845
|
-
start: "flex-start",
|
|
1846
|
-
center: "center",
|
|
1847
|
-
end: "flex-end",
|
|
1848
|
-
stretch: "stretch"
|
|
1849
|
-
};
|
|
1850
|
-
return /* @__PURE__ */ jsx(
|
|
1851
|
-
View,
|
|
1852
|
-
{
|
|
1853
|
-
style: [
|
|
1854
|
-
{ flexDirection: "column" },
|
|
1855
|
-
gapValue !== void 0 && { gap: gapValue },
|
|
1856
|
-
gapValue === void 0 && { gap: bt.entropixSpaceLayoutStack },
|
|
1857
|
-
align && { alignItems: alignMap[align] },
|
|
1858
|
-
fullWidth && { width: "100%" },
|
|
1859
|
-
style
|
|
1860
|
-
],
|
|
1861
|
-
...rest,
|
|
1862
|
-
children
|
|
1863
|
-
}
|
|
1864
|
-
);
|
|
1865
|
-
}
|
|
1866
|
-
function getGapValue(gap, bt) {
|
|
1867
|
-
if (!gap) return void 0;
|
|
1868
|
-
switch (gap) {
|
|
1869
|
-
case "none":
|
|
1870
|
-
return 0;
|
|
1871
|
-
case "xs":
|
|
1872
|
-
return bt.entropixSpacing1;
|
|
1873
|
-
case "sm":
|
|
1874
|
-
return bt.entropixSpacing2;
|
|
1875
|
-
case "md":
|
|
1876
|
-
return bt.entropixSpacing4;
|
|
1877
|
-
case "lg":
|
|
1878
|
-
return bt.entropixSpacing6;
|
|
1879
|
-
case "xl":
|
|
1880
|
-
return bt.entropixSpacing8;
|
|
1881
|
-
case "2xl":
|
|
1882
|
-
return bt.entropixSpacing12;
|
|
1883
|
-
}
|
|
1884
|
-
}
|
|
1885
|
-
function Inline({
|
|
1886
|
-
gap,
|
|
1887
|
-
align,
|
|
1888
|
-
justify,
|
|
1889
|
-
wrap,
|
|
1890
|
-
style,
|
|
1891
|
-
children,
|
|
1892
|
-
...rest
|
|
1893
|
-
}) {
|
|
1894
|
-
const { baseTokens: bt } = useTheme();
|
|
1895
|
-
const gapValue = getGapValue2(gap, bt);
|
|
1896
|
-
const alignMap = {
|
|
1897
|
-
start: "flex-start",
|
|
1898
|
-
center: "center",
|
|
1899
|
-
end: "flex-end",
|
|
1900
|
-
stretch: "stretch",
|
|
1901
|
-
baseline: "baseline"
|
|
1902
|
-
};
|
|
1903
|
-
const justifyMap = {
|
|
1904
|
-
start: "flex-start",
|
|
1905
|
-
center: "center",
|
|
1906
|
-
end: "flex-end",
|
|
1907
|
-
between: "space-between",
|
|
1908
|
-
around: "space-around"
|
|
1909
|
-
};
|
|
1910
|
-
return /* @__PURE__ */ jsx(
|
|
1911
|
-
View,
|
|
1912
|
-
{
|
|
1913
|
-
style: [
|
|
1914
|
-
{
|
|
1915
|
-
flexDirection: "row",
|
|
1916
|
-
alignItems: "center"
|
|
1917
|
-
},
|
|
1918
|
-
gapValue !== void 0 && { gap: gapValue },
|
|
1919
|
-
gapValue === void 0 && { gap: bt.entropixSpaceLayoutInline },
|
|
1920
|
-
align && { alignItems: alignMap[align] },
|
|
1921
|
-
justify && { justifyContent: justifyMap[justify] },
|
|
1922
|
-
wrap && { flexWrap: "wrap" },
|
|
1923
|
-
style
|
|
1924
|
-
],
|
|
1925
|
-
...rest,
|
|
1926
|
-
children
|
|
1927
|
-
}
|
|
1928
|
-
);
|
|
1929
|
-
}
|
|
1930
|
-
function getGapValue2(gap, bt) {
|
|
1931
|
-
if (!gap) return void 0;
|
|
1932
|
-
switch (gap) {
|
|
1933
|
-
case "none":
|
|
1934
|
-
return 0;
|
|
1935
|
-
case "xs":
|
|
1936
|
-
return bt.entropixSpacing1;
|
|
1937
|
-
case "sm":
|
|
1938
|
-
return bt.entropixSpacing2;
|
|
1939
|
-
case "md":
|
|
1940
|
-
return bt.entropixSpacing4;
|
|
1941
|
-
case "lg":
|
|
1942
|
-
return bt.entropixSpacing6;
|
|
1943
|
-
case "xl":
|
|
1944
|
-
return bt.entropixSpacing8;
|
|
1945
|
-
case "2xl":
|
|
1946
|
-
return bt.entropixSpacing12;
|
|
1947
|
-
}
|
|
1948
|
-
}
|
|
1949
|
-
var maxWidthMap = {
|
|
1950
|
-
xs: 480,
|
|
1951
|
-
sm: 640,
|
|
1952
|
-
md: 768,
|
|
1953
|
-
lg: 1024,
|
|
1954
|
-
xl: 1280,
|
|
1955
|
-
full: void 0
|
|
1956
|
-
};
|
|
1957
|
-
function Container({
|
|
1958
|
-
maxWidth = "lg",
|
|
1959
|
-
center,
|
|
1960
|
-
style,
|
|
1961
|
-
children,
|
|
1962
|
-
...rest
|
|
1963
|
-
}) {
|
|
1964
|
-
const { baseTokens: bt } = useTheme();
|
|
1965
|
-
const breakpoint = useBreakpoint();
|
|
1966
|
-
const maxW = maxWidthMap[maxWidth];
|
|
1967
|
-
let pageMargin = bt.entropixSpaceLayoutPageMargin;
|
|
1968
|
-
if (breakpoint === "lg" || breakpoint === "xl" || breakpoint === "2xl") {
|
|
1969
|
-
pageMargin = bt.entropixSpaceLayoutPageMarginLg;
|
|
1970
|
-
} else if (breakpoint === "md") {
|
|
1971
|
-
pageMargin = bt.entropixSpaceLayoutPageMarginMd;
|
|
1972
|
-
}
|
|
1973
|
-
return /* @__PURE__ */ jsx(
|
|
1974
|
-
View,
|
|
1975
|
-
{
|
|
1976
|
-
style: [
|
|
1977
|
-
{
|
|
1978
|
-
width: "100%",
|
|
1979
|
-
paddingHorizontal: pageMargin
|
|
1980
|
-
},
|
|
1981
|
-
maxW !== void 0 && { maxWidth: maxW, alignSelf: "center" },
|
|
1982
|
-
center && { alignItems: "center" },
|
|
1983
|
-
style
|
|
1984
|
-
],
|
|
1985
|
-
...rest,
|
|
1986
|
-
children
|
|
1987
|
-
}
|
|
1988
|
-
);
|
|
1989
|
-
}
|
|
1990
|
-
function Divider({
|
|
1991
|
-
orientation = "horizontal",
|
|
1992
|
-
spacing,
|
|
1993
|
-
style,
|
|
1994
|
-
...rest
|
|
1995
|
-
}) {
|
|
1996
|
-
const { tokens: t, baseTokens: bt } = useTheme();
|
|
1997
|
-
const spacingMap = {
|
|
1998
|
-
sm: bt.entropixSpacing2,
|
|
1999
|
-
md: bt.entropixSpacing4,
|
|
2000
|
-
lg: bt.entropixSpacing6
|
|
2001
|
-
};
|
|
2002
|
-
const spacingValue = spacing ? spacingMap[spacing] : 0;
|
|
2003
|
-
const isVertical = orientation === "vertical";
|
|
2004
|
-
const dividerStyle = isVertical ? {
|
|
2005
|
-
width: 1,
|
|
2006
|
-
alignSelf: "stretch",
|
|
2007
|
-
backgroundColor: t.entropixColorBorderDefault,
|
|
2008
|
-
marginHorizontal: spacingValue
|
|
2009
|
-
} : {
|
|
2010
|
-
height: 1,
|
|
2011
|
-
width: "100%",
|
|
2012
|
-
backgroundColor: t.entropixColorBorderDefault,
|
|
2013
|
-
marginVertical: spacingValue
|
|
2014
|
-
};
|
|
2015
|
-
return /* @__PURE__ */ jsx(
|
|
2016
|
-
View,
|
|
2017
|
-
{
|
|
2018
|
-
accessibilityRole: isVertical ? "none" : void 0,
|
|
2019
|
-
style: [dividerStyle, style],
|
|
2020
|
-
...rest
|
|
2021
|
-
}
|
|
2022
|
-
);
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
export { Accordion, AccordionItem, AccordionPanel, AccordionTrigger, BREAKPOINTS, Button, Checkbox, Container, Dialog, DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogTitle, DialogTrigger, Divider, EntropixProvider, Inline, Input, Menu, MenuContent, MenuItem, MenuTrigger, RadioGroup, RadioItem, Select, SelectContent, SelectOption, SelectTrigger, Stack, Switch, Tab, TabList, TabPanel, Tabs, Textarea, Toggle, mapAccessibilityToRN, useBreakpoint, useBreakpointValue, useScreenDimensions, useTheme };
|
|
1
|
+
export { Input } from './chunk-UHVTF2Y4.js';
|
|
2
|
+
export { Textarea } from './chunk-64DK6YFL.js';
|
|
3
|
+
export { Checkbox } from './chunk-C6HF6QXK.js';
|
|
4
|
+
export { RadioGroup, RadioItem } from './chunk-3MHE2C74.js';
|
|
5
|
+
export { Select, SelectContent, SelectOption, SelectTrigger } from './chunk-XSOLJOBG.js';
|
|
6
|
+
export { BREAKPOINTS, Container, Divider, Inline, Stack, useBreakpoint, useBreakpointValue, useScreenDimensions } from './chunk-CXQNNEPC.js';
|
|
7
|
+
export { Button } from './chunk-45KMMZUT.js';
|
|
8
|
+
export { Toggle } from './chunk-KU24A5PQ.js';
|
|
9
|
+
export { Switch } from './chunk-EFRYMWJB.js';
|
|
10
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogTitle, DialogTrigger } from './chunk-VP567WZL.js';
|
|
11
|
+
export { Tab, TabList, TabPanel, Tabs } from './chunk-XBNX4SLA.js';
|
|
12
|
+
export { Accordion, AccordionItem, AccordionPanel, AccordionTrigger } from './chunk-PVTPOJRU.js';
|
|
13
|
+
export { Menu, MenuContent, MenuItem, MenuTrigger } from './chunk-HH3CEDSH.js';
|
|
14
|
+
export { mapAccessibilityToRN } from './chunk-73BDGPZT.js';
|
|
15
|
+
export { EntropixProvider, registerBrand, useTheme } from './chunk-ZYOTKLBG.js';
|
|
2026
16
|
//# sourceMappingURL=index.js.map
|
|
2027
17
|
//# sourceMappingURL=index.js.map
|