@groupeactual/design-tokens 1.5.2 → 1.6.0-beta.11
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/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/css/accordionCss.d.ts +2 -1
- package/dist/cjs/types/css/bannerNotificationCss.d.ts +2 -1
- package/dist/cjs/types/css/breadcrumbsCss.d.ts +2 -1
- package/dist/cjs/types/css/buttonCss.d.ts +2 -1
- package/dist/cjs/types/css/chipCss.d.ts +2 -1
- package/dist/cjs/types/css/datatable/datatableCss.d.ts +2 -1
- package/dist/cjs/types/css/form/autoCompleteCss.d.ts +2 -1
- package/dist/cjs/types/css/form/checkboxCss.d.ts +2 -1
- package/dist/cjs/types/css/form/checkboxGroupCss.d.ts +2 -1
- package/dist/cjs/types/css/form/datePickerCss.d.ts +2 -1
- package/dist/cjs/types/css/form/radioCss.d.ts +2 -1
- package/dist/cjs/types/css/form/selectCss.d.ts +2 -1
- package/dist/cjs/types/css/form/snackbarCss.d.ts +2 -1
- package/dist/cjs/types/css/form/textFieldCss.d.ts +2 -1
- package/dist/cjs/types/css/iconButtonCss.d.ts +2 -1
- package/dist/cjs/types/css/linkCss.d.ts +2 -1
- package/dist/cjs/types/css/paginationCss.d.ts +2 -1
- package/dist/cjs/types/css/switchCss.d.ts +2 -1
- package/dist/cjs/types/css/tooltipCss.d.ts +1 -1
- package/dist/cjs/types/helpers/theme.d.ts +1 -1
- package/dist/cjs/types/interfaces/theme.d.ts +1 -0
- package/dist/cjs/types/useMaterialThemeTokens.d.ts +2 -2
- package/dist/es/index.d.ts +22 -21
- package/dist/es/index.mjs +1 -1
- package/dist/es/index.mjs.map +1 -1
- package/dist/es/types/css/accordionCss.d.ts +2 -1
- package/dist/es/types/css/bannerNotificationCss.d.ts +2 -1
- package/dist/es/types/css/breadcrumbsCss.d.ts +2 -1
- package/dist/es/types/css/buttonCss.d.ts +2 -1
- package/dist/es/types/css/chipCss.d.ts +2 -1
- package/dist/es/types/css/datatable/datatableCss.d.ts +2 -1
- package/dist/es/types/css/form/autoCompleteCss.d.ts +2 -1
- package/dist/es/types/css/form/checkboxCss.d.ts +2 -1
- package/dist/es/types/css/form/checkboxGroupCss.d.ts +2 -1
- package/dist/es/types/css/form/datePickerCss.d.ts +2 -1
- package/dist/es/types/css/form/radioCss.d.ts +2 -1
- package/dist/es/types/css/form/selectCss.d.ts +2 -1
- package/dist/es/types/css/form/snackbarCss.d.ts +2 -1
- package/dist/es/types/css/form/textFieldCss.d.ts +2 -1
- package/dist/es/types/css/iconButtonCss.d.ts +2 -1
- package/dist/es/types/css/linkCss.d.ts +2 -1
- package/dist/es/types/css/paginationCss.d.ts +2 -1
- package/dist/es/types/css/switchCss.d.ts +2 -1
- package/dist/es/types/css/tooltipCss.d.ts +1 -1
- package/dist/es/types/helpers/theme.d.ts +1 -1
- package/dist/es/types/interfaces/theme.d.ts +1 -0
- package/dist/es/types/useMaterialThemeTokens.d.ts +2 -2
- package/package.json +27 -28
- package/src/css/accordionCss.ts +8 -8
- package/src/css/bannerNotificationCss.ts +14 -12
- package/src/css/breadcrumbsCss.ts +7 -7
- package/src/css/buttonCss.ts +4 -4
- package/src/css/chipCss.ts +33 -33
- package/src/css/datatable/datatableCss.ts +10 -10
- package/src/css/form/autoCompleteCss.ts +71 -54
- package/src/css/form/checkboxCss.ts +23 -23
- package/src/css/form/checkboxGroupCss.ts +13 -13
- package/src/css/form/datePickerCss.ts +3 -4
- package/src/css/form/radioCss.ts +26 -26
- package/src/css/form/selectCss.ts +24 -24
- package/src/css/form/snackbarCss.ts +13 -13
- package/src/css/form/textFieldCss.ts +7 -7
- package/src/css/iconButtonCss.ts +22 -22
- package/src/css/linkCss.ts +6 -6
- package/src/css/paginationCss.ts +11 -11
- package/src/css/switchCss.ts +20 -19
- package/src/css/tooltipCss.ts +6 -9
- package/src/helpers/theme.ts +18 -16
- package/src/interfaces/theme.ts +3 -0
- package/src/themes/tokens.ts +3 -3
- package/src/useMaterialThemeTokens.ts +31 -31
- package/src/useThemeTokens.ts +2 -2
package/src/css/iconButtonCss.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
): Record<string, unknown> => {
|
|
1
|
+
import { MuiTokens } from '../interfaces/theme';
|
|
2
|
+
|
|
3
|
+
const IconButtonCss = (muiTokens: MuiTokens): Record<string, unknown> => {
|
|
4
4
|
return {
|
|
5
5
|
'&.MuiIconButton-root': {
|
|
6
6
|
borderRadius: '4px',
|
|
7
7
|
'& .MuiTouchRipple-root .MuiTouchRipple-child': {
|
|
8
|
-
borderRadius: '4px'
|
|
8
|
+
borderRadius: '4px',
|
|
9
9
|
},
|
|
10
10
|
'& .MuiSvgIcon-root': {
|
|
11
|
-
color: muiTokens.palette.blueClickable
|
|
11
|
+
color: muiTokens.palette.blueClickable,
|
|
12
12
|
},
|
|
13
13
|
'&:hover': {
|
|
14
14
|
'& .MuiSvgIcon-root': {
|
|
15
|
-
color: muiTokens.palette.blueHoverClickable
|
|
16
|
-
}
|
|
15
|
+
color: muiTokens.palette.blueHoverClickable,
|
|
16
|
+
},
|
|
17
17
|
},
|
|
18
18
|
'&.Mui-disabled': {
|
|
19
19
|
'& .MuiSvgIcon-root': {
|
|
20
|
-
color: muiTokens.palette.greyMediumInactive
|
|
21
|
-
}
|
|
20
|
+
color: muiTokens.palette.greyMediumInactive,
|
|
21
|
+
},
|
|
22
22
|
},
|
|
23
23
|
'&.IconButtonVariant-default': {
|
|
24
24
|
width: '44px !important',
|
|
@@ -27,40 +27,40 @@ const IconButtonCss = (
|
|
|
27
27
|
borderColor: muiTokens.palette.greyLightDefaultBorder,
|
|
28
28
|
'&:hover': {
|
|
29
29
|
borderColor: muiTokens.palette.blueHoverClickable,
|
|
30
|
-
backgroundColor: muiTokens.palette.white
|
|
31
|
-
}
|
|
30
|
+
backgroundColor: muiTokens.palette.white,
|
|
31
|
+
},
|
|
32
32
|
},
|
|
33
33
|
'&.IconButtonVariant-table': {
|
|
34
34
|
width: '42px !important',
|
|
35
35
|
height: '42px !important',
|
|
36
36
|
border: '0px',
|
|
37
37
|
'&:hover': {
|
|
38
|
-
backgroundColor: muiTokens.palette.blueHoverOpacity12
|
|
39
|
-
}
|
|
38
|
+
backgroundColor: muiTokens.palette.blueHoverOpacity12,
|
|
39
|
+
},
|
|
40
40
|
},
|
|
41
41
|
'&.IconButtonPositionGroup-left': {
|
|
42
42
|
borderRadius: '4px 0px 0px 4px',
|
|
43
43
|
'& .MuiTouchRipple-root .MuiTouchRipple-child': {
|
|
44
|
-
borderRadius: '4px 0px 0px 4px'
|
|
45
|
-
}
|
|
44
|
+
borderRadius: '4px 0px 0px 4px',
|
|
45
|
+
},
|
|
46
46
|
},
|
|
47
47
|
'&.IconButtonPositionGroup-middle': {
|
|
48
48
|
borderRadius: '0px',
|
|
49
49
|
'& .MuiTouchRipple-root .MuiTouchRipple-child': {
|
|
50
|
-
borderRadius: '0px'
|
|
51
|
-
}
|
|
50
|
+
borderRadius: '0px',
|
|
51
|
+
},
|
|
52
52
|
},
|
|
53
53
|
'&.IconButtonPositionGroup-right': {
|
|
54
54
|
borderRadius: '0px 4px 4px 0px',
|
|
55
55
|
'& .MuiTouchRipple-root .MuiTouchRipple-child': {
|
|
56
|
-
borderRadius: '0px 4px 4px 0px'
|
|
57
|
-
}
|
|
56
|
+
borderRadius: '0px 4px 4px 0px',
|
|
57
|
+
},
|
|
58
58
|
},
|
|
59
59
|
'&.IconButtonSize-small': {
|
|
60
60
|
width: '24px !important',
|
|
61
|
-
height: '24px !important'
|
|
62
|
-
}
|
|
63
|
-
}
|
|
61
|
+
height: '24px !important',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
64
|
};
|
|
65
65
|
};
|
|
66
66
|
|
package/src/css/linkCss.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
): Record<string, unknown> => {
|
|
1
|
+
import { MuiTokens } from '../interfaces/theme';
|
|
2
|
+
|
|
3
|
+
const LinkCss = (muiTokens: MuiTokens): Record<string, unknown> => {
|
|
4
4
|
return {
|
|
5
5
|
'&.MuiLink-root': {
|
|
6
6
|
color: muiTokens.palette.blueClickable,
|
|
7
|
-
cursor: 'pointer'
|
|
7
|
+
cursor: 'pointer',
|
|
8
8
|
},
|
|
9
9
|
'&:hover': {
|
|
10
|
-
color: muiTokens.palette.blueHoverClickable + ' !important'
|
|
11
|
-
}
|
|
10
|
+
color: muiTokens.palette.blueHoverClickable + ' !important',
|
|
11
|
+
},
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
|
package/src/css/paginationCss.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
): Record<string, unknown> => {
|
|
1
|
+
import { MuiTokens } from '../interfaces/theme';
|
|
2
|
+
|
|
3
|
+
const PaginationCss = (muiTokens: MuiTokens): Record<string, unknown> => {
|
|
4
4
|
return {
|
|
5
5
|
'.MuiPaginationItem-root': {
|
|
6
6
|
height: '44px !important',
|
|
@@ -16,7 +16,7 @@ const PaginationCss = (
|
|
|
16
16
|
backgroundColor: 'white !important',
|
|
17
17
|
borderColor: muiTokens.palette.blueHoverClickable + ' !important',
|
|
18
18
|
borderRadius: '4px !important',
|
|
19
|
-
outline: 'none !important'
|
|
19
|
+
outline: 'none !important',
|
|
20
20
|
},
|
|
21
21
|
'&.Mui-selected': {
|
|
22
22
|
color: 'white !important',
|
|
@@ -28,30 +28,30 @@ const PaginationCss = (
|
|
|
28
28
|
backgroundColor: muiTokens.palette.blueClickable + ' !important',
|
|
29
29
|
borderColor: muiTokens.palette.greyDark + ' !important',
|
|
30
30
|
borderRadius: '4px !important',
|
|
31
|
-
outline: 'none !important'
|
|
31
|
+
outline: 'none !important',
|
|
32
32
|
},
|
|
33
33
|
'&:focus': {
|
|
34
34
|
color: 'white !important',
|
|
35
35
|
backgroundColor: muiTokens.palette.blueClickable + ' !important',
|
|
36
36
|
borderColor: muiTokens.palette.greyDark + ' !important',
|
|
37
37
|
borderRadius: '4px !important',
|
|
38
|
-
outline: 'none !important'
|
|
39
|
-
}
|
|
38
|
+
outline: 'none !important',
|
|
39
|
+
},
|
|
40
40
|
},
|
|
41
41
|
'&.Mui-disabled': {
|
|
42
42
|
color: muiTokens.palette.greyMediumInactive + ' !important',
|
|
43
43
|
backgroundColor: 'white !important',
|
|
44
44
|
borderRadius: '4px !important',
|
|
45
45
|
outline: 'none !important',
|
|
46
|
-
opacity: '1 !important'
|
|
46
|
+
opacity: '1 !important',
|
|
47
47
|
},
|
|
48
48
|
'&.MuiPaginationItem-ellipsis': {
|
|
49
49
|
color: muiTokens.palette.greyDark + ' !important',
|
|
50
50
|
display: 'flex',
|
|
51
51
|
alignItems: 'center',
|
|
52
|
-
justifyContent: 'center'
|
|
53
|
-
}
|
|
54
|
-
}
|
|
52
|
+
justifyContent: 'center',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
57
|
|
package/src/css/switchCss.ts
CHANGED
|
@@ -1,56 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
): Record<string, unknown> => {
|
|
1
|
+
import { MuiTokens } from '../interfaces/theme';
|
|
2
|
+
|
|
3
|
+
const SwitchCss = (muiTokens: MuiTokens): Record<string, unknown> => {
|
|
4
4
|
return {
|
|
5
5
|
'& .MuiSwitch-switchBase': {
|
|
6
6
|
'&:hover': {
|
|
7
|
-
backgroundColor: muiTokens.palette.blueHoverOpacity12 + ' !important'
|
|
7
|
+
backgroundColor: muiTokens.palette.blueHoverOpacity12 + ' !important',
|
|
8
8
|
},
|
|
9
9
|
'& + .MuiSwitch-track': {
|
|
10
10
|
backgroundColor: muiTokens.palette.blueHoverEquivalence + ' !important',
|
|
11
11
|
border: '1px solid',
|
|
12
12
|
borderColor: muiTokens.palette.blueClickable + ' !important',
|
|
13
|
-
opacity: 1
|
|
13
|
+
opacity: 1,
|
|
14
14
|
},
|
|
15
15
|
'& + .MuiSwitch-thumb': {
|
|
16
|
-
backgroundColor: muiTokens.palette.white + ' !important'
|
|
16
|
+
backgroundColor: muiTokens.palette.white + ' !important',
|
|
17
17
|
},
|
|
18
18
|
'&.Mui-disabled': {
|
|
19
19
|
'& + .MuiSwitch-track': {
|
|
20
|
-
backgroundColor:
|
|
20
|
+
backgroundColor:
|
|
21
|
+
muiTokens.palette.greyLightDefaultBorder + ' !important',
|
|
21
22
|
border: '1px solid',
|
|
22
23
|
borderColor: muiTokens.palette.greyMediumInactive + ' !important',
|
|
23
|
-
opacity: 1
|
|
24
|
+
opacity: 1,
|
|
24
25
|
},
|
|
25
26
|
'& + .MuiSwitch-thumb': {
|
|
26
|
-
backgroundColor: muiTokens.palette.greyDark + ' !important'
|
|
27
|
-
}
|
|
27
|
+
backgroundColor: muiTokens.palette.greyDark + ' !important',
|
|
28
|
+
},
|
|
28
29
|
},
|
|
29
30
|
'&.Mui-checked': {
|
|
30
31
|
'& + .MuiSwitch-track': {
|
|
31
32
|
backgroundColor: muiTokens.palette.blueClickable + ' !important',
|
|
32
33
|
opacity: 1,
|
|
33
34
|
border: '1px solid',
|
|
34
|
-
borderColor: muiTokens.palette.blueClickable + ' !important'
|
|
35
|
+
borderColor: muiTokens.palette.blueClickable + ' !important',
|
|
35
36
|
},
|
|
36
37
|
'& .MuiSwitch-thumb': {
|
|
37
|
-
backgroundColor: muiTokens.palette.blueHoverClickable + ' !important'
|
|
38
|
+
backgroundColor: muiTokens.palette.blueHoverClickable + ' !important',
|
|
38
39
|
},
|
|
39
40
|
'&:hover': {
|
|
40
|
-
backgroundColor: muiTokens.palette.blueHoverOpacity12 + ' !important'
|
|
41
|
-
}
|
|
41
|
+
backgroundColor: muiTokens.palette.blueHoverOpacity12 + ' !important',
|
|
42
|
+
},
|
|
42
43
|
},
|
|
43
44
|
'&.Mui-disabled.Mui-checked': {
|
|
44
45
|
'& .MuiSwitch-thumb': {
|
|
45
|
-
backgroundColor: muiTokens.palette.greyDark + ' !important'
|
|
46
|
+
backgroundColor: muiTokens.palette.greyDark + ' !important',
|
|
46
47
|
},
|
|
47
48
|
'& + .MuiSwitch-track': {
|
|
48
49
|
backgroundColor: muiTokens.palette.greyMediumInactive + ' !important',
|
|
49
50
|
border: '1px solid',
|
|
50
|
-
borderColor: muiTokens.palette.greyMediumInactive + ' !important'
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
51
|
+
borderColor: muiTokens.palette.greyMediumInactive + ' !important',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
54
55
|
};
|
|
55
56
|
};
|
|
56
57
|
|
package/src/css/tooltipCss.ts
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
const TooltipCss = (
|
|
2
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3
|
-
muiTokens: Record<string, string | number | any>
|
|
4
|
-
): Record<string, unknown> => {
|
|
1
|
+
const TooltipCss = (): Record<string, unknown> => {
|
|
5
2
|
return {
|
|
6
3
|
'& .MuiTooltip-tooltip': {
|
|
7
4
|
background: 'red',
|
|
8
|
-
backgroundColor: 'red'
|
|
5
|
+
backgroundColor: 'red',
|
|
9
6
|
},
|
|
10
7
|
'.MuiTooltip-tooltip': {
|
|
11
8
|
background: 'red',
|
|
12
|
-
backgroundColor: 'red'
|
|
9
|
+
backgroundColor: 'red',
|
|
13
10
|
},
|
|
14
11
|
'& .MuiPopper-popper': {
|
|
15
12
|
background: 'red',
|
|
16
|
-
backgroundColor: 'red'
|
|
13
|
+
backgroundColor: 'red',
|
|
17
14
|
},
|
|
18
15
|
'.MuiPopper-popper': {
|
|
19
16
|
background: 'red',
|
|
20
|
-
backgroundColor: 'red'
|
|
21
|
-
}
|
|
17
|
+
backgroundColor: 'red',
|
|
18
|
+
},
|
|
22
19
|
};
|
|
23
20
|
};
|
|
24
21
|
|
package/src/helpers/theme.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as tokens from '../themes/tokens';
|
|
2
1
|
import { Theme, Types } from '../interfaces/theme';
|
|
2
|
+
import * as tokens from '../themes/tokens';
|
|
3
3
|
|
|
4
4
|
export const getTokensByType = (
|
|
5
5
|
themeName: Theme,
|
|
6
|
-
type: Types
|
|
6
|
+
type: Types,
|
|
7
7
|
): Record<string, string> => {
|
|
8
8
|
const defaultTokens: Record<string, string> = {};
|
|
9
9
|
|
|
@@ -17,10 +17,10 @@ export const getTokensByType = (
|
|
|
17
17
|
case 'lineHeights':
|
|
18
18
|
case 'fontSize':
|
|
19
19
|
case 'paragraphSpacing':
|
|
20
|
-
defaultTokens[parsedTokenKey] =
|
|
20
|
+
defaultTokens[parsedTokenKey] = tokens[tokenKey] + 'px';
|
|
21
21
|
break;
|
|
22
22
|
default:
|
|
23
|
-
defaultTokens[parsedTokenKey] =
|
|
23
|
+
defaultTokens[parsedTokenKey] = tokens[tokenKey];
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
});
|
|
@@ -28,8 +28,10 @@ export const getTokensByType = (
|
|
|
28
28
|
return defaultTokens;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
export const getMuiPalette = (
|
|
32
|
-
|
|
31
|
+
export const getMuiPalette = (
|
|
32
|
+
themeName: Theme,
|
|
33
|
+
): Record<string, string | number | unknown> => {
|
|
34
|
+
const palette: Record<string, string | number | unknown> = {};
|
|
33
35
|
|
|
34
36
|
Object.keys(tokens).forEach((colorName) => {
|
|
35
37
|
// color structure :
|
|
@@ -37,39 +39,39 @@ export const getMuiPalette = (themeName: Theme): Record<string, any> => {
|
|
|
37
39
|
// récupérer last iteration of "Colors" pour avoir le nom de la couleur
|
|
38
40
|
if (colorName.startsWith(themeName) && colorName.indexOf('Colors')) {
|
|
39
41
|
let colorKey = colorName.substring(
|
|
40
|
-
colorName.lastIndexOf('Colors') + 'Colors'.length
|
|
42
|
+
colorName.lastIndexOf('Colors') + 'Colors'.length,
|
|
41
43
|
);
|
|
42
44
|
|
|
43
45
|
colorKey = colorKey.charAt(0).toLowerCase() + colorKey.slice(1);
|
|
44
|
-
palette[colorKey] =
|
|
46
|
+
palette[colorKey] = tokens[colorName] as 'primary';
|
|
45
47
|
}
|
|
46
48
|
});
|
|
47
49
|
|
|
48
50
|
const defaultPalette = {
|
|
49
51
|
primary: {
|
|
50
52
|
main: palette['blueClickable'],
|
|
51
|
-
dark: palette['blueHoverClickable']
|
|
53
|
+
dark: palette['blueHoverClickable'],
|
|
52
54
|
},
|
|
53
55
|
secondary: {
|
|
54
|
-
main: palette['redActual']
|
|
56
|
+
main: palette['redActual'],
|
|
55
57
|
},
|
|
56
58
|
success: {
|
|
57
|
-
main: palette['greenSuccess']
|
|
59
|
+
main: palette['greenSuccess'],
|
|
58
60
|
},
|
|
59
61
|
error: {
|
|
60
|
-
main: palette['redError']
|
|
62
|
+
main: palette['redError'],
|
|
61
63
|
},
|
|
62
64
|
warning: {
|
|
63
|
-
main: palette['orangeWarning']
|
|
65
|
+
main: palette['orangeWarning'],
|
|
64
66
|
},
|
|
65
67
|
infos: {
|
|
66
|
-
main: palette['blueInfo']
|
|
67
|
-
}
|
|
68
|
+
main: palette['blueInfo'],
|
|
69
|
+
},
|
|
68
70
|
};
|
|
69
71
|
|
|
70
72
|
return {
|
|
71
73
|
...palette,
|
|
72
|
-
...defaultPalette
|
|
74
|
+
...defaultPalette,
|
|
73
75
|
};
|
|
74
76
|
};
|
|
75
77
|
|
package/src/interfaces/theme.ts
CHANGED
package/src/themes/tokens.ts
CHANGED
|
@@ -8,7 +8,7 @@ export const DefaultWebShadowAllContent = {
|
|
|
8
8
|
x: '0',
|
|
9
9
|
y: '2',
|
|
10
10
|
blur: '10',
|
|
11
|
-
spread: '0'
|
|
11
|
+
spread: '0',
|
|
12
12
|
};
|
|
13
13
|
export const DefaultSpacingXxs = '4';
|
|
14
14
|
export const DefaultSpacingXs = '8';
|
|
@@ -94,7 +94,7 @@ export const EpAppShadowAllContent = {
|
|
|
94
94
|
x: '0',
|
|
95
95
|
y: '4',
|
|
96
96
|
blur: '15',
|
|
97
|
-
spread: '0'
|
|
97
|
+
spread: '0',
|
|
98
98
|
};
|
|
99
99
|
export const EpAppShadowButtomMenu = {
|
|
100
100
|
color: '#dedada66',
|
|
@@ -102,7 +102,7 @@ export const EpAppShadowButtomMenu = {
|
|
|
102
102
|
x: '0',
|
|
103
103
|
y: '-4',
|
|
104
104
|
blur: '15',
|
|
105
|
-
spread: '0'
|
|
105
|
+
spread: '0',
|
|
106
106
|
};
|
|
107
107
|
export const EpBorderRadius4 = '4';
|
|
108
108
|
export const EpBorderRadius8 = '8';
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
|
|
4
|
-
import * as tokens from './themes/tokens';
|
|
5
|
-
import { Theme } from './interfaces/theme';
|
|
6
4
|
import { getFontFamilies, getMuiPalette } from './helpers/theme';
|
|
5
|
+
import { MuiTokens, Theme } from './interfaces/theme';
|
|
6
|
+
import * as tokens from './themes/tokens';
|
|
7
7
|
|
|
8
8
|
interface useMaterialThemeTokensReturnType {
|
|
9
|
-
muiTokens:
|
|
9
|
+
muiTokens: MuiTokens;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const useMaterialThemeTokens = (
|
|
13
|
-
themeName: Theme
|
|
13
|
+
themeName: Theme,
|
|
14
14
|
): useMaterialThemeTokensReturnType => {
|
|
15
15
|
const fontWeights = {
|
|
16
16
|
RobotoBold: 700,
|
|
17
17
|
RobotoMedium: 500,
|
|
18
|
-
RobotoRegular: 400
|
|
18
|
+
RobotoRegular: 400,
|
|
19
19
|
};
|
|
20
20
|
const designTokens = tokens as Record<string, string | number | unknown>;
|
|
21
21
|
|
|
@@ -26,7 +26,7 @@ const useMaterialThemeTokens = (
|
|
|
26
26
|
letterSpacing: designTokens[`${themeName}LetterSpacingNone`],
|
|
27
27
|
paragraphSpacing: designTokens[`${themeName}ParagraphSpacing0`] + 'px',
|
|
28
28
|
textCase: designTokens[`${themeName}TextCaseNone`],
|
|
29
|
-
textDecoration: designTokens[`${themeName}TextDecorationNone`]
|
|
29
|
+
textDecoration: designTokens[`${themeName}TextDecorationNone`],
|
|
30
30
|
};
|
|
31
31
|
const h2 = {
|
|
32
32
|
fontWeight: fontWeights.RobotoMedium,
|
|
@@ -35,7 +35,7 @@ const useMaterialThemeTokens = (
|
|
|
35
35
|
letterSpacing: designTokens[`${themeName}LetterSpacingNone`],
|
|
36
36
|
paragraphSpacing: designTokens[`${themeName}ParagraphSpacing0`] + 'px',
|
|
37
37
|
textCase: designTokens[`${themeName}TextCaseNone`],
|
|
38
|
-
textDecoration: designTokens[`${themeName}TextDecorationNone`]
|
|
38
|
+
textDecoration: designTokens[`${themeName}TextDecorationNone`],
|
|
39
39
|
};
|
|
40
40
|
const h3 = {
|
|
41
41
|
fontWeight: fontWeights.RobotoRegular,
|
|
@@ -44,7 +44,7 @@ const useMaterialThemeTokens = (
|
|
|
44
44
|
letterSpacing: designTokens[`${themeName}LetterSpacingNone`],
|
|
45
45
|
paragraphSpacing: designTokens[`${themeName}ParagraphSpacing0`] + 'px',
|
|
46
46
|
textCase: designTokens[`${themeName}TextCaseNone`],
|
|
47
|
-
textDecoration: designTokens[`${themeName}TextDecorationNone`]
|
|
47
|
+
textDecoration: designTokens[`${themeName}TextDecorationNone`],
|
|
48
48
|
};
|
|
49
49
|
const h4 = {
|
|
50
50
|
fontWeight: fontWeights.RobotoMedium,
|
|
@@ -53,7 +53,7 @@ const useMaterialThemeTokens = (
|
|
|
53
53
|
letterSpacing: designTokens[`${themeName}LetterSpacingNone`],
|
|
54
54
|
paragraphSpacing: designTokens[`${themeName}ParagraphSpacing0`] + 'px',
|
|
55
55
|
textCase: designTokens[`${themeName}TextCaseNone`],
|
|
56
|
-
textDecoration: designTokens[`${themeName}TextDecorationNone`]
|
|
56
|
+
textDecoration: designTokens[`${themeName}TextDecorationNone`],
|
|
57
57
|
};
|
|
58
58
|
const body1 = {
|
|
59
59
|
fontWeight: fontWeights.RobotoRegular,
|
|
@@ -62,7 +62,7 @@ const useMaterialThemeTokens = (
|
|
|
62
62
|
letterSpacing: designTokens[`${themeName}LetterSpacingNone`],
|
|
63
63
|
paragraphSpacing: designTokens[`${themeName}ParagraphSpacing8`] + 'px',
|
|
64
64
|
textCase: designTokens[`${themeName}TextCaseNone`],
|
|
65
|
-
textDecoration: designTokens[`${themeName}TextDecorationNone`]
|
|
65
|
+
textDecoration: designTokens[`${themeName}TextDecorationNone`],
|
|
66
66
|
};
|
|
67
67
|
const body2 = {
|
|
68
68
|
fontWeight: fontWeights.RobotoRegular,
|
|
@@ -71,7 +71,7 @@ const useMaterialThemeTokens = (
|
|
|
71
71
|
letterSpacing: designTokens[`${themeName}LetterSpacingNone`],
|
|
72
72
|
paragraphSpacing: designTokens[`${themeName}ParagraphSpacing8`] + 'px',
|
|
73
73
|
textCase: designTokens[`${themeName}TextCaseNone`],
|
|
74
|
-
textDecoration: designTokens[`${themeName}TextDecorationNone`]
|
|
74
|
+
textDecoration: designTokens[`${themeName}TextDecorationNone`],
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
const muiTokensObject = {
|
|
@@ -80,10 +80,10 @@ const useMaterialThemeTokens = (
|
|
|
80
80
|
defaultProps: {
|
|
81
81
|
variantMapping: {
|
|
82
82
|
subtitle1: 'body1',
|
|
83
|
-
subtitle2: 'body2'
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
83
|
+
subtitle2: 'body2',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
87
|
},
|
|
88
88
|
typography: {
|
|
89
89
|
fontFamily: getFontFamilies(themeName).join(','),
|
|
@@ -94,7 +94,7 @@ const useMaterialThemeTokens = (
|
|
|
94
94
|
letterSpacing: designTokens[`${themeName}LetterSpacingNone`],
|
|
95
95
|
paragraphSpacing: designTokens[`${themeName}ParagraphSpacing0`] + 'px',
|
|
96
96
|
textCase: designTokens[`${themeName}TextCaseNone`],
|
|
97
|
-
textDecoration: designTokens[`${themeName}TextDecorationNone`]
|
|
97
|
+
textDecoration: designTokens[`${themeName}TextDecorationNone`],
|
|
98
98
|
},
|
|
99
99
|
h1,
|
|
100
100
|
header1: h1, // Do not used this, use h1 instead
|
|
@@ -113,7 +113,7 @@ const useMaterialThemeTokens = (
|
|
|
113
113
|
letterSpacing: designTokens[`${themeName}LetterSpacingNone`],
|
|
114
114
|
paragraphSpacing: designTokens[`${themeName}ParagraphSpacing8`] + 'px',
|
|
115
115
|
textCase: designTokens[`${themeName}TextCaseNone`],
|
|
116
|
-
textDecoration: designTokens[`${themeName}TextDecorationNone`]
|
|
116
|
+
textDecoration: designTokens[`${themeName}TextDecorationNone`],
|
|
117
117
|
},
|
|
118
118
|
body1Bold: {
|
|
119
119
|
fontWeight: fontWeights.RobotoBold,
|
|
@@ -122,7 +122,7 @@ const useMaterialThemeTokens = (
|
|
|
122
122
|
letterSpacing: designTokens[`${themeName}LetterSpacingNone`],
|
|
123
123
|
paragraphSpacing: designTokens[`${themeName}ParagraphSpacing8`] + 'px',
|
|
124
124
|
textCase: designTokens[`${themeName}TextCaseNone`],
|
|
125
|
-
textDecoration: designTokens[`${themeName}TextDecorationNone`]
|
|
125
|
+
textDecoration: designTokens[`${themeName}TextDecorationNone`],
|
|
126
126
|
},
|
|
127
127
|
body2,
|
|
128
128
|
body2Regular: body2,
|
|
@@ -133,7 +133,7 @@ const useMaterialThemeTokens = (
|
|
|
133
133
|
letterSpacing: designTokens[`${themeName}LetterSpacingNone`],
|
|
134
134
|
paragraphSpacing: designTokens[`${themeName}ParagraphSpacing8`] + 'px',
|
|
135
135
|
textCase: designTokens[`${themeName}TextCaseNone`],
|
|
136
|
-
textDecoration: designTokens[`${themeName}TextDecorationNone`]
|
|
136
|
+
textDecoration: designTokens[`${themeName}TextDecorationNone`],
|
|
137
137
|
},
|
|
138
138
|
body2Bold: {
|
|
139
139
|
fontWeight: fontWeights.RobotoBold,
|
|
@@ -142,7 +142,7 @@ const useMaterialThemeTokens = (
|
|
|
142
142
|
letterSpacing: designTokens[`${themeName}LetterSpacingNone`],
|
|
143
143
|
paragraphSpacing: designTokens[`${themeName}ParagraphSpacing8`] + 'px',
|
|
144
144
|
textCase: designTokens[`${themeName}TextCaseNone`],
|
|
145
|
-
textDecoration: designTokens[`${themeName}TextDecorationNone`]
|
|
145
|
+
textDecoration: designTokens[`${themeName}TextDecorationNone`],
|
|
146
146
|
},
|
|
147
147
|
caption: {
|
|
148
148
|
fontWeight: fontWeights.RobotoRegular,
|
|
@@ -151,7 +151,7 @@ const useMaterialThemeTokens = (
|
|
|
151
151
|
letterSpacing: designTokens[`${themeName}LetterSpacingNone`],
|
|
152
152
|
paragraphSpacing: designTokens[`${themeName}ParagraphSpacing0`] + 'px',
|
|
153
153
|
textCase: designTokens[`${themeName}TextCaseNone`],
|
|
154
|
-
textDecoration: designTokens[`${themeName}TextDecorationNone`]
|
|
154
|
+
textDecoration: designTokens[`${themeName}TextDecorationNone`],
|
|
155
155
|
},
|
|
156
156
|
buttonNotif: {
|
|
157
157
|
fontWeight: fontWeights.RobotoBold,
|
|
@@ -160,7 +160,7 @@ const useMaterialThemeTokens = (
|
|
|
160
160
|
letterSpacing: designTokens[`${themeName}LetterSpacingNone`],
|
|
161
161
|
paragraphSpacing: designTokens[`${themeName}ParagraphSpacing0`] + 'px',
|
|
162
162
|
textCase: designTokens[`${themeName}TextCaseNone`],
|
|
163
|
-
textDecoration: designTokens[`${themeName}TextDecorationNone`]
|
|
163
|
+
textDecoration: designTokens[`${themeName}TextDecorationNone`],
|
|
164
164
|
},
|
|
165
165
|
link1: {
|
|
166
166
|
fontWeight: fontWeights.RobotoBold,
|
|
@@ -169,7 +169,7 @@ const useMaterialThemeTokens = (
|
|
|
169
169
|
letterSpacing: designTokens[`${themeName}LetterSpacingNone`],
|
|
170
170
|
paragraphSpacing: designTokens[`${themeName}ParagraphSpacing0`] + 'px',
|
|
171
171
|
textCase: designTokens[`${themeName}TextCaseNone`],
|
|
172
|
-
textDecoration: designTokens[`${themeName}TextDecorationUnderline`]
|
|
172
|
+
textDecoration: designTokens[`${themeName}TextDecorationUnderline`],
|
|
173
173
|
},
|
|
174
174
|
link2: {
|
|
175
175
|
fontWeight: fontWeights.RobotoBold,
|
|
@@ -178,11 +178,11 @@ const useMaterialThemeTokens = (
|
|
|
178
178
|
letterSpacing: designTokens[`${themeName}LetterSpacingNone`],
|
|
179
179
|
paragraphSpacing: designTokens[`${themeName}ParagraphSpacing0`] + 'px',
|
|
180
180
|
textCase: designTokens[`${themeName}TextCaseNone`],
|
|
181
|
-
textDecoration: designTokens[`${themeName}TextDecorationUnderline`]
|
|
181
|
+
textDecoration: designTokens[`${themeName}TextDecorationUnderline`],
|
|
182
182
|
},
|
|
183
183
|
fontWeightRegular: fontWeights.RobotoRegular,
|
|
184
184
|
fontWeightMedium: fontWeights.RobotoMedium,
|
|
185
|
-
fontWeightBold: fontWeights.RobotoBold
|
|
185
|
+
fontWeightBold: fontWeights.RobotoBold,
|
|
186
186
|
},
|
|
187
187
|
breakpoints: {
|
|
188
188
|
values: {
|
|
@@ -190,8 +190,8 @@ const useMaterialThemeTokens = (
|
|
|
190
190
|
sm: 600,
|
|
191
191
|
md: 900,
|
|
192
192
|
lg: 1200,
|
|
193
|
-
xl: 1536
|
|
194
|
-
}
|
|
193
|
+
xl: 1536,
|
|
194
|
+
},
|
|
195
195
|
},
|
|
196
196
|
zIndex: {
|
|
197
197
|
mobileStepper: 1000,
|
|
@@ -201,16 +201,16 @@ const useMaterialThemeTokens = (
|
|
|
201
201
|
drawer: 1200,
|
|
202
202
|
modal: 1300,
|
|
203
203
|
snackbar: 1400,
|
|
204
|
-
tooltip: 1500
|
|
204
|
+
tooltip: 1500,
|
|
205
205
|
},
|
|
206
|
-
palette: getMuiPalette(themeName)
|
|
206
|
+
palette: getMuiPalette(themeName),
|
|
207
207
|
};
|
|
208
208
|
|
|
209
209
|
const muiTokens = useMemo(
|
|
210
210
|
() => ({
|
|
211
|
-
...muiTokensObject
|
|
211
|
+
...muiTokensObject,
|
|
212
212
|
}),
|
|
213
|
-
[muiTokensObject]
|
|
213
|
+
[muiTokensObject],
|
|
214
214
|
);
|
|
215
215
|
|
|
216
216
|
return { muiTokens };
|
package/src/useThemeTokens.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
|
|
3
|
-
import { DesignTokens, Theme } from './interfaces/theme';
|
|
4
3
|
import { getFontFamilies, getTokensByType } from './helpers/theme';
|
|
4
|
+
import { DesignTokens, Theme } from './interfaces/theme';
|
|
5
5
|
|
|
6
6
|
interface useThemeTokensReturnType {
|
|
7
7
|
tokens: DesignTokens;
|
|
@@ -20,7 +20,7 @@ const useThemeTokens = (themeName: Theme): useThemeTokensReturnType => {
|
|
|
20
20
|
textDecoration: getTokensByType(themeName, 'TextDecoration'),
|
|
21
21
|
colors: getTokensByType(themeName, 'Colors'),
|
|
22
22
|
spacing: getTokensByType(themeName, 'Spacing'),
|
|
23
|
-
sizing: getTokensByType(themeName, 'Sizing')
|
|
23
|
+
sizing: getTokensByType(themeName, 'Sizing'),
|
|
24
24
|
};
|
|
25
25
|
}, [themeName]);
|
|
26
26
|
|