@xaui/native 0.9.1-alpha.23 → 0.9.1-alpha.24

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 (45) hide show
  1. package/dist/{chunk-KM2TI5IC.js → chunk-4HELPMAK.js} +76 -82
  2. package/dist/{chunk-AHL33YAO.js → chunk-4J26FA6O.js} +9 -7
  3. package/dist/{chunk-BNWS26PX.cjs → chunk-6FBGCF5T.cjs} +9 -7
  4. package/dist/{chunk-ZQ3JSWRO.js → chunk-A4RGJBP2.js} +4 -2
  5. package/dist/{chunk-I6PE5UUH.cjs → chunk-AV5LMFS3.cjs} +13 -11
  6. package/dist/{chunk-OGC4RKE3.js → chunk-AXSJPWSJ.js} +5 -5
  7. package/dist/chunk-EGLLDKN6.js +9 -0
  8. package/dist/chunk-EJQCQPET.cjs +9 -0
  9. package/dist/{chunk-VDRRD6GM.cjs → chunk-EWBBDVTM.cjs} +22 -21
  10. package/dist/{chunk-BH5DSJVX.cjs → chunk-IG4Q3WQO.cjs} +61 -68
  11. package/dist/{chunk-6WW4CSPY.cjs → chunk-J2JJLKLG.cjs} +6 -4
  12. package/dist/{chunk-4MHJOWM4.cjs → chunk-J4JFIC4W.cjs} +7 -7
  13. package/dist/chunk-J4QE34AU.js +732 -0
  14. package/dist/chunk-LIQTGAI7.cjs +621 -0
  15. package/dist/{chunk-FNQF4KQV.js → chunk-MRYLLKML.js} +18 -17
  16. package/dist/{chunk-FTCTTBLG.js → chunk-ZTA47PO5.js} +7 -5
  17. package/dist/components/alert/index.cjs +7 -6
  18. package/dist/components/alert/index.js +6 -5
  19. package/dist/components/button/index.cjs +6 -5
  20. package/dist/components/button/index.js +5 -4
  21. package/dist/components/card/index.cjs +5 -4
  22. package/dist/components/card/index.js +4 -3
  23. package/dist/components/chip/index.cjs +7 -6
  24. package/dist/components/chip/index.js +6 -5
  25. package/dist/components/input/index.cjs +3 -3
  26. package/dist/components/input/index.js +2 -2
  27. package/dist/components/input-otp/index.cjs +27 -0
  28. package/dist/components/input-otp/index.d.cts +325 -0
  29. package/dist/components/input-otp/index.d.ts +325 -0
  30. package/dist/components/input-otp/index.js +27 -0
  31. package/dist/components/typography/index.cjs +3 -3
  32. package/dist/components/typography/index.js +2 -2
  33. package/dist/index.cjs +37 -51
  34. package/dist/index.d.cts +1 -0
  35. package/dist/index.d.ts +1 -0
  36. package/dist/index.js +48 -62
  37. package/dist/system/index.cjs +6 -5
  38. package/dist/system/index.js +5 -4
  39. package/package.json +11 -1
  40. package/dist/{chunk-E3LXUXE7.js → chunk-6RO26ORT.js} +3 -3
  41. package/dist/{chunk-DXGQ43IV.cjs → chunk-B4W2XNBP.cjs} +2 -2
  42. package/dist/{chunk-2U6JR7BF.js → chunk-G52TQJBI.js} +3 -3
  43. package/dist/{chunk-FVP5FUVS.js → chunk-ICR42HHG.js} +3 -3
  44. package/dist/{chunk-TIP3T7JJ.cjs → chunk-P2XA4DV7.cjs} +2 -2
  45. package/dist/{chunk-RAWOJ3N3.cjs → chunk-Y7U6ACMB.cjs} +2 -2
