@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.
- package/Ad/Ad.d.ts +5 -0
- package/Ad/Ad.js +226 -0
- package/Ad/AdCarbon.d.ts +2 -0
- package/Ad/AdCarbon.js +125 -0
- package/Ad/AdDisplay.d.ts +16 -0
- package/Ad/AdDisplay.js +86 -0
- package/Ad/AdGuest.d.ts +10 -0
- package/Ad/AdGuest.js +29 -0
- package/Ad/AdInHouse.d.ts +4 -0
- package/Ad/AdInHouse.js +14 -0
- package/Ad/AdManager.d.ts +19 -0
- package/Ad/AdManager.js +36 -0
- package/Ad/AdProvider.d.ts +15 -0
- package/Ad/AdProvider.js +24 -0
- package/Ad/ad.styles.d.ts +4 -0
- package/Ad/ad.styles.js +91 -0
- package/Ad/index.d.ts +5 -0
- package/Ad/index.js +7 -0
- package/ApiPage/ApiWarningAlert.d.ts +10 -0
- package/ApiPage/ApiWarningAlert.js +22 -0
- package/ApiPage/definitions/classes.d.ts +18 -0
- package/ApiPage/definitions/classes.js +54 -0
- package/ApiPage/definitions/index.d.ts +4 -0
- package/ApiPage/definitions/index.js +4 -0
- package/ApiPage/definitions/properties.d.ts +58 -0
- package/ApiPage/definitions/properties.js +110 -0
- package/ApiPage/definitions/slots.d.ts +16 -0
- package/ApiPage/definitions/slots.js +39 -0
- package/ApiPage/definitions/types.d.ts +53 -0
- package/ApiPage/definitions/types.js +1 -0
- package/ApiPage/index.d.ts +2 -0
- package/ApiPage/index.js +2 -0
- package/ApiPage/list/ClassesList.d.ts +11 -0
- package/ApiPage/list/ClassesList.js +103 -0
- package/ApiPage/list/ExpandableApiItem.d.ts +18 -0
- package/ApiPage/list/ExpandableApiItem.js +241 -0
- package/ApiPage/list/PropertiesList.d.ts +7 -0
- package/ApiPage/list/PropertiesList.js +263 -0
- package/ApiPage/list/SlotsList.d.ts +7 -0
- package/ApiPage/list/SlotsList.js +93 -0
- package/ApiPage/list/index.d.ts +1 -0
- package/ApiPage/list/index.js +1 -0
- package/ApiPage/private.d.ts +3 -0
- package/ApiPage/private.js +3 -0
- package/ApiPage/sections/ClassesSection.d.ts +34 -0
- package/ApiPage/sections/ClassesSection.js +76 -0
- package/ApiPage/sections/PropertiesSection.d.ts +45 -0
- package/ApiPage/sections/PropertiesSection.js +59 -0
- package/ApiPage/sections/SlotsSection.d.ts +24 -0
- package/ApiPage/sections/SlotsSection.js +61 -0
- package/ApiPage/sections/ToggleDisplayOption.d.ts +17 -0
- package/ApiPage/sections/ToggleDisplayOption.js +161 -0
- package/ApiPage/sections/index.d.ts +4 -0
- package/ApiPage/sections/index.js +4 -0
- package/ApiPage/table/ClassesTable.d.ts +7 -0
- package/ApiPage/table/ClassesTable.js +116 -0
- package/ApiPage/table/PropertiesTable.d.ts +6 -0
- package/ApiPage/table/PropertiesTable.js +286 -0
- package/ApiPage/table/SlotsTable.d.ts +6 -0
- package/ApiPage/table/SlotsTable.js +126 -0
- package/ApiPage/table/StyledTableContainer.d.ts +1 -0
- package/ApiPage/table/StyledTableContainer.js +42 -0
- package/ApiPage/types.d.ts +11 -0
- package/ApiPage/types.js +1 -0
- package/CHANGELOG.md +1651 -0
- package/CodeCopy/CodeCopy.d.ts +22 -0
- package/CodeCopy/CodeCopy.js +172 -0
- package/CodeCopy/CodeCopyButton.d.ts +4 -0
- package/CodeCopy/CodeCopyButton.js +40 -0
- package/CodeCopy/index.d.ts +3 -0
- package/CodeCopy/index.js +3 -0
- package/CodeCopy/useClipboardCopy.d.ts +4 -0
- package/CodeCopy/useClipboardCopy.js +21 -0
- package/ComponentLinkHeader/ComponentLinkHeader.d.ts +8 -0
- package/ComponentLinkHeader/ComponentLinkHeader.js +197 -0
- package/ComponentLinkHeader/index.d.ts +2 -0
- package/ComponentLinkHeader/index.js +2 -0
- package/DemoContext/DemoContext.d.ts +86 -0
- package/DemoContext/DemoContext.js +13 -0
- package/DemoContext/index.d.ts +2 -0
- package/DemoContext/index.js +1 -0
- package/DocsApp/AnalyticsProvider.d.ts +17 -0
- package/DocsApp/AnalyticsProvider.js +229 -0
- package/DocsApp/DocsApp.d.ts +79 -0
- package/DocsApp/DocsApp.js +105 -0
- package/DocsApp/GoogleAnalytics.d.ts +9 -0
- package/DocsApp/GoogleAnalytics.js +129 -0
- package/DocsApp/StyledEngineProvider.d.ts +8 -0
- package/DocsApp/StyledEngineProvider.js +38 -0
- package/DocsApp/consoleBanner.d.ts +1 -0
- package/DocsApp/consoleBanner.js +18 -0
- package/DocsApp/createEmotionCache.d.ts +1 -0
- package/DocsApp/createEmotionCache.js +12 -0
- package/DocsApp/createGetInitialProps.d.ts +30 -0
- package/DocsApp/createGetInitialProps.js +29 -0
- package/DocsApp/index.d.ts +5 -0
- package/DocsApp/index.js +4 -0
- package/DocsApp/loadDependencies.d.ts +1 -0
- package/DocsApp/loadDependencies.js +9 -0
- package/DocsApp/reportWebVitals.d.ts +13 -0
- package/DocsApp/reportWebVitals.js +22 -0
- package/DocsApp/serviceWorker.d.ts +1 -0
- package/DocsApp/serviceWorker.js +59 -0
- package/DocsProvider/DocsProvider.d.ts +24 -0
- package/DocsProvider/DocsProvider.js +31 -0
- package/DocsProvider/index.d.ts +1 -0
- package/DocsProvider/index.js +1 -0
- package/Document/Document.d.ts +16 -0
- package/Document/Document.js +147 -0
- package/Document/getInitialProps.d.ts +18 -0
- package/Document/getInitialProps.js +60 -0
- package/Document/index.d.ts +2 -0
- package/Document/index.js +2 -0
- package/HighlightedCode/HighlightedCode.d.ts +14 -0
- package/HighlightedCode/HighlightedCode.js +67 -0
- package/HighlightedCode/index.d.ts +1 -0
- package/HighlightedCode/index.js +1 -0
- package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.d.ts +28 -0
- package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.js +362 -0
- package/HighlightedCodeWithTabs/index.d.ts +2 -0
- package/HighlightedCodeWithTabs/index.js +2 -0
- package/IconImage/IconImage.d.ts +11 -0
- package/IconImage/IconImage.js +83 -0
- package/IconImage/index.d.ts +1 -0
- package/IconImage/index.js +1 -0
- package/InfoCard/InfoCard.d.ts +22 -0
- package/InfoCard/InfoCard.js +91 -0
- package/InfoCard/index.d.ts +1 -0
- package/InfoCard/index.js +1 -0
- package/LICENSE +21 -0
- package/Link/Link.d.ts +25 -0
- package/Link/Link.js +75 -0
- package/Link/MarkdownLinks.d.ts +2 -0
- package/Link/MarkdownLinks.js +84 -0
- package/Link/SkipLink.d.ts +1 -0
- package/Link/SkipLink.js +64 -0
- package/Link/index.d.ts +3 -0
- package/Link/index.js +3 -0
- package/MarkdownElement/MarkdownElement.d.ts +7 -0
- package/MarkdownElement/MarkdownElement.js +847 -0
- package/MarkdownElement/index.d.ts +1 -0
- package/MarkdownElement/index.js +1 -0
- package/MuiPage/MuiPage.d.ts +67 -0
- package/MuiPage/MuiPage.js +1 -0
- package/MuiPage/index.d.ts +1 -0
- package/MuiPage/index.js +1 -0
- package/NextNProgressBar/NProgressBar.d.ts +6 -0
- package/NextNProgressBar/NProgressBar.js +91 -0
- package/NextNProgressBar/NextNProgressBar.d.ts +1 -0
- package/NextNProgressBar/NextNProgressBar.js +42 -0
- package/NextNProgressBar/index.d.ts +1 -0
- package/NextNProgressBar/index.js +1 -0
- package/PageContext/PageContext.d.ts +32 -0
- package/PageContext/PageContext.js +6 -0
- package/PageContext/index.d.ts +2 -0
- package/PageContext/index.js +1 -0
- package/README.md +26 -0
- package/SectionHeadline/SectionHeadline.d.ts +13 -0
- package/SectionHeadline/SectionHeadline.js +81 -0
- package/SectionHeadline/index.d.ts +2 -0
- package/SectionHeadline/index.js +2 -0
- package/SectionTitle/SectionTitle.d.ts +6 -0
- package/SectionTitle/SectionTitle.js +29 -0
- package/SectionTitle/index.d.ts +1 -0
- package/SectionTitle/index.js +1 -0
- package/ThemeContext/ThemeContext.d.ts +92 -0
- package/ThemeContext/ThemeContext.js +200 -0
- package/ThemeContext/index.d.ts +1 -0
- package/ThemeContext/index.js +1 -0
- package/branding/BrandingCssVarsProvider.d.ts +27 -0
- package/branding/BrandingCssVarsProvider.js +170 -0
- package/branding/BrandingProvider.d.ts +9 -0
- package/branding/BrandingProvider.js +17 -0
- package/branding/brandingTheme.d.ts +147 -0
- package/branding/brandingTheme.js +1534 -0
- package/branding/index.d.ts +3 -0
- package/branding/index.js +3 -0
- package/codeStyling/codeStyling.d.ts +7 -0
- package/codeStyling/codeStyling.js +80 -0
- package/codeStyling/index.d.ts +1 -0
- package/codeStyling/index.js +1 -0
- package/codeVariant/codeVariant.d.ts +7 -0
- package/codeVariant/codeVariant.js +69 -0
- package/codeVariant/index.d.ts +1 -0
- package/codeVariant/index.js +1 -0
- package/constants/constants.d.ts +13 -0
- package/constants/constants.js +15 -0
- package/constants/index.d.ts +1 -0
- package/constants/index.js +1 -0
- package/findActivePage/findActivePage.d.ts +5 -0
- package/findActivePage/findActivePage.js +35 -0
- package/findActivePage/index.d.ts +1 -0
- package/findActivePage/index.js +1 -0
- package/getProductInfoFromUrl/getProductInfoFromUrl.d.ts +8 -0
- package/getProductInfoFromUrl/getProductInfoFromUrl.js +50 -0
- package/getProductInfoFromUrl/index.d.ts +2 -0
- package/getProductInfoFromUrl/index.js +1 -0
- package/globalSelector/globalSelector.d.ts +2 -0
- package/globalSelector/globalSelector.js +17 -0
- package/globalSelector/index.d.ts +1 -0
- package/globalSelector/index.js +1 -0
- package/helpers/helpers.d.ts +31 -0
- package/helpers/helpers.js +87 -0
- package/helpers/index.d.ts +2 -0
- package/helpers/index.js +1 -0
- package/i18n/i18n.d.ts +27 -0
- package/i18n/i18n.js +111 -0
- package/i18n/index.d.ts +1 -0
- package/i18n/index.js +1 -0
- package/mapApiPageTranslations/index.d.ts +1 -0
- package/mapApiPageTranslations/index.js +1 -0
- package/mapApiPageTranslations/mapApiPageTranslations.d.ts +11 -0
- package/mapApiPageTranslations/mapApiPageTranslations.js +46 -0
- package/nextFonts/fonts/GeneralSans-Bold.ttf +0 -0
- package/nextFonts/fonts/GeneralSans-Bold.woff2 +0 -0
- package/nextFonts/fonts/GeneralSans-Medium.ttf +0 -0
- package/nextFonts/fonts/GeneralSans-Medium.woff2 +0 -0
- package/nextFonts/fonts/GeneralSans-Regular.ttf +0 -0
- package/nextFonts/fonts/GeneralSans-Regular.woff2 +0 -0
- package/nextFonts/fonts/GeneralSans-Semibold-subset.woff2 +0 -0
- package/nextFonts/fonts/GeneralSans-Semibold.ttf +0 -0
- package/nextFonts/fonts/GeneralSans-Semibold.woff2 +0 -0
- package/nextFonts/fonts/IBMPlexSans-Bold.ttf +0 -0
- package/nextFonts/fonts/IBMPlexSans-Bold.woff +0 -0
- package/nextFonts/fonts/IBMPlexSans-Bold.woff2 +0 -0
- package/nextFonts/fonts/IBMPlexSans-Medium.ttf +0 -0
- package/nextFonts/fonts/IBMPlexSans-Medium.woff +0 -0
- package/nextFonts/fonts/IBMPlexSans-Medium.woff2 +0 -0
- package/nextFonts/fonts/IBMPlexSans-Regular-subset.woff2 +0 -0
- package/nextFonts/fonts/IBMPlexSans-Regular.ttf +0 -0
- package/nextFonts/fonts/IBMPlexSans-Regular.woff +0 -0
- package/nextFonts/fonts/IBMPlexSans-Regular.woff2 +0 -0
- package/nextFonts/fonts/IBMPlexSans-SemiBold.ttf +0 -0
- package/nextFonts/fonts/IBMPlexSans-SemiBold.woff +0 -0
- package/nextFonts/fonts/IBMPlexSans-SemiBold.woff2 +0 -0
- package/nextFonts/index.d.ts +6 -0
- package/nextFonts/index.js +59 -0
- package/package.json +426 -3
- package/svgIcons/BundleSizeIcon.d.ts +4 -0
- package/svgIcons/BundleSizeIcon.js +13 -0
- package/svgIcons/FigmaIcon.d.ts +4 -0
- package/svgIcons/FigmaIcon.js +22 -0
- package/svgIcons/FileDownload.d.ts +6 -0
- package/svgIcons/FileDownload.js +13 -0
- package/svgIcons/JavaScript.d.ts +6 -0
- package/svgIcons/JavaScript.js +13 -0
- package/svgIcons/MarkdownIcon.d.ts +2 -0
- package/svgIcons/MarkdownIcon.js +22 -0
- package/svgIcons/MaterialDesignIcon.d.ts +4 -0
- package/svgIcons/MaterialDesignIcon.js +18 -0
- package/svgIcons/SketchIcon.d.ts +4 -0
- package/svgIcons/SketchIcon.js +27 -0
- package/svgIcons/TypeScript.d.ts +6 -0
- package/svgIcons/TypeScript.js +13 -0
- package/svgIcons/W3CIcon.d.ts +4 -0
- package/svgIcons/W3CIcon.js +15 -0
- package/translations/index.d.ts +3 -0
- package/translations/index.js +4 -0
- package/translations/translations.json +222 -0
- package/useLazyCSS/index.d.ts +1 -0
- package/useLazyCSS/index.js +1 -0
- package/useLazyCSS/useLazyCSS.d.ts +11 -0
- package/useLazyCSS/useLazyCSS.js +70 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/loadScript.d.ts +1 -0
- package/utils/loadScript.js +7 -0
- package/webpack/index.d.ts +17 -0
- package/webpack/index.js +1 -0
package/Ad/ad.styles.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { alpha } from '@mui/material/styles';
|
|
2
|
+
export const adBodyImageStyles = theme => ({
|
|
3
|
+
root: {
|
|
4
|
+
display: 'block',
|
|
5
|
+
overflow: 'hidden',
|
|
6
|
+
border: '1px dashed',
|
|
7
|
+
borderColor: (theme.vars || theme).palette.divider,
|
|
8
|
+
borderRadius: (theme.vars || theme).shape.borderRadius,
|
|
9
|
+
padding: 8,
|
|
10
|
+
paddingLeft: 8 + 130,
|
|
11
|
+
[theme.breakpoints.up('sm')]: {
|
|
12
|
+
padding: 12,
|
|
13
|
+
paddingLeft: 12 + 130
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
imgWrapper: {
|
|
17
|
+
float: 'left',
|
|
18
|
+
marginLeft: -130,
|
|
19
|
+
width: 130,
|
|
20
|
+
height: 100
|
|
21
|
+
},
|
|
22
|
+
img: {
|
|
23
|
+
verticalAlign: 'middle'
|
|
24
|
+
},
|
|
25
|
+
a: {
|
|
26
|
+
color: (theme.vars || theme).palette.text.primary,
|
|
27
|
+
textDecoration: 'none'
|
|
28
|
+
},
|
|
29
|
+
description: {
|
|
30
|
+
...theme.typography.body2,
|
|
31
|
+
[theme.breakpoints.up('sm')]: {
|
|
32
|
+
...theme.typography.body1
|
|
33
|
+
},
|
|
34
|
+
display: 'block',
|
|
35
|
+
marginLeft: theme.spacing(1.5)
|
|
36
|
+
},
|
|
37
|
+
poweredby: {
|
|
38
|
+
...theme.typography.caption,
|
|
39
|
+
marginLeft: theme.spacing(1.5),
|
|
40
|
+
color: (theme.vars || theme).palette.text.secondary,
|
|
41
|
+
display: 'block',
|
|
42
|
+
marginTop: theme.spacing(0.5),
|
|
43
|
+
fontWeight: theme.typography.fontWeightRegular
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
export const adBodyInlineStyles = theme => {
|
|
47
|
+
const baseline = adBodyImageStyles(theme);
|
|
48
|
+
return {
|
|
49
|
+
...baseline,
|
|
50
|
+
root: {
|
|
51
|
+
display: 'block',
|
|
52
|
+
paddingTop: 8
|
|
53
|
+
},
|
|
54
|
+
imgWrapper: {
|
|
55
|
+
display: 'none'
|
|
56
|
+
},
|
|
57
|
+
description: {
|
|
58
|
+
...baseline.description,
|
|
59
|
+
marginLeft: 0,
|
|
60
|
+
'&::before': {
|
|
61
|
+
border: '1px solid #3e8e41',
|
|
62
|
+
color: '#3e8e41',
|
|
63
|
+
marginRight: 6,
|
|
64
|
+
padding: '1px 5px',
|
|
65
|
+
borderRadius: 3,
|
|
66
|
+
content: '"Ad"',
|
|
67
|
+
fontSize: theme.typography.pxToRem(14)
|
|
68
|
+
},
|
|
69
|
+
'&::after': {
|
|
70
|
+
// Link
|
|
71
|
+
marginLeft: 4,
|
|
72
|
+
content: '"Get started"',
|
|
73
|
+
// Style taken from the Link component & MarkdownElement.
|
|
74
|
+
color: (theme.vars || theme).palette.primary[600],
|
|
75
|
+
textDecoration: 'underline',
|
|
76
|
+
textDecorationColor: alpha(theme.palette.primary.main, 0.4),
|
|
77
|
+
...theme.applyStyles('dark', {
|
|
78
|
+
color: (theme.vars || theme).palette.primary[300]
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
poweredby: {
|
|
83
|
+
...baseline.poweredby,
|
|
84
|
+
marginTop: 2,
|
|
85
|
+
marginLeft: 0
|
|
86
|
+
},
|
|
87
|
+
link: {
|
|
88
|
+
display: 'none'
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
};
|
package/Ad/index.d.ts
ADDED
package/Ad/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface ApiWarningAlertProps {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function ApiWarningAlert({
|
|
7
|
+
children,
|
|
8
|
+
className
|
|
9
|
+
}: ApiWarningAlertProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var _WarningRoundedIcon;
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import Alert from '@mui/material/Alert';
|
|
4
|
+
import WarningRoundedIcon from '@mui/icons-material/WarningRounded';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
export function ApiWarningAlert({
|
|
7
|
+
children,
|
|
8
|
+
className
|
|
9
|
+
}) {
|
|
10
|
+
return /*#__PURE__*/_jsx(Alert, {
|
|
11
|
+
severity: "warning",
|
|
12
|
+
className: className,
|
|
13
|
+
icon: _WarningRoundedIcon || (_WarningRoundedIcon = /*#__PURE__*/_jsx(WarningRoundedIcon, {
|
|
14
|
+
fontSize: "small"
|
|
15
|
+
})),
|
|
16
|
+
sx: {
|
|
17
|
+
fontSize: '0.875rem',
|
|
18
|
+
mt: '12px'
|
|
19
|
+
},
|
|
20
|
+
children: children
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PropsTranslations, ComponentApiContent } from '@mui-internal/api-docs-builder';
|
|
2
|
+
import type { ClassDefinition, BaseCssTOCParams } from "./types.js";
|
|
3
|
+
import type { TableOfContentsParams } from "../types.js";
|
|
4
|
+
export declare const getClassesToc: ({
|
|
5
|
+
classes,
|
|
6
|
+
t,
|
|
7
|
+
hash,
|
|
8
|
+
componentName
|
|
9
|
+
}: BaseCssTOCParams & {
|
|
10
|
+
classes: ClassDefinition[];
|
|
11
|
+
componentName?: string;
|
|
12
|
+
}) => TableOfContentsParams[];
|
|
13
|
+
export interface GetClassApiDefinitionsParams {
|
|
14
|
+
componentClasses: ComponentApiContent['classes'];
|
|
15
|
+
classDescriptions: PropsTranslations['classDescriptions'];
|
|
16
|
+
componentName: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function getClassApiDefinitions(params: GetClassApiDefinitionsParams): ClassDefinition[];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { kebabCase } from 'es-toolkit/string';
|
|
2
|
+
export const getClassesToc = ({
|
|
3
|
+
classes,
|
|
4
|
+
t,
|
|
5
|
+
hash,
|
|
6
|
+
componentName
|
|
7
|
+
}) => !classes || classes.length === 0 ? [] : [{
|
|
8
|
+
text: t('api-docs.classes'),
|
|
9
|
+
hash: hash ?? 'classes',
|
|
10
|
+
children: [...classes.map(({
|
|
11
|
+
key,
|
|
12
|
+
hash: classHash
|
|
13
|
+
}) => ({
|
|
14
|
+
text: key,
|
|
15
|
+
hash: componentName ? `${kebabCase(componentName)}-classes-${key}` : classHash,
|
|
16
|
+
children: []
|
|
17
|
+
}))]
|
|
18
|
+
}];
|
|
19
|
+
const errorMessage = (componentName, className, slotName) => `${className} description from component ${componentName} should include ${slotName} since its definition includes "{{${slotName}}}"`;
|
|
20
|
+
export function getClassApiDefinitions(params) {
|
|
21
|
+
const {
|
|
22
|
+
componentClasses,
|
|
23
|
+
classDescriptions,
|
|
24
|
+
componentName
|
|
25
|
+
} = params;
|
|
26
|
+
return componentClasses.map(classDefinition => {
|
|
27
|
+
const {
|
|
28
|
+
conditions,
|
|
29
|
+
nodeName,
|
|
30
|
+
deprecationInfo,
|
|
31
|
+
description: translatedDescription
|
|
32
|
+
} = classDescriptions[classDefinition.key] ?? {}; // Not all classes have a description.
|
|
33
|
+
|
|
34
|
+
let description = translatedDescription ?? classDefinition.description;
|
|
35
|
+
if (description.includes('{{conditions}}')) {
|
|
36
|
+
if (!conditions) {
|
|
37
|
+
throw new Error(errorMessage(componentName, classDefinition.className, 'conditions'));
|
|
38
|
+
}
|
|
39
|
+
description = description.replace(/{{conditions}}/, conditions);
|
|
40
|
+
}
|
|
41
|
+
if (description.includes('{{nodeName}}')) {
|
|
42
|
+
if (!nodeName) {
|
|
43
|
+
throw new Error(errorMessage(componentName, classDefinition.className, 'nodeName'));
|
|
44
|
+
}
|
|
45
|
+
description = description.replace(/{{nodeName}}/, nodeName);
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
...classDefinition,
|
|
49
|
+
description,
|
|
50
|
+
deprecationInfo,
|
|
51
|
+
hash: `${kebabCase(componentName)}-classes-${classDefinition.className}`
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { PropsTableItem, PropsTranslations, HookApiContent, HooksTranslations } from '@mui-internal/api-docs-builder';
|
|
2
|
+
import type { BaseCssTOCParams, PropertyDefinition } from "./types.js";
|
|
3
|
+
import type { TableOfContentsParams } from "../types.js";
|
|
4
|
+
type GetPropertiesTocParams = BaseCssTOCParams & ({
|
|
5
|
+
properties: Array<Pick<PropertyDefinition, 'propName' | 'hash'>>;
|
|
6
|
+
componentProps?: never;
|
|
7
|
+
componentName?: never;
|
|
8
|
+
} | {
|
|
9
|
+
componentProps: Record<string, unknown>;
|
|
10
|
+
componentName: string;
|
|
11
|
+
properties?: never;
|
|
12
|
+
});
|
|
13
|
+
export declare const getPropertiesToc: ({
|
|
14
|
+
properties,
|
|
15
|
+
componentProps,
|
|
16
|
+
componentName,
|
|
17
|
+
inheritance,
|
|
18
|
+
themeDefaultProps,
|
|
19
|
+
t,
|
|
20
|
+
hash
|
|
21
|
+
}: GetPropertiesTocParams) => TableOfContentsParams;
|
|
22
|
+
interface GetPropsApiDefinitionsParams {
|
|
23
|
+
componentName: string;
|
|
24
|
+
properties: {
|
|
25
|
+
[name: string]: PropsTableItem & {
|
|
26
|
+
/**
|
|
27
|
+
* Only to be compatible the time of the migration for X
|
|
28
|
+
*/
|
|
29
|
+
isProPlan?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Only to be compatible the time of the migration for X
|
|
32
|
+
*/
|
|
33
|
+
isPremiumPlan?: boolean;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
propertiesDescriptions: PropsTranslations['propDescriptions'];
|
|
37
|
+
/**
|
|
38
|
+
* Add indicators that the properties is optional instead of showing it is required.
|
|
39
|
+
*/
|
|
40
|
+
showOptionalAbbr?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare function getPropsApiDefinitions(params: GetPropsApiDefinitionsParams): PropertyDefinition[];
|
|
43
|
+
interface HookCommonApiParams {
|
|
44
|
+
hookName: string;
|
|
45
|
+
showOptionalAbbr?: boolean;
|
|
46
|
+
}
|
|
47
|
+
interface GetHookReturnApiDefinitionsParams extends HookCommonApiParams {
|
|
48
|
+
kind: 'return';
|
|
49
|
+
properties: HookApiContent['returnValue'];
|
|
50
|
+
translations: HooksTranslations['returnValueDescriptions'];
|
|
51
|
+
}
|
|
52
|
+
interface GetHookParametersApiDefinitions extends HookCommonApiParams {
|
|
53
|
+
kind: 'parameters';
|
|
54
|
+
properties: HookApiContent['parameters'];
|
|
55
|
+
translations: HooksTranslations['parametersDescriptions'];
|
|
56
|
+
}
|
|
57
|
+
export declare function getHookApiDefinitions(params: GetHookReturnApiDefinitionsParams | GetHookParametersApiDefinitions): PropertyDefinition[];
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { kebabCase } from 'es-toolkit/string';
|
|
2
|
+
export const getPropertiesToc = ({
|
|
3
|
+
properties,
|
|
4
|
+
componentProps,
|
|
5
|
+
componentName,
|
|
6
|
+
inheritance,
|
|
7
|
+
themeDefaultProps,
|
|
8
|
+
t,
|
|
9
|
+
hash
|
|
10
|
+
}) => {
|
|
11
|
+
const resolvedProperties = properties ?? Object.keys(componentProps).map(propName => ({
|
|
12
|
+
propName,
|
|
13
|
+
hash: `${kebabCase(componentName)}-prop-${propName}`
|
|
14
|
+
}));
|
|
15
|
+
return {
|
|
16
|
+
text: t('api-docs.props'),
|
|
17
|
+
hash: hash ?? '',
|
|
18
|
+
children: [...resolvedProperties.map(({
|
|
19
|
+
propName,
|
|
20
|
+
hash: propertyHash
|
|
21
|
+
}) => ({
|
|
22
|
+
text: propName,
|
|
23
|
+
hash: propertyHash,
|
|
24
|
+
children: []
|
|
25
|
+
})), ...(inheritance ? [{
|
|
26
|
+
text: t('api-docs.inheritance'),
|
|
27
|
+
hash: 'inheritance',
|
|
28
|
+
children: []
|
|
29
|
+
}] : []), ...(themeDefaultProps ? [{
|
|
30
|
+
text: t('api-docs.themeDefaultProps'),
|
|
31
|
+
hash: 'theme-default-props',
|
|
32
|
+
children: []
|
|
33
|
+
}] : [])]
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export function getPropsApiDefinitions(params) {
|
|
37
|
+
const {
|
|
38
|
+
properties,
|
|
39
|
+
propertiesDescriptions,
|
|
40
|
+
componentName,
|
|
41
|
+
showOptionalAbbr = false
|
|
42
|
+
} = params;
|
|
43
|
+
return Object.entries(properties).map(([propName, propData]) => {
|
|
44
|
+
const isRequired = propData.required && !showOptionalAbbr;
|
|
45
|
+
const isOptional = !propData.required && showOptionalAbbr;
|
|
46
|
+
const isDeprecated = propData.deprecated;
|
|
47
|
+
const deprecationInfo = propData.deprecationInfo;
|
|
48
|
+
const typeName = propData.type?.description || propData.type.name;
|
|
49
|
+
const propDefault = propData.default;
|
|
50
|
+
const propDescription = propertiesDescriptions[propName];
|
|
51
|
+
const additionalInfo = ['cssApi', 'sx', 'slotsApi', 'joy-size', 'joy-color', 'joy-variant'].filter(key => propData.additionalInfo?.[key]);
|
|
52
|
+
const seeMoreDescription = propDescription?.seeMoreText && propData.seeMoreLink && propDescription.seeMoreText.replace('{{link}}', `<a href="${propData.seeMoreLink.url}">${propData.seeMoreLink.text}</a>`);
|
|
53
|
+
const signature = propData.signature?.type;
|
|
54
|
+
const signatureArgs = propData.signature?.describedArgs?.map(argName => ({
|
|
55
|
+
argName,
|
|
56
|
+
argDescription: propertiesDescriptions[propName].typeDescriptions?.[argName].description,
|
|
57
|
+
argType: propertiesDescriptions[propName].typeDescriptions?.[argName]?.argType,
|
|
58
|
+
argTypeDescription: propertiesDescriptions[propName].typeDescriptions?.[argName]?.argTypeDescription
|
|
59
|
+
}));
|
|
60
|
+
const signatureReturnDescription = propData.signature?.returned && propertiesDescriptions[propName].typeDescriptions?.[propData.signature.returned].argTypeDescription;
|
|
61
|
+
return {
|
|
62
|
+
hash: `${kebabCase(componentName)}-prop-${propName}`,
|
|
63
|
+
propName,
|
|
64
|
+
seeMoreDescription,
|
|
65
|
+
description: propDescription?.description,
|
|
66
|
+
requiresRef: propDescription?.requiresRef,
|
|
67
|
+
isOptional,
|
|
68
|
+
isRequired,
|
|
69
|
+
isDeprecated,
|
|
70
|
+
deprecationInfo,
|
|
71
|
+
typeName,
|
|
72
|
+
propDefault,
|
|
73
|
+
additionalInfo,
|
|
74
|
+
signature,
|
|
75
|
+
signatureArgs,
|
|
76
|
+
signatureReturnDescription,
|
|
77
|
+
isProPlan: propData.isProPlan,
|
|
78
|
+
isPremiumPlan: propData.isPremiumPlan
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
export function getHookApiDefinitions(params) {
|
|
83
|
+
const {
|
|
84
|
+
properties,
|
|
85
|
+
translations,
|
|
86
|
+
hookName,
|
|
87
|
+
kind,
|
|
88
|
+
showOptionalAbbr
|
|
89
|
+
} = params;
|
|
90
|
+
return Object.entries(properties).map(([propName, propData]) => {
|
|
91
|
+
const isRequired = propData.required && !showOptionalAbbr;
|
|
92
|
+
const isOptional = !propData.required && showOptionalAbbr;
|
|
93
|
+
const isDeprecated = propData.deprecated;
|
|
94
|
+
const deprecationInfo = propData.deprecationInfo;
|
|
95
|
+
const typeName = propData.type?.description || propData.type.name;
|
|
96
|
+
const propDefault = propData.default;
|
|
97
|
+
const propDescription = translations[propName];
|
|
98
|
+
return {
|
|
99
|
+
hash: `${kebabCase(hookName)}-${kind === 'parameters' ? 'parameters' : 'return-value'}-${propName}`,
|
|
100
|
+
propName,
|
|
101
|
+
description: propDescription?.description,
|
|
102
|
+
isRequired,
|
|
103
|
+
isOptional,
|
|
104
|
+
isDeprecated,
|
|
105
|
+
deprecationInfo,
|
|
106
|
+
typeName,
|
|
107
|
+
propDefault
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PropsTranslations, ComponentApiContent } from '@mui-internal/api-docs-builder';
|
|
2
|
+
import type { BaseCssTOCParams, SlotDefinition } from "./types.js";
|
|
3
|
+
import type { TableOfContentsParams } from "../types.js";
|
|
4
|
+
export interface GetSlotsApiDefinitionsParams {
|
|
5
|
+
componentSlots: ComponentApiContent['slots'];
|
|
6
|
+
slotDescriptions: PropsTranslations['slotDescriptions'];
|
|
7
|
+
componentName: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function getSlotsApiDefinitions(params: GetSlotsApiDefinitionsParams): SlotDefinition[];
|
|
10
|
+
export declare const getSlotsToc: ({
|
|
11
|
+
slots,
|
|
12
|
+
t,
|
|
13
|
+
hash
|
|
14
|
+
}: BaseCssTOCParams & {
|
|
15
|
+
slots: SlotDefinition[];
|
|
16
|
+
}) => TableOfContentsParams[];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export function getSlotsApiDefinitions(params) {
|
|
2
|
+
const {
|
|
3
|
+
componentSlots,
|
|
4
|
+
slotDescriptions,
|
|
5
|
+
componentName
|
|
6
|
+
} = params;
|
|
7
|
+
if (!componentSlots) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
return componentSlots.map(({
|
|
11
|
+
class: className,
|
|
12
|
+
name,
|
|
13
|
+
default: defaultValue
|
|
14
|
+
}) => {
|
|
15
|
+
return {
|
|
16
|
+
description: slotDescriptions?.[name],
|
|
17
|
+
className,
|
|
18
|
+
name,
|
|
19
|
+
defaultValue,
|
|
20
|
+
hash: `${componentName}-css-${className ?? name}`
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export const getSlotsToc = ({
|
|
25
|
+
slots,
|
|
26
|
+
t,
|
|
27
|
+
hash
|
|
28
|
+
}) => !slots || slots.length === 0 ? [] : [{
|
|
29
|
+
text: t('api-docs.slots'),
|
|
30
|
+
hash: hash ?? 'slots',
|
|
31
|
+
children: [...slots.map(({
|
|
32
|
+
name,
|
|
33
|
+
hash: slotHash
|
|
34
|
+
}) => ({
|
|
35
|
+
text: name,
|
|
36
|
+
hash: slotHash,
|
|
37
|
+
children: []
|
|
38
|
+
}))]
|
|
39
|
+
}];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Translate } from "../../i18n/index.js";
|
|
2
|
+
export type ClassDefinition = {
|
|
3
|
+
className: string;
|
|
4
|
+
key: string;
|
|
5
|
+
hash: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
isGlobal?: boolean;
|
|
8
|
+
isDeprecated?: boolean;
|
|
9
|
+
deprecationInfo?: string;
|
|
10
|
+
};
|
|
11
|
+
export type PropertyDefinition = {
|
|
12
|
+
additionalInfo?: string[];
|
|
13
|
+
hash: string;
|
|
14
|
+
deprecationInfo?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
isDeprecated?: boolean;
|
|
17
|
+
isOptional?: boolean;
|
|
18
|
+
isRequired?: boolean;
|
|
19
|
+
propDefault?: string;
|
|
20
|
+
propName: string;
|
|
21
|
+
requiresRef?: boolean;
|
|
22
|
+
seeMoreDescription?: string;
|
|
23
|
+
signature?: string;
|
|
24
|
+
signatureArgs?: {
|
|
25
|
+
argName: string;
|
|
26
|
+
argDescription?: string;
|
|
27
|
+
argType?: string;
|
|
28
|
+
argTypeDescription?: string;
|
|
29
|
+
}[];
|
|
30
|
+
signatureReturnDescription?: string;
|
|
31
|
+
typeName: string;
|
|
32
|
+
/**
|
|
33
|
+
* Used by MUI X interface documentation
|
|
34
|
+
*/
|
|
35
|
+
isProPlan?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Used by MUI X interface documentation
|
|
38
|
+
*/
|
|
39
|
+
isPremiumPlan?: boolean;
|
|
40
|
+
};
|
|
41
|
+
export type SlotDefinition = {
|
|
42
|
+
className: string | null;
|
|
43
|
+
hash: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
name: string;
|
|
46
|
+
defaultValue?: string;
|
|
47
|
+
};
|
|
48
|
+
export type BaseCssTOCParams = {
|
|
49
|
+
inheritance?: boolean;
|
|
50
|
+
themeDefaultProps?: boolean;
|
|
51
|
+
t: Translate;
|
|
52
|
+
hash?: string;
|
|
53
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/ApiPage/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ClassDefinition } from "../definitions/types.js";
|
|
2
|
+
type ClassesListProps = {
|
|
3
|
+
classes: ClassDefinition[];
|
|
4
|
+
displayOption: 'collapsed' | 'expanded';
|
|
5
|
+
/**
|
|
6
|
+
* If `true` the the associated key in the classes object is visible.
|
|
7
|
+
*/
|
|
8
|
+
displayClassKeys?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export default function ClassesList(props: ClassesListProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
var _span;
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import { useTranslate } from "../../i18n/index.js";
|
|
5
|
+
import { brandingDarkTheme as darkTheme, brandingLightTheme as lightTheme } from "../../branding/index.js";
|
|
6
|
+
import { ApiItemContainer, ExpandableApiItem } from "./ExpandableApiItem.js";
|
|
7
|
+
import { ApiWarningAlert } from "../ApiWarningAlert.js";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const StyledApiItem = styled(ExpandableApiItem)(({
|
|
10
|
+
theme
|
|
11
|
+
}) => ({
|
|
12
|
+
'& p': {
|
|
13
|
+
margin: 0
|
|
14
|
+
},
|
|
15
|
+
'& .prop-list-title': {
|
|
16
|
+
...theme.typography.body2,
|
|
17
|
+
fontWeight: theme.typography.fontWeightSemiBold,
|
|
18
|
+
color: theme.palette.text.primary,
|
|
19
|
+
paddingRight: 5,
|
|
20
|
+
whiteSpace: 'nowrap',
|
|
21
|
+
margin: 0
|
|
22
|
+
},
|
|
23
|
+
'& .prop-list-class': {
|
|
24
|
+
margin: 0
|
|
25
|
+
},
|
|
26
|
+
'&.classes-list-deprecated-item': {
|
|
27
|
+
'& .MuiApi-item-note': {
|
|
28
|
+
color: `var(--muidocs-palette-warning-700, ${lightTheme.palette.warning[700]})`
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}), ({
|
|
32
|
+
theme
|
|
33
|
+
}) => ({
|
|
34
|
+
[`:where(${theme.vars ? '[data-mui-color-scheme="dark"]' : '.mode-dark'}) &`]: {
|
|
35
|
+
'& .prop-list-title': {
|
|
36
|
+
color: `var(--muidocs-palette-grey-50, ${darkTheme.palette.grey[50]})`
|
|
37
|
+
},
|
|
38
|
+
'&.classes-list-deprecated-item': {
|
|
39
|
+
'& .MuiApi-item-note': {
|
|
40
|
+
color: `var(--muidocs-palette-warning-400, ${darkTheme.palette.warning[400]})`
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}));
|
|
45
|
+
export default function ClassesList(props) {
|
|
46
|
+
const {
|
|
47
|
+
classes,
|
|
48
|
+
displayOption,
|
|
49
|
+
displayClassKeys
|
|
50
|
+
} = props;
|
|
51
|
+
const t = useTranslate();
|
|
52
|
+
return /*#__PURE__*/_jsx(ApiItemContainer, {
|
|
53
|
+
children: classes.map(classDefinition => {
|
|
54
|
+
const {
|
|
55
|
+
hash,
|
|
56
|
+
className,
|
|
57
|
+
key,
|
|
58
|
+
description,
|
|
59
|
+
isGlobal,
|
|
60
|
+
isDeprecated,
|
|
61
|
+
deprecationInfo
|
|
62
|
+
} = classDefinition;
|
|
63
|
+
let note = isGlobal ? t('api-docs.state') : '';
|
|
64
|
+
if (isDeprecated) {
|
|
65
|
+
note = [note, t('api-docs.deprecated')].filter(Boolean).join(' - ');
|
|
66
|
+
}
|
|
67
|
+
return /*#__PURE__*/_jsxs(StyledApiItem, {
|
|
68
|
+
id: hash,
|
|
69
|
+
note: note,
|
|
70
|
+
title: `.${className}`,
|
|
71
|
+
type: "classes",
|
|
72
|
+
displayOption: displayOption,
|
|
73
|
+
isExtendable: !!description,
|
|
74
|
+
className: isDeprecated ? 'classes-list-deprecated-item' : '',
|
|
75
|
+
children: [description && /*#__PURE__*/_jsx("p", {
|
|
76
|
+
dangerouslySetInnerHTML: {
|
|
77
|
+
__html: description
|
|
78
|
+
}
|
|
79
|
+
}), displayClassKeys && !isGlobal && /*#__PURE__*/_jsxs("p", {
|
|
80
|
+
className: "prop-list-class",
|
|
81
|
+
children: [_span || (_span = /*#__PURE__*/_jsxs("span", {
|
|
82
|
+
className: "prop-list-title",
|
|
83
|
+
children: ['Rule name', ":"]
|
|
84
|
+
})), /*#__PURE__*/_jsx("code", {
|
|
85
|
+
className: "Api-code",
|
|
86
|
+
children: key
|
|
87
|
+
})]
|
|
88
|
+
}), isDeprecated && /*#__PURE__*/_jsxs(ApiWarningAlert, {
|
|
89
|
+
children: [/*#__PURE__*/_jsx("b", {
|
|
90
|
+
children: t('api-docs.deprecated')
|
|
91
|
+
}), deprecationInfo && /*#__PURE__*/_jsxs(React.Fragment, {
|
|
92
|
+
children: ['-', /*#__PURE__*/_jsx("span", {
|
|
93
|
+
/* eslint-disable-next-line react/no-danger */
|
|
94
|
+
dangerouslySetInnerHTML: {
|
|
95
|
+
__html: deprecationInfo
|
|
96
|
+
}
|
|
97
|
+
})]
|
|
98
|
+
})]
|
|
99
|
+
})]
|
|
100
|
+
}, key);
|
|
101
|
+
})
|
|
102
|
+
});
|
|
103
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SxProps } from '@mui/material/styles';
|
|
3
|
+
type DescriptionType = 'props' | 'classes' | 'CSS' | 'slots';
|
|
4
|
+
type ExpandableApiItemProps = {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
displayOption?: 'collapsed' | 'expanded';
|
|
9
|
+
id: string;
|
|
10
|
+
isExtendable?: boolean;
|
|
11
|
+
note?: string;
|
|
12
|
+
sx?: SxProps;
|
|
13
|
+
title: string | React.ReactNode;
|
|
14
|
+
type?: DescriptionType;
|
|
15
|
+
};
|
|
16
|
+
export declare function ExpandableApiItem(props: ExpandableApiItemProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const ApiItemContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
18
|
+
export {};
|