Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs-infra] Add support for data attributes in the API generation #44709

Merged
merged 8 commits into from
Dec 10, 2024

Conversation

mnajdova
Copy link
Member

@mnajdova mnajdova commented Dec 10, 2024

Adds support for API generation for data-* attributes. It works identical to the CSS variables generation. I'll remove the test data after the approval.

@mnajdova mnajdova added the scope: docs-infra Specific to the docs-infra product label Dec 10, 2024
@mui-bot
Copy link

mui-bot commented Dec 10, 2024

Netlify deploy preview

https://deploy-preview-44709--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against fd11e17

const attachCssVariables = (reactApi: ComponentReactApi, params: ParsedProperty[]) => {
const cssVarsErrors: Array<[propName: string, error: Error]> = [];
const cssVariables: ComponentReactApi['cssVariables'] = params
const attachTable = (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repurposed the function to be used with any attribute

@@ -7,7 +7,7 @@ export interface Slot {
default?: string;
}

export interface CssVariable {
export interface ApiItemDescription {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the name more generic to be reused with different types of API descriptions.

@mnajdova mnajdova marked this pull request as ready for review December 10, 2024 12:40
@@ -0,0 +1,13 @@
enum AccordionDataAttributes {
/**
* Indicates whether the panel is opened
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Indicates whether the panel is opened
* Indicates whether the panel is opened.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note, I was thinking of making a quick PR to fail the CI anytime any of those descriptions doesn't end with a dot. I suspect it's a quick win.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am reverting these changes, they are just here to help the reviewer :)

mnajdova and others added 2 commits December 10, 2024 15:41
Co-authored-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
Signed-off-by: Marija Najdova <mnajdova@gmail.com>
@mj12albert mj12albert mentioned this pull request Dec 10, 2024
1 task
@mnajdova mnajdova merged commit 332c01f into mui:master Dec 10, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: docs-infra Specific to the docs-infra product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants