@mui/internal-core-docs 0.0.1 → 9.0.0-canary.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/Ad/Ad.d.ts +5 -0
  2. package/Ad/Ad.js +226 -0
  3. package/Ad/AdCarbon.d.ts +2 -0
  4. package/Ad/AdCarbon.js +125 -0
  5. package/Ad/AdDisplay.d.ts +16 -0
  6. package/Ad/AdDisplay.js +86 -0
  7. package/Ad/AdGuest.d.ts +10 -0
  8. package/Ad/AdGuest.js +29 -0
  9. package/Ad/AdInHouse.d.ts +4 -0
  10. package/Ad/AdInHouse.js +14 -0
  11. package/Ad/AdManager.d.ts +19 -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 +4 -0
  16. package/Ad/ad.styles.js +91 -0
  17. package/Ad/index.d.ts +5 -0
  18. package/Ad/index.js +7 -0
  19. package/ApiPage/ApiWarningAlert.d.ts +10 -0
  20. package/ApiPage/ApiWarningAlert.js +22 -0
  21. package/ApiPage/definitions/classes.d.ts +18 -0
  22. package/ApiPage/definitions/classes.js +54 -0
  23. package/ApiPage/definitions/index.d.ts +4 -0
  24. package/ApiPage/definitions/index.js +4 -0
  25. package/ApiPage/definitions/properties.d.ts +58 -0
  26. package/ApiPage/definitions/properties.js +110 -0
  27. package/ApiPage/definitions/slots.d.ts +16 -0
  28. package/ApiPage/definitions/slots.js +39 -0
  29. package/ApiPage/definitions/types.d.ts +53 -0
  30. package/ApiPage/definitions/types.js +1 -0
  31. package/ApiPage/index.d.ts +2 -0
  32. package/ApiPage/index.js +2 -0
  33. package/ApiPage/list/ClassesList.d.ts +11 -0
  34. package/ApiPage/list/ClassesList.js +103 -0
  35. package/ApiPage/list/ExpandableApiItem.d.ts +18 -0
  36. package/ApiPage/list/ExpandableApiItem.js +241 -0
  37. package/ApiPage/list/PropertiesList.d.ts +7 -0
  38. package/ApiPage/list/PropertiesList.js +263 -0
  39. package/ApiPage/list/SlotsList.d.ts +7 -0
  40. package/ApiPage/list/SlotsList.js +93 -0
  41. package/ApiPage/list/index.d.ts +1 -0
  42. package/ApiPage/list/index.js +1 -0
  43. package/ApiPage/private.d.ts +3 -0
  44. package/ApiPage/private.js +3 -0
  45. package/ApiPage/sections/ClassesSection.d.ts +34 -0
  46. package/ApiPage/sections/ClassesSection.js +76 -0
  47. package/ApiPage/sections/PropertiesSection.d.ts +45 -0
  48. package/ApiPage/sections/PropertiesSection.js +59 -0
  49. package/ApiPage/sections/SlotsSection.d.ts +24 -0
  50. package/ApiPage/sections/SlotsSection.js +61 -0
  51. package/ApiPage/sections/ToggleDisplayOption.d.ts +17 -0
  52. package/ApiPage/sections/ToggleDisplayOption.js +161 -0
  53. package/ApiPage/sections/index.d.ts +4 -0
  54. package/ApiPage/sections/index.js +4 -0
  55. package/ApiPage/table/ClassesTable.d.ts +7 -0
  56. package/ApiPage/table/ClassesTable.js +116 -0
  57. package/ApiPage/table/PropertiesTable.d.ts +6 -0
  58. package/ApiPage/table/PropertiesTable.js +286 -0
  59. package/ApiPage/table/SlotsTable.d.ts +6 -0
  60. package/ApiPage/table/SlotsTable.js +126 -0
  61. package/ApiPage/table/StyledTableContainer.d.ts +1 -0
  62. package/ApiPage/table/StyledTableContainer.js +42 -0
  63. package/ApiPage/types.d.ts +11 -0
  64. package/ApiPage/types.js +1 -0
  65. package/CHANGELOG.md +1651 -0
  66. package/CodeCopy/CodeCopy.d.ts +22 -0
  67. package/CodeCopy/CodeCopy.js +172 -0
  68. package/CodeCopy/CodeCopyButton.d.ts +4 -0
  69. package/CodeCopy/CodeCopyButton.js +40 -0
  70. package/CodeCopy/index.d.ts +3 -0
  71. package/CodeCopy/index.js +3 -0
  72. package/CodeCopy/useClipboardCopy.d.ts +4 -0
  73. package/CodeCopy/useClipboardCopy.js +21 -0
  74. package/ComponentLinkHeader/ComponentLinkHeader.d.ts +8 -0
  75. package/ComponentLinkHeader/ComponentLinkHeader.js +197 -0
  76. package/ComponentLinkHeader/index.d.ts +2 -0
  77. package/ComponentLinkHeader/index.js +2 -0
  78. package/DemoContext/DemoContext.d.ts +86 -0
  79. package/DemoContext/DemoContext.js +13 -0
  80. package/DemoContext/index.d.ts +2 -0
  81. package/DemoContext/index.js +1 -0
  82. package/DocsApp/AnalyticsProvider.d.ts +17 -0
  83. package/DocsApp/AnalyticsProvider.js +229 -0
  84. package/DocsApp/DocsApp.d.ts +79 -0
  85. package/DocsApp/DocsApp.js +105 -0
  86. package/DocsApp/GoogleAnalytics.d.ts +9 -0
  87. package/DocsApp/GoogleAnalytics.js +129 -0
  88. package/DocsApp/StyledEngineProvider.d.ts +8 -0
  89. package/DocsApp/StyledEngineProvider.js +38 -0
  90. package/DocsApp/consoleBanner.d.ts +1 -0
  91. package/DocsApp/consoleBanner.js +18 -0
  92. package/DocsApp/createEmotionCache.d.ts +1 -0
  93. package/DocsApp/createEmotionCache.js +12 -0
  94. package/DocsApp/createGetInitialProps.d.ts +30 -0
  95. package/DocsApp/createGetInitialProps.js +29 -0
  96. package/DocsApp/index.d.ts +5 -0
  97. package/DocsApp/index.js +4 -0
  98. package/DocsApp/loadDependencies.d.ts +1 -0
  99. package/DocsApp/loadDependencies.js +9 -0
  100. package/DocsApp/reportWebVitals.d.ts +13 -0
  101. package/DocsApp/reportWebVitals.js +22 -0
  102. package/DocsApp/serviceWorker.d.ts +1 -0
  103. package/DocsApp/serviceWorker.js +59 -0
  104. package/DocsProvider/DocsProvider.d.ts +24 -0
  105. package/DocsProvider/DocsProvider.js +31 -0
  106. package/DocsProvider/index.d.ts +1 -0
  107. package/DocsProvider/index.js +1 -0
  108. package/Document/Document.d.ts +16 -0
  109. package/Document/Document.js +147 -0
  110. package/Document/getInitialProps.d.ts +18 -0
  111. package/Document/getInitialProps.js +60 -0
  112. package/Document/index.d.ts +2 -0
  113. package/Document/index.js +2 -0
  114. package/HighlightedCode/HighlightedCode.d.ts +14 -0
  115. package/HighlightedCode/HighlightedCode.js +67 -0
  116. package/HighlightedCode/index.d.ts +1 -0
  117. package/HighlightedCode/index.js +1 -0
  118. package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.d.ts +28 -0
  119. package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.js +362 -0
  120. package/HighlightedCodeWithTabs/index.d.ts +2 -0
  121. package/HighlightedCodeWithTabs/index.js +2 -0
  122. package/IconImage/IconImage.d.ts +11 -0
  123. package/IconImage/IconImage.js +83 -0
  124. package/IconImage/index.d.ts +1 -0
  125. package/IconImage/index.js +1 -0
  126. package/InfoCard/InfoCard.d.ts +22 -0
  127. package/InfoCard/InfoCard.js +91 -0
  128. package/InfoCard/index.d.ts +1 -0
  129. package/InfoCard/index.js +1 -0
  130. package/LICENSE +21 -0
  131. package/Link/Link.d.ts +25 -0
  132. package/Link/Link.js +75 -0
  133. package/Link/MarkdownLinks.d.ts +2 -0
  134. package/Link/MarkdownLinks.js +84 -0
  135. package/Link/SkipLink.d.ts +1 -0
  136. package/Link/SkipLink.js +64 -0
  137. package/Link/index.d.ts +3 -0
  138. package/Link/index.js +3 -0
  139. package/MarkdownElement/MarkdownElement.d.ts +7 -0
  140. package/MarkdownElement/MarkdownElement.js +847 -0
  141. package/MarkdownElement/index.d.ts +1 -0
  142. package/MarkdownElement/index.js +1 -0
  143. package/MuiPage/MuiPage.d.ts +67 -0
  144. package/MuiPage/MuiPage.js +1 -0
  145. package/MuiPage/index.d.ts +1 -0
  146. package/MuiPage/index.js +1 -0
  147. package/NextNProgressBar/NProgressBar.d.ts +6 -0
  148. package/NextNProgressBar/NProgressBar.js +91 -0
  149. package/NextNProgressBar/NextNProgressBar.d.ts +1 -0
  150. package/NextNProgressBar/NextNProgressBar.js +42 -0
  151. package/NextNProgressBar/index.d.ts +1 -0
  152. package/NextNProgressBar/index.js +1 -0
  153. package/PageContext/PageContext.d.ts +32 -0
  154. package/PageContext/PageContext.js +6 -0
  155. package/PageContext/index.d.ts +2 -0
  156. package/PageContext/index.js +1 -0
  157. package/README.md +26 -0
  158. package/SectionHeadline/SectionHeadline.d.ts +13 -0
  159. package/SectionHeadline/SectionHeadline.js +81 -0
  160. package/SectionHeadline/index.d.ts +2 -0
  161. package/SectionHeadline/index.js +2 -0
  162. package/SectionTitle/SectionTitle.d.ts +6 -0
  163. package/SectionTitle/SectionTitle.js +29 -0
  164. package/SectionTitle/index.d.ts +1 -0
  165. package/SectionTitle/index.js +1 -0
  166. package/ThemeContext/ThemeContext.d.ts +92 -0
  167. package/ThemeContext/ThemeContext.js +200 -0
  168. package/ThemeContext/index.d.ts +1 -0
  169. package/ThemeContext/index.js +1 -0
  170. package/branding/BrandingCssVarsProvider.d.ts +27 -0
  171. package/branding/BrandingCssVarsProvider.js +170 -0
  172. package/branding/BrandingProvider.d.ts +9 -0
  173. package/branding/BrandingProvider.js +17 -0
  174. package/branding/brandingTheme.d.ts +147 -0
  175. package/branding/brandingTheme.js +1534 -0
  176. package/branding/index.d.ts +3 -0
  177. package/branding/index.js +3 -0
  178. package/codeStyling/codeStyling.d.ts +7 -0
  179. package/codeStyling/codeStyling.js +80 -0
  180. package/codeStyling/index.d.ts +1 -0
  181. package/codeStyling/index.js +1 -0
  182. package/codeVariant/codeVariant.d.ts +7 -0
  183. package/codeVariant/codeVariant.js +69 -0
  184. package/codeVariant/index.d.ts +1 -0
  185. package/codeVariant/index.js +1 -0
  186. package/constants/constants.d.ts +13 -0
  187. package/constants/constants.js +15 -0
  188. package/constants/index.d.ts +1 -0
  189. package/constants/index.js +1 -0
  190. package/findActivePage/findActivePage.d.ts +5 -0
  191. package/findActivePage/findActivePage.js +35 -0
  192. package/findActivePage/index.d.ts +1 -0
  193. package/findActivePage/index.js +1 -0
  194. package/getProductInfoFromUrl/getProductInfoFromUrl.d.ts +8 -0
  195. package/getProductInfoFromUrl/getProductInfoFromUrl.js +50 -0
  196. package/getProductInfoFromUrl/index.d.ts +2 -0
  197. package/getProductInfoFromUrl/index.js +1 -0
  198. package/globalSelector/globalSelector.d.ts +2 -0
  199. package/globalSelector/globalSelector.js +17 -0
  200. package/globalSelector/index.d.ts +1 -0
  201. package/globalSelector/index.js +1 -0
  202. package/helpers/helpers.d.ts +31 -0
  203. package/helpers/helpers.js +87 -0
  204. package/helpers/index.d.ts +2 -0
  205. package/helpers/index.js +1 -0
  206. package/i18n/i18n.d.ts +27 -0
  207. package/i18n/i18n.js +111 -0
  208. package/i18n/index.d.ts +1 -0
  209. package/i18n/index.js +1 -0
  210. package/mapApiPageTranslations/index.d.ts +1 -0
  211. package/mapApiPageTranslations/index.js +1 -0
  212. package/mapApiPageTranslations/mapApiPageTranslations.d.ts +11 -0
  213. package/mapApiPageTranslations/mapApiPageTranslations.js +46 -0
  214. package/nextFonts/fonts/GeneralSans-Bold.ttf +0 -0
  215. package/nextFonts/fonts/GeneralSans-Bold.woff2 +0 -0
  216. package/nextFonts/fonts/GeneralSans-Medium.ttf +0 -0
  217. package/nextFonts/fonts/GeneralSans-Medium.woff2 +0 -0
  218. package/nextFonts/fonts/GeneralSans-Regular.ttf +0 -0
  219. package/nextFonts/fonts/GeneralSans-Regular.woff2 +0 -0
  220. package/nextFonts/fonts/GeneralSans-Semibold-subset.woff2 +0 -0
  221. package/nextFonts/fonts/GeneralSans-Semibold.ttf +0 -0
  222. package/nextFonts/fonts/GeneralSans-Semibold.woff2 +0 -0
  223. package/nextFonts/fonts/IBMPlexSans-Bold.ttf +0 -0
  224. package/nextFonts/fonts/IBMPlexSans-Bold.woff +0 -0
  225. package/nextFonts/fonts/IBMPlexSans-Bold.woff2 +0 -0
  226. package/nextFonts/fonts/IBMPlexSans-Medium.ttf +0 -0
  227. package/nextFonts/fonts/IBMPlexSans-Medium.woff +0 -0
  228. package/nextFonts/fonts/IBMPlexSans-Medium.woff2 +0 -0
  229. package/nextFonts/fonts/IBMPlexSans-Regular-subset.woff2 +0 -0
  230. package/nextFonts/fonts/IBMPlexSans-Regular.ttf +0 -0
  231. package/nextFonts/fonts/IBMPlexSans-Regular.woff +0 -0
  232. package/nextFonts/fonts/IBMPlexSans-Regular.woff2 +0 -0
  233. package/nextFonts/fonts/IBMPlexSans-SemiBold.ttf +0 -0
  234. package/nextFonts/fonts/IBMPlexSans-SemiBold.woff +0 -0
  235. package/nextFonts/fonts/IBMPlexSans-SemiBold.woff2 +0 -0
  236. package/nextFonts/index.d.ts +6 -0
  237. package/nextFonts/index.js +59 -0
  238. package/package.json +426 -3
  239. package/svgIcons/BundleSizeIcon.d.ts +4 -0
  240. package/svgIcons/BundleSizeIcon.js +13 -0
  241. package/svgIcons/FigmaIcon.d.ts +4 -0
  242. package/svgIcons/FigmaIcon.js +22 -0
  243. package/svgIcons/FileDownload.d.ts +6 -0
  244. package/svgIcons/FileDownload.js +13 -0
  245. package/svgIcons/JavaScript.d.ts +6 -0
  246. package/svgIcons/JavaScript.js +13 -0
  247. package/svgIcons/MarkdownIcon.d.ts +2 -0
  248. package/svgIcons/MarkdownIcon.js +22 -0
  249. package/svgIcons/MaterialDesignIcon.d.ts +4 -0
  250. package/svgIcons/MaterialDesignIcon.js +18 -0
  251. package/svgIcons/SketchIcon.d.ts +4 -0
  252. package/svgIcons/SketchIcon.js +27 -0
  253. package/svgIcons/TypeScript.d.ts +6 -0
  254. package/svgIcons/TypeScript.js +13 -0
  255. package/svgIcons/W3CIcon.d.ts +4 -0
  256. package/svgIcons/W3CIcon.js +15 -0
  257. package/translations/index.d.ts +3 -0
  258. package/translations/index.js +4 -0
  259. package/translations/translations.json +222 -0
  260. package/useLazyCSS/index.d.ts +1 -0
  261. package/useLazyCSS/index.js +1 -0
  262. package/useLazyCSS/useLazyCSS.d.ts +11 -0
  263. package/useLazyCSS/useLazyCSS.js +70 -0
  264. package/utils/index.d.ts +1 -0
  265. package/utils/index.js +1 -0
  266. package/utils/loadScript.d.ts +1 -0
  267. package/utils/loadScript.js +7 -0
  268. package/webpack/index.d.ts +17 -0
  269. package/webpack/index.js +1 -0
