sapo-components-ui-rn 1.0.9 → 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.
|
@@ -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
|
@@ -6730,12 +6730,19 @@ var styles$1 = StyleSheet.create({
|
|
|
6730
6730
|
});
|
|
6731
6731
|
|
|
6732
6732
|
var SelectionField = function (_a) {
|
|
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 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"]);
|
|
6734
6734
|
var theme = useInternalTheme();
|
|
6735
6735
|
var colors = theme.colors;
|
|
6736
6736
|
var disabledTextStyle = {
|
|
6737
6737
|
color: colors.textSecondary,
|
|
6738
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
|
+
};
|
|
6739
6746
|
return (React__default.createElement(View, null,
|
|
6740
6747
|
React__default.createElement(ScaleButton$1, __assign({ activeOpacity: 0.8, onPress: onPress }, props, { disabled: disabled || false }),
|
|
6741
6748
|
React__default.createElement(View, { style: [
|
|
@@ -6770,8 +6777,11 @@ var SelectionField = function (_a) {
|
|
|
6770
6777
|
error.length > 0 && {
|
|
6771
6778
|
color: colors.textErrorDefault,
|
|
6772
6779
|
},
|
|
6773
|
-
] },
|
|
6774
|
-
|
|
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)),
|
|
6775
6785
|
right || React__default.createElement(Icon$1, { name: "IconArrowDown", type: "Svg", size: 24 }),
|
|
6776
6786
|
React__default.createElement(Spacer, { width: SPACE_12 }))),
|
|
6777
6787
|
error.length > 0 && (React__default.createElement(View, { paddingHorizontal: SPACE_12, paddingVertical: SPACE_4 },
|