@mui/system 5.6.1 → 5.6.4

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 (52) hide show
  1. package/Box/Box.d.ts +18 -1
  2. package/Box/Box.js +26 -0
  3. package/Box/Box.spec.d.ts +1 -1
  4. package/CHANGELOG.md +185 -2
  5. package/ThemeProvider/ThemeProvider.d.ts +6 -0
  6. package/ThemeProvider/ThemeProvider.js +9 -2
  7. package/createBox.js +0 -26
  8. package/createBox.spec.d.ts +1 -1
  9. package/createStyled.js +3 -1
  10. package/createTheme/createSpacing.d.ts +10 -10
  11. package/cssVars/createCssVarsProvider.js +20 -36
  12. package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
  13. package/cssVars/createGetCssVar.d.ts +5 -5
  14. package/cssVars/cssVarsParser.d.ts +70 -70
  15. package/cssVars/cssVarsParser.js +11 -9
  16. package/cssVars/getInitColorSchemeScript.d.ts +12 -12
  17. package/cssVars/index.d.ts +2 -2
  18. package/cssVars/useCurrentColorScheme.d.ts +50 -50
  19. package/esm/Box/Box.js +25 -0
  20. package/esm/ThemeProvider/ThemeProvider.js +9 -2
  21. package/esm/createBox.js +0 -25
  22. package/esm/createStyled.js +3 -1
  23. package/esm/cssVars/createCssVarsProvider.js +21 -35
  24. package/esm/cssVars/cssVarsParser.js +11 -9
  25. package/esm/spacing.js +3 -1
  26. package/esm/style.js +16 -1
  27. package/index.d.ts +4 -0
  28. package/index.js +1 -1
  29. package/index.spec.d.ts +1 -1
  30. package/legacy/Box/Box.js +25 -0
  31. package/legacy/ThemeProvider/ThemeProvider.js +9 -2
  32. package/legacy/createBox.js +0 -25
  33. package/legacy/createStyled.js +3 -1
  34. package/legacy/cssVars/createCssVarsProvider.js +22 -31
  35. package/legacy/cssVars/cssVarsParser.js +11 -7
  36. package/legacy/index.js +1 -1
  37. package/legacy/spacing.js +3 -1
  38. package/legacy/style.js +16 -1
  39. package/modern/Box/Box.js +25 -0
  40. package/modern/ThemeProvider/ThemeProvider.js +9 -2
  41. package/modern/createBox.js +0 -25
  42. package/modern/createStyled.js +3 -1
  43. package/modern/cssVars/createCssVarsProvider.js +21 -33
  44. package/modern/cssVars/cssVarsParser.js +11 -9
  45. package/modern/index.js +1 -1
  46. package/modern/spacing.js +1 -1
  47. package/modern/style.js +16 -1
  48. package/package.json +2 -2
  49. package/spacing.js +3 -1
  50. package/style.js +16 -1
  51. package/styleFunctionSx/styleFunctionSx.d.ts +3 -1
  52. package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
package/Box/Box.d.ts CHANGED
@@ -174,13 +174,30 @@ export interface BoxTypeMap<P = {}, D extends React.ElementType = 'div'> {
174
174
  props: P &
175
175
  SystemProps<Theme> & {
176
176
  children?: React.ReactNode;
177
+ /**
178
+ * The component used for the root node.
179
+ * Either a string to use a HTML element or a component.
180
+ */
177
181
  component?: React.ElementType;
178
182
  ref?: React.Ref<unknown>;
183
+ /**
184
+ * The system prop that allows defining system overrides as well as additional CSS styles.
185
+ */
179
186
  sx?: SxProps<Theme>;
180
187
  };
181
188
  defaultComponent: D;
182
189
  }
183
-
190
+ /**
191
+ *
192
+ * Demos:
193
+ *
194
+ * - [Box (Material UI)](https://mui.com/material-ui/react-box/)
195
+ * - [Box (MUI System)](https://mui.com/system/react-box/)
196
+ *
197
+ * API:
198
+ *
199
+ * - [Box API](https://mui.com/system/api/box/)
200
+ */
184
201
  declare const Box: OverridableComponent<BoxTypeMap>;
185
202
 
186
203
  export type BoxProps<
package/Box/Box.js CHANGED
@@ -7,8 +7,34 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
10
12
  var _createBox = _interopRequireDefault(require("../createBox"));
11
13
 
12
14
  const Box = (0, _createBox.default)();
