@mui/docs 9.0.0-alpha.2 → 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 +37 -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.js +13 -21
- package/IconImage/index.js +1 -13
- 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.js +9 -17
- package/SectionHeadline/index.js +2 -25
- 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.js +26 -38
- package/ThemeContext/index.js +1 -42
- 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 +231 -126
- 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.js +1 -13
- package/useLazyCSS/useLazyCSS.js +5 -11
- 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/IconImage/IconImage.d.mts +0 -11
- package/IconImage/IconImage.mjs +0 -83
- package/IconImage/index.d.mts +0 -1
- package/IconImage/index.mjs +0 -1
- 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/SectionHeadline/SectionHeadline.d.mts +0 -13
- package/SectionHeadline/SectionHeadline.mjs +0 -81
- package/SectionHeadline/index.d.mts +0 -2
- package/SectionHeadline/index.mjs +0 -2
- 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/ThemeContext/ThemeContext.d.mts +0 -92
- package/ThemeContext/ThemeContext.mjs +0 -200
- package/ThemeContext/index.d.mts +0 -1
- package/ThemeContext/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/useLazyCSS/index.d.mts +0 -1
- package/useLazyCSS/index.mjs +0 -1
- package/useLazyCSS/useLazyCSS.d.mts +0 -11
- package/useLazyCSS/useLazyCSS.mjs +0 -70
- 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,225 @@
|
|
|
1
|
+
var _CookieOutlinedIcon, _BrandingCssThemeProv;
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import Button from '@mui/material/Button';
|
|
4
|
+
import Fade from '@mui/material/Fade';
|
|
5
|
+
import Paper from '@mui/material/Paper';
|
|
6
|
+
import Box from '@mui/material/Box';
|
|
7
|
+
import Stack from '@mui/material/Stack';
|
|
8
|
+
import Typography from '@mui/material/Typography';
|
|
9
|
+
import useLocalStorageState from '@mui/utils/useLocalStorageState';
|
|
10
|
+
import { alpha } from '@mui/system';
|
|
11
|
+
import Portal from '@mui/material/Portal';
|
|
12
|
+
import TrapFocus from '@mui/material/Unstable_TrapFocus';
|
|
13
|
+
import CookieOutlinedIcon from '@mui/icons-material/CookieOutlined';
|
|
14
|
+
import { BrandingCssThemeProvider } from "../branding/BrandingCssVarsProvider.js";
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
const COOKIE_CONSENT_KEY = 'docs-cookie-consent';
|
|
17
|
+
function getDoNotTrack() {
|
|
18
|
+
if (typeof window === 'undefined') {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
// Check for Do Not Track (DNT)
|
|
22
|
+
return navigator.doNotTrack === '1' || window.doNotTrack === '1';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// DNT doesn't change during a session, so we can use a simple external store
|
|
26
|
+
const subscribeToNothing = () => () => {};
|
|
27
|
+
const getDoNotTrackSnapshot = () => getDoNotTrack();
|
|
28
|
+
const getDoNotTrackServerSnapshot = () => true; // Assume DNT until we know the actual value
|
|
29
|
+
|
|
30
|
+
function useDoNotTrack() {
|
|
31
|
+
return React.useSyncExternalStore(subscribeToNothing, getDoNotTrackSnapshot, getDoNotTrackServerSnapshot);
|
|
32
|
+
}
|
|
33
|
+
const AnalyticsContext = /*#__PURE__*/React.createContext({
|
|
34
|
+
consentStatus: null,
|
|
35
|
+
hasAnalyticsConsent: false,
|
|
36
|
+
needsConsent: false,
|
|
37
|
+
setAnalyticsConsent: () => {},
|
|
38
|
+
setEssentialOnly: () => {}
|
|
39
|
+
});
|
|
40
|
+
export function useAnalyticsConsent() {
|
|
41
|
+
return React.useContext(AnalyticsContext);
|
|
42
|
+
}
|
|
43
|
+
export function CookieConsentDialog() {
|
|
44
|
+
const {
|
|
45
|
+
needsConsent,
|
|
46
|
+
setAnalyticsConsent,
|
|
47
|
+
setEssentialOnly
|
|
48
|
+
} = useAnalyticsConsent();
|
|
49
|
+
const [show, setShow] = React.useState(false);
|
|
50
|
+
React.useEffect(() => {
|
|
51
|
+
if (needsConsent) {
|
|
52
|
+
// Double rAF to ensure the initial opacity: 0 state is painted before transitioning
|
|
53
|
+
const frame = requestAnimationFrame(() => {
|
|
54
|
+
requestAnimationFrame(() => {
|
|
55
|
+
setShow(true);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
return () => cancelAnimationFrame(frame);
|
|
59
|
+
}
|
|
60
|
+
setShow(false);
|
|
61
|
+
return undefined;
|
|
62
|
+
}, [needsConsent]);
|
|
63
|
+
return /*#__PURE__*/_jsx(Portal, {
|
|
64
|
+
children: /*#__PURE__*/_jsx(TrapFocus, {
|
|
65
|
+
open: needsConsent,
|
|
66
|
+
disableAutoFocus: true,
|
|
67
|
+
disableEnforceFocus: true,
|
|
68
|
+
children: /*#__PURE__*/_jsx(Fade, {
|
|
69
|
+
in: show,
|
|
70
|
+
unmountOnExit: true,
|
|
71
|
+
children: /*#__PURE__*/_jsx(Paper, {
|
|
72
|
+
role: "dialog",
|
|
73
|
+
"aria-modal": "false",
|
|
74
|
+
"aria-labelledby": "cookie-consent-dialog-title",
|
|
75
|
+
"aria-describedby": "cookie-consent-dialog-description",
|
|
76
|
+
variant: "outlined",
|
|
77
|
+
tabIndex: -1,
|
|
78
|
+
sx: theme => ({
|
|
79
|
+
position: 'fixed',
|
|
80
|
+
bottom: 0,
|
|
81
|
+
right: 0,
|
|
82
|
+
p: 2,
|
|
83
|
+
m: 2,
|
|
84
|
+
maxWidth: 340,
|
|
85
|
+
pointerEvents: 'auto',
|
|
86
|
+
boxShadow: theme.shadows[2],
|
|
87
|
+
zIndex: theme.zIndex.snackbar,
|
|
88
|
+
...(theme.applyDarkStyles ? theme.applyDarkStyles({
|
|
89
|
+
bgcolor: 'primaryDark.900'
|
|
90
|
+
}) : {
|
|
91
|
+
[theme.getColorSchemeSelector?.('dark') || '&.mode-dark']: {
|
|
92
|
+
bgcolor: 'primaryDark.900'
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
}),
|
|
96
|
+
children: /*#__PURE__*/_jsxs(Stack, {
|
|
97
|
+
direction: "column",
|
|
98
|
+
spacing: 3,
|
|
99
|
+
sx: {
|
|
100
|
+
justifyContent: 'flex-start'
|
|
101
|
+
},
|
|
102
|
+
children: [/*#__PURE__*/_jsxs(Stack, {
|
|
103
|
+
spacing: 1,
|
|
104
|
+
sx: {
|
|
105
|
+
flexShrink: 1,
|
|
106
|
+
alignSelf: {
|
|
107
|
+
xs: 'flex-start',
|
|
108
|
+
sm: 'center'
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
112
|
+
sx: theme => ({
|
|
113
|
+
borderRadius: '50%',
|
|
114
|
+
bgcolor: alpha(theme.palette.primary.main, 0.1),
|
|
115
|
+
p: 1,
|
|
116
|
+
display: 'inline-block',
|
|
117
|
+
width: 40,
|
|
118
|
+
height: 40,
|
|
119
|
+
mb: -1,
|
|
120
|
+
alignSelf: {
|
|
121
|
+
xs: 'center',
|
|
122
|
+
sm: 'flex-start'
|
|
123
|
+
}
|
|
124
|
+
}),
|
|
125
|
+
children: _CookieOutlinedIcon || (_CookieOutlinedIcon = /*#__PURE__*/_jsx(CookieOutlinedIcon, {
|
|
126
|
+
color: "primary",
|
|
127
|
+
strokeWidth: 1.5
|
|
128
|
+
}))
|
|
129
|
+
}), /*#__PURE__*/_jsxs(Stack, {
|
|
130
|
+
spacing: 0.5,
|
|
131
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
132
|
+
variant: "subtitle2",
|
|
133
|
+
id: "cookie-consent-dialog-title",
|
|
134
|
+
textAlign: {
|
|
135
|
+
xs: 'center',
|
|
136
|
+
sm: 'start'
|
|
137
|
+
},
|
|
138
|
+
children: "Cookie Preferences"
|
|
139
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
140
|
+
id: "cookie-consent-dialog-description",
|
|
141
|
+
variant: "body2",
|
|
142
|
+
textAlign: {
|
|
143
|
+
xs: 'center',
|
|
144
|
+
sm: 'start'
|
|
145
|
+
},
|
|
146
|
+
children: "We use cookies to understand site usage and improve our content. This includes third-party analytics."
|
|
147
|
+
})]
|
|
148
|
+
})]
|
|
149
|
+
}), /*#__PURE__*/_jsxs(Stack, {
|
|
150
|
+
direction: "row",
|
|
151
|
+
spacing: 1,
|
|
152
|
+
sx: {
|
|
153
|
+
justifyContent: 'flex-start'
|
|
154
|
+
},
|
|
155
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
156
|
+
onClick: setAnalyticsConsent,
|
|
157
|
+
variant: "contained",
|
|
158
|
+
size: "small",
|
|
159
|
+
children: "Allow analytics"
|
|
160
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
161
|
+
onClick: setEssentialOnly,
|
|
162
|
+
size: "small",
|
|
163
|
+
children: "Essential only"
|
|
164
|
+
})]
|
|
165
|
+
})]
|
|
166
|
+
})
|
|
167
|
+
})
|
|
168
|
+
})
|
|
169
|
+
})
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
function updateGoogleConsent(hasAnalytics) {
|
|
173
|
+
if (typeof window !== 'undefined' && typeof window.gtag === 'function') {
|
|
174
|
+
window.gtag('consent', 'update', {
|
|
175
|
+
ad_storage: 'denied',
|
|
176
|
+
ad_user_data: 'denied',
|
|
177
|
+
ad_personalization: 'denied',
|
|
178
|
+
analytics_storage: hasAnalytics ? 'granted' : 'denied'
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// Initialize Apollo when analytics consent is granted
|
|
182
|
+
const win = window;
|
|
183
|
+
if (hasAnalytics && typeof win.initApollo === 'function') {
|
|
184
|
+
win.initApollo();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
export function AnalyticsProvider({
|
|
189
|
+
children
|
|
190
|
+
}) {
|
|
191
|
+
const [consentStatus, setConsentStatus] = useLocalStorageState(COOKIE_CONSENT_KEY, null);
|
|
192
|
+
const doNotTrack = useDoNotTrack();
|
|
193
|
+
|
|
194
|
+
// Respect Do Not Track - don't show dialog and treat as essential only
|
|
195
|
+
const needsConsent = consentStatus === null && !doNotTrack;
|
|
196
|
+
|
|
197
|
+
// Update Google consent when status changes or on mount if already set
|
|
198
|
+
React.useEffect(() => {
|
|
199
|
+
if (doNotTrack) {
|
|
200
|
+
// DNT is enabled - always deny analytics
|
|
201
|
+
updateGoogleConsent(false);
|
|
202
|
+
} else if (consentStatus !== null) {
|
|
203
|
+
updateGoogleConsent(consentStatus === 'analytics');
|
|
204
|
+
}
|
|
205
|
+
}, [consentStatus, doNotTrack]);
|
|
206
|
+
const setAnalyticsConsent = React.useCallback(() => {
|
|
207
|
+
setConsentStatus('analytics');
|
|
208
|
+
}, [setConsentStatus]);
|
|
209
|
+
const setEssentialOnly = React.useCallback(() => {
|
|
210
|
+
setConsentStatus('essential');
|
|
211
|
+
}, [setConsentStatus]);
|
|
212
|
+
const contextValue = React.useMemo(() => ({
|
|
213
|
+
consentStatus: doNotTrack ? 'essential' : consentStatus,
|
|
214
|
+
hasAnalyticsConsent: !doNotTrack && consentStatus === 'analytics',
|
|
215
|
+
needsConsent,
|
|
216
|
+
setAnalyticsConsent,
|
|
217
|
+
setEssentialOnly
|
|
218
|
+
}), [consentStatus, doNotTrack, needsConsent, setAnalyticsConsent, setEssentialOnly]);
|
|
219
|
+
return /*#__PURE__*/_jsxs(AnalyticsContext.Provider, {
|
|
220
|
+
value: contextValue,
|
|
221
|
+
children: [children, _BrandingCssThemeProv || (_BrandingCssThemeProv = /*#__PURE__*/_jsx(BrandingCssThemeProvider, {
|
|
222
|
+
children: /*#__PURE__*/_jsx(CookieConsentDialog, {})
|
|
223
|
+
}))]
|
|
224
|
+
});
|
|
225
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AnalyticsProvider, useAnalyticsConsent, CookieConsentDialog } from "./AnalyticsProvider.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AnalyticsProvider, useAnalyticsConsent, CookieConsentDialog } from "./AnalyticsProvider.js";
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 9.0.0-alpha.3
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v9.0.0-alpha.2..master -->
|
|
6
|
+
|
|
7
|
+
_Mar 12, 2026_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
10
|
+
|
|
11
|
+
- 📖 A new [Menubar](https://mui.com/material-ui/react-menubar/) component page integrated with [Base UI](https://base-ui.com/react/components/menubar)
|
|
12
|
+
- ♿️ Improved the Roving TabIndex keyboard navigation for the Stepper, Tabs and MenuList components.
|
|
13
|
+
|
|
14
|
+
### `@mui/material@9.0.0-alpha.3`
|
|
15
|
+
|
|
16
|
+
- [autocomplete] Add `root` slot (#47852) @GerardasB
|
|
17
|
+
- [autocomplete] Fix popup reopening on window focus regain with openOnFocus (#47790) @aman44444
|
|
18
|
+
- [autocomplete] Support full slots for clearIndicator and popupIndicator (#47891) @silviuaavram
|
|
19
|
+
- [material-ui] Partially revert "[material-ui] Clean up duplicated CSS rules (#47838)" (#47927) @sai6855
|
|
20
|
+
- [stepper][menulist][tabs] Improve accessibility (#47687) @silviuaavram
|
|
21
|
+
|
|
22
|
+
### Docs
|
|
23
|
+
|
|
24
|
+
- [docs][codemod] Add v7 migration docs for deprecated Autocomplete APIs and Autocomplete codemod (#47945) @ZeeshanTamboli
|
|
25
|
+
- [docs] Update faq about vendor chunks (#47747) @Janpot
|
|
26
|
+
- [docs] Use direct palette vars in Tailwind v4 snippet (#47940) @Ahmad-Alaziz
|
|
27
|
+
- [docs][menubar] Add Menubar component page (#47616) @siriwatknp
|
|
28
|
+
|
|
29
|
+
### Core
|
|
30
|
+
|
|
31
|
+
- [core] Fix the release prepare steps (#47951) @silviuaavram
|
|
32
|
+
- [core] Remove Joy UI code and docs (#47939) @mnajdova
|
|
33
|
+
- [code-infra] Add previously missed export of themeCssVarsAugmentation (#47918) @brijeshb42
|
|
34
|
+
- [docs-infra] Import font module for nextjs transpilation (#47935) @brijeshb42
|
|
35
|
+
- [docs-infra] Migrate simpler modules from docs to mui-docs (#47897) @brijeshb42
|
|
36
|
+
- [test] Fix detached anchorEl elements in tests (#47929) @Janpot
|
|
37
|
+
|
|
38
|
+
All contributors of this release in alphabetical order: @Ahmad-Alaziz, @aman44444, @brijeshb42, @GerardasB, @Janpot, @mnajdova, @sai6855, @silviuaavram, @siriwatknp, @ZeeshanTamboli
|
|
39
|
+
|
|
3
40
|
## 9.0.0-alpha.2
|
|
4
41
|
|
|
5
42
|
<!-- generated comparing v9.0.0-alpha.1..master -->
|
package/CodeCopy/CodeCopy.js
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.CodeCopyProvider = CodeCopyProvider;
|
|
9
|
-
exports.useCodeCopy = useCodeCopy;
|
|
10
|
-
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _router = require("next/router");
|
|
12
|
-
var _clipboardCopy = _interopRequireDefault(require("clipboard-copy"));
|
|
13
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
1
|
var _InitCodeCopy;
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useRouter } from 'next/router';
|
|
4
|
+
import clipboardCopy from 'clipboard-copy';
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
6
|
const CodeBlockContext = /*#__PURE__*/React.createContext({
|
|
16
7
|
current: null
|
|
17
8
|
});
|
|
@@ -25,7 +16,7 @@ const CodeBlockContext = /*#__PURE__*/React.createContext({
|
|
|
25
16
|
* <button className="MuiCode-copy">...</button>
|
|
26
17
|
* </div>
|
|
27
18
|
*/
|
|
28
|
-
function useCodeCopy() {
|
|
19
|
+
export function useCodeCopy() {
|
|
29
20
|
const rootNode = React.useContext(CodeBlockContext);
|
|
30
21
|
return {
|
|
31
22
|
onMouseEnter: event => {
|
|
@@ -49,7 +40,7 @@ function useCodeCopy() {
|
|
|
49
40
|
}
|
|
50
41
|
function InitCodeCopy() {
|
|
51
42
|
const rootNode = React.useContext(CodeBlockContext);
|
|
52
|
-
const router =
|
|
43
|
+
const router = useRouter();
|
|
53
44
|
React.useEffect(() => {
|
|
54
45
|
let key = 'Ctrl + ';
|
|
55
46
|
if (typeof window !== 'undefined') {
|
|
@@ -103,7 +94,7 @@ function InitCodeCopy() {
|
|
|
103
94
|
}, 2000);
|
|
104
95
|
try {
|
|
105
96
|
if (pre.textContent) {
|
|
106
|
-
await (
|
|
97
|
+
await clipboardCopy(pre.textContent);
|
|
107
98
|
}
|
|
108
99
|
// eslint-disable-next-line no-empty
|
|
109
100
|
} catch (error) {}
|
|
@@ -147,7 +138,7 @@ function hasNativeSelection(element) {
|
|
|
147
138
|
* Place <CodeCopyProvider> at the page level. It will check the keydown event and try to initiate copy click if rootNode exist.
|
|
148
139
|
* Any code block inside the tree can set the rootNode when mouse enter to leverage keyboard copy.
|
|
149
140
|
*/
|
|
150
|
-
function CodeCopyProvider({
|
|
141
|
+
export function CodeCopyProvider({
|
|
151
142
|
children
|
|
152
143
|
}) {
|
|
153
144
|
const rootNode = React.useRef(null);
|
|
@@ -174,8 +165,8 @@ function CodeCopyProvider({
|
|
|
174
165
|
copyBtn.dataset.gaEventAction = initialEventAction; // reset the 'data-ga-event-action' back to initial
|
|
175
166
|
});
|
|
176
167
|
}, []);
|
|
177
|
-
return /*#__PURE__*/(
|
|
168
|
+
return /*#__PURE__*/_jsxs(CodeBlockContext.Provider, {
|
|
178
169
|
value: rootNode,
|
|
179
|
-
children: [_InitCodeCopy || (_InitCodeCopy = /*#__PURE__*/(
|
|
170
|
+
children: [_InitCodeCopy || (_InitCodeCopy = /*#__PURE__*/_jsx(InitCodeCopy, {})), children]
|
|
180
171
|
});
|
|
181
172
|
}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.CodeCopyButton = CodeCopyButton;
|
|
8
|
-
var _useClipboardCopy = _interopRequireDefault(require("./useClipboardCopy"));
|
|
9
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
1
|
var _span, _span2;
|
|
11
|
-
|
|
2
|
+
import useClipboardCopy from "./useClipboardCopy.js";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
export function CodeCopyButton(props) {
|
|
12
5
|
const {
|
|
13
6
|
code,
|
|
14
7
|
...other
|
|
@@ -16,13 +9,13 @@ function CodeCopyButton(props) {
|
|
|
16
9
|
const {
|
|
17
10
|
copy,
|
|
18
11
|
isCopied
|
|
19
|
-
} = (
|
|
12
|
+
} = useClipboardCopy();
|
|
20
13
|
// This component is designed to be wrapped in NoSsr
|
|
21
14
|
const macOS = window.navigator.platform.toUpperCase().includes('MAC');
|
|
22
15
|
const key = macOS ? '⌘' : 'Ctrl + ';
|
|
23
|
-
return /*#__PURE__*/(
|
|
16
|
+
return /*#__PURE__*/_jsx("div", {
|
|
24
17
|
className: "MuiCode-copy-container",
|
|
25
|
-
children: /*#__PURE__*/(
|
|
18
|
+
children: /*#__PURE__*/_jsxs("button", {
|
|
26
19
|
...other,
|
|
27
20
|
"aria-label": "Copy the code",
|
|
28
21
|
type: "button",
|
|
@@ -31,14 +24,14 @@ function CodeCopyButton(props) {
|
|
|
31
24
|
// event.stopPropagation();
|
|
32
25
|
await copy(code);
|
|
33
26
|
},
|
|
34
|
-
children: [isCopied ? 'Copied' : 'Copy', /*#__PURE__*/(
|
|
27
|
+
children: [isCopied ? 'Copied' : 'Copy', /*#__PURE__*/_jsxs("span", {
|
|
35
28
|
className: "MuiCode-copyKeypress",
|
|
36
29
|
style: {
|
|
37
30
|
opacity: isCopied ? 0 : 1
|
|
38
31
|
},
|
|
39
|
-
children: [_span || (_span = /*#__PURE__*/(
|
|
32
|
+
children: [_span || (_span = /*#__PURE__*/_jsx("span", {
|
|
40
33
|
children: "(or"
|
|
41
|
-
})), " ", key, "C", _span2 || (_span2 = /*#__PURE__*/(
|
|
34
|
+
})), " ", key, "C", _span2 || (_span2 = /*#__PURE__*/_jsx("span", {
|
|
42
35
|
children: ")"
|
|
43
36
|
}))]
|
|
44
37
|
})]
|
package/CodeCopy/index.js
CHANGED
|
@@ -1,40 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
var _exportNames = {
|
|
8
|
-
useClipboardCopy: true
|
|
9
|
-
};
|
|
10
|
-
Object.defineProperty(exports, "useClipboardCopy", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _useClipboardCopy.default;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
var _CodeCopy = require("./CodeCopy");
|
|
17
|
-
Object.keys(_CodeCopy).forEach(function (key) {
|
|
18
|
-
if (key === "default" || key === "__esModule") return;
|
|
19
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
|
-
if (key in exports && exports[key] === _CodeCopy[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _CodeCopy[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _CodeCopyButton = require("./CodeCopyButton");
|
|
29
|
-
Object.keys(_CodeCopyButton).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
32
|
-
if (key in exports && exports[key] === _CodeCopyButton[key]) return;
|
|
33
|
-
Object.defineProperty(exports, key, {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: function () {
|
|
36
|
-
return _CodeCopyButton[key];
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
var _useClipboardCopy = _interopRequireDefault(require("./useClipboardCopy"));
|
|
1
|
+
export * from "./CodeCopy.js";
|
|
2
|
+
export * from "./CodeCopyButton.js";
|
|
3
|
+
export { default as useClipboardCopy } from "./useClipboardCopy.js";
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = useClipboardCopy;
|
|
9
|
-
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _clipboardCopy = _interopRequireDefault(require("clipboard-copy"));
|
|
11
|
-
function useClipboardCopy() {
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import clipboardCopy from 'clipboard-copy';
|
|
3
|
+
export default function useClipboardCopy() {
|
|
12
4
|
const [isCopied, setIsCopied] = React.useState(false);
|
|
13
5
|
const timeout = React.useRef(undefined);
|
|
14
6
|
React.useEffect(() => () => {
|
|
15
7
|
clearTimeout(timeout.current);
|
|
16
8
|
}, []);
|
|
17
9
|
const copy = async text => {
|
|
18
|
-
await (
|
|
10
|
+
await clipboardCopy(text);
|
|
19
11
|
setIsCopied(true);
|
|
20
12
|
clearTimeout(timeout.current);
|
|
21
13
|
timeout.current = setTimeout(() => {
|