sapo-components-ui-rn 1.1.52 → 1.1.53
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/TextInput/TextInputNumber.d.ts +3 -1
- package/dist/index.esm.js +14 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +14 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/TextInput/TextInput.tsx +3 -0
- package/src/components/TextInput/TextInputNumber.tsx +19 -4
|
@@ -20,6 +20,8 @@ export interface TextInputNumberProps extends TouchableOpacityProps {
|
|
|
20
20
|
formatDecimal?: 1 | 2 | 3;
|
|
21
21
|
required?: boolean;
|
|
22
22
|
labelStyle?: StyleProp<TextStyle>;
|
|
23
|
+
contentStyle?: StyleProp<TextStyle>;
|
|
24
|
+
textErrorStyle?: StyleProp<TextStyle>;
|
|
23
25
|
}
|
|
24
|
-
declare const _default: React.MemoExoticComponent<({ style, value, label, textError, left, right, onChangeText, disabled, theme: themeOverrides, prefix, suffix, clearButton, maxValue, minValue, type, formatDecimal, required, labelStyle, ...props }: TextInputNumberProps) => React.JSX.Element>;
|
|
26
|
+
declare const _default: React.MemoExoticComponent<({ style, value, label, textError, left, right, onChangeText, disabled, theme: themeOverrides, prefix, suffix, clearButton, maxValue, minValue, type, formatDecimal, required, labelStyle, contentStyle, textErrorStyle, ...props }: TextInputNumberProps) => React.JSX.Element>;
|
|
25
27
|
export default _default;
|
package/dist/index.esm.js
CHANGED
|
@@ -5664,7 +5664,7 @@ function formatNumberInput$1(value, formatDecimal) {
|
|
|
5664
5664
|
return result;
|
|
5665
5665
|
}
|
|
5666
5666
|
var TextInputNumber = function (_a) {
|
|
5667
|
-
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, left = _a.left, right = _a.right, onChangeText = _a.onChangeText, _e = _a.disabled, disabled = _e === void 0 ? false : _e; _a.theme; var _f = _a.prefix, prefix = _f === void 0 ? "" : _f, _g = _a.suffix, suffix = _g === void 0 ? "" : _g, _h = _a.clearButton, clearButton = _h === void 0 ? false : _h, _j = _a.maxValue, maxValue = _j === void 0 ? 999999999999 : _j, _k = _a.minValue, minValue = _k === void 0 ? 0 : _k, _l = _a.type, type = _l === void 0 ? "integer" : _l, _m = _a.formatDecimal, formatDecimal = _m === void 0 ? 3 : _m, _o = _a.required, required = _o === void 0 ? false : _o, labelStyle = _a.labelStyle, props = __rest(_a, ["style", "value", "label", "textError", "left", "right", "onChangeText", "disabled", "theme", "prefix", "suffix", "clearButton", "maxValue", "minValue", "type", "formatDecimal", "required", "labelStyle"]);
|
|
5667
|
+
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, left = _a.left, right = _a.right, onChangeText = _a.onChangeText, _e = _a.disabled, disabled = _e === void 0 ? false : _e; _a.theme; var _f = _a.prefix, prefix = _f === void 0 ? "" : _f, _g = _a.suffix, suffix = _g === void 0 ? "" : _g, _h = _a.clearButton, clearButton = _h === void 0 ? false : _h, _j = _a.maxValue, maxValue = _j === void 0 ? 999999999999 : _j, _k = _a.minValue, minValue = _k === void 0 ? 0 : _k, _l = _a.type, type = _l === void 0 ? "integer" : _l, _m = _a.formatDecimal, formatDecimal = _m === void 0 ? 3 : _m, _o = _a.required, required = _o === void 0 ? false : _o, labelStyle = _a.labelStyle, contentStyle = _a.contentStyle, textErrorStyle = _a.textErrorStyle, props = __rest(_a, ["style", "value", "label", "textError", "left", "right", "onChangeText", "disabled", "theme", "prefix", "suffix", "clearButton", "maxValue", "minValue", "type", "formatDecimal", "required", "labelStyle", "contentStyle", "textErrorStyle"]);
|
|
5668
5668
|
var theme = useInternalTheme();
|
|
5669
5669
|
var colors = theme.colors;
|
|
5670
5670
|
var _p = useState(false), isShowModalKeyboard = _p[0], setIsShowModalKeyboard = _p[1];
|
|
@@ -6053,15 +6053,21 @@ var TextInputNumber = function (_a) {
|
|
|
6053
6053
|
" ",
|
|
6054
6054
|
"*"))))),
|
|
6055
6055
|
React__default.createElement(View, { row: true, alignCenter: true },
|
|
6056
|
-
!checkValueEmpty() && prefix.toString() !== "" && (React__default.createElement(Text$1, { numberOfLines: 1, color: colors.textSecondary, style: [disabled && disabledTextStyle] },
|
|
6056
|
+
!checkValueEmpty() && prefix.toString() !== "" && (React__default.createElement(Text$1, { numberOfLines: 1, color: colors.textSecondary, style: [contentStyle, , disabled && disabledTextStyle] },
|
|
6057
6057
|
prefix, " ")),
|
|
6058
6058
|
React__default.createElement(View, { full: true },
|
|
6059
|
-
React__default.createElement(Text$1, { numberOfLines: 1, color: getColorValue, style: [
|
|
6059
|
+
React__default.createElement(Text$1, { numberOfLines: 1, color: getColorValue, style: [
|
|
6060
|
+
styles$c.text14,
|
|
6061
|
+
contentStyle,
|
|
6062
|
+
disabled && disabledTextStyle,
|
|
6063
|
+
] },
|
|
6060
6064
|
checkValueEmpty()
|
|
6061
6065
|
? label
|
|
6062
6066
|
: formatNumberInput$1(numberValue, formatDecimal),
|
|
6063
|
-
checkValueEmpty() && required && (React__default.createElement(Text$1, { color: colors.textErrorDefault },
|
|
6064
|
-
|
|
6067
|
+
checkValueEmpty() && required && (React__default.createElement(Text$1, { style: [contentStyle], color: colors.textErrorDefault },
|
|
6068
|
+
" ",
|
|
6069
|
+
"*")))),
|
|
6070
|
+
!checkValueEmpty() && suffix.toString() !== "" && (React__default.createElement(Text$1, { numberOfLines: 1, color: colors.textSecondary, style: [contentStyle, disabled && disabledTextStyle] }, " ",
|
|
6065
6071
|
suffix)))),
|
|
6066
6072
|
clearButton && !checkValueEmpty() && (React__default.createElement(TouchableOpacity, { style: {
|
|
6067
6073
|
alignContent: "center",
|
|
@@ -6074,7 +6080,7 @@ var TextInputNumber = function (_a) {
|
|
|
6074
6080
|
right && (React__default.createElement(View, { center: true, paddingLeft: SPACE_8, height: "100%" }, right)),
|
|
6075
6081
|
React__default.createElement(Spacer, { width: SPACE_12 }))),
|
|
6076
6082
|
!disabled && textError.length > 0 && (React__default.createElement(View, { paddingHorizontal: SPACE_12, paddingVertical: SPACE_4 },
|
|
6077
|
-
React__default.createElement(Text$1, { size: 12, numberOfLines: 1, color: theme.colors.textErrorDefault }, textError))),
|
|
6083
|
+
React__default.createElement(Text$1, { size: 12, numberOfLines: 1, color: theme.colors.textErrorDefault, style: [textErrorStyle] }, textError))),
|
|
6078
6084
|
React__default.createElement(Modal, { visible: isShowModalKeyboard, transparent: true, animationType: "fade", onRequestClose: onCloseModalKeyboard },
|
|
6079
6085
|
React__default.createElement(TouchableOpacity, { style: styles$c.modalOverlay, activeOpacity: 1, onPress: onCloseModalKeyboard },
|
|
6080
6086
|
React__default.createElement(View, { onPress: function () { }, activeOpacity: 1, backgroundColor: colors.surfacePrimaryDefault, style: styles$c.modalContent },
|
|
@@ -6214,7 +6220,7 @@ var DefaultRenderer = function (props) { return React__default.createElement(Tex
|
|
|
6214
6220
|
* @extends TextInput props https://reactnative.dev/docs/textinput#props
|
|
6215
6221
|
*/
|
|
6216
6222
|
var TextInput = forwardRef(function (_a, ref) {
|
|
6217
|
-
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, suffix = _a.suffix, maxValue = _a.maxValue, minValue = _a.minValue, type = _a.type, _j = _a.required, required = _j === void 0 ? false : _j, labelStyle = _a.labelStyle, rest = __rest(_a, ["mode", "dense", "disabled", "error", "multiline", "editable", "contentStyle", "render", "theme", "placeholderTextColor", "clearButton", "textError", "prefix", "suffix", "maxValue", "minValue", "type", "required", "labelStyle"]);
|
|
6223
|
+
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, suffix = _a.suffix, maxValue = _a.maxValue, minValue = _a.minValue, type = _a.type, _j = _a.required, required = _j === void 0 ? false : _j, labelStyle = _a.labelStyle, textErrorStyle = _a.textErrorStyle, rest = __rest(_a, ["mode", "dense", "disabled", "error", "multiline", "editable", "contentStyle", "render", "theme", "placeholderTextColor", "clearButton", "textError", "prefix", "suffix", "maxValue", "minValue", "type", "required", "labelStyle", "textErrorStyle"]);
|
|
6218
6224
|
var theme = useInternalTheme();
|
|
6219
6225
|
var isControlled = rest.value !== undefined;
|
|
6220
6226
|
var validInputValue = isControlled ? rest.value : rest.defaultValue;
|
|
@@ -6416,7 +6422,7 @@ var TextInput = forwardRef(function (_a, ref) {
|
|
|
6416
6422
|
}, 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 })));
|
|
6417
6423
|
}
|
|
6418
6424
|
if (mode === "number") {
|
|
6419
|
-
return (React__default.createElement(TextInputNumber$1, { textError: textError, disabled: disabled, prefix: prefix, suffix: suffix, value: value, right: rest.right, left: rest.left, required: required, label: rest.label, clearButton: clearButton, onChangeText: handleChangeText, maxValue: maxValue, minValue: minValue, formatDecimal: rest.formatDecimal, type: type, labelStyle: labelStyle }));
|
|
6425
|
+
return (React__default.createElement(TextInputNumber$1, { textError: textError, disabled: disabled, prefix: prefix, suffix: suffix, value: value, right: rest.right, left: rest.left, required: required, label: rest.label, clearButton: clearButton, onChangeText: handleChangeText, maxValue: maxValue, minValue: minValue, formatDecimal: rest.formatDecimal, type: type, labelStyle: labelStyle, textErrorStyle: textErrorStyle, contentStyle: contentStyle }));
|
|
6420
6426
|
}
|
|
6421
6427
|
return (React__default.createElement(TextInputFlat, __assign({ dense: dense, disabled: disabled, error: errorProp, textError: textError, editable: editable, prefix: prefix, suffix: suffix, clearButton: clearButton, required: required, render: render }, rest, { theme: theme, value: value, parentState: {
|
|
6422
6428
|
labeled: labeled,
|