@mui/system 6.0.0-alpha.1 → 6.0.0-alpha.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 +169 -2
- package/Container/Container.d.ts +1 -1
- package/Stack/Stack.d.ts +1 -1
- package/Stack/createStack.d.ts +1 -1
- package/Unstable_Grid/Grid.d.ts +1 -1
- package/Unstable_Grid/createGrid.d.ts +1 -1
- package/breakpoints/breakpoints.js +19 -1
- package/createTheme/createTheme.d.ts +2 -1
- package/createTheme/createTheme.js +2 -0
- package/cssContainerQueries/cssContainerQueries.d.ts +24 -0
- package/cssContainerQueries/cssContainerQueries.js +68 -0
- package/cssContainerQueries/index.d.ts +3 -0
- package/cssContainerQueries/index.js +2 -0
- package/cssContainerQueries/package.json +6 -0
- package/cssVars/cssVarsParser.d.ts +1 -1
- package/cssVars/index.d.ts +2 -0
- package/cssVars/index.js +1 -0
- package/cssVars/prepareTypographyVars.d.ts +8 -0
- package/cssVars/prepareTypographyVars.js +11 -0
- package/index.d.ts +2 -0
- package/index.js +2 -1
- package/modern/breakpoints/breakpoints.js +19 -1
- package/modern/createTheme/createTheme.js +2 -0
- package/modern/cssContainerQueries/cssContainerQueries.js +68 -0
- package/modern/cssContainerQueries/index.js +2 -0
- package/modern/cssVars/index.js +1 -0
- package/modern/cssVars/prepareTypographyVars.js +11 -0
- package/modern/index.js +2 -1
- package/modern/styleFunctionSx/defaultSxConfig.js +3 -0
- package/modern/styleFunctionSx/styleFunctionSx.js +2 -1
- package/node/breakpoints/breakpoints.js +19 -1
- package/node/createTheme/createTheme.js +2 -0
- package/node/cssContainerQueries/cssContainerQueries.js +79 -0
- package/node/cssContainerQueries/index.js +32 -0
- package/node/cssVars/index.js +7 -0
- package/node/cssVars/prepareTypographyVars.js +17 -0
- package/node/index.js +9 -1
- package/node/styleFunctionSx/defaultSxConfig.js +3 -0
- package/node/styleFunctionSx/styleFunctionSx.js +2 -1
- package/package.json +5 -5
- package/styleFunctionSx/defaultSxConfig.js +3 -0
- package/styleFunctionSx/styleFunctionSx.js +2 -1
- package/legacy/Box/Box.js +0 -30
- package/legacy/Box/boxClasses.js +0 -3
- package/legacy/Box/index.js +0 -5
- package/legacy/Container/Container.js +0 -61
- package/legacy/Container/ContainerProps.js +0 -1
- package/legacy/Container/containerClasses.js +0 -7
- package/legacy/Container/createContainer.js +0 -140
- package/legacy/Container/index.js +0 -5
- package/legacy/GlobalStyles/GlobalStyles.js +0 -37
- package/legacy/GlobalStyles/index.js +0 -4
- package/legacy/RtlProvider/index.js +0 -22
- package/legacy/Stack/Stack.js +0 -62
- package/legacy/Stack/StackProps.js +0 -1
- package/legacy/Stack/createStack.js +0 -180
- package/legacy/Stack/index.js +0 -7
- package/legacy/Stack/stackClasses.js +0 -7
- package/legacy/ThemeProvider/ThemeProvider.js +0 -87
- package/legacy/ThemeProvider/index.js +0 -3
- package/legacy/Unstable_Grid/Grid.js +0 -177
- package/legacy/Unstable_Grid/GridProps.js +0 -1
- package/legacy/Unstable_Grid/createGrid.js +0 -184
- package/legacy/Unstable_Grid/gridClasses.js +0 -28
- package/legacy/Unstable_Grid/gridGenerator.js +0 -216
- package/legacy/Unstable_Grid/index.js +0 -8
- package/legacy/Unstable_Grid/traverseBreakpoints.js +0 -48
- package/legacy/borders/borders.js +0 -51
- package/legacy/borders/index.js +0 -4
- package/legacy/breakpoints/breakpoints.js +0 -162
- package/legacy/breakpoints/index.js +0 -4
- package/legacy/colorManipulator/colorManipulator.js +0 -356
- package/legacy/colorManipulator/index.js +0 -3
- package/legacy/compose/compose.js +0 -32
- package/legacy/compose/index.js +0 -3
- package/legacy/createBox/createBox.js +0 -38
- package/legacy/createBox/index.js +0 -3
- package/legacy/createStyled/createStyled.js +0 -250
- package/legacy/createStyled/index.js +0 -4
- package/legacy/createTheme/applyStyles.js +0 -73
- package/legacy/createTheme/createBreakpoints.js +0 -83
- package/legacy/createTheme/createSpacing.js +0 -32
- package/legacy/createTheme/createTheme.js +0 -49
- package/legacy/createTheme/index.js +0 -3
- package/legacy/createTheme/shape.js +0 -4
- package/legacy/cssGrid/cssGrid.js +0 -91
- package/legacy/cssGrid/index.js +0 -4
- package/legacy/cssVars/createCssVarsProvider.js +0 -338
- package/legacy/cssVars/createCssVarsTheme.js +0 -13
- package/legacy/cssVars/createGetCssVar.js +0 -30
- package/legacy/cssVars/cssVarsParser.js +0 -141
- package/legacy/cssVars/getInitColorSchemeScript.js +0 -28
- package/legacy/cssVars/index.js +0 -6
- package/legacy/cssVars/prepareCssVars.js +0 -92
- package/legacy/cssVars/useCurrentColorScheme.js +0 -237
- package/legacy/display/display.js +0 -29
- package/legacy/display/index.js +0 -4
- package/legacy/flexbox/flexbox.js +0 -43
- package/legacy/flexbox/index.js +0 -4
- package/legacy/getThemeValue/getThemeValue.js +0 -47
- package/legacy/getThemeValue/index.js +0 -4
- package/legacy/index.js +0 -72
- package/legacy/memoize/index.js +0 -3
- package/legacy/memoize/memoize.js +0 -9
- package/legacy/merge/index.js +0 -3
- package/legacy/merge/merge.js +0 -10
- package/legacy/palette/index.js +0 -4
- package/legacy/palette/palette.js +0 -26
- package/legacy/positions/index.js +0 -4
- package/legacy/positions/positions.js +0 -22
- package/legacy/propsToClassKey/index.js +0 -3
- package/legacy/propsToClassKey/propsToClassKey.js +0 -24
- package/legacy/responsivePropType/index.js +0 -3
- package/legacy/responsivePropType/responsivePropType.js +0 -3
- package/legacy/shadows/index.js +0 -3
- package/legacy/shadows/shadows.js +0 -6
- package/legacy/sizing/index.js +0 -4
- package/legacy/sizing/sizing.js +0 -65
- package/legacy/spacing/index.js +0 -4
- package/legacy/spacing/spacing.js +0 -161
- package/legacy/style/index.js +0 -4
- package/legacy/style/style.js +0 -73
- package/legacy/styleFunctionSx/defaultSxConfig.js +0 -293
- package/legacy/styleFunctionSx/extendSxProp.js +0 -45
- package/legacy/styleFunctionSx/index.js +0 -4
- package/legacy/styleFunctionSx/styleFunctionSx.js +0 -126
- package/legacy/styled/index.js +0 -3
- package/legacy/styled/styled.js +0 -3
- package/legacy/typography/index.js +0 -4
- package/legacy/typography/typography.js +0 -37
- package/legacy/useMediaQuery/index.js +0 -2
- package/legacy/useMediaQuery/useMediaQuery.js +0 -145
- package/legacy/useTheme/index.js +0 -4
- package/legacy/useTheme/useTheme.js +0 -10
- package/legacy/useThemeProps/getThemeProps.js +0 -10
- package/legacy/useThemeProps/index.js +0 -4
- package/legacy/useThemeProps/useThemeProps.js +0 -20
- package/legacy/useThemeWithoutDefault/index.js +0 -3
- package/legacy/useThemeWithoutDefault/useThemeWithoutDefault.js +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,172 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## v6.0.0-alpha.4
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v6.0.0-alpha.3..next -->
|
|
6
|
+
|
|
7
|
+
_Apr 24, 2024_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
|
|
10
|
+
|
|
11
|
+
- 🔥 Converted 3 more Material UI components to use Pigment CSS.
|
|
12
|
+
- ℹ️ Pigment CSS now lives in [its own repository](https://github.com/mui/pigment-css)! From now on, all future development will happen there.
|
|
13
|
+
|
|
14
|
+
### `@mui/material@6.0.0-alpha.4`
|
|
15
|
+
|
|
16
|
+
- [Checkbox] Convert to support CSS extraction (#41957) @lhilgert9
|
|
17
|
+
- [IconButton] Convert to support CSS extraction (#41850) @gijsbotje
|
|
18
|
+
- [Radio] Convert to support CSS extraction (#41840) @lhilgert9
|
|
19
|
+
- [Typography] Fix ownerState prop placement (#41903) @sai6855
|
|
20
|
+
- Generate typography tokens (#41703) @siriwatknp
|
|
21
|
+
- Move typography CSS variables to `font` (#42003) @siriwatknp
|
|
22
|
+
- Fix getOverlayAlpha type (#41995) @oliviertassinari
|
|
23
|
+
- Support CSS Extraction using codemod (#41935) @siriwatknp
|
|
24
|
+
|
|
25
|
+
### `@mui/icons-material@6.0.0-alpha.4`
|
|
26
|
+
|
|
27
|
+
- ​<!-- 08 -->[icons] Update the icons package (#41937) @danilo-leal
|
|
28
|
+
|
|
29
|
+
### Docs
|
|
30
|
+
|
|
31
|
+
- [material-ui] Remove react-swipeable-views from demos as it's no longer maintained (#41912) @soler1212
|
|
32
|
+
- [material-ui] Add dark theme thumbnails for templates (#41947) @zanivan
|
|
33
|
+
- [material-ui] Remove links and interdependencies from free templates (#41941) @zanivan
|
|
34
|
+
- [material-ui] Add missing backticks to HTML tag in the installation page (#41972) @Miguelrom
|
|
35
|
+
- Fix 301 Toolpad links @oliviertassinari
|
|
36
|
+
- Fix 301 image redirections @oliviertassinari
|
|
37
|
+
|
|
38
|
+
### Core
|
|
39
|
+
|
|
40
|
+
- pnpm docs:zipRules && vale sync @oliviertassinari
|
|
41
|
+
- Remove @pigment-css/\* packages (#41965) @mnajdova
|
|
42
|
+
- [code-infra] Move the HighlightedCode component to @mui/docs (#41859) @Janpot
|
|
43
|
+
- [code-infra] Move the HighlightedCode component to @mui/docs (#41859) @Janpot
|
|
44
|
+
- [code-infra] Make Babel config path configurable in API docs builder (#41999) @michaldudak
|
|
45
|
+
- [docs-infra] Fix flex-shrink pro-plan (#41990) @oliviertassinari
|
|
46
|
+
- [docs-infra] Allow more value uses of MUI (#41706) @oliviertassinari
|
|
47
|
+
- [docs-infra] Move CPU to shared config (#41901) @oliviertassinari
|
|
48
|
+
- [docs-infra] Improve Twitter OG:image (#41860) @oliviertassinari
|
|
49
|
+
- [docs-infra] Adapt docs infra to Base UI docs needs (#41963) @michaldudak
|
|
50
|
+
- [docs-infra] Add demo container design refinements (#41948) @danilo-leal
|
|
51
|
+
- [docs-infra] Use the `getLayout` on the material demo pages (#41936) @alexfauquette
|
|
52
|
+
- [test] Update browser versions in karma config (#42008) @ZeeshanTamboli
|
|
53
|
+
- [website] Remove customer support agent role from website (#41969) @rluzists1
|
|
54
|
+
- [website] Fix grid usage and add stray improvements (#41930) @danilo-leal
|
|
55
|
+
|
|
56
|
+
All contributors of this release in alphabetical order: @alexfauquette, @danilo-leal, @gijsbotje, @Janpot, @lhilgert9, @michaldudak, @Miguelrom, @mnajdova, @oliviertassinari, @rluzists1, @sai6855, @siriwatknp, @soler1212, @zanivan, @ZeeshanTamboli
|
|
57
|
+
|
|
58
|
+
## v6.0.0-alpha.3
|
|
59
|
+
|
|
60
|
+
<!-- generated comparing v6.0.0-alpha.2..next -->
|
|
61
|
+
|
|
62
|
+
_Apr 17, 2024_
|
|
63
|
+
|
|
64
|
+
A big thanks to the 24 contributors who made this release possible. Here are some highlights ✨:
|
|
65
|
+
|
|
66
|
+
- 🔥 Converted 5 more Material UI components to use Pigment CSS.
|
|
67
|
+
- 🚀 Added container queries utility to the `@mui/system` package (#41674) @siriwatknp.
|
|
68
|
+
|
|
69
|
+
### `@mui/material@6.0.0-alpha.3`
|
|
70
|
+
|
|
71
|
+
- Convert `LinearProgress` to support Pigment CSS (#41816) @siriwatknp
|
|
72
|
+
- [Dialog] Prevent onClick on the root element from being overwritten (#41881) @ryanburr
|
|
73
|
+
- [FloatingActionButton] Convert to support CSS extraction (#41851) @gijsbotje
|
|
74
|
+
- Convert `CircularProgress` to support Pigment CSS (#41776) @siriwatknp
|
|
75
|
+
- [PaginationItem] Convert to support CSS extraction (#41848) @gijsbotje
|
|
76
|
+
- [StepConnector] deprecate composed classes (#41740) @sai6855
|
|
77
|
+
- [StepLabel] Deprecate `StepIconComponent`, `StepIconProps` (#41835) @sai6855
|
|
78
|
+
- [ToggleButton] Convert to support CSS extraction (#41782) @lhilgert9
|
|
79
|
+
- [ToggleButtonGroup] Deprecate composed classes (#41288) @sai6855
|
|
80
|
+
- [Typography] Fix Typography inherit variant styles (#41308) @kealjones-wk
|
|
81
|
+
|
|
82
|
+
### `@mui/system@6.0.0-alpha.3`
|
|
83
|
+
|
|
84
|
+
- Add container queries utility (#41674) @siriwatknp
|
|
85
|
+
|
|
86
|
+
### `@mui/codemod@6.0.0-alpha.3`
|
|
87
|
+
|
|
88
|
+
- Add styled v6 transformation (#41743) @siriwatknp
|
|
89
|
+
|
|
90
|
+
### `@mui/joy@5.0.0-beta.36`
|
|
91
|
+
|
|
92
|
+
- [Button] Disable text highlighting (#41902) @mithun522
|
|
93
|
+
|
|
94
|
+
### `@pigment-css/react@0.0.7`
|
|
95
|
+
|
|
96
|
+
- Patch WyW's WeakRef usage (#41909) @DiegoAndai
|
|
97
|
+
- Implement sx transform for system components (#41861) @brijeshb42
|
|
98
|
+
|
|
99
|
+
### Docs
|
|
100
|
+
|
|
101
|
+
- [material-ui] Add Connect-related content (#40848) @danilo-leal
|
|
102
|
+
- [material-ui] Fix credit comment typo (#41872) @aarongarciah
|
|
103
|
+
- [material-ui] Remove Data Grid v7 beta callout (#41839) @cherniavskii
|
|
104
|
+
- [material-ui] Add stray design tweaks to free templates (#41696) @zanivan
|
|
105
|
+
- [material-ui] Simplify components styling on templates (#41845) @zanivan
|
|
106
|
+
- [material-ui][Button] Add `onChange` event handler to file upload example (#41863) @aarongarciah
|
|
107
|
+
- [material-ui] Fix import statement in migration guide (#41852) @sai6855
|
|
108
|
+
- Fix 301 redirection @oliviertassinari
|
|
109
|
+
- Fix format git diff regression (#41882) @oliviertassinari
|
|
110
|
+
- Fix small SEO issues @oliviertassinari
|
|
111
|
+
- [pigment-css] Fix README typos (#41870) @MohammadShehadeh
|
|
112
|
+
|
|
113
|
+
### Core
|
|
114
|
+
|
|
115
|
+
- Begin removing IE 11-related code (#41709) @iammminzzy
|
|
116
|
+
- [blog] Add post to introduce the Connect plugin (#41763) @danilo-leal
|
|
117
|
+
- [code-infra] Fix require.context with aliases (#41682) @Janpot
|
|
118
|
+
- [code-infra] Allow customizing hooks imports in API docs generator (#41828) @michaldudak
|
|
119
|
+
- [codemod] Add utils for `*Component` and `*Props` props deprecations (#41685) @DiegoAndai
|
|
120
|
+
- Replace bundle size reporter filter (#38979) @Janpot
|
|
121
|
+
- [docs-infra] Make the whole header clickable (#39603) @MoazMirza-13
|
|
122
|
+
- [docs-infra] Improve demo container and related components design (#41827) @danilo-leal
|
|
123
|
+
- [docs-infra] Use edge function for card generation (#41188) (#41836) @alexfauquette
|
|
124
|
+
- [docs-infra] Fix code block layout shift (#41917) @oliviertassinari
|
|
125
|
+
- [docs-infra] Fine-tune the OG card image design (#41862) @danilo-leal
|
|
126
|
+
- [docs-infra] Fix markdown version for material (#41908) @alexfauquette
|
|
127
|
+
- [docs-infra] Support multiple tabs in demos (#40901) @bharatkashyap
|
|
128
|
+
|
|
129
|
+
All contributors of this release in alphabetical order: @aarongarciah, @alexfauquette, @bharatkashyap, @brijeshb42, @cherniavskii, @danilo-leal, @DiegoAndai, @EyaOuenniche, @gijsbotje, @iammminzzy, @Janpot, @kealjones-wk, @lhilgert9, @magnimarels, @michaldudak, @mithun522, @mnajdova, @MoazMirza-13, @MohammadShehadeh, @oliviertassinari, @ryanburr, @sai6855, @siriwatknp, @zanivan
|
|
130
|
+
|
|
131
|
+
## v6.0.0-alpha.2
|
|
132
|
+
|
|
133
|
+
<!-- generated comparing v6.0.0-alpha.1..next -->
|
|
134
|
+
|
|
135
|
+
_Apr 9, 2024_
|
|
136
|
+
|
|
137
|
+
A big thanks to the 5 contributors who made this release possible.
|
|
138
|
+
This release was mostly about 🐛 bug fixes and 📚 documentation improvements.
|
|
139
|
+
|
|
140
|
+
### `@mui/material@6.0.0-alpha.2`
|
|
141
|
+
|
|
142
|
+
- ​<!-- 03 -->[typescript][Select] Fix `muiName` property TypeScript error (#41726) @EyaOuenniche
|
|
143
|
+
- ​<!-- 04 -->[l10n] Fix typo in is-IS locale (#41810) @magnimarels
|
|
144
|
+
|
|
145
|
+
### `@pigment-css/react@0.0.6`
|
|
146
|
+
|
|
147
|
+
- ​<!-- 12 -->[core] Remove `muiName` during eval phase (#41811) @brijeshb42
|
|
148
|
+
|
|
149
|
+
### `@pigment-css/nextjs-plugin@0.0.6`
|
|
150
|
+
|
|
151
|
+
- ​<!-- 02 -->[nextjs] Handle file references passed through imports (#41817) @brijeshb42
|
|
152
|
+
- ​<!-- 01 -->[nextjs] Allow usage of url() CSS function (#41758) @brijeshb42
|
|
153
|
+
|
|
154
|
+
### Docs
|
|
155
|
+
|
|
156
|
+
- ​<!-- 11 -->[docs] Fix 301 links @oliviertassinari
|
|
157
|
+
- ​<!-- 06 -->[pigment-css][docs] Fix README typo (#41808) @aarongarciah
|
|
158
|
+
- ​<!-- 05 -->[pigment-css][docs] Fix output on dynamic styles example (#41805) @aarongarciah
|
|
159
|
+
- ​<!-- 07 -->[material-ui][docs] Fix Material 3 message typo (#41821) @aarongarciah
|
|
160
|
+
- ​<!-- 08 -->[material-ui][docs] Add stray design tweaks to free templates (#41696) @zanivan
|
|
161
|
+
|
|
162
|
+
### Core
|
|
163
|
+
|
|
164
|
+
- ​<!-- 13 -->[core] Remove unused files (#41818) @mnajdova
|
|
165
|
+
- ​<!-- 10 -->[docs-infra] Fix analytics about inline ads (#41474) (#41819) @alexfauquette
|
|
166
|
+
- ​<!-- 08 -->[docs-infra] Fix drawer performances (#41807) @alexfauquette
|
|
167
|
+
|
|
168
|
+
All contributors of this release in alphabetical order: @aarongarciah, @alexfauquette, @brijeshb42, @EyaOuenniche, @oliviertassinari
|
|
169
|
+
|
|
3
170
|
## v6.0.0-alpha.1
|
|
4
171
|
|
|
5
172
|
<!-- generated comparing v6.0.0-alpha.0..next -->
|
|
@@ -8128,7 +8295,7 @@ A big thanks to the 25 contributors who made this release possible. Here are som
|
|
|
8128
8295
|
|
|
8129
8296
|
<a href="https://mui.com/components/tables/#unstyled-table"><img width="800" alt="unstyled table" src="https://user-images.githubusercontent.com/4512430/144862194-584356ef-7d9d-462c-a631-186a7e716193.png"></a>
|
|
8130
8297
|
|
|
8131
|
-
You can follow our progress with unstyled components at https://github.com/mui/
|
|
8298
|
+
You can follow our progress with unstyled components at https://github.com/mui/base-ui/issues/10.
|
|
8132
8299
|
|
|
8133
8300
|
- 🎉 We have added an example of how to use MUI with [Remix](https://remix.run/) (#29952) @mnajdova
|
|
8134
8301
|
|
|
@@ -9598,7 +9765,7 @@ A big thanks to the 17 contributors who made this release possible. Here are som
|
|
|
9598
9765
|
|
|
9599
9766
|
<a href="https://mui.com/components/switches/#unstyled"><img width="832" alt="switch" src="https://user-images.githubusercontent.com/3165635/125192249-236f8a80-e247-11eb-9df9-17d476379a32.png"></a>
|
|
9600
9767
|
|
|
9601
|
-
You can follow our progress at https://github.com/mui/
|
|
9768
|
+
You can follow our progress at https://github.com/mui/base-ui/issues/10.
|
|
9602
9769
|
|
|
9603
9770
|
- 💄 We have updated the default `info` `success` `warning` color to be more accessible (#26817) @siriwatknp.
|
|
9604
9771
|
You can find the new [default values](https://mui.com/material-ui/customization/palette/#default-values) in the documentation.
|
package/Container/Container.d.ts
CHANGED
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
*
|
|
10
10
|
* - [Container API](https://mui.com/system/api/container/)
|
|
11
11
|
*/
|
|
12
|
-
declare const Container: import("@mui/types").OverridableComponent<import("
|
|
12
|
+
declare const Container: import("@mui/types").OverridableComponent<import("./ContainerProps").ContainerTypeMap<{}, "div">>;
|
|
13
13
|
export default Container;
|
package/Stack/Stack.d.ts
CHANGED
|
@@ -10,5 +10,5 @@
|
|
|
10
10
|
*
|
|
11
11
|
* - [Stack API](https://mui.com/system/api/stack/)
|
|
12
12
|
*/
|
|
13
|
-
declare const Stack: import("@mui/types").OverridableComponent<import("
|
|
13
|
+
declare const Stack: import("@mui/types").OverridableComponent<import("./StackProps").StackTypeMap<{}, "div">>;
|
|
14
14
|
export default Stack;
|
package/Stack/createStack.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ interface StyleFunctionProps {
|
|
|
10
10
|
};
|
|
11
11
|
ownerState: StackOwnerState;
|
|
12
12
|
}
|
|
13
|
-
declare const defaultCreateStyledComponent: import("@mui/styled-engine").CreateStyledComponent<import("
|
|
13
|
+
declare const defaultCreateStyledComponent: import("@mui/styled-engine").CreateStyledComponent<import("../createStyled").MUIStyledCommonProps<any>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}, any>;
|
|
14
14
|
declare function useThemePropsDefault<T extends {}>(props: T): T;
|
|
15
15
|
export declare const style: ({ ownerState, theme }: StyleFunctionProps) => any;
|
|
16
16
|
export default function createStack(options?: {
|
package/Unstable_Grid/Grid.d.ts
CHANGED
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
*
|
|
10
10
|
* - [Grid API](https://mui.com/system/api/grid/)
|
|
11
11
|
*/
|
|
12
|
-
declare const Grid: import("@mui/types").OverridableComponent<import("
|
|
12
|
+
declare const Grid: import("@mui/types").OverridableComponent<import("./GridProps").GridTypeMap<{}, "div">>;
|
|
13
13
|
export default Grid;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { OverridableComponent } from '@mui/types';
|
|
3
3
|
import { GridTypeMap } from './GridProps';
|
|
4
|
-
declare const defaultCreateStyledComponent: import("@mui/styled-engine").CreateStyledComponent<import("
|
|
4
|
+
declare const defaultCreateStyledComponent: import("@mui/styled-engine").CreateStyledComponent<import("../createStyled").MUIStyledCommonProps<any>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}, any>;
|
|
5
5
|
declare function useThemePropsDefault<T extends {}>(props: T): T;
|
|
6
6
|
export default function createGrid(options?: {
|
|
7
7
|
createStyledComponent?: typeof defaultCreateStyledComponent;
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import deepmerge from '@mui/utils/deepmerge';
|
|
4
4
|
import merge from '../merge';
|
|
5
|
+
import { isCqShorthand, getContainerQuery } from '../cssContainerQueries';
|
|
5
6
|
|
|
6
7
|
// The breakpoint **start** at this value.
|
|
7
8
|
// For instance with the first breakpoint xs: [xs, sm[.
|
|
@@ -22,6 +23,17 @@ const defaultBreakpoints = {
|
|
|
22
23
|
keys: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
23
24
|
up: key => `@media (min-width:${values[key]}px)`
|
|
24
25
|
};
|
|
26
|
+
const defaultContainerQueries = {
|
|
27
|
+
containerQueries: containerName => ({
|
|
28
|
+
up: key => {
|
|
29
|
+
let result = typeof key === 'number' ? key : values[key] || key;
|
|
30
|
+
if (typeof result === 'number') {
|
|
31
|
+
result = `${result}px`;
|
|
32
|
+
}
|
|
33
|
+
return containerName ? `@container ${containerName} (min-width:${result})` : `@container (min-width:${result})`;
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
};
|
|
25
37
|
export function handleBreakpoints(props, propValue, styleFromPropValue) {
|
|
26
38
|
const theme = props.theme || {};
|
|
27
39
|
if (Array.isArray(propValue)) {
|
|
@@ -34,8 +46,14 @@ export function handleBreakpoints(props, propValue, styleFromPropValue) {
|
|
|
34
46
|
if (typeof propValue === 'object') {
|
|
35
47
|
const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
|
|
36
48
|
return Object.keys(propValue).reduce((acc, breakpoint) => {
|
|
49
|
+
if (isCqShorthand(themeBreakpoints.keys, breakpoint)) {
|
|
50
|
+
const containerKey = getContainerQuery(theme.containerQueries ? theme : defaultContainerQueries, breakpoint);
|
|
51
|
+
if (containerKey) {
|
|
52
|
+
acc[containerKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
37
55
|
// key is breakpoint
|
|
38
|
-
if (Object.keys(themeBreakpoints.values || values).indexOf(breakpoint) !== -1) {
|
|
56
|
+
else if (Object.keys(themeBreakpoints.values || values).indexOf(breakpoint) !== -1) {
|
|
39
57
|
const mediaKey = themeBreakpoints.up(breakpoint);
|
|
40
58
|
acc[mediaKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
|
|
41
59
|
} else {
|
|
@@ -4,6 +4,7 @@ import { Shape, ShapeOptions } from './shape';
|
|
|
4
4
|
import { Spacing, SpacingOptions } from './createSpacing';
|
|
5
5
|
import { SxConfig, SxProps } from '../styleFunctionSx';
|
|
6
6
|
import { ApplyStyles } from './applyStyles';
|
|
7
|
+
import { CssContainerQueries } from '../cssContainerQueries';
|
|
7
8
|
|
|
8
9
|
export { Breakpoint, BreakpointOverrides } from './createBreakpoints';
|
|
9
10
|
|
|
@@ -24,7 +25,7 @@ export interface ThemeOptions {
|
|
|
24
25
|
unstable_sxConfig?: SxConfig;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
export interface Theme {
|
|
28
|
+
export interface Theme extends CssContainerQueries {
|
|
28
29
|
shape: Shape;
|
|
29
30
|
breakpoints: Breakpoints;
|
|
30
31
|
direction: Direction;
|
|
@@ -3,6 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["breakpoints", "palette", "spacing", "shape"];
|
|
4
4
|
import deepmerge from '@mui/utils/deepmerge';
|
|
5
5
|
import createBreakpoints from './createBreakpoints';
|
|
6
|
+
import cssContainerQueries from '../cssContainerQueries';
|
|
6
7
|
import shape from './shape';
|
|
7
8
|
import createSpacing from './createSpacing';
|
|
8
9
|
import styleFunctionSx from '../styleFunctionSx/styleFunctionSx';
|
|
@@ -29,6 +30,7 @@ function createTheme(options = {}, ...args) {
|
|
|
29
30
|
spacing,
|
|
30
31
|
shape: _extends({}, shape, shapeInput)
|
|
31
32
|
}, other);
|
|
33
|
+
muiTheme = cssContainerQueries(muiTheme);
|
|
32
34
|
muiTheme.applyStyles = applyStyles;
|
|
33
35
|
muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
|
|
34
36
|
muiTheme.unstable_sxConfig = _extends({}, defaultSxConfig, other?.unstable_sxConfig);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Breakpoints } from '../createTheme/createBreakpoints';
|
|
2
|
+
interface ContainerQueries {
|
|
3
|
+
up: Breakpoints['up'];
|
|
4
|
+
down: Breakpoints['down'];
|
|
5
|
+
between: Breakpoints['between'];
|
|
6
|
+
only: Breakpoints['only'];
|
|
7
|
+
not: Breakpoints['not'];
|
|
8
|
+
}
|
|
9
|
+
export interface CssContainerQueries {
|
|
10
|
+
containerQueries: ((name: string) => ContainerQueries) & ContainerQueries;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* For using in `sx` prop to sort the breakpoint from low to high.
|
|
14
|
+
* Note: this function does not work and will not support multiple units.
|
|
15
|
+
* e.g. input: { '@container (min-width:300px)': '1rem', '@container (min-width:40rem)': '2rem' }
|
|
16
|
+
* output: { '@container (min-width:40rem)': '2rem', '@container (min-width:300px)': '1rem' } // since 40 < 300 eventhough 40rem > 300px
|
|
17
|
+
*/
|
|
18
|
+
export declare function sortContainerQueries(theme: Partial<CssContainerQueries>, css: Record<string, any>): Record<string, any>;
|
|
19
|
+
export declare function isCqShorthand(breakpointKeys: string[], value: string): boolean;
|
|
20
|
+
export declare function getContainerQuery(theme: CssContainerQueries, shorthand: string): string | null;
|
|
21
|
+
export default function cssContainerQueries<T extends {
|
|
22
|
+
breakpoints: Breakpoints;
|
|
23
|
+
}>(themeInput: T): T & CssContainerQueries;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
|
3
|
+
/**
|
|
4
|
+
* For using in `sx` prop to sort the breakpoint from low to high.
|
|
5
|
+
* Note: this function does not work and will not support multiple units.
|
|
6
|
+
* e.g. input: { '@container (min-width:300px)': '1rem', '@container (min-width:40rem)': '2rem' }
|
|
7
|
+
* output: { '@container (min-width:40rem)': '2rem', '@container (min-width:300px)': '1rem' } // since 40 < 300 eventhough 40rem > 300px
|
|
8
|
+
*/
|
|
9
|
+
export function sortContainerQueries(theme, css) {
|
|
10
|
+
if (!theme.containerQueries) {
|
|
11
|
+
return css;
|
|
12
|
+
}
|
|
13
|
+
const sorted = Object.keys(css).filter(key => key.startsWith('@container')).sort((a, b) => {
|
|
14
|
+
const regex = /min-width:\s*([0-9.]+)/;
|
|
15
|
+
return +(a.match(regex)?.[1] || 0) - +(b.match(regex)?.[1] || 0);
|
|
16
|
+
});
|
|
17
|
+
if (!sorted.length) {
|
|
18
|
+
return css;
|
|
19
|
+
}
|
|
20
|
+
return sorted.reduce((acc, key) => {
|
|
21
|
+
const value = css[key];
|
|
22
|
+
delete acc[key];
|
|
23
|
+
acc[key] = value;
|
|
24
|
+
return acc;
|
|
25
|
+
}, _extends({}, css));
|
|
26
|
+
}
|
|
27
|
+
export function isCqShorthand(breakpointKeys, value) {
|
|
28
|
+
return value.startsWith('@') && (breakpointKeys.some(key => value.startsWith(`@${key}`)) || !!value.match(/^@\d/));
|
|
29
|
+
}
|
|
30
|
+
export function getContainerQuery(theme, shorthand) {
|
|
31
|
+
const matches = shorthand.match(/^@([^/]+)\/?(.+)?$/);
|
|
32
|
+
if (!matches) {
|
|
33
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
34
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.
|
|
35
|
+
For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.` : _formatMuiErrorMessage(21, `(${shorthand})`));
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const [, containerQuery, containerName] = matches;
|
|
40
|
+
const value = Number.isNaN(+containerQuery) ? containerQuery : +containerQuery;
|
|
41
|
+
return theme.containerQueries(containerName).up(value);
|
|
42
|
+
}
|
|
43
|
+
export default function cssContainerQueries(themeInput) {
|
|
44
|
+
const toContainerQuery = (mediaQuery, name) => mediaQuery.replace('@media', name ? `@container ${name}` : '@container');
|
|
45
|
+
function attachCq(node, name) {
|
|
46
|
+
node.up = (...args) => toContainerQuery(themeInput.breakpoints.up(...args), name);
|
|
47
|
+
node.down = (...args) => toContainerQuery(themeInput.breakpoints.down(...args), name);
|
|
48
|
+
node.between = (...args) => toContainerQuery(themeInput.breakpoints.between(...args), name);
|
|
49
|
+
node.only = (...args) => toContainerQuery(themeInput.breakpoints.only(...args), name);
|
|
50
|
+
node.not = (...args) => {
|
|
51
|
+
const result = toContainerQuery(themeInput.breakpoints.not(...args), name);
|
|
52
|
+
if (result.includes('not all and')) {
|
|
53
|
+
// `@container` does not work with `not all and`, so need to invert the logic
|
|
54
|
+
return result.replace('not all and ', '').replace('min-width:', 'width<').replace('max-width:', 'width>');
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const node = {};
|
|
60
|
+
const containerQueries = name => {
|
|
61
|
+
attachCq(node, name);
|
|
62
|
+
return node;
|
|
63
|
+
};
|
|
64
|
+
attachCq(containerQueries);
|
|
65
|
+
return _extends({}, themeInput, {
|
|
66
|
+
containerQueries
|
|
67
|
+
});
|
|
68
|
+
}
|
|
@@ -30,7 +30,7 @@ export declare const assignNestedKeys: <T extends string | Record<string, any> |
|
|
|
30
30
|
* walkObjectDeep({ palette: { primary: { main: '#000000' } } }, console.log)
|
|
31
31
|
* // ['palette', 'primary', 'main'] '#000000'
|
|
32
32
|
*/
|
|
33
|
-
export declare const walkObjectDeep: <Value, T = Record<string, any>>(obj: T, callback: (keys: Array<string>, value: Value, arrayKeys: Array<string>) => void, shouldSkipPaths?: (
|
|
33
|
+
export declare const walkObjectDeep: <Value, T = Record<string, any>>(obj: T, callback: (keys: Array<string>, value: Value, arrayKeys: Array<string>) => void, shouldSkipPaths?: (keys: Array<string>) => boolean) => void;
|
|
34
34
|
/**
|
|
35
35
|
* a function that parse theme and return { css, vars }
|
|
36
36
|
*
|
package/cssVars/index.d.ts
CHANGED
|
@@ -2,4 +2,6 @@ export { default } from './createCssVarsProvider';
|
|
|
2
2
|
export type { CreateCssVarsProviderResult, CssVarsProviderConfig, ColorSchemeContextValue, } from './createCssVarsProvider';
|
|
3
3
|
export { default as getInitColorSchemeScript } from './getInitColorSchemeScript';
|
|
4
4
|
export { default as prepareCssVars } from './prepareCssVars';
|
|
5
|
+
export { default as prepareTypographyVars } from './prepareTypographyVars';
|
|
6
|
+
export type { ExtractTypographyTokens } from './prepareTypographyVars';
|
|
5
7
|
export { default as createCssVarsTheme } from './createCssVarsTheme';
|
package/cssVars/index.js
CHANGED
|
@@ -3,4 +3,5 @@
|
|
|
3
3
|
export { default } from './createCssVarsProvider';
|
|
4
4
|
export { default as getInitColorSchemeScript } from './getInitColorSchemeScript';
|
|
5
5
|
export { default as prepareCssVars } from './prepareCssVars';
|
|
6
|
+
export { default as prepareTypographyVars } from './prepareTypographyVars';
|
|
6
7
|
export { default as createCssVarsTheme } from './createCssVarsTheme';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type RecordPropertyNames<T> = {
|
|
2
|
+
[K in keyof T]: T[K] extends Function ? never : T[K] extends Record<string, any> ? K : never;
|
|
3
|
+
}[keyof T];
|
|
4
|
+
export type ExtractTypographyTokens<T> = {
|
|
5
|
+
[K in RecordPropertyNames<T>]: string;
|
|
6
|
+
};
|
|
7
|
+
export default function prepareTypographyVars<T extends Record<string, any>>(typography: T): ExtractTypographyTokens<T>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default function prepareTypographyVars(typography) {
|
|
2
|
+
const vars = {};
|
|
3
|
+
const entries = Object.entries(typography);
|
|
4
|
+
entries.forEach(entry => {
|
|
5
|
+
const [key, value] = entry;
|
|
6
|
+
if (typeof value === 'object') {
|
|
7
|
+
vars[key] = `${value.fontStyle ? `${value.fontStyle} ` : ''}${value.fontVariant ? `${value.fontVariant} ` : ''}${value.fontWeight ? `${value.fontWeight} ` : ''}${value.fontStretch ? `${value.fontStretch} ` : ''}${value.fontSize || ''}${value.lineHeight ? `/${value.lineHeight} ` : ''}${value.fontFamily || ''}`;
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
return vars;
|
|
11
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export * from './borders';
|
|
|
5
5
|
|
|
6
6
|
export { default as breakpoints, handleBreakpoints, mergeBreakpointsInOrder } from './breakpoints';
|
|
7
7
|
|
|
8
|
+
export { default as cssContainerQueries, type CssContainerQueries } from './cssContainerQueries';
|
|
9
|
+
|
|
8
10
|
export { default as compose } from './compose';
|
|
9
11
|
|
|
10
12
|
export * from './display';
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/system v6.0.0-alpha.
|
|
2
|
+
* @mui/system v6.0.0-alpha.4
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -11,6 +11,7 @@ export { default as GlobalStyles } from './GlobalStyles';
|
|
|
11
11
|
export { default as borders } from './borders';
|
|
12
12
|
export * from './borders';
|
|
13
13
|
export { default as breakpoints } from './breakpoints';
|
|
14
|
+
export { default as cssContainerQueries } from './cssContainerQueries';
|
|
14
15
|
export { handleBreakpoints, mergeBreakpointsInOrder, resolveBreakpointValues as unstable_resolveBreakpointValues } from './breakpoints';
|
|
15
16
|
export { default as compose } from './compose';
|
|
16
17
|
export { default as display } from './display';
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import deepmerge from '@mui/utils/deepmerge';
|
|
4
4
|
import merge from '../merge';
|
|
5
|
+
import { isCqShorthand, getContainerQuery } from '../cssContainerQueries';
|
|
5
6
|
|
|
6
7
|
// The breakpoint **start** at this value.
|
|
7
8
|
// For instance with the first breakpoint xs: [xs, sm[.
|
|
@@ -22,6 +23,17 @@ const defaultBreakpoints = {
|
|
|
22
23
|
keys: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
23
24
|
up: key => `@media (min-width:${values[key]}px)`
|
|
24
25
|
};
|
|
26
|
+
const defaultContainerQueries = {
|
|
27
|
+
containerQueries: containerName => ({
|
|
28
|
+
up: key => {
|
|
29
|
+
let result = typeof key === 'number' ? key : values[key] || key;
|
|
30
|
+
if (typeof result === 'number') {
|
|
31
|
+
result = `${result}px`;
|
|
32
|
+
}
|
|
33
|
+
return containerName ? `@container ${containerName} (min-width:${result})` : `@container (min-width:${result})`;
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
};
|
|
25
37
|
export function handleBreakpoints(props, propValue, styleFromPropValue) {
|
|
26
38
|
const theme = props.theme || {};
|
|
27
39
|
if (Array.isArray(propValue)) {
|
|
@@ -34,8 +46,14 @@ export function handleBreakpoints(props, propValue, styleFromPropValue) {
|
|
|
34
46
|
if (typeof propValue === 'object') {
|
|
35
47
|
const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
|
|
36
48
|
return Object.keys(propValue).reduce((acc, breakpoint) => {
|
|
49
|
+
if (isCqShorthand(themeBreakpoints.keys, breakpoint)) {
|
|
50
|
+
const containerKey = getContainerQuery(theme.containerQueries ? theme : defaultContainerQueries, breakpoint);
|
|
51
|
+
if (containerKey) {
|
|
52
|
+
acc[containerKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
37
55
|
// key is breakpoint
|
|
38
|
-
if (Object.keys(themeBreakpoints.values || values).indexOf(breakpoint) !== -1) {
|
|
56
|
+
else if (Object.keys(themeBreakpoints.values || values).indexOf(breakpoint) !== -1) {
|
|
39
57
|
const mediaKey = themeBreakpoints.up(breakpoint);
|
|
40
58
|
acc[mediaKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
|
|
41
59
|
} else {
|
|
@@ -3,6 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["breakpoints", "palette", "spacing", "shape"];
|
|
4
4
|
import deepmerge from '@mui/utils/deepmerge';
|
|
5
5
|
import createBreakpoints from './createBreakpoints';
|
|
6
|
+
import cssContainerQueries from '../cssContainerQueries';
|
|
6
7
|
import shape from './shape';
|
|
7
8
|
import createSpacing from './createSpacing';
|
|
8
9
|
import styleFunctionSx from '../styleFunctionSx/styleFunctionSx';
|
|
@@ -29,6 +30,7 @@ function createTheme(options = {}, ...args) {
|
|
|
29
30
|
spacing,
|
|
30
31
|
shape: _extends({}, shape, shapeInput)
|
|
31
32
|
}, other);
|
|
33
|
+
muiTheme = cssContainerQueries(muiTheme);
|
|
32
34
|
muiTheme.applyStyles = applyStyles;
|
|
33
35
|
muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
|
|
34
36
|
muiTheme.unstable_sxConfig = _extends({}, defaultSxConfig, other?.unstable_sxConfig);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
|
3
|
+
/**
|
|
4
|
+
* For using in `sx` prop to sort the breakpoint from low to high.
|
|
5
|
+
* Note: this function does not work and will not support multiple units.
|
|
6
|
+
* e.g. input: { '@container (min-width:300px)': '1rem', '@container (min-width:40rem)': '2rem' }
|
|
7
|
+
* output: { '@container (min-width:40rem)': '2rem', '@container (min-width:300px)': '1rem' } // since 40 < 300 eventhough 40rem > 300px
|
|
8
|
+
*/
|
|
9
|
+
export function sortContainerQueries(theme, css) {
|
|
10
|
+
if (!theme.containerQueries) {
|
|
11
|
+
return css;
|
|
12
|
+
}
|
|
13
|
+
const sorted = Object.keys(css).filter(key => key.startsWith('@container')).sort((a, b) => {
|
|
14
|
+
const regex = /min-width:\s*([0-9.]+)/;
|
|
15
|
+
return +(a.match(regex)?.[1] || 0) - +(b.match(regex)?.[1] || 0);
|
|
16
|
+
});
|
|
17
|
+
if (!sorted.length) {
|
|
18
|
+
return css;
|
|
19
|
+
}
|
|
20
|
+
return sorted.reduce((acc, key) => {
|
|
21
|
+
const value = css[key];
|
|
22
|
+
delete acc[key];
|
|
23
|
+
acc[key] = value;
|
|
24
|
+
return acc;
|
|
25
|
+
}, _extends({}, css));
|
|
26
|
+
}
|
|
27
|
+
export function isCqShorthand(breakpointKeys, value) {
|
|
28
|
+
return value.startsWith('@') && (breakpointKeys.some(key => value.startsWith(`@${key}`)) || !!value.match(/^@\d/));
|
|
29
|
+
}
|
|
30
|
+
export function getContainerQuery(theme, shorthand) {
|
|
31
|
+
const matches = shorthand.match(/^@([^/]+)\/?(.+)?$/);
|
|
32
|
+
if (!matches) {
|
|
33
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
34
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.
|
|
35
|
+
For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.` : _formatMuiErrorMessage(21, `(${shorthand})`));
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const [, containerQuery, containerName] = matches;
|
|
40
|
+
const value = Number.isNaN(+containerQuery) ? containerQuery : +containerQuery;
|
|
41
|
+
return theme.containerQueries(containerName).up(value);
|
|
42
|
+
}
|
|
43
|
+
export default function cssContainerQueries(themeInput) {
|
|
44
|
+
const toContainerQuery = (mediaQuery, name) => mediaQuery.replace('@media', name ? `@container ${name}` : '@container');
|
|
45
|
+
function attachCq(node, name) {
|
|
46
|
+
node.up = (...args) => toContainerQuery(themeInput.breakpoints.up(...args), name);
|
|
47
|
+
node.down = (...args) => toContainerQuery(themeInput.breakpoints.down(...args), name);
|
|
48
|
+
node.between = (...args) => toContainerQuery(themeInput.breakpoints.between(...args), name);
|
|
49
|
+
node.only = (...args) => toContainerQuery(themeInput.breakpoints.only(...args), name);
|
|
50
|
+
node.not = (...args) => {
|
|
51
|
+
const result = toContainerQuery(themeInput.breakpoints.not(...args), name);
|
|
52
|
+
if (result.includes('not all and')) {
|
|
53
|
+
// `@container` does not work with `not all and`, so need to invert the logic
|
|
54
|
+
return result.replace('not all and ', '').replace('min-width:', 'width<').replace('max-width:', 'width>');
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const node = {};
|
|
60
|
+
const containerQueries = name => {
|
|
61
|
+
attachCq(node, name);
|
|
62
|
+
return node;
|
|
63
|
+
};
|
|
64
|
+
attachCq(containerQueries);
|
|
65
|
+
return _extends({}, themeInput, {
|
|
66
|
+
containerQueries
|
|
67
|
+
});
|
|
68
|
+
}
|
package/modern/cssVars/index.js
CHANGED
|
@@ -3,4 +3,5 @@
|
|
|
3
3
|
export { default } from './createCssVarsProvider';
|
|
4
4
|
export { default as getInitColorSchemeScript } from './getInitColorSchemeScript';
|
|
5
5
|
export { default as prepareCssVars } from './prepareCssVars';
|
|
6
|
+
export { default as prepareTypographyVars } from './prepareTypographyVars';
|
|
6
7
|
export { default as createCssVarsTheme } from './createCssVarsTheme';
|