@mui/system 5.11.16 → 5.12.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +73 -22
  2. package/GlobalStyles/GlobalStyles.d.ts +13 -0
  3. package/GlobalStyles/GlobalStyles.js +45 -0
  4. package/GlobalStyles/index.d.ts +2 -0
  5. package/GlobalStyles/index.js +26 -0
  6. package/GlobalStyles/package.json +6 -0
  7. package/ThemeProvider/ThemeProvider.d.ts +4 -0
  8. package/ThemeProvider/ThemeProvider.js +43 -17
  9. package/createBox.d.ts +1 -0
  10. package/createBox.js +2 -1
  11. package/createStyled.d.ts +1 -0
  12. package/createStyled.js +34 -24
  13. package/cssVars/createCssVarsProvider.d.ts +22 -7
  14. package/cssVars/createCssVarsProvider.js +7 -3
  15. package/esm/GlobalStyles/GlobalStyles.js +35 -0
  16. package/esm/GlobalStyles/index.js +2 -0
  17. package/esm/ThemeProvider/ThemeProvider.js +44 -18
  18. package/esm/createBox.js +2 -1
  19. package/esm/createStyled.js +34 -24
  20. package/esm/cssVars/createCssVarsProvider.js +7 -3
  21. package/esm/index.js +2 -1
  22. package/esm/useThemeProps/useThemeProps.js +6 -2
  23. package/esm/useThemeWithoutDefault.js +3 -2
  24. package/index.d.ts +2 -2
  25. package/index.js +4 -3
  26. package/legacy/GlobalStyles/GlobalStyles.js +35 -0
  27. package/legacy/GlobalStyles/index.js +2 -0
  28. package/legacy/ThemeProvider/ThemeProvider.js +44 -19
  29. package/legacy/createBox.js +3 -2
  30. package/legacy/createStyled.js +34 -17
  31. package/legacy/cssVars/createCssVarsProvider.js +18 -14
  32. package/legacy/index.js +3 -2
  33. package/legacy/useThemeProps/useThemeProps.js +5 -1
  34. package/legacy/useThemeWithoutDefault.js +3 -2
  35. package/modern/GlobalStyles/GlobalStyles.js +35 -0
  36. package/modern/GlobalStyles/index.js +2 -0
  37. package/modern/ThemeProvider/ThemeProvider.js +44 -18
  38. package/modern/createBox.js +2 -1
  39. package/modern/createStyled.js +34 -24
  40. package/modern/cssVars/createCssVarsProvider.js +7 -3
  41. package/modern/index.js +3 -2
  42. package/modern/useThemeProps/useThemeProps.js +6 -2
  43. package/modern/useThemeWithoutDefault.js +3 -2
  44. package/package.json +5 -5
  45. package/useThemeProps/useThemeProps.d.ts +6 -1
  46. package/useThemeProps/useThemeProps.js +6 -2
  47. package/useThemeWithoutDefault.js +5 -2
  48. package/Box/Box.spec.d.ts +0 -1
  49. package/createBox.spec.d.ts +0 -1
  50. package/cssVars/createCssVarsProvider.spec.d.ts +0 -1
  51. package/index.spec.d.ts +0 -1
  52. package/styleFunctionSx/styleFunctionSx.spec.d.ts +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 5.12.0
