@xaui/native 0.0.27 → 0.0.28
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/LICENSE +21 -0
- package/README.md +105 -228
- package/dist/alert/index.cjs +92 -166
- package/dist/alert/index.js +2 -1
- package/dist/app-bar/index.cjs +24 -98
- package/dist/app-bar/index.js +2 -1
- package/dist/autocomplete/index.cjs +192 -281
- package/dist/autocomplete/index.js +36 -48
- package/dist/avatar/index.cjs +59 -133
- package/dist/avatar/index.js +2 -1
- package/dist/badge/index.cjs +26 -99
- package/dist/badge/index.js +2 -1
- package/dist/bottom-sheet/index.cjs +5 -456
- package/dist/bottom-sheet/index.js +4 -363
- package/dist/bottom-tab-bar/index.cjs +93 -167
- package/dist/bottom-tab-bar/index.js +2 -2
- package/dist/button/index.cjs +73 -525
- package/dist/button/index.js +3 -2
- package/dist/card/index.cjs +76 -169
- package/dist/card/index.js +2 -2
- package/dist/carousel/index.cjs +68 -145
- package/dist/carousel/index.js +1 -1
- package/dist/chart/index.cjs +132 -173
- package/dist/checkbox/index.cjs +70 -143
- package/dist/checkbox/index.js +2 -1
- package/dist/chip/index.cjs +89 -164
- package/dist/chip/index.js +2 -1
- package/dist/chunk-BD72HIPR.cjs +75 -0
- package/dist/chunk-DHSTKO3K.cjs +19 -0
- package/dist/{chunk-CZFDZPAS.js → chunk-DXXNBF5P.js} +5 -0
- package/dist/{chunk-UI5L26KD.js → chunk-F7WH4DMG.js} +1 -1
- package/dist/chunk-GBHQCAKW.js +19 -0
- package/dist/chunk-HC2SSHNU.js +368 -0
- package/dist/chunk-HSPTLUFA.cjs +7 -0
- package/dist/chunk-JEGEPGVU.js +287 -0
- package/dist/chunk-KTLGDLCB.cjs +287 -0
- package/dist/{chunk-GHCVNQET.js → chunk-LTKYHG5V.js} +5 -12
- package/dist/{chunk-ULJSCNPE.js → chunk-LUBWRVI2.js} +1 -1
- package/dist/chunk-OQ2BLOOG.cjs +138 -0
- package/dist/chunk-QMYWIWSX.cjs +384 -0
- package/dist/chunk-XFPPR2VB.cjs +368 -0
- package/dist/core/index.cjs +22 -168
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +5 -3
- package/dist/datepicker/index.cjs +239 -320
- package/dist/datepicker/index.js +2 -1
- package/dist/divider/index.cjs +5 -145
- package/dist/divider/index.js +3 -2
- package/dist/drawer/index.cjs +39 -112
- package/dist/drawer/index.js +2 -1
- package/dist/expansion-panel/index.cjs +91 -230
- package/dist/expansion-panel/index.js +3 -2
- package/dist/fab/index.cjs +6 -722
- package/dist/fab/index.js +4 -3
- package/dist/fab-menu/index.cjs +81 -814
- package/dist/fab-menu/index.js +4 -3
- package/dist/feature-discovery/index.cjs +72 -139
- package/dist/feature-discovery/index.js +2 -2
- package/dist/index.cjs +1 -18
- package/dist/indicator/index.cjs +5 -445
- package/dist/indicator/index.js +3 -2
- package/dist/input/index.cjs +214 -282
- package/dist/input/index.js +2 -2
- package/dist/list/index.cjs +71 -146
- package/dist/list/index.js +2 -1
- package/dist/menu/index.cjs +59 -127
- package/dist/menu/index.js +2 -2
- package/dist/menubox/index.cjs +60 -132
- package/dist/menubox/index.js +2 -1
- package/dist/pager/index.cjs +42 -80
- package/dist/progress/index.cjs +43 -114
- package/dist/progress/index.js +2 -1
- package/dist/radio/index.cjs +82 -154
- package/dist/radio/index.js +2 -1
- package/dist/segment-button/index.cjs +60 -147
- package/dist/segment-button/index.js +2 -2
- package/dist/select/index.cjs +149 -224
- package/dist/select/index.js +10 -22
- package/dist/skeleton/index.cjs +23 -94
- package/dist/skeleton/index.js +2 -2
- package/dist/slider/index.cjs +77 -156
- package/dist/slider/index.js +2 -1
- package/dist/snackbar/index.cjs +420 -0
- package/dist/snackbar/index.d.cts +175 -0
- package/dist/snackbar/index.d.ts +175 -0
- package/dist/snackbar/index.js +420 -0
- package/dist/stepper/index.cjs +121 -195
- package/dist/stepper/index.js +2 -1
- package/dist/switch/index.cjs +48 -121
- package/dist/switch/index.js +2 -1
- package/dist/tabs/index.cjs +67 -151
- package/dist/tabs/index.js +2 -1
- package/dist/timepicker/index.cjs +135 -593
- package/dist/timepicker/index.js +24 -383
- package/dist/toolbar/index.cjs +59 -128
- package/dist/toolbar/index.js +2 -1
- package/dist/typography/index.cjs +37 -92
- package/dist/typography/index.d.cts +1 -1
- package/dist/typography/index.d.ts +1 -1
- package/dist/typography/index.js +20 -1
- package/dist/view/index.cjs +178 -223
- package/package.json +6 -1
- package/dist/chunk-3XSXTM3G.js +0 -661
- package/dist/chunk-4KSZLONZ.js +0 -79
- package/dist/chunk-I4V5Y5GD.js +0 -76
- package/dist/chunk-URBEEDFX.js +0 -79
package/dist/input/index.cjs
CHANGED
|
@@ -1,95 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
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; }require('../chunk-HSPTLUFA.cjs');
|
|
29
2
|
|
|
30
|
-
// src/components/input/index.ts
|
|
31
|
-
var input_exports = {};
|
|
32
|
-
__export(input_exports, {
|
|
33
|
-
DateInput: () => DateInput,
|
|
34
|
-
DateTimeInput: () => DateTimeInput,
|
|
35
|
-
NumberInput: () => NumberInput,
|
|
36
|
-
OTPInput: () => OTPInput,
|
|
37
|
-
TextArea: () => TextArea,
|
|
38
|
-
TextInput: () => TextInput,
|
|
39
|
-
TimeInput: () => TimeInput,
|
|
40
|
-
getDateOrder: () => getDateOrder
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(input_exports);
|
|
43
3
|
|
|
44
|
-
|
|
45
|
-
var import_react7 = __toESM(require("react"), 1);
|
|
46
|
-
var import_react_native5 = require("react-native");
|
|
47
|
-
var import_icons = require("@xaui/icons");
|
|
4
|
+
var _chunkOQ2BLOOGcjs = require('../chunk-OQ2BLOOG.cjs');
|
|
48
5
|
|
|
49
|
-
// src/components/input/input.
|
|
50
|
-
var
|
|
51
|
-
var import_core = require("@xaui/core");
|
|
52
|
-
|
|
53
|
-
// src/core/theme-context.tsx
|
|
54
|
-
var import_react4 = __toESM(require("react"), 1);
|
|
55
|
-
var import_react_native2 = require("react-native");
|
|
56
|
-
var import_theme = require("@xaui/core/theme");
|
|
57
|
-
var import_palette = require("@xaui/core/palette");
|
|
6
|
+
// src/components/input/input.tsx
|
|
7
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
58
8
|
|
|
59
|
-
// src/core/portal/portal.tsx
|
|
60
|
-
var import_react2 = require("react");
|
|
61
9
|
|
|
62
|
-
// src/core/portal/portal-context.ts
|
|
63
|
-
var import_react = require("react");
|
|
64
|
-
var PortalContext = (0, import_react.createContext)(null);
|
|
65
10
|
|
|
66
|
-
// src/core/portal/portal-host.tsx
|
|
67
|
-
var import_react3 = __toESM(require("react"), 1);
|
|
68
|
-
var import_react_native = require("react-native");
|
|
69
|
-
var hostStyles = import_react_native.StyleSheet.create({
|
|
70
|
-
container: {
|
|
71
|
-
flex: 1
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
11
|
|
|
75
|
-
// src/core/theme-context.tsx
|
|
76
|
-
var XUIThemeContext = (0, import_react4.createContext)(null);
|
|
77
12
|
|
|
78
|
-
// src/core/theme-hooks.ts
|
|
79
|
-
var import_react5 = require("react");
|
|
80
|
-
var import_react_native3 = require("react-native");
|
|
81
|
-
function useXUITheme() {
|
|
82
|
-
const theme = (0, import_react5.useContext)(XUIThemeContext);
|
|
83
|
-
if (!theme) {
|
|
84
|
-
throw new Error("useXUITheme must be used within XUIProvider");
|
|
85
|
-
}
|
|
86
|
-
return theme;
|
|
87
|
-
}
|
|
88
13
|
|
|
89
|
-
|
|
90
|
-
var
|
|
14
|
+
var _reactnative = require('react-native');
|
|
15
|
+
var _icons = require('@xaui/icons');
|
|
91
16
|
|
|
92
17
|
// src/components/input/input.hook.ts
|
|
18
|
+
|
|
19
|
+
var _core = require('@xaui/core');
|
|
93
20
|
var sizeMap = {
|
|
94
21
|
sm: {
|
|
95
22
|
minHeight: 40,
|
|
@@ -120,11 +47,11 @@ var sizeMap = {
|
|
|
120
47
|
}
|
|
121
48
|
};
|
|
122
49
|
var useTextInputSizeStyles = (size) => {
|
|
123
|
-
return (0,
|
|
50
|
+
return _react.useMemo.call(void 0, () => sizeMap[size], [size]);
|
|
124
51
|
};
|
|
125
52
|
var useTextInputRadiusStyles = (radius) => {
|
|
126
|
-
const theme = useXUITheme();
|
|
127
|
-
return (0,
|
|
53
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
54
|
+
return _react.useMemo.call(void 0, () => {
|
|
128
55
|
if (radius === "full") {
|
|
129
56
|
return { borderRadius: theme.borderRadius.full };
|
|
130
57
|
}
|
|
@@ -138,16 +65,16 @@ var useTextInputVariantStyles = ({
|
|
|
138
65
|
isInvalid,
|
|
139
66
|
isDisabled
|
|
140
67
|
}) => {
|
|
141
|
-
const theme = useXUITheme();
|
|
142
|
-
const safeThemeColor = (0,
|
|
68
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
69
|
+
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
143
70
|
const colorScheme = theme.colors[safeThemeColor];
|
|
144
|
-
return (0,
|
|
71
|
+
return _react.useMemo.call(void 0, () => {
|
|
145
72
|
const focusColor = isInvalid ? theme.colors.danger.main : colorScheme.main;
|
|
146
|
-
const neutralBorder = (0,
|
|
147
|
-
const textColor = isDisabled ? (0,
|
|
148
|
-
const placeholderColor = (0,
|
|
149
|
-
const labelColor = isInvalid ? theme.colors.danger.main : isFocused ? colorScheme.main : (0,
|
|
150
|
-
const helperColor = isInvalid ? theme.colors.danger.main : (0,
|
|
73
|
+
const neutralBorder = _core.withOpacity.call(void 0, theme.colors.foreground, 0.1);
|
|
74
|
+
const textColor = isDisabled ? _core.withOpacity.call(void 0, theme.colors.foreground, 0.55) : theme.colors.foreground;
|
|
75
|
+
const placeholderColor = _core.withOpacity.call(void 0, theme.colors.foreground, 0.45);
|
|
76
|
+
const labelColor = isInvalid ? theme.colors.danger.main : isFocused ? colorScheme.main : _core.withOpacity.call(void 0, theme.colors.foreground, 0.8);
|
|
77
|
+
const helperColor = isInvalid ? theme.colors.danger.main : _core.withOpacity.call(void 0, theme.colors.foreground, 0.72);
|
|
151
78
|
if (variant === "underlined") {
|
|
152
79
|
return {
|
|
153
80
|
container: {
|
|
@@ -181,7 +108,7 @@ var useTextInputVariantStyles = ({
|
|
|
181
108
|
if (variant === "faded") {
|
|
182
109
|
return {
|
|
183
110
|
container: {
|
|
184
|
-
backgroundColor: (0,
|
|
111
|
+
backgroundColor: _core.withOpacity.call(void 0, colorScheme.background, 0.68),
|
|
185
112
|
borderColor: isFocused || isInvalid ? focusColor : "transparent",
|
|
186
113
|
borderWidth: isFocused || isInvalid ? theme.borderWidth.md : 0
|
|
187
114
|
},
|
|
@@ -196,11 +123,11 @@ var useTextInputVariantStyles = ({
|
|
|
196
123
|
return {
|
|
197
124
|
container: {
|
|
198
125
|
backgroundColor: colorScheme.background,
|
|
199
|
-
borderColor: isFocused || isInvalid ? (0,
|
|
126
|
+
borderColor: isFocused || isInvalid ? _core.withPaletteNumber.call(void 0, focusColor, 500) : "transparent",
|
|
200
127
|
borderWidth: isFocused || isInvalid ? theme.borderWidth.md : 0
|
|
201
128
|
},
|
|
202
129
|
unfocusedBorderColor: "transparent",
|
|
203
|
-
focusedBorderColor: (0,
|
|
130
|
+
focusedBorderColor: _core.withPaletteNumber.call(void 0, focusColor, 500),
|
|
204
131
|
textColor,
|
|
205
132
|
placeholderColor,
|
|
206
133
|
labelColor,
|
|
@@ -210,8 +137,8 @@ var useTextInputVariantStyles = ({
|
|
|
210
137
|
};
|
|
211
138
|
|
|
212
139
|
// src/components/input/input.style.ts
|
|
213
|
-
|
|
214
|
-
var styles =
|
|
140
|
+
|
|
141
|
+
var styles = _reactnative.StyleSheet.create({
|
|
215
142
|
container: {
|
|
216
143
|
width: "100%",
|
|
217
144
|
gap: 6
|
|
@@ -257,7 +184,7 @@ var styles = import_react_native4.StyleSheet.create({
|
|
|
257
184
|
});
|
|
258
185
|
|
|
259
186
|
// src/components/input/input.tsx
|
|
260
|
-
var TextInput = (0,
|
|
187
|
+
var TextInput = _react.forwardRef.call(void 0,
|
|
261
188
|
({
|
|
262
189
|
value,
|
|
263
190
|
defaultValue,
|
|
@@ -285,12 +212,12 @@ var TextInput = (0, import_react7.forwardRef)(
|
|
|
285
212
|
...nativeProps
|
|
286
213
|
}, forwardedRef) => {
|
|
287
214
|
const isControlled = typeof value === "string";
|
|
288
|
-
const [internalValue, setInternalValue] = (0,
|
|
289
|
-
const [isFocused, setIsFocused] = (0,
|
|
290
|
-
const internalRef = (0,
|
|
291
|
-
const borderAnimation = (0,
|
|
292
|
-
const inputValue = isControlled ? value
|
|
293
|
-
const secureTextEntry = nativeProps.secureTextEntry
|
|
215
|
+
const [internalValue, setInternalValue] = _react.useState.call(void 0, _nullishCoalesce(defaultValue, () => ( "")));
|
|
216
|
+
const [isFocused, setIsFocused] = _react.useState.call(void 0, false);
|
|
217
|
+
const internalRef = _react.useRef.call(void 0, null);
|
|
218
|
+
const borderAnimation = _react.useRef.call(void 0, new _reactnative.Animated.Value(0)).current;
|
|
219
|
+
const inputValue = isControlled ? _nullishCoalesce(value, () => ( "")) : internalValue;
|
|
220
|
+
const secureTextEntry = _nullishCoalesce(nativeProps.secureTextEntry, () => ( isSecured));
|
|
294
221
|
const sizeStyles = useTextInputSizeStyles(size);
|
|
295
222
|
const radiusStyles = useTextInputRadiusStyles(radius);
|
|
296
223
|
const variantStyles = useTextInputVariantStyles({
|
|
@@ -300,16 +227,16 @@ var TextInput = (0, import_react7.forwardRef)(
|
|
|
300
227
|
isInvalid,
|
|
301
228
|
isDisabled
|
|
302
229
|
});
|
|
303
|
-
(0,
|
|
304
|
-
|
|
230
|
+
_react.useEffect.call(void 0, () => {
|
|
231
|
+
_reactnative.Animated.timing(borderAnimation, {
|
|
305
232
|
toValue: isFocused || isInvalid ? 1 : 0,
|
|
306
233
|
duration: 200,
|
|
307
234
|
useNativeDriver: false
|
|
308
235
|
}).start();
|
|
309
236
|
}, [borderAnimation, isFocused, isInvalid]);
|
|
310
237
|
const showClearButton = isClearable && !!inputValue && !isDisabled && !isReadOnly && !secureTextEntry && nativeProps.editable !== false;
|
|
311
|
-
const editable = nativeProps.editable
|
|
312
|
-
const helperText = (0,
|
|
238
|
+
const editable = _nullishCoalesce(nativeProps.editable, () => ( (!isDisabled && !isReadOnly)));
|
|
239
|
+
const helperText = _react.useMemo.call(void 0, () => {
|
|
313
240
|
if (isInvalid && errorMessage) {
|
|
314
241
|
return errorMessage;
|
|
315
242
|
}
|
|
@@ -319,37 +246,37 @@ var TextInput = (0, import_react7.forwardRef)(
|
|
|
319
246
|
if (!isControlled) {
|
|
320
247
|
setInternalValue(text);
|
|
321
248
|
}
|
|
322
|
-
onValueChange
|
|
323
|
-
onChangeText
|
|
249
|
+
_optionalChain([onValueChange, 'optionalCall', _2 => _2(text)]);
|
|
250
|
+
_optionalChain([onChangeText, 'optionalCall', _3 => _3(text)]);
|
|
324
251
|
};
|
|
325
252
|
const handleClear = () => {
|
|
326
253
|
if (!isControlled) {
|
|
327
254
|
setInternalValue("");
|
|
328
255
|
}
|
|
329
|
-
onValueChange
|
|
330
|
-
onChangeText
|
|
256
|
+
_optionalChain([onValueChange, 'optionalCall', _4 => _4("")]);
|
|
257
|
+
_optionalChain([onChangeText, 'optionalCall', _5 => _5("")]);
|
|
331
258
|
};
|
|
332
259
|
const handleWrapperPress = () => {
|
|
333
260
|
if (isDisabled || isReadOnly || nativeProps.editable === false) return;
|
|
334
261
|
const inputRef = forwardedRef || internalRef;
|
|
335
262
|
if (typeof forwardedRef === "function") {
|
|
336
|
-
internalRef.current
|
|
337
|
-
} else if (inputRef
|
|
263
|
+
_optionalChain([internalRef, 'access', _6 => _6.current, 'optionalAccess', _7 => _7.focus, 'call', _8 => _8()]);
|
|
264
|
+
} else if (_optionalChain([inputRef, 'optionalAccess', _9 => _9.current])) {
|
|
338
265
|
inputRef.current.focus();
|
|
339
266
|
}
|
|
340
267
|
};
|
|
341
|
-
return /* @__PURE__ */
|
|
342
|
-
|
|
268
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
269
|
+
_reactnative.View,
|
|
343
270
|
{
|
|
344
271
|
style: [
|
|
345
272
|
styles.container,
|
|
346
273
|
!fullWidth && styles.noFullWidth,
|
|
347
274
|
isDisabled && styles.disabled,
|
|
348
|
-
customAppearance
|
|
275
|
+
_optionalChain([customAppearance, 'optionalAccess', _10 => _10.container])
|
|
349
276
|
]
|
|
350
277
|
},
|
|
351
|
-
/* @__PURE__ */
|
|
352
|
-
|
|
278
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.inputContainer, _optionalChain([customAppearance, 'optionalAccess', _11 => _11.inputContainer])] }, label && labelPlacement === "outside" && /* @__PURE__ */ _react2.default.createElement(
|
|
279
|
+
_reactnative.Text,
|
|
353
280
|
{
|
|
354
281
|
style: [
|
|
355
282
|
styles.label,
|
|
@@ -357,18 +284,18 @@ var TextInput = (0, import_react7.forwardRef)(
|
|
|
357
284
|
color: variantStyles.labelColor,
|
|
358
285
|
fontSize: sizeStyles.labelSize
|
|
359
286
|
},
|
|
360
|
-
customAppearance
|
|
287
|
+
_optionalChain([customAppearance, 'optionalAccess', _12 => _12.label])
|
|
361
288
|
]
|
|
362
289
|
},
|
|
363
290
|
label
|
|
364
|
-
), /* @__PURE__ */
|
|
365
|
-
|
|
291
|
+
), /* @__PURE__ */ _react2.default.createElement(
|
|
292
|
+
_reactnative.Pressable,
|
|
366
293
|
{
|
|
367
294
|
onPress: handleWrapperPress,
|
|
368
295
|
disabled: isDisabled || isReadOnly
|
|
369
296
|
},
|
|
370
|
-
/* @__PURE__ */
|
|
371
|
-
|
|
297
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
298
|
+
_reactnative.Animated.View,
|
|
372
299
|
{
|
|
373
300
|
style: [
|
|
374
301
|
styles.inputWrapper,
|
|
@@ -402,20 +329,20 @@ var TextInput = (0, import_react7.forwardRef)(
|
|
|
402
329
|
}
|
|
403
330
|
},
|
|
404
331
|
variant === "underlined" && styles.underlinedWrapper,
|
|
405
|
-
customAppearance
|
|
332
|
+
_optionalChain([customAppearance, 'optionalAccess', _13 => _13.inputWrapper])
|
|
406
333
|
]
|
|
407
334
|
},
|
|
408
|
-
startContent && /* @__PURE__ */
|
|
409
|
-
/* @__PURE__ */
|
|
410
|
-
|
|
335
|
+
startContent && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.slot }, startContent),
|
|
336
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
337
|
+
_reactnative.View,
|
|
411
338
|
{
|
|
412
339
|
style: {
|
|
413
340
|
flex: 1,
|
|
414
341
|
gap: labelPlacement === "inside" && label ? 2 : 0
|
|
415
342
|
}
|
|
416
343
|
},
|
|
417
|
-
label && labelPlacement === "inside" && /* @__PURE__ */
|
|
418
|
-
|
|
344
|
+
label && labelPlacement === "inside" && /* @__PURE__ */ _react2.default.createElement(
|
|
345
|
+
_reactnative.Text,
|
|
419
346
|
{
|
|
420
347
|
style: [
|
|
421
348
|
styles.label,
|
|
@@ -424,24 +351,24 @@ var TextInput = (0, import_react7.forwardRef)(
|
|
|
424
351
|
fontSize: sizeStyles.helperSize,
|
|
425
352
|
paddingBottom: 2
|
|
426
353
|
},
|
|
427
|
-
customAppearance
|
|
354
|
+
_optionalChain([customAppearance, 'optionalAccess', _14 => _14.label])
|
|
428
355
|
]
|
|
429
356
|
},
|
|
430
357
|
label
|
|
431
358
|
),
|
|
432
|
-
/* @__PURE__ */
|
|
433
|
-
|
|
359
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
360
|
+
_reactnative.TextInput,
|
|
434
361
|
{
|
|
435
362
|
ref: typeof forwardedRef === "function" ? internalRef : forwardedRef || internalRef,
|
|
436
363
|
value: inputValue,
|
|
437
364
|
onChangeText: handleChangeText,
|
|
438
365
|
onFocus: (event) => {
|
|
439
366
|
setIsFocused(true);
|
|
440
|
-
onFocus
|
|
367
|
+
_optionalChain([onFocus, 'optionalCall', _15 => _15(event)]);
|
|
441
368
|
},
|
|
442
369
|
onBlur: (event) => {
|
|
443
370
|
setIsFocused(false);
|
|
444
|
-
onBlur
|
|
371
|
+
_optionalChain([onBlur, 'optionalCall', _16 => _16(event)]);
|
|
445
372
|
},
|
|
446
373
|
editable,
|
|
447
374
|
secureTextEntry,
|
|
@@ -452,26 +379,26 @@ var TextInput = (0, import_react7.forwardRef)(
|
|
|
452
379
|
color: variantStyles.textColor,
|
|
453
380
|
fontSize: sizeStyles.fontSize
|
|
454
381
|
},
|
|
455
|
-
customAppearance
|
|
382
|
+
_optionalChain([customAppearance, 'optionalAccess', _17 => _17.input])
|
|
456
383
|
],
|
|
457
384
|
...nativeProps
|
|
458
385
|
}
|
|
459
386
|
)
|
|
460
387
|
),
|
|
461
|
-
showClearButton ? /* @__PURE__ */
|
|
462
|
-
|
|
388
|
+
showClearButton ? /* @__PURE__ */ _react2.default.createElement(
|
|
389
|
+
_reactnative.Pressable,
|
|
463
390
|
{
|
|
464
391
|
onPress: handleClear,
|
|
465
392
|
accessibilityLabel: "Clear input",
|
|
466
393
|
accessibilityRole: "button",
|
|
467
394
|
style: styles.clearButton
|
|
468
395
|
},
|
|
469
|
-
/* @__PURE__ */
|
|
470
|
-
) : endContent && /* @__PURE__ */
|
|
396
|
+
/* @__PURE__ */ _react2.default.createElement(_icons.CloseIcon, { size: 16, color: variantStyles.placeholderColor })
|
|
397
|
+
) : endContent && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.slot }, endContent)
|
|
471
398
|
)
|
|
472
399
|
)),
|
|
473
|
-
helperText && /* @__PURE__ */
|
|
474
|
-
|
|
400
|
+
helperText && /* @__PURE__ */ _react2.default.createElement(
|
|
401
|
+
_reactnative.Text,
|
|
475
402
|
{
|
|
476
403
|
style: [
|
|
477
404
|
styles.helperText,
|
|
@@ -479,7 +406,7 @@ var TextInput = (0, import_react7.forwardRef)(
|
|
|
479
406
|
color: variantStyles.helperColor,
|
|
480
407
|
fontSize: sizeStyles.helperSize
|
|
481
408
|
},
|
|
482
|
-
customAppearance
|
|
409
|
+
_optionalChain([customAppearance, 'optionalAccess', _18 => _18.helperText])
|
|
483
410
|
]
|
|
484
411
|
},
|
|
485
412
|
helperText
|
|
@@ -490,11 +417,11 @@ var TextInput = (0, import_react7.forwardRef)(
|
|
|
490
417
|
TextInput.displayName = "TextInput";
|
|
491
418
|
|
|
492
419
|
// src/components/input/textarea.tsx
|
|
493
|
-
|
|
420
|
+
|
|
494
421
|
|
|
495
422
|
// src/components/input/textarea.style.ts
|
|
496
|
-
|
|
497
|
-
var textAreaStyles =
|
|
423
|
+
|
|
424
|
+
var textAreaStyles = _reactnative.StyleSheet.create({
|
|
498
425
|
inputWrapper: {
|
|
499
426
|
alignItems: "flex-start"
|
|
500
427
|
},
|
|
@@ -520,15 +447,15 @@ var TextArea = ({
|
|
|
520
447
|
const normalizedMaxRows = typeof maxRows === "number" ? Math.max(maxRows, minRows) : void 0;
|
|
521
448
|
const minHeight = minRows * lineHeight + verticalPadding;
|
|
522
449
|
const maxHeight = typeof normalizedMaxRows === "number" ? normalizedMaxRows * lineHeight + verticalPadding : void 0;
|
|
523
|
-
return /* @__PURE__ */
|
|
450
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
524
451
|
TextInput,
|
|
525
452
|
{
|
|
526
453
|
...props,
|
|
527
454
|
size,
|
|
528
455
|
multiline: true,
|
|
529
|
-
numberOfLines: numberOfLines
|
|
530
|
-
textAlignVertical: textAlignVertical
|
|
531
|
-
scrollEnabled: scrollEnabled
|
|
456
|
+
numberOfLines: _nullishCoalesce(numberOfLines, () => ( minRows)),
|
|
457
|
+
textAlignVertical: _nullishCoalesce(textAlignVertical, () => ( "top")),
|
|
458
|
+
scrollEnabled: _nullishCoalesce(scrollEnabled, () => ( !!maxHeight)),
|
|
532
459
|
customAppearance: {
|
|
533
460
|
...customAppearance,
|
|
534
461
|
inputWrapper: [
|
|
@@ -537,14 +464,14 @@ var TextArea = ({
|
|
|
537
464
|
minHeight,
|
|
538
465
|
...maxHeight ? { maxHeight } : {}
|
|
539
466
|
},
|
|
540
|
-
customAppearance
|
|
467
|
+
_optionalChain([customAppearance, 'optionalAccess', _19 => _19.inputWrapper])
|
|
541
468
|
],
|
|
542
469
|
input: [
|
|
543
470
|
textAreaStyles.input,
|
|
544
471
|
{
|
|
545
472
|
lineHeight
|
|
546
473
|
},
|
|
547
|
-
customAppearance
|
|
474
|
+
_optionalChain([customAppearance, 'optionalAccess', _20 => _20.input])
|
|
548
475
|
]
|
|
549
476
|
}
|
|
550
477
|
}
|
|
@@ -552,7 +479,7 @@ var TextArea = ({
|
|
|
552
479
|
};
|
|
553
480
|
|
|
554
481
|
// src/components/input/date-time-input.tsx
|
|
555
|
-
|
|
482
|
+
|
|
556
483
|
|
|
557
484
|
// src/components/input/date-time-input.hook.ts
|
|
558
485
|
var YMD_LOCALES = ["ja", "zh", "ko", "hu", "lt", "mn"];
|
|
@@ -569,7 +496,7 @@ var getDateOrder = (locale) => {
|
|
|
569
496
|
if (order[0] === "year") return "YMD";
|
|
570
497
|
if (order[0] === "month") return "MDY";
|
|
571
498
|
return "DMY";
|
|
572
|
-
} catch {
|
|
499
|
+
} catch (e2) {
|
|
573
500
|
const lang = locale.split("-")[0];
|
|
574
501
|
if (YMD_LOCALES.includes(locale) || YMD_LOCALES.includes(lang)) return "YMD";
|
|
575
502
|
if (MDY_LOCALES.includes(locale)) return "MDY";
|
|
@@ -661,7 +588,7 @@ var getDateTimeMaxLength = (separator, granularity, hourCycle) => {
|
|
|
661
588
|
};
|
|
662
589
|
|
|
663
590
|
// src/components/input/date-time-input.tsx
|
|
664
|
-
var DateInput = (0,
|
|
591
|
+
var DateInput = _react.forwardRef.call(void 0,
|
|
665
592
|
({
|
|
666
593
|
separator = "-",
|
|
667
594
|
dateOrder,
|
|
@@ -672,34 +599,34 @@ var DateInput = (0, import_react9.forwardRef)(
|
|
|
672
599
|
onValueChange,
|
|
673
600
|
...props
|
|
674
601
|
}, ref) => {
|
|
675
|
-
const resolvedOrder = (0,
|
|
676
|
-
() => dateOrder
|
|
602
|
+
const resolvedOrder = _react.useMemo.call(void 0,
|
|
603
|
+
() => _nullishCoalesce(dateOrder, () => ( getDateOrder(locale))),
|
|
677
604
|
[dateOrder, locale]
|
|
678
605
|
);
|
|
679
|
-
const handleChangeText = (0,
|
|
606
|
+
const handleChangeText = _react.useCallback.call(void 0,
|
|
680
607
|
(text) => {
|
|
681
608
|
const formatted = formatDateInput(text, resolvedOrder, separator);
|
|
682
|
-
onChangeText
|
|
683
|
-
onValueChange
|
|
609
|
+
_optionalChain([onChangeText, 'optionalCall', _21 => _21(formatted)]);
|
|
610
|
+
_optionalChain([onValueChange, 'optionalCall', _22 => _22(formatted)]);
|
|
684
611
|
},
|
|
685
612
|
[resolvedOrder, separator, onChangeText, onValueChange]
|
|
686
613
|
);
|
|
687
|
-
return /* @__PURE__ */
|
|
614
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
688
615
|
TextInput,
|
|
689
616
|
{
|
|
690
617
|
ref,
|
|
691
|
-
placeholder: placeholder
|
|
618
|
+
placeholder: _nullishCoalesce(placeholder, () => ( getDatePlaceholder(resolvedOrder, separator))),
|
|
692
619
|
keyboardType: "number-pad",
|
|
693
620
|
autoCapitalize: "none",
|
|
694
621
|
autoCorrect: false,
|
|
695
|
-
maxLength: maxLength
|
|
622
|
+
maxLength: _nullishCoalesce(maxLength, () => ( getDateMaxLength(separator))),
|
|
696
623
|
onChangeText: handleChangeText,
|
|
697
624
|
...props
|
|
698
625
|
}
|
|
699
626
|
);
|
|
700
627
|
}
|
|
701
628
|
);
|
|
702
|
-
var TimeInput = (0,
|
|
629
|
+
var TimeInput = _react.forwardRef.call(void 0,
|
|
703
630
|
({
|
|
704
631
|
granularity = "minute",
|
|
705
632
|
hourCycle = 24,
|
|
@@ -709,30 +636,30 @@ var TimeInput = (0, import_react9.forwardRef)(
|
|
|
709
636
|
onValueChange,
|
|
710
637
|
...props
|
|
711
638
|
}, ref) => {
|
|
712
|
-
const handleChangeText = (0,
|
|
639
|
+
const handleChangeText = _react.useCallback.call(void 0,
|
|
713
640
|
(text) => {
|
|
714
641
|
const formatted = formatTimeInput(text, granularity, hourCycle);
|
|
715
|
-
onChangeText
|
|
716
|
-
onValueChange
|
|
642
|
+
_optionalChain([onChangeText, 'optionalCall', _23 => _23(formatted)]);
|
|
643
|
+
_optionalChain([onValueChange, 'optionalCall', _24 => _24(formatted)]);
|
|
717
644
|
},
|
|
718
645
|
[granularity, hourCycle, onChangeText, onValueChange]
|
|
719
646
|
);
|
|
720
|
-
return /* @__PURE__ */
|
|
647
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
721
648
|
TextInput,
|
|
722
649
|
{
|
|
723
650
|
ref,
|
|
724
|
-
placeholder: placeholder
|
|
651
|
+
placeholder: _nullishCoalesce(placeholder, () => ( getTimePlaceholder(granularity, hourCycle))),
|
|
725
652
|
keyboardType: "number-pad",
|
|
726
653
|
autoCapitalize: "none",
|
|
727
654
|
autoCorrect: false,
|
|
728
|
-
maxLength: maxLength
|
|
655
|
+
maxLength: _nullishCoalesce(maxLength, () => ( getTimeMaxLength(granularity, hourCycle))),
|
|
729
656
|
onChangeText: handleChangeText,
|
|
730
657
|
...props
|
|
731
658
|
}
|
|
732
659
|
);
|
|
733
660
|
}
|
|
734
661
|
);
|
|
735
|
-
var DateTimeInput = (0,
|
|
662
|
+
var DateTimeInput = _react.forwardRef.call(void 0,
|
|
736
663
|
({
|
|
737
664
|
separator = "-",
|
|
738
665
|
dateOrder,
|
|
@@ -745,11 +672,11 @@ var DateTimeInput = (0, import_react9.forwardRef)(
|
|
|
745
672
|
onValueChange,
|
|
746
673
|
...props
|
|
747
674
|
}, ref) => {
|
|
748
|
-
const resolvedOrder = (0,
|
|
749
|
-
() => dateOrder
|
|
675
|
+
const resolvedOrder = _react.useMemo.call(void 0,
|
|
676
|
+
() => _nullishCoalesce(dateOrder, () => ( getDateOrder(locale))),
|
|
750
677
|
[dateOrder, locale]
|
|
751
678
|
);
|
|
752
|
-
const handleChangeText = (0,
|
|
679
|
+
const handleChangeText = _react.useCallback.call(void 0,
|
|
753
680
|
(text) => {
|
|
754
681
|
const formatted = formatDateTimeInput(
|
|
755
682
|
text,
|
|
@@ -758,20 +685,20 @@ var DateTimeInput = (0, import_react9.forwardRef)(
|
|
|
758
685
|
granularity,
|
|
759
686
|
hourCycle
|
|
760
687
|
);
|
|
761
|
-
onChangeText
|
|
762
|
-
onValueChange
|
|
688
|
+
_optionalChain([onChangeText, 'optionalCall', _25 => _25(formatted)]);
|
|
689
|
+
_optionalChain([onValueChange, 'optionalCall', _26 => _26(formatted)]);
|
|
763
690
|
},
|
|
764
691
|
[resolvedOrder, separator, granularity, hourCycle, onChangeText, onValueChange]
|
|
765
692
|
);
|
|
766
|
-
return /* @__PURE__ */
|
|
693
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
767
694
|
TextInput,
|
|
768
695
|
{
|
|
769
696
|
ref,
|
|
770
|
-
placeholder: placeholder
|
|
697
|
+
placeholder: _nullishCoalesce(placeholder, () => ( getDateTimePlaceholder(resolvedOrder, separator, granularity, hourCycle))),
|
|
771
698
|
keyboardType: "number-pad",
|
|
772
699
|
autoCapitalize: "none",
|
|
773
700
|
autoCorrect: false,
|
|
774
|
-
maxLength: maxLength
|
|
701
|
+
maxLength: _nullishCoalesce(maxLength, () => ( getDateTimeMaxLength(separator, granularity, hourCycle))),
|
|
775
702
|
onChangeText: handleChangeText,
|
|
776
703
|
...props
|
|
777
704
|
}
|
|
@@ -783,18 +710,24 @@ TimeInput.displayName = "TimeInput";
|
|
|
783
710
|
DateTimeInput.displayName = "DateTimeInput";
|
|
784
711
|
|
|
785
712
|
// src/components/input/otp-input.tsx
|
|
786
|
-
|
|
787
|
-
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
|
|
788
721
|
|
|
789
722
|
// src/components/input/otp-input.hook.ts
|
|
790
|
-
|
|
723
|
+
|
|
791
724
|
var segmentSizeMap = {
|
|
792
725
|
sm: { width: 40, height: 40, fontSize: 16 },
|
|
793
726
|
md: { width: 48, height: 48, fontSize: 20 },
|
|
794
727
|
lg: { width: 56, height: 56, fontSize: 24 }
|
|
795
728
|
};
|
|
796
729
|
var useOTPSegmentSizeStyles = (size) => {
|
|
797
|
-
return (0,
|
|
730
|
+
return _react.useMemo.call(void 0, () => segmentSizeMap[size], [size]);
|
|
798
731
|
};
|
|
799
732
|
var useOTPInputState = ({
|
|
800
733
|
length,
|
|
@@ -805,27 +738,27 @@ var useOTPInputState = ({
|
|
|
805
738
|
allowedKeys
|
|
806
739
|
}) => {
|
|
807
740
|
const isControlled = typeof value === "string";
|
|
808
|
-
const [internalValue, setInternalValue] = (0,
|
|
809
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
810
|
-
const refs = (0,
|
|
741
|
+
const [internalValue, setInternalValue] = _react.useState.call(void 0, _nullishCoalesce(defaultValue, () => ( "")));
|
|
742
|
+
const [activeIndex, setActiveIndex] = _react.useState.call(void 0, -1);
|
|
743
|
+
const refs = _react.useRef.call(void 0, []);
|
|
811
744
|
const currentValue = isControlled ? value : internalValue;
|
|
812
|
-
const segments = (0,
|
|
745
|
+
const segments = _react.useMemo.call(void 0, () => {
|
|
813
746
|
const chars = currentValue.split("");
|
|
814
|
-
return Array.from({ length }, (_, i) => chars[i]
|
|
747
|
+
return Array.from({ length }, (_, i) => _nullishCoalesce(chars[i], () => ( "")));
|
|
815
748
|
}, [currentValue, length]);
|
|
816
|
-
const updateValue = (0,
|
|
749
|
+
const updateValue = _react.useCallback.call(void 0,
|
|
817
750
|
(newValue) => {
|
|
818
751
|
if (!isControlled) {
|
|
819
752
|
setInternalValue(newValue);
|
|
820
753
|
}
|
|
821
|
-
onValueChange
|
|
754
|
+
_optionalChain([onValueChange, 'optionalCall', _27 => _27(newValue)]);
|
|
822
755
|
if (newValue.length === length) {
|
|
823
|
-
onComplete
|
|
756
|
+
_optionalChain([onComplete, 'optionalCall', _28 => _28(newValue)]);
|
|
824
757
|
}
|
|
825
758
|
},
|
|
826
759
|
[isControlled, length, onValueChange, onComplete]
|
|
827
760
|
);
|
|
828
|
-
const handleSegmentChange = (0,
|
|
761
|
+
const handleSegmentChange = _react.useCallback.call(void 0,
|
|
829
762
|
(index, text) => {
|
|
830
763
|
if (!text) return;
|
|
831
764
|
const char = text.slice(-1);
|
|
@@ -836,12 +769,12 @@ var useOTPInputState = ({
|
|
|
836
769
|
const newValue = chars.join("").replace(/\s+$/, "");
|
|
837
770
|
updateValue(newValue);
|
|
838
771
|
if (index < length - 1) {
|
|
839
|
-
refs.current[index + 1]
|
|
772
|
+
_optionalChain([refs, 'access', _29 => _29.current, 'access', _30 => _30[index + 1], 'optionalAccess', _31 => _31.focus, 'call', _32 => _32()]);
|
|
840
773
|
}
|
|
841
774
|
},
|
|
842
775
|
[allowedKeys, currentValue, length, updateValue]
|
|
843
776
|
);
|
|
844
|
-
const handleSegmentKeyPress = (0,
|
|
777
|
+
const handleSegmentKeyPress = _react.useCallback.call(void 0,
|
|
845
778
|
(index, key) => {
|
|
846
779
|
if (key !== "Backspace") return;
|
|
847
780
|
const chars = currentValue.split("");
|
|
@@ -854,15 +787,15 @@ var useOTPInputState = ({
|
|
|
854
787
|
if (index > 0) {
|
|
855
788
|
chars[index - 1] = "";
|
|
856
789
|
updateValue(chars.join("").replace(/\s+$/, ""));
|
|
857
|
-
refs.current[index - 1]
|
|
790
|
+
_optionalChain([refs, 'access', _33 => _33.current, 'access', _34 => _34[index - 1], 'optionalAccess', _35 => _35.focus, 'call', _36 => _36()]);
|
|
858
791
|
}
|
|
859
792
|
},
|
|
860
793
|
[currentValue, length, updateValue]
|
|
861
794
|
);
|
|
862
|
-
const handleSegmentFocus = (0,
|
|
795
|
+
const handleSegmentFocus = _react.useCallback.call(void 0, (index) => {
|
|
863
796
|
setActiveIndex(index);
|
|
864
797
|
}, []);
|
|
865
|
-
const handleSegmentBlur = (0,
|
|
798
|
+
const handleSegmentBlur = _react.useCallback.call(void 0, () => {
|
|
866
799
|
setActiveIndex(-1);
|
|
867
800
|
}, []);
|
|
868
801
|
return {
|
|
@@ -877,8 +810,8 @@ var useOTPInputState = ({
|
|
|
877
810
|
};
|
|
878
811
|
|
|
879
812
|
// src/components/input/otp-input.style.ts
|
|
880
|
-
|
|
881
|
-
var otpStyles =
|
|
813
|
+
|
|
814
|
+
var otpStyles = _reactnative.StyleSheet.create({
|
|
882
815
|
container: {
|
|
883
816
|
gap: 6
|
|
884
817
|
},
|
|
@@ -938,16 +871,16 @@ var OTPSegment = ({
|
|
|
938
871
|
onBlur,
|
|
939
872
|
onPress
|
|
940
873
|
}) => {
|
|
941
|
-
const borderAnimation = (0,
|
|
942
|
-
(0,
|
|
943
|
-
|
|
874
|
+
const borderAnimation = _react.useRef.call(void 0, new _reactnative.Animated.Value(0)).current;
|
|
875
|
+
_react.useEffect.call(void 0, () => {
|
|
876
|
+
_reactnative.Animated.timing(borderAnimation, {
|
|
944
877
|
toValue: isActive ? 1 : 0,
|
|
945
878
|
duration: 200,
|
|
946
879
|
useNativeDriver: false
|
|
947
880
|
}).start();
|
|
948
881
|
}, [borderAnimation, isActive]);
|
|
949
|
-
return /* @__PURE__ */
|
|
950
|
-
|
|
882
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
883
|
+
_reactnative.Pressable,
|
|
951
884
|
{
|
|
952
885
|
onPress: () => {
|
|
953
886
|
if (!isDisabled) {
|
|
@@ -956,8 +889,8 @@ var OTPSegment = ({
|
|
|
956
889
|
},
|
|
957
890
|
disabled: isDisabled
|
|
958
891
|
},
|
|
959
|
-
/* @__PURE__ */
|
|
960
|
-
|
|
892
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
893
|
+
_reactnative.Animated.View,
|
|
961
894
|
{
|
|
962
895
|
style: [
|
|
963
896
|
otpStyles.segment,
|
|
@@ -965,7 +898,7 @@ var OTPSegment = ({
|
|
|
965
898
|
width: sizeStyles.width,
|
|
966
899
|
height: sizeStyles.height,
|
|
967
900
|
backgroundColor: variantStyles.container.backgroundColor,
|
|
968
|
-
borderWidth: variantStyles.container.borderWidth
|
|
901
|
+
borderWidth: _nullishCoalesce(variantStyles.container.borderWidth, () => ( 0)),
|
|
969
902
|
borderRadius: radiusStyles.borderRadius,
|
|
970
903
|
borderColor: borderAnimation.interpolate({
|
|
971
904
|
inputRange: [0, 1],
|
|
@@ -975,19 +908,19 @@ var OTPSegment = ({
|
|
|
975
908
|
]
|
|
976
909
|
})
|
|
977
910
|
},
|
|
978
|
-
customSegment
|
|
911
|
+
_optionalChain([customSegment, 'optionalAccess', _37 => _37.segment])
|
|
979
912
|
]
|
|
980
913
|
},
|
|
981
|
-
char && isSecured ? /* @__PURE__ */
|
|
982
|
-
|
|
914
|
+
char && isSecured ? /* @__PURE__ */ _react2.default.createElement(
|
|
915
|
+
_reactnative.View,
|
|
983
916
|
{
|
|
984
917
|
style: [
|
|
985
918
|
otpStyles.securedDot,
|
|
986
919
|
{ backgroundColor: variantStyles.textColor }
|
|
987
920
|
]
|
|
988
921
|
}
|
|
989
|
-
) : /* @__PURE__ */
|
|
990
|
-
|
|
922
|
+
) : /* @__PURE__ */ _react2.default.createElement(
|
|
923
|
+
_reactnative.Text,
|
|
991
924
|
{
|
|
992
925
|
style: [
|
|
993
926
|
otpStyles.segmentText,
|
|
@@ -995,13 +928,13 @@ var OTPSegment = ({
|
|
|
995
928
|
color: variantStyles.textColor,
|
|
996
929
|
fontSize: sizeStyles.fontSize
|
|
997
930
|
},
|
|
998
|
-
customSegmentText
|
|
931
|
+
_optionalChain([customSegmentText, 'optionalAccess', _38 => _38.segmentText])
|
|
999
932
|
]
|
|
1000
933
|
},
|
|
1001
934
|
char
|
|
1002
935
|
),
|
|
1003
|
-
/* @__PURE__ */
|
|
1004
|
-
|
|
936
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
937
|
+
_reactnative.TextInput,
|
|
1005
938
|
{
|
|
1006
939
|
ref: inputRef,
|
|
1007
940
|
style: otpStyles.hiddenInput,
|
|
@@ -1073,30 +1006,30 @@ var OTPInput = ({
|
|
|
1073
1006
|
isInvalid,
|
|
1074
1007
|
isDisabled
|
|
1075
1008
|
});
|
|
1076
|
-
const focusSegment = (0,
|
|
1009
|
+
const focusSegment = _react.useCallback.call(void 0,
|
|
1077
1010
|
(index) => {
|
|
1078
1011
|
if (isDisabled) return;
|
|
1079
|
-
refs.current[index]
|
|
1012
|
+
_optionalChain([refs, 'access', _39 => _39.current, 'access', _40 => _40[index], 'optionalAccess', _41 => _41.focus, 'call', _42 => _42()]);
|
|
1080
1013
|
},
|
|
1081
1014
|
[isDisabled, refs]
|
|
1082
1015
|
);
|
|
1083
|
-
const handleContainerPress = (0,
|
|
1016
|
+
const handleContainerPress = _react.useCallback.call(void 0, () => {
|
|
1084
1017
|
const firstEmptyIndex = segments.findIndex((segment) => !segment);
|
|
1085
1018
|
const targetIndex = firstEmptyIndex === -1 ? length - 1 : firstEmptyIndex;
|
|
1086
1019
|
focusSegment(targetIndex);
|
|
1087
1020
|
}, [focusSegment, length, segments]);
|
|
1088
|
-
return /* @__PURE__ */
|
|
1089
|
-
|
|
1021
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
1022
|
+
_reactnative.View,
|
|
1090
1023
|
{
|
|
1091
1024
|
style: [
|
|
1092
1025
|
otpStyles.container,
|
|
1093
1026
|
fullWidth && otpStyles.fullWidth,
|
|
1094
1027
|
isDisabled && otpStyles.disabled,
|
|
1095
|
-
customAppearance
|
|
1028
|
+
_optionalChain([customAppearance, 'optionalAccess', _43 => _43.container])
|
|
1096
1029
|
]
|
|
1097
1030
|
},
|
|
1098
|
-
label && /* @__PURE__ */
|
|
1099
|
-
|
|
1031
|
+
label && /* @__PURE__ */ _react2.default.createElement(
|
|
1032
|
+
_reactnative.Text,
|
|
1100
1033
|
{
|
|
1101
1034
|
style: [
|
|
1102
1035
|
otpStyles.label,
|
|
@@ -1104,19 +1037,19 @@ var OTPInput = ({
|
|
|
1104
1037
|
color: variantStyles.labelColor,
|
|
1105
1038
|
fontSize: 14
|
|
1106
1039
|
},
|
|
1107
|
-
customAppearance
|
|
1040
|
+
_optionalChain([customAppearance, 'optionalAccess', _44 => _44.label])
|
|
1108
1041
|
]
|
|
1109
1042
|
},
|
|
1110
1043
|
label
|
|
1111
1044
|
),
|
|
1112
|
-
/* @__PURE__ */
|
|
1113
|
-
|
|
1045
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
1046
|
+
_reactnative.Pressable,
|
|
1114
1047
|
{
|
|
1115
1048
|
onPress: handleContainerPress,
|
|
1116
1049
|
disabled: isDisabled,
|
|
1117
|
-
style: [otpStyles.segmentContainer, customAppearance
|
|
1050
|
+
style: [otpStyles.segmentContainer, _optionalChain([customAppearance, 'optionalAccess', _45 => _45.segmentContainer])]
|
|
1118
1051
|
},
|
|
1119
|
-
segments.map((char, index) => /* @__PURE__ */
|
|
1052
|
+
segments.map((char, index) => /* @__PURE__ */ _react2.default.createElement(
|
|
1120
1053
|
OTPSegment,
|
|
1121
1054
|
{
|
|
1122
1055
|
key: index,
|
|
@@ -1140,13 +1073,13 @@ var OTPInput = ({
|
|
|
1140
1073
|
}
|
|
1141
1074
|
))
|
|
1142
1075
|
),
|
|
1143
|
-
helperText && /* @__PURE__ */
|
|
1144
|
-
|
|
1076
|
+
helperText && /* @__PURE__ */ _react2.default.createElement(
|
|
1077
|
+
_reactnative.Text,
|
|
1145
1078
|
{
|
|
1146
1079
|
style: [
|
|
1147
1080
|
otpStyles.helperText,
|
|
1148
1081
|
{ color: helperColor, fontSize: 13 },
|
|
1149
|
-
customAppearance
|
|
1082
|
+
_optionalChain([customAppearance, 'optionalAccess', _46 => _46.helperText])
|
|
1150
1083
|
]
|
|
1151
1084
|
},
|
|
1152
1085
|
helperText
|
|
@@ -1156,13 +1089,13 @@ var OTPInput = ({
|
|
|
1156
1089
|
OTPInput.displayName = "OTPInput";
|
|
1157
1090
|
|
|
1158
1091
|
// src/components/input/number-input.tsx
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1092
|
+
|
|
1093
|
+
|
|
1094
|
+
|
|
1095
|
+
|
|
1163
1096
|
|
|
1164
1097
|
// src/components/input/number-input.hook.ts
|
|
1165
|
-
|
|
1098
|
+
|
|
1166
1099
|
var useNumberInputState = ({
|
|
1167
1100
|
value,
|
|
1168
1101
|
defaultValue,
|
|
@@ -1174,32 +1107,32 @@ var useNumberInputState = ({
|
|
|
1174
1107
|
locale
|
|
1175
1108
|
}) => {
|
|
1176
1109
|
const isControlled = typeof value === "number";
|
|
1177
|
-
const [internalValue, setInternalValue] = (0,
|
|
1110
|
+
const [internalValue, setInternalValue] = _react.useState.call(void 0,
|
|
1178
1111
|
defaultValue
|
|
1179
1112
|
);
|
|
1180
|
-
const [isEditing, setIsEditing] = (0,
|
|
1181
|
-
const [rawText, setRawText] = (0,
|
|
1113
|
+
const [isEditing, setIsEditing] = _react.useState.call(void 0, false);
|
|
1114
|
+
const [rawText, setRawText] = _react.useState.call(void 0, "");
|
|
1182
1115
|
const currentValue = isControlled ? value : internalValue;
|
|
1183
|
-
const formatter = (0,
|
|
1116
|
+
const formatter = _react.useMemo.call(void 0, () => {
|
|
1184
1117
|
if (!formatOptions) return null;
|
|
1185
1118
|
return new Intl.NumberFormat(locale, formatOptions);
|
|
1186
1119
|
}, [formatOptions, locale]);
|
|
1187
|
-
const displayValue = (0,
|
|
1120
|
+
const displayValue = _react.useMemo.call(void 0, () => {
|
|
1188
1121
|
if (isEditing) return rawText;
|
|
1189
1122
|
if (currentValue === void 0) return "";
|
|
1190
1123
|
if (formatter) return formatter.format(currentValue);
|
|
1191
1124
|
return String(currentValue);
|
|
1192
1125
|
}, [currentValue, formatter, isEditing, rawText]);
|
|
1193
|
-
const updateValue = (0,
|
|
1126
|
+
const updateValue = _react.useCallback.call(void 0,
|
|
1194
1127
|
(newValue) => {
|
|
1195
1128
|
if (!isControlled) {
|
|
1196
1129
|
setInternalValue(newValue);
|
|
1197
1130
|
}
|
|
1198
|
-
onValueChange
|
|
1131
|
+
_optionalChain([onValueChange, 'optionalCall', _47 => _47(newValue)]);
|
|
1199
1132
|
},
|
|
1200
1133
|
[isControlled, onValueChange]
|
|
1201
1134
|
);
|
|
1202
|
-
const clamp = (0,
|
|
1135
|
+
const clamp = _react.useCallback.call(void 0,
|
|
1203
1136
|
(num) => {
|
|
1204
1137
|
let clamped = num;
|
|
1205
1138
|
if (minValue !== void 0 && clamped < minValue) clamped = minValue;
|
|
@@ -1208,7 +1141,7 @@ var useNumberInputState = ({
|
|
|
1208
1141
|
},
|
|
1209
1142
|
[minValue, maxValue]
|
|
1210
1143
|
);
|
|
1211
|
-
const handleTextChange = (0,
|
|
1144
|
+
const handleTextChange = _react.useCallback.call(void 0,
|
|
1212
1145
|
(text) => {
|
|
1213
1146
|
setRawText(text);
|
|
1214
1147
|
if (text === "" || text === "-") return;
|
|
@@ -1218,11 +1151,11 @@ var useNumberInputState = ({
|
|
|
1218
1151
|
},
|
|
1219
1152
|
[updateValue]
|
|
1220
1153
|
);
|
|
1221
|
-
const handleFocus = (0,
|
|
1154
|
+
const handleFocus = _react.useCallback.call(void 0, () => {
|
|
1222
1155
|
setIsEditing(true);
|
|
1223
1156
|
setRawText(currentValue !== void 0 ? String(currentValue) : "");
|
|
1224
1157
|
}, [currentValue]);
|
|
1225
|
-
const handleBlur = (0,
|
|
1158
|
+
const handleBlur = _react.useCallback.call(void 0, () => {
|
|
1226
1159
|
setIsEditing(false);
|
|
1227
1160
|
if (rawText === "" || rawText === "-") {
|
|
1228
1161
|
updateValue(void 0);
|
|
@@ -1235,19 +1168,19 @@ var useNumberInputState = ({
|
|
|
1235
1168
|
}
|
|
1236
1169
|
updateValue(clamp(parsed));
|
|
1237
1170
|
}, [rawText, clamp, updateValue]);
|
|
1238
|
-
const handleClear = (0,
|
|
1171
|
+
const handleClear = _react.useCallback.call(void 0, () => {
|
|
1239
1172
|
setRawText("");
|
|
1240
1173
|
updateValue(void 0);
|
|
1241
1174
|
}, [updateValue]);
|
|
1242
|
-
const canIncrement = maxValue === void 0 || (currentValue
|
|
1243
|
-
const canDecrement = minValue === void 0 || (currentValue
|
|
1244
|
-
const handleIncrement = (0,
|
|
1245
|
-
const base = currentValue
|
|
1175
|
+
const canIncrement = maxValue === void 0 || (_nullishCoalesce(currentValue, () => ( 0))) + step <= maxValue;
|
|
1176
|
+
const canDecrement = minValue === void 0 || (_nullishCoalesce(currentValue, () => ( 0))) - step >= minValue;
|
|
1177
|
+
const handleIncrement = _react.useCallback.call(void 0, () => {
|
|
1178
|
+
const base = _nullishCoalesce(currentValue, () => ( 0));
|
|
1246
1179
|
const newValue = clamp(base + step);
|
|
1247
1180
|
updateValue(newValue);
|
|
1248
1181
|
}, [currentValue, step, clamp, updateValue]);
|
|
1249
|
-
const handleDecrement = (0,
|
|
1250
|
-
const base = currentValue
|
|
1182
|
+
const handleDecrement = _react.useCallback.call(void 0, () => {
|
|
1183
|
+
const base = _nullishCoalesce(currentValue, () => ( 0));
|
|
1251
1184
|
const newValue = clamp(base - step);
|
|
1252
1185
|
updateValue(newValue);
|
|
1253
1186
|
}, [currentValue, step, clamp, updateValue]);
|
|
@@ -1265,8 +1198,8 @@ var useNumberInputState = ({
|
|
|
1265
1198
|
};
|
|
1266
1199
|
|
|
1267
1200
|
// src/components/input/number-input.style.ts
|
|
1268
|
-
|
|
1269
|
-
var numberInputStyles =
|
|
1201
|
+
|
|
1202
|
+
var numberInputStyles = _reactnative.StyleSheet.create({
|
|
1270
1203
|
stepperContainer: {
|
|
1271
1204
|
flexDirection: "row",
|
|
1272
1205
|
alignItems: "center",
|
|
@@ -1285,7 +1218,7 @@ var numberInputStyles = import_react_native9.StyleSheet.create({
|
|
|
1285
1218
|
});
|
|
1286
1219
|
|
|
1287
1220
|
// src/components/input/number-input.tsx
|
|
1288
|
-
var NumberInput = (0,
|
|
1221
|
+
var NumberInput = _react.forwardRef.call(void 0,
|
|
1289
1222
|
({
|
|
1290
1223
|
value,
|
|
1291
1224
|
defaultValue,
|
|
@@ -1312,7 +1245,7 @@ var NumberInput = (0, import_react13.forwardRef)(
|
|
|
1312
1245
|
fullWidth = true,
|
|
1313
1246
|
customAppearance
|
|
1314
1247
|
}, ref) => {
|
|
1315
|
-
const theme = useXUITheme();
|
|
1248
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
1316
1249
|
const {
|
|
1317
1250
|
displayValue,
|
|
1318
1251
|
handleTextChange,
|
|
@@ -1332,17 +1265,17 @@ var NumberInput = (0, import_react13.forwardRef)(
|
|
|
1332
1265
|
formatOptions,
|
|
1333
1266
|
locale
|
|
1334
1267
|
});
|
|
1335
|
-
const iconColor = (0,
|
|
1336
|
-
const stepperContent = hideStepper || isReadOnly ? void 0 : /* @__PURE__ */
|
|
1337
|
-
|
|
1268
|
+
const iconColor = _core.withOpacity.call(void 0, theme.colors.foreground, 0.7);
|
|
1269
|
+
const stepperContent = hideStepper || isReadOnly ? void 0 : /* @__PURE__ */ _react2.default.createElement(
|
|
1270
|
+
_reactnative.View,
|
|
1338
1271
|
{
|
|
1339
1272
|
style: [
|
|
1340
1273
|
numberInputStyles.stepperContainer,
|
|
1341
|
-
customAppearance
|
|
1274
|
+
_optionalChain([customAppearance, 'optionalAccess', _48 => _48.stepperContainer])
|
|
1342
1275
|
]
|
|
1343
1276
|
},
|
|
1344
|
-
/* @__PURE__ */
|
|
1345
|
-
|
|
1277
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
1278
|
+
_reactnative.Pressable,
|
|
1346
1279
|
{
|
|
1347
1280
|
onPress: handleDecrement,
|
|
1348
1281
|
disabled: isDisabled || !canDecrement,
|
|
@@ -1351,13 +1284,13 @@ var NumberInput = (0, import_react13.forwardRef)(
|
|
|
1351
1284
|
style: [
|
|
1352
1285
|
numberInputStyles.stepperButton,
|
|
1353
1286
|
(!canDecrement || isDisabled) && numberInputStyles.stepperDisabled,
|
|
1354
|
-
customAppearance
|
|
1287
|
+
_optionalChain([customAppearance, 'optionalAccess', _49 => _49.stepperButton])
|
|
1355
1288
|
]
|
|
1356
1289
|
},
|
|
1357
|
-
/* @__PURE__ */
|
|
1290
|
+
/* @__PURE__ */ _react2.default.createElement(_icons.RemoveIcon, { size: 16, color: iconColor })
|
|
1358
1291
|
),
|
|
1359
|
-
/* @__PURE__ */
|
|
1360
|
-
|
|
1292
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
1293
|
+
_reactnative.Pressable,
|
|
1361
1294
|
{
|
|
1362
1295
|
onPress: handleIncrement,
|
|
1363
1296
|
disabled: isDisabled || !canIncrement,
|
|
@@ -1366,13 +1299,13 @@ var NumberInput = (0, import_react13.forwardRef)(
|
|
|
1366
1299
|
style: [
|
|
1367
1300
|
numberInputStyles.stepperButton,
|
|
1368
1301
|
(!canIncrement || isDisabled) && numberInputStyles.stepperDisabled,
|
|
1369
|
-
customAppearance
|
|
1302
|
+
_optionalChain([customAppearance, 'optionalAccess', _50 => _50.stepperButton])
|
|
1370
1303
|
]
|
|
1371
1304
|
},
|
|
1372
|
-
/* @__PURE__ */
|
|
1305
|
+
/* @__PURE__ */ _react2.default.createElement(_icons.AddIcon, { size: 16, color: iconColor })
|
|
1373
1306
|
)
|
|
1374
1307
|
);
|
|
1375
|
-
return /* @__PURE__ */
|
|
1308
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
1376
1309
|
TextInput,
|
|
1377
1310
|
{
|
|
1378
1311
|
ref,
|
|
@@ -1402,14 +1335,13 @@ var NumberInput = (0, import_react13.forwardRef)(
|
|
|
1402
1335
|
}
|
|
1403
1336
|
);
|
|
1404
1337
|
NumberInput.displayName = "NumberInput";
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
});
|
|
1338
|
+
|
|
1339
|
+
|
|
1340
|
+
|
|
1341
|
+
|
|
1342
|
+
|
|
1343
|
+
|
|
1344
|
+
|
|
1345
|
+
|
|
1346
|
+
|
|
1347
|
+
exports.DateInput = DateInput; exports.DateTimeInput = DateTimeInput; exports.NumberInput = NumberInput; exports.OTPInput = OTPInput; exports.TextArea = TextArea; exports.TextInput = TextInput; exports.TimeInput = TimeInput; exports.getDateOrder = getDateOrder;
|