@mui/docs 9.0.0-alpha.3 → 9.0.0-beta.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.
- 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 +158 -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 +224 -3
- package/DemoContext/DemoContext.d.ts +1 -1
- package/{AnalyticsProvider → DocsApp}/AnalyticsProvider.js +10 -6
- package/DocsApp/DocsApp.d.ts +79 -0
- package/DocsApp/DocsApp.js +105 -0
- package/{GoogleAnalytics → DocsApp}/GoogleAnalytics.js +4 -4
- package/DocsApp/StyledEngineProvider.d.ts +8 -0
- package/{StyledEngineProvider → DocsApp}/StyledEngineProvider.js +2 -8
- package/DocsApp/consoleBanner.d.ts +1 -0
- package/DocsApp/consoleBanner.js +18 -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/Document/Document.js +2 -2
- package/Document/getInitialProps.js +3 -5
- package/InfoCard/InfoCard.js +9 -5
- package/Link/SkipLink.js +1 -3
- package/NextNProgressBar/NextNProgressBar.js +0 -2
- package/PageContext/PageContext.d.ts +6 -5
- package/branding/BrandingCssVarsProvider.d.ts +9 -5
- package/branding/BrandingCssVarsProvider.js +1 -1
- package/branding/brandingTheme.js +82 -75
- package/codeStyling/codeStyling.d.ts +7 -10
- package/codeStyling/codeStyling.js +0 -4
- package/codeVariant/codeVariant.d.ts +7 -10
- package/codeVariant/codeVariant.js +0 -4
- package/constants/constants.d.ts +10 -10
- package/constants/index.d.ts +1 -1
- package/constants/index.js +1 -1
- package/package.json +35 -44
- package/utils/index.js +0 -1
- package/webpack/index.d.ts +17 -0
- package/webpack/index.js +1 -0
- package/AnalyticsProvider/index.d.ts +0 -1
- package/AnalyticsProvider/index.js +0 -1
- package/GoogleAnalytics/index.d.ts +0 -1
- package/GoogleAnalytics/index.js +0 -1
- package/StyledEngineProvider/StyledEngineProvider.d.ts +0 -9
- package/StyledEngineProvider/index.d.ts +0 -1
- package/StyledEngineProvider/index.js +0 -1
- package/createEmotionCache/index.d.ts +0 -1
- package/createEmotionCache/index.js +0 -1
- /package/{AnalyticsProvider → DocsApp}/AnalyticsProvider.d.ts +0 -0
- /package/{GoogleAnalytics → DocsApp}/GoogleAnalytics.d.ts +0 -0
- /package/{createEmotionCache → DocsApp}/createEmotionCache.d.ts +0 -0
- /package/{createEmotionCache → DocsApp}/createEmotionCache.js +0 -0
|
@@ -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 {};
|