sapo-components-ui-rn 1.0.8 → 1.0.10
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/SelectionField/index.d.ts +2 -1
- package/dist/components/Toast/ToastProvider.d.ts +1 -1
- package/dist/index.esm.js +23 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +23 -7
- package/dist/index.js.map +1 -1
- package/dist/utils/toast-manager.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/SelectionField/index.tsx +11 -2
- package/src/components/Toast/ToastProvider.tsx +1 -1
- package/src/components/Toast/index.tsx +14 -6
- package/src/utils/toast-manager.tsx +2 -2
|
@@ -19,6 +19,7 @@ export interface SelectionFieldProps extends TouchableOpacityProps {
|
|
|
19
19
|
disabled?: boolean;
|
|
20
20
|
onPress?: (res?: any) => void;
|
|
21
21
|
theme?: ThemeProp;
|
|
22
|
+
required?: boolean;
|
|
22
23
|
}
|
|
23
|
-
declare const _default: React.MemoExoticComponent<({ style, content, label, error, borderColor, left, right, textStyle, labelStyle, textProps, onPress, disabled, textColor, labelColor, size, theme: themeOverrides, ...props }: SelectionFieldProps) => React.JSX.Element>;
|
|
24
|
+
declare const _default: React.MemoExoticComponent<({ style, content, label, error, borderColor, left, right, textStyle, labelStyle, textProps, onPress, disabled, textColor, labelColor, size, theme: themeOverrides, required, ...props }: SelectionFieldProps) => React.JSX.Element>;
|
|
24
25
|
export default _default;
|
package/dist/index.esm.js
CHANGED
|
@@ -6177,6 +6177,11 @@ var POSITION = {
|
|
|
6177
6177
|
TOP: "top",
|
|
6178
6178
|
BOTTOM: "bottom",
|
|
6179
6179
|
};
|
|
6180
|
+
var SPACER = {
|
|
6181
|
+
NORMAL: "normal",
|
|
6182
|
+
MEDIUM: "medium",
|
|
6183
|
+
LARGE: "large",
|
|
6184
|
+
};
|
|
6180
6185
|
var Toast = memoWithRef(function (_props, ref) {
|
|
6181
6186
|
var _a = useState("Thông báo"), message = _a[0], setMessage = _a[1];
|
|
6182
6187
|
var viewVisibleAnimatedRef = useRef(null);
|
|
@@ -6213,6 +6218,7 @@ var Toast = memoWithRef(function (_props, ref) {
|
|
|
6213
6218
|
onPress: onPress,
|
|
6214
6219
|
title: title,
|
|
6215
6220
|
duration: duration,
|
|
6221
|
+
spacer: spacer,
|
|
6216
6222
|
});
|
|
6217
6223
|
}, true);
|
|
6218
6224
|
};
|
|
@@ -6275,14 +6281,14 @@ var Toast = memoWithRef(function (_props, ref) {
|
|
|
6275
6281
|
var handleToastBottomHeight = function () {
|
|
6276
6282
|
var spacer = options.spacer;
|
|
6277
6283
|
if (typeof spacer === "number") {
|
|
6278
|
-
return spacer;
|
|
6284
|
+
return Math.max(0, spacer);
|
|
6279
6285
|
}
|
|
6280
6286
|
switch (spacer) {
|
|
6281
|
-
case
|
|
6287
|
+
case SPACER.NORMAL:
|
|
6282
6288
|
return 0;
|
|
6283
|
-
case
|
|
6289
|
+
case SPACER.MEDIUM:
|
|
6284
6290
|
return 72;
|
|
6285
|
-
case
|
|
6291
|
+
case SPACER.LARGE:
|
|
6286
6292
|
return 104;
|
|
6287
6293
|
default:
|
|
6288
6294
|
return 0;
|
|
@@ -6724,12 +6730,19 @@ var styles$1 = StyleSheet.create({
|
|
|
6724
6730
|
});
|
|
6725
6731
|
|
|
6726
6732
|
var SelectionField = function (_a) {
|
|
6727
|
-
var style = _a.style, _b = _a.content, content = _b === void 0 ? "content" : _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; _a.labelStyle; var textProps = _a.textProps, onPress = _a.onPress, _e = _a.disabled, disabled = _e === void 0 ? false : _e, textColor = _a.textColor, labelColor = _a.labelColor, _f = _a.size, size = _f === void 0 ? 16 : _f; _a.theme; var props = __rest(_a, ["style", "content", "label", "error", "borderColor", "left", "right", "textStyle", "labelStyle", "textProps", "onPress", "disabled", "textColor", "labelColor", "size", "theme"]);
|
|
6733
|
+
var style = _a.style, _b = _a.content, content = _b === void 0 ? "content" : _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; _a.labelStyle; var textProps = _a.textProps, onPress = _a.onPress, _e = _a.disabled, disabled = _e === void 0 ? false : _e, textColor = _a.textColor, labelColor = _a.labelColor, _f = _a.size, size = _f === void 0 ? 16 : _f; _a.theme; var _g = _a.required, required = _g === void 0 ? false : _g, props = __rest(_a, ["style", "content", "label", "error", "borderColor", "left", "right", "textStyle", "labelStyle", "textProps", "onPress", "disabled", "textColor", "labelColor", "size", "theme", "required"]);
|
|
6728
6734
|
var theme = useInternalTheme();
|
|
6729
6735
|
var colors = theme.colors;
|
|
6730
6736
|
var disabledTextStyle = {
|
|
6731
6737
|
color: colors.textSecondary,
|
|
6732
6738
|
};
|
|
6739
|
+
var getColor = function () {
|
|
6740
|
+
if (disabled)
|
|
6741
|
+
return colors.textPlaceholder;
|
|
6742
|
+
if (error.length > 0)
|
|
6743
|
+
return colors.textErrorDefault;
|
|
6744
|
+
return textColor || colors.textDefault;
|
|
6745
|
+
};
|
|
6733
6746
|
return (React__default.createElement(View, null,
|
|
6734
6747
|
React__default.createElement(ScaleButton$1, __assign({ activeOpacity: 0.8, onPress: onPress }, props, { disabled: disabled || false }),
|
|
6735
6748
|
React__default.createElement(View, { style: [
|
|
@@ -6764,8 +6777,11 @@ var SelectionField = function (_a) {
|
|
|
6764
6777
|
error.length > 0 && {
|
|
6765
6778
|
color: colors.textErrorDefault,
|
|
6766
6779
|
},
|
|
6767
|
-
] },
|
|
6768
|
-
|
|
6780
|
+
] },
|
|
6781
|
+
label,
|
|
6782
|
+
" ",
|
|
6783
|
+
required && React__default.createElement(Text$1, { color: colors.textErrorDefault }, "*"))),
|
|
6784
|
+
React__default.createElement(Text$1, __assign({ numberOfLines: 1, color: getColor(), size: size, style: [disabled && disabledTextStyle, textStyle] }, textProps), content.toString() === "" ? label : content)),
|
|
6769
6785
|
right || React__default.createElement(Icon$1, { name: "IconArrowDown", type: "Svg", size: 24 }),
|
|
6770
6786
|
React__default.createElement(Spacer, { width: SPACE_12 }))),
|
|
6771
6787
|
error.length > 0 && (React__default.createElement(View, { paddingHorizontal: SPACE_12, paddingVertical: SPACE_4 },
|