@mui/system 5.8.1 → 5.8.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,214 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 5.8.4
4
+
5
+ <!-- generated comparing v5.8.3..master -->
6
+
7
+ _Jun 14, 2022_
8
+
9
+ A big thanks to the 24 contributors who made this release possible. Here are some highlights ✨:
10
+
11
+ - 🚀 Added support for custom breakpoints in the `Grid` component by @boutahlilsoufiane
12
+ - 📚 Added guide on how to use Material UI with Shadow DOM by @cherniavskii
13
+ - many other 🐛 bug fixes and 📚 documentation improvements
14
+
15
+ ### `@mui/material@5.8.4`
16
+
17
+ - &#8203;<!-- 36 -->[Button] Add missing classes in `ButtonClasses` type (#33040) @ZeeshanTamboli
18
+ - &#8203;<!-- 20 -->[Grid] Fix prop-type key regression (#33123) @oliviertassinari
19
+ - &#8203;<!-- 19 -->[Grid] Support custom breakpoints (#31998) @boutahlilsoufiane
20
+ - &#8203;<!-- 18 -->[Grow] Limit CSS transition bug workaround to Safari 15.4 only (#32996) @igordanchenko
21
+ - &#8203;<!-- 17 -->[Hidden] Remove dependency on hoist-non-react-statics (#33015) @oliviertassinari
22
+ - &#8203;<!-- 12 -->[Link] Add support for CSS variables (#33036) @winderica
23
+ - &#8203;<!-- 07 -->[Popover] Export `getOffsetTop` & `getOffsetLeft` from Popover's index and add typings (#32959) @rart
24
+ - &#8203;<!-- 06 -->[Slider] Fix SliderValueLabelProps type (#32895) @oliviertassinari
25
+ - &#8203;<!-- 05 -->[Snackbar] Remove `RTL` direction specific logic (#32808) @aaarichter
26
+ - &#8203;<!-- 04 -->[StepIcon] Fix text centering when changing browser font size (#32706) @alansouzati
27
+ - &#8203;<!-- 02 -->[Tabs] Scroll by width of the first visible tab if only one tab is partially visible (#32778) @frankkluijtmans
28
+
29
+ ### `@mui/system@5.8.4`
30
+
31
+ - &#8203;<!-- 38 -->[Stack, system] Apply correct responsive styles if any custom breakpoints are provided (#32913) @ZeeshanTamboli
32
+ - &#8203;<!-- 03 -->[system] Fix missing typings for ColorFormat (#32417) @l-zoy
33
+
34
+ ### `@mui/codemod@5.8.4`
35
+
36
+ - &#8203;<!-- 35 -->[codemod] Add support for `@mui/styles/makeStyles` imports (#32962) @joshkel
37
+
38
+ ### `@mui/lab@5.0.0-alpha.86`
39
+
40
+ - &#8203;<!-- 08 -->[pickers] Fix broken ref forwarding (#33107) @oliviertassinari
41
+ - &#8203;<!-- 13 -->[lab] Fix React's `forwardRef` warning when importing from the index (#33134) @mnajdova
42
+
43
+ ### `@mui/base@5.0.0-alpha.85`
44
+
45
+ - &#8203;<!-- 11 -->[MenuUnstyled] Accept callbacks in componentsProps (#32997) @michaldudak
46
+ - &#8203;<!-- 10 -->[ModalUnstyled] Fix errors from the W3C validator about incorrect aria-hidden attribute on some elements (#30920) @mkrtchian
47
+ - &#8203;<!-- 09 -->[ModalUnstyled] Fix behavior of not respecting props ariaHidden value (#32055) @tech-meppem
48
+
49
+ ### `@mui/joy@5.0.0-alpha.32`
50
+
51
+ - &#8203;<!-- 16 -->[Joy] Miscellaneous card fixes (#33129) @siriwatknp
52
+ - &#8203;<!-- 15 -->[Joy] Miscellaneous fixes (#33073) @siriwatknp
53
+ - &#8203;<!-- 14 -->[Joy] Add typography and link docs (#33047) @siriwatknp
54
+
55
+ ### Docs
56
+
57
+ - &#8203;<!-- 40 -->[Contributing.md] Local install instructions (#32975) @Moizsohail
58
+ - &#8203;<!-- 32 -->[docs] Add responsive AppBar with drawer (#32769) @dvlprAlamin
59
+ - &#8203;<!-- 31 -->[docs] Move codesandbox to MUI org (#33122) @oliviertassinari
60
+ - &#8203;<!-- 30 -->[docs] Add Shadow DOM guide (#33007) @cherniavskii
61
+ - &#8203;<!-- 29 -->[docs] Fix typo in Material UI overview page (#33087) @oliviertassinari
62
+ - &#8203;<!-- 28 -->[docs] Miscellaneous fixes in `MUI Base` docs (#33091) @ZeeshanTamboli
63
+ - &#8203;<!-- 27 -->[docs] Fix GitHub capitalization (#33071) @oliviertassinari
64
+ - &#8203;<!-- 26 -->[docs] Fix a typo in `InputUnstyled` docs (#33077) @ZeeshanTamboli
65
+ - &#8203;<!-- 25 -->[docs] Add notification for Joy blog post (#33059) @siriwatknp
66
+ - &#8203;<!-- 24 -->[docs] Improve aspect ratio docs and integration (#33065) @siriwatknp
67
+ - &#8203;<!-- 34 -->[docs] Update code block copy label (#33128) @siriwatknp
68
+ - &#8203;<!-- 23 -->[docs] Fix typo in Autocomplete CSS API (#32838) @KeaghanKennedy
69
+ - &#8203;<!-- 22 -->[docs] Improvements for Radio Group Rating Docs (#32843) @Kai-W
70
+ - &#8203;<!-- 21 -->[docs] Enable Joy pages (#33064) @siriwatknp
71
+ - &#8203;<!-- 02 -->[website] Add Joy UI to the pricing page (#33099) @danilo-leal
72
+ - &#8203;<!-- 01 -->[website] Clarify the pricing a bit (#33069) @oliviertassinari
73
+
74
+ ### Core
75
+
76
+ - &#8203;<!-- 39 -->yarn proptypes @oliviertassinari
77
+ - &#8203;<!-- 34 -->[core] Update dependencies to fix security vulnerabilities (#33095) @michaldudak
78
+ - &#8203;<!-- 33 -->[core] Import new line convention (#33068) @oliviertassinari
79
+ - &#8203;<!-- 37 -->[core] Make repository configurable in changelog script (#33130) @Janpot
80
+
81
+ All contributors of this release in alphabetical order: @aaarichter, @alansouzati, @boutahlilsoufiane, @cherniavskii, @danilo-leal, @dvlprAlamin, @frankkluijtmans, @igordanchenko, @Janpot, @joshkel, @Kai-W, @KeaghanKennedy, @l-zoy, @michaldudak, @mkrtchian, @mnajdova, @Moizsohail, @oliviertassinari, @pushys, @rart, @siriwatknp, @tech-meppem, @winderica, @ZeeshanTamboli
82
+
83
+ ## 5.8.3
84
+
85
+ <!-- generated comparing v5.8.2..master -->
86
+
87
+ _Jun 7, 2022_
88
+
89
+ A big thanks to the 15 contributors who made this release possible.
90
+ This release is mostly about 🐛 bug fixes and 📚 documentation improvements.
91
+
92
+ ### `@mui/material@5.8.3`
93
+
94
+ - [Alert] Constrain message width and allow overflow (#32747) @Janpot
95
+ - [Checkbox] Add support for CSS variables (#32579) @haneenmahd
96
+ - [Slider] Fix positioning of tooltips on vertical slider (#32919) @abhinav-22-tech
97
+
98
+ ### `@mui/system@5.8.3`
99
+
100
+ - [system] Configurable attributes for libraries (#32971) @siriwatknp
101
+
102
+ ### `@mui/codemod@5.8.3`
103
+
104
+ - [codemod] Fix infinite loop in jss-to-tss-react and add TODO (#33048) @ryancogswell
105
+
106
+ ### `@mui/lab@5.0.0-alpha.85`
107
+
108
+ - [pickers] Add deprecations when importing pickers from the lab (#32950) @flaviendelangle
109
+
110
+ ### `@mui/joy@5.0.0-alpha.31`
111
+
112
+ - [Joy] Add `Slider` component and demos (#32694) @hbjORbj
113
+ - [Joy] Add articles about customization approaches (#32887) @siriwatknp
114
+ - [Joy] Add automatic adjustment page to core features (#32980) @siriwatknp
115
+ - [Joy] Add docs about dark mode (#33002) @siriwatknp
116
+ - [Joy] Add template UIs & first look blog post (#32791) @danilo-leal
117
+
118
+ ### `@mui/base@5.0.0-alpha.84`
119
+
120
+ - [base] Remove @mui/system in tests (#32945) @kevinji
121
+ - [ButtonUnstyled] Accept callbacks in componentsProps (#32991) @michaldudak
122
+ - [SwitchUnstyled] Accept callbacks in componentsProps (#32993) @michaldudak
123
+ - [TablePaginationUnstyled] Define ownerState and slot props' types (#32905) @michaldudak
124
+ - [TabPanelUnstyled] Define ownerState and slot props' types (#32928) @michaldudak
125
+ - [TabsListUnstyled] Define ownerState and slot props' types (#32925) @michaldudak
126
+
127
+ ### Docs
128
+
129
+ - [blog] Fix anchor link scroll (#32994) @oliviertassinari
130
+ - [docs] Add "Migration" section to sidebar and revise v4-v5 content (#32740) @samuelsycamore
131
+ - [docs] Add What doesn't count as a breaking change? (#32850) @oliviertassinari
132
+ - [docs] Fix 301 link @oliviertassinari
133
+ - [docs] Fix icon color in `BadgeUnstyled` docs (#32976) @ZeeshanTamboli
134
+ - [docs] Improve product identifier (#32707) @danilo-leal
135
+ - [docs] Improve UX with back to top (#32896) @oliviertassinari
136
+ - [docs] Polish overview page to Material UI (#32954) @oliviertassinari
137
+ - [docs] Redirect older URLs (#33037) @oliviertassinari
138
+ - [docs] Remove pickers page from the Lab section (#32961) @DanailH
139
+ - [docs] Show product identifier on updated MUI X Introduction pages (#32966) @samuelsycamore
140
+ - [docs] Throw on 301 links (#32939) @oliviertassinari
141
+ - [website] Add Gerda to the about page (#33038) @danilo-leal
142
+ - [website] Polish the pricing page (#32811) @oliviertassinari
143
+ - [website] Remove unnecessary `address` dependency (#32957) @michaldudak
144
+
145
+ ### Core
146
+
147
+ - [core] Improve icon synonyms (#32742) @oliviertassinari
148
+ - [core] Prepare Next.js config for React 18 (#32963) @michaldudak
149
+ - [core] Remove dead logic (#32940) @oliviertassinari
150
+ - [core] Update dependencies to fix security vulnerabilities (#32947) @michaldudak
151
+ - Add security link to README for Tidelift @mbrookes
152
+
153
+ All contributors of this release in alphabetical order: @abhinav-22-tech, @DanailH, @danilo-leal, @flaviendelangle, @haneenmahd, @hbjORbj, @Janpot, @kevinji, @mbrookes, @michaldudak, @oliviertassinari, @ryancogswell, @samuelsycamore, @siriwatknp, @ZeeshanTamboli
154
+
155
+ ## 5.8.2
156
+
157
+ <!-- generated comparing v5.8.1..master -->
158
+
159
+ _May 30, 2022_
160
+
161
+ A big thanks to the 8 contributors who made this release possible. Here are some highlights ✨:
162
+
163
+ - 🐛 bug fixes and 📚 documentation improvements.
164
+
165
+ ### `@mui/system@5.8.2`
166
+
167
+ - &#8203;<!-- 04 -->[system] Add `getColorSchemeSelector` util (#32868) @siriwatknp
168
+
169
+ ### `@mui/lab@5.0.0-alpha.84`
170
+
171
+ - &#8203;<!-- 07 -->[Masonry] Place items to the left when there are less objects than specified in `column` prop (#32873) @hbjORbj
172
+
173
+ ### `@mui/base@5.0.0-alpha.83`
174
+
175
+ - &#8203;<!-- 24 -->[BadgeUnstyled] Define ownerState and slot props' types (#32750) @michaldudak
176
+ - &#8203;<!-- 06 -->[SliderUnstyled] Define ownerState and slot props' types (#32739) @michaldudak
177
+ - &#8203;<!-- 05 -->[SwitchUnstyled] Define ownerState and slot props' types (#32573) @michaldudak
178
+ - &#8203;<!-- 03 -->[TabsUnstyled] Define ownerState and slot props' types (#32918) @michaldudak
179
+ - &#8203;<!-- 02 -->[TabUnstyled] Define ownerState and slot props' types (#32915) @michaldudak
180
+
181
+ ### `@mui/joy@5.0.0-alpha.30`
182
+
183
+ - &#8203;<!-- 13 -->[Joy] use `textColor` prop for Typography and Link (#32938) @siriwatknp
184
+ - &#8203;<!-- 12 -->[Joy] Make variants for more flexible (#32931) @siriwatknp
185
+ - &#8203;<!-- 11 -->[Joy] Improve automatic adjustment (#32923) @siriwatknp
186
+ - &#8203;<!-- 10 -->[Joy] Add `Chip` doc (#32819) @hbjORbj
187
+ - &#8203;<!-- 09 -->[Joy] Add `AspectRatio` demos (#32848) @siriwatknp
188
+ - &#8203;<!-- 08 -->[Joy] Fix wrong urls (#32883) @siriwatknp
189
+
190
+ ### Docs
191
+
192
+ - &#8203;<!-- 24 -->[docs] Iterate on the job ad for React engineer in Core (#32900) @mnajdova
193
+ - &#8203;<!-- 23 -->[blog] Fix avatar image resolution (#32890) @oliviertassinari
194
+ - &#8203;<!-- 19 -->[docs] Link the first page of the product (#32943) @oliviertassinari
195
+ - &#8203;<!-- 18 -->[docs] Batch small changes (#32170) @michaldudak
196
+ - &#8203;<!-- 17 -->[docs] Allow function prop to return undefined (#32766) @m4theushw
197
+ - &#8203;<!-- 16 -->[docs] Fix wrong link to Material Icons (#32847) @oliviertassinari
198
+ - &#8203;<!-- 15 -->[docs] Fix ClassNameGenerator content (#32800) @siriwatknp
199
+ - &#8203;<!-- 14 -->[docs] Fix navigation links (#32851) @oliviertassinari
200
+ - &#8203;<!-- 14 -->[docs] Document the `size` prop for InputLabel (#32936) @romelperez
201
+ - &#8203;<!-- 21 -->[docs] Add note about transparent background on the outlined Alert variant (#32810) @aaarichter
202
+ - &#8203;<!-- 01 -->[website] Update the careers's page with the new roles (#32535) @oliviertassinari
203
+
204
+ ### Core
205
+
206
+ - &#8203;<!-- 22 -->[core] Improve the incomplete issues workflow (#32878) @mnajdova
207
+ - &#8203;<!-- 21 -->[core] Add CI check that the PR has label (#32886) @mnajdova
208
+ - &#8203;<!-- 20 -->[core] Avoid leaking @babel/runtime (#32874) @oliviertassinari
209
+
210
+ All contributors of this release in alphabetical order: @aaarichter, @hbjORbj, @m4theushw, @michaldudak, @mnajdova, @oliviertassinari, @romelperez, @siriwatknp
211
+
3
212
  ## 5.8.1
4
213
 
5
214
  <!-- generated comparing v5.8.0..master -->
@@ -991,7 +1200,7 @@ A big thanks to the 16 contributors who made this release possible. Here are som
991
1200
  - [docs] Fix force redirection to a different locale (#30967) @oliviertassinari
992
1201
  - [docs] Add live Tailwind CSS demo (#30966) @oliviertassinari
993
1202
  - [website] Add banner for promoting priority open roles (#31076) @danilo-leal
994
- - [website] Open Full-stack Engineer role for studio (#31038) @newguy-123
1203
+ - [website] Open Full-stack Engineer role for studio (#31038) @prakhargupta1
995
1204
  - [website] Minor security improvements (#31062) @oliviertassinari
996
1205
  - [website] Improve title of open roles (#30963) @DanailH
997
1206
  - [website] Add BIMI avatar (#30444) @oliviertassinari
@@ -1006,7 +1215,7 @@ A big thanks to the 16 contributors who made this release possible. Here are som
1006
1215
  - [test] Test if certain Base members are exported from Material UI (#31067) @michaldudak
1007
1216
  - [core] Remove dead code (#31064) @oliviertassinari
1008
1217
 
1009
- All contributors of this release in alphabetical order: @agauravdev, @alisasanib, @DanailH, @danilo-leal, @huyenltnguyen, @l10nbot, @liradb2000, @mbrookes, @michaldudak, @mnajdova, @newguy-123, @oliviertassinari, @ryohey, @samuelsycamore, @siriwatknp, @sydneyjodon-wk
1218
+ All contributors of this release in alphabetical order: @agauravdev, @alisasanib, @DanailH, @danilo-leal, @huyenltnguyen, @l10nbot, @liradb2000, @mbrookes, @michaldudak, @mnajdova, @prakhargupta1, @oliviertassinari, @ryohey, @samuelsycamore, @siriwatknp, @sydneyjodon-wk
1010
1219
 
1011
1220
  ## 5.4.1
1012
1221
 
@@ -1716,14 +1925,14 @@ This is an early release to fix `export 'useId' (imported as 'React') was not fo
1716
1925
  - &#8203;<!-- 9 -->[core] Fix PR run detection in test_bundle_size_monitor (#29879) @eps1lon
1717
1926
  - &#8203;<!-- 8 -->[core] Move bundle size monitoring to CircleCI (#29876) @eps1lon
1718
1927
  - &#8203;<!-- 7 -->[docs] Add keys to Responsive AppBar demo (#29884) @mbrookes
1719
- - &#8203;<!-- 6 -->[docs] MUI's 2021 Developer survey (#29765) @newguy-123
1928
+ - &#8203;<!-- 6 -->[docs] MUI's 2021 Developer survey (#29765) @prakhargupta1
1720
1929
  - &#8203;<!-- 5 -->[docs] Smoother image loading UX (#29858) @oliviertassinari
1721
1930
  - &#8203;<!-- 4 -->[Select] Fix select display value with React Nodes (#29836) @kegi
1722
1931
  - &#8203;<!-- 3 -->[system] Add `experimental_sx` utility (#29833) @mnajdova
1723
1932
  - &#8203;<!-- 2 -->[test] Ignore "detected multiple renderers" warning for now (#29854) @eps1lon
1724
1933
  - &#8203;<!-- 1 -->[useMediaQuery][utils] Remove usage of React 18 APIs (#29870) @eps1lon
1725
1934
 
1726
- All contributors of this release in alphabetical order: @eps1lon, @karakib2k18, @kegi, @mbrookes, @mnajdova, @newguy-123, @oliviertassinari
1935
+ All contributors of this release in alphabetical order: @eps1lon, @karakib2k18, @kegi, @mbrookes, @mnajdova, @prakhargupta1, @oliviertassinari
1727
1936
 
1728
1937
  ## 5.2.0
1729
1938
 
@@ -1871,7 +2080,7 @@ A big thanks to the 15 contributors who made this release possible. Here are som
1871
2080
  - &#8203;<!-- 33 -->[core] Add `experiments` index page (#29582) @siriwatknp
1872
2081
  - &#8203;<!-- 32 -->[core] Move s3 bucket ownership to mui-org (#29609) @eps1lon
1873
2082
  - &#8203;<!-- 31 -->[core] Improve support request message (#29614) @mnajdova
1874
- - &#8203;<!-- 30 -->[core] Use support request Github Action (#29594) @mnajdova
2083
+ - &#8203;<!-- 30 -->[core] Use support request GitHub Action (#29594) @mnajdova
1875
2084
  - &#8203;<!-- 29 -->[core] Remove unused `getJsxPreview` util (#29586) @ZeeshanTamboli
1876
2085
  - &#8203;<!-- 28 -->[core] Use GitHub issue forms (#28038) @oliviertassinari
1877
2086
  - &#8203;<!-- 26 -->[core] Add playground (#29423) @oliviertassinari
@@ -2541,7 +2750,7 @@ _Sep 1, 2021_
2541
2750
  A big thanks to the 18 contributors who made this release possible. Here are some highlights ✨:
2542
2751
 
2543
2752
  - 🎉 Renamed packages to `@mui/*` as part of rebranding the company, following the strategy of expanding the library scope beyond Material Design. For more details about it, check the [GitHub discussion](https://github.com/mui/material-ui/discussions/27803).
2544
- - 🛠 Added `mui-replace` codemod for migrating `@material-ui/*` to new packages `@mui/*`. Check out this [codemod detail](https://github.com/mui/material-ui/blob/next/packages/mui-codemod/README.md#mui-replace) or head to [migration guide](https://mui.com/material-ui/guides/migration-v4/#preset-safe)
2753
+ - 🛠 Added `mui-replace` codemod for migrating `@material-ui/*` to new packages `@mui/*`. Check out this [codemod detail](https://github.com/mui/material-ui/blob/next/packages/mui-codemod/README.md#mui-replace) or head to [migration guide](https://mui.com/material-ui/migration/migration-v4/#preset-safe)
2545
2754
  - 🧪 Added new `<Mansory>` component to the lab, [check it out](https://mui.com/components/masonry/). It has been crafted by our first intern, @hbjORbj 👏!
2546
2755
 
2547
2756
  ### `@mui/material@5.0.0-rc.0`
@@ -3946,7 +4155,7 @@ A big thanks to the 16 contributors who made this release possible. Here are som
3946
4155
  />
3947
4156
  ```
3948
4157
 
3949
- > Follow [this link](https://mui.com/material-ui/guides/migration-v4/#main-content) for full migration from v4 => v5
4158
+ > Follow [this link](https://mui.com/material-ui/migration/migration-v4/) for full migration from v4 => v5
3950
4159
 
3951
4160
  #### Changes
3952
4161
 
@@ -5926,7 +6135,7 @@ A big thanks to the 24 contributors who made this release possible. Here are som
5926
6135
  - [docs] Fix duplicated styles generated from emotion (#23809) @mnajdova
5927
6136
  - [docs] Fix icon alignment in /components/breadcrumbs (#23818) @eps1lon
5928
6137
  - [docs] Fix production deploy (#23963) @eps1lon
5929
- - [docs] Fix source on Github links (#23821) @praveenkumar-kalidass
6138
+ - [docs] Fix source on GitHub links (#23821) @praveenkumar-kalidass
5930
6139
  - [docs] Fix StickyHeaderTable round borders (#23882) @antoniopacheco
5931
6140
  - [docs] Fix typo in date picker dayjs adapter name (#23935) @andresmrm
5932
6141
  - [docs] Improve system properties page (#23961) @mnajdova
package/breakpoints.js CHANGED
@@ -180,9 +180,11 @@ function resolveBreakpointValues({
180
180
  if (Array.isArray(breakpointValues)) {
181
181
  acc[breakpoint] = breakpointValues[i] != null ? breakpointValues[i] : breakpointValues[previous];
182
182
  previous = i;
183
- } else {
184
- acc[breakpoint] = breakpointValues[breakpoint] != null ? breakpointValues[breakpoint] : breakpointValues[previous] || breakpointValues;
183
+ } else if (typeof breakpointValues === 'object') {
184
+ acc[breakpoint] = breakpointValues[breakpoint] != null ? breakpointValues[breakpoint] : breakpointValues[previous];
185
185
  previous = breakpoint;
186
+ } else {
187
+ acc[breakpoint] = breakpointValues;
186
188
  }
187
189
 
188
190
  return acc;
@@ -1,4 +1,4 @@
1
- export type ColorFormat = 'rgb' | 'rgba' | 'hsl' | 'hsla';
1
+ export type ColorFormat = 'rgb' | 'rgba' | 'hsl' | 'hsla' | 'color';
2
2
  export interface ColorObject {
3
3
  type: ColorFormat;
4
4
  values: [number, number, number] | [number, number, number, number];
@@ -63,7 +63,7 @@ function intToHex(int) {
63
63
  * Returns an object with the type and values of a color.
64
64
  *
65
65
  * Note: Does not support rgb % values.
66
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
66
+ * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
67
67
  * @returns {object} - A MUI color object: {type: string, values: number[]}
68
68
  */
69
69
 
@@ -115,7 +115,7 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
115
115
  /**
116
116
  * Returns a channel created from the input color.
117
117
  *
118
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
118
+ * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
119
119
  * @returns {string} - The channel for the color, that can be used in rgba or hsla colors
120
120
  */
121
121
 
@@ -127,7 +127,7 @@ const colorChannel = color => {
127
127
  /**
128
128
  * Converts a color object with type and values to a string.
129
129
  * @param {object} color - Decomposed color
130
- * @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla'
130
+ * @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla', 'color'
131
131
  * @param {array} color.values - [n,n,n] or [n,n,n,n]
132
132
  * @returns {string} A CSS color string
133
133
  */
package/createStyled.js CHANGED
@@ -136,7 +136,7 @@ function createStyled(input = {}) {
136
136
 
137
137
  const muiStyledResolver = (styleArg, ...expressions) => {
138
138
  const expressionsWithDefaultTheme = expressions ? expressions.map(stylesArg => {
139
- // On the server emotion doesn't use React.forwardRef for creating components, so the created
139
+ // On the server Emotion doesn't use React.forwardRef for creating components, so the created
140
140
  // component stays as a function. This condition makes sure that we do not interpolate functions
141
141
  // which are basically components used as a selectors.
142
142
  // eslint-disable-next-line no-underscore-dangle
@@ -194,7 +194,7 @@ function createStyled(input = {}) {
194
194
 
195
195
  transformedStyleArg = [...styleArg, ...placeholders];
196
196
  transformedStyleArg.raw = [...styleArg.raw, ...placeholders];
197
- } else if (typeof styleArg === 'function' && // On the server emotion doesn't use React.forwardRef for creating components, so the created
197
+ } else if (typeof styleArg === 'function' && // On the server Emotion doesn't use React.forwardRef for creating components, so the created
198
198
  // component stays as a function. This condition makes sure that we do not interpolate functions
199
199
  // which are basically components used as a selectors.
200
200
  // eslint-disable-next-line no-underscore-dangle
@@ -8,6 +8,21 @@ export interface ColorSchemeContextValue<SupportedColorScheme extends string>
8
8
  }
9
9
 
10
10
  export interface CssVarsProviderConfig<ColorScheme extends string> {
11
+ /**
12
+ * DOM attribute for applying color scheme
13
+ * @default 'data-color-scheme'
14
+ */
15
+ attribute?: string;
16
+ /**
17
+ * localStorage key used to store application `mode`
18
+ * @default 'mode'
19
+ */
20
+ modeStorageKey?: string;
21
+ /**
22
+ * localStorage key used to store `colorScheme`
23
+ * @default 'color-scheme'
24
+ */
25
+ colorSchemeStorageKey?: string;
11
26
  /**
12
27
  * Design system default color scheme.
13
28
  * - provides string if the design system has one default color scheme (either light or dark)
@@ -41,16 +56,6 @@ export interface CreateCssVarsProviderResult<ColorScheme extends string, ThemeIn
41
56
  props: React.PropsWithChildren<
42
57
  Partial<CssVarsProviderConfig<ColorScheme>> & {
43
58
  theme?: ThemeInput;
44
- /**
45
- * localStorage key used to store application `mode`
46
- * @default 'mui-mode'
47
- */
48
- modeStorageKey?: string;
49
- /**
50
- * DOM attribute for applying color scheme
51
- * @default 'data-mui-color-scheme'
52
- */
53
- attribute?: string;
54
59
  /**
55
60
  * The document used to perform `disableTransitionOnChange` feature
56
61
  * @default document
@@ -66,11 +71,6 @@ export interface CreateCssVarsProviderResult<ColorScheme extends string, ThemeIn
66
71
  * @default ':root'
67
72
  */
68
73
  colorSchemeSelector?: string;
69
- /**
70
- * localStorage key used to store `colorScheme`
71
- * @default 'mui-color-scheme'
72
- */
73
- colorSchemeStorageKey?: string;
74
74
  /**
75
75
  * The window that attaches the 'storage' event listener
76
76
  * @default window
@@ -44,6 +44,9 @@ exports.DISABLE_CSS_TRANSITION = DISABLE_CSS_TRANSITION;
44
44
  function createCssVarsProvider(options) {
45
45
  const {
46
46
  theme: defaultTheme = {},
47
+ attribute: defaultAttribute = _getInitColorSchemeScript.DEFAULT_ATTRIBUTE,
48
+ modeStorageKey: defaultModeStorageKey = _getInitColorSchemeScript.DEFAULT_MODE_STORAGE_KEY,
49
+ colorSchemeStorageKey: defaultColorSchemeStorageKey = _getInitColorSchemeScript.DEFAULT_COLOR_SCHEME_STORAGE_KEY,
47
50
  defaultMode: desisgnSystemMode = 'light',
48
51
  defaultColorScheme: designSystemColorScheme,
49
52
  disableTransitionOnChange: designSystemTransitionOnChange = false,
@@ -73,9 +76,9 @@ function createCssVarsProvider(options) {
73
76
  children,
74
77
  theme: themeProp = defaultTheme,
75
78
  prefix = designSystemPrefix,
76
- modeStorageKey = _getInitColorSchemeScript.DEFAULT_MODE_STORAGE_KEY,
77
- colorSchemeStorageKey = _getInitColorSchemeScript.DEFAULT_COLOR_SCHEME_STORAGE_KEY,
78
- attribute = _getInitColorSchemeScript.DEFAULT_ATTRIBUTE,
79
+ modeStorageKey = defaultModeStorageKey,
80
+ colorSchemeStorageKey = defaultColorSchemeStorageKey,
81
+ attribute = defaultAttribute,
79
82
  defaultMode = desisgnSystemMode,
80
83
  defaultColorScheme = designSystemColorScheme,
81
84
  disableTransitionOnChange = designSystemTransitionOnChange,
@@ -141,7 +144,8 @@ function createCssVarsProvider(options) {
141
144
  colorSchemes,
142
145
  prefix,
143
146
  vars: rootVars,
144
- getCssVar: (0, _createGetCssVar.default)(prefix)
147
+ getCssVar: (0, _createGetCssVar.default)(prefix),
148
+ getColorSchemeSelector: targetColorScheme => `[${attribute}="${targetColorScheme}"] &`
145
149
  });
146
150
  const defaultColorSchemeStyleSheet = {};
147
151
  const otherColorSchemesStyleSheet = {};
@@ -331,9 +335,16 @@ function createCssVarsProvider(options) {
331
335
  */
332
336
  theme: _propTypes.default.object
333
337
  } : void 0;
338
+
339
+ const getInitColorSchemeScript = params => (0, _getInitColorSchemeScript.default)((0, _extends2.default)({
340
+ attribute: defaultAttribute,
341
+ colorSchemeStorageKey: defaultColorSchemeStorageKey,
342
+ modeStorageKey: defaultModeStorageKey
343
+ }, params));
344
+
334
345
  return {
335
346
  CssVarsProvider,
336
347
  useColorScheme,
337
- getInitColorSchemeScript: _getInitColorSchemeScript.default
348
+ getInitColorSchemeScript
338
349
  };
339
350
  }
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- export declare const DEFAULT_MODE_STORAGE_KEY = "mui-mode";
3
- export declare const DEFAULT_COLOR_SCHEME_STORAGE_KEY = "mui-color-scheme";
4
- export declare const DEFAULT_ATTRIBUTE = "data-mui-color-scheme";
2
+ export declare const DEFAULT_MODE_STORAGE_KEY = "mode";
3
+ export declare const DEFAULT_COLOR_SCHEME_STORAGE_KEY = "color-scheme";
4
+ export declare const DEFAULT_ATTRIBUTE = "data-color-scheme";
5
5
  export interface GetInitColorSchemeScriptOptions {
6
6
  /**
7
7
  * If `true`, the initial color scheme is set to the user's prefers-color-scheme mode
@@ -23,17 +23,17 @@ export interface GetInitColorSchemeScriptOptions {
23
23
  colorSchemeNode?: string;
24
24
  /**
25
25
  * localStorage key used to store `mode`
26
- * @default 'mui-mode'
26
+ * @default 'mode'
27
27
  */
28
28
  modeStorageKey?: string;
29
29
  /**
30
30
  * localStorage key used to store `colorScheme`
31
- * @default 'mui-color-scheme'
31
+ * @default 'color-scheme'
32
32
  */
33
33
  colorSchemeStorageKey?: string;
34
34
  /**
35
35
  * DOM attribute for applying color scheme
36
- * @default 'data-mui-color-scheme'
36
+ * @default 'data-color-scheme'
37
37
  */
38
38
  attribute?: string;
39
39
  }
@@ -14,11 +14,11 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
14
14
 
15
15
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
16
 
17
- const DEFAULT_MODE_STORAGE_KEY = 'mui-mode';
17
+ const DEFAULT_MODE_STORAGE_KEY = 'mode';
18
18
  exports.DEFAULT_MODE_STORAGE_KEY = DEFAULT_MODE_STORAGE_KEY;
19
- const DEFAULT_COLOR_SCHEME_STORAGE_KEY = 'mui-color-scheme';
19
+ const DEFAULT_COLOR_SCHEME_STORAGE_KEY = 'color-scheme';
20
20
  exports.DEFAULT_COLOR_SCHEME_STORAGE_KEY = DEFAULT_COLOR_SCHEME_STORAGE_KEY;
21
- const DEFAULT_ATTRIBUTE = 'data-mui-color-scheme';
21
+ const DEFAULT_ATTRIBUTE = 'data-color-scheme';
22
22
  exports.DEFAULT_ATTRIBUTE = DEFAULT_ATTRIBUTE;
23
23
 
24
24
  function getInitColorSchemeScript(options) {
@@ -154,9 +154,11 @@ export function resolveBreakpointValues({
154
154
  if (Array.isArray(breakpointValues)) {
155
155
  acc[breakpoint] = breakpointValues[i] != null ? breakpointValues[i] : breakpointValues[previous];
156
156
  previous = i;
157
- } else {
158
- acc[breakpoint] = breakpointValues[breakpoint] != null ? breakpointValues[breakpoint] : breakpointValues[previous] || breakpointValues;
157
+ } else if (typeof breakpointValues === 'object') {
158
+ acc[breakpoint] = breakpointValues[breakpoint] != null ? breakpointValues[breakpoint] : breakpointValues[previous];
159
159
  previous = breakpoint;
160
+ } else {
161
+ acc[breakpoint] = breakpointValues;
160
162
  }
161
163
 
162
164
  return acc;
@@ -45,7 +45,7 @@ function intToHex(int) {
45
45
  * Returns an object with the type and values of a color.
46
46
  *
47
47
  * Note: Does not support rgb % values.
48
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
48
+ * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
49
49
  * @returns {object} - A MUI color object: {type: string, values: number[]}
50
50
  */
51
51
 
@@ -97,7 +97,7 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
97
97
  /**
98
98
  * Returns a channel created from the input color.
99
99
  *
100
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
100
+ * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
101
101
  * @returns {string} - The channel for the color, that can be used in rgba or hsla colors
102
102
  */
103
103
 
@@ -108,7 +108,7 @@ export const colorChannel = color => {
108
108
  /**
109
109
  * Converts a color object with type and values to a string.
110
110
  * @param {object} color - Decomposed color
111
- * @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla'
111
+ * @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla', 'color'
112
112
  * @param {array} color.values - [n,n,n] or [n,n,n,n]
113
113
  * @returns {string} A CSS color string
114
114
  */
@@ -117,7 +117,7 @@ export default function createStyled(input = {}) {
117
117
 
118
118
  const muiStyledResolver = (styleArg, ...expressions) => {
119
119
  const expressionsWithDefaultTheme = expressions ? expressions.map(stylesArg => {
120
- // On the server emotion doesn't use React.forwardRef for creating components, so the created
120
+ // On the server Emotion doesn't use React.forwardRef for creating components, so the created
121
121
  // component stays as a function. This condition makes sure that we do not interpolate functions
122
122
  // which are basically components used as a selectors.
123
123
  // eslint-disable-next-line no-underscore-dangle
@@ -176,7 +176,7 @@ export default function createStyled(input = {}) {
176
176
 
177
177
  transformedStyleArg = [...styleArg, ...placeholders];
178
178
  transformedStyleArg.raw = [...styleArg.raw, ...placeholders];
179
- } else if (typeof styleArg === 'function' && // On the server emotion doesn't use React.forwardRef for creating components, so the created
179
+ } else if (typeof styleArg === 'function' && // On the server Emotion doesn't use React.forwardRef for creating components, so the created
180
180
  // component stays as a function. This condition makes sure that we do not interpolate functions
181
181
  // which are basically components used as a selectors.
182
182
  // eslint-disable-next-line no-underscore-dangle
@@ -8,7 +8,7 @@ import { deepmerge, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui
8
8
  import { GlobalStyles } from '@mui/styled-engine';
9
9
  import cssVarsParser from './cssVarsParser';
10
10
  import ThemeProvider from '../ThemeProvider';
11
- import getInitColorSchemeScript, { DEFAULT_ATTRIBUTE, DEFAULT_COLOR_SCHEME_STORAGE_KEY, DEFAULT_MODE_STORAGE_KEY } from './getInitColorSchemeScript';
11
+ import systemGetInitColorSchemeScript, { DEFAULT_ATTRIBUTE, DEFAULT_COLOR_SCHEME_STORAGE_KEY, DEFAULT_MODE_STORAGE_KEY } from './getInitColorSchemeScript';
12
12
  import useCurrentColorScheme from './useCurrentColorScheme';
13
13
  import createGetCssVar from './createGetCssVar';
14
14
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -17,6 +17,9 @@ export const DISABLE_CSS_TRANSITION = '*{-webkit-transition:none!important;-moz-
17
17
  export default function createCssVarsProvider(options) {
18
18
  const {
19
19
  theme: defaultTheme = {},
20
+ attribute: defaultAttribute = DEFAULT_ATTRIBUTE,
21
+ modeStorageKey: defaultModeStorageKey = DEFAULT_MODE_STORAGE_KEY,
22
+ colorSchemeStorageKey: defaultColorSchemeStorageKey = DEFAULT_COLOR_SCHEME_STORAGE_KEY,
20
23
  defaultMode: desisgnSystemMode = 'light',
21
24
  defaultColorScheme: designSystemColorScheme,
22
25
  disableTransitionOnChange: designSystemTransitionOnChange = false,
@@ -46,9 +49,9 @@ export default function createCssVarsProvider(options) {
46
49
  children,
47
50
  theme: themeProp = defaultTheme,
48
51
  prefix = designSystemPrefix,
49
- modeStorageKey = DEFAULT_MODE_STORAGE_KEY,
50
- colorSchemeStorageKey = DEFAULT_COLOR_SCHEME_STORAGE_KEY,
51
- attribute = DEFAULT_ATTRIBUTE,
52
+ modeStorageKey = defaultModeStorageKey,
53
+ colorSchemeStorageKey = defaultColorSchemeStorageKey,
54
+ attribute = defaultAttribute,
52
55
  defaultMode = desisgnSystemMode,
53
56
  defaultColorScheme = designSystemColorScheme,
54
57
  disableTransitionOnChange = designSystemTransitionOnChange,
@@ -116,7 +119,8 @@ export default function createCssVarsProvider(options) {
116
119
  colorSchemes,
117
120
  prefix,
118
121
  vars: rootVars,
119
- getCssVar: createGetCssVar(prefix)
122
+ getCssVar: createGetCssVar(prefix),
123
+ getColorSchemeSelector: targetColorScheme => `[${attribute}="${targetColorScheme}"] &`
120
124
  });
121
125
  const defaultColorSchemeStyleSheet = {};
122
126
  const otherColorSchemesStyleSheet = {};
@@ -306,6 +310,13 @@ export default function createCssVarsProvider(options) {
306
310
  */
307
311
  theme: PropTypes.object
308
312
  } : void 0;
313
+
314
+ const getInitColorSchemeScript = params => systemGetInitColorSchemeScript(_extends({
315
+ attribute: defaultAttribute,
316
+ colorSchemeStorageKey: defaultColorSchemeStorageKey,
317
+ modeStorageKey: defaultModeStorageKey
318
+ }, params));
319
+
309
320
  return {
310
321
  CssVarsProvider,
311
322
  useColorScheme,
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- export const DEFAULT_MODE_STORAGE_KEY = 'mui-mode';
4
- export const DEFAULT_COLOR_SCHEME_STORAGE_KEY = 'mui-color-scheme';
5
- export const DEFAULT_ATTRIBUTE = 'data-mui-color-scheme';
3
+ export const DEFAULT_MODE_STORAGE_KEY = 'mode';
4
+ export const DEFAULT_COLOR_SCHEME_STORAGE_KEY = 'color-scheme';
5
+ export const DEFAULT_ATTRIBUTE = 'data-color-scheme';
6
6
  export default function getInitColorSchemeScript(options) {
7
7
  const {
8
8
  enableSystem = false,
@@ -39,7 +39,7 @@ export function unstable_createStyleFunctionSx(styleFunctionMapping = defaultSty
39
39
  } = props || {};
40
40
 
41
41
  if (!sx) {
42
- return null; // emotion & styled-components will neglect null
42
+ return null; // Emotion & styled-components will neglect null
43
43
  }
44
44
  /*
45
45
  * Receive `sxInput` as object or callback
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.8.1
1
+ /** @license MUI v5.8.4
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -167,9 +167,11 @@ export function resolveBreakpointValues(_ref) {
167
167
  if (Array.isArray(breakpointValues)) {
168
168
  acc[breakpoint] = breakpointValues[i] != null ? breakpointValues[i] : breakpointValues[previous];
169
169
  previous = i;
170
- } else {
171
- acc[breakpoint] = breakpointValues[breakpoint] != null ? breakpointValues[breakpoint] : breakpointValues[previous] || breakpointValues;
170
+ } else if (_typeof(breakpointValues) === 'object') {
171
+ acc[breakpoint] = breakpointValues[breakpoint] != null ? breakpointValues[breakpoint] : breakpointValues[previous];
172
172
  previous = breakpoint;
173
+ } else {
174
+ acc[breakpoint] = breakpointValues;
173
175
  }
174
176
 
175
177
  return acc;
@@ -50,7 +50,7 @@ function intToHex(int) {
50
50
  * Returns an object with the type and values of a color.
51
51
  *
52
52
  * Note: Does not support rgb % values.
53
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
53
+ * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
54
54
  * @returns {object} - A MUI color object: {type: string, values: number[]}
55
55
  */
56
56
 
@@ -102,7 +102,7 @@ export function decomposeColor(color) {
102
102
  /**
103
103
  * Returns a channel created from the input color.
104
104
  *
105
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
105
+ * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
106
106
  * @returns {string} - The channel for the color, that can be used in rgba or hsla colors
107
107
  */
108
108
 
@@ -115,7 +115,7 @@ export var colorChannel = function colorChannel(color) {
115
115
  /**
116
116
  * Converts a color object with type and values to a string.
117
117
  * @param {object} color - Decomposed color
118
- * @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla'
118
+ * @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla', 'color'
119
119
  * @param {array} color.values - [n,n,n] or [n,n,n,n]
120
120
  * @returns {string} A CSS color string
121
121
  */
@@ -122,7 +122,7 @@ export default function createStyled() {
122
122
  }
123
123
 
124
124
  var expressionsWithDefaultTheme = expressions ? expressions.map(function (stylesArg) {
125
- // On the server emotion doesn't use React.forwardRef for creating components, so the created
125
+ // On the server Emotion doesn't use React.forwardRef for creating components, so the created
126
126
  // component stays as a function. This condition makes sure that we do not interpolate functions
127
127
  // which are basically components used as a selectors.
128
128
  // eslint-disable-next-line no-underscore-dangle
@@ -183,7 +183,7 @@ export default function createStyled() {
183
183
 
184
184
  transformedStyleArg = [].concat(_toConsumableArray(styleArg), _toConsumableArray(placeholders));
185
185
  transformedStyleArg.raw = [].concat(_toConsumableArray(styleArg.raw), _toConsumableArray(placeholders));
186
- } else if (typeof styleArg === 'function' && // On the server emotion doesn't use React.forwardRef for creating components, so the created
186
+ } else if (typeof styleArg === 'function' && // On the server Emotion doesn't use React.forwardRef for creating components, so the created
187
187
  // component stays as a function. This condition makes sure that we do not interpolate functions
188
188
  // which are basically components used as a selectors.
189
189
  // eslint-disable-next-line no-underscore-dangle
@@ -10,7 +10,7 @@ import { deepmerge, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui
10
10
  import { GlobalStyles } from '@mui/styled-engine';
11
11
  import cssVarsParser from './cssVarsParser';
12
12
  import ThemeProvider from '../ThemeProvider';
13
- import getInitColorSchemeScript, { DEFAULT_ATTRIBUTE, DEFAULT_COLOR_SCHEME_STORAGE_KEY, DEFAULT_MODE_STORAGE_KEY } from './getInitColorSchemeScript';
13
+ import systemGetInitColorSchemeScript, { DEFAULT_ATTRIBUTE, DEFAULT_COLOR_SCHEME_STORAGE_KEY, DEFAULT_MODE_STORAGE_KEY } from './getInitColorSchemeScript';
14
14
  import useCurrentColorScheme from './useCurrentColorScheme';
15
15
  import createGetCssVar from './createGetCssVar';
16
16
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -19,6 +19,12 @@ export var DISABLE_CSS_TRANSITION = '*{-webkit-transition:none!important;-moz-tr
19
19
  export default function createCssVarsProvider(options) {
20
20
  var _options$theme = options.theme,
21
21
  defaultTheme = _options$theme === void 0 ? {} : _options$theme,
22
+ _options$attribute = options.attribute,
23
+ defaultAttribute = _options$attribute === void 0 ? DEFAULT_ATTRIBUTE : _options$attribute,
24
+ _options$modeStorageK = options.modeStorageKey,
25
+ defaultModeStorageKey = _options$modeStorageK === void 0 ? DEFAULT_MODE_STORAGE_KEY : _options$modeStorageK,
26
+ _options$colorSchemeS = options.colorSchemeStorageKey,
27
+ defaultColorSchemeStorageKey = _options$colorSchemeS === void 0 ? DEFAULT_COLOR_SCHEME_STORAGE_KEY : _options$colorSchemeS,
22
28
  _options$defaultMode = options.defaultMode,
23
29
  desisgnSystemMode = _options$defaultMode === void 0 ? 'light' : _options$defaultMode,
24
30
  designSystemColorScheme = options.defaultColorScheme,
@@ -54,11 +60,11 @@ export default function createCssVarsProvider(options) {
54
60
  _ref$prefix = _ref.prefix,
55
61
  prefix = _ref$prefix === void 0 ? designSystemPrefix : _ref$prefix,
56
62
  _ref$modeStorageKey = _ref.modeStorageKey,
57
- modeStorageKey = _ref$modeStorageKey === void 0 ? DEFAULT_MODE_STORAGE_KEY : _ref$modeStorageKey,
63
+ modeStorageKey = _ref$modeStorageKey === void 0 ? defaultModeStorageKey : _ref$modeStorageKey,
58
64
  _ref$colorSchemeStora = _ref.colorSchemeStorageKey,
59
- colorSchemeStorageKey = _ref$colorSchemeStora === void 0 ? DEFAULT_COLOR_SCHEME_STORAGE_KEY : _ref$colorSchemeStora,
65
+ colorSchemeStorageKey = _ref$colorSchemeStora === void 0 ? defaultColorSchemeStorageKey : _ref$colorSchemeStora,
60
66
  _ref$attribute = _ref.attribute,
61
- attribute = _ref$attribute === void 0 ? DEFAULT_ATTRIBUTE : _ref$attribute,
67
+ attribute = _ref$attribute === void 0 ? defaultAttribute : _ref$attribute,
62
68
  _ref$defaultMode = _ref.defaultMode,
63
69
  defaultMode = _ref$defaultMode === void 0 ? desisgnSystemMode : _ref$defaultMode,
64
70
  _ref$defaultColorSche = _ref.defaultColorScheme,
@@ -134,7 +140,10 @@ export default function createCssVarsProvider(options) {
134
140
  colorSchemes: colorSchemes,
135
141
  prefix: prefix,
136
142
  vars: rootVars,
137
- getCssVar: createGetCssVar(prefix)
143
+ getCssVar: createGetCssVar(prefix),
144
+ getColorSchemeSelector: function getColorSchemeSelector(targetColorScheme) {
145
+ return "[".concat(attribute, "=\"").concat(targetColorScheme, "\"] &");
146
+ }
138
147
  });
139
148
  var defaultColorSchemeStyleSheet = {};
140
149
  var otherColorSchemesStyleSheet = {};
@@ -328,6 +337,15 @@ export default function createCssVarsProvider(options) {
328
337
  */
329
338
  theme: PropTypes.object
330
339
  } : void 0;
340
+
341
+ var getInitColorSchemeScript = function getInitColorSchemeScript(params) {
342
+ return systemGetInitColorSchemeScript(_extends({
343
+ attribute: defaultAttribute,
344
+ colorSchemeStorageKey: defaultColorSchemeStorageKey,
345
+ modeStorageKey: defaultModeStorageKey
346
+ }, params));
347
+ };
348
+
331
349
  return {
332
350
  CssVarsProvider: CssVarsProvider,
333
351
  useColorScheme: useColorScheme,
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- export var DEFAULT_MODE_STORAGE_KEY = 'mui-mode';
4
- export var DEFAULT_COLOR_SCHEME_STORAGE_KEY = 'mui-color-scheme';
5
- export var DEFAULT_ATTRIBUTE = 'data-mui-color-scheme';
3
+ export var DEFAULT_MODE_STORAGE_KEY = 'mode';
4
+ export var DEFAULT_COLOR_SCHEME_STORAGE_KEY = 'color-scheme';
5
+ export var DEFAULT_ATTRIBUTE = 'data-color-scheme';
6
6
  export default function getInitColorSchemeScript(options) {
7
7
  var _ref = options || {},
8
8
  _ref$enableSystem = _ref.enableSystem,
package/legacy/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.8.1
1
+ /** @license MUI v5.8.4
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -47,7 +47,7 @@ export function unstable_createStyleFunctionSx() {
47
47
  theme = _ref2$theme === void 0 ? {} : _ref2$theme;
48
48
 
49
49
  if (!sx) {
50
- return null; // emotion & styled-components will neglect null
50
+ return null; // Emotion & styled-components will neglect null
51
51
  }
52
52
  /*
53
53
  * Receive `sxInput` as object or callback
@@ -152,9 +152,11 @@ export function resolveBreakpointValues({
152
152
  if (Array.isArray(breakpointValues)) {
153
153
  acc[breakpoint] = breakpointValues[i] != null ? breakpointValues[i] : breakpointValues[previous];
154
154
  previous = i;
155
- } else {
156
- acc[breakpoint] = breakpointValues[breakpoint] != null ? breakpointValues[breakpoint] : breakpointValues[previous] || breakpointValues;
155
+ } else if (typeof breakpointValues === 'object') {
156
+ acc[breakpoint] = breakpointValues[breakpoint] != null ? breakpointValues[breakpoint] : breakpointValues[previous];
157
157
  previous = breakpoint;
158
+ } else {
159
+ acc[breakpoint] = breakpointValues;
158
160
  }
159
161
 
160
162
  return acc;
@@ -45,7 +45,7 @@ function intToHex(int) {
45
45
  * Returns an object with the type and values of a color.
46
46
  *
47
47
  * Note: Does not support rgb % values.
48
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
48
+ * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
49
49
  * @returns {object} - A MUI color object: {type: string, values: number[]}
50
50
  */
51
51
 
@@ -97,7 +97,7 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
97
97
  /**
98
98
  * Returns a channel created from the input color.
99
99
  *
100
- * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
100
+ * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
101
101
  * @returns {string} - The channel for the color, that can be used in rgba or hsla colors
102
102
  */
103
103
 
@@ -108,7 +108,7 @@ export const colorChannel = color => {
108
108
  /**
109
109
  * Converts a color object with type and values to a string.
110
110
  * @param {object} color - Decomposed color
111
- * @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla'
111
+ * @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla', 'color'
112
112
  * @param {array} color.values - [n,n,n] or [n,n,n,n]
113
113
  * @returns {string} A CSS color string
114
114
  */
@@ -115,7 +115,7 @@ export default function createStyled(input = {}) {
115
115
 
116
116
  const muiStyledResolver = (styleArg, ...expressions) => {
117
117
  const expressionsWithDefaultTheme = expressions ? expressions.map(stylesArg => {
118
- // On the server emotion doesn't use React.forwardRef for creating components, so the created
118
+ // On the server Emotion doesn't use React.forwardRef for creating components, so the created
119
119
  // component stays as a function. This condition makes sure that we do not interpolate functions
120
120
  // which are basically components used as a selectors.
121
121
  // eslint-disable-next-line no-underscore-dangle
@@ -174,7 +174,7 @@ export default function createStyled(input = {}) {
174
174
 
175
175
  transformedStyleArg = [...styleArg, ...placeholders];
176
176
  transformedStyleArg.raw = [...styleArg.raw, ...placeholders];
177
- } else if (typeof styleArg === 'function' && // On the server emotion doesn't use React.forwardRef for creating components, so the created
177
+ } else if (typeof styleArg === 'function' && // On the server Emotion doesn't use React.forwardRef for creating components, so the created
178
178
  // component stays as a function. This condition makes sure that we do not interpolate functions
179
179
  // which are basically components used as a selectors.
180
180
  // eslint-disable-next-line no-underscore-dangle
@@ -8,7 +8,7 @@ import { deepmerge, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui
8
8
  import { GlobalStyles } from '@mui/styled-engine';
9
9
  import cssVarsParser from './cssVarsParser';
10
10
  import ThemeProvider from '../ThemeProvider';
11
- import getInitColorSchemeScript, { DEFAULT_ATTRIBUTE, DEFAULT_COLOR_SCHEME_STORAGE_KEY, DEFAULT_MODE_STORAGE_KEY } from './getInitColorSchemeScript';
11
+ import systemGetInitColorSchemeScript, { DEFAULT_ATTRIBUTE, DEFAULT_COLOR_SCHEME_STORAGE_KEY, DEFAULT_MODE_STORAGE_KEY } from './getInitColorSchemeScript';
12
12
  import useCurrentColorScheme from './useCurrentColorScheme';
13
13
  import createGetCssVar from './createGetCssVar';
14
14
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -17,6 +17,9 @@ export const DISABLE_CSS_TRANSITION = '*{-webkit-transition:none!important;-moz-
17
17
  export default function createCssVarsProvider(options) {
18
18
  const {
19
19
  theme: defaultTheme = {},
20
+ attribute: defaultAttribute = DEFAULT_ATTRIBUTE,
21
+ modeStorageKey: defaultModeStorageKey = DEFAULT_MODE_STORAGE_KEY,
22
+ colorSchemeStorageKey: defaultColorSchemeStorageKey = DEFAULT_COLOR_SCHEME_STORAGE_KEY,
20
23
  defaultMode: desisgnSystemMode = 'light',
21
24
  defaultColorScheme: designSystemColorScheme,
22
25
  disableTransitionOnChange: designSystemTransitionOnChange = false,
@@ -46,9 +49,9 @@ export default function createCssVarsProvider(options) {
46
49
  children,
47
50
  theme: themeProp = defaultTheme,
48
51
  prefix = designSystemPrefix,
49
- modeStorageKey = DEFAULT_MODE_STORAGE_KEY,
50
- colorSchemeStorageKey = DEFAULT_COLOR_SCHEME_STORAGE_KEY,
51
- attribute = DEFAULT_ATTRIBUTE,
52
+ modeStorageKey = defaultModeStorageKey,
53
+ colorSchemeStorageKey = defaultColorSchemeStorageKey,
54
+ attribute = defaultAttribute,
52
55
  defaultMode = desisgnSystemMode,
53
56
  defaultColorScheme = designSystemColorScheme,
54
57
  disableTransitionOnChange = designSystemTransitionOnChange,
@@ -116,7 +119,8 @@ export default function createCssVarsProvider(options) {
116
119
  colorSchemes,
117
120
  prefix,
118
121
  vars: rootVars,
119
- getCssVar: createGetCssVar(prefix)
122
+ getCssVar: createGetCssVar(prefix),
123
+ getColorSchemeSelector: targetColorScheme => `[${attribute}="${targetColorScheme}"] &`
120
124
  });
121
125
  const defaultColorSchemeStyleSheet = {};
122
126
  const otherColorSchemesStyleSheet = {};
@@ -306,6 +310,13 @@ export default function createCssVarsProvider(options) {
306
310
  */
307
311
  theme: PropTypes.object
308
312
  } : void 0;
313
+
314
+ const getInitColorSchemeScript = params => systemGetInitColorSchemeScript(_extends({
315
+ attribute: defaultAttribute,
316
+ colorSchemeStorageKey: defaultColorSchemeStorageKey,
317
+ modeStorageKey: defaultModeStorageKey
318
+ }, params));
319
+
309
320
  return {
310
321
  CssVarsProvider,
311
322
  useColorScheme,
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- export const DEFAULT_MODE_STORAGE_KEY = 'mui-mode';
4
- export const DEFAULT_COLOR_SCHEME_STORAGE_KEY = 'mui-color-scheme';
5
- export const DEFAULT_ATTRIBUTE = 'data-mui-color-scheme';
3
+ export const DEFAULT_MODE_STORAGE_KEY = 'mode';
4
+ export const DEFAULT_COLOR_SCHEME_STORAGE_KEY = 'color-scheme';
5
+ export const DEFAULT_ATTRIBUTE = 'data-color-scheme';
6
6
  export default function getInitColorSchemeScript(options) {
7
7
  const {
8
8
  enableSystem = false,
package/modern/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.8.1
1
+ /** @license MUI v5.8.4
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -39,7 +39,7 @@ export function unstable_createStyleFunctionSx(styleFunctionMapping = defaultSty
39
39
  } = props || {};
40
40
 
41
41
  if (!sx) {
42
- return null; // emotion & styled-components will neglect null
42
+ return null; // Emotion & styled-components will neglect null
43
43
  }
44
44
  /*
45
45
  * Receive `sxInput` as object or callback
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/system",
3
- "version": "5.8.1",
3
+ "version": "5.8.4",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "CSS utilities for rapidly laying out custom designs.",
@@ -44,12 +44,12 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@babel/runtime": "^7.17.2",
47
- "@mui/private-theming": "^5.8.0",
47
+ "@mui/private-theming": "^5.8.4",
48
48
  "@mui/styled-engine": "^5.8.0",
49
- "@mui/types": "^7.1.3",
50
- "@mui/utils": "^5.8.0",
49
+ "@mui/types": "^7.1.4",
50
+ "@mui/utils": "^5.8.4",
51
51
  "clsx": "^1.1.1",
52
- "csstype": "^3.0.11",
52
+ "csstype": "^3.1.0",
53
53
  "prop-types": "^15.8.1"
54
54
  },
55
55
  "sideEffects": false,
package/style.d.ts CHANGED
@@ -13,3 +13,4 @@ export interface StyleOptions<PropKey> {
13
13
  export function style<PropKey extends string, Theme extends object>(
14
14
  options: StyleOptions<PropKey>,
15
15
  ): StyleFunction<{ [K in PropKey]?: unknown } & { theme?: Theme }> & { filterProps: string[] };
16
+ export function getPath<T>(obj: T, path: string | undefined, checkVars?: boolean): null | unknown;
@@ -51,7 +51,7 @@ function unstable_createStyleFunctionSx(styleFunctionMapping = _getThemeValue.st
51
51
  } = props || {};
52
52
 
53
53
  if (!sx) {
54
- return null; // emotion & styled-components will neglect null
54
+ return null; // Emotion & styled-components will neglect null
55
55
  }
56
56
  /*
57
57
  * Receive `sxInput` as object or callback