@xaui/native 0.9.1-alpha.36 → 0.9.1-alpha.38

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.
Files changed (153) hide show
  1. package/dist/{chunk-B6OKVLC7.js → chunk-26OGEFQI.js} +4 -4
  2. package/dist/{chunk-V5IVMZQJ.js → chunk-2PMXMKS5.js} +13 -8
  3. package/dist/{chunk-QZO57TPX.js → chunk-346QBNUD.js} +4 -4
  4. package/dist/{chunk-PPWXLZGL.js → chunk-3GFRSZYR.js} +15 -23
  5. package/dist/{chunk-GPZSTEEI.cjs → chunk-3JXI2IHV.cjs} +17 -17
  6. package/dist/{chunk-ISPOIMGX.cjs → chunk-4KFKWBN5.cjs} +26 -5
  7. package/dist/{chunk-N2U63JUX.cjs → chunk-4KSKQD37.cjs} +10 -10
  8. package/dist/{chunk-ZU3XQZ63.cjs → chunk-54CWXA34.cjs} +66 -66
  9. package/dist/{chunk-EFPWXJAJ.cjs → chunk-66FOASTP.cjs} +16 -16
  10. package/dist/{chunk-E5ZW7MBW.js → chunk-6CO6FM67.js} +17 -17
  11. package/dist/{chunk-54FJOKAN.cjs → chunk-7GHM4GKL.cjs} +25 -25
  12. package/dist/{chunk-2L7FOIWY.cjs → chunk-7TOG4TVU.cjs} +26 -26
  13. package/dist/{chunk-6N5ZCEAB.cjs → chunk-A7YB7YWX.cjs} +10 -10
  14. package/dist/{chunk-FVKIQBHS.cjs → chunk-AAVCMCJ3.cjs} +4 -4
  15. package/dist/{chunk-HQVVQGYV.cjs → chunk-ACAPTWE3.cjs} +16 -12
  16. package/dist/{chunk-LCDHTLSG.cjs → chunk-BNFIFRQA.cjs} +7 -7
  17. package/dist/{chunk-6U5IUUAR.js → chunk-DY3SUG5P.js} +5 -5
  18. package/dist/{chunk-RSGIJ6RI.js → chunk-EYD4H4X6.js} +2 -2
  19. package/dist/{chunk-DL2PGB5G.js → chunk-FBCWNXZC.js} +59 -59
  20. package/dist/{chunk-OWE5IID7.js → chunk-FHUYHV6J.js} +28 -7
  21. package/dist/{chunk-K7GAHNMJ.js → chunk-HA6BFY3A.js} +6 -6
  22. package/dist/{chunk-MFXZHLOU.cjs → chunk-HOI5425P.cjs} +16 -16
  23. package/dist/{chunk-VWATEE5O.js → chunk-IKJVLJKT.js} +15 -15
  24. package/dist/{chunk-YXPYOOHU.js → chunk-K72UDPVN.js} +27 -27
  25. package/dist/{chunk-2LNE4PWB.cjs → chunk-KSUV74BE.cjs} +5 -5
  26. package/dist/{chunk-UCW25LL6.js → chunk-LIUO6D3D.js} +76 -76
  27. package/dist/{chunk-U3HFQHGZ.js → chunk-LTX6TB5I.js} +4 -4
  28. package/dist/{chunk-OSCW7I4H.js → chunk-M63GFNKV.js} +19 -4
  29. package/dist/chunk-MESKS6AI.js +0 -0
  30. package/dist/{chunk-SAGMDVFU.js → chunk-MXGER5PI.js} +5 -5
  31. package/dist/{chunk-GHKJ6MUH.cjs → chunk-NCCRQK3P.cjs} +14 -14
  32. package/dist/chunk-NCTOTTVW.js +13 -0
  33. package/dist/chunk-OJCCV65P.cjs +1 -0
  34. package/dist/chunk-Q3MQ7S2D.cjs +476 -0
  35. package/dist/{chunk-CVCE7TW5.js → chunk-QZ24MZRX.js} +4 -4
  36. package/dist/{chunk-5GMU7ESV.js → chunk-R7BU4CPS.js} +3 -3
  37. package/dist/chunk-RAWGK2XK.cjs +971 -0
  38. package/dist/{chunk-PGQWUASE.cjs → chunk-RKCWYUGA.cjs} +6 -6
  39. package/dist/{chunk-3YZSUDZ2.js → chunk-S2WNWMNT.js} +4 -4
  40. package/dist/{chunk-XARBUUIE.cjs → chunk-S4QUM4EE.cjs} +12 -12
  41. package/dist/{chunk-OMV5MUTM.js → chunk-SACDOFGF.js} +16 -16
  42. package/dist/{chunk-FYCDRRJ2.cjs → chunk-SIP5J7HU.cjs} +25 -25
  43. package/dist/{chunk-AQXNEV6J.cjs → chunk-SNIHUKDA.cjs} +16 -16
  44. package/dist/{chunk-2OZPOWFB.js → chunk-SZLXPF3G.js} +4 -4
  45. package/dist/{chunk-RPOKLFRB.cjs → chunk-TDTUAIFF.cjs} +12 -12
  46. package/dist/{chunk-2SCE7TFZ.cjs → chunk-TGMVEHV7.cjs} +68 -68
  47. package/dist/{chunk-K3AVOT6L.cjs → chunk-TK44VBIE.cjs} +22 -7
  48. package/dist/{chunk-KZVHC4FL.js → chunk-TRETQZEW.js} +7 -7
  49. package/dist/{chunk-AZRMOWRG.cjs → chunk-URA25DU4.cjs} +10 -10
  50. package/dist/{chunk-BAPXLO5N.js → chunk-USF6EWYR.js} +7 -7
  51. package/dist/{chunk-TE7KVFE4.cjs → chunk-VZK3NLBH.cjs} +11 -11
  52. package/dist/{chunk-5BNIIDQD.cjs → chunk-WDDXU3OH.cjs} +14 -9
  53. package/dist/chunk-WFEMJCXO.cjs +13 -0
  54. package/dist/{chunk-JB5XANQY.js → chunk-WKCQ6VGW.js} +15 -11
  55. package/dist/{chunk-DOLWSO7A.js → chunk-XNMZQSY5.js} +5 -5
  56. package/dist/{chunk-K4TWKF5U.cjs → chunk-XSQPVDFH.cjs} +15 -25
  57. package/dist/{chunk-4XFEEBPU.js → chunk-XTC2SLFT.js} +2 -2
  58. package/dist/{chunk-ADQVA2FQ.cjs → chunk-XWNG2U4K.cjs} +5 -5
  59. package/dist/chunk-ZF6KIHXH.js +591 -0
  60. package/dist/chunk-ZNZ7HVRW.js +1106 -0
  61. package/dist/components/accordion/index.cjs +34 -0
  62. package/dist/components/accordion/index.d.cts +299 -0
  63. package/dist/components/accordion/index.d.ts +299 -0
  64. package/dist/components/accordion/index.js +34 -0
  65. package/dist/components/alert/index.cjs +7 -8
  66. package/dist/components/alert/index.d.cts +2 -2
  67. package/dist/components/alert/index.d.ts +2 -2
  68. package/dist/components/alert/index.js +6 -7
  69. package/dist/components/avatar/index.cjs +5 -6
  70. package/dist/components/avatar/index.d.cts +2 -2
  71. package/dist/components/avatar/index.d.ts +2 -2
  72. package/dist/components/avatar/index.js +4 -5
  73. package/dist/components/badge/index.cjs +4 -5
  74. package/dist/components/badge/index.d.cts +1 -1
  75. package/dist/components/badge/index.d.ts +1 -1
  76. package/dist/components/badge/index.js +3 -4
  77. package/dist/components/button/index.cjs +8 -8
  78. package/dist/components/button/index.d.cts +41 -41
  79. package/dist/components/button/index.d.ts +41 -41
  80. package/dist/components/button/index.js +7 -7
  81. package/dist/components/card/index.cjs +5 -6
  82. package/dist/components/card/index.d.cts +43 -43
  83. package/dist/components/card/index.d.ts +43 -43
  84. package/dist/components/card/index.js +4 -5
  85. package/dist/components/checkbox/index.cjs +5 -6
  86. package/dist/components/checkbox/index.d.cts +82 -82
  87. package/dist/components/checkbox/index.d.ts +82 -82
  88. package/dist/components/checkbox/index.js +4 -5
  89. package/dist/components/chip/index.cjs +7 -8
  90. package/dist/components/chip/index.d.cts +42 -42
  91. package/dist/components/chip/index.d.ts +42 -42
  92. package/dist/components/chip/index.js +6 -7
  93. package/dist/components/divider/index.cjs +4 -5
  94. package/dist/components/divider/index.d.cts +3 -3
  95. package/dist/components/divider/index.d.ts +3 -3
  96. package/dist/components/divider/index.js +3 -4
  97. package/dist/components/field-group/index.cjs +6 -7
  98. package/dist/components/field-group/index.d.cts +2 -2
  99. package/dist/components/field-group/index.d.ts +2 -2
  100. package/dist/components/field-group/index.js +5 -6
  101. package/dist/components/input-otp/index.cjs +4 -5
  102. package/dist/components/input-otp/index.d.cts +2 -2
  103. package/dist/components/input-otp/index.d.ts +2 -2
  104. package/dist/components/input-otp/index.js +3 -4
  105. package/dist/components/radio/index.cjs +5 -6
  106. package/dist/components/radio/index.d.cts +82 -82
  107. package/dist/components/radio/index.d.ts +82 -82
  108. package/dist/components/radio/index.js +4 -5
  109. package/dist/components/select/index.cjs +48 -0
  110. package/dist/components/select/index.d.cts +509 -0
  111. package/dist/components/select/index.d.ts +509 -0
  112. package/dist/components/select/index.js +48 -0
  113. package/dist/components/skeleton/index.cjs +3 -4
  114. package/dist/components/skeleton/index.d.cts +1 -1
  115. package/dist/components/skeleton/index.d.ts +1 -1
  116. package/dist/components/skeleton/index.js +2 -3
  117. package/dist/components/spinner/index.cjs +5 -5
  118. package/dist/components/spinner/index.d.cts +1 -1
  119. package/dist/components/spinner/index.d.ts +1 -1
  120. package/dist/components/spinner/index.js +4 -4
  121. package/dist/components/switch/index.cjs +5 -6
  122. package/dist/components/switch/index.d.cts +81 -81
  123. package/dist/components/switch/index.d.ts +81 -81
  124. package/dist/components/switch/index.js +4 -5
  125. package/dist/components/text-area/index.cjs +5 -6
  126. package/dist/components/text-area/index.js +4 -5
  127. package/dist/components/text-field/index.cjs +4 -5
  128. package/dist/components/text-field/index.d.cts +3 -3
  129. package/dist/components/text-field/index.d.ts +3 -3
  130. package/dist/components/text-field/index.js +3 -4
  131. package/dist/components/typography/index.cjs +4 -5
  132. package/dist/components/typography/index.d.cts +5 -5
  133. package/dist/components/typography/index.d.ts +5 -5
  134. package/dist/components/typography/index.js +3 -4
  135. package/dist/components/view/index.cjs +4 -5
  136. package/dist/components/view/index.d.cts +3 -3
  137. package/dist/components/view/index.d.ts +3 -3
  138. package/dist/components/view/index.js +3 -4
  139. package/dist/index.cjs +91 -31
  140. package/dist/index.d.cts +3 -1
  141. package/dist/index.d.ts +3 -1
  142. package/dist/index.js +125 -65
  143. package/dist/system/index.cjs +13 -11
  144. package/dist/system/index.d.cts +61 -35
  145. package/dist/system/index.d.ts +61 -35
  146. package/dist/system/index.js +13 -11
  147. package/dist/theme/index.cjs +4 -3
  148. package/dist/theme/index.d.cts +21 -1
  149. package/dist/theme/index.d.ts +21 -1
  150. package/dist/theme/index.js +3 -2
  151. package/package.json +21 -1
  152. package/dist/chunk-FJ5TLRT3.js +0 -21
  153. package/dist/chunk-HT7H35GU.cjs +0 -21
