@momo-kits/foundation 0.151.2-beta.1 → 0.152.1-beta.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/Application/BottomSheet.tsx +1 -1
- package/Application/BottomTab/Badge.tsx +15 -2
- package/Application/BottomTab/BottomTabBar.tsx +1 -1
- package/Application/BottomTab/CustomBottomTabItem.tsx +5 -3
- package/Application/BottomTab/TabBarIcon.tsx +8 -6
- package/Application/BottomTab/index.tsx +8 -14
- package/Application/Components/BackgroundImageView.tsx +1 -1
- package/Application/Components/HeaderAnimated.tsx +12 -11
- package/Application/Components/HeaderBackground.tsx +1 -1
- package/Application/Components/HeaderExtendHeader.tsx +31 -26
- package/Application/Components/HeaderLeft.tsx +1 -1
- package/Application/Components/HeaderRight.tsx +24 -20
- package/Application/Components/HeaderTitle.tsx +6 -2
- package/Application/Components/NavigationButton.tsx +12 -11
- package/Application/Components/SearchHeader.tsx +1 -1
- package/Application/ModalScreen.tsx +1 -1
- package/Application/NavigationContainer.tsx +5 -7
- package/Application/StackScreen.tsx +27 -23
- package/Application/WidgetContainer.tsx +1 -1
- package/Application/index.ts +12 -31
- package/Application/types.ts +45 -8
- package/Application/utils.tsx +41 -17
- package/Badge/Badge.tsx +14 -11
- package/Badge/BadgeRibbon.tsx +1 -1
- package/Button/index.tsx +32 -27
- package/CheckBox/index.tsx +23 -19
- package/Context/index.ts +23 -0
- package/Divider/DashDivider.tsx +10 -9
- package/Divider/index.tsx +7 -7
- package/Icon/index.tsx +9 -9
- package/IconButton/index.tsx +12 -10
- package/Image/index.tsx +9 -2
- package/Input/Input.tsx +2 -5
- package/Input/InputDropDown.tsx +31 -23
- package/Input/InputMoney.tsx +2 -5
- package/Input/InputOTP.tsx +2 -5
- package/Input/InputPhoneNumber.tsx +2 -5
- package/Input/InputSearch.tsx +2 -5
- package/Input/InputTextArea.tsx +1 -1
- package/Input/common.tsx +31 -24
- package/Layout/Card.tsx +1 -1
- package/Layout/FloatingButton.tsx +1 -1
- package/Layout/GridSystem.tsx +15 -14
- package/Layout/Item.tsx +1 -1
- package/Layout/Screen.tsx +5 -4
- package/Layout/Section.tsx +1 -1
- package/Layout/TrackingScope.tsx +3 -3
- package/Loader/DotLoader.tsx +7 -7
- package/Loader/ProgressBar.tsx +10 -9
- package/Loader/Spinner.tsx +7 -7
- package/Pagination/Dot.tsx +10 -7
- package/Pagination/PaginationDot.tsx +8 -8
- package/Pagination/PaginationScroll.tsx +12 -10
- package/Popup/PopupNotify.tsx +2 -2
- package/Popup/PopupPromotion.tsx +1 -1
- package/Radio/index.tsx +18 -18
- package/Skeleton/index.tsx +1 -1
- package/Switch/index.tsx +17 -12
- package/Text/index.tsx +1 -1
- package/Title/index.tsx +48 -29
- package/index.ts +1 -0
- package/package.json +1 -1
- package/Application/Components/index.ts +0 -7
package/Divider/index.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, {useContext} from 'react';
|
|
2
|
-
import {View, ViewStyle} from 'react-native';
|
|
3
|
-
import {ApplicationContext} from '../
|
|
4
|
-
import {Spacing} from '../Consts';
|
|
5
|
-
import {DashDivider} from './DashDivider';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { View, ViewStyle } from 'react-native';
|
|
3
|
+
import { ApplicationContext } from '../Context';
|
|
4
|
+
import { Spacing } from '../Consts';
|
|
5
|
+
import { DashDivider } from './DashDivider';
|
|
6
6
|
|
|
7
7
|
export interface DividerProps {
|
|
8
8
|
/**
|
|
@@ -23,7 +23,7 @@ const Divider: React.FC<DividerProps> = ({
|
|
|
23
23
|
useMargin = true,
|
|
24
24
|
type = 'default',
|
|
25
25
|
}) => {
|
|
26
|
-
const {theme} = useContext(ApplicationContext);
|
|
26
|
+
const { theme } = useContext(ApplicationContext);
|
|
27
27
|
|
|
28
28
|
if (type === 'dash') return <DashDivider style={style} />;
|
|
29
29
|
|
|
@@ -42,4 +42,4 @@ const Divider: React.FC<DividerProps> = ({
|
|
|
42
42
|
);
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
export {Divider};
|
|
45
|
+
export { Divider };
|
package/Icon/index.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React, {useContext} from 'react';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import IconSources from '../Assets/icon.json';
|
|
3
3
|
import IconBankSources from '../Assets/icon_bank.json';
|
|
4
|
-
import {IconProps} from './types';
|
|
5
|
-
import {ApplicationContext} from '../
|
|
6
|
-
import {Image} from '../Image';
|
|
4
|
+
import { IconProps } from './types';
|
|
5
|
+
import { ApplicationContext } from '../Context';
|
|
6
|
+
import { Image } from '../Image';
|
|
7
7
|
|
|
8
8
|
const Icon: React.FC<IconProps> = ({
|
|
9
9
|
source = 'ic_back',
|
|
@@ -12,17 +12,17 @@ const Icon: React.FC<IconProps> = ({
|
|
|
12
12
|
style = {},
|
|
13
13
|
...props
|
|
14
14
|
}) => {
|
|
15
|
-
const {theme} = useContext(ApplicationContext);
|
|
15
|
+
const { theme } = useContext(ApplicationContext);
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* get icon source maps or remote http
|
|
19
19
|
*/
|
|
20
20
|
const getIconSource = (): any => {
|
|
21
21
|
if (source && !source.includes('http')) {
|
|
22
|
-
let icon: {[key: string]: {uri: string}} = IconSources;
|
|
22
|
+
let icon: { [key: string]: { uri: string } } = IconSources;
|
|
23
23
|
return icon[source] ?? icon.ic_warning;
|
|
24
24
|
}
|
|
25
|
-
return {uri: source};
|
|
25
|
+
return { uri: source };
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const tintColorProps = color !== null && {
|
|
@@ -34,11 +34,11 @@ const Icon: React.FC<IconProps> = ({
|
|
|
34
34
|
{...props}
|
|
35
35
|
loading={false}
|
|
36
36
|
source={getIconSource()}
|
|
37
|
-
style={[style, {width: size, height: size}]}
|
|
37
|
+
style={[style, { width: size, height: size }]}
|
|
38
38
|
resizeMode="contain"
|
|
39
39
|
{...tintColorProps}
|
|
40
40
|
/>
|
|
41
41
|
);
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
export {Icon, IconSources, IconBankSources};
|
|
44
|
+
export { Icon, IconSources, IconBankSources };
|
package/IconButton/index.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React, {useContext} from 'react';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
StyleSheet,
|
|
4
4
|
TouchableOpacity,
|
|
5
5
|
TouchableOpacityProps,
|
|
6
6
|
} from 'react-native';
|
|
7
|
-
import {ApplicationContext, ComponentContext} from '../
|
|
8
|
-
import {Colors} from '../Consts';
|
|
9
|
-
import {Icon} from '../Icon';
|
|
7
|
+
import { ApplicationContext, ComponentContext } from '../Context';
|
|
8
|
+
import { Colors } from '../Consts';
|
|
9
|
+
import { Icon } from '../Icon';
|
|
10
10
|
import styles from './styles';
|
|
11
11
|
|
|
12
12
|
export interface IconButtonProps extends TouchableOpacityProps {
|
|
@@ -39,7 +39,7 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
39
39
|
params,
|
|
40
40
|
...rest
|
|
41
41
|
}) => {
|
|
42
|
-
const {theme} = useContext(ApplicationContext);
|
|
42
|
+
const { theme } = useContext(ApplicationContext);
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* get size icon button
|
|
@@ -61,7 +61,7 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
61
61
|
backgroundColor: theme.colors.background.disable,
|
|
62
62
|
};
|
|
63
63
|
case 'primary':
|
|
64
|
-
return {backgroundColor: theme.colors.primary};
|
|
64
|
+
return { backgroundColor: theme.colors.primary };
|
|
65
65
|
case 'secondary':
|
|
66
66
|
return {
|
|
67
67
|
backgroundColor: theme.colors.background.surface,
|
|
@@ -83,7 +83,7 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
83
83
|
backgroundColor: theme.colors.error.primary,
|
|
84
84
|
};
|
|
85
85
|
default:
|
|
86
|
-
return {backgroundColor: theme.colors.primary};
|
|
86
|
+
return { backgroundColor: theme.colors.primary };
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
|
|
@@ -120,16 +120,18 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
120
120
|
params,
|
|
121
121
|
state: type === 'disabled' ? 'disabled' : 'enabled',
|
|
122
122
|
action: 'click',
|
|
123
|
-
}}
|
|
123
|
+
}}
|
|
124
|
+
>
|
|
124
125
|
<TouchableOpacity
|
|
125
126
|
{...rest}
|
|
126
127
|
disabled={type === 'disabled'}
|
|
127
128
|
activeOpacity={activeOpacity}
|
|
128
|
-
style={buttonStyle}
|
|
129
|
+
style={buttonStyle}
|
|
130
|
+
>
|
|
129
131
|
<Icon size={iconSize} source={icon} color={getIconColor()} />
|
|
130
132
|
</TouchableOpacity>
|
|
131
133
|
</ComponentContext.Provider>
|
|
132
134
|
);
|
|
133
135
|
};
|
|
134
136
|
|
|
135
|
-
export {IconButton};
|
|
137
|
+
export { IconButton };
|
package/Image/index.tsx
CHANGED
|
@@ -6,15 +6,22 @@ import {
|
|
|
6
6
|
ApplicationContext,
|
|
7
7
|
ComponentContext,
|
|
8
8
|
SkeletonContext,
|
|
9
|
-
} from '../
|
|
9
|
+
} from '../Context';
|
|
10
10
|
import { Skeleton } from '../Skeleton';
|
|
11
11
|
import { Icon } from '../Icon';
|
|
12
12
|
import { Styles } from '../Consts';
|
|
13
13
|
import { ImageProps } from './types';
|
|
14
|
-
import { getImageName } from '../Application/utils';
|
|
15
14
|
|
|
16
15
|
type Status = 'success' | 'loading' | 'error';
|
|
17
16
|
|
|
17
|
+
export const getImageName = (source: any): string => {
|
|
18
|
+
const parts = source?.uri?.split?.('/');
|
|
19
|
+
if (parts?.length > 0) {
|
|
20
|
+
return parts?.[parts.length - 1];
|
|
21
|
+
}
|
|
22
|
+
return '';
|
|
23
|
+
};
|
|
24
|
+
|
|
18
25
|
const Image: React.FC<ImageProps> = ({
|
|
19
26
|
style,
|
|
20
27
|
source,
|
package/Input/Input.tsx
CHANGED
|
@@ -12,11 +12,7 @@ import {
|
|
|
12
12
|
TouchableOpacity,
|
|
13
13
|
View,
|
|
14
14
|
} from 'react-native';
|
|
15
|
-
import {
|
|
16
|
-
ApplicationContext,
|
|
17
|
-
ComponentContext,
|
|
18
|
-
useComponentId,
|
|
19
|
-
} from '../Application';
|
|
15
|
+
import { useComponentId } from '../Application';
|
|
20
16
|
import { Icon } from '../Icon';
|
|
21
17
|
import { exportFontFamily } from '../Text';
|
|
22
18
|
import {
|
|
@@ -30,6 +26,7 @@ import { InputProps } from './index';
|
|
|
30
26
|
import styles from './styles';
|
|
31
27
|
import { checkTyping } from './utils';
|
|
32
28
|
import SystemTextInput from './SystemTextInput';
|
|
29
|
+
import { ApplicationContext, ComponentContext } from '../Context';
|
|
33
30
|
|
|
34
31
|
/**
|
|
35
32
|
* Input default component
|
package/Input/InputDropDown.tsx
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import React, {useContext} from 'react';
|
|
2
|
-
import {TouchableOpacity, View} from 'react-native';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import { useComponentId } from '../Application';
|
|
4
|
+
import { ApplicationContext, ComponentContext } from '../Context';
|
|
5
|
+
import { Icon } from '../Icon';
|
|
3
6
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {Text} from '../Text';
|
|
7
|
+
ErrorView,
|
|
8
|
+
FloatingView,
|
|
9
|
+
getBorderColor,
|
|
10
|
+
getSizeStyle,
|
|
11
|
+
} from './common';
|
|
12
|
+
import { InputDropDownProps } from './index';
|
|
13
|
+
import { Text } from '../Text';
|
|
12
14
|
import styles from './styles';
|
|
13
|
-
import {Spacing} from '../Consts';
|
|
15
|
+
import { Spacing } from '../Consts';
|
|
14
16
|
|
|
15
17
|
const InputDropDown = ({
|
|
16
18
|
value,
|
|
@@ -32,12 +34,12 @@ const InputDropDown = ({
|
|
|
32
34
|
multiline,
|
|
33
35
|
...props
|
|
34
36
|
}: InputDropDownProps) => {
|
|
35
|
-
const {theme} = useContext(ApplicationContext);
|
|
37
|
+
const { theme } = useContext(ApplicationContext);
|
|
36
38
|
const componentName = 'InputDropDown';
|
|
37
39
|
|
|
38
|
-
const {componentId} = useComponentId(
|
|
40
|
+
const { componentId } = useComponentId(
|
|
39
41
|
`${componentName}/${placeholder}`,
|
|
40
|
-
props.accessibilityLabel
|
|
42
|
+
props.accessibilityLabel,
|
|
41
43
|
);
|
|
42
44
|
|
|
43
45
|
/**
|
|
@@ -57,10 +59,11 @@ const InputDropDown = ({
|
|
|
57
59
|
<View
|
|
58
60
|
style={[
|
|
59
61
|
styles.inputDropDownWrapper,
|
|
60
|
-
{backgroundColor: theme.colors.background.surface},
|
|
62
|
+
{ backgroundColor: theme.colors.background.surface },
|
|
61
63
|
getSizeStyle(size, multiline),
|
|
62
64
|
getBorderColor(theme, false, errorMessage, disabled as boolean),
|
|
63
|
-
]}
|
|
65
|
+
]}
|
|
66
|
+
>
|
|
64
67
|
<FloatingView
|
|
65
68
|
floatingValue={floatingValue}
|
|
66
69
|
floatingIconColor={floatingIconColor}
|
|
@@ -79,7 +82,8 @@ const InputDropDown = ({
|
|
|
79
82
|
marginTop: Spacing.M,
|
|
80
83
|
marginRight: Spacing.S,
|
|
81
84
|
},
|
|
82
|
-
]}
|
|
85
|
+
]}
|
|
86
|
+
>
|
|
83
87
|
<Icon
|
|
84
88
|
color={leadingIconColor}
|
|
85
89
|
source={leadingIcon}
|
|
@@ -93,8 +97,9 @@ const InputDropDown = ({
|
|
|
93
97
|
numberOfLines={multiline ? undefined : 1}
|
|
94
98
|
typography={'body_default_regular'}
|
|
95
99
|
color={value ? textColor : placeholderColor}
|
|
96
|
-
accessibilityState={{disabled: disabled as boolean}}
|
|
97
|
-
accessibilityLabel={`${componentId}`}
|
|
100
|
+
accessibilityState={{ disabled: disabled as boolean }}
|
|
101
|
+
accessibilityLabel={`${componentId}`}
|
|
102
|
+
>
|
|
98
103
|
{value || placeholder}
|
|
99
104
|
</Text>
|
|
100
105
|
</View>
|
|
@@ -106,7 +111,8 @@ const InputDropDown = ({
|
|
|
106
111
|
alignItems: multiline ? 'flex-start' : 'center',
|
|
107
112
|
paddingTop: multiline ? Spacing.M : 0,
|
|
108
113
|
},
|
|
109
|
-
]}
|
|
114
|
+
]}
|
|
115
|
+
>
|
|
110
116
|
<Icon source={'arrow_chevron_down_small'} />
|
|
111
117
|
</View>
|
|
112
118
|
</View>
|
|
@@ -120,13 +126,15 @@ const InputDropDown = ({
|
|
|
120
126
|
componentId,
|
|
121
127
|
params,
|
|
122
128
|
state: 'enabled',
|
|
123
|
-
}}
|
|
129
|
+
}}
|
|
130
|
+
>
|
|
124
131
|
<TouchableOpacity
|
|
125
132
|
{...props}
|
|
126
133
|
accessibilityLabel={`${componentId}|touch`}
|
|
127
|
-
accessibilityState={{disabled: disabled as boolean}}
|
|
134
|
+
accessibilityState={{ disabled: disabled as boolean }}
|
|
128
135
|
activeOpacity={0.6}
|
|
129
|
-
style={[style, styles.wrapper]}
|
|
136
|
+
style={[style, styles.wrapper]}
|
|
137
|
+
>
|
|
130
138
|
{renderInputView()}
|
|
131
139
|
<ErrorView
|
|
132
140
|
errorMessage={errorMessage}
|
package/Input/InputMoney.tsx
CHANGED
|
@@ -14,11 +14,8 @@ import {
|
|
|
14
14
|
TouchableOpacity,
|
|
15
15
|
View,
|
|
16
16
|
} from 'react-native';
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
ComponentContext,
|
|
20
|
-
useComponentId,
|
|
21
|
-
} from '../Application';
|
|
17
|
+
import { useComponentId } from '../Application';
|
|
18
|
+
import { ApplicationContext, ComponentContext } from '../Context';
|
|
22
19
|
import { Icon } from '../Icon';
|
|
23
20
|
import {
|
|
24
21
|
ErrorView,
|
package/Input/InputOTP.tsx
CHANGED
|
@@ -14,11 +14,7 @@ import {
|
|
|
14
14
|
TouchableOpacity,
|
|
15
15
|
View,
|
|
16
16
|
} from 'react-native';
|
|
17
|
-
import {
|
|
18
|
-
ApplicationContext,
|
|
19
|
-
ComponentContext,
|
|
20
|
-
useComponentId,
|
|
21
|
-
} from '../Application';
|
|
17
|
+
import { useComponentId } from '../Application';
|
|
22
18
|
import { Spacing, Styles } from '../Consts';
|
|
23
19
|
import { scaleSize, Text } from '../Text';
|
|
24
20
|
import { ErrorView, getBorderColor } from './common';
|
|
@@ -26,6 +22,7 @@ import { CaretProps, InputOTPProps } from './index';
|
|
|
26
22
|
import styles from './styles';
|
|
27
23
|
import { Icon } from '../Icon';
|
|
28
24
|
import SystemTextInput from './SystemTextInput';
|
|
25
|
+
import { ApplicationContext, ComponentContext } from '../Context';
|
|
29
26
|
|
|
30
27
|
const OTPCaret: FC<CaretProps> = ({ index, length }) => {
|
|
31
28
|
const DURATION = 300;
|
|
@@ -13,11 +13,8 @@ import {
|
|
|
13
13
|
TouchableOpacity,
|
|
14
14
|
View,
|
|
15
15
|
} from 'react-native';
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
ComponentContext,
|
|
19
|
-
useComponentId,
|
|
20
|
-
} from '../Application';
|
|
16
|
+
import { useComponentId } from '../Application';
|
|
17
|
+
import { ApplicationContext, ComponentContext } from '../Context';
|
|
21
18
|
import { Colors, Spacing, Styles } from '../Consts';
|
|
22
19
|
import { Icon } from '../Icon';
|
|
23
20
|
import { scaleSize, Text } from '../Text';
|
package/Input/InputSearch.tsx
CHANGED
|
@@ -16,11 +16,8 @@ import {
|
|
|
16
16
|
TouchableOpacity,
|
|
17
17
|
View,
|
|
18
18
|
} from 'react-native';
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
ComponentContext,
|
|
22
|
-
useComponentId,
|
|
23
|
-
} from '../Application';
|
|
19
|
+
import { useComponentId } from '../Application';
|
|
20
|
+
import { ApplicationContext, ComponentContext } from '../Context';
|
|
24
21
|
import { Icon } from '../Icon';
|
|
25
22
|
import { Text } from '../Text';
|
|
26
23
|
import { InputRef, InputSearchProps } from './index';
|
package/Input/InputTextArea.tsx
CHANGED
package/Input/common.tsx
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import React, {FC, ReactNode, useContext} from 'react';
|
|
1
|
+
import React, { FC, ReactNode, useContext } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
GestureResponderEvent,
|
|
4
4
|
TouchableOpacity,
|
|
5
5
|
View,
|
|
6
6
|
ViewStyle,
|
|
7
7
|
} from 'react-native';
|
|
8
|
-
import {ApplicationContext} from '../
|
|
9
|
-
import {Theme} from '../Application/types';
|
|
10
|
-
import {Styles} from '../Consts';
|
|
11
|
-
import {Icon} from '../Icon';
|
|
12
|
-
import {scaleSize, Text} from '../Text';
|
|
8
|
+
import { ApplicationContext } from '../Context';
|
|
9
|
+
import { Theme } from '../Application/types';
|
|
10
|
+
import { Styles } from '../Consts';
|
|
11
|
+
import { Icon } from '../Icon';
|
|
12
|
+
import { scaleSize, Text } from '../Text';
|
|
13
13
|
import styles from './styles';
|
|
14
|
-
import {Loader} from '../Loader';
|
|
14
|
+
import { Loader } from '../Loader';
|
|
15
15
|
import IconSources from '../Assets/icon.json';
|
|
16
16
|
|
|
17
17
|
type FloatingViewProps = {
|
|
@@ -40,7 +40,7 @@ export const getBorderColor = (
|
|
|
40
40
|
theme: Theme,
|
|
41
41
|
focused: boolean,
|
|
42
42
|
errorMessage?: string,
|
|
43
|
-
disabled?: boolean
|
|
43
|
+
disabled?: boolean,
|
|
44
44
|
) => {
|
|
45
45
|
let borderColor = theme.colors.border.default;
|
|
46
46
|
|
|
@@ -56,12 +56,12 @@ export const getBorderColor = (
|
|
|
56
56
|
borderColor = theme.colors.border.disable;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
return {borderColor};
|
|
59
|
+
return { borderColor };
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
export const getSizeStyle = (
|
|
63
63
|
size?: 'small' | 'large',
|
|
64
|
-
multiline: boolean = false
|
|
64
|
+
multiline: boolean = false,
|
|
65
65
|
) => {
|
|
66
66
|
if (multiline)
|
|
67
67
|
return [
|
|
@@ -81,8 +81,8 @@ export const ErrorView: FC<{
|
|
|
81
81
|
errorSpacing?: boolean;
|
|
82
82
|
hintText?: string;
|
|
83
83
|
componentId?: string;
|
|
84
|
-
}> = ({errorMessage, errorSpacing, hintText, componentId}) => {
|
|
85
|
-
const {theme} = useContext(ApplicationContext);
|
|
84
|
+
}> = ({ errorMessage, errorSpacing, hintText, componentId }) => {
|
|
85
|
+
const { theme } = useContext(ApplicationContext);
|
|
86
86
|
const errorColor = theme.colors.error.primary;
|
|
87
87
|
const hintColor = theme.colors.text.hint;
|
|
88
88
|
const hintTextDefault = hintText ?? 'Không thể chỉnh sửa';
|
|
@@ -102,14 +102,15 @@ export const ErrorView: FC<{
|
|
|
102
102
|
}-text`}
|
|
103
103
|
style={Styles.flex}
|
|
104
104
|
color={errorMessage ? errorColor : hintColor}
|
|
105
|
-
typography={'description_default_regular'}
|
|
105
|
+
typography={'description_default_regular'}
|
|
106
|
+
>
|
|
106
107
|
{errorMessage ?? hintTextDefault}
|
|
107
108
|
</Text>
|
|
108
109
|
</View>
|
|
109
110
|
);
|
|
110
111
|
}
|
|
111
112
|
if (errorSpacing) {
|
|
112
|
-
return <View style={[styles.errorView, {height: 18}]} />;
|
|
113
|
+
return <View style={[styles.errorView, { height: 18 }]} />;
|
|
113
114
|
}
|
|
114
115
|
return <View />;
|
|
115
116
|
};
|
|
@@ -124,7 +125,7 @@ export const FloatingView: FC<FloatingViewProps> = ({
|
|
|
124
125
|
onPress,
|
|
125
126
|
componentId,
|
|
126
127
|
}) => {
|
|
127
|
-
const {theme} = useContext(ApplicationContext);
|
|
128
|
+
const { theme } = useContext(ApplicationContext);
|
|
128
129
|
|
|
129
130
|
if (floatingValue) {
|
|
130
131
|
let floatingTextColor = theme.colors.text.hint;
|
|
@@ -143,16 +144,19 @@ export const FloatingView: FC<FloatingViewProps> = ({
|
|
|
143
144
|
zIndex: 10,
|
|
144
145
|
},
|
|
145
146
|
style,
|
|
146
|
-
]}
|
|
147
|
+
]}
|
|
148
|
+
>
|
|
147
149
|
<Text
|
|
148
150
|
color={floatingTextColor}
|
|
149
151
|
typography={'label_s_medium'}
|
|
150
|
-
accessibilityLabel={`${componentId}|floating-text`}
|
|
152
|
+
accessibilityLabel={`${componentId}|floating-text`}
|
|
153
|
+
>
|
|
151
154
|
{floatingValue}
|
|
152
155
|
{required && (
|
|
153
156
|
<Text
|
|
154
157
|
typography={'label_s_medium'}
|
|
155
|
-
color={theme.colors.error.primary}
|
|
158
|
+
color={theme.colors.error.primary}
|
|
159
|
+
>
|
|
156
160
|
*
|
|
157
161
|
</Text>
|
|
158
162
|
)}
|
|
@@ -161,7 +165,8 @@ export const FloatingView: FC<FloatingViewProps> = ({
|
|
|
161
165
|
<TouchableOpacity
|
|
162
166
|
activeOpacity={onPress ? 0.6 : 1}
|
|
163
167
|
onPress={onPress}
|
|
164
|
-
accessibilityLabel={`${componentId}|floating-icon-touch`}
|
|
168
|
+
accessibilityLabel={`${componentId}|floating-icon-touch`}
|
|
169
|
+
>
|
|
165
170
|
<Icon
|
|
166
171
|
color={floatingIconTintColor}
|
|
167
172
|
source={floatingIcon}
|
|
@@ -184,7 +189,7 @@ export const RenderTrailing: FC<TrailingProps> = ({
|
|
|
184
189
|
onPressIcon,
|
|
185
190
|
componentId,
|
|
186
191
|
}) => {
|
|
187
|
-
const {theme} = useContext(ApplicationContext);
|
|
192
|
+
const { theme } = useContext(ApplicationContext);
|
|
188
193
|
if (loading) {
|
|
189
194
|
return <Loader type={'spinner'} color={color} style={styles.icon} />;
|
|
190
195
|
}
|
|
@@ -197,7 +202,8 @@ export const RenderTrailing: FC<TrailingProps> = ({
|
|
|
197
202
|
<TouchableOpacity
|
|
198
203
|
accessibilityLabel={`${componentId}|trailing-touch`}
|
|
199
204
|
onPress={onPressIcon}
|
|
200
|
-
style={styles.icon}
|
|
205
|
+
style={styles.icon}
|
|
206
|
+
>
|
|
201
207
|
{icon}
|
|
202
208
|
</TouchableOpacity>
|
|
203
209
|
);
|
|
@@ -210,7 +216,7 @@ export const RenderTrailing: FC<TrailingProps> = ({
|
|
|
210
216
|
source={icon as string}
|
|
211
217
|
size={24}
|
|
212
218
|
accessibilityLabel={`${componentId}|trailing-icon`}
|
|
213
|
-
|
|
219
|
+
/>,
|
|
214
220
|
);
|
|
215
221
|
}
|
|
216
222
|
return renderIconTouchable(
|
|
@@ -218,9 +224,10 @@ export const RenderTrailing: FC<TrailingProps> = ({
|
|
|
218
224
|
typography="action_xs_bold"
|
|
219
225
|
color={color ?? theme.colors.primary}
|
|
220
226
|
numberOfLines={1}
|
|
221
|
-
accessibilityLabel={`${componentId}|trailing-text`}
|
|
227
|
+
accessibilityLabel={`${componentId}|trailing-text`}
|
|
228
|
+
>
|
|
222
229
|
{icon!.substring(0, 15)}
|
|
223
|
-
</Text
|
|
230
|
+
</Text>,
|
|
224
231
|
);
|
|
225
232
|
}
|
|
226
233
|
return null;
|
package/Layout/Card.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { useGridSystem } from './utils';
|
|
|
4
4
|
import { GridContextProps } from './types';
|
|
5
5
|
import { GridContext, GridSystem } from './index';
|
|
6
6
|
import { Image } from '../Image';
|
|
7
|
-
import { ApplicationContext } from '../
|
|
7
|
+
import { ApplicationContext } from '../Context';
|
|
8
8
|
import styles from './styles';
|
|
9
9
|
import { Colors, Radius, Shadow, Spacing } from '../Consts';
|
|
10
10
|
|
package/Layout/GridSystem.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, {useContext} from 'react';
|
|
2
|
-
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
3
|
-
import {Dimensions, StyleSheet, View} from 'react-native';
|
|
4
|
-
import {ApplicationContext} from '../
|
|
5
|
-
import {Colors, Spacing} from '../Consts';
|
|
6
|
-
import {GridContextProps} from './types';
|
|
7
|
-
import {useGridSystem} from './utils';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
3
|
+
import { Dimensions, StyleSheet, View } from 'react-native';
|
|
4
|
+
import { ApplicationContext } from '../Context';
|
|
5
|
+
import { Colors, Spacing } from '../Consts';
|
|
6
|
+
import { GridContextProps } from './types';
|
|
7
|
+
import { useGridSystem } from './utils';
|
|
8
8
|
|
|
9
9
|
const GridSystem: React.FC<any> = ({
|
|
10
10
|
width = Dimensions.get('window').width,
|
|
@@ -13,8 +13,8 @@ const GridSystem: React.FC<any> = ({
|
|
|
13
13
|
screenGrid = true,
|
|
14
14
|
gridColor = Colors.blue_07,
|
|
15
15
|
}) => {
|
|
16
|
-
const {theme} = useContext(ApplicationContext);
|
|
17
|
-
const {numberOfColumns} = useGridSystem();
|
|
16
|
+
const { theme } = useContext(ApplicationContext);
|
|
17
|
+
const { numberOfColumns } = useGridSystem();
|
|
18
18
|
|
|
19
19
|
const margin = useMargin ? Spacing.M : 0;
|
|
20
20
|
const widthSection = width - margin * 2;
|
|
@@ -49,11 +49,12 @@ const GridSystem: React.FC<any> = ({
|
|
|
49
49
|
top: Spacing.M,
|
|
50
50
|
bottom: Spacing.M,
|
|
51
51
|
},
|
|
52
|
-
]}
|
|
52
|
+
]}
|
|
53
|
+
>
|
|
53
54
|
{list.map((_, index) => {
|
|
54
55
|
return (
|
|
55
|
-
<View style={{flexDirection: 'row'}} key={index.toString()}>
|
|
56
|
-
{index !== 0 && <View style={{width: grid.gutterSize}} />}
|
|
56
|
+
<View style={{ flexDirection: 'row' }} key={index.toString()}>
|
|
57
|
+
{index !== 0 && <View style={{ width: grid.gutterSize }} />}
|
|
57
58
|
<View
|
|
58
59
|
key={`Grid${index.toString()}`}
|
|
59
60
|
pointerEvents="none"
|
|
@@ -75,11 +76,11 @@ const GridSystem: React.FC<any> = ({
|
|
|
75
76
|
<View pointerEvents="none" style={styles.dangerRightContainer} />
|
|
76
77
|
<View
|
|
77
78
|
pointerEvents="none"
|
|
78
|
-
style={[styles.dangerTopContainer, {height: Spacing.M}]}
|
|
79
|
+
style={[styles.dangerTopContainer, { height: Spacing.M }]}
|
|
79
80
|
/>
|
|
80
81
|
<View
|
|
81
82
|
pointerEvents="none"
|
|
82
|
-
style={[styles.dangerBottomContainer, {height: insets.bottom}]}
|
|
83
|
+
style={[styles.dangerBottomContainer, { height: insets.bottom }]}
|
|
83
84
|
/>
|
|
84
85
|
</>
|
|
85
86
|
)}
|
package/Layout/Item.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { View, ViewProps } from 'react-native';
|
|
3
3
|
import { GridContext } from './index';
|
|
4
|
-
import { ApplicationContext } from '../
|
|
4
|
+
import { ApplicationContext } from '../Context';
|
|
5
5
|
import styles from './styles';
|
|
6
6
|
import { SpanNumber } from './types';
|
|
7
7
|
|
package/Layout/Screen.tsx
CHANGED
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
ViewProps,
|
|
27
27
|
} from 'react-native';
|
|
28
28
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
29
|
-
import { ApplicationContext, ScreenContext } from '../
|
|
29
|
+
import { ApplicationContext, ScreenContext } from '../Context';
|
|
30
30
|
import Navigation from '../Application/Navigation';
|
|
31
31
|
import {
|
|
32
32
|
AnimatedHeader,
|
|
@@ -36,17 +36,18 @@ import {
|
|
|
36
36
|
} from '../Application/types';
|
|
37
37
|
import { Colors, Spacing, Styles } from '../Consts';
|
|
38
38
|
import { FloatingButton, FloatingButtonProps } from './FloatingButton';
|
|
39
|
-
import { Section, validateChildren } from './index';
|
|
40
39
|
import styles from './styles';
|
|
41
40
|
import { HeaderType } from './types';
|
|
42
41
|
import { InputRef } from '../Input';
|
|
43
42
|
import { exportHeaderTitle, getOptions } from '../Application/utils';
|
|
43
|
+
import { validateChildren } from './utils';
|
|
44
|
+
import Section from './Section';
|
|
44
45
|
import {
|
|
45
46
|
HeaderBackground,
|
|
46
47
|
HeaderExtendHeader,
|
|
47
48
|
HeaderTitle,
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
SearchHeader,
|
|
50
|
+
} from '../Application';
|
|
50
51
|
|
|
51
52
|
export interface ScreenProps extends ViewProps {
|
|
52
53
|
/**
|
package/Layout/Section.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { Dimensions, View, ViewProps } from 'react-native';
|
|
|
3
3
|
import { useGridSystem } from './utils';
|
|
4
4
|
import { GridContextProps } from './types';
|
|
5
5
|
import { GridContext } from './index';
|
|
6
|
-
import { ApplicationContext } from '../
|
|
6
|
+
import { ApplicationContext } from '../Context';
|
|
7
7
|
import styles from './styles';
|
|
8
8
|
import { Image } from '../Image';
|
|
9
9
|
import { Spacing } from '../Consts';
|