sapo-components-ui-rn 1.1.50 → 1.1.52
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 -2
- package/dist/index.esm.js +12 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/SelectionField/index.tsx +7 -1
- package/src/components/TextInput/TextInput.tsx +2 -0
- package/src/components/TextInput/TextInputNumber.tsx +10 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { StyleProp, ViewStyle, TouchableOpacityProps } from "react-native";
|
|
2
|
+
import { StyleProp, ViewStyle, TouchableOpacityProps, TextStyle } from "react-native";
|
|
3
3
|
import { ThemeProp } from "../../types";
|
|
4
4
|
export interface TextInputNumberProps extends TouchableOpacityProps {
|
|
5
5
|
style?: StyleProp<ViewStyle>;
|
|
@@ -19,6 +19,7 @@ export interface TextInputNumberProps extends TouchableOpacityProps {
|
|
|
19
19
|
type?: "integer" | "float";
|
|
20
20
|
formatDecimal?: 1 | 2 | 3;
|
|
21
21
|
required?: boolean;
|
|
22
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
22
23
|
}
|
|
23
|
-
declare const _default: React.MemoExoticComponent<({ style, value, label, textError, left, right, onChangeText, disabled, theme: themeOverrides, prefix, suffix, clearButton, maxValue, minValue, type, formatDecimal, required, ...props }: TextInputNumberProps) => React.JSX.Element>;
|
|
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>;
|
|
24
25
|
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, props = __rest(_a, ["style", "value", "label", "textError", "left", "right", "onChangeText", "disabled", "theme", "prefix", "suffix", "clearButton", "maxValue", "minValue", "type", "formatDecimal", "required"]);
|
|
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"]);
|
|
5668
5668
|
var theme = useInternalTheme();
|
|
5669
5669
|
var colors = theme.colors;
|
|
5670
5670
|
var _p = useState(false), isShowModalKeyboard = _p[0], setIsShowModalKeyboard = _p[1];
|
|
@@ -6040,6 +6040,7 @@ var TextInputNumber = function (_a) {
|
|
|
6040
6040
|
React__default.createElement(View, { full: true, paddingRight: SPACE_4 },
|
|
6041
6041
|
!checkValueEmpty() && !checkLabelEmpty() && (React__default.createElement(View, null,
|
|
6042
6042
|
React__default.createElement(Text$1, { size: 12, color: colors.textSecondary, style: [
|
|
6043
|
+
labelStyle,
|
|
6043
6044
|
disabled && {
|
|
6044
6045
|
color: colors.textPlaceholder,
|
|
6045
6046
|
},
|
|
@@ -6048,7 +6049,9 @@ var TextInputNumber = function (_a) {
|
|
|
6048
6049
|
},
|
|
6049
6050
|
] },
|
|
6050
6051
|
label,
|
|
6051
|
-
required && React__default.createElement(Text$1, { color: colors.textErrorDefault },
|
|
6052
|
+
required && (React__default.createElement(Text$1, { style: [labelStyle], color: colors.textErrorDefault },
|
|
6053
|
+
" ",
|
|
6054
|
+
"*"))))),
|
|
6052
6055
|
React__default.createElement(View, { row: true, alignCenter: true },
|
|
6053
6056
|
!checkValueEmpty() && prefix.toString() !== "" && (React__default.createElement(Text$1, { numberOfLines: 1, color: colors.textSecondary, style: [disabled && disabledTextStyle] },
|
|
6054
6057
|
prefix, " ")),
|
|
@@ -6211,7 +6214,7 @@ var DefaultRenderer = function (props) { return React__default.createElement(Tex
|
|
|
6211
6214
|
* @extends TextInput props https://reactnative.dev/docs/textinput#props
|
|
6212
6215
|
*/
|
|
6213
6216
|
var TextInput = forwardRef(function (_a, ref) {
|
|
6214
|
-
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, rest = __rest(_a, ["mode", "dense", "disabled", "error", "multiline", "editable", "contentStyle", "render", "theme", "placeholderTextColor", "clearButton", "textError", "prefix", "suffix", "maxValue", "minValue", "type", "required"]);
|
|
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"]);
|
|
6215
6218
|
var theme = useInternalTheme();
|
|
6216
6219
|
var isControlled = rest.value !== undefined;
|
|
6217
6220
|
var validInputValue = isControlled ? rest.value : rest.defaultValue;
|
|
@@ -6413,7 +6416,7 @@ var TextInput = forwardRef(function (_a, ref) {
|
|
|
6413
6416
|
}, 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 })));
|
|
6414
6417
|
}
|
|
6415
6418
|
if (mode === "number") {
|
|
6416
|
-
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 }));
|
|
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 }));
|
|
6417
6420
|
}
|
|
6418
6421
|
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: {
|
|
6419
6422
|
labeled: labeled,
|
|
@@ -7337,7 +7340,7 @@ var styles$3 = StyleSheet.create({
|
|
|
7337
7340
|
});
|
|
7338
7341
|
|
|
7339
7342
|
var SelectionField = function (_a) {
|
|
7340
|
-
var style = _a.style, _b = _a.content, content = _b === void 0 ? "" : _b, _c = _a.label, label = _c === void 0 ? "" : _c, _d = _a.error, error = _d === void 0 ? "" : _d, borderColor = _a.borderColor; _a.left; var right = _a.right, textStyle = _a.textStyle
|
|
7343
|
+
var style = _a.style, _b = _a.content, content = _b === void 0 ? "" : _b, _c = _a.label, label = _c === void 0 ? "" : _c, _d = _a.error, error = _d === void 0 ? "" : _d, borderColor = _a.borderColor; _a.left; var right = _a.right, textStyle = _a.textStyle, labelStyle = _a.labelStyle, textProps = _a.textProps, onPress = _a.onPress, _e = _a.disabled, disabled = _e === void 0 ? false : _e, textColor = _a.textColor, labelColor = _a.labelColor; _a.theme; var _f = _a.required, required = _f === void 0 ? false : _f, props = __rest(_a, ["style", "content", "label", "error", "borderColor", "left", "right", "textStyle", "labelStyle", "textProps", "onPress", "disabled", "textColor", "labelColor", "theme", "required"]);
|
|
7341
7344
|
var theme = useInternalTheme();
|
|
7342
7345
|
var colors = theme.colors;
|
|
7343
7346
|
var disabledTextStyle = {
|
|
@@ -7381,6 +7384,7 @@ var SelectionField = function (_a) {
|
|
|
7381
7384
|
React__default.createElement(View, { full: true },
|
|
7382
7385
|
content.toString() !== "" && label.toString() !== "" && (React__default.createElement(Text$1, { color: labelColor || colors.textSecondary, style: [
|
|
7383
7386
|
styles$2.text12,
|
|
7387
|
+
labelStyle,
|
|
7384
7388
|
disabled && {
|
|
7385
7389
|
color: colors.textPlaceholder,
|
|
7386
7390
|
},
|
|
@@ -7389,7 +7393,9 @@ var SelectionField = function (_a) {
|
|
|
7389
7393
|
},
|
|
7390
7394
|
] },
|
|
7391
7395
|
label,
|
|
7392
|
-
required && React__default.createElement(Text$1, { color: colors.textErrorDefault },
|
|
7396
|
+
required && (React__default.createElement(Text$1, { style: [labelStyle], color: colors.textErrorDefault },
|
|
7397
|
+
" ",
|
|
7398
|
+
"*")))),
|
|
7393
7399
|
React__default.createElement(Text$1, __assign({ numberOfLines: 1, color: getColor(), style: [disabled && disabledTextStyle, textStyle] }, textProps),
|
|
7394
7400
|
content.toString() === "" ? label : content,
|
|
7395
7401
|
required && content.toString() === "" && (React__default.createElement(Text$1, { color: colors.textErrorDefault }, " *")))),
|