@webpros/mui-theme 0.1.6 → 0.2.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 (236) hide show
  1. package/dist/package.json +6 -4
  2. package/dist/src/components/data-display/Avatar/Avatar.theme.js +11 -8
  3. package/dist/src/components/data-display/Badge/Badge.theme.d.ts +4 -1
  4. package/dist/src/components/data-display/Badge/Badge.theme.js +216 -55
  5. package/dist/src/components/data-display/Chip/Chip.theme.d.ts +17 -3
  6. package/dist/src/components/data-display/Chip/Chip.theme.js +133 -477
  7. package/dist/src/components/data-display/Chip/get-chip-colors-map.d.ts +42 -0
  8. package/dist/src/components/data-display/Chip/get-chip-colors-map.js +253 -0
  9. package/dist/src/components/data-display/Divider/Divider.theme.d.ts +6 -1
  10. package/dist/src/components/data-display/Divider/Divider.theme.js +60 -3
  11. package/dist/src/components/data-display/List/List.theme.d.ts +1 -1
  12. package/dist/src/components/data-display/List/List.theme.js +1 -1
  13. package/dist/src/components/data-display/ListItem/ListItem.theme.d.ts +1 -1
  14. package/dist/src/components/data-display/ListItem/ListItem.theme.js +16 -8
  15. package/dist/src/components/data-display/ListItemAvatar/ListItemAvatar.theme.js +1 -2
  16. package/dist/src/components/data-display/ListItemButton/ListItemButton.theme.d.ts +0 -5
  17. package/dist/src/components/data-display/ListItemButton/ListItemButton.theme.js +14 -48
  18. package/dist/src/components/data-display/ListItemIcon/ListItemIcon.theme.js +4 -4
  19. package/dist/src/components/data-display/ListSubheader/ListSubheader.theme.d.ts +1 -1
  20. package/dist/src/components/data-display/ListSubheader/ListSubheader.theme.js +2 -5
  21. package/dist/src/components/data-display/Skeleton/Skeleton.d.ts +3 -0
  22. package/dist/src/components/data-display/Skeleton/Skeleton.js +4 -0
  23. package/dist/src/components/data-display/Skeleton/Skeleton.theme.d.ts +15 -0
  24. package/dist/src/components/data-display/Skeleton/Skeleton.theme.js +31 -0
  25. package/dist/src/components/data-display/Skeleton/index.d.ts +1 -0
  26. package/dist/src/components/data-display/Skeleton/index.js +2 -0
  27. package/dist/src/components/data-display/Tooltip/Tooltip.theme.js +7 -9
  28. package/dist/src/components/data-display/Typography/Typography.theme.d.ts +19 -26
  29. package/dist/src/components/data-display/Typography/Typography.theme.js +7 -163
  30. package/dist/src/components/feedback/Alert/Alert.theme.d.ts +12 -0
  31. package/dist/src/components/feedback/Alert/Alert.theme.js +60 -45
  32. package/dist/src/components/feedback/CircularProgress/CircularProgress.theme.d.ts +6 -1
  33. package/dist/src/components/feedback/CircularProgress/CircularProgress.theme.js +49 -8
  34. package/dist/src/components/feedback/LinearProgress/LinearProgress.theme.d.ts +6 -1
  35. package/dist/src/components/feedback/LinearProgress/LinearProgress.theme.js +83 -9
  36. package/dist/src/components/feedback/Snackbar/Snackbar.theme.d.ts +4 -4
  37. package/dist/src/components/feedback/Snackbar/Snackbar.theme.js +7 -3
  38. package/dist/src/components/index.d.ts +10 -1
  39. package/dist/src/components/index.js +10 -1
  40. package/dist/src/components/inputs/Autocomplete/Autocomplete.theme.d.ts +1 -1
  41. package/dist/src/components/inputs/Autocomplete/Autocomplete.theme.js +23 -51
  42. package/dist/src/components/inputs/Autocomplete/components/AutocompleteCaretDownIcon.d.ts +1 -0
  43. package/dist/src/components/inputs/Autocomplete/components/{AutocompletePopupIcon.js → AutocompleteCaretDownIcon.js} +1 -1
  44. package/dist/src/components/inputs/Autocomplete/components/AutocompleteXIcon.d.ts +1 -0
  45. package/dist/src/components/inputs/Autocomplete/components/AutocompleteXIcon.js +4 -0
  46. package/dist/src/components/inputs/Button/Button.theme.d.ts +4 -0
  47. package/dist/src/components/inputs/Button/Button.theme.js +93 -226
  48. package/dist/src/components/inputs/Button/get-button-colors-map.d.ts +24 -0
  49. package/dist/src/components/inputs/Button/get-button-colors-map.js +211 -0
  50. package/dist/src/components/inputs/Checkbox/Checkbox.theme.d.ts +7 -2
  51. package/dist/src/components/inputs/Checkbox/Checkbox.theme.js +57 -7
  52. package/dist/src/components/inputs/Fab/Fab.theme.d.ts +5 -9
  53. package/dist/src/components/inputs/Fab/Fab.theme.js +27 -98
  54. package/dist/src/components/inputs/FormHelperText/FormHelperText.d.ts +2 -0
  55. package/dist/src/components/inputs/FormHelperText/FormHelperText.js +3 -0
  56. package/dist/src/components/inputs/FormHelperText/FormHelperText.theme.d.ts +7 -0
  57. package/dist/src/components/inputs/FormHelperText/FormHelperText.theme.js +8 -0
  58. package/dist/src/components/inputs/FormHelperText/index.d.ts +1 -0
  59. package/dist/src/components/inputs/FormHelperText/index.js +2 -0
  60. package/dist/src/components/inputs/FormLabel/FormLabel.d.ts +2 -0
  61. package/dist/src/components/inputs/FormLabel/FormLabel.js +3 -0
  62. package/dist/src/components/inputs/FormLabel/FormLabel.theme.d.ts +7 -0
  63. package/dist/src/components/inputs/FormLabel/FormLabel.theme.js +8 -0
  64. package/dist/src/components/inputs/FormLabel/index.d.ts +1 -0
  65. package/dist/src/components/inputs/FormLabel/index.js +2 -0
  66. package/dist/src/components/inputs/IconButton/IconButton.theme.d.ts +3 -2
  67. package/dist/src/components/inputs/IconButton/IconButton.theme.js +90 -95
  68. package/dist/src/components/inputs/InputBase/InputBase.theme.d.ts +9 -26
  69. package/dist/src/components/inputs/InputBase/InputBase.theme.js +2 -64
  70. package/dist/src/components/inputs/InputLabel/InputLabel.theme.d.ts +7 -4
  71. package/dist/src/components/inputs/InputLabel/InputLabel.theme.js +26 -12
  72. package/dist/src/components/inputs/OutlinedInput/OutlinedInput.theme.d.ts +8 -0
  73. package/dist/src/components/inputs/OutlinedInput/OutlinedInput.theme.js +67 -0
  74. package/dist/src/components/inputs/OutlinedInput/index.d.ts +1 -0
  75. package/dist/src/components/inputs/OutlinedInput/index.js +2 -0
  76. package/dist/src/components/inputs/Radio/Radio.d.ts +4 -0
  77. package/dist/src/components/inputs/Radio/Radio.js +4 -0
  78. package/dist/src/components/inputs/Radio/Radio.theme.d.ts +11 -0
  79. package/dist/src/components/inputs/Radio/Radio.theme.js +35 -0
  80. package/dist/src/components/inputs/Radio/index.d.ts +1 -0
  81. package/dist/src/components/{navigation/TabList → inputs/Radio}/index.js +1 -1
  82. package/dist/src/components/inputs/Select/Select.theme.d.ts +2 -3
  83. package/dist/src/components/inputs/Select/Select.theme.js +6 -33
  84. package/dist/src/components/inputs/Switch/Switch.theme.js +125 -49
  85. package/dist/src/components/inputs/TextField/TextField.theme.d.ts +2 -3
  86. package/dist/src/components/inputs/TextField/TextField.theme.js +2 -26
  87. package/dist/src/components/navigation/Breadcrumbs/Breadcrumbs.d.ts +4 -0
  88. package/dist/src/components/navigation/Breadcrumbs/Breadcrumbs.js +5 -0
  89. package/dist/src/components/navigation/Breadcrumbs/Breadcrumbs.theme.d.ts +11 -0
  90. package/dist/src/components/navigation/Breadcrumbs/Breadcrumbs.theme.js +23 -0
  91. package/dist/src/components/navigation/Breadcrumbs/Crumb.d.ts +10 -0
  92. package/dist/src/components/navigation/Breadcrumbs/Crumb.js +10 -0
  93. package/dist/src/components/navigation/Breadcrumbs/index.d.ts +1 -0
  94. package/dist/src/components/navigation/Breadcrumbs/index.js +2 -0
  95. package/dist/src/components/navigation/Drawer/Drawer.theme.d.ts +1 -1
  96. package/dist/src/components/navigation/Drawer/Drawer.theme.js +50 -6
  97. package/dist/src/components/navigation/Link/Link.theme.d.ts +11 -2
  98. package/dist/src/components/navigation/Link/Link.theme.js +66 -9
  99. package/dist/src/components/navigation/Menu/Menu.theme.d.ts +2 -3
  100. package/dist/src/components/navigation/Menu/Menu.theme.js +6 -11
  101. package/dist/src/components/navigation/MenuItem/MenuItem.theme.d.ts +2 -4
  102. package/dist/src/components/navigation/MenuItem/MenuItem.theme.js +8 -8
  103. package/dist/src/components/navigation/Pagination/Pagination.theme.d.ts +1 -1
  104. package/dist/src/components/navigation/Pagination/Pagination.theme.js +11 -3
  105. package/dist/src/components/navigation/PaginationItem/PaginationItem.theme.js +65 -10
  106. package/dist/src/components/navigation/PaginationItem/components/PaginationIcons.d.ts +4 -0
  107. package/dist/src/components/navigation/PaginationItem/components/PaginationIcons.js +8 -0
  108. package/dist/src/components/navigation/PaginationItem/components/index.d.ts +1 -0
  109. package/dist/src/components/navigation/PaginationItem/components/index.js +2 -0
  110. package/dist/src/components/navigation/Tab/Tab.theme.d.ts +7 -1
  111. package/dist/src/components/navigation/Tab/Tab.theme.js +52 -13
  112. package/dist/src/components/navigation/Tabs/Tabs.d.ts +3 -0
  113. package/dist/src/components/navigation/Tabs/Tabs.js +4 -0
  114. package/dist/src/components/navigation/Tabs/Tabs.theme.d.ts +16 -0
  115. package/dist/src/components/navigation/Tabs/Tabs.theme.js +55 -0
  116. package/dist/src/components/navigation/Tabs/index.d.ts +1 -0
  117. package/dist/src/components/navigation/Tabs/index.js +2 -0
  118. package/dist/src/components/surfaces/Accordion/Accordion.theme.js +54 -22
  119. package/dist/src/components/surfaces/Accordion/AccordionDetails.theme.d.ts +10 -0
  120. package/dist/src/components/surfaces/Accordion/AccordionDetails.theme.js +19 -0
  121. package/dist/src/components/surfaces/Accordion/AccordionSummary.theme.d.ts +10 -0
  122. package/dist/src/components/surfaces/Accordion/AccordionSummary.theme.js +37 -0
  123. package/dist/src/components/surfaces/Accordion/index.d.ts +2 -0
  124. package/dist/src/components/surfaces/Accordion/index.js +2 -0
  125. package/dist/src/components/surfaces/Card/Card.theme.js +1 -1
  126. package/dist/src/components/surfaces/Paper/Paper.theme.d.ts +16 -1
  127. package/dist/src/components/surfaces/Paper/Paper.theme.js +21 -7
  128. package/dist/src/components/surfaces/Paper/Paper.tokens.d.ts +8 -0
  129. package/dist/src/components/surfaces/Paper/Paper.tokens.js +50 -0
  130. package/dist/src/components/surfaces/Paper/Paper.variants.d.ts +4 -0
  131. package/dist/src/components/surfaces/Paper/Paper.variants.js +3 -0
  132. package/dist/src/components/surfaces/Popover/Popover.d.ts +4 -0
  133. package/dist/src/components/surfaces/Popover/Popover.js +4 -0
  134. package/dist/src/components/surfaces/Popover/Popover.theme.d.ts +9 -0
  135. package/dist/src/components/surfaces/Popover/Popover.theme.js +14 -0
  136. package/dist/src/components/surfaces/Popover/index.d.ts +1 -0
  137. package/dist/src/components/surfaces/Popover/index.js +2 -0
  138. package/dist/src/components/utils/Backdrop/Backdrop.d.ts +3 -0
  139. package/dist/src/components/utils/Backdrop/Backdrop.js +4 -0
  140. package/dist/src/components/utils/Backdrop/Backdrop.theme.d.ts +11 -0
  141. package/dist/src/components/utils/Backdrop/Backdrop.theme.js +17 -0
  142. package/dist/src/components/utils/Backdrop/index.d.ts +1 -0
  143. package/dist/src/components/utils/Backdrop/index.js +2 -0
  144. package/dist/src/providers/ThemeModeProvider.d.ts +1 -2
  145. package/dist/src/providers/ThemeModeProvider.js +2 -2
  146. package/dist/src/providers/WebProsMuiThemeProvider.js +1 -1
  147. package/dist/src/providers/WebProsTheme.d.ts +1 -0
  148. package/dist/src/providers/WebProsTheme.js +11 -5
  149. package/dist/src/shared/rippleEnterKeyframe.d.ts +6 -0
  150. package/dist/src/shared/rippleEnterKeyframe.js +12 -0
  151. package/dist/src/shared/viewContext/index.d.ts +1 -0
  152. package/dist/src/shared/viewContext/index.js +2 -0
  153. package/dist/src/shared/viewContext/viewContext.d.ts +4 -0
  154. package/dist/src/shared/viewContext/viewContext.js +2 -0
  155. package/dist/src/style/additional-color-palette.d.ts +1 -3
  156. package/dist/src/style/additional-color-palette.js +3 -6
  157. package/dist/src/style/custom-color-palette.js +50 -52
  158. package/dist/src/tokens/ThemeColorTokens.d.ts +11 -93
  159. package/dist/src/tokens/ThemeColorTokens.js +4 -168
  160. package/dist/src/tokens/ThemeScheme.d.ts +0 -3
  161. package/dist/src/tokens/ThemeScheme.js +0 -2
  162. package/dist/src/tokens/colors/Dark.d.ts +16 -0
  163. package/dist/src/tokens/colors/Dark.js +1398 -0
  164. package/dist/src/tokens/colors/Light.d.ts +16 -0
  165. package/dist/src/tokens/colors/Light.js +1398 -0
  166. package/dist/src/tokens/colors/index.d.ts +7 -0
  167. package/dist/src/tokens/colors/index.js +4 -0
  168. package/dist/src/tokens/colors/inverseSchemas.d.ts +40 -0
  169. package/dist/src/tokens/colors/inverseSchemas.js +3 -0
  170. package/dist/src/tokens/colors/inverseSchemes.d.ts +53 -0
  171. package/dist/src/tokens/colors/inverseSchemes.js +3 -0
  172. package/dist/src/tokens/colors/inverseStateLayers.d.ts +174 -0
  173. package/dist/src/tokens/colors/inverseStateLayers.js +3 -0
  174. package/dist/src/tokens/colors/schemas.d.ts +111 -0
  175. package/dist/src/tokens/colors/schemas.js +3 -0
  176. package/dist/src/tokens/colors/schemes.d.ts +111 -0
  177. package/dist/src/tokens/colors/schemes.js +3 -0
  178. package/dist/src/tokens/colors/stateLayers.d.ts +456 -0
  179. package/dist/src/tokens/colors/stateLayers.js +3 -0
  180. package/dist/src/tokens/colors/types.d.ts +9 -0
  181. package/dist/src/tokens/colors/types.js +2 -0
  182. package/dist/src/tokens/index.d.ts +6 -2
  183. package/dist/src/tokens/index.js +2 -1
  184. package/dist/src/tokens/legacyColors/LegacyDark.d.ts +2 -0
  185. package/dist/src/tokens/legacyColors/LegacyDark.js +88 -0
  186. package/dist/src/tokens/legacyColors/LegacyLight.d.ts +2 -0
  187. package/dist/src/tokens/legacyColors/LegacyLight.js +86 -0
  188. package/dist/src/tokens/legacyColors/ThemeColorTokensLegacy.d.ts +74 -0
  189. package/dist/src/tokens/legacyColors/ThemeColorTokensLegacy.js +2 -0
  190. package/dist/src/tokens/legacyColors/additionalColors/additionalColors.d.ts +21 -0
  191. package/dist/src/tokens/legacyColors/additionalColors/additionalColors.js +2 -0
  192. package/dist/src/tokens/{additionalColors → legacyColors/additionalColors}/index.d.ts +1 -0
  193. package/dist/src/tokens/{additionalColors → legacyColors/additionalColors}/index.js +1 -0
  194. package/dist/src/tokens/legacyColors/index.d.ts +2 -0
  195. package/dist/src/tokens/legacyColors/index.js +3 -0
  196. package/dist/src/tokens/shadows/index.d.ts +12 -0
  197. package/dist/src/tokens/shadows/index.js +112 -0
  198. package/dist/src/tokens/typography/index.d.ts +2 -0
  199. package/dist/src/tokens/typography/index.js +4 -0
  200. package/dist/src/tokens/typography/typescale.d.ts +28 -0
  201. package/dist/src/tokens/typography/typescale.js +26 -0
  202. package/dist/src/tokens/typography/typography.d.ts +2 -0
  203. package/dist/src/tokens/typography/typography.js +156 -0
  204. package/dist/src/utils/flatten.d.ts +1 -0
  205. package/dist/src/utils/flatten.js +12 -0
  206. package/dist/src/utils/getMUIComponents.js +2 -2
  207. package/dist/src/utils/getMUIPalette.d.ts +4 -9
  208. package/dist/src/utils/getMUIPalette.js +49 -25
  209. package/dist/src/utils/getMUIThemeCustoimzationType.d.ts +31 -0
  210. package/dist/src/utils/getMUIThemeCustoimzationType.js +2 -0
  211. package/dist/src/utils/getMUITypography.d.ts +2 -0
  212. package/dist/src/utils/getMUITypography.js +5 -0
  213. package/dist/src/utils/getStateLayerColor.d.ts +37 -0
  214. package/dist/src/utils/getStateLayerColor.js +43 -1
  215. package/dist/src/utils/index.d.ts +1 -1
  216. package/dist/src/utils/index.js +1 -1
  217. package/dist/src/utils/patchMUIShadows.js +4 -3
  218. package/package.json +6 -4
  219. package/dist/src/components/inputs/Autocomplete/components/AutocompletePopupIcon.d.ts +0 -1
  220. package/dist/src/components/navigation/PaginationItem/PaginationItem.d.ts +0 -3
  221. package/dist/src/components/navigation/PaginationItem/PaginationItem.js +0 -4
  222. package/dist/src/components/navigation/TabList/TabList.d.ts +0 -3
  223. package/dist/src/components/navigation/TabList/TabList.js +0 -4
  224. package/dist/src/components/navigation/TabList/TabList.theme.d.ts +0 -10
  225. package/dist/src/components/navigation/TabList/TabList.theme.js +0 -17
  226. package/dist/src/components/navigation/TabList/index.d.ts +0 -1
  227. package/dist/src/hooks/useTonalPalette.d.ts +0 -3
  228. package/dist/src/hooks/useTonalPalette.js +0 -32
  229. package/dist/src/providers/ThemeSchemeProvider.d.ts +0 -12
  230. package/dist/src/providers/ThemeSchemeProvider.js +0 -29
  231. package/dist/src/tokens/TonalPalette.d.ts +0 -10
  232. package/dist/src/tokens/TonalPalette.js +0 -10
  233. package/dist/src/utils/generateTokens.d.ts +0 -4
  234. package/dist/src/utils/generateTokens.js +0 -107
  235. /package/dist/src/tokens/{Tone.d.ts → legacyColors/Tone.d.ts} +0 -0
  236. /package/dist/src/tokens/{Tone.js → legacyColors/Tone.js} +0 -0
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@webpros/mui-theme",
3
3
  "description": "MUI v6 theme for WebPros products",
