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