@@ -0,0 +1,229 @@
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
+ sx: {
135
+ textAlign: {
136
+ xs: 'center',
137
+ sm: 'start'
138
+ }
139
+ },
140
+ children: "Cookie Preferences"
141
+ }), /*#__PURE__*/_jsx(Typography, {
142
+ id: "cookie-consent-dialog-description",
143
+ variant: "body2",
144
+ sx: {
145
+ textAlign: {
146
+ xs: 'center',
147
+ sm: 'start'
148
+ }
149
+ },
150
+ children: "We use cookies to understand site usage and improve our content. This includes third-party analytics."
151
+ })]
152
+ })]
153
+ }), /*#__PURE__*/_jsxs(Stack, {
154
+ direction: "row",
155
+ spacing: 1,
156
+ sx: {
157
+ justifyContent: 'flex-start'
158
+ },
159
+ children: [/*#__PURE__*/_jsx(Button, {
160
+ onClick: setAnalyticsConsent,
161
+ variant: "contained",
162
+ size: "small",
163
+ children: "Allow analytics"
164
+ }), /*#__PURE__*/_jsx(Button, {
165
+ onClick: setEssentialOnly,
166
+ size: "small",
167
+ children: "Essential only"
168
+ })]
169
+ })]
170
+ })
171
+ })
172
+ })
173
+ })
174
+ });
175
+ }
176
+ function updateGoogleConsent(hasAnalytics) {
177
+ if (typeof window !== 'undefined' && typeof window.gtag === 'function') {
178
+ window.gtag('consent', 'update', {
179
+ ad_storage: 'denied',
180
+ ad_user_data: 'denied',
181
+ ad_personalization: 'denied',
182
+ analytics_storage: hasAnalytics ? 'granted' : 'denied'
183
+ });
184
+
185
+ // Initialize Apollo when analytics consent is granted
186
+ const win = window;
187
+ if (hasAnalytics && typeof win.initApollo === 'function') {
188
+ win.initApollo();
189
+ }
190
+ }
191
+ }
192
+ export function AnalyticsProvider({
193
+ children
194
+ }) {
195
+ const [consentStatus, setConsentStatus] = useLocalStorageState(COOKIE_CONSENT_KEY, null);
196
+ const doNotTrack = useDoNotTrack();
197
+
198
+ // Respect Do Not Track - don't show dialog and treat as essential only
199
+ const needsConsent = consentStatus === null && !doNotTrack;
200
+
201
+ // Update Google consent when status changes or on mount if already set
202
+ React.useEffect(() => {
203
+ if (doNotTrack) {
204
+ // DNT is enabled - always deny analytics
205
+ updateGoogleConsent(false);
206
+ } else if (consentStatus !== null) {
207
+ updateGoogleConsent(consentStatus === 'analytics');
208
+ }
209
+ }, [consentStatus, doNotTrack]);
210
+ const setAnalyticsConsent = React.useCallback(() => {
211
+ setConsentStatus('analytics');
212
+ }, [setConsentStatus]);
213
+ const setEssentialOnly = React.useCallback(() => {
214
+ setConsentStatus('essential');
215
+ }, [setConsentStatus]);
216
+ const contextValue = React.useMemo(() => ({
217
+ consentStatus: doNotTrack ? 'essential' : consentStatus,
218
+ hasAnalyticsConsent: !doNotTrack && consentStatus === 'analytics',
219
+ needsConsent,
220
+ setAnalyticsConsent,
221
+ setEssentialOnly
222
+ }), [consentStatus, doNotTrack, needsConsent, setAnalyticsConsent, setEssentialOnly]);
223
+ return /*#__PURE__*/_jsxs(AnalyticsContext.Provider, {
224
+ value: contextValue,
225
+ children: [children, _BrandingCssThemeProv || (_BrandingCssThemeProv = /*#__PURE__*/_jsx(BrandingCssThemeProvider, {
226
+ children: /*#__PURE__*/_jsx(CookieConsentDialog, {})
227
+ }))]
228
+ });
229
+ }
@@ -0,0 +1,79 @@
1
+ import * as React from 'react';
2
+ import type { AdConfig } from "../Ad/index.js";
3
+ import type { DemoContextValue } from "../DemoContext/index.js";
4
+ import type { DocsConfig } from "../DocsProvider/index.js";
5
+ import type { MuiPageContext } from "../PageContext/index.js";
6
+ import type { Translations } from "../i18n/index.js";
7
+ import createEmotionCache from "./createEmotionCache.js";
8
+ export interface DocsAppProps {
9
+ /**
10
+ * The Next.js page component.
11
+ */
12
+ Component: React.ComponentType<any> & {
13
+ getLayout?: (page: React.ReactElement) => React.ReactNode;
14
+ };
15
+ /**
16
+ * The Emotion cache for CSS-in-JS. Falls back to a client-side cache.
17
+ */
18
+ emotionCache?: ReturnType<typeof createEmotionCache>;
19
+ /**
20
+ * Page props from Next.js, including userLanguage and translations.
21
+ */
22
+ pageProps: {
23
+ userLanguage: string;
24
+ translations: Translations;
25
+ [key: string]: unknown;
26
+ };
27
+ /**
28
+ * Docs configuration object (from docs/config.ts)
29
+ */
30
+ docsConfig: DocsConfig;
31
+ /**
32
+ * Path to the service worker file, e.g. '/sw.js'
33
+ */
34
+ serviceWorkerPath: string;
35
+ /**
36
+ * The currently active page object
37
+ */
38
+ activePage: MuiPageContext['activePage'];
39
+ /**
40
+ * The parent pages of the active page
41
+ */
42
+ activePageParents: MuiPageContext['activePageParents'];
43
+ /**
44
+ * List of all pages for the product
45
+ */
46
+ pageList: MuiPageContext['pages'];
47
+ /**
48
+ * Product metadata and branding info
49
+ */
50
+ productIdentifier: MuiPageContext['productIdentifier'];
51
+ /**
52
+ * Product identifier string (e.g. 'material-ui')
53
+ */
54
+ productId: MuiPageContext['productId'];
55
+ /**
56
+ * Product category identifier string (e.g. 'core')
57
+ */
58
+ productCategoryId: MuiPageContext['productCategoryId'];
59
+ /**
60
+ * Display name for the product (e.g. 'Material UI')
61
+ */
62
+ demoDisplayName: DemoContextValue['productDisplayName'];
63
+ /**
64
+ * CodeSandbox configuration for demos
65
+ */
66
+ csbConfig: DemoContextValue['csb'];
67
+ /**
68
+ * Optional ad configuration
69
+ */
70
+ adConfig?: Partial<AdConfig>;
71
+ /**
72
+ * Optional wrapper component for theming
73
+ */
74
+ ThemeWrapper?: React.ComponentType<{
75
+ children: React.ReactNode;
76
+ }>;
77
+ }
78
+ declare function DocsApp(props: DocsAppProps): import("react/jsx-runtime").JSX.Element;
79
+ export { DocsApp };
@@ -0,0 +1,105 @@
1
+ var _meta, _GoogleAnalytics;
2
+ import NextHead from 'next/head';
3
+ import * as React from 'react';
4
+ import { CodeCopyProvider } from "../CodeCopy/index.js";
5
+ import DemoContext from "../DemoContext/index.js";
6
+ import { DocsProvider } from "../DocsProvider/index.js";
7
+ import PageContext from "../PageContext/index.js";
8
+ import { ThemeProvider } from "../ThemeContext/index.js";
9
+ import { CodeStylingProvider } from "../codeStyling/index.js";
10
+ import { CodeVariantProvider } from "../codeVariant/index.js";
11
+ import { AnalyticsProvider } from "./AnalyticsProvider.js";
12
+ import GoogleAnalytics from "./GoogleAnalytics.js";
13
+ import DocsStyledEngineProvider from "./StyledEngineProvider.js";
14
+ import createEmotionCache from "./createEmotionCache.js";
15
+ import { loadDependencies } from "./loadDependencies.js";
16
+ import { registerServiceWorker } from "./serviceWorker.js";
17
+
18
+ // Client-side cache, shared for the whole session of the user in the browser.
19
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
+ const clientSideEmotionCache = createEmotionCache();
21
+ function DocsApp(props) {
22
+ const {
23
+ Component,
24
+ emotionCache = clientSideEmotionCache,
25
+ pageProps,
26
+ docsConfig,
27
+ serviceWorkerPath,
28
+ activePage,
29
+ activePageParents,
30
+ pageList,
31
+ productIdentifier,
32
+ productId,
33
+ productCategoryId,
34
+ demoDisplayName,
35
+ csbConfig,
36
+ adConfig,
37
+ ThemeWrapper = ThemeProvider
38
+ } = props;
39
+ const pageContextValue = React.useMemo(() => ({
40
+ activePage,
41
+ activePageParents,
42
+ pages: pageList,
43
+ productIdentifier,
44
+ productId,
45
+ productCategoryId
46
+ }), [activePage, activePageParents, pageList, productIdentifier, productId, productCategoryId]);
47
+ const demoContextValue = React.useMemo(() => ({
48
+ productDisplayName: demoDisplayName,
49
+ csb: csbConfig
50
+ }), [demoDisplayName, csbConfig]);
51
+ const getLayout = Component.getLayout ?? (page => page);
52
+ React.useEffect(() => {
53
+ loadDependencies();
54
+ registerServiceWorker(serviceWorkerPath);
55
+
56
+ // Remove the server-side injected CSS.
57
+ const jssStyles = document.querySelector('#jss-server-side');
58
+ if (jssStyles) {
59
+ jssStyles.parentElement.removeChild(jssStyles);
60
+ }
61
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
62
+
63
+ return /*#__PURE__*/_jsxs(React.Fragment, {
64
+ children: [/*#__PURE__*/_jsxs(NextHead, {
65
+ children: [_meta || (_meta = /*#__PURE__*/_jsx("meta", {
66
+ name: "viewport",
67
+ content: "initial-scale=1, width=device-width"
68
+ })), /*#__PURE__*/_jsx("meta", {
69
+ name: "mui:productId",
70
+ content: productId
71
+ }), /*#__PURE__*/_jsx("meta", {
72
+ name: "mui:productCategoryId",
73
+ content: productCategoryId
74
+ })]
75
+ }), /*#__PURE__*/_jsx(DocsProvider, {
76
+ config: docsConfig,
77
+ adConfig: adConfig,
78
+ defaultUserLanguage: pageProps.userLanguage,
79
+ translations: pageProps.translations,
80
+ children: /*#__PURE__*/_jsx(CodeCopyProvider, {
81
+ children: /*#__PURE__*/_jsx(CodeStylingProvider, {
82
+ children: /*#__PURE__*/_jsx(CodeVariantProvider, {
83
+ children: /*#__PURE__*/_jsx(PageContext.Provider, {
84
+ value: pageContextValue,
85
+ children: /*#__PURE__*/_jsx(DemoContext.Provider, {
86
+ value: demoContextValue,
87
+ children: /*#__PURE__*/_jsx(ThemeWrapper, {
88
+ children: /*#__PURE__*/_jsx(DocsStyledEngineProvider, {
89
+ cacheLtr: emotionCache,
90
+ children: /*#__PURE__*/_jsxs(AnalyticsProvider, {
91
+ children: [getLayout(/*#__PURE__*/_jsx(Component, {
92
+ ...pageProps
93
+ })), _GoogleAnalytics || (_GoogleAnalytics = /*#__PURE__*/_jsx(GoogleAnalytics, {}))]
94
+ })
95
+ })
96
+ })
97
+ })
98
+ })
99
+ })
100
+ })
101
+ })
102
+ })]
103
+ });
104
+ }
105
+ export { DocsApp };
@@ -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 "../codeVariant/index.js";
5
+ import { useUserLanguage } from "../i18n/index.js";
6
+ import { pathnameToLanguage } from "../helpers/index.js";
7
+ import { ThemeOptionsContext } from "../ThemeContext/index.js";
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,8 @@
1
+ import * as React from 'react';
2
+ import { createEmotionCache as createCache } from '@mui/material-nextjs/v15-pagesRouter';
3
+ type StyledEngineProviderProps = {
4
+ cacheLtr: ReturnType<typeof createCache>;
5
+ children: React.ReactNode;
6
+ };
7
+ export default function StyledEngineProvider(props: StyledEngineProviderProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,38 @@
1
+ var _GlobalStyles;
2
+ import * as React from 'react';
3
+ import { StyleSheetManager } from 'styled-components';
4
+ import { CacheProvider } from '@emotion/react';
5
+ import { createEmotionCache as createCache } from '@mui/material-nextjs/v15-pagesRouter';
6
+ import { prefixer } from 'stylis';
7
+ import rtlPlugin from '@mui/stylis-plugin-rtl';
8
+ import GlobalStyles from '@mui/material/GlobalStyles';
9
+ import { ThemeOptionsContext } from "../ThemeContext/index.js";
10
+ import globalSelector from "../globalSelector/index.js";
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ // Cache for the rtl version of the styles
13
+ const cacheRtl = createCache({
14
+ key: 'rtl',
15
+ prepend: true,
16
+ enableCssLayer: true,
17
+ stylisPlugins: [prefixer, rtlPlugin, globalSelector]
18
+ });
19
+ export default function StyledEngineProvider(props) {
20
+ const {
21
+ children,
22
+ cacheLtr
23
+ } = props;
24
+ const {
25
+ direction
26
+ } = React.useContext(ThemeOptionsContext);
27
+ const rtl = direction === 'rtl';
28
+ const emotionCache = direction === 'rtl' ? cacheRtl : cacheLtr;
29
+ return /*#__PURE__*/_jsx(StyleSheetManager, {
30
+ stylisPlugins: rtl ? [rtlPlugin] : [],
31
+ children: /*#__PURE__*/_jsxs(CacheProvider, {
32
+ value: emotionCache,
33
+ children: [_GlobalStyles || (_GlobalStyles = /*#__PURE__*/_jsx(GlobalStyles, {
34
+ styles: "@layer theme, docsearch, mui, utilities;"
35
+ })), children]
36
+ })
37
+ });
38
+ }
@@ -0,0 +1 @@
1
+ export declare function printConsoleBanner(): void;
@@ -0,0 +1,18 @@
1
+ import { getTheme } from "../branding/index.js";
2
+ export function printConsoleBanner() {
3
+ if (typeof window !== 'undefined' && process.env.NODE_ENV === 'production') {
4
+ window.theme = getTheme('ltr');
5
+ // eslint-disable-next-line no-console
6
+ console.log(`%c
7
+
8
+ ███╗ ███╗ ██╗ ██╗ ██████╗
9
+ ████╗ ████║ ██║ ██║ ██╔═╝
10
+ ██╔████╔██║ ██║ ██║ ██║
11
+ ██║╚██╔╝██║ ██║ ██║ ██║
12
+ ██║ ╚═╝ ██║ ╚██████╔╝ ██████╗
13
+ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝
14
+
15
+ Tip: you can access the documentation \`theme\` object directly in the console.
16
+ `, 'font-family:monospace;color:#1976d2;font-size:12px;');
17
+ }
18
+ }
@@ -0,0 +1 @@
1
+ export default function createEmotionCache(): import("@emotion/cache").EmotionCache;
@@ -0,0 +1,12 @@
1
+ import { createEmotionCache as createCache } from '@mui/material-nextjs/v15-pagesRouter';
2
+ import { prefixer } from 'stylis';
3
+ import globalSelector from "../globalSelector/index.js";
4
+ export default function createEmotionCache() {
5
+ // TODO remove prepend: true once JSS is out
6
+ return createCache({
7
+ key: 'css',
8
+ prepend: true,
9
+ enableCssLayer: true,
10
+ stylisPlugins: [prefixer, globalSelector]
11
+ });
12
+ }
@@ -0,0 +1,30 @@
1
+ import type { RequireContext } from "../i18n/index.js";
2
+ interface AppContext {
3
+ ctx: {
4
+ query: {
5
+ userLanguage?: string;
6
+ };
7
+ };
8
+ Component: {
9
+ getInitialProps?: (ctx: AppContext['ctx']) => Promise<Record<string, unknown>>;
10
+ };
11
+ }
12
+ /**
13
+ * Factory to create MyApp.getInitialProps.
14
+ * Follows the same pattern as `@mui/internal-core-docs/Document`'s `createGetInitialProps`.
15
+ *
16
+ * @param options.translationsContext - A webpack require.context pointing at translation JSON files.
17
+ * e.g. `require.context('docs/translations', false, /\.\/translations.*\.json$/)`
18
+ */
19
+ export declare function createGetInitialProps(options: {
20
+ translationsContext: RequireContext;
21
+ }): ({
22
+ ctx,
23
+ Component
24
+ }: AppContext) => Promise<{
25
+ pageProps: {
26
+ userLanguage: string;
27
+ translations: import("../i18n/index.js").Translations;
28
+ };
29
+ }>;
30
+ export {};