@hero-design/rn 7.20.1 → 7.22.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.js +11 -0
- package/.turbo/turbo-build.log +9 -9
- package/babel.config.js +1 -1
- package/es/index.js +714 -471
- package/lib/index.js +720 -474
- package/package.json +9 -15
- package/rollup.config.js +1 -0
- package/src/components/BottomNavigation/__tests__/index.spec.tsx +1 -1
- package/src/components/BottomNavigation/index.tsx +3 -3
- package/src/components/BottomSheet/index.tsx +6 -1
- package/src/components/Box/helpers.ts +1 -1
- package/src/components/Calendar/index.tsx +9 -9
- 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/Collapse/index.tsx +1 -1
- package/src/components/Drawer/DragableDrawer/helpers.ts +7 -3
- 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/FAB/ActionGroup/index.tsx +1 -1
- package/src/components/Icon/HeroIcon/selection.json +7029 -1
- 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/PinInput/index.tsx +1 -1
- package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +60 -60
- package/src/components/RichTextEditor/EditorToolbar.tsx +3 -3
- package/src/components/RichTextEditor/RichTextEditor.tsx +5 -5
- package/src/components/RichTextEditor/__tests__/EditorToolbar.spec.tsx +2 -2
- package/src/components/RichTextEditor/__tests__/MentionList.spec.tsx +1 -1
- 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 +5 -7
- package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +21 -0
- package/src/components/Select/MultiSelect/index.tsx +35 -5
- 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 +36 -6
- package/src/components/Select/StyledOptionList.tsx +3 -9
- package/src/components/Select/helpers.tsx +4 -4
- 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/SelectorSwitch/Option.tsx +67 -0
- package/src/components/Switch/SelectorSwitch/StyledSelectorSwitch.tsx +25 -0
- package/src/components/Switch/SelectorSwitch/__tests__/Option.spec.tsx +61 -0
- package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/Option.spec.tsx.snap +195 -0
- package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/index.spec.tsx.snap +121 -0
- package/src/components/Switch/SelectorSwitch/__tests__/index.spec.tsx +62 -0
- package/src/components/Switch/SelectorSwitch/index.tsx +60 -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 +9 -5
- package/src/components/Tabs/ScrollableTabs.tsx +12 -5
- package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +1 -1
- package/src/components/Tabs/__tests__/index.spec.tsx +1 -1
- package/src/components/Tabs/index.tsx +13 -6
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +3 -1
- package/src/components/TextInput/__tests__/index.spec.tsx +114 -112
- package/src/components/TextInput/index.tsx +64 -59
- package/src/components/Toast/ToastContainer.tsx +6 -6
- package/src/index.ts +4 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +70 -23
- 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 +28 -17
- 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 +15 -1
- package/tsconfig.json +1 -1
- 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/Switch/SelectorSwitch/Option.d.ts +10 -0
- package/types/components/Switch/SelectorSwitch/StyledSelectorSwitch.d.ts +19 -0
- package/types/components/Switch/SelectorSwitch/__tests__/Option.spec.d.ts +1 -0
- package/types/components/Switch/SelectorSwitch/__tests__/index.spec.d.ts +1 -0
- package/types/components/Switch/SelectorSwitch/index.d.ts +37 -0
- package/types/components/Switch/index.d.ts +5 -3
- package/types/components/Tabs/ScrollableTabs.d.ts +1 -1
- package/types/components/Tabs/index.d.ts +2 -2
- package/types/components/TextInput/index.d.ts +6 -5
- 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 +27 -12
- 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
- package/.eslintrc.json +0 -61
- package/.prettierrc.json +0 -8
|
@@ -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;
|
|
@@ -9,38 +9,49 @@ const getSwitchTheme = (theme: GlobalTheme) => {
|
|
|
9
9
|
'disabled-unchecked': theme.colors.archived,
|
|
10
10
|
},
|
|
11
11
|
thumb: theme.colors.platformBackground,
|
|
12
|
+
selector: {
|
|
13
|
+
background: theme.colors.__alpha__globalNeutral3,
|
|
14
|
+
textBackground: theme.colors.__alpha__primary1,
|
|
15
|
+
},
|
|
12
16
|
};
|
|
13
17
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
const sizes = {
|
|
19
|
+
thumbs: {
|
|
20
|
+
small: theme.sizes.medium,
|
|
21
|
+
medium: theme.sizes.large,
|
|
22
|
+
},
|
|
23
|
+
widths: {
|
|
24
|
+
small: theme.sizes.xxxlarge,
|
|
25
|
+
medium: theme.sizes.xxxxxlarge,
|
|
26
|
+
},
|
|
27
|
+
heights: {
|
|
28
|
+
small: theme.sizes.large,
|
|
29
|
+
medium: theme.sizes.xlarge,
|
|
30
|
+
},
|
|
31
|
+
selector: {
|
|
32
|
+
height: theme.sizes.xxxxlarge,
|
|
33
|
+
},
|
|
27
34
|
};
|
|
28
35
|
|
|
29
36
|
const spaces = {
|
|
30
37
|
small: theme.space.xsmall,
|
|
31
38
|
medium: theme.space.xsmall,
|
|
32
|
-
|
|
39
|
+
selector: {
|
|
40
|
+
iconPadding: theme.space.medium,
|
|
41
|
+
wrapperPadding: theme.space.xsmall,
|
|
42
|
+
},
|
|
33
43
|
};
|
|
34
44
|
|
|
35
45
|
const radii = {
|
|
36
46
|
rounded: theme.radii.rounded,
|
|
47
|
+
selector: {
|
|
48
|
+
default: theme.radii.rounded,
|
|
49
|
+
},
|
|
37
50
|
};
|
|
38
51
|
|
|
39
52
|
return {
|
|
40
53
|
colors,
|
|
41
|
-
|
|
42
|
-
widths,
|
|
43
|
-
heights,
|
|
54
|
+
sizes,
|
|
44
55
|
spaces,
|
|
45
56
|
radii,
|
|
46
57
|
};
|
|
@@ -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
|
}));
|
|
@@ -16,7 +20,7 @@ jest.mock('react-native', () => {
|
|
|
16
20
|
});
|
|
17
21
|
|
|
18
22
|
jest.mock('../src/utils/scale', () => ({
|
|
19
|
-
scale: jest.fn(size => size),
|
|
23
|
+
scale: jest.fn((size) => size),
|
|
20
24
|
}));
|
|
21
25
|
|
|
22
26
|
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
|
|
@@ -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
|
|
package/tsconfig.json
CHANGED
|
@@ -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;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SectionList } from 'react-native';
|
|
1
3
|
import type { SingleSelectProps } 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<SingleSelectProps<V, T>, 'keyExtractor' | 'loading' | 'onEndReached' | 'onQueryChange' | 'value' | 'renderOption'> & {
|
|
4
6
|
onPress: (value: V | null) => 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 SingleSelectProps<V, T extends OptionType<V> = OptionType<V>> extends SelectProps<V, T> {
|
|
3
5
|
/**
|
|
@@ -5,9 +7,13 @@ export interface SingleSelectProps<V, T extends OptionType<V> = OptionType<V>> e
|
|
|
5
7
|
*/
|
|
6
8
|
value: V | null;
|
|
7
9
|
/**
|
|
8
|
-
*
|
|
10
|
+
* On select event handler
|
|
9
11
|
*/
|
|
10
12
|
onConfirm: (value: V | null) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Customise the selected value rendering.
|
|
15
|
+
*/
|
|
16
|
+
renderSelectedValue?: (selectedValue: V | null, inputProps: NativeTextInputProps) => React.ReactNode;
|
|
11
17
|
}
|
|
12
|
-
declare const SingleSelect: <V, T extends OptionType<V>>({ label, loading, inputProps, onConfirm, onDimiss, onEndReached, onQueryChange, options, renderOption, query, error, editable, disabled, numberOfLines, style, testID, value, }: SingleSelectProps<V, T>) => JSX.Element;
|
|
18
|
+
declare const SingleSelect: <V, T extends OptionType<V>>({ label, loading, inputProps, onConfirm, onDimiss, onEndReached, onQueryChange, options, renderOption, renderSelectedValue, query, error, editable, disabled, numberOfLines, style, testID, value, }: SingleSelectProps<V, T>) => JSX.Element;
|
|
13
19
|
export default SingleSelect;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SectionList } from 'react-native';
|
|
1
3
|
import type { ReactElement } from 'react';
|
|
2
4
|
import type { SectionListRenderItemInfo } from 'react-native';
|
|
3
|
-
import type { ScrollParams } from './helpers';
|
|
4
5
|
import type { SectionData, OptionType, SelectProps, SectionType } from './types';
|
|
5
6
|
export declare type StyledOptionListProps<V, T extends OptionType<V>> = Pick<SelectProps<V, T>, 'keyExtractor' | 'loading' | 'onEndReached' | 'onQueryChange'> & {
|
|
6
|
-
scrollParams: ScrollParams;
|
|
7
7
|
sections: SectionData<V, T>[];
|
|
8
8
|
renderItem: (info: SectionListRenderItemInfo<T, SectionType>) => ReactElement;
|
|
9
|
+
sectionListRef?: React.RefObject<SectionList<T, SectionType>>;
|
|
9
10
|
};
|
|
10
|
-
declare const StyledOptionList: <V, T extends OptionType<V>>({ keyExtractor, loading, onEndReached, onQueryChange, sections, renderItem,
|
|
11
|
+
declare const StyledOptionList: <V, T extends OptionType<V>>({ keyExtractor, loading, onEndReached, onQueryChange, sections, renderItem, sectionListRef, }: StyledOptionListProps<V, T>) => JSX.Element;
|
|
11
12
|
export default StyledOptionList;
|
|
@@ -2,7 +2,7 @@ import MultiSelect from './MultiSelect';
|
|
|
2
2
|
import type { MultiSelectProps } from './MultiSelect';
|
|
3
3
|
import type { SingleSelectProps } from './SingleSelect';
|
|
4
4
|
export type { MultiSelectProps, SingleSelectProps };
|
|
5
|
-
declare const _default: (<V, T extends import("./types").OptionType<V>>({ label, loading, inputProps, onConfirm, onDimiss, onEndReached, onQueryChange, options, renderOption, query, error, editable, disabled, numberOfLines, style, testID, value, }: SingleSelectProps<V, T>) => JSX.Element) & {
|
|
5
|
+
declare const _default: (<V, T extends import("./types").OptionType<V>>({ label, loading, inputProps, onConfirm, onDimiss, onEndReached, onQueryChange, options, renderOption, renderSelectedValue, query, error, editable, disabled, numberOfLines, style, testID, value, }: SingleSelectProps<V, T>) => JSX.Element) & {
|
|
6
6
|
Multi: typeof MultiSelect;
|
|
7
7
|
};
|
|
8
8
|
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
export interface SliderProps {
|
|
3
|
+
/**
|
|
4
|
+
* Minimum value of the slider.
|
|
5
|
+
* Defaults to 0.
|
|
6
|
+
*/
|
|
7
|
+
minimumValue?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Maximum value of the slider.
|
|
10
|
+
* Defaults to 1.
|
|
11
|
+
*/
|
|
12
|
+
maximumValue?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Step value of the slider.
|
|
15
|
+
* The value should be between 0 and (maximumValue - minimumValue).
|
|
16
|
+
* Defaults to 0.
|
|
17
|
+
*/
|
|
18
|
+
step?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Value of the slider.
|
|
21
|
+
* Defaults to 0.
|
|
22
|
+
*/
|
|
23
|
+
value?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Callback continuously called while the user is dragging the slider.
|
|
26
|
+
*/
|
|
27
|
+
onValueChange?: (value: number) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Callback that is called when the user picks up the slider.
|
|
30
|
+
* The initial value is passed as an argument to the callback handler.
|
|
31
|
+
*/
|
|
32
|
+
onSlidingStart?: (value: number) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Callback that is called when the user releases the slider, regardless if the value has changed.
|
|
35
|
+
* The current value is passed as an argument to the callback handler.
|
|
36
|
+
*/
|
|
37
|
+
onSlidingComplete?: (value: number) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the slider is disabled.
|
|
40
|
+
*/
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Additional style.
|
|
44
|
+
*/
|
|
45
|
+
style?: StyleProp<ViewStyle>;
|
|
46
|
+
/**
|
|
47
|
+
* Testing id of the component.
|
|
48
|
+
*/
|
|
49
|
+
testID?: string;
|
|
50
|
+
}
|
|
51
|
+
declare const Slider: ({ minimumValue, maximumValue, step, value, onValueChange, onSlidingStart, onSlidingComplete, disabled, style, testID, }: SliderProps) => JSX.Element;
|
|
52
|
+
export default Slider;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { BadgeConfigType, OptionType } from '.';
|
|
3
|
+
export declare const OptionContent: ({ content, badge, }: {
|
|
4
|
+
content: ReactElement;
|
|
5
|
+
badge?: BadgeConfigType;
|
|
6
|
+
}) => JSX.Element;
|
|
7
|
+
declare const Option: <T>({ text, icon, badge, selected, }: Pick<OptionType<T>, "text" | "icon" | "badge"> & {
|
|
8
|
+
selected: boolean;
|
|
9
|
+
}) => ReactElement;
|
|
10
|
+
export default Option;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
export declare const StyledWrapper: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
3
|
+
theme?: import("@emotion/react").Theme;
|
|
4
|
+
as?: import("react").ElementType<any>;
|
|
5
|
+
}, {}, {
|
|
6
|
+
ref?: import("react").Ref<View>;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const StyledTextWrapper: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
9
|
+
theme?: import("@emotion/react").Theme;
|
|
10
|
+
as?: import("react").ElementType<any>;
|
|
11
|
+
}, {}, {
|
|
12
|
+
ref?: import("react").Ref<View>;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const StyledIconWrapper: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
15
|
+
theme?: import("@emotion/react").Theme;
|
|
16
|
+
as?: import("react").ElementType<any>;
|
|
17
|
+
}, {}, {
|
|
18
|
+
ref?: import("react").Ref<View>;
|
|
19
|
+
}>;
|