sapo-components-ui-rn 1.0.58 → 1.0.60
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/components/Button/index.d.ts +2 -1
- package/dist/components/TextInput/TextInput.d.ts +3 -0
- package/dist/components/TextInput/TextInputNumber.d.ts +5 -2
- package/dist/components/View/index.d.ts +3 -1
- package/dist/index.esm.js +101 -37
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +100 -36
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.tsx +27 -4
- package/src/components/TextInput/TextInput.tsx +9 -1
- package/src/components/TextInput/TextInputNumber.tsx +90 -28
- package/src/components/View/index.tsx +10 -0
|
@@ -24,6 +24,7 @@ export interface ButtonProps extends TouchableOpacityProps {
|
|
|
24
24
|
full?: boolean;
|
|
25
25
|
theme?: ThemeProp;
|
|
26
26
|
buttonSize?: "normal" | "small";
|
|
27
|
+
critical?: boolean;
|
|
27
28
|
}
|
|
28
|
-
declare const _default: React.MemoExoticComponent<({ style, title, border, borderColor, isLoading, left, right, margin, textStyle, textProps, onPress, disabled, backgroundColor, textColor, bold, size, medium, mode, transparent, full, theme: themeOverrides, buttonSize, ...props }: ButtonProps) => React.JSX.Element>;
|
|
29
|
+
declare const _default: React.MemoExoticComponent<({ style, title, border, borderColor, isLoading, left, right, margin, textStyle, textProps, onPress, disabled, backgroundColor, textColor, bold, size, medium, mode, transparent, full, theme: themeOverrides, buttonSize, critical, ...props }: ButtonProps) => React.JSX.Element>;
|
|
29
30
|
export default _default;
|
|
@@ -9,6 +9,9 @@ export type Props = React.ComponentPropsWithRef<typeof NativeTextInput> & {
|
|
|
9
9
|
right?: React.ReactNode;
|
|
10
10
|
prefix?: string;
|
|
11
11
|
textError?: string;
|
|
12
|
+
maxValue?: number;
|
|
13
|
+
type?: "integer" | "float";
|
|
14
|
+
formatDecimal?: 1 | 2 | 3;
|
|
12
15
|
/**
|
|
13
16
|
* If true, user won't be able to interact with the component.
|
|
14
17
|
*/
|
|
@@ -5,7 +5,7 @@ import { ThemeProp } from "../../types";
|
|
|
5
5
|
export interface TextInputNumberProps extends TouchableOpacityProps {
|
|
6
6
|
style?: StyleProp<ViewStyle>;
|
|
7
7
|
borderColor?: string;
|
|
8
|
-
value?: string;
|
|
8
|
+
value?: string | number;
|
|
9
9
|
label?: string;
|
|
10
10
|
textError?: string;
|
|
11
11
|
left?: React.ReactNode;
|
|
@@ -20,6 +20,9 @@ export interface TextInputNumberProps extends TouchableOpacityProps {
|
|
|
20
20
|
onChangeText?: (value: string) => void;
|
|
21
21
|
clearButton?: boolean;
|
|
22
22
|
theme?: ThemeProp;
|
|
23
|
+
maxValue?: number;
|
|
24
|
+
type?: "integer" | "float";
|
|
25
|
+
formatDecimal?: 1 | 2 | 3;
|
|
23
26
|
}
|
|
24
|
-
declare const _default: React.MemoExoticComponent<({ style, value, label, textError, borderColor, left, right, textStyle, labelStyle, textProps, onChangeText, disabled, textColor, labelColor, theme: themeOverrides, prefix, clearButton, ...props }: TextInputNumberProps) => React.JSX.Element>;
|
|
27
|
+
declare const _default: React.MemoExoticComponent<({ style, value, label, textError, borderColor, left, right, textStyle, labelStyle, textProps, onChangeText, disabled, textColor, labelColor, theme: themeOverrides, prefix, clearButton, maxValue, type, formatDecimal, ...props }: TextInputNumberProps) => React.JSX.Element>;
|
|
25
28
|
export default _default;
|
|
@@ -42,6 +42,8 @@ interface ViewProps {
|
|
|
42
42
|
borderRadius?: number;
|
|
43
43
|
borderWidth?: number;
|
|
44
44
|
borderColor?: string;
|
|
45
|
+
pointerEvents?: "box-none" | "box-only" | "none" | "auto";
|
|
46
|
+
gap?: number;
|
|
45
47
|
}
|
|
46
|
-
declare const _default: React.MemoExoticComponent<({ row, full, justifyCenter, justifyBetween, alignCenter, center, color, backgroundColor, width, height, padding, paddingHorizontal, paddingVertical, marginHorizontal, marginVertical, paddingLeft, paddingRight, paddingTop, alignEnd, wrap, borderBottomWidth, borderBottomColor, borderRadius, borderWidth, borderColor, style, onPress, activeOpacity, children, disabled, paddingBottom, marginTop, marginBottom, marginLeft, marginRight, borderTopWidth, borderTopColor, borderLeftWidth, borderLeftColor, borderRightWidth, borderRightColor, }: ViewProps) => React.JSX.Element>;
|
|
48
|
+
declare const _default: React.MemoExoticComponent<({ row, full, justifyCenter, justifyBetween, alignCenter, center, color, backgroundColor, width, height, padding, paddingHorizontal, paddingVertical, marginHorizontal, marginVertical, paddingLeft, paddingRight, paddingTop, alignEnd, wrap, borderBottomWidth, borderBottomColor, borderRadius, borderWidth, borderColor, style, onPress, activeOpacity, children, disabled, paddingBottom, marginTop, marginBottom, marginLeft, marginRight, borderTopWidth, borderTopColor, borderLeftWidth, borderLeftColor, borderRightWidth, borderRightColor, pointerEvents, gap, }: ViewProps) => React.JSX.Element>;
|
|
47
49
|
export default _default;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
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';
|
|
2
2
|
import * as React$3 from 'react';
|
|
3
|
-
import React__default, { useMemo, memo, forwardRef as forwardRef$1, useState, useRef, useImperativeHandle,
|
|
3
|
+
import React__default, { useMemo, memo, forwardRef as forwardRef$1, useState, useEffect, useRef, useImperativeHandle, useCallback } from 'react';
|
|
4
4
|
import require$$1 from 'deepmerge';
|
|
5
5
|
import color from 'color';
|
|
6
6
|
import FontAwesome from 'react-native-vector-icons/FontAwesome';
|
|
@@ -1929,7 +1929,7 @@ var styles$h = StyleSheet.create({
|
|
|
1929
1929
|
});
|
|
1930
1930
|
|
|
1931
1931
|
var ViewCustom = function (_a) {
|
|
1932
|
-
var row = _a.row, full = _a.full, justifyCenter = _a.justifyCenter, justifyBetween = _a.justifyBetween, alignCenter = _a.alignCenter, center = _a.center, color = _a.color, backgroundColor = _a.backgroundColor, width = _a.width, height = _a.height, padding = _a.padding, paddingHorizontal = _a.paddingHorizontal, paddingVertical = _a.paddingVertical, marginHorizontal = _a.marginHorizontal, marginVertical = _a.marginVertical, paddingLeft = _a.paddingLeft, paddingRight = _a.paddingRight, paddingTop = _a.paddingTop, alignEnd = _a.alignEnd, wrap = _a.wrap, borderBottomWidth = _a.borderBottomWidth, borderBottomColor = _a.borderBottomColor, borderRadius = _a.borderRadius, borderWidth = _a.borderWidth, borderColor = _a.borderColor, style = _a.style, onPress = _a.onPress, _b = _a.activeOpacity, activeOpacity = _b === void 0 ? 0.8 : _b, children = _a.children, disabled = _a.disabled, paddingBottom = _a.paddingBottom, marginTop = _a.marginTop, marginBottom = _a.marginBottom, marginLeft = _a.marginLeft, marginRight = _a.marginRight, borderTopWidth = _a.borderTopWidth, borderTopColor = _a.borderTopColor, borderLeftWidth = _a.borderLeftWidth, borderLeftColor = _a.borderLeftColor, borderRightWidth = _a.borderRightWidth, borderRightColor = _a.borderRightColor;
|
|
1932
|
+
var row = _a.row, full = _a.full, justifyCenter = _a.justifyCenter, justifyBetween = _a.justifyBetween, alignCenter = _a.alignCenter, center = _a.center, color = _a.color, backgroundColor = _a.backgroundColor, width = _a.width, height = _a.height, padding = _a.padding, paddingHorizontal = _a.paddingHorizontal, paddingVertical = _a.paddingVertical, marginHorizontal = _a.marginHorizontal, marginVertical = _a.marginVertical, paddingLeft = _a.paddingLeft, paddingRight = _a.paddingRight, paddingTop = _a.paddingTop, alignEnd = _a.alignEnd, wrap = _a.wrap, borderBottomWidth = _a.borderBottomWidth, borderBottomColor = _a.borderBottomColor, borderRadius = _a.borderRadius, borderWidth = _a.borderWidth, borderColor = _a.borderColor, style = _a.style, onPress = _a.onPress, _b = _a.activeOpacity, activeOpacity = _b === void 0 ? 0.8 : _b, children = _a.children, disabled = _a.disabled, paddingBottom = _a.paddingBottom, marginTop = _a.marginTop, marginBottom = _a.marginBottom, marginLeft = _a.marginLeft, marginRight = _a.marginRight, borderTopWidth = _a.borderTopWidth, borderTopColor = _a.borderTopColor, borderLeftWidth = _a.borderLeftWidth, borderLeftColor = _a.borderLeftColor, borderRightWidth = _a.borderRightWidth, borderRightColor = _a.borderRightColor, pointerEvents = _a.pointerEvents, gap = _a.gap;
|
|
1933
1933
|
var getStyle = function () {
|
|
1934
1934
|
var styleCustom = {};
|
|
1935
1935
|
if (row) {
|
|
@@ -2041,6 +2041,12 @@ var ViewCustom = function (_a) {
|
|
|
2041
2041
|
if (borderColor) {
|
|
2042
2042
|
styleCustom.borderColor = borderColor;
|
|
2043
2043
|
}
|
|
2044
|
+
if (pointerEvents) {
|
|
2045
|
+
styleCustom.pointerEvents = pointerEvents;
|
|
2046
|
+
}
|
|
2047
|
+
if (gap) {
|
|
2048
|
+
styleCustom.gap = gap;
|
|
2049
|
+
}
|
|
2044
2050
|
return StyleSheet.create({ styleCustom: styleCustom }).styleCustom;
|
|
2045
2051
|
};
|
|
2046
2052
|
var defaultStyle = getStyle();
|
|
@@ -5936,7 +5942,7 @@ var containerStyles = StyleSheet.create({
|
|
|
5936
5942
|
},
|
|
5937
5943
|
});
|
|
5938
5944
|
|
|
5939
|
-
function formatNumberInput(value) {
|
|
5945
|
+
function formatNumberInput(value, formatDecimal) {
|
|
5940
5946
|
if (!value)
|
|
5941
5947
|
return "0";
|
|
5942
5948
|
// Xử lý số âm
|
|
@@ -5947,7 +5953,7 @@ function formatNumberInput(value) {
|
|
|
5947
5953
|
intPart = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
5948
5954
|
// Giới hạn phần thập phân 3 số
|
|
5949
5955
|
if (decimalPart)
|
|
5950
|
-
decimalPart = decimalPart.slice(0,
|
|
5956
|
+
decimalPart = decimalPart.slice(0, formatDecimal);
|
|
5951
5957
|
var result = intPart;
|
|
5952
5958
|
if (decimalPart !== undefined)
|
|
5953
5959
|
result += "." + decimalPart;
|
|
@@ -5956,14 +5962,18 @@ function formatNumberInput(value) {
|
|
|
5956
5962
|
return result;
|
|
5957
5963
|
}
|
|
5958
5964
|
var TextInputNumber = function (_a) {
|
|
5959
|
-
var style = _a.style, _b = _a.value, value = _b === void 0 ? "" : _b, _c = _a.label, label = _c === void 0 ? "" : _c, _d = _a.textError, textError = _d === void 0 ? "" : _d, borderColor = _a.borderColor, left = _a.left, right = _a.right, textStyle = _a.textStyle; _a.labelStyle; var textProps = _a.textProps, onChangeText = _a.onChangeText, _e = _a.disabled, disabled = _e === void 0 ? false : _e, textColor = _a.textColor, labelColor = _a.labelColor; _a.theme; var _f = _a.prefix, prefix = _f === void 0 ? "" : _f, _g = _a.clearButton, clearButton = _g === void 0 ? false : _g, props = __rest(_a, ["style", "value", "label", "textError", "borderColor", "left", "right", "textStyle", "labelStyle", "textProps", "onChangeText", "disabled", "textColor", "labelColor", "theme", "prefix", "clearButton"]);
|
|
5965
|
+
var style = _a.style, _b = _a.value, value = _b === void 0 ? "" : _b, _c = _a.label, label = _c === void 0 ? "" : _c, _d = _a.textError, textError = _d === void 0 ? "" : _d, borderColor = _a.borderColor, left = _a.left, right = _a.right, textStyle = _a.textStyle; _a.labelStyle; var textProps = _a.textProps, onChangeText = _a.onChangeText, _e = _a.disabled, disabled = _e === void 0 ? false : _e, textColor = _a.textColor, labelColor = _a.labelColor; _a.theme; var _f = _a.prefix, prefix = _f === void 0 ? "" : _f, _g = _a.clearButton, clearButton = _g === void 0 ? false : _g, _h = _a.maxValue, maxValue = _h === void 0 ? 999999999 : _h, _j = _a.type, type = _j === void 0 ? "integer" : _j, _k = _a.formatDecimal, formatDecimal = _k === void 0 ? 3 : _k, props = __rest(_a, ["style", "value", "label", "textError", "borderColor", "left", "right", "textStyle", "labelStyle", "textProps", "onChangeText", "disabled", "textColor", "labelColor", "theme", "prefix", "clearButton", "maxValue", "type", "formatDecimal"]);
|
|
5960
5966
|
var theme = useInternalTheme();
|
|
5961
5967
|
var colors = theme.colors;
|
|
5962
|
-
var
|
|
5963
|
-
var
|
|
5968
|
+
var _l = useState(false), isShowModalKeyboard = _l[0], setIsShowModalKeyboard = _l[1];
|
|
5969
|
+
var _m = useState((value === null || value === void 0 ? void 0 : value.toString()) || ""), inputValue = _m[0], setInputValue = _m[1];
|
|
5970
|
+
var _o = useState((value === null || value === void 0 ? void 0 : value.toString()) || ""), numberValue = _o[0], setNumberValue = _o[1];
|
|
5964
5971
|
var disabledTextStyle = {
|
|
5965
5972
|
color: colors.textSecondary,
|
|
5966
5973
|
};
|
|
5974
|
+
useEffect(function () {
|
|
5975
|
+
setInputValue((value === null || value === void 0 ? void 0 : value.toString()) || "");
|
|
5976
|
+
}, [value]);
|
|
5967
5977
|
var getColorValue = useMemo(function () {
|
|
5968
5978
|
if (textError.length > 0) {
|
|
5969
5979
|
return colors.textErrorDefault;
|
|
@@ -5971,44 +5981,61 @@ var TextInputNumber = function (_a) {
|
|
|
5971
5981
|
if (disabled) {
|
|
5972
5982
|
return colors.textPlaceholder;
|
|
5973
5983
|
}
|
|
5974
|
-
if (
|
|
5984
|
+
if (numberValue.length > 0) {
|
|
5975
5985
|
return colors.textDefault;
|
|
5976
5986
|
}
|
|
5977
5987
|
return textColor || colors.textSecondary;
|
|
5978
|
-
}, [textColor, colors, textError, disabled,
|
|
5988
|
+
}, [textColor, colors, textError, disabled, numberValue]);
|
|
5979
5989
|
var handleKeyPress = function (key) {
|
|
5980
5990
|
if (key === "del") {
|
|
5981
5991
|
setInputValue(function (prev) { return prev.slice(0, -1); });
|
|
5982
5992
|
}
|
|
5983
5993
|
else if (key === ".") {
|
|
5984
|
-
if (
|
|
5994
|
+
if (type === "float" &&
|
|
5995
|
+
!inputValue.includes(".") &&
|
|
5996
|
+
inputValue.length > 0) {
|
|
5985
5997
|
setInputValue(function (prev) { return prev + key; });
|
|
5998
|
+
}
|
|
5986
5999
|
}
|
|
5987
6000
|
else {
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
6001
|
+
var newInputValue = inputValue === "0" ? key : inputValue + key;
|
|
6002
|
+
var newValue = Number(newInputValue);
|
|
6003
|
+
var maxValueNumber = Number(maxValue);
|
|
6004
|
+
if (!isNaN(newValue) &&
|
|
6005
|
+
!isNaN(maxValueNumber) &&
|
|
6006
|
+
newValue <= maxValueNumber) {
|
|
6007
|
+
if (inputValue.includes(".")) {
|
|
6008
|
+
var _a = inputValue.split("."), intPart = _a[0], _b = _a[1], decimalPart = _b === void 0 ? "" : _b;
|
|
6009
|
+
if (intPart.length < 10 && decimalPart.length === 0) {
|
|
6010
|
+
setInputValue(function (prev) { return prev + key; });
|
|
6011
|
+
}
|
|
6012
|
+
else if (decimalPart.length < 3) {
|
|
6013
|
+
setInputValue(function (prev) { return prev + key; });
|
|
6014
|
+
}
|
|
5996
6015
|
}
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
setInputValue(function (prev) { return (prev === "0" ? key : prev + key); });
|
|
6016
|
+
else {
|
|
6017
|
+
if (inputValue.length < 10) {
|
|
6018
|
+
setInputValue(function (prev) { return (prev === "0" ? key : prev + key); });
|
|
6019
|
+
}
|
|
6002
6020
|
}
|
|
6003
6021
|
}
|
|
6004
6022
|
}
|
|
6005
6023
|
};
|
|
6006
6024
|
var handleClear = function () {
|
|
6007
6025
|
setInputValue("");
|
|
6026
|
+
};
|
|
6027
|
+
var handleClearInput = function () {
|
|
6028
|
+
setInputValue("");
|
|
6029
|
+
setNumberValue("");
|
|
6008
6030
|
onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText("");
|
|
6009
6031
|
};
|
|
6010
6032
|
var handleSave = function () {
|
|
6011
|
-
|
|
6033
|
+
var finalValue = inputValue;
|
|
6034
|
+
if (inputValue.endsWith(".")) {
|
|
6035
|
+
finalValue = inputValue.slice(0, -1);
|
|
6036
|
+
}
|
|
6037
|
+
onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(finalValue);
|
|
6038
|
+
setNumberValue(finalValue);
|
|
6012
6039
|
setIsShowModalKeyboard(false);
|
|
6013
6040
|
};
|
|
6014
6041
|
var checkValueEmpty = function () {
|
|
@@ -6028,6 +6055,9 @@ var TextInputNumber = function (_a) {
|
|
|
6028
6055
|
};
|
|
6029
6056
|
var onCloseModalKeyboard = function () {
|
|
6030
6057
|
setIsShowModalKeyboard(false);
|
|
6058
|
+
setTimeout(function () {
|
|
6059
|
+
setInputValue((value === null || value === void 0 ? void 0 : value.toString()) || "");
|
|
6060
|
+
}, 300);
|
|
6031
6061
|
};
|
|
6032
6062
|
return (React__default.createElement(View, null,
|
|
6033
6063
|
React__default.createElement(ScaleButton$1, __assign({ activeOpacity: 0.8, onPress: onShowModalKeyboard }, props, { disabled: disabled || false }),
|
|
@@ -6068,20 +6098,22 @@ var TextInputNumber = function (_a) {
|
|
|
6068
6098
|
!checkValueEmpty() && prefix.toString() !== "" && (React__default.createElement(Text$1, __assign({ numberOfLines: 1, color: colors.textSecondary, style: [disabled && disabledTextStyle, textStyle] }, textProps),
|
|
6069
6099
|
prefix, " ")),
|
|
6070
6100
|
React__default.createElement(View, { full: true },
|
|
6071
|
-
React__default.createElement(Text$1, __assign({ numberOfLines: 1, color: getColorValue, style: [disabled && disabledTextStyle, textStyle] }, textProps), checkValueEmpty()
|
|
6072
|
-
|
|
6101
|
+
React__default.createElement(Text$1, __assign({ numberOfLines: 1, color: getColorValue, style: [disabled && disabledTextStyle, textStyle] }, textProps), checkValueEmpty()
|
|
6102
|
+
? label
|
|
6103
|
+
: formatNumberInput(numberValue, formatDecimal))))),
|
|
6104
|
+
clearButton && !checkValueEmpty() && (React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, onPress: handleClearInput },
|
|
6073
6105
|
React__default.createElement(Icon$1, { name: "IconClearText", type: "Svg", size: 24 }))),
|
|
6074
6106
|
right && (React__default.createElement(View, { paddingLeft: SPACE_8, height: "100%" }, right)),
|
|
6075
6107
|
React__default.createElement(Spacer, { width: SPACE_12 }))),
|
|
6076
6108
|
textError.length > 0 && (React__default.createElement(View, { paddingHorizontal: SPACE_12, paddingVertical: SPACE_4 },
|
|
6077
6109
|
React__default.createElement(Text$1, { style: styles$a.text12, color: colors.textErrorDefault }, textError))),
|
|
6078
|
-
React__default.createElement(Modal, { visible: isShowModalKeyboard, transparent: true, animationType: "fade" },
|
|
6079
|
-
React__default.createElement(TouchableOpacity, { style: styles$a.modalOverlay, activeOpacity: 1 },
|
|
6080
|
-
React__default.createElement(View, { backgroundColor: colors.surfacePrimaryDefault, style: styles$a.modalContent },
|
|
6110
|
+
React__default.createElement(Modal, { visible: isShowModalKeyboard, transparent: true, animationType: "fade", onRequestClose: onCloseModalKeyboard },
|
|
6111
|
+
React__default.createElement(TouchableOpacity, { style: styles$a.modalOverlay, activeOpacity: 1, onPress: onCloseModalKeyboard },
|
|
6112
|
+
React__default.createElement(View, { onPress: function () { }, activeOpacity: 1, backgroundColor: colors.surfacePrimaryDefault, style: styles$a.modalContent },
|
|
6081
6113
|
React__default.createElement(Text$1, { style: styles$a.modalTitle }, label),
|
|
6082
6114
|
React__default.createElement(View, { width: "100%" },
|
|
6083
6115
|
React__default.createElement(View, { paddingHorizontal: SPACE_40 },
|
|
6084
|
-
React__default.createElement(Text$1, { numberOfLines: 1, style: styles$a.valueText }, formatNumberInput(inputValue) || "0")),
|
|
6116
|
+
React__default.createElement(Text$1, { numberOfLines: 1, style: styles$a.valueText }, formatNumberInput(inputValue, formatDecimal) || "0")),
|
|
6085
6117
|
React__default.createElement(TouchableOpacity, { onPress: handleClear, style: styles$a.clearButton },
|
|
6086
6118
|
React__default.createElement(Icon$1, { name: "IconClearText", type: "Svg", size: 24, color: colors.textSecondary }))),
|
|
6087
6119
|
React__default.createElement(View, { style: styles$a.keyboardGrid }, [
|
|
@@ -6089,7 +6121,15 @@ var TextInputNumber = function (_a) {
|
|
|
6089
6121
|
["4", "5", "6"],
|
|
6090
6122
|
["7", "8", "9"],
|
|
6091
6123
|
[".", "0", "del"],
|
|
6092
|
-
].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:
|
|
6124
|
+
].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: [
|
|
6125
|
+
styles$a.keyButton,
|
|
6126
|
+
key === "." && type === "integer" && styles$a.disabledKey,
|
|
6127
|
+
], 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: [
|
|
6128
|
+
styles$a.keyText,
|
|
6129
|
+
key === "." &&
|
|
6130
|
+
type === "integer" &&
|
|
6131
|
+
styles$a.disabledKeyText,
|
|
6132
|
+
] }, key)))); }))); })),
|
|
6093
6133
|
React__default.createElement(View, { style: styles$a.actionRow },
|
|
6094
6134
|
React__default.createElement(TouchableOpacity, { activeOpacity: 0.8, style: styles$a.actionButton, onPress: onCloseModalKeyboard },
|
|
6095
6135
|
React__default.createElement(Text$1, { style: styles$a.actionText }, "\u0110\u00F3ng")),
|
|
@@ -6165,6 +6205,10 @@ var styles$a = StyleSheet.create(__assign(__assign({}, containerStyles), { disab
|
|
|
6165
6205
|
}, actionText: {
|
|
6166
6206
|
fontSize: 16,
|
|
6167
6207
|
fontWeight: "600",
|
|
6208
|
+
}, disabledKey: {
|
|
6209
|
+
opacity: 0.5,
|
|
6210
|
+
}, disabledKeyText: {
|
|
6211
|
+
opacity: 0.5,
|
|
6168
6212
|
} }));
|
|
6169
6213
|
var TextInputNumber$1 = React__default.memo(TextInputNumber);
|
|
6170
6214
|
|
|
@@ -6197,7 +6241,7 @@ var DefaultRenderer = function (props) { return React__default.createElement(Tex
|
|
|
6197
6241
|
* @extends TextInput props https://reactnative.dev/docs/textinput#props
|
|
6198
6242
|
*/
|
|
6199
6243
|
var TextInput = forwardRef(function (_a, ref) {
|
|
6200
|
-
var _b = _a.mode, mode = _b === void 0 ? "flat" : _b, _c = _a.dense, dense = _c === void 0 ? false : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.error, errorProp = _e === void 0 ? false : _e, _f = _a.multiline, multiline = _f === void 0 ? false : _f, _g = _a.editable, editable = _g === void 0 ? true : _g, contentStyle = _a.contentStyle, _h = _a.render, render = _h === void 0 ? DefaultRenderer : _h; _a.theme; var placeholderTextColor = _a.placeholderTextColor, clearButton = _a.clearButton, textError = _a.textError, prefix = _a.prefix, rest = __rest(_a, ["mode", "dense", "disabled", "error", "multiline", "editable", "contentStyle", "render", "theme", "placeholderTextColor", "clearButton", "textError", "prefix"]);
|
|
6244
|
+
var _b = _a.mode, mode = _b === void 0 ? "flat" : _b, _c = _a.dense, dense = _c === void 0 ? false : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.error, errorProp = _e === void 0 ? false : _e, _f = _a.multiline, multiline = _f === void 0 ? false : _f, _g = _a.editable, editable = _g === void 0 ? true : _g, contentStyle = _a.contentStyle, _h = _a.render, render = _h === void 0 ? DefaultRenderer : _h; _a.theme; var placeholderTextColor = _a.placeholderTextColor, clearButton = _a.clearButton, textError = _a.textError, prefix = _a.prefix, maxValue = _a.maxValue, type = _a.type, rest = __rest(_a, ["mode", "dense", "disabled", "error", "multiline", "editable", "contentStyle", "render", "theme", "placeholderTextColor", "clearButton", "textError", "prefix", "maxValue", "type"]);
|
|
6201
6245
|
var theme = useInternalTheme();
|
|
6202
6246
|
var isControlled = rest.value !== undefined;
|
|
6203
6247
|
var validInputValue = isControlled ? rest.value : rest.defaultValue;
|
|
@@ -6399,7 +6443,7 @@ var TextInput = forwardRef(function (_a, ref) {
|
|
|
6399
6443
|
}, onFocus: handleFocus, forceFocus: forceFocus, onBlur: handleBlur, allowFontScaling: false, onChangeText: handleChangeText, onLayoutAnimatedText: handleLayoutAnimatedText, onInputLayout: handleInputContainerLayout, onLabelTextLayout: handleLabelTextLayout, onLeftAffixLayoutChange: onLeftAffixLayoutChange, onRightAffixLayoutChange: onRightAffixLayoutChange, maxFontSizeMultiplier: maxFontSizeMultiplier, contentStyle: contentStyle, scaledLabel: scaledLabel })));
|
|
6400
6444
|
}
|
|
6401
6445
|
if (mode === "number") {
|
|
6402
|
-
return (React__default.createElement(TextInputNumber$1, { textError: textError, disabled: disabled, prefix: prefix, value: value, label:
|
|
6446
|
+
return (React__default.createElement(TextInputNumber$1, { textError: textError, disabled: disabled, prefix: prefix, value: value, label: rest.label, clearButton: clearButton, onChangeText: handleChangeText, maxValue: maxValue, formatDecimal: rest.formatDecimal, type: type }));
|
|
6403
6447
|
}
|
|
6404
6448
|
return (React__default.createElement(TextInputFlat, __assign({ dense: dense, disabled: disabled, error: errorProp, editable: editable, clearButton: clearButton, render: render }, rest, { theme: theme, value: value, parentState: {
|
|
6405
6449
|
labeled: labeled,
|
|
@@ -6422,18 +6466,32 @@ var TextInput = forwardRef(function (_a, ref) {
|
|
|
6422
6466
|
TextInput.Affix = TextInputAffix;
|
|
6423
6467
|
|
|
6424
6468
|
var Button = function (_a) {
|
|
6425
|
-
var style = _a.style, title = _a.title; _a.border; var borderColor = _a.borderColor, isLoading = _a.isLoading, left = _a.left, right = _a.right; _a.margin; var textStyle = _a.textStyle, textProps = _a.textProps, onPress = _a.onPress, disabled = _a.disabled, backgroundColor = _a.backgroundColor, textColor = _a.textColor, _b = _a.bold, bold = _b === void 0 ? true : _b, _c = _a.size, size = _c === void 0 ? 16 : _c, _d = _a.medium, medium = _d === void 0 ? false : _d, _e = _a.mode, mode = _e === void 0 ? "contained" : _e; _a.transparent; var _g = _a.full, full = _g === void 0 ? false : _g; _a.theme; var _h = _a.buttonSize, buttonSize = _h === void 0 ? "normal" : _h, props = __rest(_a, ["style", "title", "border", "borderColor", "isLoading", "left", "right", "margin", "textStyle", "textProps", "onPress", "disabled", "backgroundColor", "textColor", "bold", "size", "medium", "mode", "transparent", "full", "theme", "buttonSize"]);
|
|
6469
|
+
var style = _a.style, title = _a.title; _a.border; var borderColor = _a.borderColor, isLoading = _a.isLoading, left = _a.left, right = _a.right; _a.margin; var textStyle = _a.textStyle, textProps = _a.textProps, onPress = _a.onPress, disabled = _a.disabled, backgroundColor = _a.backgroundColor, textColor = _a.textColor, _b = _a.bold, bold = _b === void 0 ? true : _b, _c = _a.size, size = _c === void 0 ? 16 : _c, _d = _a.medium, medium = _d === void 0 ? false : _d, _e = _a.mode, mode = _e === void 0 ? "contained" : _e; _a.transparent; var _g = _a.full, full = _g === void 0 ? false : _g; _a.theme; var _h = _a.buttonSize, buttonSize = _h === void 0 ? "normal" : _h, _j = _a.critical, critical = _j === void 0 ? false : _j, props = __rest(_a, ["style", "title", "border", "borderColor", "isLoading", "left", "right", "margin", "textStyle", "textProps", "onPress", "disabled", "backgroundColor", "textColor", "bold", "size", "medium", "mode", "transparent", "full", "theme", "buttonSize", "critical"]);
|
|
6426
6470
|
var theme = useInternalTheme();
|
|
6427
6471
|
var colors = theme.colors;
|
|
6428
6472
|
var disabledTextStyle = {
|
|
6429
|
-
color: colors.
|
|
6473
|
+
color: colors.textDisabled,
|
|
6430
6474
|
};
|
|
6431
6475
|
var renderButtonStyle = function () {
|
|
6432
6476
|
switch (mode) {
|
|
6433
6477
|
case "outlined":
|
|
6434
|
-
return [
|
|
6478
|
+
return [
|
|
6479
|
+
styles$9.border,
|
|
6480
|
+
{ borderColor: colors.borderBrandDefault },
|
|
6481
|
+
critical && {
|
|
6482
|
+
backgroundColor: colors.surfacePrimaryDefault,
|
|
6483
|
+
borderColor: colors.borderCriticalDefault,
|
|
6484
|
+
borderWidth: CONSTANTS.BORDER_WIDTH_1,
|
|
6485
|
+
},
|
|
6486
|
+
];
|
|
6435
6487
|
case "contained":
|
|
6436
|
-
return [
|
|
6488
|
+
return [
|
|
6489
|
+
{
|
|
6490
|
+
backgroundColor: critical
|
|
6491
|
+
? colors.surfaceCriticalDefault
|
|
6492
|
+
: colors.surfaceBrandDefault,
|
|
6493
|
+
},
|
|
6494
|
+
];
|
|
6437
6495
|
case "transparent":
|
|
6438
6496
|
return [
|
|
6439
6497
|
{ borderColor: colors.borderBrandDefault },
|
|
@@ -6444,10 +6502,16 @@ var Button = function (_a) {
|
|
|
6444
6502
|
var renderTextColor = function () {
|
|
6445
6503
|
switch (mode) {
|
|
6446
6504
|
case "outlined":
|
|
6505
|
+
if (critical) {
|
|
6506
|
+
return colors.textCriticalDefault;
|
|
6507
|
+
}
|
|
6447
6508
|
return colors.textBrandDefault;
|
|
6448
6509
|
case "contained":
|
|
6449
6510
|
return colors.textOnFillDefault;
|
|
6450
6511
|
case "transparent":
|
|
6512
|
+
if (critical) {
|
|
6513
|
+
return colors.textCriticalDefault;
|
|
6514
|
+
}
|
|
6451
6515
|
return colors.textBrandDefault;
|
|
6452
6516
|
}
|
|
6453
6517
|
};
|