@hero-design/rn 7.12.1 → 7.14.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/.eslintrc.json +3 -1
- package/.turbo/turbo-build.log +3 -2
- package/assets/fonts/hero-icons.ttf +0 -0
- package/babel.config.js +16 -0
- package/es/index.js +35840 -16325
- package/lib/assets/fonts/hero-icons.ttf +0 -0
- package/lib/index.js +35847 -16327
- package/package.json +9 -4
- package/rollup.config.js +1 -0
- package/src/components/Accordion/AccordionItem.tsx +50 -0
- package/src/components/Accordion/StyledAccordion.tsx +29 -0
- package/src/components/Accordion/__tests__/AccordionItem.spec.tsx +56 -0
- package/src/components/Accordion/__tests__/StyledAccordion.spec.tsx +17 -0
- package/src/components/Accordion/__tests__/__snapshots__/AccordionItem.spec.tsx.snap +529 -0
- package/src/components/Accordion/__tests__/__snapshots__/StyledAccordion.spec.tsx.snap +33 -0
- package/src/components/Accordion/__tests__/__snapshots__/index.spec.tsx.snap +822 -0
- package/src/components/Accordion/__tests__/index.spec.tsx +54 -0
- package/src/components/Accordion/index.tsx +82 -0
- package/src/components/Accordion/utils.tsx +11 -0
- package/src/components/Button/Button.tsx +64 -60
- package/src/components/Button/IconButton.tsx +1 -1
- package/src/components/Button/StyledButton.tsx +4 -6
- package/src/components/Button/__tests__/StyledButton.spec.tsx +11 -4
- package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +312 -78
- package/src/components/Calendar/CalendarRowItem.tsx +54 -0
- package/src/components/Calendar/StyledCalendar.tsx +76 -0
- package/src/components/Calendar/__tests__/CalendarRowItem.spec.tsx +76 -0
- package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +411 -0
- package/src/components/Calendar/__tests__/helper.spec.ts +50 -0
- package/src/components/Calendar/__tests__/index.spec.tsx +99 -0
- package/src/components/Calendar/helpers.ts +29 -0
- package/src/components/Calendar/index.tsx +217 -0
- package/src/components/Collapse/index.tsx +13 -15
- package/src/components/ContentNavigator/index.tsx +6 -0
- package/src/components/DatePicker/DatePickerAndroid.tsx +59 -0
- package/src/components/DatePicker/DatePickerIOS.tsx +87 -0
- package/src/components/DatePicker/StyledDatePicker.tsx +8 -0
- package/src/components/DatePicker/__tests__/DatePicker.spec.tsx +34 -0
- package/src/components/DatePicker/__tests__/DatePickerAndroid.spec.tsx +39 -0
- package/src/components/DatePicker/__tests__/DatePickerIOS.spec.tsx +46 -0
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +199 -0
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +513 -0
- package/src/components/DatePicker/index.tsx +15 -0
- package/src/components/DatePicker/types.ts +49 -0
- package/src/components/Empty/StyledEmpty.tsx +47 -0
- package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +66 -0
- package/src/components/Empty/__tests__/index.spec.tsx +17 -0
- package/src/components/Empty/index.tsx +53 -0
- package/src/components/FAB/ActionGroup/ActionItem.tsx +6 -2
- package/src/components/FAB/ActionGroup/StyledActionGroup.tsx +1 -0
- package/src/components/FAB/ActionGroup/StyledActionItem.tsx +7 -1
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +84 -22
- package/src/components/FAB/ActionGroup/index.tsx +8 -1
- package/src/components/Icon/HeroIcon/selection.json +1 -1
- package/src/components/Icon/IconList.ts +13 -0
- package/src/components/List/BasicListItem.tsx +44 -34
- package/src/components/List/ListItem.tsx +67 -58
- package/src/components/List/StyledBasicListItem.tsx +2 -3
- package/src/components/List/StyledListItem.tsx +2 -2
- package/src/components/List/__tests__/StyledBasicListItem.spec.tsx +5 -2
- package/src/components/List/__tests__/StyledListItem.spec.tsx +4 -1
- package/src/components/List/__tests__/__snapshots__/BasicListItem.spec.tsx.snap +15 -10
- package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +52 -32
- package/src/components/List/__tests__/__snapshots__/StyledBasicListItem.spec.tsx.snap +128 -48
- package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +132 -52
- package/src/components/RichTextEditor/EditorEvent.ts +7 -0
- package/src/components/RichTextEditor/EditorToolbar.tsx +220 -0
- package/src/components/RichTextEditor/MentionList.tsx +69 -0
- package/src/components/RichTextEditor/RichTextEditor.tsx +396 -0
- package/src/components/RichTextEditor/StyledRichTextEditor.ts +20 -0
- package/src/components/RichTextEditor/StyledToolbar.ts +32 -0
- package/src/components/RichTextEditor/__tests__/EditorToolbar.spec.tsx +130 -0
- package/src/components/RichTextEditor/__tests__/MentionList.spec.tsx +109 -0
- package/src/components/RichTextEditor/__tests__/RichTextEditor.spec.tsx +245 -0
- package/src/components/RichTextEditor/__tests__/__snapshots__/EditorToolbar.spec.tsx.snap +324 -0
- package/src/components/RichTextEditor/__tests__/__snapshots__/MentionList.spec.tsx.snap +45 -0
- package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +526 -0
- package/src/components/RichTextEditor/constants.ts +20 -0
- package/src/components/RichTextEditor/hero-editor.d.ts +8 -0
- package/src/components/RichTextEditor/index.tsx +8 -0
- package/src/components/RichTextEditor/utils/events.ts +31 -0
- package/src/components/RichTextEditor/utils/rnWebView.ts +19 -0
- package/src/components/SectionHeading/__tests__/__snapshots__/index.spec.tsx.snap +77 -0
- package/src/components/SectionHeading/__tests__/index.spec.tsx +14 -0
- package/src/components/SectionHeading/index.tsx +16 -9
- package/src/components/Tag/StyledTag.tsx +12 -2
- package/src/components/Tag/__tests__/Tag.spec.tsx +35 -8
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +118 -4
- package/src/components/Tag/index.tsx +9 -2
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +1 -0
- package/src/components/TimePicker/TimePickerIOS.tsx +1 -1
- package/src/components/TimePicker/types.ts +1 -1
- package/src/components/Typography/Text/StyledText.tsx +2 -1
- package/src/components/Typography/Text/__tests__/StyledText.spec.tsx +1 -0
- package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +22 -0
- package/src/components/Typography/Text/index.tsx +2 -1
- package/src/index.ts +10 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +119 -4
- package/src/theme/components/accordion.ts +19 -0
- package/src/theme/components/button.ts +12 -0
- package/src/theme/components/calendar.ts +34 -0
- package/src/theme/components/card.ts +1 -1
- package/src/theme/components/datePicker.ts +11 -0
- package/src/theme/components/empty.ts +38 -0
- package/src/theme/components/fab.ts +4 -3
- package/src/theme/components/list.ts +1 -0
- package/src/theme/components/pinInput.ts +1 -1
- package/src/theme/components/richTextEditor.ts +34 -0
- package/src/theme/components/tag.ts +8 -2
- package/src/theme/components/typography.ts +1 -0
- package/src/theme/global/borders.ts +6 -6
- package/src/theme/global/colors.ts +5 -1
- package/src/theme/index.ts +15 -0
- package/testUtils/setup.tsx +17 -0
- package/types/components/Accordion/AccordionItem.d.ts +14 -0
- package/types/components/Accordion/StyledAccordion.d.ts +32 -0
- package/types/components/Accordion/__tests__/AccordionItem.spec.d.ts +1 -0
- package/types/components/Accordion/__tests__/StyledAccordion.spec.d.ts +1 -0
- package/types/components/Accordion/__tests__/index.spec.d.ts +1 -0
- package/types/components/Accordion/index.d.ts +38 -0
- package/types/components/Accordion/utils.d.ts +1 -0
- package/types/components/Button/IconButton.d.ts +1 -1
- package/types/components/Button/StyledButton.d.ts +3 -3
- package/types/components/Calendar/CalendarRowItem.d.ts +10 -0
- package/types/components/Calendar/StyledCalendar.d.ts +54 -0
- package/types/components/Calendar/__tests__/CalendarRowItem.spec.d.ts +1 -0
- package/types/components/Calendar/__tests__/helper.spec.d.ts +1 -0
- package/types/components/Calendar/__tests__/index.spec.d.ts +1 -0
- package/types/components/Calendar/helpers.d.ts +3 -0
- package/types/components/Calendar/index.d.ts +40 -0
- package/types/components/Collapse/index.d.ts +1 -1
- package/types/components/ContentNavigator/index.d.ts +5 -1
- package/types/components/DatePicker/DatePickerAndroid.d.ts +3 -0
- package/types/components/DatePicker/DatePickerIOS.d.ts +3 -0
- package/types/components/DatePicker/StyledDatePicker.d.ts +8 -0
- package/types/components/DatePicker/__tests__/DatePicker.spec.d.ts +1 -0
- package/types/components/DatePicker/__tests__/DatePickerAndroid.spec.d.ts +1 -0
- package/types/components/DatePicker/__tests__/DatePickerIOS.spec.d.ts +1 -0
- package/types/components/DatePicker/index.d.ts +3 -0
- package/types/components/DatePicker/types.d.ts +48 -0
- package/types/components/Empty/StyledEmpty.d.ts +31 -0
- package/types/components/Empty/__tests__/index.spec.d.ts +1 -0
- package/types/components/Empty/index.d.ts +26 -0
- package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +6 -1
- package/types/components/FAB/ActionGroup/index.d.ts +6 -1
- package/types/components/FAB/index.d.ts +1 -1
- package/types/components/Icon/IconList.d.ts +1 -1
- package/types/components/Icon/utils.d.ts +1 -1
- package/types/components/List/StyledBasicListItem.d.ts +3 -3
- package/types/components/List/StyledListItem.d.ts +3 -3
- package/types/components/RichTextEditor/EditorEvent.d.ts +3 -0
- package/types/components/RichTextEditor/EditorToolbar.d.ts +17 -0
- package/types/components/RichTextEditor/MentionList.d.ts +12 -0
- package/types/components/RichTextEditor/RichTextEditor.d.ts +65 -0
- package/types/components/RichTextEditor/StyledRichTextEditor.d.ts +16 -0
- package/types/components/RichTextEditor/StyledToolbar.d.ts +21 -0
- package/types/components/RichTextEditor/__tests__/EditorToolbar.spec.d.ts +1 -0
- package/types/components/RichTextEditor/__tests__/MentionList.spec.d.ts +1 -0
- package/types/components/RichTextEditor/__tests__/RichTextEditor.spec.d.ts +1 -0
- package/types/components/RichTextEditor/constants.d.ts +19 -0
- package/types/components/RichTextEditor/index.d.ts +5 -0
- package/types/components/RichTextEditor/utils/events.d.ts +8 -0
- package/types/components/RichTextEditor/utils/rnWebView.d.ts +7 -0
- package/types/components/SectionHeading/index.d.ts +2 -2
- package/types/components/Select/MultiSelect/OptionList.d.ts +1 -1
- package/types/components/Select/SingleSelect/OptionList.d.ts +1 -1
- package/types/components/Tag/StyledTag.d.ts +1 -1
- package/types/components/Tag/index.d.ts +1 -1
- package/types/components/TimePicker/types.d.ts +1 -1
- package/types/components/Typography/Text/StyledText.d.ts +1 -1
- package/types/components/Typography/Text/index.d.ts +1 -1
- package/types/index.d.ts +6 -1
- package/types/theme/components/accordion.d.ts +13 -0
- package/types/theme/components/button.d.ts +12 -0
- package/types/theme/components/calendar.d.ts +26 -0
- package/types/theme/components/datePicker.d.ts +6 -0
- package/types/theme/components/empty.d.ts +28 -0
- package/types/theme/components/fab.d.ts +1 -0
- package/types/theme/components/list.d.ts +1 -0
- package/types/theme/components/richTextEditor.d.ts +26 -0
- package/types/theme/components/tag.d.ts +8 -2
- package/types/theme/components/typography.d.ts +1 -0
- package/types/theme/global/colors.d.ts +5 -1
- package/types/theme/global/index.d.ts +5 -1
- package/types/theme/index.d.ts +10 -0
|
@@ -1,5 +1,82 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`SectionHeading allows to customise the icon 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
style={
|
|
6
|
+
Array [
|
|
7
|
+
Object {
|
|
8
|
+
"alignContent": "center",
|
|
9
|
+
"backgroundColor": "#dadbde",
|
|
10
|
+
"display": "flex",
|
|
11
|
+
"flexDirection": "row",
|
|
12
|
+
"justifyContent": "space-between",
|
|
13
|
+
"marginBottom": 16,
|
|
14
|
+
"paddingHorizontal": 16,
|
|
15
|
+
"paddingVertical": 8,
|
|
16
|
+
},
|
|
17
|
+
undefined,
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
>
|
|
21
|
+
<View
|
|
22
|
+
style={
|
|
23
|
+
Array [
|
|
24
|
+
Object {
|
|
25
|
+
"display": "flex",
|
|
26
|
+
"flexDirection": "row",
|
|
27
|
+
},
|
|
28
|
+
undefined,
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
>
|
|
32
|
+
<View
|
|
33
|
+
style={
|
|
34
|
+
Array [
|
|
35
|
+
Object {
|
|
36
|
+
"marginRight": 8,
|
|
37
|
+
},
|
|
38
|
+
undefined,
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
>
|
|
42
|
+
<HeroIcon
|
|
43
|
+
name="home"
|
|
44
|
+
style={
|
|
45
|
+
Array [
|
|
46
|
+
Object {
|
|
47
|
+
"color": "#de350b",
|
|
48
|
+
"fontSize": 24,
|
|
49
|
+
},
|
|
50
|
+
undefined,
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
themeIntent="danger"
|
|
54
|
+
themeSize="medium"
|
|
55
|
+
/>
|
|
56
|
+
</View>
|
|
57
|
+
<Text
|
|
58
|
+
style={
|
|
59
|
+
Array [
|
|
60
|
+
Object {
|
|
61
|
+
"color": "#7622d7",
|
|
62
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
63
|
+
"fontSize": 16,
|
|
64
|
+
"letterSpacing": 0.48,
|
|
65
|
+
"lineHeight": 24,
|
|
66
|
+
},
|
|
67
|
+
undefined,
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
themeFontSize="large"
|
|
71
|
+
themeFontWeight="regular"
|
|
72
|
+
themeIntent="primary"
|
|
73
|
+
>
|
|
74
|
+
test demo
|
|
75
|
+
</Text>
|
|
76
|
+
</View>
|
|
77
|
+
</View>
|
|
78
|
+
`;
|
|
79
|
+
|
|
3
80
|
exports[`SectionHeading render icon correctly 1`] = `
|
|
4
81
|
<View
|
|
5
82
|
style={
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Text } from 'react-native';
|
|
3
3
|
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
4
4
|
import SectionHeading from '..';
|
|
5
|
+
import Icon from '../../Icon';
|
|
5
6
|
|
|
6
7
|
describe('SectionHeading', () => {
|
|
7
8
|
it('renders correctly', () => {
|
|
@@ -36,4 +37,17 @@ describe('SectionHeading', () => {
|
|
|
36
37
|
|
|
37
38
|
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
38
39
|
});
|
|
40
|
+
|
|
41
|
+
it('allows to customise the icon', () => {
|
|
42
|
+
const wrapper = renderWithTheme(
|
|
43
|
+
<SectionHeading
|
|
44
|
+
text="test demo"
|
|
45
|
+
intent="primary"
|
|
46
|
+
fontSize="large"
|
|
47
|
+
icon={<Icon icon="home" intent="danger" />}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
52
|
+
});
|
|
39
53
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ReactElement } from 'react';
|
|
2
2
|
|
|
3
3
|
import { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
4
|
-
import Icon, { IconName } from '../Icon';
|
|
4
|
+
import Icon, { IconName, IconProps } from '../Icon';
|
|
5
5
|
import Typography from '../Typography';
|
|
6
6
|
import {
|
|
7
7
|
StyledHeading,
|
|
@@ -17,7 +17,7 @@ export interface SectionHeadingProps extends ViewProps {
|
|
|
17
17
|
/**
|
|
18
18
|
* Name of the Icon.
|
|
19
19
|
*/
|
|
20
|
-
icon?: IconName
|
|
20
|
+
icon?: IconName | ReactElement<IconProps>;
|
|
21
21
|
/**
|
|
22
22
|
* Right corner content
|
|
23
23
|
*/
|
|
@@ -70,13 +70,20 @@ const SectionHeading = ({
|
|
|
70
70
|
<StyledHeading style={style} testID={testID}>
|
|
71
71
|
<StyledWrapper>
|
|
72
72
|
<StyledIconWrapper>
|
|
73
|
-
{icon &&
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
{icon !== undefined &&
|
|
74
|
+
(typeof icon === 'string' ? (
|
|
75
|
+
<Icon
|
|
76
|
+
icon={icon}
|
|
77
|
+
size={ICON_SIZE_MAP[fontSize]}
|
|
78
|
+
intent={ICON_INTENT_MAP[intent]}
|
|
79
|
+
/>
|
|
80
|
+
) : (
|
|
81
|
+
React.cloneElement(icon, {
|
|
82
|
+
size: ICON_SIZE_MAP[fontSize],
|
|
83
|
+
intent: ICON_INTENT_MAP[intent],
|
|
84
|
+
...icon.props,
|
|
85
|
+
})
|
|
86
|
+
))}
|
|
80
87
|
</StyledIconWrapper>
|
|
81
88
|
<Typography.Text
|
|
82
89
|
fontSize={fontSize}
|
|
@@ -2,13 +2,23 @@ import { View, Text } from 'react-native';
|
|
|
2
2
|
import styled from '@emotion/native';
|
|
3
3
|
|
|
4
4
|
const BACKGROUND_INTENTS = {
|
|
5
|
+
default: 'defaultBackground',
|
|
6
|
+
primary: 'primaryBackground',
|
|
7
|
+
info: 'infoBackground',
|
|
5
8
|
success: 'successBackground',
|
|
6
9
|
warning: 'warningBackground',
|
|
7
10
|
danger: 'dangerBackground',
|
|
8
|
-
|
|
11
|
+
archived: 'archivedBackground',
|
|
9
12
|
} as const;
|
|
10
13
|
|
|
11
|
-
type ThemeIntent =
|
|
14
|
+
type ThemeIntent =
|
|
15
|
+
| 'default'
|
|
16
|
+
| 'primary'
|
|
17
|
+
| 'info'
|
|
18
|
+
| 'success'
|
|
19
|
+
| 'warning'
|
|
20
|
+
| 'danger'
|
|
21
|
+
| 'archived';
|
|
12
22
|
|
|
13
23
|
const StyledView = styled(View)<{ themeIntent: ThemeIntent }>(
|
|
14
24
|
({ themeIntent, theme }) => ({
|
|
@@ -5,37 +5,64 @@ import Tag from '..';
|
|
|
5
5
|
describe('Tag', () => {
|
|
6
6
|
it('has success style when intent is success', () => {
|
|
7
7
|
const { getByText, toJSON } = renderWithTheme(
|
|
8
|
-
<Tag content="
|
|
8
|
+
<Tag content="SUCCESS" intent="success" />
|
|
9
9
|
);
|
|
10
10
|
|
|
11
11
|
expect(toJSON()).toMatchSnapshot();
|
|
12
|
-
expect(getByText('
|
|
12
|
+
expect(getByText('SUCCESS')).toBeDefined();
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
it('has warning style when intent is warning', () => {
|
|
16
16
|
const { getByText, toJSON } = renderWithTheme(
|
|
17
|
-
<Tag content="
|
|
17
|
+
<Tag content="WARNING" intent="warning" />
|
|
18
18
|
);
|
|
19
19
|
|
|
20
20
|
expect(toJSON()).toMatchSnapshot();
|
|
21
|
-
expect(getByText('
|
|
21
|
+
expect(getByText('WARNING')).toBeDefined();
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
it('has danger style when intent is danger', () => {
|
|
25
25
|
const { getByText, toJSON } = renderWithTheme(
|
|
26
|
-
<Tag content="
|
|
26
|
+
<Tag content="DANGER" intent="danger" />
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
expect(toJSON()).toMatchSnapshot();
|
|
30
|
-
expect(getByText('
|
|
30
|
+
expect(getByText('DANGER')).toBeDefined();
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
it('has info style when intent is info', () => {
|
|
34
34
|
const { getByText, toJSON } = renderWithTheme(
|
|
35
|
-
<Tag content="
|
|
35
|
+
<Tag content="INFO" intent="info" />
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
expect(toJSON()).toMatchSnapshot();
|
|
39
|
-
expect(getByText('
|
|
39
|
+
expect(getByText('INFO')).toBeDefined();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('has default style when intent is default', () => {
|
|
43
|
+
const { getByText, toJSON } = renderWithTheme(
|
|
44
|
+
<Tag content="DEFAULT" intent="default" />
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
expect(toJSON()).toMatchSnapshot();
|
|
48
|
+
expect(getByText('DEFAULT')).toBeDefined();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('has archived style when intent is archived', () => {
|
|
52
|
+
const { getByText, toJSON } = renderWithTheme(
|
|
53
|
+
<Tag content="ARCHIVED" intent="archived" />
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
expect(toJSON()).toMatchSnapshot();
|
|
57
|
+
expect(getByText('ARCHIVED')).toBeDefined();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('has archived style when intent is primary', () => {
|
|
61
|
+
const { getByText, toJSON } = renderWithTheme(
|
|
62
|
+
<Tag content="PRIMARY" intent="primary" />
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
expect(toJSON()).toMatchSnapshot();
|
|
66
|
+
expect(getByText('PRIMARY')).toBeDefined();
|
|
40
67
|
});
|
|
41
68
|
});
|
|
@@ -1,5 +1,81 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`Tag has archived style when intent is archived 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
style={
|
|
6
|
+
Array [
|
|
7
|
+
Object {
|
|
8
|
+
"backgroundColor": "#f1f2f3",
|
|
9
|
+
"borderColor": "#737479",
|
|
10
|
+
"borderRadius": 4,
|
|
11
|
+
"borderWidth": 1,
|
|
12
|
+
"paddingHorizontal": 8,
|
|
13
|
+
"paddingVertical": 2,
|
|
14
|
+
},
|
|
15
|
+
undefined,
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
themeIntent="archived"
|
|
19
|
+
>
|
|
20
|
+
<Text
|
|
21
|
+
style={
|
|
22
|
+
Array [
|
|
23
|
+
Object {
|
|
24
|
+
"color": "#737479",
|
|
25
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
26
|
+
"fontSize": 12,
|
|
27
|
+
"includeFontPadding": false,
|
|
28
|
+
"textAlign": "center",
|
|
29
|
+
"textAlignVertical": "center",
|
|
30
|
+
},
|
|
31
|
+
undefined,
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
themeIntent="archived"
|
|
35
|
+
>
|
|
36
|
+
ARCHIVED
|
|
37
|
+
</Text>
|
|
38
|
+
</View>
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
exports[`Tag has archived style when intent is primary 1`] = `
|
|
42
|
+
<View
|
|
43
|
+
style={
|
|
44
|
+
Array [
|
|
45
|
+
Object {
|
|
46
|
+
"backgroundColor": "#f1e9fb",
|
|
47
|
+
"borderColor": "#7622d7",
|
|
48
|
+
"borderRadius": 4,
|
|
49
|
+
"borderWidth": 1,
|
|
50
|
+
"paddingHorizontal": 8,
|
|
51
|
+
"paddingVertical": 2,
|
|
52
|
+
},
|
|
53
|
+
undefined,
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
themeIntent="primary"
|
|
57
|
+
>
|
|
58
|
+
<Text
|
|
59
|
+
style={
|
|
60
|
+
Array [
|
|
61
|
+
Object {
|
|
62
|
+
"color": "#7622d7",
|
|
63
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
64
|
+
"fontSize": 12,
|
|
65
|
+
"includeFontPadding": false,
|
|
66
|
+
"textAlign": "center",
|
|
67
|
+
"textAlignVertical": "center",
|
|
68
|
+
},
|
|
69
|
+
undefined,
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
themeIntent="primary"
|
|
73
|
+
>
|
|
74
|
+
PRIMARY
|
|
75
|
+
</Text>
|
|
76
|
+
</View>
|
|
77
|
+
`;
|
|
78
|
+
|
|
3
79
|
exports[`Tag has danger style when intent is danger 1`] = `
|
|
4
80
|
<View
|
|
5
81
|
style={
|
|
@@ -33,7 +109,45 @@ exports[`Tag has danger style when intent is danger 1`] = `
|
|
|
33
109
|
}
|
|
34
110
|
themeIntent="danger"
|
|
35
111
|
>
|
|
36
|
-
|
|
112
|
+
DANGER
|
|
113
|
+
</Text>
|
|
114
|
+
</View>
|
|
115
|
+
`;
|
|
116
|
+
|
|
117
|
+
exports[`Tag has default style when intent is default 1`] = `
|
|
118
|
+
<View
|
|
119
|
+
style={
|
|
120
|
+
Array [
|
|
121
|
+
Object {
|
|
122
|
+
"backgroundColor": undefined,
|
|
123
|
+
"borderColor": "#292a2b",
|
|
124
|
+
"borderRadius": 4,
|
|
125
|
+
"borderWidth": 1,
|
|
126
|
+
"paddingHorizontal": 8,
|
|
127
|
+
"paddingVertical": 2,
|
|
128
|
+
},
|
|
129
|
+
undefined,
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
themeIntent="default"
|
|
133
|
+
>
|
|
134
|
+
<Text
|
|
135
|
+
style={
|
|
136
|
+
Array [
|
|
137
|
+
Object {
|
|
138
|
+
"color": "#292a2b",
|
|
139
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
140
|
+
"fontSize": 12,
|
|
141
|
+
"includeFontPadding": false,
|
|
142
|
+
"textAlign": "center",
|
|
143
|
+
"textAlignVertical": "center",
|
|
144
|
+
},
|
|
145
|
+
undefined,
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
themeIntent="default"
|
|
149
|
+
>
|
|
150
|
+
DEFAULT
|
|
37
151
|
</Text>
|
|
38
152
|
</View>
|
|
39
153
|
`;
|
|
@@ -71,7 +185,7 @@ exports[`Tag has info style when intent is info 1`] = `
|
|
|
71
185
|
}
|
|
72
186
|
themeIntent="info"
|
|
73
187
|
>
|
|
74
|
-
|
|
188
|
+
INFO
|
|
75
189
|
</Text>
|
|
76
190
|
</View>
|
|
77
191
|
`;
|
|
@@ -109,7 +223,7 @@ exports[`Tag has success style when intent is success 1`] = `
|
|
|
109
223
|
}
|
|
110
224
|
themeIntent="success"
|
|
111
225
|
>
|
|
112
|
-
|
|
226
|
+
SUCCESS
|
|
113
227
|
</Text>
|
|
114
228
|
</View>
|
|
115
229
|
`;
|
|
@@ -147,7 +261,7 @@ exports[`Tag has warning style when intent is warning 1`] = `
|
|
|
147
261
|
}
|
|
148
262
|
themeIntent="warning"
|
|
149
263
|
>
|
|
150
|
-
|
|
264
|
+
WARNING
|
|
151
265
|
</Text>
|
|
152
266
|
</View>
|
|
153
267
|
`;
|
|
@@ -10,7 +10,14 @@ interface TagProps extends ViewProps {
|
|
|
10
10
|
/**
|
|
11
11
|
* Visual intent color to apply to Tag.
|
|
12
12
|
*/
|
|
13
|
-
intent?:
|
|
13
|
+
intent?:
|
|
14
|
+
| 'default'
|
|
15
|
+
| 'primary'
|
|
16
|
+
| 'info'
|
|
17
|
+
| 'success'
|
|
18
|
+
| 'warning'
|
|
19
|
+
| 'danger'
|
|
20
|
+
| 'archived';
|
|
14
21
|
/**
|
|
15
22
|
* Additional style.
|
|
16
23
|
*/
|
|
@@ -23,7 +30,7 @@ interface TagProps extends ViewProps {
|
|
|
23
30
|
|
|
24
31
|
const Tag = ({
|
|
25
32
|
content,
|
|
26
|
-
intent = '
|
|
33
|
+
intent = 'default',
|
|
27
34
|
style,
|
|
28
35
|
testID,
|
|
29
36
|
...nativeProps
|
|
@@ -22,7 +22,7 @@ const TimePickerIOS = ({
|
|
|
22
22
|
style,
|
|
23
23
|
testID,
|
|
24
24
|
}: TimePickerProps) => {
|
|
25
|
-
const [selectingDate, setSelectingDate] = useState<Date |
|
|
25
|
+
const [selectingDate, setSelectingDate] = useState<Date | undefined>(value);
|
|
26
26
|
const [open, setOpen] = useState(false);
|
|
27
27
|
|
|
28
28
|
const is12Hour = displayFormat.includes('hh');
|
|
@@ -8,7 +8,7 @@ export interface TimePickerProps {
|
|
|
8
8
|
/**
|
|
9
9
|
* Current time value. Must be in correct default format or format provided via format prop.
|
|
10
10
|
*/
|
|
11
|
-
value
|
|
11
|
+
value?: Date;
|
|
12
12
|
/**
|
|
13
13
|
* Input placeholder. Time format will be used as placeholder if not specified.
|
|
14
14
|
*/
|
|
@@ -17,7 +17,8 @@ const StyledText = styled(Text)<{
|
|
|
17
17
|
| 'success'
|
|
18
18
|
| 'info'
|
|
19
19
|
| 'warning'
|
|
20
|
-
| 'danger'
|
|
20
|
+
| 'danger'
|
|
21
|
+
| 'inverted';
|
|
21
22
|
}>(({ themeFontSize, themeFontWeight, themeIntent, theme }) => {
|
|
22
23
|
const sizeStyles = {
|
|
23
24
|
fontSize: theme.__hd__.typography.fontSizes[themeFontSize],
|
|
@@ -66,6 +66,28 @@ exports[`StyledText has info intent style 1`] = `
|
|
|
66
66
|
</Text>
|
|
67
67
|
`;
|
|
68
68
|
|
|
69
|
+
exports[`StyledText has inverted intent style 1`] = `
|
|
70
|
+
<Text
|
|
71
|
+
style={
|
|
72
|
+
Array [
|
|
73
|
+
Object {
|
|
74
|
+
"color": "#ffffff",
|
|
75
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
76
|
+
"fontSize": 14,
|
|
77
|
+
"letterSpacing": 0.42,
|
|
78
|
+
"lineHeight": 22,
|
|
79
|
+
},
|
|
80
|
+
undefined,
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
themeFontSize="medium"
|
|
84
|
+
themeFontWeight="regular"
|
|
85
|
+
themeIntent="inverted"
|
|
86
|
+
>
|
|
87
|
+
This is a test
|
|
88
|
+
</Text>
|
|
89
|
+
`;
|
|
90
|
+
|
|
69
91
|
exports[`StyledText has large fontSize style 1`] = `
|
|
70
92
|
<Text
|
|
71
93
|
style={
|
package/src/index.ts
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import theme, { getTheme, ThemeProvider, useTheme } from './theme';
|
|
2
2
|
import { scale } from './utils/scale';
|
|
3
3
|
|
|
4
|
+
import Accordion from './components/Accordion';
|
|
4
5
|
import Alert from './components/Alert';
|
|
5
6
|
import Avatar from './components/Avatar';
|
|
6
7
|
import Badge from './components/Badge';
|
|
7
8
|
import BottomNavigation from './components/BottomNavigation';
|
|
8
9
|
import BottomSheet from './components/BottomSheet';
|
|
9
10
|
import Button from './components/Button';
|
|
11
|
+
import Calendar from './components/Calendar';
|
|
10
12
|
import Card from './components/Card';
|
|
11
13
|
import Collapse from './components/Collapse';
|
|
12
14
|
import Checkbox from './components/Checkbox';
|
|
13
15
|
import ContentNavigator from './components/ContentNavigator';
|
|
16
|
+
import DatePicker from './components/DatePicker';
|
|
14
17
|
import Divider from './components/Divider';
|
|
15
18
|
import Drawer from './components/Drawer';
|
|
19
|
+
import Empty from './components/Empty';
|
|
16
20
|
import FAB from './components/FAB';
|
|
17
21
|
import Icon from './components/Icon';
|
|
18
22
|
import List from './components/List';
|
|
@@ -30,6 +34,7 @@ import TimePicker from './components/TimePicker';
|
|
|
30
34
|
import Toast from './components/Toast';
|
|
31
35
|
import Toolbar from './components/Toolbar';
|
|
32
36
|
import Typography from './components/Typography';
|
|
37
|
+
import RichTextEditor from './components/RichTextEditor';
|
|
33
38
|
|
|
34
39
|
export {
|
|
35
40
|
theme,
|
|
@@ -37,18 +42,22 @@ export {
|
|
|
37
42
|
useTheme,
|
|
38
43
|
scale,
|
|
39
44
|
ThemeProvider,
|
|
45
|
+
Accordion,
|
|
40
46
|
Alert,
|
|
41
47
|
Avatar,
|
|
42
48
|
Badge,
|
|
43
49
|
BottomNavigation,
|
|
44
50
|
BottomSheet,
|
|
45
51
|
Button,
|
|
52
|
+
Calendar,
|
|
46
53
|
Card,
|
|
47
54
|
Collapse,
|
|
48
55
|
Checkbox,
|
|
49
56
|
ContentNavigator,
|
|
57
|
+
DatePicker,
|
|
50
58
|
Divider,
|
|
51
59
|
Drawer,
|
|
60
|
+
Empty,
|
|
52
61
|
FAB,
|
|
53
62
|
Icon,
|
|
54
63
|
List,
|
|
@@ -66,6 +75,7 @@ export {
|
|
|
66
75
|
Toast,
|
|
67
76
|
Toolbar,
|
|
68
77
|
Typography,
|
|
78
|
+
RichTextEditor,
|
|
69
79
|
};
|
|
70
80
|
|
|
71
81
|
export * from './types';
|