@mui/docs 6.0.0-alpha.13 → 6.0.0-alpha.14

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,57 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## v6.0.0-alpha.14
4
+
5
+ <!-- generated comparing v6.0.0-alpha.13..next -->
6
+
7
+ _Jul 3, 2024_
8
+
9
+ A big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
10
+
11
+ - ✨ Updated Grid v2 to match PigmentGrid (#42742) @DiegoAndai
12
+
13
+ ### `@mui/material@v6.0.0-alpha.14`
14
+
15
+ #### BREAKING CHANGES
16
+
17
+ - [Grid] Update Grid props to match PigmentGrid (#42742) @DiegoAndai
18
+
19
+ Use the codemod below to migrate the props:
20
+
21
+ ```bash
22
+ npx @mui/codemod@next v6.0.0/grid-v2-props /path/to/folder
23
+ ```
24
+
25
+ #### Changes
26
+
27
+ - [Alert] Add ability to override slot props (#42787) @alexey-kozlenkov
28
+ - [Dialog] Revert incorrect textAlign style removal (#42778) @DiegoAndai
29
+ - [theme] Support `CssVarsTheme` in `responsiveFontSizes` return type (#42786) @jxdp
30
+
31
+ ### Docs
32
+
33
+ - [material-ui] Add some writing tweaks to v6 migration page (#42623) @danilo-leal
34
+ - [material-ui] Fix issues reported by react-compiler in docs folder (#42830) @sai6855
35
+ - [material-ui] Add some writing tweaks to v6 migration page (#42623) @danilo-leal
36
+ - [base-ui] Fix wrong description for `UseTabParameters.onChange` (#42749) @ohgree
37
+ - Fix 301 MDN redirections @oliviertassinari
38
+
39
+ ### Core
40
+
41
+ - [core] Bump React to 18.3.1 (#42047) @renovate[bot]
42
+ - [core] Revert lint for `useThemeProps` (#42817) @siriwatknp
43
+ - [core] Remove useIsFocusVisible util (#42467) @DiegoAndai
44
+ - [core] Remove react-test-renderer (#42784) @aarongarciah
45
+ - [core][mui-utils] Remove remaining IE11 references (#42777) @DiegoAndai
46
+ - [code-infra] Move `HighlightedCode` test into `@mui/docs` package (#42835) @LukasTy
47
+ - [code-infra] Cleanup `@mui/docs` usage and legacy re-exports (#42833) @LukasTy
48
+ - [docs-infra] Fix React Compiler ESLint issues in website components (#42566) @aarongarciah
49
+ - [docs-infra] Add batch of design polish (#42823) @danilo-leal
50
+ - [test][mui-utils] Remove usages of deprecated react-dom APIs (#42780) @aarongarciah
51
+ - [test][joy-ui][Autocomplete] Fix spread key error in test (#42775) @aarongarciah
52
+
53
+ All contributors of this release in alphabetical order: @aarongarciah, @alexey-kozlenkov, @danilo-leal, @DiegoAndai, @Janpot, @jxdp, @LukasTy, @ohgree, @oliviertassinari, @renovate[bot], @sai6855, @siriwatknp
54
+
3
55
  ## v6.0.0-alpha.13
4
56
 
5
57
  <!-- generated comparing v6.0.0-alpha.12..next -->
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+ export declare const CodeTabList: import("@mui/styled-engine").StyledComponent<import("@mui/base/TabsList").TabsListOwnProps & Omit<any, keyof import("@mui/base/TabsList").TabsListOwnProps> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
3
+ ownerState: {
4
+ mounted: boolean;
5
+ contained?: boolean;
6
+ };
7
+ }, {}, {}>;
8
+ export declare const CodeTabPanel: import("@mui/styled-engine").StyledComponent<import("@mui/base/TabPanel").TabPanelOwnProps & Omit<any, keyof import("@mui/base/TabPanel").TabPanelOwnProps> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
9
+ ownerState: {
10
+ mounted: boolean;
11
+ contained?: boolean;
12
+ };
13
+ }, {}, {}>;
14
+ export declare const CodeTab: import("@mui/styled-engine").StyledComponent<import("@mui/base/Tab").TabOwnProps & Omit<any, keyof import("@mui/base/Tab").TabOwnProps> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
15
+ ownerState: {
16
+ mounted: boolean;
17
+ contained?: boolean;
18
+ };
19
+ }, {}, {}>;
20
+ type TabsConfig = {
21
+ code: string | ((tab: string) => string);
22
+ language: string;
23
+ tab: string;
24
+ };
25
+ export declare function HighlightedCodeWithTabs(props: {
26
+ tabs: Array<TabsConfig>;
27
+ storageKey?: string;
28
+ } & Record<string, any>): React.JSX.Element;
29
+ export {};
@@ -0,0 +1,353 @@
1
+ import * as React from 'react';
2
+ import { styled, alpha } from '@mui/material/styles';
3
+ import { Tabs } from '@mui/base/Tabs';
4
+ import { TabsList as TabsListBase } from '@mui/base/TabsList';
5
+ import { TabPanel as TabPanelBase } from '@mui/base/TabPanel';
6
+ import { Tab as TabBase } from '@mui/base/Tab';
7
+ import useLocalStorageState from '@mui/utils/useLocalStorageState';
8
+ import { HighlightedCode } from './HighlightedCode';
9
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
+ export const CodeTabList = styled(TabsListBase)(({
11
+ theme
12
+ }) => ({
13
+ display: 'flex',
14
+ gap: theme.spacing(0.5),
15
+ borderLeft: '1px solid',
16
+ borderRight: '1px solid',
17
+ ...theme.applyDarkStyles({
18
+ backgroundColor: alpha(theme.palette.primaryDark[800], 0.2)
19
+ }),
20
+ variants: [{
21
+ props: ({
22
+ ownerState
23
+ }) => ownerState?.contained,
24
+ style: {
25
+ padding: theme.spacing(1.5, 1)
26
+ }
27
+ }, {
28
+ props: ({
29
+ ownerState
30
+ }) => !ownerState?.contained,
31
+ style: {
32
+ padding: theme.spacing(1)
33
+ }
34
+ }, {
35
+ props: ({
36
+ ownerState
37
+ }) => ownerState?.contained,
38
+ style: {
39
+ borderTop: 'none'
40
+ }
41
+ }, {
42
+ props: ({
43
+ ownerState
44
+ }) => !ownerState?.contained,
45
+ style: {
46
+ borderTop: '1px solid'
47
+ }
48
+ }, {
49
+ props: ({
50
+ ownerState
51
+ }) => ownerState?.contained,
52
+ style: {
53
+ borderBottom: 'none'
54
+ }
55
+ }, {
56
+ props: ({
57
+ ownerState
58
+ }) => !ownerState?.contained,
59
+ style: {
60
+ borderBottom: '1px solid'
61
+ }
62
+ }, {
63
+ props: ({
64
+ ownerState
65
+ }) => ownerState?.contained,
66
+ style: {
67
+ borderTopLeftRadius: 0
68
+ }
69
+ }, {
70
+ props: ({
71
+ ownerState
72
+ }) => !ownerState?.contained,
73
+ style: {
74
+ borderTopLeftRadius: (theme.vars || theme).shape.borderRadius
75
+ }
76
+ }, {
77
+ props: ({
78
+ ownerState
79
+ }) => ownerState?.contained,
80
+ style: {
81
+ borderTopRightRadius: 0
82
+ }
83
+ }, {
84
+ props: ({
85
+ ownerState
86
+ }) => !ownerState?.contained,
87
+ style: {
88
+ borderTopRightRadius: (theme.vars || theme).shape.borderRadius
89
+ }
90
+ }, {
91
+ props: ({
92
+ ownerState
93
+ }) => ownerState?.contained,
94
+ style: {
95
+ borderColor: (theme.vars || theme).palette.divider
96
+ }
97
+ }, {
98
+ props: ({
99
+ ownerState
100
+ }) => !ownerState?.contained,
101
+ style: {
102
+ borderColor: (theme.vars || theme).palette.primaryDark[700]
103
+ }
104
+ }, {
105
+ props: ({
106
+ ownerState
107
+ }) => ownerState?.contained,
108
+ style: {
109
+ backgroundColor: alpha(theme.palette.grey[50], 0.2)
110
+ }
111
+ }, {
112
+ props: ({
113
+ ownerState
114
+ }) => !ownerState?.contained,
115
+ style: {
116
+ backgroundColor: (theme.vars || theme).palette.primaryDark[900]
117
+ }
118
+ }]
119
+ }));
120
+ export const CodeTabPanel = styled(TabPanelBase)({
121
+ '& pre': {
122
+ borderTopLeftRadius: 0,
123
+ borderTopRightRadius: 0,
124
+ '& code': {}
125
+ },
126
+ variants: [{
127
+ props: ({
128
+ ownerState
129
+ }) => ownerState?.contained,
130
+ style: {
131
+ marginTop: -1
132
+ }
133
+ }, {
134
+ props: ({
135
+ ownerState
136
+ }) => !ownerState?.contained,
137
+ style: {
138
+ marginTop: 0
139
+ }
140
+ }, {
141
+ props: ({
142
+ ownerState
143
+ }) => ownerState?.contained,
144
+ style: {
145
+ '& pre': {
146
+ marginTop: 0
147
+ }
148
+ }
149
+ }, {
150
+ props: ({
151
+ ownerState
152
+ }) => !ownerState?.contained,
153
+ style: {
154
+ '& pre': {
155
+ marginTop: -1
156
+ }
157
+ }
158
+ }, {
159
+ props: ({
160
+ ownerState
161
+ }) => ownerState.mounted,
162
+ style: {
163
+ '& pre': {
164
+ '& code': {
165
+ opacity: 1
166
+ }
167
+ }
168
+ }
169
+ }, {
170
+ props: ({
171
+ ownerState
172
+ }) => !ownerState.mounted,
173
+ style: {
174
+ '& pre': {
175
+ '& code': {
176
+ opacity: 0
177
+ }
178
+ }
179
+ }
180
+ }]
181
+ });
182
+ export const CodeTab = styled(TabBase)(({
183
+ theme
184
+ }) => ({
185
+ variants: [{
186
+ props: ({
187
+ ownerState
188
+ }) => ownerState?.contained,
189
+ style: {
190
+ border: '1px solid transparent',
191
+ fontSize: theme.typography.pxToRem(13)
192
+ }
193
+ }, {
194
+ props: ({
195
+ ownerState
196
+ }) => !ownerState?.contained,
197
+ style: {
198
+ border: 'none',
199
+ fontSize: theme.typography.pxToRem(12)
200
+ }
201
+ }, {
202
+ props: ({
203
+ ownerState
204
+ }) => ownerState?.contained,
205
+ style: {
206
+ color: (theme.vars || theme).palette.text.tertiary
207
+ }
208
+ }, {
209
+ props: ({
210
+ ownerState
211
+ }) => !ownerState?.contained,
212
+ style: {
213
+ color: (theme.vars || theme).palette.grey[500]
214
+ }
215
+ }, {
216
+ props: ({
217
+ ownerState
218
+ }) => ownerState?.contained,
219
+ style: {
220
+ fontFamily: theme.typography.fontFamily
221
+ }
222
+ }, {
223
+ props: ({
224
+ ownerState
225
+ }) => !ownerState?.contained,
226
+ style: {
227
+ fontFamily: theme.typography.fontFamilyCode
228
+ }
229
+ }, {
230
+ props: ({
231
+ ownerState
232
+ }) => ownerState?.contained,
233
+ style: {
234
+ fontWeight: theme.typography.fontWeightMedium
235
+ }
236
+ }, {
237
+ props: ({
238
+ ownerState
239
+ }) => !ownerState?.contained,
240
+ style: {
241
+ fontWeight: theme.typography.fontWeightBold
242
+ }
243
+ }, {
244
+ props: ({
245
+ ownerState
246
+ }) => ownerState?.contained,
247
+ style: {
248
+ transition: 'background, color, 100ms ease'
249
+ }
250
+ }, {
251
+ props: ({
252
+ ownerState
253
+ }) => !ownerState?.contained,
254
+ style: {
255
+ transition: 'unset'
256
+ }
257
+ }, {
258
+ props: ({
259
+ ownerState
260
+ }) => !ownerState?.contained,
261
+ style: {
262
+ '&:hover': {
263
+ backgroundColor: alpha(theme.palette.primaryDark[500], 0.5),
264
+ color: (theme.vars || theme).palette.grey[400]
265
+ }
266
+ }
267
+ }, {
268
+ props: ({
269
+ ownerState
270
+ }) => !ownerState?.contained && ownerState.mounted,
271
+ style: {
272
+ '&.base--selected': {
273
+ color: '#FFF',
274
+ '&::after': {
275
+ content: "''",
276
+ position: 'absolute',
277
+ left: 0,
278
+ bottom: '-8px',
279
+ height: 2,
280
+ width: '100%',
281
+ bgcolor: (theme.vars || theme).palette.primary.light
282
+ }
283
+ }
284
+ }
285
+ }],
286
+ ...theme.unstable_sx({
287
+ height: 26,
288
+ p: '2px 8px',
289
+ bgcolor: 'transparent',
290
+ lineHeight: 1.2,
291
+ outline: 'none',
292
+ minWidth: 45,
293
+ cursor: 'pointer',
294
+ borderRadius: 99,
295
+ position: 'relative',
296
+ '&:hover': {
297
+ backgroundColor: (theme.vars || theme).palette.divider
298
+ },
299
+ '&:focus-visible': {
300
+ outline: '3px solid',
301
+ outlineOffset: '1px',
302
+ outlineColor: (theme.vars || theme).palette.primary.light
303
+ }
304
+ })
305
+ }));
306
+ export function HighlightedCodeWithTabs(props) {
307
+ const {
308
+ tabs,
309
+ storageKey
310
+ } = props;
311
+ const availableTabs = React.useMemo(() => tabs.map(({
312
+ tab
313
+ }) => tab), [tabs]);
314
+ const [activeTab, setActiveTab] = useLocalStorageState(storageKey ?? null, availableTabs[0]);
315
+ // During hydration, activeTab is null, default to first value.
316
+ const defaultizedActiveTab = activeTab ?? availableTabs[0];
317
+ const [mounted, setMounted] = React.useState(false);
318
+ React.useEffect(() => {
319
+ setMounted(true);
320
+ }, []);
321
+ const handleChange = (event, newValue) => {
322
+ setActiveTab(newValue);
323
+ };
324
+ const ownerState = {
325
+ mounted
326
+ };
327
+ return /*#__PURE__*/_jsxs(Tabs, {
328
+ selectionFollowsFocus: true,
329
+ value: defaultizedActiveTab,
330
+ onChange: handleChange,
331
+ children: [/*#__PURE__*/_jsx(CodeTabList, {
332
+ ownerState: ownerState,
333
+ children: tabs.map(({
334
+ tab
335
+ }) => /*#__PURE__*/_jsx(CodeTab, {
336
+ ownerState: ownerState,
337
+ value: tab,
338
+ children: tab
339
+ }, tab))
340
+ }), tabs.map(({
341
+ tab,
342
+ language,
343
+ code
344
+ }) => /*#__PURE__*/_jsx(CodeTabPanel, {
345
+ ownerState: ownerState,
346
+ value: tab,
347
+ children: /*#__PURE__*/_jsx(HighlightedCode, {
348
+ language: language || 'bash',
349
+ code: typeof code === 'function' ? code(tab) : code
350
+ })
351
+ }, tab))]
352
+ });
353
+ }
@@ -1 +1,2 @@
1
1
  export * from './HighlightedCode';
2
+ export * from './HighlightedCodeWithTabs';
@@ -1 +1,2 @@
1
- export * from './HighlightedCode';
1
+ export * from './HighlightedCode';
2
+ export * from './HighlightedCodeWithTabs';
@@ -197,11 +197,13 @@ const Root = styled('div')(({
197
197
  marginLeft: 8,
198
198
  height: 26,
199
199
  width: 26,
200
- backgroundColor: `var(--muidocs-palette-primary-50, ${lightTheme.palette.grey[50]})`,
201
200
  color: `var(--muidocs-palette-grey-600, ${lightTheme.palette.grey[600]})`,
202
- border: '1px solid',
203
- borderColor: `var(--muidocs-palette-divider, ${lightTheme.palette.divider})`,
201
+ backgroundColor: 'transparent',
202
+ border: '1px solid transparent',
204
203
  borderRadius: 8,
204
+ transition: theme.transitions.create(['visibility', 'background-color', 'color', 'border-color'], {
205
+ duration: theme.transitions.duration.shortest
206
+ }),
205
207
  '&:hover': {
206
208
  backgroundColor: alpha(lightTheme.palette.primary[100], 0.4),
207
209
  borderColor: `var(--muidocs-palette-primary-100, ${lightTheme.palette.primary[100]})`,
@@ -222,7 +224,7 @@ const Root = styled('div')(({
222
224
  display: 'none',
223
225
  // So we can have the comment button opt-in.
224
226
  marginLeft: 'auto',
225
- transition: theme.transitions.create('opacity', {
227
+ transition: theme.transitions.create(['background-color', 'color', 'border-color'], {
226
228
  duration: theme.transitions.duration.shortest
227
229
  }),
228
230
  '& svg': {
@@ -548,7 +550,6 @@ const Root = styled('div')(({
548
550
  display: 'inline-flex',
549
551
  flexDirection: 'row-reverse',
550
552
  alignItems: 'center',
551
- height: 24,
552
553
  padding: theme.spacing(0.5),
553
554
  paddingBottom: '5px',
554
555
  // optical alignment
@@ -681,9 +682,7 @@ const Root = styled('div')(({
681
682
  '& h1, & h2, & h3, & h4, & h5': {
682
683
  color: `var(--muidocs-palette-grey-50, ${darkTheme.palette.grey[50]})`,
683
684
  '& .anchor-icon, & .comment-link': {
684
- color: `var(--muidocs-palette-primary-300, ${darkTheme.palette.primaryDark[300]})`,
685
- borderColor: `var(--muidocs-palette-divider, ${darkTheme.palette.divider})`,
686
- backgroundColor: alpha(darkTheme.palette.primaryDark[700], 0.5),
685
+ color: `var(--muidocs-palette-primary-300, ${darkTheme.palette.primaryDark[400]})`,
687
686
  '&:hover': {
688
687
  color: `var(--muidocs-palette-primary-100, ${darkTheme.palette.primary[100]})`,
689
688
  borderColor: `var(--muidocs-palette-primary-900, ${darkTheme.palette.primary[900]})`,
@@ -4,6 +4,6 @@ export interface BrandingProviderProps {
4
4
  /**
5
5
  * If not `undefined`, the provider is considered nesting and does not render NextNProgressBar & CssBaseline
6
6
  */
7
- mode: 'light' | 'dark';
7
+ mode?: 'light' | 'dark';
8
8
  }
9
9
  export declare function BrandingProvider(props: BrandingProviderProps): React.JSX.Element;