4
+
5
+ <!-- generated comparing v5.11.16..master -->
6
+
7
+ _Apr 11, 2023_
8
+
9
+ A big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
10
+
11
+ - 💫 Added [theme scope](https://mui.com/material-ui/guides/styled-engine/#theme-scoping) for using multiple design systems (#36664) @siriwatknp
12
+ - 🐛 bug fixes and 📚 documentation improvements.
13
+
14
+ ### `@mui/system@5.12.0`
15
+
16
+ - &#8203;<!-- 05 -->[system] Introduce theme scope for using multiple design systems (#36664) @siriwatknp
17
+
18
+ ### `@mui/base@5.0.0-alpha.125`
19
+
20
+ - &#8203;<!-- 06 -->[PopperUnstyled] Do not merge internal `ownerState` with `ownerState` from props (#36599) @hbjORbj
21
+
22
+ ### `@mui/joy@5.0.0-alpha.75`
23
+
24
+ - &#8203;<!-- 08 -->[Joy] Add tests for slots/slotProps for all components (#36828) @hbjORbj
25
+ - &#8203;<!-- 07 -->[Joy] Support `slots`/`slotsProps` for every component (components with only root slot too) (#36540) @hbjORbj
26
+
27
+ ### Docs
28
+
29
+ - &#8203;<!-- 23 -->[docs][Backdrop] Improvements to the docs (#34244) @alirezahekmati
30
+ - &#8203;<!-- 20 -->[docs] Fix base API redirects (#36833) @mnajdova
31
+ - &#8203;<!-- 19 -->[docs] Improve perf on tab APIs (#36832) @mnajdova
32
+ - &#8203;<!-- 18 -->[docs] Revert CircularProgress component text to be proper noun instead (#36837) @ZeeshanTamboli
33
+ - &#8203;<!-- 17 -->[docs] Simplify language redirection @oliviertassinari
34
+ - &#8203;<!-- 16 -->[docs] Add missing `readOnly` state class in the list (#36788) @ZeeshanTamboli
35
+ - &#8203;<!-- 15 -->[docs] Improve side nav scroll into view (#36732) @oliviertassinari
36
+ - &#8203;<!-- 14 -->[docs][base & joy] Display "Classes" Section in API docs (#36589) @hbjORbj
37
+ - &#8203;<!-- 13 -->[docs] Fix 100+ typos throughout the Material UI docs (#36194) @Lioness100
38
+ - &#8203;<!-- 12 -->[docs] Change "coming soon" chip color (#36786) @danilo-leal
39
+ - &#8203;<!-- 11 -->[docs][Joy] Fix wrong prop descriptions (#36826) @hbjORbj
40
+ - &#8203;<!-- 10 -->[docs][material] Highlight global state classes in CSS table in API docs (#36633) @hbjORbj
41
+ - &#8203;<!-- 09 -->[examples] Fix `SliderUnstyled` slots `key` name (#36830) @sai6855
42
+ - &#8203;<!-- 04 -->[Tabs] Improve useTab() API page (#36725) @oliviertassinari
43
+
44
+ ### Core
45
+
46
+ - &#8203;<!-- 22 -->[core] Increase margin to scroll @oliviertassinari
47
+ - &#8203;<!-- 21 -->[core] Replace MUI Base with Base UI (#36716) @mnajdova
48
+ - &#8203;<!-- 03 -->[website] Fix broken career website links @oliviertassinari
49
+ - &#8203;<!-- 02 -->[website] Fix backlinks to homepage (#36801) @oliviertassinari
50
+ - &#8203;<!-- 01 -->[website] Tweaks to the Designer position ad (#36771) @danilo-leal
51
+
52
+ All contributors of this release in alphabetical order: @alirezahekmati, @danilo-leal, @hbjORbj, @Lioness100, @mnajdova, @oliviertassinari, @sai6855, @siriwatknp, @ZeeshanTamboli
53
+
3
54
  ## 5.11.16
4
55
 
5
56
  <!-- generated comparing v5.11.15..master -->
@@ -190,12 +241,12 @@ _Mar 14, 2023_
190
241
 
191
242
  A big thanks to the 13 contributors who made this release possible. Here are some highlights ✨:
192
243
 
193
- - @michaldudak added an option for [disabling the generation](https://mui.com/base/getting-started/customization/#disabling-default-css-classes) of the default classes in MUI Base (#35963)
244
+ - @michaldudak added an option for [disabling the generation](https://mui.com/base/getting-started/customization/#disabling-default-css-classes) of the default classes in Base UI (#35963)
194
245
  - other 🐛 bug fixes and 📚 documentation improvements.
195
246
 
196
247
  ### `@mui/material@5.11.13`
197
248
 
198
- - &#8203;<!-- 13 -->[core] Bump MUI Base's version in Material UI (#36492) @hbjORbj
249
+ - &#8203;<!-- 13 -->[core] Bump Base UI's version in Material UI (#36492) @hbjORbj
199
250
  - &#8203;<!-- 17 -->[material] Export `shouldSkipGeneratingVar` from Material UI (#36489) @siriwatknp
200
251
  - &#8203;<!-- 06 -->[Typography] Apply font properties to typography inherit variant (#33621) @oyar99
201
252
 
@@ -345,7 +396,7 @@ A big thanks to the 17 contributors who made this release possible. Here are som
345
396
  - &#8203;<!-- 23 -->[docs] Add instructions for deploying docs without a release (#36301) @cherniavskii
346
397
  - &#8203;<!-- 22 -->[docs] Fix 301 redirections on the docs @oliviertassinari
347
398
  - &#8203;<!-- 21 -->[docs] Update MUI X banner to reflect stable release (#36354) @MBilalShafi
348
- - &#8203;<!-- 20 -->[docs] Clarify the future plan for integrating MUI Base in Material UI (#36365) @mnajdova
399
+ - &#8203;<!-- 20 -->[docs] Clarify the future plan for integrating Base UI in Material UI (#36365) @mnajdova
349
400
  - &#8203;<!-- 19 -->[docs] Improve visual look of loose lists (#36190) @oliviertassinari
350
401
  - &#8203;<!-- 18 -->[docs] Fix @mui/styles example links (#36331) @oliviertassinari
351
402
  - &#8203;<!-- 17 -->[docs][joy] Build TS versions for List component demos (#36382) @sai6855
@@ -375,7 +426,7 @@ _Feb 27, 2023_
375
426
 
376
427
  A big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
377
428
 
378
- - 📚 added API documentation for the slots in MUI Base and Joy UI by @hbjORbj, for e.g. [SliderUnstyled API](https://mui.com/base/api/slider-unstyled/#slots)
429
+ - 📚 added API documentation for the slots in Base UI and Joy UI by @hbjORbj, for e.g. [SliderUnstyled API](https://mui.com/base/api/slider-unstyled/#slots)
379
430
  - other 🐛 bug fixes and 📚 documentation improvements.
380
431
 
381
432
  ### `@mui/material@5.11.11`
@@ -612,7 +663,7 @@ A big thanks to the 14 contributors who made this release possible. Here are som
612
663
  - &#8203;<!-- 16 -->[docs] Improve inline preview's information (#35974) @oliviertassinari
613
664
  - &#8203;<!-- 15 -->[docs] Fix wrong v5 migration instructions (#36022) @oliviertassinari
614
665
  - &#8203;<!-- 14 -->[docs] Fix autocomplete render group key warning in the demo (#36025) @chuanyu0201
615
- - &#8203;<!-- 13 -->[docs] Add hooks API pages for MUI Base (#35828) @mnajdova
666
+ - &#8203;<!-- 13 -->[docs] Add hooks API pages for Base UI (#35828) @mnajdova
616
667
  - &#8203;<!-- 12 -->[docs] Fix grammar typo (#36016) @alexownejazayeri
617
668
  - &#8203;<!-- 11 -->[docs][joy] Add JSDoc for the `AutocompleteProps` type (#36039) @ArthurPedroti
618
669
 
@@ -828,7 +879,7 @@ This release was mostly about 🐛 bug fixes and 📚 documentation improvements
828
879
 
829
880
  - [docs] Improve pickers lab migration stressing `mui-x` usage (#35740) @LukasTy
830
881
  - [docs] Fix incorrectly named AccessibleTable demo component (#35832) @HeVictor
831
- - [docs] Clarify where to find docs for MUI Base components in Material UI (#35799) @samuelsycamore
882
+ - [docs] Clarify where to find docs for Base UI components in Material UI (#35799) @samuelsycamore
832
883
  - [docs] Fix typos (#35814) @alexfauquette
833
884
  - [docs] Revise and expand the Joy UI Card page (#35745) @samuelsycamore
834
885
  - [docs] Fix navigation layout shift (#35679) @oliviertassinari
@@ -939,7 +990,7 @@ _Dec 26, 2022_
939
990
 
940
991
  A big thanks to the 20 contributors who made this release possible. Here are some highlights ✨:
941
992
 
942
- - ⚙️ Several MUI Base components were converted to TypeScript by @trizotti, @leventdeniz and @danhuynhdev (#35005, #34793, #34771)
993
+ - ⚙️ Several Base UI components were converted to TypeScript by @trizotti, @leventdeniz and @danhuynhdev (#35005, #34793, #34771)
943
994
  - Many other 🐛 bug fixes abd 📚 documentation improvements.
944
995
 
945
996
  ### `@mui/material@5.11.2`
@@ -1116,7 +1167,7 @@ A big thanks to the 19 contributors who made this release possible. Here are som
1116
1167
  - [docs] Refactor `ToggleButtonSizes` demo (#35375) @Armanio
1117
1168
  - [docs] Standardize the usage of callouts in the MUI Core docs (#35361) @samuelsycamore
1118
1169
  - [docs] Format feedback to add a link to the commented section (#35381) @alexfauquette
1119
- - [docs] Direct users from Material UI to MUI Base for duplicated components (#35293) @samuelsycamore
1170
+ - [docs] Direct users from Material UI to Base UI for duplicated components (#35293) @samuelsycamore
1120
1171
  - [docs] Fix typo in FormControl API docs (#35449) @Spanishiwa
1121
1172
  - [docs] Update callouts design (#35390) @danilo-leal
1122
1173
  - [website] New wave of open roles (#35240) @mnajdova
@@ -1191,7 +1242,7 @@ A big thanks to the 15 contributors who made this release possible. Here are som
1191
1242
  - &#8203;<!-- 14 -->[docs] Improve the autogenerated "Unstyled" and "API" text (#35185) @samuelsycamore
1192
1243
  - &#8203;<!-- 13 -->[docs] Fix ad margin on API pages (#35201) @oliviertassinari
1193
1244
  - &#8203;<!-- 12 -->[docs] Revise and expand the Joy UI "Badge" page (#35199) @samuelsycamore
1194
- - &#8203;<!-- 11 -->[docs] Update MUI Base docs with latest style conventions (#35034) @samuelsycamore
1245
+ - &#8203;<!-- 11 -->[docs] Update Base UI docs with latest style conventions (#35034) @samuelsycamore
1195
1246
  - &#8203;<!-- 09 -->[l10n] Improve Chinese (Taiwan) zh-TW locale (#35328) @happyincent
1196
1247
  - &#8203;<!-- 02 -->[website] Update MUI stats: GitHub stars, Twitter followers, etc. (#35318) @nomandhoni-cs
1197
1248
 
@@ -1524,7 +1575,7 @@ _Oct 25, 2022_
1524
1575
 
1525
1576
  A big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
1526
1577
 
1527
- - 🔧 Moved `components` to `slots` prop starting at MUI Base to create consistency across products
1578
+ - 🔧 Moved `components` to `slots` prop starting at Base UI to create consistency across products
1528
1579
  - Many other 🐛 bug fixes, 📚 documentation, and ⚙️ infrastructure improvements
1529
1580
 
1530
1581
  ### `@mui/material@5.10.11`
@@ -1606,7 +1657,7 @@ A big thanks to the 21 contributors who made this release possible. Here are som
1606
1657
 
1607
1658
  - 🖌 Thanks to the efforts of @bharatkashyap and @nihgwu, we now have editable demos across our docs (#34454)!
1608
1659
  - 🚀 The Tooltip component has been added to Joy UI by @hbjORbj (#34509).
1609
- - ⚙️ We started converting the remaining JS components in MUI Base to TypeScript.
1660
+ - ⚙️ We started converting the remaining JS components in Base UI to TypeScript.
1610
1661
  @mbayucot finished the first PR with the conversion of the NoSsr code (#34735).
1611
1662
  - And more 🐛 bug fixes and 📚 documentation improvements.
1612
1663
 
@@ -1737,7 +1788,7 @@ _Oct 3, 2022_
1737
1788
 
1738
1789
  A big thanks to the 18 contributors who made this release possible. Here are some highlights ✨:
1739
1790
 
1740
- - 🚀 [SnackbarUnstyled](https://mui.com/base/react-snackbar/) component & headless hook are added to MUI Base (#33227) @ZeeshanTamboli
1791
+ - 🚀 [SnackbarUnstyled](https://mui.com/base/react-snackbar/) component & headless hook are added to Base UI (#33227) @ZeeshanTamboli
1741
1792
  - 📚 [CSS variables documentation](https://mui.com/material-ui/experimental-api/css-theme-variables/overview/) for Material UI has been added by @siriwatknp (#33958)
1742
1793
  - And more 🐛 bug fixes and 📚 documentation improvements.
1743
1794
 
@@ -1839,7 +1890,7 @@ A big thanks to the 21 contributors who made this release possible. Here are som
1839
1890
 
1840
1891
  ### Docs
1841
1892
 
1842
- - [blog] MUI Base announcement typo fixed (#34409) @prakhargupta1
1893
+ - [blog] Base UI announcement typo fixed (#34409) @prakhargupta1
1843
1894
  - [blog] Fix typo in date-pickers v5 stable (#34386) @alexfauquette
1844
1895
  - [blog] Update date on date pickers v5 release blog post (#34406) @joserodolfofreitas
1845
1896
  - [docs] Update `useMenu` and `useMenuItem` hooks demo (#34166) @ZeeshanTamboli
@@ -1925,7 +1976,7 @@ This release was mostly about 🐛 bug fixes and 📚 documentation improvements
1925
1976
  - [docs] Fix 301 link to external projects @oliviertassinari
1926
1977
  - [docs] Move 12 component names to Title Case (#34188) @oliviertassinari
1927
1978
  - [docs] Fix broken links (#34320) @alexfauquette
1928
- - [docs] Add notification for MUI Base announcement post (#34295) @samuelsycamore
1979
+ - [docs] Add notification for Base UI announcement post (#34295) @samuelsycamore
1929
1980
  - [website] Fix MUI X subscribe email border style (#34330) @oliviertassinari
1930
1981
  - [website] Improve security header @oliviertassinari
1931
1982
 
@@ -1946,7 +1997,7 @@ _Sep 12, 2022_
1946
1997
 
1947
1998
  A big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
1948
1999
 
1949
- - 🚀 [Blog post](https://mui.com/blog/introducing-mui-base/) for announcing the release of the MUI Base package is out thanks to @michaldudak.
2000
+ - 🚀 [Blog post](https://mui.com/blog/introducing-mui-base/) for announcing the release of the Base UI package is out thanks to @michaldudak.
1950
2001
  - 🚀 Added [`Alert`](https://mui.com/joy-ui/react-alert/), [`Modal`](https://mui.com/joy-ui/react-modal/), [`ListSubheader`](https://mui.com/joy-ui/react-list-subheader/), [`FormControl`](https://mui.com/joy-ui/react-form-control/), [`CircularProgress`](https://mui.com/joy-ui/react-circular-progress/) components to Joy UI (#33859) @hbjORbj @siriwatknp
1951
2002
  - And more 🐛 bug fixes and 📚 documentation improvements.
1952
2003
 
@@ -1969,7 +2020,7 @@ A big thanks to the 12 contributors who made this release possible. Here are som
1969
2020
 
1970
2021
  ### Docs
1971
2022
 
1972
- - &#8203;<!-- 16 -->[blog] Introducing MUI Base (#33778) @michaldudak
2023
+ - &#8203;<!-- 16 -->[blog] Introducing Base UI (#33778) @michaldudak
1973
2024
  - &#8203;<!-- 13 -->[docs] Fix spelling error (#34209) @ChrystianDeMatos
1974
2025
  - &#8203;<!-- 12 -->[docs] Improve link to the security policy (#34219) @oliviertassinari
1975
2026
  - &#8203;<!-- 11 -->[docs] Fix typo in Joy UI's `Usage` docs (#34200) @zillion504
@@ -2524,7 +2575,7 @@ A big thanks to the 19 contributors who made this release possible. Here are som
2524
2575
  - [docs] Add "refine" demo to showcase (#33240) @omeraplak
2525
2576
  - [docs] Add webpack alias for legacy utils package (#33376) @jgbae
2526
2577
  - [docs] Improve external link icons synonyms (#33257) @davidgarciab
2527
- - [examples] Update MUI Base with Tailwind CSS to use the latest versions of the dependencies (#33401) @mnajdova
2578
+ - [examples] Update Base UI with Tailwind CSS to use the latest versions of the dependencies (#33401) @mnajdova
2528
2579
  - [examples] Add MUI base example (#33154) @siriwatknp
2529
2580
 
2530
2581
  ### Core
@@ -2698,7 +2749,7 @@ A big thanks to the 14 contributors who made this release possible. Here are som
2698
2749
  - &#8203;<!-- 28 -->[blog] Update Blogpost to clear confusion on "no impact" disclaimer. (#33131) @joserodolfofreitas
2699
2750
  - &#8203;<!-- 27 -->[blog] Add post about v5 Migration guide update (#33063) @samuelsycamore
2700
2751
  - &#8203;<!-- 26 -->[blog] Fix display on Safari (#33102) @oliviertassinari
2701
- - &#8203;<!-- 18 -->[docs] Add guide on how to use MUI Base with Tailwind CSS (#33100) @mnajdova
2752
+ - &#8203;<!-- 18 -->[docs] Add guide on how to use Base UI with Tailwind CSS (#33100) @mnajdova
2702
2753
  - &#8203;<!-- 17 -->[docs] Improve Joy template UX (#33159) @siriwatknp
2703
2754
  - &#8203;<!-- 16 -->[docs] Update Shadow DOM guide (#33160) @cherniavskii
2704
2755
  - &#8203;<!-- 15 -->[docs] Fix SEO regressions (#33106) @oliviertassinari
@@ -2776,7 +2827,7 @@ A big thanks to the 24 contributors who made this release possible. Here are som
2776
2827
  - &#8203;<!-- 31 -->[docs] Move codesandbox to MUI org (#33122) @oliviertassinari
2777
2828
  - &#8203;<!-- 30 -->[docs] Add Shadow DOM guide (#33007) @cherniavskii
2778
2829
  - &#8203;<!-- 29 -->[docs] Fix typo in Material UI overview page (#33087) @oliviertassinari
2779
- - &#8203;<!-- 28 -->[docs] Miscellaneous fixes in `MUI Base` docs (#33091) @ZeeshanTamboli
2830
+ - &#8203;<!-- 28 -->[docs] Miscellaneous fixes in `Base UI` docs (#33091) @ZeeshanTamboli
2780
2831
  - &#8203;<!-- 27 -->[docs] Fix GitHub capitalization (#33071) @oliviertassinari
2781
2832
  - &#8203;<!-- 26 -->[docs] Fix a typo in `InputUnstyled` docs (#33077) @ZeeshanTamboli
2782
2833
  - &#8203;<!-- 25 -->[docs] Add notification for Joy blog post (#33059) @siriwatknp
@@ -3212,7 +3263,7 @@ A big thanks to the 13 contributors who made this release possible. Here are som
3212
3263
  - &#8203;<!-- 24 -->[docs] Base Button style revisions and final review (#32380) @samuelsycamore
3213
3264
  - &#8203;<!-- 23 -->[docs] Base NoSsr style revisions and final review (#32254) @samuelsycamore
3214
3265
  - &#8203;<!-- 22 -->[docs] Correctly capitalize Ctrl @oliviertassinari
3215
- - &#8203;<!-- 21 -->[docs] Fix styling in `Basic Popper` demo on the MUI Base docs (#32488) @ZeeshanTamboli
3266
+ - &#8203;<!-- 21 -->[docs] Fix styling in `Basic Popper` demo on the Base UI docs (#32488) @ZeeshanTamboli
3216
3267
  - &#8203;<!-- 20 -->[docs] Add "Overview" page to Base docs (#32310) @samuelsycamore
3217
3268
  - &#8203;<!-- 19 -->[docs] Add copy button to code block (#32390) @siriwatknp
3218
3269
  - &#8203;<!-- 18 -->[docs] Base Tabs style revisions and final review (#32423) @samuelsycamore
@@ -3466,7 +3517,7 @@ A big thanks to the 15 contributors who made this release possible. Here are som
3466
3517
 
3467
3518
  - &#8203;<!-- 28 -->[core] Update peer deps to support React 18 (#32063) @eps1lon
3468
3519
  - &#8203;<!-- 27 -->[core] Fix running docs:api on Windows (#32091) @michaldudak
3469
- - &#8203;<!-- 26 -->[core] Fix api build script for MUI Base (#32081) @siriwatknp
3520
+ - &#8203;<!-- 26 -->[core] Fix api build script for Base UI (#32081) @siriwatknp
3470
3521
 
3471
3522
  All contributors of this release in alphabetical order: @apeltop, @eps1lon, @flaviendelangle, @garronej, @ivan-ngchakming, @m4theushw, @MatthijsMud, @michaldudak, @mnajdova, @oliviertassinari, @psjishnu, @raigoinabox, @samuelsycamore, @siriwatknp, @TkaczykAdam
3472
3523
 
@@ -3693,7 +3744,7 @@ A big thanks to the 16 contributors who made this release possible. Here are som
3693
3744
 
3694
3745
  - &#8203;<!-- 24 -->[ClassNameGenerator] Prevent all `base` imports (#31297) @siriwatknp
3695
3746
 
3696
- `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:
3747
+ `unstable_ClassNameGenerator` has been moved from `utils` to `className` folder to prevent all Base UI module imports. If you use the module, please update the import as suggested in the diff below:
3697
3748
 
3698
3749
  ```diff
3699
3750
  -import { unstable_ClassNameGenerator } from '@mui/material/utils';
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { Interpolation } from '@mui/styled-engine';
3
+ import { Theme as SystemTheme } from '../createTheme';
4
+ export interface GlobalStylesProps<Theme = SystemTheme> {
5
+ styles: Interpolation<Theme>;
6
+ defaultTheme?: object;
7
+ themeId?: string;
8
+ }
9
+ declare function GlobalStyles<Theme = SystemTheme>({ styles, themeId, defaultTheme, }: GlobalStylesProps<Theme>): JSX.Element;
10
+ declare namespace GlobalStyles {
11
+ var propTypes: any;
12
+ }
13
+ export default GlobalStyles;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var React = _interopRequireWildcard(require("react"));
9
+ var _propTypes = _interopRequireDefault(require("prop-types"));
10
+ var _styledEngine = require("@mui/styled-engine");
11
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
+ 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; }
15
+ function GlobalStyles({
16
+ styles,
17
+ themeId,
18
+ defaultTheme = {}
19
+ }) {
20
+ const upperTheme = (0, _useTheme.default)(defaultTheme);
21
+ const globalStyles = typeof styles === 'function' ? styles(themeId ? upperTheme[themeId] || upperTheme : upperTheme) : styles;
22
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledEngine.GlobalStyles, {
23
+ styles: globalStyles
24
+ });
25
+ }
26
+ process.env.NODE_ENV !== "production" ? GlobalStyles.propTypes /* remove-proptypes */ = {
27
+ // ----------------------------- Warning --------------------------------
28
+ // | These PropTypes are generated from the TypeScript type definitions |
29
+ // | To update them edit TypeScript types and run "yarn proptypes" |
30
+ // ----------------------------------------------------------------------
31
+ /**
32
+ * @ignore
33
+ */
34
+ defaultTheme: _propTypes.default.object,
35
+ /**
36
+ * @ignore
37
+ */
38
+ styles: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.array, _propTypes.default.func, _propTypes.default.number, _propTypes.default.object, _propTypes.default.string, _propTypes.default.bool]),
39
+ /**
40
+ * @ignore
41
+ */
42
+ themeId: _propTypes.default.string
43
+ } : void 0;
44
+ var _default = GlobalStyles;
45
+ exports.default = _default;
@@ -0,0 +1,2 @@
1
+ export { default } from './GlobalStyles';
2
+ export * from './GlobalStyles';
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {};
7
+ Object.defineProperty(exports, "default", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _GlobalStyles.default;
11
+ }
12
+ });
13
+ var _GlobalStyles = _interopRequireWildcard(require("./GlobalStyles"));
14
+ Object.keys(_GlobalStyles).forEach(function (key) {
15
+ if (key === "default" || key === "__esModule") return;
16
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
17
+ if (key in exports && exports[key] === _GlobalStyles[key]) return;
18
+ Object.defineProperty(exports, key, {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _GlobalStyles[key];
22
+ }
23
+ });
24
+ });
25
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
26
+ 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; }
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "../esm/GlobalStyles/index.js",
4
+ "main": "./index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -5,6 +5,10 @@ export interface ThemeProviderProps<Theme = DefaultTheme> {
5
5
  * Your component tree.
6
6
  */
7
7
  children?: React.ReactNode;
8
+ /**
9
+ * The design system's unique id for getting the corresponded theme when there are multiple design systems.
10
+ */
11
+ themeId?: string;
8
12
  /**
9
13
  * A theme object. You can provide a function to extend the outer theme.
10
14
  */
@@ -5,42 +5,64 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
9
  var React = _interopRequireWildcard(require("react"));
9
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
10
11
  var _privateTheming = require("@mui/private-theming");
11
12
  var _utils = require("@mui/utils");
12
13
  var _styledEngine = require("@mui/styled-engine");
13
- var _useTheme = _interopRequireDefault(require("../useTheme"));
14
+ var _useThemeWithoutDefault = _interopRequireDefault(require("../useThemeWithoutDefault"));
14
15
  var _jsxRuntime = require("react/jsx-runtime");
15
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
17
  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; }
17
18
  const EMPTY_THEME = {};
18
- function InnerThemeProvider(props) {
19
- const theme = (0, _useTheme.default)();
20
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledEngine.ThemeContext.Provider, {
21
- value: typeof theme === 'object' ? theme : EMPTY_THEME,
22
- children: props.children
23
- });
19
+ function useThemeScoping(themeId, upperTheme, localTheme, isPrivate = false) {
20
+ return React.useMemo(() => {
21
+ const resolvedTheme = themeId ? upperTheme[themeId] || upperTheme : upperTheme;
22
+ if (typeof localTheme === 'function') {
23
+ const mergedTheme = localTheme(resolvedTheme);
24
+ const result = themeId ? (0, _extends2.default)({}, upperTheme, {
25
+ [themeId]: mergedTheme
26
+ }) : mergedTheme;
27
+ // must return a function for the private theme to NOT merge with the upper theme.
28
+ // see the test case "use provided theme from a callback" in ThemeProvider.test.js
29
+ if (isPrivate) {
30
+ return () => result;
31
+ }
32
+ return result;
33
+ }
34
+ return themeId ? (0, _extends2.default)({}, upperTheme, {
35
+ [themeId]: localTheme
36
+ }) : (0, _extends2.default)({}, upperTheme, localTheme);
37
+ }, [themeId, upperTheme, localTheme, isPrivate]);
24
38
  }
25
- process.env.NODE_ENV !== "production" ? InnerThemeProvider.propTypes = {
26
- /**
27
- * Your component tree.
28
- */
29
- children: _propTypes.default.node
30
- } : void 0;
31
39
 
32
40
  /**
33
41
  * This component makes the `theme` available down the React tree.
34
42
  * It should preferably be used at **the root of your component tree**.
43
+ *
44
+ * <ThemeProvider theme={theme}> // existing use case
45
+ * <ThemeProvider theme={{ id: theme }}> // theme scoping
35
46
  */
36
47
  function ThemeProvider(props) {
37
48
  const {
38
49
  children,
39
- theme: localTheme
50
+ theme: localTheme,
51
+ themeId
40
52
  } = props;
53
+ const upperTheme = (0, _useThemeWithoutDefault.default)(EMPTY_THEME);
54
+ const upperPrivateTheme = (0, _privateTheming.useTheme)() || EMPTY_THEME;
55
+ if (process.env.NODE_ENV !== 'production') {
56
+ if (upperTheme === null && typeof localTheme === 'function' || themeId && upperTheme && !upperTheme[themeId] && typeof localTheme === 'function') {
57
+ console.error(['MUI: You are providing a theme function prop to the ThemeProvider component:', '<ThemeProvider theme={outerTheme => outerTheme} />', '', 'However, no outer theme is present.', 'Make sure a theme is already injected higher in the React tree ' + 'or provide a theme object.'].join('\n'));
58
+ }
59
+ }
60
+ const engineTheme = useThemeScoping(themeId, upperTheme, localTheme);
61
+ const privateTheme = useThemeScoping(themeId, upperPrivateTheme, localTheme, true);
41
62
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_privateTheming.ThemeProvider, {
42
- theme: localTheme,
43
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(InnerThemeProvider, {
63
+ theme: privateTheme,
64
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledEngine.ThemeContext.Provider, {
65
+ value: engineTheme,
44
66
  children: children
45
67
  })
46
68
  });
@@ -57,7 +79,11 @@ process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes /* remove-propty
57
79
  /**
58
80
  * A theme object. You can provide a function to extend the outer theme.
59
81
  */
60
- theme: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]).isRequired
82
+ theme: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]).isRequired,
83
+ /**
84
+ * The design system's unique id for getting the corresponded theme when there are multiple design systems.
85
+ */
86
+ themeId: _propTypes.default.string
61
87
  } : void 0;
62
88
  if (process.env.NODE_ENV !== 'production') {
63
89
  process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = (0, _utils.exactProp)(ThemeProvider.propTypes) : void 0;
package/createBox.d.ts CHANGED
@@ -6,6 +6,7 @@ export default function createBox<
6
6
  T extends object = SystemTheme,
7
7
  AdditionalProps extends Record<string, unknown> = {},
8
8
  >(options?: {
9
+ themeId?: string;
9
10
  defaultTheme: T;
10
11
  defaultClassName?: string;
11
12
  generateClassName?: (componentName: string) => string;
package/createBox.js CHANGED
@@ -18,6 +18,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
18
18
  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; }
19
19
  function createBox(options = {}) {
20
20
  const {
21
+ themeId,
21
22
  defaultTheme,
22
23
  defaultClassName = 'MuiBox-root',
23
24
  generateClassName
@@ -37,7 +38,7 @@ function createBox(options = {}) {
37
38
  as: component,
38
39
  ref: ref,
39
40
  className: (0, _clsx.default)(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
40
- theme: theme
41
+ theme: themeId ? theme[themeId] || theme : theme
41
42
  }, other));
42
43
  });
43
44
  return Box;
package/createStyled.d.ts CHANGED
@@ -31,6 +31,7 @@ export type CreateMUIStyled<T extends object = DefaultTheme> = CreateMUIStyledSt
31
31
  >;
32
32
 
33
33
  export default function createStyled<T extends object = DefaultTheme>(options?: {
34
+ themeId?: string;
34
35
  defaultTheme?: T;
35
36
  rootShouldForwardProp?: (prop: PropertyKey) => boolean;
36
37
  slotShouldForwardProp?: (prop: PropertyKey) => boolean;
package/createStyled.js CHANGED
@@ -14,9 +14,7 @@ var _utils = require("@mui/utils");
14
14
  var _createTheme = _interopRequireDefault(require("./createTheme"));
15
15
  var _propsToClassKey = _interopRequireDefault(require("./propsToClassKey"));
16
16
  var _styleFunctionSx = _interopRequireDefault(require("./styleFunctionSx"));
17
- const _excluded = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"],
18
- _excluded2 = ["theme"],
19
- _excluded3 = ["theme"];
17
+ const _excluded = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"];
20
18
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
19
  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; }
22
20
  function isEmpty(obj) {
@@ -81,16 +79,26 @@ exports.systemDefaultTheme = systemDefaultTheme;
81
79
  const lowercaseFirstLetter = string => {
82
80
  return string.charAt(0).toLowerCase() + string.slice(1);
83
81
  };
82
+ function resolveTheme({
83
+ defaultTheme,
84
+ theme,
85
+ themeId
86
+ }) {
87
+ return isEmpty(theme) ? defaultTheme : theme[themeId] || theme;
88
+ }
84
89
  function createStyled(input = {}) {
85
90
  const {
91
+ themeId,
86
92
  defaultTheme = systemDefaultTheme,
87
93
  rootShouldForwardProp = shouldForwardProp,
88
94
  slotShouldForwardProp = shouldForwardProp
89
95
  } = input;
90
96
  const systemSx = props => {
91
- const theme = isEmpty(props.theme) ? defaultTheme : props.theme;
92
97
  return (0, _styleFunctionSx.default)((0, _extends2.default)({}, props, {
93
- theme
98
+ theme: resolveTheme((0, _extends2.default)({}, props, {
99
+ defaultTheme,
100
+ themeId
101
+ }))
94
102
  }));
95
103
  };
96
104
  systemSx.__mui_systemSx = true;
@@ -134,20 +142,22 @@ function createStyled(input = {}) {
134
142
  // On the server Emotion doesn't use React.forwardRef for creating components, so the created
135
143
  // component stays as a function. This condition makes sure that we do not interpolate functions
136
144
  // which are basically components used as a selectors.
137
- return typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg ? _ref => {
138
- let {
139
- theme: themeInput
140
- } = _ref,
141
- other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded2);
142
- return stylesArg((0, _extends2.default)({
143
- theme: isEmpty(themeInput) ? defaultTheme : themeInput
144
- }, other));
145
+ return typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg ? props => {
146
+ return stylesArg((0, _extends2.default)({}, props, {
147
+ theme: resolveTheme((0, _extends2.default)({}, props, {
148
+ defaultTheme,
149
+ themeId
150
+ }))
151
+ }));
145
152
  } : stylesArg;
146
153
  }) : [];
147
154
  let transformedStyleArg = styleArg;
148
155
  if (componentName && overridesResolver) {
149
156
  expressionsWithDefaultTheme.push(props => {
150
- const theme = isEmpty(props.theme) ? defaultTheme : props.theme;
157
+ const theme = resolveTheme((0, _extends2.default)({}, props, {
158
+ defaultTheme,
159
+ themeId
160
+ }));
151
161
  const styleOverrides = getStyleOverrides(componentName, theme);
152
162
  if (styleOverrides) {
153
163
  const resolvedStyleOverrides = {};
@@ -163,7 +173,10 @@ function createStyled(input = {}) {
163
173
  }
164
174
  if (componentName && !skipVariantsResolver) {
165
175
  expressionsWithDefaultTheme.push(props => {
166
- const theme = isEmpty(props.theme) ? defaultTheme : props.theme;
176
+ const theme = resolveTheme((0, _extends2.default)({}, props, {
177
+ defaultTheme,
178
+ themeId
179
+ }));
167
180
  return variantsResolver(props, getVariantStyles(componentName, theme), theme, componentName);
168
181
  });
169
182
  }
@@ -182,15 +195,12 @@ function createStyled(input = {}) {
182
195
  // which are basically components used as a selectors.
183
196
  styleArg.__emotion_real !== styleArg) {
184
197
  // If the type is function, we need to define the default theme.
185
- transformedStyleArg = _ref2 => {
186
- let {
187
- theme: themeInput
188
- } = _ref2,
189
- other = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded3);
190
- return styleArg((0, _extends2.default)({
191
- theme: isEmpty(themeInput) ? defaultTheme : themeInput
192
- }, other));
193
- };
198
+ transformedStyleArg = props => styleArg((0, _extends2.default)({}, props, {
199
+ theme: resolveTheme((0, _extends2.default)({}, props, {
200
+ defaultTheme,
201
+ themeId
202
+ }))
203
+ }));
194
204
  }
195
205
  const Component = defaultStyledResolver(transformedStyleArg, ...expressionsWithDefaultTheme);
196
206
  if (process.env.NODE_ENV !== 'production') {