sapo-components-ui-rn 1.0.63 → 1.0.65

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/index.esm.js CHANGED
@@ -1,8 +1,9 @@
1
- import { Platform, Dimensions, StyleSheet, useColorScheme, Animated, Easing, View as View$1, I18nManager, TouchableOpacity, NativeModules, Switch as Switch$1, Text as Text$2, Pressable, useWindowDimensions, TextInput as TextInput$1, Modal, ActivityIndicator as ActivityIndicator$1, ImageBackground, Image as Image$2 } from 'react-native';
1
+ import { Platform, Dimensions, StyleSheet, useColorScheme, Animated, Easing, View as View$1, I18nManager, TouchableOpacity, Text as Text$2, Pressable, useWindowDimensions, TextInput as TextInput$1, Modal, ActivityIndicator as ActivityIndicator$1, ImageBackground, Image as Image$2 } from 'react-native';
2
2
  import * as React$3 from 'react';
3
- import React__default, { memo, forwardRef as forwardRef$1, useMemo, useState, useEffect, useRef, useImperativeHandle, useCallback } from 'react';
3
+ import React__default, { memo, useCallback, forwardRef as forwardRef$1, useMemo, useState, useEffect, useRef, useImperativeHandle } from 'react';
4
4
  import require$$1 from 'deepmerge';
5
5
  import color from 'color';
6
+ import Animated$1, { useSharedValue, withSequence, withTiming, withSpring, useAnimatedStyle, interpolateColor, useAnimatedReaction } from 'react-native-reanimated';
6
7
  import FontAwesome from 'react-native-vector-icons/FontAwesome';
7
8
  import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
8
9
  import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
@@ -1708,7 +1709,7 @@ var ActivityIndicator = function (_a) {
1708
1709
  height: size / 2,
1709
1710
  overflow: "hidden",
1710
1711
  };
