@groupeactual/design-tokens 1.7.9 → 2.0.0-beta.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.
Files changed (108) hide show
  1. package/dist/cjs/index.js +23 -1
  2. package/dist/es/index.d.ts +244 -63
  3. package/dist/es/index.js +23 -1
  4. package/dist/types/helpers/theme.helper.d.ts +5 -0
  5. package/dist/types/index.d.ts +2 -0
  6. package/dist/types/interfaces/theme.interface.d.ts +242 -0
  7. package/dist/types/styled/Accordion.d.ts +4 -0
  8. package/dist/types/styled/Alert.d.ts +4 -0
  9. package/dist/types/styled/Autocomplete.d.ts +4 -0
  10. package/dist/types/styled/Breadcrumbs.d.ts +4 -0
  11. package/dist/types/styled/Button.d.ts +4 -0
  12. package/dist/types/styled/Checkbox.d.ts +4 -0
  13. package/dist/types/styled/Chip.d.ts +4 -0
  14. package/dist/types/styled/Divider.d.ts +4 -0
  15. package/dist/types/styled/FormHelperText.d.ts +4 -0
  16. package/dist/types/styled/FormLabel.d.ts +4 -0
  17. package/dist/types/styled/IconButton.d.ts +4 -0
  18. package/dist/types/styled/InputLabel.d.ts +4 -0
  19. package/dist/types/styled/MenuItem.d.ts +4 -0
  20. package/dist/types/styled/OutlinedInput.d.ts +4 -0
  21. package/dist/types/styled/PaginationItem.d.ts +4 -0
  22. package/dist/types/styled/Radio.d.ts +4 -0
  23. package/dist/types/styled/Select.d.ts +4 -0
  24. package/dist/types/styled/Switch.d.ts +4 -0
  25. package/dist/types/styled/Table.d.ts +4 -0
  26. package/dist/types/styled/TextField.d.ts +4 -0
  27. package/dist/types/styled/Typography.d.ts +4 -0
  28. package/dist/types/theme/theme.d.ts +4 -0
  29. package/package.json +22 -14
  30. package/src/helpers/theme.helper.ts +229 -0
  31. package/src/index.ts +2 -4
  32. package/src/interfaces/theme.interface.ts +270 -0
  33. package/src/styled/Accordion.ts +49 -0
  34. package/src/styled/Alert.ts +83 -0
  35. package/src/styled/Autocomplete.ts +24 -0
  36. package/src/styled/Breadcrumbs.ts +29 -0
  37. package/src/styled/Button.ts +109 -0
  38. package/src/styled/Checkbox.ts +81 -0
  39. package/src/styled/Chip.ts +201 -0
  40. package/src/styled/Divider.ts +24 -0
  41. package/src/styled/FormHelperText.ts +28 -0
  42. package/src/styled/FormLabel.ts +30 -0
  43. package/src/styled/IconButton.ts +161 -0
  44. package/src/styled/InputLabel.ts +30 -0
  45. package/src/styled/MenuItem.ts +73 -0
  46. package/src/styled/OutlinedInput.ts +89 -0
  47. package/src/styled/PaginationItem.ts +72 -0
  48. package/src/styled/Radio.ts +67 -0
  49. package/src/styled/Select.ts +38 -0
  50. package/src/styled/Switch.ts +62 -0
  51. package/src/styled/Table.ts +54 -0
  52. package/src/styled/TextField.ts +105 -0
  53. package/src/styled/Typography.ts +67 -0
  54. package/src/theme/theme.tsx +23 -0
  55. package/src/tokens/tokens.json +667 -6
  56. package/dist/types/src/css/accordionCss.d.ts +0 -3
  57. package/dist/types/src/css/bannerNotificationCss.d.ts +0 -3
  58. package/dist/types/src/css/breadcrumbsCss.d.ts +0 -3
  59. package/dist/types/src/css/buttonCss.d.ts +0 -3
  60. package/dist/types/src/css/chipCss.d.ts +0 -3
  61. package/dist/types/src/css/datatable/datatableCss.d.ts +0 -3
  62. package/dist/types/src/css/form/autoCompleteCss.d.ts +0 -3
  63. package/dist/types/src/css/form/checkboxCss.d.ts +0 -3
  64. package/dist/types/src/css/form/checkboxGroupCss.d.ts +0 -3
  65. package/dist/types/src/css/form/datePickerCss.d.ts +0 -3
  66. package/dist/types/src/css/form/radioCss.d.ts +0 -3
  67. package/dist/types/src/css/form/selectCss.d.ts +0 -3
  68. package/dist/types/src/css/form/snackbarCss.d.ts +0 -3
  69. package/dist/types/src/css/form/textFieldCss.d.ts +0 -3
  70. package/dist/types/src/css/iconButtonCss.d.ts +0 -3
  71. package/dist/types/src/css/index.d.ts +0 -20
  72. package/dist/types/src/css/linkCss.d.ts +0 -3
  73. package/dist/types/src/css/menuItemCss.d.ts +0 -3
  74. package/dist/types/src/css/paginationCss.d.ts +0 -3
  75. package/dist/types/src/css/switchCss.d.ts +0 -3
  76. package/dist/types/src/css/tooltipCss.d.ts +0 -2
  77. package/dist/types/src/helpers/theme.d.ts +0 -4
  78. package/dist/types/src/index.d.ts +0 -4
  79. package/dist/types/src/interfaces/theme.d.ts +0 -16
  80. package/dist/types/src/themes/tokens.d.ts +0 -167
  81. package/dist/types/src/useMaterialThemeTokens.d.ts +0 -6
  82. package/dist/types/src/useThemeTokens.d.ts +0 -6
  83. package/src/css/accordionCss.ts +0 -30
  84. package/src/css/bannerNotificationCss.ts +0 -52
  85. package/src/css/breadcrumbsCss.ts +0 -19
  86. package/src/css/buttonCss.ts +0 -80
  87. package/src/css/chipCss.ts +0 -142
  88. package/src/css/datatable/datatableCss.ts +0 -32
  89. package/src/css/form/autoCompleteCss.ts +0 -340
  90. package/src/css/form/checkboxCss.ts +0 -128
  91. package/src/css/form/checkboxGroupCss.ts +0 -42
  92. package/src/css/form/datePickerCss.ts +0 -117
  93. package/src/css/form/radioCss.ts +0 -102
  94. package/src/css/form/selectCss.ts +0 -233
  95. package/src/css/form/snackbarCss.ts +0 -42
  96. package/src/css/form/textFieldCss.ts +0 -188
  97. package/src/css/iconButtonCss.ts +0 -64
  98. package/src/css/index.ts +0 -20
  99. package/src/css/linkCss.ts +0 -15
  100. package/src/css/menuItemCss.ts +0 -31
  101. package/src/css/paginationCss.ts +0 -59
  102. package/src/css/switchCss.ts +0 -58
  103. package/src/css/tooltipCss.ts +0 -5
  104. package/src/helpers/theme.ts +0 -89
  105. package/src/interfaces/theme.ts +0 -34
  106. package/src/themes/tokens.ts +0 -169
  107. package/src/useMaterialThemeTokens.ts +0 -218
  108. package/src/useThemeTokens.ts +0 -30
