sapo-components-ui-rn 1.1.19 → 1.1.21
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/assets/icon-radio-active.svg +5 -0
- package/dist/assets/icon-radio.svg +4 -0
- package/dist/assets/index.ts +13 -0
- package/dist/assets/svg/icon-radio-active.svg +5 -0
- package/dist/assets/svg/icon-radio.svg +4 -0
- package/dist/assets/svg/index.d.ts +7 -0
- package/dist/assets/svg/index.ts +13 -0
- package/dist/components/Icon/index.d.ts +0 -2
- package/dist/components/TextInput/constants.d.ts +2 -2
- package/dist/index.esm.js +55 -63
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +68 -74
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/assets/svg/icon-radio-active.svg +5 -0
- package/src/assets/svg/icon-radio.svg +4 -0
- package/src/assets/svg/index.ts +13 -0
- package/src/components/Checkbox/index.tsx +0 -1
- package/src/components/Icon/index.tsx +5 -47
- package/src/components/IconSvg/index.tsx +6 -7
- package/src/components/NumberKeyboard/index.tsx +1 -2
- package/src/components/RadioButton/index.tsx +1 -2
- package/src/components/SearchInput/index.tsx +2 -3
- package/src/components/SelectionField/index.tsx +1 -1
- package/src/components/Tag/index.tsx +0 -1
- package/src/components/Text/index.tsx +2 -2
- package/src/components/TextInput/TextInputDefault.tsx +1 -1
- package/src/components/TextInput/TextInputFlat.tsx +1 -1
- package/src/components/TextInput/TextInputNumber.tsx +2 -3
- package/src/components/TextInput/constants.tsx +2 -2
- package/src/components/Toast/index.tsx +1 -1
- package/src/icons/IconRadio.tsx +2 -9
- package/src/icons/IconRadioActive.tsx +3 -9
package/package.json
CHANGED
package/src/.DS_Store
ADDED
|
Binary file
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12Z" fill="#0088FF"/>
|
|
3
|
+
<circle cx="12" cy="12" r="6" fill="white"/>
|
|
4
|
+
<circle cx="12" cy="12" r="4" fill="#0088FF"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12Z" fill="#A3A8AF"/>
|
|
3
|
+
<path d="M6 12C6 8.68629 8.68629 6 12 6C15.3137 6 18 8.68629 18 12C18 15.3137 15.3137 18 12 18C8.68629 18 6 15.3137 6 12Z" fill="white"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import IconClose from "./icon-close.svg";
|
|
2
|
+
import IconCheckbox from "./icon-checkbox.svg";
|
|
3
|
+
import IconCheckboxActive from "./icon-checkbox-active.svg";
|
|
4
|
+
import IconRadio from "./icon-radio.svg";
|
|
5
|
+
import IconRadioActive from "./icon-radio-active.svg";
|
|
6
|
+
|
|
7
|
+
export const Svg = {
|
|
8
|
+
IconClose,
|
|
9
|
+
IconCheckbox,
|
|
10
|
+
IconCheckboxActive,
|
|
11
|
+
IconRadio,
|
|
12
|
+
IconRadioActive,
|
|
13
|
+
};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { StyleProp, TextStyle, TouchableOpacity, View } from "react-native";
|
|
3
|
-
import FontAwesome from "react-native-vector-icons/FontAwesome";
|
|
4
|
-
import MaterialIcons from "react-native-vector-icons/MaterialIcons";
|
|
5
|
-
import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons";
|
|
6
3
|
import { useInternalTheme } from "../../core/theming";
|
|
7
4
|
import { CONSTANTS } from "../../styles/themes/tokens";
|
|
8
5
|
import SvgIcon from "../IconSvg";
|
|
@@ -21,14 +18,6 @@ import IconInfo from "@/icons/IconInfo";
|
|
|
21
18
|
import IconWarning from "@/icons/IconWarning";
|
|
22
19
|
import IconDelNumber from "@/icons/IconDelNumber";
|
|
23
20
|
|
|
24
|
-
export type IconType =
|
|
25
|
-
| "FontAwesome"
|
|
26
|
-
| "Image"
|
|
27
|
-
| "MaterialIcons"
|
|
28
|
-
| "Feather"
|
|
29
|
-
| "MaterialCommunityIcons"
|
|
30
|
-
| "Svg";
|
|
31
|
-
|
|
32
21
|
export interface IconProps {
|
|
33
22
|
name:
|
|
34
23
|
| "IconCheckboxActive"
|
|
@@ -51,40 +40,20 @@ export interface IconProps {
|
|
|
51
40
|
style?: StyleProp<TextStyle>;
|
|
52
41
|
showBackground?: boolean;
|
|
53
42
|
onPress?: () => void;
|
|
54
|
-
type?: IconType;
|
|
55
43
|
tintColor?: string;
|
|
56
44
|
animatedProps?: Record<string, unknown>;
|
|
57
45
|
}
|
|
58
46
|
|
|
59
|
-
const getIconComponent = (type: IconType) => {
|
|
60
|
-
switch (type) {
|
|
61
|
-
case "MaterialIcons":
|
|
62
|
-
return MaterialIcons;
|
|
63
|
-
case "MaterialCommunityIcons":
|
|
64
|
-
return MaterialCommunityIcons;
|
|
65
|
-
case "FontAwesome":
|
|
66
|
-
default:
|
|
67
|
-
return FontAwesome;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
|
|
71
47
|
const Icon: React.FC<IconProps> = ({
|
|
72
48
|
name,
|
|
73
49
|
size = 14,
|
|
74
50
|
color,
|
|
75
51
|
style,
|
|
76
|
-
showBackground,
|
|
77
|
-
backgroundColor,
|
|
78
52
|
onPress,
|
|
79
|
-
type = "FontAwesome",
|
|
80
|
-
tintColor,
|
|
81
|
-
...rest
|
|
82
53
|
}) => {
|
|
83
54
|
const theme = useInternalTheme();
|
|
84
55
|
const { colors } = theme;
|
|
85
56
|
|
|
86
|
-
const IconComponent = useMemo(() => getIconComponent(type), [type]);
|
|
87
|
-
|
|
88
57
|
const renderName = () => {
|
|
89
58
|
switch (name) {
|
|
90
59
|
case "IconCheckboxActive":
|
|
@@ -121,23 +90,12 @@ const Icon: React.FC<IconProps> = ({
|
|
|
121
90
|
};
|
|
122
91
|
|
|
123
92
|
const renderIcon = () => {
|
|
124
|
-
if (type === "Svg") {
|
|
125
|
-
return (
|
|
126
|
-
<SvgIcon
|
|
127
|
-
name={renderName()}
|
|
128
|
-
width={size}
|
|
129
|
-
height={size}
|
|
130
|
-
color={color || colors.iconPrimaryDefault}
|
|
131
|
-
/>
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
93
|
return (
|
|
136
|
-
<
|
|
137
|
-
name={
|
|
138
|
-
|
|
94
|
+
<SvgIcon
|
|
95
|
+
name={renderName()}
|
|
96
|
+
width={size}
|
|
97
|
+
height={size}
|
|
139
98
|
color={color || colors.iconPrimaryDefault}
|
|
140
|
-
{...rest}
|
|
141
99
|
/>
|
|
142
100
|
);
|
|
143
101
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import colors from "../../theme/colors";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { Svg } from "../../assets/svg";
|
|
4
4
|
|
|
5
5
|
interface SvgIconProps {
|
|
6
6
|
name: any;
|
|
@@ -20,13 +20,12 @@ const SvgIcon: React.FC<SvgIconProps> = ({
|
|
|
20
20
|
onPress,
|
|
21
21
|
disabled = false,
|
|
22
22
|
}) => {
|
|
23
|
-
|
|
24
|
-
if (!name || typeof name !== "function") {
|
|
25
|
-
console.warn(`Icon is not a valid React component:`, name);
|
|
26
|
-
return <View style={{ width, height }} />;
|
|
27
|
-
}
|
|
23
|
+
const IconComponent = (Svg as any)[name];
|
|
28
24
|
|
|
29
|
-
|
|
25
|
+
if (!IconComponent) {
|
|
26
|
+
console.warn(`Icon "${name}" không tồn tại trong Svg.`);
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
30
29
|
|
|
31
30
|
return (
|
|
32
31
|
<IconComponent
|
|
@@ -217,7 +217,6 @@ const NumberKeyboard: React.FC<NumberKeyboardProps> = ({
|
|
|
217
217
|
<TouchableOpacity onPress={handleClear} style={styles.clearButton}>
|
|
218
218
|
<Icon
|
|
219
219
|
name="IconClearText"
|
|
220
|
-
type="Svg"
|
|
221
220
|
size={24}
|
|
222
221
|
color={colors.textSecondary}
|
|
223
222
|
/>
|
|
@@ -249,7 +248,7 @@ const NumberKeyboard: React.FC<NumberKeyboardProps> = ({
|
|
|
249
248
|
}
|
|
250
249
|
>
|
|
251
250
|
{key === "del" ? (
|
|
252
|
-
<Icon name="IconDelNumber"
|
|
251
|
+
<Icon name="IconDelNumber" size={24} />
|
|
253
252
|
) : (
|
|
254
253
|
<Text
|
|
255
254
|
style={[
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useMemo } from "react";
|
|
1
|
+
import React, { useState, useCallback, useMemo, useEffect } from "react";
|
|
2
2
|
import { StyleProp, ViewStyle, StyleSheet, TextStyle } from "react-native";
|
|
3
3
|
import View from "../View";
|
|
4
4
|
import { CONSTANTS } from "../../styles/themes/tokens";
|
|
@@ -63,7 +63,6 @@ const RadioButton = ({
|
|
|
63
63
|
? "IconRadioActive"
|
|
64
64
|
: "IconRadio"
|
|
65
65
|
}
|
|
66
|
-
type="Svg"
|
|
67
66
|
size={24}
|
|
68
67
|
color={getColorCheckbox}
|
|
69
68
|
/>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { StyleProp, ViewStyle,
|
|
2
|
+
import { StyleProp, ViewStyle, TextStyle } from "react-native";
|
|
3
3
|
import View from "../View";
|
|
4
|
-
import containerStyles from "../../theme/container-styles";
|
|
5
4
|
import Icon from "../Icon";
|
|
6
5
|
import TextInput from "../TextInput/TextInput";
|
|
7
6
|
import { useInternalTheme } from "../../core/theming";
|
|
@@ -49,7 +48,7 @@ const SearchInput = ({
|
|
|
49
48
|
<TextInput
|
|
50
49
|
left={
|
|
51
50
|
<View>
|
|
52
|
-
<Icon name={"IconSearch"}
|
|
51
|
+
<Icon name={"IconSearch"} size={18} />
|
|
53
52
|
</View>
|
|
54
53
|
}
|
|
55
54
|
disabled={disabled}
|
|
@@ -26,11 +26,11 @@ const Text = (props: IText) => {
|
|
|
26
26
|
fontWeight: "normal",
|
|
27
27
|
color: colors.textDefault,
|
|
28
28
|
fontFamily: "Inter-Regular",
|
|
29
|
-
fontSize:
|
|
29
|
+
fontSize: 14,
|
|
30
30
|
lineHeight: 20,
|
|
31
31
|
};
|
|
32
32
|
const {
|
|
33
|
-
size =
|
|
33
|
+
size = 14,
|
|
34
34
|
lineHeight,
|
|
35
35
|
center,
|
|
36
36
|
color,
|
|
@@ -393,7 +393,7 @@ const TextInputDefault = ({
|
|
|
393
393
|
onPress={handleClear}
|
|
394
394
|
style={multiline ? styles.clearButtonMultiline : styles.clearButton}
|
|
395
395
|
>
|
|
396
|
-
<Icon name={"IconClearText"}
|
|
396
|
+
<Icon name={"IconClearText"} size={24} />
|
|
397
397
|
</TouchableOpacity>
|
|
398
398
|
) : (
|
|
399
399
|
<Spacer width={CONSTANTS.SPACE_12} />
|
|
@@ -501,7 +501,7 @@ const TextInputFlat = ({
|
|
|
501
501
|
</View>
|
|
502
502
|
{parentState.focused && !disabled && clearButton && inputValue ? (
|
|
503
503
|
<TouchableOpacity onPress={handleClear} style={styles.clearButton}>
|
|
504
|
-
<Icon name="IconClearText"
|
|
504
|
+
<Icon name="IconClearText" size={24} />
|
|
505
505
|
</TouchableOpacity>
|
|
506
506
|
) : (
|
|
507
507
|
<Spacer width={SPACE_12} />
|
|
@@ -363,7 +363,7 @@ const TextInputNumber = ({
|
|
|
363
363
|
</View>
|
|
364
364
|
{clearButton && !checkValueEmpty() && (
|
|
365
365
|
<TouchableOpacity activeOpacity={0.8} onPress={handleClearInput}>
|
|
366
|
-
<Icon name={"IconClearText"}
|
|
366
|
+
<Icon name={"IconClearText"} size={24} />
|
|
367
367
|
</TouchableOpacity>
|
|
368
368
|
)}
|
|
369
369
|
{right && numberValue && (
|
|
@@ -430,7 +430,6 @@ const TextInputNumber = ({
|
|
|
430
430
|
>
|
|
431
431
|
<Icon
|
|
432
432
|
name="IconClearText"
|
|
433
|
-
type="Svg"
|
|
434
433
|
size={24}
|
|
435
434
|
color={colors.textSecondary}
|
|
436
435
|
/>
|
|
@@ -462,7 +461,7 @@ const TextInputNumber = ({
|
|
|
462
461
|
}
|
|
463
462
|
>
|
|
464
463
|
{key === "del" ? (
|
|
465
|
-
<Icon name="IconDelNumber"
|
|
464
|
+
<Icon name="IconDelNumber" size={24} />
|
|
466
465
|
) : (
|
|
467
466
|
<Text
|
|
468
467
|
style={[
|
|
@@ -236,7 +236,7 @@ const Toast = memoWithRef(
|
|
|
236
236
|
>
|
|
237
237
|
<View row style={{ alignItems: "flex-start" }}>
|
|
238
238
|
<View>
|
|
239
|
-
<Icon name={getSourceIcon()}
|
|
239
|
+
<Icon name={getSourceIcon()} size={20} />
|
|
240
240
|
</View>
|
|
241
241
|
<View full paddingLeft={CONSTANTS.SPACE_8}>
|
|
242
242
|
<Text bold color={colors.textOnFillDefault}>
|
package/src/icons/IconRadio.tsx
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import Svg, {
|
|
2
|
+
import Svg, { Circle } from "react-native-svg";
|
|
3
3
|
import { SvgProps } from "react-native-svg";
|
|
4
4
|
|
|
5
5
|
const IconRadio = (props: SvgProps) => (
|
|
6
6
|
<Svg width={24} height={24} viewBox="0 0 24 24" fill="none" {...props}>
|
|
7
|
-
<
|
|
8
|
-
d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12Z"
|
|
9
|
-
fill="#9F9FA9"
|
|
10
|
-
/>
|
|
11
|
-
<Path
|
|
12
|
-
d="M6 12C6 8.68629 8.68629 6 12 6C15.3137 6 18 8.68629 18 12C18 15.3137 15.3137 18 12 18C8.68629 18 6 15.3137 6 12Z"
|
|
13
|
-
fill="white"
|
|
14
|
-
/>
|
|
7
|
+
<Circle cx={12} cy={12} r={9.25} stroke="#A1A5AB" strokeWidth={1.5} />
|
|
15
8
|
</Svg>
|
|
16
9
|
);
|
|
17
10
|
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import Svg, { Circle
|
|
2
|
+
import Svg, { Circle } from "react-native-svg";
|
|
3
3
|
import { SvgProps } from "react-native-svg";
|
|
4
4
|
|
|
5
5
|
const IconRadioActive = (props: SvgProps) => (
|
|
6
6
|
<Svg width={24} height={24} viewBox="0 0 24 24" fill="none" {...props}>
|
|
7
|
-
|
|
8
|
-
<Circle cx={12} cy={12} r={6} fill="currentColor" />
|
|
9
|
-
<Path
|
|
10
|
-
d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12Z"
|
|
11
|
-
fill="#0071ED"
|
|
12
|
-
/>
|
|
13
|
-
<Circle cx="12" cy="12" r="6" fill="white" />
|
|
14
|
-
<Circle cx="12" cy="12" r="4" fill="#0071ED" />
|
|
7
|
+
<Circle cx={12} cy={12} r={9.25} stroke="currentColor" strokeWidth={1.5} />
|
|
8
|
+
<Circle cx={12} cy={12} r={6} fill="currentColor" />
|
|
15
9
|
</Svg>
|
|
16
10
|
);
|
|
17
11
|
|