sapo-components-ui-rn 1.1.80 → 1.1.82
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/NumberKeyboard/index.d.ts +2 -0
- package/dist/components/Tag/index.d.ts +3 -3
- package/dist/components/TextInput/TextInput.d.ts +1 -1
- package/dist/components/TextInput/TextInputNumber.d.ts +2 -2
- package/dist/index.esm.js +30 -31
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +30 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
- package/src/components/NumberKeyboard/index.tsx +10 -2
- package/src/components/Tag/index.tsx +66 -68
- package/src/components/TextInput/TextInput.tsx +3 -4
- package/src/components/TextInput/TextInputNumber.tsx +3 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { ViewStyle, StyleProp } from 'react-native';
|
|
2
3
|
export interface NumberKeyboardProps {
|
|
3
4
|
/** Giá trị hiện tại của input */
|
|
4
5
|
value?: string | number;
|
|
@@ -18,6 +19,7 @@ export interface NumberKeyboardProps {
|
|
|
18
19
|
visible: boolean;
|
|
19
20
|
/** Callback khi đóng modal */
|
|
20
21
|
onClose: () => void;
|
|
22
|
+
keyboardStyle?: StyleProp<ViewStyle>;
|
|
21
23
|
}
|
|
22
24
|
declare const _default: React.NamedExoticComponent<NumberKeyboardProps>;
|
|
23
25
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { StyleProp, ViewStyle, TextStyle } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
3
3
|
interface TagProps {
|
|
4
4
|
style?: StyleProp<ViewStyle>;
|
|
5
5
|
title: string;
|
|
@@ -10,7 +10,7 @@ interface TagProps {
|
|
|
10
10
|
leftIcon?: React.ReactNode;
|
|
11
11
|
rightIcon?: React.ReactNode;
|
|
12
12
|
checked?: boolean;
|
|
13
|
-
ellipsizeMode?:
|
|
13
|
+
ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip';
|
|
14
14
|
numberOfLines?: number;
|
|
15
15
|
hideRightIcon?: boolean;
|
|
16
16
|
height?: number;
|
|
@@ -13,7 +13,7 @@ export type Props = React.ComponentPropsWithRef<typeof NativeTextInput> & {
|
|
|
13
13
|
maxValue?: number;
|
|
14
14
|
minValue?: number;
|
|
15
15
|
type?: 'integer' | 'float';
|
|
16
|
-
|
|
16
|
+
keyboardStyle?: StyleProp<ViewStyle>;
|
|
17
17
|
formatDecimal?: 1 | 2 | 3;
|
|
18
18
|
required?: boolean;
|
|
19
19
|
/**
|
|
@@ -3,7 +3,7 @@ import { StyleProp, ViewStyle, TouchableOpacityProps, TextStyle } from 'react-na
|
|
|
3
3
|
import { ThemeProp } from '../../types';
|
|
4
4
|
export interface TextInputNumberProps extends TouchableOpacityProps {
|
|
5
5
|
style?: StyleProp<ViewStyle>;
|
|
6
|
-
|
|
6
|
+
keyboardStyle?: StyleProp<ViewStyle>;
|
|
7
7
|
value?: string | number;
|
|
8
8
|
label?: string;
|
|
9
9
|
textError?: string;
|
|
@@ -25,5 +25,5 @@ export interface TextInputNumberProps extends TouchableOpacityProps {
|
|
|
25
25
|
textErrorStyle?: StyleProp<TextStyle>;
|
|
26
26
|
height?: number;
|
|
27
27
|
}
|
|
28
|
-
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, height,
|
|
28
|
+
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, height, keyboardStyle, ...props }: TextInputNumberProps) => React.JSX.Element>;
|
|
29
29
|
export default _default;
|
package/dist/index.esm.js
CHANGED
|
@@ -5413,7 +5413,7 @@ function formatShowInput(value, formatDecimal) {
|
|
|
5413
5413
|
return result;
|
|
5414
5414
|
}
|
|
5415
5415
|
var TextInputNumber = function (_a) {
|
|
5416
|
-
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, height = _a.height, _p = _a.
|
|
5416
|
+
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, height = _a.height, _p = _a.keyboardStyle, keyboardStyle = _p === void 0 ? {} : _p, props = __rest(_a, ["style", "value", "label", "textError", "left", "right", "onChangeText", "disabled", "theme", "prefix", "suffix", "clearButton", "maxValue", "minValue", "type", "formatDecimal", "required", "labelStyle", "contentStyle", "textErrorStyle", "height", "keyboardStyle"]);
|
|
5417
5417
|
var theme = useInternalTheme();
|
|
5418
5418
|
var colors = theme.colors;
|
|
5419
5419
|
var _q = useState(false), isShowModalKeyboard = _q[0], setIsShowModalKeyboard = _q[1];
|
|
@@ -5837,7 +5837,7 @@ var TextInputNumber = function (_a) {
|
|
|
5837
5837
|
React__default.createElement(Text$1, { size: 14, numberOfLines: 1, color: theme.colors.textErrorDefault, style: [textErrorStyle] }, textError))),
|
|
5838
5838
|
React__default.createElement(Modal, { visible: isShowModalKeyboard, transparent: true, animationType: "fade", onRequestClose: onCloseModalKeyboard },
|
|
5839
5839
|
React__default.createElement(TouchableOpacity, { style: styles$c.modalOverlay, activeOpacity: 1, onPress: onCloseModalKeyboard },
|
|
5840
|
-
React__default.createElement(View, { onPress: function () { }, activeOpacity: 1, backgroundColor: colors.surfacePrimaryDefault, style: [styles$c.modalContent,
|
|
5840
|
+
React__default.createElement(View, { onPress: function () { }, activeOpacity: 1, backgroundColor: colors.surfacePrimaryDefault, style: [styles$c.modalContent, keyboardStyle] },
|
|
5841
5841
|
React__default.createElement(Text$1, { style: [styles$c.modalTitle, styles$c.text18] }, label),
|
|
5842
5842
|
React__default.createElement(View, { width: '100%' },
|
|
5843
5843
|
React__default.createElement(View, { paddingHorizontal: SPACE_40 },
|
|
@@ -5976,7 +5976,7 @@ var DefaultRenderer = function (props) { return React__default.createElement(Tex
|
|
|
5976
5976
|
* @extends TextInput props https://reactnative.dev/docs/textinput#props
|
|
5977
5977
|
*/
|
|
5978
5978
|
var TextInput = forwardRef(function (_a, ref) {
|
|
5979
|
-
var _b = _a.mode, mode = _b === void 0 ? 'default' : _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,
|
|
5979
|
+
var _b = _a.mode, mode = _b === void 0 ? 'default' : _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, keyboardStyle = _a.keyboardStyle, rest = __rest(_a, ["mode", "dense", "disabled", "error", "multiline", "editable", "contentStyle", "render", "theme", "placeholderTextColor", "clearButton", "textError", "prefix", "suffix", "maxValue", "minValue", "type", "required", "keyboardStyle"]);
|
|
5980
5980
|
var theme = useInternalTheme();
|
|
5981
5981
|
var isControlled = rest.value !== undefined;
|
|
5982
5982
|
var validInputValue = isControlled ? rest.value : rest.defaultValue;
|
|
@@ -6178,7 +6178,7 @@ var TextInput = forwardRef(function (_a, ref) {
|
|
|
6178
6178
|
}, 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 })));
|
|
6179
6179
|
}
|
|
6180
6180
|
if (mode === 'number') {
|
|
6181
|
-
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,
|
|
6181
|
+
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, keyboardStyle: keyboardStyle }));
|
|
6182
6182
|
}
|
|
6183
6183
|
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: {
|
|
6184
6184
|
labeled: labeled,
|
|
@@ -7227,36 +7227,35 @@ var SearchInput = function (_a) {
|
|
|
7227
7227
|
};
|
|
7228
7228
|
|
|
7229
7229
|
var Tag = function (_a) {
|
|
7230
|
-
var style = _a.style, _b = _a.borderRadius, borderRadius = _b === void 0 ? CONSTANTS.BORDER_RADIUS_ROUNDED : _b, _c = _a.title, title = _c === void 0 ?
|
|
7230
|
+
var style = _a.style, _b = _a.borderRadius, borderRadius = _b === void 0 ? CONSTANTS.BORDER_RADIUS_ROUNDED : _b, _c = _a.title, title = _c === void 0 ? 'content' : _c, textStyle = _a.textStyle, onPress = _a.onPress, _d = _a.disabled, disabled = _d === void 0 ? false : _d, leftIcon = _a.leftIcon, rightIcon = _a.rightIcon, _e = _a.checked, checked = _e === void 0 ? false : _e, _f = _a.ellipsizeMode, ellipsizeMode = _f === void 0 ? 'tail' : _f, _g = _a.numberOfLines, numberOfLines = _g === void 0 ? 1 : _g, _h = _a.hideRightIcon, hideRightIcon = _h === void 0 ? false : _h, _j = _a.height, height = _j === void 0 ? 32 : _j;
|
|
7231
7231
|
var theme = useInternalTheme();
|
|
7232
7232
|
var colors = theme.colors;
|
|
7233
7233
|
var handlePressTag = useCallback(function () {
|
|
7234
7234
|
onPress === null || onPress === void 0 ? void 0 : onPress(!checked);
|
|
7235
7235
|
}, [checked]);
|
|
7236
|
-
return (React__default.createElement(View, { row: true
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
React__default.createElement(
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
React__default.createElement(SvgIcon, { name: "IconClose", width: 20, height: 20, color: colors.iconBrandDefault }))))));
|
|
7236
|
+
return (React__default.createElement(View, { row: true, height: height, disabled: disabled, paddingHorizontal: CONSTANTS.SPACE_12, paddingVertical: CONSTANTS.SPACE_8, borderRadius: borderRadius, center: true, style: [
|
|
7237
|
+
disabled && {
|
|
7238
|
+
backgroundColor: colors.surfaceSecondaryDefault,
|
|
7239
|
+
borderColor: colors.surfaceSecondaryDefault,
|
|
7240
|
+
},
|
|
7241
|
+
style,
|
|
7242
|
+
], onPress: handlePressTag, backgroundColor: checked
|
|
7243
|
+
? colors.surfaceBrandInversePressed
|
|
7244
|
+
: colors.surfaceBrandInverseDefault },
|
|
7245
|
+
leftIcon && React__default.createElement(View, { paddingRight: CONSTANTS.SPACE_4 }, leftIcon),
|
|
7246
|
+
React__default.createElement(View, { paddingHorizontal: CONSTANTS.SPACE_4 },
|
|
7247
|
+
React__default.createElement(Text$1, { size: 14, numberOfLines: numberOfLines, ellipsizeMode: ellipsizeMode, style: [
|
|
7248
|
+
styles$1.textMedium,
|
|
7249
|
+
{
|
|
7250
|
+
lineHeight: 16,
|
|
7251
|
+
},
|
|
7252
|
+
disabled && {
|
|
7253
|
+
color: colors.textSecondary,
|
|
7254
|
+
},
|
|
7255
|
+
textStyle,
|
|
7256
|
+
] }, title)),
|
|
7257
|
+
rightIcon ? (React__default.createElement(View, { paddingLeft: CONSTANTS.SPACE_4 }, rightIcon)) : hideRightIcon ? (React__default.createElement(View, null)) : (React__default.createElement(View, { paddingLeft: CONSTANTS.SPACE_4 },
|
|
7258
|
+
React__default.createElement(SvgIcon, { name: 'IconClose', width: 20, height: 20, color: colors.iconBrandDefault })))));
|
|
7260
7259
|
};
|
|
7261
7260
|
var styles$1 = StyleSheet.create(__assign({}, containerStyles));
|
|
7262
7261
|
|
|
@@ -7281,7 +7280,7 @@ var formatNumberInput = function (value, formatDecimal) {
|
|
|
7281
7280
|
return result;
|
|
7282
7281
|
};
|
|
7283
7282
|
var NumberKeyboard = function (_a) {
|
|
7284
|
-
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 ? 999999999999 : _d, _e = _a.minValue, minValue = _e === void 0 ? 0 : _e, _f = _a.type, type = _f === void 0 ? 'integer' : _f, _g = _a.formatDecimal, formatDecimal = _g === void 0 ? 3 : _g, visible = _a.visible, onClose = _a.onClose;
|
|
7283
|
+
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 ? 999999999999 : _d, _e = _a.minValue, minValue = _e === void 0 ? 0 : _e, _f = _a.type, type = _f === void 0 ? 'integer' : _f, _g = _a.formatDecimal, formatDecimal = _g === void 0 ? 3 : _g, visible = _a.visible, onClose = _a.onClose, keyboardStyle = _a.keyboardStyle;
|
|
7285
7284
|
var theme = useInternalTheme();
|
|
7286
7285
|
var colors = theme.colors;
|
|
7287
7286
|
var _h = useState((value === null || value === void 0 ? void 0 : value.toString()) || ''), inputValue = _h[0], setInputValue = _h[1];
|
|
@@ -7587,7 +7586,7 @@ var NumberKeyboard = function (_a) {
|
|
|
7587
7586
|
}, [onClose, value]);
|
|
7588
7587
|
return (React__default.createElement(Modal, { visible: visible, transparent: true, animationType: "fade", onRequestClose: handleClose },
|
|
7589
7588
|
React__default.createElement(TouchableOpacity, { style: styles.modalOverlay, activeOpacity: 1, onPress: handleClose },
|
|
7590
|
-
React__default.createElement(View, { onPress: function () { }, activeOpacity: 1, backgroundColor: colors.surfacePrimaryDefault, style: styles.modalContent },
|
|
7589
|
+
React__default.createElement(View, { onPress: function () { }, activeOpacity: 1, backgroundColor: colors.surfacePrimaryDefault, style: [styles.modalContent, keyboardStyle] },
|
|
7591
7590
|
React__default.createElement(Text$1, { style: [styles.text18, styles.modalTitle] }, label),
|
|
7592
7591
|
React__default.createElement(View, { width: '100%' },
|
|
7593
7592
|
React__default.createElement(View, { paddingHorizontal: SPACE_40 },
|