@mui/material 6.0.0-alpha.10 → 6.0.0-alpha.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.
Files changed (208) hide show
  1. package/Accordion/Accordion.d.ts +3 -3
  2. package/AccordionActions/AccordionActions.d.ts +2 -2
  3. package/AccordionDetails/AccordionDetails.d.ts +2 -2
  4. package/AccordionSummary/AccordionSummary.d.ts +3 -3
  5. package/Alert/Alert.d.ts +3 -3
  6. package/AlertTitle/AlertTitle.d.ts +3 -3
  7. package/AppBar/AppBar.d.ts +3 -3
  8. package/Autocomplete/Autocomplete.d.ts +2 -2
  9. package/Autocomplete/Autocomplete.js +9 -17
  10. package/Avatar/Avatar.d.ts +2 -2
  11. package/AvatarGroup/AvatarGroup.d.ts +2 -2
  12. package/Backdrop/Backdrop.d.ts +3 -3
  13. package/Badge/Badge.d.ts +3 -3
  14. package/BottomNavigation/BottomNavigation.d.ts +2 -2
  15. package/BottomNavigationAction/BottomNavigationAction.d.ts +3 -3
  16. package/Box/Box.d.ts +2 -2
  17. package/Breadcrumbs/Breadcrumbs.d.ts +3 -3
  18. package/Button/Button.d.ts +4 -4
  19. package/ButtonBase/ButtonBase.d.ts +2 -2
  20. package/ButtonGroup/ButtonGroup.d.ts +2 -2
  21. package/CHANGELOG.md +76 -0
  22. package/Card/Card.d.ts +3 -3
  23. package/CardActionArea/CardActionArea.d.ts +3 -3
  24. package/CardActions/CardActions.d.ts +2 -2
  25. package/CardContent/CardContent.d.ts +2 -2
  26. package/CardHeader/CardHeader.d.ts +2 -2
  27. package/CardMedia/CardMedia.d.ts +2 -2
  28. package/Checkbox/Checkbox.d.ts +4 -4
  29. package/Chip/Chip.d.ts +5 -5
  30. package/Chip/Chip.js +0 -2
  31. package/CircularProgress/CircularProgress.d.ts +2 -2
  32. package/Collapse/Collapse.d.ts +5 -5
  33. package/Collapse/Collapse.js +1 -2
  34. package/Container/Container.d.ts +2 -2
  35. package/CssBaseline/CssBaseline.d.ts +2 -2
  36. package/Dialog/Dialog.d.ts +3 -3
  37. package/Dialog/Dialog.js +1 -2
  38. package/DialogActions/DialogActions.d.ts +2 -2
  39. package/DialogContent/DialogContent.d.ts +2 -2
  40. package/DialogContentText/DialogContentText.d.ts +3 -3
  41. package/DialogTitle/DialogTitle.d.ts +3 -3
  42. package/Divider/Divider.d.ts +3 -3
  43. package/Drawer/Drawer.d.ts +3 -3
  44. package/Drawer/Drawer.js +1 -2
  45. package/Fab/Fab.d.ts +3 -3
  46. package/Fade/Fade.d.ts +3 -3
  47. package/Fade/Fade.js +1 -1
  48. package/FilledInput/FilledInput.d.ts +3 -3
  49. package/FormControl/FormControl.d.ts +6 -6
  50. package/FormControlLabel/FormControlLabel.d.ts +4 -4
  51. package/FormGroup/FormGroup.d.ts +3 -3
  52. package/FormHelperText/FormHelperText.d.ts +2 -2
  53. package/FormLabel/FormLabel.d.ts +4 -4
  54. package/GlobalStyles/GlobalStyles.d.ts +3 -3
  55. package/Grid/Grid.d.ts +2 -2
  56. package/Grid/Grid.js +7 -13
  57. package/Grow/Grow.d.ts +5 -5
  58. package/Grow/Grow.js +1 -1
  59. package/Hidden/Hidden.d.ts +2 -2
  60. package/Icon/Icon.d.ts +3 -3
  61. package/IconButton/IconButton.d.ts +4 -4
  62. package/ImageList/ImageList.d.ts +2 -2
  63. package/ImageListItem/ImageListItem.d.ts +2 -2
  64. package/ImageListItemBar/ImageListItemBar.d.ts +2 -2
  65. package/Input/Input.d.ts +3 -3
  66. package/InputAdornment/InputAdornment.d.ts +2 -2
  67. package/InputBase/InputBase.d.ts +2 -2
  68. package/InputBase/InputBase.js +26 -20
  69. package/InputLabel/InputLabel.d.ts +3 -3
  70. package/LinearProgress/LinearProgress.d.ts +2 -2
  71. package/Link/Link.d.ts +4 -4
  72. package/Link/Link.js +1 -2
  73. package/List/List.d.ts +3 -3
  74. package/ListItem/ListItem.d.ts +3 -3
  75. package/ListItemAvatar/ListItemAvatar.d.ts +2 -2
  76. package/ListItemButton/ListItemButton.d.ts +3 -3
  77. package/ListItemIcon/ListItemIcon.d.ts +2 -2
  78. package/ListItemSecondaryAction/ListItemSecondaryAction.d.ts +2 -2
  79. package/ListItemText/ListItemText.d.ts +2 -2
  80. package/ListSubheader/ListSubheader.d.ts +2 -2
  81. package/Menu/Menu.d.ts +4 -4
  82. package/MenuItem/MenuItem.d.ts +3 -3
  83. package/MenuList/MenuList.d.ts +4 -4
  84. package/MobileStepper/MobileStepper.d.ts +3 -3
  85. package/Modal/Modal.d.ts +8 -8
  86. package/NativeSelect/NativeSelect.d.ts +3 -3
  87. package/OutlinedInput/OutlinedInput.d.ts +3 -3
  88. package/Pagination/Pagination.d.ts +2 -2
  89. package/PaginationItem/PaginationItem.d.ts +2 -2
  90. package/Paper/Paper.d.ts +3 -3
  91. package/Paper/Paper.js +1 -2
  92. package/Popover/Popover.d.ts +4 -4
  93. package/Popper/Popper.d.ts +4 -4
  94. package/Popper/Popper.js +4 -4
  95. package/Radio/Radio.d.ts +3 -3
  96. package/RadioGroup/RadioGroup.d.ts +3 -3
  97. package/Rating/Rating.d.ts +2 -2
  98. package/ScopedCssBaseline/ScopedCssBaseline.d.ts +2 -2
  99. package/Select/Select.d.ts +3 -3
  100. package/Skeleton/Skeleton.d.ts +2 -2
  101. package/Slide/Slide.d.ts +4 -4
  102. package/Slide/Slide.js +1 -1
  103. package/Slider/Slider.d.ts +3 -3
  104. package/Snackbar/Snackbar.d.ts +2 -2
  105. package/Snackbar/Snackbar.js +1 -2
  106. package/SnackbarContent/SnackbarContent.d.ts +3 -3
  107. package/SpeedDial/SpeedDial.d.ts +2 -2
  108. package/SpeedDial/SpeedDial.js +1 -2
  109. package/SpeedDialAction/SpeedDialAction.d.ts +3 -3
  110. package/SpeedDialIcon/SpeedDialIcon.d.ts +2 -2
  111. package/Stack/Stack.d.ts +2 -2
  112. package/Step/Step.d.ts +2 -2
  113. package/StepButton/StepButton.d.ts +3 -3
  114. package/StepConnector/StepConnector.d.ts +3 -3
  115. package/StepContent/StepContent.d.ts +2 -2
  116. package/StepIcon/StepIcon.d.ts +2 -2
  117. package/StepLabel/StepLabel.d.ts +2 -2
  118. package/Stepper/Stepper.d.ts +2 -2
  119. package/SvgIcon/SvgIcon.d.ts +3 -3
  120. package/SwipeableDrawer/SwipeableDrawer.d.ts +3 -3
  121. package/SwipeableDrawer/SwipeableDrawer.js +3 -3
  122. package/Switch/Switch.d.ts +4 -4
  123. package/Tab/Tab.d.ts +4 -4
  124. package/Tab/Tab.js +3 -1
  125. package/Tab/tabClasses.d.ts +1 -1
  126. package/TabScrollButton/TabScrollButton.d.ts +2 -2
  127. package/Table/Table.d.ts +2 -2
  128. package/TableBody/TableBody.d.ts +2 -2
  129. package/TableCell/TableCell.d.ts +2 -2
  130. package/TableContainer/TableContainer.d.ts +2 -2
  131. package/TableFooter/TableFooter.d.ts +2 -2
  132. package/TableHead/TableHead.d.ts +2 -2
  133. package/TablePagination/TablePagination.d.ts +4 -4
  134. package/TableRow/TableRow.d.ts +2 -2
  135. package/TableSortLabel/TableSortLabel.d.ts +3 -3
  136. package/Tabs/Tabs.d.ts +2 -2
  137. package/Tabs/Tabs.js +1 -2
  138. package/TextField/TextField.d.ts +10 -10
  139. package/ToggleButton/ToggleButton.d.ts +3 -3
  140. package/ToggleButtonGroup/ToggleButtonGroup.d.ts +2 -2
  141. package/Toolbar/Toolbar.d.ts +2 -2
  142. package/Tooltip/Tooltip.d.ts +2 -2
  143. package/Tooltip/Tooltip.js +1 -2
  144. package/Typography/Typography.d.ts +3 -3
  145. package/Typography/Typography.js +2 -2
  146. package/Zoom/Zoom.d.ts +3 -3
  147. package/Zoom/Zoom.js +1 -1
  148. package/index.js +1 -1
  149. package/modern/Autocomplete/Autocomplete.js +9 -17
  150. package/modern/Chip/Chip.js +0 -2
  151. package/modern/Collapse/Collapse.js +1 -2
  152. package/modern/Dialog/Dialog.js +1 -2
  153. package/modern/Drawer/Drawer.js +1 -2
  154. package/modern/Fade/Fade.js +1 -1
  155. package/modern/Grid/Grid.js +7 -13
  156. package/modern/Grow/Grow.js +1 -1
  157. package/modern/InputBase/InputBase.js +26 -20
  158. package/modern/Link/Link.js +1 -2
  159. package/modern/Paper/Paper.js +1 -2
  160. package/modern/Popper/Popper.js +4 -4
  161. package/modern/Slide/Slide.js +1 -1
  162. package/modern/Snackbar/Snackbar.js +1 -2
  163. package/modern/SpeedDial/SpeedDial.js +1 -2
  164. package/modern/SwipeableDrawer/SwipeableDrawer.js +3 -3
  165. package/modern/Tab/Tab.js +3 -1
  166. package/modern/Tabs/Tabs.js +1 -2
  167. package/modern/Tooltip/Tooltip.js +1 -2
  168. package/modern/Typography/Typography.js +2 -2
  169. package/modern/Zoom/Zoom.js +1 -1
  170. package/modern/index.js +1 -1
  171. package/modern/styles/createTheme.js +1 -1
  172. package/modern/styles/index.js +2 -1
  173. package/modern/styles/stringifyTheme.js +55 -0
  174. package/modern/zero-styled/index.js +20 -1
  175. package/node/Autocomplete/Autocomplete.js +9 -17
  176. package/node/Chip/Chip.js +0 -2
  177. package/node/Collapse/Collapse.js +1 -2
  178. package/node/Dialog/Dialog.js +1 -2
  179. package/node/Drawer/Drawer.js +1 -2
  180. package/node/Fade/Fade.js +2 -2
  181. package/node/Grid/Grid.js +7 -13
  182. package/node/Grow/Grow.js +2 -2
  183. package/node/InputBase/InputBase.js +25 -19
  184. package/node/Link/Link.js +1 -2
  185. package/node/Paper/Paper.js +1 -2
  186. package/node/Popper/Popper.js +4 -4
  187. package/node/Slide/Slide.js +2 -2
  188. package/node/Snackbar/Snackbar.js +1 -2
  189. package/node/SpeedDial/SpeedDial.js +1 -2
  190. package/node/SwipeableDrawer/SwipeableDrawer.js +5 -4
  191. package/node/Tab/Tab.js +3 -1
  192. package/node/Tabs/Tabs.js +1 -2
  193. package/node/Tooltip/Tooltip.js +1 -2
  194. package/node/Typography/Typography.js +2 -2
  195. package/node/Zoom/Zoom.js +2 -2
  196. package/node/index.js +1 -1
  197. package/node/styles/createTheme.js +1 -1
  198. package/node/styles/index.js +20 -1
  199. package/node/styles/stringifyTheme.js +62 -0
  200. package/node/zero-styled/index.js +29 -0
  201. package/package.json +6 -6
  202. package/styles/createTheme.js +1 -1
  203. package/styles/index.d.ts +3 -0
  204. package/styles/index.js +2 -1
  205. package/styles/stringifyTheme.d.ts +20 -0
  206. package/styles/stringifyTheme.js +55 -0
  207. package/zero-styled/index.d.ts +7 -0
  208. package/zero-styled/index.js +20 -1
