@mui/docs 6.0.0-alpha.9 → 6.0.0-beta.1

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,355 @@
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
+ overflowX: 'auto',
18
+ ...theme.applyDarkStyles({
19
+ backgroundColor: alpha(theme.palette.primaryDark[800], 0.2)
20
+ }),
21
+ variants: [{
22
+ props: ({
23
+ ownerState
24
+ }) => ownerState?.contained,
25
+ style: {
26
+ padding: theme.spacing(1.5, 1)
27
+ }
28
+ }, {
29
+ props: ({
30
+ ownerState
31
+ }) => !ownerState?.contained,
32
+ style: {
33
+ padding: theme.spacing(1)
34
+ }
35
+ }, {
36
+ props: ({
37
+ ownerState
38
+ }) => ownerState?.contained,
39
+ style: {
40
+ borderTop: 'none'
41
+ }
42
+ }, {
43
+ props: ({
44
+ ownerState
45
+ }) => !ownerState?.contained,
46
+ style: {
47
+ borderTop: '1px solid'
48
+ }
49
+ }, {
50
+ props: ({
51
+ ownerState
52
+ }) => ownerState?.contained,
53
+ style: {
54
+ borderBottom: 'none'
55
+ }
56
+ }, {
57
+ props: ({
58
+ ownerState
59
+ }) => !ownerState?.contained,
60
+ style: {
61
+ borderBottom: '1px solid'
62
+ }
63
+ }, {
64
+ props: ({
65
+ ownerState
66
+ }) => ownerState?.contained,
67
+ style: {
68
+ borderTopLeftRadius: 0
69
+ }
70
+ }, {
71
+ props: ({
72
+ ownerState
73
+ }) => !ownerState?.contained,
74
+ style: {
75
+ borderTopLeftRadius: (theme.vars || theme).shape.borderRadius
76
+ }
77
+ }, {
78
+ props: ({
79
+ ownerState
80
+ }) => ownerState?.contained,
81
+ style: {
82
+ borderTopRightRadius: 0
83
+ }
84
+ }, {
85
+ props: ({
86
+ ownerState
87
+ }) => !ownerState?.contained,
88
+ style: {
89
+ borderTopRightRadius: (theme.vars || theme).shape.borderRadius
90
+ }
91
+ }, {
92
+ props: ({
93
+ ownerState
94
+ }) => ownerState?.contained,
95
+ style: {
96
+ borderColor: (theme.vars || theme).palette.divider
97
+ }
98
+ }, {
99
+ props: ({
100
+ ownerState
101
+ }) => !ownerState?.contained,
102
+ style: {
103
+ borderColor: (theme.vars || theme).palette.primaryDark[700]
104
+ }
105
+ }, {
106
+ props: ({
107
+ ownerState
108
+ }) => ownerState?.contained,
109
+ style: {
110
+ backgroundColor: alpha(theme.palette.grey[50], 0.2)
111
+ }
112
+ }, {
113
+ props: ({
114
+ ownerState
115
+ }) => !ownerState?.contained,
116
+ style: {
117
+ backgroundColor: (theme.vars || theme).palette.primaryDark[900]
118
+ }
119
+ }]
120
+ }));
121
+ export const CodeTabPanel = styled(TabPanelBase)({
122
+ '& pre': {
123
+ borderTopLeftRadius: 0,
124
+ borderTopRightRadius: 0,
125
+ '& code': {}
126
+ },
127
+ variants: [{
128
+ props: ({
129
+ ownerState
130
+ }) => ownerState?.contained,
131
+ style: {
132
+ marginTop: -1
133
+ }
134
+ }, {
135
+ props: ({
136
+ ownerState
137
+ }) => !ownerState?.contained,
138
+ style: {
139
+ marginTop: 0
140
+ }
141
+ }, {
142
+ props: ({
143
+ ownerState
144
+ }) => ownerState?.contained,
145
+ style: {
146
+ '& pre': {
147
+ marginTop: 0
148
+ }
149
+ }
150
+ }, {
151
+ props: ({
152
+ ownerState
153
+ }) => !ownerState?.contained,
154
+ style: {
155
+ '& pre': {
156
+ marginTop: -1
157
+ }
158
+ }
159
+ }, {
160
+ props: ({
161
+ ownerState
162
+ }) => ownerState.mounted,
163
+ style: {
164
+ '& pre': {
165
+ '& code': {
166
+ opacity: 1
167
+ }
168
+ }
169
+ }
170
+ }, {
171
+ props: ({
172
+ ownerState
173
+ }) => !ownerState.mounted,
174
+ style: {
175
+ '& pre': {
176
+ '& code': {
177
+ opacity: 0
178
+ }
179
+ }
180
+ }
181
+ }]
182
+ });
183
+ export const CodeTab = styled(TabBase)(({
184
+ theme
185
+ }) => ({
186
+ variants: [{
187
+ props: ({
188
+ ownerState
189
+ }) => ownerState?.contained,
190
+ style: {
191
+ border: '1px solid transparent',
192
+ fontSize: theme.typography.pxToRem(13)
193
+ }
194
+ }, {
195
+ props: ({
196
+ ownerState
197
+ }) => !ownerState?.contained,
198
+ style: {
199
+ border: 'none',
200
+ fontSize: theme.typography.pxToRem(12)
201
+ }
202
+ }, {
203
+ props: ({
204
+ ownerState
205
+ }) => ownerState?.contained,
206
+ style: {
207
+ color: (theme.vars || theme).palette.text.tertiary
208
+ }
209
+ }, {
210
+ props: ({
211
+ ownerState
212
+ }) => !ownerState?.contained,
213
+ style: {
214
+ color: (theme.vars || theme).palette.grey[500]
215
+ }
216
+ }, {
217
+ props: ({
218
+ ownerState
219
+ }) => ownerState?.contained,
220
+ style: {
221
+ fontFamily: theme.typography.fontFamily
222
+ }
223
+ }, {
224
+ props: ({
225
+ ownerState
226
+ }) => !ownerState?.contained,
227
+ style: {
228
+ fontFamily: theme.typography.fontFamilyCode
229
+ }
230
+ }, {
231
+ props: ({
232
+ ownerState
233
+ }) => ownerState?.contained,
234
+ style: {
235
+ fontWeight: theme.typography.fontWeightMedium
236
+ }
237
+ }, {
238
+ props: ({
239
+ ownerState
240
+ }) => !ownerState?.contained,
241
+ style: {
242
+ fontWeight: theme.typography.fontWeightBold
243
+ }
244
+ }, {
245
+ props: ({
246
+ ownerState
247
+ }) => ownerState?.contained,
248
+ style: {
249
+ transition: 'background, color, 100ms ease'
250
+ }
251
+ }, {
252
+ props: ({
253
+ ownerState
254
+ }) => !ownerState?.contained,
255
+ style: {
256
+ transition: 'unset'
257
+ }
258
+ }, {
259
+ props: ({
260
+ ownerState
261
+ }) => !ownerState?.contained,
262
+ style: {
263
+ '&:hover': {
264
+ backgroundColor: alpha(theme.palette.primaryDark[500], 0.5),
265
+ color: (theme.vars || theme).palette.grey[400]
266
+ }
267
+ }
268
+ }, {
269
+ props: ({
270
+ ownerState
271
+ }) => !ownerState?.contained && ownerState.mounted,
272
+ style: {
273
+ '&.base--selected': {
274
+ color: '#FFF',
275
+ '&::after': {
276
+ content: "''",
277
+ position: 'absolute',
278
+ left: 0,
279
+ bottom: '-8px',
280
+ height: 2,
281
+ width: '100%',
282
+ bgcolor: (theme.vars || theme).palette.primary.light
283
+ }
284
+ }
285
+ }
286
+ }],
287
+ ...theme.unstable_sx({
288
+ flex: '0 0 auto',
289
+ height: 26,
290
+ p: '2px 8px',
291
+ bgcolor: 'transparent',
292
+ lineHeight: 1.2,
293
+ outline: 'none',
294
+ minWidth: 45,
295
+ cursor: 'pointer',
296
+ borderRadius: 99,
297
+ position: 'relative',
298
+ '&:hover': {
299
+ backgroundColor: (theme.vars || theme).palette.divider
300
+ },
301
+ '&:focus-visible': {
302
+ outline: '3px solid',
303
+ outlineOffset: '1px',
304
+ outlineColor: (theme.vars || theme).palette.primary.light
305
+ }
306
+ })
307
+ }));
308
+ export function HighlightedCodeWithTabs(props) {
309
+ const {
310
+ tabs,
311
+ storageKey
312
+ } = props;
313
+ const availableTabs = React.useMemo(() => tabs.map(({
314
+ tab
315
+ }) => tab), [tabs]);
316
+ const [activeTab, setActiveTab] = useLocalStorageState(storageKey ?? null, availableTabs[0]);
317
+ // During hydration, activeTab is null, default to first value.
318
+ const defaultizedActiveTab = activeTab ?? availableTabs[0];
319
+ const [mounted, setMounted] = React.useState(false);
320
+ React.useEffect(() => {
321
+ setMounted(true);
322
+ }, []);
323
+ const handleChange = (event, newValue) => {
324
+ setActiveTab(newValue);
325
+ };
326
+ const ownerState = {
327
+ mounted
328
+ };
329
+ return /*#__PURE__*/_jsxs(Tabs, {
330
+ selectionFollowsFocus: true,
331
+ value: defaultizedActiveTab,
332
+ onChange: handleChange,
333
+ children: [/*#__PURE__*/_jsx(CodeTabList, {
334
+ ownerState: ownerState,
335
+ children: tabs.map(({
336
+ tab
337
+ }) => /*#__PURE__*/_jsx(CodeTab, {
338
+ ownerState: ownerState,
339
+ value: tab,
340
+ children: tab
341
+ }, tab))
342
+ }), tabs.map(({
343
+ tab,
344
+ language,
345
+ code
346
+ }) => /*#__PURE__*/_jsx(CodeTabPanel, {
347
+ ownerState: ownerState,
348
+ value: tab,
349
+ children: /*#__PURE__*/_jsx(HighlightedCode, {
350
+ language: language || 'bash',
351
+ code: typeof code === 'function' ? code(tab) : code
352
+ })
353
+ }, tab))]
354
+ });
355
+ }
@@ -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