@mui/docs 9.0.0-alpha.1 → 9.0.0-alpha.3
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/Ad/Ad.js +33 -42
- package/Ad/AdCarbon.js +18 -27
- package/Ad/AdDisplay.js +22 -29
- package/Ad/AdGuest.js +8 -15
- package/Ad/AdInHouse.js +4 -11
- package/Ad/AdManager.js +8 -17
- package/Ad/AdProvider.js +5 -13
- package/Ad/ad.styles.js +5 -13
- package/Ad/index.js +6 -62
- package/AnalyticsProvider/AnalyticsProvider.d.ts +17 -0
- package/AnalyticsProvider/AnalyticsProvider.js +225 -0
- package/AnalyticsProvider/index.d.ts +1 -0
- package/AnalyticsProvider/index.js +1 -0
- package/CHANGELOG.md +65 -0
- package/CodeCopy/CodeCopy.js +10 -19
- package/CodeCopy/CodeCopyButton.js +9 -16
- package/CodeCopy/index.js +3 -40
- package/CodeCopy/useClipboardCopy.js +4 -12
- package/ComponentLinkHeader/ComponentLinkHeader.js +46 -54
- package/ComponentLinkHeader/index.js +2 -24
- package/DemoContext/DemoContext.d.ts +86 -0
- package/DemoContext/DemoContext.js +13 -0
- package/DemoContext/index.d.ts +2 -0
- package/DemoContext/index.js +1 -0
- package/DocsProvider/DocsProvider.js +9 -17
- package/DocsProvider/index.js +1 -16
- package/Document/Document.d.ts +16 -0
- package/Document/Document.js +147 -0
- package/Document/getInitialProps.d.ts +18 -0
- package/Document/getInitialProps.js +62 -0
- package/Document/index.d.ts +2 -0
- package/Document/index.js +2 -0
- package/GoogleAnalytics/GoogleAnalytics.d.ts +9 -0
- package/GoogleAnalytics/GoogleAnalytics.js +129 -0
- package/GoogleAnalytics/index.d.ts +1 -0
- package/GoogleAnalytics/index.js +1 -0
- package/HighlightedCode/HighlightedCode.js +18 -26
- package/HighlightedCode/index.js +1 -16
- package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.js +22 -31
- package/HighlightedCodeWithTabs/index.js +2 -24
- package/IconImage/IconImage.d.ts +11 -0
- package/IconImage/IconImage.js +83 -0
- package/IconImage/index.d.ts +1 -0
- package/IconImage/index.js +1 -0
- package/InfoCard/InfoCard.js +20 -29
- package/InfoCard/index.js +1 -16
- package/Link/Link.js +17 -25
- package/Link/MarkdownLinks.d.ts +2 -0
- package/Link/MarkdownLinks.js +84 -0
- package/Link/SkipLink.d.ts +1 -0
- package/Link/SkipLink.js +66 -0
- package/Link/index.d.ts +3 -1
- package/Link/index.js +3 -16
- package/MarkdownElement/MarkdownElement.js +178 -186
- package/MarkdownElement/index.js +1 -16
- package/MuiPage/MuiPage.d.ts +67 -0
- package/MuiPage/MuiPage.js +1 -0
- package/MuiPage/index.d.ts +1 -0
- package/MuiPage/index.js +1 -0
- package/NextNProgressBar/NextNProgressBar.d.ts +1 -0
- package/NextNProgressBar/NextNProgressBar.js +44 -0
- package/NextNProgressBar/index.d.ts +1 -0
- package/NextNProgressBar/index.js +1 -0
- package/PageContext/PageContext.d.ts +31 -0
- package/PageContext/PageContext.js +6 -0
- package/PageContext/index.d.ts +2 -0
- package/PageContext/index.js +1 -0
- package/SectionHeadline/SectionHeadline.d.ts +13 -0
- package/SectionHeadline/SectionHeadline.js +81 -0
- package/SectionHeadline/index.d.ts +2 -0
- package/SectionHeadline/index.js +2 -0
- package/SectionTitle/SectionTitle.js +7 -13
- package/SectionTitle/index.js +1 -16
- package/StyledEngineProvider/StyledEngineProvider.d.ts +9 -0
- package/StyledEngineProvider/StyledEngineProvider.js +44 -0
- package/StyledEngineProvider/index.d.ts +1 -0
- package/StyledEngineProvider/index.js +1 -0
- package/ThemeContext/ThemeContext.d.ts +92 -0
- package/ThemeContext/ThemeContext.js +200 -0
- package/ThemeContext/index.d.ts +1 -0
- package/ThemeContext/index.js +1 -0
- package/branding/BrandingCssVarsProvider.d.ts +23 -0
- package/branding/BrandingCssVarsProvider.js +170 -0
- package/branding/BrandingProvider.js +8 -15
- package/branding/brandingTheme.js +115 -126
- package/branding/index.d.ts +2 -1
- package/branding/index.js +3 -27
- package/codeStyling/codeStyling.d.ts +10 -0
- package/codeStyling/codeStyling.js +84 -0
- package/codeStyling/index.d.ts +1 -0
- package/codeStyling/index.js +1 -0
- package/codeVariant/codeVariant.d.ts +10 -0
- package/codeVariant/codeVariant.js +73 -0
- package/codeVariant/index.d.ts +1 -0
- package/codeVariant/index.js +1 -0
- package/constants/constants.d.ts +13 -0
- package/constants/constants.js +15 -0
- package/constants/index.d.ts +1 -0
- package/constants/index.js +1 -0
- package/createEmotionCache/createEmotionCache.d.ts +1 -0
- package/createEmotionCache/createEmotionCache.js +12 -0
- package/createEmotionCache/index.d.ts +1 -0
- package/createEmotionCache/index.js +1 -0
- package/findActivePage/findActivePage.d.ts +5 -0
- package/findActivePage/findActivePage.js +35 -0
- package/findActivePage/index.d.ts +1 -0
- package/findActivePage/index.js +1 -0
- package/getProductInfoFromUrl/getProductInfoFromUrl.d.ts +8 -0
- package/getProductInfoFromUrl/getProductInfoFromUrl.js +50 -0
- package/getProductInfoFromUrl/index.d.ts +2 -0
- package/getProductInfoFromUrl/index.js +1 -0
- package/globalSelector/globalSelector.d.ts +2 -0
- package/globalSelector/globalSelector.js +17 -0
- package/globalSelector/index.d.ts +1 -0
- package/globalSelector/index.js +1 -0
- package/helpers/helpers.d.ts +31 -0
- package/helpers/helpers.js +87 -0
- package/helpers/index.d.ts +2 -0
- package/helpers/index.js +1 -0
- package/i18n/i18n.js +17 -29
- package/i18n/index.js +1 -16
- package/mapApiPageTranslations/index.d.ts +1 -0
- package/mapApiPageTranslations/index.js +1 -0
- package/mapApiPageTranslations/mapApiPageTranslations.d.ts +11 -0
- package/mapApiPageTranslations/mapApiPageTranslations.js +46 -0
- package/nextFonts/index.js +8 -15
- package/package.json +265 -102
- package/svgIcons/BundleSizeIcon.js +5 -11
- package/svgIcons/FigmaIcon.js +8 -14
- package/svgIcons/FileDownload.js +5 -12
- package/svgIcons/JavaScript.js +5 -12
- package/svgIcons/MarkdownIcon.js +7 -14
- package/svgIcons/MaterialDesignIcon.js +6 -12
- package/svgIcons/SketchIcon.js +10 -16
- package/svgIcons/TypeScript.js +5 -12
- package/svgIcons/W3CIcon.js +6 -12
- package/translations/index.js +3 -10
- package/translations/translations.json +0 -1
- package/useLazyCSS/index.d.ts +1 -0
- package/useLazyCSS/index.js +1 -0
- package/useLazyCSS/useLazyCSS.d.ts +11 -0
- package/useLazyCSS/useLazyCSS.js +70 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +2 -0
- package/utils/loadScript.js +1 -7
- package/Ad/Ad.d.mts +0 -5
- package/Ad/Ad.mjs +0 -226
- package/Ad/AdCarbon.d.mts +0 -2
- package/Ad/AdCarbon.mjs +0 -125
- package/Ad/AdDisplay.d.mts +0 -16
- package/Ad/AdDisplay.mjs +0 -86
- package/Ad/AdGuest.d.mts +0 -10
- package/Ad/AdGuest.mjs +0 -29
- package/Ad/AdInHouse.d.mts +0 -4
- package/Ad/AdInHouse.mjs +0 -14
- package/Ad/AdManager.d.mts +0 -19
- package/Ad/AdManager.mjs +0 -36
- package/Ad/AdProvider.d.mts +0 -15
- package/Ad/AdProvider.mjs +0 -24
- package/Ad/ad.styles.d.mts +0 -4512
- package/Ad/ad.styles.mjs +0 -91
- package/Ad/index.d.mts +0 -5
- package/Ad/index.mjs +0 -7
- package/CodeCopy/CodeCopy.d.mts +0 -22
- package/CodeCopy/CodeCopy.mjs +0 -172
- package/CodeCopy/CodeCopyButton.d.mts +0 -4
- package/CodeCopy/CodeCopyButton.mjs +0 -40
- package/CodeCopy/index.d.mts +0 -3
- package/CodeCopy/index.mjs +0 -3
- package/CodeCopy/useClipboardCopy.d.mts +0 -4
- package/CodeCopy/useClipboardCopy.mjs +0 -21
- package/ComponentLinkHeader/ComponentLinkHeader.d.mts +0 -8
- package/ComponentLinkHeader/ComponentLinkHeader.mjs +0 -197
- package/ComponentLinkHeader/index.d.mts +0 -2
- package/ComponentLinkHeader/index.mjs +0 -2
- package/DocsProvider/DocsProvider.d.mts +0 -24
- package/DocsProvider/DocsProvider.mjs +0 -31
- package/DocsProvider/index.d.mts +0 -1
- package/DocsProvider/index.mjs +0 -1
- package/HighlightedCode/HighlightedCode.d.mts +0 -14
- package/HighlightedCode/HighlightedCode.mjs +0 -67
- package/HighlightedCode/index.d.mts +0 -1
- package/HighlightedCode/index.mjs +0 -1
- package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.d.mts +0 -28
- package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.mjs +0 -362
- package/HighlightedCodeWithTabs/index.d.mts +0 -2
- package/HighlightedCodeWithTabs/index.mjs +0 -2
- package/InfoCard/InfoCard.d.mts +0 -22
- package/InfoCard/InfoCard.mjs +0 -87
- package/InfoCard/index.d.mts +0 -1
- package/InfoCard/index.mjs +0 -1
- package/Link/Link.d.mts +0 -25
- package/Link/Link.mjs +0 -75
- package/Link/index.d.mts +0 -1
- package/Link/index.mjs +0 -1
- package/MarkdownElement/MarkdownElement.d.mts +0 -7
- package/MarkdownElement/MarkdownElement.mjs +0 -847
- package/MarkdownElement/index.d.mts +0 -1
- package/MarkdownElement/index.mjs +0 -1
- package/NProgressBar/NProgressBar.d.mts +0 -6
- package/NProgressBar/NProgressBar.js +0 -98
- package/NProgressBar/index.d.mts +0 -2
- package/NProgressBar/index.d.ts +0 -2
- package/NProgressBar/index.js +0 -13
- package/NProgressBar/index.mjs +0 -1
- package/SectionTitle/SectionTitle.d.mts +0 -6
- package/SectionTitle/SectionTitle.mjs +0 -29
- package/SectionTitle/index.d.mts +0 -1
- package/SectionTitle/index.mjs +0 -1
- package/branding/BrandingProvider.d.mts +0 -9
- package/branding/BrandingProvider.mjs +0 -17
- package/branding/brandingTheme.d.mts +0 -147
- package/branding/brandingTheme.mjs +0 -1527
- package/branding/index.d.mts +0 -2
- package/branding/index.mjs +0 -2
- package/i18n/i18n.d.mts +0 -27
- package/i18n/i18n.mjs +0 -111
- package/i18n/index.d.mts +0 -1
- package/i18n/index.mjs +0 -1
- package/nextFonts/index.d.mts +0 -6
- package/nextFonts/index.mjs +0 -59
- package/svgIcons/BundleSizeIcon.d.mts +0 -4
- package/svgIcons/BundleSizeIcon.mjs +0 -13
- package/svgIcons/FigmaIcon.d.mts +0 -4
- package/svgIcons/FigmaIcon.mjs +0 -22
- package/svgIcons/FileDownload.d.mts +0 -6
- package/svgIcons/FileDownload.mjs +0 -13
- package/svgIcons/JavaScript.d.mts +0 -6
- package/svgIcons/JavaScript.mjs +0 -13
- package/svgIcons/MarkdownIcon.d.mts +0 -2
- package/svgIcons/MarkdownIcon.mjs +0 -22
- package/svgIcons/MaterialDesignIcon.d.mts +0 -4
- package/svgIcons/MaterialDesignIcon.mjs +0 -18
- package/svgIcons/SketchIcon.d.mts +0 -4
- package/svgIcons/SketchIcon.mjs +0 -27
- package/svgIcons/TypeScript.d.mts +0 -6
- package/svgIcons/TypeScript.mjs +0 -13
- package/svgIcons/W3CIcon.d.mts +0 -4
- package/svgIcons/W3CIcon.mjs +0 -15
- package/translations/index.d.mts +0 -3
- package/translations/index.mjs +0 -4
- package/utils/loadScript.d.mts +0 -1
- package/utils/loadScript.mjs +0 -7
- /package/{NProgressBar → NextNProgressBar}/NProgressBar.d.ts +0 -0
- /package/{NProgressBar/NProgressBar.mjs → NextNProgressBar/NProgressBar.js} +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* basically just a `useAnalytics` hook.
|
|
4
|
+
* However, it needs the redux store which is created
|
|
5
|
+
* in the same component this "hook" is used.
|
|
6
|
+
*/
|
|
7
|
+
declare function GoogleAnalytics(): null;
|
|
8
|
+
declare const _default: React.MemoExoticComponent<typeof GoogleAnalytics>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
3
|
+
import { useRouter } from 'next/router';
|
|
4
|
+
import { useNoSsrCodeVariant } from '@mui/docs/codeVariant';
|
|
5
|
+
import { useUserLanguage } from '@mui/docs/i18n';
|
|
6
|
+
import { pathnameToLanguage } from '@mui/docs/helpers';
|
|
7
|
+
import { ThemeOptionsContext } from '@mui/docs/ThemeContext';
|
|
8
|
+
|
|
9
|
+
// So we can write code like:
|
|
10
|
+
//
|
|
11
|
+
// <Button
|
|
12
|
+
// data-ga-event-category="demo"
|
|
13
|
+
// data-ga-event-action="expand"
|
|
14
|
+
// >
|
|
15
|
+
// Foo
|
|
16
|
+
// </Button>
|
|
17
|
+
function handleClick(event) {
|
|
18
|
+
let el = event.target;
|
|
19
|
+
while (el && el !== document) {
|
|
20
|
+
const element = el;
|
|
21
|
+
const category = element.getAttribute('data-ga-event-category');
|
|
22
|
+
|
|
23
|
+
// We reach a tracking element, no need to look higher in the dom tree.
|
|
24
|
+
if (category) {
|
|
25
|
+
const split = parseFloat(element.getAttribute('data-ga-event-split') || '');
|
|
26
|
+
if (split && split < Math.random()) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
window.gtag('event', category, {
|
|
30
|
+
eventAction: element.getAttribute('data-ga-event-action'),
|
|
31
|
+
eventLabel: element.getAttribute('data-ga-event-label')
|
|
32
|
+
});
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
el = element.parentElement;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
let boundDataGaListener = false;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* basically just a `useAnalytics` hook.
|
|
42
|
+
* However, it needs the redux store which is created
|
|
43
|
+
* in the same component this "hook" is used.
|
|
44
|
+
*/
|
|
45
|
+
function GoogleAnalytics() {
|
|
46
|
+
React.useEffect(() => {
|
|
47
|
+
if (!boundDataGaListener) {
|
|
48
|
+
boundDataGaListener = true;
|
|
49
|
+
document.addEventListener('click', handleClick);
|
|
50
|
+
}
|
|
51
|
+
}, []);
|
|
52
|
+
const router = useRouter();
|
|
53
|
+
const timeout = React.useRef(null);
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
// Wait for the title to be updated.
|
|
56
|
+
// React fires useEffect twice in dev mode
|
|
57
|
+
if (timeout.current) {
|
|
58
|
+
clearTimeout(timeout.current);
|
|
59
|
+
}
|
|
60
|
+
timeout.current = setTimeout(() => {
|
|
61
|
+
const {
|
|
62
|
+
canonicalAsServer
|
|
63
|
+
} = pathnameToLanguage(window.location.pathname);
|
|
64
|
+
|
|
65
|
+
// https://developers.google.com/analytics/devguides/collection/ga4/views?client_type=gtag
|
|
66
|
+
const productIdMeta = document.querySelector('meta[name="mui:productId"]');
|
|
67
|
+
const productCategoryIdMeta = document.querySelector('meta[name="mui:productCategoryId"]');
|
|
68
|
+
window.gtag('event', 'page_view', {
|
|
69
|
+
page_title: document.title,
|
|
70
|
+
page_location: canonicalAsServer,
|
|
71
|
+
productId: productIdMeta?.content,
|
|
72
|
+
productCategoryId: productCategoryIdMeta?.content
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}, [router.route]);
|
|
76
|
+
const codeVariant = useNoSsrCodeVariant();
|
|
77
|
+
React.useEffect(() => {
|
|
78
|
+
window.gtag('set', 'user_properties', {
|
|
79
|
+
codeVariant
|
|
80
|
+
});
|
|
81
|
+
}, [codeVariant]);
|
|
82
|
+
const userLanguage = useUserLanguage();
|
|
83
|
+
React.useEffect(() => {
|
|
84
|
+
window.gtag('set', 'user_properties', {
|
|
85
|
+
userLanguage
|
|
86
|
+
});
|
|
87
|
+
}, [userLanguage]);
|
|
88
|
+
React.useEffect(() => {
|
|
89
|
+
/**
|
|
90
|
+
* Based on https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio#Monitoring_screen_resolution_or_zoom_level_changes
|
|
91
|
+
* Adjusted to track 3 or more different ratios
|
|
92
|
+
*/
|
|
93
|
+
function trackDevicePixelRation() {
|
|
94
|
+
const devicePixelRatio = Math.round(window.devicePixelRatio * 10) / 10;
|
|
95
|
+
window.gtag('set', 'user_properties', {
|
|
96
|
+
devicePixelRatio
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
trackDevicePixelRation();
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @type {MediaQueryList}
|
|
103
|
+
*/
|
|
104
|
+
const matchMedia = window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);
|
|
105
|
+
// Intentionally use deprecated listener methods to support iOS & old browsers
|
|
106
|
+
matchMedia.addListener(trackDevicePixelRation);
|
|
107
|
+
return () => {
|
|
108
|
+
matchMedia.removeListener(trackDevicePixelRation);
|
|
109
|
+
};
|
|
110
|
+
}, []);
|
|
111
|
+
const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)', {
|
|
112
|
+
noSsr: true
|
|
113
|
+
});
|
|
114
|
+
const colorSchemeOS = prefersDarkMode ? 'dark' : 'light';
|
|
115
|
+
const themeOptions = React.useContext(ThemeOptionsContext);
|
|
116
|
+
const colorScheme = themeOptions.paletteMode;
|
|
117
|
+
React.useEffect(() => {
|
|
118
|
+
window.gtag('set', 'user_properties', {
|
|
119
|
+
colorSchemeOS
|
|
120
|
+
});
|
|
121
|
+
}, [colorSchemeOS]);
|
|
122
|
+
React.useEffect(() => {
|
|
123
|
+
window.gtag('set', 'user_properties', {
|
|
124
|
+
colorScheme
|
|
125
|
+
});
|
|
126
|
+
}, [colorScheme]);
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
export default /*#__PURE__*/React.memo(GoogleAnalytics);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./GoogleAnalytics.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./GoogleAnalytics.js";
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _prism = _interopRequireDefault(require("@mui/internal-markdown/prism"));
|
|
11
|
-
var _NoSsr = require("@mui/base/NoSsr");
|
|
12
|
-
var _styles = require("@mui/material/styles");
|
|
13
|
-
var _CodeCopy = require("../CodeCopy");
|
|
14
|
-
var _MarkdownElement = require("../MarkdownElement");
|
|
15
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
const Pre = (0, _styles.styled)('pre')(({
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import prism from '@mui/internal-markdown/prism';
|
|
3
|
+
import { NoSsr } from '@mui/base/NoSsr';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import { useCodeCopy, CodeCopyButton } from "../CodeCopy/index.js";
|
|
6
|
+
import { MarkdownElement } from "../MarkdownElement/index.js";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
const Pre = styled('pre')(({
|
|
17
9
|
theme
|
|
18
10
|
}) => ({
|
|
19
11
|
margin: 0,
|
|
@@ -31,37 +23,37 @@ const Pre = (0, _styles.styled)('pre')(({
|
|
|
31
23
|
// https://github.com/necolas/normalize.css/blob/master/normalize.css#L102
|
|
32
24
|
}
|
|
33
25
|
}));
|
|
34
|
-
function HighlightedCode(props) {
|
|
26
|
+
export function HighlightedCode(props) {
|
|
35
27
|
const {
|
|
36
28
|
code,
|
|
37
29
|
copyButtonHidden = false,
|
|
38
30
|
copyButtonProps,
|
|
39
31
|
language,
|
|
40
32
|
plainStyle,
|
|
41
|
-
parentComponent: Component = plainStyle ? React.Fragment :
|
|
33
|
+
parentComponent: Component = plainStyle ? React.Fragment : MarkdownElement,
|
|
42
34
|
preComponent: PreComponent = plainStyle ? Pre : 'pre',
|
|
43
35
|
...other
|
|
44
36
|
} = props;
|
|
45
37
|
const renderedCode = React.useMemo(() => {
|
|
46
|
-
return (
|
|
38
|
+
return prism(code.trim(), language);
|
|
47
39
|
}, [code, language]);
|
|
48
|
-
const handlers =
|
|
40
|
+
const handlers = useCodeCopy();
|
|
49
41
|
const componentProps = !plainStyle ? other : undefined;
|
|
50
|
-
return /*#__PURE__*/(
|
|
42
|
+
return /*#__PURE__*/_jsx(Component, {
|
|
51
43
|
...componentProps,
|
|
52
|
-
children: /*#__PURE__*/(
|
|
44
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
53
45
|
className: "MuiCode-root",
|
|
54
46
|
...handlers,
|
|
55
47
|
style: {
|
|
56
48
|
height: '100%'
|
|
57
49
|
},
|
|
58
|
-
children: [copyButtonHidden ? null : /*#__PURE__*/(
|
|
59
|
-
children: /*#__PURE__*/(
|
|
50
|
+
children: [copyButtonHidden ? null : /*#__PURE__*/_jsx(NoSsr, {
|
|
51
|
+
children: /*#__PURE__*/_jsx(CodeCopyButton, {
|
|
60
52
|
code: code,
|
|
61
53
|
...copyButtonProps
|
|
62
54
|
})
|
|
63
|
-
}), /*#__PURE__*/(
|
|
64
|
-
children: /*#__PURE__*/(
|
|
55
|
+
}), /*#__PURE__*/_jsx(PreComponent, {
|
|
56
|
+
children: /*#__PURE__*/_jsx("code", {
|
|
65
57
|
className: `language-${language}`
|
|
66
58
|
// eslint-disable-next-line react/no-danger
|
|
67
59
|
,
|
package/HighlightedCode/index.js
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _HighlightedCode = require("./HighlightedCode");
|
|
7
|
-
Object.keys(_HighlightedCode).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _HighlightedCode[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _HighlightedCode[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
1
|
+
export * from "./HighlightedCode.js";
|
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _styles = require("@mui/material/styles");
|
|
12
|
-
var _Tabs = require("@mui/base/Tabs");
|
|
13
|
-
var _TabsList = require("@mui/base/TabsList");
|
|
14
|
-
var _TabPanel = require("@mui/base/TabPanel");
|
|
15
|
-
var _Tab = require("@mui/base/Tab");
|
|
16
|
-
var _useLocalStorageState = _interopRequireDefault(require("@mui/utils/useLocalStorageState"));
|
|
17
|
-
var _HighlightedCode = require("../HighlightedCode");
|
|
18
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
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/index.js";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
10
|
const PACKAGE_MANAGER_ORDER = new Map(['npm', 'pnpm', 'yarn'].map((manager, index) => [manager, index]));
|
|
20
|
-
const CodeTabList =
|
|
11
|
+
export const CodeTabList = styled(TabsListBase)(({
|
|
21
12
|
theme
|
|
22
13
|
}) => ({
|
|
23
14
|
display: 'flex',
|
|
@@ -26,7 +17,7 @@ const CodeTabList = exports.CodeTabList = (0, _styles.styled)(_TabsList.TabsList
|
|
|
26
17
|
borderRight: '1px solid',
|
|
27
18
|
overflowX: 'auto',
|
|
28
19
|
...theme.applyDarkStyles({
|
|
29
|
-
backgroundColor:
|
|
20
|
+
backgroundColor: alpha(theme.palette.primaryDark[800], 0.2)
|
|
30
21
|
}),
|
|
31
22
|
variants: [{
|
|
32
23
|
props: ({
|
|
@@ -117,7 +108,7 @@ const CodeTabList = exports.CodeTabList = (0, _styles.styled)(_TabsList.TabsList
|
|
|
117
108
|
ownerState
|
|
118
109
|
}) => ownerState?.contained,
|
|
119
110
|
style: {
|
|
120
|
-
backgroundColor:
|
|
111
|
+
backgroundColor: alpha(theme.palette.grey[50], 0.2)
|
|
121
112
|
}
|
|
122
113
|
}, {
|
|
123
114
|
props: ({
|
|
@@ -128,7 +119,7 @@ const CodeTabList = exports.CodeTabList = (0, _styles.styled)(_TabsList.TabsList
|
|
|
128
119
|
}
|
|
129
120
|
}]
|
|
130
121
|
}));
|
|
131
|
-
const CodeTabPanel =
|
|
122
|
+
export const CodeTabPanel = styled(TabPanelBase)({
|
|
132
123
|
'& pre': {
|
|
133
124
|
borderTopLeftRadius: 0,
|
|
134
125
|
borderTopRightRadius: 0,
|
|
@@ -190,7 +181,7 @@ const CodeTabPanel = exports.CodeTabPanel = (0, _styles.styled)(_TabPanel.TabPan
|
|
|
190
181
|
}
|
|
191
182
|
}]
|
|
192
183
|
});
|
|
193
|
-
const CodeTab =
|
|
184
|
+
export const CodeTab = styled(TabBase)(({
|
|
194
185
|
theme
|
|
195
186
|
}) => ({
|
|
196
187
|
variants: [{
|
|
@@ -271,7 +262,7 @@ const CodeTab = exports.CodeTab = (0, _styles.styled)(_Tab.Tab)(({
|
|
|
271
262
|
}) => !ownerState?.contained,
|
|
272
263
|
style: {
|
|
273
264
|
'&:hover': {
|
|
274
|
-
backgroundColor:
|
|
265
|
+
backgroundColor: alpha(theme.palette.primaryDark[500], 0.5),
|
|
275
266
|
color: (theme.vars || theme).palette.grey[400]
|
|
276
267
|
}
|
|
277
268
|
}
|
|
@@ -315,7 +306,7 @@ const CodeTab = exports.CodeTab = (0, _styles.styled)(_Tab.Tab)(({
|
|
|
315
306
|
}
|
|
316
307
|
})
|
|
317
308
|
}));
|
|
318
|
-
function HighlightedCodeWithTabs(props) {
|
|
309
|
+
export function HighlightedCodeWithTabs(props) {
|
|
319
310
|
const {
|
|
320
311
|
tabs,
|
|
321
312
|
storageKey
|
|
@@ -329,7 +320,7 @@ function HighlightedCodeWithTabs(props) {
|
|
|
329
320
|
}
|
|
330
321
|
return result;
|
|
331
322
|
}, [storageKey, tabs]);
|
|
332
|
-
const [activeTab, setActiveTab] = (
|
|
323
|
+
const [activeTab, setActiveTab] = useLocalStorageState(storageKey ?? null, availableTabs[0]);
|
|
333
324
|
// During hydration, activeTab is null, default to first value.
|
|
334
325
|
const defaultizedActiveTab = activeTab ?? availableTabs[0];
|
|
335
326
|
const [mounted, setMounted] = React.useState(false);
|
|
@@ -342,15 +333,15 @@ function HighlightedCodeWithTabs(props) {
|
|
|
342
333
|
const ownerState = {
|
|
343
334
|
mounted
|
|
344
335
|
};
|
|
345
|
-
return /*#__PURE__*/(
|
|
336
|
+
return /*#__PURE__*/_jsxs(Tabs, {
|
|
346
337
|
selectionFollowsFocus: true,
|
|
347
338
|
value: defaultizedActiveTab,
|
|
348
339
|
onChange: handleChange,
|
|
349
|
-
children: [/*#__PURE__*/(
|
|
340
|
+
children: [/*#__PURE__*/_jsx(CodeTabList, {
|
|
350
341
|
ownerState: ownerState,
|
|
351
342
|
children: tabs.map(({
|
|
352
343
|
tab
|
|
353
|
-
}) => /*#__PURE__*/(
|
|
344
|
+
}) => /*#__PURE__*/_jsx(CodeTab, {
|
|
354
345
|
ownerState: ownerState,
|
|
355
346
|
value: tab,
|
|
356
347
|
children: tab
|
|
@@ -359,10 +350,10 @@ function HighlightedCodeWithTabs(props) {
|
|
|
359
350
|
tab,
|
|
360
351
|
language,
|
|
361
352
|
code
|
|
362
|
-
}) => /*#__PURE__*/(
|
|
353
|
+
}) => /*#__PURE__*/_jsx(CodeTabPanel, {
|
|
363
354
|
ownerState: ownerState,
|
|
364
355
|
value: tab,
|
|
365
|
-
children: /*#__PURE__*/(
|
|
356
|
+
children: /*#__PURE__*/_jsx(HighlightedCode, {
|
|
366
357
|
language: language || 'bash',
|
|
367
358
|
code: typeof code === 'function' ? code(tab) : code
|
|
368
359
|
})
|
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
|
|
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
|
-
});
|
|
1
|
+
export * from "./HighlightedCodeWithTabs.js";
|
|
2
|
+
export { HighlightedCodeWithTabs as default } from "./HighlightedCodeWithTabs.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Theme } from '@mui/material/styles';
|
|
3
|
+
import { SxProps } from '@mui/system';
|
|
4
|
+
export type IconImageProps = {
|
|
5
|
+
name: 'product-core' | 'product-advanced' | 'product-toolpad' | 'product-templates' | 'product-designkits' | 'pricing/x-plan-pro' | 'pricing/x-plan-premium' | 'pricing/x-plan-community' | 'pricing/yes' | 'pricing/no' | 'pricing/time' | 'companies/spotify' | 'companies/amazon' | 'companies/nasa' | 'companies/netflix' | 'companies/unity' | 'companies/shutterstock' | 'companies/southwest' | 'companies/siemens' | 'companies/deloitte' | 'companies/apple' | 'companies/twitter' | 'companies/salesforce' | 'companies/verizon' | 'companies/atandt' | 'companies/patreon' | 'companies/ebay' | 'companies/samsung' | 'companies/volvo' | 'companies/tesla' | string;
|
|
6
|
+
height?: number;
|
|
7
|
+
mode?: '' | 'light' | 'dark';
|
|
8
|
+
sx?: SxProps<Theme>;
|
|
9
|
+
width?: number;
|
|
10
|
+
} & Omit<React.JSX.IntrinsicElements['img'], 'ref'>;
|
|
11
|
+
export default function IconImage(props: IconImageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import { ThemeOptionsContext } from "../ThemeContext/index.js";
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
const Img = styled('img')({
|
|
7
|
+
display: 'inline-block',
|
|
8
|
+
verticalAlign: 'bottom'
|
|
9
|
+
});
|
|
10
|
+
let neverHydrated = true;
|
|
11
|
+
export default function IconImage(props) {
|
|
12
|
+
const {
|
|
13
|
+
height: heightProp,
|
|
14
|
+
name,
|
|
15
|
+
width: widthProp,
|
|
16
|
+
mode: modeProp,
|
|
17
|
+
...other
|
|
18
|
+
} = props;
|
|
19
|
+
const themeOptions = React.useContext(ThemeOptionsContext);
|
|
20
|
+
const [firstRender, setFirstRender] = React.useState(true);
|
|
21
|
+
React.useEffect(() => {
|
|
22
|
+
setFirstRender(false);
|
|
23
|
+
neverHydrated = false;
|
|
24
|
+
}, []);
|
|
25
|
+
let defaultWidth;
|
|
26
|
+
let defaultHeight;
|
|
27
|
+
const mode = modeProp ?? themeOptions.paletteMode;
|
|
28
|
+
if (name.startsWith('product-')) {
|
|
29
|
+
defaultWidth = 36;
|
|
30
|
+
defaultHeight = 36;
|
|
31
|
+
} else if (name.startsWith('pricing/x-plan-')) {
|
|
32
|
+
defaultWidth = 17;
|
|
33
|
+
defaultHeight = 20;
|
|
34
|
+
} else if (['pricing/yes', 'pricing/no', 'pricing/time'].includes(name)) {
|
|
35
|
+
defaultWidth = 18;
|
|
36
|
+
defaultHeight = 18;
|
|
37
|
+
}
|
|
38
|
+
const width = widthProp ?? defaultWidth;
|
|
39
|
+
const height = heightProp ?? defaultHeight;
|
|
40
|
+
|
|
41
|
+
// First time render with a theme depend image
|
|
42
|
+
if (firstRender && neverHydrated && mode !== '') {
|
|
43
|
+
if (other.loading === 'eager') {
|
|
44
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
45
|
+
children: [/*#__PURE__*/_jsx(Img, {
|
|
46
|
+
className: "only-light-mode-v2",
|
|
47
|
+
src: `/static/branding/${name}-light.svg`,
|
|
48
|
+
alt: "",
|
|
49
|
+
width: width,
|
|
50
|
+
height: height,
|
|
51
|
+
...other,
|
|
52
|
+
loading: "lazy"
|
|
53
|
+
}), /*#__PURE__*/_jsx(Img, {
|
|
54
|
+
className: "only-dark-mode-v2",
|
|
55
|
+
src: `/static/branding/${name}-dark.svg`,
|
|
56
|
+
alt: "",
|
|
57
|
+
width: width,
|
|
58
|
+
height: height,
|
|
59
|
+
...other,
|
|
60
|
+
loading: "lazy"
|
|
61
|
+
})]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Prevent hydration mismatch between the light and dark mode image source.
|
|
66
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
67
|
+
component: "span",
|
|
68
|
+
sx: {
|
|
69
|
+
width,
|
|
70
|
+
height,
|
|
71
|
+
display: 'inline-block'
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return /*#__PURE__*/_jsx(Img, {
|
|
76
|
+
src: `/static/branding/${name}${mode ? `-${mode}` : ''}.svg`,
|
|
77
|
+
alt: "",
|
|
78
|
+
loading: "lazy",
|
|
79
|
+
width: width,
|
|
80
|
+
height: height,
|
|
81
|
+
...other
|
|
82
|
+
});
|
|
83
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, type IconImageProps } from "./IconImage.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./IconImage.js";
|
package/InfoCard/InfoCard.js
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
exports.InfoCard = InfoCard;
|
|
10
|
-
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _styles = require("@mui/material/styles");
|
|
12
|
-
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
13
|
-
var _Paper = _interopRequireDefault(require("@mui/material/Paper"));
|
|
14
|
-
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
15
|
-
var _Link = require("../Link");
|
|
16
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
function GlowingIconContainer({
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { alpha } from '@mui/material/styles';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import Paper from '@mui/material/Paper';
|
|
5
|
+
import Typography from '@mui/material/Typography';
|
|
6
|
+
import { Link } from "../Link/index.js";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
export function GlowingIconContainer({
|
|
18
9
|
icon
|
|
19
10
|
}) {
|
|
20
|
-
return /*#__PURE__*/(
|
|
11
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
21
12
|
sx: theme => ({
|
|
22
13
|
width: 36,
|
|
23
14
|
height: 36,
|
|
@@ -29,20 +20,20 @@ function GlowingIconContainer({
|
|
|
29
20
|
border: '1px solid',
|
|
30
21
|
borderColor: 'primary.200',
|
|
31
22
|
bgcolor: 'primary.50',
|
|
32
|
-
boxShadow: `0px 0 0 2px ${
|
|
23
|
+
boxShadow: `0px 0 0 2px ${alpha(theme.palette.primary[500], 0.1)}, 0px 2px 12px 0px rgba(234, 237, 241, 0.3) inset`,
|
|
33
24
|
'& .MuiSvgIcon-root': {
|
|
34
25
|
fontSize: theme.typography.pxToRem(18)
|
|
35
26
|
},
|
|
36
27
|
...theme.applyDarkStyles({
|
|
37
|
-
borderColor:
|
|
38
|
-
bgcolor:
|
|
39
|
-
boxShadow: `0 0 0 2px ${
|
|
28
|
+
borderColor: alpha(theme.palette.primary[400], 0.25),
|
|
29
|
+
bgcolor: alpha(theme.palette.primary[900], 0.2),
|
|
30
|
+
boxShadow: `0 0 0 2px ${alpha(theme.palette.primary[600], 0.1)}, 0px 2px 12px 0px rgba(0, 0, 0, 0.25) inset`
|
|
40
31
|
})
|
|
41
32
|
}),
|
|
42
33
|
children: icon
|
|
43
34
|
});
|
|
44
35
|
}
|
|
45
|
-
function InfoCard(props) {
|
|
36
|
+
export function InfoCard(props) {
|
|
46
37
|
const {
|
|
47
38
|
classNameDescription,
|
|
48
39
|
classNameTitle,
|
|
@@ -54,9 +45,9 @@ function InfoCard(props) {
|
|
|
54
45
|
titleProps,
|
|
55
46
|
...other
|
|
56
47
|
} = props;
|
|
57
|
-
return /*#__PURE__*/(
|
|
48
|
+
return /*#__PURE__*/_jsxs(Paper, {
|
|
58
49
|
variant: "outlined",
|
|
59
|
-
component: link ?
|
|
50
|
+
component: link ? Link : 'div',
|
|
60
51
|
href: link,
|
|
61
52
|
...(link ? {
|
|
62
53
|
noLinkStyle: true,
|
|
@@ -68,15 +59,15 @@ function InfoCard(props) {
|
|
|
68
59
|
height: '100%',
|
|
69
60
|
background: `${(theme.vars || theme).palette.gradients.linearSubtle}`,
|
|
70
61
|
...theme.applyDarkStyles({
|
|
71
|
-
bgcolor:
|
|
62
|
+
bgcolor: alpha(theme.palette.primaryDark[800], 0.25),
|
|
72
63
|
background: `${(theme.vars || theme).palette.gradients.linearSubtle}`,
|
|
73
64
|
borderColor: 'primaryDark.700'
|
|
74
65
|
})
|
|
75
66
|
}),
|
|
76
67
|
...other,
|
|
77
|
-
children: [svg && svg, icon && /*#__PURE__*/(
|
|
68
|
+
children: [svg && svg, icon && /*#__PURE__*/_jsx(GlowingIconContainer, {
|
|
78
69
|
icon: icon
|
|
79
|
-
}), /*#__PURE__*/(
|
|
70
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
80
71
|
fontWeight: "semiBold",
|
|
81
72
|
component: "h3",
|
|
82
73
|
color: "text.primary",
|
|
@@ -86,7 +77,7 @@ function InfoCard(props) {
|
|
|
86
77
|
className: classNameTitle,
|
|
87
78
|
...titleProps,
|
|
88
79
|
children: title
|
|
89
|
-
}), /*#__PURE__*/(
|
|
80
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
90
81
|
variant: "body2",
|
|
91
82
|
color: "text.secondary",
|
|
92
83
|
className: classNameDescription,
|
package/InfoCard/index.js
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _InfoCard = require("./InfoCard");
|
|
7
|
-
Object.keys(_InfoCard).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _InfoCard[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _InfoCard[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
1
|
+
export * from "./InfoCard.js";
|