@@ -30,6 +30,7 @@ var _exportNames = {
30
30
  unstable_getUnit: true,
31
31
  unstable_toUnitless: true,
32
32
  responsiveFontSizes: true,
33
+ createTransitions: true,
33
34
  duration: true,
34
35
  easing: true,
35
36
  useTheme: true,
@@ -96,6 +97,12 @@ Object.defineProperty(exports, "createTheme", {
96
97
  return _createTheme.default;
97
98
  }
98
99
  });
100
+ Object.defineProperty(exports, "createTransitions", {
101
+ enumerable: true,
102
+ get: function () {
103
+ return _createTransitions.default;
104
+ }
105
+ });
99
106
  Object.defineProperty(exports, "css", {
100
107
  enumerable: true,
101
108
  get: function () {
@@ -298,7 +305,7 @@ var _createMuiStrictModeTheme = _interopRequireDefault(require("./createMuiStric
298
305
  var _createStyles = _interopRequireDefault(require("./createStyles"));
299
306
  var _cssUtils = require("./cssUtils");
300
307
  var _responsiveFontSizes = _interopRequireDefault(require("./responsiveFontSizes"));
301
- var _createTransitions = require("./createTransitions");
308
+ var _createTransitions = _interopRequireWildcard(require("./createTransitions"));
302
309
  var _useTheme = _interopRequireDefault(require("./useTheme"));
303
310
  var _useThemeProps = _interopRequireDefault(require("./useThemeProps"));
304
311
  var _styled = _interopRequireDefault(require("./styled"));
@@ -322,6 +329,18 @@ var _extendTheme = _interopRequireDefault(require("./extendTheme"));
322
329
  var _experimental_extendTheme = _interopRequireDefault(require("./experimental_extendTheme"));
323
330
  var _getOverlayAlpha = _interopRequireDefault(require("./getOverlayAlpha"));
324
331
  var _shouldSkipGeneratingVar = _interopRequireDefault(require("./shouldSkipGeneratingVar"));
332
+ var _stringifyTheme = require("./stringifyTheme");
333
+ Object.keys(_stringifyTheme).forEach(function (key) {
334
+ if (key === "default" || key === "__esModule") return;
335
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
336
+ if (key in exports && exports[key] === _stringifyTheme[key]) return;
337
+ Object.defineProperty(exports, key, {
338
+ enumerable: true,
339
+ get: function () {
340
+ return _stringifyTheme[key];
341
+ }
342
+ });
343
+ });
325
344
  var _createTypography = _interopRequireDefault(require("./createTypography"));
326
345
  var _createMixins = _interopRequireDefault(require("./createMixins"));
327
346
  var _excludeVariablesFromRoot = _interopRequireDefault(require("./excludeVariablesFromRoot"));
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.stringifyTheme = stringifyTheme;
7
+ var _deepmerge = require("@mui/utils/deepmerge");
8
+ /* eslint-disable import/prefer-default-export */
9
+
10
+ function isSerializable(val) {
11
+ return (0, _deepmerge.isPlainObject)(val) || typeof val === 'undefined' || typeof val === 'string' || typeof val === 'boolean' || typeof val === 'number' || Array.isArray(val);
12
+ }
13
+
14
+ /**
15
+ * `baseTheme` usually comes from `createTheme` or `extendTheme`.
16
+ *
17
+ * This function is intended to be used with zero-runtime CSS-in-JS like Pigment CSS
18
+ * For example, in a Next.js project:
19
+ *
20
+ * ```js
21
+ * // next.config.js
22
+ * const { extendTheme } = require('@mui/material/styles');
23
+ *
24
+ * const theme = extendTheme();
25
+ * // `.toRuntimeSource` is Pigment CSS specific to create a theme that is available at runtime.
26
+ * theme.toRuntimeSource = stringifyTheme;
27
+ *
28
+ * module.exports = withPigment({
29
+ * theme,
30
+ * });
31
+ * ```
32
+ */
33
+ function stringifyTheme(baseTheme = {}) {
34
+ const serializableTheme = {
35
+ ...baseTheme
36
+ };
37
+ function serializeTheme(object) {
38
+ const array = Object.entries(object);
39
+ // eslint-disable-next-line no-plusplus
40
+ for (let index = 0; index < array.length; index++) {
41
+ const [key, value] = array[index];
42
+ if (!isSerializable(value) || key.startsWith('unstable_')) {
43
+ delete object[key];
44
+ } else if ((0, _deepmerge.isPlainObject)(value)) {
45
+ object[key] = {
46
+ ...value
47
+ };
48
+ serializeTheme(object[key]);
49
+ }
50
+ }
51
+ }
52
+ serializeTheme(serializableTheme);
53
+ return `import { createBreakpoints } from '@mui/system';
54
+ import { createTransitions } from '@mui/material/styles';
55
+
56
+ const theme = ${JSON.stringify(serializableTheme, null, 2)};
57
+
58
+ theme.breakpoints = createBreakpoints(theme.breakpoints || {});
59
+ theme.transitions = createTransitions(theme.transitions || {});
60
+
61
+ export default theme;`;
62
+ }
@@ -11,6 +11,8 @@ Object.defineProperty(exports, "css", {
11
11
  return _system.css;
12
12
  }
13
13
  });
14
+ exports.globalCss = globalCss;
15
+ exports.internal_createExtendSxProp = internal_createExtendSxProp;
14
16
  Object.defineProperty(exports, "keyframes", {
15
17
  enumerable: true,
16
18
  get: function () {
@@ -23,10 +25,37 @@ Object.defineProperty(exports, "styled", {
23
25
  return _styled.default;
24
26
  }
25
27
  });
28
+ Object.defineProperty(exports, "useTheme", {
29
+ enumerable: true,
30
+ get: function () {
31
+ return _useTheme.default;
32
+ }
33
+ });
34
+ var React = _interopRequireWildcard(require("react"));
35
+ var _styleFunctionSx = require("@mui/system/styleFunctionSx");
26
36
  var _useThemeProps = _interopRequireDefault(require("../styles/useThemeProps"));
37
+ var _useTheme = _interopRequireDefault(require("../styles/useTheme"));
38
+ var _GlobalStyles2 = _interopRequireDefault(require("../GlobalStyles"));
39
+ var _jsxRuntime = require("react/jsx-runtime");
27
40
  var _system = require("@mui/system");
28
41
  var _styled = _interopRequireDefault(require("../styles/styled"));
42
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
43
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
44
+ function globalCss(styles) {
45
+ var _GlobalStyles;
46
+ return function GlobalStylesWrapper() {
47
+ return _GlobalStyles || (_GlobalStyles = /*#__PURE__*/(0, _jsxRuntime.jsx)(_GlobalStyles2.default, {
48
+ styles: styles
49
+ }));
50
+ };
51
+ }
52
+
29
53
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
30
54
  function createUseThemeProps(name) {
31
55
  return _useThemeProps.default;
56
+ }
57
+
58
+ // eslint-disable-next-line @typescript-eslint/naming-convention
59
+ function internal_createExtendSxProp() {
60
+ return _styleFunctionSx.extendSxProp;
32
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/material",
3
- "version": "6.0.0-alpha.10",
3
+ "version": "6.0.0-alpha.11",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "Material UI is an open-source React component library that implements Google's Material Design. It's comprehensive and can be used in production out of the box.",
@@ -27,18 +27,18 @@
27
27
  "url": "https://opencollective.com/mui-org"
28
28
  },
29
29
  "dependencies": {
30
- "@babel/runtime": "^7.24.6",
30
+ "@babel/runtime": "^7.24.7",
31
31
  "@types/react-transition-group": "^4.4.10",
32
32
  "clsx": "^2.1.1",
33
33
  "csstype": "^3.1.3",
34
34
  "prop-types": "^15.8.1",
35
35
  "react-is": "^18.2.0",
36
36
  "react-transition-group": "^4.4.5",
37
- "@mui/system": "^6.0.0-alpha.10",
38
- "@mui/base": "5.0.0-beta.48",
39
- "@mui/utils": "^6.0.0-alpha.9",
40
37
  "@mui/types": "^7.2.14",
41
- "@mui/core-downloads-tracker": "^6.0.0-alpha.10"
38
+ "@mui/base": "5.0.0-beta.49",
39
+ "@mui/system": "^6.0.0-alpha.11",
40
+ "@mui/utils": "^6.0.0-alpha.11",
41
+ "@mui/core-downloads-tracker": "^6.0.0-alpha.11"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@emotion/react": "^11.5.0",
@@ -45,7 +45,7 @@ Please use another name.` : _formatMuiErrorMessage(18));
45
45
  const traverse = (node, component) => {
46
46
  let key;
47
47
 
48
- // eslint-disable-next-line guard-for-in, no-restricted-syntax
48
+ // eslint-disable-next-line guard-for-in
49
49
  for (key in node) {
50
50
  const child = node[key];
51
51
  if (stateClasses.indexOf(key) !== -1 && Object.keys(child).length > 0) {
package/styles/index.d.ts CHANGED
@@ -100,6 +100,9 @@ export { default as withTheme } from './withTheme';
100
100
  export * from './CssVarsProvider';
101
101
 
102
102
  export { default as extendTheme } from './extendTheme';
103
+
104
+ export * from './stringifyTheme';
105
+
103
106
  export type {
104
107
  ColorSchemeOverrides,
105
108
  SupportedColorScheme,
package/styles/index.js CHANGED
@@ -14,7 +14,7 @@ export { default as unstable_createMuiStrictModeTheme } from './createMuiStrictM
14
14
  export { default as createStyles } from './createStyles';
15
15
  export { getUnit as unstable_getUnit, toUnitless as unstable_toUnitless } from './cssUtils';
16
16
  export { default as responsiveFontSizes } from './responsiveFontSizes';
17
- export { duration, easing } from './createTransitions';
17
+ export { default as createTransitions, duration, easing } from './createTransitions';
18
18
  export { default as useTheme } from './useTheme';
19
19
  export { default as useThemeProps } from './useThemeProps';
20
20
  export { default as styled } from './styled';
@@ -31,6 +31,7 @@ export { default as extendTheme } from './extendTheme';
31
31
  export { default as experimental_extendTheme } from './experimental_extendTheme'; // TODO: Remove in v7
32
32
  export { default as getOverlayAlpha } from './getOverlayAlpha';
33
33
  export { default as shouldSkipGeneratingVar } from './shouldSkipGeneratingVar';
34
+ export * from './stringifyTheme';
34
35
 
35
36
  // Private methods for creating parts of the theme
36
37
  export { default as private_createTypography } from './createTypography';
@@ -0,0 +1,20 @@
1
+ /**
2
+ * `baseTheme` usually comes from `createTheme` or `extendTheme`.
3
+ *
4
+ * This function is intended to be used with zero-runtime CSS-in-JS like Pigment CSS
5
+ * For example, in a Next.js project:
6
+ *
7
+ * ```js
8
+ * // next.config.js
9
+ * const { extendTheme } = require('@mui/material/styles');
10
+ *
11
+ * const theme = extendTheme();
12
+ * // `.toRuntimeSource` is Pigment CSS specific to create a theme that is available at runtime.
13
+ * theme.toRuntimeSource = stringifyTheme;
14
+ *
15
+ * module.exports = withPigment({
16
+ * theme,
17
+ * });
18
+ * ```
19
+ */
20
+ export declare function stringifyTheme(baseTheme?: Record<string, any>): string;
@@ -0,0 +1,55 @@
1
+ /* eslint-disable import/prefer-default-export */
2
+ import { isPlainObject } from '@mui/utils/deepmerge';
3
+ function isSerializable(val) {
4
+ return isPlainObject(val) || typeof val === 'undefined' || typeof val === 'string' || typeof val === 'boolean' || typeof val === 'number' || Array.isArray(val);
5
+ }
6
+
7
+ /**
8
+ * `baseTheme` usually comes from `createTheme` or `extendTheme`.
9
+ *
10
+ * This function is intended to be used with zero-runtime CSS-in-JS like Pigment CSS
11
+ * For example, in a Next.js project:
12
+ *
13
+ * ```js
14
+ * // next.config.js
15
+ * const { extendTheme } = require('@mui/material/styles');
16
+ *
17
+ * const theme = extendTheme();
18
+ * // `.toRuntimeSource` is Pigment CSS specific to create a theme that is available at runtime.
19
+ * theme.toRuntimeSource = stringifyTheme;
20
+ *
21
+ * module.exports = withPigment({
22
+ * theme,
23
+ * });
24
+ * ```
25
+ */
26
+ export function stringifyTheme(baseTheme = {}) {
27
+ const serializableTheme = {
28
+ ...baseTheme
29
+ };
30
+ function serializeTheme(object) {
31
+ const array = Object.entries(object);
32
+ // eslint-disable-next-line no-plusplus
33
+ for (let index = 0; index < array.length; index++) {
34
+ const [key, value] = array[index];
35
+ if (!isSerializable(value) || key.startsWith('unstable_')) {
36
+ delete object[key];
37
+ } else if (isPlainObject(value)) {
38
+ object[key] = {
39
+ ...value
40
+ };
41
+ serializeTheme(object[key]);
42
+ }
43
+ }
44
+ }
45
+ serializeTheme(serializableTheme);
46
+ return `import { createBreakpoints } from '@mui/system';
47
+ import { createTransitions } from '@mui/material/styles';
48
+
49
+ const theme = ${JSON.stringify(serializableTheme, null, 2)};
50
+
51
+ theme.breakpoints = createBreakpoints(theme.breakpoints || {});
52
+ theme.transitions = createTransitions(theme.transitions || {});
53
+
54
+ export default theme;`;
55
+ }
@@ -1,4 +1,11 @@
1
+ import * as React from 'react';
2
+ import { extendSxProp } from '@mui/system/styleFunctionSx';
1
3
  import useThemeProps from '../styles/useThemeProps';
4
+ import useTheme from '../styles/useTheme';
5
+ import { GlobalStylesProps } from '../GlobalStyles';
2
6
  export { css, keyframes } from '@mui/system';
3
7
  export { default as styled } from '../styles/styled';
8
+ export declare function globalCss(styles: GlobalStylesProps['styles']): () => React.JSX.Element;
4
9
  export declare function createUseThemeProps(name: string): typeof useThemeProps;
10
+ export declare function internal_createExtendSxProp(): typeof extendSxProp;
11
+ export { useTheme };
@@ -1,8 +1,27 @@
1
+ import * as React from 'react';
2
+ import { extendSxProp } from '@mui/system/styleFunctionSx';
1
3
  import useThemeProps from '../styles/useThemeProps';
4
+ import useTheme from '../styles/useTheme';
5
+ import GlobalStyles from '../GlobalStyles';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
2
7
  export { css, keyframes } from '@mui/system';
3
8
  export { default as styled } from '../styles/styled';
9
+ export function globalCss(styles) {
10
+ var _GlobalStyles;
11
+ return function GlobalStylesWrapper() {
12
+ return _GlobalStyles || (_GlobalStyles = /*#__PURE__*/_jsx(GlobalStyles, {
13
+ styles: styles
14
+ }));
15
+ };
16
+ }
4
17
 
5
18
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
6
19
  export function createUseThemeProps(name) {
7
20
  return useThemeProps;
8
- }
21
+ }
22
+
23
+ // eslint-disable-next-line @typescript-eslint/naming-convention
24
+ export function internal_createExtendSxProp() {
25
+ return extendSxProp;
26
+ }
27
+ export { useTheme };