@hero-design/rn 7.17.1 → 7.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +2 -2
- package/es/index.js +3680 -3449
- package/lib/index.js +3684 -3451
- package/package.json +2 -2
- package/src/components/BottomNavigation/index.tsx +1 -1
- package/src/components/Button/Button.tsx +1 -0
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +2 -2
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +6 -6
- package/src/components/Button/UtilityButton/{styled.tsx → StyledUtilityButton.tsx} +2 -2
- package/src/components/Button/UtilityButton/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
- package/src/components/Button/UtilityButton/index.tsx +5 -1
- package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +14 -14
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +1 -0
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +1 -0
- package/src/components/Drawer/DragableDrawer/__tests__/__snapshots__/index.spec.tsx.snap +99 -0
- package/src/components/Drawer/DragableDrawer/__tests__/helpers.spec.ts +39 -0
- package/src/components/Drawer/DragableDrawer/__tests__/index.spec.tsx +24 -0
- package/src/components/Drawer/DragableDrawer/helpers.ts +43 -0
- package/src/components/Drawer/DragableDrawer/index.tsx +205 -0
- package/src/components/Drawer/StyledDrawer.tsx +70 -26
- package/src/components/Drawer/index.tsx +4 -1
- package/src/components/Empty/StyledEmpty.tsx +4 -3
- package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +1 -0
- package/src/components/Empty/index.tsx +2 -2
- package/src/components/FAB/ActionGroup/index.tsx +1 -1
- package/src/components/List/ListItem.tsx +1 -1
- package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +2 -0
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +5 -0
- package/src/components/Select/MultiSelect/index.tsx +1 -4
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +5 -0
- package/src/components/Select/SingleSelect/index.tsx +2 -6
- package/src/components/Tabs/ScrollableTabs.tsx +1 -1
- package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +8 -0
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +79 -0
- package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +79 -0
- package/src/components/Tabs/__tests__/index.spec.tsx +8 -0
- package/src/components/Tabs/index.tsx +8 -3
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +1 -1
- package/src/components/TextInput/StyledTextInput.tsx +1 -0
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +13 -0
- package/src/components/TextInput/index.tsx +2 -2
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +1 -0
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +1 -0
- package/src/index.ts +9 -1
- package/src/theme/ThemeProvider.ts +19 -0
- package/src/theme/ThemeSwitcher.tsx +27 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +25 -12
- package/src/theme/components/button.ts +9 -8
- package/src/theme/components/drawer.ts +14 -2
- package/src/theme/components/empty.ts +3 -2
- package/src/theme/getTheme.ts +129 -0
- package/src/theme/global/{colors.ts → colors/swag.ts} +8 -5
- package/src/theme/global/colors/types.ts +45 -0
- package/src/theme/global/colors/work.ts +14 -0
- package/src/theme/global/index.ts +6 -2
- package/src/theme/index.ts +16 -143
- package/src/utils/scale.ts +4 -1
- package/types/components/Button/Button.d.ts +1 -0
- package/types/components/Button/UtilityButton/{styled.d.ts → StyledUtilityButton.d.ts} +0 -0
- package/types/components/Drawer/DragableDrawer/__tests__/helpers.spec.d.ts +1 -0
- package/types/components/Drawer/DragableDrawer/__tests__/index.spec.d.ts +1 -0
- package/types/components/Drawer/DragableDrawer/helpers.d.ts +8 -0
- package/types/components/Drawer/DragableDrawer/index.d.ts +33 -0
- package/types/components/Drawer/StyledDrawer.d.ts +34 -4
- package/types/components/Drawer/index.d.ts +4 -2
- package/types/components/Empty/index.d.ts +1 -1
- package/types/components/Icon/utils.d.ts +1 -1
- package/types/index.d.ts +2 -2
- package/types/theme/ThemeProvider.d.ts +12 -0
- package/types/theme/ThemeSwitcher.d.ts +7 -0
- package/types/theme/components/button.d.ts +1 -1
- package/types/theme/components/drawer.d.ts +9 -0
- package/types/theme/components/empty.d.ts +3 -2
- package/types/theme/getTheme.d.ts +74 -0
- package/types/theme/global/colors/swag.d.ts +3 -0
- package/types/theme/global/{colors.d.ts → colors/types.d.ts} +4 -3
- package/types/theme/global/colors/work.d.ts +3 -0
- package/types/theme/global/index.d.ts +7 -2
- package/types/theme/index.d.ts +7 -84
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GlobalTheme,
|
|
3
|
+
Scale,
|
|
4
|
+
SystemPalette,
|
|
5
|
+
getGlobalTheme,
|
|
6
|
+
defaultScale,
|
|
7
|
+
swagSystemPalette,
|
|
8
|
+
} from './global';
|
|
9
|
+
|
|
10
|
+
import getAccordionTheme from './components/accordion';
|
|
11
|
+
import getAlertTheme from './components/alert';
|
|
12
|
+
import getAvatarTheme from './components/avatar';
|
|
13
|
+
import getBadgeTheme from './components/badge';
|
|
14
|
+
import getBottomNavigationTheme from './components/bottomNavigation';
|
|
15
|
+
import getBottomSheetTheme from './components/bottomSheet';
|
|
16
|
+
import getButtonTheme from './components/button';
|
|
17
|
+
import getCalendarTheme from './components/calendar';
|
|
18
|
+
import getCardTheme from './components/card';
|
|
19
|
+
import getCheckboxTheme from './components/checkbox';
|
|
20
|
+
import getContentNavigatorTheme from './components/contentNavigator';
|
|
21
|
+
import getDatePickerTheme from './components/datePicker';
|
|
22
|
+
import getDividerTheme from './components/divider';
|
|
23
|
+
import getDrawerTheme from './components/drawer';
|
|
24
|
+
import getEmptyTheme from './components/empty';
|
|
25
|
+
import getFABTheme from './components/fab';
|
|
26
|
+
import getIconTheme from './components/icon';
|
|
27
|
+
import getListTheme from './components/list';
|
|
28
|
+
import getPinInputTheme from './components/pinInput';
|
|
29
|
+
import getProgressTheme from './components/progress';
|
|
30
|
+
import getRadioTheme from './components/radio';
|
|
31
|
+
import getRichTextEditorTheme from './components/richTextEditor';
|
|
32
|
+
import getSectionHeadingTheme from './components/sectionHeading';
|
|
33
|
+
import getSelectTheme from './components/select';
|
|
34
|
+
import getSpinnerTheme from './components/spinner';
|
|
35
|
+
import getSwitchTheme from './components/switch';
|
|
36
|
+
import getTabsTheme from './components/tabs';
|
|
37
|
+
import getTagTheme from './components/tag';
|
|
38
|
+
import getTextInputTheme from './components/textInput';
|
|
39
|
+
import getTimePickerTheme from './components/timePicker';
|
|
40
|
+
import getToastTheme from './components/toast';
|
|
41
|
+
import getToolbarTheme from './components/toolbar';
|
|
42
|
+
import getTypographyTheme from './components/typography';
|
|
43
|
+
|
|
44
|
+
type Theme = GlobalTheme & {
|
|
45
|
+
__hd__: {
|
|
46
|
+
accordion: ReturnType<typeof getAccordionTheme>;
|
|
47
|
+
alert: ReturnType<typeof getAlertTheme>;
|
|
48
|
+
avatar: ReturnType<typeof getAvatarTheme>;
|
|
49
|
+
badge: ReturnType<typeof getBadgeTheme>;
|
|
50
|
+
bottomNavigation: ReturnType<typeof getBottomNavigationTheme>;
|
|
51
|
+
bottomSheet: ReturnType<typeof getBottomSheetTheme>;
|
|
52
|
+
button: ReturnType<typeof getButtonTheme>;
|
|
53
|
+
calendar: ReturnType<typeof getCalendarTheme>;
|
|
54
|
+
card: ReturnType<typeof getCardTheme>;
|
|
55
|
+
checkbox: ReturnType<typeof getCheckboxTheme>;
|
|
56
|
+
contentNavigator: ReturnType<typeof getContentNavigatorTheme>;
|
|
57
|
+
datePicker: ReturnType<typeof getDatePickerTheme>;
|
|
58
|
+
divider: ReturnType<typeof getDividerTheme>;
|
|
59
|
+
drawer: ReturnType<typeof getDrawerTheme>;
|
|
60
|
+
empty: ReturnType<typeof getEmptyTheme>;
|
|
61
|
+
fab: ReturnType<typeof getFABTheme>;
|
|
62
|
+
icon: ReturnType<typeof getIconTheme>;
|
|
63
|
+
list: ReturnType<typeof getListTheme>;
|
|
64
|
+
pinInput: ReturnType<typeof getPinInputTheme>;
|
|
65
|
+
progress: ReturnType<typeof getProgressTheme>;
|
|
66
|
+
radio: ReturnType<typeof getRadioTheme>;
|
|
67
|
+
richTextEditor: ReturnType<typeof getRichTextEditorTheme>;
|
|
68
|
+
sectionHeading: ReturnType<typeof getSectionHeadingTheme>;
|
|
69
|
+
select: ReturnType<typeof getSelectTheme>;
|
|
70
|
+
spinner: ReturnType<typeof getSpinnerTheme>;
|
|
71
|
+
switch: ReturnType<typeof getSwitchTheme>;
|
|
72
|
+
tabs: ReturnType<typeof getTabsTheme>;
|
|
73
|
+
tag: ReturnType<typeof getTagTheme>;
|
|
74
|
+
textInput: ReturnType<typeof getTextInputTheme>;
|
|
75
|
+
timePicker: ReturnType<typeof getTimePickerTheme>;
|
|
76
|
+
toast: ReturnType<typeof getToastTheme>;
|
|
77
|
+
toolbar: ReturnType<typeof getToolbarTheme>;
|
|
78
|
+
typography: ReturnType<typeof getTypographyTheme>;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const getTheme = (
|
|
83
|
+
scale: Scale = defaultScale,
|
|
84
|
+
systemPallete: SystemPalette = swagSystemPalette
|
|
85
|
+
): Theme => {
|
|
86
|
+
const globalTheme = getGlobalTheme(scale, systemPallete);
|
|
87
|
+
return {
|
|
88
|
+
...globalTheme,
|
|
89
|
+
__hd__: {
|
|
90
|
+
accordion: getAccordionTheme(globalTheme),
|
|
91
|
+
avatar: getAvatarTheme(globalTheme),
|
|
92
|
+
alert: getAlertTheme(globalTheme),
|
|
93
|
+
badge: getBadgeTheme(globalTheme),
|
|
94
|
+
bottomNavigation: getBottomNavigationTheme(globalTheme),
|
|
95
|
+
bottomSheet: getBottomSheetTheme(globalTheme),
|
|
96
|
+
button: getButtonTheme(globalTheme),
|
|
97
|
+
calendar: getCalendarTheme(globalTheme),
|
|
98
|
+
card: getCardTheme(globalTheme),
|
|
99
|
+
checkbox: getCheckboxTheme(globalTheme),
|
|
100
|
+
contentNavigator: getContentNavigatorTheme(globalTheme),
|
|
101
|
+
datePicker: getDatePickerTheme(),
|
|
102
|
+
divider: getDividerTheme(globalTheme),
|
|
103
|
+
drawer: getDrawerTheme(globalTheme),
|
|
104
|
+
empty: getEmptyTheme(globalTheme),
|
|
105
|
+
fab: getFABTheme(globalTheme),
|
|
106
|
+
icon: getIconTheme(globalTheme),
|
|
107
|
+
list: getListTheme(globalTheme),
|
|
108
|
+
pinInput: getPinInputTheme(globalTheme),
|
|
109
|
+
progress: getProgressTheme(globalTheme),
|
|
110
|
+
radio: getRadioTheme(globalTheme),
|
|
111
|
+
richTextEditor: getRichTextEditorTheme(globalTheme),
|
|
112
|
+
sectionHeading: getSectionHeadingTheme(globalTheme),
|
|
113
|
+
select: getSelectTheme(globalTheme),
|
|
114
|
+
spinner: getSpinnerTheme(globalTheme),
|
|
115
|
+
switch: getSwitchTheme(globalTheme),
|
|
116
|
+
tabs: getTabsTheme(globalTheme),
|
|
117
|
+
tag: getTagTheme(globalTheme),
|
|
118
|
+
textInput: getTextInputTheme(globalTheme),
|
|
119
|
+
timePicker: getTimePickerTheme(),
|
|
120
|
+
toast: getToastTheme(globalTheme),
|
|
121
|
+
toolbar: getToolbarTheme(globalTheme),
|
|
122
|
+
typography: getTypographyTheme(globalTheme),
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export { Theme };
|
|
128
|
+
|
|
129
|
+
export default getTheme;
|
|
@@ -3,7 +3,12 @@ import {
|
|
|
3
3
|
swagPalette,
|
|
4
4
|
} from '@hero-design/colors';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import { SystemPalette } from './types';
|
|
7
|
+
|
|
8
|
+
const swagSystemPalette: SystemPalette = {
|
|
9
|
+
globalPrimary: palette.maasstrichtBlue,
|
|
10
|
+
globalPrimaryLight: palette.maasstrichtBlueLight50,
|
|
11
|
+
globalPrimaryBackground: palette.maasstrichtBlueLight90,
|
|
7
12
|
primary: swagPalette.violet,
|
|
8
13
|
primaryLight: swagPalette.violetLight50, // no longer needed after revising Button
|
|
9
14
|
primaryDark: swagPalette.scarletGumLight30, // DEPRECATED
|
|
@@ -40,12 +45,10 @@ const systemPalette = {
|
|
|
40
45
|
archived: palette.greyLight45, // no usage
|
|
41
46
|
archivedLight: palette.greyLight30,
|
|
42
47
|
archivedDark: palette.sonicSilver, // should replace archived as archived has no usage?
|
|
43
|
-
archivedBackground: palette.
|
|
48
|
+
archivedBackground: palette.greyLight90,
|
|
44
49
|
black: palette.black,
|
|
45
50
|
inactiveBackground: palette.maasstrichtBlueLight50,
|
|
46
51
|
shadow: palette.greyLight45, // waiting for new color
|
|
47
52
|
};
|
|
48
53
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
export { systemPalette, SystemPalette };
|
|
54
|
+
export default swagSystemPalette;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type SystemPalette = {
|
|
2
|
+
globalPrimary: string;
|
|
3
|
+
globalPrimaryLight: string;
|
|
4
|
+
globalPrimaryBackground: string;
|
|
5
|
+
primary: string;
|
|
6
|
+
primaryLight: string;
|
|
7
|
+
primaryDark: string;
|
|
8
|
+
primaryBackground: string;
|
|
9
|
+
primaryBackgroundDark: string;
|
|
10
|
+
secondary: string;
|
|
11
|
+
secondaryLight: string;
|
|
12
|
+
secondaryBackground: string;
|
|
13
|
+
info: string;
|
|
14
|
+
infoMediumLight: string;
|
|
15
|
+
infoLight: string;
|
|
16
|
+
infoBackground: string;
|
|
17
|
+
success: string;
|
|
18
|
+
successLight: string;
|
|
19
|
+
successDark: string;
|
|
20
|
+
successBackground: string;
|
|
21
|
+
danger: string;
|
|
22
|
+
dangerMediumLight: string;
|
|
23
|
+
dangerLight: string;
|
|
24
|
+
dangerBackground: string;
|
|
25
|
+
warning: string;
|
|
26
|
+
warningLight: string;
|
|
27
|
+
warningDark: string;
|
|
28
|
+
warningBackground: string;
|
|
29
|
+
platformBackground: string;
|
|
30
|
+
backgroundLight: string;
|
|
31
|
+
backgroundDark: string;
|
|
32
|
+
text: string;
|
|
33
|
+
subduedText: string;
|
|
34
|
+
disabledText: string;
|
|
35
|
+
disabledLightText: string;
|
|
36
|
+
invertedText: string;
|
|
37
|
+
outline: string;
|
|
38
|
+
archived: string;
|
|
39
|
+
archivedLight: string;
|
|
40
|
+
archivedDark: string;
|
|
41
|
+
archivedBackground: string;
|
|
42
|
+
black: string;
|
|
43
|
+
inactiveBackground: string;
|
|
44
|
+
shadow: string;
|
|
45
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { workPalette } from '@hero-design/colors';
|
|
2
|
+
|
|
3
|
+
import { SystemPalette } from './types';
|
|
4
|
+
import swag from './swag';
|
|
5
|
+
|
|
6
|
+
const workSystemPalette: SystemPalette = {
|
|
7
|
+
...swag,
|
|
8
|
+
primary: workPalette.gold,
|
|
9
|
+
primaryLight: workPalette.goldLight50,
|
|
10
|
+
primaryDark: workPalette.goldLight20,
|
|
11
|
+
primaryBackground: workPalette.goldLight90,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default workSystemPalette;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { scale as defaultScale, Scale } from './scale';
|
|
2
|
-
import {
|
|
2
|
+
import { SystemPalette } from './colors/types';
|
|
3
|
+
import swagSystemPalette from './colors/swag';
|
|
4
|
+
import workSystemPalette from './colors/work';
|
|
5
|
+
|
|
3
6
|
import { getFonts, getFontSizes, getLineHeights } from './typography';
|
|
4
7
|
import { getSpace } from './space';
|
|
5
8
|
import { getBorderWidths, getRadii } from './borders';
|
|
@@ -33,5 +36,6 @@ export {
|
|
|
33
36
|
SystemPalette,
|
|
34
37
|
getGlobalTheme,
|
|
35
38
|
defaultScale,
|
|
36
|
-
|
|
39
|
+
swagSystemPalette,
|
|
40
|
+
workSystemPalette,
|
|
37
41
|
};
|
package/src/theme/index.ts
CHANGED
|
@@ -1,145 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import getBottomNavigationTheme from './components/bottomNavigation';
|
|
17
|
-
import getBottomSheetTheme from './components/bottomSheet';
|
|
18
|
-
import getButtonTheme from './components/button';
|
|
19
|
-
import getCalendarTheme from './components/calendar';
|
|
20
|
-
import getCardTheme from './components/card';
|
|
21
|
-
import getCheckboxTheme from './components/checkbox';
|
|
22
|
-
import getContentNavigatorTheme from './components/contentNavigator';
|
|
23
|
-
import getDatePickerTheme from './components/datePicker';
|
|
24
|
-
import getDividerTheme from './components/divider';
|
|
25
|
-
import getDrawerTheme from './components/drawer';
|
|
26
|
-
import getEmptyTheme from './components/empty';
|
|
27
|
-
import getFABTheme from './components/fab';
|
|
28
|
-
import getIconTheme from './components/icon';
|
|
29
|
-
import getListTheme from './components/list';
|
|
30
|
-
import getPinInputTheme from './components/pinInput';
|
|
31
|
-
import getProgressTheme from './components/progress';
|
|
32
|
-
import getRadioTheme from './components/radio';
|
|
33
|
-
import getRichTextEditorTheme from './components/richTextEditor';
|
|
34
|
-
import getSectionHeadingTheme from './components/sectionHeading';
|
|
35
|
-
import getSelectTheme from './components/select';
|
|
36
|
-
import getSpinnerTheme from './components/spinner';
|
|
37
|
-
import getSwitchTheme from './components/switch';
|
|
38
|
-
import getTabsTheme from './components/tabs';
|
|
39
|
-
import getTagTheme from './components/tag';
|
|
40
|
-
import getTextInputTheme from './components/textInput';
|
|
41
|
-
import getTimePickerTheme from './components/timePicker';
|
|
42
|
-
import getToastTheme from './components/toast';
|
|
43
|
-
import getToolbarTheme from './components/toolbar';
|
|
44
|
-
import getTypographyTheme from './components/typography';
|
|
45
|
-
|
|
46
|
-
type Theme = GlobalTheme & {
|
|
47
|
-
__hd__: {
|
|
48
|
-
accordion: ReturnType<typeof getAccordionTheme>;
|
|
49
|
-
alert: ReturnType<typeof getAlertTheme>;
|
|
50
|
-
avatar: ReturnType<typeof getAvatarTheme>;
|
|
51
|
-
badge: ReturnType<typeof getBadgeTheme>;
|
|
52
|
-
bottomNavigation: ReturnType<typeof getBottomNavigationTheme>;
|
|
53
|
-
bottomSheet: ReturnType<typeof getBottomSheetTheme>;
|
|
54
|
-
button: ReturnType<typeof getButtonTheme>;
|
|
55
|
-
calendar: ReturnType<typeof getCalendarTheme>;
|
|
56
|
-
card: ReturnType<typeof getCardTheme>;
|
|
57
|
-
checkbox: ReturnType<typeof getCheckboxTheme>;
|
|
58
|
-
contentNavigator: ReturnType<typeof getContentNavigatorTheme>;
|
|
59
|
-
datePicker: ReturnType<typeof getDatePickerTheme>;
|
|
60
|
-
divider: ReturnType<typeof getDividerTheme>;
|
|
61
|
-
drawer: ReturnType<typeof getDrawerTheme>;
|
|
62
|
-
empty: ReturnType<typeof getEmptyTheme>;
|
|
63
|
-
fab: ReturnType<typeof getFABTheme>;
|
|
64
|
-
icon: ReturnType<typeof getIconTheme>;
|
|
65
|
-
list: ReturnType<typeof getListTheme>;
|
|
66
|
-
pinInput: ReturnType<typeof getPinInputTheme>;
|
|
67
|
-
progress: ReturnType<typeof getProgressTheme>;
|
|
68
|
-
radio: ReturnType<typeof getRadioTheme>;
|
|
69
|
-
richTextEditor: ReturnType<typeof getRichTextEditorTheme>;
|
|
70
|
-
sectionHeading: ReturnType<typeof getSectionHeadingTheme>;
|
|
71
|
-
select: ReturnType<typeof getSelectTheme>;
|
|
72
|
-
spinner: ReturnType<typeof getSpinnerTheme>;
|
|
73
|
-
switch: ReturnType<typeof getSwitchTheme>;
|
|
74
|
-
tabs: ReturnType<typeof getTabsTheme>;
|
|
75
|
-
tag: ReturnType<typeof getTagTheme>;
|
|
76
|
-
textInput: ReturnType<typeof getTextInputTheme>;
|
|
77
|
-
timePicker: ReturnType<typeof getTimePickerTheme>;
|
|
78
|
-
toast: ReturnType<typeof getToastTheme>;
|
|
79
|
-
toolbar: ReturnType<typeof getToolbarTheme>;
|
|
80
|
-
typography: ReturnType<typeof getTypographyTheme>;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const getTheme = (
|
|
85
|
-
scale: Scale = defaultScale,
|
|
86
|
-
systemPallete: SystemPalette = defaultSystemPalette
|
|
87
|
-
): Theme => {
|
|
88
|
-
const globalTheme = getGlobalTheme(scale, systemPallete);
|
|
89
|
-
return {
|
|
90
|
-
...globalTheme,
|
|
91
|
-
__hd__: {
|
|
92
|
-
accordion: getAccordionTheme(globalTheme),
|
|
93
|
-
avatar: getAvatarTheme(globalTheme),
|
|
94
|
-
alert: getAlertTheme(globalTheme),
|
|
95
|
-
badge: getBadgeTheme(globalTheme),
|
|
96
|
-
bottomNavigation: getBottomNavigationTheme(globalTheme),
|
|
97
|
-
bottomSheet: getBottomSheetTheme(globalTheme),
|
|
98
|
-
button: getButtonTheme(globalTheme),
|
|
99
|
-
calendar: getCalendarTheme(globalTheme),
|
|
100
|
-
card: getCardTheme(globalTheme),
|
|
101
|
-
checkbox: getCheckboxTheme(globalTheme),
|
|
102
|
-
contentNavigator: getContentNavigatorTheme(globalTheme),
|
|
103
|
-
datePicker: getDatePickerTheme(),
|
|
104
|
-
divider: getDividerTheme(globalTheme),
|
|
105
|
-
drawer: getDrawerTheme(globalTheme),
|
|
106
|
-
empty: getEmptyTheme(globalTheme),
|
|
107
|
-
fab: getFABTheme(globalTheme),
|
|
108
|
-
icon: getIconTheme(globalTheme),
|
|
109
|
-
list: getListTheme(globalTheme),
|
|
110
|
-
pinInput: getPinInputTheme(globalTheme),
|
|
111
|
-
progress: getProgressTheme(globalTheme),
|
|
112
|
-
radio: getRadioTheme(globalTheme),
|
|
113
|
-
richTextEditor: getRichTextEditorTheme(globalTheme),
|
|
114
|
-
sectionHeading: getSectionHeadingTheme(globalTheme),
|
|
115
|
-
select: getSelectTheme(globalTheme),
|
|
116
|
-
spinner: getSpinnerTheme(globalTheme),
|
|
117
|
-
switch: getSwitchTheme(globalTheme),
|
|
118
|
-
tabs: getTabsTheme(globalTheme),
|
|
119
|
-
tag: getTagTheme(globalTheme),
|
|
120
|
-
textInput: getTextInputTheme(globalTheme),
|
|
121
|
-
timePicker: getTimePickerTheme(),
|
|
122
|
-
toast: getToastTheme(globalTheme),
|
|
123
|
-
toolbar: getToolbarTheme(globalTheme),
|
|
124
|
-
typography: getTypographyTheme(globalTheme),
|
|
125
|
-
},
|
|
126
|
-
};
|
|
1
|
+
import getTheme, { Theme } from './getTheme';
|
|
2
|
+
import ThemeProvider, { useTheme } from './ThemeProvider';
|
|
3
|
+
import ThemeSwitcher from './ThemeSwitcher';
|
|
4
|
+
import { swagSystemPalette, workSystemPalette } from './global';
|
|
5
|
+
|
|
6
|
+
const defaultTheme = getTheme();
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
Theme,
|
|
10
|
+
getTheme,
|
|
11
|
+
ThemeProvider,
|
|
12
|
+
ThemeSwitcher,
|
|
13
|
+
useTheme,
|
|
14
|
+
swagSystemPalette,
|
|
15
|
+
workSystemPalette,
|
|
127
16
|
};
|
|
128
17
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
export interface ThemeProviderProps {
|
|
132
|
-
theme: Partial<Theme> | ((outerTheme: Theme) => Theme);
|
|
133
|
-
children: React.ReactNode;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
interface ThemeProviderType {
|
|
137
|
-
(props: ThemeProviderProps): React.ReactElement;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const ThemeProvider = Emotion.ThemeProvider as ThemeProviderType;
|
|
141
|
-
|
|
142
|
-
const useTheme = Emotion.useTheme as () => Theme;
|
|
143
|
-
export { Theme, getTheme, ThemeProvider, useTheme };
|
|
144
|
-
|
|
145
|
-
export default theme;
|
|
18
|
+
export default defaultTheme;
|
package/src/utils/scale.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { Dimensions } from 'react-native';
|
|
1
|
+
import { Dimensions, Platform } from 'react-native';
|
|
2
2
|
|
|
3
3
|
export const BASE_WIDTH = 390; // Based on iPhone 13's viewport size
|
|
4
4
|
|
|
5
5
|
export const horizontalScale = (size: number) => {
|
|
6
|
+
if (Platform.OS === 'web') {
|
|
7
|
+
return size;
|
|
8
|
+
}
|
|
6
9
|
const { width, height } = Dimensions.get('window');
|
|
7
10
|
const shortDimension = width < height ? width : height;
|
|
8
11
|
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const getOffset: (height: number, percentage: number) => number;
|
|
2
|
+
export declare type SnapPointsData = {
|
|
3
|
+
list: number[];
|
|
4
|
+
minHeightOffset: number;
|
|
5
|
+
maxHeightOffset: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const calculateSnapPointsData: (minimumHeight: number, height: number, snapPoints: number[]) => SnapPointsData;
|
|
8
|
+
export declare const calculateAnimatedToValue: (position: number, heightSnapPoints: number[]) => number;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface DragableDrawerProps {
|
|
3
|
+
/**
|
|
4
|
+
* Drawer's content.
|
|
5
|
+
*/
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Initial visible height percentage of the drawer. Can be used to programmatically control the drawer height. Range: [0,100].
|
|
9
|
+
*/
|
|
10
|
+
initialHeightPercentage?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Mininum visible height percentage of the drawer. This will be the lowest point in snap points list. Range: [0,100].
|
|
13
|
+
*/
|
|
14
|
+
minimumHeightPercentage?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Callback function is called when the drawer expand to max position.
|
|
17
|
+
*/
|
|
18
|
+
onExpanded?: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Callback function is called when the drawer collapsed to min position.
|
|
21
|
+
*/
|
|
22
|
+
onCollapsed?: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Testing id of the component.
|
|
25
|
+
*/
|
|
26
|
+
testID?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Nearest height snap points that the drawer will attach to on release gesture. Range: [0,100]
|
|
29
|
+
*/
|
|
30
|
+
snapPoints?: number[];
|
|
31
|
+
}
|
|
32
|
+
declare const DragableDrawer: ({ children, initialHeightPercentage, minimumHeightPercentage, snapPoints, onExpanded, onCollapsed, testID, }: DragableDrawerProps) => JSX.Element;
|
|
33
|
+
export default DragableDrawer;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import { Animated, View } from 'react-native';
|
|
2
|
-
declare const StyledContainer: import("@emotion/native").StyledComponent<
|
|
1
|
+
import { Animated, View, ViewProps } from 'react-native';
|
|
2
|
+
declare const StyledContainer: import("@emotion/native").StyledComponent<ViewProps & {
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
} & {
|
|
6
|
+
enableShadow: boolean;
|
|
7
|
+
}, {}, {
|
|
8
|
+
ref?: import("react").Ref<View> | undefined;
|
|
9
|
+
}>;
|
|
10
|
+
declare const StyledDragableContainer: import("@emotion/native").StyledComponent<ViewProps & {
|
|
3
11
|
theme?: import("@emotion/react").Theme | undefined;
|
|
4
12
|
as?: import("react").ElementType<any> | undefined;
|
|
5
13
|
} & {
|
|
@@ -13,7 +21,7 @@ declare const StyledBackdrop: import("@emotion/native").StyledComponent<Animated
|
|
|
13
21
|
theme?: import("@emotion/react").Theme | undefined;
|
|
14
22
|
as?: import("react").ElementType<any> | undefined;
|
|
15
23
|
}, {}, {}>;
|
|
16
|
-
declare const StyledDrawerContainer: import("@emotion/native").StyledComponent<Animated.AnimatedProps<
|
|
24
|
+
declare const StyledDrawerContainer: import("@emotion/native").StyledComponent<Animated.AnimatedProps<ViewProps & import("react").RefAttributes<View>> & {
|
|
17
25
|
children?: import("react").ReactNode;
|
|
18
26
|
} & {
|
|
19
27
|
theme?: import("@emotion/react").Theme | undefined;
|
|
@@ -21,4 +29,26 @@ declare const StyledDrawerContainer: import("@emotion/native").StyledComponent<A
|
|
|
21
29
|
} & {
|
|
22
30
|
enableShadow: boolean;
|
|
23
31
|
}, {}, {}>;
|
|
24
|
-
|
|
32
|
+
declare const StyledDragableDrawerContainer: import("@emotion/native").StyledComponent<Animated.AnimatedProps<ViewProps & import("react").RefAttributes<View>> & {
|
|
33
|
+
children?: import("react").ReactNode;
|
|
34
|
+
} & {
|
|
35
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
36
|
+
as?: import("react").ElementType<any> | undefined;
|
|
37
|
+
} & {
|
|
38
|
+
enableShadow: boolean;
|
|
39
|
+
}, {}, {}>;
|
|
40
|
+
declare const StyledHandlerContainer: import("@emotion/native").StyledComponent<ViewProps & {
|
|
41
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
42
|
+
as?: import("react").ElementType<any> | undefined;
|
|
43
|
+
}, {}, {
|
|
44
|
+
ref?: import("react").Ref<View> | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
declare const StyledHandler: import("@emotion/native").StyledComponent<ViewProps & {
|
|
47
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
48
|
+
as?: import("react").ElementType<any> | undefined;
|
|
49
|
+
} & {
|
|
50
|
+
active?: boolean | undefined;
|
|
51
|
+
}, {}, {
|
|
52
|
+
ref?: import("react").Ref<View> | undefined;
|
|
53
|
+
}>;
|
|
54
|
+
export { StyledBackdrop, StyledContainer, StyledDrawerContainer, StyledHandlerContainer, StyledHandler, StyledDragableContainer, StyledDragableDrawerContainer, };
|
|
@@ -21,5 +21,7 @@ interface DrawerProps {
|
|
|
21
21
|
* */
|
|
22
22
|
testID?: string;
|
|
23
23
|
}
|
|
24
|
-
declare const
|
|
25
|
-
|
|
24
|
+
declare const _default: (({ visible, children, hasBackdrop, onDismiss, testID, }: DrawerProps) => JSX.Element) & {
|
|
25
|
+
Dragable: ({ children, initialHeightPercentage, minimumHeightPercentage, snapPoints, onExpanded, onCollapsed, testID, }: import("./DragableDrawer").DragableDrawerProps) => JSX.Element;
|
|
26
|
+
};
|
|
27
|
+
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const isHeroIcon: (x: any) => x is "number" | "
|
|
1
|
+
declare const isHeroIcon: (x: any) => x is "number" | "swag" | "bold" | "menu" | "image" | "switch" | "list" | "warning" | "activate" | "add-emoji" | "add-person" | "adjustment" | "alignment" | "archive" | "bank" | "bell" | "billing" | "bookmark" | "box-check" | "box" | "buildings" | "cake" | "calendar-clock" | "calendar" | "candy-box-menu" | "carat-down-small" | "carat-down" | "carat-left" | "carat-right" | "carat-up" | "circle-add" | "circle-cancel" | "circle-check" | "circle-down" | "circle-info" | "circle-left" | "circle-ok" | "circle-pencil" | "circle-question" | "circle-remove" | "circle-right" | "circle-up" | "circle-warning" | "clock" | "clock-3" | "cloud-download" | "cloud-upload" | "cog" | "coin" | "contacts" | "credit-card" | "diamond" | "direction-arrows" | "directory" | "document" | "dollar-coin-shine" | "double-buildings" | "edit-template" | "envelope" | "expense" | "eye-circle" | "eye-invisible" | "eye" | "face-meh" | "face-sad" | "face-smiley" | "feed" | "feedbacks" | "file-certified" | "file-clone" | "file-copy" | "file-csv" | "file-dispose" | "file-doc" | "file-excel" | "file-export" | "file-lock" | "file-pdf" | "file-powerpoint" | "file-search" | "file-secured" | "file-sheets" | "file-slide" | "file-verified" | "file-word" | "file" | "filter-outlined" | "folder-user" | "folder" | "format-bold" | "format-heading1" | "format-heading2" | "format-italic" | "format-list-bulleted" | "format-list-numbered" | "format-underlined" | "funnel-filter" | "global-dollar" | "globe" | "graduation-cap" | "graph" | "happy-sun" | "health-bag" | "heart" | "home" | "import" | "incident-siren" | "instapay" | "loading" | "loading-2" | "location" | "lock" | "looks-one" | "looks-two" | "mandatory" | "media-content" | "moneybag" | "moon" | "multiple-stars" | "multiple-users" | "node" | "open-folder" | "paperclip" | "payment-summary" | "pencil" | "phone" | "piggy-bank" | "plane" | "play-circle" | "print" | "raising-hands" | "reply" | "reply-arrow" | "reschedule" | "rostering" | "save" | "schedule-send" | "schedule" | "search-person" | "send" | "speaker" | "star-award" | "star-badge" | "star-medal" | "star" | "steps-circle" | "stopwatch" | "suitcase" | "survey" | "tag" | "target" | "teams" | "timesheet" | "touch-id" | "trash-bin" | "unlock" | "user" | "video-1" | "video-2" | "activate-outlined" | "add-person-outlined" | "add-section-outlined" | "add-time-outlined" | "add" | "adjustment-outlined" | "alignment-2-outlined" | "alignment-outlined" | "all-caps" | "arrow-down" | "arrow-left" | "arrow-right" | "arrow-up" | "at-sign" | "bell-outlined" | "billing-outlined" | "body-outlined" | "bookmark-outlined" | "box-check-outlined" | "box-outlined" | "bullet-points" | "cake-outlined" | "calendar-dates-outlined" | "calendar-star-outlined" | "camera-outlined" | "cancel" | "checkmark" | "circle-add-outlined" | "circle-cancel-outlined" | "circle-down-outlined" | "circle-info-outlined" | "circle-left-outlined" | "circle-ok-outlined" | "circle-question-outlined" | "circle-remove-outlined" | "circle-right-outlined" | "circle-up-outlined" | "circle-warning-outlined" | "clock-2-outlined" | "clock-outlined" | "cog-outlined" | "coin-outlined" | "comment-outlined" | "contacts-outlined" | "credit-card-outlined" | "direction-arrows-outlined" | "directory-outlined" | "document-outlined" | "dollar-coin-shine-outlined" | "dollar-sign" | "double-buildings-outlined" | "double-left-arrows" | "double-right-arrows" | "download-outlined" | "edit-template-outlined" | "email-outlined" | "enter-arrow" | "envelope-outlined" | "expense-outlined" | "external-link" | "eye-invisible-outlined" | "eye-outlined" | "face-id" | "face-meh-outlined" | "face-open-smiley-outlined" | "face-sad-outlined" | "face-smiley-outlined" | "feed-outlined" | "file-certified-outlined" | "file-clone-outlined" | "file-copy-outlined" | "file-dispose-outlined" | "file-download-outlined" | "file-export-outlined" | "file-lock-outlined" | "file-outlined" | "file-search-outlined" | "file-secured-outlined" | "file-verified-outlined" | "folder-outlined" | "folder-user-outlined" | "funnel-filter-outline" | "graph-outlined" | "happy-sun-outlined" | "health-bag-outlined" | "heart-outlined" | "home-outlined" | "image-outlined" | "import-outlined" | "instapay-outlined" | "italic" | "link-1" | "link-2" | "list-outlined" | "location-outlined" | "lock-outlined" | "locked-file-outlined" | "log-out" | "media-content-outlined" | "menu-close" | "menu-expand" | "menu-fold-outlined" | "menu-unfold-outlined" | "moneybag-outlined" | "moon-outlined" | "more-horizontal" | "more-vertical" | "multiple-folders-outlined" | "multiple-users-outlined" | "node-outlined" | "number-points" | "payment-summary-outlined" | "payslip-outlined" | "pencil-outlined" | "percentage" | "phone-outlined" | "piggy-bank-outlined" | "plane-outlined" | "play-circle-outlined" | "print-outlined" | "qr-code-outlined" | "re-assign" | "redeem" | "refresh" | "remove" | "reply-outlined" | "restart" | "return-arrow" | "rostering-outlined" | "save-outlined" | "schedule-outlined" | "search-outlined" | "send-outlined" | "share-1" | "share-2" | "single-down-arrow" | "single-left-arrow" | "single-right-arrow" | "single-up-arrow" | "speaker-outlined" | "star-outlined" | "stopwatch-outlined" | "strikethrough" | "suitcase-outlined" | "survey-outlined" | "switch-outlined" | "sync" | "target-outlined" | "timesheet-outlined" | "transfer" | "trash-bin-outlined" | "unavailable" | "underline" | "unlock-outlined" | "upload-outlined" | "user-circle-outlined" | "user-outlined" | "user-rectangle-outlined" | "video-1-outlined" | "video-2-outlined" | "wallet-outlined";
|
|
2
2
|
export { isHeroIcon };
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import theme, { getTheme, ThemeProvider, useTheme } from './theme';
|
|
1
|
+
import theme, { getTheme, ThemeProvider, useTheme, swagSystemPalette, workSystemPalette } from './theme';
|
|
2
2
|
import { scale } from './utils/scale';
|
|
3
3
|
import Accordion from './components/Accordion';
|
|
4
4
|
import Alert from './components/Alert';
|
|
@@ -34,5 +34,5 @@ import Toast from './components/Toast';
|
|
|
34
34
|
import Toolbar from './components/Toolbar';
|
|
35
35
|
import Typography from './components/Typography';
|
|
36
36
|
import RichTextEditor from './components/RichTextEditor';
|
|
37
|
-
export { theme, getTheme, useTheme, scale, ThemeProvider, Accordion, Alert, Avatar, Badge, BottomNavigation, BottomSheet, Button, Calendar, Card, Collapse, Checkbox, ContentNavigator, DatePicker, Divider, Drawer, Empty, FAB, Icon, List, PinInput, Progress, Spinner, Radio, SectionHeading, Select, Switch, Tabs, Tag, TextInput, TimePicker, Toast, Toolbar, Typography, RichTextEditor, };
|
|
37
|
+
export { theme, getTheme, useTheme, scale, ThemeProvider, swagSystemPalette, workSystemPalette, Accordion, Alert, Avatar, Badge, BottomNavigation, BottomSheet, Button, Calendar, Card, Collapse, Checkbox, ContentNavigator, DatePicker, Divider, Drawer, Empty, FAB, Icon, List, PinInput, Progress, Spinner, Radio, SectionHeading, Select, Switch, Tabs, Tag, TextInput, TimePicker, Toast, Toolbar, Typography, RichTextEditor, };
|
|
38
38
|
export * from './types';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Theme } from './getTheme';
|
|
2
|
+
export interface ThemeProviderProps {
|
|
3
|
+
theme: Partial<Theme> | ((outerTheme: Theme) => Theme);
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
interface ThemeProviderType {
|
|
7
|
+
(props: ThemeProviderProps): React.ReactElement;
|
|
8
|
+
}
|
|
9
|
+
declare const ThemeProvider: ThemeProviderType;
|
|
10
|
+
declare const useTheme: () => Theme;
|
|
11
|
+
export { useTheme };
|
|
12
|
+
export default ThemeProvider;
|
|
@@ -5,6 +5,7 @@ declare const getButtonTheme: (theme: GlobalTheme) => {
|
|
|
5
5
|
};
|
|
6
6
|
fonts: {
|
|
7
7
|
default: string;
|
|
8
|
+
utility: string;
|
|
8
9
|
};
|
|
9
10
|
fontSize: {
|
|
10
11
|
default: number;
|
|
@@ -51,7 +52,6 @@ declare const getButtonTheme: (theme: GlobalTheme) => {
|
|
|
51
52
|
buttonPadding: number;
|
|
52
53
|
iconPadding: number;
|
|
53
54
|
utilityPadding: number;
|
|
54
|
-
utilityIconPadding: number;
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
57
|
export default getButtonTheme;
|