Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/data/api/collapsible-trigger.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"imports": [
"import { Collapsible } from '@base-ui-components/react/collapsible';\nconst CollapsibleTrigger = Collapsible.Trigger;"
],
"dataAttributes": {
"data-panel-open": { "description": "Indicates whether the collapsible panel is opened." }
},
"classes": [],
"spread": true,
"themeDefaultProps": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
},
"render": { "description": "A function to customize rendering of the component." }
},
"classDescriptions": {}
"classDescriptions": {},
"dataAttributesDescriptions": {
"data-panel-open": "Indicates whether the collapsible panel is opened."
}
}
5 changes: 5 additions & 0 deletions docs/reference/generated/collapsible-trigger.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@
"type": "React.ReactElement | (props, state) => React.ReactElement",
"description": "A function to customize rendering of the component."
}
},
"dataAttributes": {
"data-panel-open": {
"description": "Indicates whether the collapsible panel is opened."
}
}
}
10 changes: 5 additions & 5 deletions docs/reference/generated/dialog-backdrop.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
"description": "A function to customize rendering of the component."
}
},
"attributes": {
"[data-open]": {
"dataAttributes": {
"data-open": {
"description": "Present when the dialog is open."
},
"[data-closed]": {
"data-closed": {
"description": "Present when the dialog is closed."
},
"[data-starting-style]": {
"data-starting-style": {
"description": "Present when the dialog is animating in."
},
"[data-ending-style]": {
"data-ending-style": {
"description": "Present when the dialog is animating out."
}
}
Expand Down
14 changes: 7 additions & 7 deletions docs/reference/generated/dialog-popup.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@
"description": "A function to customize rendering of the component."
}
},
"attributes": {
"[data-open]": {
"dataAttributes": {
"data-open": {
"description": "Present when the dialog is open."
},
"[data-closed]": {
"data-closed": {
"description": "Present when the dialog is closed."
},
"[data-starting-style]": {
"data-starting-style": {
"description": "Present when the dialog is animating in."
},
"[data-ending-style]": {
"data-ending-style": {
"description": "Present when the dialog is animating out."
},
"[data-modal]": {
"data-modal": {
"description": "Present when the dialog is modal."
},
"[data-nested-dialogs]": {
"data-nested-dialogs": {
"type": "number",
"description": "Indicates how many dialogs are nested within."
}
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/generated/dialog-trigger.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"description": "A function to customize rendering of the component."
}
},
"attributes": {
"[data-modal]": {
"dataAttributes": {
"data-modal": {
"description": "Present when the corresponding dialog is modal."
},
"[data-popup-open]": {
"data-popup-open": {
"description": "Present when the corresponding dialog is open."
}
}
Expand Down
10 changes: 5 additions & 5 deletions docs/reference/overrides/dialog-backdrop.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "DialogBackdrop",
"attributes": {
"[data-open]": {
"dataAttributes": {
"data-open": {
"description": "Present when the dialog is open."
},
"[data-closed]": {
"data-closed": {
"description": "Present when the dialog is closed."
},
"[data-starting-style]": {
"data-starting-style": {
"description": "Present when the dialog is animating in."
},
"[data-ending-style]": {
"data-ending-style": {
"description": "Present when the dialog is animating out."
}
}
Expand Down
14 changes: 7 additions & 7 deletions docs/reference/overrides/dialog-popup.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"name": "DialogPopup",
"attributes": {
"[data-open]": {
"dataAttributes": {
"data-open": {
"description": "Present when the dialog is open."
},
"[data-closed]": {
"data-closed": {
"description": "Present when the dialog is closed."
},
"[data-starting-style]": {
"data-starting-style": {
"description": "Present when the dialog is animating in."
},
"[data-ending-style]": {
"data-ending-style": {
"description": "Present when the dialog is animating out."
},
"[data-modal]": {
"data-modal": {
"description": "Present when the dialog is modal."
},
"[data-nested-dialogs]": {
"data-nested-dialogs": {
"type": "number",
"description": "Indicates how many dialogs are nested within."
}
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/overrides/dialog-trigger.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "DialogTrigger",
"attributes": {
"[data-modal]": {
"dataAttributes": {
"data-modal": {
"description": "Present when the corresponding dialog is modal."
},
"[data-popup-open]": {
"data-popup-open": {
"description": "Present when the corresponding dialog is open."
}
}
Expand Down
4 changes: 3 additions & 1 deletion docs/src/components/reference/AttributesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ export async function AttributesTable({ data, ...props }: AttributesTableProps)
useMDXComponents: () => inlineMdxComponents,
});

const attributeName = name.startsWith('[') ? name : `[${name}]`;

return (
<Table.Row key={name}>
<Table.RowHeader>
<Code className="text-navy">{name}</Code>
<Code className="text-navy">{attributeName}</Code>
</Table.RowHeader>
<Table.Cell>
<AttributeType />
Expand Down
4 changes: 2 additions & 2 deletions docs/src/components/reference/rehypeReference.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ export function rehypeReference() {
}),
);

if (def.attributes) {
if (def.dataAttributes) {
subtree.push(
createMdxElement({
name: ATTRIBUTES_TABLE,
props: { data: def.attributes },
props: { data: def.dataAttributes },
}),
);
}
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/reference/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export interface ComponentDef {
name: string;
description?: string;
props: Record<string, PropDef>;
attributes?: Record<string, AttributeDef>;
dataAttributes?: Record<string, AttributeDef>;
cssVariables?: Record<string, CssVariableDef>;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"@mui/internal-markdown": "^1.0.22",
"@mui/internal-scripts": "^1.0.29",
"@mui/internal-test-utils": "https://pkg.csb.dev/mui/material-ui/commit/92c23999/@mui/internal-test-utils",
"@mui/monorepo": "github:mui/material-ui#v6.1.10",
"@mui/monorepo": "github:mui/material-ui#0eafaa04fa68500cc820076fcf9f7299f28ece5d",
"@next/eslint-plugin-next": "^14.2.18",
"@octokit/rest": "^20.1.1",
"@playwright/test": "1.49.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export enum CollapsibleTriggerDataAttributes {
/**
* Indicates whether the collapsible panel is opened.
*/
panelOpen = 'data-panel-open',
}
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions scripts/buildApiDocs/buildReference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,20 @@ export async function buildReference() {
console.warn(`Missing component description: ${componentData.name}`);
}

const attributes = componentOverrides?.attributes;
const dataAttributes =
!!componentData?.dataAttributes || !!componentOverrides?.dataAttributes
? { ...componentData?.dataAttributes, ...componentOverrides?.dataAttributes }
: undefined;
const cssVariables =
!!componentData?.cssVariables || componentOverrides?.cssVariables
!!componentData?.cssVariables || !!componentOverrides?.cssVariables
? { ...componentData?.cssVariables, ...componentOverrides?.cssVariables }
: undefined;

const json: ComponentDef = {
name: componentData.name,
description: descriptionData.componentDescription,
props,
attributes,
dataAttributes,
cssVariables,
};

Expand Down
Loading