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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,200 @@
1
+ import * as React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { createTheme as createMdTheme } from '@mui/material/styles';
4
+ import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
5
+ import useMediaQuery from '@mui/material/useMediaQuery';
6
+ import useLocalStorageState from '@mui/utils/useLocalStorageState';
7
+ import useLazyCSS from "../useLazyCSS/index.js";
8
+ import { getMetaThemeColor } from "../branding/index.js";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ const themeInitialOptions = {
11
+ dense: false,
12
+ direction: 'ltr',
13
+ paletteMode: 'light'
14
+ };
15
+ export const highDensity = {
16
+ components: {
17
+ MuiButton: {
18
+ defaultProps: {
19
+ size: 'small'
20
+ }
21
+ },
22
+ MuiFilledInput: {
23
+ defaultProps: {
24
+ margin: 'dense'
25
+ }
26
+ },
27
+ MuiFormControl: {
28
+ defaultProps: {
29
+ margin: 'dense'
30
+ }
31
+ },
32
+ MuiFormHelperText: {
33
+ defaultProps: {
34
+ margin: 'dense'
35
+ }
36
+ },
37
+ MuiIconButton: {
38
+ defaultProps: {
39
+ size: 'small'
40
+ }
41
+ },
42
+ MuiInputBase: {
43
+ defaultProps: {
44
+ margin: 'dense'
45
+ }
46
+ },
47
+ MuiInputLabel: {
48
+ defaultProps: {
49
+ margin: 'dense'
50
+ }
51
+ },
52
+ MuiListItem: {
53
+ defaultProps: {
54
+ dense: true
55
+ }
56
+ },
57
+ MuiOutlinedInput: {
58
+ defaultProps: {
59
+ margin: 'dense'
60
+ }
61
+ },
62
+ MuiFab: {
63
+ defaultProps: {
64
+ size: 'small'
65
+ }
66
+ },
67
+ MuiTable: {
68
+ defaultProps: {
69
+ size: 'small'
70
+ }
71
+ },
72
+ MuiTextField: {
73
+ defaultProps: {
74
+ margin: 'dense'
75
+ }
76
+ },
77
+ MuiToolbar: {
78
+ defaultProps: {
79
+ variant: 'dense'
80
+ }
81
+ }
82
+ }
83
+ };
84
+ export const DispatchContext = /*#__PURE__*/React.createContext(() => {
85
+ throw new Error('Forgot to wrap component in `ThemeProvider`');
86
+ });
87
+ if (process.env.NODE_ENV !== 'production') {
88
+ DispatchContext.displayName = 'ThemeDispatchContext';
89
+ }
90
+ export const ThemeOptionsContext = /*#__PURE__*/React.createContext(themeInitialOptions);
91
+ if (process.env.NODE_ENV !== 'production') {
92
+ ThemeOptionsContext.displayName = 'ThemeOptionsContext';
93
+ }
94
+ export function ThemeProvider(props) {
95
+ const {
96
+ children
97
+ } = props;
98
+ const [themeOptions, dispatch] = React.useReducer((state, action) => {
99
+ switch (action.type) {
100
+ case 'SET_DENSE':
101
+ return {
102
+ ...state,
103
+ dense: action.payload
104
+ };
105
+ case 'RESET_DENSITY':
106
+ return {
107
+ ...state,
108
+ dense: themeInitialOptions.dense
109
+ };
110
+ case 'CHANGE':
111
+ // No value changed
112
+ if ((!action.payload.paletteMode || action.payload.paletteMode === state.paletteMode) && (!action.payload.direction || action.payload.direction === state.direction)) {
113
+ return state;
114
+ }
115
+ return {
116
+ ...state,
117
+ paletteMode: action.payload.paletteMode || state.paletteMode,
118
+ direction: action.payload.direction || state.direction
119
+ };
120
+ default:
121
+ throw new Error(`Unrecognized type ${action.type}`);
122
+ }
123
+ }, themeInitialOptions);
124
+ const {
125
+ direction,
126
+ paletteMode
127
+ } = themeOptions;
128
+ useLazyCSS('/static/styles/prism-okaidia.css', '#prismjs');
129
+
130
+ // TODO replace with useColorScheme once all pages support css vars
131
+ const {
132
+ mode,
133
+ systemMode
134
+ } = useColorSchemeShim();
135
+ const calculatedMode = mode === 'system' ? systemMode : mode;
136
+ useEnhancedEffect(() => {
137
+ dispatch({
138
+ type: 'CHANGE',
139
+ payload: {
140
+ paletteMode: calculatedMode
141
+ }
142
+ });
143
+ }, [calculatedMode]);
144
+ useEnhancedEffect(() => {
145
+ document.body.setAttribute('dir', direction);
146
+ }, [direction]);
147
+ useEnhancedEffect(() => {
148
+ // To support light and dark mode images in the docs
149
+ if (paletteMode === 'dark') {
150
+ document.body.classList.remove('mode-light');
151
+ document.body.classList.add('mode-dark');
152
+ } else {
153
+ document.body.classList.remove('mode-dark');
154
+ document.body.classList.add('mode-light');
155
+ }
156
+ const metas = document.querySelectorAll('meta[name="theme-color"]');
157
+ metas.forEach(meta => {
158
+ meta.setAttribute('content', getMetaThemeColor(paletteMode));
159
+ });
160
+ }, [paletteMode]);
161
+ React.useEffect(() => {
162
+ // Expose the theme as a global variable so people can play with it.
163
+ window.createTheme = createMdTheme;
164
+ }, []);
165
+ return /*#__PURE__*/_jsx(ThemeOptionsContext.Provider, {
166
+ value: themeOptions,
167
+ children: /*#__PURE__*/_jsx(DispatchContext.Provider, {
168
+ value: dispatch,
169
+ children: children
170
+ })
171
+ });
172
+ }
173
+ process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = {
174
+ children: PropTypes.node
175
+ } : void 0;
176
+
177
+ /**
178
+ * @returns {(nextOptions: Partial<typeof themeInitialOptions>) => void}
179
+ */
180
+ export function useChangeTheme() {
181
+ const dispatch = React.useContext(DispatchContext);
182
+ return React.useCallback(options => dispatch({
183
+ type: 'CHANGE',
184
+ payload: options
185
+ }), [dispatch]);
186
+ }
187
+
188
+ // TODO: remove once all pages support css vars and replace call sites with useColorScheme()
189
+ export function useColorSchemeShim() {
190
+ const [mode, setMode] = useLocalStorageState('mui-mode', 'system');
191
+ const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)', {
192
+ noSsr: true
193
+ });
194
+ const systemMode = prefersDarkMode ? 'dark' : 'light';
195
+ return {
196
+ mode,
197
+ systemMode,
198
+ setMode
199
+ };
200
+ }
@@ -0,0 +1 @@
1
+ export { ThemeProvider, ThemeOptionsContext, DispatchContext, highDensity, useChangeTheme, useColorSchemeShim } from "./ThemeContext.js";
@@ -0,0 +1 @@
1
+ export { ThemeProvider, ThemeOptionsContext, DispatchContext, highDensity, useChangeTheme, useColorSchemeShim } from "./ThemeContext.js";
@@ -0,0 +1,27 @@
1
+ import * as React from 'react';
2
+ import { PaletteColorOptions } from '@mui/material/styles';
3
+ declare module '@mui/material/styles' {
4
+ interface PaletteOptions {
5
+ primaryDark?: PaletteColorOptions;
6
+ }
7
+ }
8
+ export declare function setDocsColors(primary: Record<string, string>, secondary: Record<string, string>): void;
9
+ export declare function resetDocsColor(): void;
10
+ export declare function setDocsSpacing(value: number): void;
11
+ export declare function resetDocsSpacing(): void;
12
+ export declare function getTheme(direction: 'ltr' | 'rtl'): import("@mui/material/styles").Theme;
13
+ interface BrandingCssThemeProviderProps {
14
+ children: React.ReactNode;
15
+ direction?: 'ltr' | 'rtl';
16
+ forceThemeRerender?: boolean;
17
+ }
18
+ export declare function BrandingCssThemeProvider({
19
+ children,
20
+ direction,
21
+ forceThemeRerender
22
+ }: BrandingCssThemeProviderProps): import("react/jsx-runtime").JSX.Element;
23
+ export declare function BrandingCssVarsProvider(props: {
24
+ children: React.ReactNode;
25
+ direction?: 'ltr' | 'rtl';
26
+ }): import("react/jsx-runtime").JSX.Element;
27
+ export {};
@@ -0,0 +1,170 @@
1
+ var _NextNProgressBar, _CssBaseline, _SkipLink, _MarkdownLinks;
2
+ import * as React from 'react';
3
+ import { useRouter } from 'next/router';
4
+ import deepmerge from '@mui/utils/deepmerge';
5
+ import { ThemeProvider, createTheme } from '@mui/material/styles';
6
+ import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
7
+ import { colorChannel, getContrastRatio, lighten, darken } from '@mui/system/colorManipulator';
8
+ import CssBaseline from '@mui/material/CssBaseline';
9
+ import { getCookie, pathnameToLanguage } from "../helpers/helpers.js";
10
+ import { NextNProgressBar } from "../NextNProgressBar/index.js";
11
+ import { getDesignTokens, getThemedComponents } from "./brandingTheme.js";
12
+ import { SkipLink, MarkdownLinks } from "../Link/index.js";
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ const {
15
+ palette: lightPalette,
16
+ typography,
17
+ ...designTokens
18
+ } = getDesignTokens('light');
19
+ const {
20
+ palette: darkPalette
21
+ } = getDesignTokens('dark');
22
+ const themeOptions = {
23
+ colorSchemes: {
24
+ light: {
25
+ palette: lightPalette
26
+ },
27
+ dark: {
28
+ palette: darkPalette
29
+ }
30
+ },
31
+ ...designTokens,
32
+ typography: deepmerge(typography, {
33
+ h1: {
34
+ ':where([data-mui-color-scheme="dark"]) &': {
35
+ color: 'var(--muidocs-palette-common-white)'
36
+ }
37
+ },
38
+ h2: {
39
+ ':where([data-mui-color-scheme="dark"]) &': {
40
+ color: 'var(--muidocs-palette-grey-100)'
41
+ }
42
+ },
43
+ h5: {
44
+ ':where([data-mui-color-scheme="dark"]) &': {
45
+ color: 'var(--muidocs-palette-primary-300)'
46
+ }
47
+ }
48
+ }),
49
+ ...getThemedComponents()
50
+ };
51
+ export function setDocsColors(primary, secondary) {
52
+ function injectPalette(prefix, palette, color, el) {
53
+ // simplified logic of `createPalette` to avoid `useTheme`.
54
+ const light = lighten(color, 0.2);
55
+ const dark = darken(color, 0.3);
56
+ const contrastText = getContrastRatio(color, '#fff') >= 3 ? '#fff' : 'rgba(0, 0, 0, 0.87)';
57
+ const elStyle = el.style;
58
+ elStyle.setProperty(`--${prefix}-palette-${palette}-main`, color);
59
+ elStyle.setProperty(`--${prefix}-palette-${palette}-mainChannel`, colorChannel(color));
60
+ elStyle.setProperty(`--${prefix}-palette-${palette}-light`, light);
61
+ elStyle.setProperty(`--${prefix}-palette-${palette}-lightChannel`, colorChannel(light));
62
+ elStyle.setProperty(`--${prefix}-palette-${palette}-dark`, dark);
63
+ elStyle.setProperty(`--${prefix}-palette-${palette}-darkChannel`, colorChannel(dark));
64
+ elStyle.setProperty(`--${prefix}-palette-${palette}-contrastText`, contrastText);
65
+ elStyle.setProperty(`--${prefix}-palette-${palette}-contrastTextChannel`, colorChannel(contrastText));
66
+ }
67
+ if (typeof document !== 'undefined') {
68
+ const htmlEl = document.documentElement;
69
+ injectPalette('muidocs', 'primary', primary.main, htmlEl);
70
+ injectPalette('muidocs', 'secondary', secondary.main, htmlEl);
71
+ ['50', '100', '200', '300', '400', '500', '600', '700', '800', '900'].forEach(key => {
72
+ htmlEl.style.setProperty(`--muidocs-palette-primary-${key}`, primary[key]);
73
+ htmlEl.style.setProperty(`--muidocs-palette-secondary-${key}`, secondary[key]);
74
+ });
75
+ injectPalette('mui', 'primary', primary.main, htmlEl);
76
+ injectPalette('mui', 'secondary', secondary.main, htmlEl);
77
+ }
78
+ }
79
+ export function resetDocsColor() {
80
+ if (typeof document !== 'undefined') {
81
+ const htmlElStyle = document.documentElement.style;
82
+ htmlElStyle.removeProperty('--muidocs-palette-primary-main');
83
+ htmlElStyle.removeProperty('--muidocs-palette-secondary-main');
84
+ htmlElStyle.removeProperty('--mui-palette-primary-main');
85
+ htmlElStyle.removeProperty('--mui-palette-secondary-main');
86
+ ['50', '100', '200', '300', '400', '500', '600', '700', '800', '900'].forEach(key => {
87
+ htmlElStyle.removeProperty(`--muidocs-palette-primary-${key}`);
88
+ htmlElStyle.removeProperty(`--muidocs-palette-secondary-${key}`);
89
+ });
90
+ }
91
+ }
92
+ export function setDocsSpacing(value) {
93
+ if (typeof document !== 'undefined') {
94
+ const htmlElStyle = document.documentElement.style;
95
+ htmlElStyle.setProperty('--muidocs-spacing', `${value}px`);
96
+ htmlElStyle.setProperty('--mui-spacing', `${value}px`);
97
+ }
98
+ }
99
+ export function resetDocsSpacing() {
100
+ if (typeof document !== 'undefined') {
101
+ const htmlElStyle = document.documentElement.style;
102
+ htmlElStyle.removeProperty('--muidocs-spacing');
103
+ htmlElStyle.removeProperty('--mui-spacing');
104
+ }
105
+ }
106
+ const themeCache = new Map();
107
+ export function getTheme(direction) {
108
+ let cachedTheme = themeCache.get(direction);
109
+ if (!cachedTheme) {
110
+ cachedTheme = createTheme({
111
+ cssVariables: {
112
+ cssVarPrefix: 'muidocs',
113
+ colorSchemeSelector: 'data-mui-color-scheme'
114
+ },
115
+ direction,
116
+ ...themeOptions
117
+ });
118
+ themeCache.set(direction, cachedTheme);
119
+ }
120
+ return cachedTheme;
121
+ }
122
+ export function BrandingCssThemeProvider({
123
+ children,
124
+ direction = 'ltr',
125
+ forceThemeRerender = false
126
+ }) {
127
+ const theme = React.useMemo(() => getTheme(direction), [direction]);
128
+ return /*#__PURE__*/_jsx(ThemeProvider, {
129
+ theme: theme,
130
+ disableTransitionOnChange: true
131
+ // TODO: remove `forceThemeRerender` once custom theme on some demos rely on CSS variables instead of `theme.palette.mode`
132
+ ,
133
+ forceThemeRerender: forceThemeRerender,
134
+ children: children
135
+ });
136
+ }
137
+ export function BrandingCssVarsProvider(props) {
138
+ const {
139
+ direction = 'ltr',
140
+ children
141
+ } = props;
142
+ const {
143
+ asPath
144
+ } = useRouter();
145
+ const {
146
+ canonicalAs
147
+ } = pathnameToLanguage(asPath);
148
+ useEnhancedEffect(() => {
149
+ const nextPaletteColors = JSON.parse(getCookie('paletteColors') || 'null');
150
+ if (nextPaletteColors) {
151
+ setDocsColors(nextPaletteColors.primary, nextPaletteColors.secondary);
152
+ }
153
+ }, []);
154
+ useEnhancedEffect(() => {
155
+ // This is required to ensure that the layer order is declared first in the head
156
+ // because when the direction is RTL on the client, emotion reinserts the RTL styles back to the top of the insertion point.
157
+ if (direction === 'rtl') {
158
+ const head = document.querySelector('head');
159
+ if (head) {
160
+ const style = document.createElement('style');
161
+ style.textContent = '@layer theme, docsearch, mui, mui.global, mui.default, mui.theme, mui.custom, mui.sx, utilities;';
162
+ head.prepend(style);
163
+ }
164
+ }
165
+ }, [direction]);
166
+ return /*#__PURE__*/_jsxs(BrandingCssThemeProvider, {
167
+ forceThemeRerender: canonicalAs.startsWith('/x/') || canonicalAs.startsWith('/toolpad/'),
168
+ children: [_NextNProgressBar || (_NextNProgressBar = /*#__PURE__*/_jsx(NextNProgressBar, {})), _CssBaseline || (_CssBaseline = /*#__PURE__*/_jsx(CssBaseline, {})), _SkipLink || (_SkipLink = /*#__PURE__*/_jsx(SkipLink, {})), _MarkdownLinks || (_MarkdownLinks = /*#__PURE__*/_jsx(MarkdownLinks, {})), children]
169
+ });
170
+ }
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ export interface BrandingProviderProps {
3
+ children: React.ReactNode;
4
+ /**
5
+ * If not `undefined`, the provider is considered nesting and does not render NextNProgressBar & CssBaseline
6
+ */
7
+ mode?: 'light' | 'dark';
8
+ }
9
+ export declare function BrandingProvider(props: BrandingProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import { ThemeProvider, useTheme } from '@mui/material/styles';
3
+ import { brandingDarkTheme, brandingLightTheme } from "./brandingTheme.js";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ export function BrandingProvider(props) {
6
+ const {
7
+ children,
8
+ mode: modeProp
9
+ } = props;
10
+ const upperTheme = useTheme();
11
+ const mode = modeProp || upperTheme.palette.mode;
12
+ const theme = mode === 'dark' ? brandingDarkTheme : brandingLightTheme;
13
+ return /*#__PURE__*/_jsx(ThemeProvider, {
14
+ theme: modeProp ? () => theme : theme,
15
+ children: children
16
+ });
17
+ }
@@ -0,0 +1,147 @@
1
+ import type { CSSObject } from '@mui/system';
2
+ import { ThemeOptions, Theme } from '@mui/material/styles';
3
+ interface ApplyDarkStyles {
4
+ (scheme: CSSObject): CSSObject;
5
+ }
6
+ declare module '@mui/material/styles' {
7
+ interface Theme {
8
+ applyDarkStyles: ApplyDarkStyles;
9
+ }
10
+ interface ColorRange {
11
+ 50: string;
12
+ 100: string;
13
+ 200: string;
14
+ 300: string;
15
+ 400: string;
16
+ 500: string;
17
+ 600: string;
18
+ 700: string;
19
+ 800: string;
20
+ 900: string;
21
+ }
22
+ interface PaletteColor extends ColorRange {}
23
+ interface Palette {
24
+ primaryDark: PaletteColor;
25
+ gradients: {
26
+ radioSubtle: string;
27
+ linearSubtle: string;
28
+ };
29
+ }
30
+ interface TypeText {
31
+ tertiary: string;
32
+ }
33
+ interface TypographyVariantsOptions {
34
+ fontWeightSemiBold?: number;
35
+ fontWeightExtraBold?: number;
36
+ fontFamilyCode?: string;
37
+ fontFamilySystem?: string;
38
+ }
39
+ interface TypographyVariants {
40
+ fontWeightSemiBold: number;
41
+ fontWeightExtraBold: number;
42
+ fontFamilyCode: string;
43
+ fontFamilySystem: string;
44
+ }
45
+ }
46
+ declare module '@mui/material/Chip' {
47
+ interface ChipPropsColorOverrides {
48
+ grey: true;
49
+ }
50
+ }
51
+ declare module '@mui/material/SvgIcon' {
52
+ interface SvgIconPropsColorOverrides {
53
+ danger: true;
54
+ }
55
+ interface SvgIconPropsSizeOverrides {
56
+ xs: true;
57
+ sm: true;
58
+ md: true;
59
+ lg: true;
60
+ xl: true;
61
+ xl2: true;
62
+ xl3: true;
63
+ xl4: true;
64
+ }
65
+ }
66
+ export declare const blue: {
67
+ 50: string;
68
+ 100: string;
69
+ 200: string;
70
+ 300: string;
71
+ 400: string;
72
+ main: string;
73
+ 500: string;
74
+ 600: string;
75
+ 700: string;
76
+ 800: string;
77
+ 900: string;
78
+ };
79
+ export declare const blueDark: {
80
+ 50: string;
81
+ 100: string;
82
+ 200: string;
83
+ 300: string;
84
+ main: string;
85
+ 400: string;
86
+ 500: string;
87
+ 600: string;
88
+ 700: string;
89
+ 800: string;
90
+ 900: string;
91
+ };
92
+ export declare const grey: {
93
+ 50: string;
94
+ 100: string;
95
+ 200: string;
96
+ 300: string;
97
+ 400: string;
98
+ 500: string;
99
+ 600: string;
100
+ 700: string;
101
+ 800: string;
102
+ 900: string;
103
+ };
104
+ export declare const error: {
105
+ 50: string;
106
+ 100: string;
107
+ 200: string;
108
+ 300: string;
109
+ 400: string;
110
+ 500: string;
111
+ main: string;
112
+ 600: string;
113
+ 700: string;
114
+ 800: string;
115
+ 900: string;
116
+ };
117
+ export declare const success: {
118
+ 50: string;
119
+ 100: string;
120
+ 200: string;
121
+ 300: string;
122
+ 400: string;
123
+ 500: string;
124
+ 600: string;
125
+ 700: string;
126
+ 800: string;
127
+ 900: string;
128
+ };
129
+ export declare const warning: {
130
+ 50: string;
131
+ 100: string;
132
+ 200: string;
133
+ 300: string;
134
+ 400: string;
135
+ 500: string;
136
+ main: string;
137
+ 600: string;
138
+ 700: string;
139
+ 800: string;
140
+ 900: string;
141
+ };
142
+ export declare const getMetaThemeColor: (mode: "light" | "dark") => string;
143
+ export declare const getDesignTokens: (mode: "light" | "dark") => ThemeOptions;
144
+ export declare function getThemedComponents(): ThemeOptions;
145
+ export declare const brandingDarkTheme: Theme;
146
+ export declare const brandingLightTheme: Theme;
147
+ export {};