15
+ process.env.NODE_ENV !== "production" ? Box.propTypes
16
+ /* remove-proptypes */
17
+ = {
18
+ // ----------------------------- Warning --------------------------------
19
+ // | These PropTypes are generated from the TypeScript type definitions |
20
+ // | To update them edit the d.ts file and run "yarn proptypes" |
21
+ // ----------------------------------------------------------------------
22
+
23
+ /**
24
+ * @ignore
25
+ */
26
+ children: _propTypes.default.node,
27
+
28
+ /**
29
+ * The component used for the root node.
30
+ * Either a string to use a HTML element or a component.
31
+ */
32
+ component: _propTypes.default.elementType,
33
+
34
+ /**
35
+ * The system prop that allows defining system overrides as well as additional CSS styles.
36
+ */
37
+ sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
38
+ } : void 0;
13
39
  var _default = Box;
14
40
  exports.default = _default;
package/Box/Box.spec.d.ts CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export {};
package/CHANGELOG.md CHANGED
@@ -1,5 +1,188 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 5.6.4
4
+
5
+ <!-- generated comparing v5.6.3..master -->
6
+
7
+ _May 2, 2022_
8
+
9
+ A big thanks to the 13 contributors who made this release possible. Here are some highlights ✨:
10
+
11
+ - 💅 5 Material UI components were updated to support CSS variables by @ZeeshanTamboli & @vicasas
12
+ - And more 🐛 bug fixes and 📚 improvements.
13
+
14
+ ### `@mui/material@5.6.4`
15
+
16
+ - &#8203;<!-- 37 -->[Accordion] Add support for CSS variables (#32542) @ZeeshanTamboli
17
+ - &#8203;<!-- 36 -->[AvatarGroup] Add support for CSS variables (#32507) @vicasas
18
+ - &#8203;<!-- 35 -->[Badge] Add support for CSS variables (#32516) @vicasas
19
+ - &#8203;<!-- 34 -->[BottomNavigation] Add support for CSS variables (#32517) @vicasas
20
+ - &#8203;<!-- 33 -->[CircularProgress] Add support for CSS variables (#32543) @ZeeshanTamboli
21
+ - &#8203;<!-- 07 -->[FilledInput] Fix type error from undefined `color` (#32258) @hbjORbj
22
+ - &#8203;<!-- 02 -->[l10n] Fix typo in csCZ translation of Pagination component (#32509) @Martin005
23
+ - &#8203;<!-- 01 -->[Tabs] Fix `TabIndicatorProps` prop missing `sx` prop (#32503) @b-novikov-ipersonality
24
+
25
+ ### `@mui/codemod@5.6.4`
26
+
27
+ - &#8203;<!-- 32 -->[codemod] Leave numeric arguments to breakpoints functions unchanged (#32426) @ryancogswell
28
+ - &#8203;<!-- 31 -->[codemod] Allow for line breaks within theme.spacing parentheses (#32432) @ryancogswell
29
+
30
+ ### `@mui/joy@5.0.0-alpha.26`
31
+
32
+ - &#8203;<!-- 06 -->[Joy] Miscellaneous fixes (#32541) @siriwatknp
33
+ - &#8203;<!-- 05 -->[Joy] Add `extendSxProp` to Link (#32505) @siriwatknp
34
+ - &#8203;<!-- 04 -->[Joy] Rename variants (#32489) @siriwatknp
35
+ - &#8203;<!-- 03 -->[Joy] Add `extendTheme` (#32450) @siriwatknp
36
+
37
+ ### Docs
38
+
39
+ - &#8203;<!-- 30 -->[docs] SEO fixes (#32515) @oliviertassinari
40
+ - &#8203;<!-- 29 -->[docs] Replace `Overriding nested component styles` anchor link with text (#32487) @ZeeshanTamboli
41
+ - &#8203;<!-- 28 -->[docs] Update the list of external domains (#32514) @oliviertassinari
42
+ - &#8203;<!-- 27 -->[docs] Update Material UI code snippets for React 18 (#32361) @samuelsycamore
43
+ - &#8203;<!-- 26 -->[docs] Base TextareaAutosize style revisions and final review (#32481) @samuelsycamore
44
+ - &#8203;<!-- 25 -->[docs] Base ClickAwayListener style revisions and final review (#32156) @samuelsycamore
45
+ - &#8203;<!-- 24 -->[docs] Base Button style revisions and final review (#32380) @samuelsycamore
46
+ - &#8203;<!-- 23 -->[docs] Base NoSsr style revisions and final review (#32254) @samuelsycamore
47
+ - &#8203;<!-- 22 -->[docs] Correctly capitalize Ctrl @oliviertassinari
48
+ - &#8203;<!-- 21 -->[docs] Fix styling in `Basic Popper` demo on the MUI Base docs (#32488) @ZeeshanTamboli
49
+ - &#8203;<!-- 20 -->[docs] Add "Overview" page to Base docs (#32310) @samuelsycamore
50
+ - &#8203;<!-- 19 -->[docs] Add copy button to code block (#32390) @siriwatknp
51
+ - &#8203;<!-- 18 -->[docs] Base Tabs style revisions and final review (#32423) @samuelsycamore
52
+ - &#8203;<!-- 17 -->[docs] Base Popper style revisions and final review (#32412) @samuelsycamore
53
+ - &#8203;<!-- 16 -->[docs] Improve sidenav for MUI X (#32435) @oliviertassinari
54
+ - &#8203;<!-- 15 -->[docs] Don't redirect on deploy preview (#32399) @m4theushw
55
+ - &#8203;<!-- 14 -->[docs] A few SEO fixes (#32431) @oliviertassinari
56
+ - &#8203;<!-- 13 -->[docs] Update links to the new Group & Pivot pages (#32410) @flaviendelangle
57
+ - &#8203;<!-- 12 -->[docs] Support callouts (#32402) @siriwatknp
58
+ - &#8203;<!-- 11 -->[docs] Fix import path in the Snackbar article #32462 @mongolyy
59
+ - &#8203;<!-- 10 -->[docs] Fix grammar mistake in shadows.md (#32454) @HexM7
60
+ - &#8203;<!-- 09 -->[docs] Improve unstyled button docs (#32429) @oliviertassinari
61
+
62
+ ### Core
63
+
64
+ - &#8203;<!-- 08 -->[experiment] Add template for testing Material UI components with CSS variables (#32500) @siriwatknp
65
+
66
+ All contributors of this release in alphabetical order: @b-novikov-ipersonality, @flaviendelangle, @hbjORbj, @HexM7, @m4theushw, @Martin005, @mongolyy, @oliviertassinari, @ryancogswell, @samuelsycamore, @siriwatknp, @vicasas, @ZeeshanTamboli
67
+
68
+ ## 5.6.3
69
+
70
+ <!-- generated comparing v5.6.2..master -->
71
+
72
+ _Apr 25, 2022_
73
+
74
+ A big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
75
+
76
+ - 🛠 Fixed TypeScript issue when the `fill` CSS property is used in the system (#32355) @valerii15298
77
+ - And more 🐛 bug fixes and 📚 improvements.
78
+
79
+ ### `@mui/material@5.6.3`
80
+
81
+ - [BottomNavigation] Action icon `padding` fix (#32030) @abhinav-22-tech
82
+ - [Dialog] Fix `component` prop is not available in `DialogTitleProps` (#32389) @hbjORbj
83
+ - [StepContent] Fix TypeScript type of `TransitionComponent` prop (#32314) @ZeeshanTamboli
84
+
85
+ ### `@mui/system@5.6.3`
86
+
87
+ - [system] Fix prop types when the `fill` CSS property is used (#32355) @valerii15298
88
+ - [system] Fix broken behavior when theme value is `zero` (#32365) @ZeeshanTamboli
89
+
90
+ ### `@mui/base@5.0.0-alpha.78`
91
+
92
+ - [InputUnstyled] `multiline` property should not log DOM warnings for `maxRows` and `minRows` props (#32401) @ZeeshanTamboli
93
+
94
+ ### `@mui/joy@5.0.0-alpha.25`
95
+
96
+ - [Joy] Improve theme focus to be more flexible (#32405) @siriwatknp
97
+ - [Joy] Add `Radio`, `RadioGroup` components (#32279) @siriwatknp
98
+ - [Joy] Add `Chip` component (#31983) @hbjORbj
99
+ - [Joy] Improve controls (#32267) @siriwatknp
100
+ - [Joy] Set up docs (#32370) @siriwatknp
101
+
102
+ ### Docs
103
+
104
+ - [docs] Enable row reordering on the pricing page (#31875) @DanailH
105
+ - [blog] A few improvements on date picker change (#32325) @oliviertassinari
106
+ - [docs] Emphasize how to avoid failing tests when migrating from v4 to v5 (#32159) @dwjohnston
107
+ - [docs] Revise the related projects page (#32180) @danilo-leal
108
+ - [docs] Cleanup remaining @mui/styles usages (#32313) @mnajdova
109
+ - [docs] Fix sidenav mobile color (#32324) @oliviertassinari
110
+ - [docs] Base TrapFocus style revisions and final review (#32364) @samuelsycamore
111
+ - [docs] Update the README.md to better cover the different products (#32360) @samuelsycamore
112
+ - [docs] Improve the propTypes generation and API demos' links (#32295) @mnajdova
113
+ - [docs] Add ability to display a plan icon next to a page link in nav bar (#32393) @flaviendelangle
114
+ - [docs] Change label on `FormControlLabelPlacement` (#32322) @ainatenhi
115
+ - [website] Update Diamond sponsors list (#32433) @oliviertassinari
116
+ - [website] Add privacy policy link to website's footer (#32080) @danilo-leal
117
+ - [website] Remove the designer role (#32384) @danilo-leal
118
+
119
+ ### Core
120
+
121
+ - [core] `yarn prettier` write @oliviertassinari
122
+ - [core] Fix changelog warning message (#32240) @praveen001
123
+ - [core] Update the proptypes scripts to support components in @mui/system (#32456) @mnajdova
124
+
125
+ All contributors of this release in alphabetical order: @abhinav-22-tech, @ainatenhi, @DanailH, @danilo-leal, @dwjohnston, @flaviendelangle, @hbjORbj, @mnajdova, @oliviertassinari, @praveen001, @samuelsycamore, @siriwatknp, @valerii15298, @ZeeshanTamboli
126
+
127
+ ## 5.6.2
128
+
129
+ <!-- generated comparing v5.6.1..master -->
130
+
131
+ _Apr 18, 2022_
132
+
133
+ A big thanks to the 11 contributors who made this release possible. This release is mostly about 🐛 bug fixes and 📚 documentation improvements.
134
+
135
+ ### `@mui/material@5.6.2`
136
+
137
+ - &#8203;<!-- 29 -->[Autocomplete] Explain how to use getOptionLabel in free solo mode and update getOptionLabel type (#32165) @michaldudak
138
+ - &#8203;<!-- 28 -->[Badge] Fix customization of classes (#32185) @michaldudak
139
+ - &#8203;<!-- 03 -->[TextField] Add a workaround for Safari CSS transition scale bug (#32188) @igordanchenko
140
+
141
+ ### `@mui/system@5.6.2`
142
+
143
+ - &#8203;<!-- 05 -->[system] Update style function to use vars automatically if available (#32244) @mnajdova
144
+
145
+ ### `@mui/base@5.0.0-alpha.77`
146
+
147
+ - &#8203;<!-- 08 -->[FormControlUnstyled] Revise API (#32134) @michaldudak
148
+
149
+ ### `@mui/joy@5.0.0-alpha.24`
150
+
151
+ - &#8203;<!-- 07 -->[Joy] Add `Badge` component (#31401) @hbjORbj
152
+ - &#8203;<!-- 06 -->[Joy] Fix misuse variable in `Input` (#32268) @siriwatknp
153
+
154
+ ### Docs
155
+
156
+ - &#8203;<!-- 27 -->[blog] Fix images for the docs separation post (#32257) @danilo-leal
157
+ - &#8203;<!-- 25 -->[docs] Base Form Control style revisions and final review (#32309) @samuelsycamore
158
+ - &#8203;<!-- 24 -->[docs] Base TablePagination style revisions and final review (#32178) @samuelsycamore
159
+ - &#8203;<!-- 23 -->[docs] Revise the dark mode article (#32179) @danilo-leal
160
+ - &#8203;<!-- 22 -->[docs] Add `aria-label` for `IconButton` (#32276) @SiarheiBobryk
161
+ - &#8203;<!-- 21 -->[docs] Fix `borderRadius` in the docs example (#32347) @ZeeshanTamboli
162
+ - &#8203;<!-- 20 -->[docs] Fix 404 link in the code (#32323) @oliviertassinari
163
+ - &#8203;<!-- 19 -->[docs] Sync h1 with side nav label (#32235) @oliviertassinari
164
+ - &#8203;<!-- 18 -->[docs] Fix SEO issues (#32282) @oliviertassinari
165
+ - &#8203;<!-- 17 -->[docs] Fix broken link in the test contributing guide (#32283) @sirartemis
166
+ - &#8203;<!-- 16 -->[docs] Update "How to customize" page anchor links #32315 @abaker93
167
+ - &#8203;<!-- 15 -->[docs] Mark `onBackdropClick` prop as deprecated in `Dialog`, `Modal` and `ModalUnstyled` components (#32297) @ZeeshanTamboli
168
+ - &#8203;<!-- 14 -->[docs] Link to advanced components page (#32290) @siriwatknp
169
+ - &#8203;<!-- 13 -->[docs] Sync package description with the docs (#32211) @oliviertassinari
170
+ - &#8203;<!-- 12 -->[docs] Revise "Component theming" and "How to customize" guides (#31997) @danilo-leal
171
+ - &#8203;<!-- 11 -->[docs] Add note in the Contributing guide about linking issues to a PR (#32174) @danilo-leal
172
+ - &#8203;<!-- 10 -->[docs] Update RTL guide (#32242) @michaldudak
173
+ - &#8203;<!-- 09 -->[docs] Uniformize capitalization (#32238) @oliviertassinari
174
+ - &#8203;<!-- 02 -->[website] Improve new role template @oliviertassinari
175
+ - &#8203;<!-- 01 -->[website] Remove a gold sponsor (#32261) @hbjORbj
176
+ - &#8203;<!-- 24 -->[website] Mark DataGrid Column spanning done on Pricing page (#32305) @cherniavskii
177
+
178
+ ### Core
179
+
180
+ - &#8203;<!-- 31 -->[core] Remove unecessary div (#32237) @oliviertassinari
181
+ - &#8203;<!-- 30 -->[core] Revert #32229 (#32262) @michaldudak
182
+ - &#8203;<!-- 04 -->[test] Fix running unit tests on Windows (#32260) @michaldudak
183
+
184
+ All contributors of this release in alphabetical order: @abaker93, @cherniavskii, @danilo-leal, @hbjORbj, @igordanchenko, @michaldudak, @mnajdova, @oliviertassinari, @samuelsycamore, @SiarheiBobryk, @sirartemis, @siriwatknp, @ZeeshanTamboli
185
+
3
186
  ## 5.6.1
4
187
 
5
188
  <!-- generated comparing v5.6.0..master -->
@@ -3575,7 +3758,7 @@ A big thanks to the 16 contributors who made this release possible. Here are som
3575
3758
  - &#8203;<!-- 28 -->[docs] Fix broken overrides link on API pages (#26244) @mnajdova
3576
3759
  - &#8203;<!-- 27 -->[docs] Improve documentation for Buttons (#26184) @arpitBhalla
3577
3760
  - &#8203;<!-- 24 -->[docs] Emphasize on props for screen readers (#26222) @atisheyJain03
3578
- - &#8203;<!-- 23 -->[docs] Link third-party routing in Bottom Navigation (#26190) @arpitBhalla
3761
+ - &#8203;<!-- 23 -->[docs] Link third-party routing in Bottom navigation (#26190) @arpitBhalla
3579
3762
  - &#8203;<!-- 22 -->[docs] Migrate Select, Progress demos to emotion (#26178) @mnajdova
3580
3763
  - &#8203;<!-- 20 -->[docs] Add accessibility section to Badges (#26009) @likitarai1
3581
3764
  - &#8203;<!-- 15 -->[docs] Migrate Popper, Drawer demos to emotion (#26183) @mnajdova
@@ -4587,7 +4770,7 @@ The prop didn't solve any important problem better than any of its alternatives
4587
4770
 
4588
4771
  ### Docs
4589
4772
 
4590
- - &#8203;<!-- 22 -->[docs] Migrate Bottom Navigation demos to emotion (#25180) @vicasas
4773
+ - &#8203;<!-- 22 -->[docs] Migrate Bottom navigation demos to emotion (#25180) @vicasas
4591
4774
  - &#8203;<!-- 09 -->[docs] Migrate Button demos to emotion (#25138) @vicasas
4592
4775
  - &#8203;<!-- 17 -->[docs] Migrate Divider demos to emotion (#25145) @vicasas
4593
4776
  - &#8203;<!-- 24 -->[docs] Migrate Pagination demos to emotion (#25183) @vicasas
@@ -1,7 +1,13 @@
1
1
  import { DefaultTheme } from '@mui/private-theming';
2
2
 
3
3
  export interface ThemeProviderProps<Theme = DefaultTheme> {
4
+ /**
5
+ * Your component tree.
6
+ */
4
7
  children?: React.ReactNode;
8
+ /**
9
+ * A theme object. You can provide a function to extend the outer theme.
10
+ */
5
11
  theme: Partial<Theme> | ((outerTheme: Theme) => Theme);
6
12
  }
7
13
 
@@ -57,7 +57,14 @@ function ThemeProvider(props) {
57
57
  });
58
58
  }
59
59
 
60
- process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = {
60
+ process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes
61
+ /* remove-proptypes */
62
+ = {
63
+ // ----------------------------- Warning --------------------------------
64
+ // | These PropTypes are generated from the TypeScript type definitions |
65
+ // | To update them edit the d.ts file and run "yarn proptypes" |
66
+ // ----------------------------------------------------------------------
67
+
61
68
  /**
62
69
  * Your component tree.
63
70
  */
@@ -66,7 +73,7 @@ process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = {
66
73
  /**
67
74
  * A theme object. You can provide a function to extend the outer theme.
68
75
  */
69
- theme: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.func]).isRequired
76
+ theme: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]).isRequired
70
77
  } : void 0;
71
78
 
72
79
  if (process.env.NODE_ENV !== 'production') {
package/createBox.js CHANGED
@@ -13,8 +13,6 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
13
13
 
14
14
  var React = _interopRequireWildcard(require("react"));
15
15
 
16
- var _propTypes = _interopRequireDefault(require("prop-types"));
17
-
18
16
  var _clsx = _interopRequireDefault(require("clsx"));
19
17
 
20
18
  var _styledEngine = _interopRequireDefault(require("@mui/styled-engine"));
@@ -56,29 +54,5 @@ function createBox(options = {}) {
56
54
  theme: theme
57
55
  }, other));
58
56
  });
59
- process.env.NODE_ENV !== "production" ? Box.propTypes
60
- /* remove-proptypes */
61
- = {
62
- // ----------------------------- Warning --------------------------------
63
- // | These PropTypes are generated from the TypeScript type definitions |
64
- // | To update them edit the d.ts file and run "yarn proptypes" |
65
- // ----------------------------------------------------------------------
66
-
67
- /**
68
- * @ignore
69
- */
70
- children: _propTypes.default.node,
71
-
72
- /**
73
- * The component used for the root node.
74
- * Either a string to use a HTML element or a component.
75
- */
76
- component: _propTypes.default.elementType,
77
-
78
- /**
79
- * @ignore
80
- */
81
- sx: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.array, _propTypes.default.func])
82
- } : void 0;
83
57
  return Box;
84
58
  }
@@ -1 +1 @@
1
- export {};
1
+ export {};
package/createStyled.js CHANGED
@@ -160,7 +160,9 @@ function createStyled(input = {}) {
160
160
  if (styleOverrides) {
161
161
  const resolvedStyleOverrides = {};
162
162
  Object.entries(styleOverrides).forEach(([slotKey, slotStyle]) => {
163
- resolvedStyleOverrides[slotKey] = typeof slotStyle === 'function' ? slotStyle(props) : slotStyle;
163
+ resolvedStyleOverrides[slotKey] = typeof slotStyle === 'function' ? slotStyle((0, _extends2.default)({}, props, {
164
+ theme
165
+ })) : slotStyle;
164
166
  });
165
167
  return overridesResolver(props, resolvedStyleOverrides);
166
168
  }
@@ -1,10 +1,10 @@
1
- export declare type SpacingOptions = number | Spacing | ((abs: number) => number | string) | ((abs: number | string) => number | string) | ReadonlyArray<string | number>;
2
- export declare type SpacingArgument = number | string;
3
- export interface Spacing {
4
- (): string;
5
- (value: number): string;
6
- (topBottom: SpacingArgument, rightLeft: SpacingArgument): string;
7
- (top: SpacingArgument, rightLeft: SpacingArgument, bottom: SpacingArgument): string;
8
- (top: SpacingArgument, right: SpacingArgument, bottom: SpacingArgument, left: SpacingArgument): string;
9
- }
10
- export default function createSpacing(spacingInput?: SpacingOptions): Spacing;
1
+ export declare type SpacingOptions = number | Spacing | ((abs: number) => number | string) | ((abs: number | string) => number | string) | ReadonlyArray<string | number>;
2
+ export declare type SpacingArgument = number | string;
3
+ export interface Spacing {
4
+ (): string;
5
+ (value: number): string;
6
+ (topBottom: SpacingArgument, rightLeft: SpacingArgument): string;
7
+ (top: SpacingArgument, rightLeft: SpacingArgument, bottom: SpacingArgument): string;
8
+ (top: SpacingArgument, right: SpacingArgument, bottom: SpacingArgument, left: SpacingArgument): string;
9
+ }
10
+ export default function createSpacing(spacingInput?: SpacingOptions): Spacing;
@@ -20,10 +20,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
20
20
 
21
21
  var _styledEngine = require("@mui/styled-engine");
22
22
 
23
- var _createSpacing = _interopRequireDefault(require("../createTheme/createSpacing"));
24
-
25
- var _createBreakpoints = _interopRequireDefault(require("../createTheme/createBreakpoints"));
26
-
27
23
  var _cssVarsParser = _interopRequireDefault(require("./cssVarsParser"));
28
24
 
29
25
  var _ThemeProvider = _interopRequireDefault(require("../ThemeProvider"));
@@ -36,9 +32,7 @@ var _createGetCssVar = _interopRequireDefault(require("./createGetCssVar"));
36
32
 
37
33
  var _jsxRuntime = require("react/jsx-runtime");
38
34
 
39
- const _excluded = ["colorSchemes"],
40
- _excluded2 = ["colorSchemes"],
41
- _excluded3 = ["components"];
35
+ const _excluded = ["colorSchemes", "components"];
42
36
 
43
37
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
44
38
 
@@ -48,10 +42,8 @@ const DISABLE_CSS_TRANSITION = '*{-webkit-transition:none!important;-moz-transit
48
42
  exports.DISABLE_CSS_TRANSITION = DISABLE_CSS_TRANSITION;
49
43
 
50
44
  function createCssVarsProvider(options) {
51
- var _baseTheme$breakpoint;
52
-
53
45
  const {
54
- theme: baseTheme = {},
46
+ theme: defaultTheme = {},
55
47
  defaultMode: desisgnSystemMode = 'light',
56
48
  defaultColorScheme: designSystemColorScheme,
57
49
  disableTransitionOnChange: designSystemTransitionOnChange = false,
@@ -60,10 +52,8 @@ function createCssVarsProvider(options) {
60
52
  shouldSkipGeneratingVar,
61
53
  resolveTheme
62
54
  } = options;
63
- const systemSpacing = (0, _createSpacing.default)(baseTheme.spacing);
64
- const systemBreakpoints = (0, _createBreakpoints.default)((_baseTheme$breakpoint = baseTheme.breakpoints) != null ? _baseTheme$breakpoint : {});
65
55
 
66
- if (!baseTheme.colorSchemes || typeof designSystemColorScheme === 'string' && !baseTheme.colorSchemes[designSystemColorScheme] || typeof designSystemColorScheme === 'object' && !baseTheme.colorSchemes[designSystemColorScheme == null ? void 0 : designSystemColorScheme.light] || typeof designSystemColorScheme === 'object' && !baseTheme.colorSchemes[designSystemColorScheme == null ? void 0 : designSystemColorScheme.dark]) {
56
+ if (!defaultTheme.colorSchemes || typeof designSystemColorScheme === 'string' && !defaultTheme.colorSchemes[designSystemColorScheme] || typeof designSystemColorScheme === 'object' && !defaultTheme.colorSchemes[designSystemColorScheme == null ? void 0 : designSystemColorScheme.light] || typeof designSystemColorScheme === 'object' && !defaultTheme.colorSchemes[designSystemColorScheme == null ? void 0 : designSystemColorScheme.dark]) {
67
57
  console.error(`MUI: \`${designSystemColorScheme}\` does not exist in \`theme.colorSchemes\`.`);
68
58
  }
69
59
 
@@ -81,7 +71,7 @@ function createCssVarsProvider(options) {
81
71
 
82
72
  function CssVarsProvider({
83
73
  children,
84
- theme: themeProp = {},
74
+ theme: themeProp = defaultTheme,
85
75
  prefix = designSystemPrefix,
86
76
  modeStorageKey = _getInitColorSchemeScript.DEFAULT_MODE_STORAGE_KEY,
87
77
  attribute = _getInitColorSchemeScript.DEFAULT_ATTRIBUTE,
@@ -90,23 +80,12 @@ function createCssVarsProvider(options) {
90
80
  disableTransitionOnChange = designSystemTransitionOnChange,
91
81
  enableColorScheme = designSystemEnableColorScheme
92
82
  }) {
83
+ const hasMounted = React.useRef(false);
93
84
  const {
94
- colorSchemes: baseColorSchemes = {}
95
- } = baseTheme,
96
- restBaseTheme = (0, _objectWithoutPropertiesLoose2.default)(baseTheme, _excluded);
97
- const {
98
- colorSchemes: colorSchemesProp = {}
99
- } = themeProp,
100
- restThemeProp = (0, _objectWithoutPropertiesLoose2.default)(themeProp, _excluded2);
101
- const hasMounted = React.useRef(false); // eslint-disable-next-line prefer-const
102
-
103
- let _deepmerge = (0, _utils.deepmerge)(restBaseTheme, restThemeProp),
104
- {
85
+ colorSchemes = {},
105
86
  components = {}
106
- } = _deepmerge,
107
- mergedTheme = (0, _objectWithoutPropertiesLoose2.default)(_deepmerge, _excluded3);
108
-
109
- const colorSchemes = (0, _utils.deepmerge)(baseColorSchemes, colorSchemesProp);
87
+ } = themeProp,
88
+ restThemeProp = (0, _objectWithoutPropertiesLoose2.default)(themeProp, _excluded);
110
89
  const allColorSchemes = Object.keys(colorSchemes);
111
90
  const defaultLightColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.light;
112
91
  const defaultDarkColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.dark;
@@ -140,22 +119,21 @@ function createCssVarsProvider(options) {
140
119
  return colorScheme;
141
120
  })();
142
121
 
122
+ let theme = restThemeProp;
143
123
  const {
144
124
  css: rootCss,
145
125
  vars: rootVars,
146
126
  parsedTheme
147
- } = (0, _cssVarsParser.default)(mergedTheme, {
127
+ } = (0, _cssVarsParser.default)(theme, {
148
128
  prefix,
149
129
  basePrefix: designSystemPrefix,
150
130
  shouldSkipGeneratingVar
151
131
  });
152
- mergedTheme = (0, _extends2.default)({}, parsedTheme, {
132
+ theme = (0, _extends2.default)({}, parsedTheme, {
153
133
  components,
154
134
  colorSchemes,
155
135
  prefix,
156
136
  vars: rootVars,
157
- spacing: themeProp.spacing ? (0, _createSpacing.default)(themeProp.spacing) : systemSpacing,
158
- breakpoints: themeProp.breakpoints ? (0, _createBreakpoints.default)(themeProp.breakpoints) : systemBreakpoints,
159
137
  getCssVar: (0, _createGetCssVar.default)(prefix)
160
138
  });
161
139
  const styleSheet = {};
@@ -169,10 +147,16 @@ function createCssVarsProvider(options) {
169
147
  basePrefix: designSystemPrefix,
170
148
  shouldSkipGeneratingVar
171
149
  });
172
- mergedTheme.vars = (0, _utils.deepmerge)(mergedTheme.vars, vars);
150
+ theme.vars = (0, _utils.deepmerge)(theme.vars, vars);
173
151
 
174
152
  if (key === resolvedColorScheme) {
175
- mergedTheme = (0, _extends2.default)({}, mergedTheme, parsedScheme);
153
+ theme = (0, _extends2.default)({}, theme, parsedScheme);
154
+
155
+ if (theme.palette) {
156
+ // assign runtime mode & colorScheme
157
+ theme.palette.mode = mode;
158
+ theme.palette.colorScheme = resolvedColorScheme;
159
+ }
176
160
  }
177
161
 
178
162
  const resolvedDefaultColorScheme = (() => {
@@ -259,7 +243,7 @@ function createCssVarsProvider(options) {
259
243
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledEngine.GlobalStyles, {
260
244
  styles: styleSheet
261
245
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ThemeProvider.default, {
262
- theme: resolveTheme ? resolveTheme(mergedTheme) : mergedTheme,
246
+ theme: resolveTheme ? resolveTheme(theme) : theme,
263
247
  children: children
264
248
  })]
265
249
  });
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,5 +1,5 @@
1
- /**
2
- * The benefit of this function is to help developers get CSS var from theme without specifying the whole variable
3
- * and they does not need to remember the prefix (defined once).
4
- */
5
- export default function createGetCssVar<T extends string = string>(prefix?: string): <AdditionalVars extends string = never>(field: T | AdditionalVars, ...vars: (T | AdditionalVars)[]) => string;
1
+ /**
2
+ * The benefit of this function is to help developers get CSS var from theme without specifying the whole variable
3
+ * and they does not need to remember the prefix (defined once).
4
+ */
5
+ export default function createGetCssVar<T extends string = string>(prefix?: string): <AdditionalVars extends string = never>(field: T | AdditionalVars, ...vars: (T | AdditionalVars)[]) => string;