@@ -0,0 +1,621 @@
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
+ var _chunkEJQCQPETcjs = require('./chunk-EJQCQPET.cjs');
4
+
5
+
6
+
7
+ var _chunkYXVKQMCKcjs = require('./chunk-YXVKQMCK.cjs');
8
+
9
+
10
+
11
+ var _chunkHUZ4AUM2cjs = require('./chunk-HUZ4AUM2.cjs');
12
+
13
+
14
+ var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
15
+
16
+ // src/components/input-otp/input-otp-box.tsx
17
+ var _react = require('react');
18
+ var _reactnative = require('react-native');
19
+
20
+ // src/components/input-otp/input-otp.context.ts
21
+ var [InputOTPProvider, useInputOTP] = _chunkHUZ4AUM2cjs.createSlotContext.call(void 0, "InputOTP");
22
+ var [InputOTPBoxProvider, useInputOTPBox] = _chunkHUZ4AUM2cjs.createSlotContext.call(void 0, "InputOTP.Box");
23
+
24
+ // src/components/input-otp/input-otp-caret.tsx
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+ var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
35
+ var _jsxruntime = require('react/jsx-runtime');
36
+ var BLINK_DURATION = 530;
37
+ function InputOTPCaret({
38
+ style,
39
+ animation = true,
40
+ ...props
41
+ }) {
42
+ const { caretStyle } = useInputOTP();
43
+ const { slot } = useInputOTPBox();
44
+ const [styleProps] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
45
+ const barStyle = [caretStyle, styleProps, style];
46
+ if (!_optionalChain([slot, 'optionalAccess', _2 => _2.isCaretVisible])) return null;
47
+ if (!animation) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: barStyle });
48
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BlinkingCaret, { style: barStyle });
49
+ }
50
+ InputOTPCaret.displayName = "XAUI.InputOTP.Caret";
51
+ function BlinkingCaret({ style }) {
52
+ const opacity = _reactnativereanimated.useSharedValue.call(void 0, 1);
53
+ _react.useEffect.call(void 0, () => {
54
+ opacity.value = _reactnativereanimated.withRepeat.call(void 0,
55
+ _reactnativereanimated.withTiming.call(void 0, 0, { duration: BLINK_DURATION, easing: _reactnativereanimated.Easing.ease }),
56
+ -1,
57
+ true
58
+ );
59
+ return () => _reactnativereanimated.cancelAnimation.call(void 0, opacity);
60
+ }, [opacity]);
61
+ const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, () => ({ opacity: opacity.value }));
62
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, { style: [style, animatedStyle] });
63
+ }
64
+
65
+ // src/components/input-otp/input-otp-placeholder.tsx
66
+
67
+
68
+
69
+ var InputOTPPlaceholder = _react.forwardRef.call(void 0,
70
+ function InputOTPPlaceholder2({ children, style, maxFontSizeMultiplier = 1.6, ...props }, ref) {
71
+ const { placeholderStyle } = useInputOTP();
72
+ const { slot } = useInputOTPBox();
73
+ const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
74
+ const char = _nullishCoalesce(children, () => ( _optionalChain([slot, 'optionalAccess', _3 => _3.placeholderChar])));
75
+ if (!char) return null;
76
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
77
+ _reactnative.Text,
78
+ {
79
+ ref,
80
+ maxFontSizeMultiplier,
81
+ style: [placeholderStyle, styleProps, style],
82
+ ...rest,
83
+ children: char
84
+ }
85
+ );
86
+ }
87
+ );
88
+ InputOTPPlaceholder.displayName = "XAUI.InputOTP.Placeholder";
89
+
90
+ // src/components/input-otp/input-otp-value.tsx
91
+
92
+
93
+
94
+ var InputOTPValue = _react.forwardRef.call(void 0,
95
+ function InputOTPValue2({ children, style, maxFontSizeMultiplier = 1.6, ...props }, ref) {
96
+ const { valueStyle } = useInputOTP();
97
+ const { slot } = useInputOTPBox();
98
+ const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
99
+ const char = _nullishCoalesce(children, () => ( _optionalChain([slot, 'optionalAccess', _4 => _4.char])));
100
+ if (!char) return null;
101
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
102
+ _reactnative.Text,
103
+ {
104
+ ref,
105
+ maxFontSizeMultiplier,
106
+ style: [valueStyle, styleProps, style],
107
+ ...rest,
108
+ children: char
109
+ }
110
+ );
111
+ }
112
+ );
113
+ InputOTPValue.displayName = "XAUI.InputOTP.Value";
114
+
115
+ // src/components/input-otp/input-otp-box.tsx
116
+
117
+ var InputOTPBox = _react.forwardRef.call(void 0, function InputOTPBox2({ index, children, style, ...props }, ref) {
118
+ const { boxStyle, boxActiveStyle, slots } = useInputOTP();
119
+ const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
120
+ const slot = slots[index];
121
+ const context = _react.useMemo.call(void 0, () => ({ slot }), [slot]);
122
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InputOTPBoxProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
123
+ _reactnative.View,
124
+ {
125
+ ref,
126
+ style: [_optionalChain([slot, 'optionalAccess', _5 => _5.isActive]) ? boxActiveStyle : boxStyle, styleProps, style],
127
+ ...rest,
128
+ children: _nullishCoalesce(children, () => ( /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
129
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InputOTPPlaceholder, {}),
130
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InputOTPValue, {}),
131
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InputOTPCaret, {})
132
+ ] })))
133
+ }
134
+ ) });
135
+ });
136
+ InputOTPBox.displayName = "XAUI.InputOTP.Box";
137
+
138
+ // src/components/input-otp/input-otp-group.tsx
139
+
140
+
141
+
142
+ var InputOTPGroup = _react.forwardRef.call(void 0,
143
+ function InputOTPGroup2({ children, style, ...props }, ref) {
144
+ const { groupStyle, slots, value, maxLength, isFocused, isDisabled, isInvalid } = useInputOTP();
145
+ const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
146
+ const content = typeof children === "function" ? children({ slots, value, maxLength, isFocused, isDisabled, isInvalid }) : children;
147
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { ref, style: [groupStyle, styleProps, style], ...rest, children: content });
148
+ }
149
+ );
150
+ InputOTPGroup.displayName = "XAUI.InputOTP.Group";
151
+
152
+ // src/components/input-otp/input-otp-separator.tsx
153
+
154
+
155
+
156
+ var InputOTPSeparator = _react.forwardRef.call(void 0,
157
+ function InputOTPSeparator2({ children, style, ...props }, ref) {
158
+ const { separatorStyle } = useInputOTP();
159
+ const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
160
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
161
+ _reactnative.View,
162
+ {
163
+ ref,
164
+ accessibilityElementsHidden: true,
165
+ importantForAccessibility: "no-hide-descendants",
166
+ style: [separatorStyle, styleProps, style],
167
+ ...rest,
168
+ children
169
+ }
170
+ );
171
+ }
172
+ );
173
+ InputOTPSeparator.displayName = "XAUI.InputOTP.Separator";
174
+
175
+ // src/components/input-otp/input-otp.tsx
176
+
177
+
178
+
179
+ // src/components/input-otp/input-otp.hook.ts
180
+
181
+
182
+ // src/hooks/use-controllable-state.ts
183
+
184
+ function useControllableState({
185
+ value,
186
+ defaultValue,
187
+ onChange
188
+ }) {
189
+ const [uncontrolled, setUncontrolled] = _react.useState.call(void 0, defaultValue);
190
+ const isControlled = value !== void 0;
191
+ const current = isControlled ? value : uncontrolled;
192
+ useControlWarning(isControlled);
193
+ const latest = _react.useRef.call(void 0, current);
194
+ latest.current = current;
195
+ const onChangeRef = _react.useRef.call(void 0, onChange);
196
+ onChangeRef.current = onChange;
197
+ const controlled = _react.useRef.call(void 0, isControlled);
198
+ controlled.current = isControlled;
199
+ const set = _react.useCallback.call(void 0, (next) => {
200
+ const resolved = typeof next === "function" ? next(latest.current) : next;
201
+ if (resolved === latest.current) return;
202
+ if (!controlled.current) setUncontrolled(resolved);
203
+ _optionalChain([onChangeRef, 'access', _6 => _6.current, 'optionalCall', _7 => _7(resolved)]);
204
+ }, []);
205
+ return [current, set];
206
+ }
207
+ function useControlWarning(isControlled) {
208
+ const wasControlled = _react.useRef.call(void 0, isControlled);
209
+ if (wasControlled.current !== isControlled) {
210
+ _chunkEJQCQPETcjs.warnDev.call(void 0,
211
+ `a component switched from ${wasControlled.current ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}. Decide for the life of the component: pass \`value\` always, or never. Passing \`undefined\` for a value you do control reads as "uncontrolled" here.`
212
+ );
213
+ wasControlled.current = isControlled;
214
+ }
215
+ }
216
+
217
+ // src/components/input-otp/input-otp.utils.ts
218
+ function buildSlots({
219
+ value,
220
+ maxLength,
221
+ isFocused,
222
+ placeholder
223
+ }) {
224
+ return Array.from({ length: maxLength }, (_, index) => {
225
+ const char = _nullishCoalesce(value[index], () => ( null));
226
+ const isActive = isFocused && index === value.length;
227
+ return {
228
+ index,
229
+ char,
230
+ // A box shows its placeholder only when it has neither a character nor the caret.
231
+ placeholderChar: char === null && !isActive ? placeholderFor(placeholder, index) : null,
232
+ isActive,
233
+ isCaretVisible: isActive && char === null
234
+ };
235
+ });
236
+ }
237
+ function placeholderFor(placeholder, index) {
238
+ if (!placeholder) return null;
239
+ return placeholder.length === 1 ? placeholder : _nullishCoalesce(placeholder[index], () => ( null));
240
+ }
241
+ function extractPastedCode(pasted, maxLength) {
242
+ const match = pasted.match(new RegExp(`(?<!\\d)(\\d{${maxLength}})(?!\\d)`));
243
+ return _nullishCoalesce(_optionalChain([match, 'optionalAccess', _8 => _8[1]]), () => ( ""));
244
+ }
245
+ function isPaste(text, previous) {
246
+ return text.length > previous.length + 1;
247
+ }
248
+ var OTP_DIGITS = "^\\d+$";
249
+ var OTP_LETTERS = "^[a-zA-Z]+$";
250
+ var OTP_ALPHANUMERIC = "^[a-zA-Z0-9]+$";
251
+
252
+ // src/components/input-otp/input-otp.hook.ts
253
+ function useInputOTPState({
254
+ maxLength,
255
+ value: valueProp,
256
+ defaultValue = "",
257
+ onChangeText: onChangeTextProp,
258
+ onComplete,
259
+ pattern,
260
+ placeholder
261
+ }) {
262
+ const [value, setValue] = useControllableState({
263
+ value: valueProp,
264
+ defaultValue,
265
+ onChange: onChangeTextProp
266
+ });
267
+ const [isFocused, setIsFocused] = _react.useState.call(void 0, false);
268
+ const inputRef = _react.useRef.call(void 0, null);
269
+ const regexp = _react.useMemo.call(void 0, () => {
270
+ if (!pattern) return null;
271
+ return typeof pattern === "string" ? new RegExp(pattern) : pattern;
272
+ }, [pattern]);
273
+ const slots = _react.useMemo.call(void 0,
274
+ () => buildSlots({ value, maxLength, isFocused, placeholder }),
275
+ [value, maxLength, isFocused, placeholder]
276
+ );
277
+ const latest = _react.useRef.call(void 0, { value, maxLength, regexp, onComplete, setValue });
278
+ latest.current = { value, maxLength, regexp, onComplete, setValue };
279
+ const onChangeText = _react.useCallback.call(void 0, (text) => {
280
+ const current = latest.current;
281
+ const candidate = isPaste(text, current.value) ? extractPastedCode(text, current.maxLength) : text;
282
+ const next = candidate.slice(0, current.maxLength);
283
+ if (next.length > 0 && current.regexp && !current.regexp.test(next)) return;
284
+ current.setValue(next);
285
+ if (next.length === current.maxLength) _optionalChain([current, 'access', _9 => _9.onComplete, 'optionalCall', _10 => _10(next)]);
286
+ }, []);
287
+ const onFocus = _react.useCallback.call(void 0, () => setIsFocused(true), []);
288
+ const onBlur = _react.useCallback.call(void 0, () => setIsFocused(false), []);
289
+ const handle = _react.useMemo.call(void 0,
290
+ () => ({
291
+ focus: () => _optionalChain([inputRef, 'access', _11 => _11.current, 'optionalAccess', _12 => _12.focus, 'call', _13 => _13()]),
292
+ blur: () => _optionalChain([inputRef, 'access', _14 => _14.current, 'optionalAccess', _15 => _15.blur, 'call', _16 => _16()]),
293
+ // Both halves: the native buffer and our value. Clearing one and not the other is
294
+ // how a cleared field comes back on the next keystroke.
295
+ clear: () => {
296
+ _optionalChain([inputRef, 'access', _17 => _17.current, 'optionalAccess', _18 => _18.clear, 'call', _19 => _19()]);
297
+ latest.current.setValue("");
298
+ }
299
+ }),
300
+ []
301
+ );
302
+ return { value, slots, isFocused, inputRef, handle, onChangeText, onFocus, onBlur };
303
+ }
304
+
305
+ // src/components/input-otp/input-otp.recipe.ts
306
+ var SLOTS = [
307
+ "root",
308
+ "group",
309
+ "box",
310
+ "value",
311
+ "placeholder",
312
+ "caret",
313
+ "separator"
314
+ ];
315
+ var VARIANT_TOKENS = {
316
+ primary: {
317
+ bg: "fieldBackground",
318
+ border: "fieldBorder",
319
+ borderFocus: "accent",
320
+ fg: "fieldForeground"
321
+ },
322
+ secondary: {
323
+ bg: "default",
324
+ border: "fieldBorder",
325
+ borderFocus: "accent",
326
+ fg: "fieldForeground"
327
+ },
328
+ tertiary: {
329
+ border: "fieldBorder",
330
+ borderFocus: "accent",
331
+ fg: "fieldForeground"
332
+ }
333
+ };
334
+ var PLACEHOLDER_OPACITY = 0.5;
335
+ var ACTIVE_BORDER_WIDTH = 2;
336
+ function sizeAxis(step) {
337
+ const { control, gap, glyph } = step;
338
+ return (theme) => {
339
+ const height = theme.controlHeights[control];
340
+ const type = {
341
+ fontSize: theme.fontSizes[glyph],
342
+ lineHeight: theme.lineHeights[glyph]
343
+ };
344
+ return {
345
+ root: { gap: theme.spacing(gap) },
346
+ group: { gap: theme.spacing(gap) },
347
+ box: { height, width: height - theme.spacing(1) },
348
+ value: type,
349
+ placeholder: type,
350
+ // As tall as the character it stands in for, so the box does not change shape
351
+ // between an empty state and a typed one.
352
+ caret: { height: theme.lineHeights[glyph], width: theme.spacing(CARET_WIDTH) },
353
+ separator: {
354
+ height: theme.spacing(CARET_WIDTH),
355
+ width: theme.spacing(SEPARATOR_WIDTH)
356
+ }
357
+ };
358
+ };
359
+ }
360
+ var CARET_WIDTH = 0.5;
361
+ var SEPARATOR_WIDTH = 2;
362
+ var SIZES = {
363
+ sm: { control: "sm", gap: 2, glyph: "md" },
364
+ md: { control: "md", gap: 2, glyph: "lg" },
365
+ lg: { control: "lg", gap: 2.5, glyph: "xl" }
366
+ };
367
+ var inputOTPRecipe = _chunkYXVKQMCKcjs.createRecipe.call(void 0, {
368
+ slots: SLOTS,
369
+ base: (theme) => ({
370
+ root: { flexDirection: "row", alignItems: "center" },
371
+ group: { flexDirection: "row", alignItems: "center" },
372
+ box: {
373
+ alignItems: "center",
374
+ justifyContent: "center",
375
+ // `lg` and not `field`, which is the radius the rest of this family uses. A field is
376
+ // wide, so 21 on a 48-tall one reads as a rounded rectangle; a code box is very
377
+ // nearly square — 44 by 48 at `md`, 36 by 40 at `sm` — where the geometric maximum
378
+ // is 22, so the same 21 is a pill in all but name and is clamped to one outright at
379
+ // the small end. Twelve is where HeroUI lands for the same box from the other
380
+ // direction: their `field` radius is their `xl`, and their scale's base is 8 where
381
+ // ours is 12.
382
+ borderRadius: theme.radius.lg,
383
+ borderCurve: "continuous",
384
+ // The one root in the library that clips: the box has no shadow to lose and a
385
+ // character wider than it would otherwise spill onto its neighbour.
386
+ overflow: "hidden"
387
+ },
388
+ // `semibold`, where a field's own text is `regular`. A code is read at a glance and
389
+ // then compared character by character, which is the one thing weight helps with.
390
+ value: {
391
+ fontFamily: theme.fontFamilies.body,
392
+ fontWeight: theme.fontWeights.semibold
393
+ },
394
+ placeholder: {
395
+ fontFamily: theme.fontFamilies.body,
396
+ fontWeight: theme.fontWeights.semibold,
397
+ color: theme.colors.fieldPlaceholder,
398
+ opacity: PLACEHOLDER_OPACITY
399
+ },
400
+ caret: {
401
+ position: "absolute",
402
+ borderRadius: theme.radius.full,
403
+ backgroundColor: theme.colors.fieldPlaceholder
404
+ },
405
+ // The theme's second separator level rather than the first at half opacity: it is
406
+ // already the lighter of the two, and it composites the same way in both modes.
407
+ separator: {
408
+ borderRadius: theme.radius.full,
409
+ backgroundColor: theme.colors.separatorSecondary
410
+ }
411
+ }),
412
+ variantTokens: VARIANT_TOKENS,
413
+ /**
414
+ * Where the variant's colours land. The border width follows the *presence* of the
415
+ * border role, so a variant that names none needs no rule of its own to say so.
416
+ *
417
+ * The active box takes the ring whichever variant it is: the `focused` state sets the
418
+ * width as well as the colour. The box has a fixed width and height and centres what it
419
+ * holds, so an edge appearing moves nothing.
420
+ */
421
+ paint: (theme, colors) => ({
422
+ box: {
423
+ backgroundColor: colors.bg,
424
+ borderColor: colors.border,
425
+ borderWidth: colors.border ? theme.borderWidth.field : 0
426
+ },
427
+ value: { color: colors.fg }
428
+ }),
429
+ variants: {
430
+ size: {
431
+ sm: sizeAxis(SIZES.sm),
432
+ md: sizeAxis(SIZES.md),
433
+ lg: sizeAxis(SIZES.lg)
434
+ },
435
+ radius: _chunkYXVKQMCKcjs.radiusAxis.call(void 0, "box"),
436
+ /**
437
+ * Declared after `size` and before the states, so a code that is wrong stays wrong
438
+ * under the finger: the ring below reads `borderFocus`, and the root hands it the
439
+ * danger colour by suppressing the active state and painting every box instead.
440
+ */
441
+ isInvalid: {
442
+ true: (theme) => ({
443
+ box: {
444
+ borderColor: theme.colors.danger,
445
+ borderWidth: ACTIVE_BORDER_WIDTH
446
+ }
447
+ })
448
+ }
449
+ },
450
+ compoundVariants: [
451
+ {
452
+ when: { variant: "primary" },
453
+ style: (theme) => ({ box: theme.shadows.field })
454
+ }
455
+ ],
456
+ /**
457
+ * `focused` here means **this box is the active one**, not that the component has the
458
+ * keyboard: the root resolves the recipe twice, once each way, and hands both to the
459
+ * boxes so none of them resolves anything itself (R5).
460
+ */
461
+ states: {
462
+ focused: (_theme, colors) => ({
463
+ box: { borderColor: colors.borderFocus, borderWidth: ACTIVE_BORDER_WIDTH }
464
+ }),
465
+ disabled: (theme) => ({ root: { opacity: theme.opacity.disabled } })
466
+ },
467
+ defaultVariants: { variant: "secondary", size: "md" }
468
+ });
469
+
470
+ // src/components/input-otp/input-otp.style.ts
471
+
472
+ var inputOTPSheet = _reactnative.StyleSheet.create({
473
+ hiddenInput: {
474
+ ..._reactnative.StyleSheet.absoluteFillObject,
475
+ color: "transparent",
476
+ // A caret of our own is drawn in the active box; the platform's would sit wherever
477
+ // the invisible text happens to end.
478
+ ..._reactnative.Platform.select({
479
+ ios: { opacity: 0.02 },
480
+ default: { opacity: 0 }
481
+ })
482
+ }
483
+ });
484
+
485
+ // src/components/input-otp/input-otp.tsx
486
+
487
+ var InputOTPRoot = _react.forwardRef.call(void 0,
488
+ function InputOTP({
489
+ children,
490
+ maxLength,
491
+ variant,
492
+ size,
493
+ radius,
494
+ color,
495
+ value: valueProp,
496
+ defaultValue,
497
+ onChangeText,
498
+ onComplete,
499
+ pattern,
500
+ placeholder,
501
+ isInvalid = false,
502
+ isDisabled = false,
503
+ inputMode = "numeric",
504
+ textInputProps,
505
+ style,
506
+ ...props
507
+ }, ref) {
508
+ const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
509
+ const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
510
+ const state = useInputOTPState({
511
+ maxLength,
512
+ value: valueProp,
513
+ defaultValue,
514
+ onChangeText,
515
+ onComplete,
516
+ pattern,
517
+ placeholder
518
+ });
519
+ _react.useImperativeHandle.call(void 0, ref, () => state.handle, [state.handle]);
520
+ const selection = {
521
+ variant,
522
+ size,
523
+ radius,
524
+ isInvalid: isInvalid ? "true" : void 0
525
+ };
526
+ const states = { disabled: isDisabled };
527
+ const styles = inputOTPRecipe.resolve({ theme, selection, states });
528
+ const activeStyles = isInvalid ? styles : inputOTPRecipe.resolve({
529
+ theme,
530
+ selection,
531
+ states: { ...states, focused: true }
532
+ });
533
+ const tint = color ? inputOTPRecipe.tint({ theme, color, selection, states }) : void 0;
534
+ const activeTint = color && !isInvalid ? inputOTPRecipe.tint({
535
+ theme,
536
+ color,
537
+ selection,
538
+ states: { ...states, focused: true }
539
+ }) : tint;
540
+ const context = _react.useMemo.call(void 0,
541
+ () => ({
542
+ groupStyle: styles.group,
543
+ boxStyle: tint ? [styles.box, tint.box] : styles.box,
544
+ boxActiveStyle: activeTint ? [activeStyles.box, activeTint.box] : activeStyles.box,
545
+ valueStyle: tint ? [styles.value, tint.value] : styles.value,
546
+ placeholderStyle: styles.placeholder,
547
+ caretStyle: styles.caret,
548
+ separatorStyle: styles.separator,
549
+ slots: state.slots,
550
+ value: state.value,
551
+ maxLength,
552
+ isFocused: state.isFocused,
553
+ isDisabled,
554
+ isInvalid,
555
+ inputRef: state.inputRef
556
+ }),
557
+ [
558
+ styles,
559
+ activeStyles,
560
+ tint,
561
+ activeTint,
562
+ state.slots,
563
+ state.value,
564
+ state.isFocused,
565
+ state.inputRef,
566
+ maxLength,
567
+ isDisabled,
568
+ isInvalid
569
+ ]
570
+ );
571
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InputOTPProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: [styles.root, _optionalChain([tint, 'optionalAccess', _20 => _20.root]), styleProps, style], ...rest, children: [
572
+ children,
573
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
574
+ _reactnative.TextInput,
575
+ {
576
+ ref: state.inputRef,
577
+ style: inputOTPSheet.hiddenInput,
578
+ value: state.value,
579
+ onChangeText: state.onChangeText,
580
+ onFocus: state.onFocus,
581
+ onBlur: state.onBlur,
582
+ editable: !isDisabled,
583
+ inputMode,
584
+ caretHidden: true,
585
+ autoComplete: "one-time-code",
586
+ textContentType: "oneTimeCode",
587
+ accessibilityLabel: `${maxLength}-character code`,
588
+ accessibilityState: { disabled: isDisabled },
589
+ accessibilityValue: {
590
+ text: `${state.value.length} of ${maxLength} entered`
591
+ },
592
+ ...textInputProps
593
+ }
594
+ )
595
+ ] }) });
596
+ }
597
+ );
598
+ InputOTPRoot.displayName = "XAUI.InputOTP.Root";
599
+
600
+ // src/components/input-otp/index.ts
601
+ var InputOTP2 = Object.assign(InputOTPRoot, {
602
+ Group: InputOTPGroup,
603
+ Box: InputOTPBox,
604
+ Value: InputOTPValue,
605
+ Placeholder: InputOTPPlaceholder,
606
+ Caret: InputOTPCaret,
607
+ Separator: InputOTPSeparator
608
+ });
609
+
610
+
611
+
612
+
613
+
614
+
615
+
616
+
617
+
618
+
619
+
620
+
621
+ exports.useInputOTP = useInputOTP; exports.useInputOTPBox = useInputOTPBox; exports.useControllableState = useControllableState; exports.buildSlots = buildSlots; exports.extractPastedCode = extractPastedCode; exports.OTP_DIGITS = OTP_DIGITS; exports.OTP_LETTERS = OTP_LETTERS; exports.OTP_ALPHANUMERIC = OTP_ALPHANUMERIC; exports.inputOTPRecipe = inputOTPRecipe; exports.InputOTP = InputOTP2;
@@ -1,8 +1,9 @@
1
- import { Icon } from "./chunk-FVP5FUVS.js";
2
- import { PressableFeedback, usePressState, warnDev } from "./chunk-KM2TI5IC.js";
1
+ import { Icon } from "./chunk-ICR42HHG.js";
2
+ import { PressableFeedback, usePressState } from "./chunk-4HELPMAK.js";
3
+ import { warnDev } from "./chunk-EGLLDKN6.js";
3
4
  import { createRecipe, radiusAxis } from "./chunk-3JATAB7S.js";
