sapo-components-ui-rn 1.0.31 → 1.0.33

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,7 +19,6 @@ export interface SelectionFieldProps extends TouchableOpacityProps {
19
19
  disabled?: boolean;
20
20
  onPress?: (res?: any) => void;
21
21
  theme?: ThemeProp;
22
- required?: boolean;
23
22
  }
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>;
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>;
25
24
  export default _default;
package/dist/index.esm.js CHANGED
@@ -2608,7 +2608,7 @@ var InputLabel = function (props) {
2608
2608
  var commonStyles = [
2609
2609
  placeholderStyle,
2610
2610
  {
2611
- top: topPosition,
2611
+ top: topPosition - (Platform.OS === "android" ? 3 : 2),
2612
2612
  },
2613
2613
  {
2614
2614
  maxWidth: labelWidth,
@@ -2701,6 +2701,21 @@ var Spacer = function (_a) {
2701
2701
  return React__default.createElement(View, { width: width, height: height, style: [style] });
2702
2702
  };
2703
2703
 
2704
+ Dimensions.get("window").height;
2705
+ Dimensions.get("window").width;
2706
+ var BUTTON_HEIGHT = 48;
2707
+ var BUTTON_HEIGHT_SMALL = 40;
2708
+ var SPACE_4 = 4;
2709
+ var SPACE_6 = 6;
2710
+ var SPACE_8 = 8;
2711
+ var SPACE_12 = 12;
2712
+ var SPACE_16 = 16;
2713
+ //MARK: Border radius
2714
+ var BORDER_RADIUS_6 = 6;
2715
+ //MARK: Border width
2716
+ StyleSheet.hairlineWidth; //0.3-0.5
2717
+ var BORDER_WIDTH_1 = 1;
2718
+
2704
2719
  var SvgIcon = function (_a) {
2705
2720
  var name = _a.name, _b = _a.width, width = _b === void 0 ? 24 : _b, _c = _a.height, height = _c === void 0 ? 24 : _c, _d = _a.color, color = _d === void 0 ? colors.ink.INK40 : _d, style = _a.style, onPress = _a.onPress, _e = _a.disabled, disabled = _e === void 0 ? false : _e;
2706
2721
  // Kiểm tra kỹ hơn
@@ -2819,7 +2834,7 @@ var TextInputFlat = function (_a) {
2819
2834
  var font = theme.fonts.bodyLarge;
2820
2835
  var hasActiveOutline = parentState.focused || error;
2821
2836
  var _h = getConstants(), LABEL_PADDING_TOP = _h.LABEL_PADDING_TOP, FLAT_INPUT_OFFSET = _h.FLAT_INPUT_OFFSET, MIN_HEIGHT = _h.MIN_HEIGHT;
2822
- var _j = (StyleSheet.flatten(style) || {}), fontSizeStyle = _j.fontSize, lineHeightStyle = _j.lineHeight, fontWeight = _j.fontWeight, height = _j.height, paddingHorizontal = _j.paddingHorizontal, textAlign = _j.textAlign, viewStyle = __rest(_j, ["fontSize", "lineHeight", "fontWeight", "height", "paddingHorizontal", "textAlign"]);
2837
+ var _j = (StyleSheet.flatten(style) || {}), fontSizeStyle = _j.fontSize, lineHeightStyle = _j.lineHeight, fontWeight = _j.fontWeight, height = _j.height, paddingHorizontal = _j.paddingHorizontal, textAlign = _j.textAlign; __rest(_j, ["fontSize", "lineHeight", "fontWeight", "height", "paddingHorizontal", "textAlign"]);
2823
2838
  var fontSize = fontSizeStyle || MAXIMIZED_LABEL_FONT_SIZE;
2824
2839
  var lineHeight = lineHeightStyle || (Platform.OS === "web" ? fontSize * 1.2 : undefined);
2825
2840
  var isPaddingHorizontalPassed = paddingHorizontal !== undefined && typeof paddingHorizontal === "number";
@@ -2843,11 +2858,11 @@ var TextInputFlat = function (_a) {
2843
2858
  error: error,
2844
2859
  theme: theme,
2845
2860
  }), inputTextColor = _l.inputTextColor, activeColor = _l.activeColor, placeholderColor = _l.placeholderColor, errorColor = _l.errorColor, backgroundColor = _l.backgroundColor, selectionColor = _l.selectionColor;
2846
- var containerStyle = {
2861
+ ({
2847
2862
  backgroundColor: backgroundColor,
2848
2863
  borderTopLeftRadius: theme.roundness,
2849
2864
  borderTopRightRadius: theme.roundness,
2850
- };
2865
+ });
2851
2866
  var labelScale = MINIMIZED_LABEL_FONT_SIZE / fontSize;
2852
2867
  var fontScale = MAXIMIZED_LABEL_FONT_SIZE / fontSize;
2853
2868
  var labelWidth = parentState.labelLayout.width;
@@ -2955,18 +2970,18 @@ var TextInputFlat = function (_a) {
2955
2970
  return (React$3.createElement(View$1, { style: {
2956
2971
  flexDirection: "row",
2957
2972
  alignItems: "center",
2958
- borderRadius: CONSTANTS.BORDER_RADIUS_6,
2973
+ borderRadius: BORDER_RADIUS_6,
2959
2974
  borderWidth: 1,
2960
2975
  borderColor: getBorderColor(),
2961
- height: 48,
2976
+ height: 44,
2962
2977
  overflow: "hidden",
2963
2978
  backgroundColor: disabled
2964
2979
  ? theme.colors.surfacePrimaryDisabled
2965
2980
  : theme.colors.surfacePrimaryDefault,
2966
2981
  } },
2967
2982
  React$3.createElement(View$1, { style: { flexDirection: "row" } },
2968
- left && (React$3.createElement(View$1, { style: { paddingLeft: CONSTANTS.SPACE_12 } }, left)),
2969
- left ? (React$3.createElement(Spacer, { width: CONSTANTS.SPACE_8 })) : (React$3.createElement(Spacer, { width: CONSTANTS.SPACE_12 }))),
2983
+ left && React$3.createElement(View$1, { style: { paddingLeft: SPACE_12 } }, left),
2984
+ left ? React$3.createElement(Spacer, { width: SPACE_8 }) : React$3.createElement(Spacer, { width: SPACE_12 })),
2970
2985
  React$3.createElement(Outline, { style: outlineStyle, label: label, roundness: roundness, hasActiveOutline: hasActiveOutline, focused: parentState.focused, activeColor: activeColor, outlineColor: outlineColor, backgroundColor: backgroundColor }),
2971
2986
  React$3.createElement(View$1, { onLayout: onInputLayout, style: [
2972
2987
  styles$c.labelContainer,
@@ -2975,31 +2990,21 @@ var TextInputFlat = function (_a) {
2975
2990
  flex: 1,
2976
2991
  },
2977
2992
  ] },
2978
- !isAndroid && multiline && !!label && !disabled && (React$3.createElement(View$1, { pointerEvents: "none", style: [
2979
- StyleSheet.absoluteFill,
2980
- dense ? styles$c.densePatchContainer : styles$c.patchContainer,
2981
- {
2982
- backgroundColor: viewStyle.backgroundColor || containerStyle.backgroundColor,
2983
- left: paddingLeft,
2984
- right: paddingRight,
2985
- },
2986
- ] })),
2987
2993
  label ? (React$3.createElement(InputLabel$1, __assign({ labeled: parentState.labeled, error: parentState.error, focused: parentState.focused, scaledLabel: scaledLabel, wiggle: Boolean(parentState.value && labelProps.labelError), labelLayoutMeasured: parentState.labelLayout.measured, labelLayoutWidth: parentState.labelLayout.width, labelLayoutHeight: parentState.labelLayout.height }, labelProps))) : null, render === null || render === void 0 ? void 0 :
2988
2994
  render(__assign(__assign({}, rest), { ref: innerRef, onChangeText: handleChangeText, value: inputValue, placeholder: rest.placeholder, editable: !disabled && editable, selectionColor: selectionColor, cursorColor: typeof cursorColor === "undefined" ? activeColor : cursorColor, placeholderTextColor: placeholderTextColorBasedOnState, onFocus: onFocus, onBlur: onBlur, underlineColorAndroid: "transparent", multiline: multiline, style: [
2989
2995
  styles$c.input,
2990
- __assign(__assign({ paddingLeft: paddingLeft, paddingRight: paddingRight, paddingTop: CONSTANTS.SPACE_12 }, font), { fontSize: fontSize, lineHeight: lineHeight, fontWeight: fontWeight, color: inputTextColor, textAlignVertical: multiline ? "top" : "center", textAlign: textAlign
2996
+ __assign(__assign({ paddingLeft: paddingLeft, paddingRight: paddingRight, paddingTop: parentState.focused || parentState.value ? SPACE_12 : 0 }, font), { fontSize: fontSize, lineHeight: lineHeight, fontWeight: fontWeight, color: inputTextColor, textAlignVertical: multiline ? "top" : "center", textAlign: textAlign
2991
2997
  ? textAlign
2992
2998
  : I18nManager.getConstants().isRTL
2993
2999
  ? "right"
2994
- : "left" }),
2995
- Platform.OS === "web" && { outline: "none" },
3000
+ : "left", marginTop: Platform.OS === "android" ? SPACE_8 : 0 }),
2996
3001
  contentStyle,
2997
3002
  ] }))),
2998
3003
  !disabled && clearButton && inputValue ? (React$3.createElement(TouchableOpacity, { onPress: handleClear, style: styles$c.clearButton },
2999
- React$3.createElement(Icon$1, { name: "IconClearText", type: "Svg", size: 24 }))) : (React$3.createElement(Spacer, { width: CONSTANTS.SPACE_12 })),
3004
+ React$3.createElement(Icon$1, { name: "IconClearText", type: "Svg", size: 24 }))) : (React$3.createElement(Spacer, { width: SPACE_12 })),
3000
3005
  React$3.createElement(View$1, { style: { flexDirection: "row" } },
3001
- right && React$3.createElement(Spacer, { width: CONSTANTS.SPACE_8 }),
3002
- right && (React$3.createElement(View$1, { style: { paddingRight: CONSTANTS.SPACE_12 } }, right)))));
3006
+ right && React$3.createElement(Spacer, { width: SPACE_8 }),
3007
+ right && React$3.createElement(View$1, { style: { paddingRight: SPACE_12 } }, right))));
3003
3008
  };
