sapo-components-ui-rn 1.0.64 → 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.d.ts +1 -0
- package/dist/index.esm.js +252 -87
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +255 -89
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/index.tsx +1 -0
package/dist/index.esm.js
CHANGED
|
@@ -1709,7 +1709,7 @@ var ActivityIndicator = function (_a) {
|
|
|
1709
1709
|
height: size / 2,
|
|
1710
1710
|
overflow: "hidden",
|
|
1711
1711
|
};
|
|
1712
|
-
return (React$3.createElement(View$1, __assign({ style: [styles$
|
|
1712
|
+
return (React$3.createElement(View$1, __assign({ style: [styles$k.container, style] }, rest, { accessible: true, accessibilityRole: "progressbar", accessibilityState: { busy: animating } }),
|
|
1713
1713
|
React$3.createElement(Animated.View, { style: [{ width: size, height: size, opacity: fade }], collapsable: false }, [0, 1].map(function (index) {
|
|
1714
1714
|
// Thanks to https://github.com/n4kz/react-native-indicators for the great work
|
|
1715
1715
|
var inputRange = Array.from(new Array(frames), function (_, frameIndex) { return frameIndex / (frames - 1); });
|
|
@@ -1754,7 +1754,7 @@ var ActivityIndicator = function (_a) {
|
|
|
1754
1754
|
borderWidth: size / 10,
|
|
1755
1755
|
borderRadius: size / 2,
|
|
1756
1756
|
};
|
|
1757
|
-
return (React$3.createElement(Animated.View, { key: index, style: [styles$
|
|
1757
|
+
return (React$3.createElement(Animated.View, { key: index, style: [styles$k.layer] },
|
|
1758
1758
|
React$3.createElement(Animated.View, { style: layerStyle },
|
|
1759
1759
|
React$3.createElement(Animated.View, { style: [containerStyle, offsetStyle], collapsable: false },
|
|
1760
1760
|
React$3.createElement(Animated.View, { style: viewportStyle },
|
|
@@ -1762,7 +1762,7 @@ var ActivityIndicator = function (_a) {
|
|
|
1762
1762
|
React$3.createElement(Animated.View, { style: lineStyle })))))));
|
|
1763
1763
|
}))));
|
|
1764
1764
|
};
|
|
1765
|
-
var styles$
|
|
1765
|
+
var styles$k = StyleSheet.create({
|
|
1766
1766
|
container: {
|
|
1767
1767
|
justifyContent: "center",
|
|
1768
1768
|
alignItems: "center",
|
|
@@ -1870,11 +1870,11 @@ var ProgressBar = function (_a) {
|
|
|
1870
1870
|
? {}
|
|
1871
1871
|
: { min: 0, max: 100, now: Math.round(progress * 100) }, testID: testID }),
|
|
1872
1872
|
React$3.createElement(Animated.View, { style: [
|
|
1873
|
-
styles$
|
|
1873
|
+
styles$j.container,
|
|
1874
1874
|
{ backgroundColor: trackTintColor, opacity: fade },
|
|
1875
1875
|
style,
|
|
1876
1876
|
] }, width ? (React$3.createElement(Animated.View, { testID: "".concat(testID, "-fill"), style: [
|
|
1877
|
-
styles$
|
|
1877
|
+
styles$j.progressBar,
|
|
1878
1878
|
{
|
|
1879
1879
|
width: width,
|
|
1880
1880
|
backgroundColor: tintColor,
|
|
@@ -1918,7 +1918,7 @@ var ProgressBar = function (_a) {
|
|
|
1918
1918
|
fillStyle,
|
|
1919
1919
|
] })) : null)));
|
|
1920
1920
|
};
|
|
1921
|
-
var styles$
|
|
1921
|
+
var styles$j = StyleSheet.create({
|
|
1922
1922
|
container: {
|
|
1923
1923
|
height: 4,
|
|
1924
1924
|
overflow: "hidden",
|
|
@@ -2100,7 +2100,7 @@ var Switch = memo(function (_a) {
|
|
|
2100
2100
|
return (React$3.createElement(View, { row: true },
|
|
2101
2101
|
React$3.createElement(TouchableOpacity, { activeOpacity: 1, onPress: handleSwitch, disabled: disabled, style: disabled ? { opacity: 0.6 } : {} },
|
|
2102
2102
|
React$3.createElement(Animated$1.View, { style: [
|
|
2103
|
-
styles$
|
|
2103
|
+
styles$i.vSegment,
|
|
2104
2104
|
backgroundColor,
|
|
2105
2105
|
{
|
|
2106
2106
|
width: 52,
|
|
@@ -2108,7 +2108,7 @@ var Switch = memo(function (_a) {
|
|
|
2108
2108
|
},
|
|
2109
2109
|
] },
|
|
2110
2110
|
React$3.createElement(Animated$1.View, { style: [
|
|
2111
|
-
styles$
|
|
2111
|
+
styles$i.animated,
|
|
2112
2112
|
animatedStyle,
|
|
2113
2113
|
{
|
|
2114
2114
|
width: 28,
|
|
@@ -2118,7 +2118,7 @@ var Switch = memo(function (_a) {
|
|
|
2118
2118
|
},
|
|
2119
2119
|
] })))));
|
|
2120
2120
|
});
|
|
2121
|
-
var styles$
|
|
2121
|
+
var styles$i = StyleSheet.create({
|
|
2122
2122
|
vSegment: {
|
|
2123
2123
|
overflow: "hidden",
|
|
2124
2124
|
borderRadius: 100,
|
|
@@ -2494,7 +2494,7 @@ var TextInputAffix = function (_a) {
|
|
|
2494
2494
|
var textColor = getTextColor({ theme: theme, disabled: disabled });
|
|
2495
2495
|
var content = (React__default.createElement(Text$2, { maxFontSizeMultiplier: maxFontSizeMultiplier, style: [{ color: textColor }, textStyle, labelStyle], onLayout: onTextLayout, testID: "".concat(testID, "-text") }, text));
|
|
2496
2496
|
return (React__default.createElement(Animated.View, { style: [
|
|
2497
|
-
styles$
|
|
2497
|
+
styles$h.container,
|
|
2498
2498
|
style,
|
|
2499
2499
|
{
|
|
2500
2500
|
opacity: (visible === null || visible === void 0 ? void 0 : visible.interpolate({
|
|
@@ -2505,7 +2505,7 @@ var TextInputAffix = function (_a) {
|
|
|
2505
2505
|
], onLayout: onLayout, testID: testID }, onPress ? (React__default.createElement(Pressable, { onPress: onPress, accessibilityRole: "button", accessibilityLabel: accessibilityLabel }, content)) : (content)));
|
|
2506
2506
|
};
|
|
2507
2507
|
TextInputAffix.displayName = "TextInput.Affix";
|
|
2508
|
-
var styles$
|
|
2508
|
+
var styles$h = StyleSheet.create({
|
|
2509
2509
|
container: {
|
|
2510
2510
|
position: "absolute",
|
|
2511
2511
|
justifyContent: "center",
|
|
@@ -2563,13 +2563,13 @@ var AnimatedText = forwardRef(function AnimatedText(_a, ref) {
|
|
|
2563
2563
|
}
|
|
2564
2564
|
return (React$3.createElement(Animated.Text, __assign({ ref: ref }, rest, { style: [
|
|
2565
2565
|
font,
|
|
2566
|
-
styles$
|
|
2566
|
+
styles$g.text,
|
|
2567
2567
|
{ writingDirection: writingDirection, color: theme.colors.backgroundPrimary },
|
|
2568
2568
|
style,
|
|
2569
2569
|
] })));
|
|
2570
2570
|
}
|
|
2571
2571
|
});
|
|
2572
|
-
var styles$
|
|
2572
|
+
var styles$g = StyleSheet.create({
|
|
2573
2573
|
text: {
|
|
2574
2574
|
textAlign: "left",
|
|
2575
2575
|
},
|
|
@@ -5145,7 +5145,7 @@ var InputLabel = function (props) {
|
|
|
5145
5145
|
return (
|
|
5146
5146
|
// Position colored placeholder and gray placeholder on top of each other and crossfade them
|
|
5147
5147
|
// This gives the effect of animating the color, but allows us to use native driver
|
|
5148
|
-
React__default.createElement(View$1, { pointerEvents: "none", style: [StyleSheet.absoluteFill, styles$
|
|
5148
|
+
React__default.createElement(View$1, { pointerEvents: "none", style: [StyleSheet.absoluteFill, styles$f.overflow, styles$f.labelContainer] },
|
|
5149
5149
|
React__default.createElement(Animated.View, { pointerEvents: "none", style: [
|
|
5150
5150
|
StyleSheet.absoluteFill,
|
|
5151
5151
|
Platform.OS !== "web" && { width: width },
|
|
@@ -5187,7 +5187,7 @@ var InputLabel = function (props) {
|
|
|
5187
5187
|
label,
|
|
5188
5188
|
required && React__default.createElement(Text$1, { color: theme.colors.textErrorDefault }, " *"))))));
|
|
5189
5189
|
};
|
|
5190
|
-
var styles$
|
|
5190
|
+
var styles$f = StyleSheet.create({
|
|
5191
5191
|
overflow: {
|
|
5192
5192
|
overflow: "hidden",
|
|
5193
5193
|
},
|
|
@@ -5200,8 +5200,8 @@ var InputLabel$1 = React__default.memo(InputLabel);
|
|
|
5200
5200
|
var Outline = function (_a) {
|
|
5201
5201
|
var label = _a.label; _a.activeColor; _a.backgroundColor; _a.hasActiveOutline; _a.focused; _a.outlineColor; _a.roundness; var style = _a.style;
|
|
5202
5202
|
return (React$3.createElement(View$1, { testID: "text-input-outline", pointerEvents: "none", style: [
|
|
5203
|
-
styles$
|
|
5204
|
-
!label && styles$
|
|
5203
|
+
styles$e.outline,
|
|
5204
|
+
!label && styles$e.noLabelOutline,
|
|
5205
5205
|
// eslint-disable-next-line react-native/no-inline-styles
|
|
5206
5206
|
{
|
|
5207
5207
|
// backgroundColor,
|
|
@@ -5212,7 +5212,7 @@ var Outline = function (_a) {
|
|
|
5212
5212
|
style,
|
|
5213
5213
|
] }));
|
|
5214
5214
|
};
|
|
5215
|
-
var styles$
|
|
5215
|
+
var styles$e = StyleSheet.create({
|
|
5216
5216
|
outline: {
|
|
5217
5217
|
position: "absolute",
|
|
5218
5218
|
left: 0,
|
|
@@ -5458,7 +5458,7 @@ var TextInputFlat = function (_a) {
|
|
|
5458
5458
|
label: label,
|
|
5459
5459
|
scale: fontScale,
|
|
5460
5460
|
isAndroid: isAndroid,
|
|
5461
|
-
styles: StyleSheet.flatten(dense ? styles$
|
|
5461
|
+
styles: StyleSheet.flatten(dense ? styles$d.inputFlatDense : styles$d.inputFlat),
|
|
5462
5462
|
};
|
|
5463
5463
|
var pad = calculatePadding(paddingSettings);
|
|
5464
5464
|
adjustPaddingFlat(__assign(__assign({}, paddingSettings), { pad: pad }));
|
|
@@ -5484,7 +5484,7 @@ var TextInputFlat = function (_a) {
|
|
|
5484
5484
|
onLabelTextLayout: onLabelTextLayout,
|
|
5485
5485
|
placeholderOpacity: placeholderOpacity,
|
|
5486
5486
|
labelError: error,
|
|
5487
|
-
placeholderStyle: styles$
|
|
5487
|
+
placeholderStyle: styles$d.placeholder,
|
|
5488
5488
|
baseLabelTranslateY: baseLabelTranslateY,
|
|
5489
5489
|
baseLabelTranslateX: baseLabelTranslateX,
|
|
5490
5490
|
font: font,
|
|
@@ -5570,7 +5570,7 @@ var TextInputFlat = function (_a) {
|
|
|
5570
5570
|
left ? React$3.createElement(Spacer, { width: SPACE_8 }) : React$3.createElement(Spacer, { width: SPACE_12 })),
|
|
5571
5571
|
React$3.createElement(Outline, { style: outlineStyle, label: label, roundness: roundness, hasActiveOutline: hasActiveOutline, focused: parentState.focused, activeColor: activeColor, outlineColor: outlineColor, backgroundColor: backgroundColor }),
|
|
5572
5572
|
React$3.createElement(View$1, { onLayout: onInputLayout, style: [
|
|
5573
|
-
styles$
|
|
5573
|
+
styles$d.labelContainer,
|
|
5574
5574
|
{
|
|
5575
5575
|
minHeight: minHeight,
|
|
5576
5576
|
flex: 1,
|
|
@@ -5580,7 +5580,7 @@ var TextInputFlat = function (_a) {
|
|
|
5580
5580
|
React$3.createElement(View$1, { style: { flexDirection: "row", alignItems: "flex-end" } },
|
|
5581
5581
|
renderPrefix(), render === null || render === void 0 ? void 0 :
|
|
5582
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: [
|
|
5583
|
-
styles$
|
|
5583
|
+
styles$d.input,
|
|
5584
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
|
|
5585
5585
|
? textAlign
|
|
5586
5586
|
: I18nManager.getConstants().isRTL
|
|
@@ -5588,7 +5588,7 @@ var TextInputFlat = function (_a) {
|
|
|
5588
5588
|
: "left", marginTop: Platform.OS === "android" ? SPACE_8 : SPACE_2 }),
|
|
5589
5589
|
contentStyle,
|
|
5590
5590
|
] })))),
|
|
5591
|
-
!disabled && clearButton && inputValue ? (React$3.createElement(TouchableOpacity, { onPress: handleClear, style: styles$
|
|
5591
|
+
!disabled && clearButton && inputValue ? (React$3.createElement(TouchableOpacity, { onPress: handleClear, style: styles$d.clearButton },
|
|
5592
5592
|
React$3.createElement(Icon$1, { name: "IconClearText", type: "Svg", size: 24 }))) : (React$3.createElement(Spacer, { width: SPACE_12 })),
|
|
5593
5593
|
React$3.createElement(View$1, { style: {
|
|
5594
5594
|
flexDirection: "row",
|
|
@@ -5599,10 +5599,10 @@ var TextInputFlat = function (_a) {
|
|
|
5599
5599
|
right && (React$3.createElement(View$1, { style: {
|
|
5600
5600
|
paddingRight: SPACE_12,
|
|
5601
5601
|
} }, right)))),
|
|
5602
|
-
error && (textError === null || textError === void 0 ? void 0 : textError.toString()) !== "" && (React$3.createElement(View$1, { style: styles$
|
|
5602
|
+
error && (textError === null || textError === void 0 ? void 0 : textError.toString()) !== "" && (React$3.createElement(View$1, { style: styles$d.vError },
|
|
5603
5603
|
React$3.createElement(Text$1, { size: 12, numberOfLines: 1, color: theme.colors.textErrorDefault }, textError)))));
|
|
5604
5604
|
};
|
|
5605
|
-
var styles$
|
|
5605
|
+
var styles$d = StyleSheet.create({
|
|
5606
5606
|
placeholder: {
|
|
5607
5607
|
position: "absolute",
|
|
5608
5608
|
left: 0,
|
|
@@ -5758,7 +5758,7 @@ var TextInputDefault = function (_a) {
|
|
|
5758
5758
|
? rest.placeholder
|
|
5759
5759
|
: label
|
|
5760
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: [
|
|
5761
|
-
styles$
|
|
5761
|
+
styles$c.input,
|
|
5762
5762
|
__assign(__assign({}, font), { fontSize: fontSize, lineHeight: lineHeight, fontWeight: fontWeight, color: inputTextColor, textAlignVertical: multiline ? "top" : "center", textAlign: textAlign
|
|
5763
5763
|
? textAlign
|
|
5764
5764
|
: I18nManager.getConstants().isRTL
|
|
@@ -5766,17 +5766,17 @@ var TextInputDefault = function (_a) {
|
|
|
5766
5766
|
: "left", height: height ? height : 48, paddingTop: getPaddingTopValue(), paddingBottom: multiline ? CONSTANTS.SPACE_4 : 0 }),
|
|
5767
5767
|
contentStyle,
|
|
5768
5768
|
] }))),
|
|
5769
|
-
!disabled && clearButton && inputValue ? (React$3.createElement(TouchableOpacity, { onPress: handleClear, style: multiline ? styles$
|
|
5769
|
+
!disabled && clearButton && inputValue ? (React$3.createElement(TouchableOpacity, { onPress: handleClear, style: multiline ? styles$c.clearButtonMultiline : styles$c.clearButton },
|
|
5770
5770
|
React$3.createElement(Icon$1, { name: "IconClearText", type: "Svg", size: 24 }))) : (React$3.createElement(Spacer, { width: CONSTANTS.SPACE_12 })),
|
|
5771
5771
|
right && !clearButton && React$3.createElement(Spacer, { width: CONSTANTS.SPACE_2 }),
|
|
5772
5772
|
right && (React$3.createElement(View, { style: {
|
|
5773
5773
|
height: "100%",
|
|
5774
5774
|
paddingRight: CONSTANTS.SPACE_12,
|
|
5775
5775
|
} }, right))),
|
|
5776
|
-
error && (textError === null || textError === void 0 ? void 0 : textError.toString()) !== "" && (React$3.createElement(View, { style: styles$
|
|
5776
|
+
error && (textError === null || textError === void 0 ? void 0 : textError.toString()) !== "" && (React$3.createElement(View, { style: styles$c.vError },
|
|
5777
5777
|
React$3.createElement(Text$1, { size: 12, numberOfLines: 1, color: theme.colors.textErrorDefault }, textError)))));
|
|
5778
5778
|
};
|
|
5779
|
-
var styles$
|
|
5779
|
+
var styles$c = StyleSheet.create({
|
|
5780
5780
|
input: {
|
|
5781
5781
|
margin: 0,
|
|
5782
5782
|
flex: 1,
|
|
@@ -5927,7 +5927,7 @@ var containerStyles = StyleSheet.create({
|
|
|
5927
5927
|
},
|
|
5928
5928
|
});
|
|
5929
5929
|
|
|
5930
|
-
function formatNumberInput(value, formatDecimal) {
|
|
5930
|
+
function formatNumberInput$1(value, formatDecimal) {
|
|
5931
5931
|
if (!value)
|
|
5932
5932
|
return "0";
|
|
5933
5933
|
// Xử lý số âm
|
|
@@ -6047,11 +6047,11 @@ var TextInputNumber = function (_a) {
|
|
|
6047
6047
|
return (React__default.createElement(View, null,
|
|
6048
6048
|
React__default.createElement(ScaleButton$1, __assign({ activeOpacity: 0.8, onPress: onShowModalKeyboard }, props, { disabled: disabled || false }),
|
|
6049
6049
|
React__default.createElement(View, { style: [
|
|
6050
|
-
styles$
|
|
6050
|
+
styles$b.container,
|
|
6051
6051
|
{
|
|
6052
6052
|
borderRadius: BORDER_RADIUS_6,
|
|
6053
6053
|
},
|
|
6054
|
-
[styles$
|
|
6054
|
+
[styles$b.border, { borderColor: colors.borderPrimaryDefault }],
|
|
6055
6055
|
textError.length > 0 && [
|
|
6056
6056
|
{
|
|
6057
6057
|
borderColor: colors.borderErrorDefault,
|
|
@@ -6059,7 +6059,7 @@ var TextInputNumber = function (_a) {
|
|
|
6059
6059
|
},
|
|
6060
6060
|
],
|
|
6061
6061
|
disabled && [
|
|
6062
|
-
styles$
|
|
6062
|
+
styles$b.disabled,
|
|
6063
6063
|
{
|
|
6064
6064
|
borderColor: colors.borderPrimaryDisabled,
|
|
6065
6065
|
backgroundColor: colors.surfacePrimaryDisabled,
|
|
@@ -6087,7 +6087,7 @@ var TextInputNumber = function (_a) {
|
|
|
6087
6087
|
React__default.createElement(Text$1, { numberOfLines: 1, color: getColorValue, style: [disabled && disabledTextStyle] },
|
|
6088
6088
|
checkValueEmpty()
|
|
6089
6089
|
? label
|
|
6090
|
-
: formatNumberInput(numberValue, formatDecimal),
|
|
6090
|
+
: formatNumberInput$1(numberValue, formatDecimal),
|
|
6091
6091
|
checkValueEmpty() && required && (React__default.createElement(Text$1, { color: colors.textErrorDefault }, " *")))))),
|
|
6092
6092
|
clearButton && !checkValueEmpty() && (React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, onPress: handleClearInput },
|
|
6093
6093
|
React__default.createElement(Icon$1, { name: "IconClearText", type: "Svg", size: 24 }))),
|
|
@@ -6096,41 +6096,41 @@ var TextInputNumber = function (_a) {
|
|
|
6096
6096
|
!disabled && textError.length > 0 && (React__default.createElement(View, { paddingHorizontal: SPACE_12, paddingVertical: SPACE_4 },
|
|
6097
6097
|
React__default.createElement(Text$1, { size: 12, numberOfLines: 1, color: theme.colors.textErrorDefault }, textError))),
|
|
6098
6098
|
React__default.createElement(Modal, { visible: isShowModalKeyboard, transparent: true, animationType: "fade", onRequestClose: onCloseModalKeyboard },
|
|
6099
|
-
React__default.createElement(TouchableOpacity, { style: styles$
|
|
6100
|
-
React__default.createElement(View, { onPress: function () { }, activeOpacity: 1, backgroundColor: colors.surfacePrimaryDefault, style: styles$
|
|
6101
|
-
React__default.createElement(Text$1, { style: styles$
|
|
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),
|
|
6102
6102
|
React__default.createElement(View, { width: "100%" },
|
|
6103
6103
|
React__default.createElement(View, { paddingHorizontal: SPACE_40 },
|
|
6104
|
-
React__default.createElement(Text$1, { numberOfLines: 1, style: styles$
|
|
6105
|
-
React__default.createElement(TouchableOpacity, { onPress: handleClear, style: styles$
|
|
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 },
|
|
6106
6106
|
React__default.createElement(Icon$1, { name: "IconClearText", type: "Svg", size: 24, color: colors.textSecondary }))),
|
|
6107
|
-
React__default.createElement(View, { style: styles$
|
|
6107
|
+
React__default.createElement(View, { style: styles$b.keyboardGrid }, [
|
|
6108
6108
|
["1", "2", "3"],
|
|
6109
6109
|
["4", "5", "6"],
|
|
6110
6110
|
["7", "8", "9"],
|
|
6111
6111
|
[".", "0", "del"],
|
|
6112
|
-
].map(function (row, rowIndex) { return (React__default.createElement(View, { key: rowIndex, style: styles$
|
|
6113
|
-
styles$
|
|
6114
|
-
key === "." && type === "integer" && styles$
|
|
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,
|
|
6115
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: [
|
|
6116
|
-
styles$
|
|
6116
|
+
styles$b.keyText,
|
|
6117
6117
|
key === "." &&
|
|
6118
6118
|
type === "integer" &&
|
|
6119
|
-
styles$
|
|
6119
|
+
styles$b.disabledKeyText,
|
|
6120
6120
|
] }, key)))); }))); })),
|
|
6121
|
-
React__default.createElement(View, { style: styles$
|
|
6122
|
-
React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, style: styles$
|
|
6123
|
-
React__default.createElement(Text$1, { style: styles$
|
|
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")),
|
|
6124
6124
|
React__default.createElement(Spacer, { style: {
|
|
6125
6125
|
height: "100%",
|
|
6126
6126
|
}, width: 1, backgroundColor: colors.borderPrimaryDefault }),
|
|
6127
|
-
React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, style: styles$
|
|
6127
|
+
React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, style: styles$b.actionButton, onPress: handleSave },
|
|
6128
6128
|
React__default.createElement(Text$1, { style: [
|
|
6129
|
-
styles$
|
|
6129
|
+
styles$b.actionText,
|
|
6130
6130
|
{ color: colors.textBrandDefault },
|
|
6131
6131
|
] }, "L\u01B0u"))))))));
|
|
6132
6132
|
};
|
|
6133
|
-
var styles$
|
|
6133
|
+
var styles$b = StyleSheet.create(__assign(__assign({}, containerStyles), { disabled: { opacity: 0.6 }, container: {
|
|
6134
6134
|
height: 48,
|
|
6135
6135
|
flexDirection: "row",
|
|
6136
6136
|
alignItems: "center",
|
|
@@ -6464,7 +6464,7 @@ var Button = function (_a) {
|
|
|
6464
6464
|
switch (mode) {
|
|
6465
6465
|
case "outlined":
|
|
6466
6466
|
return [
|
|
6467
|
-
styles$
|
|
6467
|
+
styles$a.border,
|
|
6468
6468
|
{ borderColor: colors.borderBrandDefault },
|
|
6469
6469
|
critical && {
|
|
6470
6470
|
backgroundColor: colors.surfacePrimaryDefault,
|
|
@@ -6506,7 +6506,7 @@ var Button = function (_a) {
|
|
|
6506
6506
|
return (React__default.createElement(View, { row: !full },
|
|
6507
6507
|
React__default.createElement(ScaleButton$1, __assign({ activeOpacity: 0.8, onPress: onPress }, props, { disabled: disabled || false }),
|
|
6508
6508
|
React__default.createElement(View, { style: [
|
|
6509
|
-
styles$
|
|
6509
|
+
styles$a.button,
|
|
6510
6510
|
{
|
|
6511
6511
|
borderRadius: CONSTANTS.BORDER_RADIUS_6,
|
|
6512
6512
|
},
|
|
@@ -6516,9 +6516,9 @@ var Button = function (_a) {
|
|
|
6516
6516
|
borderColor && { borderColor: borderColor },
|
|
6517
6517
|
backgroundColor && { backgroundColor: backgroundColor },
|
|
6518
6518
|
renderButtonStyle(),
|
|
6519
|
-
buttonSize === "small" && styles$
|
|
6519
|
+
buttonSize === "small" && styles$a.small,
|
|
6520
6520
|
disabled && [
|
|
6521
|
-
styles$
|
|
6521
|
+
styles$a.disabled,
|
|
6522
6522
|
{
|
|
6523
6523
|
borderColor: colors.borderPrimaryDisabled,
|
|
6524
6524
|
backgroundColor: colors.surfacePrimaryDisabled,
|
|
@@ -6535,7 +6535,7 @@ var Button = function (_a) {
|
|
|
6535
6535
|
!isLoading && right,
|
|
6536
6536
|
React__default.createElement(Spacer, { width: right ? CONSTANTS.SPACE_12 : CONSTANTS.SPACE_16 })))));
|
|
6537
6537
|
};
|
|
6538
|
-
var styles$
|
|
6538
|
+
var styles$a = StyleSheet.create({
|
|
6539
6539
|
disabled: { opacity: 0.6 },
|
|
6540
6540
|
button: {
|
|
6541
6541
|
height: CONSTANTS.BUTTON_HEIGHT,
|
|
@@ -6552,13 +6552,13 @@ var styles$9 = StyleSheet.create({
|
|
|
6552
6552
|
height: CONSTANTS.BUTTON_HEIGHT_SMALL,
|
|
6553
6553
|
},
|
|
6554
6554
|
});
|
|
6555
|
-
var index$
|
|
6555
|
+
var index$3 = React__default.memo(Button);
|
|
6556
6556
|
|
|
6557
6557
|
var FloatingButton = function (_a) {
|
|
6558
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;
|
|
6559
6559
|
var colors = useInternalTheme().colors;
|
|
6560
6560
|
return (React__default.createElement(TouchableOpacity, __assign({ activeOpacity: 0.8, onPress: onPress }, props, { disabled: disabled || isLoading, style: [
|
|
6561
|
-
styles$
|
|
6561
|
+
styles$9.btn,
|
|
6562
6562
|
top > 0 && { top: top },
|
|
6563
6563
|
right > 0 && { right: right },
|
|
6564
6564
|
left > 0 && { left: left },
|
|
@@ -6584,12 +6584,12 @@ var FloatingButton = function (_a) {
|
|
|
6584
6584
|
style,
|
|
6585
6585
|
] }, props), isLoading ? React__default.createElement(ActivityIndicator$1, { size: "small" }) : children)));
|
|
6586
6586
|
};
|
|
6587
|
-
var styles$
|
|
6587
|
+
var styles$9 = StyleSheet.create({
|
|
6588
6588
|
btn: {
|
|
6589
6589
|
position: "absolute",
|
|
6590
6590
|
},
|
|
6591
6591
|
});
|
|
6592
|
-
var index$
|
|
6592
|
+
var index$2 = memoDeepEqual(FloatingButton);
|
|
6593
6593
|
|
|
6594
6594
|
var ViewVisibleAnimated = React__default.memo(React__default.forwardRef(function (_a, ref) {
|
|
6595
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;
|
|
@@ -6824,7 +6824,7 @@ var Toast = memoWithRef(function (_props, ref) {
|
|
|
6824
6824
|
}
|
|
6825
6825
|
};
|
|
6826
6826
|
return (React__default.createElement(ViewVisibleAnimated, { ref: viewVisibleAnimatedRef, autoShow: false, scaleEnable: true, style: [
|
|
6827
|
-
styles$
|
|
6827
|
+
styles$8.container,
|
|
6828
6828
|
options.position === POSITION.BOTTOM && {
|
|
6829
6829
|
bottom: bottom
|
|
6830
6830
|
? bottom + handleToastBottomHeight()
|
|
@@ -6835,7 +6835,7 @@ var Toast = memoWithRef(function (_props, ref) {
|
|
|
6835
6835
|
},
|
|
6836
6836
|
] },
|
|
6837
6837
|
React__default.createElement(View, { row: !options.title, center: !options.title, full: true, onPress: onPressToast, style: [
|
|
6838
|
-
styles$
|
|
6838
|
+
styles$8.wrapContent,
|
|
6839
6839
|
{
|
|
6840
6840
|
shadowColor: "black",
|
|
6841
6841
|
shadowOffset: {
|
|
@@ -6852,9 +6852,9 @@ var Toast = memoWithRef(function (_props, ref) {
|
|
|
6852
6852
|
React__default.createElement(Icon$1, { name: getSourceIcon(), type: "Svg", size: 20 })),
|
|
6853
6853
|
React__default.createElement(View, { full: true, paddingLeft: CONSTANTS.SPACE_8 },
|
|
6854
6854
|
React__default.createElement(Text$1, { bold: true, color: colors.textOnFillDefault }, options.title),
|
|
6855
|
-
message.toString().length > 0 && (React__default.createElement(Text$1, { color: colors.textOnFillDefault, numberOfLines: 4, style: !options.title && styles$
|
|
6855
|
+
message.toString().length > 0 && (React__default.createElement(Text$1, { color: colors.textOnFillDefault, numberOfLines: 4, style: !options.title && styles$8.wrapMess }, message)))))));
|
|
6856
6856
|
});
|
|
6857
|
-
var styles$
|
|
6857
|
+
var styles$8 = StyleSheet.create({
|
|
6858
6858
|
wrapMess: { marginLeft: CONSTANTS.SPACE_8, flex: 1 },
|
|
6859
6859
|
wrapContent: {
|
|
6860
6860
|
borderRadius: CONSTANTS.BORDER_RADIUS_12,
|
|
@@ -6955,10 +6955,10 @@ var CountingDot = function (_a) {
|
|
|
6955
6955
|
return React__default.createElement(View, { style: style }, children);
|
|
6956
6956
|
}
|
|
6957
6957
|
return (React__default.createElement(View, { row: true },
|
|
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$
|
|
6959
|
-
React__default.createElement(Text$1, { size: 10, style: [styles$
|
|
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))));
|
|
6960
6960
|
};
|
|
6961
|
-
var styles$
|
|
6961
|
+
var styles$7 = StyleSheet.create(__assign(__assign({}, containerStyles), { container: {
|
|
6962
6962
|
minWidth: 16,
|
|
6963
6963
|
minHeight: 16,
|
|
6964
6964
|
} }));
|
|
@@ -6988,18 +6988,18 @@ var ChipBar = function (_a) {
|
|
|
6988
6988
|
leftIcon && React__default.createElement(View, { paddingRight: CONSTANTS.SPACE_4 }, leftIcon),
|
|
6989
6989
|
React__default.createElement(View, null,
|
|
6990
6990
|
React__default.createElement(Text$1, { numberOfLines: numberOfLines, ellipsizeMode: ellipsizeMode, color: active ? colors.textBrandDefault : colors.textDefault, style: [
|
|
6991
|
-
styles$
|
|
6992
|
-
styles$
|
|
6991
|
+
styles$6.text14,
|
|
6992
|
+
styles$6.textMedium,
|
|
6993
6993
|
disabled && {
|
|
6994
6994
|
color: colors.textSecondary,
|
|
6995
6995
|
},
|
|
6996
6996
|
textStyle,
|
|
6997
6997
|
] }, title)),
|
|
6998
6998
|
rightIcon && React__default.createElement(View, { paddingLeft: CONSTANTS.SPACE_4 }, rightIcon)),
|
|
6999
|
-
badge > 0 && (React__default.createElement(View, { style: styles$
|
|
6999
|
+
badge > 0 && (React__default.createElement(View, { style: styles$6.badgeContainer },
|
|
7000
7000
|
React__default.createElement(CountingDot, { value: badge })))));
|
|
7001
7001
|
};
|
|
7002
|
-
var styles$
|
|
7002
|
+
var styles$6 = StyleSheet.create(__assign(__assign({}, containerStyles), { badgeContainer: {
|
|
7003
7003
|
position: "absolute",
|
|
7004
7004
|
right: 0,
|
|
7005
7005
|
top: -4,
|
|
@@ -7037,14 +7037,14 @@ var Checkbox = function (_a) {
|
|
|
7037
7037
|
React__default.createElement(Icon$1, { name: isActive ? "IconCheckboxActive" : "IconCheckbox", type: "Svg", size: iconSize, color: checkboxColor }))),
|
|
7038
7038
|
React__default.createElement(View, null,
|
|
7039
7039
|
React__default.createElement(Text$1, { color: colors.textDefault, style: [
|
|
7040
|
-
styles$
|
|
7040
|
+
styles$5.text14,
|
|
7041
7041
|
disabled && {
|
|
7042
7042
|
color: colors.textDisabled,
|
|
7043
7043
|
},
|
|
7044
7044
|
textStyle,
|
|
7045
7045
|
] }, content))));
|
|
7046
7046
|
};
|
|
7047
|
-
var styles$
|
|
7047
|
+
var styles$5 = StyleSheet.create(__assign(__assign({}, containerStyles), { icon: {
|
|
7048
7048
|
width: 24,
|
|
7049
7049
|
height: 24,
|
|
7050
7050
|
} }));
|
|
@@ -7079,14 +7079,14 @@ var RadioButton = function (_a) {
|
|
|
7079
7079
|
: "IconRadio", type: "Svg", size: 24, color: getColorCheckbox }))),
|
|
7080
7080
|
React__default.createElement(View, null,
|
|
7081
7081
|
React__default.createElement(Text$1, { color: colors.textDefault, style: [
|
|
7082
|
-
styles$
|
|
7082
|
+
styles$4.text14,
|
|
7083
7083
|
disabled && {
|
|
7084
7084
|
color: colors.textSecondary,
|
|
7085
7085
|
},
|
|
7086
7086
|
textStyle,
|
|
7087
7087
|
] }, content))));
|
|
7088
7088
|
};
|
|
7089
|
-
var styles$
|
|
7089
|
+
var styles$4 = StyleSheet.create(__assign(__assign({}, containerStyles), { icon: {
|
|
7090
7090
|
width: 24,
|
|
7091
7091
|
height: 24,
|
|
7092
7092
|
} }));
|
|
@@ -7117,9 +7117,9 @@ var Avatar = function (_a) {
|
|
|
7117
7117
|
return 16;
|
|
7118
7118
|
}
|
|
7119
7119
|
};
|
|
7120
|
-
return (React__default.createElement(View, { onPress: onPress, width: size, height: size, borderRadius: size / 2, center: true, backgroundColor: backgroundColor || colors.surfaceSecondaryDefault, style: [styles$
|
|
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)))));
|
|
7121
7121
|
};
|
|
7122
|
-
var styles$
|
|
7122
|
+
var styles$3 = StyleSheet.create({
|
|
7123
7123
|
container: {
|
|
7124
7124
|
overflow: "hidden",
|
|
7125
7125
|
},
|
|
@@ -7145,14 +7145,14 @@ var SelectionField = function (_a) {
|
|
|
7145
7145
|
return (React__default.createElement(View, null,
|
|
7146
7146
|
React__default.createElement(ScaleButton$1, __assign({ activeOpacity: 0.8, onPress: onPress }, props, { disabled: disabled || false }),
|
|
7147
7147
|
React__default.createElement(View, { style: [
|
|
7148
|
-
styles$
|
|
7148
|
+
styles$2.container,
|
|
7149
7149
|
{
|
|
7150
7150
|
borderRadius: BORDER_RADIUS_6,
|
|
7151
7151
|
},
|
|
7152
|
-
[styles$
|
|
7152
|
+
[styles$2.border, { borderColor: colors.borderPrimaryDefault }],
|
|
7153
7153
|
borderColor && { borderColor: borderColor },
|
|
7154
7154
|
disabled && [
|
|
7155
|
-
styles$
|
|
7155
|
+
styles$2.disabled,
|
|
7156
7156
|
{
|
|
7157
7157
|
borderColor: colors.borderPrimaryDisabled,
|
|
7158
7158
|
backgroundColor: colors.surfacePrimaryDisabled,
|
|
@@ -7169,7 +7169,7 @@ var SelectionField = function (_a) {
|
|
|
7169
7169
|
React__default.createElement(Spacer, { width: SPACE_12 }),
|
|
7170
7170
|
React__default.createElement(View, { full: true },
|
|
7171
7171
|
content.toString() !== "" && label.toString() !== "" && (React__default.createElement(Text$1, { color: labelColor || colors.textSecondary, style: [
|
|
7172
|
-
styles$
|
|
7172
|
+
styles$2.text12,
|
|
7173
7173
|
disabled && {
|
|
7174
7174
|
color: colors.textPlaceholder,
|
|
7175
7175
|
},
|
|
@@ -7185,9 +7185,9 @@ var SelectionField = function (_a) {
|
|
|
7185
7185
|
right || React__default.createElement(Icon$1, { name: "IconArrowDown", type: "Svg", size: 24 }),
|
|
7186
7186
|
React__default.createElement(Spacer, { width: SPACE_12 }))),
|
|
7187
7187
|
error.length > 0 && (React__default.createElement(View, { paddingHorizontal: SPACE_12, paddingVertical: SPACE_4 },
|
|
7188
|
-
React__default.createElement(Text$1, { style: styles$
|
|
7188
|
+
React__default.createElement(Text$1, { style: styles$2.text12, color: colors.textErrorDefault }, error)))));
|
|
7189
7189
|
};
|
|
7190
|
-
var styles$
|
|
7190
|
+
var styles$2 = StyleSheet.create(__assign(__assign({}, containerStyles), { disabled: { opacity: 0.6 }, container: {
|
|
7191
7191
|
height: 48,
|
|
7192
7192
|
flexDirection: "row",
|
|
7193
7193
|
alignItems: "center",
|
|
@@ -7198,7 +7198,7 @@ var styles$1 = StyleSheet.create(__assign(__assign({}, containerStyles), { disab
|
|
|
7198
7198
|
}, small: {
|
|
7199
7199
|
height: BUTTON_HEIGHT_SMALL,
|
|
7200
7200
|
} }));
|
|
7201
|
-
var index = React__default.memo(SelectionField);
|
|
7201
|
+
var index$1 = React__default.memo(SelectionField);
|
|
7202
7202
|
|
|
7203
7203
|
var SearchInput = function (_a) {
|
|
7204
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;
|
|
@@ -7244,7 +7244,7 @@ var Tag = function (_a) {
|
|
|
7244
7244
|
leftIcon && React__default.createElement(View, { paddingRight: CONSTANTS.SPACE_4 }, leftIcon),
|
|
7245
7245
|
React__default.createElement(View, null,
|
|
7246
7246
|
React__default.createElement(Text$1, { size: 14, numberOfLines: numberOfLines, ellipsizeMode: ellipsizeMode, style: [
|
|
7247
|
-
styles.textMedium,
|
|
7247
|
+
styles$1.textMedium,
|
|
7248
7248
|
{
|
|
7249
7249
|
lineHeight: 16,
|
|
7250
7250
|
},
|
|
@@ -7256,7 +7256,172 @@ var Tag = function (_a) {
|
|
|
7256
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 },
|
|
7257
7257
|
React__default.createElement(Icon$1, { name: "IconClose", type: "Svg", size: 20, color: colors.iconBrandDefault }))))));
|
|
7258
7258
|
};
|
|
7259
|
-
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);
|
|
7260
7425
|
|
|
7261
7426
|
var toastRef = React__default.createRef();
|
|
7262
7427
|
var showToast = function (_a) {
|
|
@@ -7308,5 +7473,5 @@ var ToastProvider = forwardRef$1(function (_a, ref) {
|
|
|
7308
7473
|
renderToast()));
|
|
7309
7474
|
});
|
|
7310
7475
|
|
|
7311
|
-
export { ActivityIndicator, Avatar, Badge, index$
|
|
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 };
|
|
7312
7477
|
//# sourceMappingURL=index.esm.js.map
|