sapo-components-ui-rn 1.1.72 → 1.1.73

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.
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { StyleProp, ViewStyle, TextStyle } from "react-native";
2
+ import { StyleProp, ViewStyle, TextStyle, TextInput as TextInputNative } from "react-native";
3
3
  interface SearchInputProps {
4
4
  style?: StyleProp<ViewStyle>;
5
5
  value?: string;
@@ -15,6 +15,7 @@ interface SearchInputProps {
15
15
  height?: number;
16
16
  debounceTime?: number;
17
17
  autoFocus?: boolean;
18
+ ref?: React.RefObject<TextInputNative | null>;
18
19
  }
19
- declare const SearchInput: ({ value, disabled, rightIcon, clearButton, placeholder, onFocus, onBlur, onChangeText, style, height, debounceTime, autoFocus, textStyle, }: SearchInputProps) => React.JSX.Element;
20
+ declare const SearchInput: ({ value, disabled, rightIcon, clearButton, placeholder, onFocus, onBlur, onChangeText, style, height, debounceTime, autoFocus, textStyle, ref, }: SearchInputProps) => React.JSX.Element;
20
21
  export default SearchInput;
package/dist/index.esm.js CHANGED
@@ -249,6 +249,7 @@ var ref = {
249
249
  borderCriticalPressed: red.RED120,
250
250
  borderErrorDefault: red.RED100,
251
251
  borderInfoDefault: blue.BLUE100,
252
+ borderInfoInverseDefault: blue.BLUE40,
252
253
  borderPrimaryDefault: ink.INK10,
253
254
  borderPrimaryDisabled: ink.INK20,
254
255
  borderPrimaryHovered: ink.INK40,
@@ -410,6 +411,7 @@ var ref = {
410
411
  borderCriticalPressed: red.RED120,
411
412
  borderErrorDefault: red.RED100,
412
413
  borderInfoDefault: blue.BLUE100,
414
+ borderInfoInverseDefault: blue.BLUE40,
413
415
  borderPrimaryDefault: ink.INK10,
414
416
  borderPrimaryDisabled: ink.INK20,
415
417
  borderPrimaryHovered: ink.INK40,
@@ -652,72 +654,7 @@ var CONSTANTS = {
652
654
  FONT_WEIGHT_BLACK: "900",
653
655
  };
654
656
 
655
- Dimensions.get("window").height;
656
- Dimensions.get("window").width;
657
- var BUTTON_HEIGHT = 48;
658
- var BUTTON_HEIGHT_SMALL = 40;
659
- var SPACE_4 = 4;
660
- var SPACE_6 = 6;
661
- var SPACE_8 = 8;
662
- var SPACE_12 = 12;
663
- var SPACE_16 = 16;
664
- var SPACE_40 = 40;
665
- //MARK: Border radius
666
- var BORDER_RADIUS_6 = 6;
667
- //MARK: Border width
668
- StyleSheet.hairlineWidth; //0.3-0.5
669
- var BORDER_WIDTH_1 = 1;
670
-
671
657
  var containerStyles = StyleSheet.create({
672
- container: { flex: 1 },
673
- center: {
674
- paddingHorizontal: SPACE_16,
675
- alignItems: "center",
676
- justifyContent: "center",
677
- },
678
- end: { alignItems: "flex-end" },
679
- start: { alignItems: "flex-start" },
680
- centerHorizontal: { justifyContent: "center" },
681
- icon: {
682
- backgroundColor: blue.BLUE100,
683
- justifyContent: "center",
684
- alignItems: "center",
685
- },
686
- row: {
687
- flexDirection: "row",
688
- },
689
- txtSmallBold: {
690
- fontSize: 12,
691
- color: ink.INK80,
692
- fontWeight: "600",
693
- },
694
- button: {
695
- borderRadius: 20,
696
- justifyContent: "center",
697
- alignItems: "center",
698
- width: 40,
699
- height: 40,
700
- backgroundColor: white.WHITE100,
701
- marginHorizontal: SPACE_8,
702
- },
703
- shadow: {
704
- shadowColor: "black",
705
- shadowOffset: {
706
- width: 1,
707
- height: 2,
708
- },
709
- shadowOpacity: 0.3,
710
- shadowRadius: 5,
711
- },
712
- hitSlop: {
713
- top: 10,
714
- right: 10,
715
- bottom: 10,
716
- left: 10,
717
- },
718
- transparent: {
719
- backgroundColor: "transparent",
720
- },
721
658
  //MARK: text size
722
659
  text10: {
723
660
  fontSize: 11,
@@ -4795,6 +4732,22 @@ var Spacer = function (_a) {
4795
4732
  return (React__default.createElement(View, { backgroundColor: backgroundColor || "transparent", width: width, height: height, style: [style] }));
4796
4733
  };
4797
4734
 
4735
+ Dimensions.get("window").height;
4736
+ Dimensions.get("window").width;
4737
+ var BUTTON_HEIGHT = 48;
4738
+ var BUTTON_HEIGHT_SMALL = 40;
4739
+ var SPACE_4 = 4;
4740
+ var SPACE_6 = 6;
4741
+ var SPACE_8 = 8;
4742
+ var SPACE_12 = 12;
4743
+ var SPACE_16 = 16;
4744
+ var SPACE_40 = 40;
4745
+ //MARK: Border radius
4746
+ var BORDER_RADIUS_6 = 6;
4747
+ //MARK: Border width
4748
+ StyleSheet.hairlineWidth; //0.3-0.5
4749
+ var BORDER_WIDTH_1 = 1;
4750
+
4798
4751
  var ICON100 = "#46515F";
4799
4752
  var ICON50 = "#A1A5AB";
4800
4753
  var icon = {
@@ -5177,14 +5130,14 @@ var styles$e = StyleSheet.create({
5177
5130
  });
5178
5131
 
5179
5132
  var TextInputDefault = function (_a) {
5180
- var _b, _c;
5181
- var _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.editable, editable = _e === void 0 ? true : _e, label = _a.label, _f = _a.error, error = _f === void 0 ? false : _f, customSelectionColor = _a.selectionColor, cursorColor = _a.cursorColor, customOutlineColor = _a.outlineColor, activeOutlineColor = _a.activeOutlineColor; _a.outlineStyle; var textColor = _a.textColor; _a.dense; var style = _a.style, theme = _a.theme, _g = _a.render, render = _g === void 0 ? function (props) { return React$3.createElement(TextInput$1, __assign({}, props)); } : _g, _h = _a.multiline, multiline = _h === void 0 ? false : _h, parentState = _a.parentState, innerRef = _a.innerRef, onFocus = _a.onFocus; _a.forceFocus; var onBlur = _a.onBlur, onChangeText = _a.onChangeText; _a.onLayout; var left = _a.left, right = _a.right, prefix = _a.prefix, suffix = _a.suffix, placeholderTextColor = _a.placeholderTextColor, _j = _a.clearButton, clearButton = _j === void 0 ? false : _j, contentStyle = _a.contentStyle, _k = _a.value, value = _k === void 0 ? "" : _k, textError = _a.textError, required = _a.required, rest = __rest(_a, ["disabled", "editable", "label", "error", "selectionColor", "cursorColor", "outlineColor", "activeOutlineColor", "outlineStyle", "textColor", "dense", "style", "theme", "render", "multiline", "parentState", "innerRef", "onFocus", "forceFocus", "onBlur", "onChangeText", "onLayout", "left", "right", "prefix", "suffix", "placeholderTextColor", "clearButton", "contentStyle", "value", "textError", "required"]);
5133
+ var _b;
5134
+ var _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.editable, editable = _d === void 0 ? true : _d, label = _a.label, _e = _a.error, error = _e === void 0 ? false : _e, customSelectionColor = _a.selectionColor, cursorColor = _a.cursorColor, customOutlineColor = _a.outlineColor, activeOutlineColor = _a.activeOutlineColor; _a.outlineStyle; var textColor = _a.textColor; _a.dense; var style = _a.style, theme = _a.theme, _f = _a.render, render = _f === void 0 ? function (props) { return React$3.createElement(TextInput$1, __assign({}, props)); } : _f, _g = _a.multiline, multiline = _g === void 0 ? false : _g, parentState = _a.parentState, innerRef = _a.innerRef, onFocus = _a.onFocus; _a.forceFocus; var onBlur = _a.onBlur, onChangeText = _a.onChangeText; _a.onLayout; var left = _a.left, right = _a.right, prefix = _a.prefix, suffix = _a.suffix, placeholderTextColor = _a.placeholderTextColor, _h = _a.clearButton, clearButton = _h === void 0 ? false : _h, contentStyle = _a.contentStyle, _j = _a.value, value = _j === void 0 ? "" : _j, textError = _a.textError, required = _a.required, rest = __rest(_a, ["disabled", "editable", "label", "error", "selectionColor", "cursorColor", "outlineColor", "activeOutlineColor", "outlineStyle", "textColor", "dense", "style", "theme", "render", "multiline", "parentState", "innerRef", "onFocus", "forceFocus", "onBlur", "onChangeText", "onLayout", "left", "right", "prefix", "suffix", "placeholderTextColor", "clearButton", "contentStyle", "value", "textError", "required"]);
5182
5135
  var colors = theme.colors;
5183
5136
  var font = theme.fonts.bodyLarge;
5184
- var _l = (StyleSheet.flatten(style) || {}), fontSizeStyle = _l.fontSize, fontWeight = _l.fontWeight, lineHeightStyle = _l.lineHeight, height = _l.height, _m = _l.backgroundColor; _m === void 0 ? colors === null || colors === void 0 ? void 0 : colors.backgroundPrimary : _m; var textAlign = _l.textAlign; _l.minHeight; var viewStyle = __rest(_l, ["fontSize", "fontWeight", "lineHeight", "height", "backgroundColor", "textAlign", "minHeight"]);
5137
+ var _k = (StyleSheet.flatten(style) || {}), fontSizeStyle = _k.fontSize, fontWeight = _k.fontWeight, lineHeightStyle = _k.lineHeight, height = _k.height, _l = _k.backgroundColor; _l === void 0 ? colors === null || colors === void 0 ? void 0 : colors.backgroundPrimary : _l; var textAlign = _k.textAlign; _k.minHeight; var viewStyle = __rest(_k, ["fontSize", "fontWeight", "lineHeight", "height", "backgroundColor", "textAlign", "minHeight"]);
5185
5138
  var fontSize = fontSizeStyle || MAXIMIZED_LABEL_FONT_SIZE;
5186
5139
  var lineHeight = lineHeightStyle || (Platform.OS === "web" ? fontSize * 1.2 : undefined);
5187
- var _o = getOutlinedInputColors({
5140
+ var _m = getOutlinedInputColors({
5188
5141
  activeOutlineColor: activeOutlineColor,
5189
5142
  customOutlineColor: customOutlineColor,
5190
5143
  customSelectionColor: customSelectionColor,
@@ -5192,8 +5145,8 @@ var TextInputDefault = function (_a) {
5192
5145
  disabled: disabled,
5193
5146
  error: error,
5194
5147
  theme: theme,
5195
- }), inputTextColor = _o.inputTextColor, activeColor = _o.activeColor, selectionColor = _o.selectionColor;
5196
- var _p = React$3.useState(value || ""), inputValue = _p[0], setInputValue = _p[1];
5148
+ }), inputTextColor = _m.inputTextColor, activeColor = _m.activeColor, selectionColor = _m.selectionColor;
5149
+ var _o = React$3.useState(value || ""), inputValue = _o[0], setInputValue = _o[1];
5197
5150
  React$3.useEffect(function () {
5198
5151
  if (value === undefined) {
5199
5152
  setInputValue("");
@@ -5360,22 +5313,15 @@ var TextInputDefault = function (_a) {
5360
5313
  ] }))) : (React$3.createElement(View, { style: {
5361
5314
  flexDirection: "row",
5362
5315
  } },
5363
- !multiline &&
5364
- prefix &&
5365
- (prefix === null || prefix === void 0 ? void 0 : prefix.toString()) !== "" &&
5366
- renderPrefix(), render === null || render === void 0 ? void 0 :
5367
- render(__assign(__assign({}, rest), { ref: innerRef, onChangeText: handleChangeText, value: inputValue, placeholder: ((_c = parentState.value) === null || _c === void 0 ? void 0 : _c.toString()) == ""
5368
- ? parentState.focused
5369
- ? rest.placeholder
5370
- : label
5371
- : rest.placeholder, editable: !disabled && editable, selectionColor: selectionColor, cursorColor: typeof cursorColor === "undefined"
5316
+ prefix && (prefix === null || prefix === void 0 ? void 0 : prefix.toString()) !== "" && renderPrefix(), render === null || render === void 0 ? void 0 :
5317
+ render(__assign(__assign({}, rest), { ref: innerRef, onChangeText: handleChangeText, value: inputValue, placeholder: rest.placeholder, editable: !disabled && editable, selectionColor: selectionColor, cursorColor: typeof cursorColor === "undefined"
5372
5318
  ? activeColor
5373
5319
  : cursorColor, placeholderTextColor: placeholderTextColorBasedOnState, onFocus: onFocus, onBlur: onBlur, underlineColorAndroid: "transparent", multiline: multiline, style: [
5374
5320
  styles$d.input,
5375
- __assign(__assign({}, font), { fontSize: fontSize, lineHeight: lineHeight, fontWeight: fontWeight, color: inputTextColor, textAlignVertical: multiline ? "top" : "center", height: height ? height : 48, paddingTop: getPaddingTopValue(), paddingBottom: multiline ? CONSTANTS.SPACE_4 : 0 }),
5321
+ __assign(__assign({}, font), { fontSize: fontSize, lineHeight: lineHeight, fontWeight: fontWeight, color: inputTextColor, textAlignVertical: "center", height: height ? height : 48, paddingTop: getPaddingTopValue(), paddingBottom: 0 }),
5376
5322
  contentStyle,
5377
5323
  ] })),
5378
- !multiline && renderSuffix()))),
5324
+ renderSuffix()))),
5379
5325
  !disabled && clearButton && inputValue ? (React$3.createElement(TouchableOpacity, { onPress: handleClear, style: multiline ? styles$d.clearButtonMultiline : styles$d.clearButton },
5380
5326
  React$3.createElement(SvgIcon, { name: "IconClearText", width: 24, height: 24 }))) : (React$3.createElement(Spacer, { width: CONSTANTS.SPACE_12 })),
5381
5327
  checkLineRightAction() && (React$3.createElement(Spacer, { width: 1, height: 24, backgroundColor: colors.borderPrimaryDefault, style: {
@@ -7252,14 +7198,14 @@ var styles$2 = StyleSheet.create(__assign(__assign({}, containerStyles), { disab
7252
7198
  var index$1 = React__default.memo(SelectionField);
7253
7199
 
7254
7200
  var SearchInput = function (_a) {
7255
- 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, _f = _a.debounceTime, debounceTime = _f === void 0 ? 500 : _f, _g = _a.autoFocus, autoFocus = _g === void 0 ? false : _g, textStyle = _a.textStyle;
7201
+ 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, _f = _a.debounceTime, debounceTime = _f === void 0 ? 500 : _f, _g = _a.autoFocus, autoFocus = _g === void 0 ? false : _g, textStyle = _a.textStyle, ref = _a.ref;
7256
7202
  var theme = useInternalTheme();
7257
7203
  var colors = theme.colors;
7258
7204
  var debouncedOnChangeText = useDebouncedCallback(function (text) {
7259
7205
  onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(text);
7260
7206
  }, debounceTime);
7261
7207
  return (React__default.createElement(TextInput, { left: React__default.createElement(View, null,
7262
- React__default.createElement(SvgIcon, { name: "IconSearch", width: 24, height: 24 })), disabled: disabled, value: value, clearButton: clearButton, mode: "default", label: placeholder, placeholder: placeholder, placeholderTextColor: colors.textPlaceholder, right: rightIcon, onFocus: onFocus, autoFocus: autoFocus, onBlur: onBlur, allowFontScaling: false, onChangeText: debouncedOnChangeText, style: [
7208
+ React__default.createElement(SvgIcon, { name: "IconSearch", width: 24, height: 24 })), ref: ref, disabled: disabled, value: value, clearButton: clearButton, mode: "default", numberOfLines: 1, textBreakStrategy: "simple", multiline: false, placeholder: placeholder, placeholderTextColor: colors.textPlaceholder, right: rightIcon, onFocus: onFocus, autoFocus: autoFocus, onBlur: onBlur, allowFontScaling: false, onChangeText: debouncedOnChangeText, style: [
7263
7209
  {
7264
7210
  height: height || 36,
7265
7211
  },