3004
3009
  var styles$c = StyleSheet.create({
3005
3010
  placeholder: {
@@ -3014,7 +3019,7 @@ var styles$c = StyleSheet.create({
3014
3019
  input: {
3015
3020
  // margin: 0,
3016
3021
  flex: 1,
3017
- height: 48,
3022
+ height: 44,
3018
3023
  },
3019
3024
  inputFlat: {
3020
3025
  paddingTop: 24,
@@ -3033,7 +3038,7 @@ var styles$c = StyleSheet.create({
3033
3038
  zIndex: 2,
3034
3039
  },
3035
3040
  clearButton: {
3036
- padding: CONSTANTS.SPACE_8,
3041
+ padding: SPACE_8,
3037
3042
  },
3038
3043
  });
3039
3044
 
@@ -6046,21 +6051,6 @@ var styles$9 = StyleSheet.create({
6046
6051
  });
6047
6052
  var index$2 = memoDeepEqual(ButtonIcon);
6048
6053
 
6049
- Dimensions.get("window").height;
6050
- Dimensions.get("window").width;
6051
- var BUTTON_HEIGHT = 48;
6052
- var BUTTON_HEIGHT_SMALL = 40;
6053
- var SPACE_4 = 4;
6054
- var SPACE_6 = 6;
6055
- var SPACE_8 = 8;
6056
- var SPACE_12 = 12;
6057
- var SPACE_16 = 16;
6058
- //MARK: Border radius
6059
- var BORDER_RADIUS_6 = 6;
6060
- //MARK: Border width
6061
- StyleSheet.hairlineWidth; //0.3-0.5
6062
- var BORDER_WIDTH_1 = 1;
6063
-
6064
6054
  var FloatingButton = function (_a) {
6065
6055
  var isLoading = _a.isLoading, disabled = _a.disabled, onPress = _a.onPress, style = _a.style, _b = _a.hiddenBackground, hiddenBackground = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? BUTTON_HEIGHT : _c, children = _a.children, backgroundColor = _a.backgroundColor, props = _a.props, _d = _a.top, top = _d === void 0 ? 0 : _d, _e = _a.right, right = _e === void 0 ? 0 : _e, _f = _a.left, left = _f === void 0 ? 0 : _f, _g = _a.bottom, bottom = _g === void 0 ? 0 : _g;
6066
6056
  var colors = useInternalTheme().colors;
@@ -6751,22 +6741,12 @@ var styles$2 = StyleSheet.create({
6751
6741
  });
6752
6742
 
6753
6743
  var SelectionField = function (_a) {
6754
- 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; _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"]);
6744
+ 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; _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 ? 14 : _f; _a.theme; var props = __rest(_a, ["style", "content", "label", "error", "borderColor", "left", "right", "textStyle", "labelStyle", "textProps", "onPress", "disabled", "textColor", "labelColor", "size", "theme"]);
6755
6745
  var theme = useInternalTheme();
6756
6746
  var colors = theme.colors;
6757
6747
  var disabledTextStyle = {
6758
6748
  color: colors.textSecondary,
6759
6749
  };
6760
- var getColor = function () {
6761
- if (disabled)
6762
- return colors.textPlaceholder;
6763
- if (error.length > 0)
6764
- return colors.textErrorDefault;
6765
- if (content.toString() === "") {
6766
- return textColor || colors.textSecondary;
6767
- }
6768
- return textColor || colors.textDefault;
6769
- };
6770
6750
  return (React__default.createElement(View, null,
6771
6751
  React__default.createElement(ScaleButton$1, __assign({ activeOpacity: 0.8, onPress: onPress }, props, { disabled: disabled || false }),
6772
6752
  React__default.createElement(View, { style: [
@@ -6793,27 +6773,22 @@ var SelectionField = function (_a) {
6793
6773
  ] },
6794
6774
  React__default.createElement(Spacer, { width: SPACE_12 }),
6795
6775
  React__default.createElement(View, { full: true },
6796
- content.toString() !== "" && label.toString() !== "" && (React__default.createElement(Text$1, { color: labelColor || colors.textSecondary, style: [
6797
- styles$1.text12,
6776
+ content.toString() !== "" && label.toString() !== "" && (React__default.createElement(Text$1, { size: 12, color: labelColor || colors.textSecondary, style: [
6798
6777
  disabled && {
6799
6778
  color: colors.textPlaceholder,
6800
6779
  },
6801
6780
  error.length > 0 && {
6802
6781
  color: colors.textErrorDefault,
6803
6782
  },
6804
- ] },
6805
- label,
6806
- required && React__default.createElement(Text$1, { color: colors.textErrorDefault }, " *"))),
6807
- React__default.createElement(Text$1, __assign({ numberOfLines: 1, color: getColor(), size: size, style: [disabled && disabledTextStyle, textStyle] }, textProps),
6808
- content.toString() === "" ? label : content,
6809
- required && content.toString() === "" && (React__default.createElement(Text$1, { color: colors.textErrorDefault }, " *")))),
6783
+ ] }, label)),
6784
+ React__default.createElement(Text$1, __assign({ numberOfLines: 1, color: textColor || colors.textDefault, size: size, style: [disabled && disabledTextStyle, textStyle] }, textProps), content.toString() === "" ? label : content)),
6810
6785
  right || React__default.createElement(Icon$1, { name: "IconArrowDown", type: "Svg", size: 24 }),
6811
6786
  React__default.createElement(Spacer, { width: SPACE_12 }))),
6812
6787
  error.length > 0 && (React__default.createElement(View, { paddingHorizontal: SPACE_12, paddingVertical: SPACE_4 },
6813
6788
  React__default.createElement(Text$1, { style: styles$1.text12, color: colors.textErrorDefault }, error)))));
6814
6789
  };
6815
6790
  var styles$1 = StyleSheet.create(__assign(__assign({}, containerStyles), { disabled: { opacity: 0.6 }, container: {
6816
- minHeight: BUTTON_HEIGHT,
6791
+ height: 48,
6817
6792
  flexDirection: "row",
6818
6793
  alignItems: "center",
6819
6794
  justifyContent: "space-between",
@@ -6827,14 +6802,15 @@ var index = React__default.memo(SelectionField);
6827
6802
 
6828
6803
  var SearchInput = function (_a) {
6829
6804
  var _b = _a.value, value = _b === void 0 ? "" : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, rightIcon = _a.rightIcon, _d = _a.clearButton, clearButton = _d === void 0 ? false : _d, _e = _a.placeholder, placeholder = _e === void 0 ? "Tìm kiếm" : _e, onFocus = _a.onFocus, onBlur = _a.onBlur, onChangeText = _a.onChangeText, style = _a.style, height = _a.height;
6830
- return (React__default.createElement(TextInput, { left: React__default.createElement(View, null,
6831
- React__default.createElement(Icon$1, { name: "IconSearch", type: "Svg", size: 20 })), disabled: disabled, value: value, clearButton: clearButton, mode: "default", label: placeholder, placeholder: placeholder, right: rightIcon, onFocus: onFocus, onBlur: onBlur, allowFontScaling: false, onChangeText: onChangeText, style: [
6805
+ return (React__default.createElement(TextInput, { left: React__default.createElement(View, { center: true },
6806
+ React__default.createElement(Icon$1, { name: "IconSearch", type: "Svg", size: 18 })), disabled: disabled, value: value, clearButton: clearButton, mode: "default", label: placeholder, placeholder: placeholder, right: rightIcon, onFocus: onFocus, onBlur: onBlur, allowFontScaling: false, onChangeText: onChangeText, style: [
6832
6807
  {
6833
6808
  height: height || 40,
6834
6809
  },
6835
6810
  style,
6836
6811
  ] }));
6837
6812
  };
6813
+ StyleSheet.create(__assign({}, containerStyles));
6838
6814
 
6839
6815
  var Tag = function (_a) {
6840
6816
  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.isActive, isActive = _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;