@hero-design/rn 8.0.0-2 → 8.0.0-5
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/.turbo/turbo-build.log +3 -3
- package/.turbo/turbo-lint.log +121 -96
- package/.turbo/turbo-test.log +348 -909
- package/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/es/index.js +389 -556
- package/lib/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/lib/assets/fonts/hero-icons.ttf +0 -0
- package/lib/index.js +389 -556
- package/package.json +5 -5
- package/src/components/Alert/StyledAlert.tsx +2 -3
- package/src/components/Alert/__tests__/__snapshots__/index.spec.tsx.snap +6 -12
- package/src/components/Alert/index.tsx +3 -23
- package/src/components/Box/__tests__/__snapshots__/index.spec.tsx.snap +4 -26
- package/src/components/Button/Button.tsx +7 -16
- package/src/components/Button/StyledButton.tsx +0 -46
- package/src/components/Button/__tests__/Button.spec.tsx +10 -11
- package/src/components/Button/__tests__/StyledButton.spec.tsx +0 -3
- package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +0 -91
- package/src/components/Card/StyledCard.tsx +2 -11
- package/src/components/Card/__tests__/StyledCard.spec.tsx +2 -14
- package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +0 -32
- package/src/components/Card/__tests__/__snapshots__/index.spec.tsx.snap +0 -4
- package/src/components/Card/__tests__/index.spec.tsx +1 -13
- package/src/components/Card/index.tsx +5 -26
- package/src/components/DatePicker/DatePickerAndroid.tsx +4 -0
- package/src/components/DatePicker/DatePickerIOS.tsx +4 -0
- package/src/components/DatePicker/__tests__/DatePicker.spec.tsx +4 -0
- package/src/components/DatePicker/__tests__/DatePickerAndroid.spec.tsx +4 -0
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +2 -0
- package/src/components/DatePicker/types.ts +8 -0
- package/src/components/Icon/HeroIcon/glyphMap.json +1 -1
- package/src/components/Icon/IconList.ts +0 -8
- package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +5 -7
- package/src/components/Select/MultiSelect/index.tsx +1 -20
- package/src/components/Select/SingleSelect/index.tsx +5 -24
- package/src/components/Select/types.ts +1 -11
- package/src/components/Switch/StyledSwitch.tsx +7 -12
- package/src/components/Switch/__tests__/StyledSwitch.spec.tsx +2 -2
- package/src/components/Switch/__tests__/__snapshots__/StyledSwitch.spec.tsx.snap +10 -15
- package/src/components/Switch/__tests__/__snapshots__/index.spec.tsx.snap +8 -12
- package/src/components/Switch/index.tsx +6 -22
- package/src/components/Tabs/ScrollableTabs.tsx +1 -6
- package/src/components/Tabs/TabWithBadge.tsx +1 -15
- package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +3 -1
- package/src/components/Tabs/__tests__/TabWithBadge.spec.tsx +4 -1
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +4 -3
- package/src/components/Tabs/__tests__/__snapshots__/TabWithBadge.spec.tsx.snap +2 -32
- package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +1 -2
- package/src/components/Tabs/__tests__/index.spec.tsx +3 -1
- package/src/components/Tabs/index.tsx +12 -24
- package/src/components/Tag/StyledTag.tsx +0 -1
- package/src/components/Tag/__tests__/Tag.spec.tsx +0 -9
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +0 -40
- package/src/components/Tag/index.tsx +3 -16
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +4 -63
- package/src/theme/components/switch.ts +4 -14
- package/src/theme/components/tag.ts +0 -2
- package/src/theme/global/colors/swag.ts +1 -20
- package/src/theme/global/colors/types.ts +1 -58
- package/src/utils/hooks.ts +1 -1
- package/types/components/Alert/StyledAlert.d.ts +0 -1
- package/types/components/Alert/index.d.ts +1 -6
- package/types/components/BottomSheet/BottomSheetContext.d.ts +5 -0
- package/types/components/BottomSheet/ScrollView.d.ts +3 -0
- package/types/components/Button/Button.d.ts +2 -3
- package/types/components/Button/StyledButton.d.ts +1 -1
- package/types/components/Card/StyledCard.d.ts +1 -8
- package/types/components/Card/index.d.ts +2 -8
- package/types/components/DatePicker/DatePickerAndroid.d.ts +1 -1
- package/types/components/DatePicker/DatePickerIOS.d.ts +1 -1
- package/types/components/DatePicker/types.d.ts +8 -0
- package/types/components/Icon/IconList.d.ts +1 -1
- package/types/components/Icon/index.d.ts +1 -1
- package/types/components/Icon/utils.d.ts +1 -1
- package/types/components/Select/MultiSelect/index.d.ts +1 -1
- package/types/components/Select/SingleSelect/index.d.ts +1 -1
- package/types/components/Select/index.d.ts +1 -1
- package/types/components/Select/types.d.ts +1 -11
- package/types/components/Switch/StyledSwitch.d.ts +0 -4
- package/types/components/Switch/index.d.ts +1 -6
- package/types/components/Tabs/TabWithBadge.d.ts +1 -2
- package/types/components/Tabs/index.d.ts +2 -3
- package/types/components/Tag/StyledTag.d.ts +1 -1
- package/types/components/Tag/index.d.ts +2 -2
- package/types/theme/components/switch.d.ts +4 -14
- package/types/theme/components/tag.d.ts +0 -2
- package/types/theme/global/colors/types.d.ts +1 -52
- package/types/theme/global/index.d.ts +0 -47
- package/.expo/README.md +0 -15
- package/.expo/packager-info.json +0 -10
- package/.expo/prebuild/cached-packages.json +0 -4
- package/.expo/settings.json +0 -10
- package/.expo/xcodebuild-error.log +0 -2
- package/.expo/xcodebuild.log +0 -11199
- package/.turbo/turbo-build:types.log +0 -2
- package/.turbo/turbo-build:watch.log +0 -1
- package/src/theme/__tests__/ensureCompatibleWithV7.spec.tsx +0 -13
- package/src/theme/global/colors/legacySystemPalette.ts +0 -53
- package/types/theme/utils.d.ts +0 -2
|
@@ -22,16 +22,15 @@ exports[`Switch renders correctly 1`] = `
|
|
|
22
22
|
"backgroundColor": "#808f91",
|
|
23
23
|
"borderRadius": 999,
|
|
24
24
|
"display": "flex",
|
|
25
|
-
"height":
|
|
25
|
+
"height": 24,
|
|
26
26
|
"justifyContent": "center",
|
|
27
27
|
"paddingHorizontal": 4,
|
|
28
|
-
"width":
|
|
28
|
+
"width": 48,
|
|
29
29
|
},
|
|
30
30
|
undefined,
|
|
31
31
|
]
|
|
32
32
|
}
|
|
33
33
|
testID="switch"
|
|
34
|
-
themeSize="medium"
|
|
35
34
|
themeVariant="unchecked"
|
|
36
35
|
>
|
|
37
36
|
<View
|
|
@@ -41,12 +40,11 @@ exports[`Switch renders correctly 1`] = `
|
|
|
41
40
|
Object {
|
|
42
41
|
"backgroundColor": "#ffffff",
|
|
43
42
|
"borderRadius": 999,
|
|
44
|
-
"height":
|
|
43
|
+
"height": 16,
|
|
45
44
|
"left": 0,
|
|
46
|
-
"width":
|
|
45
|
+
"width": 16,
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
|
-
themeSize="medium"
|
|
50
48
|
/>
|
|
51
49
|
</View>
|
|
52
50
|
`;
|
|
@@ -73,16 +71,15 @@ exports[`Switch trigger press function correctly 1`] = `
|
|
|
73
71
|
"backgroundColor": "#808f91",
|
|
74
72
|
"borderRadius": 999,
|
|
75
73
|
"display": "flex",
|
|
76
|
-
"height":
|
|
74
|
+
"height": 24,
|
|
77
75
|
"justifyContent": "center",
|
|
78
76
|
"paddingHorizontal": 4,
|
|
79
|
-
"width":
|
|
77
|
+
"width": 48,
|
|
80
78
|
},
|
|
81
79
|
undefined,
|
|
82
80
|
]
|
|
83
81
|
}
|
|
84
82
|
testID="switch"
|
|
85
|
-
themeSize="medium"
|
|
86
83
|
themeVariant="unchecked"
|
|
87
84
|
>
|
|
88
85
|
<View
|
|
@@ -92,12 +89,11 @@ exports[`Switch trigger press function correctly 1`] = `
|
|
|
92
89
|
Object {
|
|
93
90
|
"backgroundColor": "#ffffff",
|
|
94
91
|
"borderRadius": 999,
|
|
95
|
-
"height":
|
|
92
|
+
"height": 16,
|
|
96
93
|
"left": 0,
|
|
97
|
-
"width":
|
|
94
|
+
"width": 16,
|
|
98
95
|
}
|
|
99
96
|
}
|
|
100
|
-
themeSize="medium"
|
|
101
97
|
/>
|
|
102
98
|
</View>
|
|
103
99
|
`;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { useTheme } from '@emotion/react';
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import { Animated, Easing, TouchableWithoutFeedback } from 'react-native';
|
|
5
5
|
|
|
6
6
|
import type { ReactElement } from 'react';
|
|
7
7
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
8
|
-
import { StyledKnot, StyledWrapper, Variant } from './StyledSwitch';
|
|
9
8
|
import SelectorSwitch from './SelectorSwitch';
|
|
10
|
-
import {
|
|
9
|
+
import { StyledKnot, StyledWrapper, Variant } from './StyledSwitch';
|
|
11
10
|
|
|
12
11
|
export interface SwitchProps {
|
|
13
12
|
/**
|
|
@@ -22,11 +21,6 @@ export interface SwitchProps {
|
|
|
22
21
|
* Event handler.
|
|
23
22
|
*/
|
|
24
23
|
onPress?: () => void;
|
|
25
|
-
/**
|
|
26
|
-
* Size of the switch
|
|
27
|
-
* size is deprecated and will be removed in the next major release.
|
|
28
|
-
*/
|
|
29
|
-
size?: 'small' | 'medium';
|
|
30
24
|
/**
|
|
31
25
|
* Additional style.
|
|
32
26
|
*/
|
|
@@ -51,28 +45,18 @@ const getVariant = ({
|
|
|
51
45
|
};
|
|
52
46
|
|
|
53
47
|
const Switch = ({
|
|
54
|
-
size: _size,
|
|
55
48
|
disabled = false,
|
|
56
49
|
checked = false,
|
|
57
50
|
onPress,
|
|
58
51
|
style,
|
|
59
52
|
testID,
|
|
60
53
|
}: SwitchProps): ReactElement => {
|
|
61
|
-
const size: SwitchProps['size'] = _size === undefined ? 'medium' : _size;
|
|
62
|
-
|
|
63
54
|
const theme = useTheme();
|
|
64
55
|
const variant = getVariant({ disabled, checked });
|
|
65
56
|
|
|
66
|
-
useDeprecation(
|
|
67
|
-
"Switch's size prop will be removed in the next major release.",
|
|
68
|
-
_size !== undefined
|
|
69
|
-
);
|
|
70
|
-
|
|
71
57
|
const offset = checked
|
|
72
|
-
? (theme.__hd__.switch.sizes.
|
|
73
|
-
|
|
74
|
-
2 +
|
|
75
|
-
theme.__hd__.switch.sizes.thumbs[size] / 2
|
|
58
|
+
? (theme.__hd__.switch.sizes.width - theme.__hd__.switch.sizes.thumb) / 2 +
|
|
59
|
+
theme.__hd__.switch.sizes.thumb / 2
|
|
76
60
|
: 0;
|
|
77
61
|
|
|
78
62
|
const [animatedOffset] = useState(() => new Animated.Value(offset));
|
|
@@ -90,8 +74,8 @@ const Switch = ({
|
|
|
90
74
|
onPress={onPress}
|
|
91
75
|
disabled={disabled}
|
|
92
76
|
>
|
|
93
|
-
<StyledWrapper themeVariant={variant}
|
|
94
|
-
<StyledKnot
|
|
77
|
+
<StyledWrapper themeVariant={variant} style={style}>
|
|
78
|
+
<StyledKnot style={{ left: animatedOffset }} />
|
|
95
79
|
</StyledWrapper>
|
|
96
80
|
</TouchableWithoutFeedback>
|
|
97
81
|
);
|
|
@@ -130,7 +130,6 @@ const ScrollableTab = ({
|
|
|
130
130
|
testID,
|
|
131
131
|
activeItem,
|
|
132
132
|
inactiveItem: originalInactiveItem,
|
|
133
|
-
showBadge,
|
|
134
133
|
badge,
|
|
135
134
|
} = tab;
|
|
136
135
|
const active = selectedTabKey === key;
|
|
@@ -174,11 +173,7 @@ const ScrollableTab = ({
|
|
|
174
173
|
/>
|
|
175
174
|
</HeaderTabItemOutlineWrapper>
|
|
176
175
|
<HeaderTabItemWrapper>
|
|
177
|
-
<TabWithBadge
|
|
178
|
-
showBadge={showBadge}
|
|
179
|
-
config={badge}
|
|
180
|
-
tabItem={tabItem}
|
|
181
|
-
/>
|
|
176
|
+
<TabWithBadge config={badge} tabItem={tabItem} />
|
|
182
177
|
</HeaderTabItemWrapper>
|
|
183
178
|
</HeaderTabItem>
|
|
184
179
|
</TouchableWithoutFeedback>
|
|
@@ -17,27 +17,13 @@ export type CounterBadgeType = {
|
|
|
17
17
|
export type BadgeConfigType = StatusBadgeType | CounterBadgeType;
|
|
18
18
|
|
|
19
19
|
interface TabWithBadgeProps {
|
|
20
|
-
showBadge?: boolean;
|
|
21
20
|
config?: BadgeConfigType;
|
|
22
21
|
tabItem: ReactNode;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
const TabWithBadge = ({
|
|
24
|
+
const TabWithBadge = ({ config, tabItem }: TabWithBadgeProps) => {
|
|
26
25
|
const theme = useTheme();
|
|
27
26
|
|
|
28
|
-
// Deprecated. To be removed.
|
|
29
|
-
if (showBadge !== undefined) {
|
|
30
|
-
return (
|
|
31
|
-
<Badge.Status
|
|
32
|
-
testID="deprecated-badge"
|
|
33
|
-
visible={showBadge}
|
|
34
|
-
style={{ paddingHorizontal: theme.space.small }}
|
|
35
|
-
>
|
|
36
|
-
{tabItem}
|
|
37
|
-
</Badge.Status>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
27
|
if (!config) return <View>{tabItem}</View>;
|
|
42
28
|
|
|
43
29
|
if (config.type === 'status') {
|
|
@@ -18,7 +18,10 @@ describe('TabWithBadge', () => {
|
|
|
18
18
|
${false}
|
|
19
19
|
`('renders correctly when showBadge prop is available', ({ showBadge }) => {
|
|
20
20
|
const { toJSON } = renderWithTheme(
|
|
21
|
-
<TabWithBadge
|
|
21
|
+
<TabWithBadge
|
|
22
|
+
config={showBadge ? { type: 'status' } : undefined}
|
|
23
|
+
tabItem="Tab Item"
|
|
24
|
+
/>
|
|
22
25
|
);
|
|
23
26
|
|
|
24
27
|
expect(toJSON()).toMatchSnapshot();
|
|
@@ -148,12 +148,14 @@ exports[`Tabs.Scroll renders correctly 1`] = `
|
|
|
148
148
|
},
|
|
149
149
|
Object {
|
|
150
150
|
"activeItem": "home",
|
|
151
|
+
"badge": Object {
|
|
152
|
+
"type": "status",
|
|
153
|
+
},
|
|
151
154
|
"component": <Text>
|
|
152
155
|
Home Screen
|
|
153
156
|
</Text>,
|
|
154
157
|
"inactiveItem": "home-outlined",
|
|
155
158
|
"key": "home",
|
|
156
|
-
"showBadge": true,
|
|
157
159
|
},
|
|
158
160
|
Object {
|
|
159
161
|
"activeItem": "calendar",
|
|
@@ -467,10 +469,9 @@ exports[`Tabs.Scroll renders correctly 1`] = `
|
|
|
467
469
|
<View
|
|
468
470
|
style={
|
|
469
471
|
Object {
|
|
470
|
-
"paddingHorizontal":
|
|
472
|
+
"paddingHorizontal": 4,
|
|
471
473
|
}
|
|
472
474
|
}
|
|
473
|
-
testID="deprecated-badge"
|
|
474
475
|
>
|
|
475
476
|
<HeroIcon
|
|
476
477
|
name="home-outlined"
|
|
@@ -4,10 +4,9 @@ exports[`TabWithBadge renders correctly when showBadge prop is available 1`] = `
|
|
|
4
4
|
<View
|
|
5
5
|
style={
|
|
6
6
|
Object {
|
|
7
|
-
"paddingHorizontal":
|
|
7
|
+
"paddingHorizontal": 4,
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
testID="deprecated-badge"
|
|
11
10
|
>
|
|
12
11
|
Tab Item
|
|
13
12
|
<View
|
|
@@ -36,37 +35,8 @@ exports[`TabWithBadge renders correctly when showBadge prop is available 1`] = `
|
|
|
36
35
|
`;
|
|
37
36
|
|
|
38
37
|
exports[`TabWithBadge renders correctly when showBadge prop is available 2`] = `
|
|
39
|
-
<View
|
|
40
|
-
style={
|
|
41
|
-
Object {
|
|
42
|
-
"paddingHorizontal": 8,
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
testID="deprecated-badge"
|
|
46
|
-
>
|
|
38
|
+
<View>
|
|
47
39
|
Tab Item
|
|
48
|
-
<View
|
|
49
|
-
collapsable={false}
|
|
50
|
-
nativeID="animatedComponent"
|
|
51
|
-
style={
|
|
52
|
-
Object {
|
|
53
|
-
"backgroundColor": "#de350b",
|
|
54
|
-
"borderRadius": 999,
|
|
55
|
-
"height": 8,
|
|
56
|
-
"opacity": 0,
|
|
57
|
-
"position": "absolute",
|
|
58
|
-
"right": -2,
|
|
59
|
-
"top": -2,
|
|
60
|
-
"transform": Array [
|
|
61
|
-
Object {
|
|
62
|
-
"scale": 0.5,
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
"width": 8,
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
themeIntent="danger"
|
|
69
|
-
/>
|
|
70
40
|
</View>
|
|
71
41
|
`;
|
|
72
42
|
|
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
2
|
-
import { Animated, TouchableWithoutFeedback, View } from 'react-native';
|
|
3
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
1
|
import { useTheme } from '@emotion/react';
|
|
5
|
-
import PagerView from 'react-native-pager-view';
|
|
6
2
|
import type { ReactNode } from 'react';
|
|
7
|
-
import
|
|
3
|
+
import React, { useEffect } from 'react';
|
|
4
|
+
import type { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
5
|
+
import { Animated, TouchableWithoutFeedback, View } from 'react-native';
|
|
8
6
|
import type { PagerViewOnPageScrollEventData } from 'react-native-pager-view';
|
|
7
|
+
import PagerView from 'react-native-pager-view';
|
|
8
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
9
|
+
import { IconName } from '../Icon';
|
|
9
10
|
import Typography from '../Typography';
|
|
11
|
+
import ActiveTabIndicator from './ActiveTabIndicator';
|
|
12
|
+
import ScrollableTabs from './ScrollableTabs';
|
|
10
13
|
import {
|
|
11
14
|
ContentWrapper,
|
|
12
|
-
|
|
15
|
+
HeaderTab,
|
|
13
16
|
HeaderTabItem,
|
|
17
|
+
HeaderTabWrapper,
|
|
14
18
|
TabContainer,
|
|
15
19
|
TabScreen,
|
|
16
|
-
HeaderTab,
|
|
17
20
|
} from './StyledTabs';
|
|
18
|
-
import ActiveTabIndicator from './ActiveTabIndicator';
|
|
19
|
-
import ScrollableTabs from './ScrollableTabs';
|
|
20
|
-
import TabWithBadge from './TabWithBadge';
|
|
21
21
|
import type { BadgeConfigType } from './TabWithBadge';
|
|
22
|
-
import
|
|
23
|
-
import { useDeprecation } from '../../utils/hooks';
|
|
22
|
+
import TabWithBadge from './TabWithBadge';
|
|
24
23
|
|
|
25
24
|
export type ItemType =
|
|
26
25
|
| string
|
|
@@ -33,7 +32,6 @@ export type TabType = {
|
|
|
33
32
|
inactiveItem?: ItemType;
|
|
34
33
|
component: ReactNode;
|
|
35
34
|
testID?: string;
|
|
36
|
-
showBadge?: boolean;
|
|
37
35
|
badge?: BadgeConfigType;
|
|
38
36
|
};
|
|
39
37
|
|
|
@@ -114,11 +112,6 @@ const Tabs = ({
|
|
|
114
112
|
swipeEnabled = true,
|
|
115
113
|
testID: componentTestID,
|
|
116
114
|
}: TabsProps): JSX.Element => {
|
|
117
|
-
useDeprecation(
|
|
118
|
-
"Tabs' showBadge will be removed in the next major release. Please use badge prop instead.",
|
|
119
|
-
tabs.some((item) => item.showBadge !== undefined)
|
|
120
|
-
);
|
|
121
|
-
|
|
122
115
|
const theme = useTheme();
|
|
123
116
|
const insets = useSafeAreaInsets();
|
|
124
117
|
const pagerViewRef = React.useRef<PagerView>(null);
|
|
@@ -157,7 +150,6 @@ const Tabs = ({
|
|
|
157
150
|
testID,
|
|
158
151
|
activeItem,
|
|
159
152
|
inactiveItem: originalInactiveItem,
|
|
160
|
-
showBadge,
|
|
161
153
|
badge,
|
|
162
154
|
} = tab;
|
|
163
155
|
|
|
@@ -178,11 +170,7 @@ const Tabs = ({
|
|
|
178
170
|
testID={testID}
|
|
179
171
|
>
|
|
180
172
|
<HeaderTabItem>
|
|
181
|
-
<TabWithBadge
|
|
182
|
-
showBadge={showBadge}
|
|
183
|
-
config={badge}
|
|
184
|
-
tabItem={tabItem}
|
|
185
|
-
/>
|
|
173
|
+
<TabWithBadge config={badge} tabItem={tabItem} />
|
|
186
174
|
</HeaderTabItem>
|
|
187
175
|
</TouchableWithoutFeedback>
|
|
188
176
|
);
|
|
@@ -40,15 +40,6 @@ describe('Tag', () => {
|
|
|
40
40
|
expect(getByText('INFO')).toBeDefined();
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
it('has default style when intent is default', () => {
|
|
44
|
-
const { getByText, toJSON } = renderWithTheme(
|
|
45
|
-
<Tag content="DEFAULT" intent="default" />
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
expect(toJSON()).toMatchSnapshot();
|
|
49
|
-
expect(getByText('DEFAULT')).toBeDefined();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
43
|
it('has archived style when intent is archived', () => {
|
|
53
44
|
const { getByText, toJSON } = renderWithTheme(
|
|
54
45
|
<Tag content="ARCHIVED" intent="archived" />
|
|
@@ -120,46 +120,6 @@ exports[`Tag has danger style when intent is danger 1`] = `
|
|
|
120
120
|
</View>
|
|
121
121
|
`;
|
|
122
122
|
|
|
123
|
-
exports[`Tag has default style when intent is default 1`] = `
|
|
124
|
-
<View
|
|
125
|
-
style={
|
|
126
|
-
Array [
|
|
127
|
-
Object {
|
|
128
|
-
"backgroundColor": undefined,
|
|
129
|
-
"borderColor": "#001f23",
|
|
130
|
-
"borderRadius": 4,
|
|
131
|
-
"borderWidth": 1,
|
|
132
|
-
"paddingHorizontal": 8,
|
|
133
|
-
"paddingVertical": 2,
|
|
134
|
-
},
|
|
135
|
-
undefined,
|
|
136
|
-
]
|
|
137
|
-
}
|
|
138
|
-
themeIntent="default"
|
|
139
|
-
themeVariant="outlined"
|
|
140
|
-
>
|
|
141
|
-
<Text
|
|
142
|
-
style={
|
|
143
|
-
Array [
|
|
144
|
-
Object {
|
|
145
|
-
"color": "#001f23",
|
|
146
|
-
"fontFamily": "BeVietnamPro-SemiBold",
|
|
147
|
-
"fontSize": 12,
|
|
148
|
-
"includeFontPadding": false,
|
|
149
|
-
"textAlign": "center",
|
|
150
|
-
"textAlignVertical": "center",
|
|
151
|
-
},
|
|
152
|
-
undefined,
|
|
153
|
-
]
|
|
154
|
-
}
|
|
155
|
-
themeIntent="default"
|
|
156
|
-
themeVariant="outlined"
|
|
157
|
-
>
|
|
158
|
-
DEFAULT
|
|
159
|
-
</Text>
|
|
160
|
-
</View>
|
|
161
|
-
`;
|
|
162
|
-
|
|
163
123
|
exports[`Tag has info style when intent is info 1`] = `
|
|
164
124
|
<View
|
|
165
125
|
style={
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { ReactElement } from 'react';
|
|
2
|
-
import type { StyleProp,
|
|
3
|
-
import {
|
|
4
|
-
import { StyledView, StyledText } from './StyledTag';
|
|
2
|
+
import type { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
3
|
+
import { StyledText, StyledView } from './StyledTag';
|
|
5
4
|
|
|
6
5
|
interface TagProps extends ViewProps {
|
|
7
6
|
/**
|
|
@@ -11,14 +10,7 @@ interface TagProps extends ViewProps {
|
|
|
11
10
|
/**
|
|
12
11
|
* Visual intent color to apply to Tag.
|
|
13
12
|
*/
|
|
14
|
-
intent?:
|
|
15
|
-
| 'primary'
|
|
16
|
-
| 'default' // Will be deprecated in the future
|
|
17
|
-
| 'info'
|
|
18
|
-
| 'success'
|
|
19
|
-
| 'warning'
|
|
20
|
-
| 'danger'
|
|
21
|
-
| 'archived';
|
|
13
|
+
intent?: 'primary' | 'info' | 'success' | 'warning' | 'danger' | 'archived';
|
|
22
14
|
/**
|
|
23
15
|
* Tag variant.
|
|
24
16
|
*/
|
|
@@ -41,11 +33,6 @@ const Tag = ({
|
|
|
41
33
|
testID,
|
|
42
34
|
...nativeProps
|
|
43
35
|
}: TagProps): JSX.Element => {
|
|
44
|
-
useDeprecation(
|
|
45
|
-
"Tag's default intent is deprecated and will be removed in the next major release.\nPlease use primary intent instead.",
|
|
46
|
-
intent === 'default'
|
|
47
|
-
);
|
|
48
|
-
|
|
49
36
|
return (
|
|
50
37
|
<StyledView
|
|
51
38
|
{...nativeProps}
|
|
@@ -674,29 +674,19 @@ Object {
|
|
|
674
674
|
},
|
|
675
675
|
},
|
|
676
676
|
"sizes": Object {
|
|
677
|
-
"
|
|
678
|
-
"medium": 32,
|
|
679
|
-
"small": 24,
|
|
680
|
-
},
|
|
677
|
+
"height": 24,
|
|
681
678
|
"selector": Object {
|
|
682
679
|
"height": 56,
|
|
683
680
|
},
|
|
684
|
-
"
|
|
685
|
-
|
|
686
|
-
"small": 16,
|
|
687
|
-
},
|
|
688
|
-
"widths": Object {
|
|
689
|
-
"medium": 64,
|
|
690
|
-
"small": 48,
|
|
691
|
-
},
|
|
681
|
+
"thumb": 16,
|
|
682
|
+
"width": 48,
|
|
692
683
|
},
|
|
693
684
|
"spaces": Object {
|
|
694
|
-
"
|
|
685
|
+
"paddingHorizontal": 4,
|
|
695
686
|
"selector": Object {
|
|
696
687
|
"iconPadding": 16,
|
|
697
688
|
"wrapperPadding": 4,
|
|
698
689
|
},
|
|
699
|
-
"small": 4,
|
|
700
690
|
},
|
|
701
691
|
},
|
|
702
692
|
"tabs": Object {
|
|
@@ -735,8 +725,6 @@ Object {
|
|
|
735
725
|
"archivedBackground": "#f1f2f3",
|
|
736
726
|
"danger": "#de350b",
|
|
737
727
|
"dangerBackground": "#fcebe7",
|
|
738
|
-
"default": "#001f23",
|
|
739
|
-
"defaultBackground": undefined,
|
|
740
728
|
"info": "#4568fb",
|
|
741
729
|
"infoBackground": "#ecf0ff",
|
|
742
730
|
"primary": "#401960",
|
|
@@ -945,54 +933,25 @@ Object {
|
|
|
945
933
|
},
|
|
946
934
|
"colors": Object {
|
|
947
935
|
"archived": "#abacaf",
|
|
948
|
-
"archivedBackground": "#f6f6f7",
|
|
949
|
-
"archivedDark": "#737479",
|
|
950
|
-
"archivedLight": "#bfc1c5",
|
|
951
936
|
"archivedSurface": "#f1f2f3",
|
|
952
|
-
"backgroundDark": "#001f23",
|
|
953
|
-
"backgroundLight": "#f6f6f7",
|
|
954
|
-
"black": "#000000",
|
|
955
|
-
"danger": "#de350b",
|
|
956
|
-
"dangerBackground": "#fcebe7",
|
|
957
|
-
"dangerLight": "#f46363",
|
|
958
|
-
"dangerMediumLight": "#e3602a",
|
|
959
937
|
"darkGlobalSurface": "#001f23",
|
|
960
938
|
"decorativePrimary": "#ffffff",
|
|
961
939
|
"decorativePrimarySurface": "#ccd2d3",
|
|
962
940
|
"defaultGlobalSurface": "#ffffff",
|
|
963
941
|
"defaultSurface": "#f6f6f7",
|
|
964
|
-
"disabledLightText": "#bfc1c5",
|
|
965
942
|
"disabledOnDefaultGlobalSurface": "#bfc1c5",
|
|
966
943
|
"disabledOutline": "#bfc1c5",
|
|
967
|
-
"disabledSecondary": "#a08cb0",
|
|
968
|
-
"disabledText": "#808f91",
|
|
969
944
|
"error": "#f46363",
|
|
970
945
|
"errorSurface": "#fcebe7",
|
|
971
|
-
"globalPrimary": "#001f23",
|
|
972
|
-
"globalPrimaryBackground": "#e6e9e9",
|
|
973
|
-
"globalPrimaryLight": "#808f91",
|
|
974
|
-
"globalPrimaryOutline": "#001f23",
|
|
975
|
-
"globalSecondary": "#4d6265",
|
|
976
|
-
"globalSecondaryOutline": "#e8e9ea",
|
|
977
|
-
"highlightedSecondarySurface": "#ecf0ff",
|
|
978
946
|
"highlightedSurface": "#ece8ef",
|
|
979
|
-
"inactiveBackground": "#808f91",
|
|
980
947
|
"inactiveOnDefaultGlobalSurface": "#808f91",
|
|
981
948
|
"inactiveOutline": "#808f91",
|
|
982
949
|
"info": "#b5c3fd",
|
|
983
|
-
"infoBackground": "#ecf0ff",
|
|
984
|
-
"infoLight": "#b5c3fd",
|
|
985
|
-
"infoMediumLight": "#b5c3fd",
|
|
986
950
|
"infoSurface": "#ecf0ff",
|
|
987
|
-
"invertedText": "#ffffff",
|
|
988
|
-
"lightHighlightedSurface": "#ece8ef",
|
|
989
951
|
"mutedArchived": "#bcbdbf",
|
|
990
952
|
"mutedError": "#f68282",
|
|
991
|
-
"mutedGlobalPrimary": "#4d6265",
|
|
992
953
|
"mutedInfo": "#c4cffd",
|
|
993
954
|
"mutedOnDefaultGlobalSurface": "#4d6265",
|
|
994
|
-
"mutedPrimary": "#e6e9e9",
|
|
995
|
-
"mutedSecondary": "#808f91",
|
|
996
955
|
"mutedSuccess": "#7bd897",
|
|
997
956
|
"mutedWarning": "#ffcb8d",
|
|
998
957
|
"neutralGlobalSurface": "#f6f6f7",
|
|
@@ -1000,38 +959,20 @@ Object {
|
|
|
1000
959
|
"onDarkGlobalSurface": "#ffffff",
|
|
1001
960
|
"onDefaultGlobalSurface": "#001f23",
|
|
1002
961
|
"onErrorSurface": "#de350b",
|
|
1003
|
-
"onGlobalPrimary": "#ffffff",
|
|
1004
962
|
"onInfoSurface": "#4568fb",
|
|
1005
963
|
"onPrimary": "#ffffff",
|
|
1006
964
|
"onSecondary": "#ffffff",
|
|
1007
965
|
"onSuccessSurface": "#017d6d",
|
|
1008
966
|
"onWarningSurface": "#ffa234",
|
|
1009
|
-
"outline": "#e8e9ea",
|
|
1010
967
|
"overlayGlobalSurface": "#000000",
|
|
1011
|
-
"platformBackground": "#ffffff",
|
|
1012
968
|
"pressedSurface": "#664780",
|
|
1013
969
|
"primary": "#401960",
|
|
1014
|
-
"primaryBackground": "#f3e6f6",
|
|
1015
|
-
"primaryBackgroundDark": "#4d6265",
|
|
1016
|
-
"primaryDark": "#795e90",
|
|
1017
|
-
"primaryLight": "#c282d1",
|
|
1018
970
|
"primaryOutline": "#001f23",
|
|
1019
971
|
"secondary": "#795e90",
|
|
1020
|
-
"secondaryBackground": "#ecf0ff",
|
|
1021
|
-
"secondaryLight": "#b5c3fd",
|
|
1022
972
|
"secondaryOutline": "#e8e9ea",
|
|
1023
|
-
"shadow": "#ccced1",
|
|
1024
|
-
"subduedText": "#4d6265",
|
|
1025
973
|
"success": "#5ace7d",
|
|
1026
|
-
"successBackground": "#f0fef4",
|
|
1027
|
-
"successDark": "#017d6d",
|
|
1028
|
-
"successLight": "#5ace7d",
|
|
1029
974
|
"successSurface": "#f0fef4",
|
|
1030
|
-
"text": "#001f23",
|
|
1031
975
|
"warning": "#ffbe71",
|
|
1032
|
-
"warningBackground": "#fff6eb",
|
|
1033
|
-
"warningDark": "#ffa234",
|
|
1034
|
-
"warningLight": "#ffbe71",
|
|
1035
976
|
"warningSurface": "#fff6eb",
|
|
1036
977
|
},
|
|
1037
978
|
"fontSizes": Object {
|
|
@@ -16,26 +16,16 @@ const getSwitchTheme = (theme: GlobalTheme) => {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
const sizes = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
widths: {
|
|
24
|
-
small: theme.sizes.xxxlarge,
|
|
25
|
-
medium: theme.sizes.xxxxxlarge,
|
|
26
|
-
},
|
|
27
|
-
heights: {
|
|
28
|
-
small: theme.sizes.large,
|
|
29
|
-
medium: theme.sizes.xlarge,
|
|
30
|
-
},
|
|
19
|
+
thumb: theme.sizes.medium,
|
|
20
|
+
width: theme.sizes.xxxlarge,
|
|
21
|
+
height: theme.sizes.large,
|
|
31
22
|
selector: {
|
|
32
23
|
height: theme.sizes.xxxxlarge,
|
|
33
24
|
},
|
|
34
25
|
};
|
|
35
26
|
|
|
36
27
|
const spaces = {
|
|
37
|
-
|
|
38
|
-
medium: theme.space.xsmall,
|
|
28
|
+
paddingHorizontal: theme.space.xsmall,
|
|
39
29
|
selector: {
|
|
40
30
|
iconPadding: theme.space.medium,
|
|
41
31
|
wrapperPadding: theme.space.xsmall,
|