@xaui/native 0.9.1-alpha.28 → 0.9.1-alpha.29

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 (66) hide show
  1. package/dist/{chunk-3JATAB7S.js → chunk-4GTAZM2C.js} +4 -2
  2. package/dist/{chunk-N4UJYDOW.js → chunk-5RFRASSB.js} +20 -18
  3. package/dist/{chunk-V2FQN6ZK.js → chunk-7BOFQN2G.js} +1 -1
  4. package/dist/{chunk-5OXZIZRZ.cjs → chunk-APONC4DB.cjs} +7 -7
  5. package/dist/{chunk-6FBGCF5T.cjs → chunk-AQNWXJYV.cjs} +2 -2
  6. package/dist/chunk-BA2DBSAN.js +102 -0
  7. package/dist/{chunk-TR2TGPDQ.js → chunk-D4SOU26X.js} +1 -1
  8. package/dist/{chunk-CQRUNV6S.cjs → chunk-E25JH7W2.cjs} +17 -17
  9. package/dist/{chunk-V6DGGDHF.cjs → chunk-F3H4TXAY.cjs} +5 -5
  10. package/dist/chunk-F6CQ6CBI.cjs +112 -0
  11. package/dist/{chunk-ZTA47PO5.js → chunk-FDSQOPJH.js} +1 -1
  12. package/dist/{chunk-JCKVYYZO.cjs → chunk-FFEUGWVA.cjs} +3 -3
  13. package/dist/{chunk-YXVKQMCK.cjs → chunk-FNEUOBCV.cjs} +4 -2
  14. package/dist/{chunk-Y7U6ACMB.cjs → chunk-FXHRNUCS.cjs} +2 -2
  15. package/dist/{chunk-J4JFIC4W.cjs → chunk-GCU5A5MM.cjs} +3 -3
  16. package/dist/{chunk-G52TQJBI.js → chunk-HOIQRGSK.js} +1 -1
  17. package/dist/chunk-L3Q5TVYE.js +659 -0
  18. package/dist/{chunk-WEMZ4VMC.js → chunk-NG4GFBDR.js} +1 -1
  19. package/dist/chunk-O5KDIEDH.cjs +735 -0
  20. package/dist/chunk-RZC4VFB5.cjs +698 -0
  21. package/dist/{chunk-5A4M6X5B.cjs → chunk-SVRZJEDU.cjs} +5 -5
  22. package/dist/{chunk-3LKGVKQY.cjs → chunk-TFNB2PNI.cjs} +4 -4
  23. package/dist/{chunk-3YN7JQ55.js → chunk-V3KS5PPK.js} +2 -2
  24. package/dist/{chunk-AXSJPWSJ.js → chunk-V56334S3.js} +1 -1
  25. package/dist/{chunk-EHARM2EN.js → chunk-VUEDYW3M.js} +1 -1
  26. package/dist/{chunk-LKB3RIR2.js → chunk-XYFMSRNJ.js} +2 -2
  27. package/dist/{chunk-56KVKM27.js → chunk-YGOXQSNU.js} +15 -15
  28. package/dist/{chunk-H7DVR52Z.cjs → chunk-YWBTIWT5.cjs} +3 -3
  29. package/dist/components/alert/index.cjs +3 -3
  30. package/dist/components/alert/index.js +2 -2
  31. package/dist/components/button/index.cjs +3 -3
  32. package/dist/components/button/index.js +2 -2
  33. package/dist/components/card/index.cjs +3 -3
  34. package/dist/components/card/index.js +2 -2
  35. package/dist/components/checkbox/index.cjs +4 -4
  36. package/dist/components/checkbox/index.js +3 -3
  37. package/dist/components/chip/index.cjs +3 -3
  38. package/dist/components/chip/index.js +2 -2
  39. package/dist/components/input/index.cjs +3 -3
  40. package/dist/components/input/index.js +2 -2
  41. package/dist/components/input-group/index.cjs +4 -4
  42. package/dist/components/input-group/index.js +3 -3
  43. package/dist/components/input-otp/index.cjs +3 -3
  44. package/dist/components/input-otp/index.js +2 -2
  45. package/dist/components/radio/index.cjs +4 -4
  46. package/dist/components/radio/index.js +3 -3
  47. package/dist/components/switch/index.cjs +25 -0
  48. package/dist/components/switch/index.d.cts +1154 -0
  49. package/dist/components/switch/index.d.ts +1154 -0
  50. package/dist/components/switch/index.js +25 -0
  51. package/dist/components/text-area/index.cjs +4 -4
  52. package/dist/components/text-area/index.js +3 -3
  53. package/dist/components/typography/index.cjs +3 -3
  54. package/dist/components/typography/index.js +2 -2
  55. package/dist/index.cjs +30 -14
  56. package/dist/index.d.cts +1 -0
  57. package/dist/index.d.ts +1 -0
  58. package/dist/index.js +29 -13
  59. package/dist/system/index.cjs +3 -3
  60. package/dist/system/index.d.cts +13 -1
  61. package/dist/system/index.d.ts +13 -1
  62. package/dist/system/index.js +2 -2
  63. package/package.json +11 -1
  64. package/dist/chunk-63TWVWHG.cjs +0 -584
  65. package/dist/chunk-E6EFYPJR.cjs +0 -41
  66. package/dist/chunk-EYJEUXXC.js +0 -98
