@hero-design/rn 7.25.1 → 7.27.0
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 +9 -9
- package/assets/fonts/BeVietnamPro-Bold.ttf +0 -0
- package/assets/fonts/{be-vietnam-pro-light.ttf → BeVietnamPro-Light.ttf} +0 -0
- package/assets/fonts/{be-vietnam-pro-regular.ttf → BeVietnamPro-Regular.ttf} +0 -0
- package/assets/fonts/{be-vietnam-pro-semibold.ttf → BeVietnamPro-SemiBold.ttf} +0 -0
- package/assets/fonts/RebondGrotesque-Light.otf +0 -0
- package/assets/fonts/RebondGrotesque-Regular.otf +0 -0
- package/assets/fonts/RebondGrotesque-SemiBold.otf +0 -0
- package/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/es/index.js +9212 -12310
- package/jest.config.js +6 -2
- package/lib/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/lib/index.js +9212 -12309
- package/package.json +4 -4
- package/src/components/Accordion/__tests__/__snapshots__/AccordionItem.spec.tsx.snap +8 -0
- package/src/components/Accordion/__tests__/__snapshots__/index.spec.tsx.snap +12 -0
- package/src/components/Accordion/index.tsx +1 -1
- package/src/components/Alert/__tests__/__snapshots__/index.spec.tsx.snap +11 -0
- package/src/components/Attachment/__tests__/__snapshots__/index.spec.tsx.snap +1 -0
- package/src/components/Avatar/{index.tsx → Avatar.tsx} +33 -18
- package/src/components/Avatar/AvatarStack/StyledAvatarStack.tsx +29 -0
- package/src/components/Avatar/AvatarStack/__tests__/StyledAvatarStack.spec.tsx +33 -0
- package/src/components/Avatar/AvatarStack/__tests__/__snapshots__/StyledAvatarStack.spec.tsx.snap +80 -0
- package/src/components/Avatar/AvatarStack/__tests__/__snapshots__/index.spec.tsx.snap +552 -0
- package/src/components/Avatar/AvatarStack/__tests__/index.spec.tsx +59 -0
- package/src/components/Avatar/AvatarStack/index.tsx +61 -0
- package/src/components/Avatar/AvatarStack/utils.ts +22 -0
- package/src/components/Avatar/StyledAvatar.tsx +6 -25
- package/src/components/Avatar/__tests__/StyledAvatar.spec.tsx +3 -19
- package/src/components/Avatar/__tests__/__snapshots__/StyledAvatar.spec.tsx.snap +3 -24
- package/src/components/Avatar/__tests__/__snapshots__/index.spec.tsx.snap +118 -20
- package/src/components/Avatar/__tests__/index.spec.tsx +25 -8
- package/src/components/Avatar/index.ts +6 -0
- package/src/components/Badge/__tests__/__snapshots__/Status.spec.tsx.snap +1 -0
- package/src/components/BottomNavigation/__tests__/__snapshots__/index.spec.tsx.snap +4 -0
- package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +2 -0
- package/src/components/Button/UtilityButton/__tests__/__snapshots__/index.spec.tsx.snap +2 -0
- package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +11 -0
- package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +5 -0
- package/src/components/Card/DataCard/__tests__/__snapshots__/StyledDataCard.spec.tsx.snap +1 -1
- package/src/components/Card/DataCard/__tests__/__snapshots__/index.spec.tsx.snap +1 -1
- package/src/components/Card/__tests__/__snapshots__/index.spec.tsx.snap +4 -0
- package/src/components/Card/index.tsx +18 -7
- package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +4 -0
- package/src/components/ContentNavigator/__tests__/__snapshots__/StyledContentNavigator.spec.tsx.snap +1 -0
- package/src/components/ContentNavigator/__tests__/__snapshots__/index.spec.tsx.snap +2 -0
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +1 -0
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +3 -0
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +12 -0
- package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +1 -0
- package/src/components/Icon/HeroIcon/glyphMap.json +1 -1
- package/src/components/Icon/IconList.ts +11 -0
- package/src/components/List/__tests__/__snapshots__/BasicListItem.spec.tsx.snap +4 -0
- package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +54 -31
- package/src/components/List/__tests__/__snapshots__/StyledBasicListItem.spec.tsx.snap +4 -0
- package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +5 -1
- package/src/components/Progress/ProgressBar.tsx +19 -2
- package/src/components/Progress/ProgressCircle.tsx +30 -9
- package/src/components/Progress/StyledProgressBar.tsx +14 -7
- package/src/components/Progress/StyledProgressCircle.tsx +35 -24
- package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +337 -30
- package/src/components/Progress/__tests__/index.spec.js +15 -0
- package/src/components/Progress/constants.ts +16 -0
- package/src/components/Progress/types.ts +7 -1
- package/src/components/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +2 -0
- package/src/components/Radio/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +3 -0
- package/src/components/RichTextEditor/RichTextEditor.tsx +1 -1
- package/src/components/RichTextEditor/__mocks__/heroEditorApp.ts +2 -0
- package/src/components/RichTextEditor/__tests__/RichTextEditor.spec.tsx +36 -25
- package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +8 -4
- package/src/components/RichTextEditor/heroEditorApp.ts +3 -0
- package/src/components/SectionHeading/__tests__/__snapshots__/index.spec.tsx.snap +4 -0
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/Option.spec.tsx.snap +1 -0
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +20 -0
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +51 -0
- package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +22 -0
- package/src/components/Select/MultiSelect/index.tsx +40 -15
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/Option.spec.tsx.snap +1 -0
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +20 -0
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +46 -0
- package/src/components/Select/SingleSelect/index.tsx +5 -2
- package/src/components/Select/__tests__/__snapshots__/StyledSelect.spec.tsx.snap +1 -0
- package/src/components/Select/types.ts +15 -6
- package/src/components/Swipeable/__tests__/__snapshots__/SwipeableAction.spec.tsx.snap +3 -0
- package/src/components/Swipeable/__tests__/__snapshots__/index.spec.tsx.snap +1 -0
- package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/Option.spec.tsx.snap +1 -0
- package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/index.spec.tsx.snap +1 -0
- package/src/components/Tabs/ScrollableTabs.tsx +2 -0
- package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +1 -1
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +2 -0
- package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +5 -0
- package/src/components/Tabs/__tests__/index.spec.tsx +1 -1
- package/src/components/Tabs/index.tsx +7 -0
- package/src/components/Tag/StyledTag.tsx +42 -11
- package/src/components/Tag/__tests__/Tag.spec.tsx +28 -0
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +135 -0
- package/src/components/Tag/index.tsx +15 -3
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +22 -0
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +31 -0
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +1 -0
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +3 -0
- package/src/components/Toast/__tests__/__snapshots__/Toast.spec.tsx.snap +13 -0
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarGroup.spec.tsx.snap +6 -0
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.spec.tsx.snap +6 -0
- package/src/components/Typography/Text/StyledText.tsx +6 -2
- package/src/components/Typography/Text/__tests__/StyledText.spec.tsx +22 -0
- package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +63 -0
- package/src/components/Typography/Text/index.tsx +8 -0
- package/src/index.ts +2 -1
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +86 -22
- package/src/theme/components/avatar.ts +29 -5
- package/src/theme/components/badge.ts +1 -1
- package/src/theme/components/button.ts +2 -2
- package/src/theme/components/empty.ts +2 -2
- package/src/theme/components/fab.ts +3 -3
- package/src/theme/components/pinInput.ts +2 -2
- package/src/theme/components/progress.ts +37 -9
- package/src/theme/components/tag.ts +2 -1
- package/src/theme/components/toolbar.ts +1 -1
- package/src/theme/components/typography.ts +1 -7
- package/src/theme/global/colors/global.ts +12 -3
- package/src/theme/global/colors/types.ts +5 -0
- package/src/theme/global/scale.ts +6 -2
- package/src/theme/global/typography.ts +23 -5
- package/src/utils/hooks.ts +18 -1
- package/types/components/Avatar/Avatar.d.ts +33 -0
- package/types/components/Avatar/AvatarStack/StyledAvatarStack.d.ts +17 -0
- package/types/components/Avatar/AvatarStack/index.d.ts +23 -0
- package/types/components/Avatar/AvatarStack/utils.d.ts +4 -0
- package/types/components/Avatar/StyledAvatar.d.ts +2 -12
- package/types/components/Avatar/index.d.ts +6 -25
- package/types/components/Card/index.d.ts +1 -1
- 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/Progress/ProgressBar.d.ts +1 -1
- package/types/components/Progress/ProgressCircle.d.ts +4 -2
- package/types/components/Progress/StyledProgressBar.d.ts +2 -0
- package/types/components/Progress/StyledProgressCircle.d.ts +2 -0
- package/types/components/Progress/constants.d.ts +15 -0
- package/types/components/Progress/index.d.ts +1 -1
- package/types/components/Progress/types.d.ts +1 -1
- package/types/components/RichTextEditor/__mocks__/heroEditorApp.d.ts +2 -0
- package/types/components/RichTextEditor/heroEditorApp.d.ts +2 -0
- package/types/components/Select/MultiSelect/index.d.ts +5 -2
- 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 +15 -3
- package/types/components/Tabs/ScrollableTabs.d.ts +1 -1
- package/types/components/Tabs/index.d.ts +7 -2
- package/types/components/Tag/StyledTag.d.ts +3 -0
- package/types/components/Tag/index.d.ts +7 -2
- package/types/components/Typography/Text/StyledText.d.ts +1 -0
- package/types/components/Typography/Text/index.d.ts +7 -1
- package/types/index.d.ts +2 -2
- package/types/theme/components/avatar.d.ts +4 -2
- package/types/theme/components/progress.d.ts +30 -9
- package/types/theme/components/tag.d.ts +1 -0
- package/types/theme/components/typography.d.ts +1 -5
- package/types/theme/global/colors/types.d.ts +5 -0
- package/types/theme/global/index.d.ts +5 -0
- package/types/theme/global/scale.d.ts +4 -1
- package/types/theme/global/typography.d.ts +9 -2
- package/types/utils/hooks.d.ts +2 -0
- package/src/components/Accordion/utils.tsx +0 -11
- package/types/components/Accordion/utils.d.ts +0 -1
|
@@ -87,6 +87,7 @@ exports[`Tabs.Scroll renders correctly 1`] = `
|
|
|
87
87
|
themeFontSize="medium"
|
|
88
88
|
themeFontWeight="regular"
|
|
89
89
|
themeIntent="body"
|
|
90
|
+
themeTypeface="neutral"
|
|
90
91
|
>
|
|
91
92
|
Move to Work
|
|
92
93
|
</Text>
|
|
@@ -283,6 +284,7 @@ exports[`Tabs.Scroll renders correctly 1`] = `
|
|
|
283
284
|
themeFontSize="medium"
|
|
284
285
|
themeFontWeight="semi-bold"
|
|
285
286
|
themeIntent="body"
|
|
287
|
+
themeTypeface="neutral"
|
|
286
288
|
>
|
|
287
289
|
Work
|
|
288
290
|
</Text>
|
|
@@ -87,6 +87,7 @@ exports[`Tabs renders correctly 1`] = `
|
|
|
87
87
|
themeFontSize="medium"
|
|
88
88
|
themeFontWeight="regular"
|
|
89
89
|
themeIntent="body"
|
|
90
|
+
themeTypeface="neutral"
|
|
90
91
|
>
|
|
91
92
|
Move to Work
|
|
92
93
|
</Text>
|
|
@@ -175,6 +176,7 @@ exports[`Tabs renders correctly 1`] = `
|
|
|
175
176
|
themeFontSize="medium"
|
|
176
177
|
themeFontWeight="semi-bold"
|
|
177
178
|
themeIntent="body"
|
|
179
|
+
themeTypeface="neutral"
|
|
178
180
|
>
|
|
179
181
|
Work
|
|
180
182
|
</Text>
|
|
@@ -221,6 +223,7 @@ exports[`Tabs renders correctly 1`] = `
|
|
|
221
223
|
themeFontSize="medium"
|
|
222
224
|
themeFontWeight="regular"
|
|
223
225
|
themeIntent="body"
|
|
226
|
+
themeTypeface="neutral"
|
|
224
227
|
>
|
|
225
228
|
Personal
|
|
226
229
|
</Text>
|
|
@@ -274,6 +277,7 @@ exports[`Tabs renders correctly 1`] = `
|
|
|
274
277
|
themeFontSize="medium"
|
|
275
278
|
themeFontWeight="regular"
|
|
276
279
|
themeIntent="body"
|
|
280
|
+
themeTypeface="neutral"
|
|
277
281
|
>
|
|
278
282
|
Home
|
|
279
283
|
</Text>
|
|
@@ -352,6 +356,7 @@ exports[`Tabs renders correctly 1`] = `
|
|
|
352
356
|
themeFontSize="medium"
|
|
353
357
|
themeFontWeight="regular"
|
|
354
358
|
themeIntent="body"
|
|
359
|
+
themeTypeface="neutral"
|
|
355
360
|
>
|
|
356
361
|
Wallet
|
|
357
362
|
</Text>
|
|
@@ -87,7 +87,7 @@ describe('Tabs', () => {
|
|
|
87
87
|
|
|
88
88
|
it('renders correctly with lazy preloaded', () => {
|
|
89
89
|
const { getByText, queryByText } = renderWithTheme(
|
|
90
|
-
<TestTabsComponent lazy lazyPreloadDistance={1} />
|
|
90
|
+
<TestTabsComponent lazy lazyPreloadDistance={1} swipeEnabled={false} />
|
|
91
91
|
);
|
|
92
92
|
|
|
93
93
|
expect(getByText('Work Screen')).toBeDefined();
|
|
@@ -67,6 +67,11 @@ export interface TabsProps extends ViewProps {
|
|
|
67
67
|
* Defaults value is `1`.
|
|
68
68
|
*/
|
|
69
69
|
lazyPreloadDistance?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Boolean indicating whether to enable swipe gestures. Passing `false` will disable swipe gestures, but the user can still switch tabs by pressing the tab bar.
|
|
72
|
+
* Defaults value is `true`.
|
|
73
|
+
*/
|
|
74
|
+
swipeEnabled?: boolean;
|
|
70
75
|
/**
|
|
71
76
|
* Testing id of the component.
|
|
72
77
|
*/
|
|
@@ -105,6 +110,7 @@ const Tabs = ({
|
|
|
105
110
|
barStyle,
|
|
106
111
|
lazy = false,
|
|
107
112
|
lazyPreloadDistance = 1,
|
|
113
|
+
swipeEnabled = true,
|
|
108
114
|
testID: componentTestID,
|
|
109
115
|
}: TabsProps): JSX.Element => {
|
|
110
116
|
const theme = useTheme();
|
|
@@ -207,6 +213,7 @@ const Tabs = ({
|
|
|
207
213
|
useNativeDriver: true,
|
|
208
214
|
}
|
|
209
215
|
)}
|
|
216
|
+
scrollEnabled={swipeEnabled}
|
|
210
217
|
>
|
|
211
218
|
{tabs.map((tab, index) => {
|
|
212
219
|
const { key, component, testID } = tab;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { View, Text } from 'react-native';
|
|
2
2
|
import styled from '@emotion/native';
|
|
3
|
+
import { Theme } from '../../theme';
|
|
3
4
|
|
|
4
5
|
type ThemeIntent =
|
|
5
6
|
| 'default'
|
|
@@ -10,26 +11,56 @@ type ThemeIntent =
|
|
|
10
11
|
| 'danger'
|
|
11
12
|
| 'archived';
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
type ThemeVariant = 'filled' | 'outlined';
|
|
15
|
+
|
|
16
|
+
const getFilledStyles = (themeIntent: ThemeIntent, theme: Theme) => ({
|
|
17
|
+
textColor: theme.__hd__.tag.colors.text,
|
|
18
|
+
borderColor: theme.__hd__.tag.colors[`${themeIntent}Background`],
|
|
19
|
+
backgroundColor: theme.__hd__.tag.colors[`${themeIntent}Background`],
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const getOutlinedStyles = (themeIntent: ThemeIntent, theme: Theme) => ({
|
|
23
|
+
textColor: theme.__hd__.tag.colors[themeIntent],
|
|
24
|
+
borderColor: theme.__hd__.tag.colors[themeIntent],
|
|
25
|
+
backgroundColor: theme.__hd__.tag.colors[`${themeIntent}Background`],
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const StyledView = styled(View)<{
|
|
29
|
+
themeIntent: ThemeIntent;
|
|
30
|
+
themeVariant: ThemeVariant;
|
|
31
|
+
}>(({ themeIntent, themeVariant, theme }) => {
|
|
32
|
+
const { borderColor, backgroundColor } =
|
|
33
|
+
themeVariant === 'filled'
|
|
34
|
+
? getFilledStyles(themeIntent, theme)
|
|
35
|
+
: getOutlinedStyles(themeIntent, theme);
|
|
36
|
+
|
|
37
|
+
return {
|
|
15
38
|
borderWidth: theme.__hd__.tag.borderWidths.default,
|
|
16
39
|
borderRadius: theme.__hd__.tag.radii.default,
|
|
17
40
|
paddingVertical: theme.__hd__.tag.space.verticalPadding,
|
|
18
41
|
paddingHorizontal: theme.__hd__.tag.space.horizontalPadding,
|
|
19
|
-
borderColor
|
|
20
|
-
backgroundColor
|
|
21
|
-
}
|
|
22
|
-
);
|
|
42
|
+
borderColor,
|
|
43
|
+
backgroundColor,
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const StyledText = styled(Text)<{
|
|
48
|
+
themeIntent: ThemeIntent;
|
|
49
|
+
themeVariant: ThemeVariant;
|
|
50
|
+
}>(({ themeIntent, themeVariant, theme }) => {
|
|
51
|
+
const { textColor } =
|
|
52
|
+
themeVariant === 'filled'
|
|
53
|
+
? getFilledStyles(themeIntent, theme)
|
|
54
|
+
: getOutlinedStyles(themeIntent, theme);
|
|
23
55
|
|
|
24
|
-
|
|
25
|
-
({ themeIntent, theme }) => ({
|
|
56
|
+
return {
|
|
26
57
|
fontFamily: theme.__hd__.tag.fonts.default,
|
|
27
58
|
fontSize: theme.__hd__.tag.fontSizes.default,
|
|
28
|
-
color:
|
|
59
|
+
color: textColor,
|
|
29
60
|
includeFontPadding: false,
|
|
30
61
|
textAlignVertical: 'center',
|
|
31
62
|
textAlign: 'center',
|
|
32
|
-
}
|
|
33
|
-
);
|
|
63
|
+
};
|
|
64
|
+
});
|
|
34
65
|
|
|
35
66
|
export { StyledView, StyledText };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
3
3
|
import Tag from '..';
|
|
4
|
+
import Typography from '../../Typography';
|
|
4
5
|
|
|
5
6
|
describe('Tag', () => {
|
|
6
7
|
it('has success style when intent is success', () => {
|
|
@@ -65,4 +66,31 @@ describe('Tag', () => {
|
|
|
65
66
|
expect(toJSON()).toMatchSnapshot();
|
|
66
67
|
expect(getByText('PRIMARY')).toBeDefined();
|
|
67
68
|
});
|
|
69
|
+
|
|
70
|
+
it('renders correctly when variant is filled and intent is warning', () => {
|
|
71
|
+
const { getByText, toJSON } = renderWithTheme(
|
|
72
|
+
<Tag content="WARNING" intent="warning" variant="filled" />
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
expect(toJSON()).toMatchSnapshot();
|
|
76
|
+
expect(getByText('WARNING')).toBeDefined();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('renders correctly when variant is filled and intent is danger', () => {
|
|
80
|
+
const { getByText, toJSON } = renderWithTheme(
|
|
81
|
+
<Tag content="DANGER" intent="danger" variant="filled" />
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
expect(toJSON()).toMatchSnapshot();
|
|
85
|
+
expect(getByText('DANGER')).toBeDefined();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('renders correctly with custom content', () => {
|
|
89
|
+
const { getByText, toJSON } = renderWithTheme(
|
|
90
|
+
<Tag content={<Typography.Text>Custom Content</Typography.Text>} />
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
expect(toJSON()).toMatchSnapshot();
|
|
94
|
+
expect(getByText('Custom Content')).toBeDefined();
|
|
95
|
+
});
|
|
68
96
|
});
|
|
@@ -16,6 +16,7 @@ exports[`Tag has archived style when intent is archived 1`] = `
|
|
|
16
16
|
]
|
|
17
17
|
}
|
|
18
18
|
themeIntent="archived"
|
|
19
|
+
themeVariant="outlined"
|
|
19
20
|
>
|
|
20
21
|
<Text
|
|
21
22
|
style={
|
|
@@ -32,6 +33,7 @@ exports[`Tag has archived style when intent is archived 1`] = `
|
|
|
32
33
|
]
|
|
33
34
|
}
|
|
34
35
|
themeIntent="archived"
|
|
36
|
+
themeVariant="outlined"
|
|
35
37
|
>
|
|
36
38
|
ARCHIVED
|
|
37
39
|
</Text>
|
|
@@ -54,6 +56,7 @@ exports[`Tag has archived style when intent is primary 1`] = `
|
|
|
54
56
|
]
|
|
55
57
|
}
|
|
56
58
|
themeIntent="primary"
|
|
59
|
+
themeVariant="outlined"
|
|
57
60
|
>
|
|
58
61
|
<Text
|
|
59
62
|
style={
|
|
@@ -70,6 +73,7 @@ exports[`Tag has archived style when intent is primary 1`] = `
|
|
|
70
73
|
]
|
|
71
74
|
}
|
|
72
75
|
themeIntent="primary"
|
|
76
|
+
themeVariant="outlined"
|
|
73
77
|
>
|
|
74
78
|
PRIMARY
|
|
75
79
|
</Text>
|
|
@@ -92,6 +96,7 @@ exports[`Tag has danger style when intent is danger 1`] = `
|
|
|
92
96
|
]
|
|
93
97
|
}
|
|
94
98
|
themeIntent="danger"
|
|
99
|
+
themeVariant="outlined"
|
|
95
100
|
>
|
|
96
101
|
<Text
|
|
97
102
|
style={
|
|
@@ -108,6 +113,7 @@ exports[`Tag has danger style when intent is danger 1`] = `
|
|
|
108
113
|
]
|
|
109
114
|
}
|
|
110
115
|
themeIntent="danger"
|
|
116
|
+
themeVariant="outlined"
|
|
111
117
|
>
|
|
112
118
|
DANGER
|
|
113
119
|
</Text>
|
|
@@ -130,6 +136,7 @@ exports[`Tag has default style when intent is default 1`] = `
|
|
|
130
136
|
]
|
|
131
137
|
}
|
|
132
138
|
themeIntent="default"
|
|
139
|
+
themeVariant="outlined"
|
|
133
140
|
>
|
|
134
141
|
<Text
|
|
135
142
|
style={
|
|
@@ -146,6 +153,7 @@ exports[`Tag has default style when intent is default 1`] = `
|
|
|
146
153
|
]
|
|
147
154
|
}
|
|
148
155
|
themeIntent="default"
|
|
156
|
+
themeVariant="outlined"
|
|
149
157
|
>
|
|
150
158
|
DEFAULT
|
|
151
159
|
</Text>
|
|
@@ -168,6 +176,7 @@ exports[`Tag has info style when intent is info 1`] = `
|
|
|
168
176
|
]
|
|
169
177
|
}
|
|
170
178
|
themeIntent="info"
|
|
179
|
+
themeVariant="outlined"
|
|
171
180
|
>
|
|
172
181
|
<Text
|
|
173
182
|
style={
|
|
@@ -184,6 +193,7 @@ exports[`Tag has info style when intent is info 1`] = `
|
|
|
184
193
|
]
|
|
185
194
|
}
|
|
186
195
|
themeIntent="info"
|
|
196
|
+
themeVariant="outlined"
|
|
187
197
|
>
|
|
188
198
|
INFO
|
|
189
199
|
</Text>
|
|
@@ -206,6 +216,7 @@ exports[`Tag has success style when intent is success 1`] = `
|
|
|
206
216
|
]
|
|
207
217
|
}
|
|
208
218
|
themeIntent="success"
|
|
219
|
+
themeVariant="outlined"
|
|
209
220
|
>
|
|
210
221
|
<Text
|
|
211
222
|
style={
|
|
@@ -222,6 +233,7 @@ exports[`Tag has success style when intent is success 1`] = `
|
|
|
222
233
|
]
|
|
223
234
|
}
|
|
224
235
|
themeIntent="success"
|
|
236
|
+
themeVariant="outlined"
|
|
225
237
|
>
|
|
226
238
|
SUCCESS
|
|
227
239
|
</Text>
|
|
@@ -244,6 +256,7 @@ exports[`Tag has warning style when intent is warning 1`] = `
|
|
|
244
256
|
]
|
|
245
257
|
}
|
|
246
258
|
themeIntent="warning"
|
|
259
|
+
themeVariant="outlined"
|
|
247
260
|
>
|
|
248
261
|
<Text
|
|
249
262
|
style={
|
|
@@ -260,8 +273,130 @@ exports[`Tag has warning style when intent is warning 1`] = `
|
|
|
260
273
|
]
|
|
261
274
|
}
|
|
262
275
|
themeIntent="warning"
|
|
276
|
+
themeVariant="outlined"
|
|
263
277
|
>
|
|
264
278
|
WARNING
|
|
265
279
|
</Text>
|
|
266
280
|
</View>
|
|
267
281
|
`;
|
|
282
|
+
|
|
283
|
+
exports[`Tag renders correctly when variant is filled and intent is danger 1`] = `
|
|
284
|
+
<View
|
|
285
|
+
style={
|
|
286
|
+
Array [
|
|
287
|
+
Object {
|
|
288
|
+
"backgroundColor": "#fcebe7",
|
|
289
|
+
"borderColor": "#fcebe7",
|
|
290
|
+
"borderRadius": 4,
|
|
291
|
+
"borderWidth": 1,
|
|
292
|
+
"paddingHorizontal": 8,
|
|
293
|
+
"paddingVertical": 2,
|
|
294
|
+
},
|
|
295
|
+
undefined,
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
themeIntent="danger"
|
|
299
|
+
themeVariant="filled"
|
|
300
|
+
>
|
|
301
|
+
<Text
|
|
302
|
+
style={
|
|
303
|
+
Array [
|
|
304
|
+
Object {
|
|
305
|
+
"color": "#001f23",
|
|
306
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
307
|
+
"fontSize": 12,
|
|
308
|
+
"includeFontPadding": false,
|
|
309
|
+
"textAlign": "center",
|
|
310
|
+
"textAlignVertical": "center",
|
|
311
|
+
},
|
|
312
|
+
undefined,
|
|
313
|
+
]
|
|
314
|
+
}
|
|
315
|
+
themeIntent="danger"
|
|
316
|
+
themeVariant="filled"
|
|
317
|
+
>
|
|
318
|
+
DANGER
|
|
319
|
+
</Text>
|
|
320
|
+
</View>
|
|
321
|
+
`;
|
|
322
|
+
|
|
323
|
+
exports[`Tag renders correctly when variant is filled and intent is warning 1`] = `
|
|
324
|
+
<View
|
|
325
|
+
style={
|
|
326
|
+
Array [
|
|
327
|
+
Object {
|
|
328
|
+
"backgroundColor": "#fff6eb",
|
|
329
|
+
"borderColor": "#fff6eb",
|
|
330
|
+
"borderRadius": 4,
|
|
331
|
+
"borderWidth": 1,
|
|
332
|
+
"paddingHorizontal": 8,
|
|
333
|
+
"paddingVertical": 2,
|
|
334
|
+
},
|
|
335
|
+
undefined,
|
|
336
|
+
]
|
|
337
|
+
}
|
|
338
|
+
themeIntent="warning"
|
|
339
|
+
themeVariant="filled"
|
|
340
|
+
>
|
|
341
|
+
<Text
|
|
342
|
+
style={
|
|
343
|
+
Array [
|
|
344
|
+
Object {
|
|
345
|
+
"color": "#001f23",
|
|
346
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
347
|
+
"fontSize": 12,
|
|
348
|
+
"includeFontPadding": false,
|
|
349
|
+
"textAlign": "center",
|
|
350
|
+
"textAlignVertical": "center",
|
|
351
|
+
},
|
|
352
|
+
undefined,
|
|
353
|
+
]
|
|
354
|
+
}
|
|
355
|
+
themeIntent="warning"
|
|
356
|
+
themeVariant="filled"
|
|
357
|
+
>
|
|
358
|
+
WARNING
|
|
359
|
+
</Text>
|
|
360
|
+
</View>
|
|
361
|
+
`;
|
|
362
|
+
|
|
363
|
+
exports[`Tag renders correctly with custom content 1`] = `
|
|
364
|
+
<View
|
|
365
|
+
style={
|
|
366
|
+
Array [
|
|
367
|
+
Object {
|
|
368
|
+
"backgroundColor": undefined,
|
|
369
|
+
"borderColor": "#401960",
|
|
370
|
+
"borderRadius": 4,
|
|
371
|
+
"borderWidth": 1,
|
|
372
|
+
"paddingHorizontal": 8,
|
|
373
|
+
"paddingVertical": 2,
|
|
374
|
+
},
|
|
375
|
+
undefined,
|
|
376
|
+
]
|
|
377
|
+
}
|
|
378
|
+
themeIntent="primary"
|
|
379
|
+
themeVariant="outlined"
|
|
380
|
+
>
|
|
381
|
+
<Text
|
|
382
|
+
style={
|
|
383
|
+
Array [
|
|
384
|
+
Object {
|
|
385
|
+
"color": "#001f23",
|
|
386
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
387
|
+
"fontSize": 14,
|
|
388
|
+
"letterSpacing": 0.42,
|
|
389
|
+
"lineHeight": 22,
|
|
390
|
+
},
|
|
391
|
+
undefined,
|
|
392
|
+
]
|
|
393
|
+
}
|
|
394
|
+
themeFontSize="medium"
|
|
395
|
+
themeFontWeight="regular"
|
|
396
|
+
themeIntent="body"
|
|
397
|
+
themeTypeface="neutral"
|
|
398
|
+
>
|
|
399
|
+
Custom Content
|
|
400
|
+
</Text>
|
|
401
|
+
</View>
|
|
402
|
+
`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
2
|
import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
|
|
3
3
|
import { StyledView, StyledText } from './StyledTag';
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ interface TagProps extends ViewProps {
|
|
|
6
6
|
/**
|
|
7
7
|
* Content of the Tag.
|
|
8
8
|
*/
|
|
9
|
-
content: string;
|
|
9
|
+
content: string | ReactElement;
|
|
10
10
|
/**
|
|
11
11
|
* Visual intent color to apply to Tag.
|
|
12
12
|
*/
|
|
@@ -18,6 +18,10 @@ interface TagProps extends ViewProps {
|
|
|
18
18
|
| 'warning'
|
|
19
19
|
| 'danger'
|
|
20
20
|
| 'archived';
|
|
21
|
+
/**
|
|
22
|
+
* Tag variant.
|
|
23
|
+
*/
|
|
24
|
+
variant?: 'filled' | 'outlined';
|
|
21
25
|
/**
|
|
22
26
|
* Additional style.
|
|
23
27
|
*/
|
|
@@ -30,6 +34,7 @@ interface TagProps extends ViewProps {
|
|
|
30
34
|
|
|
31
35
|
const Tag = ({
|
|
32
36
|
content,
|
|
37
|
+
variant = 'outlined',
|
|
33
38
|
intent = 'primary',
|
|
34
39
|
style,
|
|
35
40
|
testID,
|
|
@@ -38,10 +43,17 @@ const Tag = ({
|
|
|
38
43
|
<StyledView
|
|
39
44
|
{...nativeProps}
|
|
40
45
|
themeIntent={intent}
|
|
46
|
+
themeVariant={variant}
|
|
41
47
|
style={style}
|
|
42
48
|
testID={testID}
|
|
43
49
|
>
|
|
44
|
-
|
|
50
|
+
{typeof content === 'string' ? (
|
|
51
|
+
<StyledText themeIntent={intent} themeVariant={variant}>
|
|
52
|
+
{content}
|
|
53
|
+
</StyledText>
|
|
54
|
+
) : (
|
|
55
|
+
content
|
|
56
|
+
)}
|
|
45
57
|
</StyledView>
|
|
46
58
|
);
|
|
47
59
|
|
|
@@ -22,6 +22,7 @@ exports[`Label renders correctly with themeVariant default 1`] = `
|
|
|
22
22
|
themeFontSize="medium"
|
|
23
23
|
themeFontWeight="regular"
|
|
24
24
|
themeIntent="body"
|
|
25
|
+
themeTypeface="neutral"
|
|
25
26
|
themeVariant="default"
|
|
26
27
|
>
|
|
27
28
|
Label
|
|
@@ -50,6 +51,7 @@ exports[`Label renders correctly with themeVariant disabled 1`] = `
|
|
|
50
51
|
themeFontSize="medium"
|
|
51
52
|
themeFontWeight="regular"
|
|
52
53
|
themeIntent="body"
|
|
54
|
+
themeTypeface="neutral"
|
|
53
55
|
themeVariant="disabled"
|
|
54
56
|
>
|
|
55
57
|
Label
|
|
@@ -78,6 +80,7 @@ exports[`Label renders correctly with themeVariant error 1`] = `
|
|
|
78
80
|
themeFontSize="medium"
|
|
79
81
|
themeFontWeight="regular"
|
|
80
82
|
themeIntent="body"
|
|
83
|
+
themeTypeface="neutral"
|
|
81
84
|
themeVariant="error"
|
|
82
85
|
>
|
|
83
86
|
Label
|
|
@@ -106,6 +109,7 @@ exports[`Label renders correctly with themeVariant filled 1`] = `
|
|
|
106
109
|
themeFontSize="medium"
|
|
107
110
|
themeFontWeight="regular"
|
|
108
111
|
themeIntent="body"
|
|
112
|
+
themeTypeface="neutral"
|
|
109
113
|
themeVariant="filled"
|
|
110
114
|
>
|
|
111
115
|
Label
|
|
@@ -134,6 +138,7 @@ exports[`Label renders correctly with themeVariant readonly 1`] = `
|
|
|
134
138
|
themeFontSize="medium"
|
|
135
139
|
themeFontWeight="regular"
|
|
136
140
|
themeIntent="body"
|
|
141
|
+
themeTypeface="neutral"
|
|
137
142
|
themeVariant="readonly"
|
|
138
143
|
>
|
|
139
144
|
Label
|
|
@@ -185,6 +190,7 @@ exports[`LabelInsideTextInput renders correctly with themeVariant default 1`] =
|
|
|
185
190
|
themeFontSize="medium"
|
|
186
191
|
themeFontWeight="regular"
|
|
187
192
|
themeIntent="body"
|
|
193
|
+
themeTypeface="neutral"
|
|
188
194
|
themeVariant="default"
|
|
189
195
|
>
|
|
190
196
|
Label
|
|
@@ -217,6 +223,7 @@ exports[`LabelInsideTextInput renders correctly with themeVariant disabled 1`] =
|
|
|
217
223
|
themeFontSize="medium"
|
|
218
224
|
themeFontWeight="regular"
|
|
219
225
|
themeIntent="body"
|
|
226
|
+
themeTypeface="neutral"
|
|
220
227
|
themeVariant="disabled"
|
|
221
228
|
>
|
|
222
229
|
Label
|
|
@@ -249,6 +256,7 @@ exports[`LabelInsideTextInput renders correctly with themeVariant error 1`] = `
|
|
|
249
256
|
themeFontSize="medium"
|
|
250
257
|
themeFontWeight="regular"
|
|
251
258
|
themeIntent="body"
|
|
259
|
+
themeTypeface="neutral"
|
|
252
260
|
themeVariant="error"
|
|
253
261
|
>
|
|
254
262
|
Label
|
|
@@ -281,6 +289,7 @@ exports[`LabelInsideTextInput renders correctly with themeVariant filled 1`] = `
|
|
|
281
289
|
themeFontSize="medium"
|
|
282
290
|
themeFontWeight="regular"
|
|
283
291
|
themeIntent="body"
|
|
292
|
+
themeTypeface="neutral"
|
|
284
293
|
themeVariant="filled"
|
|
285
294
|
>
|
|
286
295
|
Label
|
|
@@ -313,6 +322,7 @@ exports[`LabelInsideTextInput renders correctly with themeVariant readonly 1`] =
|
|
|
313
322
|
themeFontSize="medium"
|
|
314
323
|
themeFontWeight="regular"
|
|
315
324
|
themeIntent="body"
|
|
325
|
+
themeTypeface="neutral"
|
|
316
326
|
themeVariant="readonly"
|
|
317
327
|
>
|
|
318
328
|
Label
|
|
@@ -341,6 +351,7 @@ exports[`StyledAsteriskLabel renders correctly with themeVariant default 1`] = `
|
|
|
341
351
|
themeFontSize="medium"
|
|
342
352
|
themeFontWeight="regular"
|
|
343
353
|
themeIntent="body"
|
|
354
|
+
themeTypeface="neutral"
|
|
344
355
|
themeVariant="default"
|
|
345
356
|
>
|
|
346
357
|
*
|
|
@@ -369,6 +380,7 @@ exports[`StyledAsteriskLabel renders correctly with themeVariant disabled 1`] =
|
|
|
369
380
|
themeFontSize="medium"
|
|
370
381
|
themeFontWeight="regular"
|
|
371
382
|
themeIntent="body"
|
|
383
|
+
themeTypeface="neutral"
|
|
372
384
|
themeVariant="disabled"
|
|
373
385
|
>
|
|
374
386
|
*
|
|
@@ -397,6 +409,7 @@ exports[`StyledAsteriskLabel renders correctly with themeVariant error 1`] = `
|
|
|
397
409
|
themeFontSize="medium"
|
|
398
410
|
themeFontWeight="regular"
|
|
399
411
|
themeIntent="body"
|
|
412
|
+
themeTypeface="neutral"
|
|
400
413
|
themeVariant="error"
|
|
401
414
|
>
|
|
402
415
|
*
|
|
@@ -425,6 +438,7 @@ exports[`StyledAsteriskLabel renders correctly with themeVariant filled 1`] = `
|
|
|
425
438
|
themeFontSize="medium"
|
|
426
439
|
themeFontWeight="regular"
|
|
427
440
|
themeIntent="body"
|
|
441
|
+
themeTypeface="neutral"
|
|
428
442
|
themeVariant="filled"
|
|
429
443
|
>
|
|
430
444
|
*
|
|
@@ -453,6 +467,7 @@ exports[`StyledAsteriskLabel renders correctly with themeVariant readonly 1`] =
|
|
|
453
467
|
themeFontSize="medium"
|
|
454
468
|
themeFontWeight="regular"
|
|
455
469
|
themeIntent="body"
|
|
470
|
+
themeTypeface="neutral"
|
|
456
471
|
themeVariant="readonly"
|
|
457
472
|
>
|
|
458
473
|
*
|
|
@@ -615,6 +630,7 @@ exports[`StyledErrorMessage renders correctly 1`] = `
|
|
|
615
630
|
themeFontSize="medium"
|
|
616
631
|
themeFontWeight="regular"
|
|
617
632
|
themeIntent="body"
|
|
633
|
+
themeTypeface="neutral"
|
|
618
634
|
>
|
|
619
635
|
must not exceed character limit
|
|
620
636
|
</Text>
|
|
@@ -665,6 +681,7 @@ exports[`StyledHelperText renders correctly 1`] = `
|
|
|
665
681
|
themeFontSize="medium"
|
|
666
682
|
themeFontWeight="regular"
|
|
667
683
|
themeIntent="body"
|
|
684
|
+
themeTypeface="neutral"
|
|
668
685
|
>
|
|
669
686
|
helper text
|
|
670
687
|
</Text>
|
|
@@ -698,6 +715,7 @@ exports[`StyledMaxLengthMessage renders correctly with themeVariant default 1`]
|
|
|
698
715
|
themeFontSize="medium"
|
|
699
716
|
themeFontWeight="regular"
|
|
700
717
|
themeIntent="body"
|
|
718
|
+
themeTypeface="neutral"
|
|
701
719
|
themeVariant="default"
|
|
702
720
|
>
|
|
703
721
|
100/255
|
|
@@ -732,6 +750,7 @@ exports[`StyledMaxLengthMessage renders correctly with themeVariant disabled 1`]
|
|
|
732
750
|
themeFontSize="medium"
|
|
733
751
|
themeFontWeight="regular"
|
|
734
752
|
themeIntent="body"
|
|
753
|
+
themeTypeface="neutral"
|
|
735
754
|
themeVariant="disabled"
|
|
736
755
|
>
|
|
737
756
|
100/255
|
|
@@ -766,6 +785,7 @@ exports[`StyledMaxLengthMessage renders correctly with themeVariant error 1`] =
|
|
|
766
785
|
themeFontSize="medium"
|
|
767
786
|
themeFontWeight="regular"
|
|
768
787
|
themeIntent="body"
|
|
788
|
+
themeTypeface="neutral"
|
|
769
789
|
themeVariant="error"
|
|
770
790
|
>
|
|
771
791
|
100/255
|
|
@@ -800,6 +820,7 @@ exports[`StyledMaxLengthMessage renders correctly with themeVariant filled 1`] =
|
|
|
800
820
|
themeFontSize="medium"
|
|
801
821
|
themeFontWeight="regular"
|
|
802
822
|
themeIntent="body"
|
|
823
|
+
themeTypeface="neutral"
|
|
803
824
|
themeVariant="filled"
|
|
804
825
|
>
|
|
805
826
|
100/255
|
|
@@ -834,6 +855,7 @@ exports[`StyledMaxLengthMessage renders correctly with themeVariant readonly 1`]
|
|
|
834
855
|
themeFontSize="medium"
|
|
835
856
|
themeFontWeight="regular"
|
|
836
857
|
themeIntent="body"
|
|
858
|
+
themeTypeface="neutral"
|
|
837
859
|
themeVariant="readonly"
|
|
838
860
|
>
|
|
839
861
|
100/255
|