4
- import { useXAUITheme } from "./chunk-A3EGFI6T.js";
5
5
  import { childrenToString, createSlotContext, useStyleProps } from "./chunk-PMO62QK4.js";
6
+ import { useXAUITheme } from "./chunk-A3EGFI6T.js";
6
7
 
7
8
  // src/components/button/button.context.ts
8
9
  var [ButtonProvider, useButton] = createSlotContext("Button");
@@ -73,10 +74,10 @@ function ButtonSpinner({
73
74
  });
74
75
  }
75
76
  ButtonSpinner.displayName = "XAUI.Button.Spinner";
76
- const _worklet_763735822272_init_data = {
77
- code: "function chunkFNQF4KQVJs1(){const{angle}=this.__closure;return{transform:[{rotate:angle.value+\"deg\"}]};}",
78
- location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-FNQF4KQV.js",
79
- sourceMap: "{\"version\":3,\"names\":[\"chunkFNQF4KQVJs1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-FNQF4KQV.js\"],\"mappings\":\"AAmFyC,SAAAA,gBAAMA,CAAA,QAAAC,KAAA,OAAAC,SAAA,CAE3C,MAAO,CAAEC,SAAS,CAAE,CAAC,CAAEC,MAAM,CAAKH,KAAK,CAACI,KAAK,MAAM,CAAC,CAAE,CAAC,CACzD\",\"ignoreList\":[]}"
77
+ const _worklet_12240051127083_init_data = {
78
+ code: "function chunkMRYLLKMLJs1(){const{angle}=this.__closure;return{transform:[{rotate:angle.value+\"deg\"}]};}",
79
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-MRYLLKML.js",
80
+ sourceMap: "{\"version\":3,\"names\":[\"chunkMRYLLKMLJs1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-MRYLLKML.js\"],\"mappings\":\"AAqFyC,SAAAA,gBAAMA,CAAA,QAAAC,KAAA,OAAAC,SAAA,CAE3C,MAAO,CAAEC,SAAS,CAAE,CAAC,CAAEC,MAAM,CAAKH,KAAK,CAACI,KAAK,MAAM,CAAC,CAAE,CAAC,CACzD\",\"ignoreList\":[]}"
80
81
  };
81
82
  function SpinningRing({
82
83
  style
@@ -89,28 +90,28 @@ function SpinningRing({
89
90
  }), -1, false);
90
91
  return () => cancelAnimation(angle);
91
92
  }, [angle]);
