@xaui/native 0.0.21 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +195 -2
- package/dist/alert/index.js +1 -2
- package/dist/app-bar/index.cjs +217 -0
- package/dist/app-bar/index.d.cts +52 -0
- package/dist/app-bar/index.d.ts +52 -0
- package/dist/app-bar/index.js +142 -0
- package/dist/autocomplete/index.js +48 -36
- package/dist/avatar/index.js +1 -2
- package/dist/badge/index.js +1 -2
- package/dist/bottom-sheet/index.js +1 -2
- package/dist/bottom-tab-bar/index.cjs +571 -0
- package/dist/bottom-tab-bar/index.d.cts +211 -0
- package/dist/bottom-tab-bar/index.d.ts +211 -0
- package/dist/bottom-tab-bar/index.js +497 -0
- package/dist/button/index.d.cts +102 -5
- package/dist/button/index.d.ts +102 -5
- package/dist/button/index.js +2 -3
- package/dist/button.type-j1ZdkkSl.d.cts +4 -0
- package/dist/button.type-j1ZdkkSl.d.ts +4 -0
- package/dist/card/index.cjs +2 -0
- package/dist/card/index.d.cts +6 -1
- package/dist/card/index.d.ts +6 -1
- package/dist/card/index.js +4 -2
- package/dist/carousel/index.js +1 -1
- package/dist/chart/index.cjs +1067 -0
- package/dist/chart/index.d.cts +218 -0
- package/dist/chart/index.d.ts +218 -0
- package/dist/chart/index.js +1026 -0
- package/dist/checkbox/index.js +1 -2
- package/dist/chip/index.js +1 -2
- package/dist/chunk-3XSXTM3G.js +661 -0
- package/dist/chunk-4KSZLONZ.js +79 -0
- package/dist/{chunk-DXXNBF5P.js → chunk-CZFDZPAS.js} +0 -5
- package/dist/{chunk-LTKYHG5V.js → chunk-GHCVNQET.js} +12 -5
- package/dist/chunk-I4V5Y5GD.js +76 -0
- package/dist/{chunk-F7WH4DMG.js → chunk-UI5L26KD.js} +1 -1
- package/dist/{chunk-LUBWRVI2.js → chunk-ULJSCNPE.js} +1 -1
- package/dist/chunk-URBEEDFX.js +79 -0
- package/dist/core/index.js +3 -5
- package/dist/datepicker/index.js +1 -2
- package/dist/divider/index.js +2 -3
- package/dist/drawer/index.cjs +310 -0
- package/dist/drawer/index.d.cts +58 -0
- package/dist/drawer/index.d.ts +58 -0
- package/dist/drawer/index.js +236 -0
- package/dist/{accordion → expansion-panel}/index.cjs +45 -45
- package/dist/{accordion → expansion-panel}/index.d.cts +30 -30
- package/dist/{accordion → expansion-panel}/index.d.ts +30 -30
- package/dist/{accordion → expansion-panel}/index.js +40 -41
- package/dist/fab/index.d.cts +3 -3
- package/dist/fab/index.d.ts +3 -3
- package/dist/fab/index.js +3 -4
- package/dist/fab-menu/index.d.cts +2 -2
- package/dist/fab-menu/index.d.ts +2 -2
- package/dist/fab-menu/index.js +3 -4
- package/dist/{fab.type-Ba0QMprb.d.ts → fab.type-CgIYqQlT.d.ts} +1 -1
- package/dist/{fab.type-U09H8B7D.d.cts → fab.type-l2vjG8-p.d.cts} +1 -1
- package/dist/feature-discovery/index.cjs +531 -0
- package/dist/feature-discovery/index.d.cts +82 -0
- package/dist/feature-discovery/index.d.ts +82 -0
- package/dist/feature-discovery/index.js +464 -0
- package/dist/indicator/index.js +2 -3
- package/dist/input/index.cjs +258 -164
- package/dist/input/index.d.cts +15 -1
- package/dist/input/index.d.ts +15 -1
- package/dist/input/index.js +219 -126
- package/dist/list/index.js +1 -2
- package/dist/menu/index.js +2 -2
- package/dist/menubox/index.cjs +369 -0
- package/dist/menubox/index.d.cts +98 -0
- package/dist/menubox/index.d.ts +98 -0
- package/dist/menubox/index.js +296 -0
- package/dist/pager/index.cjs +243 -0
- package/dist/pager/index.d.cts +93 -0
- package/dist/pager/index.d.ts +93 -0
- package/dist/pager/index.js +205 -0
- package/dist/progress/index.js +1 -2
- package/dist/radio/index.cjs +537 -0
- package/dist/radio/index.d.cts +145 -0
- package/dist/radio/index.d.ts +145 -0
- package/dist/radio/index.js +464 -0
- package/dist/segment-button/index.js +2 -2
- package/dist/select/index.js +22 -10
- package/dist/skeleton/index.js +2 -2
- package/dist/slider/index.cjs +655 -0
- package/dist/slider/index.d.cts +171 -0
- package/dist/slider/index.d.ts +171 -0
- package/dist/slider/index.js +575 -0
- package/dist/stepper/index.cjs +624 -0
- package/dist/stepper/index.d.cts +137 -0
- package/dist/stepper/index.d.ts +137 -0
- package/dist/stepper/index.js +549 -0
- package/dist/switch/index.js +1 -2
- package/dist/tabs/index.cjs +523 -0
- package/dist/tabs/index.d.cts +176 -0
- package/dist/tabs/index.d.ts +176 -0
- package/dist/tabs/index.js +438 -0
- package/dist/timepicker/index.cjs +1280 -0
- package/dist/timepicker/index.d.cts +215 -0
- package/dist/timepicker/index.d.ts +215 -0
- package/dist/timepicker/index.js +1181 -0
- package/dist/toolbar/index.cjs +395 -0
- package/dist/toolbar/index.d.cts +100 -0
- package/dist/toolbar/index.d.ts +100 -0
- package/dist/toolbar/index.js +325 -0
- package/dist/typography/index.js +1 -2
- package/dist/view/index.cjs +16 -2
- package/dist/view/index.js +16 -2
- package/package.json +73 -8
- package/dist/button.type-D8tzEBo7.d.ts +0 -104
- package/dist/button.type-ikaWzhIg.d.cts +0 -104
- package/dist/chunk-GBHQCAKW.js +0 -19
- package/dist/chunk-JEGEPGVU.js +0 -287
package/dist/input/index.cjs
CHANGED
|
@@ -34,6 +34,7 @@ __export(input_exports, {
|
|
|
34
34
|
DateTimeInput: () => DateTimeInput,
|
|
35
35
|
NumberInput: () => NumberInput,
|
|
36
36
|
OTPInput: () => OTPInput,
|
|
37
|
+
TextArea: () => TextArea,
|
|
37
38
|
TextInput: () => TextInput,
|
|
38
39
|
TimeInput: () => TimeInput,
|
|
39
40
|
getDateOrder: () => getDateOrder
|
|
@@ -360,98 +361,115 @@ var TextInput = (0, import_react7.forwardRef)(
|
|
|
360
361
|
]
|
|
361
362
|
},
|
|
362
363
|
label
|
|
363
|
-
), /* @__PURE__ */ import_react7.default.createElement(
|
|
364
|
-
import_react_native5.
|
|
364
|
+
), /* @__PURE__ */ import_react7.default.createElement(
|
|
365
|
+
import_react_native5.Pressable,
|
|
365
366
|
{
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
{
|
|
369
|
-
minHeight: sizeStyles.minHeight,
|
|
370
|
-
paddingVertical: sizeStyles.paddingVertical,
|
|
371
|
-
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
372
|
-
gap: sizeStyles.slotGap,
|
|
373
|
-
backgroundColor: variantStyles.container.backgroundColor,
|
|
374
|
-
borderWidth: variant === "underlined" ? 0 : variantStyles.container.borderWidth,
|
|
375
|
-
...variant === "underlined" && {
|
|
376
|
-
borderBottomWidth: variantStyles.container.borderBottomWidth
|
|
377
|
-
},
|
|
378
|
-
borderRadius: variant === "underlined" ? 0 : radiusStyles.borderRadius,
|
|
379
|
-
...variant === "underlined" ? {
|
|
380
|
-
borderBottomColor: borderAnimation.interpolate({
|
|
381
|
-
inputRange: [0, 1],
|
|
382
|
-
outputRange: [
|
|
383
|
-
variantStyles.unfocusedBorderColor,
|
|
384
|
-
variantStyles.focusedBorderColor
|
|
385
|
-
]
|
|
386
|
-
})
|
|
387
|
-
} : {
|
|
388
|
-
borderColor: borderAnimation.interpolate({
|
|
389
|
-
inputRange: [0, 1],
|
|
390
|
-
outputRange: [
|
|
391
|
-
variantStyles.unfocusedBorderColor,
|
|
392
|
-
variantStyles.focusedBorderColor
|
|
393
|
-
]
|
|
394
|
-
})
|
|
395
|
-
}
|
|
396
|
-
},
|
|
397
|
-
variant === "underlined" && styles.underlinedWrapper,
|
|
398
|
-
customAppearance?.inputWrapper
|
|
399
|
-
]
|
|
367
|
+
onPress: handleWrapperPress,
|
|
368
|
+
disabled: isDisabled || isReadOnly
|
|
400
369
|
},
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
import_react_native5.Text,
|
|
370
|
+
/* @__PURE__ */ import_react7.default.createElement(
|
|
371
|
+
import_react_native5.Animated.View,
|
|
404
372
|
{
|
|
405
373
|
style: [
|
|
406
|
-
styles.
|
|
374
|
+
styles.inputWrapper,
|
|
407
375
|
{
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
376
|
+
minHeight: sizeStyles.minHeight,
|
|
377
|
+
paddingVertical: sizeStyles.paddingVertical,
|
|
378
|
+
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
379
|
+
gap: sizeStyles.slotGap,
|
|
380
|
+
backgroundColor: variantStyles.container.backgroundColor,
|
|
381
|
+
borderWidth: variant === "underlined" ? 0 : variantStyles.container.borderWidth,
|
|
382
|
+
...variant === "underlined" && {
|
|
383
|
+
borderBottomWidth: variantStyles.container.borderBottomWidth
|
|
384
|
+
},
|
|
385
|
+
borderRadius: variant === "underlined" ? 0 : radiusStyles.borderRadius,
|
|
386
|
+
...variant === "underlined" ? {
|
|
387
|
+
borderBottomColor: borderAnimation.interpolate({
|
|
388
|
+
inputRange: [0, 1],
|
|
389
|
+
outputRange: [
|
|
390
|
+
variantStyles.unfocusedBorderColor,
|
|
391
|
+
variantStyles.focusedBorderColor
|
|
392
|
+
]
|
|
393
|
+
})
|
|
394
|
+
} : {
|
|
395
|
+
borderColor: borderAnimation.interpolate({
|
|
396
|
+
inputRange: [0, 1],
|
|
397
|
+
outputRange: [
|
|
398
|
+
variantStyles.unfocusedBorderColor,
|
|
399
|
+
variantStyles.focusedBorderColor
|
|
400
|
+
]
|
|
401
|
+
})
|
|
402
|
+
}
|
|
411
403
|
},
|
|
412
|
-
|
|
404
|
+
variant === "underlined" && styles.underlinedWrapper,
|
|
405
|
+
customAppearance?.inputWrapper
|
|
413
406
|
]
|
|
414
407
|
},
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
setIsFocused(true);
|
|
424
|
-
onFocus?.(event);
|
|
425
|
-
},
|
|
426
|
-
onBlur: (event) => {
|
|
427
|
-
setIsFocused(false);
|
|
428
|
-
onBlur?.(event);
|
|
408
|
+
startContent && /* @__PURE__ */ import_react7.default.createElement(import_react_native5.View, { style: styles.slot }, startContent),
|
|
409
|
+
/* @__PURE__ */ import_react7.default.createElement(
|
|
410
|
+
import_react_native5.View,
|
|
411
|
+
{
|
|
412
|
+
style: {
|
|
413
|
+
flex: 1,
|
|
414
|
+
gap: labelPlacement === "inside" && label ? 2 : 0
|
|
415
|
+
}
|
|
429
416
|
},
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
placeholderTextColor: variantStyles.placeholderColor,
|
|
433
|
-
style: [
|
|
434
|
-
styles.input,
|
|
417
|
+
label && labelPlacement === "inside" && /* @__PURE__ */ import_react7.default.createElement(
|
|
418
|
+
import_react_native5.Text,
|
|
435
419
|
{
|
|
436
|
-
|
|
437
|
-
|
|
420
|
+
style: [
|
|
421
|
+
styles.label,
|
|
422
|
+
{
|
|
423
|
+
color: variantStyles.labelColor,
|
|
424
|
+
fontSize: sizeStyles.helperSize,
|
|
425
|
+
paddingBottom: 2
|
|
426
|
+
},
|
|
427
|
+
customAppearance?.label
|
|
428
|
+
]
|
|
438
429
|
},
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
430
|
+
label
|
|
431
|
+
),
|
|
432
|
+
/* @__PURE__ */ import_react7.default.createElement(
|
|
433
|
+
import_react_native5.TextInput,
|
|
434
|
+
{
|
|
435
|
+
ref: typeof forwardedRef === "function" ? internalRef : forwardedRef || internalRef,
|
|
436
|
+
value: inputValue,
|
|
437
|
+
onChangeText: handleChangeText,
|
|
438
|
+
onFocus: (event) => {
|
|
439
|
+
setIsFocused(true);
|
|
440
|
+
onFocus?.(event);
|
|
441
|
+
},
|
|
442
|
+
onBlur: (event) => {
|
|
443
|
+
setIsFocused(false);
|
|
444
|
+
onBlur?.(event);
|
|
445
|
+
},
|
|
446
|
+
editable,
|
|
447
|
+
secureTextEntry,
|
|
448
|
+
placeholderTextColor: variantStyles.placeholderColor,
|
|
449
|
+
style: [
|
|
450
|
+
styles.input,
|
|
451
|
+
{
|
|
452
|
+
color: variantStyles.textColor,
|
|
453
|
+
fontSize: sizeStyles.fontSize
|
|
454
|
+
},
|
|
455
|
+
customAppearance?.input
|
|
456
|
+
],
|
|
457
|
+
...nativeProps
|
|
458
|
+
}
|
|
459
|
+
)
|
|
460
|
+
),
|
|
461
|
+
showClearButton ? /* @__PURE__ */ import_react7.default.createElement(
|
|
462
|
+
import_react_native5.Pressable,
|
|
463
|
+
{
|
|
464
|
+
onPress: handleClear,
|
|
465
|
+
accessibilityLabel: "Clear input",
|
|
466
|
+
accessibilityRole: "button",
|
|
467
|
+
style: styles.clearButton
|
|
468
|
+
},
|
|
469
|
+
/* @__PURE__ */ import_react7.default.createElement(import_icons.CloseIcon, { size: 16, color: variantStyles.placeholderColor })
|
|
470
|
+
) : endContent && /* @__PURE__ */ import_react7.default.createElement(import_react_native5.View, { style: styles.slot }, endContent)
|
|
471
|
+
)
|
|
472
|
+
)),
|
|
455
473
|
helperText && /* @__PURE__ */ import_react7.default.createElement(
|
|
456
474
|
import_react_native5.Text,
|
|
457
475
|
{
|
|
@@ -471,9 +489,71 @@ var TextInput = (0, import_react7.forwardRef)(
|
|
|
471
489
|
);
|
|
472
490
|
TextInput.displayName = "TextInput";
|
|
473
491
|
|
|
474
|
-
// src/components/input/
|
|
492
|
+
// src/components/input/textarea.tsx
|
|
475
493
|
var import_react8 = __toESM(require("react"), 1);
|
|
476
494
|
|
|
495
|
+
// src/components/input/textarea.style.ts
|
|
496
|
+
var import_react_native6 = require("react-native");
|
|
497
|
+
var textAreaStyles = import_react_native6.StyleSheet.create({
|
|
498
|
+
inputWrapper: {
|
|
499
|
+
alignItems: "flex-start"
|
|
500
|
+
},
|
|
501
|
+
input: {
|
|
502
|
+
textAlignVertical: "top"
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
// src/components/input/textarea.tsx
|
|
507
|
+
var TextArea = ({
|
|
508
|
+
minRows = 3,
|
|
509
|
+
maxRows,
|
|
510
|
+
size = "md",
|
|
511
|
+
customAppearance,
|
|
512
|
+
numberOfLines,
|
|
513
|
+
textAlignVertical,
|
|
514
|
+
scrollEnabled,
|
|
515
|
+
...props
|
|
516
|
+
}) => {
|
|
517
|
+
const sizeStyles = useTextInputSizeStyles(size);
|
|
518
|
+
const lineHeight = Math.round(sizeStyles.fontSize * 1.35);
|
|
519
|
+
const verticalPadding = sizeStyles.paddingVertical * 2;
|
|
520
|
+
const normalizedMaxRows = typeof maxRows === "number" ? Math.max(maxRows, minRows) : void 0;
|
|
521
|
+
const minHeight = minRows * lineHeight + verticalPadding;
|
|
522
|
+
const maxHeight = typeof normalizedMaxRows === "number" ? normalizedMaxRows * lineHeight + verticalPadding : void 0;
|
|
523
|
+
return /* @__PURE__ */ import_react8.default.createElement(
|
|
524
|
+
TextInput,
|
|
525
|
+
{
|
|
526
|
+
...props,
|
|
527
|
+
size,
|
|
528
|
+
multiline: true,
|
|
529
|
+
numberOfLines: numberOfLines ?? minRows,
|
|
530
|
+
textAlignVertical: textAlignVertical ?? "top",
|
|
531
|
+
scrollEnabled: scrollEnabled ?? !!maxHeight,
|
|
532
|
+
customAppearance: {
|
|
533
|
+
...customAppearance,
|
|
534
|
+
inputWrapper: [
|
|
535
|
+
textAreaStyles.inputWrapper,
|
|
536
|
+
{
|
|
537
|
+
minHeight,
|
|
538
|
+
...maxHeight ? { maxHeight } : {}
|
|
539
|
+
},
|
|
540
|
+
customAppearance?.inputWrapper
|
|
541
|
+
],
|
|
542
|
+
input: [
|
|
543
|
+
textAreaStyles.input,
|
|
544
|
+
{
|
|
545
|
+
lineHeight
|
|
546
|
+
},
|
|
547
|
+
customAppearance?.input
|
|
548
|
+
]
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
);
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
// src/components/input/date-time-input.tsx
|
|
555
|
+
var import_react9 = __toESM(require("react"), 1);
|
|
556
|
+
|
|
477
557
|
// src/components/input/date-time-input.hook.ts
|
|
478
558
|
var YMD_LOCALES = ["ja", "zh", "ko", "hu", "lt", "mn"];
|
|
479
559
|
var MDY_LOCALES = ["en-US", "en-PH", "en-BZ"];
|
|
@@ -581,7 +661,7 @@ var getDateTimeMaxLength = (separator, granularity, hourCycle) => {
|
|
|
581
661
|
};
|
|
582
662
|
|
|
583
663
|
// src/components/input/date-time-input.tsx
|
|
584
|
-
var DateInput = (0,
|
|
664
|
+
var DateInput = (0, import_react9.forwardRef)(
|
|
585
665
|
({
|
|
586
666
|
separator = "-",
|
|
587
667
|
dateOrder,
|
|
@@ -592,11 +672,11 @@ var DateInput = (0, import_react8.forwardRef)(
|
|
|
592
672
|
onValueChange,
|
|
593
673
|
...props
|
|
594
674
|
}, ref) => {
|
|
595
|
-
const resolvedOrder = (0,
|
|
675
|
+
const resolvedOrder = (0, import_react9.useMemo)(
|
|
596
676
|
() => dateOrder ?? getDateOrder(locale),
|
|
597
677
|
[dateOrder, locale]
|
|
598
678
|
);
|
|
599
|
-
const handleChangeText = (0,
|
|
679
|
+
const handleChangeText = (0, import_react9.useCallback)(
|
|
600
680
|
(text) => {
|
|
601
681
|
const formatted = formatDateInput(text, resolvedOrder, separator);
|
|
602
682
|
onChangeText?.(formatted);
|
|
@@ -604,7 +684,7 @@ var DateInput = (0, import_react8.forwardRef)(
|
|
|
604
684
|
},
|
|
605
685
|
[resolvedOrder, separator, onChangeText, onValueChange]
|
|
606
686
|
);
|
|
607
|
-
return /* @__PURE__ */
|
|
687
|
+
return /* @__PURE__ */ import_react9.default.createElement(
|
|
608
688
|
TextInput,
|
|
609
689
|
{
|
|
610
690
|
ref,
|
|
@@ -619,7 +699,7 @@ var DateInput = (0, import_react8.forwardRef)(
|
|
|
619
699
|
);
|
|
620
700
|
}
|
|
621
701
|
);
|
|
622
|
-
var TimeInput = (0,
|
|
702
|
+
var TimeInput = (0, import_react9.forwardRef)(
|
|
623
703
|
({
|
|
624
704
|
granularity = "minute",
|
|
625
705
|
hourCycle = 24,
|
|
@@ -629,7 +709,7 @@ var TimeInput = (0, import_react8.forwardRef)(
|
|
|
629
709
|
onValueChange,
|
|
630
710
|
...props
|
|
631
711
|
}, ref) => {
|
|
632
|
-
const handleChangeText = (0,
|
|
712
|
+
const handleChangeText = (0, import_react9.useCallback)(
|
|
633
713
|
(text) => {
|
|
634
714
|
const formatted = formatTimeInput(text, granularity, hourCycle);
|
|
635
715
|
onChangeText?.(formatted);
|
|
@@ -637,7 +717,7 @@ var TimeInput = (0, import_react8.forwardRef)(
|
|
|
637
717
|
},
|
|
638
718
|
[granularity, hourCycle, onChangeText, onValueChange]
|
|
639
719
|
);
|
|
640
|
-
return /* @__PURE__ */
|
|
720
|
+
return /* @__PURE__ */ import_react9.default.createElement(
|
|
641
721
|
TextInput,
|
|
642
722
|
{
|
|
643
723
|
ref,
|
|
@@ -652,7 +732,7 @@ var TimeInput = (0, import_react8.forwardRef)(
|
|
|
652
732
|
);
|
|
653
733
|
}
|
|
654
734
|
);
|
|
655
|
-
var DateTimeInput = (0,
|
|
735
|
+
var DateTimeInput = (0, import_react9.forwardRef)(
|
|
656
736
|
({
|
|
657
737
|
separator = "-",
|
|
658
738
|
dateOrder,
|
|
@@ -665,11 +745,11 @@ var DateTimeInput = (0, import_react8.forwardRef)(
|
|
|
665
745
|
onValueChange,
|
|
666
746
|
...props
|
|
667
747
|
}, ref) => {
|
|
668
|
-
const resolvedOrder = (0,
|
|
748
|
+
const resolvedOrder = (0, import_react9.useMemo)(
|
|
669
749
|
() => dateOrder ?? getDateOrder(locale),
|
|
670
750
|
[dateOrder, locale]
|
|
671
751
|
);
|
|
672
|
-
const handleChangeText = (0,
|
|
752
|
+
const handleChangeText = (0, import_react9.useCallback)(
|
|
673
753
|
(text) => {
|
|
674
754
|
const formatted = formatDateTimeInput(
|
|
675
755
|
text,
|
|
@@ -683,7 +763,7 @@ var DateTimeInput = (0, import_react8.forwardRef)(
|
|
|
683
763
|
},
|
|
684
764
|
[resolvedOrder, separator, granularity, hourCycle, onChangeText, onValueChange]
|
|
685
765
|
);
|
|
686
|
-
return /* @__PURE__ */
|
|
766
|
+
return /* @__PURE__ */ import_react9.default.createElement(
|
|
687
767
|
TextInput,
|
|
688
768
|
{
|
|
689
769
|
ref,
|
|
@@ -703,18 +783,18 @@ TimeInput.displayName = "TimeInput";
|
|
|
703
783
|
DateTimeInput.displayName = "DateTimeInput";
|
|
704
784
|
|
|
705
785
|
// src/components/input/otp-input.tsx
|
|
706
|
-
var
|
|
707
|
-
var
|
|
786
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
787
|
+
var import_react_native8 = require("react-native");
|
|
708
788
|
|
|
709
789
|
// src/components/input/otp-input.hook.ts
|
|
710
|
-
var
|
|
790
|
+
var import_react10 = require("react");
|
|
711
791
|
var segmentSizeMap = {
|
|
712
792
|
sm: { width: 40, height: 40, fontSize: 16 },
|
|
713
793
|
md: { width: 48, height: 48, fontSize: 20 },
|
|
714
794
|
lg: { width: 56, height: 56, fontSize: 24 }
|
|
715
795
|
};
|
|
716
796
|
var useOTPSegmentSizeStyles = (size) => {
|
|
717
|
-
return (0,
|
|
797
|
+
return (0, import_react10.useMemo)(() => segmentSizeMap[size], [size]);
|
|
718
798
|
};
|
|
719
799
|
var useOTPInputState = ({
|
|
720
800
|
length,
|
|
@@ -725,17 +805,15 @@ var useOTPInputState = ({
|
|
|
725
805
|
allowedKeys
|
|
726
806
|
}) => {
|
|
727
807
|
const isControlled = typeof value === "string";
|
|
728
|
-
const [internalValue, setInternalValue] = (0,
|
|
729
|
-
|
|
730
|
-
);
|
|
731
|
-
const [activeIndex, setActiveIndex] = (0, import_react9.useState)(-1);
|
|
732
|
-
const refs = (0, import_react9.useRef)([]);
|
|
808
|
+
const [internalValue, setInternalValue] = (0, import_react10.useState)(defaultValue ?? "");
|
|
809
|
+
const [activeIndex, setActiveIndex] = (0, import_react10.useState)(-1);
|
|
810
|
+
const refs = (0, import_react10.useRef)([]);
|
|
733
811
|
const currentValue = isControlled ? value : internalValue;
|
|
734
|
-
const segments = (0,
|
|
812
|
+
const segments = (0, import_react10.useMemo)(() => {
|
|
735
813
|
const chars = currentValue.split("");
|
|
736
814
|
return Array.from({ length }, (_, i) => chars[i] ?? "");
|
|
737
815
|
}, [currentValue, length]);
|
|
738
|
-
const updateValue = (0,
|
|
816
|
+
const updateValue = (0, import_react10.useCallback)(
|
|
739
817
|
(newValue) => {
|
|
740
818
|
if (!isControlled) {
|
|
741
819
|
setInternalValue(newValue);
|
|
@@ -747,7 +825,7 @@ var useOTPInputState = ({
|
|
|
747
825
|
},
|
|
748
826
|
[isControlled, length, onValueChange, onComplete]
|
|
749
827
|
);
|
|
750
|
-
const handleSegmentChange = (0,
|
|
828
|
+
const handleSegmentChange = (0, import_react10.useCallback)(
|
|
751
829
|
(index, text) => {
|
|
752
830
|
if (!text) return;
|
|
753
831
|
const char = text.slice(-1);
|
|
@@ -763,7 +841,7 @@ var useOTPInputState = ({
|
|
|
763
841
|
},
|
|
764
842
|
[allowedKeys, currentValue, length, updateValue]
|
|
765
843
|
);
|
|
766
|
-
const handleSegmentKeyPress = (0,
|
|
844
|
+
const handleSegmentKeyPress = (0, import_react10.useCallback)(
|
|
767
845
|
(index, key) => {
|
|
768
846
|
if (key !== "Backspace") return;
|
|
769
847
|
const chars = currentValue.split("");
|
|
@@ -781,10 +859,10 @@ var useOTPInputState = ({
|
|
|
781
859
|
},
|
|
782
860
|
[currentValue, length, updateValue]
|
|
783
861
|
);
|
|
784
|
-
const handleSegmentFocus = (0,
|
|
862
|
+
const handleSegmentFocus = (0, import_react10.useCallback)((index) => {
|
|
785
863
|
setActiveIndex(index);
|
|
786
864
|
}, []);
|
|
787
|
-
const handleSegmentBlur = (0,
|
|
865
|
+
const handleSegmentBlur = (0, import_react10.useCallback)(() => {
|
|
788
866
|
setActiveIndex(-1);
|
|
789
867
|
}, []);
|
|
790
868
|
return {
|
|
@@ -799,8 +877,8 @@ var useOTPInputState = ({
|
|
|
799
877
|
};
|
|
800
878
|
|
|
801
879
|
// src/components/input/otp-input.style.ts
|
|
802
|
-
var
|
|
803
|
-
var otpStyles =
|
|
880
|
+
var import_react_native7 = require("react-native");
|
|
881
|
+
var otpStyles = import_react_native7.StyleSheet.create({
|
|
804
882
|
container: {
|
|
805
883
|
gap: 6
|
|
806
884
|
},
|
|
@@ -857,29 +935,29 @@ var OTPSegment = ({
|
|
|
857
935
|
onChangeText,
|
|
858
936
|
onKeyPress,
|
|
859
937
|
onFocus,
|
|
860
|
-
onBlur
|
|
938
|
+
onBlur,
|
|
939
|
+
onPress
|
|
861
940
|
}) => {
|
|
862
|
-
const borderAnimation = (0,
|
|
863
|
-
(0,
|
|
864
|
-
|
|
941
|
+
const borderAnimation = (0, import_react11.useRef)(new import_react_native8.Animated.Value(0)).current;
|
|
942
|
+
(0, import_react11.useEffect)(() => {
|
|
943
|
+
import_react_native8.Animated.timing(borderAnimation, {
|
|
865
944
|
toValue: isActive ? 1 : 0,
|
|
866
945
|
duration: 200,
|
|
867
946
|
useNativeDriver: false
|
|
868
947
|
}).start();
|
|
869
948
|
}, [borderAnimation, isActive]);
|
|
870
|
-
return /* @__PURE__ */
|
|
871
|
-
|
|
949
|
+
return /* @__PURE__ */ import_react11.default.createElement(
|
|
950
|
+
import_react_native8.Pressable,
|
|
872
951
|
{
|
|
873
952
|
onPress: () => {
|
|
874
953
|
if (!isDisabled) {
|
|
875
|
-
|
|
876
|
-
if (typeof inputEl !== "function") return;
|
|
954
|
+
onPress();
|
|
877
955
|
}
|
|
878
956
|
},
|
|
879
957
|
disabled: isDisabled
|
|
880
958
|
},
|
|
881
|
-
/* @__PURE__ */
|
|
882
|
-
|
|
959
|
+
/* @__PURE__ */ import_react11.default.createElement(
|
|
960
|
+
import_react_native8.Animated.View,
|
|
883
961
|
{
|
|
884
962
|
style: [
|
|
885
963
|
otpStyles.segment,
|
|
@@ -900,16 +978,16 @@ var OTPSegment = ({
|
|
|
900
978
|
customSegment?.segment
|
|
901
979
|
]
|
|
902
980
|
},
|
|
903
|
-
char && isSecured ? /* @__PURE__ */
|
|
904
|
-
|
|
981
|
+
char && isSecured ? /* @__PURE__ */ import_react11.default.createElement(
|
|
982
|
+
import_react_native8.View,
|
|
905
983
|
{
|
|
906
984
|
style: [
|
|
907
985
|
otpStyles.securedDot,
|
|
908
986
|
{ backgroundColor: variantStyles.textColor }
|
|
909
987
|
]
|
|
910
988
|
}
|
|
911
|
-
) : /* @__PURE__ */
|
|
912
|
-
|
|
989
|
+
) : /* @__PURE__ */ import_react11.default.createElement(
|
|
990
|
+
import_react_native8.Text,
|
|
913
991
|
{
|
|
914
992
|
style: [
|
|
915
993
|
otpStyles.segmentText,
|
|
@@ -922,8 +1000,8 @@ var OTPSegment = ({
|
|
|
922
1000
|
},
|
|
923
1001
|
char
|
|
924
1002
|
),
|
|
925
|
-
/* @__PURE__ */
|
|
926
|
-
|
|
1003
|
+
/* @__PURE__ */ import_react11.default.createElement(
|
|
1004
|
+
import_react_native8.TextInput,
|
|
927
1005
|
{
|
|
928
1006
|
ref: inputRef,
|
|
929
1007
|
style: otpStyles.hiddenInput,
|
|
@@ -995,8 +1073,20 @@ var OTPInput = ({
|
|
|
995
1073
|
isInvalid,
|
|
996
1074
|
isDisabled
|
|
997
1075
|
});
|
|
998
|
-
|
|
999
|
-
|
|
1076
|
+
const focusSegment = (0, import_react11.useCallback)(
|
|
1077
|
+
(index) => {
|
|
1078
|
+
if (isDisabled) return;
|
|
1079
|
+
refs.current[index]?.focus();
|
|
1080
|
+
},
|
|
1081
|
+
[isDisabled, refs]
|
|
1082
|
+
);
|
|
1083
|
+
const handleContainerPress = (0, import_react11.useCallback)(() => {
|
|
1084
|
+
const firstEmptyIndex = segments.findIndex((segment) => !segment);
|
|
1085
|
+
const targetIndex = firstEmptyIndex === -1 ? length - 1 : firstEmptyIndex;
|
|
1086
|
+
focusSegment(targetIndex);
|
|
1087
|
+
}, [focusSegment, length, segments]);
|
|
1088
|
+
return /* @__PURE__ */ import_react11.default.createElement(
|
|
1089
|
+
import_react_native8.View,
|
|
1000
1090
|
{
|
|
1001
1091
|
style: [
|
|
1002
1092
|
otpStyles.container,
|
|
@@ -1005,8 +1095,8 @@ var OTPInput = ({
|
|
|
1005
1095
|
customAppearance?.container
|
|
1006
1096
|
]
|
|
1007
1097
|
},
|
|
1008
|
-
label && /* @__PURE__ */
|
|
1009
|
-
|
|
1098
|
+
label && /* @__PURE__ */ import_react11.default.createElement(
|
|
1099
|
+
import_react_native8.Text,
|
|
1010
1100
|
{
|
|
1011
1101
|
style: [
|
|
1012
1102
|
otpStyles.label,
|
|
@@ -1019,12 +1109,14 @@ var OTPInput = ({
|
|
|
1019
1109
|
},
|
|
1020
1110
|
label
|
|
1021
1111
|
),
|
|
1022
|
-
/* @__PURE__ */
|
|
1023
|
-
|
|
1112
|
+
/* @__PURE__ */ import_react11.default.createElement(
|
|
1113
|
+
import_react_native8.Pressable,
|
|
1024
1114
|
{
|
|
1115
|
+
onPress: handleContainerPress,
|
|
1116
|
+
disabled: isDisabled,
|
|
1025
1117
|
style: [otpStyles.segmentContainer, customAppearance?.segmentContainer]
|
|
1026
1118
|
},
|
|
1027
|
-
segments.map((char, index) => /* @__PURE__ */
|
|
1119
|
+
segments.map((char, index) => /* @__PURE__ */ import_react11.default.createElement(
|
|
1028
1120
|
OTPSegment,
|
|
1029
1121
|
{
|
|
1030
1122
|
key: index,
|
|
@@ -1043,12 +1135,13 @@ var OTPInput = ({
|
|
|
1043
1135
|
onChangeText: (text) => handleSegmentChange(index, text),
|
|
1044
1136
|
onKeyPress: (key) => handleSegmentKeyPress(index, key),
|
|
1045
1137
|
onFocus: () => handleSegmentFocus(index),
|
|
1046
|
-
onBlur: handleSegmentBlur
|
|
1138
|
+
onBlur: handleSegmentBlur,
|
|
1139
|
+
onPress: () => focusSegment(index)
|
|
1047
1140
|
}
|
|
1048
1141
|
))
|
|
1049
1142
|
),
|
|
1050
|
-
helperText && /* @__PURE__ */
|
|
1051
|
-
|
|
1143
|
+
helperText && /* @__PURE__ */ import_react11.default.createElement(
|
|
1144
|
+
import_react_native8.Text,
|
|
1052
1145
|
{
|
|
1053
1146
|
style: [
|
|
1054
1147
|
otpStyles.helperText,
|
|
@@ -1063,13 +1156,13 @@ var OTPInput = ({
|
|
|
1063
1156
|
OTPInput.displayName = "OTPInput";
|
|
1064
1157
|
|
|
1065
1158
|
// src/components/input/number-input.tsx
|
|
1066
|
-
var
|
|
1067
|
-
var
|
|
1159
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
1160
|
+
var import_react_native10 = require("react-native");
|
|
1068
1161
|
var import_icons2 = require("@xaui/icons");
|
|
1069
1162
|
var import_core3 = require("@xaui/core");
|
|
1070
1163
|
|
|
1071
1164
|
// src/components/input/number-input.hook.ts
|
|
1072
|
-
var
|
|
1165
|
+
var import_react12 = require("react");
|
|
1073
1166
|
var useNumberInputState = ({
|
|
1074
1167
|
value,
|
|
1075
1168
|
defaultValue,
|
|
@@ -1081,23 +1174,23 @@ var useNumberInputState = ({
|
|
|
1081
1174
|
locale
|
|
1082
1175
|
}) => {
|
|
1083
1176
|
const isControlled = typeof value === "number";
|
|
1084
|
-
const [internalValue, setInternalValue] = (0,
|
|
1177
|
+
const [internalValue, setInternalValue] = (0, import_react12.useState)(
|
|
1085
1178
|
defaultValue
|
|
1086
1179
|
);
|
|
1087
|
-
const [isEditing, setIsEditing] = (0,
|
|
1088
|
-
const [rawText, setRawText] = (0,
|
|
1180
|
+
const [isEditing, setIsEditing] = (0, import_react12.useState)(false);
|
|
1181
|
+
const [rawText, setRawText] = (0, import_react12.useState)("");
|
|
1089
1182
|
const currentValue = isControlled ? value : internalValue;
|
|
1090
|
-
const formatter = (0,
|
|
1183
|
+
const formatter = (0, import_react12.useMemo)(() => {
|
|
1091
1184
|
if (!formatOptions) return null;
|
|
1092
1185
|
return new Intl.NumberFormat(locale, formatOptions);
|
|
1093
1186
|
}, [formatOptions, locale]);
|
|
1094
|
-
const displayValue = (0,
|
|
1187
|
+
const displayValue = (0, import_react12.useMemo)(() => {
|
|
1095
1188
|
if (isEditing) return rawText;
|
|
1096
1189
|
if (currentValue === void 0) return "";
|
|
1097
1190
|
if (formatter) return formatter.format(currentValue);
|
|
1098
1191
|
return String(currentValue);
|
|
1099
1192
|
}, [currentValue, formatter, isEditing, rawText]);
|
|
1100
|
-
const updateValue = (0,
|
|
1193
|
+
const updateValue = (0, import_react12.useCallback)(
|
|
1101
1194
|
(newValue) => {
|
|
1102
1195
|
if (!isControlled) {
|
|
1103
1196
|
setInternalValue(newValue);
|
|
@@ -1106,7 +1199,7 @@ var useNumberInputState = ({
|
|
|
1106
1199
|
},
|
|
1107
1200
|
[isControlled, onValueChange]
|
|
1108
1201
|
);
|
|
1109
|
-
const clamp = (0,
|
|
1202
|
+
const clamp = (0, import_react12.useCallback)(
|
|
1110
1203
|
(num) => {
|
|
1111
1204
|
let clamped = num;
|
|
1112
1205
|
if (minValue !== void 0 && clamped < minValue) clamped = minValue;
|
|
@@ -1115,7 +1208,7 @@ var useNumberInputState = ({
|
|
|
1115
1208
|
},
|
|
1116
1209
|
[minValue, maxValue]
|
|
1117
1210
|
);
|
|
1118
|
-
const handleTextChange = (0,
|
|
1211
|
+
const handleTextChange = (0, import_react12.useCallback)(
|
|
1119
1212
|
(text) => {
|
|
1120
1213
|
setRawText(text);
|
|
1121
1214
|
if (text === "" || text === "-") return;
|
|
@@ -1125,11 +1218,11 @@ var useNumberInputState = ({
|
|
|
1125
1218
|
},
|
|
1126
1219
|
[updateValue]
|
|
1127
1220
|
);
|
|
1128
|
-
const handleFocus = (0,
|
|
1221
|
+
const handleFocus = (0, import_react12.useCallback)(() => {
|
|
1129
1222
|
setIsEditing(true);
|
|
1130
1223
|
setRawText(currentValue !== void 0 ? String(currentValue) : "");
|
|
1131
1224
|
}, [currentValue]);
|
|
1132
|
-
const handleBlur = (0,
|
|
1225
|
+
const handleBlur = (0, import_react12.useCallback)(() => {
|
|
1133
1226
|
setIsEditing(false);
|
|
1134
1227
|
if (rawText === "" || rawText === "-") {
|
|
1135
1228
|
updateValue(void 0);
|
|
@@ -1142,18 +1235,18 @@ var useNumberInputState = ({
|
|
|
1142
1235
|
}
|
|
1143
1236
|
updateValue(clamp(parsed));
|
|
1144
1237
|
}, [rawText, clamp, updateValue]);
|
|
1145
|
-
const handleClear = (0,
|
|
1238
|
+
const handleClear = (0, import_react12.useCallback)(() => {
|
|
1146
1239
|
setRawText("");
|
|
1147
1240
|
updateValue(void 0);
|
|
1148
1241
|
}, [updateValue]);
|
|
1149
1242
|
const canIncrement = maxValue === void 0 || (currentValue ?? 0) + step <= maxValue;
|
|
1150
1243
|
const canDecrement = minValue === void 0 || (currentValue ?? 0) - step >= minValue;
|
|
1151
|
-
const handleIncrement = (0,
|
|
1244
|
+
const handleIncrement = (0, import_react12.useCallback)(() => {
|
|
1152
1245
|
const base = currentValue ?? 0;
|
|
1153
1246
|
const newValue = clamp(base + step);
|
|
1154
1247
|
updateValue(newValue);
|
|
1155
1248
|
}, [currentValue, step, clamp, updateValue]);
|
|
1156
|
-
const handleDecrement = (0,
|
|
1249
|
+
const handleDecrement = (0, import_react12.useCallback)(() => {
|
|
1157
1250
|
const base = currentValue ?? 0;
|
|
1158
1251
|
const newValue = clamp(base - step);
|
|
1159
1252
|
updateValue(newValue);
|
|
@@ -1172,8 +1265,8 @@ var useNumberInputState = ({
|
|
|
1172
1265
|
};
|
|
1173
1266
|
|
|
1174
1267
|
// src/components/input/number-input.style.ts
|
|
1175
|
-
var
|
|
1176
|
-
var numberInputStyles =
|
|
1268
|
+
var import_react_native9 = require("react-native");
|
|
1269
|
+
var numberInputStyles = import_react_native9.StyleSheet.create({
|
|
1177
1270
|
stepperContainer: {
|
|
1178
1271
|
flexDirection: "row",
|
|
1179
1272
|
alignItems: "center",
|
|
@@ -1192,7 +1285,7 @@ var numberInputStyles = import_react_native8.StyleSheet.create({
|
|
|
1192
1285
|
});
|
|
1193
1286
|
|
|
1194
1287
|
// src/components/input/number-input.tsx
|
|
1195
|
-
var NumberInput = (0,
|
|
1288
|
+
var NumberInput = (0, import_react13.forwardRef)(
|
|
1196
1289
|
({
|
|
1197
1290
|
value,
|
|
1198
1291
|
defaultValue,
|
|
@@ -1240,16 +1333,16 @@ var NumberInput = (0, import_react12.forwardRef)(
|
|
|
1240
1333
|
locale
|
|
1241
1334
|
});
|
|
1242
1335
|
const iconColor = (0, import_core3.withOpacity)(theme.colors.foreground, 0.7);
|
|
1243
|
-
const stepperContent = hideStepper || isReadOnly ? void 0 : /* @__PURE__ */
|
|
1244
|
-
|
|
1336
|
+
const stepperContent = hideStepper || isReadOnly ? void 0 : /* @__PURE__ */ import_react13.default.createElement(
|
|
1337
|
+
import_react_native10.View,
|
|
1245
1338
|
{
|
|
1246
1339
|
style: [
|
|
1247
1340
|
numberInputStyles.stepperContainer,
|
|
1248
1341
|
customAppearance?.stepperContainer
|
|
1249
1342
|
]
|
|
1250
1343
|
},
|
|
1251
|
-
/* @__PURE__ */
|
|
1252
|
-
|
|
1344
|
+
/* @__PURE__ */ import_react13.default.createElement(
|
|
1345
|
+
import_react_native10.Pressable,
|
|
1253
1346
|
{
|
|
1254
1347
|
onPress: handleDecrement,
|
|
1255
1348
|
disabled: isDisabled || !canDecrement,
|
|
@@ -1261,10 +1354,10 @@ var NumberInput = (0, import_react12.forwardRef)(
|
|
|
1261
1354
|
customAppearance?.stepperButton
|
|
1262
1355
|
]
|
|
1263
1356
|
},
|
|
1264
|
-
/* @__PURE__ */
|
|
1357
|
+
/* @__PURE__ */ import_react13.default.createElement(import_icons2.RemoveIcon, { size: 16, color: iconColor })
|
|
1265
1358
|
),
|
|
1266
|
-
/* @__PURE__ */
|
|
1267
|
-
|
|
1359
|
+
/* @__PURE__ */ import_react13.default.createElement(
|
|
1360
|
+
import_react_native10.Pressable,
|
|
1268
1361
|
{
|
|
1269
1362
|
onPress: handleIncrement,
|
|
1270
1363
|
disabled: isDisabled || !canIncrement,
|
|
@@ -1276,10 +1369,10 @@ var NumberInput = (0, import_react12.forwardRef)(
|
|
|
1276
1369
|
customAppearance?.stepperButton
|
|
1277
1370
|
]
|
|
1278
1371
|
},
|
|
1279
|
-
/* @__PURE__ */
|
|
1372
|
+
/* @__PURE__ */ import_react13.default.createElement(import_icons2.AddIcon, { size: 16, color: iconColor })
|
|
1280
1373
|
)
|
|
1281
1374
|
);
|
|
1282
|
-
return /* @__PURE__ */
|
|
1375
|
+
return /* @__PURE__ */ import_react13.default.createElement(
|
|
1283
1376
|
TextInput,
|
|
1284
1377
|
{
|
|
1285
1378
|
ref,
|
|
@@ -1315,6 +1408,7 @@ NumberInput.displayName = "NumberInput";
|
|
|
1315
1408
|
DateTimeInput,
|
|
1316
1409
|
NumberInput,
|
|
1317
1410
|
OTPInput,
|
|
1411
|
+
TextArea,
|
|
1318
1412
|
TextInput,
|
|
1319
1413
|
TimeInput,
|
|
1320
1414
|
getDateOrder
|