4
- "version": "0.1.6",
4
+ "version": "0.2.0",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -42,7 +42,8 @@
42
42
  "eslint": "eslint",
43
43
  "prettier:test": "prettier --check \"**/*.{ts,tsx}\"",
44
44
  "prettier:write": "prettier --write \"**/*.{ts,tsx}\"",
45
- "typecheck": "tsc --noEmit"
45
+ "typecheck": "tsc --noEmit",
46
+ "extract-tokens": "node tools/extractM3Tokens.js"
46
47
  },
47
48
  "peerDependencies": {
48
49
  "@emotion/react": "^11.14.0",
@@ -93,12 +94,13 @@
93
94
  "react": "^18.3.1",
94
95
  "react-dom": "^18.3.1",
95
96
  "storybook": "^9.1.16",
97
+ "storybook-addon-pseudo-states": "^10.0.3",
96
98
  "tsc-alias": "^1.8.16",
97
99
  "typescript": "~5.9.3",
98
100
  "typescript-eslint": "^8.46.1",
101
+ "usehooks-ts": "^3.1.1",
99
102
  "vite": "^7.1.10",
100
- "vite-plugin-dts": "^4.5.4",
101
- "usehooks-ts": "^3.1.1"
103
+ "vite-plugin-dts": "^4.5.4"
102
104
  },
