@vellira-ui/react-native 2.32.0 → 2.34.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/dist/index.d.ts +1 -1
- package/dist/index.js +663 -308
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
// src/components/Dropdown/Content/DropdownContent.tsx
|
|
2
|
-
import {
|
|
2
|
+
import { useEffect, useMemo as useMemo3, useRef, useState } from "react";
|
|
3
|
+
import {
|
|
4
|
+
AccessibilityInfo,
|
|
5
|
+
Animated,
|
|
6
|
+
Modal,
|
|
7
|
+
Pressable,
|
|
8
|
+
StyleSheet as StyleSheet2,
|
|
9
|
+
View
|
|
10
|
+
} from "react-native";
|
|
3
11
|
|
|
4
12
|
// src/theme/ThemeProvider.tsx
|
|
5
13
|
import { useMemo } from "react";
|
|
@@ -69,9 +77,21 @@ function useThemeStyles(createStyles23) {
|
|
|
69
77
|
import { StyleSheet } from "react-native";
|
|
70
78
|
var createStyles = (theme) => StyleSheet.create({
|
|
71
79
|
modalRoot: {
|
|
72
|
-
flex: 1
|
|
80
|
+
flex: 1
|
|
81
|
+
},
|
|
82
|
+
sheet: {
|
|
73
83
|
justifyContent: "flex-end"
|
|
74
84
|
},
|
|
85
|
+
modal: {
|
|
86
|
+
alignItems: "center",
|
|
87
|
+
justifyContent: "center",
|
|
88
|
+
padding: theme.tokens.spacing[4]
|
|
89
|
+
},
|
|
90
|
+
popover: {
|
|
91
|
+
alignItems: "center",
|
|
92
|
+
justifyContent: "center",
|
|
93
|
+
padding: theme.tokens.spacing[4]
|
|
94
|
+
},
|
|
75
95
|
backdrop: {
|
|
76
96
|
...StyleSheet.absoluteFill,
|
|
77
97
|
backgroundColor: theme.semantic.overlay.backdrop
|
|
@@ -93,6 +113,24 @@ var createStyles = (theme) => StyleSheet.create({
|
|
|
93
113
|
shadowOpacity: 0.24,
|
|
94
114
|
shadowRadius: 16,
|
|
95
115
|
elevation: 12
|
|
116
|
+
},
|
|
117
|
+
sheetMenu: {
|
|
118
|
+
width: "100%",
|
|
119
|
+
maxHeight: "70%",
|
|
120
|
+
borderTopLeftRadius: theme.tokens.radius.lg,
|
|
121
|
+
borderTopRightRadius: theme.tokens.radius.lg
|
|
122
|
+
},
|
|
123
|
+
modalMenu: {
|
|
124
|
+
width: "100%",
|
|
125
|
+
maxWidth: 420,
|
|
126
|
+
maxHeight: "70%",
|
|
127
|
+
borderRadius: theme.tokens.radius.lg
|
|
128
|
+
},
|
|
129
|
+
popoverMenu: {
|
|
130
|
+
width: "100%",
|
|
131
|
+
maxWidth: 360,
|
|
132
|
+
maxHeight: "60%",
|
|
133
|
+
borderRadius: theme.tokens.radius.md
|
|
96
134
|
}
|
|
97
135
|
});
|
|
98
136
|
|
|
@@ -103,32 +141,97 @@ function DropdownContent({
|
|
|
103
141
|
children,
|
|
104
142
|
onClose,
|
|
105
143
|
contentStyle,
|
|
106
|
-
accessibilityLabel
|
|
144
|
+
accessibilityLabel,
|
|
145
|
+
presentation
|
|
107
146
|
}) {
|
|
108
147
|
const styles = useThemeStyles(createStyles);
|
|
148
|
+
const isSheet = presentation === "sheet";
|
|
149
|
+
const animation = useRef(new Animated.Value(isOpen ? 1 : 0)).current;
|
|
150
|
+
const [reduceMotion, setReduceMotion] = useState(false);
|
|
151
|
+
useEffect(() => {
|
|
152
|
+
AccessibilityInfo.isReduceMotionEnabled?.().then(setReduceMotion);
|
|
153
|
+
const subscription = AccessibilityInfo.addEventListener?.(
|
|
154
|
+
"reduceMotionChanged",
|
|
155
|
+
setReduceMotion
|
|
156
|
+
);
|
|
157
|
+
return () => {
|
|
158
|
+
subscription?.remove();
|
|
159
|
+
};
|
|
160
|
+
}, []);
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
if (!isOpen) {
|
|
163
|
+
animation.setValue(0);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (reduceMotion) {
|
|
167
|
+
animation.setValue(1);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
animation.setValue(0);
|
|
171
|
+
Animated.timing(animation, {
|
|
172
|
+
toValue: 1,
|
|
173
|
+
duration: isSheet ? 220 : 160,
|
|
174
|
+
useNativeDriver: true
|
|
175
|
+
}).start();
|
|
176
|
+
}, [animation, isOpen, isSheet, reduceMotion]);
|
|
177
|
+
const backdropAnimatedStyle = useMemo3(
|
|
178
|
+
() => ({
|
|
179
|
+
opacity: animation.interpolate({
|
|
180
|
+
inputRange: [0, 1],
|
|
181
|
+
outputRange: [0, 1]
|
|
182
|
+
})
|
|
183
|
+
}),
|
|
184
|
+
[animation]
|
|
185
|
+
);
|
|
186
|
+
const menuAnimatedStyle = useMemo3(() => {
|
|
187
|
+
const translateY = animation.interpolate({
|
|
188
|
+
inputRange: [0, 1],
|
|
189
|
+
outputRange: isSheet ? [24, 0] : [-6, 0]
|
|
190
|
+
});
|
|
191
|
+
const scale = animation.interpolate({
|
|
192
|
+
inputRange: [0, 1],
|
|
193
|
+
outputRange: isSheet ? [1, 1] : [0.98, 1]
|
|
194
|
+
});
|
|
195
|
+
return {
|
|
196
|
+
opacity: animation,
|
|
197
|
+
transform: [{ translateY }, { scale }]
|
|
198
|
+
};
|
|
199
|
+
}, [animation, isSheet]);
|
|
109
200
|
return /* @__PURE__ */ jsx2(
|
|
110
201
|
Modal,
|
|
111
202
|
{
|
|
112
203
|
transparent: true,
|
|
113
204
|
visible: isOpen,
|
|
114
|
-
animationType: "
|
|
205
|
+
animationType: "none",
|
|
115
206
|
onRequestClose: onClose,
|
|
116
|
-
children: /* @__PURE__ */ jsxs(View, { style: styles.modalRoot, children: [
|
|
207
|
+
children: /* @__PURE__ */ jsxs(View, { style: [styles.modalRoot, styles[presentation]], children: [
|
|
117
208
|
/* @__PURE__ */ jsx2(
|
|
118
|
-
|
|
209
|
+
Animated.View,
|
|
119
210
|
{
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
211
|
+
pointerEvents: "box-none",
|
|
212
|
+
style: [styles.backdrop, backdropAnimatedStyle],
|
|
213
|
+
children: /* @__PURE__ */ jsx2(
|
|
214
|
+
Pressable,
|
|
215
|
+
{
|
|
216
|
+
accessibilityRole: "button",
|
|
217
|
+
accessibilityLabel: "Close menu",
|
|
218
|
+
style: StyleSheet2.absoluteFill,
|
|
219
|
+
onPress: onClose
|
|
220
|
+
}
|
|
221
|
+
)
|
|
124
222
|
}
|
|
125
223
|
),
|
|
126
224
|
/* @__PURE__ */ jsx2(
|
|
127
|
-
View,
|
|
225
|
+
Animated.View,
|
|
128
226
|
{
|
|
129
227
|
accessibilityRole: "menu",
|
|
130
228
|
accessibilityLabel,
|
|
131
|
-
style: [
|
|
229
|
+
style: [
|
|
230
|
+
styles.menu,
|
|
231
|
+
styles[`${presentation}Menu`],
|
|
232
|
+
contentStyle,
|
|
233
|
+
menuAnimatedStyle
|
|
234
|
+
],
|
|
132
235
|
children
|
|
133
236
|
}
|
|
134
237
|
)
|
|
@@ -139,16 +242,23 @@ function DropdownContent({
|
|
|
139
242
|
DropdownContent.displayName = "DropdownContent";
|
|
140
243
|
|
|
141
244
|
// src/components/Dropdown/Dropdown.tsx
|
|
142
|
-
import { useCallback, useMemo as
|
|
245
|
+
import { useCallback, useEffect as useEffect3, useMemo as useMemo4, useRef as useRef3 } from "react";
|
|
143
246
|
import { useDropdown } from "@vellira-ui/core";
|
|
144
|
-
import {
|
|
247
|
+
import {
|
|
248
|
+
AccessibilityInfo as AccessibilityInfo2,
|
|
249
|
+
findNodeHandle,
|
|
250
|
+
FlatList,
|
|
251
|
+
Text as Text4,
|
|
252
|
+
useWindowDimensions,
|
|
253
|
+
View as View4
|
|
254
|
+
} from "react-native";
|
|
145
255
|
|
|
146
256
|
// src/components/Dropdown/Group/DropdownGroup.tsx
|
|
147
257
|
import { Text } from "react-native";
|
|
148
258
|
|
|
149
259
|
// src/components/Dropdown/Group/DropdownGroup.styles.ts
|
|
150
|
-
import { StyleSheet as
|
|
151
|
-
var createStyles2 = (theme) =>
|
|
260
|
+
import { StyleSheet as StyleSheet3 } from "react-native";
|
|
261
|
+
var createStyles2 = (theme) => StyleSheet3.create({
|
|
152
262
|
groupLabel: {
|
|
153
263
|
paddingHorizontal: theme.tokens.spacing[4],
|
|
154
264
|
paddingVertical: theme.tokens.spacing[2],
|
|
@@ -168,15 +278,108 @@ function DropdownGroup({ label }) {
|
|
|
168
278
|
}
|
|
169
279
|
DropdownGroup.displayName = "DropdownGroup";
|
|
170
280
|
|
|
281
|
+
// src/components/Dropdown/internal/DropdownCollection.ts
|
|
282
|
+
import { Children, isValidElement } from "react";
|
|
283
|
+
function createDropdownSlot(name, displayName) {
|
|
284
|
+
const Slot = () => null;
|
|
285
|
+
Slot.__velliraDropdownPart = name;
|
|
286
|
+
Slot.displayName = displayName;
|
|
287
|
+
return Slot;
|
|
288
|
+
}
|
|
289
|
+
function parseDropdownChildren(children) {
|
|
290
|
+
let generatedId = 0;
|
|
291
|
+
let trigger;
|
|
292
|
+
let triggerProps;
|
|
293
|
+
let contentProps;
|
|
294
|
+
const entries = [];
|
|
295
|
+
const items = [];
|
|
296
|
+
const nextId = (prefix) => `${prefix}-${generatedId++}`;
|
|
297
|
+
function pushItem(props) {
|
|
298
|
+
const entry = {
|
|
299
|
+
type: "item",
|
|
300
|
+
id: nextId("item"),
|
|
301
|
+
props,
|
|
302
|
+
label: getItemLabel(props.children) || props.value || "",
|
|
303
|
+
disabled: props.disabled
|
|
304
|
+
};
|
|
305
|
+
items.push(entry);
|
|
306
|
+
entries.push(entry);
|
|
307
|
+
}
|
|
308
|
+
function visit(node) {
|
|
309
|
+
Children.forEach(node, (child) => {
|
|
310
|
+
if (!isValidElement(child)) return;
|
|
311
|
+
const type = child.type;
|
|
312
|
+
switch (type.__velliraDropdownPart) {
|
|
313
|
+
case "trigger":
|
|
314
|
+
triggerProps = child.props;
|
|
315
|
+
trigger = triggerProps.children;
|
|
316
|
+
return;
|
|
317
|
+
case "content":
|
|
318
|
+
contentProps = child.props;
|
|
319
|
+
visit(contentProps.children);
|
|
320
|
+
return;
|
|
321
|
+
case "group":
|
|
322
|
+
visit(child.props.children);
|
|
323
|
+
return;
|
|
324
|
+
case "label":
|
|
325
|
+
entries.push({
|
|
326
|
+
type: "label",
|
|
327
|
+
id: nextId("label"),
|
|
328
|
+
props: child.props
|
|
329
|
+
});
|
|
330
|
+
return;
|
|
331
|
+
case "separator":
|
|
332
|
+
entries.push({
|
|
333
|
+
type: "separator",
|
|
334
|
+
id: nextId("separator"),
|
|
335
|
+
props: child.props
|
|
336
|
+
});
|
|
337
|
+
return;
|
|
338
|
+
case "empty":
|
|
339
|
+
entries.push({
|
|
340
|
+
type: "empty",
|
|
341
|
+
id: nextId("empty"),
|
|
342
|
+
props: child.props
|
|
343
|
+
});
|
|
344
|
+
return;
|
|
345
|
+
case "loading":
|
|
346
|
+
entries.push({
|
|
347
|
+
type: "loading",
|
|
348
|
+
id: nextId("loading"),
|
|
349
|
+
props: child.props
|
|
350
|
+
});
|
|
351
|
+
return;
|
|
352
|
+
case "item":
|
|
353
|
+
pushItem(child.props);
|
|
354
|
+
return;
|
|
355
|
+
default:
|
|
356
|
+
visit(child.props.children);
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
visit(children);
|
|
361
|
+
return { contentProps, entries, items, trigger, triggerProps };
|
|
362
|
+
}
|
|
363
|
+
function getItemLabel(children) {
|
|
364
|
+
const labelParts = [];
|
|
365
|
+
Children.forEach(children, (child) => {
|
|
366
|
+
if (typeof child === "string" || typeof child === "number") {
|
|
367
|
+
labelParts.push(String(child));
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
return labelParts.join("").trim();
|
|
371
|
+
}
|
|
372
|
+
|
|
171
373
|
// src/components/Dropdown/Item/DropdownItem.tsx
|
|
172
|
-
import { cloneElement, isValidElement } from "react";
|
|
374
|
+
import { cloneElement, isValidElement as isValidElement2 } from "react";
|
|
173
375
|
import { Pressable as Pressable2, Text as Text2 } from "react-native";
|
|
174
376
|
|
|
175
377
|
// src/components/Dropdown/Item/DropdownItem.styles.ts
|
|
176
|
-
import { StyleSheet as
|
|
177
|
-
var createStyles3 = (theme) =>
|
|
378
|
+
import { StyleSheet as StyleSheet4 } from "react-native";
|
|
379
|
+
var createStyles3 = (theme) => StyleSheet4.create({
|
|
178
380
|
item: {
|
|
179
381
|
minWidth: 0,
|
|
382
|
+
minHeight: 44,
|
|
180
383
|
alignItems: "center",
|
|
181
384
|
flexDirection: "row",
|
|
182
385
|
gap: theme.tokens.spacing[4],
|
|
@@ -235,7 +438,7 @@ function DropdownItem({
|
|
|
235
438
|
const { theme } = useTheme();
|
|
236
439
|
const styles = useThemeStyles(createStyles3);
|
|
237
440
|
const renderColoredNode = (node, color) => {
|
|
238
|
-
if (!
|
|
441
|
+
if (!isValidElement2(node)) return node;
|
|
239
442
|
return cloneElement(node, { color });
|
|
240
443
|
};
|
|
241
444
|
const getContentColor = (pressed) => {
|
|
@@ -301,8 +504,8 @@ DropdownItem.displayName = "DropdownItem";
|
|
|
301
504
|
import { View as View2 } from "react-native";
|
|
302
505
|
|
|
303
506
|
// src/components/Dropdown/Separator/DropdownSeparator.styles.ts
|
|
304
|
-
import { StyleSheet as
|
|
305
|
-
var createStyles4 = (theme) =>
|
|
507
|
+
import { StyleSheet as StyleSheet5 } from "react-native";
|
|
508
|
+
var createStyles4 = (theme) => StyleSheet5.create({
|
|
306
509
|
separator: {
|
|
307
510
|
height: 1,
|
|
308
511
|
backgroundColor: theme.components.dropdown.separator.bg
|
|
@@ -320,17 +523,17 @@ DropdownSeparator.displayName = "DropdownSeparator";
|
|
|
320
523
|
// src/components/Dropdown/Trigger/DropdownTrigger.tsx
|
|
321
524
|
import {
|
|
322
525
|
cloneElement as cloneElement2,
|
|
323
|
-
isValidElement as
|
|
324
|
-
useEffect,
|
|
325
|
-
useRef,
|
|
326
|
-
useState
|
|
526
|
+
isValidElement as isValidElement3,
|
|
527
|
+
useEffect as useEffect2,
|
|
528
|
+
useRef as useRef2,
|
|
529
|
+
useState as useState2
|
|
327
530
|
} from "react";
|
|
328
531
|
import { ChevronDown } from "@vellira-ui/icons";
|
|
329
|
-
import { Animated, Pressable as Pressable3, Text as Text3, View as View3 } from "react-native";
|
|
532
|
+
import { Animated as Animated2, Pressable as Pressable3, Text as Text3, View as View3 } from "react-native";
|
|
330
533
|
|
|
331
534
|
// src/components/Dropdown/Trigger/DropdownTrigger.styles.ts
|
|
332
|
-
import { StyleSheet as
|
|
333
|
-
var createStyles5 = (theme) =>
|
|
535
|
+
import { StyleSheet as StyleSheet6 } from "react-native";
|
|
536
|
+
var createStyles5 = (theme) => StyleSheet6.create({
|
|
334
537
|
trigger: {
|
|
335
538
|
alignItems: "center",
|
|
336
539
|
justifyContent: "center",
|
|
@@ -431,6 +634,7 @@ import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
|
431
634
|
function DropdownTrigger({
|
|
432
635
|
label,
|
|
433
636
|
trigger,
|
|
637
|
+
children,
|
|
434
638
|
icon,
|
|
435
639
|
arrowIcon,
|
|
436
640
|
showArrow = true,
|
|
@@ -438,6 +642,7 @@ function DropdownTrigger({
|
|
|
438
642
|
disabled = false,
|
|
439
643
|
isOpen,
|
|
440
644
|
triggerStyle,
|
|
645
|
+
triggerRef,
|
|
441
646
|
accessibilityLabel,
|
|
442
647
|
accessibilityHint,
|
|
443
648
|
onPress
|
|
@@ -456,10 +661,10 @@ function DropdownTrigger({
|
|
|
456
661
|
}[size];
|
|
457
662
|
const hasIcon = Boolean(icon);
|
|
458
663
|
const isIconOnly = !trigger && hasIcon && !showArrow;
|
|
459
|
-
const [isPressed, setIsPressed] =
|
|
460
|
-
const rotateAnim =
|
|
461
|
-
|
|
462
|
-
|
|
664
|
+
const [isPressed, setIsPressed] = useState2(false);
|
|
665
|
+
const rotateAnim = useRef2(new Animated2.Value(isOpen ? 1 : 0)).current;
|
|
666
|
+
useEffect2(() => {
|
|
667
|
+
Animated2.timing(rotateAnim, {
|
|
463
668
|
toValue: isOpen ? 1 : 0,
|
|
464
669
|
duration: 180,
|
|
465
670
|
useNativeDriver: true
|
|
@@ -485,15 +690,34 @@ function DropdownTrigger({
|
|
|
485
690
|
}
|
|
486
691
|
);
|
|
487
692
|
}
|
|
488
|
-
if (!
|
|
693
|
+
if (!isValidElement3(node)) return node;
|
|
489
694
|
return cloneElement2(node, { color });
|
|
490
695
|
};
|
|
491
696
|
const contentColor = disabled ? theme.components.dropdown.trigger.disabled.fg : isPressed ? theme.components.dropdown.trigger.hover.fg : theme.components.dropdown.trigger.default.fg;
|
|
492
697
|
const arrow = arrowIcon ? renderColoredNode(arrowIcon, contentColor) : /* @__PURE__ */ jsx6(ChevronDown, { width: 16, height: 16, color: contentColor });
|
|
493
698
|
const renderedIcon = icon ? renderColoredNode(icon, contentColor) : null;
|
|
699
|
+
const triggerContent = trigger ?? children;
|
|
700
|
+
if (isValidElement3(triggerContent)) {
|
|
701
|
+
const child = triggerContent;
|
|
702
|
+
const isChildDisabled = disabled || child.props.disabled;
|
|
703
|
+
return cloneElement2(child, {
|
|
704
|
+
ref: triggerRef,
|
|
705
|
+
disabled: isChildDisabled,
|
|
706
|
+
accessibilityLabel: accessibilityLabel ?? (typeof label === "string" ? label : void 0),
|
|
707
|
+
accessibilityHint,
|
|
708
|
+
accessibilityState: { expanded: isOpen, disabled: isChildDisabled },
|
|
709
|
+
onPress: () => {
|
|
710
|
+
child.props.onPress?.();
|
|
711
|
+
if (!isChildDisabled) {
|
|
712
|
+
onPress();
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
}
|
|
494
717
|
return /* @__PURE__ */ jsxs3(
|
|
495
718
|
Pressable3,
|
|
496
719
|
{
|
|
720
|
+
ref: triggerRef,
|
|
497
721
|
disabled,
|
|
498
722
|
accessibilityRole: "button",
|
|
499
723
|
accessibilityLabel: accessibilityLabel ?? (typeof label === "string" ? label : void 0),
|
|
@@ -513,7 +737,7 @@ function DropdownTrigger({
|
|
|
513
737
|
],
|
|
514
738
|
children: [
|
|
515
739
|
hasIcon && /* @__PURE__ */ jsx6(View3, { style: styles.icon, children: renderedIcon }),
|
|
516
|
-
!isIconOnly && (
|
|
740
|
+
!isIconOnly && (triggerContent ? renderColoredNode(triggerContent, contentColor) : /* @__PURE__ */ jsx6(
|
|
517
741
|
Text3,
|
|
518
742
|
{
|
|
519
743
|
numberOfLines: 1,
|
|
@@ -527,7 +751,7 @@ function DropdownTrigger({
|
|
|
527
751
|
}
|
|
528
752
|
)),
|
|
529
753
|
showArrow && /* @__PURE__ */ jsx6(
|
|
530
|
-
|
|
754
|
+
Animated2.View,
|
|
531
755
|
{
|
|
532
756
|
style: [styles.arrow, { transform: [{ rotate: arrowRotate }] }],
|
|
533
757
|
children: arrow
|
|
@@ -540,32 +764,39 @@ function DropdownTrigger({
|
|
|
540
764
|
DropdownTrigger.displayName = "DropdownTrigger";
|
|
541
765
|
|
|
542
766
|
// src/components/Dropdown/Dropdown.styles.ts
|
|
543
|
-
import { StyleSheet as
|
|
544
|
-
var createStyles6 = () =>
|
|
767
|
+
import { StyleSheet as StyleSheet7 } from "react-native";
|
|
768
|
+
var createStyles6 = (theme) => StyleSheet7.create({
|
|
545
769
|
root: {
|
|
546
770
|
alignSelf: "flex-start"
|
|
771
|
+
},
|
|
772
|
+
emptyText: {
|
|
773
|
+
minHeight: 44,
|
|
774
|
+
paddingHorizontal: theme.tokens.spacing[3],
|
|
775
|
+
paddingVertical: theme.tokens.spacing[3],
|
|
776
|
+
color: theme.components.dropdown.item.disabled.fg,
|
|
777
|
+
fontFamily: theme.tokens.typography.family.regular,
|
|
778
|
+
fontSize: theme.tokens.typography.size.md,
|
|
779
|
+
lineHeight: theme.tokens.typography.lineHeight.md
|
|
547
780
|
}
|
|
548
781
|
});
|
|
549
782
|
|
|
550
|
-
// src/components/Dropdown/types.ts
|
|
551
|
-
var isMenuItem = (item) => item.type === void 0 || item.type === "item";
|
|
552
|
-
var isGroup = (item) => item.type === "group";
|
|
553
|
-
var isSeparator = (item) => item.type === "separator";
|
|
554
|
-
|
|
555
783
|
// src/components/Dropdown/Dropdown.tsx
|
|
556
784
|
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
557
|
-
function
|
|
785
|
+
function DropdownRoot({
|
|
786
|
+
children,
|
|
558
787
|
label = "Menu",
|
|
559
788
|
trigger,
|
|
560
789
|
icon,
|
|
561
790
|
arrowIcon,
|
|
562
791
|
showArrow = true,
|
|
563
|
-
items,
|
|
564
|
-
onSelect,
|
|
565
792
|
open,
|
|
566
793
|
defaultOpen = false,
|
|
567
794
|
onOpenChange,
|
|
795
|
+
presentation = "auto",
|
|
796
|
+
closeOnSelect = true,
|
|
568
797
|
disabled = false,
|
|
798
|
+
loading = false,
|
|
799
|
+
loadingText = "Loading actions...",
|
|
569
800
|
size = "md",
|
|
570
801
|
style,
|
|
571
802
|
triggerStyle,
|
|
@@ -576,13 +807,21 @@ function Dropdown({
|
|
|
576
807
|
accessibilityHint
|
|
577
808
|
}) {
|
|
578
809
|
const styles = useThemeStyles(createStyles6);
|
|
579
|
-
const
|
|
810
|
+
const { width } = useWindowDimensions();
|
|
811
|
+
const triggerRef = useRef3(null);
|
|
812
|
+
const parsed = useMemo4(() => parseDropdownChildren(children), [children]);
|
|
813
|
+
const resolvedPresentation = presentation === "auto" ? width < 768 ? "sheet" : "popover" : presentation;
|
|
814
|
+
const menuAccessibilityLabel = useMemo4(() => {
|
|
580
815
|
if (accessibilityLabel) return accessibilityLabel;
|
|
581
816
|
return typeof label === "string" ? label : "Menu";
|
|
582
817
|
}, [accessibilityLabel, label]);
|
|
583
|
-
const navigableItems =
|
|
584
|
-
() => items.
|
|
585
|
-
|
|
818
|
+
const navigableItems = useMemo4(
|
|
819
|
+
() => parsed.items.map((item) => ({
|
|
820
|
+
disabled: item.disabled,
|
|
821
|
+
label: item.label,
|
|
822
|
+
value: item.id
|
|
823
|
+
})),
|
|
824
|
+
[parsed.items]
|
|
586
825
|
);
|
|
587
826
|
const { isOpen, closeDropdown, toggleDropdown } = useDropdown({
|
|
588
827
|
items: navigableItems,
|
|
@@ -590,32 +829,96 @@ function Dropdown({
|
|
|
590
829
|
defaultOpen,
|
|
591
830
|
disabled,
|
|
592
831
|
onOpenChange,
|
|
593
|
-
onSelect,
|
|
594
832
|
getItemValue: (item) => item.value,
|
|
595
833
|
getItemText: (item) => typeof item.label === "string" ? item.label : item.value
|
|
596
834
|
});
|
|
835
|
+
useEffect3(() => {
|
|
836
|
+
if (!isOpen) return;
|
|
837
|
+
AccessibilityInfo2.announceForAccessibility(
|
|
838
|
+
`${menuAccessibilityLabel} opened`
|
|
839
|
+
);
|
|
840
|
+
}, [isOpen, menuAccessibilityLabel]);
|
|
841
|
+
const focusTrigger = useCallback(() => {
|
|
842
|
+
if (typeof findNodeHandle !== "function") return;
|
|
843
|
+
const handle = findNodeHandle(triggerRef.current);
|
|
844
|
+
if (handle && AccessibilityInfo2.setAccessibilityFocus) {
|
|
845
|
+
AccessibilityInfo2.setAccessibilityFocus(handle);
|
|
846
|
+
}
|
|
847
|
+
}, []);
|
|
848
|
+
const closeAndFocusTrigger = useCallback(() => {
|
|
849
|
+
closeDropdown();
|
|
850
|
+
requestAnimationFrame(focusTrigger);
|
|
851
|
+
}, [closeDropdown, focusTrigger]);
|
|
597
852
|
const handleSelect = useCallback(
|
|
598
|
-
(
|
|
599
|
-
|
|
600
|
-
|
|
853
|
+
(entry) => {
|
|
854
|
+
if (entry.disabled || loading) return;
|
|
855
|
+
const event = createDropdownSelectEvent();
|
|
856
|
+
entry.props.onSelect?.(event);
|
|
857
|
+
const shouldClose = entry.props.closeOnSelect ?? closeOnSelect;
|
|
858
|
+
if (!event.defaultPrevented && shouldClose) {
|
|
859
|
+
closeAndFocusTrigger();
|
|
860
|
+
}
|
|
601
861
|
},
|
|
602
|
-
[
|
|
862
|
+
[closeAndFocusTrigger, closeOnSelect, loading]
|
|
603
863
|
);
|
|
604
864
|
const handleTriggerPress = useCallback(() => {
|
|
605
865
|
toggleDropdown();
|
|
606
866
|
}, [toggleDropdown]);
|
|
867
|
+
const renderEntry = useCallback(
|
|
868
|
+
({ item }) => {
|
|
869
|
+
if (item.type === "label") {
|
|
870
|
+
return /* @__PURE__ */ jsx7(DropdownGroup, { label: item.props.children });
|
|
871
|
+
}
|
|
872
|
+
if (item.type === "separator") {
|
|
873
|
+
return /* @__PURE__ */ jsx7(DropdownSeparator, {});
|
|
874
|
+
}
|
|
875
|
+
if (item.type === "empty") {
|
|
876
|
+
return /* @__PURE__ */ jsx7(Text4, { style: styles.emptyText, children: item.props.children });
|
|
877
|
+
}
|
|
878
|
+
if (item.type === "loading") {
|
|
879
|
+
return /* @__PURE__ */ jsx7(Text4, { style: styles.emptyText, children: item.props.children });
|
|
880
|
+
}
|
|
881
|
+
return /* @__PURE__ */ jsx7(
|
|
882
|
+
DropdownItem,
|
|
883
|
+
{
|
|
884
|
+
label: item.props.children,
|
|
885
|
+
value: item.props.value ?? item.id,
|
|
886
|
+
icon: item.props.icon,
|
|
887
|
+
danger: item.props.danger,
|
|
888
|
+
disabled: item.props.disabled,
|
|
889
|
+
textWrap: item.props.textWrap,
|
|
890
|
+
itemStyle,
|
|
891
|
+
textStyle,
|
|
892
|
+
onSelect: () => handleSelect(item)
|
|
893
|
+
}
|
|
894
|
+
);
|
|
895
|
+
},
|
|
896
|
+
[handleSelect, itemStyle, styles.emptyText, textStyle]
|
|
897
|
+
);
|
|
898
|
+
const data = loading ? [
|
|
899
|
+
{
|
|
900
|
+
type: "loading",
|
|
901
|
+
id: "loading",
|
|
902
|
+
props: { children: loadingText }
|
|
903
|
+
}
|
|
904
|
+
] : parsed.entries;
|
|
905
|
+
const contentStyleFromSlot = parsed.contentProps?.style;
|
|
906
|
+
const presentationFromSlot = parsed.contentProps?.presentation === "auto" ? void 0 : parsed.contentProps?.presentation;
|
|
607
907
|
return /* @__PURE__ */ jsxs4(View4, { style: [styles.root, style], children: [
|
|
608
908
|
/* @__PURE__ */ jsx7(
|
|
609
909
|
DropdownTrigger,
|
|
610
910
|
{
|
|
611
911
|
label,
|
|
612
|
-
trigger,
|
|
912
|
+
trigger: trigger ?? parsed.trigger,
|
|
613
913
|
icon,
|
|
614
914
|
arrowIcon,
|
|
615
915
|
showArrow,
|
|
616
|
-
disabled,
|
|
916
|
+
disabled: disabled || parsed.triggerProps?.disabled,
|
|
617
917
|
isOpen,
|
|
618
918
|
size,
|
|
919
|
+
triggerRef: (node) => {
|
|
920
|
+
triggerRef.current = node;
|
|
921
|
+
},
|
|
619
922
|
triggerStyle,
|
|
620
923
|
accessibilityLabel,
|
|
621
924
|
accessibilityHint,
|
|
@@ -626,54 +929,86 @@ function Dropdown({
|
|
|
626
929
|
DropdownContent,
|
|
627
930
|
{
|
|
628
931
|
isOpen,
|
|
629
|
-
onClose:
|
|
630
|
-
contentStyle,
|
|
932
|
+
onClose: closeAndFocusTrigger,
|
|
933
|
+
contentStyle: [contentStyle, contentStyleFromSlot],
|
|
631
934
|
accessibilityLabel: menuAccessibilityLabel,
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
}
|
|
642
|
-
if (isSeparator(item)) {
|
|
643
|
-
return /* @__PURE__ */ jsx7(DropdownSeparator, {}, `separator-${index}`);
|
|
644
|
-
}
|
|
645
|
-
if (!isMenuItem(item)) {
|
|
646
|
-
return null;
|
|
935
|
+
presentation: presentationFromSlot ?? resolvedPresentation,
|
|
936
|
+
children: /* @__PURE__ */ jsx7(
|
|
937
|
+
FlatList,
|
|
938
|
+
{
|
|
939
|
+
data,
|
|
940
|
+
keyExtractor: (item) => item.id,
|
|
941
|
+
renderItem: renderEntry,
|
|
942
|
+
keyboardShouldPersistTaps: "handled",
|
|
943
|
+
removeClippedSubviews: data.length > 24
|
|
647
944
|
}
|
|
648
|
-
|
|
649
|
-
DropdownItem,
|
|
650
|
-
{
|
|
651
|
-
label: item.label,
|
|
652
|
-
value: item.value,
|
|
653
|
-
icon: item.icon,
|
|
654
|
-
danger: item.danger,
|
|
655
|
-
disabled: item.disabled,
|
|
656
|
-
textWrap: item.textWrap,
|
|
657
|
-
itemStyle,
|
|
658
|
-
textStyle,
|
|
659
|
-
onSelect: handleSelect
|
|
660
|
-
},
|
|
661
|
-
`${item.value}-${index}`
|
|
662
|
-
);
|
|
663
|
-
})
|
|
945
|
+
)
|
|
664
946
|
}
|
|
665
947
|
)
|
|
666
948
|
] });
|
|
667
949
|
}
|
|
668
|
-
|
|
950
|
+
DropdownRoot.displayName = "Dropdown";
|
|
951
|
+
function createDropdownSelectEvent() {
|
|
952
|
+
let defaultPrevented = false;
|
|
953
|
+
return {
|
|
954
|
+
preventDefault: () => {
|
|
955
|
+
defaultPrevented = true;
|
|
956
|
+
},
|
|
957
|
+
get defaultPrevented() {
|
|
958
|
+
return defaultPrevented;
|
|
959
|
+
}
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
var DropdownTriggerSlot = createDropdownSlot(
|
|
963
|
+
"trigger",
|
|
964
|
+
"Dropdown.Trigger"
|
|
965
|
+
);
|
|
966
|
+
var DropdownContentSlot = createDropdownSlot(
|
|
967
|
+
"content",
|
|
968
|
+
"Dropdown.Content"
|
|
969
|
+
);
|
|
970
|
+
var DropdownItemSlot = createDropdownSlot(
|
|
971
|
+
"item",
|
|
972
|
+
"Dropdown.Item"
|
|
973
|
+
);
|
|
974
|
+
var DropdownGroupSlot = createDropdownSlot(
|
|
975
|
+
"group",
|
|
976
|
+
"Dropdown.Group"
|
|
977
|
+
);
|
|
978
|
+
var DropdownLabelSlot = createDropdownSlot(
|
|
979
|
+
"label",
|
|
980
|
+
"Dropdown.Label"
|
|
981
|
+
);
|
|
982
|
+
var DropdownSeparatorSlot = createDropdownSlot(
|
|
983
|
+
"separator",
|
|
984
|
+
"Dropdown.Separator"
|
|
985
|
+
);
|
|
986
|
+
var DropdownEmptySlot = createDropdownSlot(
|
|
987
|
+
"empty",
|
|
988
|
+
"Dropdown.Empty"
|
|
989
|
+
);
|
|
990
|
+
var DropdownLoadingSlot = createDropdownSlot(
|
|
991
|
+
"loading",
|
|
992
|
+
"Dropdown.Loading"
|
|
993
|
+
);
|
|
994
|
+
var Dropdown = Object.assign(DropdownRoot, {
|
|
995
|
+
Trigger: DropdownTriggerSlot,
|
|
996
|
+
Content: DropdownContentSlot,
|
|
997
|
+
Item: DropdownItemSlot,
|
|
998
|
+
Group: DropdownGroupSlot,
|
|
999
|
+
Label: DropdownLabelSlot,
|
|
1000
|
+
Separator: DropdownSeparatorSlot,
|
|
1001
|
+
Empty: DropdownEmptySlot,
|
|
1002
|
+
Loading: DropdownLoadingSlot
|
|
1003
|
+
});
|
|
669
1004
|
|
|
670
1005
|
// src/components/Modal/Body/ModalBody.tsx
|
|
671
|
-
import { Children, cloneElement as cloneElement3, isValidElement as
|
|
672
|
-
import { Text as
|
|
1006
|
+
import { Children as Children2, cloneElement as cloneElement3, isValidElement as isValidElement4 } from "react";
|
|
1007
|
+
import { Text as Text5, View as View5 } from "react-native";
|
|
673
1008
|
|
|
674
1009
|
// src/components/Modal/Body/ModalBody.styles.ts
|
|
675
|
-
import { StyleSheet as
|
|
676
|
-
var createStyles7 = (theme) =>
|
|
1010
|
+
import { StyleSheet as StyleSheet8 } from "react-native";
|
|
1011
|
+
var createStyles7 = (theme) => StyleSheet8.create({
|
|
677
1012
|
body: {
|
|
678
1013
|
paddingBottom: theme.tokens.spacing[4]
|
|
679
1014
|
},
|
|
@@ -693,10 +1028,10 @@ var createStyles7 = (theme) => StyleSheet7.create({
|
|
|
693
1028
|
|
|
694
1029
|
// src/components/Modal/Body/ModalBody.tsx
|
|
695
1030
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
696
|
-
var isTextElement = (child) =>
|
|
697
|
-
var renderBodyChildren = (children, textStyle) =>
|
|
1031
|
+
var isTextElement = (child) => isValidElement4(child) && child.type === Text5;
|
|
1032
|
+
var renderBodyChildren = (children, textStyle) => Children2.map(children, (child) => {
|
|
698
1033
|
if (typeof child === "string" || typeof child === "number") {
|
|
699
|
-
return /* @__PURE__ */ jsx8(
|
|
1034
|
+
return /* @__PURE__ */ jsx8(Text5, { style: textStyle, children: child });
|
|
700
1035
|
}
|
|
701
1036
|
if (!isTextElement(child)) {
|
|
702
1037
|
return child;
|
|
@@ -715,8 +1050,8 @@ ModalBody.displayName = "ModalBody";
|
|
|
715
1050
|
import { View as View6 } from "react-native";
|
|
716
1051
|
|
|
717
1052
|
// src/components/Modal/Content/ModalContent.styles.ts
|
|
718
|
-
import { StyleSheet as
|
|
719
|
-
var createStyles8 = (theme) =>
|
|
1053
|
+
import { StyleSheet as StyleSheet9 } from "react-native";
|
|
1054
|
+
var createStyles8 = (theme) => StyleSheet9.create({
|
|
720
1055
|
content: {
|
|
721
1056
|
width: "100%",
|
|
722
1057
|
maxWidth: 600,
|
|
@@ -750,8 +1085,8 @@ ModalContent.displayName = "ModalContent";
|
|
|
750
1085
|
import { View as View7 } from "react-native";
|
|
751
1086
|
|
|
752
1087
|
// src/components/Modal/Footer/ModalFooter.styles.ts
|
|
753
|
-
import { StyleSheet as
|
|
754
|
-
var createStyles9 = (theme) =>
|
|
1088
|
+
import { StyleSheet as StyleSheet10 } from "react-native";
|
|
1089
|
+
var createStyles9 = (theme) => StyleSheet10.create({
|
|
755
1090
|
footer: {
|
|
756
1091
|
flexDirection: "row",
|
|
757
1092
|
gap: theme.tokens.spacing[3],
|
|
@@ -770,7 +1105,7 @@ ModalFooter.displayName = "ModalFooter";
|
|
|
770
1105
|
|
|
771
1106
|
// src/components/Modal/Header/ModalHeader.tsx
|
|
772
1107
|
import { Close } from "@vellira-ui/icons";
|
|
773
|
-
import { Pressable as Pressable4, Text as
|
|
1108
|
+
import { Pressable as Pressable4, Text as Text6, View as View8 } from "react-native";
|
|
774
1109
|
|
|
775
1110
|
// src/components/Modal/ModalContext.tsx
|
|
776
1111
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
@@ -786,8 +1121,8 @@ var useModalContext = () => {
|
|
|
786
1121
|
var ModalContext_default = ModalContext;
|
|
787
1122
|
|
|
788
1123
|
// src/components/Modal/Header/ModalHeader.styles.ts
|
|
789
|
-
import { StyleSheet as
|
|
790
|
-
var createStyles10 = (theme) =>
|
|
1124
|
+
import { StyleSheet as StyleSheet11 } from "react-native";
|
|
1125
|
+
var createStyles10 = (theme) => StyleSheet11.create({
|
|
791
1126
|
header: {
|
|
792
1127
|
alignItems: "center",
|
|
793
1128
|
flexDirection: "row",
|
|
@@ -829,7 +1164,7 @@ var ModalHeader = ({
|
|
|
829
1164
|
const styles = useThemeStyles(createStyles10);
|
|
830
1165
|
const { onClose } = useModalContext();
|
|
831
1166
|
return /* @__PURE__ */ jsxs5(View8, { style: [styles.header, style], children: [
|
|
832
|
-
/* @__PURE__ */ jsx11(
|
|
1167
|
+
/* @__PURE__ */ jsx11(Text6, { style: [styles.title, textStyle], children }),
|
|
833
1168
|
onClose && /* @__PURE__ */ jsx11(
|
|
834
1169
|
Pressable4,
|
|
835
1170
|
{
|
|
@@ -854,8 +1189,8 @@ import { useModal } from "@vellira-ui/core";
|
|
|
854
1189
|
import { Modal as RNModal, Pressable as Pressable5, View as View9 } from "react-native";
|
|
855
1190
|
|
|
856
1191
|
// src/components/Modal/Modal.styles.ts
|
|
857
|
-
import { StyleSheet as
|
|
858
|
-
var createStyles11 = (theme) =>
|
|
1192
|
+
import { StyleSheet as StyleSheet12 } from "react-native";
|
|
1193
|
+
var createStyles11 = (theme) => StyleSheet12.create({
|
|
859
1194
|
overlay: {
|
|
860
1195
|
alignItems: "center",
|
|
861
1196
|
flex: 1,
|
|
@@ -863,7 +1198,7 @@ var createStyles11 = (theme) => StyleSheet11.create({
|
|
|
863
1198
|
padding: theme.tokens.spacing[5]
|
|
864
1199
|
},
|
|
865
1200
|
backdrop: {
|
|
866
|
-
...
|
|
1201
|
+
...StyleSheet12.absoluteFill,
|
|
867
1202
|
backgroundColor: theme.components.modal.overlay.bg
|
|
868
1203
|
}
|
|
869
1204
|
});
|
|
@@ -945,12 +1280,12 @@ import { View as View11 } from "react-native";
|
|
|
945
1280
|
|
|
946
1281
|
// src/patterns/FormField/FormField.tsx
|
|
947
1282
|
import { useId } from "react";
|
|
948
|
-
import { Text as
|
|
1283
|
+
import { Text as Text7, View as View10 } from "react-native";
|
|
949
1284
|
|
|
950
1285
|
// src/patterns/FormField/FormField.styles.ts
|
|
951
|
-
import { StyleSheet as
|
|
1286
|
+
import { StyleSheet as StyleSheet13 } from "react-native";
|
|
952
1287
|
var fontWeight = (value) => value;
|
|
953
|
-
var createStyles12 = (theme) =>
|
|
1288
|
+
var createStyles12 = (theme) => StyleSheet13.create({
|
|
954
1289
|
root: {
|
|
955
1290
|
width: "100%",
|
|
956
1291
|
minWidth: 0,
|
|
@@ -1072,7 +1407,7 @@ function FormField({
|
|
|
1072
1407
|
style: [styles.root, { gap: sizeTokens.gap }, style],
|
|
1073
1408
|
children: [
|
|
1074
1409
|
label && (typeof label === "string" || typeof label === "number" ? /* @__PURE__ */ jsxs7(
|
|
1075
|
-
|
|
1410
|
+
Text7,
|
|
1076
1411
|
{
|
|
1077
1412
|
style: [
|
|
1078
1413
|
styles.label,
|
|
@@ -1086,7 +1421,7 @@ function FormField({
|
|
|
1086
1421
|
children: [
|
|
1087
1422
|
label,
|
|
1088
1423
|
required && /* @__PURE__ */ jsx14(
|
|
1089
|
-
|
|
1424
|
+
Text7,
|
|
1090
1425
|
{
|
|
1091
1426
|
style: styles.required,
|
|
1092
1427
|
accessible: false,
|
|
@@ -1095,7 +1430,7 @@ function FormField({
|
|
|
1095
1430
|
}
|
|
1096
1431
|
),
|
|
1097
1432
|
!required && optionalText && /* @__PURE__ */ jsx14(
|
|
1098
|
-
|
|
1433
|
+
Text7,
|
|
1099
1434
|
{
|
|
1100
1435
|
style: [
|
|
1101
1436
|
styles.optional,
|
|
@@ -1108,7 +1443,7 @@ function FormField({
|
|
|
1108
1443
|
}
|
|
1109
1444
|
),
|
|
1110
1445
|
labelInfo && /* @__PURE__ */ jsx14(
|
|
1111
|
-
|
|
1446
|
+
Text7,
|
|
1112
1447
|
{
|
|
1113
1448
|
style: [
|
|
1114
1449
|
styles.labelInfo,
|
|
@@ -1125,7 +1460,7 @@ function FormField({
|
|
|
1125
1460
|
) : /* @__PURE__ */ jsxs7(View10, { style: styles.customLabel, children: [
|
|
1126
1461
|
label,
|
|
1127
1462
|
required && /* @__PURE__ */ jsx14(
|
|
1128
|
-
|
|
1463
|
+
Text7,
|
|
1129
1464
|
{
|
|
1130
1465
|
style: styles.required,
|
|
1131
1466
|
accessible: false,
|
|
@@ -1137,7 +1472,7 @@ function FormField({
|
|
|
1137
1472
|
labelInfo
|
|
1138
1473
|
] })),
|
|
1139
1474
|
description && (typeof description === "string" || typeof description === "number" ? /* @__PURE__ */ jsx14(
|
|
1140
|
-
|
|
1475
|
+
Text7,
|
|
1141
1476
|
{
|
|
1142
1477
|
style: [
|
|
1143
1478
|
styles.description,
|
|
@@ -1153,7 +1488,7 @@ function FormField({
|
|
|
1153
1488
|
) : description),
|
|
1154
1489
|
/* @__PURE__ */ jsx14(FormFieldContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx14(View10, { style: [styles.control, { gap: sizeTokens.gap }, controlStyle], children }) }),
|
|
1155
1490
|
error && (typeof error === "string" || typeof error === "number" ? /* @__PURE__ */ jsx14(
|
|
1156
|
-
|
|
1491
|
+
Text7,
|
|
1157
1492
|
{
|
|
1158
1493
|
accessibilityLiveRegion: "polite",
|
|
1159
1494
|
style: [
|
|
@@ -1174,8 +1509,8 @@ function FormField({
|
|
|
1174
1509
|
}
|
|
1175
1510
|
|
|
1176
1511
|
// src/components/RadioGroup/RadioGroup.styles.ts
|
|
1177
|
-
import { StyleSheet as
|
|
1178
|
-
var createStyles13 = (theme) =>
|
|
1512
|
+
import { StyleSheet as StyleSheet14 } from "react-native";
|
|
1513
|
+
var createStyles13 = (theme) => StyleSheet14.create({
|
|
1179
1514
|
items: {
|
|
1180
1515
|
width: "100%",
|
|
1181
1516
|
minWidth: 0,
|
|
@@ -1289,14 +1624,14 @@ var RadioGroup = forwardRef(
|
|
|
1289
1624
|
RadioGroup.displayName = "RadioGroup";
|
|
1290
1625
|
|
|
1291
1626
|
// src/components/Select/Content/SelectContent.tsx
|
|
1292
|
-
import { useEffect as
|
|
1293
|
-
import { FlatList, Pressable as Pressable10, Text as
|
|
1627
|
+
import { useEffect as useEffect5, useRef as useRef4, useState as useState3 } from "react";
|
|
1628
|
+
import { FlatList as FlatList2, Pressable as Pressable10, Text as Text12, View as View21 } from "react-native";
|
|
1294
1629
|
|
|
1295
1630
|
// src/components/Select/Group/SelectGroup.tsx
|
|
1296
|
-
import { Pressable as Pressable6, Text as
|
|
1631
|
+
import { Pressable as Pressable6, Text as Text8 } from "react-native";
|
|
1297
1632
|
|
|
1298
1633
|
// src/components/Select/internal/SelectCollection.ts
|
|
1299
|
-
import { Children as
|
|
1634
|
+
import { Children as Children3, isValidElement as isValidElement5 } from "react";
|
|
1300
1635
|
|
|
1301
1636
|
// src/components/Select/internal/types.ts
|
|
1302
1637
|
var selectSlotName = /* @__PURE__ */ Symbol("VelliraNativeSelectSlot");
|
|
@@ -1319,8 +1654,8 @@ var getTextFromNode = (node) => {
|
|
|
1319
1654
|
var getGroupLabel = (props) => {
|
|
1320
1655
|
if (props.label) return props.label;
|
|
1321
1656
|
let label;
|
|
1322
|
-
|
|
1323
|
-
if (label || !
|
|
1657
|
+
Children3.forEach(props.children, (child) => {
|
|
1658
|
+
if (label || !isValidElement5(child)) return;
|
|
1324
1659
|
if (getSelectSlot(child.type) === "label") {
|
|
1325
1660
|
label = getTextFromNode(child.props.children);
|
|
1326
1661
|
}
|
|
@@ -1330,8 +1665,8 @@ var getGroupLabel = (props) => {
|
|
|
1330
1665
|
var getGroupItemValues = (children) => {
|
|
1331
1666
|
const values = [];
|
|
1332
1667
|
const visit = (node) => {
|
|
1333
|
-
|
|
1334
|
-
if (!
|
|
1668
|
+
Children3.forEach(node, (child) => {
|
|
1669
|
+
if (!isValidElement5(child)) return;
|
|
1335
1670
|
const slot = getSelectSlot(child.type);
|
|
1336
1671
|
if (slot === "content") {
|
|
1337
1672
|
visit(child.props.children);
|
|
@@ -1357,8 +1692,8 @@ var parseSelectChildren = (children) => {
|
|
|
1357
1692
|
let empty;
|
|
1358
1693
|
let loading;
|
|
1359
1694
|
const visit = (node, group) => {
|
|
1360
|
-
|
|
1361
|
-
if (!
|
|
1695
|
+
Children3.forEach(node, (child) => {
|
|
1696
|
+
if (!isValidElement5(child)) return;
|
|
1362
1697
|
const slot = getSelectSlot(child.type);
|
|
1363
1698
|
if (slot === "content") {
|
|
1364
1699
|
visit(child.props.children, group);
|
|
@@ -1427,8 +1762,8 @@ var parseSelectChildren = (children) => {
|
|
|
1427
1762
|
};
|
|
1428
1763
|
|
|
1429
1764
|
// src/components/Select/Group/SelectGroup.styles.ts
|
|
1430
|
-
import { StyleSheet as
|
|
1431
|
-
var createGroupStyles = (theme) =>
|
|
1765
|
+
import { StyleSheet as StyleSheet15 } from "react-native";
|
|
1766
|
+
var createGroupStyles = (theme) => StyleSheet15.create({
|
|
1432
1767
|
groupLabel: {
|
|
1433
1768
|
paddingHorizontal: theme.tokens.spacing[3],
|
|
1434
1769
|
paddingTop: theme.tokens.spacing[4],
|
|
@@ -1477,7 +1812,7 @@ var SelectGroup = createSelectSlot(
|
|
|
1477
1812
|
);
|
|
1478
1813
|
var SelectGroupLabelRow = ({ label }) => {
|
|
1479
1814
|
const styles = useThemeStyles(createGroupStyles);
|
|
1480
|
-
return /* @__PURE__ */ jsx16(
|
|
1815
|
+
return /* @__PURE__ */ jsx16(Text8, { style: styles.groupLabel, children: label });
|
|
1481
1816
|
};
|
|
1482
1817
|
var SelectGroupActionRow = ({
|
|
1483
1818
|
label,
|
|
@@ -1505,8 +1840,8 @@ var SelectGroupActionRow = ({
|
|
|
1505
1840
|
onPress,
|
|
1506
1841
|
style: styles.groupAction,
|
|
1507
1842
|
children: [
|
|
1508
|
-
/* @__PURE__ */ jsx16(
|
|
1509
|
-
/* @__PURE__ */ jsxs8(
|
|
1843
|
+
/* @__PURE__ */ jsx16(Text8, { style: styles.groupActionText, children: resolvedLabel }),
|
|
1844
|
+
/* @__PURE__ */ jsxs8(Text8, { style: styles.groupActionMeta, children: [
|
|
1510
1845
|
selectedCount,
|
|
1511
1846
|
"/",
|
|
1512
1847
|
itemCount
|
|
@@ -1549,13 +1884,13 @@ var useSelectContext = () => {
|
|
|
1549
1884
|
};
|
|
1550
1885
|
|
|
1551
1886
|
// src/components/Select/Item/SelectItem.tsx
|
|
1552
|
-
import { cloneElement as cloneElement4, isValidElement as
|
|
1887
|
+
import { cloneElement as cloneElement4, isValidElement as isValidElement6 } from "react";
|
|
1553
1888
|
import { Check } from "@vellira-ui/icons";
|
|
1554
|
-
import { Pressable as Pressable7, Text as
|
|
1889
|
+
import { Pressable as Pressable7, Text as Text9, View as View13 } from "react-native";
|
|
1555
1890
|
|
|
1556
1891
|
// src/components/Select/Item/SelectItem.styles.ts
|
|
1557
|
-
import { StyleSheet as
|
|
1558
|
-
var createItemStyles = (theme) =>
|
|
1892
|
+
import { StyleSheet as StyleSheet16 } from "react-native";
|
|
1893
|
+
var createItemStyles = (theme) => StyleSheet16.create({
|
|
1559
1894
|
option: {
|
|
1560
1895
|
minHeight: 44,
|
|
1561
1896
|
flexDirection: "row",
|
|
@@ -1616,14 +1951,14 @@ var createItemStyles = (theme) => StyleSheet15.create({
|
|
|
1616
1951
|
import { Fragment as Fragment2, jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1617
1952
|
var renderNodeOrText = (node, textStyle, fallback) => {
|
|
1618
1953
|
if (typeof node === "string" || typeof node === "number") {
|
|
1619
|
-
return /* @__PURE__ */ jsx18(
|
|
1954
|
+
return /* @__PURE__ */ jsx18(Text9, { style: textStyle, children: node });
|
|
1620
1955
|
}
|
|
1621
|
-
if (
|
|
1956
|
+
if (isValidElement6(node) && node.type === Text9) {
|
|
1622
1957
|
return cloneElement4(node, {
|
|
1623
1958
|
style: [textStyle, node.props.style]
|
|
1624
1959
|
});
|
|
1625
1960
|
}
|
|
1626
|
-
return node ?? (fallback ? /* @__PURE__ */ jsx18(
|
|
1961
|
+
return node ?? (fallback ? /* @__PURE__ */ jsx18(Text9, { style: textStyle, children: fallback }) : null);
|
|
1627
1962
|
};
|
|
1628
1963
|
var SelectItem = createSelectSlot(
|
|
1629
1964
|
"item",
|
|
@@ -1640,8 +1975,13 @@ var SelectItemRow = ({
|
|
|
1640
1975
|
const styles = useThemeStyles(createItemStyles);
|
|
1641
1976
|
const { color, variant, renderOption } = useSelectContext();
|
|
1642
1977
|
const optionPalette = theme.components.select[option.color ?? color][variant].option;
|
|
1643
|
-
const
|
|
1644
|
-
|
|
1978
|
+
const getOptionState = (pressed) => {
|
|
1979
|
+
if (isDisabled) return theme.components.select.option.disabled;
|
|
1980
|
+
if (isSelected) {
|
|
1981
|
+
return pressed ? optionPalette.selectedPressed : optionPalette.selected;
|
|
1982
|
+
}
|
|
1983
|
+
return pressed ? optionPalette.pressed : theme.components.select.option.default;
|
|
1984
|
+
};
|
|
1645
1985
|
return /* @__PURE__ */ jsx18(
|
|
1646
1986
|
Pressable7,
|
|
1647
1987
|
{
|
|
@@ -1654,58 +1994,73 @@ var SelectItemRow = ({
|
|
|
1654
1994
|
disabled: isDisabled
|
|
1655
1995
|
},
|
|
1656
1996
|
onPress: () => onSelect(option),
|
|
1657
|
-
style:
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
borderColor: isSelected ? optionState.border : "transparent"
|
|
1662
|
-
},
|
|
1663
|
-
isDisabled && styles.optionDisabled,
|
|
1664
|
-
optionStyle
|
|
1665
|
-
],
|
|
1666
|
-
children: renderOption ? renderNodeOrText(
|
|
1667
|
-
renderOption(option, {
|
|
1668
|
-
selected: isSelected,
|
|
1669
|
-
disabled: isDisabled
|
|
1670
|
-
}),
|
|
1671
|
-
[styles.optionLabel, { color: optionFg }]
|
|
1672
|
-
) : /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
1673
|
-
option.icon && /* @__PURE__ */ jsx18(View13, { style: styles.optionIcon, children: isValidElement5(option.icon) ? cloneElement4(
|
|
1674
|
-
option.icon,
|
|
1997
|
+
style: ({ pressed }) => {
|
|
1998
|
+
const optionState = getOptionState(pressed);
|
|
1999
|
+
return [
|
|
2000
|
+
styles.option,
|
|
1675
2001
|
{
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
}
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
2002
|
+
backgroundColor: optionState.bg,
|
|
2003
|
+
borderColor: optionState.border
|
|
2004
|
+
},
|
|
2005
|
+
isDisabled && styles.optionDisabled,
|
|
2006
|
+
optionStyle
|
|
2007
|
+
];
|
|
2008
|
+
},
|
|
2009
|
+
children: ({ pressed }) => {
|
|
2010
|
+
const optionState = getOptionState(pressed);
|
|
2011
|
+
const optionFg = optionState.fg;
|
|
2012
|
+
const descriptionFg = isSelected || pressed ? optionFg : theme.components.select.option.description.fg;
|
|
2013
|
+
return renderOption ? renderNodeOrText(
|
|
2014
|
+
renderOption(option, {
|
|
2015
|
+
selected: isSelected,
|
|
2016
|
+
disabled: isDisabled
|
|
2017
|
+
}),
|
|
2018
|
+
[styles.optionLabel, { color: optionFg }]
|
|
2019
|
+
) : /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
2020
|
+
option.icon && /* @__PURE__ */ jsx18(View13, { style: styles.optionIcon, children: isValidElement6(option.icon) ? cloneElement4(
|
|
2021
|
+
option.icon,
|
|
1683
2022
|
{
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
children: option.label
|
|
2023
|
+
color: optionFg,
|
|
2024
|
+
size: 18
|
|
1687
2025
|
}
|
|
1688
|
-
),
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
View13,
|
|
1693
|
-
{
|
|
1694
|
-
style: [
|
|
1695
|
-
styles.badge,
|
|
2026
|
+
) : option.icon }),
|
|
2027
|
+
/* @__PURE__ */ jsxs9(View13, { style: styles.optionTextWrap, children: [
|
|
2028
|
+
/* @__PURE__ */ jsx18(
|
|
2029
|
+
Text9,
|
|
1696
2030
|
{
|
|
1697
|
-
|
|
1698
|
-
|
|
2031
|
+
numberOfLines: 1,
|
|
2032
|
+
style: [styles.optionLabel, { color: optionFg }],
|
|
2033
|
+
children: option.label
|
|
1699
2034
|
}
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
{
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
2035
|
+
),
|
|
2036
|
+
option.description && /* @__PURE__ */ jsx18(
|
|
2037
|
+
Text9,
|
|
2038
|
+
{
|
|
2039
|
+
numberOfLines: 2,
|
|
2040
|
+
style: [styles.optionDescription, { color: descriptionFg }],
|
|
2041
|
+
children: option.description
|
|
2042
|
+
}
|
|
2043
|
+
)
|
|
2044
|
+
] }),
|
|
2045
|
+
option.badge && /* @__PURE__ */ jsx18(
|
|
2046
|
+
View13,
|
|
2047
|
+
{
|
|
2048
|
+
style: [
|
|
2049
|
+
styles.badge,
|
|
2050
|
+
{
|
|
2051
|
+
backgroundColor: optionPalette.badge.bg,
|
|
2052
|
+
borderColor: optionPalette.badge.border
|
|
2053
|
+
}
|
|
2054
|
+
],
|
|
2055
|
+
children: renderNodeOrText(option.badge, [
|
|
2056
|
+
styles.badgeText,
|
|
2057
|
+
{ color: optionPalette.badge.fg }
|
|
2058
|
+
])
|
|
2059
|
+
}
|
|
2060
|
+
),
|
|
2061
|
+
isSelected && /* @__PURE__ */ jsx18(View13, { style: styles.check, children: /* @__PURE__ */ jsx18(Check, { width: 16, height: 16, color: optionFg }) })
|
|
2062
|
+
] });
|
|
2063
|
+
}
|
|
1709
2064
|
}
|
|
1710
2065
|
);
|
|
1711
2066
|
};
|
|
@@ -1733,8 +2088,8 @@ var SelectItemIcon = createSelectSlot(
|
|
|
1733
2088
|
import { Pressable as Pressable8 } from "react-native";
|
|
1734
2089
|
|
|
1735
2090
|
// src/components/Select/Presentation/SelectPresentation.styles.ts
|
|
1736
|
-
import { StyleSheet as
|
|
1737
|
-
var createPresentationStyles = (theme) =>
|
|
2091
|
+
import { StyleSheet as StyleSheet17 } from "react-native";
|
|
2092
|
+
var createPresentationStyles = (theme) => StyleSheet17.create({
|
|
1738
2093
|
modalRoot: {
|
|
1739
2094
|
flex: 1
|
|
1740
2095
|
},
|
|
@@ -1756,7 +2111,7 @@ var createPresentationStyles = (theme) => StyleSheet16.create({
|
|
|
1756
2111
|
justifyContent: "flex-end"
|
|
1757
2112
|
},
|
|
1758
2113
|
backdrop: {
|
|
1759
|
-
...
|
|
2114
|
+
...StyleSheet17.absoluteFill,
|
|
1760
2115
|
backgroundColor: theme.semantic.overlay.backdrop
|
|
1761
2116
|
},
|
|
1762
2117
|
content: {
|
|
@@ -1990,8 +2345,8 @@ var SelectSheet = ({
|
|
|
1990
2345
|
SelectSheet.displayName = "Select.Sheet";
|
|
1991
2346
|
|
|
1992
2347
|
// src/components/Select/Content/SelectContent.styles.ts
|
|
1993
|
-
import { StyleSheet as
|
|
1994
|
-
var createContentStyles = (theme) =>
|
|
2348
|
+
import { StyleSheet as StyleSheet18 } from "react-native";
|
|
2349
|
+
var createContentStyles = (theme) => StyleSheet18.create({
|
|
1995
2350
|
toolbar: {
|
|
1996
2351
|
minHeight: 52,
|
|
1997
2352
|
flexDirection: "row",
|
|
@@ -2065,11 +2420,11 @@ var createContentStyles = (theme) => StyleSheet17.create({
|
|
|
2065
2420
|
});
|
|
2066
2421
|
|
|
2067
2422
|
// src/components/Select/Content/SelectEmpty.tsx
|
|
2068
|
-
import { Text as
|
|
2423
|
+
import { Text as Text10, View as View18 } from "react-native";
|
|
2069
2424
|
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
2070
2425
|
var renderText = (node, style) => {
|
|
2071
2426
|
if (typeof node === "string" || typeof node === "number") {
|
|
2072
|
-
return /* @__PURE__ */ jsx24(
|
|
2427
|
+
return /* @__PURE__ */ jsx24(Text10, { style, children: node });
|
|
2073
2428
|
}
|
|
2074
2429
|
return node;
|
|
2075
2430
|
};
|
|
@@ -2085,11 +2440,11 @@ var SelectEmptyState = () => {
|
|
|
2085
2440
|
SelectEmptyState.displayName = "Select.EmptyState";
|
|
2086
2441
|
|
|
2087
2442
|
// src/components/Select/Content/SelectLoading.tsx
|
|
2088
|
-
import { ActivityIndicator, Text as
|
|
2443
|
+
import { ActivityIndicator, Text as Text11, View as View19 } from "react-native";
|
|
2089
2444
|
import { jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2090
2445
|
var renderText2 = (node, style) => {
|
|
2091
2446
|
if (typeof node === "string" || typeof node === "number") {
|
|
2092
|
-
return /* @__PURE__ */ jsx25(
|
|
2447
|
+
return /* @__PURE__ */ jsx25(Text11, { style, children: node });
|
|
2093
2448
|
}
|
|
2094
2449
|
return node;
|
|
2095
2450
|
};
|
|
@@ -2116,13 +2471,13 @@ var SelectLoadingState = () => {
|
|
|
2116
2471
|
SelectLoadingState.displayName = "Select.LoadingState";
|
|
2117
2472
|
|
|
2118
2473
|
// src/components/Select/Content/SelectSearch.tsx
|
|
2119
|
-
import { useEffect as
|
|
2474
|
+
import { useEffect as useEffect4 } from "react";
|
|
2120
2475
|
import { Close as Close2, Search } from "@vellira-ui/icons";
|
|
2121
2476
|
import { Pressable as Pressable9, TextInput, View as View20 } from "react-native";
|
|
2122
2477
|
|
|
2123
2478
|
// src/components/Select/Content/SelectSearch.styles.ts
|
|
2124
|
-
import { StyleSheet as
|
|
2125
|
-
var createSearchStyles = (theme) =>
|
|
2479
|
+
import { StyleSheet as StyleSheet19 } from "react-native";
|
|
2480
|
+
var createSearchStyles = (theme) => StyleSheet19.create({
|
|
2126
2481
|
searchWrap: {
|
|
2127
2482
|
flexDirection: "row",
|
|
2128
2483
|
alignItems: "center",
|
|
@@ -2159,7 +2514,7 @@ var createSearchStyles = (theme) => StyleSheet18.create({
|
|
|
2159
2514
|
alignItems: "center",
|
|
2160
2515
|
justifyContent: "center",
|
|
2161
2516
|
borderRadius: 999,
|
|
2162
|
-
backgroundColor: theme.
|
|
2517
|
+
backgroundColor: theme.components.select.clearButton.hoverBg
|
|
2163
2518
|
}
|
|
2164
2519
|
});
|
|
2165
2520
|
|
|
@@ -2182,7 +2537,7 @@ var SelectSearchField = () => {
|
|
|
2182
2537
|
virtual
|
|
2183
2538
|
} = useSelectContext();
|
|
2184
2539
|
const shouldAutoFocus = !virtual || selectedRowIndex === 0;
|
|
2185
|
-
|
|
2540
|
+
useEffect4(() => {
|
|
2186
2541
|
if (!shouldAutoFocus) return;
|
|
2187
2542
|
const focusTimer = setTimeout(() => {
|
|
2188
2543
|
searchInputRef.current?.focus();
|
|
@@ -2233,7 +2588,7 @@ var SelectSearchField = () => {
|
|
|
2233
2588
|
{
|
|
2234
2589
|
width: 14,
|
|
2235
2590
|
height: 14,
|
|
2236
|
-
color: theme.
|
|
2591
|
+
color: theme.components.select.clearButton.hoverFg
|
|
2237
2592
|
}
|
|
2238
2593
|
)
|
|
2239
2594
|
}
|
|
@@ -2250,8 +2605,8 @@ var SelectContent = createSelectSlot(
|
|
|
2250
2605
|
);
|
|
2251
2606
|
var SelectContentSurface = () => {
|
|
2252
2607
|
const styles = useThemeStyles(createContentStyles);
|
|
2253
|
-
const wasOpenRef =
|
|
2254
|
-
const [openCycle, setOpenCycle] =
|
|
2608
|
+
const wasOpenRef = useRef4(false);
|
|
2609
|
+
const [openCycle, setOpenCycle] = useState3(0);
|
|
2255
2610
|
const context = useSelectContext();
|
|
2256
2611
|
const {
|
|
2257
2612
|
isOpen,
|
|
@@ -2278,7 +2633,7 @@ var SelectContentSurface = () => {
|
|
|
2278
2633
|
} = context;
|
|
2279
2634
|
const shouldSeedSelectedPosition = Boolean(context.virtual) && selectedRowIndex > 0 && query === "";
|
|
2280
2635
|
const initialScrollIndex = shouldSeedSelectedPosition ? selectedRowIndex : void 0;
|
|
2281
|
-
|
|
2636
|
+
useEffect5(() => {
|
|
2282
2637
|
if (isOpen && !wasOpenRef.current) {
|
|
2283
2638
|
setOpenCycle((cycle) => cycle + 1);
|
|
2284
2639
|
}
|
|
@@ -2339,10 +2694,10 @@ var SelectContentSurface = () => {
|
|
|
2339
2694
|
style: styles.toolbarAction,
|
|
2340
2695
|
accessibilityRole: "button",
|
|
2341
2696
|
accessibilityLabel: "Close selection",
|
|
2342
|
-
children: /* @__PURE__ */ jsx27(
|
|
2697
|
+
children: /* @__PURE__ */ jsx27(Text12, { style: styles.cancelText, children: "Cancel" })
|
|
2343
2698
|
}
|
|
2344
2699
|
),
|
|
2345
|
-
/* @__PURE__ */ jsx27(
|
|
2700
|
+
/* @__PURE__ */ jsx27(Text12, { style: styles.title, numberOfLines: 1, accessibilityRole: "header", children: resolvedLabel }),
|
|
2346
2701
|
/* @__PURE__ */ jsx27(
|
|
2347
2702
|
Pressable10,
|
|
2348
2703
|
{
|
|
@@ -2351,7 +2706,7 @@ var SelectContentSurface = () => {
|
|
|
2351
2706
|
style: styles.toolbarAction,
|
|
2352
2707
|
accessibilityRole: "button",
|
|
2353
2708
|
accessibilityLabel: "Done",
|
|
2354
|
-
children: /* @__PURE__ */ jsx27(
|
|
2709
|
+
children: /* @__PURE__ */ jsx27(Text12, { style: styles.doneText, children: "Done" })
|
|
2355
2710
|
}
|
|
2356
2711
|
)
|
|
2357
2712
|
]
|
|
@@ -2359,7 +2714,7 @@ var SelectContentSurface = () => {
|
|
|
2359
2714
|
),
|
|
2360
2715
|
searchable && /* @__PURE__ */ jsx27(SelectSearchField, {}),
|
|
2361
2716
|
loading && filteredRows.length === 0 ? /* @__PURE__ */ jsx27(SelectLoadingState, {}) : filteredRows.length === 0 ? /* @__PURE__ */ jsx27(SelectEmptyState, {}) : /* @__PURE__ */ jsx27(
|
|
2362
|
-
|
|
2717
|
+
FlatList2,
|
|
2363
2718
|
{
|
|
2364
2719
|
data: filteredRows,
|
|
2365
2720
|
keyExtractor: (item) => item.key,
|
|
@@ -2420,12 +2775,12 @@ var SelectContentSurface = () => {
|
|
|
2420
2775
|
SelectContentSurface.displayName = "Select.ContentSurface";
|
|
2421
2776
|
|
|
2422
2777
|
// src/components/Select/Root/SelectRoot.tsx
|
|
2423
|
-
import { useMemo as
|
|
2778
|
+
import { useMemo as useMemo7, useRef as useRef5, useState as useState5 } from "react";
|
|
2424
2779
|
import { useSelect } from "@vellira-ui/core";
|
|
2425
2780
|
import { View as View23 } from "react-native";
|
|
2426
2781
|
|
|
2427
2782
|
// src/components/Select/internal/useSelectAccessibility.ts
|
|
2428
|
-
import { AccessibilityInfo } from "react-native";
|
|
2783
|
+
import { AccessibilityInfo as AccessibilityInfo3 } from "react-native";
|
|
2429
2784
|
var useSelectAccessibility = ({
|
|
2430
2785
|
accessibilityLabel,
|
|
2431
2786
|
accessibilityHint,
|
|
@@ -2446,23 +2801,23 @@ var useSelectAccessibility = ({
|
|
|
2446
2801
|
resolvedLabel,
|
|
2447
2802
|
resolvedHint,
|
|
2448
2803
|
announce: (message) => {
|
|
2449
|
-
|
|
2804
|
+
AccessibilityInfo3.announceForAccessibility?.(message);
|
|
2450
2805
|
}
|
|
2451
2806
|
};
|
|
2452
2807
|
};
|
|
2453
2808
|
|
|
2454
2809
|
// src/components/Select/internal/useSelectCollection.ts
|
|
2455
|
-
import { useMemo as
|
|
2810
|
+
import { useMemo as useMemo5 } from "react";
|
|
2456
2811
|
var useSelectCollection = (children, optionsProp) => {
|
|
2457
|
-
const parsedChildren =
|
|
2812
|
+
const parsedChildren = useMemo5(
|
|
2458
2813
|
() => parseSelectChildren(children),
|
|
2459
2814
|
[children]
|
|
2460
2815
|
);
|
|
2461
|
-
const options =
|
|
2816
|
+
const options = useMemo5(
|
|
2462
2817
|
() => [...optionsProp ?? [], ...parsedChildren.options],
|
|
2463
2818
|
[optionsProp, parsedChildren.options]
|
|
2464
2819
|
);
|
|
2465
|
-
const rows =
|
|
2820
|
+
const rows = useMemo5(() => {
|
|
2466
2821
|
if (parsedChildren.rows.length > 0) {
|
|
2467
2822
|
return parsedChildren.rows;
|
|
2468
2823
|
}
|
|
@@ -2483,9 +2838,9 @@ var useSelectCollection = (children, optionsProp) => {
|
|
|
2483
2838
|
};
|
|
2484
2839
|
|
|
2485
2840
|
// src/components/Select/internal/useSelectPresentation.ts
|
|
2486
|
-
import { useWindowDimensions } from "react-native";
|
|
2841
|
+
import { useWindowDimensions as useWindowDimensions2 } from "react-native";
|
|
2487
2842
|
var useSelectPresentation = (presentation = "auto") => {
|
|
2488
|
-
const { width } =
|
|
2843
|
+
const { width } = useWindowDimensions2();
|
|
2489
2844
|
if (presentation === "auto") {
|
|
2490
2845
|
return width >= 768 ? "popover" : "sheet";
|
|
2491
2846
|
}
|
|
@@ -2493,7 +2848,7 @@ var useSelectPresentation = (presentation = "auto") => {
|
|
|
2493
2848
|
};
|
|
2494
2849
|
|
|
2495
2850
|
// src/components/Select/internal/useSelectSearch.ts
|
|
2496
|
-
import { useEffect as
|
|
2851
|
+
import { useEffect as useEffect6, useMemo as useMemo6, useState as useState4 } from "react";
|
|
2497
2852
|
var useSelectSearch = ({
|
|
2498
2853
|
rows,
|
|
2499
2854
|
isOpen,
|
|
@@ -2503,10 +2858,10 @@ var useSelectSearch = ({
|
|
|
2503
2858
|
filterOptions,
|
|
2504
2859
|
filter = defaultSelectFilter
|
|
2505
2860
|
}) => {
|
|
2506
|
-
const [query, setQuery] =
|
|
2861
|
+
const [query, setQuery] = useState4("");
|
|
2507
2862
|
const shouldSearch = searchable ?? searchableFromChildren ?? Boolean(onSearch);
|
|
2508
2863
|
const shouldFilter = filterOptions ?? !onSearch;
|
|
2509
|
-
const filteredRows =
|
|
2864
|
+
const filteredRows = useMemo6(() => {
|
|
2510
2865
|
if (!query || !shouldFilter) return rows;
|
|
2511
2866
|
const visibleRows = [];
|
|
2512
2867
|
let pendingGroup;
|
|
@@ -2533,7 +2888,7 @@ var useSelectSearch = ({
|
|
|
2533
2888
|
return index > 0 && index < collection.length - 1 && collection[index - 1]?.type !== "separator";
|
|
2534
2889
|
});
|
|
2535
2890
|
}, [filter, query, rows, shouldFilter]);
|
|
2536
|
-
|
|
2891
|
+
useEffect6(() => {
|
|
2537
2892
|
if (!isOpen) {
|
|
2538
2893
|
setQuery("");
|
|
2539
2894
|
return;
|
|
@@ -2557,13 +2912,13 @@ var SelectIcon = createSelectSlot(
|
|
|
2557
2912
|
);
|
|
2558
2913
|
|
|
2559
2914
|
// src/components/Select/Trigger/SelectTrigger.tsx
|
|
2560
|
-
import { cloneElement as cloneElement5, isValidElement as
|
|
2915
|
+
import { cloneElement as cloneElement5, isValidElement as isValidElement7 } from "react";
|
|
2561
2916
|
import { ChevronDown as ChevronDown2, Close as Close3 } from "@vellira-ui/icons";
|
|
2562
|
-
import { ActivityIndicator as ActivityIndicator2, Pressable as Pressable11, Text as
|
|
2917
|
+
import { ActivityIndicator as ActivityIndicator2, Pressable as Pressable11, Text as Text13, View as View22 } from "react-native";
|
|
2563
2918
|
|
|
2564
2919
|
// src/components/Select/Trigger/SelectTrigger.styles.ts
|
|
2565
|
-
import { StyleSheet as
|
|
2566
|
-
var createTriggerStyles = (theme) =>
|
|
2920
|
+
import { StyleSheet as StyleSheet20 } from "react-native";
|
|
2921
|
+
var createTriggerStyles = (theme) => StyleSheet20.create({
|
|
2567
2922
|
trigger: {
|
|
2568
2923
|
width: "100%",
|
|
2569
2924
|
minWidth: 0,
|
|
@@ -2638,7 +2993,7 @@ var createTriggerStyles = (theme) => StyleSheet19.create({
|
|
|
2638
2993
|
alignItems: "center",
|
|
2639
2994
|
justifyContent: "center",
|
|
2640
2995
|
borderRadius: 999,
|
|
2641
|
-
backgroundColor: theme.
|
|
2996
|
+
backgroundColor: theme.components.select.clearButton.hoverBg
|
|
2642
2997
|
}
|
|
2643
2998
|
});
|
|
2644
2999
|
|
|
@@ -2687,7 +3042,7 @@ function SelectTrigger({
|
|
|
2687
3042
|
};
|
|
2688
3043
|
const resolvedAccessibilityHint = accessibilityHint ?? (hasError ? "Invalid selection. Opens a list of options" : required ? "Required. Opens a list of options" : "Opens a list of options");
|
|
2689
3044
|
const iconColor = disabled ? theme.components.select.trigger.disabled.icon : triggerState.icon;
|
|
2690
|
-
const renderIcon = (icon) =>
|
|
3045
|
+
const renderIcon = (icon) => isValidElement7(icon) ? cloneElement5(icon, { color: iconColor, size: resolvedIconSize }) : null;
|
|
2691
3046
|
const renderValue = () => {
|
|
2692
3047
|
const valueStyle = [
|
|
2693
3048
|
styles.text,
|
|
@@ -2700,9 +3055,9 @@ function SelectTrigger({
|
|
|
2700
3055
|
textStyle
|
|
2701
3056
|
];
|
|
2702
3057
|
if (typeof displayText === "string" || typeof displayText === "number") {
|
|
2703
|
-
return /* @__PURE__ */ jsx28(
|
|
3058
|
+
return /* @__PURE__ */ jsx28(Text13, { numberOfLines: 1, style: valueStyle, children: displayText });
|
|
2704
3059
|
}
|
|
2705
|
-
if (
|
|
3060
|
+
if (isValidElement7(displayText) && displayText.type === Text13) {
|
|
2706
3061
|
return cloneElement5(displayText, {
|
|
2707
3062
|
numberOfLines: displayText.props.numberOfLines ?? 1,
|
|
2708
3063
|
style: [valueStyle, displayText.props.style]
|
|
@@ -2761,9 +3116,9 @@ function SelectTrigger({
|
|
|
2761
3116
|
children: renderIcon(startIcon)
|
|
2762
3117
|
}
|
|
2763
3118
|
),
|
|
2764
|
-
prefix && /* @__PURE__ */ jsx28(
|
|
3119
|
+
prefix && /* @__PURE__ */ jsx28(Text13, { style: styles.affix, children: prefix }),
|
|
2765
3120
|
/* @__PURE__ */ jsx28(View22, { style: styles.value, children: renderValue() }),
|
|
2766
|
-
suffix && /* @__PURE__ */ jsx28(
|
|
3121
|
+
suffix && /* @__PURE__ */ jsx28(Text13, { style: styles.affix, children: suffix }),
|
|
2767
3122
|
loading ? /* @__PURE__ */ jsx28(
|
|
2768
3123
|
ActivityIndicator2,
|
|
2769
3124
|
{
|
|
@@ -2784,7 +3139,7 @@ function SelectTrigger({
|
|
|
2784
3139
|
{
|
|
2785
3140
|
width: 14,
|
|
2786
3141
|
height: 14,
|
|
2787
|
-
color: theme.
|
|
3142
|
+
color: theme.components.select.clearButton.hoverFg
|
|
2788
3143
|
}
|
|
2789
3144
|
)
|
|
2790
3145
|
}
|
|
@@ -2871,9 +3226,9 @@ function SelectRoot(props) {
|
|
|
2871
3226
|
} = props;
|
|
2872
3227
|
const field = useFormFieldContext();
|
|
2873
3228
|
const hasOwnField = Boolean(label || description || error);
|
|
2874
|
-
const [triggerWidth, setTriggerWidth] =
|
|
2875
|
-
const searchInputRef =
|
|
2876
|
-
const selectedFocusValueRef =
|
|
3229
|
+
const [triggerWidth, setTriggerWidth] = useState5();
|
|
3230
|
+
const searchInputRef = useRef5(null);
|
|
3231
|
+
const selectedFocusValueRef = useRef5(void 0);
|
|
2877
3232
|
const resolvedPresentation = useSelectPresentation(presentation);
|
|
2878
3233
|
const {
|
|
2879
3234
|
options,
|
|
@@ -2926,7 +3281,7 @@ function SelectRoot(props) {
|
|
|
2926
3281
|
const selectedOptions = options.filter(
|
|
2927
3282
|
(option) => selectedValues.includes(option.value)
|
|
2928
3283
|
);
|
|
2929
|
-
const optionsByValue =
|
|
3284
|
+
const optionsByValue = useMemo7(
|
|
2930
3285
|
() => new Map(
|
|
2931
3286
|
options.filter((option) => !option.disabled).map((option) => [option.value, option])
|
|
2932
3287
|
),
|
|
@@ -2951,7 +3306,7 @@ function SelectRoot(props) {
|
|
|
2951
3306
|
)
|
|
2952
3307
|
);
|
|
2953
3308
|
const itemHeight = typeof virtual === "object" ? virtual.estimatedItemSize ?? 46 : 46;
|
|
2954
|
-
const displayValue =
|
|
3309
|
+
const displayValue = useMemo7(() => {
|
|
2955
3310
|
if (renderValue) {
|
|
2956
3311
|
return renderValue(
|
|
2957
3312
|
props.multiple ? selectedOptions : selectedOption ?? null,
|
|
@@ -3185,8 +3540,8 @@ var useTabs = () => {
|
|
|
3185
3540
|
TabsContext.displayName = "TabsContext";
|
|
3186
3541
|
|
|
3187
3542
|
// src/components/Tabs/List/TabsList.styles.ts
|
|
3188
|
-
import { StyleSheet as
|
|
3189
|
-
var createStyles14 = (theme) =>
|
|
3543
|
+
import { StyleSheet as StyleSheet21 } from "react-native";
|
|
3544
|
+
var createStyles14 = (theme) => StyleSheet21.create({
|
|
3190
3545
|
list: {
|
|
3191
3546
|
flexDirection: "row",
|
|
3192
3547
|
alignSelf: "stretch",
|
|
@@ -3236,8 +3591,8 @@ TabsList.displayName = "TabsList";
|
|
|
3236
3591
|
import { View as View25 } from "react-native";
|
|
3237
3592
|
|
|
3238
3593
|
// src/components/Tabs/Panel/TabsPanel.styles.ts
|
|
3239
|
-
import { StyleSheet as
|
|
3240
|
-
var createStyles15 = (theme) =>
|
|
3594
|
+
import { StyleSheet as StyleSheet22 } from "react-native";
|
|
3595
|
+
var createStyles15 = (theme) => StyleSheet22.create({
|
|
3241
3596
|
panel: {
|
|
3242
3597
|
width: "100%",
|
|
3243
3598
|
minWidth: 0,
|
|
@@ -3284,13 +3639,13 @@ var TabsPanel = ({ index, children, style }) => {
|
|
|
3284
3639
|
TabsPanel.displayName = "TabsPanel";
|
|
3285
3640
|
|
|
3286
3641
|
// src/components/Tabs/Tab/Tab.tsx
|
|
3287
|
-
import { cloneElement as cloneElement6, isValidElement as
|
|
3288
|
-
import { Pressable as Pressable12, Text as
|
|
3642
|
+
import { cloneElement as cloneElement6, isValidElement as isValidElement8 } from "react";
|
|
3643
|
+
import { Pressable as Pressable12, Text as Text14, View as View26 } from "react-native";
|
|
3289
3644
|
|
|
3290
3645
|
// src/components/Tabs/Tab/Tab.styles.ts
|
|
3291
|
-
import { StyleSheet as
|
|
3646
|
+
import { StyleSheet as StyleSheet23 } from "react-native";
|
|
3292
3647
|
var fontWeight2 = (value) => value;
|
|
3293
|
-
var createStyles16 = (theme) =>
|
|
3648
|
+
var createStyles16 = (theme) => StyleSheet23.create({
|
|
3294
3649
|
tab: {
|
|
3295
3650
|
minHeight: 40,
|
|
3296
3651
|
alignItems: "center",
|
|
@@ -3426,7 +3781,7 @@ var Tab = ({
|
|
|
3426
3781
|
const isDefault = appearance === "default";
|
|
3427
3782
|
const isVertical = orientation === "vertical";
|
|
3428
3783
|
const iconColor = isPills && isActive ? theme.components.tabs.pills.active.fg : isActive ? theme.components.tabs.trigger.active.fg : theme.components.tabs.trigger.default.fg;
|
|
3429
|
-
const renderedIcon =
|
|
3784
|
+
const renderedIcon = isValidElement8(icon) ? cloneElement6(icon, {
|
|
3430
3785
|
color: iconColor
|
|
3431
3786
|
}) : icon;
|
|
3432
3787
|
return /* @__PURE__ */ jsx32(
|
|
@@ -3474,7 +3829,7 @@ var Tab = ({
|
|
|
3474
3829
|
),
|
|
3475
3830
|
icon != null && /* @__PURE__ */ jsx32(View26, { style: styles.tabIcon, children: renderedIcon }),
|
|
3476
3831
|
children != null && /* @__PURE__ */ jsx32(
|
|
3477
|
-
|
|
3832
|
+
Text14,
|
|
3478
3833
|
{
|
|
3479
3834
|
numberOfLines: 2,
|
|
3480
3835
|
ellipsizeMode: "tail",
|
|
@@ -3495,13 +3850,13 @@ var Tab = ({
|
|
|
3495
3850
|
Tab.displayName = "Tab";
|
|
3496
3851
|
|
|
3497
3852
|
// src/components/Tabs/Tabs.tsx
|
|
3498
|
-
import { useMemo as
|
|
3853
|
+
import { useMemo as useMemo8 } from "react";
|
|
3499
3854
|
import { useTabs as useTabs2 } from "@vellira-ui/core";
|
|
3500
3855
|
import { View as View27 } from "react-native";
|
|
3501
3856
|
|
|
3502
3857
|
// src/components/Tabs/Tabs.styles.ts
|
|
3503
|
-
import { StyleSheet as
|
|
3504
|
-
var createStyles17 = (theme) =>
|
|
3858
|
+
import { StyleSheet as StyleSheet24 } from "react-native";
|
|
3859
|
+
var createStyles17 = (theme) => StyleSheet24.create({
|
|
3505
3860
|
root: {
|
|
3506
3861
|
width: "100%",
|
|
3507
3862
|
minWidth: 0
|
|
@@ -3533,7 +3888,7 @@ var TabsRoot = ({
|
|
|
3533
3888
|
onChange,
|
|
3534
3889
|
orientation
|
|
3535
3890
|
});
|
|
3536
|
-
const value =
|
|
3891
|
+
const value = useMemo8(
|
|
3537
3892
|
() => ({ activeIndex, appearance, orientation, setActiveIndex }),
|
|
3538
3893
|
[activeIndex, appearance, orientation, setActiveIndex]
|
|
3539
3894
|
);
|
|
@@ -3559,20 +3914,20 @@ var Tabs = Object.assign(TabsRoot, {
|
|
|
3559
3914
|
});
|
|
3560
3915
|
|
|
3561
3916
|
// src/components/Tooltip/Tooltip.tsx
|
|
3562
|
-
import { useEffect as
|
|
3563
|
-
import { Modal as Modal6, Pressable as Pressable13, Text as
|
|
3917
|
+
import { useEffect as useEffect7, useRef as useRef7, useState as useState7 } from "react";
|
|
3918
|
+
import { Modal as Modal6, Pressable as Pressable13, Text as Text15, View as View28 } from "react-native";
|
|
3564
3919
|
|
|
3565
3920
|
// src/hooks/useNativeFloatingPosition.ts
|
|
3566
|
-
import { useCallback as useCallback2, useRef as
|
|
3921
|
+
import { useCallback as useCallback2, useRef as useRef6, useState as useState6 } from "react";
|
|
3567
3922
|
import { Dimensions } from "react-native";
|
|
3568
3923
|
var safePadding = 12;
|
|
3569
3924
|
function useNativeFloatingPosition(placement = "top", offset = 8) {
|
|
3570
|
-
const [position, setPosition] =
|
|
3571
|
-
const floatingSizeRef =
|
|
3925
|
+
const [position, setPosition] = useState6({ top: 0, left: 0 });
|
|
3926
|
+
const floatingSizeRef = useRef6({
|
|
3572
3927
|
width: 0,
|
|
3573
3928
|
height: 0
|
|
3574
3929
|
});
|
|
3575
|
-
const lastTriggerRef =
|
|
3930
|
+
const lastTriggerRef = useRef6(null);
|
|
3576
3931
|
const clamp = useCallback2((value, min, max) => {
|
|
3577
3932
|
return Math.min(Math.max(value, min), Math.max(min, max));
|
|
3578
3933
|
}, []);
|
|
@@ -3629,13 +3984,13 @@ function useNativeFloatingPosition(placement = "top", offset = 8) {
|
|
|
3629
3984
|
}
|
|
3630
3985
|
|
|
3631
3986
|
// src/components/Tooltip/Tooltip.styles.ts
|
|
3632
|
-
import { StyleSheet as
|
|
3633
|
-
var createStyles18 = (theme) =>
|
|
3987
|
+
import { StyleSheet as StyleSheet25 } from "react-native";
|
|
3988
|
+
var createStyles18 = (theme) => StyleSheet25.create({
|
|
3634
3989
|
root: {
|
|
3635
3990
|
alignSelf: "flex-start"
|
|
3636
3991
|
},
|
|
3637
3992
|
overlay: {
|
|
3638
|
-
...
|
|
3993
|
+
...StyleSheet25.absoluteFill
|
|
3639
3994
|
},
|
|
3640
3995
|
bubble: {
|
|
3641
3996
|
position: "absolute",
|
|
@@ -3680,9 +4035,9 @@ function Tooltip({
|
|
|
3680
4035
|
textStyle
|
|
3681
4036
|
}) {
|
|
3682
4037
|
const styles = useThemeStyles(createStyles18);
|
|
3683
|
-
const [visible, setVisible] =
|
|
3684
|
-
const triggerRef =
|
|
3685
|
-
const closeTimerRef =
|
|
4038
|
+
const [visible, setVisible] = useState7(false);
|
|
4039
|
+
const triggerRef = useRef7(null);
|
|
4040
|
+
const closeTimerRef = useRef7(null);
|
|
3686
4041
|
const { position, updatePosition, onFloatingLayout } = useNativeFloatingPosition(placement, 8);
|
|
3687
4042
|
const hideDelay = delay?.close ?? 2500;
|
|
3688
4043
|
const clearCloseTimer = () => {
|
|
@@ -3701,7 +4056,7 @@ function Tooltip({
|
|
|
3701
4056
|
closeTimerRef.current = null;
|
|
3702
4057
|
}, hideDelay);
|
|
3703
4058
|
};
|
|
3704
|
-
|
|
4059
|
+
useEffect7(() => {
|
|
3705
4060
|
return clearCloseTimer;
|
|
3706
4061
|
}, []);
|
|
3707
4062
|
return /* @__PURE__ */ jsxs19(View28, { style: [styles.root, style], children: [
|
|
@@ -3728,7 +4083,7 @@ function Tooltip({
|
|
|
3728
4083
|
contentStyle
|
|
3729
4084
|
],
|
|
3730
4085
|
onLayout: onFloatingLayout,
|
|
3731
|
-
children: typeof content === "string" ? /* @__PURE__ */ jsx34(
|
|
4086
|
+
children: typeof content === "string" ? /* @__PURE__ */ jsx34(Text15, { style: [styles.text, textStyle], children: content }) : content
|
|
3732
4087
|
}
|
|
3733
4088
|
)
|
|
3734
4089
|
}
|
|
@@ -3738,8 +4093,8 @@ function Tooltip({
|
|
|
3738
4093
|
Tooltip.displayName = "Tooltip";
|
|
3739
4094
|
|
|
3740
4095
|
// src/primitives/Button/Button.tsx
|
|
3741
|
-
import { cloneElement as cloneElement7, useState as
|
|
3742
|
-
import { ActivityIndicator as ActivityIndicator3, Pressable as Pressable14, Text as
|
|
4096
|
+
import { cloneElement as cloneElement7, useState as useState8 } from "react";
|
|
4097
|
+
import { ActivityIndicator as ActivityIndicator3, Pressable as Pressable14, Text as Text16, View as View29 } from "react-native";
|
|
3743
4098
|
|
|
3744
4099
|
// src/utils/devWarning.ts
|
|
3745
4100
|
var devWarning = (condition, message) => {
|
|
@@ -3749,9 +4104,9 @@ var devWarning = (condition, message) => {
|
|
|
3749
4104
|
};
|
|
3750
4105
|
|
|
3751
4106
|
// src/primitives/Button/Button.styles.ts
|
|
3752
|
-
import { StyleSheet as
|
|
4107
|
+
import { StyleSheet as StyleSheet26 } from "react-native";
|
|
3753
4108
|
var fontWeight3 = (value) => value;
|
|
3754
|
-
var createStyles19 = (theme) =>
|
|
4109
|
+
var createStyles19 = (theme) => StyleSheet26.create({
|
|
3755
4110
|
button: {
|
|
3756
4111
|
flexDirection: "row",
|
|
3757
4112
|
alignItems: "center",
|
|
@@ -3872,9 +4227,9 @@ function Button({
|
|
|
3872
4227
|
const config = sizeMap[size];
|
|
3873
4228
|
const radius = shape === "square" ? theme.tokens.radius.sm : shape === "rounded" ? theme.tokens.radius.md : theme.tokens.radius.full;
|
|
3874
4229
|
const appearanceTheme = theme.components.button[color][appearance];
|
|
3875
|
-
const [isHovered, setIsHovered] =
|
|
3876
|
-
const [isFocused, setIsFocused] =
|
|
3877
|
-
const [labelWidth, setLabelWidth] =
|
|
4230
|
+
const [isHovered, setIsHovered] = useState8(false);
|
|
4231
|
+
const [isFocused, setIsFocused] = useState8(false);
|
|
4232
|
+
const [labelWidth, setLabelWidth] = useState8(0);
|
|
3878
4233
|
const isDisabled = disabled || loading;
|
|
3879
4234
|
const iconOnly = iconOnlyProp || !children && Boolean(iconStart || iconEnd);
|
|
3880
4235
|
const content = loading && loadingText ? loadingText : children;
|
|
@@ -3953,7 +4308,7 @@ function Button({
|
|
|
3953
4308
|
!loading && iconStart && renderIcon(iconStart, contentColor),
|
|
3954
4309
|
content && !iconOnly && /* @__PURE__ */ jsxs20(View29, { style: styles.labelSlot, children: [
|
|
3955
4310
|
/* @__PURE__ */ jsx35(
|
|
3956
|
-
|
|
4311
|
+
Text16,
|
|
3957
4312
|
{
|
|
3958
4313
|
onLayout: handleLabelLayout,
|
|
3959
4314
|
style: [
|
|
@@ -3969,7 +4324,7 @@ function Button({
|
|
|
3969
4324
|
}
|
|
3970
4325
|
),
|
|
3971
4326
|
measureLabel && /* @__PURE__ */ jsx35(
|
|
3972
|
-
|
|
4327
|
+
Text16,
|
|
3973
4328
|
{
|
|
3974
4329
|
accessibilityElementsHidden: true,
|
|
3975
4330
|
importantForAccessibility: "no-hide-descendants",
|
|
@@ -3987,7 +4342,7 @@ function Button({
|
|
|
3987
4342
|
)
|
|
3988
4343
|
] }),
|
|
3989
4344
|
badge && !iconOnly && /* @__PURE__ */ jsx35(
|
|
3990
|
-
|
|
4345
|
+
Text16,
|
|
3991
4346
|
{
|
|
3992
4347
|
style: [
|
|
3993
4348
|
styles.badge,
|
|
@@ -4000,7 +4355,7 @@ function Button({
|
|
|
4000
4355
|
}
|
|
4001
4356
|
),
|
|
4002
4357
|
shortcut && !iconOnly && /* @__PURE__ */ jsx35(
|
|
4003
|
-
|
|
4358
|
+
Text16,
|
|
4004
4359
|
{
|
|
4005
4360
|
style: [
|
|
4006
4361
|
styles.shortcut,
|
|
@@ -4019,14 +4374,14 @@ function Button({
|
|
|
4019
4374
|
}
|
|
4020
4375
|
|
|
4021
4376
|
// src/primitives/Checkbox/Checkbox.tsx
|
|
4022
|
-
import { forwardRef as forwardRef2, useEffect as
|
|
4377
|
+
import { forwardRef as forwardRef2, useEffect as useEffect8 } from "react";
|
|
4023
4378
|
import { useControllableState as useControllableState3 } from "@vellira-ui/core";
|
|
4024
4379
|
import { Check as Check2 } from "@vellira-ui/icons";
|
|
4025
|
-
import { Pressable as Pressable15, Text as
|
|
4380
|
+
import { Pressable as Pressable15, Text as Text17, View as View30 } from "react-native";
|
|
4026
4381
|
|
|
4027
4382
|
// src/primitives/Checkbox/Checkbox.styles.ts
|
|
4028
|
-
import { StyleSheet as
|
|
4029
|
-
var createStyles20 = (theme) =>
|
|
4383
|
+
import { StyleSheet as StyleSheet27 } from "react-native";
|
|
4384
|
+
var createStyles20 = (theme) => StyleSheet27.create({
|
|
4030
4385
|
container: {
|
|
4031
4386
|
gap: theme.tokens.spacing[2]
|
|
4032
4387
|
},
|
|
@@ -4227,7 +4582,7 @@ var Checkbox = forwardRef2(
|
|
|
4227
4582
|
const resolvedAccessibilityLabel = accessibilityLabel ?? label;
|
|
4228
4583
|
const resolvedAccessibilityHint = [accessibilityHint, description, error].filter(Boolean).join(" ");
|
|
4229
4584
|
const accessibilityChecked = indeterminate ? "mixed" : isChecked;
|
|
4230
|
-
|
|
4585
|
+
useEffect8(() => {
|
|
4231
4586
|
devWarning(
|
|
4232
4587
|
Boolean(resolvedAccessibilityLabel),
|
|
4233
4588
|
"Checkbox: an accessible label must be provided through label or accessibilityLabel."
|
|
@@ -4291,7 +4646,7 @@ var Checkbox = forwardRef2(
|
|
|
4291
4646
|
}
|
|
4292
4647
|
),
|
|
4293
4648
|
label && /* @__PURE__ */ jsxs21(
|
|
4294
|
-
|
|
4649
|
+
Text17,
|
|
4295
4650
|
{
|
|
4296
4651
|
style: [
|
|
4297
4652
|
styles.label,
|
|
@@ -4304,7 +4659,7 @@ var Checkbox = forwardRef2(
|
|
|
4304
4659
|
],
|
|
4305
4660
|
children: [
|
|
4306
4661
|
label,
|
|
4307
|
-
required && /* @__PURE__ */ jsx36(
|
|
4662
|
+
required && /* @__PURE__ */ jsx36(Text17, { style: styles.requiredMark, children: " *" })
|
|
4308
4663
|
]
|
|
4309
4664
|
}
|
|
4310
4665
|
)
|
|
@@ -4313,7 +4668,7 @@ var Checkbox = forwardRef2(
|
|
|
4313
4668
|
}
|
|
4314
4669
|
),
|
|
4315
4670
|
description && /* @__PURE__ */ jsx36(
|
|
4316
|
-
|
|
4671
|
+
Text17,
|
|
4317
4672
|
{
|
|
4318
4673
|
style: [
|
|
4319
4674
|
styles.descriptionText,
|
|
@@ -4323,21 +4678,21 @@ var Checkbox = forwardRef2(
|
|
|
4323
4678
|
children: description
|
|
4324
4679
|
}
|
|
4325
4680
|
),
|
|
4326
|
-
hasError && /* @__PURE__ */ jsx36(
|
|
4681
|
+
hasError && /* @__PURE__ */ jsx36(Text17, { style: [styles.errorText, helperTextSizeStyle[size]], children: error })
|
|
4327
4682
|
] });
|
|
4328
4683
|
}
|
|
4329
4684
|
);
|
|
4330
4685
|
Checkbox.displayName = "Checkbox";
|
|
4331
4686
|
|
|
4332
4687
|
// src/primitives/Input/Input.tsx
|
|
4333
|
-
import { cloneElement as cloneElement8, forwardRef as forwardRef3, useState as
|
|
4334
|
-
import { Pressable as Pressable16, Text as
|
|
4688
|
+
import { cloneElement as cloneElement8, forwardRef as forwardRef3, useState as useState9 } from "react";
|
|
4689
|
+
import { Pressable as Pressable16, Text as Text18, TextInput as TextInput2, View as View31 } from "react-native";
|
|
4335
4690
|
|
|
4336
4691
|
// src/primitives/Input/Input.styles.ts
|
|
4337
|
-
import { StyleSheet as
|
|
4692
|
+
import { StyleSheet as StyleSheet28 } from "react-native";
|
|
4338
4693
|
var getDisabledPlaceholderTextColor = (theme) => theme.components.input.disabled.placeholder;
|
|
4339
4694
|
var resolveRingColor = (ring) => typeof ring === "string" ? ring : ring.color;
|
|
4340
|
-
var createStyles21 = (theme) =>
|
|
4695
|
+
var createStyles21 = (theme) => StyleSheet28.create({
|
|
4341
4696
|
inputWrapper: {
|
|
4342
4697
|
position: "relative",
|
|
4343
4698
|
width: "100%",
|
|
@@ -4582,8 +4937,8 @@ var Input = forwardRef3(
|
|
|
4582
4937
|
const styles = useThemeStyles(createStyles21);
|
|
4583
4938
|
const field = useFormFieldContext();
|
|
4584
4939
|
const hasOwnField = Boolean(label || description || error);
|
|
4585
|
-
const [isFocused, setIsFocused] =
|
|
4586
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
4940
|
+
const [isFocused, setIsFocused] = useState9(false);
|
|
4941
|
+
const [uncontrolledValue, setUncontrolledValue] = useState9(
|
|
4587
4942
|
defaultValue ?? ""
|
|
4588
4943
|
);
|
|
4589
4944
|
const isControlled = value !== void 0;
|
|
@@ -4600,7 +4955,7 @@ var Input = forwardRef3(
|
|
|
4600
4955
|
const isReadOnly = readOnly || loading;
|
|
4601
4956
|
const placeholderTextColor = isDisabled ? getDisabledPlaceholderTextColor(theme) : readOnly ? theme.components.input.readOnly.placeholder : inputState.placeholder;
|
|
4602
4957
|
const isPassword = type === "password";
|
|
4603
|
-
const [isPasswordRevealed, setIsPasswordRevealed] =
|
|
4958
|
+
const [isPasswordRevealed, setIsPasswordRevealed] = useState9(false);
|
|
4604
4959
|
const resolvedIconSize = iconSize ?? 16;
|
|
4605
4960
|
const handleFocus = (event) => {
|
|
4606
4961
|
setIsFocused(true);
|
|
@@ -4712,7 +5067,7 @@ var Input = forwardRef3(
|
|
|
4712
5067
|
children: clearIcon ? cloneElement8(clearIcon, {
|
|
4713
5068
|
color: clearIconColor,
|
|
4714
5069
|
size: resolvedIconSize
|
|
4715
|
-
}) : /* @__PURE__ */ jsx37(
|
|
5070
|
+
}) : /* @__PURE__ */ jsx37(Text18, { style: [styles.clearButtonText, { color: clearIconColor }], children: "\xD7" })
|
|
4716
5071
|
}
|
|
4717
5072
|
) : showRevealButton ? /* @__PURE__ */ jsx37(
|
|
4718
5073
|
Pressable16,
|
|
@@ -4722,7 +5077,7 @@ var Input = forwardRef3(
|
|
|
4722
5077
|
hitSlop: 8,
|
|
4723
5078
|
onPress: () => setIsPasswordRevealed((revealed) => !revealed),
|
|
4724
5079
|
style: styles.revealButton,
|
|
4725
|
-
children: /* @__PURE__ */ jsx37(
|
|
5080
|
+
children: /* @__PURE__ */ jsx37(Text18, { style: styles.revealButtonText, children: isPasswordRevealed ? "Hide" : "Show" })
|
|
4726
5081
|
}
|
|
4727
5082
|
) : showRightIcon && endIcon && /* @__PURE__ */ jsx37(
|
|
4728
5083
|
View31,
|
|
@@ -4760,17 +5115,17 @@ var Input = forwardRef3(
|
|
|
4760
5115
|
Input.displayName = "Input";
|
|
4761
5116
|
|
|
4762
5117
|
// src/primitives/Radio/Radio.tsx
|
|
4763
|
-
import { forwardRef as forwardRef4, useEffect as
|
|
5118
|
+
import { forwardRef as forwardRef4, useEffect as useEffect9 } from "react";
|
|
4764
5119
|
import { useControllableState as useControllableState4 } from "@vellira-ui/core";
|
|
4765
5120
|
import {
|
|
4766
5121
|
Pressable as Pressable17,
|
|
4767
|
-
Text as
|
|
5122
|
+
Text as Text19,
|
|
4768
5123
|
View as View32
|
|
4769
5124
|
} from "react-native";
|
|
4770
5125
|
|
|
4771
5126
|
// src/primitives/Radio/Radio.styles.ts
|
|
4772
|
-
import { StyleSheet as
|
|
4773
|
-
var createStyles22 = (theme) =>
|
|
5127
|
+
import { StyleSheet as StyleSheet29 } from "react-native";
|
|
5128
|
+
var createStyles22 = (theme) => StyleSheet29.create({
|
|
4774
5129
|
root: {
|
|
4775
5130
|
alignSelf: "flex-start"
|
|
4776
5131
|
},
|
|
@@ -4929,7 +5284,7 @@ var Radio = forwardRef4(
|
|
|
4929
5284
|
};
|
|
4930
5285
|
const typographySize = typographySizeByRadioSize[resolvedSize];
|
|
4931
5286
|
const controlMarginTop = (typographySize.labelLineHeight - controlSize) / 2;
|
|
4932
|
-
|
|
5287
|
+
useEffect9(() => {
|
|
4933
5288
|
if (typeof __DEV__ !== "undefined" && __DEV__ && !label && !accessibilityLabel) {
|
|
4934
5289
|
console.warn(
|
|
4935
5290
|
"Radio requires either a visible label or accessibilityLabel."
|
|
@@ -5017,7 +5372,7 @@ var Radio = forwardRef4(
|
|
|
5017
5372
|
),
|
|
5018
5373
|
(label || description) && /* @__PURE__ */ jsxs23(View32, { pointerEvents: "none", style: styles.content, children: [
|
|
5019
5374
|
label && (typeof label === "string" ? /* @__PURE__ */ jsx38(
|
|
5020
|
-
|
|
5375
|
+
Text19,
|
|
5021
5376
|
{
|
|
5022
5377
|
style: [
|
|
5023
5378
|
styles.label,
|
|
@@ -5039,7 +5394,7 @@ var Radio = forwardRef4(
|
|
|
5039
5394
|
}
|
|
5040
5395
|
) : label),
|
|
5041
5396
|
description && (typeof description === "string" ? /* @__PURE__ */ jsx38(
|
|
5042
|
-
|
|
5397
|
+
Text19,
|
|
5043
5398
|
{
|
|
5044
5399
|
style: [
|
|
5045
5400
|
styles.description,
|
|
@@ -5058,7 +5413,7 @@ var Radio = forwardRef4(
|
|
|
5058
5413
|
}
|
|
5059
5414
|
),
|
|
5060
5415
|
error && /* @__PURE__ */ jsx38(
|
|
5061
|
-
|
|
5416
|
+
Text19,
|
|
5062
5417
|
{
|
|
5063
5418
|
accessibilityLiveRegion: "polite",
|
|
5064
5419
|
style: [
|