@momo-kits/foundation 1.0.0 → 1.0.3
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/Button/index.tsx +118 -171
- package/CheckBox/index.tsx +63 -0
- package/CheckBox/styles.ts +14 -0
- package/CheckBox/types.ts +10 -0
- package/Consts/colors+spacing+radius.ts +6 -4
- package/Consts/index.ts +4 -73
- package/Consts/styles.ts +1 -1
- package/Consts/theme.ts +121 -0
- package/ContentLoader/index.tsx +9 -13
- package/Icon/index.tsx +14 -11
- package/Icon/types.ts +1 -4
- package/IconButton/index.tsx +67 -67
- package/IconButton/styles.ts +19 -0
- package/Image/index.tsx +22 -21
- package/Image/types.ts +0 -1
- package/Input/Input.tsx +161 -0
- package/Input/TextArea.tsx +162 -0
- package/Input/common.tsx +70 -0
- package/Input/index.tsx +26 -0
- package/Input/styles.ts +92 -0
- package/Layout/GridSystem.tsx +109 -0
- package/Layout/ScreenContainer.tsx +84 -0
- package/Layout/ScreenSection.tsx +117 -0
- package/Layout/SectionItem.tsx +63 -0
- package/Layout/index.ts +11 -5
- package/Layout/types.ts +6 -33
- package/Layout/utils.ts +69 -23
- package/Navigation/Components.tsx +42 -9
- package/Navigation/ModalScreen.tsx +65 -40
- package/Navigation/Navigation.ts +5 -2
- package/Navigation/NavigationButton.tsx +10 -5
- package/Navigation/NavigationContainer.tsx +17 -13
- package/Navigation/StackScreen.tsx +8 -2
- package/Navigation/index.ts +5 -3
- package/Navigation/types.ts +72 -38
- package/Navigation/utils.tsx +37 -14
- package/Playground/index.tsx +132 -0
- package/Playground/styles.ts +16 -0
- package/Playground/types.ts +15 -0
- package/Popup/PopupNotify.tsx +210 -0
- package/Popup/PopupPromotion.tsx +66 -0
- package/Popup/index.tsx +4 -0
- package/Popup/types.ts +23 -0
- package/Radio/index.tsx +42 -0
- package/Radio/styles.ts +12 -0
- package/Radio/types.ts +7 -0
- package/Switch/index.tsx +35 -0
- package/Switch/styles.ts +23 -0
- package/Switch/types.ts +5 -0
- package/Text/index.tsx +36 -118
- package/Text/styles.ts +24 -23
- package/Text/types.ts +5 -12
- package/index.ts +21 -4
- package/package.json +3 -4
- package/Button/types.ts +0 -18
- package/CheckBox/index.js +0 -74
- package/CheckBox/styles.js +0 -3
- package/IconButton/types.ts +0 -17
- package/Layout/Row.tsx +0 -42
- package/Layout/Screen.tsx +0 -68
- package/Layout/Section.tsx +0 -30
- package/Layout/View.tsx +0 -84
- package/Layout/styles.ts +0 -24
- package/Navigation/ScreenContainer.tsx +0 -38
- package/SizedBox/index.js +0 -23
- package/SizedBox/styles.js +0 -7
- package/TextInput/index.js +0 -225
- package/TextInput/styles.js +0 -55
package/Popup/types.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type PopupNotifyProps = {
|
|
2
|
+
image?: string;
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
information?: string;
|
|
6
|
+
secondary?: PopupAction;
|
|
7
|
+
primary: PopupAction;
|
|
8
|
+
buttonDirection: PopupActionDirection;
|
|
9
|
+
onIconClose?: () => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type PopupPromotionProps = {
|
|
13
|
+
image: string;
|
|
14
|
+
primary: PopupAction;
|
|
15
|
+
onIconClose?: () => void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type PopupAction = {
|
|
19
|
+
title: string;
|
|
20
|
+
onPress: () => void;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type PopupActionDirection = 'row' | 'column' | 'auto';
|
package/Radio/index.tsx
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, {FC, useContext} from 'react';
|
|
2
|
+
import {TouchableOpacity, View} from 'react-native';
|
|
3
|
+
|
|
4
|
+
import {RadioProps} from './types';
|
|
5
|
+
import {Text} from '../Text';
|
|
6
|
+
import styles from './styles';
|
|
7
|
+
import {ApplicationContext} from '../Navigation';
|
|
8
|
+
import {Spacing} from '../Consts';
|
|
9
|
+
|
|
10
|
+
const Radio: FC<RadioProps> = ({
|
|
11
|
+
value,
|
|
12
|
+
groupValue,
|
|
13
|
+
disabled,
|
|
14
|
+
onChange,
|
|
15
|
+
label,
|
|
16
|
+
}) => {
|
|
17
|
+
const {theme} = useContext(ApplicationContext);
|
|
18
|
+
const selected = value === groupValue;
|
|
19
|
+
const borderWidth = selected ? 6 : 2;
|
|
20
|
+
let borderColor = selected ? theme.colors.primary : theme.colors.text.default;
|
|
21
|
+
if (disabled) {
|
|
22
|
+
borderColor = selected
|
|
23
|
+
? theme.colors.background.tonal
|
|
24
|
+
: theme.colors.text.disable;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<TouchableOpacity
|
|
29
|
+
onPress={() => onChange?.(value)}
|
|
30
|
+
disabled={disabled}
|
|
31
|
+
style={{
|
|
32
|
+
flexDirection: 'row',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
marginRight: Spacing.S,
|
|
35
|
+
}}>
|
|
36
|
+
<View style={[styles.radio, {borderWidth, borderColor}]} />
|
|
37
|
+
<Text typography={'description_default'}>{label}</Text>
|
|
38
|
+
</TouchableOpacity>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export {Radio};
|
package/Radio/styles.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native';
|
|
2
|
+
import {Radius, Spacing} from '../Consts';
|
|
3
|
+
|
|
4
|
+
export default StyleSheet.create({
|
|
5
|
+
radio: {
|
|
6
|
+
height: 20,
|
|
7
|
+
width: 20,
|
|
8
|
+
borderRadius: Radius.M,
|
|
9
|
+
marginRight: Spacing.S,
|
|
10
|
+
},
|
|
11
|
+
container: {flex: 1, backgroundColor: 'red'},
|
|
12
|
+
});
|
package/Radio/types.ts
ADDED
package/Switch/index.tsx
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, {FC, useContext} from 'react';
|
|
2
|
+
import {TouchableOpacity, View} from 'react-native';
|
|
3
|
+
import {SwitchProps} from './types';
|
|
4
|
+
import styles from './styles';
|
|
5
|
+
import {ApplicationContext} from '../Navigation';
|
|
6
|
+
import {Colors} from '../Consts';
|
|
7
|
+
|
|
8
|
+
const Switch: FC<SwitchProps> = props => {
|
|
9
|
+
const {theme} = useContext(ApplicationContext);
|
|
10
|
+
const {value, onChange, disabled} = props;
|
|
11
|
+
const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
|
|
12
|
+
const circleAlign = value ? 'flex-end' : 'flex-start';
|
|
13
|
+
|
|
14
|
+
let backgroundColor = value ? theme.colors.primary : Colors.black_07;
|
|
15
|
+
if (disabled) {
|
|
16
|
+
backgroundColor = value ? theme.colors.background.tonal : Colors.black_05;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<TouchableOpacity
|
|
21
|
+
disabled={disabled}
|
|
22
|
+
onPress={() => onChange?.(!value)}
|
|
23
|
+
style={[styles.container, {backgroundColor, alignItems: circleAlign}]}>
|
|
24
|
+
<View style={[styles.circle, {backgroundColor: circleBackgroundColor}]}>
|
|
25
|
+
<View style={[styles.circleSmall, {backgroundColor}]} />
|
|
26
|
+
</View>
|
|
27
|
+
</TouchableOpacity>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
Switch.defaultProps = {
|
|
32
|
+
value: false,
|
|
33
|
+
disabled: false,
|
|
34
|
+
};
|
|
35
|
+
export {Switch};
|
package/Switch/styles.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native';
|
|
2
|
+
|
|
3
|
+
export default StyleSheet.create({
|
|
4
|
+
container: {
|
|
5
|
+
width: 38,
|
|
6
|
+
height: 24,
|
|
7
|
+
borderRadius: 20,
|
|
8
|
+
justifyContent: 'center',
|
|
9
|
+
paddingHorizontal: 4,
|
|
10
|
+
},
|
|
11
|
+
circle: {
|
|
12
|
+
width: 14,
|
|
13
|
+
height: 14,
|
|
14
|
+
borderRadius: 8,
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
justifyContent: 'center',
|
|
17
|
+
},
|
|
18
|
+
circleSmall: {
|
|
19
|
+
width: 6,
|
|
20
|
+
height: 6,
|
|
21
|
+
borderRadius: 4,
|
|
22
|
+
},
|
|
23
|
+
});
|
package/Switch/types.ts
ADDED
package/Text/index.tsx
CHANGED
|
@@ -1,41 +1,8 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
NavigationContext,
|
|
5
|
-
// FontWeight,
|
|
6
|
-
TextProps,
|
|
7
|
-
Typography,
|
|
8
|
-
TypographyWeight,
|
|
9
|
-
} from '../index';
|
|
2
|
+
import {Text as RNText, TextProps as RNTextProps} from 'react-native';
|
|
10
3
|
import styles from './styles';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
100: 'Thin',
|
|
14
|
-
200: 'Thin',
|
|
15
|
-
300: 'Thin',
|
|
16
|
-
400: 'Regular',
|
|
17
|
-
500: 'Regular',
|
|
18
|
-
600: 'Regular',
|
|
19
|
-
700: 'Bold',
|
|
20
|
-
800: 'ExtraBold',
|
|
21
|
-
900: 'Black',
|
|
22
|
-
normal: 'Regular',
|
|
23
|
-
bold: 'Bold',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const Raleway: TypographyWeight = {
|
|
27
|
-
100: 'Thin',
|
|
28
|
-
200: 'ExtraLight',
|
|
29
|
-
300: 'Light',
|
|
30
|
-
400: 'Regular',
|
|
31
|
-
500: 'Medium',
|
|
32
|
-
600: 'SemiBold',
|
|
33
|
-
700: 'Bold',
|
|
34
|
-
800: 'ExtraBold',
|
|
35
|
-
900: 'Black',
|
|
36
|
-
normal: 'Regular',
|
|
37
|
-
bold: 'Bold',
|
|
38
|
-
};
|
|
4
|
+
import {Typography, TypographyWeight} from './types';
|
|
5
|
+
import {ApplicationContext} from '../Navigation';
|
|
39
6
|
|
|
40
7
|
const SFProText: TypographyWeight = {
|
|
41
8
|
100: 'Thin',
|
|
@@ -52,103 +19,57 @@ const SFProText: TypographyWeight = {
|
|
|
52
19
|
};
|
|
53
20
|
|
|
54
21
|
const FontStyle: {[key: string]: string} = {
|
|
55
|
-
normal: '',
|
|
56
22
|
italic: 'Italic',
|
|
23
|
+
normal: '',
|
|
57
24
|
};
|
|
58
25
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const getFontFamily = ({
|
|
64
|
-
fontFamily = 'SFProText',
|
|
65
|
-
fontWeight = '400',
|
|
66
|
-
fontStyle = 'normal',
|
|
67
|
-
}) => {
|
|
68
|
-
let style = FontStyle[fontStyle];
|
|
69
|
-
if (style === 'Italic' && fontWeight === '400') {
|
|
70
|
-
fontWeight = 'bold';
|
|
71
|
-
}
|
|
26
|
+
export interface TextProps extends RNTextProps {
|
|
27
|
+
typography: Typography;
|
|
28
|
+
color?: string;
|
|
29
|
+
}
|
|
72
30
|
|
|
73
|
-
switch (fontFamily) {
|
|
74
|
-
case 'ProximaNova':
|
|
75
|
-
return `${fontFamily}-${ProximaNova[fontWeight]}${style}`;
|
|
76
|
-
case 'Raleway':
|
|
77
|
-
return `${fontFamily}-${Raleway[fontWeight]}${style}`;
|
|
78
|
-
case 'SFProText':
|
|
79
|
-
return `${fontFamily}-${SFProText[fontWeight]}${style}`;
|
|
80
|
-
default:
|
|
81
|
-
return `${fontFamily}-${SFProText[fontWeight]}${style}`;
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
31
|
const Text: React.FC<TextProps> = ({
|
|
85
32
|
typography,
|
|
86
|
-
// weight,
|
|
87
33
|
color,
|
|
88
|
-
// fontStyle,
|
|
89
34
|
children,
|
|
90
35
|
style,
|
|
91
36
|
...rest
|
|
92
37
|
}) => {
|
|
93
|
-
const {theme} = useContext(
|
|
38
|
+
const {theme} = useContext(ApplicationContext);
|
|
94
39
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
*/
|
|
99
|
-
const getTypography = (value: Typography) => {
|
|
100
|
-
const typo: {
|
|
101
|
-
[key: string]: object;
|
|
40
|
+
const getTypoStyle = (typo: Typography) => {
|
|
41
|
+
const styleSheet: {
|
|
42
|
+
[key: string]: any;
|
|
102
43
|
} = styles;
|
|
103
|
-
|
|
104
|
-
|
|
44
|
+
const typoStyle = styleSheet[typo] ?? styleSheet.paragraph_default;
|
|
45
|
+
const {fontWeight, fontSize, fontStyle, lineHeight} = typoStyle;
|
|
46
|
+
let fontFamily: string;
|
|
47
|
+
const style = FontStyle[fontStyle ?? 'normal'];
|
|
105
48
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return {fontWeight: '100'};
|
|
115
|
-
case 'ultraLight':
|
|
116
|
-
return {fontWeight: '200'};
|
|
117
|
-
case 'light':
|
|
118
|
-
return {fontWeight: '300'};
|
|
119
|
-
case 'regular':
|
|
120
|
-
return {fontWeight: '400'};
|
|
121
|
-
case 'medium':
|
|
122
|
-
return {fontWeight: '500'};
|
|
123
|
-
case 'semibold':
|
|
124
|
-
return {fontWeight: '600'};
|
|
125
|
-
case 'bold':
|
|
126
|
-
return {fontWeight: '700'};
|
|
127
|
-
case 'heavy':
|
|
128
|
-
return {fontWeight: '800'};
|
|
129
|
-
case 'black':
|
|
130
|
-
return {fontWeight: '900'};
|
|
131
|
-
default:
|
|
132
|
-
return {fontWeight: '400'};
|
|
49
|
+
switch (theme.font) {
|
|
50
|
+
case 'SFProText': {
|
|
51
|
+
fontFamily = `${theme.font}-${SFProText[fontWeight]}${style}`;
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
default: {
|
|
55
|
+
fontFamily = `SFProText-${SFProText[fontWeight]}${style}`;
|
|
56
|
+
}
|
|
133
57
|
}
|
|
134
|
-
};
|
|
135
|
-
*/
|
|
136
58
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
59
|
+
return {
|
|
60
|
+
fontFamily,
|
|
61
|
+
fontSize,
|
|
62
|
+
lineHeight,
|
|
63
|
+
fontStyle,
|
|
64
|
+
};
|
|
65
|
+
};
|
|
143
66
|
|
|
144
|
-
textStyle
|
|
145
|
-
fontFamily: textStyle.fontFamily,
|
|
146
|
-
// fontWeight: textStyle.fontWeight,
|
|
147
|
-
// fontStyle,
|
|
148
|
-
});
|
|
67
|
+
const textStyle = getTypoStyle(typography);
|
|
149
68
|
|
|
150
69
|
return (
|
|
151
|
-
<RNText
|
|
70
|
+
<RNText
|
|
71
|
+
{...rest}
|
|
72
|
+
style={[style, textStyle, {color: color ?? theme.colors.text.default}]}>
|
|
152
73
|
{children ?? ''}
|
|
153
74
|
</RNText>
|
|
154
75
|
);
|
|
@@ -156,9 +77,6 @@ const Text: React.FC<TextProps> = ({
|
|
|
156
77
|
|
|
157
78
|
Text.defaultProps = {
|
|
158
79
|
typography: 'paragraph_default',
|
|
159
|
-
// weight: 'regular',
|
|
160
|
-
color: undefined,
|
|
161
|
-
// fontStyle: 'normal',
|
|
162
80
|
};
|
|
163
81
|
|
|
164
|
-
export {Text
|
|
82
|
+
export {Text};
|
package/Text/styles.ts
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
2
|
+
headline_default: {
|
|
3
3
|
fontSize: 28,
|
|
4
4
|
lineHeight: 34,
|
|
5
5
|
fontWeight: '600',
|
|
6
6
|
},
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
headline_s: {fontSize: 24, lineHeight: 32, fontWeight: '600'},
|
|
8
|
+
headline_l: {fontSize: 32, lineHeight: 36, fontWeight: '600'},
|
|
9
|
+
headline_xl: {fontSize: 36, lineHeight: 44, fontWeight: '600'},
|
|
10
|
+
title_default: {fontSize: 20, lineHeight: 28, fontWeight: '700'},
|
|
11
|
+
title_xs: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
|
|
12
|
+
title_s: {fontSize: 18, lineHeight: 28, fontWeight: '700'},
|
|
13
|
+
header_default: {fontSize: 15, lineHeight: 22, fontWeight: '600'},
|
|
14
|
+
header_xs: {fontSize: 12, lineHeight: 16, fontWeight: '600'},
|
|
15
|
+
header_s: {fontSize: 14, lineHeight: 20, fontWeight: '600'},
|
|
16
|
+
paragraph_default: {fontSize: 15, lineHeight: 22, fontWeight: '400'},
|
|
17
|
+
paragraph_bold: {fontSize: 15, lineHeight: 22, fontWeight: '700'},
|
|
18
|
+
paragraph_italic: {
|
|
19
19
|
fontSize: 15,
|
|
20
20
|
lineHeight: 22,
|
|
21
21
|
fontWeight: '400',
|
|
22
22
|
fontStyle: 'italic',
|
|
23
23
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
description_default: {fontSize: 14, lineHeight: 20, fontWeight: '400'},
|
|
25
|
+
description_xs: {fontSize: 10, lineHeight: 14, fontWeight: '400'},
|
|
26
|
+
description_s: {fontSize: 12, lineHeight: 16, fontWeight: '400'},
|
|
27
|
+
label_default: {fontSize: 14, lineHeight: 20, fontWeight: '500'},
|
|
28
|
+
label_xxs: {fontSize: 8, lineHeight: 12, fontWeight: '500'},
|
|
29
|
+
label_xs: {fontSize: 10, lineHeight: 14, fontWeight: '500'},
|
|
30
|
+
label_s: {fontSize: 12, lineHeight: 16, fontWeight: '500'},
|
|
31
|
+
action_default: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
|
|
32
|
+
action_xxs: {fontSize: 10, lineHeight: 14, fontWeight: '700'},
|
|
33
|
+
action_xs: {fontSize: 12, lineHeight: 16, fontWeight: '700'},
|
|
34
|
+
action_s: {fontSize: 15, lineHeight: 22, fontWeight: '700'},
|
|
34
35
|
};
|
package/Text/types.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface TypographyWeight {
|
|
1
|
+
export type TypographyWeight = {
|
|
4
2
|
[key: string]: string;
|
|
5
3
|
100: string;
|
|
6
4
|
200: string;
|
|
@@ -13,7 +11,7 @@ export interface TypographyWeight {
|
|
|
13
11
|
900: string;
|
|
14
12
|
normal: string;
|
|
15
13
|
bold: string;
|
|
16
|
-
}
|
|
14
|
+
};
|
|
17
15
|
|
|
18
16
|
export type Typography =
|
|
19
17
|
| 'headline_default'
|
|
@@ -23,9 +21,9 @@ export type Typography =
|
|
|
23
21
|
| 'title_default'
|
|
24
22
|
| 'title_xs'
|
|
25
23
|
| 'title_s'
|
|
26
|
-
| '
|
|
27
|
-
| '
|
|
28
|
-
| '
|
|
24
|
+
| 'header_default'
|
|
25
|
+
| 'header_xs'
|
|
26
|
+
| 'header_s'
|
|
29
27
|
| 'paragraph_default'
|
|
30
28
|
| 'paragraph_bold'
|
|
31
29
|
| 'paragraph_italic'
|
|
@@ -40,8 +38,3 @@ export type Typography =
|
|
|
40
38
|
| 'action_xxs'
|
|
41
39
|
| 'action_xs'
|
|
42
40
|
| 'action_s';
|
|
43
|
-
|
|
44
|
-
export interface TextProps extends RNTextProps {
|
|
45
|
-
typography: Typography;
|
|
46
|
-
color?: string;
|
|
47
|
-
}
|
package/index.ts
CHANGED
|
@@ -1,18 +1,35 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
SafeAreaView,
|
|
3
|
+
useSafeAreaInsets,
|
|
4
|
+
SafeAreaProvider,
|
|
5
|
+
} from 'react-native-safe-area-context';
|
|
6
|
+
import LinearGradient from 'react-native-linear-gradient';
|
|
7
|
+
import Playground from './Playground';
|
|
8
|
+
export {Playground};
|
|
2
9
|
|
|
3
|
-
export {
|
|
10
|
+
export {SafeAreaView, useSafeAreaInsets, SafeAreaProvider, LinearGradient};
|
|
4
11
|
|
|
5
|
-
export * from './Layout';
|
|
6
12
|
export * from './Consts';
|
|
13
|
+
export * from './Layout';
|
|
14
|
+
export * from './Layout/types';
|
|
15
|
+
export * from './Popup';
|
|
16
|
+
export * from './Popup/types';
|
|
7
17
|
export * from './Text';
|
|
8
18
|
export * from './Text/types';
|
|
19
|
+
export * from './Button';
|
|
9
20
|
export * from './Navigation';
|
|
10
21
|
export * from './Navigation/types';
|
|
11
22
|
export * from './Icon';
|
|
12
23
|
export * from './Icon/types';
|
|
13
24
|
export * from './IconButton';
|
|
14
|
-
export * from './IconButton/types';
|
|
15
25
|
export * from './Image';
|
|
16
26
|
export * from './Image/types';
|
|
17
27
|
export * from './ContentLoader';
|
|
18
28
|
export * from './ContentLoader/types';
|
|
29
|
+
export * from './CheckBox';
|
|
30
|
+
export * from './CheckBox/types';
|
|
31
|
+
export * from './Radio';
|
|
32
|
+
export * from './Radio/types';
|
|
33
|
+
export * from './Switch';
|
|
34
|
+
export * from './Switch/types';
|
|
35
|
+
export * from './Input';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/foundation",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "React Native Component Kits",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -15,9 +15,8 @@
|
|
|
15
15
|
"@react-navigation/core": "5.16.1",
|
|
16
16
|
"@react-navigation/native": "5.9.8",
|
|
17
17
|
"@react-navigation/routers": "5.7.4",
|
|
18
|
-
"@react-navigation/stack": "
|
|
19
|
-
"@gorhom/bottom-sheet": "2.4.1"
|
|
20
|
-
"react-native-screens": "git+https://gitlab.com/dung.huynh1/react-native-screens.git#main"
|
|
18
|
+
"@react-navigation/stack": "git+https://gitlab.com/dung.huynh1/react-navigation-stack.git#main",
|
|
19
|
+
"@gorhom/bottom-sheet": "2.4.1"
|
|
21
20
|
},
|
|
22
21
|
"peerDependencies": {
|
|
23
22
|
"react-native": "*"
|
package/Button/types.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TouchableNativeFeedbackProps,
|
|
3
|
-
TouchableOpacityProps,
|
|
4
|
-
} from 'react-native';
|
|
5
|
-
|
|
6
|
-
export type ButtonType =
|
|
7
|
-
| 'primary'
|
|
8
|
-
| 'secondary'
|
|
9
|
-
| 'tonal'
|
|
10
|
-
| 'outline'
|
|
11
|
-
| 'disable'
|
|
12
|
-
| 'text';
|
|
13
|
-
|
|
14
|
-
export type ButtonSize = 'large' | 'medium' | 'small';
|
|
15
|
-
|
|
16
|
-
export interface ButtonProps
|
|
17
|
-
extends TouchableOpacityProps,
|
|
18
|
-
TouchableNativeFeedbackProps {}
|
package/CheckBox/index.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import React, {useContext} from 'react';
|
|
2
|
-
import {TouchableOpacity} from 'react-native';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import {ApplicationContext, Index} from '@components';
|
|
5
|
-
|
|
6
|
-
const Index = props => {
|
|
7
|
-
const {theme} = useContext(ApplicationContext);
|
|
8
|
-
const {style, value, disabled, size, shape, onPress} = props;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* export icon name
|
|
12
|
-
*/
|
|
13
|
-
const getIconName = () => {
|
|
14
|
-
switch (shape) {
|
|
15
|
-
case 'circle':
|
|
16
|
-
if (value) {
|
|
17
|
-
return 'checkbox-marked-circle';
|
|
18
|
-
}
|
|
19
|
-
return 'checkbox-blank-circle-outline';
|
|
20
|
-
case 'rectangle':
|
|
21
|
-
if (value) {
|
|
22
|
-
return 'checkbox-marked';
|
|
23
|
-
}
|
|
24
|
-
return 'checkbox-blank-outline';
|
|
25
|
-
|
|
26
|
-
default:
|
|
27
|
-
return 'checkbox-blank-outline';
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* export icon color
|
|
33
|
-
*/
|
|
34
|
-
const getIconColor = () => {
|
|
35
|
-
if (disabled) {
|
|
36
|
-
return theme.colors.textSecondary;
|
|
37
|
-
}
|
|
38
|
-
if (value) {
|
|
39
|
-
return theme.colors.primary;
|
|
40
|
-
}
|
|
41
|
-
return theme.colors.text;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<TouchableOpacity disabled={disabled} onPress={onPress}>
|
|
46
|
-
<Index
|
|
47
|
-
name={getIconName()}
|
|
48
|
-
size={size}
|
|
49
|
-
color={getIconColor()}
|
|
50
|
-
style={style}
|
|
51
|
-
/>
|
|
52
|
-
</TouchableOpacity>
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
Index.propTypes = {
|
|
57
|
-
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
58
|
-
value: PropTypes.bool,
|
|
59
|
-
disabled: PropTypes.bool,
|
|
60
|
-
size: PropTypes.number,
|
|
61
|
-
onPress: PropTypes.func,
|
|
62
|
-
shape: PropTypes.oneOf(['circle', 'rectangle']),
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
Index.defaultProps = {
|
|
66
|
-
style: {},
|
|
67
|
-
value: false,
|
|
68
|
-
disabled: false,
|
|
69
|
-
size: 24,
|
|
70
|
-
onPress: () => {},
|
|
71
|
-
shape: 'circle',
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export default Index;
|
package/CheckBox/styles.js
DELETED
package/IconButton/types.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {TouchableOpacityProps} from 'react-native';
|
|
2
|
-
|
|
3
|
-
export type IconButtonType =
|
|
4
|
-
| 'primary'
|
|
5
|
-
| 'tonal'
|
|
6
|
-
| 'secondary'
|
|
7
|
-
| 'outline'
|
|
8
|
-
| 'disabled';
|
|
9
|
-
export type IconButtonSize = 'large' | 'small';
|
|
10
|
-
export type IconButtonShape = 'circle' | 'rectangle';
|
|
11
|
-
|
|
12
|
-
export interface IconButtonProps extends TouchableOpacityProps {
|
|
13
|
-
icon: string;
|
|
14
|
-
type?: IconButtonType;
|
|
15
|
-
size?: IconButtonSize;
|
|
16
|
-
shape?: IconButtonShape;
|
|
17
|
-
}
|
package/Layout/Row.tsx
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React, {useContext} from 'react';
|
|
2
|
-
import {View} from 'react-native';
|
|
3
|
-
import styles from './styles';
|
|
4
|
-
import {MMSectionContext} from './Section';
|
|
5
|
-
import {DEFAULT_SCREEN_PADDING, screenWidth} from './utils';
|
|
6
|
-
|
|
7
|
-
const MMRow: React.FC<any> = props => {
|
|
8
|
-
const haveMargin = useContext(MMSectionContext);
|
|
9
|
-
const rowWidth = haveMargin
|
|
10
|
-
? screenWidth - DEFAULT_SCREEN_PADDING * 4
|
|
11
|
-
: screenWidth - DEFAULT_SCREEN_PADDING * 2;
|
|
12
|
-
|
|
13
|
-
const {children} = props;
|
|
14
|
-
let totalGap = 0;
|
|
15
|
-
return (
|
|
16
|
-
<View
|
|
17
|
-
style={[
|
|
18
|
-
styles.row,
|
|
19
|
-
{
|
|
20
|
-
width: rowWidth,
|
|
21
|
-
},
|
|
22
|
-
]}>
|
|
23
|
-
{React.Children.map(children, (child, index) => {
|
|
24
|
-
let isEndLine = false;
|
|
25
|
-
totalGap += child.props.span;
|
|
26
|
-
if (totalGap >= 12) {
|
|
27
|
-
totalGap = 0;
|
|
28
|
-
isEndLine = true;
|
|
29
|
-
}
|
|
30
|
-
if (totalGap + children[index + 1]?.props?.span > 12) {
|
|
31
|
-
totalGap = 0;
|
|
32
|
-
}
|
|
33
|
-
return React.cloneElement(child, {
|
|
34
|
-
isEndLine: isEndLine,
|
|
35
|
-
isRowChild: true,
|
|
36
|
-
});
|
|
37
|
-
})}
|
|
38
|
-
</View>
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export default MMRow;
|