103
105
  "browserslist": [
104
106
  "last 2 versions",
@@ -1,19 +1,22 @@
1
1
  // Copyright 2025 WebPros International GmbH. All rights reserved.
2
2
  export const getAvatar = (theme) => {
3
- const { palette } = theme;
3
+ const { colors } = theme;
4
4
  return {
5
5
  MuiAvatar: {
6
6
  styleOverrides: {
7
7
  root: {
8
- width: 40,
9
- height: 40,
10
- borderRadius: '50%',
11
- color: palette.primary.main,
12
- img: {
13
- borderRadius: '50%',
14
- },
8
+ color: colors.schemes.base.primary,
9
+ backgroundColor: colors.schemes.base.primaryContainer,
15
10
  },
16
11
  },
12
+ variants: [
13
+ {
14
+ props: { variant: 'rounded' },
15
+ style: {
16
+ borderRadius: '6px',
17
+ },
18
+ },
19
+ ],
17
20
  },
18
21
  };
19
22
  };
@@ -1,15 +1,18 @@
1
1
  import { Theme, ComponentsProps, ComponentsOverrides, ComponentsVariants } from '@mui/material';
2
+ import { ComponentWithViewContextOwnProps } from '../../../shared/viewContext';
2
3
  declare module '@mui/material/Badge' {
3
4
  interface BadgePropsColorOverrides {
4
5
  tertiary: true;
5
6
  outlined: true;
7
+ undefined: true;
6
8
  }
7
- interface BadgeOwnProps {
9
+ interface BadgeOwnProps extends ComponentWithViewContextOwnProps {
8
10
  size?: 'small' | 'medium' | 'large';
9
11
  horizontal?: 'left' | 'center' | 'right';
10
12
  vertical?: 'bottom' | 'center' | 'top';
11
13
  transformVertical?: number;
12
14
  transformHorizontal?: number;
15
+ icon?: boolean;
13
16
  }
14
17
  }
15
18
  interface M3Badge {
@@ -1,129 +1,290 @@
1
- // Copyright 2025 WebPros International GmbH. All rights reserved.
2
- import { badgeClasses, } from '@mui/material';
1
+ // Clip paths for special shapes
2
+ const OCTAGON_CLIP_PATH = 'polygon(5px 0, calc(100% - 5px) 0, 100% 5px, 100% calc(100% - 5px), calc(100% - 5px) 100%, 5px 100%, 0 calc(100% - 5px), 0 5px)';
3
+ const OCTAGON_SMALL_CLIP_PATH = 'polygon(2.5px 0, calc(100% - 2.5px) 0, 100% 2.5px, 100% calc(100% - 2.5px), calc(100% - 2.5px) 100%, 2.5px 100%, 0 calc(100% - 2.5px), 0 2.5px)';
4
+ const DIAMOND_CLIP_PATH = 'polygon(50% 0, 100% 50%, 50% 100%, 0 50%)';
5
+ // Base styles for icon badges
6
+ const iconBaseStyle = (size) => ({
7
+ width: size,
8
+ height: size,
9
+ minWidth: size,
10
+ minHeight: size,
11
+ padding: 0,
12
+ });
13
+ const DIAMOND_STRETCH_CLIP_PATH = 'polygon(9px 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 9px 100%, 0 50%)';
3
14
  export const getBadge = (theme) => {
4
- const { palette } = theme;
15
+ const { colors } = theme;
5
16
  return {
6
17
  MuiBadge: {
7
- defaultProps: { color: 'default', size: 'small' },
18
+ defaultProps: { color: 'error', size: 'small', max: 999 },
19
+ styleOverrides: {
20
+ badge: {
21
+ display: 'flex',
22
+ alignItems: 'center',
23
+ justifyContent: 'center',
24
+ },
25
+ },
8
26
  variants: [
27
+ // Color variants
28
+ {
29
+ props: { color: 'error' },
30
+ style: {
31
+ '& .MuiBadge-badge': {
32
+ backgroundColor: colors.schemes.status.error,
33
+ color: colors.schemes.status.onError,
34
+ },
35
+ },
36
+ },
9
37
  {
10
- props: { color: 'default' },
38
+ props: { color: 'warning' },
11
39
  style: {
12
- [`.${badgeClasses.badge}`]: {
13
- backgroundColor: palette.error.main,
14
- color: palette.onError.main,
40
+ '& .MuiBadge-badge': {
41
+ backgroundColor: colors.schemes.status.warning,
42
+ color: colors.schemes.status.onWarning,
43
+ },
44
+ },
45
+ },
46
+ {
47
+ props: { color: 'success' },
48
+ style: {
49
+ '& .MuiBadge-badge': {
50
+ backgroundColor: colors.schemes.status.success,
51
+ color: colors.schemes.status.onSuccess,
52
+ },
53
+ },
54
+ },
55
+ {
56
+ props: { color: 'undefined' },
57
+ style: {
58
+ '& .MuiBadge-badge': {
59
+ backgroundColor: colors.schemes.base.primary,
60
+ color: colors.schemes.base.onPrimary,
15
61
  },
16
62
  },
17
63
  },
18
64
  {
19
65
  props: { color: 'outlined' },
20
66
  style: {
21
- [`.${badgeClasses.badge}`]: {
22
- backgroundColor: palette.surfaceContainerLowest.main,
23
- color: palette.onSurfaceVariant.main,
24
- borderColor: palette.outline.main,
67
+ '& .MuiBadge-badge': {
68
+ backgroundColor: colors.schemes.surfaces.surfaceContainerLowest,
69
+ color: colors.schemes.surfaces.onSurfaceVariant,
25
70
  borderWidth: 1,
26
71
  borderStyle: 'solid',
72
+ borderColor: colors.schemes.surfaces.outline,
73
+ },
74
+ },
75
+ },
76
+ // Inverse color variants
77
+ {
78
+ props: { color: 'error', viewContext: 'inverse' },
79
+ style: {
80
+ '& .MuiBadge-badge': {
81
+ backgroundColor: colors.inverseSchemes.status.error,
82
+ color: colors.inverseSchemes.status.onError,
83
+ },
84
+ },
85
+ },
86
+ {
87
+ props: { color: 'warning', viewContext: 'inverse' },
88
+ style: {
89
+ '& .MuiBadge-badge': {
90
+ backgroundColor: colors.inverseSchemes.status.warning,
91
+ color: colors.inverseSchemes.status.onWarning,
27
92
  },
28
93
  },
29
94
  },
30
- // BadgeOwnProps['size']
95
+ {
96
+ props: { color: 'success', viewContext: 'inverse' },
97
+ style: {
98
+ '& .MuiBadge-badge': {
99
+ backgroundColor: colors.inverseSchemes.status.success,
100
+ color: colors.inverseSchemes.status.onSuccess,
101
+ },
102
+ },
103
+ },
104
+ {
105
+ props: { color: 'undefined', viewContext: 'inverse' },
106
+ style: {
107
+ '& .MuiBadge-badge': {
108
+ backgroundColor: colors.inverseSchemes.base.primary,
109
+ color: colors.inverseSchemes.base.onPrimary,
110
+ },
111
+ },
112
+ },
113
+ // Size variants
31
114
  {
32
115
  props: { size: 'small' },
33
116
  style: {
34
- [`.${badgeClasses.badge}`]: {
117
+ '& .MuiBadge-badge': {
35
118
  minWidth: 6,
36
119
  minHeight: 6,
37
- width: 6,
38
- height: 6,
39
- borderRadius: 6,
120
+ borderRadius: 999,
40
121
  },
41
122
  },
42
123
  },
43
124
  {
44
125
  props: { size: 'medium' },
45
126
  style: {
46
- [`.${badgeClasses.badge}`]: {
47
- minWidth: 12,
48
- minHeight: 12,
49
- width: 12,
50
- height: 12,
51
- borderRadius: 12,
127
+ '& .MuiBadge-badge': {
128
+ minWidth: 9,
129
+ minHeight: 9,
130
+ borderRadius: 999,
52
131
  },
53
132
  },
54
133
  },
55
134
  {
56
135
  props: { size: 'large' },
57
136
  style: {
58
- [`.${badgeClasses.badge}`]: {
59
- minWidth: 16,
60
- minHeight: 16,
61
- width: 16,
62
- height: 16,
63
- borderRadius: 16,
137
+ '& .MuiBadge-badge': {
138
+ minWidth: 18,
139
+ minHeight: 18,
140
+ borderRadius: 999,
64
141
  },
65
142
  },
66
143
  },
144
+ // Dot variants
67
145
  {
68
- props: {
69
- horizontal: 'left',
146
+ props: { size: 'small', variant: 'dot' },
147
+ style: {
148
+ '& .MuiBadge-badge': {
149
+ width: 6,
150
+ height: 6,
151
+ borderRadius: 999,
152
+ },
70
153
  },
154
+ },
155
+ {
156
+ props: { size: 'medium', variant: 'dot' },
71
157
  style: {
72
- [`.${badgeClasses.badge}`]: {
73
- left: '0',
158
+ '& .MuiBadge-badge': {
159
+ width: 9,
160
+ height: 9,
161
+ borderRadius: 999,
74
162
  },
75
163
  },
76
164
  },
77
165
  {
78
- props: {
79
- horizontal: 'center',
166
+ props: { size: 'medium', color: 'error', variant: 'dot' },
167
+ style: {
168
+ '& .MuiBadge-badge': {
169
+ width: 9,
170
+ height: 9,
171
+ clipPath: OCTAGON_SMALL_CLIP_PATH,
172
+ borderRadius: 0,
173
+ },
80
174
  },
175
+ },
176
+ {
177
+ props: { size: 'medium', color: 'warning', variant: 'dot' },
81
178
  style: {
82
- [`.${badgeClasses.badge}`]: {
83
- left: '50%',
179
+ '& .MuiBadge-badge': {
180
+ width: 9,
181
+ height: 9,
182
+ clipPath: DIAMOND_CLIP_PATH,
183
+ borderRadius: 0,
84
184
  },
85
185
  },
86
186
  },
187
+ // Large standard variants with special shapes
87
188
  {
88
- props: {
89
- horizontal: 'right',
189
+ props: { size: 'large', color: 'error', variant: 'standard' },
190
+ style: {
191
+ '& .MuiBadge-badge': {
192
+ height: 18,
193
+ minHeight: 18,
194
+ padding: '0 6px',
195
+ clipPath: OCTAGON_CLIP_PATH,
196
+ borderRadius: 0,
197
+ },
90
198
  },
199
+ },
200
+ {
201
+ props: { size: 'large', color: 'warning', variant: 'standard' },
91
202
  style: {
92
- [`.${badgeClasses.badge}`]: {
93
- right: '0',
203
+ '& .MuiBadge-badge': {
204
+ height: 18,
205
+ minHeight: 18,
206
+ padding: '0 6px',
207
+ clipPath: DIAMOND_STRETCH_CLIP_PATH,
208
+ borderRadius: 0,
94
209
  },
95
210
  },
96
211
  },
97
212
  {
98
- props: {
99
- vertical: 'bottom',
213
+ props: { size: 'large', color: 'success', variant: 'standard' },
214
+ style: {
215
+ '& .MuiBadge-badge': {
216
+ minWidth: 18,
217
+ height: 18,
218
+ minHeight: 18,
219
+ paddingLeft: 4,
220
+ paddingRight: 4,
221
+ borderRadius: 999,
222
+ },
100
223
  },
224
+ },
225
+ {
226
+ props: { size: 'large', color: 'undefined', variant: 'standard' },
101
227
  style: {
102
- [`.${badgeClasses.badge}`]: {
103
- bottom: '0',
228
+ '& .MuiBadge-badge': {
229
+ minWidth: 18,
230
+ height: 18,
231
+ minHeight: 18,
232
+ paddingLeft: 4,
233
+ paddingRight: 4,
234
+ borderRadius: 999,
104
235
  },
105
236
  },
106
237
  },
238
+ // Icon variants (fixed square size)
107
239
  {
108
- props: {
109
- vertical: 'center',
240
+ props: { size: 'large', color: 'error', icon: true },
241
+ style: {
242
+ '& .MuiBadge-badge': Object.assign(Object.assign({}, iconBaseStyle(18)), { clipPath: OCTAGON_CLIP_PATH, borderRadius: 0 }),
110
243
  },
244
+ },
245
+ {
246
+ props: { size: 'large', color: 'warning', icon: true },
111
247
  style: {
112
- [`.${badgeClasses.badge}`]: {
113
- top: '50%',
114
- },
248
+ '& .MuiBadge-badge': Object.assign(Object.assign({}, iconBaseStyle(20)), { clipPath: DIAMOND_CLIP_PATH, borderRadius: 0 }),
115
249
  },
116
250
  },
117
251
  {
118
- props: {
119
- vertical: 'top',
252
+ props: { size: 'large', color: 'success', icon: true },
253
+ style: {
254
+ '& .MuiBadge-badge': Object.assign(Object.assign({}, iconBaseStyle(18)), { borderRadius: 999 }),
120
255
  },
256
+ },
257
+ {
258
+ props: { size: 'large', color: 'undefined', icon: true },
121
259
  style: {
122
- [`.${badgeClasses.badge}`]: {
123
- top: '0',
124
- },
260
+ '& .MuiBadge-badge': Object.assign(Object.assign({}, iconBaseStyle(18)), { borderRadius: 999 }),
125
261
  },
126
262
  },
263
+ // Position variants
264
+ {
265
+ props: { horizontal: 'left' },
266
+ style: { '& .MuiBadge-badge': { left: 0 } },
267
+ },
268
+ {
269
+ props: { horizontal: 'center' },
270
+ style: { '& .MuiBadge-badge': { left: '50%' } },
271
+ },
272
+ {
273
+ props: { horizontal: 'right' },
274
+ style: { '& .MuiBadge-badge': { right: 0 } },
275
+ },
276
+ {
277
+ props: { vertical: 'bottom' },
278
+ style: { '& .MuiBadge-badge': { bottom: 0 } },
279
+ },
280
+ {
281
+ props: { vertical: 'center' },
282
+ style: { '& .MuiBadge-badge': { top: '50%' } },
283
+ },
284
+ {
285
+ props: { vertical: 'top' },
286
+ style: { '& .MuiBadge-badge': { top: 0 } },
287
+ },
127
288
  ],
128
289
  },
129
290
  };
@@ -1,9 +1,23 @@
1
1
  import { ComponentsProps, ComponentsOverrides, ComponentsVariants, Theme } from '@mui/material';
2
+ import { ComponentWithViewContextOwnProps } from '../../../shared/viewContext';
2
3
  declare module '@mui/material/Chip' {
3
- interface ChipPropsVariantOverrides {
4
- ghost: true;
4
+ interface ChipPropsSizeOverrides {
5
+ extraSmall: true;
6
+ small: true;
7
+ medium: true;
8
+ large: true;
5
9
  }
6
- interface ChipOwnProps {
10
+ interface ChipPropsColorOverrides {
11
+ primary: true;
12
+ secondary: true;
13
+ default: true;
14
+ undefined: true;
15
+ error: true;
16
+ success: true;
17
+ warning: true;
18
+ info: true;
19
+ }
20
+ interface ChipOwnProps extends ComponentWithViewContextOwnProps {
7
21
  selected?: boolean;
8
22
  }
9
23
  }