@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,971 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+
4
+ var _chunkWDDXU3OHcjs = require('./chunk-WDDXU3OH.cjs');
5
+
6
+
7
+ var _chunkWFEMJCXOcjs = require('./chunk-WFEMJCXO.cjs');
8
+
9
+
10
+
11
+
12
+ var _chunk4KFKWBN5cjs = require('./chunk-4KFKWBN5.cjs');
13
+
14
+
15
+ var _chunk7EIHHOHPcjs = require('./chunk-7EIHHOHP.cjs');
16
+
17
+
18
+ var _chunkTGMVEHV7cjs = require('./chunk-TGMVEHV7.cjs');
19
+
20
+
21
+ var _chunk7DPL3ZDScjs = require('./chunk-7DPL3ZDS.cjs');
22
+
23
+
24
+
25
+ var _chunk7GHM4GKLcjs = require('./chunk-7GHM4GKL.cjs');
26
+
27
+
28
+
29
+ var _chunkFNEUOBCVcjs = require('./chunk-FNEUOBCV.cjs');
30
+
31
+
32
+ var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
33
+
34
+
35
+ var _chunkTK44VBIEcjs = require('./chunk-TK44VBIE.cjs');
36
+
37
+ // src/components/select/select-content.tsx
38
+ var _react = require('react');
39
+ var _reactnative = require('react-native');
40
+ var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
41
+
42
+ // src/components/select/select.context.ts
43
+ var [SelectProvider, useSelect] = _chunk7GHM4GKLcjs.createSlotContext.call(void 0, "Select");
44
+ var [SelectItemProvider, useSelectItem] = _chunk7GHM4GKLcjs.createSlotContext.call(void 0, "Select.Item");
45
+
46
+ // src/components/select/select.animation.ts
47
+
48
+ var INDICATOR_SPRING = {
49
+ damping: 140,
50
+ stiffness: 1e3,
51
+ mass: 4
52
+ };
53
+ var INDICATOR_ROTATION = [0, -180];
54
+ var ENTER_MS = 200;
55
+ var EXIT_MS = 150;
56
+ function contentEntering(placement) {
57
+ const from = placement === "bottom" ? -8 : 8;
58
+ return new (0, _reactnativereanimated.Keyframe)({
59
+ 0: {
60
+ opacity: 0,
61
+ transform: [{ translateY: from }, { scale: 0.95 }]
62
+ },
63
+ 100: {
64
+ opacity: 1,
65
+ transform: [{ translateY: 0 }, { scale: 1 }],
66
+ easing: _reactnativereanimated.Easing.out(_reactnativereanimated.Easing.cubic)
67
+ }
68
+ }).duration(ENTER_MS);
69
+ }
70
+ function contentExiting(placement) {
71
+ const to = placement === "bottom" ? -8 : 8;
72
+ return new (0, _reactnativereanimated.Keyframe)({
73
+ 0: { opacity: 1, transform: [{ translateY: 0 }, { scale: 1 }] },
74
+ 100: {
75
+ opacity: 0,
76
+ transform: [{ translateY: to }, { scale: 0.95 }],
77
+ easing: _reactnativereanimated.Easing.in(_reactnativereanimated.Easing.cubic)
78
+ }
79
+ }).duration(EXIT_MS);
80
+ }
81
+ var overlayEntering = new (0, _reactnativereanimated.Keyframe)({
82
+ 0: { opacity: 0 },
83
+ 100: { opacity: 1 }
84
+ }).duration(ENTER_MS);
85
+ var overlayExiting = new (0, _reactnativereanimated.Keyframe)({
86
+ 0: { opacity: 1 },
87
+ 100: { opacity: 0 }
88
+ }).duration(EXIT_MS);
89
+
90
+ // src/components/select/select-item.tsx
91
+
92
+
93
+ // src/components/select/select-item-label.tsx
94
+
95
+
96
+ var _jsxruntime = require('react/jsx-runtime');
97
+ var SelectItemLabel = _react.forwardRef.call(void 0,
98
+ function SelectItemLabel2({ children, numberOfLines = 1, style, ...props }, ref) {
99
+ const { itemLabelStyle } = useSelect();
100
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
101
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
102
+ _reactnative.Text,
103
+ {
104
+ ref,
105
+ numberOfLines,
106
+ ...rest,
107
+ style: [itemLabelStyle, styleProps, style],
108
+ children
109
+ }
110
+ );
111
+ }
112
+ );
113
+ SelectItemLabel.displayName = "XAUI.Select.ItemLabel";
114
+
115
+ // src/components/select/select-item.tsx
116
+
117
+ var SelectItem = _react.forwardRef.call(void 0, function SelectItem2({
118
+ value,
119
+ label,
120
+ children,
121
+ isDisabled = false,
122
+ asChild = false,
123
+ accessibilityRole = "menuitem",
124
+ accessibilityState,
125
+ style,
126
+ onPress,
127
+ onPressIn,
128
+ onPressOut,
129
+ ...props
130
+ }, ref) {
131
+ const {
132
+ itemStyle,
133
+ itemPressedStyle,
134
+ value: selected,
135
+ select,
136
+ registerLabel
137
+ } = useSelect();
138
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
139
+ const [isPressed, press] = _chunk7DPL3ZDScjs.usePressState.call(void 0, { onPressIn, onPressOut });
140
+ const isSelected = selected === value;
141
+ const text = typeof children === "function" ? null : _chunk7GHM4GKLcjs.childrenToString.call(void 0, children);
142
+ const registered = _nullishCoalesce(_nullishCoalesce(label, () => ( text)), () => ( void 0));
143
+ _react.useEffect.call(void 0, () => {
144
+ if (registered !== void 0) registerLabel(value, registered);
145
+ }, [registerLabel, value, registered]);
146
+ const handlePress = _react.useCallback.call(void 0,
147
+ (event) => {
148
+ _optionalChain([onPress, 'optionalCall', _ => _(event)]);
149
+ select(value, registered);
150
+ },
151
+ [onPress, select, value, registered]
152
+ );
153
+ const context = _react.useMemo.call(void 0,
154
+ () => ({ isSelected, isPressed, isDisabled }),
155
+ [isSelected, isPressed, isDisabled]
156
+ );
157
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectItemProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
158
+ _chunkTGMVEHV7cjs.PressableFeedback,
159
+ {
160
+ ref,
161
+ isPressed,
162
+ isDisabled,
163
+ asChild,
164
+ accessibilityRole,
165
+ accessibilityState: {
166
+ disabled: isDisabled,
167
+ selected: isSelected,
168
+ ...accessibilityState
169
+ },
170
+ ...rest,
171
+ style: [
172
+ itemStyle,
173
+ isPressed && itemPressedStyle,
174
+ styleProps,
175
+ typeof style === "function" ? style({ pressed: isPressed }) : style
176
+ ],
177
+ onPress: handlePress,
178
+ onPressIn: press.onPressIn,
179
+ onPressOut: press.onPressOut,
180
+ children: typeof children === "function" ? children(context) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: text !== null ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectItemLabel, { children: text }) : children })
181
+ }
182
+ ) });
183
+ });
184
+ SelectItem.displayName = "XAUI.Select.Item";
185
+
186
+ // src/components/select/select.utils.ts
187
+
188
+ function resolvePlacement(input) {
189
+ const { anchor, content, window, offset, alignOffset, insets } = input;
190
+ const available = window.width - insets.start - insets.end;
191
+ const width = Math.min(resolveWidth(input), Math.max(available, 0));
192
+ const placement = choosePlacement(input);
193
+ const maxHeight = Math.max(roomFor(placement, input), 0);
194
+ const height = Math.min(content.height, maxHeight);
195
+ const top = placement === "bottom" ? anchor.y + anchor.height + offset : anchor.y - offset - height;
196
+ const start = clamp(
197
+ alignedStart(input, width) + alignOffset,
198
+ insets.start,
199
+ Math.max(window.width - insets.end - width, insets.start)
200
+ );
201
+ return { top, start, width, maxHeight, placement };
202
+ }
203
+ function resolveWidth({ width, anchor, content }) {
204
+ if (width === "trigger") return anchor.width;
205
+ if (width === "content-fit") return content.width;
206
+ return width;
207
+ }
208
+ function choosePlacement(input) {
209
+ const { placement, avoidCollisions, content } = input;
210
+ if (!avoidCollisions) return placement;
211
+ if (roomFor(placement, input) >= content.height) return placement;
212
+ const other = placement === "bottom" ? "top" : "bottom";
213
+ return roomFor(other, input) > roomFor(placement, input) ? other : placement;
214
+ }
215
+ function roomFor(placement, input) {
216
+ const { anchor, window, offset, insets } = input;
217
+ return placement === "bottom" ? window.height - insets.bottom - (anchor.y + anchor.height) - offset : anchor.y - insets.top - offset;
218
+ }
219
+ function alignedStart({ align, anchor }, width) {
220
+ if (align === "start") return anchor.x;
221
+ if (align === "end") return anchor.x + anchor.width - width;
222
+ return anchor.x + (anchor.width - width) / 2;
223
+ }
224
+ function clamp(value, min, max) {
225
+ return Math.min(Math.max(value, min), max);
226
+ }
227
+ function collectItemLabels(children, isItem) {
228
+ const found = [];
229
+ const walk = (node) => {
230
+ _react.Children.forEach(node, (child) => {
231
+ if (!_react.isValidElement.call(void 0, child)) return;
232
+ const props = child.props;
233
+ if (isItem(child.type) && typeof props.value === "string") {
234
+ const label = _nullishCoalesce(props.label, () => ( _chunk7GHM4GKLcjs.childrenToString.call(void 0, props.children)));
235
+ if (label !== null && label !== void 0) found.push([props.value, label]);
236
+ return;
237
+ }
238
+ walk(props.children);
239
+ });
240
+ };
241
+ walk(children);
242
+ return found;
243
+ }
244
+
245
+ // src/components/select/select-content.tsx
246
+
247
+ var DEFAULT_OFFSET = 8;
248
+ var ZERO = { x: 0, y: 0 };
249
+ var isSelectItem = (type) => type === SelectItem;
250
+ var DEFAULT_INSETS = {
251
+ top: 12,
252
+ bottom: 12,
253
+ start: 12,
254
+ end: 12
255
+ };
256
+ var SelectContent = _react.forwardRef.call(void 0,
257
+ function SelectContent2({
258
+ children,
259
+ placement = "bottom",
260
+ align = "center",
261
+ width = "trigger",
262
+ offset = DEFAULT_OFFSET,
263
+ alignOffset = 0,
264
+ avoidCollisions = true,
265
+ insets,
266
+ style,
267
+ onLayout,
268
+ ...props
269
+ }, ref) {
270
+ const context = useSelect();
271
+ const { contentStyle, isOpen, anchor } = context;
272
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
273
+ const window = _reactnative.useWindowDimensions.call(void 0, );
274
+ const origin = _nullishCoalesce(_optionalChain([_react.useContext.call(void 0, _chunkWDDXU3OHcjs.PortalContext), 'optionalAccess', _2 => _2.origin]), () => ( ZERO));
275
+ const [measured, setMeasured] = _react.useState.call(void 0, null);
276
+ const { registerLabel } = context;
277
+ _react.useEffect.call(void 0, () => {
278
+ for (const [value, label] of collectItemLabels(children, isSelectItem)) {
279
+ registerLabel(value, label);
280
+ }
281
+ }, [children, registerLabel]);
282
+ if (!isOpen && measured !== null) setMeasured(null);
283
+ if (!isOpen || anchor === null) return null;
284
+ const measure = (event) => {
285
+ _optionalChain([onLayout, 'optionalCall', _3 => _3(event)]);
286
+ const { width: w, height: h } = event.nativeEvent.layout;
287
+ if (measured === null || measured.height !== h || measured.width !== w) {
288
+ setMeasured({ width: w, height: h });
289
+ }
290
+ };
291
+ const local = { ...anchor, x: anchor.x - origin.x, y: anchor.y - origin.y };
292
+ const position = measured && resolvePlacement({
293
+ anchor: local,
294
+ content: measured,
295
+ // The window in the host's own coordinates, for the same reason as the anchor.
296
+ window: {
297
+ width: window.width - origin.x,
298
+ height: window.height - origin.y
299
+ },
300
+ placement,
301
+ align,
302
+ width,
303
+ offset,
304
+ alignOffset,
305
+ avoidCollisions,
306
+ insets: { ...DEFAULT_INSETS, ...insets }
307
+ });
308
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWDDXU3OHcjs.Portal, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
309
+ _reactnativereanimated2.default.View,
310
+ {
311
+ ref,
312
+ entering: position ? contentEntering(position.placement) : void 0,
313
+ exiting: position ? contentExiting(position.placement) : void 0,
314
+ onLayout: measure,
315
+ ...rest,
316
+ style: [
317
+ contentStyle,
318
+ // The measuring pass: laid out at the trigger's width so the rows wrap as they
319
+ // finally will, and invisible so the reader never sees it at the wrong place.
320
+ position === null ? { opacity: 0, top: 0, start: 0, width: local.width } : {
321
+ top: position.top,
322
+ start: position.start,
323
+ width: position.width,
324
+ maxHeight: position.maxHeight
325
+ },
326
+ styleProps,
327
+ style
328
+ ],
329
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
330
+ _reactnative.ScrollView,
331
+ {
332
+ bounces: false,
333
+ keyboardShouldPersistTaps: "handled",
334
+ showsVerticalScrollIndicator: false,
335
+ children
336
+ }
337
+ )
338
+ },
339
+ _nullishCoalesce(_optionalChain([position, 'optionalAccess', _4 => _4.placement]), () => ( "measuring"))
340
+ ) }) });
341
+ }
342
+ );
343
+ SelectContent.displayName = "XAUI.Select.Content";
344
+
345
+ // src/components/select/select-indicator.tsx
346
+
347
+
348
+
349
+
350
+
351
+
352
+
353
+
354
+ function SelectIndicator({
355
+ as = _chunk4KFKWBN5cjs.ChevronDownIcon,
356
+ ...props
357
+ }) {
358
+ const { indicatorStyle, isOpen } = useSelect();
359
+ const progress = _reactnativereanimated.useSharedValue.call(void 0, isOpen ? 1 : 0);
360
+ _react.useEffect.call(void 0, () => {
361
+ progress.set(_reactnativereanimated.withSpring.call(void 0, isOpen ? 1 : 0, INDICATOR_SPRING));
362
+ }, [isOpen, progress]);
363
+ const rotation = _reactnativereanimated.useAnimatedStyle.call(void 0, () => ({
364
+ transform: [
365
+ {
366
+ rotate: `${_reactnativereanimated.interpolate.call(void 0, progress.get(), [0, 1], [INDICATOR_ROTATION[0], INDICATOR_ROTATION[1]])}deg`
367
+ }
368
+ ]
369
+ }));
370
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, { style: [indicatorStyle, rotation], children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4KFKWBN5cjs.Icon, { as, ...props }) });
371
+ }
372
+ SelectIndicator.displayName = "XAUI.Select.Indicator";
373
+
374
+ // src/components/select/select-item-description.tsx
375
+
376
+
377
+
378
+ var SelectItemDescription = _react.forwardRef.call(void 0,
379
+ function SelectItemDescription2({ children, style, ...props }, ref) {
380
+ const { itemDescriptionStyle } = useSelect();
381
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
382
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { ref, ...rest, style: [itemDescriptionStyle, styleProps, style], children });
383
+ }
384
+ );
385
+ SelectItemDescription.displayName = "XAUI.Select.ItemDescription";
386
+
387
+ // src/components/select/select-item-indicator.tsx
388
+
389
+
390
+ // src/components/select/check-icon.tsx
391
+ var _reactnativesvg = require('react-native-svg');
392
+
393
+ function CheckIcon({
394
+ size = 20,
395
+ color = "currentColor"
396
+ }) {
397
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativesvg.Svg, { width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
398
+ _reactnativesvg.Path,
399
+ {
400
+ d: "m20 6-11 11-5-5",
401
+ stroke: color,
402
+ strokeWidth: 2,
403
+ strokeLinecap: "round",
404
+ strokeLinejoin: "round"
405
+ }
406
+ ) });
407
+ }
408
+ CheckIcon.displayName = "XAUI.Select.CheckIcon";
409
+
410
+ // src/components/select/select-item-indicator.tsx
411
+
412
+ function SelectItemIndicator({
413
+ as = CheckIcon,
414
+ color,
415
+ ...props
416
+ }) {
417
+ const { itemIndicatorStyle, checkColor } = useSelect();
418
+ const { isSelected } = useSelectItem();
419
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: itemIndicatorStyle, children: isSelected ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4KFKWBN5cjs.Icon, { as, color: _nullishCoalesce(color, () => ( checkColor)), ...props }) : null });
420
+ }
421
+ SelectItemIndicator.displayName = "XAUI.Select.ItemIndicator";
422
+
423
+ // src/components/select/select-label.tsx
424
+
425
+
426
+
427
+ var SelectLabel = _react.forwardRef.call(void 0, function SelectLabel2({ children, accessibilityRole = "header", style, ...props }, ref) {
428
+ const { labelStyle } = useSelect();
429
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
430
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
431
+ _reactnative.Text,
432
+ {
433
+ ref,
434
+ accessibilityRole,
435
+ ...rest,
436
+ style: [labelStyle, styleProps, style],
437
+ children
438
+ }
439
+ );
440
+ });
441
+ SelectLabel.displayName = "XAUI.Select.Label";
442
+
443
+ // src/components/select/select-overlay.tsx
444
+
445
+
446
+
447
+
448
+ var AnimatedPressable = _reactnativereanimated2.default.createAnimatedComponent(_reactnative.Pressable);
449
+ var SelectOverlay = _react.forwardRef.call(void 0,
450
+ function SelectOverlay2({ children, isDismissable = true, style, ...props }, ref) {
451
+ const context = useSelect();
452
+ const { overlayStyle, isOpen, close } = context;
453
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
454
+ if (!isOpen) return null;
455
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWDDXU3OHcjs.Portal, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
456
+ AnimatedPressable,
457
+ {
458
+ ref,
459
+ entering: overlayEntering,
460
+ exiting: overlayExiting,
461
+ accessibilityRole: "none",
462
+ importantForAccessibility: "no",
463
+ onPress: isDismissable ? close : void 0,
464
+ ...rest,
465
+ style: [overlayStyle, styleProps, style],
466
+ children
467
+ }
468
+ ) }) });
469
+ }
470
+ );
471
+ SelectOverlay.displayName = "XAUI.Select.Overlay";
472
+
473
+ // src/components/select/select-trigger.tsx
474
+
475
+
476
+ var SelectTrigger = _react.forwardRef.call(void 0,
477
+ function SelectTrigger2({
478
+ children,
479
+ asChild = false,
480
+ accessibilityRole = "button",
481
+ accessibilityState,
482
+ style,
483
+ onLayout,
484
+ onPressIn,
485
+ onPressOut,
486
+ onPress,
487
+ ...props
488
+ }, ref) {
489
+ const {
490
+ triggerStyle,
491
+ triggerPressedStyle,
492
+ glyph,
493
+ isOpen,
494
+ isDisabled,
495
+ isInvalid,
496
+ toggle,
497
+ setAnchor
498
+ } = useSelect();
499
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
500
+ const [isPressed, press] = _chunk7DPL3ZDScjs.usePressState.call(void 0, { onPressIn, onPressOut });
501
+ const node = _react.useRef.call(void 0, null);
502
+ const refs = _chunkWFEMJCXOcjs.useMergedRef.call(void 0, node, ref);
503
+ const measure = _react.useCallback.call(void 0, () => {
504
+ _optionalChain([node, 'access', _5 => _5.current, 'optionalAccess', _6 => _6.measureInWindow, 'call', _7 => _7((x, y, width, height) => {
505
+ setAnchor({ x, y, width, height });
506
+ })]);
507
+ }, [setAnchor]);
508
+ const handleLayout = _react.useCallback.call(void 0,
509
+ (event) => {
510
+ _optionalChain([onLayout, 'optionalCall', _8 => _8(event)]);
511
+ measure();
512
+ },
513
+ [measure, onLayout]
514
+ );
515
+ _react.useEffect.call(void 0, () => {
516
+ if (isOpen) measure();
517
+ }, [isOpen, measure]);
518
+ const handlePress = _react.useCallback.call(void 0,
519
+ (event) => {
520
+ _optionalChain([onPress, 'optionalCall', _9 => _9(event)]);
521
+ measure();
522
+ toggle();
523
+ },
524
+ [measure, onPress, toggle]
525
+ );
526
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4KFKWBN5cjs.IconContext.Provider, { value: glyph, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
527
+ _chunkTGMVEHV7cjs.PressableFeedback,
528
+ {
529
+ ref: refs,
530
+ isPressed,
531
+ isDisabled,
532
+ asChild,
533
+ accessibilityRole,
534
+ accessibilityState: {
535
+ disabled: isDisabled,
536
+ expanded: isOpen,
537
+ ...accessibilityState
538
+ },
539
+ "aria-invalid": isInvalid || void 0,
540
+ ...rest,
541
+ onLayout: handleLayout,
542
+ style: [
543
+ triggerStyle,
544
+ isPressed && triggerPressedStyle,
545
+ styleProps,
546
+ typeof style === "function" ? style({ pressed: isPressed }) : style
547
+ ],
548
+ onPress: handlePress,
549
+ onPressIn: press.onPressIn,
550
+ onPressOut: press.onPressOut,
551
+ children
552
+ }
553
+ ) });
554
+ }
555
+ );
556
+ SelectTrigger.displayName = "XAUI.Select.Trigger";
557
+
558
+ // src/components/select/select-value.tsx
559
+
560
+
561
+
562
+ var SelectValue = _react.forwardRef.call(void 0, function SelectValue2({ placeholder, children, numberOfLines = 1, style, ...props }, ref) {
563
+ const { valueStyle, placeholderStyle, value, labelFor } = useSelect();
564
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
565
+ const label = _nullishCoalesce(children, () => ( (value !== void 0 ? labelFor(value) : void 0)));
566
+ const isEmpty = label === void 0 || label === "";
567
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
568
+ _reactnative.Text,
569
+ {
570
+ ref,
571
+ numberOfLines,
572
+ ...rest,
573
+ style: [valueStyle, isEmpty && placeholderStyle, styleProps, style],
574
+ children: isEmpty ? placeholder : label
575
+ }
576
+ );
577
+ });
578
+ SelectValue.displayName = "XAUI.Select.Value";
579
+
580
+ // src/components/select/select.tsx
581
+
582
+
583
+
584
+ // src/components/select/select.hook.ts
585
+
586
+ function useLabelRegistry() {
587
+ const labels = _react.useRef.call(void 0, /* @__PURE__ */ new Map());
588
+ const [, force] = _react.useState.call(void 0, 0);
589
+ const registerLabel = _react.useCallback.call(void 0, (value, label) => {
590
+ if (labels.current.get(value) === label) return;
591
+ labels.current.set(value, label);
592
+ force((n) => n + 1);
593
+ }, []);
594
+ const labelFor = _react.useCallback.call(void 0, (value) => labels.current.get(value), []);
595
+ return _react.useMemo.call(void 0, () => ({ labelFor, registerLabel }), [labelFor, registerLabel]);
596
+ }
597
+
598
+ // src/components/select/select.recipe.ts
599
+ var SLOTS = [
600
+ "trigger",
601
+ "value",
602
+ "placeholder",
603
+ "indicator",
604
+ "overlay",
605
+ "content",
606
+ "label",
607
+ "item",
608
+ "itemLabel",
609
+ "itemDescription",
610
+ "itemIndicator"
611
+ ];
612
+ var VARIANT_TOKENS = {
613
+ primary: {
614
+ bg: "fieldBackground",
615
+ border: "fieldBorder",
616
+ borderFocus: "fieldBorderFocus",
617
+ fg: "fieldForeground"
618
+ },
619
+ secondary: {
620
+ bg: "default",
621
+ border: "fieldBorder",
622
+ borderFocus: "fieldBorderFocus",
623
+ fg: "fieldForeground"
624
+ },
625
+ tertiary: {
626
+ border: "fieldBorder",
627
+ borderFocus: "fieldBorderFocus",
628
+ fg: "fieldForeground"
629
+ },
630
+ ghost: { borderFocus: "fieldBorderFocus", fg: "fieldForeground" }
631
+ };
632
+ var SIZES = {
633
+ sm: {
634
+ control: "sm",
635
+ padding: 3,
636
+ gap: 2.5,
637
+ value: "md",
638
+ glyph: "lg",
639
+ listLabel: "xs",
640
+ description: "xs"
641
+ },
642
+ md: {
643
+ control: "md",
644
+ padding: 3,
645
+ gap: 3,
646
+ value: "md",
647
+ glyph: "lg",
648
+ listLabel: "sm",
649
+ description: "sm"
650
+ },
651
+ lg: {
652
+ control: "lg",
653
+ padding: 4,
654
+ gap: 3,
655
+ value: "lg",
656
+ glyph: "xl",
657
+ listLabel: "md",
658
+ description: "md"
659
+ }
660
+ };
661
+ var LIST = {
662
+ /** Panel padding, and the inset the rows sit in. */
663
+ padding: 3,
664
+ itemPaddingHorizontal: 2,
665
+ itemPaddingVertical: 3,
666
+ itemGap: 2,
667
+ labelPaddingHorizontal: 2,
668
+ labelPaddingVertical: 1.5,
669
+ /** The check's box, in spacing steps like the rest — five of them, HeroUI's twenty. */
670
+ indicator: 5
671
+ };
672
+ function sizeAxis(step) {
673
+ const { control, padding, gap, value, glyph, listLabel, description } = step;
674
+ return (theme) => {
675
+ const valueType = {
676
+ fontSize: theme.fontSizes[value],
677
+ lineHeight: theme.lineHeights[value]
678
+ };
679
+ return {
680
+ trigger: {
681
+ // Fixed, not a minimum: a control has a height, and a label too long for it
682
+ // truncates rather than deforming the field it shares a row with.
683
+ height: theme.controlHeights[control],
684
+ paddingHorizontal: theme.spacing(padding),
685
+ gap: theme.spacing(gap)
686
+ },
687
+ value: valueType,
688
+ placeholder: valueType,
689
+ indicator: { fontSize: theme.fontSizes[glyph] },
690
+ label: {
691
+ fontSize: theme.fontSizes[listLabel],
692
+ lineHeight: theme.lineHeights[listLabel]
693
+ },
694
+ itemLabel: valueType,
695
+ itemDescription: {
696
+ fontSize: theme.fontSizes[description],
697
+ lineHeight: theme.lineHeights[description]
698
+ }
699
+ };
700
+ };
701
+ }
702
+ var selectRecipe = _chunkFNEUOBCVcjs.createRecipe.call(void 0, {
703
+ slots: SLOTS,
704
+ base: (theme) => ({
705
+ trigger: {
706
+ flexDirection: "row",
707
+ alignItems: "center",
708
+ justifyContent: "space-between",
709
+ borderWidth: theme.borderWidth.field,
710
+ borderRadius: theme.radius.field,
711
+ borderCurve: "continuous"
712
+ },
713
+ value: {
714
+ fontFamily: theme.fontFamilies.body,
715
+ // `regular`, as on the field: a chosen value is content, not the control's label.
716
+ fontWeight: theme.fontWeights.regular,
717
+ // Without it a long value pushes the chevron off the end of the trigger instead of
718
+ // truncating, because a row gives a text node its intrinsic width by default.
719
+ flexShrink: 1
720
+ },
721
+ placeholder: { color: theme.colors.fieldPlaceholder },
722
+ indicator: { alignItems: "center", justifyContent: "center" },
723
+ overlay: { position: "absolute", top: 0, bottom: 0, start: 0, end: 0 },
724
+ content: {
725
+ position: "absolute",
726
+ backgroundColor: theme.colors.overlay,
727
+ padding: theme.spacing(LIST.padding),
728
+ // The panel is not the field, so it is rounder — but not by three steps of our
729
+ // scale. HeroUI's panel is their `--radius-3xl` on a base of 8, which is 24 points;
730
+ // ours is a base of 12, so the same 24 is `2xl`. Reading their key rather than
731
+ // their number is what put a 36-point corner on it and made it read as a pill.
732
+ borderRadius: theme.radius["2xl"],
733
+ borderCurve: "continuous",
734
+ ...theme.shadows.overlay
735
+ },
736
+ label: {
737
+ fontFamily: theme.fontFamilies.body,
738
+ fontWeight: theme.fontWeights.medium,
739
+ color: theme.colors.muted,
740
+ paddingHorizontal: theme.spacing(LIST.labelPaddingHorizontal),
741
+ paddingVertical: theme.spacing(LIST.labelPaddingVertical)
742
+ },
743
+ item: {
744
+ flexDirection: "row",
745
+ alignItems: "center",
746
+ justifyContent: "space-between",
747
+ gap: theme.spacing(LIST.itemGap),
748
+ paddingHorizontal: theme.spacing(LIST.itemPaddingHorizontal),
749
+ paddingVertical: theme.spacing(LIST.itemPaddingVertical),
750
+ borderRadius: theme.radius.md,
751
+ borderCurve: "continuous"
752
+ },
753
+ itemLabel: {
754
+ fontFamily: theme.fontFamilies.body,
755
+ // `medium`, unlike the trigger's value: a row in a list is a target being offered,
756
+ // and the weight is what separates it from the description under it.
757
+ fontWeight: theme.fontWeights.medium,
758
+ color: theme.colors.overlayForeground,
759
+ flexShrink: 1
760
+ },
761
+ itemDescription: {
762
+ fontFamily: theme.fontFamilies.body,
763
+ color: theme.colors.muted
764
+ },
765
+ itemIndicator: {
766
+ width: theme.spacing(LIST.indicator),
767
+ height: theme.spacing(LIST.indicator),
768
+ alignItems: "center",
769
+ justifyContent: "center"
770
+ }
771
+ }),
772
+ variantTokens: VARIANT_TOKENS,
773
+ /**
774
+ * The variant paints the **trigger only**. The list is a floating surface of the
775
+ * theme's own — a `ghost` select does not open a ghost panel, it opens the same panel
776
+ * every other select opens, because the panel is not part of the control's emphasis.
777
+ */
778
+ paint: (theme, colors) => ({
779
+ trigger: {
780
+ backgroundColor: colors.bg,
781
+ borderColor: colors.border,
782
+ borderWidth: colors.border ? theme.borderWidth.field : 0
783
+ },
784
+ value: { color: colors.fg },
785
+ indicator: { color: theme.colors.fieldPlaceholder }
786
+ }),
787
+ variants: {
788
+ size: {
789
+ sm: sizeAxis(SIZES.sm),
790
+ md: sizeAxis(SIZES.md),
791
+ lg: sizeAxis(SIZES.lg)
792
+ },
793
+ radius: _chunkFNEUOBCVcjs.radiusAxis.call(void 0, "trigger"),
794
+ /**
795
+ * Open is not `focused`: the field's focus border is what a keyboard gives a text
796
+ * input, and a select that is open has no caret in it. It borrows the same token
797
+ * because the two mean the same thing to the eye — this control is the live one.
798
+ */
799
+ isOpen: {
800
+ true: (theme) => ({
801
+ trigger: { borderColor: theme.colors.fieldBorderFocus }
802
+ })
803
+ },
804
+ isInvalid: {
805
+ true: (theme) => ({ trigger: { borderColor: theme.colors.danger } })
806
+ }
807
+ },
808
+ states: {
809
+ pressed: (theme) => ({
810
+ trigger: { backgroundColor: theme.colors.fieldPressed },
811
+ item: { backgroundColor: theme.colors.defaultSoftPressed }
812
+ }),
813
+ disabled: (theme) => ({ trigger: { opacity: theme.opacity.disabled } })
814
+ },
815
+ defaultVariants: { variant: "primary", size: "md" }
816
+ });
817
+
818
+ // src/components/select/select.tsx
819
+
820
+ function Select({
821
+ children,
822
+ variant,
823
+ size,
824
+ radius,
825
+ color,
826
+ value: controlledValue,
827
+ defaultValue,
828
+ onValueChange,
829
+ isOpen: controlledOpen,
830
+ defaultOpen = false,
831
+ onOpenChange,
832
+ isDisabled = false,
833
+ isInvalid = false
834
+ }) {
835
+ const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
836
+ const { labelFor, registerLabel } = useLabelRegistry();
837
+ const [anchor, setAnchor] = _react.useState.call(void 0, null);
838
+ const [value, setValue] = _chunk7EIHHOHPcjs.useControllableState.call(void 0, {
839
+ value: controlledValue,
840
+ defaultValue,
841
+ onChange: onValueChange
842
+ });
843
+ const [isOpen, setOpen] = _chunk7EIHHOHPcjs.useControllableState.call(void 0, {
844
+ value: controlledOpen,
845
+ defaultValue: defaultOpen,
846
+ onChange: onOpenChange
847
+ });
848
+ const selection = {
849
+ variant,
850
+ size,
851
+ radius,
852
+ isOpen: isOpen ? "true" : void 0,
853
+ isInvalid: isInvalid ? "true" : void 0
854
+ };
855
+ const styles = selectRecipe.resolve({
856
+ theme,
857
+ selection,
858
+ states: { disabled: isDisabled }
859
+ });
860
+ const pressed = selectRecipe.resolve({
861
+ theme,
862
+ selection,
863
+ states: { pressed: true }
864
+ });
865
+ const tint = color ? selectRecipe.tint({ theme, color, selection }) : void 0;
866
+ const open = _react.useCallback.call(void 0, () => setOpen(true), [setOpen]);
867
+ const close = _react.useCallback.call(void 0, () => setOpen(false), [setOpen]);
868
+ const toggle = _react.useCallback.call(void 0, () => setOpen(!isOpen), [isOpen, setOpen]);
869
+ const select = _react.useCallback.call(void 0,
870
+ (next, label) => {
871
+ if (label !== void 0) registerLabel(next, label);
872
+ setValue(next);
873
+ setOpen(false);
874
+ },
875
+ [registerLabel, setValue, setOpen]
876
+ );
877
+ const context = _react.useMemo.call(void 0, () => {
878
+ const indicator = _reactnative.StyleSheet.flatten([
879
+ styles.indicator,
880
+ _optionalChain([tint, 'optionalAccess', _10 => _10.indicator])
881
+ ]);
882
+ const itemLabel = _reactnative.StyleSheet.flatten([styles.itemLabel]);
883
+ const tintedPlaceholder = tint ? _reactnative.StyleSheet.flatten([tint.value]).color : void 0;
884
+ return {
885
+ triggerStyle: tint ? [styles.trigger, tint.trigger] : styles.trigger,
886
+ triggerPressedStyle: pressed.trigger,
887
+ valueStyle: tint ? [styles.value, tint.value] : styles.value,
888
+ placeholderStyle: tintedPlaceholder ? [styles.placeholder, { color: tintedPlaceholder }] : styles.placeholder,
889
+ indicatorStyle: styles.indicator,
890
+ overlayStyle: styles.overlay,
891
+ contentStyle: styles.content,
892
+ labelStyle: styles.label,
893
+ itemStyle: styles.item,
894
+ itemPressedStyle: pressed.item,
895
+ itemLabelStyle: styles.itemLabel,
896
+ itemDescriptionStyle: styles.itemDescription,
897
+ itemIndicatorStyle: styles.itemIndicator,
898
+ glyph: {
899
+ size: indicator.fontSize,
900
+ // `ColorValue` also covers the platform's opaque colours, which `Icon` cannot
901
+ // hand to a third-party component expecting a string.
902
+ color: typeof indicator.color === "string" ? indicator.color : void 0
903
+ },
904
+ // The check reads the row's own colour rather than the chevron's: it belongs to the
905
+ // list, and the chevron belongs to the field.
906
+ checkColor: typeof itemLabel.color === "string" ? itemLabel.color : void 0,
907
+ value,
908
+ isOpen,
909
+ isDisabled,
910
+ isInvalid,
911
+ open,
912
+ close,
913
+ toggle,
914
+ select,
915
+ anchor,
916
+ setAnchor,
917
+ labelFor,
918
+ registerLabel
919
+ };
920
+ }, [
921
+ styles,
922
+ pressed,
923
+ tint,
924
+ value,
925
+ isOpen,
926
+ isDisabled,
927
+ isInvalid,
928
+ open,
929
+ close,
930
+ toggle,
931
+ select,
932
+ anchor,
933
+ labelFor,
934
+ registerLabel
935
+ ]);
936
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectProvider, { value: context, children });
937
+ }
938
+ Select.displayName = "XAUI.Select.Root";
939
+
940
+ // src/components/select/index.ts
941
+ var Select2 = Object.assign(Select, {
942
+ Trigger: SelectTrigger,
943
+ Value: SelectValue,
944
+ Indicator: SelectIndicator,
945
+ Overlay: SelectOverlay,
946
+ Content: SelectContent,
947
+ Label: SelectLabel,
948
+ Item: SelectItem,
949
+ ItemLabel: SelectItemLabel,
950
+ ItemDescription: SelectItemDescription,
951
+ ItemIndicator: SelectItemIndicator
952
+ });
953
+
954
+
955
+
956
+
957
+
958
+
959
+
960
+
961
+
962
+
963
+
964
+
965
+
966
+
967
+
968
+
969
+
970
+
971
+ exports.useSelect = useSelect; exports.useSelectItem = useSelectItem; exports.SelectItemLabel = SelectItemLabel; exports.SelectItem = SelectItem; exports.SelectContent = SelectContent; exports.SelectIndicator = SelectIndicator; exports.SelectItemDescription = SelectItemDescription; exports.CheckIcon = CheckIcon; exports.SelectItemIndicator = SelectItemIndicator; exports.SelectLabel = SelectLabel; exports.SelectOverlay = SelectOverlay; exports.SelectTrigger = SelectTrigger; exports.SelectValue = SelectValue; exports.selectRecipe = selectRecipe; exports.Select = Select; exports.Select2 = Select2;