@xaui/native 0.9.1-alpha.35 → 0.9.1-alpha.37

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