@mui/docs 6.0.0-dev.240424162023-9968b4889d → 6.0.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.
Files changed (125) hide show
  1. package/Ad/Ad.d.ts +6 -0
  2. package/Ad/Ad.js +228 -0
  3. package/Ad/AdCarbon.d.ts +3 -0
  4. package/Ad/AdCarbon.js +120 -0
  5. package/Ad/AdDisplay.d.ts +16 -0
  6. package/Ad/AdDisplay.js +89 -0
  7. package/Ad/AdGuest.d.ts +10 -0
  8. package/Ad/AdGuest.js +29 -0
  9. package/Ad/AdInHouse.d.ts +5 -0
  10. package/Ad/AdInHouse.js +15 -0
  11. package/Ad/AdManager.d.ts +16 -0
  12. package/Ad/AdManager.js +36 -0
  13. package/Ad/AdProvider.d.ts +15 -0
  14. package/Ad/AdProvider.js +24 -0
  15. package/Ad/ad.styles.d.ts +4327 -0
  16. package/Ad/ad.styles.js +89 -0
  17. package/Ad/index.d.ts +5 -0
  18. package/Ad/index.js +7 -0
  19. package/Ad/package.json +6 -0
  20. package/CHANGELOG.md +1367 -22
  21. package/CodeCopy/CodeCopy.js +1 -1
  22. package/CodeCopy/CodeCopyButton.js +11 -20
  23. package/CodeCopy/index.js +3 -3
  24. package/CodeCopy/useClipboardCopy.js +1 -1
  25. package/ComponentLinkHeader/ComponentLinkHeader.d.ts +9 -0
  26. package/ComponentLinkHeader/ComponentLinkHeader.js +197 -0
  27. package/ComponentLinkHeader/index.d.ts +2 -0
  28. package/ComponentLinkHeader/index.js +2 -0
  29. package/ComponentLinkHeader/package.json +6 -0
  30. package/DocsProvider/DocsProvider.d.ts +3 -1
  31. package/DocsProvider/DocsProvider.js +10 -5
  32. package/DocsProvider/index.js +1 -1
  33. package/HighlightedCode/HighlightedCode.d.ts +3 -1
  34. package/HighlightedCode/HighlightedCode.js +50 -24
  35. package/HighlightedCode/index.js +1 -1
  36. package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.d.ts +29 -0
  37. package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.js +355 -0
  38. package/HighlightedCodeWithTabs/index.d.ts +2 -0
  39. package/HighlightedCodeWithTabs/index.js +2 -0
  40. package/HighlightedCodeWithTabs/package.json +6 -0
  41. package/InfoCard/InfoCard.d.ts +0 -1
  42. package/InfoCard/InfoCard.js +46 -45
  43. package/InfoCard/index.js +1 -1
  44. package/Link/Link.js +41 -41
  45. package/Link/index.js +1 -1
  46. package/MarkdownElement/MarkdownElement.d.ts +1 -0
  47. package/MarkdownElement/MarkdownElement.js +187 -165
  48. package/MarkdownElement/index.js +1 -1
  49. package/NProgressBar/NProgressBar.js +6 -7
  50. package/NProgressBar/index.js +1 -1
  51. package/README.md +2 -2
  52. package/SectionTitle/SectionTitle.d.ts +7 -0
  53. package/SectionTitle/SectionTitle.js +30 -0
  54. package/SectionTitle/index.d.ts +1 -0
  55. package/SectionTitle/index.js +1 -0
  56. package/SectionTitle/package.json +6 -0
  57. package/branding/BrandingProvider.d.ts +1 -1
  58. package/branding/BrandingProvider.js +1 -1
  59. package/branding/brandingTheme.d.ts +2 -2
  60. package/branding/brandingTheme.js +657 -369
  61. package/branding/index.js +2 -2
  62. package/i18n/i18n.d.ts +2 -1
  63. package/i18n/i18n.js +19 -9
  64. package/i18n/index.js +1 -1
  65. package/node/Ad/Ad.js +238 -0
  66. package/node/Ad/AdCarbon.js +130 -0
  67. package/node/Ad/AdDisplay.js +97 -0
  68. package/node/Ad/AdGuest.js +37 -0
  69. package/node/Ad/AdInHouse.js +24 -0
  70. package/node/Ad/AdManager.js +46 -0
  71. package/node/Ad/AdProvider.js +33 -0
  72. package/node/Ad/ad.styles.js +97 -0
  73. package/node/Ad/index.js +63 -0
  74. package/node/CodeCopy/CodeCopy.js +10 -16
  75. package/node/CodeCopy/CodeCopyButton.js +10 -19
  76. package/node/CodeCopy/useClipboardCopy.js +1 -1
  77. package/node/ComponentLinkHeader/ComponentLinkHeader.js +206 -0
  78. package/node/ComponentLinkHeader/index.js +24 -0
  79. package/node/DocsProvider/DocsProvider.js +9 -4
  80. package/node/HighlightedCode/HighlightedCode.js +48 -22
  81. package/node/HighlightedCodeWithTabs/HighlightedCodeWithTabs.js +365 -0
  82. package/node/HighlightedCodeWithTabs/index.js +24 -0
  83. package/node/InfoCard/InfoCard.js +45 -44
  84. package/node/Link/Link.js +43 -42
  85. package/node/MarkdownElement/MarkdownElement.js +642 -623
  86. package/node/NProgressBar/NProgressBar.js +6 -7
  87. package/node/SectionTitle/SectionTitle.js +38 -0
  88. package/node/SectionTitle/index.js +16 -0
  89. package/node/branding/brandingTheme.js +657 -369
  90. package/node/i18n/i18n.js +18 -8
  91. package/node/svgIcons/AdobeXDIcon.js +22 -0
  92. package/node/svgIcons/BundleSizeIcon.js +22 -0
  93. package/node/svgIcons/FigmaIcon.js +31 -0
  94. package/node/svgIcons/FileDownload.js +3 -3
  95. package/node/svgIcons/JavaScript.js +3 -3
  96. package/node/svgIcons/MaterialDesignIcon.js +27 -0
  97. package/node/svgIcons/SketchIcon.js +36 -0
  98. package/node/svgIcons/TypeScript.js +3 -3
  99. package/node/svgIcons/W3CIcon.js +24 -0
  100. package/node/translations/translations.json +9 -4
  101. package/node/utils/loadScript.js +15 -0
  102. package/package.json +12 -10
  103. package/svgIcons/AdobeXDIcon.d.ts +4 -0
  104. package/svgIcons/AdobeXDIcon.js +14 -0
  105. package/svgIcons/BundleSizeIcon.d.ts +4 -0
  106. package/svgIcons/BundleSizeIcon.js +14 -0
  107. package/svgIcons/FigmaIcon.d.ts +4 -0
  108. package/svgIcons/FigmaIcon.js +23 -0
  109. package/svgIcons/FileDownload.d.ts +7 -0
  110. package/svgIcons/FileDownload.js +3 -3
  111. package/svgIcons/JavaScript.d.ts +7 -0
  112. package/svgIcons/JavaScript.js +3 -3
  113. package/svgIcons/MaterialDesignIcon.d.ts +4 -0
  114. package/svgIcons/MaterialDesignIcon.js +19 -0
  115. package/svgIcons/SketchIcon.d.ts +4 -0
  116. package/svgIcons/SketchIcon.js +28 -0
  117. package/svgIcons/TypeScript.d.ts +7 -0
  118. package/svgIcons/TypeScript.js +3 -3
  119. package/svgIcons/W3CIcon.d.ts +4 -0
  120. package/svgIcons/W3CIcon.js +16 -0
  121. package/translations/index.js +1 -1
  122. package/translations/translations.json +9 -4
  123. package/tsconfig.build.tsbuildinfo +1 -1
  124. package/utils/loadScript.d.ts +1 -0
  125. package/utils/loadScript.js +9 -0
