sapo-components-ui-rn 1.0.0 → 1.0.1

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/README.md CHANGED
@@ -29,13 +29,11 @@ Thư viện này yêu cầu các peer dependencies sau:
29
29
  ## Sử dụng
30
30
 
31
31
  ```tsx
32
- import { Button, Text } from 'sapo-components-ui-rn';
32
+ import { Button } from '@sapo/components-ui-rn';
33
33
 
34
34
  function MyComponent() {
35
35
  return (
36
- <Button onPress={() => console.log('Pressed')}>
37
- <Text>Click me</Text>
38
- </Button>
36
+ <Button disabled textStyle={{...}} title="My Button" onPress={()=> {}}/>
39
37
  );
40
38
  }
41
39
  ```
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { StyleProp, TextStyle } from "react-native";
3
3
  export type IconType = "FontAwesome" | "Image" | "MaterialIcons" | "Feather" | "MaterialCommunityIcons" | "Svg";
4
4
  export interface IconProps {
5
- name: "IconCheckboxActive" | "IconCheckbox" | "IconRadio" | "IconRadioActive" | "IconRadioDisable" | "IconArrowDown" | "IconClearText";
5
+ name: "IconCheckboxActive" | "IconCheckbox" | "IconRadio" | "IconRadioActive" | "IconRadioDisable" | "IconArrowDown" | "IconClearText" | "IconSearch";
6
6
  backgroundColor?: string;
7
7
  size?: number;
8
8
  color?: string;
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { StyleProp, ViewStyle, TextStyle } from "react-native";
3
+ interface SearchInputProps {
4
+ style?: StyleProp<ViewStyle>;
5
+ value?: string;
6
+ placeholder?: string;
7
+ textStyle?: StyleProp<TextStyle>;
8
+ disabled?: boolean;
9
+ leftIcon?: React.ReactNode;
10
+ rightIcon?: React.ReactNode;
11
+ clearButton?: boolean;
12
+ onFocus?: () => void;
13
+ onBlur?: () => void;
14
+ onChangeText?: (text: string) => void;
15
+ }
16
+ declare const SearchInput: ({ value, disabled, rightIcon, clearButton, placeholder, onFocus, onBlur, onChangeText, style, }: SearchInputProps) => React.JSX.Element;
17
+ export default SearchInput;
@@ -34,5 +34,5 @@ interface ViewProps {
34
34
  borderWidth?: number;
35
35
  borderColor?: string;
36
36
  }
37
- declare const _default: React.MemoExoticComponent<({ row, full, justifyCenter, justifyBetween, alignCenter, center, color, backgroundColor, width, height, padding, paddingHorizontal, paddingVertical, marginHorizontal, marginVertical, paddingLeft, paddingRight, paddingTop, alignEnd, wrap, borderBottomWidth, borderBottomColor, borderRadius, borderWidth, borderColor, style, onPress, activeOpacity, children, }: ViewProps) => React.JSX.Element>;
37
+ declare const _default: React.MemoExoticComponent<({ row, full, justifyCenter, justifyBetween, alignCenter, center, color, backgroundColor, width, height, padding, paddingHorizontal, paddingVertical, marginHorizontal, marginVertical, paddingLeft, paddingRight, paddingTop, alignEnd, wrap, borderBottomWidth, borderBottomColor, borderRadius, borderWidth, borderColor, style, onPress, activeOpacity, children, disabled, }: ViewProps) => React.JSX.Element>;
38
38
  export default _default;
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import { SvgProps } from "react-native-svg";
3
+ declare const IconSearch: (props: SvgProps) => React.JSX.Element;
4
+ export default IconSearch;
package/dist/index.d.ts CHANGED
@@ -24,6 +24,7 @@ export { default as Checkbox } from "./components/Checkbox";
24
24
  export { default as RadioButton } from "./components/RadioButton";
25
25
  export { default as Avatar } from "./components/Avatar";
26
26
  export { default as SelectionField } from "./components/SelectionField";
27
+ export { default as SearchInput } from "./components/SearchInput";
27
28
  export type { Props as ActivityIndicatorProps } from "./components/ActivityIndicator";
28
29
  export type { Props as SwitchProps } from "./components/Switch/Switch";
29
30
  export type { Props as TextInputProps } from "./components/TextInput/TextInput";
package/dist/index.esm.js CHANGED
@@ -226,7 +226,7 @@ var ref = {
226
226
  gray: ink.INK60,
227
227
  backgroundLight: ink.INK80,
228
228
  //new theme colors
229
- backgroundPrimary: ink.INK100,
229
+ backgroundPrimary: ink.INK5,
230
230
  backgroundSecondary: white.WHITE100,
231
231
  borderBrandDefault: blue.BLUE100,
232
232
  borderCriticalDefault: red.RED100,
@@ -307,7 +307,7 @@ var ref = {
307
307
  surfaceWarningInverseHover: yellow.YELLOW20,
308
308
  surfaceWarningInversePressed: yellow.YELLOW40,
309
309
  surfaceWarningPressed: yellow.YELLOW120,
310
- textDefault: ink.INK5,
310
+ textDefault: ink.INK100,
311
311
  textDisabled: ink.INK20,
312
312
  textPlaceholder: ink.INK40,
313
313
  textSecondary: ink.INK60,
@@ -1268,7 +1268,7 @@ var DarkTheme = __assign(__assign({}, LightTheme), { dark: true, mode: "adaptive
1268
1268
  level5: "rgb(52, 49, 63)",
1269
1269
  },
1270
1270
  //new theme colors
1271
- backgroundPrimary: ink.INK100,
1271
+ backgroundPrimary: ink.INK5,
1272
1272
  backgroundSecondary: white.WHITE100,
1273
1273
  borderBrandDefault: blue.BLUE100,
1274
1274
  borderCriticalDefault: red.RED100,
@@ -1349,7 +1349,7 @@ var DarkTheme = __assign(__assign({}, LightTheme), { dark: true, mode: "adaptive
1349
1349
  surfaceWarningInverseHover: yellow.YELLOW20,
1350
1350
  surfaceWarningInversePressed: yellow.YELLOW40,
1351
1351
  surfaceWarningPressed: yellow.YELLOW120,
1352
- textDefault: ink.INK5,
1352
+ textDefault: ink.INK100,
1353
1353
  textDisabled: ink.INK20,
1354
1354
  textPlaceholder: ink.INK40,
1355
1355
  textSecondary: ink.INK60,
@@ -1907,7 +1907,7 @@ var styles$g = StyleSheet.create({
1907
1907
  });
1908
1908
 
1909
1909
  var ViewCustom = function (_a) {
1910
- var row = _a.row, full = _a.full, justifyCenter = _a.justifyCenter, justifyBetween = _a.justifyBetween, alignCenter = _a.alignCenter, center = _a.center, color = _a.color, backgroundColor = _a.backgroundColor, width = _a.width, height = _a.height, padding = _a.padding, paddingHorizontal = _a.paddingHorizontal, paddingVertical = _a.paddingVertical, marginHorizontal = _a.marginHorizontal, marginVertical = _a.marginVertical, paddingLeft = _a.paddingLeft, paddingRight = _a.paddingRight, paddingTop = _a.paddingTop, alignEnd = _a.alignEnd, wrap = _a.wrap, borderBottomWidth = _a.borderBottomWidth, borderBottomColor = _a.borderBottomColor, borderRadius = _a.borderRadius, borderWidth = _a.borderWidth, borderColor = _a.borderColor, style = _a.style, onPress = _a.onPress, activeOpacity = _a.activeOpacity, children = _a.children;
1910
+ var row = _a.row, full = _a.full, justifyCenter = _a.justifyCenter, justifyBetween = _a.justifyBetween, alignCenter = _a.alignCenter, center = _a.center, color = _a.color, backgroundColor = _a.backgroundColor, width = _a.width, height = _a.height, padding = _a.padding, paddingHorizontal = _a.paddingHorizontal, paddingVertical = _a.paddingVertical, marginHorizontal = _a.marginHorizontal, marginVertical = _a.marginVertical, paddingLeft = _a.paddingLeft, paddingRight = _a.paddingRight, paddingTop = _a.paddingTop, alignEnd = _a.alignEnd, wrap = _a.wrap, borderBottomWidth = _a.borderBottomWidth, borderBottomColor = _a.borderBottomColor, borderRadius = _a.borderRadius, borderWidth = _a.borderWidth, borderColor = _a.borderColor, style = _a.style, onPress = _a.onPress, activeOpacity = _a.activeOpacity, children = _a.children, disabled = _a.disabled;
1911
1911
  var getStyle = function () {
1912
1912
  var styleCustom = {};
1913
1913
  if (row) {
@@ -1990,7 +1990,7 @@ var ViewCustom = function (_a) {
1990
1990
  };
1991
1991
  var defaultStyle = getStyle();
1992
1992
  var Component = onPress ? TouchableOpacity : View$1;
1993
- return (React__default.createElement(Component, { activeOpacity: activeOpacity, onPress: onPress, style: [defaultStyle, style] }, children));
1993
+ return (React__default.createElement(Component, { activeOpacity: activeOpacity, onPress: onPress, disabled: disabled, style: [defaultStyle, style] }, children));
1994
1994
  };
1995
1995
  var View = React__default.memo(ViewCustom);
1996
1996
 
@@ -2723,6 +2723,9 @@ var IconArrowDown = function (props) { return (React$3.createElement(Svg, __assi
2723
2723
  var IconClearText = function (props) { return (React$3.createElement(Svg, __assign({ width: 24, height: 24, viewBox: "0 0 24 24", fill: "none" }, props),
2724
2724
  React$3.createElement(Path, { d: "M12 2.00043C17.53 2.00043 22 6.47046 22 12.0004C21.9997 17.5302 17.5298 22.0004 12 22.0004C6.47016 22.0004 2.00026 17.5302 2 12.0004C2.00004 6.47046 6.47003 2.00043 12 2.00043ZM12 10.5903L9.41016 8.00043L8 9.40961L10.5898 12.0004L8 14.5903L9.41016 16.0004L12 13.4096L14.5898 16.0004L16 14.5903L13.4102 12.0004L16 9.40961L14.5898 8.00043L12 10.5903Z", fill: "currentColor" }))); };
2725
2725
 
2726
+ var IconSearch = function (props) { return (React$3.createElement(Svg, __assign({ width: 16, height: 16, viewBox: "0 0 16 16", fill: "none" }, props),
2727
+ React$3.createElement(Path, { d: "M15.7 14.3L11.5 10.1C11.3 9.9 11 9.8 10.7 9.8C11.5 8.8 12 7.4 12 6C12 2.7 9.3 0 6 0C2.7 0 0 2.7 0 6C0 9.3 2.7 12 6 12C7.4 12 8.8 11.5 9.8 10.6C9.8 10.9 9.8 11.2 10.1 11.4L14.3 15.6C14.5 15.8 14.8 15.9 15 15.9C15.2 15.9 15.5 15.8 15.7 15.6C16.1 15.3 16.1 14.7 15.7 14.3ZM6 10.5C3.5 10.5 1.5 8.5 1.5 6C1.5 3.5 3.5 1.5 6 1.5C8.5 1.5 10.5 3.5 10.5 6C10.5 8.5 8.5 10.5 6 10.5Z", fill: "currentColor" }))); };
2728
+
2726
2729
  var getIconComponent = function (type) {
2727
2730
  switch (type) {
2728
2731
  case "MaterialIcons":
@@ -2755,6 +2758,8 @@ var Icon = function (_a) {
2755
2758
  return IconArrowDown;
2756
2759
  case "IconClearText":
2757
2760
  return IconClearText;
2761
+ case "IconSearch":
2762
+ return IconSearch;
2758
2763
  default:
2759
2764
  return IconCheckbox;
2760
2765
  }
@@ -6496,11 +6501,11 @@ var ChipBar = function (_a) {
6496
6501
  }, [isActive]);
6497
6502
  return (React__default.createElement(View, { row: true },
6498
6503
  React__default.createElement(View, { row: true, disabled: disabled, paddingHorizontal: CONSTANTS.SPACE_12, paddingVertical: CONSTANTS.SPACE_8, borderRadius: borderRadius, borderWidth: 1, alignCenter: true, style: [
6499
- style,
6500
6504
  disabled && {
6501
6505
  backgroundColor: colors.surfaceSecondaryDefault,
6502
6506
  borderColor: colors.surfaceSecondaryDefault,
6503
6507
  },
6508
+ style,
6504
6509
  ], onPress: handlePressChipBar, borderColor: active ? colors.borderBrandDefault : colors.borderPrimaryDefault, backgroundColor: active
6505
6510
  ? colors.surfaceBrandInverseDefault
6506
6511
  : colors.backgroundSecondary },
@@ -6705,6 +6710,17 @@ var styles = StyleSheet.create(__assign(__assign({}, containerStyles), { disable
6705
6710
  } }));
6706
6711
  var index = React__default.memo(SelectionField);
6707
6712
 
6713
+ var SearchInput = function (_a) {
6714
+ 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;
6715
+ return (React__default.createElement(TextInput, { left: React__default.createElement(View, { paddingRight: SPACE_8 },
6716
+ React__default.createElement(Icon$1, { name: "IconSearch", type: "Svg", size: 24 })), disabled: disabled, value: value, clearButton: clearButton, mode: "default", placeholder: placeholder, right: rightIcon, onFocus: onFocus, onBlur: onBlur, allowFontScaling: false, onChangeText: onChangeText, contentStyle: [
6717
+ {
6718
+ height: 36,
6719
+ },
6720
+ style,
6721
+ ] }));
6722
+ };
6723
+
6708
6724
  var toastRef = React__default.createRef();
6709
6725
  var showToast = function (_a) {
6710
6726
  var message = _a.message, _b = _a.duration, duration = _b === void 0 ? 5000 : _b, _c = _a.position, position = _c === void 0 ? "top" : _c, _d = _a.type, type = _d === void 0 ? "success" : _d, _e = _a.onPress, onPress = _e === void 0 ? function () { } : _e, title = _a.title;
@@ -6754,5 +6770,5 @@ var ToastProvider = forwardRef$1(function (_a, ref) {
6754
6770
  renderToast()));
6755
6771
  });
6756
6772
 
6757
- export { ActivityIndicator, Avatar, Badge, index$3 as Button, index$2 as ButtonIcon, CONSTANTS, Checkbox, ChipBar, CountingDot, DarkTheme, DefaultTheme, index$1 as FloatingButton, Image$1 as Image, LightTheme, ProgressBar, RadioButton, index as SelectionField, Spacer, Switch, Text$1 as Text, TextInput, ThemeColors, ThemeProvider, Toast, ToastProvider, View, adaptNavigationTheme, configureFonts, overlay, shadow, showToast, toastRef, useTheme };
6773
+ export { ActivityIndicator, Avatar, Badge, index$3 as Button, index$2 as ButtonIcon, CONSTANTS, Checkbox, ChipBar, CountingDot, DarkTheme, DefaultTheme, index$1 as FloatingButton, Image$1 as Image, LightTheme, ProgressBar, RadioButton, SearchInput, index as SelectionField, Spacer, Switch, Text$1 as Text, TextInput, ThemeColors, ThemeProvider, Toast, ToastProvider, View, adaptNavigationTheme, configureFonts, overlay, shadow, showToast, toastRef, useTheme };
6758
6774
  //# sourceMappingURL=index.esm.js.map