1711
- return (React$3.createElement(View$1, __assign({ style: [styles$i.container, style] }, rest, { accessible: true, accessibilityRole: "progressbar", accessibilityState: { busy: animating } }),
1712
+ return (React$3.createElement(View$1, __assign({ style: [styles$k.container, style] }, rest, { accessible: true, accessibilityRole: "progressbar", accessibilityState: { busy: animating } }),
1712
1713
  React$3.createElement(Animated.View, { style: [{ width: size, height: size, opacity: fade }], collapsable: false }, [0, 1].map(function (index) {
1713
1714
  // Thanks to https://github.com/n4kz/react-native-indicators for the great work
1714
1715
  var inputRange = Array.from(new Array(frames), function (_, frameIndex) { return frameIndex / (frames - 1); });
@@ -1753,7 +1754,7 @@ var ActivityIndicator = function (_a) {
1753
1754
  borderWidth: size / 10,
1754
1755
  borderRadius: size / 2,
1755
1756
  };
1756
- return (React$3.createElement(Animated.View, { key: index, style: [styles$i.layer] },
1757
+ return (React$3.createElement(Animated.View, { key: index, style: [styles$k.layer] },
1757
1758
  React$3.createElement(Animated.View, { style: layerStyle },
1758
1759
  React$3.createElement(Animated.View, { style: [containerStyle, offsetStyle], collapsable: false },
1759
1760
  React$3.createElement(Animated.View, { style: viewportStyle },
@@ -1761,7 +1762,7 @@ var ActivityIndicator = function (_a) {
1761
1762
  React$3.createElement(Animated.View, { style: lineStyle })))))));
1762
1763
  }))));
1763
1764
  };
1764
- var styles$i = StyleSheet.create({
1765
+ var styles$k = StyleSheet.create({
1765
1766
  container: {
1766
1767
  justifyContent: "center",
1767
1768
  alignItems: "center",
@@ -1869,11 +1870,11 @@ var ProgressBar = function (_a) {
1869
1870
  ? {}
1870
1871
  : { min: 0, max: 100, now: Math.round(progress * 100) }, testID: testID }),
1871
1872
  React$3.createElement(Animated.View, { style: [
1872
- styles$h.container,
1873
+ styles$j.container,
1873
1874
  { backgroundColor: trackTintColor, opacity: fade },
1874
1875
  style,
1875
1876
  ] }, width ? (React$3.createElement(Animated.View, { testID: "".concat(testID, "-fill"), style: [
1876
- styles$h.progressBar,
1877
+ styles$j.progressBar,
1877
1878
  {
1878
1879
  width: width,
1879
1880
  backgroundColor: tintColor,
@@ -1917,7 +1918,7 @@ var ProgressBar = function (_a) {
1917
1918
  fillStyle,
1918
1919
  ] })) : null)));
1919
1920
  };
1920
- var styles$h = StyleSheet.create({
1921
+ var styles$j = StyleSheet.create({
1921
1922
  container: {
1922
1923
  height: 4,
1923
1924
  overflow: "hidden",
@@ -2055,109 +2056,86 @@ var ViewCustom = function (_a) {
2055
2056
  };
2056
2057
  var View = React__default.memo(ViewCustom);
2057
2058
 
2058
- var getCheckedColor = function (_a) {
2059
- var theme = _a.theme, color = _a.color;
2060
- if (color) {
2061
- return color;
2062
- }
2063
- return theme.colors.toggleBackgroundActive;
2064
- };
2065
- var getThumbTintColor = function (_a) {
2066
- var theme = _a.theme, disabled = _a.disabled, value = _a.value, checkedColor = _a.checkedColor;
2067
- var isIOS = Platform.OS === "ios";
2068
- if (isIOS) {
2069
- return undefined;
2070
- }
2071
- if (disabled) {
2072
- if (theme.dark) {
2073
- return theme.colors.toggleBackgroundDefault;
2074
- }
2075
- return theme.colors.toggleBackgroundDefault;
2076
- }
2077
- if (value) {
2078
- return checkedColor;
2079
- }
2080
- if (theme.dark) {
2081
- return theme.colors.toggleBackgroundDefault;
2082
- }
2083
- return theme.colors.toggleBackgroundDefault;
2084
- };
2085
- var getOnTintColor = function (_a) {
2086
- var theme = _a.theme, disabled = _a.disabled, value = _a.value, checkedColor = _a.checkedColor;
2087
- var isIOS = Platform.OS === "ios";
2088
- if (isIOS) {
2089
- return checkedColor;
2090
- }
2091
- if (disabled) {
2092
- if (theme.dark) {
2093
- return theme.colors.toggleBackgroundDefault;
2094
- }
2095
- return theme.colors.toggleBackgroundDefault;
2096
- }
2097
- if (value) {
2098
- return checkedColor;
2099
- }
2100
- if (theme.dark) {
2101
- return theme.colors.toggleBackgroundDefault;
2102
- }
2103
- return theme.colors.toggleBackgroundDefault;
2104
- };
2105
- var getSwitchColor = function (_a) {
2106
- var theme = _a.theme, disabled = _a.disabled, value = _a.value, color = _a.color;
2107
- var checkedColor = getCheckedColor({ theme: theme, color: color });
2108
- return {
2109
- onTintColor: getOnTintColor({ theme: theme, disabled: disabled, value: value, checkedColor: checkedColor }),
2110
- thumbTintColor: getThumbTintColor({ theme: theme, disabled: disabled, value: value, checkedColor: checkedColor }),
2111
- checkedColor: checkedColor,
2112
- };
2113
- };
2114
-
2115
- var version = NativeModules.PlatformConstants
2116
- ? NativeModules.PlatformConstants.reactNativeVersion
2117
- : undefined;
2118
- /**
2119
- * Switch is a visual toggle between two mutually exclusive states — on and off.
2120
- *
2121
- * ## Usage
2122
- * ```js
2123
- * import * as React from 'react';
2124
- * import { Switch } from 'react-native-paper';
2125
- *
2126
- * const MyComponent = () => {
2127
- * const [isSwitchOn, setIsSwitchOn] = React.useState(false);
2128
- *
2129
- * const onToggleSwitch = () => setIsSwitchOn(!isSwitchOn);
2130
- *
2131
- * return <Switch value={isSwitchOn} onValueChange={onToggleSwitch} />;
2132
- * };
2133
- *
2134
- * export default MyComponent;
2135
- * ```
2136
- */
2137
- var Switch = function (_a) {
2138
- var value = _a.value, disabled = _a.disabled, onValueChange = _a.onValueChange, color = _a.color; _a.theme; var rest = __rest(_a, ["value", "disabled", "onValueChange", "color", "theme"]);
2059
+ var Switch = memo(function (_a) {
2060
+ var value = _a.value, disabled = _a.disabled, onValueChange = _a.onValueChange;
2139
2061
  var theme = useInternalTheme();
2140
- var _b = getSwitchColor({
2141
- theme: theme,
2142
- disabled: disabled,
2143
- value: value,
2144
- color: color,
2145
- }), onTintColor = _b.onTintColor, thumbTintColor = _b.thumbTintColor;
2146
- var props = version && version.major === 0 && version.minor <= 56
2147
- ? {
2148
- onTintColor: onTintColor,
2149
- thumbTintColor: thumbTintColor,
2150
- }
2151
- : {
2152
- thumbColor: thumbTintColor,
2153
- trackColor: {
2154
- true: onTintColor,
2155
- false: onTintColor,
2156
- },
2062
+ var colors = theme.colors;
2063
+ var progress = useSharedValue(value ? 1 : 0);
2064
+ var handleSwitch = useCallback(function () {
2065
+ if (disabled)
2066
+ return;
2067
+ var newValue = !value;
2068
+ progress.value = withSequence(withTiming(newValue ? 1 : 0, {
2069
+ duration: 150,
2070
+ }), withSpring(newValue ? 1 : 0, {
2071
+ damping: 20,
2072
+ stiffness: 200,
2073
+ mass: 0.5,
2074
+ velocity: 0.5,
2075
+ }));
2076
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue);
2077
+ }, [disabled, value, onValueChange]);
2078
+ var animatedStyle = useAnimatedStyle(function () {
2079
+ return {
2080
+ transform: [{ translateX: progress.value * 20 }],
2081
+ };
2082
+ });
2083
+ var backgroundColor = useAnimatedStyle(function () {
2084
+ return {
2085
+ backgroundColor: interpolateColor(progress.value, [0, 1], [colors.toggleBackgroundDefault, colors.toggleBackgroundActive]),
2157
2086
  };
2087
+ });
2088
+ useAnimatedReaction(function () { return value; }, function (currentValue) {
2089
+ if (currentValue !== undefined) {
2090
+ progress.value = withSequence(withTiming(currentValue ? 1 : 0, {
2091
+ duration: 150,
2092
+ }), withSpring(currentValue ? 1 : 0, {
2093
+ damping: 20,
2094
+ stiffness: 200,
2095
+ mass: 0.5,
2096
+ velocity: 0.5,
2097
+ }));
2098
+ }
2099
+ }, [value]);
2158
2100
  return (React$3.createElement(View, { row: true },
2159
- React$3.createElement(Switch$1, __assign({ value: value, disabled: disabled, onValueChange: disabled ? undefined : onValueChange }, props, rest))));
2160
- };
2101
+ React$3.createElement(TouchableOpacity, { activeOpacity: 1, onPress: handleSwitch, disabled: disabled, style: disabled ? { opacity: 0.6 } : {} },
2102
+ React$3.createElement(Animated$1.View, { style: [
2103
+ styles$i.vSegment,
2104
+ backgroundColor,
2105
+ {
2106
+ width: 52,
2107
+ height: 32,
2108
+ },
2109
+ ] },
2110
+ React$3.createElement(Animated$1.View, { style: [
2111
+ styles$i.animated,
2112
+ animatedStyle,
2113
+ {
2114
+ width: 28,
2115
+ height: 28,
2116
+ borderRadius: 14,
2117
+ backgroundColor: colors.surfacePrimaryDefault,
2118
+ },
2119
+ ] })))));
2120
+ });
2121
+ var styles$i = StyleSheet.create({
2122
+ vSegment: {
2123
+ overflow: "hidden",
2124
+ borderRadius: 100,
2125
+ flexDirection: "row",
2126
+ alignItems: "center",
2127
+ },
2128
+ animated: {
2129
+ position: "absolute",
2130
+ // shadowColor: "#000000",
2131
+ // shadowOffset: { width: 0, height: 0 },
2132
+ // shadowOpacity: 0.15,
2133
+ // shadowRadius: BORDER_RADIUS_6,
2134
+ // elevation: 5,
2135
+ marginHorizontal: 2,
2136
+ },
2137
+ });
2138
+ Switch.displayName = "Switch";
2161
2139
 
2162
2140
  var AdornmentType;
2163
2141
  (function (AdornmentType) {
@@ -2516,7 +2494,7 @@ var TextInputAffix = function (_a) {
2516
2494
  var textColor = getTextColor({ theme: theme, disabled: disabled });
2517
2495
  var content = (React__default.createElement(Text$2, { maxFontSizeMultiplier: maxFontSizeMultiplier, style: [{ color: textColor }, textStyle, labelStyle], onLayout: onTextLayout, testID: "".concat(testID, "-text") }, text));
2518
2496
  return (React__default.createElement(Animated.View, { style: [
2519
- styles$g.container,
2497
+ styles$h.container,
2520
2498
  style,
2521
2499
  {
2522
2500
  opacity: (visible === null || visible === void 0 ? void 0 : visible.interpolate({
@@ -2527,7 +2505,7 @@ var TextInputAffix = function (_a) {
2527
2505
  ], onLayout: onLayout, testID: testID }, onPress ? (React__default.createElement(Pressable, { onPress: onPress, accessibilityRole: "button", accessibilityLabel: accessibilityLabel }, content)) : (content)));
2528
2506
  };
2529
2507
  TextInputAffix.displayName = "TextInput.Affix";
2530
- var styles$g = StyleSheet.create({
2508
+ var styles$h = StyleSheet.create({
2531
2509
  container: {
2532
2510
  position: "absolute",
2533
2511
  justifyContent: "center",
@@ -2585,13 +2563,13 @@ var AnimatedText = forwardRef(function AnimatedText(_a, ref) {
2585
2563
  }
2586
2564
  return (React$3.createElement(Animated.Text, __assign({ ref: ref }, rest, { style: [
2587
2565
  font,
2588
- styles$f.text,
2566
+ styles$g.text,
2589
2567
  { writingDirection: writingDirection, color: theme.colors.backgroundPrimary },
2590
2568
  style,
2591
2569
  ] })));
2592
2570
  }
2593
2571
  });
2594
- var styles$f = StyleSheet.create({
2572
+ var styles$g = StyleSheet.create({
2595
2573
  text: {
2596
2574
  textAlign: "left",
2597
2575
  },
@@ -5167,7 +5145,7 @@ var InputLabel = function (props) {
5167
5145
  return (
5168
5146
  // Position colored placeholder and gray placeholder on top of each other and crossfade them
5169
5147
  // This gives the effect of animating the color, but allows us to use native driver
5170
- React__default.createElement(View$1, { pointerEvents: "none", style: [StyleSheet.absoluteFill, styles$e.overflow, styles$e.labelContainer] },
5148
+ React__default.createElement(View$1, { pointerEvents: "none", style: [StyleSheet.absoluteFill, styles$f.overflow, styles$f.labelContainer] },
5171
5149
  React__default.createElement(Animated.View, { pointerEvents: "none", style: [
5172
5150
  StyleSheet.absoluteFill,
5173
5151
  Platform.OS !== "web" && { width: width },
@@ -5209,7 +5187,7 @@ var InputLabel = function (props) {
5209
5187
  label,
5210
5188
  required && React__default.createElement(Text$1, { color: theme.colors.textErrorDefault }, " *"))))));
5211
5189
  };
5212
- var styles$e = StyleSheet.create({
5190
+ var styles$f = StyleSheet.create({
5213
5191
  overflow: {
5214
5192
  overflow: "hidden",
5215
5193
  },
@@ -5222,8 +5200,8 @@ var InputLabel$1 = React__default.memo(InputLabel);
5222
5200
  var Outline = function (_a) {
5223
5201
  var label = _a.label; _a.activeColor; _a.backgroundColor; _a.hasActiveOutline; _a.focused; _a.outlineColor; _a.roundness; var style = _a.style;
5224
5202
  return (React$3.createElement(View$1, { testID: "text-input-outline", pointerEvents: "none", style: [
5225
- styles$d.outline,
5226
- !label && styles$d.noLabelOutline,
5203
+ styles$e.outline,
5204
+ !label && styles$e.noLabelOutline,
5227
5205
  // eslint-disable-next-line react-native/no-inline-styles
5228
5206
  {
5229
5207
  // backgroundColor,
@@ -5234,7 +5212,7 @@ var Outline = function (_a) {
5234
5212
  style,
5235
5213
  ] }));
5236
5214
  };
5237
- var styles$d = StyleSheet.create({
5215
+ var styles$e = StyleSheet.create({
5238
5216
  outline: {
5239
5217
  position: "absolute",
5240
5218
  left: 0,
@@ -5480,7 +5458,7 @@ var TextInputFlat = function (_a) {
5480
5458
  label: label,
5481
5459
  scale: fontScale,
5482
5460
  isAndroid: isAndroid,
5483
- styles: StyleSheet.flatten(dense ? styles$c.inputFlatDense : styles$c.inputFlat),
5461
+ styles: StyleSheet.flatten(dense ? styles$d.inputFlatDense : styles$d.inputFlat),
5484
5462
  };
5485
5463
  var pad = calculatePadding(paddingSettings);
5486
5464
  adjustPaddingFlat(__assign(__assign({}, paddingSettings), { pad: pad }));
@@ -5506,7 +5484,7 @@ var TextInputFlat = function (_a) {
5506
5484
  onLabelTextLayout: onLabelTextLayout,
5507
5485
  placeholderOpacity: placeholderOpacity,
5508
5486
  labelError: error,
5509
- placeholderStyle: styles$c.placeholder,
5487
+ placeholderStyle: styles$d.placeholder,
5510
5488
  baseLabelTranslateY: baseLabelTranslateY,
5511
5489
  baseLabelTranslateX: baseLabelTranslateX,
5512
5490
  font: font,
@@ -5592,7 +5570,7 @@ var TextInputFlat = function (_a) {
5592
5570
  left ? React$3.createElement(Spacer, { width: SPACE_8 }) : React$3.createElement(Spacer, { width: SPACE_12 })),
5593
5571
  React$3.createElement(Outline, { style: outlineStyle, label: label, roundness: roundness, hasActiveOutline: hasActiveOutline, focused: parentState.focused, activeColor: activeColor, outlineColor: outlineColor, backgroundColor: backgroundColor }),
5594
5572
  React$3.createElement(View$1, { onLayout: onInputLayout, style: [
5595
- styles$c.labelContainer,
5573
+ styles$d.labelContainer,
5596
5574
  {
5597
5575
  minHeight: minHeight,
5598
5576
  flex: 1,
@@ -5602,7 +5580,7 @@ var TextInputFlat = function (_a) {
5602
5580
  React$3.createElement(View$1, { style: { flexDirection: "row", alignItems: "flex-end" } },
5603
5581
  renderPrefix(), render === null || render === void 0 ? void 0 :
5604
5582
  render(__assign(__assign({}, rest), { ref: innerRef, onChangeText: handleChangeText, value: inputValue, placeholder: rest.placeholder, editable: !disabled && editable, selectionColor: selectionColor, cursorColor: typeof cursorColor === "undefined" ? activeColor : cursorColor, placeholderTextColor: placeholderTextColorBasedOnState, onFocus: onFocus, onBlur: onBlur, underlineColorAndroid: "transparent", multiline: multiline, style: [
5605
- styles$c.input,
5583
+ styles$d.input,
5606
5584
  __assign(__assign({ paddingLeft: paddingLeft, paddingRight: paddingRight, paddingTop: parentState.focused || parentState.value ? SPACE_12 : 0 }, font), { fontSize: fontSize, lineHeight: lineHeight, fontWeight: fontWeight, color: inputTextColor, textAlignVertical: multiline ? "top" : "center", textAlign: textAlign
5607
5585
  ? textAlign
5608
5586
  : I18nManager.getConstants().isRTL
@@ -5610,7 +5588,7 @@ var TextInputFlat = function (_a) {
5610
5588
  : "left", marginTop: Platform.OS === "android" ? SPACE_8 : SPACE_2 }),
5611
5589
  contentStyle,
5612
5590
  ] })))),
5613
- !disabled && clearButton && inputValue ? (React$3.createElement(TouchableOpacity, { onPress: handleClear, style: styles$c.clearButton },
5591
+ !disabled && clearButton && inputValue ? (React$3.createElement(TouchableOpacity, { onPress: handleClear, style: styles$d.clearButton },
5614
5592
  React$3.createElement(Icon$1, { name: "IconClearText", type: "Svg", size: 24 }))) : (React$3.createElement(Spacer, { width: SPACE_12 })),
5615
5593
  React$3.createElement(View$1, { style: {
5616
5594
  flexDirection: "row",
@@ -5621,10 +5599,10 @@ var TextInputFlat = function (_a) {
5621
5599
  right && (React$3.createElement(View$1, { style: {
5622
5600
  paddingRight: SPACE_12,
5623
5601
  } }, right)))),
5624
- error && (textError === null || textError === void 0 ? void 0 : textError.toString()) !== "" && (React$3.createElement(View$1, { style: styles$c.vError },
5602
+ error && (textError === null || textError === void 0 ? void 0 : textError.toString()) !== "" && (React$3.createElement(View$1, { style: styles$d.vError },
5625
5603
  React$3.createElement(Text$1, { size: 12, numberOfLines: 1, color: theme.colors.textErrorDefault }, textError)))));
5626
5604
  };
5627
- var styles$c = StyleSheet.create({
5605
+ var styles$d = StyleSheet.create({
5628
5606
  placeholder: {
5629
5607
  position: "absolute",
5630
5608
  left: 0,
@@ -5780,7 +5758,7 @@ var TextInputDefault = function (_a) {
5780
5758
  ? rest.placeholder
5781
5759
  : label
5782
5760
  : rest.placeholder, editable: !disabled && editable, selectionColor: selectionColor, cursorColor: typeof cursorColor === "undefined" ? activeColor : cursorColor, placeholderTextColor: placeholderTextColorBasedOnState, onFocus: onFocus, onBlur: onBlur, underlineColorAndroid: "transparent", multiline: multiline, style: [
5783
- styles$b.input,
5761
+ styles$c.input,
5784
5762
  __assign(__assign({}, font), { fontSize: fontSize, lineHeight: lineHeight, fontWeight: fontWeight, color: inputTextColor, textAlignVertical: multiline ? "top" : "center", textAlign: textAlign
5785
5763
  ? textAlign
5786
5764
  : I18nManager.getConstants().isRTL
@@ -5788,17 +5766,17 @@ var TextInputDefault = function (_a) {
5788
5766
  : "left", height: height ? height : 48, paddingTop: getPaddingTopValue(), paddingBottom: multiline ? CONSTANTS.SPACE_4 : 0 }),
5789
5767
  contentStyle,
5790
5768
  ] }))),
5791
- !disabled && clearButton && inputValue ? (React$3.createElement(TouchableOpacity, { onPress: handleClear, style: multiline ? styles$b.clearButtonMultiline : styles$b.clearButton },
5769
+ !disabled && clearButton && inputValue ? (React$3.createElement(TouchableOpacity, { onPress: handleClear, style: multiline ? styles$c.clearButtonMultiline : styles$c.clearButton },
5792
5770
  React$3.createElement(Icon$1, { name: "IconClearText", type: "Svg", size: 24 }))) : (React$3.createElement(Spacer, { width: CONSTANTS.SPACE_12 })),
5793
5771
  right && !clearButton && React$3.createElement(Spacer, { width: CONSTANTS.SPACE_2 }),
5794
5772
  right && (React$3.createElement(View, { style: {
5795
5773
  height: "100%",
5796
5774
  paddingRight: CONSTANTS.SPACE_12,
5797
5775
  } }, right))),
5798
- error && (textError === null || textError === void 0 ? void 0 : textError.toString()) !== "" && (React$3.createElement(View, { style: styles$b.vError },
5776
+ error && (textError === null || textError === void 0 ? void 0 : textError.toString()) !== "" && (React$3.createElement(View, { style: styles$c.vError },
5799
5777
  React$3.createElement(Text$1, { size: 12, numberOfLines: 1, color: theme.colors.textErrorDefault }, textError)))));
5800
5778
  };
5801
- var styles$b = StyleSheet.create({
5779
+ var styles$c = StyleSheet.create({
5802
5780
  input: {
5803
5781
  margin: 0,
5804
5782
  flex: 1,
@@ -5949,7 +5927,7 @@ var containerStyles = StyleSheet.create({
5949
5927
  },
5950
5928
  });
5951
5929
 
5952
- function formatNumberInput(value, formatDecimal) {
5930
+ function formatNumberInput$1(value, formatDecimal) {
5953
5931
  if (!value)
5954
5932
  return "0";
5955
5933
  // Xử lý số âm
@@ -6069,11 +6047,11 @@ var TextInputNumber = function (_a) {
6069
6047
  return (React__default.createElement(View, null,
6070
6048
  React__default.createElement(ScaleButton$1, __assign({ activeOpacity: 0.8, onPress: onShowModalKeyboard }, props, { disabled: disabled || false }),
6071
6049
  React__default.createElement(View, { style: [
6072
- styles$a.container,
6050
+ styles$b.container,
6073
6051
  {
6074
6052
  borderRadius: BORDER_RADIUS_6,
6075
6053
  },
6076
- [styles$a.border, { borderColor: colors.borderPrimaryDefault }],
6054
+ [styles$b.border, { borderColor: colors.borderPrimaryDefault }],
6077
6055
  textError.length > 0 && [
6078
6056
  {
6079
6057
  borderColor: colors.borderErrorDefault,
@@ -6081,7 +6059,7 @@ var TextInputNumber = function (_a) {
6081
6059
  },
6082
6060
  ],
6083
6061
  disabled && [
6084
- styles$a.disabled,
6062
+ styles$b.disabled,
6085
6063
  {
6086
6064
  borderColor: colors.borderPrimaryDisabled,
6087
6065
  backgroundColor: colors.surfacePrimaryDisabled,
@@ -6109,7 +6087,7 @@ var TextInputNumber = function (_a) {
6109
6087
  React__default.createElement(Text$1, { numberOfLines: 1, color: getColorValue, style: [disabled && disabledTextStyle] },
6110
6088
  checkValueEmpty()
6111
6089
  ? label
6112
- : formatNumberInput(numberValue, formatDecimal),
6090
+ : formatNumberInput$1(numberValue, formatDecimal),
6113
6091
  checkValueEmpty() && required && (React__default.createElement(Text$1, { color: colors.textErrorDefault }, " *")))))),
6114
6092
  clearButton && !checkValueEmpty() && (React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, onPress: handleClearInput },
6115
6093
  React__default.createElement(Icon$1, { name: "IconClearText", type: "Svg", size: 24 }))),
@@ -6118,41 +6096,41 @@ var TextInputNumber = function (_a) {
6118
6096
  !disabled && textError.length > 0 && (React__default.createElement(View, { paddingHorizontal: SPACE_12, paddingVertical: SPACE_4 },
6119
6097
  React__default.createElement(Text$1, { size: 12, numberOfLines: 1, color: theme.colors.textErrorDefault }, textError))),
6120
6098
  React__default.createElement(Modal, { visible: isShowModalKeyboard, transparent: true, animationType: "fade", onRequestClose: onCloseModalKeyboard },
6121
- React__default.createElement(TouchableOpacity, { style: styles$a.modalOverlay, activeOpacity: 1, onPress: onCloseModalKeyboard },
6122
- React__default.createElement(View, { onPress: function () { }, activeOpacity: 1, backgroundColor: colors.surfacePrimaryDefault, style: styles$a.modalContent },
6123
- React__default.createElement(Text$1, { style: styles$a.modalTitle }, label),
6099
+ React__default.createElement(TouchableOpacity, { style: styles$b.modalOverlay, activeOpacity: 1, onPress: onCloseModalKeyboard },
6100
+ React__default.createElement(View, { onPress: function () { }, activeOpacity: 1, backgroundColor: colors.surfacePrimaryDefault, style: styles$b.modalContent },
6101
+ React__default.createElement(Text$1, { style: styles$b.modalTitle }, label),
6124
6102
  React__default.createElement(View, { width: "100%" },
6125
6103
  React__default.createElement(View, { paddingHorizontal: SPACE_40 },
6126
- React__default.createElement(Text$1, { numberOfLines: 1, style: styles$a.valueText }, formatNumberInput(inputValue, formatDecimal) || "0")),
6127
- React__default.createElement(TouchableOpacity, { onPress: handleClear, style: styles$a.clearButton },
6104
+ React__default.createElement(Text$1, { numberOfLines: 1, style: styles$b.valueText }, formatNumberInput$1(inputValue, formatDecimal) || "0")),
6105
+ React__default.createElement(TouchableOpacity, { onPress: handleClear, style: styles$b.clearButton },
6128
6106
  React__default.createElement(Icon$1, { name: "IconClearText", type: "Svg", size: 24, color: colors.textSecondary }))),
6129
- React__default.createElement(View, { style: styles$a.keyboardGrid }, [
6107
+ React__default.createElement(View, { style: styles$b.keyboardGrid }, [
6130
6108
  ["1", "2", "3"],
6131
6109
  ["4", "5", "6"],
6132
6110
  ["7", "8", "9"],
6133
6111
  [".", "0", "del"],
6134
- ].map(function (row, rowIndex) { return (React__default.createElement(View, { key: rowIndex, style: styles$a.keyboardRow }, row.map(function (key) { return (React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, key: key, style: [
6135
- styles$a.keyButton,
6136
- key === "." && type === "integer" && styles$a.disabledKey,
6112
+ ].map(function (row, rowIndex) { return (React__default.createElement(View, { key: rowIndex, style: styles$b.keyboardRow }, row.map(function (key) { return (React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, key: key, style: [
6113
+ styles$b.keyButton,
6114
+ key === "." && type === "integer" && styles$b.disabledKey,
6137
6115
  ], onPress: function () { return handleKeyPress(key); }, disabled: key === "." && type === "integer" }, key === "del" ? (React__default.createElement(Icon$1, { name: "IconDelNumber", type: "Svg", size: 24 })) : (React__default.createElement(Text$1, { style: [
6138
- styles$a.keyText,
6116
+ styles$b.keyText,
6139
6117
  key === "." &&
6140
6118
  type === "integer" &&
6141
- styles$a.disabledKeyText,
6119
+ styles$b.disabledKeyText,
6142
6120
  ] }, key)))); }))); })),
6143
- React__default.createElement(View, { style: styles$a.actionRow },
6144
- React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, style: styles$a.actionButton, onPress: onCloseModalKeyboard },
6145
- React__default.createElement(Text$1, { style: styles$a.actionText }, "\u0110\u00F3ng")),
6121
+ React__default.createElement(View, { style: styles$b.actionRow },
6122
+ React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, style: styles$b.actionButton, onPress: onCloseModalKeyboard },
6123
+ React__default.createElement(Text$1, { style: styles$b.actionText }, "\u0110\u00F3ng")),
6146
6124
  React__default.createElement(Spacer, { style: {
6147
6125
  height: "100%",
6148
6126
  }, width: 1, backgroundColor: colors.borderPrimaryDefault }),
6149
- React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, style: styles$a.actionButton, onPress: handleSave },
6127
+ React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, style: styles$b.actionButton, onPress: handleSave },
6150
6128
  React__default.createElement(Text$1, { style: [
6151
- styles$a.actionText,
6129
+ styles$b.actionText,
6152
6130
  { color: colors.textBrandDefault },
6153
6131
  ] }, "L\u01B0u"))))))));
6154
6132
  };
6155
- var styles$a = StyleSheet.create(__assign(__assign({}, containerStyles), { disabled: { opacity: 0.6 }, container: {
6133
+ var styles$b = StyleSheet.create(__assign(__assign({}, containerStyles), { disabled: { opacity: 0.6 }, container: {
6156
6134
  height: 48,
6157
6135
  flexDirection: "row",
6158
6136
  alignItems: "center",
@@ -6486,7 +6464,7 @@ var Button = function (_a) {
6486
6464
  switch (mode) {
6487
6465
  case "outlined":
6488
6466
  return [
6489
- styles$9.border,
6467
+ styles$a.border,
6490
6468
  { borderColor: colors.borderBrandDefault },
6491
6469
  critical && {
6492
6470
  backgroundColor: colors.surfacePrimaryDefault,
@@ -6528,7 +6506,7 @@ var Button = function (_a) {
6528
6506
  return (React__default.createElement(View, { row: !full },
6529
6507
  React__default.createElement(ScaleButton$1, __assign({ activeOpacity: 0.8, onPress: onPress }, props, { disabled: disabled || false }),
6530
6508
  React__default.createElement(View, { style: [
6531
- styles$9.button,
6509
+ styles$a.button,
6532
6510
  {
6533
6511
  borderRadius: CONSTANTS.BORDER_RADIUS_6,
6534
6512
  },
@@ -6538,9 +6516,9 @@ var Button = function (_a) {
6538
6516
  borderColor && { borderColor: borderColor },
6539
6517
  backgroundColor && { backgroundColor: backgroundColor },
6540
6518
  renderButtonStyle(),
6541
- buttonSize === "small" && styles$9.small,
6519
+ buttonSize === "small" && styles$a.small,
6542
6520
  disabled && [
6543
- styles$9.disabled,
6521
+ styles$a.disabled,
6544
6522
  {
6545
6523
  borderColor: colors.borderPrimaryDisabled,
6546
6524
  backgroundColor: colors.surfacePrimaryDisabled,
@@ -6557,7 +6535,7 @@ var Button = function (_a) {
6557
6535
  !isLoading && right,
6558
6536
  React__default.createElement(Spacer, { width: right ? CONSTANTS.SPACE_12 : CONSTANTS.SPACE_16 })))));
6559
6537
  };
6560
- var styles$9 = StyleSheet.create({
6538
+ var styles$a = StyleSheet.create({
6561
6539
  disabled: { opacity: 0.6 },
6562
6540
  button: {
6563
6541
  height: CONSTANTS.BUTTON_HEIGHT,
@@ -6574,13 +6552,13 @@ var styles$9 = StyleSheet.create({
6574
6552
  height: CONSTANTS.BUTTON_HEIGHT_SMALL,
6575
6553
  },
6576
6554
  });
6577
- var index$2 = React__default.memo(Button);
6555
+ var index$3 = React__default.memo(Button);
6578
6556
 
6579
6557
  var FloatingButton = function (_a) {
6580
6558
  var isLoading = _a.isLoading, disabled = _a.disabled, onPress = _a.onPress, style = _a.style, _b = _a.hiddenBackground, hiddenBackground = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? BUTTON_HEIGHT : _c, children = _a.children, backgroundColor = _a.backgroundColor, props = _a.props, _d = _a.top, top = _d === void 0 ? 0 : _d, _e = _a.right, right = _e === void 0 ? 0 : _e, _f = _a.left, left = _f === void 0 ? 0 : _f, _g = _a.bottom, bottom = _g === void 0 ? 0 : _g;
6581
6559
  var colors = useInternalTheme().colors;
6582
6560
  return (React__default.createElement(TouchableOpacity, __assign({ activeOpacity: 0.8, onPress: onPress }, props, { disabled: disabled || isLoading, style: [
6583
- styles$8.btn,
6561
+ styles$9.btn,
6584
6562
  top > 0 && { top: top },
6585
6563
  right > 0 && { right: right },
6586
6564
  left > 0 && { left: left },
@@ -6606,12 +6584,12 @@ var FloatingButton = function (_a) {
6606
6584
  style,
6607
6585
  ] }, props), isLoading ? React__default.createElement(ActivityIndicator$1, { size: "small" }) : children)));
6608
6586
  };
6609
- var styles$8 = StyleSheet.create({
6587
+ var styles$9 = StyleSheet.create({
6610
6588
  btn: {
6611
6589
  position: "absolute",
6612
6590
  },
6613
6591
  });
6614
- var index$1 = memoDeepEqual(FloatingButton);
6592
+ var index$2 = memoDeepEqual(FloatingButton);
6615
6593
 
6616
6594
  var ViewVisibleAnimated = React__default.memo(React__default.forwardRef(function (_a, ref) {
6617
6595
  var onShowStart = _a.onShowStart, onShowDone = _a.onShowDone, onDone = _a.onDone, style = _a.style, children = _a.children, _b = _a.autoHide, autoHide = _b === void 0 ? false : _b, _c = _a.scaleEnable, scaleEnable = _c === void 0 ? true : _c, _d = _a.translateEnable, translateEnable = _d === void 0 ? true : _d, _e = _a.delay, delay = _e === void 0 ? 100 : _e, _f = _a.duration, duration = _f === void 0 ? 250 : _f, _g = _a.timeout, timeout = _g === void 0 ? 1000 : _g, _h = _a.autoShow, autoShow = _h === void 0 ? true : _h, _j = _a.pointerEvents, pointerEvents = _j === void 0 ? "auto" : _j, _k = _a.scaleType, scaleType = _k === void 0 ? "in" : _k, _l = _a.renderHiddenContent, renderHiddenContent = _l === void 0 ? null : _l, _m = _a.disableHiddenContent, disableHiddenContent = _m === void 0 ? false : _m;
@@ -6846,7 +6824,7 @@ var Toast = memoWithRef(function (_props, ref) {
6846
6824
  }
6847
6825
  };
6848
6826
  return (React__default.createElement(ViewVisibleAnimated, { ref: viewVisibleAnimatedRef, autoShow: false, scaleEnable: true, style: [
6849
- styles$7.container,
6827
+ styles$8.container,
6850
6828
  options.position === POSITION.BOTTOM && {
6851
6829
  bottom: bottom
6852
6830
  ? bottom + handleToastBottomHeight()
@@ -6857,7 +6835,7 @@ var Toast = memoWithRef(function (_props, ref) {
6857
6835
  },
6858
6836
  ] },
6859
6837
  React__default.createElement(View, { row: !options.title, center: !options.title, full: true, onPress: onPressToast, style: [
6860
- styles$7.wrapContent,
6838
+ styles$8.wrapContent,
6861
6839
  {
6862
6840
  shadowColor: "black",
6863
6841
  shadowOffset: {
@@ -6874,9 +6852,9 @@ var Toast = memoWithRef(function (_props, ref) {
6874
6852
  React__default.createElement(Icon$1, { name: getSourceIcon(), type: "Svg", size: 20 })),
6875
6853
  React__default.createElement(View, { full: true, paddingLeft: CONSTANTS.SPACE_8 },
6876
6854
  React__default.createElement(Text$1, { bold: true, color: colors.textOnFillDefault }, options.title),
6877
- message.toString().length > 0 && (React__default.createElement(Text$1, { color: colors.textOnFillDefault, numberOfLines: 4, style: !options.title && styles$7.wrapMess }, message)))))));
6855
+ message.toString().length > 0 && (React__default.createElement(Text$1, { color: colors.textOnFillDefault, numberOfLines: 4, style: !options.title && styles$8.wrapMess }, message)))))));
6878
6856
  });
6879
- var styles$7 = StyleSheet.create({
6857
+ var styles$8 = StyleSheet.create({
6880
6858
  wrapMess: { marginLeft: CONSTANTS.SPACE_8, flex: 1 },
6881
6859
  wrapContent: {
6882
6860
  borderRadius: CONSTANTS.BORDER_RADIUS_12,
@@ -6977,10 +6955,10 @@ var CountingDot = function (_a) {
6977
6955
  return React__default.createElement(View, { style: style }, children);
6978
6956
  }
6979
6957
  return (React__default.createElement(View, { row: true },
6980
- React__default.createElement(View, { center: true, borderRadius: CONSTANTS.BORDER_RADIUS_12, backgroundColor: backgroundColor || colors.surfaceCriticalDefault, paddingHorizontal: CONSTANTS.SPACE_4, paddingVertical: CONSTANTS.SPACE_2, style: [styles$6.container, style] },
6981
- React__default.createElement(Text$1, { size: 10, style: [styles$6.textMedium, textStyle], color: textColor || colors.textOnFillDefault }, value))));
6958
+ React__default.createElement(View, { center: true, borderRadius: CONSTANTS.BORDER_RADIUS_12, backgroundColor: backgroundColor || colors.surfaceCriticalDefault, paddingHorizontal: CONSTANTS.SPACE_4, paddingVertical: CONSTANTS.SPACE_2, style: [styles$7.container, style] },
6959
+ React__default.createElement(Text$1, { size: 10, style: [styles$7.textMedium, textStyle], color: textColor || colors.textOnFillDefault }, value))));
6982
6960
  };
6983
- var styles$6 = StyleSheet.create(__assign(__assign({}, containerStyles), { container: {
6961
+ var styles$7 = StyleSheet.create(__assign(__assign({}, containerStyles), { container: {
6984
6962
  minWidth: 16,
6985
6963
  minHeight: 16,
6986
6964
  } }));
@@ -7010,18 +6988,18 @@ var ChipBar = function (_a) {
7010
6988
  leftIcon && React__default.createElement(View, { paddingRight: CONSTANTS.SPACE_4 }, leftIcon),
7011
6989
  React__default.createElement(View, null,
7012
6990
  React__default.createElement(Text$1, { numberOfLines: numberOfLines, ellipsizeMode: ellipsizeMode, color: active ? colors.textBrandDefault : colors.textDefault, style: [
7013
- styles$5.text14,
7014
- styles$5.textMedium,
6991
+ styles$6.text14,
6992
+ styles$6.textMedium,
7015
6993
  disabled && {
7016
6994
  color: colors.textSecondary,
7017
6995
  },
7018
6996
  textStyle,
7019
6997
  ] }, title)),
7020
6998
  rightIcon && React__default.createElement(View, { paddingLeft: CONSTANTS.SPACE_4 }, rightIcon)),
7021
- badge > 0 && (React__default.createElement(View, { style: styles$5.badgeContainer },
6999
+ badge > 0 && (React__default.createElement(View, { style: styles$6.badgeContainer },
7022
7000
  React__default.createElement(CountingDot, { value: badge })))));
7023
7001
  };
7024
- var styles$5 = StyleSheet.create(__assign(__assign({}, containerStyles), { badgeContainer: {
7002
+ var styles$6 = StyleSheet.create(__assign(__assign({}, containerStyles), { badgeContainer: {
7025
7003
  position: "absolute",
7026
7004
  right: 0,
7027
7005
  top: -4,
@@ -7059,14 +7037,14 @@ var Checkbox = function (_a) {
7059
7037
  React__default.createElement(Icon$1, { name: isActive ? "IconCheckboxActive" : "IconCheckbox", type: "Svg", size: iconSize, color: checkboxColor }))),
7060
7038
  React__default.createElement(View, null,
7061
7039
  React__default.createElement(Text$1, { color: colors.textDefault, style: [
7062
- styles$4.text14,
7040
+ styles$5.text14,
7063
7041
  disabled && {
7064
7042
  color: colors.textDisabled,
7065
7043
  },
7066
7044
  textStyle,
7067
7045
  ] }, content))));
7068
7046
  };
7069
- var styles$4 = StyleSheet.create(__assign(__assign({}, containerStyles), { icon: {
7047
+ var styles$5 = StyleSheet.create(__assign(__assign({}, containerStyles), { icon: {
7070
7048
  width: 24,
7071
7049
  height: 24,
7072
7050
  } }));
@@ -7101,14 +7079,14 @@ var RadioButton = function (_a) {
7101
7079
  : "IconRadio", type: "Svg", size: 24, color: getColorCheckbox }))),
7102
7080
  React__default.createElement(View, null,
7103
7081
  React__default.createElement(Text$1, { color: colors.textDefault, style: [
7104
- styles$3.text14,
7082
+ styles$4.text14,
7105
7083
  disabled && {
7106
7084
  color: colors.textSecondary,
7107
7085
  },
7108
7086
  textStyle,
7109
7087
  ] }, content))));
7110
7088
  };
7111
- var styles$3 = StyleSheet.create(__assign(__assign({}, containerStyles), { icon: {
7089
+ var styles$4 = StyleSheet.create(__assign(__assign({}, containerStyles), { icon: {
7112
7090
  width: 24,
7113
7091
  height: 24,
7114
7092
  } }));
@@ -7139,9 +7117,9 @@ var Avatar = function (_a) {
7139
7117
  return 16;
7140
7118
  }
7141
7119
  };
7142
- return (React__default.createElement(View, { onPress: onPress, width: size, height: size, borderRadius: size / 2, center: true, backgroundColor: backgroundColor || colors.surfaceSecondaryDefault, style: [styles$2.container, style] }, source ? (React__default.createElement(Image$1, { useFastImage: true, resizeMode: "cover", source: source, style: [{ width: size, height: size }, imageStyle] })) : (React__default.createElement(Text$1, { size: getSize(size), color: textColor || colors.textSecondary, style: textStyle || { fontWeight: "500" } }, getInitials(name)))));
7120
+ return (React__default.createElement(View, { onPress: onPress, width: size, height: size, borderRadius: size / 2, center: true, backgroundColor: backgroundColor || colors.surfaceSecondaryDefault, style: [styles$3.container, style] }, source ? (React__default.createElement(Image$1, { useFastImage: true, resizeMode: "cover", source: source, style: [{ width: size, height: size }, imageStyle] })) : (React__default.createElement(Text$1, { size: getSize(size), color: textColor || colors.textSecondary, style: textStyle || { fontWeight: "500" } }, getInitials(name)))));
7143
7121
  };
7144
- var styles$2 = StyleSheet.create({
7122
+ var styles$3 = StyleSheet.create({
7145
7123
  container: {
7146
7124
  overflow: "hidden",
7147
7125
  },
@@ -7167,14 +7145,14 @@ var SelectionField = function (_a) {
7167
7145
  return (React__default.createElement(View, null,
7168
7146
  React__default.createElement(ScaleButton$1, __assign({ activeOpacity: 0.8, onPress: onPress }, props, { disabled: disabled || false }),
7169
7147
  React__default.createElement(View, { style: [
7170
- styles$1.container,
7148
+ styles$2.container,
7171
7149
  {
7172
7150
  borderRadius: BORDER_RADIUS_6,
7173
7151
  },
7174
- [styles$1.border, { borderColor: colors.borderPrimaryDefault }],
7152
+ [styles$2.border, { borderColor: colors.borderPrimaryDefault }],
7175
7153
  borderColor && { borderColor: borderColor },
7176
7154
  disabled && [
7177
- styles$1.disabled,
7155
+ styles$2.disabled,
7178
7156
  {
7179
7157
  borderColor: colors.borderPrimaryDisabled,
7180
7158
  backgroundColor: colors.surfacePrimaryDisabled,
@@ -7191,7 +7169,7 @@ var SelectionField = function (_a) {
7191
7169
  React__default.createElement(Spacer, { width: SPACE_12 }),
7192
7170
  React__default.createElement(View, { full: true },
7193
7171
  content.toString() !== "" && label.toString() !== "" && (React__default.createElement(Text$1, { color: labelColor || colors.textSecondary, style: [
7194
- styles$1.text12,
7172
+ styles$2.text12,
7195
7173
  disabled && {
7196
7174
  color: colors.textPlaceholder,
7197
7175
  },
@@ -7207,9 +7185,9 @@ var SelectionField = function (_a) {
7207
7185
  right || React__default.createElement(Icon$1, { name: "IconArrowDown", type: "Svg", size: 24 }),
7208
7186
  React__default.createElement(Spacer, { width: SPACE_12 }))),
7209
7187
  error.length > 0 && (React__default.createElement(View, { paddingHorizontal: SPACE_12, paddingVertical: SPACE_4 },
7210
- React__default.createElement(Text$1, { style: styles$1.text12, color: colors.textErrorDefault }, error)))));
7188
+ React__default.createElement(Text$1, { style: styles$2.text12, color: colors.textErrorDefault }, error)))));
7211
7189
  };
7212
- var styles$1 = StyleSheet.create(__assign(__assign({}, containerStyles), { disabled: { opacity: 0.6 }, container: {
7190
+ var styles$2 = StyleSheet.create(__assign(__assign({}, containerStyles), { disabled: { opacity: 0.6 }, container: {
7213
7191
  height: 48,
7214
7192
  flexDirection: "row",
7215
7193
  alignItems: "center",
@@ -7220,7 +7198,7 @@ var styles$1 = StyleSheet.create(__assign(__assign({}, containerStyles), { disab
7220
7198
  }, small: {
7221
7199
  height: BUTTON_HEIGHT_SMALL,
7222
7200
  } }));
7223
- var index = React__default.memo(SelectionField);
7201
+ var index$1 = React__default.memo(SelectionField);
7224
7202
 
7225
7203
  var SearchInput = function (_a) {
7226
7204
  var _b = _a.value, value = _b === void 0 ? "" : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, rightIcon = _a.rightIcon, _d = _a.clearButton, clearButton = _d === void 0 ? false : _d, _e = _a.placeholder, placeholder = _e === void 0 ? "Tìm kiếm" : _e, onFocus = _a.onFocus, onBlur = _a.onBlur, onChangeText = _a.onChangeText, style = _a.style, height = _a.height, textStyle = _a.textStyle;
@@ -7266,7 +7244,7 @@ var Tag = function (_a) {
7266
7244
  leftIcon && React__default.createElement(View, { paddingRight: CONSTANTS.SPACE_4 }, leftIcon),
7267
7245
  React__default.createElement(View, null,
7268
7246
  React__default.createElement(Text$1, { size: 14, numberOfLines: numberOfLines, ellipsizeMode: ellipsizeMode, style: [
7269
- styles.textMedium,
7247
+ styles$1.textMedium,
7270
7248
  {
7271
7249
  lineHeight: 16,
7272
7250
  },
@@ -7278,7 +7256,172 @@ var Tag = function (_a) {
7278
7256
  rightIcon ? (React__default.createElement(View, { paddingLeft: CONSTANTS.SPACE_4 }, rightIcon)) : hideRightIcon ? (React__default.createElement(View, null)) : (React__default.createElement(View, { paddingLeft: CONSTANTS.SPACE_4 },
7279
7257
  React__default.createElement(Icon$1, { name: "IconClose", type: "Svg", size: 20, color: colors.iconBrandDefault }))))));
7280
7258
  };
7281
- var styles = StyleSheet.create(__assign({}, containerStyles));
7259
+ var styles$1 = StyleSheet.create(__assign({}, containerStyles));
7260
+
7261
+ var formatNumberInput = function (value, formatDecimal) {
7262
+ if (!value)
7263
+ return "0";
7264
+ var isNegative = value.startsWith("-");
7265
+ var _a = value.replace(/[^0-9.]/g, "").split("."), intPart = _a[0], decimalPart = _a[1];
7266
+ intPart = intPart.replace(/^0+(?=\d)/, "");
7267
+ intPart = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
7268
+ if (decimalPart)
7269
+ decimalPart = decimalPart.slice(0, formatDecimal);
7270
+ var result = intPart;
7271
+ if (decimalPart !== undefined)
7272
+ result += "." + decimalPart;
7273
+ if (isNegative)
7274
+ result = "-" + result;
7275
+ return result;
7276
+ };
7277
+ var NumberKeyboard = function (_a) {
7278
+ var _b = _a.value, value = _b === void 0 ? "" : _b, _c = _a.label, label = _c === void 0 ? "" : _c, onChangeText = _a.onChangeText, _d = _a.maxValue, maxValue = _d === void 0 ? 999999999 : _d, _e = _a.type, type = _e === void 0 ? "integer" : _e, _f = _a.formatDecimal, formatDecimal = _f === void 0 ? 3 : _f, visible = _a.visible, onClose = _a.onClose;
7279
+ var theme = useInternalTheme();
7280
+ var colors = theme.colors;
7281
+ var _g = useState((value === null || value === void 0 ? void 0 : value.toString()) || ""), inputValue = _g[0], setInputValue = _g[1];
7282
+ useEffect(function () {
7283
+ setInputValue((value === null || value === void 0 ? void 0 : value.toString()) || "");
7284
+ }, [value]);
7285
+ var handleKeyPress = useCallback(function (key) {
7286
+ if (key === "del") {
7287
+ setInputValue(function (prev) { return prev.slice(0, -1); });
7288
+ return;
7289
+ }
7290
+ if (key === ".") {
7291
+ if (type === "float" &&
7292
+ !inputValue.includes(".") &&
7293
+ inputValue.length > 0) {
7294
+ setInputValue(function (prev) { return prev + key; });
7295
+ }
7296
+ return;
7297
+ }
7298
+ var newInputValue = inputValue === "0" ? key : inputValue + key;
7299
+ var newValue = Number(newInputValue);
7300
+ var maxValueNumber = Number(maxValue);
7301
+ if (!isNaN(newValue) &&
7302
+ !isNaN(maxValueNumber) &&
7303
+ newValue <= maxValueNumber) {
7304
+ if (inputValue.includes(".")) {
7305
+ var _a = inputValue.split("."), intPart = _a[0], _b = _a[1], decimalPart = _b === void 0 ? "" : _b;
7306
+ if (intPart.length < 10 && decimalPart.length === 0) {
7307
+ setInputValue(function (prev) { return prev + key; });
7308
+ }
7309
+ else if (decimalPart.length < formatDecimal) {
7310
+ setInputValue(function (prev) { return prev + key; });
7311
+ }
7312
+ }
7313
+ else {
7314
+ if (inputValue.length < 10) {
7315
+ setInputValue(function (prev) { return (prev === "0" ? key : prev + key); });
7316
+ }
7317
+ }
7318
+ }
7319
+ }, [inputValue, maxValue, type, formatDecimal]);
7320
+ var handleClear = useCallback(function () {
7321
+ setInputValue("");
7322
+ }, []);
7323
+ var handleSave = useCallback(function () {
7324
+ var finalValue = inputValue;
7325
+ if (inputValue.endsWith(".")) {
7326
+ finalValue = inputValue.slice(0, -1);
7327
+ }
7328
+ onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(finalValue);
7329
+ onClose();
7330
+ }, [inputValue, onChangeText, onClose]);
7331
+ var handleClose = useCallback(function () {
7332
+ onClose();
7333
+ setTimeout(function () {
7334
+ setInputValue((value === null || value === void 0 ? void 0 : value.toString()) || "");
7335
+ }, 300);
7336
+ }, [onClose, value]);
7337
+ var renderKeyboardRow = useCallback(function (row) { return (React__default.createElement(View, { key: row.join(""), style: styles.keyboardRow }, row.map(function (key) { return (React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, key: key, style: [
7338
+ styles.keyButton,
7339
+ key === "." && type === "integer" && styles.disabledKey,
7340
+ ], onPress: function () { return handleKeyPress(key); }, disabled: key === "." && type === "integer" }, key === "del" ? (React__default.createElement(Icon$1, { name: "IconDelNumber", type: "Svg", size: 24 })) : (React__default.createElement(Text$1, { style: [
7341
+ styles.keyText,
7342
+ key === "." && type === "integer" && styles.disabledKeyText,
7343
+ ] }, key)))); }))); }, [handleKeyPress, type]);
7344
+ return (React__default.createElement(Modal, { visible: visible, transparent: true, animationType: "fade", onRequestClose: handleClose },
7345
+ React__default.createElement(TouchableOpacity, { style: styles.modalOverlay, activeOpacity: 1, onPress: handleClose },
7346
+ React__default.createElement(View, { onPress: function () { }, activeOpacity: 1, backgroundColor: colors.surfacePrimaryDefault, style: styles.modalContent },
7347
+ React__default.createElement(Text$1, { style: styles.modalTitle }, label),
7348
+ React__default.createElement(View, { width: "100%" },
7349
+ React__default.createElement(View, { paddingHorizontal: SPACE_40 },
7350
+ React__default.createElement(Text$1, { numberOfLines: 1, style: styles.valueText }, formatNumberInput(inputValue, formatDecimal) || "0")),
7351
+ React__default.createElement(TouchableOpacity, { onPress: handleClear, style: styles.clearButton },
7352
+ React__default.createElement(Icon$1, { name: "IconClearText", type: "Svg", size: 24, color: colors.textSecondary }))),
7353
+ React__default.createElement(View, { style: styles.keyboardGrid }, [
7354
+ ["1", "2", "3"],
7355
+ ["4", "5", "6"],
7356
+ ["7", "8", "9"],
7357
+ [".", "0", "del"],
7358
+ ].map(renderKeyboardRow)),
7359
+ React__default.createElement(View, { style: styles.actionRow },
7360
+ React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, style: styles.actionButton, onPress: handleClose },
7361
+ React__default.createElement(Text$1, { style: styles.actionText }, "\u0110\u00F3ng")),
7362
+ React__default.createElement(Spacer, { style: { height: "100%" }, width: 1, backgroundColor: colors.borderPrimaryDefault }),
7363
+ React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, style: styles.actionButton, onPress: handleSave },
7364
+ React__default.createElement(Text$1, { style: [styles.actionText, { color: colors.textBrandDefault }] }, "L\u01B0u")))))));
7365
+ };
7366
+ var styles = StyleSheet.create(__assign(__assign({}, containerStyles), { modalOverlay: {
7367
+ flex: 1,
7368
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
7369
+ justifyContent: "center",
7370
+ alignItems: "center",
7371
+ }, modalContent: {
7372
+ borderRadius: 20,
7373
+ width: "90%",
7374
+ paddingBottom: 20,
7375
+ alignItems: "center",
7376
+ }, modalTitle: {
7377
+ fontSize: 18,
7378
+ textAlign: "center",
7379
+ marginTop: 16,
7380
+ marginBottom: 8,
7381
+ }, valueText: {
7382
+ fontSize: 30,
7383
+ textAlign: "center",
7384
+ }, clearButton: {
7385
+ padding: 8,
7386
+ position: "absolute",
7387
+ right: SPACE_12,
7388
+ }, keyboardGrid: {
7389
+ marginVertical: 8,
7390
+ width: "90%",
7391
+ }, keyboardRow: {
7392
+ flexDirection: "row",
7393
+ justifyContent: "space-between",
7394
+ marginBottom: 8,
7395
+ }, keyButton: {
7396
+ flex: 1,
7397
+ marginHorizontal: 6,
7398
+ backgroundColor: "#F5F5F5",
7399
+ borderRadius: 8,
7400
+ alignItems: "center",
7401
+ justifyContent: "center",
7402
+ height: 48,
7403
+ }, keyText: {
7404
+ fontSize: 22,
7405
+ fontWeight: "500",
7406
+ }, actionRow: {
7407
+ flexDirection: "row",
7408
+ justifyContent: "space-between",
7409
+ marginTop: 12,
7410
+ width: "90%",
7411
+ paddingHorizontal: 16,
7412
+ }, actionButton: {
7413
+ flex: 1,
7414
+ alignItems: "center",
7415
+ paddingVertical: 12,
7416
+ }, actionText: {
7417
+ fontSize: 16,
7418
+ fontWeight: "600",
7419
+ }, disabledKey: {
7420
+ opacity: 0.5,
7421
+ }, disabledKeyText: {
7422
+ opacity: 0.5,
7423
+ } }));
7424
+ var index = React__default.memo(NumberKeyboard);
7282
7425
 
7283
7426
  var toastRef = React__default.createRef();
7284
7427
  var showToast = function (_a) {
@@ -7330,5 +7473,5 @@ var ToastProvider = forwardRef$1(function (_a, ref) {
7330
7473
  renderToast()));
7331
7474
  });
7332
7475
 
7333
- export { ActivityIndicator, Avatar, Badge, index$2 as Button, CONSTANTS, Checkbox, ChipBar, CountingDot, DarkTheme, DefaultTheme, index$1 as FloatingButton, Image$1 as Image, LightTheme, ProgressBar, RadioButton, SearchInput, index as SelectionField, Spacer, Switch, Tag, Text$1 as Text, TextInput, ThemeColors, ThemeProvider, Toast, ToastProvider, View, adaptNavigationTheme, configureFonts, overlay, shadow, showToast, toastRef, useTheme };
7476
+ export { ActivityIndicator, Avatar, Badge, index$3 as Button, CONSTANTS, Checkbox, ChipBar, CountingDot, DarkTheme, DefaultTheme, index$2 as FloatingButton, Image$1 as Image, LightTheme, index as NumberKeyboard, ProgressBar, RadioButton, SearchInput, index$1 as SelectionField, Spacer, Switch, Tag, Text$1 as Text, TextInput, ThemeColors, ThemeProvider, Toast, ToastProvider, View, adaptNavigationTheme, configureFonts, overlay, shadow, showToast, toastRef, useTheme };
7334
7477
  //# sourceMappingURL=index.esm.js.map