@@ -1,16 +1,15 @@
1
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
- import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["className", "renderedMarkdown"];
4
1
  import * as React from 'react';
5
2
  import clsx from 'clsx';
6
3
  import { alpha, darken, styled } from '@mui/material/styles';
7
- import { brandingDarkTheme as darkTheme, brandingLightTheme as lightTheme } from '../branding';
4
+ import useForkRef from '@mui/utils/useForkRef';
5
+ import { brandingDarkTheme as darkTheme, brandingLightTheme as lightTheme } from "../branding/index.js";
8
6
  import { jsx as _jsx } from "react/jsx-runtime";
9
7
  const Root = styled('div')(({
10
8
  theme
11
- }) => _extends({}, lightTheme.typography.body1, {
12
- lineHeight: 1.6,
13
- // Increased compared to the 1.5 default to make the docs easier to read.
9
+ }) => ({
10
+ ...lightTheme.typography.body1,
11
+ lineHeight: 1.625,
12
+ // Rounds up to 26px-increased compared to the 1.5 default to make the docs easier to read.
14
13
  color: `var(--muidocs-palette-text-primary, ${lightTheme.palette.text.primary})`,
15
14
  '& :focus-visible': {
16
15
  outline: `3px solid ${alpha(lightTheme.palette.primary[500], 0.5)}`,
@@ -25,7 +24,7 @@ const Root = styled('div')(({
25
24
  // Developers like when the code is dense.
26
25
  margin: theme.spacing(2, 'auto'),
27
26
  padding: theme.spacing(2),
28
- backgroundColor: 'hsl(210, 35%, 9%)',
27
+ backgroundColor: 'hsl(210, 25%, 9%)',
29
28
  // a special, one-off, color tailored for the code blocks using MUI's branding theme blue palette as the starting point. It has a less saturaded color but still maintaining a bit of the blue tint.
30
29
  color: 'hsl(60, 30%, 96%)',
31
30
  colorScheme: 'dark',
@@ -41,11 +40,12 @@ const Root = styled('div')(({
41
40
  maxWidth: 'calc(100vw - 32px - 16px)'
42
41
  }
43
42
  },
44
- '& code': _extends({}, lightTheme.typography.body2, {
43
+ '& code': {
44
+ ...lightTheme.typography.body2,
45
45
  fontFamily: lightTheme.typography.fontFamilyCode,
46
46
  fontWeight: 400,
47
47
  WebkitFontSmoothing: 'subpixel-antialiased'
48
- }),
48
+ },
49
49
  '& pre > code': {
50
50
  // Reset for Safari
51
51
  // https://github.com/necolas/normalize.css/blob/master/normalize.css#L102
@@ -63,47 +63,53 @@ const Root = styled('div')(({
63
63
  direction: 'ltr /*! @noflip */',
64
64
  boxDecorationBreak: 'clone'
65
65
  },
66
- '& h1': _extends({}, lightTheme.typography.h3, {
66
+ '& h1': {
67
+ ...lightTheme.typography.h3,
67
68
  fontSize: lightTheme.typography.pxToRem(36),
68
69
  fontFamily: `"General Sans", ${lightTheme.typography.fontFamilySystem}`,
69
70
  margin: '10px 0',
70
71
  color: `var(--muidocs-palette-primaryDark-900, ${lightTheme.palette.primaryDark[900]})`,
71
72
  fontWeight: 600,
72
73
  letterSpacing: -0.2
73
- }),
74
- '& .description': _extends({}, lightTheme.typography.subtitle1, {
74
+ },
75
+ '& .description': {
76
+ ...lightTheme.typography.subtitle1,
75
77
  fontWeight: 400,
76
78
  margin: '0 0 24px'
77
- }),
79
+ },
78
80
  '& .component-tabs': {
79
81
  margin: '0 0 40px'
80
82
  },
81
- '& h2': _extends({}, lightTheme.typography.h5, {
83
+ '& h2': {
84
+ ...lightTheme.typography.h5,
82
85
  fontFamily: `"General Sans", ${lightTheme.typography.fontFamilySystem}`,
83
86
  fontSize: theme.typography.pxToRem(26),
84
87
  fontWeight: lightTheme.typography.fontWeightSemiBold,
85
88
  color: `var(--muidocs-palette-grey-900, ${lightTheme.palette.grey[900]})`,
86
89
  margin: '40px 0 4px'
87
- }),
88
- '& h3': _extends({}, lightTheme.typography.h6, {
90
+ },
91
+ '& h3': {
92
+ ...lightTheme.typography.h6,
89
93
  fontFamily: `"General Sans", ${lightTheme.typography.fontFamilySystem}`,
90
94
  fontSize: theme.typography.pxToRem(20),
91
95
  fontWeight: lightTheme.typography.fontWeightSemiBold,
92
96
  color: `var(--muidocs-palette-grey-900, ${lightTheme.palette.grey[900]})`,
93
97
  margin: '24px 0 4px'
94
- }),
95
- '& h4': _extends({}, lightTheme.typography.subtitle1, {
98
+ },
99
+ '& h4': {
100
+ ...lightTheme.typography.subtitle1,
96
101
  fontFamily: `"General Sans", ${lightTheme.typography.fontFamilySystem}`,
97
102
  fontWeight: lightTheme.typography.fontWeightSemiBold,
98
103
  color: `var(--muidocs-palette-grey-900, ${lightTheme.palette.grey[900]})`,
99
104
  margin: '20px 0 6px'
100
- }),
101
- '& h5': _extends({}, lightTheme.typography.subtitle2, {
105
+ },
106
+ '& h5': {
107
+ ...lightTheme.typography.subtitle2,
102
108
  fontFamily: `"General Sans", ${lightTheme.typography.fontFamilySystem}`,
103
109
  fontWeight: lightTheme.typography.fontWeightSemiBold,
104
110
  color: `var(--muidocs-palette-grey-900, ${lightTheme.palette.grey[900]})`,
105
111
  margin: '20px 0 8px'
106
- }),
112
+ },
107
113
  '& p': {
108
114
  marginTop: 0,
109
115
  marginBottom: 16,
@@ -117,6 +123,44 @@ const Root = styled('div')(({
117
123
  marginBottom: 6
118
124
  }
119
125
  },
126
+ '& a[target="_blank"]::after': {
127
+ content: '""',
128
+ maskImage: `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' focusable='false' aria-hidden='true' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z'%3E%3C/path%3E%3C/svg%3E")`,
129
+ display: 'inline-flex',
130
+ width: '1em',
131
+ height: '1em',
132
+ color: 'inherit',
133
+ backgroundColor: 'currentColor',
134
+ transform: 'translate(0, 2px)',
135
+ transition: 'transform 0.3s cubic-bezier(0.1, 0.8, 0.3, 1)',
136
+ // bounce effect
137
+ opacity: 0.8
138
+ },
139
+ '& a[target="_blank"]:hover::after': {
140
+ opacity: 1,
141
+ transform: 'translate(1px, 0)'
142
+ },
143
+ '& a.remove-link-arrow::after': {
144
+ // Allows to remove link arrows for images
145
+ display: 'none'
146
+ },
147
+ '& .Ad-root a::after': {
148
+ // Remove link arrow for ads
149
+ display: 'none'
150
+ },
151
+ '& a': {
152
+ // Style taken from the Link component
153
+ color: `var(--muidocs-palette-primary-600, ${lightTheme.palette.primary[600]})`,
154
+ fontWeight: theme.typography.fontWeightMedium,
155
+ textDecoration: 'underline',
156
+ textDecorationColor: alpha(lightTheme.palette.primary.main, 0.4),
157
+ '&:hover': {
158
+ textDecorationColor: 'inherit'
159
+ }
160
+ },
161
+ '& a code': {
162
+ color: darken(lightTheme.palette.primary.main, 0.2)
163
+ },
120
164
  '& h1, & h2, & h3, & h4': {
121
165
  display: 'flex',
122
166
  alignItems: 'center',
@@ -130,9 +174,10 @@ const Root = styled('div')(({
130
174
  '& .title-link-to-anchor': {
131
175
  color: 'inherit',
132
176
  textDecoration: 'none',
177
+ boxShadow: 'none',
178
+ fontWeight: 'inherit',
133
179
  position: 'relative',
134
- display: 'flex',
135
- alignItems: 'center'
180
+ userSelect: 'text'
136
181
  },
137
182
  '& .anchor-icon': {
138
183
  // To prevent the link to get the focus.
@@ -140,12 +185,6 @@ const Root = styled('div')(({
140
185
  alignItems: 'center',
141
186
  visibility: 'hidden'
142
187
  },
143
- '& a:not(.title-link-to-anchor):hover': {
144
- color: 'currentColor',
145
- border: 'none',
146
- boxShadow: '0 1px 0 0 currentColor',
147
- textDecoration: 'none'
148
- },
149
188
  '& .anchor-icon, & .comment-link': {
150
189
  padding: 0,
151
190
  cursor: 'pointer',
@@ -156,11 +195,13 @@ const Root = styled('div')(({
156
195
  marginLeft: 8,
157
196
  height: 26,
158
197
  width: 26,
159
- backgroundColor: `var(--muidocs-palette-primary-50, ${lightTheme.palette.grey[50]})`,
160
198
  color: `var(--muidocs-palette-grey-600, ${lightTheme.palette.grey[600]})`,
161
- border: '1px solid',
162
- borderColor: `var(--muidocs-palette-divider, ${lightTheme.palette.divider})`,
199
+ backgroundColor: 'transparent',
200
+ border: '1px solid transparent',
163
201
  borderRadius: 8,
202
+ transition: theme.transitions.create(['visibility', 'background-color', 'color', 'border-color'], {
203
+ duration: theme.transitions.duration.shortest
204
+ }),
164
205
  '&:hover': {
165
206
  backgroundColor: alpha(lightTheme.palette.primary[100], 0.4),
166
207
  borderColor: `var(--muidocs-palette-primary-100, ${lightTheme.palette.primary[100]})`,
@@ -181,7 +222,7 @@ const Root = styled('div')(({
181
222
  display: 'none',
182
223
  // So we can have the comment button opt-in.
183
224
  marginLeft: 'auto',
184
- transition: theme.transitions.create('opacity', {
225
+ transition: theme.transitions.create(['background-color', 'color', 'border-color'], {
185
226
  duration: theme.transitions.duration.shortest
186
227
  }),
187
228
  '& svg': {
@@ -231,13 +272,14 @@ const Root = styled('div')(({
231
272
  borderBottom: `1px dotted var(--muidocs-palette-divider, ${lightTheme.palette.divider})`
232
273
  }
233
274
  },
234
- '& td': _extends({}, theme.typography.body2, {
275
+ '& td': {
276
+ ...theme.typography.body2,
235
277
  borderBottom: `1px solid var(--muidocs-palette-divider, ${lightTheme.palette.divider})`,
236
278
  paddingRight: 20,
237
279
  paddingTop: 16,
238
280
  paddingBottom: 16,
239
281
  color: `var(--muidocs-palette-text-secondary, ${lightTheme.palette.text.secondary})`
240
- }),
282
+ },
241
283
  '& td code': {
242
284
  lineHeight: 1.6
243
285
  },
@@ -278,44 +320,58 @@ const Root = styled('div')(({
278
320
  },
279
321
  '& .MuiCallout-root': {
280
322
  display: 'flex',
281
- gap: 12,
282
- padding: '16px',
323
+ gap: '8px',
324
+ padding: '12px',
283
325
  margin: '16px 0',
284
326
  border: '1px solid',
285
327
  color: `var(--muidocs-palette-text-secondary, ${lightTheme.palette.text.secondary})`,
286
328
  borderColor: `var(--muidocs-palette-grey-100, ${lightTheme.palette.grey[100]})`,
287
329
  borderRadius: `var(--muidocs-shape-borderRadius, ${theme.shape?.borderRadius ?? lightTheme.shape.borderRadius}px)`,
288
- '& > code': {
330
+ '& .MuiCallout-content': {
331
+ minWidth: 0,
332
+ // Allows content to shrink. Useful when callout contains code block
333
+ flexGrow: 1
334
+ },
335
+ '& code': {
289
336
  height: 'fit-content',
290
337
  backgroundColor: `var(--muidocs-palette-grey-100, ${lightTheme.palette.grey[100]})`,
291
338
  borderColor: `var(--muidocs-palette-grey-300, ${lightTheme.palette.grey[300]})`
292
339
  },
293
- '& .MuiCallout-content': {
294
- minWidth: 0,
295
- // Allows content to shrink. Useful when callout contains code block
296
- flexGrow: 1,
340
+ '& p': {
341
+ marginBottom: '8px',
297
342
  '& > p:last-child, & > ul:last-child': {
298
343
  // Avoid margin on last child
299
344
  marginBottom: 0
300
345
  },
301
- '& .MuiCode-root': {
302
- '& > pre': {
303
- margin: 0,
304
- marginTop: 4
305
- }
306
- },
307
346
  '& > ul': {
308
347
  // Because of the gap left by the icon, we visually need less padding
309
348
  paddingLeft: 22
310
349
  }
311
350
  },
312
- '& > svg': {
313
- marginTop: 2,
314
- width: 20,
315
- height: 20,
316
- flexShrink: 0
351
+ '& .MuiCode-root': {
352
+ '& pre': {
353
+ margin: '4px 0 0 0',
354
+ borderRadius: '12px 12px 6px 12px',
355
+ borderColor: alpha(lightTheme.palette.primaryDark[600], 0.6),
356
+ '& code': {
357
+ backgroundColor: 'transparent'
358
+ }
359
+ }
360
+ },
361
+ '& .MuiCallout-icon-container': {
362
+ width: 26,
363
+ // to match text's line-height
364
+ height: 26,
365
+ display: 'flex',
366
+ alignItems: 'center',
367
+ justifyContent: 'center',
368
+ flexShrink: 0,
369
+ '& svg': {
370
+ width: 18,
371
+ height: 18
372
+ }
317
373
  },
318
- '& > ul, & > p': {
374
+ '& ul, & p': {
319
375
  '&:last-child': {
320
376
  margin: 0
321
377
  }
@@ -330,7 +386,7 @@ const Root = styled('div')(({
330
386
  '& strong': {
331
387
  color: `var(--muidocs-palette-error-800, ${lightTheme.palette.error[800]})`
332
388
  },
333
- '& > svg': {
389
+ '& svg': {
334
390
  fill: `var(--muidocs-palette-error-500, ${lightTheme.palette.error[600]})`
335
391
  },
336
392
  '& a': {
@@ -348,7 +404,7 @@ const Root = styled('div')(({
348
404
  '& strong': {
349
405
  color: `var(--muidocs-palette-primary-800, ${lightTheme.palette.primary[800]})`
350
406
  },
351
- '& > svg': {
407
+ '& svg': {
352
408
  fill: `var(--muidocs-palette-grey-600, ${lightTheme.palette.grey[600]})`
353
409
  }
354
410
  },
@@ -359,7 +415,7 @@ const Root = styled('div')(({
359
415
  '& strong': {
360
416
  color: `var(--muidocs-palette-success-900, ${lightTheme.palette.success[900]})`
361
417
  },
362
- '& > svg': {
418
+ '& svg': {
363
419
  fill: `var(--muidocs-palette-success-600, ${lightTheme.palette.success[600]})`
364
420
  },
365
421
  '& a': {
@@ -377,7 +433,7 @@ const Root = styled('div')(({
377
433
  '& strong': {
378
434
  color: `var(--muidocs-palette-warning-800, ${lightTheme.palette.warning[800]})`
379
435
  },
380
- '& > svg': {
436
+ '& svg': {
381
437
  fill: `var(--muidocs-palette-warning-600, ${lightTheme.palette.warning[600]})`
382
438
  },
383
439
  '& a': {
@@ -389,47 +445,6 @@ const Root = styled('div')(({
389
445
  }
390
446
  }
391
447
  },
392
- '& a[target="_blank"]::after': {
393
- content: '""',
394
- maskImage: `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' focusable='false' aria-hidden='true' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z'%3E%3C/path%3E%3C/svg%3E")`,
395
- display: 'inline-flex',
396
- width: '1em',
397
- height: '1em',
398
- color: 'inherit',
399
- backgroundColor: 'currentColor',
400
- transform: 'translate(0, 2px)',
401
- transition: 'transform 0.3s cubic-bezier(0.1, 0.8, 0.3, 1)',
402
- // bounce effect
403
- opacity: 0.8
404
- },
405
- '& a[target="_blank"]:hover::after': {
406
- opacity: 1,
407
- transform: 'translate(1px, 0)'
408
- },
409
- '& a.remove-link-arrow::after': {
410
- // Allows to remove link arrows for images
411
- display: 'none'
412
- },
413
- '& .Ad-root a::after': {
414
- // Remove link arrow for ads
415
- display: 'none'
416
- },
417
- '& a:not(.title-link-to-anchor), & a:not(.title-link-to-anchor) code': {
418
- // Style taken from the Link component
419
- color: `var(--muidocs-palette-primary-600, ${lightTheme.palette.primary[600]})`,
420
- fontWeight: theme.typography.fontWeightMedium,
421
- textDecoration: 'underline',
422
- textDecorationColor: alpha(lightTheme.palette.primary.main, 0.4),
423
- '&:hover': {
424
- textDecorationColor: 'inherit'
425
- }
426
- },
427
- '& a code': {
428
- color: darken(lightTheme.palette.primary.main, 0.04)
429
- },
430
- '& a:not(.title-link-to-anchor) code': {
431
- color: darken(lightTheme.palette.primary.main, 0.2)
432
- },
433
448
  '& img, & video': {
434
449
  // Use !important so that inline style on <img> or <video> can't win.
435
450
  // This avoid horizontal overflows on mobile.
@@ -526,45 +541,34 @@ const Root = styled('div')(({
526
541
  top: 0
527
542
  },
528
543
  '& .MuiCode-copy': {
529
- display: 'inline-flex',
530
- flexDirection: 'row-reverse',
531
- alignItems: 'center',
532
- width: 26,
533
- height: 26,
534
544
  cursor: 'pointer',
535
545
  position: 'absolute',
536
546
  top: 12,
537
547
  right: 12,
548
+ display: 'inline-flex',
549
+ flexDirection: 'row-reverse',
550
+ alignItems: 'center',
538
551
  padding: theme.spacing(0.5),
539
- fontFamily: 'inherit',
540
- fontWeight: 500,
552
+ paddingBottom: '5px',
553
+ // optical alignment
554
+ fontFamily: lightTheme.typography.fontFamily,
555
+ fontWeight: lightTheme.typography.fontWeightMedium,
556
+ fontSize: lightTheme.typography.pxToRem(12),
541
557
  borderRadius: 6,
542
- border: 'none',
543
- backgroundColor: 'hsl(210, 35%, 9%)',
544
- // using the code block one-off background color (defined in line 23)
545
- color: '#FFF',
558
+ border: '1px solid',
559
+ borderColor: alpha(lightTheme.palette.primaryDark[600], 0.5),
560
+ backgroundColor: alpha(lightTheme.palette.primaryDark[800], 0.5),
561
+ color: `var(--muidocs-palette-grey-300, ${lightTheme.palette.grey[300]})`,
546
562
  transition: theme.transitions.create(['background', 'borderColor', 'display'], {
547
563
  duration: theme.transitions.duration.shortest
548
564
  }),
549
- '& svg': {
550
- userSelect: 'none',
551
- width: theme.typography.pxToRem(16),
552
- height: theme.typography.pxToRem(16),
553
- display: 'inline-block',
554
- fill: 'currentcolor',
555
- flexShrink: 0,
556
- fontSize: '18px',
557
- margin: 'auto',
558
- opacity: 0.5
559
- },
560
- '& .MuiCode-copied-icon': {
565
+ '& .MuiCode-copied-label': {
561
566
  display: 'none'
562
567
  },
563
568
  '&:hover, &:focus': {
564
- backgroundColor: lightTheme.palette.primaryDark[600],
565
- '& svg': {
566
- opacity: 1
567
- },
569
+ borderColor: `var(--muidocs-palette-primaryDark-400, ${lightTheme.palette.primaryDark[400]})`,
570
+ backgroundColor: `var(--muidocs-palette-primaryDark-700, ${lightTheme.palette.primaryDark[700]})`,
571
+ color: '#FFF',
568
572
  '& .MuiCode-copyKeypress': {
569
573
  display: 'block',
570
574
  // Approximate no hover capabilities with no keyboard
@@ -577,17 +581,19 @@ const Root = styled('div')(({
577
581
  '& .MuiCode-copyKeypress': {
578
582
  display: 'none',
579
583
  position: 'absolute',
580
- right: 26
584
+ right: 34
581
585
  },
582
586
  '&[data-copied]': {
583
- // style of the button when it is in copied state.
584
- borderColor: lightTheme.palette.primary[700],
587
+ borderColor: `var(--muidocs-palette-primaryDark-400, ${lightTheme.palette.primaryDark[400]})`,
588
+ backgroundColor: `var(--muidocs-palette-primaryDark-700, ${lightTheme.palette.primaryDark[700]})`,
585
589
  color: '#fff',
586
- backgroundColor: lightTheme.palette.primaryDark[600],
587
- '& .MuiCode-copy-icon': {
590
+ '& .MuiCode-copyKeypress': {
591
+ opacity: 0
592
+ },
593
+ '& .MuiCode-copy-label': {
588
594
  display: 'none'
589
595
  },
590
- '& .MuiCode-copied-icon': {
596
+ '& .MuiCode-copied-label': {
591
597
  display: 'block'
592
598
  }
593
599
  }
@@ -665,24 +671,26 @@ const Root = styled('div')(({
665
671
  '& hr': {
666
672
  backgroundColor: `var(--muidocs-palette-divider, ${darkTheme.palette.divider})`
667
673
  },
668
- '& h1, & h2, & h3, & h4, & h5': {
669
- color: `var(--muidocs-palette-grey-50, ${darkTheme.palette.grey[50]})`
674
+ '& a': {
675
+ color: `var(--muidocs-palette-primary-300, ${darkTheme.palette.primary[300]})`
670
676
  },
671
- '& p, & ul, & ol': {
672
- color: `var(--muidocs-palette-grey-400, ${darkTheme.palette.grey[400]})`
677
+ '& a code': {
678
+ color: `var(--muidocs-palette-primary-light, ${darkTheme.palette.primary.light})`
673
679
  },
674
- '& h1, & h2, & h3, & h4': {
675
- '&:hover .anchor-icon, & .comment-link': {
676
- color: `var(--muidocs-palette-primary-300, ${darkTheme.palette.primaryDark[300]})`,
677
- borderColor: `var(--muidocs-palette-divider, ${darkTheme.palette.divider})`,
678
- backgroundColor: alpha(darkTheme.palette.primaryDark[700], 0.5),
680
+ '& h1, & h2, & h3, & h4, & h5': {
681
+ color: `var(--muidocs-palette-grey-50, ${darkTheme.palette.grey[50]})`,
682
+ '& .anchor-icon, & .comment-link': {
683
+ color: `var(--muidocs-palette-primary-300, ${darkTheme.palette.primaryDark[400]})`,
679
684
  '&:hover': {
685
+ color: `var(--muidocs-palette-primary-100, ${darkTheme.palette.primary[100]})`,
680
686
  borderColor: `var(--muidocs-palette-primary-900, ${darkTheme.palette.primary[900]})`,
681
- backgroundColor: alpha(darkTheme.palette.primary[900], 0.6),
682
- color: `var(--muidocs-palette-primary-100, ${darkTheme.palette.primary[100]})`
687
+ backgroundColor: alpha(darkTheme.palette.primary[900], 0.6)
683
688
  }
684
689
  }
685
690
  },
691
+ '& p, & ul, & ol': {
692
+ color: `var(--muidocs-palette-grey-400, ${darkTheme.palette.grey[400]})`
693
+ },
686
694
  '& h1 code, & h2 code, & h3 code': {
687
695
  color: `var(--muidocs-palette-grey-100, ${darkTheme.palette.grey[100]})`
688
696
  },
@@ -716,8 +724,7 @@ const Root = styled('div')(({
716
724
  },
717
725
  '& .MuiCallout-root': {
718
726
  borderColor: `var(--muidocs-palette-primaryDark-700, ${darkTheme.palette.primaryDark[700]})`,
719
- '& > code': {
720
- height: 'fit-content',
727
+ '& code': {
721
728
  backgroundColor: `var(--muidocs-palette-primaryDark-600, ${darkTheme.palette.primaryDark[600]})`,
722
729
  borderColor: `var(--muidocs-palette-primaryDark-500, ${darkTheme.palette.primaryDark[500]})`
723
730
  },
@@ -728,7 +735,7 @@ const Root = styled('div')(({
728
735
  '& strong': {
729
736
  color: `var(--muidocs-palette-error-300, ${darkTheme.palette.error[300]})`
730
737
  },
731
- '& > svg': {
738
+ '& svg': {
732
739
  fill: `var(--muidocs-palette-error-500, ${darkTheme.palette.error[500]})`
733
740
  },
734
741
  '& a': {
@@ -742,7 +749,7 @@ const Root = styled('div')(({
742
749
  '& strong': {
743
750
  color: `var(--muidocs-palette-primary-200, ${darkTheme.palette.primary[200]})`
744
751
  },
745
- '& > svg': {
752
+ '& svg': {
746
753
  fill: `var(--muidocs-palette-grey-400, ${darkTheme.palette.grey[400]})`
747
754
  }
748
755
  },
@@ -753,7 +760,7 @@ const Root = styled('div')(({
753
760
  '& strong': {
754
761
  color: `var(--muidocs-palette-success-200, ${darkTheme.palette.success[200]})`
755
762
  },
756
- '& > svg': {
763
+ '& svg': {
757
764
  fill: `var(--muidocs-palette-success-500, ${darkTheme.palette.success[500]})`
758
765
  },
759
766
  '& a': {
@@ -767,7 +774,7 @@ const Root = styled('div')(({
767
774
  '& strong': {
768
775
  color: `var(--muidocs-palette-warning-200, ${darkTheme.palette.warning[200]})`
769
776
  },
770
- '& > svg': {
777
+ '& svg': {
771
778
  fill: `var(--muidocs-palette-warning-400, ${darkTheme.palette.warning[400]})`
772
779
  },
773
780
  '& a': {
@@ -775,12 +782,6 @@ const Root = styled('div')(({
775
782
  }
776
783
  }
777
784
  },
778
- '& a:not(.title-link-to-anchor), & a:not(.title-link-to-anchor) code': {
779
- color: `var(--muidocs-palette-primary-300, ${darkTheme.palette.primary[300]})`
780
- },
781
- '& a:not(.title-link-to-anchor) code': {
782
- color: `var(--muidocs-palette-primary-light, ${darkTheme.palette.primary.light})`
783
- },
784
785
  '& kbd.key': {
785
786
  color: `var(--muidocs-palette-text-primary, ${darkTheme.palette.text.primary})`,
786
787
  backgroundColor: `var(--muidocs-palette-primaryDark-800, ${darkTheme.palette.primaryDark[800]})`,
@@ -804,12 +805,32 @@ const Root = styled('div')(({
804
805
  }
805
806
  }
806
807
  }));
808
+ function handleHeaderClick(event) {
809
+ const selection = document.getSelection();
810
+ if (selection === null) {
811
+ return;
812
+ }
813
+ if (selection.type === 'Range') {
814
+ // Disable the <a> behavior to be able to select text.
815
+ event.preventDefault();
816
+ }
817
+ }
807
818
  export const MarkdownElement = /*#__PURE__*/React.forwardRef(function MarkdownElement(props, ref) {
808
819
  const {
809
- className,
810
- renderedMarkdown
811
- } = props,
812
- other = _objectWithoutPropertiesLoose(props, _excluded);
820
+ className,
821
+ renderedMarkdown,
822
+ ...other
823
+ } = props;
824
+ const rootRef = React.useRef(null);
825
+ const handleRef = useForkRef(rootRef, ref);
826
+ React.useEffect(() => {
827
+ const elements = rootRef.current.getElementsByClassName('title-link-to-anchor');
828
+ for (let i = 0; i < elements.length; i += 1) {
829
+ // More reliable than `-webkit-user-drag` (https://caniuse.com/webkit-user-drag)
830
+ elements[i].setAttribute('draggable', 'false');
831
+ elements[i].addEventListener('click', handleHeaderClick);
832
+ }
833
+ }, []);
813
834
  const more = {};
814
835
  if (typeof renderedMarkdown === 'string') {
815
836
  // workaround for https://github.com/facebook/react/issues/17170
@@ -818,9 +839,10 @@ export const MarkdownElement = /*#__PURE__*/React.forwardRef(function MarkdownEl
818
839
  __html: renderedMarkdown
819
840
  };
820
841
  }
821
- return /*#__PURE__*/_jsx(Root, _extends({
822
- className: clsx('markdown-body', className)
823
- }, more, other, {
824
- ref: ref
825
- }));
842
+ return /*#__PURE__*/_jsx(Root, {
843
+ className: clsx('markdown-body', className),
844
+ ...more,
845
+ ...other,
846
+ ref: handleRef
847
+ });
826
848
  });
@@ -1 +1 @@
1
- export * from './MarkdownElement';
1
+ export * from "./MarkdownElement.js";
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
1
  import * as React from 'react';
3
2
  import PropTypes from 'prop-types';
4
3
  import NProgress from 'nprogress';
@@ -38,7 +37,7 @@ function NProgressBar(props) {
38
37
  return /*#__PURE__*/_jsxs(NoSsr, {
39
38
  children: [props.children, /*#__PURE__*/_jsx(GlobalStyles, {
40
39
  styles: theme => ({
41
- '#nprogress': _extends({
40
+ '#nprogress': {
42
41
  direction: 'ltr',
43
42
  pointerEvents: 'none',
44
43
  position: 'fixed',
@@ -47,10 +46,10 @@ function NProgressBar(props) {
47
46
  right: 0,
48
47
  height: 2,
49
48
  zIndex: (theme.vars || theme).zIndex.tooltip,
50
- backgroundColor: (theme.vars || theme).palette.primary[200]
51
- }, theme.applyDarkStyles({
52
- backgroundColor: (theme.vars || theme).palette.primary[700]
53
- }), {
49
+ backgroundColor: (theme.vars || theme).palette.primary[200],
50
+ ...theme.applyDarkStyles({
51
+ backgroundColor: (theme.vars || theme).palette.primary[700]
52
+ }),
54
53
  '& .nprogress-bar': {
55
54
  position: 'fixed',
56
55
  backgroundColor: (theme.vars || theme).palette.primary.main,
@@ -79,7 +78,7 @@ function NProgressBar(props) {
79
78
  right: -80,
80
79
  clip: 'rect(-6px,90px,14px,-6px)'
81
80
  }
82
- })
81
+ }
83
82
  })
84
83
  })]
85
84
  });
@@ -1 +1 @@
1
- export { default } from './NProgressBar';
1
+ export { default } from "./NProgressBar.js";
package/README.md CHANGED
@@ -9,7 +9,7 @@ Install the package in your project directory with:
9
9
  <!-- #default-branch-switch -->
10
10
 
11
11
  ```bash
12
- npm install @mui/docs@next
12
+ npm install @mui/docs
13
13
  ```
14
14
 
15
15
  The docs has a peer dependency on the core components.
@@ -18,7 +18,7 @@ If you are not already using Material UI in your project, you can add it with:
18
18
  <!-- #default-branch-switch -->
19
19
 
20
20
  ```bash
21
- npm install @mui/material@next
21
+ npm install @mui/material
22
22
  ```
23
23
 
24
24
  ## Documentation