@@ -1,584 +0,0 @@
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 _chunk7EIHHOHPcjs = require('./chunk-7EIHHOHP.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/components/input-otp/input-otp.utils.ts
183
- function buildSlots({
184
- value,
185
- maxLength,
186
- isFocused,
187
- placeholder
188
- }) {
189
- return Array.from({ length: maxLength }, (_, index) => {
190
- const char = _nullishCoalesce(value[index], () => ( null));
191
- const isActive = isFocused && index === value.length;
192
- return {
193
- index,
194
- char,
195
- // A box shows its placeholder only when it has neither a character nor the caret.
196
- placeholderChar: char === null && !isActive ? placeholderFor(placeholder, index) : null,
197
- isActive,
198
- isCaretVisible: isActive && char === null
199
- };
200
- });
201
- }
202
- function placeholderFor(placeholder, index) {
203
- if (!placeholder) return null;
204
- return placeholder.length === 1 ? placeholder : _nullishCoalesce(placeholder[index], () => ( null));
205
- }
206
- function extractPastedCode(pasted, maxLength) {
207
- const match = pasted.match(new RegExp(`(?<!\\d)(\\d{${maxLength}})(?!\\d)`));
208
- return _nullishCoalesce(_optionalChain([match, 'optionalAccess', _6 => _6[1]]), () => ( ""));
209
- }
210
- function isPaste(text, previous) {
211
- return text.length > previous.length + 1;
212
- }
213
- var OTP_DIGITS = "^\\d+$";
214
- var OTP_LETTERS = "^[a-zA-Z]+$";
215
- var OTP_ALPHANUMERIC = "^[a-zA-Z0-9]+$";
216
-
217
- // src/components/input-otp/input-otp.hook.ts
218
- function useInputOTPState({
219
- maxLength,
220
- value: valueProp,
221
- defaultValue = "",
222
- onChangeText: onChangeTextProp,
223
- onComplete,
224
- pattern,
225
- placeholder
226
- }) {
227
- const [value, setValue] = _chunk7EIHHOHPcjs.useControllableState.call(void 0, {
228
- value: valueProp,
229
- defaultValue,
230
- onChange: onChangeTextProp
231
- });
232
- const [isFocused, setIsFocused] = _react.useState.call(void 0, false);
233
- const inputRef = _react.useRef.call(void 0, null);
234
- const regexp = _react.useMemo.call(void 0, () => {
235
- if (!pattern) return null;
236
- return typeof pattern === "string" ? new RegExp(pattern) : pattern;
237
- }, [pattern]);
238
- const slots = _react.useMemo.call(void 0,
239
- () => buildSlots({ value, maxLength, isFocused, placeholder }),
240
- [value, maxLength, isFocused, placeholder]
241
- );
242
- const latest = _react.useRef.call(void 0, { value, maxLength, regexp, onComplete, setValue });
243
- latest.current = { value, maxLength, regexp, onComplete, setValue };
244
- const onChangeText = _react.useCallback.call(void 0, (text) => {
245
- const current = latest.current;
246
- const candidate = isPaste(text, current.value) ? extractPastedCode(text, current.maxLength) : text;
247
- const next = candidate.slice(0, current.maxLength);
248
- if (next.length > 0 && current.regexp && !current.regexp.test(next)) return;
249
- current.setValue(next);
250
- if (next.length === current.maxLength) _optionalChain([current, 'access', _7 => _7.onComplete, 'optionalCall', _8 => _8(next)]);
251
- }, []);
252
- const onFocus = _react.useCallback.call(void 0, () => setIsFocused(true), []);
253
- const onBlur = _react.useCallback.call(void 0, () => setIsFocused(false), []);
254
- const handle = _react.useMemo.call(void 0,
255
- () => ({
256
- focus: () => _optionalChain([inputRef, 'access', _9 => _9.current, 'optionalAccess', _10 => _10.focus, 'call', _11 => _11()]),
257
- blur: () => _optionalChain([inputRef, 'access', _12 => _12.current, 'optionalAccess', _13 => _13.blur, 'call', _14 => _14()]),
258
- // Both halves: the native buffer and our value. Clearing one and not the other is
259
- // how a cleared field comes back on the next keystroke.
260
- clear: () => {
261
- _optionalChain([inputRef, 'access', _15 => _15.current, 'optionalAccess', _16 => _16.clear, 'call', _17 => _17()]);
262
- latest.current.setValue("");
263
- }
264
- }),
265
- []
266
- );
267
- return { value, slots, isFocused, inputRef, handle, onChangeText, onFocus, onBlur };
268
- }
269
-
270
- // src/components/input-otp/input-otp.recipe.ts
271
- var SLOTS = [
272
- "root",
273
- "group",
274
- "box",
275
- "value",
276
- "placeholder",
277
- "caret",
278
- "separator"
279
- ];
280
- var VARIANT_TOKENS = {
281
- primary: {
282
- bg: "fieldBackground",
283
- border: "fieldBorder",
284
- borderFocus: "accent",
285
- fg: "fieldForeground"
286
- },
287
- secondary: {
288
- bg: "default",
289
- border: "fieldBorder",
290
- borderFocus: "accent",
291
- fg: "fieldForeground"
292
- },
293
- tertiary: {
294
- border: "fieldBorder",
295
- borderFocus: "accent",
296
- fg: "fieldForeground"
297
- }
298
- };
299
- var PLACEHOLDER_OPACITY = 0.5;
300
- var ACTIVE_BORDER_WIDTH = 2;
301
- function sizeAxis(step) {
302
- const { control, gap, glyph } = step;
303
- return (theme) => {
304
- const height = theme.controlHeights[control];
305
- const type = {
306
- fontSize: theme.fontSizes[glyph],
307
- lineHeight: theme.lineHeights[glyph]
308
- };
309
- return {
310
- root: { gap: theme.spacing(gap) },
311
- group: { gap: theme.spacing(gap) },
312
- box: { height, width: height - theme.spacing(1) },
313
- value: type,
314
- placeholder: type,
315
- // As tall as the character it stands in for, so the box does not change shape
316
- // between an empty state and a typed one.
317
- caret: { height: theme.lineHeights[glyph], width: theme.spacing(CARET_WIDTH) },
318
- separator: {
319
- height: theme.spacing(CARET_WIDTH),
320
- width: theme.spacing(SEPARATOR_WIDTH)
321
- }
322
- };
323
- };
324
- }
325
- var CARET_WIDTH = 0.5;
326
- var SEPARATOR_WIDTH = 2;
327
- var SIZES = {
328
- sm: { control: "sm", gap: 2, glyph: "md" },
329
- md: { control: "md", gap: 2, glyph: "lg" },
330
- lg: { control: "lg", gap: 2.5, glyph: "xl" }
331
- };
332
- var inputOTPRecipe = _chunkYXVKQMCKcjs.createRecipe.call(void 0, {
333
- slots: SLOTS,
334
- base: (theme) => ({
335
- root: { flexDirection: "row", alignItems: "center" },
336
- group: { flexDirection: "row", alignItems: "center" },
337
- box: {
338
- alignItems: "center",
339
- justifyContent: "center",
340
- // `lg` and not `field`, though the two are the same twelve points at the default
341
- // base. The keys are kept apart on purpose: `field` is the corner a theme moves when
342
- // it wants rounder *fields*, and a field is wide — a code box is very nearly square,
343
- // 44 by 48 at `md`, where the geometric maximum is 22 and anything near it is a pill
344
- // in all but name. Following `field` here would hand this component a shape that was
345
- // never decided for it.
346
- borderRadius: theme.radius.lg,
347
- borderCurve: "continuous",
348
- // The one root in the library that clips: the box has no shadow to lose and a
349
- // character wider than it would otherwise spill onto its neighbour.
350
- overflow: "hidden"
351
- },
352
- // `semibold`, where a field's own text is `regular`. A code is read at a glance and
353
- // then compared character by character, which is the one thing weight helps with.
354
- value: {
355
- fontFamily: theme.fontFamilies.body,
356
- fontWeight: theme.fontWeights.semibold
357
- },
358
- placeholder: {
359
- fontFamily: theme.fontFamilies.body,
360
- fontWeight: theme.fontWeights.semibold,
361
- color: theme.colors.fieldPlaceholder,
362
- opacity: PLACEHOLDER_OPACITY
363
- },
364
- caret: {
365
- position: "absolute",
366
- borderRadius: theme.radius.full,
367
- backgroundColor: theme.colors.fieldPlaceholder
368
- },
369
- // The theme's second separator level rather than the first at half opacity: it is
370
- // already the lighter of the two, and it composites the same way in both modes.
371
- separator: {
372
- borderRadius: theme.radius.full,
373
- backgroundColor: theme.colors.separatorSecondary
374
- }
375
- }),
376
- variantTokens: VARIANT_TOKENS,
377
- /**
378
- * Where the variant's colours land. The border width follows the *presence* of the
379
- * border role, so a variant that names none needs no rule of its own to say so.
380
- *
381
- * The active box takes the ring whichever variant it is: the `focused` state sets the
382
- * width as well as the colour. The box has a fixed width and height and centres what it
383
- * holds, so an edge appearing moves nothing.
384
- */
385
- paint: (theme, colors) => ({
386
- box: {
387
- backgroundColor: colors.bg,
388
- borderColor: colors.border,
389
- borderWidth: colors.border ? theme.borderWidth.field : 0
390
- },
391
- value: { color: colors.fg }
392
- }),
393
- variants: {
394
- size: {
395
- sm: sizeAxis(SIZES.sm),
396
- md: sizeAxis(SIZES.md),
397
- lg: sizeAxis(SIZES.lg)
398
- },
399
- radius: _chunkYXVKQMCKcjs.radiusAxis.call(void 0, "box"),
400
- /**
401
- * Declared after `size` and before the states, so a code that is wrong stays wrong
402
- * under the finger: the ring below reads `borderFocus`, and the root hands it the
403
- * danger colour by suppressing the active state and painting every box instead.
404
- */
405
- isInvalid: {
406
- true: (theme) => ({
407
- box: {
408
- borderColor: theme.colors.danger,
409
- borderWidth: ACTIVE_BORDER_WIDTH
410
- }
411
- })
412
- }
413
- },
414
- compoundVariants: [
415
- {
416
- when: { variant: "primary" },
417
- style: (theme) => ({ box: theme.shadows.field })
418
- }
419
- ],
420
- /**
421
- * `focused` here means **this box is the active one**, not that the component has the
422
- * keyboard: the root resolves the recipe twice, once each way, and hands both to the
423
- * boxes so none of them resolves anything itself (R5).
424
- */
425
- states: {
426
- focused: (_theme, colors) => ({
427
- box: { borderColor: colors.borderFocus, borderWidth: ACTIVE_BORDER_WIDTH }
428
- }),
429
- disabled: (theme) => ({ root: { opacity: theme.opacity.disabled } })
430
- },
431
- defaultVariants: { variant: "secondary", size: "md" }
432
- });
433
-
434
- // src/components/input-otp/input-otp.style.ts
435
-
436
- var inputOTPSheet = _reactnative.StyleSheet.create({
437
- hiddenInput: {
438
- ..._reactnative.StyleSheet.absoluteFillObject,
439
- color: "transparent",
440
- // A caret of our own is drawn in the active box; the platform's would sit wherever
441
- // the invisible text happens to end.
442
- ..._reactnative.Platform.select({
443
- ios: { opacity: 0.02 },
444
- default: { opacity: 0 }
445
- })
446
- }
447
- });
448
-
449
- // src/components/input-otp/input-otp.tsx
450
-
451
- var InputOTPRoot = _react.forwardRef.call(void 0,
452
- function InputOTP({
453
- children,
454
- maxLength,
455
- variant,
456
- size,
457
- radius,
458
- color,
459
- value: valueProp,
460
- defaultValue,
461
- onChangeText,
462
- onComplete,
463
- pattern,
464
- placeholder,
465
- isInvalid = false,
466
- isDisabled = false,
467
- inputMode = "numeric",
468
- textInputProps,
469
- style,
470
- ...props
471
- }, ref) {
472
- const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
473
- const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
474
- const state = useInputOTPState({
475
- maxLength,
476
- value: valueProp,
477
- defaultValue,
478
- onChangeText,
479
- onComplete,
480
- pattern,
481
- placeholder
482
- });
483
- _react.useImperativeHandle.call(void 0, ref, () => state.handle, [state.handle]);
484
- const selection = {
485
- variant,
486
- size,
487
- radius,
488
- isInvalid: isInvalid ? "true" : void 0
489
- };
490
- const states = { disabled: isDisabled };
491
- const styles = inputOTPRecipe.resolve({ theme, selection, states });
492
- const activeStyles = isInvalid ? styles : inputOTPRecipe.resolve({
493
- theme,
494
- selection,
495
- states: { ...states, focused: true }
496
- });
497
- const tint = color ? inputOTPRecipe.tint({ theme, color, selection, states }) : void 0;
498
- const activeTint = color && !isInvalid ? inputOTPRecipe.tint({
499
- theme,
500
- color,
501
- selection,
502
- states: { ...states, focused: true }
503
- }) : tint;
504
- const context = _react.useMemo.call(void 0,
505
- () => ({
506
- groupStyle: styles.group,
507
- boxStyle: tint ? [styles.box, tint.box] : styles.box,
508
- boxActiveStyle: activeTint ? [activeStyles.box, activeTint.box] : activeStyles.box,
509
- valueStyle: tint ? [styles.value, tint.value] : styles.value,
510
- placeholderStyle: styles.placeholder,
511
- caretStyle: styles.caret,
512
- separatorStyle: styles.separator,
513
- slots: state.slots,
514
- value: state.value,
515
- maxLength,
516
- isFocused: state.isFocused,
517
- isDisabled,
518
- isInvalid,
519
- inputRef: state.inputRef
520
- }),
521
- [
522
- styles,
523
- activeStyles,
524
- tint,
525
- activeTint,
526
- state.slots,
527
- state.value,
528
- state.isFocused,
529
- state.inputRef,
530
- maxLength,
531
- isDisabled,
532
- isInvalid
533
- ]
534
- );
535
- 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', _18 => _18.root]), styleProps, style], ...rest, children: [
536
- children,
537
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
538
- _reactnative.TextInput,
539
- {
540
- ref: state.inputRef,
541
- style: inputOTPSheet.hiddenInput,
542
- value: state.value,
543
- onChangeText: state.onChangeText,
544
- onFocus: state.onFocus,
545
- onBlur: state.onBlur,
546
- editable: !isDisabled,
547
- inputMode,
548
- caretHidden: true,
549
- autoComplete: "one-time-code",
550
- textContentType: "oneTimeCode",
551
- accessibilityLabel: `${maxLength}-character code`,
552
- accessibilityState: { disabled: isDisabled },
553
- accessibilityValue: {
554
- text: `${state.value.length} of ${maxLength} entered`
555
- },
556
- ...textInputProps
557
- }
558
- )
559
- ] }) });
560
- }
561
- );
562
- InputOTPRoot.displayName = "XAUI.InputOTP.Root";
563
-
564
- // src/components/input-otp/index.ts
565
- var InputOTP2 = Object.assign(InputOTPRoot, {
566
- Group: InputOTPGroup,
567
- Box: InputOTPBox,
568
- Value: InputOTPValue,
569
- Placeholder: InputOTPPlaceholder,
570
- Caret: InputOTPCaret,
571
- Separator: InputOTPSeparator
572
- });
573
-
574
-
575
-
576
-
577
-
578
-
579
-
580
-
581
-
582
-
583
-
584
- exports.useInputOTP = useInputOTP; exports.useInputOTPBox = useInputOTPBox; 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,41 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/system/selection-fill/selection-fill.tsx
2
- var _reactnative = require('react-native');
3
-
4
-
5
-
6
-
7
- var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
8
- var _jsxruntime = require('react/jsx-runtime');
9
- var DURATION = 120;
10
- var FROM_SCALE = 0.8;
11
- function SelectionFill({
12
- isVisible,
13
- style,
14
- animation = true,
15
- children
16
- }) {
17
- if (!animation) {
18
- return isVisible ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style, children }) : null;
19
- }
20
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AnimatedFill, { isVisible, style, children });
21
- }
22
- SelectionFill.displayName = "XAUI.SelectionFill";
23
- function AnimatedFill({
24
- isVisible,
25
- style,
26
- children
27
- }) {
28
- const progress = _reactnativereanimated.useDerivedValue.call(void 0,
29
- () => _reactnativereanimated.withTiming.call(void 0, isVisible ? 1 : 0, { duration: DURATION }),
30
- [isVisible]
31
- );
32
- const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, () => ({
33
- opacity: progress.value,
34
- transform: [{ scale: FROM_SCALE + (1 - FROM_SCALE) * progress.value }]
35
- }));
36
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, { style: [style, animatedStyle], children });
37
- }
38
-
39
-
40
-
41
- exports.SelectionFill = SelectionFill;