sapo-components-ui-rn 1.0.0 → 1.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sapo-components-ui-rn",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "React Native UI Components Library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -56,11 +56,11 @@ const ChipBar = ({
56
56
  borderWidth={1}
57
57
  alignCenter
58
58
  style={[
59
- style,
60
59
  disabled && {
61
60
  backgroundColor: colors.surfaceSecondaryDefault,
62
61
  borderColor: colors.surfaceSecondaryDefault,
63
62
  },
63
+ style,
64
64
  ]}
65
65
  onPress={handlePressChipBar}
66
66
  borderColor={
@@ -13,6 +13,7 @@ import IconRadioActive from "../../icons/IconRadioActive";
13
13
  import IconRadioDisable from "../../icons/IconRadioDisable";
14
14
  import IconArrowDown from "../../icons/IconArrowDown";
15
15
  import IconClearText from "../../icons/IconClearText";
16
+ import IconSearch from "@/icons/IconSearch";
16
17
 
17
18
  export type IconType =
18
19
  | "FontAwesome"
@@ -30,7 +31,8 @@ export interface IconProps {
30
31
  | "IconRadioActive"
31
32
  | "IconRadioDisable"
32
33
  | "IconArrowDown"
33
- | "IconClearText";
34
+ | "IconClearText"
35
+ | "IconSearch";
34
36
  backgroundColor?: string;
35
37
  size?: number;
36
38
  color?: string;
@@ -87,6 +89,8 @@ const Icon: React.FC<IconProps> = ({
87
89
  return IconArrowDown;
88
90
  case "IconClearText":
89
91
  return IconClearText;
92
+ case "IconSearch":
93
+ return IconSearch;
90
94
  default:
91
95
  return IconCheckbox;
92
96
  }
@@ -0,0 +1,60 @@
1
+ import React from "react";
2
+ import { StyleProp, ViewStyle, TextStyle } from "react-native";
3
+ import View from "../View";
4
+ import { SPACE_8 } from "../../theme/dimensions";
5
+ import Icon from "../Icon";
6
+ import TextInput from "../TextInput/TextInput";
7
+
8
+ interface SearchInputProps {
9
+ style?: StyleProp<ViewStyle>;
10
+ value?: string;
11
+ placeholder?: string;
12
+ textStyle?: StyleProp<TextStyle>;
13
+ disabled?: boolean;
14
+ leftIcon?: React.ReactNode;
15
+ rightIcon?: React.ReactNode;
16
+ clearButton?: boolean;
17
+ onFocus?: () => void;
18
+ onBlur?: () => void;
19
+ onChangeText?: (text: string) => void;
20
+ }
21
+
22
+ const SearchInput = ({
23
+ value = "",
24
+ disabled = false,
25
+ rightIcon,
26
+ clearButton = false,
27
+ placeholder = "Tìm kiếm",
28
+ onFocus,
29
+ onBlur,
30
+ onChangeText,
31
+ style,
32
+ }: SearchInputProps) => {
33
+ return (
34
+ <TextInput
35
+ left={
36
+ <View paddingRight={SPACE_8}>
37
+ <Icon name={"IconSearch"} type="Svg" size={24} />
38
+ </View>
39
+ }
40
+ disabled={disabled}
41
+ value={value}
42
+ clearButton={clearButton}
43
+ mode="default"
44
+ placeholder={placeholder}
45
+ right={rightIcon}
46
+ onFocus={onFocus}
47
+ onBlur={onBlur}
48
+ allowFontScaling={false}
49
+ onChangeText={onChangeText}
50
+ contentStyle={[
51
+ {
52
+ height: 36,
53
+ },
54
+ style,
55
+ ]}
56
+ />
57
+ );
58
+ };
59
+
60
+ export default SearchInput;
@@ -71,6 +71,7 @@ const ViewCustom = ({
71
71
  onPress,
72
72
  activeOpacity,
73
73
  children,
74
+ disabled,
74
75
  }: ViewProps) => {
75
76
  const getStyle = () => {
76
77
  const styleCustom: any = {};
@@ -165,6 +166,7 @@ const ViewCustom = ({
165
166
  <Component
166
167
  activeOpacity={activeOpacity}
167
168
  onPress={onPress}
169
+ disabled={disabled}
168
170
  style={[defaultStyle, style]}
169
171
  >
170
172
  {children}
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ import Svg, { Path } from "react-native-svg";
3
+ import { SvgProps } from "react-native-svg";
4
+
5
+ const IconSearch = (props: SvgProps) => (
6
+ <Svg width={16} height={16} viewBox="0 0 16 16" fill="none" {...props}>
7
+ <Path
8
+ 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"
9
+ fill="currentColor"
10
+ />
11
+ </Svg>
12
+ );
13
+
14
+ export default IconSearch;
package/src/index.ts CHANGED
@@ -30,7 +30,7 @@ export { default as Checkbox } from "./components/Checkbox";
30
30
  export { default as RadioButton } from "./components/RadioButton";
31
31
  export { default as Avatar } from "./components/Avatar";
32
32
  export { default as SelectionField } from "./components/SelectionField";
33
-
33
+ export { default as SearchInput } from "./components/SearchInput";
34
34
  // Types
35
35
  export type { Props as ActivityIndicatorProps } from "./components/ActivityIndicator";
36
36
  export type { Props as SwitchProps } from "./components/Switch/Switch";
package/src/index.tsx CHANGED
@@ -30,6 +30,7 @@ export { default as Checkbox } from "./components/Checkbox";
30
30
  export { default as RadioButton } from "./components/RadioButton";
31
31
  export { default as Avatar } from "./components/Avatar";
32
32
  export { default as SelectionField } from "./components/SelectionField";
33
+ export { default as SearchInput } from "./components/SearchInput";
33
34
  // Types
34
35
  export type { Props as ActivityIndicatorProps } from "./components/ActivityIndicator";
35
36
  export type { Props as SwitchProps } from "./components/Switch/Switch";
@@ -23,7 +23,7 @@ export const DarkTheme: AppTheme = {
23
23
  level5: "rgb(52, 49, 63)",
24
24
  },
25
25
  //new theme colors
26
- backgroundPrimary: ink.INK100,
26
+ backgroundPrimary: ink.INK5,
27
27
  backgroundSecondary: white.WHITE100,
28
28
  borderBrandDefault: blue.BLUE100,
29
29
  borderCriticalDefault: red.RED100,
@@ -104,7 +104,7 @@ export const DarkTheme: AppTheme = {
104
104
  surfaceWarningInverseHover: yellow.YELLOW20,
105
105
  surfaceWarningInversePressed: yellow.YELLOW40,
106
106
  surfaceWarningPressed: yellow.YELLOW120,
107
- textDefault: ink.INK5,
107
+ textDefault: ink.INK100,
108
108
  textDisabled: ink.INK20,
109
109
  textPlaceholder: ink.INK40,
110
110
  textSecondary: ink.INK60,
@@ -20,7 +20,7 @@ const ref = {
20
20
  gray: ink.INK60,
21
21
  backgroundLight: ink.INK80,
22
22
  //new theme colors
23
- backgroundPrimary: ink.INK100,
23
+ backgroundPrimary: ink.INK5,
24
24
  backgroundSecondary: white.WHITE100,
25
25
  borderBrandDefault: blue.BLUE100,
26
26
  borderCriticalDefault: red.RED100,
@@ -101,7 +101,7 @@ const ref = {
101
101
  surfaceWarningInverseHover: yellow.YELLOW20,
102
102
  surfaceWarningInversePressed: yellow.YELLOW40,
103
103
  surfaceWarningPressed: yellow.YELLOW120,
104
- textDefault: ink.INK5,
104
+ textDefault: ink.INK100,
105
105
  textDisabled: ink.INK20,
106
106
  textPlaceholder: ink.INK40,
107
107
  textSecondary: ink.INK60,