@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/Layout/TrackingScope.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {TrackingScopeContext} from '../
|
|
2
|
+
import { TrackingScopeContext } from '../Context';
|
|
3
3
|
|
|
4
4
|
const TrackingScope = ({
|
|
5
5
|
scopeName,
|
|
@@ -9,10 +9,10 @@ const TrackingScope = ({
|
|
|
9
9
|
children: any;
|
|
10
10
|
}) => {
|
|
11
11
|
return (
|
|
12
|
-
<TrackingScopeContext.Provider value={{scopeName}}>
|
|
12
|
+
<TrackingScopeContext.Provider value={{ scopeName }}>
|
|
13
13
|
{children}
|
|
14
14
|
</TrackingScopeContext.Provider>
|
|
15
15
|
);
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export {TrackingScope};
|
|
18
|
+
export { TrackingScope };
|
package/Loader/DotLoader.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React, {FC, useContext} from 'react';
|
|
1
|
+
import React, { FC, useContext } from 'react';
|
|
2
2
|
import AnimatedLottieView from 'lottie-react-native';
|
|
3
3
|
import animation from '../Assets/DotAnimation.json';
|
|
4
|
-
import {ApplicationContext} from '../
|
|
5
|
-
import {hexToRGBA} from './utils';
|
|
6
|
-
import {LoaderProps} from './types';
|
|
4
|
+
import { ApplicationContext } from '../Context';
|
|
5
|
+
import { hexToRGBA } from './utils';
|
|
6
|
+
import { LoaderProps } from './types';
|
|
7
7
|
|
|
8
|
-
const DotLoader: FC<LoaderProps> = ({color, style}) => {
|
|
9
|
-
const {theme} = useContext(ApplicationContext);
|
|
8
|
+
const DotLoader: FC<LoaderProps> = ({ color, style }) => {
|
|
9
|
+
const { theme } = useContext(ApplicationContext);
|
|
10
10
|
|
|
11
11
|
const arrayColor = [
|
|
12
12
|
color ?? theme.colors.primary,
|
|
@@ -28,7 +28,7 @@ const DotLoader: FC<LoaderProps> = ({color, style}) => {
|
|
|
28
28
|
return (
|
|
29
29
|
<AnimatedLottieView
|
|
30
30
|
source={source}
|
|
31
|
-
style={[{width: 52, height: 18}, style]}
|
|
31
|
+
style={[{ width: 52, height: 18 }, style]}
|
|
32
32
|
autoPlay
|
|
33
33
|
/>
|
|
34
34
|
);
|
package/Loader/ProgressBar.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React, {FC, useContext, useEffect, useRef} from 'react';
|
|
2
|
-
import {Animated, View} from 'react-native';
|
|
1
|
+
import React, { FC, useContext, useEffect, useRef } from 'react';
|
|
2
|
+
import { Animated, View } from 'react-native';
|
|
3
3
|
import styles from './styles';
|
|
4
|
-
import {ProgressBarProps} from './types';
|
|
5
|
-
import {ApplicationContext} from '../
|
|
6
|
-
import {Radius} from '../Consts';
|
|
4
|
+
import { ProgressBarProps } from './types';
|
|
5
|
+
import { ApplicationContext } from '../Context';
|
|
6
|
+
import { Radius } from '../Consts';
|
|
7
7
|
|
|
8
|
-
const ProgressBar: FC<ProgressBarProps> = ({percent = 0, style}) => {
|
|
9
|
-
const {theme} = useContext(ApplicationContext);
|
|
8
|
+
const ProgressBar: FC<ProgressBarProps> = ({ percent = 0, style }) => {
|
|
9
|
+
const { theme } = useContext(ApplicationContext);
|
|
10
10
|
const animation = useRef(new Animated.Value(0)).current;
|
|
11
11
|
|
|
12
12
|
useEffect(() => {
|
|
@@ -27,8 +27,9 @@ const ProgressBar: FC<ProgressBarProps> = ({percent = 0, style}) => {
|
|
|
27
27
|
style={[
|
|
28
28
|
style,
|
|
29
29
|
styles.progressContainer,
|
|
30
|
-
{backgroundColor: theme.colors.background.default},
|
|
31
|
-
]}
|
|
30
|
+
{ backgroundColor: theme.colors.background.default },
|
|
31
|
+
]}
|
|
32
|
+
>
|
|
32
33
|
<Animated.View
|
|
33
34
|
style={{
|
|
34
35
|
height: 4,
|
package/Loader/Spinner.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React, {FC, useContext} from 'react';
|
|
1
|
+
import React, { FC, useContext } from 'react';
|
|
2
2
|
import AnimatedLottieView from 'lottie-react-native';
|
|
3
3
|
import animation from '../Assets/SpinnerAnimation.json';
|
|
4
|
-
import {hexToRGBA} from './utils';
|
|
5
|
-
import {ApplicationContext} from '../
|
|
6
|
-
import {LoaderProps} from './types';
|
|
4
|
+
import { hexToRGBA } from './utils';
|
|
5
|
+
import { ApplicationContext } from '../Context';
|
|
6
|
+
import { LoaderProps } from './types';
|
|
7
7
|
|
|
8
|
-
const Spinner: FC<LoaderProps> = ({color, style}) => {
|
|
9
|
-
const {theme} = useContext(ApplicationContext);
|
|
8
|
+
const Spinner: FC<LoaderProps> = ({ color, style }) => {
|
|
9
|
+
const { theme } = useContext(ApplicationContext);
|
|
10
10
|
|
|
11
11
|
let source: any = animation;
|
|
12
12
|
source.assets[0].layers.forEach((layer: any) => {
|
|
@@ -20,7 +20,7 @@ const Spinner: FC<LoaderProps> = ({color, style}) => {
|
|
|
20
20
|
return (
|
|
21
21
|
<AnimatedLottieView
|
|
22
22
|
source={source}
|
|
23
|
-
style={[{width: 24, height: 24}, style]}
|
|
23
|
+
style={[{ width: 24, height: 24 }, style]}
|
|
24
24
|
autoPlay
|
|
25
25
|
/>
|
|
26
26
|
);
|
package/Pagination/Dot.tsx
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import React, {FC, useContext} from 'react';
|
|
2
|
-
import {Animated} from 'react-native';
|
|
1
|
+
import React, { FC, useContext } from 'react';
|
|
2
|
+
import { Animated } from 'react-native';
|
|
3
3
|
import styles from './styles';
|
|
4
|
-
import {DotProps} from './types';
|
|
5
|
-
import {ApplicationContext} from '../
|
|
4
|
+
import { DotProps } from './types';
|
|
5
|
+
import { ApplicationContext } from '../Context';
|
|
6
6
|
|
|
7
|
-
const Dot: FC<DotProps> = ({active, style}) => {
|
|
8
|
-
const {theme} = useContext(ApplicationContext);
|
|
7
|
+
const Dot: FC<DotProps> = ({ active, style }) => {
|
|
8
|
+
const { theme } = useContext(ApplicationContext);
|
|
9
9
|
const dotStyle = active
|
|
10
10
|
? [styles.activeDot]
|
|
11
|
-
: [
|
|
11
|
+
: [
|
|
12
|
+
styles.inactiveDot,
|
|
13
|
+
{ backgroundColor: theme.colors.background.pressed },
|
|
14
|
+
];
|
|
12
15
|
|
|
13
16
|
return <Animated.View style={[style, dotStyle]} />;
|
|
14
17
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import React, {FC, useContext} from 'react';
|
|
2
|
-
import {View} from 'react-native';
|
|
3
|
-
import {ChildPaginationProps} from './types';
|
|
1
|
+
import React, { FC, useContext } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { ChildPaginationProps } from './types';
|
|
4
4
|
import Dot from './Dot';
|
|
5
5
|
import styles from './styles';
|
|
6
|
-
import {Spacing} from '../Consts';
|
|
7
|
-
import {ApplicationContext} from '../
|
|
6
|
+
import { Spacing } from '../Consts';
|
|
7
|
+
import { ApplicationContext } from '../Context';
|
|
8
8
|
|
|
9
9
|
const PaginationDot: FC<ChildPaginationProps> = ({
|
|
10
10
|
dataLength = 2,
|
|
11
11
|
activeIndex = 0,
|
|
12
12
|
style,
|
|
13
13
|
}) => {
|
|
14
|
-
const {theme} = useContext(ApplicationContext);
|
|
14
|
+
const { theme } = useContext(ApplicationContext);
|
|
15
15
|
const renderDots = () => {
|
|
16
16
|
const dots: React.ReactElement[] = [];
|
|
17
17
|
for (let i = 0; i < dataLength; i++) {
|
|
@@ -19,8 +19,8 @@ const PaginationDot: FC<ChildPaginationProps> = ({
|
|
|
19
19
|
<Dot
|
|
20
20
|
key={`Dot${i}`}
|
|
21
21
|
style={[
|
|
22
|
-
i !== dataLength - 1 ? {marginRight: Spacing.XS} : {},
|
|
23
|
-
{backgroundColor: theme.colors.primary},
|
|
22
|
+
i !== dataLength - 1 ? { marginRight: Spacing.XS } : {},
|
|
23
|
+
{ backgroundColor: theme.colors.primary },
|
|
24
24
|
]}
|
|
25
25
|
active={activeIndex === i}
|
|
26
26
|
/>,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, {FC, useContext, useRef, useState} from 'react';
|
|
2
|
-
import {Animated, View} from 'react-native';
|
|
3
|
-
import {ScrollIndicatorProps} from './types';
|
|
1
|
+
import React, { FC, useContext, useRef, useState } from 'react';
|
|
2
|
+
import { Animated, View } from 'react-native';
|
|
3
|
+
import { ScrollIndicatorProps } from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
|
-
import {ApplicationContext} from '../
|
|
5
|
+
import { ApplicationContext } from '../Context';
|
|
6
6
|
|
|
7
7
|
const INDICATOR_WIDTH = 24;
|
|
8
8
|
const INDICATOR_CONTAINER_WIDTH = 72;
|
|
@@ -11,7 +11,7 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
11
11
|
children,
|
|
12
12
|
scrollViewRef,
|
|
13
13
|
}) => {
|
|
14
|
-
const {theme} = useContext(ApplicationContext);
|
|
14
|
+
const { theme } = useContext(ApplicationContext);
|
|
15
15
|
const left = useRef(new Animated.Value(0)).current;
|
|
16
16
|
const [scrollViewWidth, setScrollViewWidth] = useState(0);
|
|
17
17
|
const [scrollContentWidth, setScrollContentWidth] = useState(0);
|
|
@@ -23,7 +23,7 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
23
23
|
outputRange: [0, INDICATOR_CONTAINER_WIDTH - INDICATOR_WIDTH],
|
|
24
24
|
extrapolate: 'clamp',
|
|
25
25
|
});
|
|
26
|
-
return {transform: [{translateX: value}]};
|
|
26
|
+
return { transform: [{ translateX: value }] };
|
|
27
27
|
}
|
|
28
28
|
return {};
|
|
29
29
|
};
|
|
@@ -42,7 +42,7 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
],
|
|
45
|
-
{useNativeDriver: true}
|
|
45
|
+
{ useNativeDriver: true },
|
|
46
46
|
)}
|
|
47
47
|
alwaysBounceHorizontal={false}
|
|
48
48
|
showsHorizontalScrollIndicator={false}
|
|
@@ -53,7 +53,8 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
53
53
|
}}
|
|
54
54
|
onLayout={e => {
|
|
55
55
|
setScrollViewWidth(e.nativeEvent.layout.width);
|
|
56
|
-
}}
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
57
58
|
{children}
|
|
58
59
|
</Animated.ScrollView>
|
|
59
60
|
);
|
|
@@ -63,8 +64,9 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
63
64
|
<View
|
|
64
65
|
style={[
|
|
65
66
|
styles.indicatorContainer,
|
|
66
|
-
{backgroundColor: theme.colors.background.pressed},
|
|
67
|
-
]}
|
|
67
|
+
{ backgroundColor: theme.colors.background.pressed },
|
|
68
|
+
]}
|
|
69
|
+
>
|
|
68
70
|
<Animated.View
|
|
69
71
|
style={[
|
|
70
72
|
styles.indicator,
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
TouchableOpacity,
|
|
7
7
|
View,
|
|
8
8
|
} from 'react-native';
|
|
9
|
-
import { ApplicationContext, MiniAppContext } from '../
|
|
9
|
+
import { ApplicationContext, MiniAppContext } from '../Context';
|
|
10
10
|
import { Button } from '../Button';
|
|
11
11
|
import { Radius, Spacing, Styles } from '../Consts';
|
|
12
12
|
import { Icon } from '../Icon';
|
|
@@ -226,7 +226,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
226
226
|
<Text
|
|
227
227
|
accessibilityLabel={'description_popup_notify'}
|
|
228
228
|
typography={'body_default_regular'}
|
|
229
|
-
onTextLayout={({nativeEvent: {lines}}) => {
|
|
229
|
+
onTextLayout={({ nativeEvent: { lines } }) => {
|
|
230
230
|
const enableScroll = lines.length > 8.5;
|
|
231
231
|
if (enableScroll !== scrollContent) {
|
|
232
232
|
setScrollContent(enableScroll);
|
package/Popup/PopupPromotion.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useRef } from 'react';
|
|
2
2
|
import { Dimensions, StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import { PopupPromotionProps } from './types';
|
|
4
|
-
import { ApplicationContext, MiniAppContext } from '../
|
|
4
|
+
import { ApplicationContext, MiniAppContext } from '../Context';
|
|
5
5
|
import { Image } from '../Image';
|
|
6
6
|
import { Radius, Spacing } from '../Consts';
|
|
7
7
|
import { Icon } from '../Icon';
|
package/Radio/index.tsx
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import React, {FC, useContext} from 'react';
|
|
2
|
-
import {TouchableOpacity, View} from 'react-native';
|
|
1
|
+
import React, { FC, useContext } from 'react';
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import {RadioProps} from './types';
|
|
5
|
-
import {Text} from '../Text';
|
|
4
|
+
import { RadioProps } from './types';
|
|
5
|
+
import { Text } from '../Text';
|
|
6
6
|
import styles from './styles';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
useComponentId,
|
|
11
|
-
} from '../Application';
|
|
12
|
-
import {Spacing} from '../Consts';
|
|
7
|
+
import { useComponentId } from '../Application';
|
|
8
|
+
import { ApplicationContext, ComponentContext } from '../Context';
|
|
9
|
+
import { Spacing } from '../Consts';
|
|
13
10
|
|
|
14
11
|
const Radio: FC<RadioProps> = ({
|
|
15
12
|
value,
|
|
@@ -23,12 +20,12 @@ const Radio: FC<RadioProps> = ({
|
|
|
23
20
|
accessibilityLabel,
|
|
24
21
|
...props
|
|
25
22
|
}) => {
|
|
26
|
-
const {theme} = useContext(ApplicationContext);
|
|
23
|
+
const { theme } = useContext(ApplicationContext);
|
|
27
24
|
const selected = value === groupValue;
|
|
28
25
|
const componentName = 'Radio';
|
|
29
|
-
const {componentId} = useComponentId(
|
|
26
|
+
const { componentId } = useComponentId(
|
|
30
27
|
`${componentName}${label ? `/${label}` : ''}`,
|
|
31
|
-
accessibilityLabel
|
|
28
|
+
accessibilityLabel,
|
|
32
29
|
);
|
|
33
30
|
let disabledStyle = {};
|
|
34
31
|
let checkBoxStyle = {
|
|
@@ -58,7 +55,8 @@ const Radio: FC<RadioProps> = ({
|
|
|
58
55
|
params,
|
|
59
56
|
state: disabled ? 'disabled' : 'enabled',
|
|
60
57
|
action: 'click',
|
|
61
|
-
}}
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
62
60
|
<TouchableOpacity
|
|
63
61
|
{...props}
|
|
64
62
|
disabled={disabled}
|
|
@@ -75,20 +73,22 @@ const Radio: FC<RadioProps> = ({
|
|
|
75
73
|
disabled: disabled as boolean,
|
|
76
74
|
...accessibilityState,
|
|
77
75
|
}}
|
|
78
|
-
accessibilityLabel={componentId}
|
|
76
|
+
accessibilityLabel={componentId}
|
|
77
|
+
>
|
|
79
78
|
<View
|
|
80
79
|
style={[
|
|
81
80
|
styles.radio,
|
|
82
81
|
checkBoxStyle,
|
|
83
82
|
disabledStyle,
|
|
84
|
-
{marginRight: label ? Spacing.S : 0},
|
|
83
|
+
{ marginRight: label ? Spacing.S : 0 },
|
|
85
84
|
]}
|
|
86
85
|
/>
|
|
87
86
|
{!!label && (
|
|
88
87
|
<Text
|
|
89
88
|
typography={'body_default_regular'}
|
|
90
89
|
style={styles.radioText}
|
|
91
|
-
accessibilityLabel={componentId + '|text'}
|
|
90
|
+
accessibilityLabel={componentId + '|text'}
|
|
91
|
+
>
|
|
92
92
|
{label}
|
|
93
93
|
</Text>
|
|
94
94
|
)}
|
|
@@ -97,4 +97,4 @@ const Radio: FC<RadioProps> = ({
|
|
|
97
97
|
);
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
export {Radio};
|
|
100
|
+
export { Radio };
|
package/Skeleton/index.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import LinearGradient from 'react-native-linear-gradient';
|
|
|
12
12
|
import { SkeletonTypes } from './types';
|
|
13
13
|
import { Colors, Styles } from '../Consts';
|
|
14
14
|
import styles from './styles';
|
|
15
|
-
import { ScreenContext, SkeletonContext } from '../
|
|
15
|
+
import { ScreenContext, SkeletonContext } from '../Context';
|
|
16
16
|
|
|
17
17
|
const Skeleton: React.FC<SkeletonTypes> = ({ style }) => {
|
|
18
18
|
const screen = useContext<any>(ScreenContext);
|
package/Switch/index.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React, {FC} from 'react';
|
|
2
|
-
import {TouchableOpacity, View} from 'react-native';
|
|
3
|
-
import {SwitchProps} from './types';
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import { SwitchProps } from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
|
-
import {Colors} from '../Consts';
|
|
6
|
-
import {
|
|
5
|
+
import { Colors } from '../Consts';
|
|
6
|
+
import { useComponentId } from '../Application';
|
|
7
|
+
import { ComponentContext } from '../Context';
|
|
7
8
|
|
|
8
9
|
const Switch: FC<SwitchProps> = ({
|
|
9
10
|
value = false,
|
|
@@ -18,7 +19,7 @@ const Switch: FC<SwitchProps> = ({
|
|
|
18
19
|
const circleAlign = value ? 'flex-end' : 'flex-start';
|
|
19
20
|
const componentName = 'Switch';
|
|
20
21
|
|
|
21
|
-
const {componentId} = useComponentId(componentName, accessibilityLabel);
|
|
22
|
+
const { componentId } = useComponentId(componentName, accessibilityLabel);
|
|
22
23
|
|
|
23
24
|
let backgroundColor = value ? Colors.green_03 : Colors.black_07;
|
|
24
25
|
if (disabled) {
|
|
@@ -32,7 +33,8 @@ const Switch: FC<SwitchProps> = ({
|
|
|
32
33
|
params,
|
|
33
34
|
state: disabled ? 'disabled' : 'enabled',
|
|
34
35
|
action: 'click',
|
|
35
|
-
}}
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
36
38
|
<TouchableOpacity
|
|
37
39
|
{...props}
|
|
38
40
|
disabled={disabled}
|
|
@@ -46,14 +48,17 @@ const Switch: FC<SwitchProps> = ({
|
|
|
46
48
|
style={[
|
|
47
49
|
style,
|
|
48
50
|
styles.container,
|
|
49
|
-
{backgroundColor, alignItems: circleAlign},
|
|
50
|
-
]}
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
{ backgroundColor, alignItems: circleAlign },
|
|
52
|
+
]}
|
|
53
|
+
>
|
|
54
|
+
<View
|
|
55
|
+
style={[styles.circle, { backgroundColor: circleBackgroundColor }]}
|
|
56
|
+
>
|
|
57
|
+
<View style={[styles.circleSmall, { backgroundColor }]} />
|
|
53
58
|
</View>
|
|
54
59
|
</TouchableOpacity>
|
|
55
60
|
</ComponentContext.Provider>
|
|
56
61
|
);
|
|
57
62
|
};
|
|
58
63
|
|
|
59
|
-
export {Switch};
|
|
64
|
+
export { Switch };
|
package/Text/index.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import React, { useContext } from 'react';
|
|
|
2
2
|
import { Text as RNText, TextProps as RNTextProps, View } from 'react-native';
|
|
3
3
|
import styles from './styles';
|
|
4
4
|
import { Typography, TypographyWeight } from './types';
|
|
5
|
-
import { ApplicationContext, SkeletonContext } from '../
|
|
5
|
+
import { ApplicationContext, SkeletonContext } from '../Context';
|
|
6
6
|
import { scaleSize } from './utils';
|
|
7
7
|
import { Skeleton } from '../Skeleton';
|
|
8
8
|
|
package/Title/index.tsx
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import React, {FC, useContext, useState} from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import React, { FC, useContext, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Text as RNText,
|
|
4
|
+
TouchableOpacity,
|
|
5
|
+
View,
|
|
6
|
+
ViewStyle,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
import { Icon } from '../Icon';
|
|
9
|
+
import { scaleSize, Text } from '../Text';
|
|
10
|
+
import { useComponentId } from '../Application';
|
|
11
|
+
import { ApplicationContext } from '../Context';
|
|
12
|
+
import { Badge } from '../Badge';
|
|
13
|
+
import { Colors } from '../Consts';
|
|
8
14
|
import styles from './styles';
|
|
9
|
-
import {TitleProps} from './types';
|
|
10
|
-
import {Typography} from '../Text/types';
|
|
15
|
+
import { TitleProps } from './types';
|
|
16
|
+
import { Typography } from '../Text/types';
|
|
11
17
|
|
|
12
18
|
const Title: FC<TitleProps> = ({
|
|
13
19
|
accessibilityLabel,
|
|
@@ -28,7 +34,7 @@ const Title: FC<TitleProps> = ({
|
|
|
28
34
|
textOnly = false,
|
|
29
35
|
style,
|
|
30
36
|
}) => {
|
|
31
|
-
const {theme} = useContext(ApplicationContext);
|
|
37
|
+
const { theme } = useContext(ApplicationContext);
|
|
32
38
|
const [badgeWidth, setBadgeWidth] = useState(0);
|
|
33
39
|
const [contentWidth, setContentWidth] = useState(0);
|
|
34
40
|
const styleSheet: {
|
|
@@ -39,10 +45,10 @@ const Title: FC<TitleProps> = ({
|
|
|
39
45
|
const numberOfLines = showTrailingAction || !!badgeLabel ? 1 : 2;
|
|
40
46
|
const buttonTypo: Typography =
|
|
41
47
|
buttonSize === 'small' ? 'action_xs_bold' : 'action_s_bold';
|
|
42
|
-
const flexStyle: ViewStyle = showTrailingAction ? {maxWidth: '95%'} : {};
|
|
48
|
+
const flexStyle: ViewStyle = showTrailingAction ? { maxWidth: '95%' } : {};
|
|
43
49
|
const componentName = 'Title';
|
|
44
50
|
|
|
45
|
-
const {componentId} = useComponentId(
|
|
51
|
+
const { componentId } = useComponentId(
|
|
46
52
|
`${componentName}/${title}`,
|
|
47
53
|
accessibilityLabel,
|
|
48
54
|
);
|
|
@@ -55,17 +61,18 @@ const Title: FC<TitleProps> = ({
|
|
|
55
61
|
};
|
|
56
62
|
|
|
57
63
|
if (iconAlign === 'middle') {
|
|
58
|
-
iconStyle = {justifyContent: 'center'};
|
|
64
|
+
iconStyle = { justifyContent: 'center' };
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
if (iconAlign === 'bottom') {
|
|
62
|
-
iconStyle = {justifyContent: 'flex-end'};
|
|
68
|
+
iconStyle = { justifyContent: 'flex-end' };
|
|
63
69
|
}
|
|
64
70
|
|
|
65
71
|
return (
|
|
66
72
|
<View
|
|
67
73
|
accessibilityLabel={componentId + '|icon'}
|
|
68
|
-
style={[styles.iconView, iconStyle]}
|
|
74
|
+
style={[styles.iconView, iconStyle]}
|
|
75
|
+
>
|
|
69
76
|
<Icon color={iconColor} source={icon} />
|
|
70
77
|
</View>
|
|
71
78
|
);
|
|
@@ -80,7 +87,8 @@ const Title: FC<TitleProps> = ({
|
|
|
80
87
|
setContentWidth(e.nativeEvent.layout.width);
|
|
81
88
|
}
|
|
82
89
|
}}
|
|
83
|
-
style={[styles.iconLeftView, flexStyle]}
|
|
90
|
+
style={[styles.iconLeftView, flexStyle]}
|
|
91
|
+
>
|
|
84
92
|
<RNText
|
|
85
93
|
accessibilityLabel={componentId + '|title-text'}
|
|
86
94
|
numberOfLines={numberOfLines}
|
|
@@ -91,7 +99,8 @@ const Title: FC<TitleProps> = ({
|
|
|
91
99
|
maxWidth:
|
|
92
100
|
contentWidth > 0 ? contentWidth - badgeWidth : undefined,
|
|
93
101
|
},
|
|
94
|
-
]}
|
|
102
|
+
]}
|
|
103
|
+
>
|
|
95
104
|
{title}
|
|
96
105
|
</RNText>
|
|
97
106
|
{badgeLabel && (
|
|
@@ -103,7 +112,8 @@ const Title: FC<TitleProps> = ({
|
|
|
103
112
|
}}
|
|
104
113
|
style={{
|
|
105
114
|
alignItems: 'center',
|
|
106
|
-
}}
|
|
115
|
+
}}
|
|
116
|
+
>
|
|
107
117
|
<Badge
|
|
108
118
|
style={styles.badge}
|
|
109
119
|
label={badgeLabel}
|
|
@@ -118,7 +128,8 @@ const Title: FC<TitleProps> = ({
|
|
|
118
128
|
accessibilityLabel={componentId + '|description-text'}
|
|
119
129
|
style={styles.description}
|
|
120
130
|
color={theme.colors.text.secondary}
|
|
121
|
-
typography={'description_default_regular'}
|
|
131
|
+
typography={'description_default_regular'}
|
|
132
|
+
>
|
|
122
133
|
{description}
|
|
123
134
|
</Text>
|
|
124
135
|
)}
|
|
@@ -132,7 +143,8 @@ const Title: FC<TitleProps> = ({
|
|
|
132
143
|
accessibilityLabel={componentId + '|trailing-touch'}
|
|
133
144
|
onPress={onPressTrailingAction}
|
|
134
145
|
style={styles.iconLeftView}
|
|
135
|
-
hitSlop={{top: 10, bottom: 10, left: 50, right: 10}}
|
|
146
|
+
hitSlop={{ top: 10, bottom: 10, left: 50, right: 10 }}
|
|
147
|
+
>
|
|
136
148
|
{showTrailingAction && !showRightAction && (
|
|
137
149
|
<View
|
|
138
150
|
style={[
|
|
@@ -142,7 +154,8 @@ const Title: FC<TitleProps> = ({
|
|
|
142
154
|
? Colors.black_06 + '99'
|
|
143
155
|
: Colors.black_06 + '4D',
|
|
144
156
|
},
|
|
145
|
-
]}
|
|
157
|
+
]}
|
|
158
|
+
>
|
|
146
159
|
<Icon
|
|
147
160
|
source={'arrow_chevron_right_small'}
|
|
148
161
|
size={scaleSize(18)}
|
|
@@ -164,7 +177,8 @@ const Title: FC<TitleProps> = ({
|
|
|
164
177
|
style={{
|
|
165
178
|
height: lineHeight,
|
|
166
179
|
justifyContent: 'center',
|
|
167
|
-
}}
|
|
180
|
+
}}
|
|
181
|
+
>
|
|
168
182
|
{!buttonTitle ? (
|
|
169
183
|
<TouchableOpacity
|
|
170
184
|
onPress={onPressRightAction}
|
|
@@ -174,7 +188,8 @@ const Title: FC<TitleProps> = ({
|
|
|
174
188
|
backgroundColor: theme.colors.primary + '0F',
|
|
175
189
|
},
|
|
176
190
|
]}
|
|
177
|
-
accessibilityLabel={componentId + '|label-right-action-touch'}
|
|
191
|
+
accessibilityLabel={componentId + '|label-right-action-touch'}
|
|
192
|
+
>
|
|
178
193
|
<Icon
|
|
179
194
|
source={'arrow_chevron_right_small'}
|
|
180
195
|
size={scaleSize(22)}
|
|
@@ -184,11 +199,13 @@ const Title: FC<TitleProps> = ({
|
|
|
184
199
|
) : (
|
|
185
200
|
<TouchableOpacity
|
|
186
201
|
onPress={onPressRightAction}
|
|
187
|
-
accessibilityLabel={componentId + '|label-right-action-touch'}
|
|
202
|
+
accessibilityLabel={componentId + '|label-right-action-touch'}
|
|
203
|
+
>
|
|
188
204
|
<Text
|
|
189
205
|
color={theme.colors.primary}
|
|
190
206
|
typography={buttonTypo}
|
|
191
|
-
accessibilityLabel={componentId + '|label-right-action-text'}
|
|
207
|
+
accessibilityLabel={componentId + '|label-right-action-text'}
|
|
208
|
+
>
|
|
192
209
|
{buttonTitle}
|
|
193
210
|
</Text>
|
|
194
211
|
</TouchableOpacity>
|
|
@@ -203,7 +220,8 @@ const Title: FC<TitleProps> = ({
|
|
|
203
220
|
<RNText
|
|
204
221
|
accessibilityLabel={componentId + '|title-text'}
|
|
205
222
|
numberOfLines={numberOfLines}
|
|
206
|
-
style={[styleSheet[typography], styles.title]}
|
|
223
|
+
style={[styleSheet[typography], styles.title]}
|
|
224
|
+
>
|
|
207
225
|
{title}
|
|
208
226
|
</RNText>
|
|
209
227
|
</View>
|
|
@@ -213,7 +231,8 @@ const Title: FC<TitleProps> = ({
|
|
|
213
231
|
return (
|
|
214
232
|
<View
|
|
215
233
|
style={[style, styles.wrapper, isSection && styles.margin]}
|
|
216
|
-
accessibilityLabel={componentId}
|
|
234
|
+
accessibilityLabel={componentId}
|
|
235
|
+
>
|
|
217
236
|
{renderIcon()}
|
|
218
237
|
{renderContent()}
|
|
219
238
|
{renderActionRight()}
|
|
@@ -221,5 +240,5 @@ const Title: FC<TitleProps> = ({
|
|
|
221
240
|
);
|
|
222
241
|
};
|
|
223
242
|
|
|
224
|
-
export {Title};
|
|
225
|
-
export type {TitleProps};
|
|
243
|
+
export { Title };
|
|
244
|
+
export type { TitleProps };
|
package/index.ts
CHANGED
package/package.json
CHANGED