@@ -0,0 +1,72 @@
1
+ import { Components } from '@mui/material';
2
+
3
+ import {
4
+ CustomColors,
5
+ Spacing,
6
+ TokenStructure,
7
+ } from '@/interfaces/theme.interface';
8
+
9
+ const PaginationItem = (
10
+ _spacing: Spacing,
11
+ tokens: TokenStructure & CustomColors,
12
+ ): Components<unknown> => {
13
+ return {
14
+ MuiPaginationItem: {
15
+ styleOverrides: {
16
+ root: {
17
+ fontFamily: 'Roboto',
18
+ height: '44px !important',
19
+ width: '44px !important',
20
+ color: tokens.palette?.primary?.main?.value,
21
+ backgroundColor: 'white !important',
22
+ border: `1px solid ${tokens.palette?.border?.default?.value} !important`,
23
+ fontWeight: '700 !important',
24
+ outline: 'none !important',
25
+ fontSize: '14px !important',
26
+ '&:hover': {
27
+ backgroundColor:
28
+ tokens.palette?.primary['light 3']?.value + ' !important',
29
+ color: tokens.palette?.primary.dark?.value,
30
+ borderRadius: Number(tokens.radius?.small.value) + ' !important',
31
+ outline: 'none !important',
32
+ },
33
+ '&.Mui-selected': {
34
+ color: 'white !important',
35
+ backgroundColor:
36
+ tokens.palette?.primary?.main?.value + ' !important',
37
+ borderRadius: Number(tokens.radius?.small.value) + ' !important',
38
+ outline: 'none !important',
39
+ '&:hover': {
40
+ color: 'white !important',
41
+ backgroundColor:
42
+ tokens.palette?.primary.dark?.value + ' !important',
43
+ borderRadius: Number(tokens.radius?.small.value) + ' !important',
44
+ outline: 'none !important',
45
+ },
46
+ '&:focus': {
47
+ color: 'white !important',
48
+ borderRadius: Number(tokens.radius?.small.value) + ' !important',
49
+ outline: 'none !important',
50
+ },
51
+ },
52
+ '&.Mui-disabled': {
53
+ color: tokens.palette?.text.disabled.value + ' !important',
54
+ borderColor: tokens.palette?.border?.default.value + ' !important',
55
+ backgroundColor: 'white !important',
56
+ borderRadius: '4px !important',
57
+ outline: 'none !important',
58
+ opacity: '1 !important',
59
+ },
60
+ '&.MuiPaginationItem-ellipsis': {
61
+ color: tokens.textColors.greyDark?.value + ' !important',
62
+ display: 'flex',
63
+ alignItems: 'center',
64
+ justifyContent: 'center',
65
+ },
66
+ },
67
+ },
68
+ },
69
+ };
70
+ };
71
+
72
+ export default PaginationItem;
@@ -0,0 +1,67 @@
1
+ import { Components } from '@mui/material';
2
+
3
+ import {
4
+ CustomColors,
5
+ Spacing,
6
+ TokenStructure,
7
+ } from '@/interfaces/theme.interface';
8
+
9
+ const Radio = (
10
+ spacing: Spacing,
11
+ tokens: TokenStructure & CustomColors,
12
+ ): Components<unknown> => {
13
+ return {
14
+ MuiRadio: {
15
+ styleOverrides: {
16
+ root: {
17
+ height: spacing(6),
18
+ width: spacing(6),
19
+ marginRight: spacing(1),
20
+ padding: spacing(0) + ' !important',
21
+ '&:hover': {
22
+ backgroundColor: tokens.palette?.primary['light 3']?.value,
23
+ '.MuiSvgIcon-root': {
24
+ color: tokens?.blueHoverClickable?.value,
25
+ },
26
+ },
27
+ '&.Mui-disabled': {
28
+ '::before': {
29
+ zIndex: 0,
30
+ content: '" "',
31
+ display: 'block',
32
+ position: 'absolute',
33
+ borderRadius: '10px',
34
+ width: '14px',
35
+ height: '14px',
36
+ backgroundColor: tokens.palette?.background.grey.value,
37
+ },
38
+ '.MuiSvgIcon-root': {
39
+ color: tokens.palette?.border.default.value + ' !important',
40
+ backgroundColor: 'transparent !important',
41
+ },
42
+ '&.Mui-checked': {
43
+ '.MuiSvgIcon-root': {
44
+ color: tokens.palette?.border?.grey?.value + ' !important',
45
+ },
46
+ },
47
+ },
48
+ '.MuiFormControlLabel-root:hover &': {
49
+ backgroundColor: tokens.palette?.primary['light 3']?.value,
50
+ '.MuiSvgIcon-root': {
51
+ color: tokens?.blueHoverClickable?.value,
52
+ },
53
+ '&.Mui-disabled': {
54
+ backgroundColor: 'transparent',
55
+ },
56
+ },
57
+ '.MuiSvgIcon-root': {
58
+ width: spacing(4.8),
59
+ height: spacing(4.8),
60
+ },
61
+ },
62
+ },
63
+ },
64
+ };
65
+ };
66
+
67
+ export default Radio;
@@ -0,0 +1,38 @@
1
+ import { Components } from '@mui/material';
2
+
3
+ import {
4
+ CustomColors,
5
+ Spacing,
6
+ TokenStructure,
7
+ } from '@/interfaces/theme.interface';
8
+
9
+ const Select = (
10
+ spacing: Spacing,
11
+ tokens: TokenStructure & CustomColors,
12
+ ): Components<unknown> => {
13
+ return {
14
+ MuiSelect: {
15
+ styleOverrides: {
16
+ root: {
17
+ '.itemIcon': {
18
+ display: 'inline-flex',
19
+ alignItems: 'center',
20
+ marginRight: spacing(2),
21
+ },
22
+ '.Mui-disabled.itemIcon': {
23
+ color: tokens.palette?.text.disabled?.value,
24
+ },
25
+ '&.MuiMultipleSelect': {
26
+ height: 'auto !important',
27
+ minHeight: spacing(11),
28
+ },
29
+ },
30
+ multiple: {
31
+ padding: spacing(2) + ' !important',
32
+ },
33
+ },
34
+ },
35
+ };
36
+ };
37
+
38
+ export default Select;
@@ -0,0 +1,62 @@
1
+ import { Components } from '@mui/material';
2
+
3
+ import {
4
+ CustomColors,
5
+ Spacing,
6
+ TokenStructure,
7
+ } from '@/interfaces/theme.interface';
8
+
9
+ const Switch = (
10
+ _spacing: Spacing,
11
+ tokens: TokenStructure & CustomColors,
12
+ ): Components<unknown> => {
13
+ return {
14
+ MuiSwitch: {
15
+ styleOverrides: {
16
+ root: {
17
+ '.MuiSwitch-track': {
18
+ backgroundColor:
19
+ tokens.backgroundColors?.blueHoverEquivalence?.value,
20
+ opacity: 1 + ' !important',
21
+ border: '1px solid',
22
+ borderColor: tokens.palette?.primary.main?.value,
23
+ },
24
+ '.MuiSwitch-thumb': {
25
+ backgroundColor: tokens.palette?.background?.default?.value,
26
+ },
27
+ '.Mui-checked': {
28
+ '.MuiSwitch-track': {
29
+ backgroundColor: tokens.palette?.primary.main?.value,
30
+ opacity: 1 + ' !important',
31
+ border: '1px solid',
32
+ },
33
+ '.MuiSwitch-thumb': {
34
+ backgroundColor: tokens.blueHoverClickable?.value + ' !important',
35
+ },
36
+ },
37
+ '&.Mui-disabled': {
38
+ '.MuiSwitch-track': {
39
+ backgroundColor:
40
+ tokens.borderColors?.greyLightDefaultBorder?.value,
41
+ borderColor: tokens.greyMediumInactive?.value,
42
+ },
43
+ '.MuiSwitch-thumb': {
44
+ backgroundColor: tokens.backgroundColors?.greyXLight?.value,
45
+ },
46
+ '&.Mui-checked': {
47
+ '.MuiSwitch-track': {
48
+ backgroundColor: tokens.greyMediumInactive?.value,
49
+ },
50
+ '.MuiSwitch-thumb': {
51
+ backgroundColor:
52
+ tokens.textColors.greyDark?.value + ' !important',
53
+ },
54
+ },
55
+ },
56
+ },
57
+ },
58
+ },
59
+ };
60
+ };
61
+
62
+ export default Switch;
@@ -0,0 +1,54 @@
1
+ import { Components } from '@mui/material';
2
+
3
+ import {
4
+ CustomColors,
5
+ Spacing,
6
+ TokenStructure,
7
+ } from '@/interfaces/theme.interface';
8
+
9
+ const Table = (
10
+ spacing: Spacing,
11
+ tokens: TokenStructure & CustomColors,
12
+ ): Components<unknown> => {
13
+ return {
14
+ MuiTableContainer: {
15
+ styleOverrides: {
16
+ root: {
17
+ backgroundColor: tokens.palette?.background.default.value,
18
+ borderRadius: spacing(1),
19
+ },
20
+ },
21
+ },
22
+ MuiTableCell: {
23
+ styleOverrides: {
24
+ root: {
25
+ height: spacing(12.5),
26
+ borderColor: tokens.borderColors.greyLightDefaultBorder?.value,
27
+ },
28
+ head: {
29
+ padding: spacing(0, 4),
30
+ '& .firstSortIcon': {
31
+ paddingLeft: spacing(1),
32
+ },
33
+ },
34
+ body: {
35
+ padding: spacing(3, 4),
36
+ },
37
+ },
38
+ },
39
+ MuiTableRow: {
40
+ styleOverrides: {
41
+ root: {
42
+ height: spacing(12.5),
43
+ borderColor: tokens.borderColors.greyLightDefaultBorder?.value,
44
+ },
45
+ head: {
46
+ height: spacing(10) + ' !important',
47
+ borderColor: tokens.borderColors.greyLightDefaultBorder?.value,
48
+ },
49
+ },
50
+ },
51
+ };
52
+ };
53
+
54
+ export default Table;
@@ -0,0 +1,105 @@
1
+ import { Components } from '@mui/material';
2
+
3
+ import {
4
+ CustomColors,
5
+ Spacing,
6
+ TokenStructure,
7
+ } from '@/interfaces/theme.interface';
8
+
9
+ const TextField = (
10
+ spacing: Spacing,
11
+ tokens: TokenStructure & CustomColors,
12
+ ): Components<unknown> => {
13
+ return {
14
+ MuiTextField: {
15
+ styleOverrides: {
16
+ root: {
17
+ '.itemIcon': {
18
+ display: 'inline-flex',
19
+ alignItems: 'center',
20
+ marginRight: spacing(4),
21
+ },
22
+ '.clearButton': {
23
+ color: tokens.palette?.primary?.main?.value,
24
+ },
25
+ '&::placeholder': {
26
+ color: tokens.palette?.text?.secondary?.value,
27
+ opacity: 1 + ' !important',
28
+ },
29
+ '&.Mui-focused': {
30
+ '.MuiOutlinedInput-notchedOutline': {
31
+ borderWidth: spacing(0.25),
32
+ borderColor: tokens.palette?.primary?.main?.value + ' !important',
33
+ },
34
+ },
35
+ '&.Mui-error': {
36
+ '.MuiOutlinedInput-notchedOutline': {
37
+ borderColor: tokens.palette?.error?.main?.value + ' !important',
38
+ },
39
+ },
40
+ '&.Mui-success': {
41
+ '.MuiOutlinedInput-notchedOutline': {
42
+ borderColor: tokens.palette?.success?.main?.value + ' !important',
43
+ },
44
+ },
45
+ '&.Mui-disabled': {
46
+ '.itemIcon': {
47
+ color: tokens.palette?.text.disabled?.value,
48
+ },
49
+ '.MuiOutlinedInput-root': {
50
+ backgroundColor: tokens.palette?.background?.grey?.value,
51
+ color: tokens.palette?.text?.disabled?.value,
52
+ },
53
+ '.MuiOutlinedInput-notchedOutline': {
54
+ borderColor:
55
+ tokens.palette?.border?.default?.value + ' !important',
56
+ },
57
+ },
58
+ '.MuiAutocomplete-endAdornment': {
59
+ marginRight: spacing(2),
60
+ right: 0 + ' !important',
61
+ '.Mui-error': {
62
+ color: tokens.palette?.error?.main?.value,
63
+ },
64
+ '.Mui-disabled': {
65
+ color: tokens.palette?.text.disabled?.value,
66
+ },
67
+ '.MuiAutocomplete-clearIndicator': {
68
+ height: spacing(5),
69
+ paddingRight: 0,
70
+ paddingLeft: 0,
71
+ marginRight: spacing(2),
72
+ },
73
+ '.itemIcon': {
74
+ marginRight: spacing(0),
75
+ },
76
+ },
77
+ '.MuiAutocomplete-clearIndicator': {
78
+ '&:hover': {
79
+ background: 'none',
80
+ },
81
+ '&:active': {
82
+ background: 'none',
83
+ },
84
+ '&:focus': {
85
+ background: 'none',
86
+ },
87
+ },
88
+ '.MuiAutocomplete-popupIndicator': {
89
+ '&:hover': {
90
+ background: 'none',
91
+ },
92
+ '&:active': {
93
+ background: 'none',
94
+ },
95
+ '&:focus': {
96
+ background: 'none',
97
+ },
98
+ },
99
+ },
100
+ },
101
+ },
102
+ };
103
+ };
104
+
105
+ export default TextField;
@@ -0,0 +1,67 @@
1
+ import { Components } from '@mui/material';
2
+
3
+ import { Spacing } from '@/interfaces/theme.interface';
4
+
5
+ const Typography = (_spacing: Spacing): Components<unknown> => {
6
+ return {
7
+ MuiTypography: {
8
+ styleOverrides: {
9
+ root: {
10
+ variants: [
11
+ {
12
+ props: (props) => props.variant === 'bigNumber',
13
+ style: {
14
+ fontSize: '42px',
15
+ lineHeight: '49px',
16
+ fontWeight: 700,
17
+ },
18
+ },
19
+ {
20
+ props: (props) => props.variant === 'body1Medium',
21
+ style: {
22
+ fontWeight: 500,
23
+ },
24
+ },
25
+ {
26
+ props: (props) =>
27
+ props.variant === 'body1Bold' ||
28
+ props.variant === 'buttonNotif',
29
+ style: {
30
+ fontWeight: 700,
31
+ },
32
+ },
33
+ {
34
+ props: (props) => props.variant === 'body2Medium',
35
+ style: {
36
+ fontWeight: 500,
37
+ },
38
+ },
39
+ {
40
+ props: (props) => props.variant === 'body2Bold',
41
+ style: {
42
+ fontWeight: 700,
43
+ },
44
+ },
45
+ {
46
+ props: (props) => props.variant === 'link1',
47
+ style: {
48
+ fontWeight: 700,
49
+ textDecoration: 'underline',
50
+ },
51
+ },
52
+ {
53
+ props: (props) => props.variant === 'link2',
54
+ style: {
55
+ fontSize: '13px',
56
+ fontWeight: 700,
57
+ textDecoration: 'underline',
58
+ },
59
+ },
60
+ ],
61
+ },
62
+ },
63
+ },
64
+ };
65
+ };
66
+
67
+ export default Typography;
@@ -0,0 +1,23 @@
1
+ import { useMemo } from 'react';
2
+
3
+ import { PaletteMode, ThemeOptions } from '@mui/material';
4
+
5
+ import getTheme from '@/helpers/theme.helper';
6
+ import { Theme } from '@/interfaces/theme.interface';
7
+
8
+ import tokens from '../tokens/tokens.json';
9
+
10
+ const theme = (themeName: Theme, mode: PaletteMode = 'light'): ThemeOptions => {
11
+ const designSystemThemeObject = getTheme(themeName, mode, tokens);
12
+
13
+ const designSystemTheme = useMemo(
14
+ () => ({
15
+ ...designSystemThemeObject,
16
+ }),
17
+ [designSystemThemeObject],
18
+ );
19
+
20
+ return designSystemTheme;
21
+ };
22
+
23
+ export default theme;