@mui/system 5.10.8 → 5.10.10
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 +208 -19
- package/Unstable_Grid/createGrid.js +1 -1
- package/Unstable_Grid/gridGenerator.d.ts +3 -1
- package/Unstable_Grid/gridGenerator.js +16 -2
- package/cssVars/createCssVarsProvider.d.ts +0 -5
- package/cssVars/createCssVarsProvider.js +45 -44
- package/cssVars/cssVarsParser.js +1 -1
- package/cssVars/getInitColorSchemeScript.d.ts +0 -5
- package/cssVars/getInitColorSchemeScript.js +0 -4
- package/esm/Unstable_Grid/createGrid.js +2 -2
- package/esm/Unstable_Grid/gridGenerator.js +11 -0
- package/esm/cssVars/createCssVarsProvider.js +47 -45
- package/esm/cssVars/cssVarsParser.js +1 -1
- package/esm/cssVars/getInitColorSchemeScript.js +0 -4
- package/esm/palette.js +15 -3
- package/esm/style.js +1 -1
- package/index.js +1 -1
- package/legacy/Unstable_Grid/createGrid.js +2 -2
- package/legacy/Unstable_Grid/gridGenerator.js +17 -0
- package/legacy/cssVars/createCssVarsProvider.js +45 -47
- package/legacy/cssVars/cssVarsParser.js +1 -1
- package/legacy/cssVars/getInitColorSchemeScript.js +1 -3
- package/legacy/index.js +1 -1
- package/legacy/palette.js +15 -3
- package/legacy/style.js +1 -1
- package/modern/Unstable_Grid/createGrid.js +2 -2
- package/modern/Unstable_Grid/gridGenerator.js +11 -0
- package/modern/cssVars/createCssVarsProvider.js +47 -45
- package/modern/cssVars/cssVarsParser.js +1 -1
- package/modern/cssVars/getInitColorSchemeScript.js +0 -4
- package/modern/index.js +1 -1
- package/modern/palette.js +15 -3
- package/modern/style.js +1 -1
- package/package.json +3 -3
- package/palette.js +14 -3
- package/style.d.ts +4 -1
- package/style.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,194 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 5.10.10
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v5.10.9..master -->
|
|
6
|
+
|
|
7
|
+
_Oct 18, 2022_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 21 contributors who made this release possible. Here are some highlights ✨:
|
|
10
|
+
|
|
11
|
+
- 🖌 Thanks to the efforts of @bharatkashyap and @nihgwu, we now have editable demos across our docs (#34454)!
|
|
12
|
+
- 🚀 The Tooltip component has been added to Joy UI by @hbjORbj (#34509).
|
|
13
|
+
- ⚙️ We started converting the remaining JS components in MUI Base to TypeScript.
|
|
14
|
+
@mbayucot finished the first PR with the conversion of the NoSsr code (#34735).
|
|
15
|
+
- And more 🐛 bug fixes and 📚 documentation improvements.
|
|
16
|
+
|
|
17
|
+
### `@mui/material@5.10.10`
|
|
18
|
+
|
|
19
|
+
- [Popover] Fix paper position flash on open (#34546) @TheUnlocked
|
|
20
|
+
- [SwipeableDrawer] Make component `defaultProps` overridable (#34643) @hbjORbj
|
|
21
|
+
|
|
22
|
+
### `@mui/system@5.10.10`
|
|
23
|
+
|
|
24
|
+
- [system] Support CSS `grey` color in `sx` (#34548) @TheUnlocked
|
|
25
|
+
|
|
26
|
+
### `@mui/styles@5.10.10`
|
|
27
|
+
|
|
28
|
+
- [styles] Use memoized context in StylesProvider (#34637) @mohd-akram
|
|
29
|
+
|
|
30
|
+
### `@mui/joy@5.0.0-alpha.50`
|
|
31
|
+
|
|
32
|
+
- [Select][joy] Added hidden input element (#34657) @zee-bit
|
|
33
|
+
- [Slider][joy] Add global variant to slider (#34733) @siriwatknp
|
|
34
|
+
- [Tooltip][joy] Add component (#34509) @hbjORbj
|
|
35
|
+
|
|
36
|
+
### `@mui/base@5.0.0-alpha.102`
|
|
37
|
+
|
|
38
|
+
- [MultiSelect][base] Prevent the renderValue prop from being propagated to the DOM (#34698) @michaldudak
|
|
39
|
+
- [NoSsr] Convert code to TypeScript (#34735) @mbayucot
|
|
40
|
+
|
|
41
|
+
### Docs
|
|
42
|
+
|
|
43
|
+
- [docs] Fix the Autocomplete Highlighting example (#34184) @hayawata3626
|
|
44
|
+
- [docs] Fix typos in Base (Menu, Tabs) and Joy UI (Chip) (#34803) @rvrvrv
|
|
45
|
+
- [docs] Use new editing API in homepage demos (#34220) @m4theushw
|
|
46
|
+
- [docs] Live demos (#34454) @bharatkashyap
|
|
47
|
+
- [docs] Fix typos in Joy UI Switch (#34728) @ndresx
|
|
48
|
+
- [docs] Avoid scrollbar in the code demos (#34741) @oliviertassinari
|
|
49
|
+
- [docs] Revise the Joy UI "Automatic adjustment" page (#34614) @samuelsycamore
|
|
50
|
+
- [docs] Revise and rename the Joy UI "Perfect dark mode" page (#34613) @samuelsycamore
|
|
51
|
+
- [docs] Revise the Joy UI "Global variants" page (#34595) @samuelsycamore
|
|
52
|
+
- [docs] Basic link verification at PR level (#34588) @alexfauquette
|
|
53
|
+
- [docs] Add a missing comma in the customization example (#34617) @AbayKinayat
|
|
54
|
+
- [website] Clarify Pro/Premium support (#34607) @oliviertassinari
|
|
55
|
+
- [website] Fix home page dark mode flicker (#33545)
|
|
56
|
+
- [website] Update the state of the date pickers on the landing page (#34750) @joserodolfofreitas
|
|
57
|
+
|
|
58
|
+
### Core
|
|
59
|
+
|
|
60
|
+
- [core] Clean conditionals (#34772) @pedroprado010
|
|
61
|
+
- [core] Temporary remove the authorization (#34796) @siriwatknp
|
|
62
|
+
- [core] Avoid slower CI run statues @oliviertassinari
|
|
63
|
+
- [core] Improve the playground DX (#34739) @oliviertassinari
|
|
64
|
+
- [core] Link Netlify in the danger comment (#34688) @oliviertassinari
|
|
65
|
+
- [core] Fix CI after out of sync merge @oliviertassinari
|
|
66
|
+
- [core] Enforce straight quote (#34686) @oliviertassinari
|
|
67
|
+
- [core] Add code scanning via CodeQL (#34707) @DanailH
|
|
68
|
+
- [core] Fix some upcoming eslint issues (#34727) @oliviertassinari
|
|
69
|
+
- [core] Auto-fix upcoming eslint issues (#34644) @Janpot
|
|
70
|
+
- [core] Move SearchIcons to docs src folder (#34802)
|
|
71
|
+
- [test] Enable `react/no-unstable-nested-components` (#34518) @eps1lon
|
|
72
|
+
|
|
73
|
+
All contributors of this release in alphabetical order: @AbayKinayat, @alexfauquette, @bharatkashyap, @DanailH, @eps1lon, @hayawata3626, @hbjORbj, @Janpot, @joserodolfofreitas, @m4theushw, @mbayucot, @michaldudak, @mohd-akram, @ndresx, @oliviertassinari, @pedroprado010, @rvrvrv, @samuelsycamore, @siriwatknp, @TheUnlocked, @zee-bit
|
|
74
|
+
|
|
75
|
+
## 5.10.9
|
|
76
|
+
|
|
77
|
+
<!-- generated comparing v5.10.8..master -->
|
|
78
|
+
|
|
79
|
+
_Oct 10, 2022_
|
|
80
|
+
|
|
81
|
+
A big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
82
|
+
|
|
83
|
+
- 🚀 [Joy] Button loading functionality has been added by @kushagra010 (#34658)
|
|
84
|
+
- And more 🐛 bug fixes and 📚 documentation improvements.
|
|
85
|
+
|
|
86
|
+
### `@mui/material@5.10.9`
|
|
87
|
+
|
|
88
|
+
- ​<!-- 16 -->[Grid v2][system] Handle direction object prop for responsive design (#34574) @vanyaxk
|
|
89
|
+
- ​<!-- 03 -->[Slider] Fix unnecessary accessibility attribute in root element (#34610) @vanyaxk
|
|
90
|
+
|
|
91
|
+
### `@mui/system@5.10.9`
|
|
92
|
+
|
|
93
|
+
#### BREAKING CHANGE
|
|
94
|
+
|
|
95
|
+
- ​<!-- 17 -->[system] Fix color-scheme implementation (#34639) @siriwatknp
|
|
96
|
+
|
|
97
|
+
The `enableColorScheme` prop has been removed from `CssVarsProvider` and `getInitColorScheme` (both Material UI and Joy UI).
|
|
98
|
+
|
|
99
|
+
Migration:
|
|
100
|
+
|
|
101
|
+
- **Material UI**: you can enable the CSS color scheme via `<CssBaseline enableColorScheme />`.
|
|
102
|
+
- **Joy UI**: it is enabled automatically if you use `<CssBaseline />`, [see the docs](https://mui.com/joy-ui/react-css-baseline/).
|
|
103
|
+
|
|
104
|
+
#### Changes
|
|
105
|
+
|
|
106
|
+
- ​<!-- 02 -->[system] Fix typo in createCssVarsProvider (#34661) @HexM7
|
|
107
|
+
|
|
108
|
+
### `@mui/base@5.0.0-alpha.101`
|
|
109
|
+
|
|
110
|
+
- ​<!-- 01 -->[TrapFocus] Restore the previously exported type from @mui/material (#34601) @michaldudak
|
|
111
|
+
|
|
112
|
+
### `@mui/joy@5.0.0-alpha.49`
|
|
113
|
+
|
|
114
|
+
- ​<!-- 04 -->[Joy] Add button loading functionality (#34658) @kushagra010
|
|
115
|
+
|
|
116
|
+
### Docs
|
|
117
|
+
|
|
118
|
+
- ​<!-- 18 -->[docs] Revert #34541 (#34700) @michaldudak
|
|
119
|
+
- ​<!-- 15 -->[blog] Blog post for MUI X v6 alpha zero (#34424) @joserodolfofreitas
|
|
120
|
+
- ​<!-- 09 -->[docs] Improve Joy UI tutorial demo (#34653) @oliviertassinari
|
|
121
|
+
- ​<!-- 08 -->[docs] Explain how SelectUnstyled renders a hidden input (#34638) @michaldudak
|
|
122
|
+
- ​<!-- 07 -->[docs] Fix Taiwan description (#34611) @oliviertassinari
|
|
123
|
+
- ​<!-- 06 -->[docs] Fix codesandbox export with dayjs (#34619) @oliviertassinari
|
|
124
|
+
- ​<!-- 05 -->[docs] Explain the purpose of renderGroup prop (#34066) @michaldudak
|
|
125
|
+
|
|
126
|
+
### Core
|
|
127
|
+
|
|
128
|
+
- ​<!-- 14 -->[core] Make useForkRef variadic (#27939) @michaldudak
|
|
129
|
+
- ​<!-- 13 -->[core] Speedup of yarn install in the CI (#34632) @oliviertassinari
|
|
130
|
+
- ​<!-- 12 -->[core] Fix markdown loader on Windows (#34623) @michaldudak
|
|
131
|
+
- ​<!-- 11 -->[core] Update changelog for version v5.10.8 (#34593) @mnajdova
|
|
132
|
+
- ​<!-- 10 -->[core] Update root package.json version (#34592) @mnajdova
|
|
133
|
+
|
|
134
|
+
All contributors of this release in alphabetical order: @HexM7, @joserodolfofreitas, @kushagra010, @michaldudak, @mnajdova, @oliviertassinari, @vanyaxk
|
|
135
|
+
|
|
136
|
+
## 5.10.8
|
|
137
|
+
|
|
138
|
+
<!-- generated comparing v5.10.7..master -->
|
|
139
|
+
|
|
140
|
+
_Oct 3, 2022_
|
|
141
|
+
|
|
142
|
+
A big thanks to the 18 contributors who made this release possible. Here are some highlights ✨:
|
|
143
|
+
|
|
144
|
+
- 🚀 [SnackbarUnstyled](https://mui.com/base/react-snackbar/) component & headless hook are added to MUI Base (#33227) @ZeeshanTamboli
|
|
145
|
+
- 📚 [CSS variables documentation](https://mui.com/material-ui/experimental-api/css-theme-variables/overview/) for Material UI has been added by @siriwatknp (#33958)
|
|
146
|
+
- And more 🐛 bug fixes and 📚 documentation improvements.
|
|
147
|
+
|
|
148
|
+
### `@mui/material@5.10.8`
|
|
149
|
+
|
|
150
|
+
- ​<!-- 28 -->[Autocomplete] Skip filtering when list of options is loading (#33278) @ndebeiss
|
|
151
|
+
- ​<!-- 13 -->[Fab] Add `disabled` class to FAB button (#34245) @meenarama
|
|
152
|
+
- ​<!-- 09 -->[l10n] Add Arabic Saudi Arabia (ar-SA) locale (#33340) @rolule
|
|
153
|
+
- ​<!-- 08 -->[l10n] zhTW refinement (#33391) @Aporim2051
|
|
154
|
+
- ​<!-- 07 -->[Popover] Add `ownerState` on the paper slot (#34445) @kabernardes
|
|
155
|
+
- ​<!-- 05 -->[Slider] Fixed incorrect marks displayed due to duplicate keys in range (#33526) @kskd1804
|
|
156
|
+
- ​<!-- 03 -->[TextField] Fix typo in FormControlLabel declaration file (#34535) @hghmn
|
|
157
|
+
|
|
158
|
+
### `@mui/base@5.0.0-alpha.100`
|
|
159
|
+
|
|
160
|
+
- ​<!-- 04 -->[SnackbarUnstyled] Create component and `useSnackbar` hook (#33227) @ZeeshanTamboli
|
|
161
|
+
|
|
162
|
+
### `@mui/joy@5.0.0-alpha.48`
|
|
163
|
+
|
|
164
|
+
- ​<!-- 12 -->[Joy] Fix `variantPlain` classname missing in few components (#34534) @hbjORbj
|
|
165
|
+
- ​<!-- 11 -->[Joy] Fix input decorator color and list padding (#34586) @siriwatknp
|
|
166
|
+
- ​<!-- 10 -->[Joy] Miscellaneous fixes (#34492) @siriwatknp
|
|
167
|
+
|
|
168
|
+
### Docs
|
|
169
|
+
|
|
170
|
+
- ​<!-- 27 -->[blog] Fix 404 link in base introduction @oliviertassinari
|
|
171
|
+
- ​<!-- 21 -->[docs] Fix CI build (#34589) @mnajdova
|
|
172
|
+
- ​<!-- 20 -->[docs] Temporary remove date picker from home page (#34541) @siriwatknp
|
|
173
|
+
- ​<!-- 19 -->[docs] Revise and expand Joy UI "Tutorial" doc (#34569) @samuelsycamore
|
|
174
|
+
- ​<!-- 18 -->[docs] Fix SEO issues (#34537) @oliviertassinari
|
|
175
|
+
- ​<!-- 17 -->[docs] Add CSS variables documentation for Material UI (#33958) @siriwatknp
|
|
176
|
+
- ​<!-- 16 -->[docs] Capitalize Material Design on the Breakpoints page (#34481) @Dustin-Digitar
|
|
177
|
+
- ​<!-- 15 -->[docs] Able to load doc components inside markdown files (#34243) @flaviendelangle
|
|
178
|
+
- ​<!-- 14 -->[docs] Use mouse pointer on esc button in the search modal (#34485) @minkyngkm
|
|
179
|
+
- ​<!-- 02 -->[website] Fix typo in pricing FAQ @oliviertassinari
|
|
180
|
+
- ​<!-- 01 -->[website] Move the React Engineer role from open to next (#34494) @mnajdova
|
|
181
|
+
|
|
182
|
+
### Core
|
|
183
|
+
|
|
184
|
+
- ​<!-- 26 -->[core] Update root package.json version (#34592) @mnajdova
|
|
185
|
+
- ​<!-- 25 -->[core] Remove useless comment in fixtures (#34581) @Garz4
|
|
186
|
+
- ​<!-- 24 -->[core] Fix link to CODE_OF_CONDUCT.md (#34543) @peippo
|
|
187
|
+
- ​<!-- 23 -->[core] Remove outdated docsearch.js dependency (#34421) @oliviertassinari
|
|
188
|
+
- ​<!-- 22 -->[core] Add `newFeature` to the typing of MuiPage (#34511) @flaviendelangle
|
|
189
|
+
|
|
190
|
+
All contributors of this release in alphabetical order: @Aporim2051, @Dustin-Digitar, @flaviendelangle, @Garz4, @hbjORbj, @hghmn, @kabernardes, @kskd1804, @meenarama, @minkyngkm, @mnajdova, @ndebeiss, @oliviertassinari, @peippo, @rolule, @samuelsycamore, @siriwatknp, @ZeeshanTamboli
|
|
191
|
+
|
|
3
192
|
## 5.10.7
|
|
4
193
|
|
|
5
194
|
<!-- generated comparing v5.10.6..master -->
|
|
@@ -37,8 +226,8 @@ A big thanks to the 21 contributors who made this release possible. Here are som
|
|
|
37
226
|
- [TrapFocus] Rename TrapFocus to FocusTrap (#34216) @kabernardes
|
|
38
227
|
|
|
39
228
|
```diff
|
|
40
|
-
-
|
|
41
|
-
+
|
|
229
|
+
-import TrapFocus from '@mui/base/TrapFocus';
|
|
230
|
+
+import FocusTrap from '@mui/base/FocusTrap';
|
|
42
231
|
```
|
|
43
232
|
|
|
44
233
|
#### Changes
|
|
@@ -320,7 +509,7 @@ _Aug 22, 2022_
|
|
|
320
509
|
|
|
321
510
|
A big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
|
|
322
511
|
|
|
323
|
-
- ✨ @michaldudak synced the Material Icons set with the latest from Google (#33988)
|
|
512
|
+
- ✨ @michaldudak synced the Material Icons set with the latest from Google (#33988).\
|
|
324
513
|
A couple of icons changed their appearance. See the difference [on this Argos build](https://app.argos-ci.com/mui/material-ui/builds/4428]).
|
|
325
514
|
|
|
326
515
|
### `@mui/material@5.10.2`
|
|
@@ -1910,8 +2099,8 @@ A big thanks to the 16 contributors who made this release possible. Here are som
|
|
|
1910
2099
|
`unstable_ClassNameGenerator` has been moved from `utils` to `className` folder to prevent all MUI Base module imports. If you use the module, please update the import as suggested in the diff below:
|
|
1911
2100
|
|
|
1912
2101
|
```diff
|
|
1913
|
-
-
|
|
1914
|
-
+
|
|
2102
|
+
-import { unstable_ClassNameGenerator } from '@mui/material/utils';
|
|
2103
|
+
+import { unstable_ClassNameGenerator } from '@mui/material/className';
|
|
1915
2104
|
```
|
|
1916
2105
|
|
|
1917
2106
|
#### Changes
|
|
@@ -2253,8 +2442,8 @@ A big thanks to the 22 contributors who made this release possible. Here are som
|
|
|
2253
2442
|
3. Change the import paths of unstyled components from @mui/material to @mui/base, e.g.:
|
|
2254
2443
|
|
|
2255
2444
|
```diff
|
|
2256
|
-
-
|
|
2257
|
-
+
|
|
2445
|
+
-import ButtonUnstyled from '@mui/material/ButtonUnstyled';
|
|
2446
|
+
+import ButtonUnstyled from '@mui/base/ButtonUnstyled';
|
|
2258
2447
|
```
|
|
2259
2448
|
|
|
2260
2449
|
#### Changes
|
|
@@ -4297,12 +4486,12 @@ A big thanks to the 13 contributors who made this release possible. Here are som
|
|
|
4297
4486
|
`span` element that wraps children has been removed. `wrapper` classKey is also removed. More details about [this change](https://github.com/mui/material-ui/pull/26666).
|
|
4298
4487
|
|
|
4299
4488
|
```diff
|
|
4300
|
-
|
|
4301
|
-
-
|
|
4489
|
+
<button class="MuiTab-root">
|
|
4490
|
+
- <span class="MuiTab-wrapper">
|
|
4302
4491
|
{icon}
|
|
4303
4492
|
{label}
|
|
4304
|
-
-
|
|
4305
|
-
|
|
4493
|
+
- </span>
|
|
4494
|
+
</button>
|
|
4306
4495
|
```
|
|
4307
4496
|
|
|
4308
4497
|
- [BottomNavigation] Remove wrapper from BottomNavigationAction (#26923) @siriwatknp
|
|
@@ -4310,14 +4499,14 @@ A big thanks to the 13 contributors who made this release possible. Here are som
|
|
|
4310
4499
|
`span` element that wraps children has been removed. `wrapper` classKey is also removed. More details about [this change](https://github.com/mui/material-ui/pull/26666).
|
|
4311
4500
|
|
|
4312
4501
|
```diff
|
|
4313
|
-
|
|
4314
|
-
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
-
|
|
4320
|
-
|
|
4502
|
+
<button class="MuiBottomNavigationAction-root">
|
|
4503
|
+
- <span class="MuiBottomNavigationAction-wrapper">
|
|
4504
|
+
{icon}
|
|
4505
|
+
<span class="MuiBottomNavigationAction-label">
|
|
4506
|
+
{label}
|
|
4507
|
+
</span>
|
|
4508
|
+
- </span>
|
|
4509
|
+
</button>
|
|
4321
4510
|
```
|
|
4322
4511
|
|
|
4323
4512
|
#### Changes
|
|
@@ -74,7 +74,7 @@ function createGrid(options = {}) {
|
|
|
74
74
|
gridSize
|
|
75
75
|
} = ownerState;
|
|
76
76
|
const slots = {
|
|
77
|
-
root: ['root', container && 'container',
|
|
77
|
+
root: ['root', container && 'container', wrap !== 'wrap' && `wrap-xs-${String(wrap)}`, ...(0, _gridGenerator.generateDirectionClasses)(direction), ...(0, _gridGenerator.generateSizeClassNames)(gridSize), ...(container ? (0, _gridGenerator.generateSpacingClassNames)(spacing, theme.breakpoints.keys[0]) : [])]
|
|
78
78
|
};
|
|
79
79
|
return (0, _utils.unstable_composeClasses)(slots, slot => (0, _utils.unstable_generateUtilityClass)(componentName, slot), {});
|
|
80
80
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Breakpoints } from '../createTheme/createBreakpoints';
|
|
2
2
|
import { Spacing } from '../createTheme/createSpacing';
|
|
3
|
-
import {
|
|
3
|
+
import { ResponsiveStyleValue } from '../styleFunctionSx';
|
|
4
|
+
import { GridDirection, GridOwnerState } from './GridProps';
|
|
4
5
|
interface Props {
|
|
5
6
|
theme: {
|
|
6
7
|
breakpoints: Breakpoints;
|
|
@@ -23,4 +24,5 @@ export declare const generateGridDirectionStyles: ({ theme, ownerState }: Props)
|
|
|
23
24
|
export declare const generateGridStyles: ({ ownerState }: Props) => {};
|
|
24
25
|
export declare const generateSizeClassNames: (gridSize: GridOwnerState['gridSize']) => string[];
|
|
25
26
|
export declare const generateSpacingClassNames: (spacing: GridOwnerState['spacing'], smallestBreakpoint?: string) => string[];
|
|
27
|
+
export declare const generateDirectionClasses: (direction: ResponsiveStyleValue<GridDirection> | undefined) => string[];
|
|
26
28
|
export {};
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.traverseBreakpoints = exports.generateSpacingClassNames = exports.generateSizeClassNames = exports.generateGridStyles = exports.generateGridSizeStyles = exports.generateGridRowSpacingStyles = exports.generateGridOffsetStyles = exports.generateGridDirectionStyles = exports.generateGridColumnsStyles = exports.generateGridColumnSpacingStyles = void 0;
|
|
8
|
+
exports.traverseBreakpoints = exports.generateSpacingClassNames = exports.generateSizeClassNames = exports.generateGridStyles = exports.generateGridSizeStyles = exports.generateGridRowSpacingStyles = exports.generateGridOffsetStyles = exports.generateGridDirectionStyles = exports.generateGridColumnsStyles = exports.generateGridColumnSpacingStyles = exports.generateDirectionClasses = void 0;
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
@@ -272,4 +272,18 @@ const generateSpacingClassNames = (spacing, smallestBreakpoint = 'xs') => {
|
|
|
272
272
|
return [];
|
|
273
273
|
};
|
|
274
274
|
|
|
275
|
-
exports.generateSpacingClassNames = generateSpacingClassNames;
|
|
275
|
+
exports.generateSpacingClassNames = generateSpacingClassNames;
|
|
276
|
+
|
|
277
|
+
const generateDirectionClasses = direction => {
|
|
278
|
+
if (direction === undefined) {
|
|
279
|
+
return [];
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (typeof direction === 'object') {
|
|
283
|
+
return Object.entries(direction).map(([key, value]) => `direction-${key}-${value}`);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return [`direction-xs-${String(direction)}`];
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
exports.generateDirectionClasses = generateDirectionClasses;
|
|
@@ -39,11 +39,6 @@ export interface CssVarsProviderConfig<ColorScheme extends string> {
|
|
|
39
39
|
* @default false
|
|
40
40
|
*/
|
|
41
41
|
disableTransitionOnChange?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Indicate to the browser which color scheme is used (light or dark) for rendering built-in UI
|
|
44
|
-
* @default true
|
|
45
|
-
*/
|
|
46
|
-
enableColorScheme?: boolean;
|
|
47
42
|
/**
|
|
48
43
|
* A function to determine if the key, value should be attached as CSS Variable
|
|
49
44
|
* `keys` is an array that represents the object path keys.
|
|
@@ -45,10 +45,9 @@ function createCssVarsProvider(options) {
|
|
|
45
45
|
attribute: defaultAttribute = _getInitColorSchemeScript.DEFAULT_ATTRIBUTE,
|
|
46
46
|
modeStorageKey: defaultModeStorageKey = _getInitColorSchemeScript.DEFAULT_MODE_STORAGE_KEY,
|
|
47
47
|
colorSchemeStorageKey: defaultColorSchemeStorageKey = _getInitColorSchemeScript.DEFAULT_COLOR_SCHEME_STORAGE_KEY,
|
|
48
|
-
defaultMode:
|
|
48
|
+
defaultMode: designSystemMode = 'light',
|
|
49
49
|
defaultColorScheme: designSystemColorScheme,
|
|
50
50
|
disableTransitionOnChange: designSystemTransitionOnChange = false,
|
|
51
|
-
enableColorScheme: designSystemEnableColorScheme = true,
|
|
52
51
|
shouldSkipGeneratingVar: designSystemShouldSkipGeneratingVar,
|
|
53
52
|
resolveTheme,
|
|
54
53
|
excludeVariablesFromRoot
|
|
@@ -76,10 +75,9 @@ function createCssVarsProvider(options) {
|
|
|
76
75
|
modeStorageKey = defaultModeStorageKey,
|
|
77
76
|
colorSchemeStorageKey = defaultColorSchemeStorageKey,
|
|
78
77
|
attribute = defaultAttribute,
|
|
79
|
-
defaultMode =
|
|
78
|
+
defaultMode = designSystemMode,
|
|
80
79
|
defaultColorScheme = designSystemColorScheme,
|
|
81
80
|
disableTransitionOnChange = designSystemTransitionOnChange,
|
|
82
|
-
enableColorScheme = designSystemEnableColorScheme,
|
|
83
81
|
storageWindow = typeof window === 'undefined' ? undefined : window,
|
|
84
82
|
documentNode = typeof document === 'undefined' ? undefined : document,
|
|
85
83
|
colorSchemeNode = typeof document === 'undefined' ? undefined : document.documentElement,
|
|
@@ -95,7 +93,8 @@ function createCssVarsProvider(options) {
|
|
|
95
93
|
restThemeProp = (0, _objectWithoutPropertiesLoose2.default)(themeProp, _excluded);
|
|
96
94
|
const allColorSchemes = Object.keys(colorSchemes);
|
|
97
95
|
const defaultLightColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.light;
|
|
98
|
-
const defaultDarkColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.dark;
|
|
96
|
+
const defaultDarkColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.dark; // 1. Get the data about the `mode`, `colorScheme`, and setter functions.
|
|
97
|
+
|
|
99
98
|
const {
|
|
100
99
|
mode,
|
|
101
100
|
setMode,
|
|
@@ -114,36 +113,53 @@ function createCssVarsProvider(options) {
|
|
|
114
113
|
storageWindow
|
|
115
114
|
});
|
|
116
115
|
|
|
117
|
-
const
|
|
116
|
+
const calculatedMode = (() => {
|
|
117
|
+
if (!mode) {
|
|
118
|
+
// This scope occurs on the server
|
|
119
|
+
if (defaultMode === 'system') {
|
|
120
|
+
return designSystemMode;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return defaultMode;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return mode;
|
|
127
|
+
})();
|
|
128
|
+
|
|
129
|
+
const calculatedColorScheme = (() => {
|
|
118
130
|
if (!colorScheme) {
|
|
119
131
|
// This scope occurs on the server
|
|
120
|
-
if (
|
|
132
|
+
if (calculatedMode === 'dark') {
|
|
121
133
|
return defaultDarkColorScheme;
|
|
122
|
-
} // use light color scheme, if default mode is 'light' | '
|
|
134
|
+
} // use light color scheme, if default mode is 'light' | 'system'
|
|
123
135
|
|
|
124
136
|
|
|
125
137
|
return defaultLightColorScheme;
|
|
126
138
|
}
|
|
127
139
|
|
|
128
140
|
return colorScheme;
|
|
129
|
-
})();
|
|
141
|
+
})(); // 2. Create CSS variables and store them in objects (to be generated in stylesheets in the final step)
|
|
142
|
+
|
|
130
143
|
|
|
131
|
-
let theme = restThemeProp;
|
|
132
144
|
const {
|
|
133
145
|
css: rootCss,
|
|
134
146
|
vars: rootVars,
|
|
135
147
|
parsedTheme
|
|
136
|
-
} = (0, _cssVarsParser.default)(
|
|
148
|
+
} = (0, _cssVarsParser.default)(restThemeProp, {
|
|
137
149
|
prefix: cssVarPrefix,
|
|
138
150
|
shouldSkipGeneratingVar
|
|
139
|
-
});
|
|
140
|
-
|
|
151
|
+
}); // 3. Start composing the theme object
|
|
152
|
+
|
|
153
|
+
let theme = (0, _extends2.default)({}, parsedTheme, {
|
|
141
154
|
components,
|
|
142
155
|
colorSchemes,
|
|
143
156
|
cssVarPrefix,
|
|
144
157
|
vars: rootVars,
|
|
145
158
|
getColorSchemeSelector: targetColorScheme => `[${attribute}="${targetColorScheme}"] &`
|
|
146
|
-
});
|
|
159
|
+
}); // 4. Create color CSS variables and store them in objects (to be generated in stylesheets in the final step)
|
|
160
|
+
// The default color scheme stylesheet is constructed to have the least CSS specificity.
|
|
161
|
+
// The other color schemes uses selector, default as data attribute, to increase the CSS specificity so that they can override the default color scheme stylesheet.
|
|
162
|
+
|
|
147
163
|
const defaultColorSchemeStyleSheet = {};
|
|
148
164
|
const otherColorSchemesStyleSheet = {};
|
|
149
165
|
Object.entries(colorSchemes).forEach(([key, scheme]) => {
|
|
@@ -157,13 +173,12 @@ function createCssVarsProvider(options) {
|
|
|
157
173
|
});
|
|
158
174
|
theme.vars = (0, _utils.deepmerge)(theme.vars, vars);
|
|
159
175
|
|
|
160
|
-
if (key ===
|
|
176
|
+
if (key === calculatedColorScheme) {
|
|
177
|
+
// 4.1 Merge the selected color scheme to the theme
|
|
161
178
|
theme = (0, _extends2.default)({}, theme, parsedScheme);
|
|
162
179
|
|
|
163
180
|
if (theme.palette) {
|
|
164
|
-
|
|
165
|
-
theme.palette.mode = mode;
|
|
166
|
-
theme.palette.colorScheme = resolvedColorScheme;
|
|
181
|
+
theme.palette.colorScheme = key;
|
|
167
182
|
}
|
|
168
183
|
}
|
|
169
184
|
|
|
@@ -193,35 +208,21 @@ function createCssVarsProvider(options) {
|
|
|
193
208
|
} else {
|
|
194
209
|
otherColorSchemesStyleSheet[`${colorSchemeSelector === ':root' ? '' : colorSchemeSelector}[${attribute}="${key}"]`] = css;
|
|
195
210
|
}
|
|
196
|
-
});
|
|
211
|
+
}); // 5. Declaring effects
|
|
212
|
+
// 5.1 Updates the selector value to use the current color scheme which tells CSS to use the proper stylesheet.
|
|
213
|
+
|
|
197
214
|
React.useEffect(() => {
|
|
198
215
|
if (colorScheme && colorSchemeNode) {
|
|
199
216
|
// attaches attribute to <html> because the css variables are attached to :root (html)
|
|
200
217
|
colorSchemeNode.setAttribute(attribute, colorScheme);
|
|
201
218
|
}
|
|
202
|
-
}, [colorScheme, attribute, colorSchemeNode]);
|
|
203
|
-
|
|
204
|
-
if (!mode || !enableColorScheme || !colorSchemeNode) {
|
|
205
|
-
return undefined;
|
|
206
|
-
}
|
|
219
|
+
}, [colorScheme, attribute, colorSchemeNode]); // 5.2 Remove the CSS transition when color scheme changes to create instant experience.
|
|
220
|
+
// credit: https://github.com/pacocoursey/next-themes/blob/b5c2bad50de2d61ad7b52a9c5cdc801a78507d7a/index.tsx#L313
|
|
207
221
|
|
|
208
|
-
const priorColorScheme = colorSchemeNode.style.getPropertyValue('color-scheme'); // `color-scheme` tells browser to render built-in elements according to its value: `light` or `dark`
|
|
209
|
-
|
|
210
|
-
if (mode === 'system') {
|
|
211
|
-
colorSchemeNode.style.setProperty('color-scheme', systemMode);
|
|
212
|
-
} else {
|
|
213
|
-
colorSchemeNode.style.setProperty('color-scheme', mode);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
return () => {
|
|
217
|
-
colorSchemeNode.style.setProperty('color-scheme', priorColorScheme);
|
|
218
|
-
};
|
|
219
|
-
}, [mode, systemMode, enableColorScheme, colorSchemeNode]);
|
|
220
222
|
React.useEffect(() => {
|
|
221
223
|
let timer;
|
|
222
224
|
|
|
223
225
|
if (disableTransitionOnChange && hasMounted.current && documentNode) {
|
|
224
|
-
// credit: https://github.com/pacocoursey/next-themes/blob/b5c2bad50de2d61ad7b52a9c5cdc801a78507d7a/index.tsx#L313
|
|
225
226
|
const css = documentNode.createElement('style');
|
|
226
227
|
css.appendChild(documentNode.createTextNode(DISABLE_CSS_TRANSITION));
|
|
227
228
|
documentNode.head.appendChild(css); // Force browser repaint
|
|
@@ -246,6 +247,7 @@ function createCssVarsProvider(options) {
|
|
|
246
247
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ColorSchemeContext.Provider, {
|
|
247
248
|
value: {
|
|
248
249
|
mode,
|
|
250
|
+
systemMode,
|
|
249
251
|
setMode,
|
|
250
252
|
lightColorScheme,
|
|
251
253
|
darkColorScheme,
|
|
@@ -314,11 +316,6 @@ function createCssVarsProvider(options) {
|
|
|
314
316
|
*/
|
|
315
317
|
documentNode: _propTypes.default.any,
|
|
316
318
|
|
|
317
|
-
/**
|
|
318
|
-
* Indicate to the browser which color scheme is used (light or dark) for rendering built-in UI
|
|
319
|
-
*/
|
|
320
|
-
enableColorScheme: _propTypes.default.bool,
|
|
321
|
-
|
|
322
319
|
/**
|
|
323
320
|
* The key in the local storage used to store current color scheme.
|
|
324
321
|
*/
|
|
@@ -340,12 +337,16 @@ function createCssVarsProvider(options) {
|
|
|
340
337
|
*/
|
|
341
338
|
theme: _propTypes.default.object
|
|
342
339
|
} : void 0;
|
|
340
|
+
const defaultLightColorScheme = typeof designSystemColorScheme === 'string' ? designSystemColorScheme : designSystemColorScheme.light;
|
|
341
|
+
const defaultDarkColorScheme = typeof designSystemColorScheme === 'string' ? designSystemColorScheme : designSystemColorScheme.dark;
|
|
343
342
|
|
|
344
343
|
const getInitColorSchemeScript = params => (0, _getInitColorSchemeScript.default)((0, _extends2.default)({
|
|
345
344
|
attribute: defaultAttribute,
|
|
346
345
|
colorSchemeStorageKey: defaultColorSchemeStorageKey,
|
|
347
|
-
|
|
348
|
-
|
|
346
|
+
defaultMode: designSystemMode,
|
|
347
|
+
defaultLightColorScheme,
|
|
348
|
+
defaultDarkColorScheme,
|
|
349
|
+
modeStorageKey: defaultModeStorageKey
|
|
349
350
|
}, params));
|
|
350
351
|
|
|
351
352
|
return {
|
package/cssVars/cssVarsParser.js
CHANGED
|
@@ -131,7 +131,7 @@ function cssVarsParser(theme, options) {
|
|
|
131
131
|
const parsedTheme = {};
|
|
132
132
|
walkObjectDeep(theme, (keys, value, arrayKeys) => {
|
|
133
133
|
if (typeof value === 'string' || typeof value === 'number') {
|
|
134
|
-
if (!shouldSkipGeneratingVar ||
|
|
134
|
+
if (!shouldSkipGeneratingVar || !shouldSkipGeneratingVar(keys, value)) {
|
|
135
135
|
// only create css & var if `shouldSkipGeneratingVar` return false
|
|
136
136
|
const cssVar = `--${prefix ? `${prefix}-` : ''}${keys.join('-')}`;
|
|
137
137
|
Object.assign(css, {
|
|
@@ -3,11 +3,6 @@ export declare const DEFAULT_MODE_STORAGE_KEY = "mode";
|
|
|
3
3
|
export declare const DEFAULT_COLOR_SCHEME_STORAGE_KEY = "color-scheme";
|
|
4
4
|
export declare const DEFAULT_ATTRIBUTE = "data-color-scheme";
|
|
5
5
|
export interface GetInitColorSchemeScriptOptions {
|
|
6
|
-
/**
|
|
7
|
-
* Indicate to the browser which color scheme is used (light or dark) for rendering built-in UI
|
|
8
|
-
* @default true
|
|
9
|
-
*/
|
|
10
|
-
enableColorScheme?: boolean;
|
|
11
6
|
/**
|
|
12
7
|
* The mode to be used for the first visit
|
|
13
8
|
* @default 'light'
|
|
@@ -23,7 +23,6 @@ exports.DEFAULT_ATTRIBUTE = DEFAULT_ATTRIBUTE;
|
|
|
23
23
|
|
|
24
24
|
function getInitColorSchemeScript(options) {
|
|
25
25
|
const {
|
|
26
|
-
enableColorScheme = true,
|
|
27
26
|
defaultMode = 'light',
|
|
28
27
|
defaultLightColorScheme = 'light',
|
|
29
28
|
defaultDarkColorScheme = 'dark',
|
|
@@ -59,9 +58,6 @@ function getInitColorSchemeScript(options) {
|
|
|
59
58
|
if (colorScheme) {
|
|
60
59
|
${colorSchemeNode}.setAttribute('${attribute}', colorScheme);
|
|
61
60
|
}
|
|
62
|
-
if (${enableColorScheme} && !!cssColorScheme) {
|
|
63
|
-
${colorSchemeNode}.style.setProperty('color-scheme', cssColorScheme);
|
|
64
|
-
}
|
|
65
61
|
} catch (e) {} })();`
|
|
66
62
|
}
|
|
67
63
|
});
|
|
@@ -10,7 +10,7 @@ import useThemePropsSystem from '../useThemeProps';
|
|
|
10
10
|
import useTheme from '../useTheme';
|
|
11
11
|
import { extendSxProp } from '../styleFunctionSx';
|
|
12
12
|
import createTheme from '../createTheme';
|
|
13
|
-
import { generateGridStyles, generateGridSizeStyles, generateGridColumnsStyles, generateGridColumnSpacingStyles, generateGridRowSpacingStyles, generateGridDirectionStyles, generateGridOffsetStyles, generateSizeClassNames, generateSpacingClassNames } from './gridGenerator';
|
|
13
|
+
import { generateGridStyles, generateGridSizeStyles, generateGridColumnsStyles, generateGridColumnSpacingStyles, generateGridRowSpacingStyles, generateGridDirectionStyles, generateGridOffsetStyles, generateSizeClassNames, generateSpacingClassNames, generateDirectionClasses } from './gridGenerator';
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
const defaultTheme = createTheme(); // widening Theme to any so that the consumer can own the theme structure.
|
|
16
16
|
|
|
@@ -47,7 +47,7 @@ export default function createGrid(options = {}) {
|
|
|
47
47
|
gridSize
|
|
48
48
|
} = ownerState;
|
|
49
49
|
const slots = {
|
|
50
|
-
root: ['root', container && 'container',
|
|
50
|
+
root: ['root', container && 'container', wrap !== 'wrap' && `wrap-xs-${String(wrap)}`, ...generateDirectionClasses(direction), ...generateSizeClassNames(gridSize), ...(container ? generateSpacingClassNames(spacing, theme.breakpoints.keys[0]) : [])]
|
|
51
51
|
};
|
|
52
52
|
return composeClasses(slots, slot => generateUtilityClass(componentName, slot), {});
|
|
53
53
|
};
|
|
@@ -233,4 +233,15 @@ export const generateSpacingClassNames = (spacing, smallestBreakpoint = 'xs') =>
|
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
return [];
|
|
236
|
+
};
|
|
237
|
+
export const generateDirectionClasses = direction => {
|
|
238
|
+
if (direction === undefined) {
|
|
239
|
+
return [];
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (typeof direction === 'object') {
|
|
243
|
+
return Object.entries(direction).map(([key, value]) => `direction-${key}-${value}`);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return [`direction-xs-${String(direction)}`];
|
|
236
247
|
};
|