92
- const animatedStyle = useAnimatedStyle(function chunkFNQF4KQVJs1Factory({
93
- _worklet_763735822272_init_data,
93
+ const animatedStyle = useAnimatedStyle(function chunkMRYLLKMLJs1Factory({
94
+ _worklet_12240051127083_init_data,
94
95
  angle
95
96
  }) {
96
97
  const _e = [new global.Error(), -2, -27];
97
- const chunkFNQF4KQVJs1 = function () {
98
+ const chunkMRYLLKMLJs1 = function () {
98
99
  return {
99
100
  transform: [{
100
101
  rotate: `${angle.value}deg`
101
102
  }]
102
103
  };
103
104
  };
104
- chunkFNQF4KQVJs1.__closure = {
105
+ chunkMRYLLKMLJs1.__closure = {
105
106
  angle
106
107
  };
107
- chunkFNQF4KQVJs1.__workletHash = 763735822272;
108
- chunkFNQF4KQVJs1.__pluginVersion = "0.7.4";
109
- chunkFNQF4KQVJs1.__initData = _worklet_763735822272_init_data;
110
- chunkFNQF4KQVJs1.__stackDetails = _e;
111
- return chunkFNQF4KQVJs1;
108
+ chunkMRYLLKMLJs1.__workletHash = 12240051127083;
109
+ chunkMRYLLKMLJs1.__pluginVersion = "0.7.4";
110
+ chunkMRYLLKMLJs1.__initData = _worklet_12240051127083_init_data;
111
+ chunkMRYLLKMLJs1.__stackDetails = _e;
112
+ return chunkMRYLLKMLJs1;
112
113
  }({
113
- _worklet_763735822272_init_data,
114
+ _worklet_12240051127083_init_data,
114
115
  angle
115
116
  }), [angle]);
116
117
  return /* @__PURE__ */jsx3(Animated.View, {