@hero-design/rn 7.20.1 → 7.21.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 +1 -0
- package/.turbo/turbo-build.log +2 -2
- package/es/index.js +370 -237
- package/lib/index.js +370 -234
- package/package.json +4 -2
- package/rollup.config.js +1 -0
- package/src/components/BottomSheet/index.tsx +6 -1
- package/src/components/Checkbox/__tests__/__snapshots__/StyledCheckbox.spec.tsx.snap +4 -4
- package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +13 -13
- package/src/components/Empty/StyledEmpty.tsx +1 -9
- package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +58 -5
- package/src/components/Empty/__tests__/index.spec.tsx +13 -0
- package/src/components/Empty/index.tsx +38 -18
- package/src/components/Image/__tests__/__snapshots__/index.spec.tsx.snap +81 -0
- package/src/components/Image/__tests__/index.spec.tsx +29 -0
- package/src/components/Image/index.tsx +46 -0
- package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +5 -5
- package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +60 -60
- package/src/components/RichTextEditor/__tests__/__snapshots__/EditorToolbar.spec.tsx.snap +2 -2
- package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +2 -2
- package/src/components/Select/MultiSelect/OptionList.tsx +4 -6
- package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +21 -0
- package/src/components/Select/MultiSelect/index.tsx +33 -3
- package/src/components/Select/SingleSelect/OptionList.tsx +4 -5
- package/src/components/Select/SingleSelect/__tests__/index.spec.tsx +16 -0
- package/src/components/Select/SingleSelect/index.tsx +34 -4
- package/src/components/Select/StyledOptionList.tsx +3 -9
- package/src/components/Slider/__tests__/__snapshots__/index.spec.tsx.snap +43 -0
- package/src/components/Slider/__tests__/index.spec.tsx +33 -0
- package/src/components/Slider/index.tsx +89 -0
- package/src/components/Switch/StyledSwitch.tsx +4 -4
- package/src/components/Switch/__tests__/__snapshots__/StyledSwitch.spec.tsx.snap +10 -10
- package/src/components/Switch/__tests__/__snapshots__/index.spec.tsx.snap +8 -8
- package/src/components/Switch/index.tsx +5 -4
- package/src/components/TextInput/index.tsx +43 -37
- package/src/index.ts +4 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +56 -11
- package/src/theme/components/alert.ts +1 -2
- package/src/theme/components/avatar.ts +8 -8
- package/src/theme/components/badge.ts +4 -4
- package/src/theme/components/bottomNavigation.ts +1 -1
- package/src/theme/components/bottomSheet.ts +2 -3
- package/src/theme/components/calendar.ts +9 -7
- package/src/theme/components/card.ts +1 -1
- package/src/theme/components/checkbox.ts +2 -5
- package/src/theme/components/datePicker.ts +3 -3
- package/src/theme/components/drawer.ts +2 -3
- package/src/theme/components/empty.ts +3 -8
- package/src/theme/components/fab.ts +2 -2
- package/src/theme/components/image.ts +12 -0
- package/src/theme/components/pinInput.ts +3 -3
- package/src/theme/components/progress.ts +2 -3
- package/src/theme/components/radio.ts +7 -3
- package/src/theme/components/richTextEditor.ts +4 -4
- package/src/theme/components/slider.ts +13 -0
- package/src/theme/components/switch.ts +16 -1
- package/src/theme/components/tabs.ts +1 -1
- package/src/theme/components/timePicker.ts +3 -3
- package/src/theme/components/toast.ts +1 -2
- package/src/theme/getTheme.ts +9 -2
- package/src/theme/global/colors/swag.ts +2 -0
- package/src/theme/global/colors/types.ts +2 -0
- package/src/theme/global/index.ts +3 -0
- package/src/theme/global/scale.ts +3 -0
- package/src/theme/global/sizes.ts +29 -0
- package/testUtils/setup.tsx +14 -0
- package/types/components/BottomSheet/index.d.ts +5 -1
- package/types/components/Empty/StyledEmpty.d.ts +1 -7
- package/types/components/Empty/index.d.ts +8 -2
- package/types/components/Image/__tests__/index.spec.d.ts +1 -0
- package/types/components/Image/index.d.ts +17 -0
- package/types/components/Select/MultiSelect/OptionList.d.ts +5 -2
- package/types/components/Select/MultiSelect/index.d.ts +7 -1
- package/types/components/Select/SingleSelect/OptionList.d.ts +5 -2
- package/types/components/Select/SingleSelect/index.d.ts +8 -2
- package/types/components/Select/StyledOptionList.d.ts +4 -3
- package/types/components/Select/index.d.ts +1 -1
- package/types/components/Slider/__tests__/index.spec.d.ts +1 -0
- package/types/components/Slider/index.d.ts +52 -0
- package/types/components/TextInput/index.d.ts +2 -1
- package/types/index.d.ts +3 -1
- package/types/theme/components/datePicker.d.ts +2 -1
- package/types/theme/components/empty.d.ts +2 -5
- package/types/theme/components/image.d.ts +8 -0
- package/types/theme/components/slider.d.ts +9 -0
- package/types/theme/components/switch.d.ts +14 -1
- package/types/theme/components/timePicker.d.ts +2 -1
- package/types/theme/getTheme.d.ts +4 -0
- package/types/theme/global/colors/types.d.ts +2 -0
- package/types/theme/global/index.d.ts +3 -0
- package/types/theme/global/scale.d.ts +1 -0
- package/types/theme/global/sizes.d.ts +14 -0
|
@@ -19,10 +19,10 @@ const getBadgeTheme = (theme: GlobalTheme) => {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
const sizes = {
|
|
22
|
-
height: theme.fontSizes.small + theme.
|
|
23
|
-
minWidth: theme.fontSizes.small + theme.
|
|
24
|
-
statusHeight: theme.
|
|
25
|
-
statusWidth: theme.
|
|
22
|
+
height: theme.fontSizes.small + theme.sizes.small,
|
|
23
|
+
minWidth: theme.fontSizes.small + theme.sizes.small,
|
|
24
|
+
statusHeight: theme.sizes.small,
|
|
25
|
+
statusWidth: theme.sizes.small,
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const space = {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { scale } from '../../utils/scale';
|
|
2
1
|
import type { GlobalTheme } from '../global';
|
|
3
2
|
|
|
4
3
|
const getBottomSheetTheme = (theme: GlobalTheme) => {
|
|
@@ -9,8 +8,8 @@ const getBottomSheetTheme = (theme: GlobalTheme) => {
|
|
|
9
8
|
};
|
|
10
9
|
|
|
11
10
|
const sizes = {
|
|
12
|
-
sectionHeight:
|
|
13
|
-
closeIcon:
|
|
11
|
+
sectionHeight: theme.sizes.xxxxxlarge,
|
|
12
|
+
closeIcon: theme.sizes.xxxlarge,
|
|
14
13
|
};
|
|
15
14
|
|
|
16
15
|
const space = {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { scale } from '../../utils/scale';
|
|
2
1
|
import type { GlobalTheme } from '../global';
|
|
3
2
|
|
|
4
3
|
const getCalendarTheme = (theme: GlobalTheme) => {
|
|
@@ -9,13 +8,16 @@ const getCalendarTheme = (theme: GlobalTheme) => {
|
|
|
9
8
|
inverted: theme.colors.invertedText,
|
|
10
9
|
};
|
|
11
10
|
|
|
11
|
+
const cellSize = theme.sizes.xxxlarge;
|
|
12
|
+
const markSize = theme.sizes.xsmall;
|
|
13
|
+
|
|
12
14
|
const sizes = {
|
|
13
|
-
cellWidth:
|
|
14
|
-
cellHeight:
|
|
15
|
-
cellCircleWidth:
|
|
16
|
-
cellCircleHeight:
|
|
17
|
-
markWidth:
|
|
18
|
-
markHeight:
|
|
15
|
+
cellWidth: cellSize,
|
|
16
|
+
cellHeight: cellSize,
|
|
17
|
+
cellCircleWidth: cellSize - markSize,
|
|
18
|
+
cellCircleHeight: cellSize - markSize,
|
|
19
|
+
markWidth: markSize,
|
|
20
|
+
markHeight: markSize,
|
|
19
21
|
};
|
|
20
22
|
|
|
21
23
|
const space = {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { GlobalTheme } from '../global';
|
|
2
|
-
import { scale } from '../../utils/scale';
|
|
3
2
|
|
|
4
3
|
const getCheckboxTheme = (theme: GlobalTheme) => {
|
|
5
4
|
const colors = {
|
|
@@ -8,15 +7,13 @@ const getCheckboxTheme = (theme: GlobalTheme) => {
|
|
|
8
7
|
};
|
|
9
8
|
|
|
10
9
|
const space = {
|
|
11
|
-
|
|
12
|
-
// and also to center the check mark
|
|
13
|
-
iconTop: -scale(3),
|
|
10
|
+
iconTop: 0,
|
|
14
11
|
wrapperPadding: theme.space.medium,
|
|
15
12
|
iconDescriptionPadding: theme.space.smallMedium,
|
|
16
13
|
};
|
|
17
14
|
|
|
18
15
|
const sizes = {
|
|
19
|
-
icon:
|
|
16
|
+
icon: theme.sizes.large,
|
|
20
17
|
};
|
|
21
18
|
|
|
22
19
|
const radii = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GlobalTheme } from '../global';
|
|
2
2
|
|
|
3
|
-
const getDatePickerTheme = () => {
|
|
3
|
+
const getDatePickerTheme = (theme: GlobalTheme) => {
|
|
4
4
|
const sizes = {
|
|
5
|
-
height:
|
|
5
|
+
height: theme.sizes['19xlarge'],
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
return { sizes };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { scale } from '../../utils/scale';
|
|
2
1
|
import type { GlobalTheme } from '../global';
|
|
3
2
|
|
|
4
3
|
const getDrawerTheme = (theme: GlobalTheme) => {
|
|
@@ -19,8 +18,8 @@ const getDrawerTheme = (theme: GlobalTheme) => {
|
|
|
19
18
|
};
|
|
20
19
|
|
|
21
20
|
const sizes = {
|
|
22
|
-
handlerWidth:
|
|
23
|
-
handlerHeight:
|
|
21
|
+
handlerWidth: theme.sizes.xxxxlarge,
|
|
22
|
+
handlerHeight: theme.sizes.xsmall,
|
|
24
23
|
};
|
|
25
24
|
|
|
26
25
|
const shadows = {
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import { scale } from '../../utils/scale';
|
|
2
1
|
import type { GlobalTheme } from '../global';
|
|
3
2
|
|
|
4
3
|
const getEmptyTheme = (theme: GlobalTheme) => {
|
|
5
4
|
const space = {
|
|
6
5
|
titleMargin: theme.space.medium,
|
|
7
|
-
|
|
6
|
+
imageMargin: theme.space.large,
|
|
8
7
|
wrapperPadding: theme.space.medium,
|
|
9
8
|
};
|
|
10
9
|
|
|
11
10
|
const sizes = {
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const radii = {
|
|
16
|
-
illustration: theme.radii.rounded,
|
|
11
|
+
image: theme.sizes['18xlarge'],
|
|
17
12
|
};
|
|
18
13
|
|
|
19
14
|
const colors = {
|
|
@@ -33,7 +28,7 @@ const getEmptyTheme = (theme: GlobalTheme) => {
|
|
|
33
28
|
description: theme.fonts.light,
|
|
34
29
|
};
|
|
35
30
|
|
|
36
|
-
return { fontSizes, colors, sizes, space, fonts
|
|
31
|
+
return { fontSizes, colors, sizes, space, fonts };
|
|
37
32
|
};
|
|
38
33
|
|
|
39
34
|
export default getEmptyTheme;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GlobalTheme } from '../global';
|
|
2
|
+
|
|
3
|
+
const getImageTheme = (theme: GlobalTheme) => {
|
|
4
|
+
const sizes = {
|
|
5
|
+
'6xlarge': theme.sizes['6xlarge'],
|
|
6
|
+
'15xlarge': theme.sizes['15xlarge'],
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
return { sizes };
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default getImageTheme;
|
|
@@ -24,9 +24,9 @@ const getPinInputTheme = (theme: GlobalTheme) => {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const sizes = {
|
|
27
|
-
cellWidth: theme.
|
|
28
|
-
cellHeight: theme.
|
|
29
|
-
mask: theme.
|
|
27
|
+
cellWidth: theme.sizes.xxlarge,
|
|
28
|
+
cellHeight: theme.sizes.xxxlarge,
|
|
29
|
+
mask: theme.sizes.medium,
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
const space = {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { scale } from '../../utils/scale';
|
|
2
1
|
import type { GlobalTheme } from '../global';
|
|
3
2
|
|
|
4
3
|
const getProgressTheme = (theme: GlobalTheme) => {
|
|
@@ -13,8 +12,8 @@ const getProgressTheme = (theme: GlobalTheme) => {
|
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
const sizes = {
|
|
16
|
-
circleWidth:
|
|
17
|
-
barHeight:
|
|
15
|
+
circleWidth: theme.sizes['6xlarge'],
|
|
16
|
+
barHeight: theme.sizes.xsmall,
|
|
18
17
|
};
|
|
19
18
|
|
|
20
19
|
const radii = {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { scale } from '../../utils/scale';
|
|
2
1
|
import type { GlobalTheme } from '../global';
|
|
3
2
|
|
|
4
3
|
const getRadioTheme = (theme: GlobalTheme) => {
|
|
@@ -11,9 +10,14 @@ const getRadioTheme = (theme: GlobalTheme) => {
|
|
|
11
10
|
groupTopMargin: theme.space.xsmall,
|
|
12
11
|
};
|
|
13
12
|
|
|
13
|
+
const boundingBoxSize = theme.sizes.large;
|
|
14
|
+
const innerPadding = theme.space.xsmall;
|
|
15
|
+
const circle = boundingBoxSize - innerPadding;
|
|
16
|
+
const innerCircle = circle / 2;
|
|
17
|
+
|
|
14
18
|
const sizes = {
|
|
15
|
-
circle
|
|
16
|
-
innerCircle
|
|
19
|
+
circle,
|
|
20
|
+
innerCircle,
|
|
17
21
|
};
|
|
18
22
|
|
|
19
23
|
const borderWidths = {
|
|
@@ -12,10 +12,10 @@ const getRichTextEditorTheme = (theme: GlobalTheme) => {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
const sizes = {
|
|
15
|
-
editorMinHeight:
|
|
16
|
-
toolbarButtonSize: theme.
|
|
17
|
-
toolbarSeparatorWidth:
|
|
18
|
-
toolbarSeparatorHeight: theme.
|
|
15
|
+
editorMinHeight: theme.sizes.large,
|
|
16
|
+
toolbarButtonSize: theme.sizes.xxxlarge,
|
|
17
|
+
toolbarSeparatorWidth: theme.sizes.xxsmall,
|
|
18
|
+
toolbarSeparatorHeight: theme.sizes.medium,
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
const fontSizes = {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { GlobalTheme } from '../global';
|
|
2
|
+
|
|
3
|
+
const getSliderTheme = (theme: GlobalTheme) => {
|
|
4
|
+
const colors = {
|
|
5
|
+
minimumTrackTint: theme.colors.__alpha__primary1,
|
|
6
|
+
thumbTint: theme.colors.__alpha__globalSecondary4,
|
|
7
|
+
maximumTrackTint: theme.colors.__alpha__secondary4,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
return { colors };
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default getSliderTheme;
|
|
@@ -26,10 +26,24 @@ const getSwitchTheme = (theme: GlobalTheme) => {
|
|
|
26
26
|
medium: theme.space.large * 1.2,
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
+
const sizes = {
|
|
30
|
+
thumbs: {
|
|
31
|
+
small: theme.sizes.medium,
|
|
32
|
+
medium: theme.sizes.large,
|
|
33
|
+
},
|
|
34
|
+
widths: {
|
|
35
|
+
small: theme.sizes.xxxlarge,
|
|
36
|
+
medium: theme.sizes.xxxxxlarge,
|
|
37
|
+
},
|
|
38
|
+
heights: {
|
|
39
|
+
small: theme.sizes.large,
|
|
40
|
+
medium: theme.sizes.xlarge,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
29
44
|
const spaces = {
|
|
30
45
|
small: theme.space.xsmall,
|
|
31
46
|
medium: theme.space.xsmall,
|
|
32
|
-
inactive: 0,
|
|
33
47
|
};
|
|
34
48
|
|
|
35
49
|
const radii = {
|
|
@@ -38,6 +52,7 @@ const getSwitchTheme = (theme: GlobalTheme) => {
|
|
|
38
52
|
|
|
39
53
|
return {
|
|
40
54
|
colors,
|
|
55
|
+
sizes,
|
|
41
56
|
thumbSizes,
|
|
42
57
|
widths,
|
|
43
58
|
heights,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GlobalTheme } from '../global';
|
|
2
2
|
|
|
3
|
-
const getTimePickerTheme = () => {
|
|
3
|
+
const getTimePickerTheme = (theme: GlobalTheme) => {
|
|
4
4
|
const sizes = {
|
|
5
|
-
height:
|
|
5
|
+
height: theme.sizes['19xlarge'],
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
return { sizes };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { scale } from '../../utils/scale';
|
|
2
1
|
import type { GlobalTheme } from '../global';
|
|
3
2
|
|
|
4
3
|
const getToastTheme = (theme: GlobalTheme) => {
|
|
@@ -14,7 +13,7 @@ const getToastTheme = (theme: GlobalTheme) => {
|
|
|
14
13
|
};
|
|
15
14
|
|
|
16
15
|
const sizes = {
|
|
17
|
-
height:
|
|
16
|
+
height: theme.sizes.xxxlarge,
|
|
18
17
|
};
|
|
19
18
|
|
|
20
19
|
const space = {
|
package/src/theme/getTheme.ts
CHANGED
|
@@ -17,6 +17,7 @@ import getDrawerTheme from './components/drawer';
|
|
|
17
17
|
import getEmptyTheme from './components/empty';
|
|
18
18
|
import getFABTheme from './components/fab';
|
|
19
19
|
import getIconTheme from './components/icon';
|
|
20
|
+
import getImageTheme from './components/image';
|
|
20
21
|
import getListTheme from './components/list';
|
|
21
22
|
import getPinInputTheme from './components/pinInput';
|
|
22
23
|
import getProgressTheme from './components/progress';
|
|
@@ -24,6 +25,7 @@ import getRadioTheme from './components/radio';
|
|
|
24
25
|
import getRichTextEditorTheme from './components/richTextEditor';
|
|
25
26
|
import getSectionHeadingTheme from './components/sectionHeading';
|
|
26
27
|
import getSelectTheme from './components/select';
|
|
28
|
+
import getSliderTheme from './components/slider';
|
|
27
29
|
import getSpinnerTheme from './components/spinner';
|
|
28
30
|
import getSwitchTheme from './components/switch';
|
|
29
31
|
import getTabsTheme from './components/tabs';
|
|
@@ -33,6 +35,7 @@ import getTimePickerTheme from './components/timePicker';
|
|
|
33
35
|
import getToastTheme from './components/toast';
|
|
34
36
|
import getToolbarTheme from './components/toolbar';
|
|
35
37
|
import getTypographyTheme from './components/typography';
|
|
38
|
+
|
|
36
39
|
import type { GlobalTheme, Scale, SystemPalette } from './global';
|
|
37
40
|
|
|
38
41
|
type Theme = GlobalTheme & {
|
|
@@ -54,6 +57,7 @@ type Theme = GlobalTheme & {
|
|
|
54
57
|
empty: ReturnType<typeof getEmptyTheme>;
|
|
55
58
|
fab: ReturnType<typeof getFABTheme>;
|
|
56
59
|
icon: ReturnType<typeof getIconTheme>;
|
|
60
|
+
image: ReturnType<typeof getImageTheme>;
|
|
57
61
|
list: ReturnType<typeof getListTheme>;
|
|
58
62
|
pinInput: ReturnType<typeof getPinInputTheme>;
|
|
59
63
|
progress: ReturnType<typeof getProgressTheme>;
|
|
@@ -61,6 +65,7 @@ type Theme = GlobalTheme & {
|
|
|
61
65
|
richTextEditor: ReturnType<typeof getRichTextEditorTheme>;
|
|
62
66
|
sectionHeading: ReturnType<typeof getSectionHeadingTheme>;
|
|
63
67
|
select: ReturnType<typeof getSelectTheme>;
|
|
68
|
+
slider: ReturnType<typeof getSliderTheme>;
|
|
64
69
|
spinner: ReturnType<typeof getSpinnerTheme>;
|
|
65
70
|
switch: ReturnType<typeof getSwitchTheme>;
|
|
66
71
|
tabs: ReturnType<typeof getTabsTheme>;
|
|
@@ -92,12 +97,13 @@ const getTheme = (
|
|
|
92
97
|
card: getCardTheme(globalTheme),
|
|
93
98
|
checkbox: getCheckboxTheme(globalTheme),
|
|
94
99
|
contentNavigator: getContentNavigatorTheme(globalTheme),
|
|
95
|
-
datePicker: getDatePickerTheme(),
|
|
100
|
+
datePicker: getDatePickerTheme(globalTheme),
|
|
96
101
|
divider: getDividerTheme(globalTheme),
|
|
97
102
|
drawer: getDrawerTheme(globalTheme),
|
|
98
103
|
empty: getEmptyTheme(globalTheme),
|
|
99
104
|
fab: getFABTheme(globalTheme),
|
|
100
105
|
icon: getIconTheme(globalTheme),
|
|
106
|
+
image: getImageTheme(globalTheme),
|
|
101
107
|
list: getListTheme(globalTheme),
|
|
102
108
|
pinInput: getPinInputTheme(globalTheme),
|
|
103
109
|
progress: getProgressTheme(globalTheme),
|
|
@@ -105,12 +111,13 @@ const getTheme = (
|
|
|
105
111
|
richTextEditor: getRichTextEditorTheme(globalTheme),
|
|
106
112
|
sectionHeading: getSectionHeadingTheme(globalTheme),
|
|
107
113
|
select: getSelectTheme(globalTheme),
|
|
114
|
+
slider: getSliderTheme(globalTheme),
|
|
108
115
|
spinner: getSpinnerTheme(globalTheme),
|
|
109
116
|
switch: getSwitchTheme(globalTheme),
|
|
110
117
|
tabs: getTabsTheme(globalTheme),
|
|
111
118
|
tag: getTagTheme(globalTheme),
|
|
112
119
|
textInput: getTextInputTheme(globalTheme),
|
|
113
|
-
timePicker: getTimePickerTheme(),
|
|
120
|
+
timePicker: getTimePickerTheme(globalTheme),
|
|
114
121
|
toast: getToastTheme(globalTheme),
|
|
115
122
|
toolbar: getToolbarTheme(globalTheme),
|
|
116
123
|
typography: getTypographyTheme(globalTheme),
|
|
@@ -52,6 +52,7 @@ const swagSystemPalette: SystemPalette = {
|
|
|
52
52
|
__alpha__globalPrimary: palette.maasstrichtBlue,
|
|
53
53
|
|
|
54
54
|
__alpha__globalSecondary1: palette.maasstrichtBlueLight30,
|
|
55
|
+
__alpha__globalSecondary4: palette.maasstrichtBlueLight90,
|
|
55
56
|
|
|
56
57
|
__alpha__globalNeutral3: palette.greyLight90,
|
|
57
58
|
|
|
@@ -65,6 +66,7 @@ const swagSystemPalette: SystemPalette = {
|
|
|
65
66
|
__alpha__globalLabel8: palette.honeydew,
|
|
66
67
|
__alpha__globalLabel9: palette.aliceBlue,
|
|
67
68
|
|
|
69
|
+
__alpha__primary1: swagPalette.scarletGum,
|
|
68
70
|
__alpha__primary2: swagPalette.mauve,
|
|
69
71
|
|
|
70
72
|
__alpha__secondary1: swagPalette.scarletGumLight30,
|
|
@@ -46,6 +46,7 @@ export type SystemPalette = {
|
|
|
46
46
|
__alpha__globalPrimary: string;
|
|
47
47
|
|
|
48
48
|
__alpha__globalSecondary1: string;
|
|
49
|
+
__alpha__globalSecondary4: string;
|
|
49
50
|
|
|
50
51
|
__alpha__globalNeutral3: string;
|
|
51
52
|
|
|
@@ -59,6 +60,7 @@ export type SystemPalette = {
|
|
|
59
60
|
__alpha__globalLabel8: string;
|
|
60
61
|
__alpha__globalLabel9: string;
|
|
61
62
|
|
|
63
|
+
__alpha__primary1: string;
|
|
62
64
|
__alpha__primary2: string;
|
|
63
65
|
|
|
64
66
|
__alpha__secondary1: string;
|
|
@@ -4,6 +4,7 @@ import workSystemPalette from './colors/work';
|
|
|
4
4
|
|
|
5
5
|
import { getFonts, getFontSizes, getLineHeights } from './typography';
|
|
6
6
|
import { getSpace } from './space';
|
|
7
|
+
import { getSizes } from './sizes';
|
|
7
8
|
import { getBorderWidths, getRadii } from './borders';
|
|
8
9
|
import type { Scale } from './scale';
|
|
9
10
|
import type { SystemPalette } from './colors/types';
|
|
@@ -14,6 +15,7 @@ const getGlobalTheme = (scale: Scale, systemPalette: SystemPalette) => {
|
|
|
14
15
|
const lineHeights = getLineHeights(fontSizes);
|
|
15
16
|
const borderWidths = getBorderWidths(scale.borderWidth);
|
|
16
17
|
const space = getSpace(scale.space);
|
|
18
|
+
const sizes = getSizes(scale.size);
|
|
17
19
|
const radii = getRadii(scale.radius);
|
|
18
20
|
|
|
19
21
|
return {
|
|
@@ -25,6 +27,7 @@ const getGlobalTheme = (scale: Scale, systemPalette: SystemPalette) => {
|
|
|
25
27
|
lineHeights,
|
|
26
28
|
borderWidths,
|
|
27
29
|
space,
|
|
30
|
+
sizes,
|
|
28
31
|
radii,
|
|
29
32
|
};
|
|
30
33
|
};
|
|
@@ -2,6 +2,8 @@ const BASE_BORDER_WIDTH = 1;
|
|
|
2
2
|
|
|
3
3
|
const BASE_SPACE = 8;
|
|
4
4
|
|
|
5
|
+
const BASE_SIZE = 8;
|
|
6
|
+
|
|
5
7
|
const BASE_FONT = 'BeVietnamPro';
|
|
6
8
|
|
|
7
9
|
const BASE_FONT_SIZE = 10;
|
|
@@ -11,6 +13,7 @@ const BASE_RADIUS = 4;
|
|
|
11
13
|
const scale = {
|
|
12
14
|
borderWidth: BASE_BORDER_WIDTH,
|
|
13
15
|
space: BASE_SPACE,
|
|
16
|
+
size: BASE_SIZE,
|
|
14
17
|
font: BASE_FONT,
|
|
15
18
|
fontSize: BASE_FONT_SIZE,
|
|
16
19
|
radius: BASE_RADIUS,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getSpace } from './space';
|
|
2
|
+
import type { Space } from './space';
|
|
3
|
+
import { scale } from '../../utils/scale';
|
|
4
|
+
|
|
5
|
+
interface Sizes extends Space {
|
|
6
|
+
xxxxxlarge: number;
|
|
7
|
+
'6xlarge': number;
|
|
8
|
+
'7xlarge': number;
|
|
9
|
+
'9xlarge': number;
|
|
10
|
+
'14xlarge': number;
|
|
11
|
+
'15xlarge': number;
|
|
12
|
+
'18xlarge': number;
|
|
13
|
+
'19xlarge': number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const getSizes = (baseSize: number): Sizes => ({
|
|
17
|
+
...getSpace(baseSize),
|
|
18
|
+
xxxxxlarge: scale(baseSize * 8), // 64
|
|
19
|
+
'6xlarge': scale(baseSize * 9), // 72
|
|
20
|
+
'7xlarge': scale(baseSize * 10), // 80
|
|
21
|
+
'9xlarge': scale(baseSize * 12), // 96
|
|
22
|
+
'14xlarge': scale(baseSize * 17), // 136
|
|
23
|
+
'15xlarge': scale(baseSize * 18), // 144
|
|
24
|
+
'18xlarge': scale(baseSize * 21), // 168
|
|
25
|
+
'19xlarge': scale(baseSize * 22), // 176
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export { getSizes };
|
|
29
|
+
export type { Sizes };
|
package/testUtils/setup.tsx
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
/* eslint-disable react/destructuring-assignment */
|
|
3
|
+
/* eslint-disable react/prefer-stateless-function */
|
|
4
|
+
/* eslint-disable max-classes-per-file */
|
|
1
5
|
jest.mock('react-native-vector-icons', () => ({
|
|
2
6
|
createIconSetFromIcoMoon: jest.fn(() => 'HeroIcon'),
|
|
3
7
|
}));
|
|
@@ -52,6 +56,16 @@ jest.mock('@react-native-community/datetimepicker', () => {
|
|
|
52
56
|
};
|
|
53
57
|
});
|
|
54
58
|
|
|
59
|
+
jest.mock('@react-native-community/slider', () => {
|
|
60
|
+
const React = jest.requireActual('react');
|
|
61
|
+
|
|
62
|
+
return class Slider extends React.Component {
|
|
63
|
+
render() {
|
|
64
|
+
return React.createElement('Slider', this.props, this.props.children);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
|
|
55
69
|
jest.mock('react-native-webview', () => {
|
|
56
70
|
const React = jest.requireActual('react');
|
|
57
71
|
|
|
@@ -17,6 +17,10 @@ interface BottomSheetProps {
|
|
|
17
17
|
* Bottom sheet's content.
|
|
18
18
|
*/
|
|
19
19
|
children?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Callback is called when the Bottom Sheet finishes running animation.
|
|
22
|
+
*/
|
|
23
|
+
onAnimationEnd?: () => void;
|
|
20
24
|
/**
|
|
21
25
|
* Callback is called when the Bottom Sheet is opened.
|
|
22
26
|
*/
|
|
@@ -51,5 +55,5 @@ interface BottomSheetProps {
|
|
|
51
55
|
*/
|
|
52
56
|
testID?: string;
|
|
53
57
|
}
|
|
54
|
-
declare const BottomSheet: ({ open, header, footer, children, onOpen, onRequestClose, onDismiss, showCloseButton, hasBackdrop, showDivider, style, testID, }: BottomSheetProps) => JSX.Element;
|
|
58
|
+
declare const BottomSheet: ({ open, header, footer, children, onAnimationEnd, onOpen, onRequestClose, onDismiss, showCloseButton, hasBackdrop, showDivider, style, testID, }: BottomSheetProps) => JSX.Element;
|
|
55
59
|
export default BottomSheet;
|
|
@@ -6,12 +6,6 @@ declare const StyledWrapper: import("@emotion/native").StyledComponent<import("r
|
|
|
6
6
|
}, {}, {
|
|
7
7
|
ref?: import("react").Ref<View>;
|
|
8
8
|
}>;
|
|
9
|
-
declare const StyledIllustration: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
10
|
-
theme?: import("@emotion/react").Theme;
|
|
11
|
-
as?: import("react").ElementType<any>;
|
|
12
|
-
}, {}, {
|
|
13
|
-
ref?: import("react").Ref<View>;
|
|
14
|
-
}>;
|
|
15
9
|
declare const StyledTitle: import("@emotion/native").StyledComponent<import("react-native").TextProps & {
|
|
16
10
|
theme?: import("@emotion/react").Theme;
|
|
17
11
|
as?: import("react").ElementType<any>;
|
|
@@ -28,4 +22,4 @@ declare const StyledDescription: import("@emotion/native").StyledComponent<impor
|
|
|
28
22
|
}, {}, {
|
|
29
23
|
ref?: import("react").Ref<Text>;
|
|
30
24
|
}>;
|
|
31
|
-
export { StyledWrapper,
|
|
25
|
+
export { StyledWrapper, StyledTitle, StyledDescription };
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { StyleProp, ViewStyle, ImageProps as RNImageProps } from 'react-native';
|
|
3
|
+
import { ImageProps } from '../Image';
|
|
2
4
|
interface EmptyProps {
|
|
5
|
+
/**
|
|
6
|
+
* Image to be displayed.
|
|
7
|
+
*/
|
|
8
|
+
image?: ReactElement<ImageProps | RNImageProps>;
|
|
3
9
|
/**
|
|
4
10
|
* Empty's title.
|
|
5
11
|
*/
|
|
@@ -22,5 +28,5 @@ interface EmptyProps {
|
|
|
22
28
|
*/
|
|
23
29
|
testID?: string;
|
|
24
30
|
}
|
|
25
|
-
declare const Empty: ({ title, description, style, testID, variant, }: EmptyProps) => JSX.Element;
|
|
31
|
+
declare const Empty: ({ image, title, description, style, testID, variant, }: EmptyProps) => JSX.Element;
|
|
26
32
|
export default Empty;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ImageProps as RNImageProps } from 'react-native';
|
|
2
|
+
export interface ImageProps extends RNImageProps {
|
|
3
|
+
/**
|
|
4
|
+
* Whether the image is rounded.
|
|
5
|
+
*/
|
|
6
|
+
rounded?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Image sizes, following the same sizes as the `sizes` global theme.
|
|
9
|
+
*/
|
|
10
|
+
size?: '6xlarge' | '15xlarge';
|
|
11
|
+
/**
|
|
12
|
+
* Testing id of the component.
|
|
13
|
+
*/
|
|
14
|
+
testID?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const Image: ({ rounded, size, testID, style, ...imageNativeProps }: ImageProps) => JSX.Element;
|
|
17
|
+
export default Image;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SectionList } from 'react-native';
|
|
1
3
|
import type { MultiSelectProps } from '.';
|
|
2
|
-
import type { OptionType, SectionData } from '../types';
|
|
4
|
+
import type { OptionType, SectionData, SectionType } from '../types';
|
|
3
5
|
declare type OptionListProps<V, T extends OptionType<V>> = Pick<MultiSelectProps<V, T>, 'keyExtractor' | 'loading' | 'onEndReached' | 'onQueryChange' | 'value' | 'renderOption'> & {
|
|
4
6
|
onPress: (value: V[]) => void;
|
|
5
7
|
sections: SectionData<V, T>[];
|
|
8
|
+
sectionListRef?: React.RefObject<SectionList<T, SectionType>>;
|
|
6
9
|
};
|
|
7
|
-
declare const OptionList: <V, T extends OptionType<V>>({ keyExtractor, loading, onEndReached, onPress, onQueryChange, sections, renderOption, value, }: OptionListProps<V, T>) => JSX.Element;
|
|
10
|
+
declare const OptionList: <V, T extends OptionType<V>>({ keyExtractor, loading, onEndReached, onPress, onQueryChange, sections, renderOption, value, sectionListRef, }: OptionListProps<V, T>) => JSX.Element;
|
|
8
11
|
export default OptionList;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TextInputProps as NativeTextInputProps } from 'react-native';
|
|
1
3
|
import type { OptionType, SelectProps } from '../types';
|
|
2
4
|
export interface MultiSelectProps<V, T extends OptionType<V> = OptionType<V>> extends SelectProps<V, T> {
|
|
3
5
|
/**
|
|
@@ -12,6 +14,10 @@ export interface MultiSelectProps<V, T extends OptionType<V> = OptionType<V>> ex
|
|
|
12
14
|
* Footer label.
|
|
13
15
|
*/
|
|
14
16
|
footerLabel: string;
|
|
17
|
+
/**
|
|
18
|
+
* Customise the selected value rendering.
|
|
19
|
+
*/
|
|
20
|
+
renderSelectedValue?: (selectedValue: V[], inputProps: NativeTextInputProps) => React.ReactNode;
|
|
15
21
|
}
|
|
16
|
-
declare function MultiSelect<V, T extends OptionType<V>>({ footerLabel, label, loading, inputProps, onConfirm, onDimiss, onEndReached, onQueryChange, options, renderOption, query, error, editable, disabled, numberOfLines, style, testID, value, }: MultiSelectProps<V, T>): JSX.Element;
|
|
22
|
+
declare function MultiSelect<V, T extends OptionType<V>>({ footerLabel, label, loading, inputProps, onConfirm, onDimiss, onEndReached, onQueryChange, options, renderOption, renderSelectedValue, query, error, editable, disabled, numberOfLines, style, testID, value, }: MultiSelectProps<V, T>): JSX.Element;
|
|
17
23
|
export default MultiSelect;
|