@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,76 @@
1
+ var _br;
2
+ /* eslint-disable react/no-danger */
3
+ import * as React from 'react';
4
+ import Box from '@mui/material/Box';
5
+ import { SectionTitle } from "../../SectionTitle/index.js";
6
+ import { useTranslate } from "../../i18n/index.js";
7
+ import { ToggleDisplayOption, useApiPageOption } from "./ToggleDisplayOption.js";
8
+ import { getClassApiDefinitions } from "../definitions/classes.js";
9
+ import ClassesTable from "../table/ClassesTable.js";
10
+ import ClassesList from "../list/ClassesList.js";
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ export function ClassesSection(props) {
13
+ const {
14
+ classes,
15
+ componentClasses,
16
+ classDescriptions,
17
+ componentName,
18
+ spreadHint,
19
+ title = 'api-docs.classes',
20
+ titleHash = 'classes',
21
+ level = 'h2',
22
+ displayClassKeys,
23
+ styleOverridesLink,
24
+ defaultLayout,
25
+ layoutStorageKey
26
+ } = props;
27
+ const t = useTranslate();
28
+ const [displayOption, setDisplayOption] = useApiPageOption(layoutStorageKey, defaultLayout);
29
+ const formattedClasses = classes || getClassApiDefinitions({
30
+ componentClasses,
31
+ classDescriptions,
32
+ componentName
33
+ });
34
+ if (!formattedClasses || formattedClasses.length === 0) {
35
+ return null;
36
+ }
37
+ return /*#__PURE__*/_jsxs(React.Fragment, {
38
+ children: [/*#__PURE__*/_jsxs(Box, {
39
+ sx: {
40
+ display: 'flex',
41
+ alignItems: 'baseline',
42
+ mb: 1
43
+ },
44
+ children: [/*#__PURE__*/_jsx(SectionTitle, {
45
+ title: t(title),
46
+ hash: titleHash,
47
+ level: level
48
+ }), /*#__PURE__*/_jsx(ToggleDisplayOption, {
49
+ displayOption: displayOption,
50
+ setDisplayOption: setDisplayOption,
51
+ sectionType: "classes"
52
+ })]
53
+ }), spreadHint && /*#__PURE__*/_jsx("p", {
54
+ dangerouslySetInnerHTML: {
55
+ __html: spreadHint
56
+ }
57
+ }), displayOption === 'table' ? /*#__PURE__*/_jsx(ClassesTable, {
58
+ classes: formattedClasses,
59
+ displayClassKeys: displayClassKeys
60
+ }) : /*#__PURE__*/_jsx(ClassesList, {
61
+ classes: formattedClasses,
62
+ displayOption: displayOption,
63
+ displayClassKeys: displayClassKeys
64
+ }), styleOverridesLink && /*#__PURE__*/_jsxs(React.Fragment, {
65
+ children: [_br || (_br = /*#__PURE__*/_jsx("br", {})), /*#__PURE__*/_jsx("p", {
66
+ dangerouslySetInnerHTML: {
67
+ __html: t('api-docs.overrideStyles')
68
+ }
69
+ }), /*#__PURE__*/_jsx("div", {
70
+ dangerouslySetInnerHTML: {
71
+ __html: t('api-docs.overrideStylesStyledComponent').replace(/{{styleOverridesLink}}/, styleOverridesLink)
72
+ }
73
+ })]
74
+ })]
75
+ });
76
+ }
@@ -0,0 +1,45 @@
1
+ import { PropsTableItem, PropsTranslations } from '@mui-internal/api-docs-builder';
2
+ import { type ApiDisplayLayout } from "./ToggleDisplayOption.js";
3
+ import { type SectionTitleProps } from "../../SectionTitle/index.js";
4
+ import { LayoutStorageKeys } from "../types.js";
5
+ import { PropertyDefinition } from "../definitions/index.js";
6
+ type PropertiesSectionProps = ({
7
+ properties: {
8
+ [name: string]: PropsTableItem & {
9
+ isProPlan?: true;
10
+ isPremiumPlan?: true;
11
+ };
12
+ };
13
+ propertiesDescriptions: PropsTranslations['propDescriptions'];
14
+ componentName: string;
15
+ /**
16
+ * Add indicators that the properties is optional instead of showing it is required.
17
+ */
18
+ showOptionalAbbr?: boolean;
19
+ } | {
20
+ showOptionalAbbr?: undefined;
21
+ properties: PropertyDefinition[];
22
+ propertiesDescriptions?: undefined;
23
+ componentName?: undefined;
24
+ }) & {
25
+ spreadHint?: string;
26
+ defaultLayout: ApiDisplayLayout;
27
+ layoutStorageKey: LayoutStorageKeys['props'];
28
+ /**
29
+ * The translation key of the section title.
30
+ * @default 'api-docs.props'
31
+ */
32
+ title?: string;
33
+ /**
34
+ * The hash linking to the section title.
35
+ * @default 'props'
36
+ */
37
+ titleHash?: SectionTitleProps['hash'];
38
+ /**
39
+ * The title level of the section.
40
+ * @default 'h2'
41
+ */
42
+ level?: SectionTitleProps['level'];
43
+ };
44
+ export declare function PropertiesSection(props: PropertiesSectionProps): import("react/jsx-runtime").JSX.Element;
45
+ export {};
@@ -0,0 +1,59 @@
1
+ /* eslint-disable react/no-danger */
2
+ import * as React from 'react';
3
+ import Box from '@mui/material/Box';
4
+ import { useTranslate } from "../../i18n/index.js";
5
+ import { ToggleDisplayOption, useApiPageOption } from "./ToggleDisplayOption.js";
6
+ import { SectionTitle } from "../../SectionTitle/index.js";
7
+ import PropertiesTable from "../table/PropertiesTable.js";
8
+ import PropertiesList from "../list/PropertiesList.js";
9
+ import { getPropsApiDefinitions } from "../definitions/properties.js";
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ export function PropertiesSection(props) {
12
+ const {
13
+ properties,
14
+ propertiesDescriptions,
15
+ componentName,
16
+ title = 'api-docs.props',
17
+ titleHash = 'props',
18
+ level = 'h2',
19
+ spreadHint,
20
+ defaultLayout,
21
+ layoutStorageKey,
22
+ showOptionalAbbr
23
+ } = props;
24
+ const t = useTranslate();
25
+ const [displayOption, setDisplayOption] = useApiPageOption(layoutStorageKey, defaultLayout);
26
+ const formattedProperties = Array.isArray(properties) ? properties : getPropsApiDefinitions({
27
+ properties,
28
+ propertiesDescriptions: propertiesDescriptions,
29
+ componentName: componentName,
30
+ showOptionalAbbr
31
+ });
32
+ return /*#__PURE__*/_jsxs(React.Fragment, {
33
+ children: [/*#__PURE__*/_jsxs(Box, {
34
+ sx: {
35
+ display: 'flex',
36
+ alignItems: 'baseline',
37
+ mb: 1
38
+ },
39
+ children: [/*#__PURE__*/_jsx(SectionTitle, {
40
+ title: t(title),
41
+ hash: titleHash,
42
+ level: level
43
+ }), /*#__PURE__*/_jsx(ToggleDisplayOption, {
44
+ displayOption: displayOption,
45
+ setDisplayOption: setDisplayOption,
46
+ sectionType: "props"
47
+ })]
48
+ }), spreadHint && /*#__PURE__*/_jsx("p", {
49
+ dangerouslySetInnerHTML: {
50
+ __html: spreadHint
51
+ }
52
+ }), displayOption === 'table' ? /*#__PURE__*/_jsx(PropertiesTable, {
53
+ properties: formattedProperties
54
+ }) : /*#__PURE__*/_jsx(PropertiesList, {
55
+ properties: formattedProperties,
56
+ displayOption: displayOption
57
+ })]
58
+ });
59
+ }
@@ -0,0 +1,24 @@
1
+ import { ComponentApiContent } from '@mui-internal/api-docs-builder';
2
+ import { SlotDefinition } from "../definitions/types.js";
3
+ import { type ApiDisplayLayout } from "./ToggleDisplayOption.js";
4
+ export type SlotsSectionProps = ({
5
+ slots: SlotDefinition[];
6
+ componentSlots?: undefined;
7
+ slotDescriptions?: undefined;
8
+ componentName?: undefined;
9
+ } | {
10
+ slots: undefined;
11
+ componentSlots: ComponentApiContent['slots'];
12
+ slotDescriptions: {
13
+ [key: string]: string;
14
+ };
15
+ componentName: string;
16
+ }) & {
17
+ title?: string;
18
+ titleHash?: string;
19
+ level?: 'h2' | 'h3' | 'h4';
20
+ defaultLayout: ApiDisplayLayout;
21
+ layoutStorageKey: string;
22
+ spreadHint?: string;
23
+ };
24
+ export declare function SlotsSection(props: SlotsSectionProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,61 @@
1
+ /* eslint-disable react/no-danger */
2
+ import * as React from 'react';
3
+ import Box from '@mui/material/Box';
4
+ import { useTranslate } from "../../i18n/index.js";
5
+ import { SectionTitle } from "../../SectionTitle/index.js";
6
+ import SlotsList from "../list/SlotsList.js";
7
+ import SlotsTable from "../table/SlotsTable.js";
8
+ import { ToggleDisplayOption, useApiPageOption } from "./ToggleDisplayOption.js";
9
+ import { getSlotsApiDefinitions } from "../definitions/slots.js";
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ export function SlotsSection(props) {
12
+ const {
13
+ slots,
14
+ componentSlots,
15
+ slotDescriptions,
16
+ componentName,
17
+ title = 'api-docs.slots',
18
+ titleHash = 'slots',
19
+ level = 'h2',
20
+ spreadHint,
21
+ defaultLayout,
22
+ layoutStorageKey
23
+ } = props;
24
+ const t = useTranslate();
25
+ const [displayOption, setDisplayOption] = useApiPageOption(layoutStorageKey, defaultLayout);
26
+ const formattedSlots = slots ?? getSlotsApiDefinitions({
27
+ componentSlots,
28
+ slotDescriptions,
29
+ componentName
30
+ });
31
+ if (!formattedSlots || formattedSlots.length === 0) {
32
+ return null;
33
+ }
34
+ return /*#__PURE__*/_jsxs(React.Fragment, {
35
+ children: [/*#__PURE__*/_jsxs(Box, {
36
+ sx: {
37
+ display: 'flex',
38
+ alignItems: 'baseline',
39
+ mb: 1
40
+ },
41
+ children: [/*#__PURE__*/_jsx(SectionTitle, {
42
+ title: t(title),
43
+ hash: titleHash,
44
+ level: level
45
+ }), /*#__PURE__*/_jsx(ToggleDisplayOption, {
46
+ displayOption: displayOption,
47
+ setDisplayOption: setDisplayOption,
48
+ sectionType: "slots"
49
+ })]
50
+ }), spreadHint && /*#__PURE__*/_jsx("p", {
51
+ dangerouslySetInnerHTML: {
52
+ __html: spreadHint
53
+ }
54
+ }), displayOption === 'table' ? /*#__PURE__*/_jsx(SlotsTable, {
55
+ slots: formattedSlots
56
+ }) : /*#__PURE__*/_jsx(SlotsList, {
57
+ slots: formattedSlots,
58
+ displayOption: displayOption
59
+ })]
60
+ });
61
+ }
@@ -0,0 +1,17 @@
1
+ export type ApiDisplayLayout = 'collapsed' | 'expanded' | 'table';
2
+ export declare const DEFAULT_API_LAYOUT_STORAGE_KEYS: {
3
+ readonly slots: "apiPage_slots";
4
+ readonly props: "apiPage_props";
5
+ readonly classes: "apiPage_classes";
6
+ };
7
+ export declare function useApiPageOption(storageKey: string, defaultValue: ApiDisplayLayout): [ApiDisplayLayout, (newOption: ApiDisplayLayout) => void];
8
+ interface ToggleDisplayOptionProps {
9
+ displayOption: ApiDisplayLayout;
10
+ setDisplayOption: (newValue: ApiDisplayLayout) => void;
11
+ /**
12
+ * The type of section. This value is used to send correct event to Google Analytics.
13
+ */
14
+ sectionType: 'classes' | 'props' | 'slots';
15
+ }
16
+ export declare function ToggleDisplayOption(props: ToggleDisplayOptionProps): import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -0,0 +1,161 @@
1
+ var _ArrowDropDownRounded;
2
+ import * as React from 'react';
3
+ import Box from '@mui/material/Box';
4
+ import Button from '@mui/material/Button';
5
+ import Menu from '@mui/material/Menu';
6
+ import MenuItem from '@mui/material/MenuItem';
7
+ import CheckIcon from '@mui/icons-material/Check';
8
+ import ArrowDropDownRoundedIcon from '@mui/icons-material/ArrowDropDownRounded';
9
+ import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ const options = ['collapsed', 'expanded', 'table'];
12
+ export const DEFAULT_API_LAYOUT_STORAGE_KEYS = {
13
+ slots: 'apiPage_slots',
14
+ props: 'apiPage_props',
15
+ classes: 'apiPage_classes'
16
+ };
17
+ let neverHydrated = true;
18
+ function getOption(storageKey, defaultValue) {
19
+ if (neverHydrated) {
20
+ return defaultValue;
21
+ }
22
+ try {
23
+ const savedOption = localStorage.getItem(storageKey);
24
+ if (savedOption !== null && options.includes(savedOption)) {
25
+ return savedOption;
26
+ }
27
+ } catch (error) {
28
+ return defaultValue;
29
+ }
30
+ return defaultValue;
31
+ }
32
+ export function useApiPageOption(storageKey, defaultValue) {
33
+ const [option, setOption] = React.useState(getOption(storageKey, defaultValue));
34
+ useEnhancedEffect(() => {
35
+ // TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- useEnhancedEffect uses useEffect under the hood
36
+ neverHydrated = false;
37
+ const newOption = getOption(storageKey, defaultValue);
38
+ setOption(newOption);
39
+ }, [storageKey, defaultValue]);
40
+ React.useEffect(() => {
41
+ if (option !== defaultValue) {
42
+ const id = document.location.hash.slice(1);
43
+ const element = document.getElementById(id);
44
+ element?.scrollIntoView();
45
+ }
46
+ return undefined;
47
+ }, [option, defaultValue]);
48
+ const updateOption = React.useCallback(newOption => {
49
+ try {
50
+ localStorage.setItem(storageKey, newOption);
51
+ } catch (error) {
52
+ // Do nothing
53
+ }
54
+ setOption(newOption);
55
+ }, [storageKey]);
56
+ return [option, updateOption];
57
+ }
58
+ export function ToggleDisplayOption(props) {
59
+ const {
60
+ displayOption,
61
+ setDisplayOption,
62
+ sectionType
63
+ } = props;
64
+ const id = React.useId();
65
+ const buttonId = `${id}-view-switching-button`;
66
+ const menuId = `${id}-view-options-menu`;
67
+ const [anchorEl, setAnchorEl] = React.useState(null);
68
+ const [open, setOpen] = React.useState(false);
69
+ const handleMenuClick = event => {
70
+ setAnchorEl(event.currentTarget);
71
+ setOpen(true);
72
+ };
73
+ const handleClose = () => {
74
+ setAnchorEl(null);
75
+ setOpen(false);
76
+ };
77
+ const handleMenuItemClick = newDisplayOption => {
78
+ setDisplayOption(newDisplayOption);
79
+ handleClose();
80
+ };
81
+ return /*#__PURE__*/_jsxs(React.Fragment, {
82
+ children: [/*#__PURE__*/_jsxs(Button, {
83
+ size: "small",
84
+ variant: "outlined",
85
+ color: "secondary",
86
+ id: buttonId,
87
+ "aria-controls": open ? menuId : undefined,
88
+ "aria-haspopup": "true",
89
+ "aria-expanded": open ? 'true' : undefined,
90
+ onClick: handleMenuClick,
91
+ endIcon: _ArrowDropDownRounded || (_ArrowDropDownRounded = /*#__PURE__*/_jsx(ArrowDropDownRoundedIcon, {})),
92
+ sx: {
93
+ height: '1.875rem',
94
+ p: '6px 4px 6px 8px',
95
+ textTransform: 'capitalize'
96
+ },
97
+ children: [/*#__PURE__*/_jsx(Box, {
98
+ component: "span",
99
+ sx: {
100
+ fontWeight: 'medium',
101
+ mr: 0.5
102
+ },
103
+ children: 'View:'
104
+ }), displayOption]
105
+ }), /*#__PURE__*/_jsxs(Menu, {
106
+ id: menuId,
107
+ anchorEl: anchorEl,
108
+ open: open,
109
+ onClose: handleClose,
110
+ sx: {
111
+ mt: 1,
112
+ '.MuiMenuItem-root': {
113
+ pl: 1
114
+ }
115
+ },
116
+ children: [/*#__PURE__*/_jsxs(MenuItem, {
117
+ value: "table",
118
+ onClick: () => handleMenuItemClick('table'),
119
+ selected: displayOption === 'table',
120
+ "data-ga-event-category": "layout",
121
+ "data-ga-event-action": sectionType,
122
+ "data-ga-event-label": "table",
123
+ children: ['Table', /*#__PURE__*/_jsx(CheckIcon, {
124
+ sx: {
125
+ fontSize: '0.85rem',
126
+ ml: 'auto',
127
+ opacity: displayOption === 'table' ? 1 : 0
128
+ }
129
+ })]
130
+ }), /*#__PURE__*/_jsxs(MenuItem, {
131
+ value: "expanded",
132
+ onClick: () => handleMenuItemClick('expanded'),
133
+ selected: displayOption === 'expanded',
134
+ "data-ga-event-category": "layout",
135
+ "data-ga-event-action": sectionType,
136
+ "data-ga-event-label": "expanded",
137
+ children: ['Expanded list', /*#__PURE__*/_jsx(CheckIcon, {
138
+ sx: {
139
+ fontSize: '0.85rem',
140
+ ml: 'auto',
141
+ opacity: displayOption === 'expanded' ? 1 : 0
142
+ }
143
+ })]
144
+ }), /*#__PURE__*/_jsxs(MenuItem, {
145
+ value: "collapsed",
146
+ onClick: () => handleMenuItemClick('collapsed'),
147
+ selected: displayOption === 'collapsed',
148
+ "data-ga-event-category": "layout",
149
+ "data-ga-event-action": sectionType,
150
+ "data-ga-event-label": "collapsed",
151
+ children: ['Collapsed list', /*#__PURE__*/_jsx(CheckIcon, {
152
+ sx: {
153
+ fontSize: '0.85rem',
154
+ ml: 'auto',
155
+ opacity: displayOption === 'collapsed' ? 1 : 0
156
+ }
157
+ })]
158
+ })]
159
+ })]
160
+ });
161
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./ToggleDisplayOption.js";
2
+ export * from "./PropertiesSection.js";
3
+ export * from "./ClassesSection.js";
4
+ export * from "./SlotsSection.js";
@@ -0,0 +1,4 @@
1
+ export * from "./ToggleDisplayOption.js";
2
+ export * from "./PropertiesSection.js";
3
+ export * from "./ClassesSection.js";
4
+ export * from "./SlotsSection.js";
@@ -0,0 +1,7 @@
1
+ import { ClassDefinition } from "../definitions/types.js";
2
+ interface ClassesTableProps {
3
+ classes: ClassDefinition[];
4
+ displayClassKeys?: boolean;
5
+ }
6
+ export default function ClassesTable(props: ClassesTableProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,116 @@
1
+ var _th, _th2, _th3;
2
+ /* eslint-disable react/no-danger */
3
+ import * as React from 'react';
4
+ import { styled, alpha } from '@mui/material/styles';
5
+ import { brandingDarkTheme as darkTheme, brandingLightTheme as lightTheme } from "../../branding/index.js";
6
+ import { useTranslate } from "../../i18n/index.js";
7
+ import { StyledTableContainer } from "./StyledTableContainer.js";
8
+ import { ApiWarningAlert } from "../ApiWarningAlert.js";
9
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
+ const StyledTable = styled('table')(({
11
+ theme
12
+ }) => ({
13
+ textAlign: 'left',
14
+ // Override docs/src/modules/components/MarkdownElement styles
15
+ '&&': {
16
+ display: 'table',
17
+ width: '100%'
18
+ },
19
+ '& .class-name': {
20
+ flexShrink: 0,
21
+ fontWeight: theme.typography.fontWeightSemiBold,
22
+ fontFamily: theme.typography.fontFamilyCode,
23
+ fontSize: theme.typography.pxToRem(13),
24
+ color: `var(--muidocs-palette-primary-600, ${lightTheme.palette.primary[600]})`
25
+ },
26
+ '& .class-key': {
27
+ ...theme.typography.caption,
28
+ fontFamily: theme.typography.fontFamilyCode,
29
+ fontWeight: theme.typography.fontWeightRegular,
30
+ color: `var(--muidocs-palette-text-primary, ${lightTheme.palette.text.primary})`,
31
+ padding: '1px 4px',
32
+ borderRadius: 6,
33
+ border: '1px solid',
34
+ borderColor: alpha(darkTheme.palette.primary[100], 0.8),
35
+ backgroundColor: `var(--muidocs-palette-primary-50, ${lightTheme.palette.primary[50]})`
36
+ }
37
+ }), ({
38
+ theme
39
+ }) => ({
40
+ [`:where(${theme.vars ? '[data-mui-color-scheme="dark"]' : '.mode-dark'}) &`]: {
41
+ '& .class-name': {
42
+ color: `var(--muidocs-palette-primary-200, ${darkTheme.palette.primary[200]})`
43
+ },
44
+ '& .class-key': {
45
+ color: `var(--muidocs-palette-text-primary, ${darkTheme.palette.text.primary})`,
46
+ borderColor: alpha(darkTheme.palette.primary[400], 0.1),
47
+ backgroundColor: alpha(darkTheme.palette.primary[900], 0.4)
48
+ }
49
+ }
50
+ }));
51
+ export default function ClassesTable(props) {
52
+ const {
53
+ classes,
54
+ displayClassKeys
55
+ } = props;
56
+ const t = useTranslate();
57
+ return /*#__PURE__*/_jsx(StyledTableContainer, {
58
+ children: /*#__PURE__*/_jsxs(StyledTable, {
59
+ children: [/*#__PURE__*/_jsx("thead", {
60
+ children: /*#__PURE__*/_jsxs("tr", {
61
+ children: [_th || (_th = /*#__PURE__*/_jsx("th", {
62
+ children: 'Class name'
63
+ })), displayClassKeys && (_th2 || (_th2 = /*#__PURE__*/_jsx("th", {
64
+ children: 'Rule name'
65
+ }))), _th3 || (_th3 = /*#__PURE__*/_jsx("th", {
66
+ children: 'Description'
67
+ }))]
68
+ })
69
+ }), /*#__PURE__*/_jsx("tbody", {
70
+ children: classes.map(params => {
71
+ const {
72
+ className,
73
+ hash,
74
+ key,
75
+ description,
76
+ isGlobal,
77
+ isDeprecated,
78
+ deprecationInfo
79
+ } = params;
80
+ return /*#__PURE__*/_jsxs("tr", {
81
+ id: hash,
82
+ children: [/*#__PURE__*/_jsx("td", {
83
+ className: "algolia-lvl3",
84
+ children: /*#__PURE__*/_jsxs("span", {
85
+ className: "class-name",
86
+ children: [".", className]
87
+ })
88
+ }), displayClassKeys && /*#__PURE__*/_jsx("td", {
89
+ children: !isGlobal && /*#__PURE__*/_jsx("span", {
90
+ className: "class-key",
91
+ children: key
92
+ })
93
+ }), /*#__PURE__*/_jsxs("td", {
94
+ className: "algolia-content",
95
+ children: [/*#__PURE__*/_jsx("span", {
96
+ dangerouslySetInnerHTML: {
97
+ __html: description || ''
98
+ }
99
+ }), isDeprecated && /*#__PURE__*/_jsxs(ApiWarningAlert, {
100
+ children: [/*#__PURE__*/_jsx("b", {
101
+ children: t('api-docs.deprecated')
102
+ }), deprecationInfo && /*#__PURE__*/_jsxs(React.Fragment, {
103
+ children: ['-', /*#__PURE__*/_jsx("span", {
104
+ dangerouslySetInnerHTML: {
105
+ __html: deprecationInfo
106
+ }
107
+ })]
108
+ })]
109
+ })]
110
+ })]
111
+ }, className);
112
+ })
113
+ })]
114
+ })
115
+ });
116
+ }
@@ -0,0 +1,6 @@
1
+ import type { PropertyDefinition } from "../definitions/types.js";
2
+ interface PropertiesTableProps {
3
+ properties: PropertyDefinition[];
4
+ }
5
+ export default function PropertiesTable(props: PropertiesTableProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};