sapo-components-ui-rn 1.1.72 → 1.1.74
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/.DS_Store +0 -0
- package/dist/components/SearchInput/index.d.ts +3 -2
- package/dist/index.esm.js +38 -92
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +38 -92
- package/dist/index.js.map +1 -1
- package/dist/styles/themes/tokens.d.ts +4 -0
- package/dist/theme/container-styles.d.ts +0 -57
- package/dist/theme/themes.d.ts +2 -0
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/SearchInput/index.tsx +12 -2
- package/src/components/TextInput/TextInputDefault.tsx +9 -17
- package/src/components/TextInput/TextInputFlat.tsx +2 -2
- package/src/components/TextInput/TextInputNumber.tsx +3 -3
- package/src/styles/themes/tokens.tsx +2 -0
- package/src/theme/container-styles.tsx +0 -55
- package/src/types.ts +2 -1
package/dist/.DS_Store
ADDED
|
Binary file
|
|
@@ -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 = {
|
|
@@ -5080,7 +5033,7 @@ var TextInputFlat = function (_a) {
|
|
|
5080
5033
|
borderRadius: BORDER_RADIUS_6,
|
|
5081
5034
|
borderWidth: 1,
|
|
5082
5035
|
borderColor: getBorderColor(),
|
|
5083
|
-
height:
|
|
5036
|
+
height: 36,
|
|
5084
5037
|
overflow: "hidden",
|
|
5085
5038
|
backgroundColor: disabled
|
|
5086
5039
|
? theme.colors.surfacePrimaryDisabled
|
|
@@ -5149,7 +5102,7 @@ var styles$e = StyleSheet.create({
|
|
|
5149
5102
|
input: {
|
|
5150
5103
|
// margin: 0,
|
|
5151
5104
|
flex: 1,
|
|
5152
|
-
height:
|
|
5105
|
+
height: 36,
|
|
5153
5106
|
},
|
|
5154
5107
|
inputFlat: {
|
|
5155
5108
|
paddingTop: 24,
|
|
@@ -5177,14 +5130,14 @@ var styles$e = StyleSheet.create({
|
|
|
5177
5130
|
});
|
|
5178
5131
|
|
|
5179
5132
|
var TextInputDefault = function (_a) {
|
|
5180
|
-
var _b
|
|
5181
|
-
var
|
|
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
|
|
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
|
|
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 =
|
|
5196
|
-
var
|
|
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("");
|
|
@@ -5341,7 +5294,7 @@ var TextInputDefault = function (_a) {
|
|
|
5341
5294
|
left && React$3.createElement(Spacer, { width: CONSTANTS.SPACE_8 }),
|
|
5342
5295
|
React$3.createElement(View, { full: true, style: [
|
|
5343
5296
|
{
|
|
5344
|
-
height: height ||
|
|
5297
|
+
height: height || 36,
|
|
5345
5298
|
},
|
|
5346
5299
|
] },
|
|
5347
5300
|
multiline && renderLabel(),
|
|
@@ -5355,27 +5308,20 @@ var TextInputDefault = function (_a) {
|
|
|
5355
5308
|
? textAlign
|
|
5356
5309
|
: I18nManager.getConstants().isRTL
|
|
5357
5310
|
? "right"
|
|
5358
|
-
: "left", height: height ? height :
|
|
5311
|
+
: "left", height: height ? height : 36, paddingTop: getPaddingTopValue(), paddingBottom: multiline ? CONSTANTS.SPACE_4 : 0 }),
|
|
5359
5312
|
contentStyle,
|
|
5360
5313
|
] }))) : (React$3.createElement(View, { style: {
|
|
5361
5314
|
flexDirection: "row",
|
|
5362
5315
|
} },
|
|
5363
|
-
|
|
5364
|
-
|
|
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:
|
|
5321
|
+
__assign(__assign({}, font), { fontSize: fontSize, lineHeight: lineHeight, fontWeight: fontWeight, color: inputTextColor, textAlignVertical: "center", height: height ? height : 36, paddingTop: getPaddingTopValue(), paddingBottom: 0 }),
|
|
5376
5322
|
contentStyle,
|
|
5377
5323
|
] })),
|
|
5378
|
-
|
|
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: {
|
|
@@ -5393,7 +5339,7 @@ var styles$d = StyleSheet.create({
|
|
|
5393
5339
|
input: {
|
|
5394
5340
|
margin: 0,
|
|
5395
5341
|
flex: 1,
|
|
5396
|
-
height:
|
|
5342
|
+
height: 36,
|
|
5397
5343
|
paddingLeft: 0,
|
|
5398
5344
|
},
|
|
5399
5345
|
clearButtonMultiline: {
|
|
@@ -5815,7 +5761,7 @@ var TextInputNumber = function (_a) {
|
|
|
5815
5761
|
borderRadius: BORDER_RADIUS_6,
|
|
5816
5762
|
},
|
|
5817
5763
|
{
|
|
5818
|
-
height: height ? height :
|
|
5764
|
+
height: height ? height : 36,
|
|
5819
5765
|
},
|
|
5820
5766
|
[
|
|
5821
5767
|
styles$c.border,
|
|
@@ -5931,7 +5877,7 @@ var TextInputNumber = function (_a) {
|
|
|
5931
5877
|
] }, "L\u01B0u"))))))));
|
|
5932
5878
|
};
|
|
5933
5879
|
var styles$c = StyleSheet.create(__assign(__assign({}, containerStyles), { disabled: { opacity: 0.6 }, container: {
|
|
5934
|
-
height:
|
|
5880
|
+
height: 36,
|
|
5935
5881
|
flexDirection: "row",
|
|
5936
5882
|
justifyContent: "space-between",
|
|
5937
5883
|
alignItems: "center",
|
|
@@ -5974,7 +5920,7 @@ var styles$c = StyleSheet.create(__assign(__assign({}, containerStyles), { disab
|
|
|
5974
5920
|
borderRadius: 8,
|
|
5975
5921
|
alignItems: "center",
|
|
5976
5922
|
justifyContent: "center",
|
|
5977
|
-
height:
|
|
5923
|
+
height: 36,
|
|
5978
5924
|
}, keyText: {
|
|
5979
5925
|
fontWeight: "500",
|
|
5980
5926
|
}, actionRow: {
|
|
@@ -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",
|
|
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
|
},
|