@xaui/native 0.9.1-alpha.4 → 0.9.1-alpha.41
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.
- package/dist/chunk-2EGR4LWD.js +145 -0
- package/dist/chunk-2NRZKJG7.js +531 -0
- package/dist/chunk-2PMXMKS5.js +67 -0
- package/dist/chunk-2XPG2243.js +586 -0
- package/dist/chunk-36PRYGAM.js +13 -0
- package/dist/chunk-3E7CDKFO.cjs +696 -0
- package/dist/chunk-3GFRSZYR.js +54 -0
- package/dist/chunk-423RQBOX.js +21 -0
- package/dist/chunk-4CUZZWFW.js +92 -0
- package/dist/chunk-4GTAZM2C.js +174 -0
- package/dist/chunk-4KFKWBN5.cjs +89 -0
- package/dist/{chunk-3QBT3Q65.cjs → chunk-57SJ4LJF.cjs} +7 -2
- package/dist/chunk-5R26NM4M.cjs +402 -0
- package/dist/chunk-5VKYNBNA.js +607 -0
- package/dist/chunk-64MXEVT3.js +66 -0
- package/dist/chunk-6DOLGZVV.cjs +147 -0
- package/dist/chunk-6L2TS2R3.cjs +92 -0
- package/dist/chunk-6UEZJRVI.js +669 -0
- package/dist/chunk-734MFAX4.js +27 -0
- package/dist/chunk-73RKQC5X.js +104 -0
- package/dist/chunk-7DPL3ZDS.cjs +21 -0
- package/dist/chunk-7EIHHOHP.cjs +42 -0
- package/dist/chunk-7GHM4GKL.cjs +119 -0
- package/dist/chunk-7YF5NAHQ.cjs +74 -0
- package/dist/{chunk-X2K2FX3W.js → chunk-A3EGFI6T.js} +6 -1
- package/dist/chunk-ABAGZTXZ.cjs +736 -0
- package/dist/{chunk-AW63PTQ4.cjs → chunk-ACAPTWE3.cjs} +85 -81
- package/dist/chunk-AMCSSOJT.cjs +104 -0
- package/dist/chunk-BA2DBSAN.js +102 -0
- package/dist/chunk-BRRXFOBY.js +431 -0
- package/dist/chunk-C5YLPCFC.cjs +293 -0
- package/dist/chunk-DA3OKXHV.cjs +700 -0
- package/dist/chunk-DD4276RF.js +366 -0
- package/dist/chunk-DG2I4PJG.js +701 -0
- package/dist/chunk-DHGLGSH6.js +661 -0
- package/dist/chunk-DIBUQ46Y.js +346 -0
- package/dist/chunk-EGLLDKN6.js +9 -0
- package/dist/chunk-EJQCQPET.cjs +9 -0
- package/dist/chunk-EKS3W46M.cjs +66 -0
- package/dist/chunk-EZEYMLO3.js +402 -0
- package/dist/chunk-F6CQ6CBI.cjs +112 -0
- package/dist/chunk-F6W3JQ7K.js +42 -0
- package/dist/chunk-FHUYHV6J.js +89 -0
- package/dist/chunk-FNEUOBCV.cjs +174 -0
- package/dist/chunk-G3CCT4EY.js +518 -0
- package/dist/chunk-G7P3ERYF.cjs +478 -0
- package/dist/chunk-GA6PBWNT.js +147 -0
- package/dist/chunk-GFUZ3MUT.cjs +455 -0
- package/dist/chunk-GGW43Q37.cjs +1 -0
- package/dist/chunk-GTR5X65M.cjs +27 -0
- package/dist/chunk-H4E4HDEP.cjs +13 -0
- package/dist/chunk-H7DS4IO7.js +198 -0
- package/dist/chunk-HDVVZG4S.cjs +198 -0
- package/dist/chunk-IKJVLJKT.js +151 -0
- package/dist/chunk-J3MB4PI5.cjs +531 -0
- package/dist/chunk-K72UDPVN.js +119 -0
- package/dist/chunk-KCMYU7WF.js +86 -0
- package/dist/chunk-LRN3RNDO.js +940 -0
- package/dist/chunk-LTX6TB5I.js +124 -0
- package/dist/chunk-LUPCPLND.cjs +145 -0
- package/dist/chunk-M63GFNKV.js +194 -0
- package/dist/chunk-N3KTZMPG.js +293 -0
- package/dist/chunk-NCTOTTVW.js +13 -0
- package/dist/chunk-NWGLP6JX.cjs +410 -0
- package/dist/chunk-R73XQK7X.cjs +314 -0
- package/dist/chunk-RU7JCMWC.cjs +881 -0
- package/dist/chunk-SNIHUKDA.cjs +184 -0
- package/dist/chunk-T5FV5F7A.cjs +607 -0
- package/dist/chunk-TDTUAIFF.cjs +153 -0
- package/dist/chunk-TJ74XVZN.cjs +431 -0
- package/dist/chunk-TK44VBIE.cjs +194 -0
- package/dist/chunk-UAWBAD4E.cjs +346 -0
- package/dist/chunk-UFTCTTKK.js +381 -0
- package/dist/chunk-VLKBESEV.cjs +407 -0
- package/dist/chunk-WDDXU3OH.cjs +67 -0
- package/dist/chunk-WFEMJCXO.cjs +13 -0
- package/dist/chunk-WHJTBTYM.js +0 -0
- package/dist/{chunk-2KXQATVL.js → chunk-WKCQ6VGW.js} +59 -55
- package/dist/chunk-XFPQFCEK.js +455 -0
- package/dist/chunk-XSQPVDFH.cjs +60 -0
- package/dist/chunk-XTC2SLFT.js +153 -0
- package/dist/chunk-XV735BSA.cjs +366 -0
- package/dist/chunk-XWNG2U4K.cjs +124 -0
- package/dist/chunk-YGYYJ3LQ.js +314 -0
- package/dist/chunk-YVHT2UVW.js +74 -0
- package/dist/chunk-ZFOOJK37.cjs +86 -0
- package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
- package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
- package/dist/components/accordion/index.cjs +35 -0
- package/dist/components/accordion/index.d.cts +299 -0
- package/dist/components/accordion/index.d.ts +299 -0
- package/dist/components/accordion/index.js +35 -0
- package/dist/components/alert/index.cjs +20 -0
- package/dist/components/alert/index.d.cts +169 -0
- package/dist/components/alert/index.d.ts +169 -0
- package/dist/components/alert/index.js +20 -0
- package/dist/components/avatar/index.cjs +16 -0
- package/dist/components/avatar/index.d.cts +131 -0
- package/dist/components/avatar/index.d.ts +131 -0
- package/dist/components/avatar/index.js +16 -0
- package/dist/components/badge/index.cjs +15 -0
- package/dist/components/badge/index.d.cts +157 -0
- package/dist/components/badge/index.d.ts +157 -0
- package/dist/components/badge/index.js +15 -0
- package/dist/components/button/index.cjs +22 -0
- package/dist/components/button/index.d.cts +613 -0
- package/dist/components/button/index.d.ts +613 -0
- package/dist/components/button/index.js +22 -0
- package/dist/components/card/index.cjs +22 -0
- package/dist/components/card/index.d.cts +620 -0
- package/dist/components/card/index.d.ts +620 -0
- package/dist/components/card/index.js +22 -0
- package/dist/components/checkbox/index.cjs +26 -0
- package/dist/components/checkbox/index.d.cts +1136 -0
- package/dist/components/checkbox/index.d.ts +1136 -0
- package/dist/components/checkbox/index.js +26 -0
- package/dist/components/chip/index.cjs +20 -0
- package/dist/components/chip/index.d.cts +608 -0
- package/dist/components/chip/index.d.ts +608 -0
- package/dist/components/chip/index.js +20 -0
- package/dist/components/divider/index.cjs +13 -0
- package/dist/components/divider/index.d.cts +117 -0
- package/dist/components/divider/index.d.ts +117 -0
- package/dist/components/divider/index.js +13 -0
- package/dist/components/field-group/index.cjs +27 -0
- package/dist/components/field-group/index.d.cts +270 -0
- package/dist/components/field-group/index.d.ts +270 -0
- package/dist/components/field-group/index.js +27 -0
- package/dist/components/input-otp/index.cjs +29 -0
- package/dist/components/input-otp/index.d.cts +325 -0
- package/dist/components/input-otp/index.d.ts +325 -0
- package/dist/components/input-otp/index.js +29 -0
- package/dist/components/menu/index.cjs +49 -0
- package/dist/components/menu/index.d.cts +351 -0
- package/dist/components/menu/index.d.ts +351 -0
- package/dist/components/menu/index.js +49 -0
- package/dist/components/popover/index.cjs +38 -0
- package/dist/components/popover/index.d.cts +254 -0
- package/dist/components/popover/index.d.ts +254 -0
- package/dist/components/popover/index.js +38 -0
- package/dist/components/radio/index.cjs +26 -0
- package/dist/components/radio/index.d.cts +1102 -0
- package/dist/components/radio/index.d.ts +1102 -0
- package/dist/components/radio/index.js +26 -0
- package/dist/components/select/index.cjs +50 -0
- package/dist/components/select/index.d.cts +498 -0
- package/dist/components/select/index.d.ts +498 -0
- package/dist/components/select/index.js +50 -0
- package/dist/components/skeleton/index.cjs +11 -0
- package/dist/components/skeleton/index.d.cts +111 -0
- package/dist/components/skeleton/index.d.ts +111 -0
- package/dist/components/skeleton/index.js +11 -0
- package/dist/components/spinner/index.cjs +17 -0
- package/dist/components/spinner/index.d.cts +104 -0
- package/dist/components/spinner/index.d.ts +104 -0
- package/dist/components/spinner/index.js +17 -0
- package/dist/components/switch/index.cjs +27 -0
- package/dist/components/switch/index.d.cts +1154 -0
- package/dist/components/switch/index.d.ts +1154 -0
- package/dist/components/switch/index.js +27 -0
- package/dist/components/tabs/index.cjs +33 -0
- package/dist/components/tabs/index.d.cts +261 -0
- package/dist/components/tabs/index.d.ts +261 -0
- package/dist/components/tabs/index.js +33 -0
- package/dist/components/text-area/index.cjs +14 -0
- package/dist/components/text-area/index.d.cts +73 -0
- package/dist/components/text-area/index.d.ts +73 -0
- package/dist/components/text-area/index.js +14 -0
- package/dist/components/text-field/index.cjs +25 -0
- package/dist/components/text-field/index.d.cts +205 -0
- package/dist/components/text-field/index.d.ts +205 -0
- package/dist/components/text-field/index.js +25 -0
- package/dist/components/typography/index.cjs +15 -0
- package/dist/components/typography/index.d.cts +116 -0
- package/dist/components/typography/index.d.ts +116 -0
- package/dist/components/typography/index.js +15 -0
- package/dist/components/view/index.cjs +17 -0
- package/dist/components/view/index.d.cts +152 -0
- package/dist/components/view/index.d.ts +152 -0
- package/dist/components/view/index.js +17 -0
- package/dist/create-recipe-BdVd2ffi.d.ts +114 -0
- package/dist/create-recipe-dC7wMfnj.d.cts +114 -0
- package/dist/icon.type-Kml72iSz.d.ts +73 -0
- package/dist/icon.type-d_i9ma-i.d.cts +73 -0
- package/dist/index.cjs +423 -5
- package/dist/index.d.cts +119 -4
- package/dist/index.d.ts +119 -4
- package/dist/index.js +445 -27
- package/dist/placement-DHa0Rrh1.d.cts +38 -0
- package/dist/placement-DHa0Rrh1.d.ts +38 -0
- package/dist/pressable-feedback.type-BA2C9sSz.d.cts +127 -0
- package/dist/pressable-feedback.type-Bs4dQlGj.d.ts +127 -0
- package/dist/style-props.type-CfnoGEP7.d.cts +31 -0
- package/dist/style-props.type-CfnoGEP7.d.ts +31 -0
- package/dist/system/index.cjs +73 -4
- package/dist/system/index.d.cts +379 -193
- package/dist/system/index.d.ts +379 -193
- package/dist/system/index.js +87 -18
- package/dist/text-field.type-0l73acce.d.ts +167 -0
- package/dist/text-field.type-DBh06DU5.d.cts +167 -0
- package/dist/theme/index.cjs +5 -3
- package/dist/theme/index.d.cts +55 -24
- package/dist/theme/index.d.ts +55 -24
- package/dist/theme/index.js +4 -2
- package/dist/{theme.type-C9bFJKFm.d.cts → theme.type-C2gNHpEx.d.cts} +1 -1
- package/dist/{theme.type-C9bFJKFm.d.ts → theme.type-C2gNHpEx.d.ts} +1 -1
- package/package.json +264 -18
- package/dist/chunk-ECDWSSHJ.js +0 -688
- package/dist/chunk-IYFGO523.cjs +0 -688
|
@@ -0,0 +1,736 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
function _interopRequireDefault(obj) {
|
|
7
|
+
return obj && obj.__esModule ? obj : {
|
|
8
|
+
default: obj
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function _nullishCoalesce(lhs, rhsFn) {
|
|
12
|
+
if (lhs != null) {
|
|
13
|
+
return lhs;
|
|
14
|
+
} else {
|
|
15
|
+
return rhsFn();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function _optionalChain(ops) {
|
|
19
|
+
let lastAccessLHS = undefined;
|
|
20
|
+
let value = ops[0];
|
|
21
|
+
let i = 1;
|
|
22
|
+
while (i < ops.length) {
|
|
23
|
+
const op = ops[i];
|
|
24
|
+
const fn = ops[i + 1];
|
|
25
|
+
i += 2;
|
|
26
|
+
if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
if (op === 'access' || op === 'optionalAccess') {
|
|
30
|
+
lastAccessLHS = value;
|
|
31
|
+
value = fn(value);
|
|
32
|
+
} else if (op === 'call' || op === 'optionalCall') {
|
|
33
|
+
value = fn((...args) => value.call(lastAccessLHS, ...args));
|
|
34
|
+
lastAccessLHS = undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
var _chunk7EIHHOHPcjs = require('./chunk-7EIHHOHP.cjs');
|
|
40
|
+
var _chunkFNEUOBCVcjs = require('./chunk-FNEUOBCV.cjs');
|
|
41
|
+
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
42
|
+
var _chunk7GHM4GKLcjs = require('./chunk-7GHM4GKL.cjs');
|
|
43
|
+
var _chunkTK44VBIEcjs = require('./chunk-TK44VBIE.cjs');
|
|
44
|
+
|
|
45
|
+
// src/components/input-otp/input-otp-box.tsx
|
|
46
|
+
var _react = require('react');
|
|
47
|
+
var _reactnative = require('react-native');
|
|
48
|
+
|
|
49
|
+
// src/components/input-otp/input-otp.context.ts
|
|
50
|
+
var [InputOTPProvider, useInputOTP] = _chunk7GHM4GKLcjs.createSlotContext.call(void 0, "InputOTP");
|
|
51
|
+
var [InputOTPBoxProvider, useInputOTPBox] = _chunk7GHM4GKLcjs.createSlotContext.call(void 0, "InputOTP.Box");
|
|
52
|
+
|
|
53
|
+
// src/components/input-otp/input-otp-caret.tsx
|
|
54
|
+
|
|
55
|
+
var _reactnativereanimated = require('react-native-reanimated');
|
|
56
|
+
var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
|
|
57
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
58
|
+
var BLINK_DURATION = 530;
|
|
59
|
+
function InputOTPCaret({
|
|
60
|
+
style,
|
|
61
|
+
animation = true,
|
|
62
|
+
...props
|
|
63
|
+
}) {
|
|
64
|
+
const {
|
|
65
|
+
caretStyle
|
|
66
|
+
} = useInputOTP();
|
|
67
|
+
const {
|
|
68
|
+
slot
|
|
69
|
+
} = useInputOTPBox();
|
|
70
|
+
const [styleProps] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
71
|
+
const barStyle = [caretStyle, styleProps, style];
|
|
72
|
+
if (!_optionalChain([slot, 'optionalAccess', _2 => _2.isCaretVisible])) return null;
|
|
73
|
+
if (!animation) return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
|
|
74
|
+
style: barStyle
|
|
75
|
+
});
|
|
76
|
+
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, BlinkingCaret, {
|
|
77
|
+
style: barStyle
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
InputOTPCaret.displayName = "XAUI.InputOTP.Caret";
|
|
81
|
+
const _worklet_9856484408150_init_data = {
|
|
82
|
+
code: "function chunkABAGZTXZCjs1(){const{opacity}=this.__closure;return{opacity:opacity.value};}",
|
|
83
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-ABAGZTXZ.cjs",
|
|
84
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunkABAGZTXZCjs1\",\"opacity\",\"__closure\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-ABAGZTXZ.cjs\"],\"mappings\":\"AA8D6E,SAAAA,iBAAMA,CAAA,QAAAC,OAAA,OAAAC,SAAA,CAE/E,MAAO,CAAED,OAAO,CAAEA,OAAO,CAACE,KAAM,CAAC,CACnC\",\"ignoreList\":[]}"
|
|
85
|
+
};
|
|
86
|
+
function BlinkingCaret({
|
|
87
|
+
style
|
|
88
|
+
}) {
|
|
89
|
+
const opacity = _reactnativereanimated.useSharedValue.call(void 0, 1);
|
|
90
|
+
_react.useEffect.call(void 0, () => {
|
|
91
|
+
opacity.value = _reactnativereanimated.withRepeat.call(void 0, _reactnativereanimated.withTiming.call(void 0, 0, {
|
|
92
|
+
duration: BLINK_DURATION,
|
|
93
|
+
easing: _reactnativereanimated.Easing.ease
|
|
94
|
+
}), -1, true);
|
|
95
|
+
return () => _reactnativereanimated.cancelAnimation.call(void 0, opacity);
|
|
96
|
+
}, [opacity]);
|
|
97
|
+
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkABAGZTXZCjs1Factory({
|
|
98
|
+
_worklet_9856484408150_init_data,
|
|
99
|
+
opacity
|
|
100
|
+
}) {
|
|
101
|
+
const _e = [new global.Error(), -2, -27];
|
|
102
|
+
const chunkABAGZTXZCjs1 = function () {
|
|
103
|
+
return {
|
|
104
|
+
opacity: opacity.value
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
chunkABAGZTXZCjs1.__closure = {
|
|
108
|
+
opacity
|
|
109
|
+
};
|
|
110
|
+
chunkABAGZTXZCjs1.__workletHash = 9856484408150;
|
|
111
|
+
chunkABAGZTXZCjs1.__pluginVersion = "0.7.4";
|
|
112
|
+
chunkABAGZTXZCjs1.__initData = _worklet_9856484408150_init_data;
|
|
113
|
+
chunkABAGZTXZCjs1.__stackDetails = _e;
|
|
114
|
+
return chunkABAGZTXZCjs1;
|
|
115
|
+
}({
|
|
116
|
+
_worklet_9856484408150_init_data,
|
|
117
|
+
opacity
|
|
118
|
+
}), [opacity]);
|
|
119
|
+
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, {
|
|
120
|
+
style: [style, animatedStyle]
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// src/components/input-otp/input-otp-placeholder.tsx
|
|
125
|
+
|
|
126
|
+
var InputOTPPlaceholder = _react.forwardRef.call(void 0, function InputOTPPlaceholder2({
|
|
127
|
+
children,
|
|
128
|
+
style,
|
|
129
|
+
maxFontSizeMultiplier = 1.6,
|
|
130
|
+
...props
|
|
131
|
+
}, ref) {
|
|
132
|
+
const {
|
|
133
|
+
placeholderStyle
|
|
134
|
+
} = useInputOTP();
|
|
135
|
+
const {
|
|
136
|
+
slot
|
|
137
|
+
} = useInputOTPBox();
|
|
138
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
139
|
+
const char = _nullishCoalesce(children, () => _optionalChain([slot, 'optionalAccess', _3 => _3.placeholderChar]));
|
|
140
|
+
if (!char) return null;
|
|
141
|
+
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.Text, {
|
|
142
|
+
ref,
|
|
143
|
+
maxFontSizeMultiplier,
|
|
144
|
+
style: [placeholderStyle, styleProps, style],
|
|
145
|
+
...rest,
|
|
146
|
+
children: char
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
InputOTPPlaceholder.displayName = "XAUI.InputOTP.Placeholder";
|
|
150
|
+
|
|
151
|
+
// src/components/input-otp/input-otp-value.tsx
|
|
152
|
+
|
|
153
|
+
var InputOTPValue = _react.forwardRef.call(void 0, function InputOTPValue2({
|
|
154
|
+
children,
|
|
155
|
+
style,
|
|
156
|
+
maxFontSizeMultiplier = 1.6,
|
|
157
|
+
...props
|
|
158
|
+
}, ref) {
|
|
159
|
+
const {
|
|
160
|
+
valueStyle
|
|
161
|
+
} = useInputOTP();
|
|
162
|
+
const {
|
|
163
|
+
slot
|
|
164
|
+
} = useInputOTPBox();
|
|
165
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
166
|
+
const char = _nullishCoalesce(children, () => _optionalChain([slot, 'optionalAccess', _4 => _4.char]));
|
|
167
|
+
if (!char) return null;
|
|
168
|
+
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.Text, {
|
|
169
|
+
ref,
|
|
170
|
+
maxFontSizeMultiplier,
|
|
171
|
+
style: [valueStyle, styleProps, style],
|
|
172
|
+
...rest,
|
|
173
|
+
children: char
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
InputOTPValue.displayName = "XAUI.InputOTP.Value";
|
|
177
|
+
|
|
178
|
+
// src/components/input-otp/input-otp-box.tsx
|
|
179
|
+
|
|
180
|
+
var InputOTPBox = _react.forwardRef.call(void 0, function InputOTPBox2({
|
|
181
|
+
index,
|
|
182
|
+
children,
|
|
183
|
+
style,
|
|
184
|
+
...props
|
|
185
|
+
}, ref) {
|
|
186
|
+
const {
|
|
187
|
+
boxStyle,
|
|
188
|
+
boxActiveStyle,
|
|
189
|
+
slots
|
|
190
|
+
} = useInputOTP();
|
|
191
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
192
|
+
const slot = slots[index];
|
|
193
|
+
const context = _react.useMemo.call(void 0, () => ({
|
|
194
|
+
slot
|
|
195
|
+
}), [slot]);
|
|
196
|
+
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, InputOTPBoxProvider, {
|
|
197
|
+
value: context,
|
|
198
|
+
children: /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
|
|
199
|
+
ref,
|
|
200
|
+
style: [_optionalChain([slot, 'optionalAccess', _5 => _5.isActive]) ? boxActiveStyle : boxStyle, styleProps, style],
|
|
201
|
+
...rest,
|
|
202
|
+
children: _nullishCoalesce(children, () => (/* @__PURE__ */_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
|
|
203
|
+
children: [/* @__PURE__ */_jsxruntime.jsx.call(void 0, InputOTPPlaceholder, {}), /* @__PURE__ */_jsxruntime.jsx.call(void 0, InputOTPValue, {}), /* @__PURE__ */_jsxruntime.jsx.call(void 0, InputOTPCaret, {})]
|
|
204
|
+
})))
|
|
205
|
+
})
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
InputOTPBox.displayName = "XAUI.InputOTP.Box";
|
|
209
|
+
|
|
210
|
+
// src/components/input-otp/input-otp-group.tsx
|
|
211
|
+
|
|
212
|
+
var InputOTPGroup = _react.forwardRef.call(void 0, function InputOTPGroup2({
|
|
213
|
+
children,
|
|
214
|
+
style,
|
|
215
|
+
...props
|
|
216
|
+
}, ref) {
|
|
217
|
+
const {
|
|
218
|
+
groupStyle,
|
|
219
|
+
slots,
|
|
220
|
+
value,
|
|
221
|
+
maxLength,
|
|
222
|
+
isFocused,
|
|
223
|
+
isDisabled,
|
|
224
|
+
isInvalid
|
|
225
|
+
} = useInputOTP();
|
|
226
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
227
|
+
const content = typeof children === "function" ? children({
|
|
228
|
+
slots,
|
|
229
|
+
value,
|
|
230
|
+
maxLength,
|
|
231
|
+
isFocused,
|
|
232
|
+
isDisabled,
|
|
233
|
+
isInvalid
|
|
234
|
+
}) : children;
|
|
235
|
+
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
|
|
236
|
+
ref,
|
|
237
|
+
style: [groupStyle, styleProps, style],
|
|
238
|
+
...rest,
|
|
239
|
+
children: content
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
InputOTPGroup.displayName = "XAUI.InputOTP.Group";
|
|
243
|
+
|
|
244
|
+
// src/components/input-otp/input-otp-separator.tsx
|
|
245
|
+
|
|
246
|
+
var InputOTPSeparator = _react.forwardRef.call(void 0, function InputOTPSeparator2({
|
|
247
|
+
children,
|
|
248
|
+
style,
|
|
249
|
+
...props
|
|
250
|
+
}, ref) {
|
|
251
|
+
const {
|
|
252
|
+
separatorStyle
|
|
253
|
+
} = useInputOTP();
|
|
254
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
255
|
+
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
|
|
256
|
+
ref,
|
|
257
|
+
accessibilityElementsHidden: true,
|
|
258
|
+
importantForAccessibility: "no-hide-descendants",
|
|
259
|
+
style: [separatorStyle, styleProps, style],
|
|
260
|
+
...rest,
|
|
261
|
+
children
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
InputOTPSeparator.displayName = "XAUI.InputOTP.Separator";
|
|
265
|
+
|
|
266
|
+
// src/components/input-otp/input-otp.tsx
|
|
267
|
+
|
|
268
|
+
// src/components/input-otp/input-otp.hook.ts
|
|
269
|
+
|
|
270
|
+
// src/components/input-otp/input-otp.utils.ts
|
|
271
|
+
function buildSlots({
|
|
272
|
+
value,
|
|
273
|
+
maxLength,
|
|
274
|
+
isFocused,
|
|
275
|
+
placeholder
|
|
276
|
+
}) {
|
|
277
|
+
return Array.from({
|
|
278
|
+
length: maxLength
|
|
279
|
+
}, (_, index) => {
|
|
280
|
+
const char = _nullishCoalesce(value[index], () => null);
|
|
281
|
+
const isActive = isFocused && index === value.length;
|
|
282
|
+
return {
|
|
283
|
+
index,
|
|
284
|
+
char,
|
|
285
|
+
// A box shows its placeholder only when it has neither a character nor the caret.
|
|
286
|
+
placeholderChar: char === null && !isActive ? placeholderFor(placeholder, index) : null,
|
|
287
|
+
isActive,
|
|
288
|
+
isCaretVisible: isActive && char === null
|
|
289
|
+
};
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function placeholderFor(placeholder, index) {
|
|
293
|
+
if (!placeholder) return null;
|
|
294
|
+
return placeholder.length === 1 ? placeholder : _nullishCoalesce(placeholder[index], () => null);
|
|
295
|
+
}
|
|
296
|
+
function extractPastedCode(pasted, maxLength) {
|
|
297
|
+
const match = pasted.match(new RegExp(`(?<!\\d)(\\d{${maxLength}})(?!\\d)`));
|
|
298
|
+
return _nullishCoalesce(_optionalChain([match, 'optionalAccess', _6 => _6[1]]), () => "");
|
|
299
|
+
}
|
|
300
|
+
function isPaste(text, previous) {
|
|
301
|
+
return text.length > previous.length + 1;
|
|
302
|
+
}
|
|
303
|
+
var OTP_DIGITS = "^\\d+$";
|
|
304
|
+
var OTP_LETTERS = "^[a-zA-Z]+$";
|
|
305
|
+
var OTP_ALPHANUMERIC = "^[a-zA-Z0-9]+$";
|
|
306
|
+
|
|
307
|
+
// src/components/input-otp/input-otp.hook.ts
|
|
308
|
+
function useInputOTPState({
|
|
309
|
+
maxLength,
|
|
310
|
+
value: valueProp,
|
|
311
|
+
defaultValue = "",
|
|
312
|
+
onChangeText: onChangeTextProp,
|
|
313
|
+
onComplete,
|
|
314
|
+
pattern,
|
|
315
|
+
placeholder
|
|
316
|
+
}) {
|
|
317
|
+
const [value, setValue] = _chunk7EIHHOHPcjs.useControllableState.call(void 0, {
|
|
318
|
+
value: valueProp,
|
|
319
|
+
defaultValue,
|
|
320
|
+
onChange: onChangeTextProp
|
|
321
|
+
});
|
|
322
|
+
const [isFocused, setIsFocused] = _react.useState.call(void 0, false);
|
|
323
|
+
const inputRef = _react.useRef.call(void 0, null);
|
|
324
|
+
const regexp = _react.useMemo.call(void 0, () => {
|
|
325
|
+
if (!pattern) return null;
|
|
326
|
+
return typeof pattern === "string" ? new RegExp(pattern) : pattern;
|
|
327
|
+
}, [pattern]);
|
|
328
|
+
const slots = _react.useMemo.call(void 0, () => buildSlots({
|
|
329
|
+
value,
|
|
330
|
+
maxLength,
|
|
331
|
+
isFocused,
|
|
332
|
+
placeholder
|
|
333
|
+
}), [value, maxLength, isFocused, placeholder]);
|
|
334
|
+
const latest = _react.useRef.call(void 0, {
|
|
335
|
+
value,
|
|
336
|
+
maxLength,
|
|
337
|
+
regexp,
|
|
338
|
+
onComplete,
|
|
339
|
+
setValue
|
|
340
|
+
});
|
|
341
|
+
latest.current = {
|
|
342
|
+
value,
|
|
343
|
+
maxLength,
|
|
344
|
+
regexp,
|
|
345
|
+
onComplete,
|
|
346
|
+
setValue
|
|
347
|
+
};
|
|
348
|
+
const onChangeText = _react.useCallback.call(void 0, text => {
|
|
349
|
+
const current = latest.current;
|
|
350
|
+
const candidate = isPaste(text, current.value) ? extractPastedCode(text, current.maxLength) : text;
|
|
351
|
+
const next = candidate.slice(0, current.maxLength);
|
|
352
|
+
if (next.length > 0 && current.regexp && !current.regexp.test(next)) return;
|
|
353
|
+
current.setValue(next);
|
|
354
|
+
if (next.length === current.maxLength) _optionalChain([current, 'access', _7 => _7.onComplete, 'optionalCall', _8 => _8(next)]);
|
|
355
|
+
}, []);
|
|
356
|
+
const onFocus = _react.useCallback.call(void 0, () => setIsFocused(true), []);
|
|
357
|
+
const onBlur = _react.useCallback.call(void 0, () => setIsFocused(false), []);
|
|
358
|
+
const handle = _react.useMemo.call(void 0, () => ({
|
|
359
|
+
focus: () => _optionalChain([inputRef, 'access', _9 => _9.current, 'optionalAccess', _10 => _10.focus, 'call', _11 => _11()]),
|
|
360
|
+
blur: () => _optionalChain([inputRef, 'access', _12 => _12.current, 'optionalAccess', _13 => _13.blur, 'call', _14 => _14()]),
|
|
361
|
+
// Both halves: the native buffer and our value. Clearing one and not the other is
|
|
362
|
+
// how a cleared field comes back on the next keystroke.
|
|
363
|
+
clear: () => {
|
|
364
|
+
_optionalChain([inputRef, 'access', _15 => _15.current, 'optionalAccess', _16 => _16.clear, 'call', _17 => _17()]);
|
|
365
|
+
latest.current.setValue("");
|
|
366
|
+
}
|
|
367
|
+
}), []);
|
|
368
|
+
return {
|
|
369
|
+
value,
|
|
370
|
+
slots,
|
|
371
|
+
isFocused,
|
|
372
|
+
inputRef,
|
|
373
|
+
handle,
|
|
374
|
+
onChangeText,
|
|
375
|
+
onFocus,
|
|
376
|
+
onBlur
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// src/components/input-otp/input-otp.recipe.ts
|
|
381
|
+
var SLOTS = ["root", "group", "box", "value", "placeholder", "caret", "separator"];
|
|
382
|
+
var VARIANT_TOKENS = {
|
|
383
|
+
primary: {
|
|
384
|
+
bg: "fieldBackground",
|
|
385
|
+
border: "fieldBorder",
|
|
386
|
+
borderFocus: "accent",
|
|
387
|
+
fg: "fieldForeground"
|
|
388
|
+
},
|
|
389
|
+
secondary: {
|
|
390
|
+
bg: "default",
|
|
391
|
+
border: "fieldBorder",
|
|
392
|
+
borderFocus: "accent",
|
|
393
|
+
fg: "fieldForeground"
|
|
394
|
+
},
|
|
395
|
+
tertiary: {
|
|
396
|
+
border: "fieldBorder",
|
|
397
|
+
borderFocus: "accent",
|
|
398
|
+
fg: "fieldForeground"
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
var PLACEHOLDER_OPACITY = 0.5;
|
|
402
|
+
var ACTIVE_BORDER_WIDTH = 2;
|
|
403
|
+
function sizeAxis(step) {
|
|
404
|
+
const {
|
|
405
|
+
control,
|
|
406
|
+
gap,
|
|
407
|
+
glyph
|
|
408
|
+
} = step;
|
|
409
|
+
return theme => {
|
|
410
|
+
const height = theme.controlHeights[control];
|
|
411
|
+
const type = {
|
|
412
|
+
fontSize: theme.fontSizes[glyph],
|
|
413
|
+
lineHeight: theme.lineHeights[glyph]
|
|
414
|
+
};
|
|
415
|
+
return {
|
|
416
|
+
root: {
|
|
417
|
+
gap: theme.spacing(gap)
|
|
418
|
+
},
|
|
419
|
+
group: {
|
|
420
|
+
gap: theme.spacing(gap)
|
|
421
|
+
},
|
|
422
|
+
box: {
|
|
423
|
+
height,
|
|
424
|
+
width: height - theme.spacing(1)
|
|
425
|
+
},
|
|
426
|
+
value: type,
|
|
427
|
+
placeholder: type,
|
|
428
|
+
// As tall as the character it stands in for, so the box does not change shape
|
|
429
|
+
// between an empty state and a typed one.
|
|
430
|
+
caret: {
|
|
431
|
+
height: theme.lineHeights[glyph],
|
|
432
|
+
width: theme.spacing(CARET_WIDTH)
|
|
433
|
+
},
|
|
434
|
+
separator: {
|
|
435
|
+
height: theme.spacing(CARET_WIDTH),
|
|
436
|
+
width: theme.spacing(SEPARATOR_WIDTH)
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
var CARET_WIDTH = 0.5;
|
|
442
|
+
var SEPARATOR_WIDTH = 2;
|
|
443
|
+
var SIZES = {
|
|
444
|
+
sm: {
|
|
445
|
+
control: "sm",
|
|
446
|
+
gap: 2,
|
|
447
|
+
glyph: "md"
|
|
448
|
+
},
|
|
449
|
+
md: {
|
|
450
|
+
control: "md",
|
|
451
|
+
gap: 2,
|
|
452
|
+
glyph: "lg"
|
|
453
|
+
},
|
|
454
|
+
lg: {
|
|
455
|
+
control: "lg",
|
|
456
|
+
gap: 2.5,
|
|
457
|
+
glyph: "xl"
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
var inputOTPRecipe = _chunkFNEUOBCVcjs.createRecipe.call(void 0, {
|
|
461
|
+
slots: SLOTS,
|
|
462
|
+
base: theme => ({
|
|
463
|
+
root: {
|
|
464
|
+
flexDirection: "row",
|
|
465
|
+
alignItems: "center"
|
|
466
|
+
},
|
|
467
|
+
group: {
|
|
468
|
+
flexDirection: "row",
|
|
469
|
+
alignItems: "center"
|
|
470
|
+
},
|
|
471
|
+
box: {
|
|
472
|
+
alignItems: "center",
|
|
473
|
+
justifyContent: "center",
|
|
474
|
+
// `lg` and not `field`, though the two are the same twelve points at the default
|
|
475
|
+
// base. The keys are kept apart on purpose: `field` is the corner a theme moves when
|
|
476
|
+
// it wants rounder *fields*, and a field is wide — a code box is very nearly square,
|
|
477
|
+
// 44 by 48 at `md`, where the geometric maximum is 22 and anything near it is a pill
|
|
478
|
+
// in all but name. Following `field` here would hand this component a shape that was
|
|
479
|
+
// never decided for it.
|
|
480
|
+
borderRadius: theme.radius.lg,
|
|
481
|
+
borderCurve: "continuous",
|
|
482
|
+
// The one root in the library that clips: the box has no shadow to lose and a
|
|
483
|
+
// character wider than it would otherwise spill onto its neighbour.
|
|
484
|
+
overflow: "hidden"
|
|
485
|
+
},
|
|
486
|
+
// `semibold`, where a field's own text is `regular`. A code is read at a glance and
|
|
487
|
+
// then compared character by character, which is the one thing weight helps with.
|
|
488
|
+
value: {
|
|
489
|
+
fontFamily: theme.fontFamilies.body,
|
|
490
|
+
fontWeight: theme.fontWeights.semibold
|
|
491
|
+
},
|
|
492
|
+
placeholder: {
|
|
493
|
+
fontFamily: theme.fontFamilies.body,
|
|
494
|
+
fontWeight: theme.fontWeights.semibold,
|
|
495
|
+
color: theme.colors.fieldPlaceholder,
|
|
496
|
+
opacity: PLACEHOLDER_OPACITY
|
|
497
|
+
},
|
|
498
|
+
caret: {
|
|
499
|
+
position: "absolute",
|
|
500
|
+
borderRadius: theme.radius.full,
|
|
501
|
+
backgroundColor: theme.colors.fieldPlaceholder
|
|
502
|
+
},
|
|
503
|
+
// The theme's second separator level rather than the first at half opacity: it is
|
|
504
|
+
// already the lighter of the two, and it composites the same way in both modes.
|
|
505
|
+
separator: {
|
|
506
|
+
borderRadius: theme.radius.full,
|
|
507
|
+
backgroundColor: theme.colors.separatorSecondary
|
|
508
|
+
}
|
|
509
|
+
}),
|
|
510
|
+
variantTokens: VARIANT_TOKENS,
|
|
511
|
+
/**
|
|
512
|
+
* Where the variant's colours land. The border width follows the *presence* of the
|
|
513
|
+
* border role, so a variant that names none needs no rule of its own to say so.
|
|
514
|
+
*
|
|
515
|
+
* The active box takes the ring whichever variant it is: the `focused` state sets the
|
|
516
|
+
* width as well as the colour. The box has a fixed width and height and centres what it
|
|
517
|
+
* holds, so an edge appearing moves nothing.
|
|
518
|
+
*/
|
|
519
|
+
paint: (theme, colors) => ({
|
|
520
|
+
box: {
|
|
521
|
+
backgroundColor: colors.bg,
|
|
522
|
+
borderColor: colors.border,
|
|
523
|
+
borderWidth: colors.border ? theme.borderWidth.field : 0
|
|
524
|
+
},
|
|
525
|
+
value: {
|
|
526
|
+
color: colors.fg
|
|
527
|
+
}
|
|
528
|
+
}),
|
|
529
|
+
variants: {
|
|
530
|
+
size: {
|
|
531
|
+
sm: sizeAxis(SIZES.sm),
|
|
532
|
+
md: sizeAxis(SIZES.md),
|
|
533
|
+
lg: sizeAxis(SIZES.lg)
|
|
534
|
+
},
|
|
535
|
+
radius: _chunkFNEUOBCVcjs.radiusAxis.call(void 0, "box"),
|
|
536
|
+
/**
|
|
537
|
+
* Declared after `size` and before the states, so a code that is wrong stays wrong
|
|
538
|
+
* under the finger: the ring below reads `borderFocus`, and the root hands it the
|
|
539
|
+
* danger colour by suppressing the active state and painting every box instead.
|
|
540
|
+
*/
|
|
541
|
+
isInvalid: {
|
|
542
|
+
true: theme => ({
|
|
543
|
+
box: {
|
|
544
|
+
borderColor: theme.colors.danger,
|
|
545
|
+
borderWidth: ACTIVE_BORDER_WIDTH
|
|
546
|
+
}
|
|
547
|
+
})
|
|
548
|
+
}
|
|
549
|
+
},
|
|
550
|
+
compoundVariants: [{
|
|
551
|
+
when: {
|
|
552
|
+
variant: "primary"
|
|
553
|
+
},
|
|
554
|
+
style: theme => ({
|
|
555
|
+
box: theme.shadows.field
|
|
556
|
+
})
|
|
557
|
+
}],
|
|
558
|
+
/**
|
|
559
|
+
* `focused` here means **this box is the active one**, not that the component has the
|
|
560
|
+
* keyboard: the root resolves the recipe twice, once each way, and hands both to the
|
|
561
|
+
* boxes so none of them resolves anything itself (R5).
|
|
562
|
+
*/
|
|
563
|
+
states: {
|
|
564
|
+
focused: (_theme, colors) => ({
|
|
565
|
+
box: {
|
|
566
|
+
borderColor: colors.borderFocus,
|
|
567
|
+
borderWidth: ACTIVE_BORDER_WIDTH
|
|
568
|
+
}
|
|
569
|
+
}),
|
|
570
|
+
disabled: theme => ({
|
|
571
|
+
root: {
|
|
572
|
+
opacity: theme.opacity.disabled
|
|
573
|
+
}
|
|
574
|
+
})
|
|
575
|
+
},
|
|
576
|
+
defaultVariants: {
|
|
577
|
+
variant: "secondary",
|
|
578
|
+
size: "md"
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
// src/components/input-otp/input-otp.style.ts
|
|
583
|
+
|
|
584
|
+
var inputOTPSheet = _reactnative.StyleSheet.create({
|
|
585
|
+
hiddenInput: {
|
|
586
|
+
..._reactnative.StyleSheet.absoluteFillObject,
|
|
587
|
+
color: "transparent",
|
|
588
|
+
// A caret of our own is drawn in the active box; the platform's would sit wherever
|
|
589
|
+
// the invisible text happens to end.
|
|
590
|
+
..._reactnative.Platform.select({
|
|
591
|
+
ios: {
|
|
592
|
+
opacity: 0.02
|
|
593
|
+
},
|
|
594
|
+
default: {
|
|
595
|
+
opacity: 0
|
|
596
|
+
}
|
|
597
|
+
})
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
// src/components/input-otp/input-otp.tsx
|
|
602
|
+
|
|
603
|
+
var InputOTPRoot = _react.forwardRef.call(void 0, function InputOTP({
|
|
604
|
+
children,
|
|
605
|
+
maxLength,
|
|
606
|
+
variant,
|
|
607
|
+
size,
|
|
608
|
+
radius,
|
|
609
|
+
color,
|
|
610
|
+
value: valueProp,
|
|
611
|
+
defaultValue,
|
|
612
|
+
onChangeText,
|
|
613
|
+
onComplete,
|
|
614
|
+
pattern,
|
|
615
|
+
placeholder,
|
|
616
|
+
isInvalid = false,
|
|
617
|
+
isDisabled = false,
|
|
618
|
+
inputMode = "numeric",
|
|
619
|
+
textInputProps,
|
|
620
|
+
style,
|
|
621
|
+
...props
|
|
622
|
+
}, ref) {
|
|
623
|
+
const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0);
|
|
624
|
+
const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
|
|
625
|
+
const state = useInputOTPState({
|
|
626
|
+
maxLength,
|
|
627
|
+
value: valueProp,
|
|
628
|
+
defaultValue,
|
|
629
|
+
onChangeText,
|
|
630
|
+
onComplete,
|
|
631
|
+
pattern,
|
|
632
|
+
placeholder
|
|
633
|
+
});
|
|
634
|
+
_react.useImperativeHandle.call(void 0, ref, () => state.handle, [state.handle]);
|
|
635
|
+
const selection = {
|
|
636
|
+
variant,
|
|
637
|
+
size,
|
|
638
|
+
radius,
|
|
639
|
+
isInvalid: isInvalid ? "true" : void 0
|
|
640
|
+
};
|
|
641
|
+
const states = {
|
|
642
|
+
disabled: isDisabled
|
|
643
|
+
};
|
|
644
|
+
const styles = inputOTPRecipe.resolve({
|
|
645
|
+
theme,
|
|
646
|
+
selection,
|
|
647
|
+
states
|
|
648
|
+
});
|
|
649
|
+
const activeStyles = isInvalid ? styles : inputOTPRecipe.resolve({
|
|
650
|
+
theme,
|
|
651
|
+
selection,
|
|
652
|
+
states: {
|
|
653
|
+
...states,
|
|
654
|
+
focused: true
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
const tint = color ? inputOTPRecipe.tint({
|
|
658
|
+
theme,
|
|
659
|
+
color,
|
|
660
|
+
selection,
|
|
661
|
+
states
|
|
662
|
+
}) : void 0;
|
|
663
|
+
const activeTint = color && !isInvalid ? inputOTPRecipe.tint({
|
|
664
|
+
theme,
|
|
665
|
+
color,
|
|
666
|
+
selection,
|
|
667
|
+
states: {
|
|
668
|
+
...states,
|
|
669
|
+
focused: true
|
|
670
|
+
}
|
|
671
|
+
}) : tint;
|
|
672
|
+
const context = _react.useMemo.call(void 0, () => ({
|
|
673
|
+
groupStyle: styles.group,
|
|
674
|
+
boxStyle: tint ? [styles.box, tint.box] : styles.box,
|
|
675
|
+
boxActiveStyle: activeTint ? [activeStyles.box, activeTint.box] : activeStyles.box,
|
|
676
|
+
valueStyle: tint ? [styles.value, tint.value] : styles.value,
|
|
677
|
+
placeholderStyle: styles.placeholder,
|
|
678
|
+
caretStyle: styles.caret,
|
|
679
|
+
separatorStyle: styles.separator,
|
|
680
|
+
slots: state.slots,
|
|
681
|
+
value: state.value,
|
|
682
|
+
maxLength,
|
|
683
|
+
isFocused: state.isFocused,
|
|
684
|
+
isDisabled,
|
|
685
|
+
isInvalid,
|
|
686
|
+
inputRef: state.inputRef
|
|
687
|
+
}), [styles, activeStyles, tint, activeTint, state.slots, state.value, state.isFocused, state.inputRef, maxLength, isDisabled, isInvalid]);
|
|
688
|
+
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, InputOTPProvider, {
|
|
689
|
+
value: context,
|
|
690
|
+
children: /* @__PURE__ */_jsxruntime.jsxs.call(void 0, _reactnative.View, {
|
|
691
|
+
style: [styles.root, _optionalChain([tint, 'optionalAccess', _18 => _18.root]), styleProps, style],
|
|
692
|
+
...rest,
|
|
693
|
+
children: [children, /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.TextInput, {
|
|
694
|
+
ref: state.inputRef,
|
|
695
|
+
style: inputOTPSheet.hiddenInput,
|
|
696
|
+
value: state.value,
|
|
697
|
+
onChangeText: state.onChangeText,
|
|
698
|
+
onFocus: state.onFocus,
|
|
699
|
+
onBlur: state.onBlur,
|
|
700
|
+
editable: !isDisabled,
|
|
701
|
+
inputMode,
|
|
702
|
+
caretHidden: true,
|
|
703
|
+
autoComplete: "one-time-code",
|
|
704
|
+
textContentType: "oneTimeCode",
|
|
705
|
+
accessibilityLabel: `${maxLength}-character code`,
|
|
706
|
+
accessibilityState: {
|
|
707
|
+
disabled: isDisabled
|
|
708
|
+
},
|
|
709
|
+
accessibilityValue: {
|
|
710
|
+
text: `${state.value.length} of ${maxLength} entered`
|
|
711
|
+
},
|
|
712
|
+
...textInputProps
|
|
713
|
+
})]
|
|
714
|
+
})
|
|
715
|
+
});
|
|
716
|
+
});
|
|
717
|
+
InputOTPRoot.displayName = "XAUI.InputOTP.Root";
|
|
718
|
+
|
|
719
|
+
// src/components/input-otp/index.ts
|
|
720
|
+
var InputOTP2 = Object.assign(InputOTPRoot, {
|
|
721
|
+
Group: InputOTPGroup,
|
|
722
|
+
Box: InputOTPBox,
|
|
723
|
+
Value: InputOTPValue,
|
|
724
|
+
Placeholder: InputOTPPlaceholder,
|
|
725
|
+
Caret: InputOTPCaret,
|
|
726
|
+
Separator: InputOTPSeparator
|
|
727
|
+
});
|
|
728
|
+
exports.useInputOTP = useInputOTP;
|
|
729
|
+
exports.useInputOTPBox = useInputOTPBox;
|
|
730
|
+
exports.buildSlots = buildSlots;
|
|
731
|
+
exports.extractPastedCode = extractPastedCode;
|
|
732
|
+
exports.OTP_DIGITS = OTP_DIGITS;
|
|
733
|
+
exports.OTP_LETTERS = OTP_LETTERS;
|
|
734
|
+
exports.OTP_ALPHANUMERIC = OTP_ALPHANUMERIC;
|
|
735
|
+
exports.inputOTPRecipe = inputOTPRecipe;
|
|
736
|
+
exports.InputOTP = InputOTP2;
|