@mui/docs 6.0.0-alpha.8 → 6.0.0-beta.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.
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ export * from './HighlightedCodeWithTabs';
2
+ export { HighlightedCodeWithTabs as default } from './HighlightedCodeWithTabs';
@@ -0,0 +1,2 @@
1
+ export * from './HighlightedCodeWithTabs';
2
+ export { HighlightedCodeWithTabs as default } from './HighlightedCodeWithTabs';
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/HighlightedCodeWithTabs/index.js",
5
+ "types": "./index.d.ts"
6
+ }
package/Link/Link.js CHANGED
@@ -61,8 +61,6 @@ export const Link = /*#__PURE__*/React.forwardRef(function Link(props, ref) {
61
61
  noLinkStyle,
62
62
  prefetch,
63
63
  replace,
64
- role,
65
- // Link don't have roles.
66
64
  scroll,
67
65
  shallow,
68
66
  ...other