@mui/system 5.0.6 → 5.1.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.
- package/CHANGELOG.md +107 -0
- package/LICENSE +21 -21
- package/breakpoints.js +41 -8
- package/createBox.d.ts +5 -1
- package/createBox.js +5 -3
- package/createTheme/createBreakpoints.js +2 -2
- package/cssVars/createCssVarsProvider.d.ts +88 -38
- package/cssVars/createCssVarsProvider.js +83 -61
- package/cssVars/cssVarsParser.d.ts +14 -3
- package/cssVars/cssVarsParser.js +41 -11
- package/cssVars/getInitColorSchemeScript.d.ts +7 -2
- package/cssVars/getInitColorSchemeScript.js +27 -5
- package/cssVars/useCurrentColorScheme.d.ts +50 -0
- package/cssVars/useCurrentColorScheme.js +235 -0
- package/esm/breakpoints.js +39 -8
- package/esm/createBox.js +5 -3
- package/esm/createTheme/createBreakpoints.js +2 -2
- package/esm/cssVars/createCssVarsProvider.js +82 -63
- package/esm/cssVars/cssVarsParser.js +40 -11
- package/esm/cssVars/getInitColorSchemeScript.js +24 -3
- package/esm/cssVars/useCurrentColorScheme.js +217 -0
- package/esm/styleFunctionSx/extendSxProp.js +20 -1
- package/esm/styleFunctionSx/styleFunctionSx.js +45 -35
- package/index.js +1 -1
- package/legacy/breakpoints.js +39 -8
- package/legacy/createBox.js +6 -3
- package/legacy/createTheme/createBreakpoints.js +2 -2
- package/legacy/cssVars/createCssVarsProvider.js +83 -70
- package/legacy/cssVars/cssVarsParser.js +37 -9
- package/legacy/cssVars/getInitColorSchemeScript.js +13 -4
- package/legacy/cssVars/useCurrentColorScheme.js +231 -0
- package/legacy/index.js +1 -1
- package/legacy/styleFunctionSx/extendSxProp.js +21 -1
- package/legacy/styleFunctionSx/styleFunctionSx.js +44 -34
- package/modern/breakpoints.js +39 -8
- package/modern/createBox.js +5 -3
- package/modern/createTheme/createBreakpoints.js +2 -2
- package/modern/cssVars/createCssVarsProvider.js +82 -63
- package/modern/cssVars/cssVarsParser.js +40 -11
- package/modern/cssVars/getInitColorSchemeScript.js +24 -3
- package/modern/cssVars/useCurrentColorScheme.js +217 -0
- package/modern/index.js +1 -1
- package/modern/styleFunctionSx/extendSxProp.js +20 -1
- package/modern/styleFunctionSx/styleFunctionSx.js +45 -35
- package/package.json +7 -7
- package/styleFunctionSx/extendSxProp.js +21 -1
- package/styleFunctionSx/styleFunctionSx.d.ts +2 -1
- package/styleFunctionSx/styleFunctionSx.js +46 -36
- package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,112 @@
|
|
|
1
1
|
### [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 5.1.0
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v5.0.6..master -->
|
|
6
|
+
|
|
7
|
+
_Nov 8, 2021_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 33 contributors who made this release possible. Here are some highlights ✨:
|
|
10
|
+
|
|
11
|
+
- 🎉 Support custom elements under `ButtonGroup` (#28645) @ZeeshanTamboli
|
|
12
|
+
- 🛠 Add support for arrays in the `sx` prop (#29297) @siriwatknp
|
|
13
|
+
- And many more 🐛 bug fixes and 📚 improvements.
|
|
14
|
+
|
|
15
|
+
### `@mui/material@5.1.0`
|
|
16
|
+
|
|
17
|
+
- ​<!-- 68 -->[Autocomplete] Fix `hiddenLabel` prop of `TextField variant={filled}` inside Autocomplete (#29234) @jatinsandilya
|
|
18
|
+
- ​<!-- 67 -->[Box] Support generateClassName and defaultClassName (#29347) @siriwatknp
|
|
19
|
+
- ​<!-- 66 -->[ButtonGroup] Fix variant outlined always has primary color borders on hover (#29487) @ZeeshanTamboli
|
|
20
|
+
- ​<!-- 65 -->[ButtonGroup] Support different elements under ButtonGroup (#28645) @ZeeshanTamboli
|
|
21
|
+
- ​<!-- 62 -->[CssBaseline] Add `enableColorScheme` prop so enable using `color-scheme` property to deal with dark mode (#29454) @alexfauquette
|
|
22
|
+
- ​<!-- 29 -->[FormControlLabel] Narrow the label type (#29324) @michaldudak
|
|
23
|
+
- ​<!-- 28 -->[Grid] Fix usage when columns > 12 (#29196) @tanay123456789
|
|
24
|
+
- ​<!-- 27 -->[InputBase] Do not repeat the same classname (#29353) @hbjORbj
|
|
25
|
+
- ​<!-- 30 -->[InputBase] Remove WebkitAppearance from search type (#29383) @nicbarajas
|
|
26
|
+
- ​<!-- 25 -->[ListItem] Add missing exports (#29571) @robcaldecott
|
|
27
|
+
- ​<!-- 22 -->[Pagination] Allow customization of icons (#29336) @mbeltramin
|
|
28
|
+
- ​<!-- 11 -->[TextField] Fix bootstrap, normalize.css, sanitize.css conflicts (#28674) @ChrisClaude
|
|
29
|
+
- ​<!-- 10 -->[TextField] Fix invisible wrap within notched inputs (#29088) @DASPRiD
|
|
30
|
+
- ​<!-- 09 -->[Tooltip] `open` prop in `componentsProps.popper` can be optional (#29370) @ZeeshanTamboli
|
|
31
|
+
- ​<!-- 08 -->[Tooltip] Fix `className` not getting applied from PopperProps (#29023) @ZeeshanTamboli
|
|
32
|
+
- ​<!-- 07 -->[useRadioGroup] Convert to TypeScript (#29326) @eps1lon
|
|
33
|
+
|
|
34
|
+
### `@mui/system@5.1.0`
|
|
35
|
+
|
|
36
|
+
- ​<!-- 21 -->[system] Introduce `mode` to CssVarsProvider (#29418) @siriwatknp
|
|
37
|
+
- ​<!-- 20 -->[system] Improve breakpoints resolver function (#29300) @hbjORbj
|
|
38
|
+
- ​<!-- 19 -->[system] Add array support for `sx` prop (#29297) @siriwatknp
|
|
39
|
+
|
|
40
|
+
### `@mui/codemod@5.1.0`
|
|
41
|
+
|
|
42
|
+
- ​<!-- 64 -->[codemod] Add codemod parser flag (#29059) (#29229) @ElonVolo
|
|
43
|
+
|
|
44
|
+
### `@mui/lab@5.0.0-alpha.54`
|
|
45
|
+
|
|
46
|
+
- ​<!-- 52 -->[DatePicker] Fix disabled/readOnly for view components (#28815) @adamfitzgibbon
|
|
47
|
+
- ​<!-- 24 -->[Masonry] Fix crash on unmount when using React 18 (#29358) @eps1lon
|
|
48
|
+
- ​<!-- 23 -->[Masonry] Improve height computation and detect changes in `children` (#29351) @hbjORbj
|
|
49
|
+
|
|
50
|
+
### `@mui/joy@5.0.0-alpha.0`
|
|
51
|
+
|
|
52
|
+
- ​<!-- 28 -->[Joy] Update default theme (#29478) @siriwatknp
|
|
53
|
+
- ​<!-- 26 -->[Joy] Export CssVarsProvider with default theme (#29150) @siriwatknp
|
|
54
|
+
- ​<!-- 25 -->[Joy] Remove `private` to leverage CodeSandbox (#29280) @siriwatknp
|
|
55
|
+
|
|
56
|
+
### Docs
|
|
57
|
+
|
|
58
|
+
- ​<!-- 51 -->[docs] Add differences between styled and sx (#28685) @eric-burel
|
|
59
|
+
- ​<!-- 50 -->[docs] Track usage of dark mode in Google Analytics (#29419) @oliviertassinari
|
|
60
|
+
- ​<!-- 49 -->[docs] Remove create-mui-theme as it is no longer working (#29472) @IPJT
|
|
61
|
+
- ​<!-- 48 -->[docs] Fix warnings in AppSearch (#29459) @eps1lon
|
|
62
|
+
- ​<!-- 47 -->[docs] Add framework example for ClassNameGenerator (#29453) @siriwatknp
|
|
63
|
+
- ​<!-- 46 -->[docs] Fix layout shift when scrolling (#29436) @oliviertassinari
|
|
64
|
+
- ​<!-- 45 -->[docs] Fix layout-shift on id='main-content' (#29425) @oliviertassinari
|
|
65
|
+
- ​<!-- 44 -->[docs] Remove usage of `process.browser` (#29438) @oliviertassinari
|
|
66
|
+
- ​<!-- 43 -->[docs] Add instruction on how to use the child selector API with emotion (#29350) @mnajdova
|
|
67
|
+
- ​<!-- 42 -->[docs] Fix small typos (#29424) @oliviertassinari
|
|
68
|
+
- ​<!-- 41 -->[docs] Fix TOC highlighting logic (#29435) @oliviertassinari
|
|
69
|
+
- ​<!-- 40 -->[docs] Fix about page flags (#29314) @mbrookes
|
|
70
|
+
- ​<!-- 39 -->[docs] Fix Box JS docs (#29282) @Pablion
|
|
71
|
+
- ​<!-- 38 -->[docs] Update storybook section in migration to v5 docs (#28800) @siriwatknp
|
|
72
|
+
- ​<!-- 37 -->[docs] Document how to enable color on dark mode (#29340) @Wimukti
|
|
73
|
+
- ​<!-- 36 -->[docs] Display search functionality in all viewports (#28819) @eps1lon
|
|
74
|
+
- ​<!-- 35 -->[docs] Query heading for ToC on demand (#29204) @eps1lon
|
|
75
|
+
- ​<!-- 34 -->[docs] Add next.js styled-component guide and update links to example (#29118) @Jareechang
|
|
76
|
+
- ​<!-- 33 -->[docs] Fix overriding `MuiTextField`'s default props in the migration guide (#29174) @tm1000
|
|
77
|
+
- ​<!-- 32 -->[docs] Fix "clickable" and "deletable" typos (#28702) @jacklaurencegaray
|
|
78
|
+
- ​<!-- 31 -->[docs] Update migration-v4 docs for wrong import path (#29042) @busches
|
|
79
|
+
- ​<!-- 30 -->[docs] Add GitHub icon change to "Migration from v4 to v5" guide (#29182) @dan-mba
|
|
80
|
+
- ​<!-- 06 -->[website] Benny Joo joining MUI (#29499) @mnajdova
|
|
81
|
+
- ​<!-- 05 -->[website] Update the `Print export` feature info on the pricing page (#29484) @DanailH
|
|
82
|
+
- ​<!-- 04 -->[website] Improve the dev rel role description (#29477) @oliviertassinari
|
|
83
|
+
- ​<!-- 03 -->[website] Add customers section on Design Kits and Templates marketing pages (#29168) @danilo-leal
|
|
84
|
+
- ​<!-- 02 -->[website] Improvements to the /core product page @danilo-leal
|
|
85
|
+
- ​<!-- 01 -->[website] Fix typo on the About Page (#29286) @gssakash
|
|
86
|
+
|
|
87
|
+
### Core
|
|
88
|
+
|
|
89
|
+
- ​<!-- 63 -->[core] Handle RecordType and FieldType in generatePropDescription.ts (#29467) @flaviendelangle
|
|
90
|
+
- ​<!-- 61 -->[core] Convert a named color to lowercase (#29465) @ainatenhi
|
|
91
|
+
- ​<!-- 60 -->[core] Allow to reuse functions from `docs:api` (#28828) @m4theushw
|
|
92
|
+
- ​<!-- 59 -->[core] Commit new nextjs 12 tsconfig (#29458) @eps1lon
|
|
93
|
+
- ​<!-- 58 -->[core] Settle on MUI X for the official name (#29420) @oliviertassinari
|
|
94
|
+
- ​<!-- 57 -->[core] Add mui as a npm keyword (#29427) @oliviertassinari
|
|
95
|
+
- ​<!-- 56 -->[core] Fix issue template redirection (#29432) @oliviertassinari
|
|
96
|
+
- ​<!-- 55 -->[core] Remove unecessary destructuration (#29354) @oliviertassinari
|
|
97
|
+
- ​<!-- 54 -->[core] Use cross-env to set env variables in material-icons scripts (#29327) @michaldudak
|
|
98
|
+
- ​<!-- 53 -->[core] Don't bump peer dependency ranges on dependency updates (#29303) @eps1lon
|
|
99
|
+
- ​<!-- 18 -->[test] Fix browser tests (#29505) @eps1lon
|
|
100
|
+
- ​<!-- 69 -->[test] Fix missing act warnings in latest React 18 alpha (#29357) @eps1lon
|
|
101
|
+
- ​<!-- 17 -->[test] Replace `createClientRender` with new `createRenderer` API (#29471) @eps1lon
|
|
102
|
+
- ​<!-- 16 -->[test] Fix possible "missing act" warning (#29463) @eps1lon
|
|
103
|
+
- ​<!-- 15 -->[test] Remove render#baseElement (#29462) @eps1lon
|
|
104
|
+
- ​<!-- 14 -->[test] Expose `AbortController` on global (#29360) @eps1lon
|
|
105
|
+
- ​<!-- 13 -->[test] Add internal test for uniqe `name` in `Rating` (#29329) @eps1lon
|
|
106
|
+
- ​<!-- 12 -->[test] Fix browser tests (#29305) @eps1lon
|
|
107
|
+
|
|
108
|
+
All contributors of this release in alphabetical order: @adamfitzgibbon, @ainatenhi, @alexfauquette, @busches, @ChrisClaude, @dan-mba, @DanailH, @danilo-leal, @DASPRiD, @ElonVolo, @eps1lon, @eric-burel, @flaviendelangle, @gssakash, @hbjORbj, @IPJT, @jacklaurencegaray, @Jareechang, @jatinsandilya, @m4theushw, @mbeltramin, @mbrookes, @michaldudak, @mnajdova, @nicbarajas, @oliviertassinari, @Pablion, @robcaldecott, @siriwatknp, @tanay123456789, @tm1000, @Wimukti, @ZeeshanTamboli
|
|
109
|
+
|
|
3
110
|
## 5.0.6
|
|
4
111
|
|
|
5
112
|
<!-- generated comparing v5.0.5..master -->
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2014 Call-Em-All
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 Call-Em-All
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/breakpoints.js
CHANGED
|
@@ -5,6 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
+
exports.computeBreakpointsBase = computeBreakpointsBase;
|
|
8
9
|
exports.createEmptyBreakpointObject = createEmptyBreakpointObject;
|
|
9
10
|
exports.default = void 0;
|
|
10
11
|
exports.handleBreakpoints = handleBreakpoints;
|
|
@@ -27,12 +28,12 @@ const values = {
|
|
|
27
28
|
xs: 0,
|
|
28
29
|
// phone
|
|
29
30
|
sm: 600,
|
|
30
|
-
//
|
|
31
|
+
// tablet
|
|
31
32
|
md: 900,
|
|
32
33
|
// small laptop
|
|
33
34
|
lg: 1200,
|
|
34
35
|
// desktop
|
|
35
|
-
xl: 1536 // large
|
|
36
|
+
xl: 1536 // large screen
|
|
36
37
|
|
|
37
38
|
};
|
|
38
39
|
exports.values = values;
|
|
@@ -131,12 +132,43 @@ function mergeBreakpointsInOrder(breakpointsInput, ...styles) {
|
|
|
131
132
|
const emptyBreakpoints = createEmptyBreakpointObject(breakpointsInput);
|
|
132
133
|
const mergedOutput = [emptyBreakpoints, ...styles].reduce((prev, next) => (0, _utils.deepmerge)(prev, next), {});
|
|
133
134
|
return removeUnusedBreakpoints(Object.keys(emptyBreakpoints), mergedOutput);
|
|
135
|
+
} // compute base for responsive values; e.g.,
|
|
136
|
+
// [1,2,3] => {xs: true, sm: true, md: true}
|
|
137
|
+
// {xs: 1, sm: 2, md: 3} => {xs: true, sm: true, md: true}
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
function computeBreakpointsBase(breakpointValues, themeBreakpoints) {
|
|
141
|
+
// fixed value
|
|
142
|
+
if (typeof breakpointValues !== 'object') {
|
|
143
|
+
return {};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const base = {};
|
|
147
|
+
const breakpointsKeys = Object.keys(themeBreakpoints);
|
|
148
|
+
|
|
149
|
+
if (Array.isArray(breakpointValues)) {
|
|
150
|
+
breakpointsKeys.forEach((breakpoint, i) => {
|
|
151
|
+
if (i < breakpointValues.length) {
|
|
152
|
+
base[breakpoint] = true;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
} else {
|
|
156
|
+
breakpointsKeys.forEach(breakpoint => {
|
|
157
|
+
if (breakpointValues[breakpoint] != null) {
|
|
158
|
+
base[breakpoint] = true;
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return base;
|
|
134
164
|
}
|
|
135
165
|
|
|
136
166
|
function resolveBreakpointValues({
|
|
137
167
|
values: breakpointValues,
|
|
138
|
-
|
|
168
|
+
breakpoints: themeBreakpoints,
|
|
169
|
+
base: customBase
|
|
139
170
|
}) {
|
|
171
|
+
const base = customBase || computeBreakpointsBase(breakpointValues, themeBreakpoints);
|
|
140
172
|
const keys = Object.keys(base);
|
|
141
173
|
|
|
142
174
|
if (keys.length === 0) {
|
|
@@ -144,14 +176,15 @@ function resolveBreakpointValues({
|
|
|
144
176
|
}
|
|
145
177
|
|
|
146
178
|
let previous;
|
|
147
|
-
return keys.reduce((acc, breakpoint) => {
|
|
148
|
-
if (
|
|
149
|
-
acc[breakpoint] = breakpointValues[
|
|
179
|
+
return keys.reduce((acc, breakpoint, i) => {
|
|
180
|
+
if (Array.isArray(breakpointValues)) {
|
|
181
|
+
acc[breakpoint] = breakpointValues[i] != null ? breakpointValues[i] : breakpointValues[previous];
|
|
182
|
+
previous = i;
|
|
150
183
|
} else {
|
|
151
|
-
acc[breakpoint] = breakpointValues;
|
|
184
|
+
acc[breakpoint] = breakpointValues[breakpoint] != null ? breakpointValues[breakpoint] : breakpointValues[previous] || breakpointValues;
|
|
185
|
+
previous = breakpoint;
|
|
152
186
|
}
|
|
153
187
|
|
|
154
|
-
previous = breakpoint;
|
|
155
188
|
return acc;
|
|
156
189
|
}, {});
|
|
157
190
|
}
|
package/createBox.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
export default function createBox(options?: {
|
|
3
|
+
export default function createBox(options?: {
|
|
4
|
+
defaultTheme: object;
|
|
5
|
+
defaultClassName?: string;
|
|
6
|
+
generateClassName?: () => string;
|
|
7
|
+
}): React.ElementType;
|
package/createBox.js
CHANGED
|
@@ -33,7 +33,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
33
33
|
|
|
34
34
|
function createBox(options = {}) {
|
|
35
35
|
const {
|
|
36
|
-
defaultTheme
|
|
36
|
+
defaultTheme,
|
|
37
|
+
defaultClassName = 'MuiBox-root',
|
|
38
|
+
generateClassName
|
|
37
39
|
} = options;
|
|
38
40
|
const BoxRoot = (0, _styledEngine.default)('div')(_styleFunctionSx.default);
|
|
39
41
|
const Box = /*#__PURE__*/React.forwardRef(function Box(inProps, ref) {
|
|
@@ -49,7 +51,7 @@ function createBox(options = {}) {
|
|
|
49
51
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(BoxRoot, (0, _extends2.default)({
|
|
50
52
|
as: component,
|
|
51
53
|
ref: ref,
|
|
52
|
-
className: (0, _clsx.default)(className,
|
|
54
|
+
className: (0, _clsx.default)(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
|
|
53
55
|
theme: theme
|
|
54
56
|
}, other));
|
|
55
57
|
});
|
|
@@ -75,7 +77,7 @@ function createBox(options = {}) {
|
|
|
75
77
|
/**
|
|
76
78
|
* @ignore
|
|
77
79
|
*/
|
|
78
|
-
sx: _propTypes.default.object
|
|
80
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.array])
|
|
79
81
|
} : void 0;
|
|
80
82
|
return Box;
|
|
81
83
|
}
|
|
@@ -27,12 +27,12 @@ function createBreakpoints(breakpoints) {
|
|
|
27
27
|
xs: 0,
|
|
28
28
|
// phone
|
|
29
29
|
sm: 600,
|
|
30
|
-
//
|
|
30
|
+
// tablet
|
|
31
31
|
md: 900,
|
|
32
32
|
// small laptop
|
|
33
33
|
lg: 1200,
|
|
34
34
|
// desktop
|
|
35
|
-
xl: 1536 // large
|
|
35
|
+
xl: 1536 // large screen
|
|
36
36
|
|
|
37
37
|
},
|
|
38
38
|
unit = 'px',
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { Result, Mode } from './useCurrentColorScheme';
|
|
2
3
|
|
|
3
|
-
type
|
|
4
|
-
[K in keyof T]
|
|
4
|
+
type RequiredDeep<T> = {
|
|
5
|
+
[K in keyof T]-?: RequiredDeep<T[K]>;
|
|
5
6
|
};
|
|
6
7
|
|
|
7
8
|
export type BuildCssVarsTheme<ThemeInput> = ThemeInput extends {
|
|
8
|
-
colorSchemes: Record<string, infer
|
|
9
|
+
colorSchemes: Record<string, infer ColorSystems>;
|
|
9
10
|
}
|
|
10
|
-
? Omit<ThemeInput, 'colorSchemes'> &
|
|
11
|
+
? Omit<ThemeInput, 'colorSchemes'> &
|
|
12
|
+
ColorSystems & { vars: Omit<ThemeInput, 'colorSchemes'> & ColorSystems }
|
|
11
13
|
: never;
|
|
12
14
|
|
|
13
15
|
/**
|
|
@@ -18,59 +20,107 @@ export type BuildCssVarsTheme<ThemeInput> = ThemeInput extends {
|
|
|
18
20
|
* If yes, they must provide the palette of the extended colorScheme. Otherwise `theme` is optional.
|
|
19
21
|
*/
|
|
20
22
|
type DecideTheme<
|
|
21
|
-
|
|
23
|
+
DesignSystemTheme extends { colorSchemes: Record<DesignSystemColorScheme, any> },
|
|
22
24
|
DesignSystemColorScheme extends string,
|
|
25
|
+
ApplicationTheme extends { colorSchemes: Record<ApplicationColorScheme, any> },
|
|
23
26
|
ApplicationColorScheme extends string | never,
|
|
24
27
|
> = [ApplicationColorScheme] extends [never]
|
|
25
|
-
? { theme?:
|
|
28
|
+
? { theme?: DesignSystemTheme }
|
|
26
29
|
: {
|
|
27
|
-
theme:
|
|
28
|
-
colorSchemes:
|
|
29
|
-
Record<
|
|
30
|
+
theme: Omit<ApplicationTheme, 'colorSchemes'> & {
|
|
31
|
+
colorSchemes: Partial<
|
|
32
|
+
Record<
|
|
33
|
+
DesignSystemColorScheme,
|
|
34
|
+
DesignSystemTheme['colorSchemes'][DesignSystemColorScheme]
|
|
35
|
+
>
|
|
30
36
|
> &
|
|
31
|
-
|
|
37
|
+
RequiredDeep<
|
|
38
|
+
Record<ApplicationColorScheme, ApplicationTheme['colorSchemes'][ApplicationColorScheme]>
|
|
39
|
+
>;
|
|
32
40
|
};
|
|
33
41
|
};
|
|
34
42
|
|
|
35
|
-
export interface ColorSchemeContextValue<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
setColorScheme: React.Dispatch<React.SetStateAction<DesignSystemColorScheme | undefined>>;
|
|
43
|
+
export interface ColorSchemeContextValue<SupportedColorScheme extends string>
|
|
44
|
+
extends Result<SupportedColorScheme> {
|
|
45
|
+
allColorSchemes: SupportedColorScheme[];
|
|
39
46
|
}
|
|
40
47
|
|
|
41
48
|
export default function createCssVarsProvider<
|
|
42
|
-
|
|
43
|
-
colorSchemes: Record<DesignSystemColorScheme
|
|
49
|
+
DesignSystemThemeInput extends {
|
|
50
|
+
colorSchemes: Record<DesignSystemColorScheme, any>;
|
|
44
51
|
},
|
|
45
52
|
DesignSystemColorScheme extends string,
|
|
53
|
+
ApplicationThemeInput extends {
|
|
54
|
+
colorSchemes: Record<ApplicationColorScheme, any>;
|
|
55
|
+
} = never,
|
|
46
56
|
ApplicationColorScheme extends string = never,
|
|
47
|
-
>(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
>(options: {
|
|
58
|
+
/**
|
|
59
|
+
* Design system default theme
|
|
60
|
+
*/
|
|
61
|
+
theme: DesignSystemThemeInput;
|
|
62
|
+
/**
|
|
63
|
+
* Design system default color scheme
|
|
64
|
+
*/
|
|
65
|
+
defaultColorScheme:
|
|
66
|
+
| DesignSystemColorScheme
|
|
67
|
+
| { light: DesignSystemColorScheme; dark: DesignSystemColorScheme };
|
|
68
|
+
/**
|
|
69
|
+
* Design system default mode
|
|
70
|
+
* @default 'light'
|
|
71
|
+
*/
|
|
72
|
+
defaultMode?: Mode;
|
|
73
|
+
/**
|
|
74
|
+
* CSS variable prefix
|
|
75
|
+
* @default ''
|
|
76
|
+
*/
|
|
77
|
+
prefix?: string;
|
|
78
|
+
/**
|
|
79
|
+
* A function to determine if the key, value should be attached as CSS Variable
|
|
80
|
+
* `keys` is an array that represents the object path keys.
|
|
81
|
+
* Ex, if the theme is { foo: { bar: 'var(--test)' } }
|
|
82
|
+
* then, keys = ['foo', 'bar']
|
|
83
|
+
* value = 'var(--test)'
|
|
84
|
+
*/
|
|
85
|
+
shouldSkipGeneratingVar?: (keys: string[], value: string | number) => boolean;
|
|
86
|
+
}): {
|
|
66
87
|
CssVarsProvider: (
|
|
67
88
|
props: React.PropsWithChildren<
|
|
68
89
|
{
|
|
69
|
-
|
|
70
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Application default mode (overrides design system `defaultMode` if specified)
|
|
92
|
+
*/
|
|
93
|
+
defaultMode?: Mode;
|
|
94
|
+
/**
|
|
95
|
+
* Application default colorScheme (overrides design system `defaultColorScheme` if specified)
|
|
96
|
+
*/
|
|
97
|
+
defaultColorScheme?:
|
|
98
|
+
| DesignSystemColorScheme
|
|
99
|
+
| ApplicationColorScheme
|
|
100
|
+
| {
|
|
101
|
+
light: DesignSystemColorScheme | ApplicationColorScheme;
|
|
102
|
+
dark: DesignSystemColorScheme | ApplicationColorScheme;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* localStorage key used to store application `mode`
|
|
106
|
+
* @default 'mui-mode'
|
|
107
|
+
*/
|
|
108
|
+
modeStorageKey?: string;
|
|
109
|
+
/**
|
|
110
|
+
* DOM attribute for applying color scheme
|
|
111
|
+
* @default 'data-mui-color-scheme'
|
|
112
|
+
*/
|
|
71
113
|
attribute?: string;
|
|
114
|
+
/**
|
|
115
|
+
* CSS variable prefix (overrides design system `prefix` if specified)
|
|
116
|
+
*/
|
|
72
117
|
prefix?: string;
|
|
73
|
-
} & DecideTheme<
|
|
118
|
+
} & DecideTheme<
|
|
119
|
+
DesignSystemThemeInput,
|
|
120
|
+
DesignSystemColorScheme,
|
|
121
|
+
ApplicationThemeInput,
|
|
122
|
+
ApplicationColorScheme
|
|
123
|
+
>
|
|
74
124
|
>,
|
|
75
125
|
) => React.ReactElement;
|
|
76
126
|
useColorScheme: () => ColorSchemeContextValue<DesignSystemColorScheme | ApplicationColorScheme>;
|