@@ -0,0 +1,1106 @@
1
+ import { Portal, PortalContext } from "./chunk-2PMXMKS5.js";
2
+ import { useMergedRef } from "./chunk-NCTOTTVW.js";
3
+ import { ChevronDownIcon, Icon, IconContext } from "./chunk-FHUYHV6J.js";
4
+ import { useControllableState } from "./chunk-F6W3JQ7K.js";
5
+ import { PressableFeedback } from "./chunk-LIUO6D3D.js";
6
+ import { usePressState } from "./chunk-423RQBOX.js";
7
+ import { childrenToString, createSlotContext } from "./chunk-K72UDPVN.js";
8
+ import { createRecipe, radiusAxis } from "./chunk-4GTAZM2C.js";
9
+ import { useXAUITheme } from "./chunk-A3EGFI6T.js";
10
+ import { useStyleProps } from "./chunk-M63GFNKV.js";
11
+
12
+ // src/components/select/select-content.tsx
13
+ import { forwardRef as forwardRef3, useContext, useEffect as useEffect2, useState } from "react";
14
+ import { ScrollView, useWindowDimensions } from "react-native";
15
+ import Animated from "react-native-reanimated";
16
+
17
+ // src/components/select/select.context.ts
18
+ var [SelectProvider, useSelect] = createSlotContext("Select");
19
+ var [SelectItemProvider, useSelectItem] = createSlotContext("Select.Item");
20
+
21
+ // src/components/select/select.animation.ts
22
+ import { Easing, Keyframe } from "react-native-reanimated";
23
+ var INDICATOR_SPRING = {
24
+ damping: 140,
25
+ stiffness: 1e3,
26
+ mass: 4
27
+ };
28
+ var INDICATOR_ROTATION = [0, -180];
29
+ var ENTER_MS = 200;
30
+ var EXIT_MS = 150;
31
+ function contentEntering(placement) {
32
+ const from = placement === "bottom" ? -8 : 8;
33
+ return new Keyframe({
34
+ 0: {
35
+ opacity: 0,
36
+ transform: [{
37
+ translateY: from
38
+ }, {
39
+ scale: 0.95
40
+ }]
41
+ },
42
+ 100: {
43
+ opacity: 1,
44
+ transform: [{
45
+ translateY: 0
46
+ }, {
47
+ scale: 1
48
+ }],
49
+ easing: Easing.out(Easing.cubic)
50
+ }
51
+ }).duration(ENTER_MS);
52
+ }
53
+ function contentExiting(placement) {
54
+ const to = placement === "bottom" ? -8 : 8;
55
+ return new Keyframe({
56
+ 0: {
57
+ opacity: 1,
58
+ transform: [{
59
+ translateY: 0
60
+ }, {
61
+ scale: 1
62
+ }]
63
+ },
64
+ 100: {
65
+ opacity: 0,
66
+ transform: [{
67
+ translateY: to
68
+ }, {
69
+ scale: 0.95
70
+ }],
71
+ easing: Easing.in(Easing.cubic)
72
+ }
73
+ }).duration(EXIT_MS);
74
+ }
75
+ var overlayEntering = new Keyframe({
76
+ 0: {
77
+ opacity: 0
78
+ },
79
+ 100: {
80
+ opacity: 1
81
+ }
82
+ }).duration(ENTER_MS);
83
+ var overlayExiting = new Keyframe({
84
+ 0: {
85
+ opacity: 1
86
+ },
87
+ 100: {
88
+ opacity: 0
89
+ }
90
+ }).duration(EXIT_MS);
91
+
92
+ // src/components/select/select-item.tsx
93
+ import { forwardRef as forwardRef2, useCallback, useEffect, useMemo } from "react";
94
+
95
+ // src/components/select/select-item-label.tsx
96
+ import { forwardRef } from "react";
97
+ import { Text } from "react-native";
98
+ import { jsx } from "react/jsx-runtime";
99
+ var SelectItemLabel = forwardRef(function SelectItemLabel2({
100
+ children,
101
+ numberOfLines = 1,
102
+ style,
103
+ ...props
104
+ }, ref) {
105
+ const {
106
+ itemLabelStyle
107
+ } = useSelect();
108
+ const [styleProps, rest] = useStyleProps(props);
109
+ return /* @__PURE__ */jsx(Text, {
110
+ ref,
111
+ numberOfLines,
112
+ ...rest,
113
+ style: [itemLabelStyle, styleProps, style],
114
+ children
115
+ });
116
+ });
117
+ SelectItemLabel.displayName = "XAUI.Select.ItemLabel";
118
+
119
+ // src/components/select/select-item.tsx
120
+ import { Fragment, jsx as jsx2 } from "react/jsx-runtime";
121
+ var SelectItem = forwardRef2(function SelectItem2({
122
+ value,
123
+ label,
124
+ children,
125
+ isDisabled = false,
126
+ asChild = false,
127
+ accessibilityRole = "menuitem",
128
+ accessibilityState,
129
+ style,
130
+ onPress,
131
+ onPressIn,
132
+ onPressOut,
133
+ ...props
134
+ }, ref) {
135
+ const {
136
+ itemStyle,
137
+ itemPressedStyle,
138
+ value: selected,
139
+ select,
140
+ registerLabel
141
+ } = useSelect();
142
+ const [styleProps, rest] = useStyleProps(props);
143
+ const [isPressed, press] = usePressState({
144
+ onPressIn,
145
+ onPressOut
146
+ });
147
+ const isSelected = selected === value;
148
+ const text = typeof children === "function" ? null : childrenToString(children);
149
+ const registered = label ?? text ?? void 0;
150
+ useEffect(() => {
151
+ if (registered !== void 0) registerLabel(value, registered);
152
+ }, [registerLabel, value, registered]);
153
+ const handlePress = useCallback(event => {
154
+ onPress?.(event);
155
+ select(value, registered);
156
+ }, [onPress, select, value, registered]);
157
+ const context = useMemo(() => ({
158
+ isSelected,
159
+ isPressed,
160
+ isDisabled
161
+ }), [isSelected, isPressed, isDisabled]);
162
+ return /* @__PURE__ */jsx2(SelectItemProvider, {
163
+ value: context,
164
+ children: /* @__PURE__ */jsx2(PressableFeedback, {
165
+ ref,
166
+ isPressed,
167
+ isDisabled,
168
+ asChild,
169
+ accessibilityRole,
170
+ accessibilityState: {
171
+ disabled: isDisabled,
172
+ selected: isSelected,
173
+ ...accessibilityState
174
+ },
175
+ ...rest,
176
+ style: [itemStyle, isPressed && itemPressedStyle, styleProps, typeof style === "function" ? style({
177
+ pressed: isPressed
178
+ }) : style],
179
+ onPress: handlePress,
180
+ onPressIn: press.onPressIn,
181
+ onPressOut: press.onPressOut,
182
+ children: typeof children === "function" ? children(context) : /* @__PURE__ */jsx2(Fragment, {
183
+ children: text !== null ? /* @__PURE__ */jsx2(SelectItemLabel, {
184
+ children: text
185
+ }) : children
186
+ })
187
+ })
188
+ });
189
+ });
190
+ SelectItem.displayName = "XAUI.Select.Item";
191
+
192
+ // src/components/select/select.utils.ts
193
+ import { Children, isValidElement } from "react";
194
+ function resolvePlacement(input) {
195
+ const {
196
+ anchor,
197
+ content,
198
+ window,
199
+ offset,
200
+ alignOffset,
201
+ insets
202
+ } = input;
203
+ const available = window.width - insets.start - insets.end;
204
+ const width = Math.min(resolveWidth(input), Math.max(available, 0));
205
+ const placement = choosePlacement(input);
206
+ const maxHeight = Math.max(roomFor(placement, input), 0);
207
+ const height = Math.min(content.height, maxHeight);
208
+ const top = placement === "bottom" ? anchor.y + anchor.height + offset : anchor.y - offset - height;
209
+ const start = clamp(alignedStart(input, width) + alignOffset, insets.start, Math.max(window.width - insets.end - width, insets.start));
210
+ return {
211
+ top,
212
+ start,
213
+ width,
214
+ maxHeight,
215
+ placement
216
+ };
217
+ }
218
+ function resolveWidth({
219
+ width,
220
+ anchor,
221
+ content
222
+ }) {
223
+ if (width === "trigger") return anchor.width;
224
+ if (width === "content-fit") return content.width;
225
+ return width;
226
+ }
227
+ function choosePlacement(input) {
228
+ const {
229
+ placement,
230
+ avoidCollisions,
231
+ content
232
+ } = input;
233
+ if (!avoidCollisions) return placement;
234
+ if (roomFor(placement, input) >= content.height) return placement;
235
+ const other = placement === "bottom" ? "top" : "bottom";
236
+ return roomFor(other, input) > roomFor(placement, input) ? other : placement;
237
+ }
238
+ function roomFor(placement, input) {
239
+ const {
240
+ anchor,
241
+ window,
242
+ offset,
243
+ insets
244
+ } = input;
245
+ return placement === "bottom" ? window.height - insets.bottom - (anchor.y + anchor.height) - offset : anchor.y - insets.top - offset;
246
+ }
247
+ function alignedStart({
248
+ align,
249
+ anchor
250
+ }, width) {
251
+ if (align === "start") return anchor.x;
252
+ if (align === "end") return anchor.x + anchor.width - width;
253
+ return anchor.x + (anchor.width - width) / 2;
254
+ }
255
+ function clamp(value, min, max) {
256
+ return Math.min(Math.max(value, min), max);
257
+ }
258
+ function collectItemLabels(children, isItem) {
259
+ const found = [];
260
+ const walk = node => {
261
+ Children.forEach(node, child => {
262
+ if (!isValidElement(child)) return;
263
+ const props = child.props;
264
+ if (isItem(child.type) && typeof props.value === "string") {
265
+ const label = props.label ?? childrenToString(props.children);
266
+ if (label !== null && label !== void 0) found.push([props.value, label]);
267
+ return;
268
+ }
269
+ walk(props.children);
270
+ });
271
+ };
272
+ walk(children);
273
+ return found;
274
+ }
275
+
276
+ // src/components/select/select-content.tsx
277
+ import { jsx as jsx3 } from "react/jsx-runtime";
278
+ var DEFAULT_OFFSET = 8;
279
+ var ZERO = {
280
+ x: 0,
281
+ y: 0
282
+ };
283
+ var isSelectItem = type => type === SelectItem;
284
+ var DEFAULT_INSETS = {
285
+ top: 12,
286
+ bottom: 12,
287
+ start: 12,
288
+ end: 12
289
+ };
290
+ var SelectContent = forwardRef3(function SelectContent2({
291
+ children,
292
+ placement = "bottom",
293
+ align = "center",
294
+ width = "trigger",
295
+ offset = DEFAULT_OFFSET,
296
+ alignOffset = 0,
297
+ avoidCollisions = true,
298
+ insets,
299
+ style,
300
+ onLayout,
301
+ ...props
302
+ }, ref) {
303
+ const context = useSelect();
304
+ const {
305
+ contentStyle,
306
+ isOpen,
307
+ anchor
308
+ } = context;
309
+ const [styleProps, rest] = useStyleProps(props);
310
+ const window = useWindowDimensions();
311
+ const origin = useContext(PortalContext)?.origin ?? ZERO;
312
+ const [measured, setMeasured] = useState(null);
313
+ const {
314
+ registerLabel
315
+ } = context;
316
+ useEffect2(() => {
317
+ for (const [value, label] of collectItemLabels(children, isSelectItem)) {
318
+ registerLabel(value, label);
319
+ }
320
+ }, [children, registerLabel]);
321
+ if (!isOpen && measured !== null) setMeasured(null);
322
+ if (!isOpen || anchor === null) return null;
323
+ const measure = event => {
324
+ onLayout?.(event);
325
+ const {
326
+ width: w,
327
+ height: h
328
+ } = event.nativeEvent.layout;
329
+ if (measured === null || measured.height !== h || measured.width !== w) {
330
+ setMeasured({
331
+ width: w,
332
+ height: h
333
+ });
334
+ }
335
+ };
336
+ const local = {
337
+ ...anchor,
338
+ x: anchor.x - origin.x,
339
+ y: anchor.y - origin.y
340
+ };
341
+ const position = measured && resolvePlacement({
342
+ anchor: local,
343
+ content: measured,
344
+ // The window in the host's own coordinates, for the same reason as the anchor.
345
+ window: {
346
+ width: window.width - origin.x,
347
+ height: window.height - origin.y
348
+ },
349
+ placement,
350
+ align,
351
+ width,
352
+ offset,
353
+ alignOffset,
354
+ avoidCollisions,
355
+ insets: {
356
+ ...DEFAULT_INSETS,
357
+ ...insets
358
+ }
359
+ });
360
+ return /* @__PURE__ */jsx3(Portal, {
361
+ children: /* @__PURE__ */jsx3(SelectProvider, {
362
+ value: context,
363
+ children: /* @__PURE__ */jsx3(Animated.View, {
364
+ ref,
365
+ entering: position ? contentEntering(position.placement) : void 0,
366
+ exiting: position ? contentExiting(position.placement) : void 0,
367
+ onLayout: measure,
368
+ ...rest,
369
+ style: [contentStyle,
370
+ // The measuring pass: laid out at the trigger's width so the rows wrap as they
371
+ // finally will, and invisible so the reader never sees it at the wrong place.
372
+ position === null ? {
373
+ opacity: 0,
374
+ top: 0,
375
+ start: 0,
376
+ width: local.width
377
+ } : {
378
+ top: position.top,
379
+ start: position.start,
380
+ width: position.width,
381
+ maxHeight: position.maxHeight
382
+ }, styleProps, style],
383
+ children: /* @__PURE__ */jsx3(ScrollView, {
384
+ bounces: false,
385
+ keyboardShouldPersistTaps: "handled",
386
+ showsVerticalScrollIndicator: false,
387
+ children
388
+ })
389
+ }, position?.placement ?? "measuring")
390
+ })
391
+ });
392
+ });
393
+ SelectContent.displayName = "XAUI.Select.Content";
394
+
395
+ // src/components/select/select-indicator.tsx
396
+ import { useEffect as useEffect3 } from "react";
397
+ import Animated2, { interpolate, useAnimatedStyle, useSharedValue, withSpring } from "react-native-reanimated";
398
+ import { jsx as jsx4 } from "react/jsx-runtime";
399
+ const _worklet_1818497961394_init_data = {
400
+ code: "function chunkZNZ7HVRWJs1(){const{interpolate,progress,INDICATOR_ROTATION}=this.__closure;return{transform:[{rotate:interpolate(progress.get(),[0,1],[INDICATOR_ROTATION[0],INDICATOR_ROTATION[1]])+\"deg\"}]};}",
401
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-ZNZ7HVRW.js",
402
+ sourceMap: "{\"version\":3,\"names\":[\"chunkZNZ7HVRWJs1\",\"interpolate\",\"progress\",\"INDICATOR_ROTATION\",\"__closure\",\"transform\",\"rotate\",\"get\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-ZNZ7HVRW.js\"],\"mappings\":\"AA0WoC,SAAAA,iBAAA,QAAAC,WAAA,CAAAC,QAAA,CAAAC,kBAAA,OAAAC,SAAA,OAAO,CACvCC,SAAS,CAAE,CACT,CACEC,MAAM,CAAKL,WAAW,CAACC,QAAQ,CAACK,GAAG,CAAC,CAAC,CAAE,CAAC,CAAC,CAAE,CAAC,CAAC,CAAE,CAACJ,kBAAkB,CAAC,CAAC,CAAC,CAAEA,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,MAChG,CAAC,CAEL,CAAC\",\"ignoreList\":[]}"
403
+ };
404
+ function SelectIndicator({
405
+ as = ChevronDownIcon,
406
+ ...props
407
+ }) {
408
+ const {
409
+ indicatorStyle,
410
+ isOpen
411
+ } = useSelect();
412
+ const progress = useSharedValue(isOpen ? 1 : 0);
413
+ useEffect3(() => {
414
+ progress.set(withSpring(isOpen ? 1 : 0, INDICATOR_SPRING));
415
+ }, [isOpen, progress]);
416
+ const rotation = useAnimatedStyle(function chunkZNZ7HVRWJs1Factory({
417
+ _worklet_1818497961394_init_data,
418
+ interpolate,
419
+ progress,
420
+ INDICATOR_ROTATION
421
+ }) {
422
+ const _e = [new global.Error(), -4, -27];
423
+ const chunkZNZ7HVRWJs1 = () => ({
424
+ transform: [{
425
+ rotate: `${interpolate(progress.get(), [0, 1], [INDICATOR_ROTATION[0], INDICATOR_ROTATION[1]])}deg`
426
+ }]
427
+ });
428
+ chunkZNZ7HVRWJs1.__closure = {
429
+ interpolate,
430
+ progress,
431
+ INDICATOR_ROTATION
432
+ };
433
+ chunkZNZ7HVRWJs1.__workletHash = 1818497961394;
434
+ chunkZNZ7HVRWJs1.__pluginVersion = "0.7.4";
435
+ chunkZNZ7HVRWJs1.__initData = _worklet_1818497961394_init_data;
436
+ chunkZNZ7HVRWJs1.__stackDetails = _e;
437
+ return chunkZNZ7HVRWJs1;
438
+ }({
439
+ _worklet_1818497961394_init_data,
440
+ interpolate,
441
+ progress,
442
+ INDICATOR_ROTATION
443
+ }));
444
+ return /* @__PURE__ */jsx4(Animated2.View, {
445
+ style: [indicatorStyle, rotation],
446
+ children: /* @__PURE__ */jsx4(Icon, {
447
+ as,
448
+ ...props
449
+ })
450
+ });
451
+ }
452
+ SelectIndicator.displayName = "XAUI.Select.Indicator";
453
+
454
+ // src/components/select/select-item-description.tsx
455
+ import { forwardRef as forwardRef4 } from "react";
456
+ import { Text as Text2 } from "react-native";
457
+ import { jsx as jsx5 } from "react/jsx-runtime";
458
+ var SelectItemDescription = forwardRef4(function SelectItemDescription2({
459
+ children,
460
+ style,
461
+ ...props
462
+ }, ref) {
463
+ const {
464
+ itemDescriptionStyle
465
+ } = useSelect();
466
+ const [styleProps, rest] = useStyleProps(props);
467
+ return /* @__PURE__ */jsx5(Text2, {
468
+ ref,
469
+ ...rest,
470
+ style: [itemDescriptionStyle, styleProps, style],
471
+ children
472
+ });
473
+ });
474
+ SelectItemDescription.displayName = "XAUI.Select.ItemDescription";
475
+
476
+ // src/components/select/select-item-indicator.tsx
477
+ import { View } from "react-native";
478
+
479
+ // src/components/select/check-icon.tsx
480
+ import { Path, Svg } from "react-native-svg";
481
+ import { jsx as jsx6 } from "react/jsx-runtime";
482
+ function CheckIcon({
483
+ size = 20,
484
+ color = "currentColor"
485
+ }) {
486
+ return /* @__PURE__ */jsx6(Svg, {
487
+ width: size,
488
+ height: size,
489
+ viewBox: "0 0 24 24",
490
+ fill: "none",
491
+ children: /* @__PURE__ */jsx6(Path, {
492
+ d: "m20 6-11 11-5-5",
493
+ stroke: color,
494
+ strokeWidth: 2,
495
+ strokeLinecap: "round",
496
+ strokeLinejoin: "round"
497
+ })
498
+ });
499
+ }
500
+ CheckIcon.displayName = "XAUI.Select.CheckIcon";
501
+
502
+ // src/components/select/select-item-indicator.tsx
503
+ import { jsx as jsx7 } from "react/jsx-runtime";
504
+ function SelectItemIndicator({
505
+ as = CheckIcon,
506
+ color,
507
+ ...props
508
+ }) {
509
+ const {
510
+ itemIndicatorStyle,
511
+ checkColor
512
+ } = useSelect();
513
+ const {
514
+ isSelected
515
+ } = useSelectItem();
516
+ return /* @__PURE__ */jsx7(View, {
517
+ style: itemIndicatorStyle,
518
+ children: isSelected ? /* @__PURE__ */jsx7(Icon, {
519
+ as,
520
+ color: color ?? checkColor,
521
+ ...props
522
+ }) : null
523
+ });
524
+ }
525
+ SelectItemIndicator.displayName = "XAUI.Select.ItemIndicator";
526
+
527
+ // src/components/select/select-label.tsx
528
+ import { forwardRef as forwardRef5 } from "react";
529
+ import { Text as Text3 } from "react-native";
530
+ import { jsx as jsx8 } from "react/jsx-runtime";
531
+ var SelectLabel = forwardRef5(function SelectLabel2({
532
+ children,
533
+ accessibilityRole = "header",
534
+ style,
535
+ ...props
536
+ }, ref) {
537
+ const {
538
+ labelStyle
539
+ } = useSelect();
540
+ const [styleProps, rest] = useStyleProps(props);
541
+ return /* @__PURE__ */jsx8(Text3, {
542
+ ref,
543
+ accessibilityRole,
544
+ ...rest,
545
+ style: [labelStyle, styleProps, style],
546
+ children
547
+ });
548
+ });
549
+ SelectLabel.displayName = "XAUI.Select.Label";
550
+
551
+ // src/components/select/select-overlay.tsx
552
+ import { forwardRef as forwardRef6 } from "react";
553
+ import { Pressable } from "react-native";
554
+ import Animated3 from "react-native-reanimated";
555
+ import { jsx as jsx9 } from "react/jsx-runtime";
556
+ var AnimatedPressable = Animated3.createAnimatedComponent(Pressable);
557
+ var SelectOverlay = forwardRef6(function SelectOverlay2({
558
+ children,
559
+ isDismissable = true,
560
+ style,
561
+ ...props
562
+ }, ref) {
563
+ const context = useSelect();
564
+ const {
565
+ overlayStyle,
566
+ isOpen,
567
+ close
568
+ } = context;
569
+ const [styleProps, rest] = useStyleProps(props);
570
+ if (!isOpen) return null;
571
+ return /* @__PURE__ */jsx9(Portal, {
572
+ children: /* @__PURE__ */jsx9(SelectProvider, {
573
+ value: context,
574
+ children: /* @__PURE__ */jsx9(AnimatedPressable, {
575
+ ref,
576
+ entering: overlayEntering,
577
+ exiting: overlayExiting,
578
+ accessibilityRole: "none",
579
+ importantForAccessibility: "no",
580
+ onPress: isDismissable ? close : void 0,
581
+ ...rest,
582
+ style: [overlayStyle, styleProps, style],
583
+ children
584
+ })
585
+ })
586
+ });
587
+ });
588
+ SelectOverlay.displayName = "XAUI.Select.Overlay";
589
+
590
+ // src/components/select/select-trigger.tsx
591
+ import { forwardRef as forwardRef7, useCallback as useCallback2, useEffect as useEffect4, useRef } from "react";
592
+ import { jsx as jsx10 } from "react/jsx-runtime";
593
+ var SelectTrigger = forwardRef7(function SelectTrigger2({
594
+ children,
595
+ asChild = false,
596
+ accessibilityRole = "button",
597
+ accessibilityState,
598
+ style,
599
+ onLayout,
600
+ onPressIn,
601
+ onPressOut,
602
+ onPress,
603
+ ...props
604
+ }, ref) {
605
+ const {
606
+ triggerStyle,
607
+ triggerPressedStyle,
608
+ glyph,
609
+ isOpen,
610
+ isDisabled,
611
+ isInvalid,
612
+ toggle,
613
+ setAnchor
614
+ } = useSelect();
615
+ const [styleProps, rest] = useStyleProps(props);
616
+ const [isPressed, press] = usePressState({
617
+ onPressIn,
618
+ onPressOut
619
+ });
620
+ const node = useRef(null);
621
+ const refs = useMergedRef(node, ref);
622
+ const measure = useCallback2(() => {
623
+ node.current?.measureInWindow((x, y, width, height) => {
624
+ setAnchor({
625
+ x,
626
+ y,
627
+ width,
628
+ height
629
+ });
630
+ });
631
+ }, [setAnchor]);
632
+ const handleLayout = useCallback2(event => {
633
+ onLayout?.(event);
634
+ measure();
635
+ }, [measure, onLayout]);
636
+ useEffect4(() => {
637
+ if (isOpen) measure();
638
+ }, [isOpen, measure]);
639
+ const handlePress = useCallback2(event => {
640
+ onPress?.(event);
641
+ measure();
642
+ toggle();
643
+ }, [measure, onPress, toggle]);
644
+ return /* @__PURE__ */jsx10(IconContext.Provider, {
645
+ value: glyph,
646
+ children: /* @__PURE__ */jsx10(PressableFeedback, {
647
+ ref: refs,
648
+ isPressed,
649
+ isDisabled,
650
+ asChild,
651
+ accessibilityRole,
652
+ accessibilityState: {
653
+ disabled: isDisabled,
654
+ expanded: isOpen,
655
+ ...accessibilityState
656
+ },
657
+ "aria-invalid": isInvalid || void 0,
658
+ ...rest,
659
+ onLayout: handleLayout,
660
+ style: [triggerStyle, isPressed && triggerPressedStyle, styleProps, typeof style === "function" ? style({
661
+ pressed: isPressed
662
+ }) : style],
663
+ onPress: handlePress,
664
+ onPressIn: press.onPressIn,
665
+ onPressOut: press.onPressOut,
666
+ children
667
+ })
668
+ });
669
+ });
670
+ SelectTrigger.displayName = "XAUI.Select.Trigger";
671
+
672
+ // src/components/select/select-value.tsx
673
+ import { forwardRef as forwardRef8 } from "react";
674
+ import { Text as Text4 } from "react-native";
675
+ import { jsx as jsx11 } from "react/jsx-runtime";
676
+ var SelectValue = forwardRef8(function SelectValue2({
677
+ placeholder,
678
+ children,
679
+ numberOfLines = 1,
680
+ style,
681
+ ...props
682
+ }, ref) {
683
+ const {
684
+ valueStyle,
685
+ placeholderStyle,
686
+ value,
687
+ labelFor
688
+ } = useSelect();
689
+ const [styleProps, rest] = useStyleProps(props);
690
+ const label = children ?? (value !== void 0 ? labelFor(value) : void 0);
691
+ const isEmpty = label === void 0 || label === "";
692
+ return /* @__PURE__ */jsx11(Text4, {
693
+ ref,
694
+ numberOfLines,
695
+ ...rest,
696
+ style: [valueStyle, isEmpty && placeholderStyle, styleProps, style],
697
+ children: isEmpty ? placeholder : label
698
+ });
699
+ });
700
+ SelectValue.displayName = "XAUI.Select.Value";
701
+
702
+ // src/components/select/select.tsx
703
+ import { useCallback as useCallback4, useMemo as useMemo3, useState as useState3 } from "react";
704
+ import { StyleSheet } from "react-native";
705
+
706
+ // src/components/select/select.hook.ts
707
+ import { useCallback as useCallback3, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
708
+ function useLabelRegistry() {
709
+ const labels = useRef2(/* @__PURE__ */new Map());
710
+ const [, force] = useState2(0);
711
+ const registerLabel = useCallback3((value, label) => {
712
+ if (labels.current.get(value) === label) return;
713
+ labels.current.set(value, label);
714
+ force(n => n + 1);
715
+ }, []);
716
+ const labelFor = useCallback3(value => labels.current.get(value), []);
717
+ return useMemo2(() => ({
718
+ labelFor,
719
+ registerLabel
720
+ }), [labelFor, registerLabel]);
721
+ }
722
+
723
+ // src/components/select/select.recipe.ts
724
+ var SLOTS = ["trigger", "value", "placeholder", "indicator", "overlay", "content", "label", "item", "itemLabel", "itemDescription", "itemIndicator"];
725
+ var VARIANT_TOKENS = {
726
+ primary: {
727
+ bg: "fieldBackground",
728
+ border: "fieldBorder",
729
+ borderFocus: "fieldBorderFocus",
730
+ fg: "fieldForeground"
731
+ },
732
+ secondary: {
733
+ bg: "default",
734
+ border: "fieldBorder",
735
+ borderFocus: "fieldBorderFocus",
736
+ fg: "fieldForeground"
737
+ },
738
+ tertiary: {
739
+ border: "fieldBorder",
740
+ borderFocus: "fieldBorderFocus",
741
+ fg: "fieldForeground"
742
+ },
743
+ ghost: {
744
+ borderFocus: "fieldBorderFocus",
745
+ fg: "fieldForeground"
746
+ }
747
+ };
748
+ var SIZES = {
749
+ sm: {
750
+ control: "sm",
751
+ padding: 3,
752
+ gap: 2.5,
753
+ value: "md",
754
+ glyph: "lg",
755
+ listLabel: "xs",
756
+ description: "xs"
757
+ },
758
+ md: {
759
+ control: "md",
760
+ padding: 3,
761
+ gap: 3,
762
+ value: "md",
763
+ glyph: "lg",
764
+ listLabel: "sm",
765
+ description: "sm"
766
+ },
767
+ lg: {
768
+ control: "lg",
769
+ padding: 4,
770
+ gap: 3,
771
+ value: "lg",
772
+ glyph: "xl",
773
+ listLabel: "md",
774
+ description: "md"
775
+ }
776
+ };
777
+ var LIST = {
778
+ /** Panel padding, and the inset the rows sit in. */
779
+ padding: 3,
780
+ itemPaddingHorizontal: 2,
781
+ itemPaddingVertical: 3,
782
+ itemGap: 2,
783
+ labelPaddingHorizontal: 2,
784
+ labelPaddingVertical: 1.5,
785
+ /** The check's box, in spacing steps like the rest — five of them, HeroUI's twenty. */
786
+ indicator: 5
787
+ };
788
+ function sizeAxis(step) {
789
+ const {
790
+ control,
791
+ padding,
792
+ gap,
793
+ value,
794
+ glyph,
795
+ listLabel,
796
+ description
797
+ } = step;
798
+ return theme => {
799
+ const valueType = {
800
+ fontSize: theme.fontSizes[value],
801
+ lineHeight: theme.lineHeights[value]
802
+ };
803
+ return {
804
+ trigger: {
805
+ // Fixed, not a minimum: a control has a height, and a label too long for it
806
+ // truncates rather than deforming the field it shares a row with.
807
+ height: theme.controlHeights[control],
808
+ paddingHorizontal: theme.spacing(padding),
809
+ gap: theme.spacing(gap)
810
+ },
811
+ value: valueType,
812
+ placeholder: valueType,
813
+ indicator: {
814
+ fontSize: theme.fontSizes[glyph]
815
+ },
816
+ label: {
817
+ fontSize: theme.fontSizes[listLabel],
818
+ lineHeight: theme.lineHeights[listLabel]
819
+ },
820
+ itemLabel: valueType,
821
+ itemDescription: {
822
+ fontSize: theme.fontSizes[description],
823
+ lineHeight: theme.lineHeights[description]
824
+ }
825
+ };
826
+ };
827
+ }
828
+ var selectRecipe = createRecipe({
829
+ slots: SLOTS,
830
+ base: theme => ({
831
+ trigger: {
832
+ flexDirection: "row",
833
+ alignItems: "center",
834
+ justifyContent: "space-between",
835
+ borderWidth: theme.borderWidth.field,
836
+ borderRadius: theme.radius.field,
837
+ borderCurve: "continuous"
838
+ },
839
+ value: {
840
+ fontFamily: theme.fontFamilies.body,
841
+ // `regular`, as on the field: a chosen value is content, not the control's label.
842
+ fontWeight: theme.fontWeights.regular,
843
+ // Without it a long value pushes the chevron off the end of the trigger instead of
844
+ // truncating, because a row gives a text node its intrinsic width by default.
845
+ flexShrink: 1
846
+ },
847
+ placeholder: {
848
+ color: theme.colors.fieldPlaceholder
849
+ },
850
+ indicator: {
851
+ alignItems: "center",
852
+ justifyContent: "center"
853
+ },
854
+ overlay: {
855
+ position: "absolute",
856
+ top: 0,
857
+ bottom: 0,
858
+ start: 0,
859
+ end: 0
860
+ },
861
+ content: {
862
+ position: "absolute",
863
+ backgroundColor: theme.colors.overlay,
864
+ padding: theme.spacing(LIST.padding),
865
+ // The panel is not the field, so it is rounder — but not by three steps of our
866
+ // scale. HeroUI's panel is their `--radius-3xl` on a base of 8, which is 24 points;
867
+ // ours is a base of 12, so the same 24 is `2xl`. Reading their key rather than
868
+ // their number is what put a 36-point corner on it and made it read as a pill.
869
+ borderRadius: theme.radius["2xl"],
870
+ borderCurve: "continuous",
871
+ ...theme.shadows.overlay
872
+ },
873
+ label: {
874
+ fontFamily: theme.fontFamilies.body,
875
+ fontWeight: theme.fontWeights.medium,
876
+ color: theme.colors.muted,
877
+ paddingHorizontal: theme.spacing(LIST.labelPaddingHorizontal),
878
+ paddingVertical: theme.spacing(LIST.labelPaddingVertical)
879
+ },
880
+ item: {
881
+ flexDirection: "row",
882
+ alignItems: "center",
883
+ justifyContent: "space-between",
884
+ gap: theme.spacing(LIST.itemGap),
885
+ paddingHorizontal: theme.spacing(LIST.itemPaddingHorizontal),
886
+ paddingVertical: theme.spacing(LIST.itemPaddingVertical),
887
+ borderRadius: theme.radius.md,
888
+ borderCurve: "continuous"
889
+ },
890
+ itemLabel: {
891
+ fontFamily: theme.fontFamilies.body,
892
+ // `medium`, unlike the trigger's value: a row in a list is a target being offered,
893
+ // and the weight is what separates it from the description under it.
894
+ fontWeight: theme.fontWeights.medium,
895
+ color: theme.colors.overlayForeground,
896
+ flexShrink: 1
897
+ },
898
+ itemDescription: {
899
+ fontFamily: theme.fontFamilies.body,
900
+ color: theme.colors.muted
901
+ },
902
+ itemIndicator: {
903
+ width: theme.spacing(LIST.indicator),
904
+ height: theme.spacing(LIST.indicator),
905
+ alignItems: "center",
906
+ justifyContent: "center"
907
+ }
908
+ }),
909
+ variantTokens: VARIANT_TOKENS,
910
+ /**
911
+ * The variant paints the **trigger only**. The list is a floating surface of the
912
+ * theme's own — a `ghost` select does not open a ghost panel, it opens the same panel
913
+ * every other select opens, because the panel is not part of the control's emphasis.
914
+ */
915
+ paint: (theme, colors) => ({
916
+ trigger: {
917
+ backgroundColor: colors.bg,
918
+ borderColor: colors.border,
919
+ borderWidth: colors.border ? theme.borderWidth.field : 0
920
+ },
921
+ value: {
922
+ color: colors.fg
923
+ },
924
+ indicator: {
925
+ color: theme.colors.fieldPlaceholder
926
+ }
927
+ }),
928
+ variants: {
929
+ size: {
930
+ sm: sizeAxis(SIZES.sm),
931
+ md: sizeAxis(SIZES.md),
932
+ lg: sizeAxis(SIZES.lg)
933
+ },
934
+ radius: radiusAxis("trigger"),
935
+ /**
936
+ * Open is not `focused`: the field's focus border is what a keyboard gives a text
937
+ * input, and a select that is open has no caret in it. It borrows the same token
938
+ * because the two mean the same thing to the eye — this control is the live one.
939
+ */
940
+ isOpen: {
941
+ true: theme => ({
942
+ trigger: {
943
+ borderColor: theme.colors.fieldBorderFocus
944
+ }
945
+ })
946
+ },
947
+ isInvalid: {
948
+ true: theme => ({
949
+ trigger: {
950
+ borderColor: theme.colors.danger
951
+ }
952
+ })
953
+ }
954
+ },
955
+ states: {
956
+ pressed: theme => ({
957
+ trigger: {
958
+ backgroundColor: theme.colors.fieldPressed
959
+ },
960
+ item: {
961
+ backgroundColor: theme.colors.defaultSoftPressed
962
+ }
963
+ }),
964
+ disabled: theme => ({
965
+ trigger: {
966
+ opacity: theme.opacity.disabled
967
+ }
968
+ })
969
+ },
970
+ defaultVariants: {
971
+ variant: "primary",
972
+ size: "md"
973
+ }
974
+ });
975
+
976
+ // src/components/select/select.tsx
977
+ import { jsx as jsx12 } from "react/jsx-runtime";
978
+ function Select({
979
+ children,
980
+ variant,
981
+ size,
982
+ radius,
983
+ color,
984
+ value: controlledValue,
985
+ defaultValue,
986
+ onValueChange,
987
+ isOpen: controlledOpen,
988
+ defaultOpen = false,
989
+ onOpenChange,
990
+ isDisabled = false,
991
+ isInvalid = false
992
+ }) {
993
+ const theme = useXAUITheme();
994
+ const {
995
+ labelFor,
996
+ registerLabel
997
+ } = useLabelRegistry();
998
+ const [anchor, setAnchor] = useState3(null);
999
+ const [value, setValue] = useControllableState({
1000
+ value: controlledValue,
1001
+ defaultValue,
1002
+ onChange: onValueChange
1003
+ });
1004
+ const [isOpen, setOpen] = useControllableState({
1005
+ value: controlledOpen,
1006
+ defaultValue: defaultOpen,
1007
+ onChange: onOpenChange
1008
+ });
1009
+ const selection = {
1010
+ variant,
1011
+ size,
1012
+ radius,
1013
+ isOpen: isOpen ? "true" : void 0,
1014
+ isInvalid: isInvalid ? "true" : void 0
1015
+ };
1016
+ const styles = selectRecipe.resolve({
1017
+ theme,
1018
+ selection,
1019
+ states: {
1020
+ disabled: isDisabled
1021
+ }
1022
+ });
1023
+ const pressed = selectRecipe.resolve({
1024
+ theme,
1025
+ selection,
1026
+ states: {
1027
+ pressed: true
1028
+ }
1029
+ });
1030
+ const tint = color ? selectRecipe.tint({
1031
+ theme,
1032
+ color,
1033
+ selection
1034
+ }) : void 0;
1035
+ const open = useCallback4(() => setOpen(true), [setOpen]);
1036
+ const close = useCallback4(() => setOpen(false), [setOpen]);
1037
+ const toggle = useCallback4(() => setOpen(!isOpen), [isOpen, setOpen]);
1038
+ const select = useCallback4((next, label) => {
1039
+ if (label !== void 0) registerLabel(next, label);
1040
+ setValue(next);
1041
+ setOpen(false);
1042
+ }, [registerLabel, setValue, setOpen]);
1043
+ const context = useMemo3(() => {
1044
+ const indicator = StyleSheet.flatten([styles.indicator, tint?.indicator]);
1045
+ const itemLabel = StyleSheet.flatten([styles.itemLabel]);
1046
+ const tintedPlaceholder = tint ? StyleSheet.flatten([tint.value]).color : void 0;
1047
+ return {
1048
+ triggerStyle: tint ? [styles.trigger, tint.trigger] : styles.trigger,
1049
+ triggerPressedStyle: pressed.trigger,
1050
+ valueStyle: tint ? [styles.value, tint.value] : styles.value,
1051
+ placeholderStyle: tintedPlaceholder ? [styles.placeholder, {
1052
+ color: tintedPlaceholder
1053
+ }] : styles.placeholder,
1054
+ indicatorStyle: styles.indicator,
1055
+ overlayStyle: styles.overlay,
1056
+ contentStyle: styles.content,
1057
+ labelStyle: styles.label,
1058
+ itemStyle: styles.item,
1059
+ itemPressedStyle: pressed.item,
1060
+ itemLabelStyle: styles.itemLabel,
1061
+ itemDescriptionStyle: styles.itemDescription,
1062
+ itemIndicatorStyle: styles.itemIndicator,
1063
+ glyph: {
1064
+ size: indicator.fontSize,
1065
+ // `ColorValue` also covers the platform's opaque colours, which `Icon` cannot
1066
+ // hand to a third-party component expecting a string.
1067
+ color: typeof indicator.color === "string" ? indicator.color : void 0
1068
+ },
1069
+ // The check reads the row's own colour rather than the chevron's: it belongs to the
1070
+ // list, and the chevron belongs to the field.
1071
+ checkColor: typeof itemLabel.color === "string" ? itemLabel.color : void 0,
1072
+ value,
1073
+ isOpen,
1074
+ isDisabled,
1075
+ isInvalid,
1076
+ open,
1077
+ close,
1078
+ toggle,
1079
+ select,
1080
+ anchor,
1081
+ setAnchor,
1082
+ labelFor,
1083
+ registerLabel
1084
+ };
1085
+ }, [styles, pressed, tint, value, isOpen, isDisabled, isInvalid, open, close, toggle, select, anchor, labelFor, registerLabel]);
1086
+ return /* @__PURE__ */jsx12(SelectProvider, {
1087
+ value: context,
1088
+ children
1089
+ });
1090
+ }
1091
+ Select.displayName = "XAUI.Select.Root";
1092
+
1093
+ // src/components/select/index.ts
1094
+ var Select2 = Object.assign(Select, {
1095
+ Trigger: SelectTrigger,
1096
+ Value: SelectValue,
1097
+ Indicator: SelectIndicator,
1098
+ Overlay: SelectOverlay,
1099
+ Content: SelectContent,
1100
+ Label: SelectLabel,
1101
+ Item: SelectItem,
1102
+ ItemLabel: SelectItemLabel,
1103
+ ItemDescription: SelectItemDescription,
1104
+ ItemIndicator: SelectItemIndicator
1105
+ });
1106
+ export { useSelect, useSelectItem, SelectItemLabel, SelectItem, SelectContent, SelectIndicator, SelectItemDescription, CheckIcon, SelectItemIndicator, SelectLabel, SelectOverlay, SelectTrigger, SelectValue, selectRecipe, Select, Select2 };