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] New API reference generator #1537

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 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
7 changes: 3 additions & 4 deletions docs/reference/generated/accordion-header.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"description": "A heading that labels the corresponding panel.\nRenders an `<h3>` element.",
"props": {
"className": {
"type": "string | (state) => string",
"type": "string | ((state: { index, open, transitionStatus, value, disabled, orientation }) => string)",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"type": "React.ReactElement | ((props: unknown, state: { index, open, transitionStatus, value, disabled, orientation }) => React.ReactElement)",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
}
},
Expand All @@ -19,8 +19,7 @@
"description": "Present when the accordion item is disabled."
},
"data-index": {
"description": "Indicates the index of the accordion item.",
"type": "number"
"description": "Indicates the index of the accordion item."
}
},
"cssVariables": {}
Expand Down
16 changes: 10 additions & 6 deletions docs/reference/generated/accordion-item.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,26 @@
"name": "AccordionItem",
"description": "Groups an accordion header with the corresponding panel.\nRenders a `<div>` element.",
"props": {
"value": {
"type": "any"
},
"onOpenChange": {
"type": "(open) => void",
"type": "((open: boolean) => void) | undefined",
"required": true,
"description": "Event handler called when the panel is opened or closed."
},
"disabled": {
"type": "boolean",
"type": "boolean | undefined",
"default": "false",
"required": true,
"description": "Whether the component should ignore user interaction."
},
"className": {
"type": "string | (state) => string",
"type": "string | ((state: { index, open, transitionStatus, value, disabled, orientation }) => string)",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"type": "React.ReactElement | ((props: unknown, state: { index, open, transitionStatus, value, disabled, orientation }) => React.ReactElement)",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
}
},
Expand All @@ -28,8 +33,7 @@
"description": "Present when the accordion item is disabled."
},
"data-index": {
"description": "Indicates the index of the accordion item.",
"type": "number"
"description": "Indicates the index of the accordion item."
}
},
"cssVariables": {}
Expand Down
13 changes: 5 additions & 8 deletions docs/reference/generated/accordion-panel.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"description": "Allows the browser’s built-in page search to find and expand the panel contents.\n\nOverrides the `keepMounted` prop and uses `hidden=\"until-found\"`\nto hide the element without removing it from the DOM."
},
"className": {
"type": "string | (state) => string",
"type": "string | ((state: { index, open, transitionStatus, value, disabled, orientation }) => string)",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"keepMounted": {
Expand All @@ -17,7 +17,7 @@
"description": "Whether to keep the element in the DOM while the panel is closed.\nThis prop is ignored when `hiddenUntilFound` is used."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"type": "React.ReactElement | ((props: unknown, state: { index, open, transitionStatus, value, disabled, orientation }) => React.ReactElement)",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
}
},
Expand All @@ -29,8 +29,7 @@
"description": "Present when the accordion item is disabled."
},
"data-index": {
"description": "Indicates the index of the accordion item.",
"type": "number"
"description": "Indicates the index of the accordion item."
},
"data-starting-style": {
"description": "Present when the panel is animating in."
Expand All @@ -41,12 +40,10 @@
},
"cssVariables": {
"--accordion-panel-height": {
"description": "The accordion panel's height.",
"type": "number"
"description": "The accordion panel's height."
Copy link
Member

Choose a reason for hiding this comment

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

Can we keep the previous logic for the @type info?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, the extractor doesn't handle the @type tag yet, but will soon.

},
"--accordion-panel-width": {
"description": "The accordion panel's width.",
"type": "number"
"description": "The accordion panel's width."
}
}
}
23 changes: 14 additions & 9 deletions docs/reference/generated/accordion-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
"description": "Groups all parts of the accordion.\nRenders a `<div>` element.",
"props": {
"defaultValue": {
"type": "array",
"type": "Array",
"description": "The uncontrolled value of the item(s) that should be initially expanded.\n\nTo render a controlled accordion, use the `value` prop instead."
},
"value": {
"type": "array",
"type": "Array",
"description": "The controlled value of the item(s) that should be expanded.\n\nTo render an uncontrolled accordion, use the `defaultValue` prop instead."
},
"onValueChange": {
"type": "(value) => void",
"type": "((value: Array) => void) | undefined",
"required": true,
"description": "Event handler called when an accordion item is expanded or collapsed.\nProvides the new value as an argument."
},
"hiddenUntilFound": {
Expand All @@ -20,27 +21,31 @@
"description": "Allows the browser’s built-in page search to find and expand the panel contents.\n\nOverrides the `keepMounted` prop and uses `hidden=\"until-found\"`\nto hide the element without removing it from the DOM."
},
"openMultiple": {
"type": "boolean",
"type": "boolean | undefined",
"default": "true",
"required": true,
"description": "Whether multiple items can be open at the same time."
},
"disabled": {
"type": "boolean",
"type": "boolean | undefined",
"default": "false",
"required": true,
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit strange. It says it's required, but we allow undefined as value. Is there a way to change the props that have default values not to be flagged as required?

"description": "Whether the component should ignore user interaction."
},
"loop": {
"type": "boolean",
"type": "boolean | undefined",
"default": "true",
"required": true,
"description": "Whether to loop keyboard focus back to the first item\nwhen the end of the list is reached while using the arrow keys."
},
"orientation": {
"type": "'horizontal' | 'vertical'",
"type": "\"horizontal\" | \"vertical\" | undefined",
"default": "'vertical'",
"required": true,
"description": "The visual orientation of the accordion.\nControls whether roving focus uses left/right or up/down arrow keys."
},
"className": {
"type": "string | (state) => string",
"type": "string | ((state: { value, disabled, orientation }) => string)",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"keepMounted": {
Expand All @@ -49,7 +54,7 @@
"description": "Whether to keep the element in the DOM while the panel is closed.\nThis prop is ignored when `hiddenUntilFound` is used."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"type": "React.ReactElement | ((props: unknown, state: { value, disabled, orientation }) => React.ReactElement)",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
}
},
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/generated/accordion-trigger.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"description": "A button that opens and closes the corresponding panel.\nRenders a `<button>` element.",
"props": {
"className": {
"type": "string | (state) => string",
"type": "string | ((state: { index, open, transitionStatus, value, disabled, orientation }) => string)",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"type": "React.ReactElement | ((props: unknown, state: { index, open, transitionStatus, value, disabled, orientation }) => React.ReactElement)",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
}
},
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/generated/alert-dialog-backdrop.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"description": "An overlay displayed beneath the popup.\nRenders a `<div>` element.",
"props": {
"className": {
"type": "string | (state) => string",
"type": "string | ((state: { open, transitionStatus }) => string)",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"type": "React.ReactElement | ((props: unknown, state: { open, transitionStatus }) => React.ReactElement)",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
}
},
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/generated/alert-dialog-close.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"description": "A button that closes the alert dialog.\nRenders a `<button>` element.",
"props": {
"className": {
"type": "string | (state) => string",
"type": "string | ((state: { disabled }) => string)",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"type": "React.ReactElement | ((props: unknown, state: { disabled }) => React.ReactElement)",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
}
},
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/generated/alert-dialog-description.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"description": "A paragraph with additional information about the alert dialog.\nRenders a `<p>` element.",
"props": {
"className": {
"type": "string | (state) => string",
"type": "string | ((state: unknown) => string)",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"type": "React.ReactElement | ((props: unknown, state: unknown) => React.ReactElement)",
Copy link
Member

Choose a reason for hiding this comment

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

We probably need to specify the state & props for each component.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, this doesn't look right. These aren't really the props of a component but attributes to be spread on the rendered HTML element. I'll try to display in a better way

"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
}
},
Expand Down
8 changes: 4 additions & 4 deletions docs/reference/generated/alert-dialog-popup.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
"description": "A container for the alert dialog contents.\nRenders a `<div>` element.",
"props": {
"initialFocus": {
"type": "React.Ref | (interactionType => HTMLElement | null)",
"type": "React.RefObject | ((interactionType: \"\" | \"mouse\" | \"pen\" | \"touch\" | \"keyboard\") => React.RefObject)",
"description": "Determines the element to focus when the dialog is opened.\nBy default, the first focusable element is focused."
},
"finalFocus": {
"type": "React.Ref",
"type": "React.RefObject",
"description": "Determines the element to focus when the dialog is closed.\nBy default, focus returns to the trigger."
},
"className": {
"type": "string | (state) => string",
"type": "string | ((state: { open, transitionStatus, nested, hasNestedDialogs }) => string)",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"type": "React.ReactElement | ((props: unknown, state: { open, transitionStatus, nested, hasNestedDialogs }) => React.ReactElement)",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
}
},
Expand Down
6 changes: 5 additions & 1 deletion docs/reference/generated/alert-dialog-portal.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
"description": "A portal element that moves the popup to a different part of the DOM.\nBy default, the portal element is appended to `<body>`.",
"props": {
"container": {
"type": "React.Ref | HTMLElement | null",
"type": "null | HTMLElement | React.RefObject",
"description": "A parent element to render the portal element into."
},
"children": {
"type": "ReactNode",
"required": true
},
"keepMounted": {
"type": "boolean",
"default": "false",
Expand Down
10 changes: 7 additions & 3 deletions docs/reference/generated/alert-dialog-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,20 @@
"description": "Whether the dialog is currently open."
},
"onOpenChange": {
"type": "(open, event, reason) => void",
"type": "function",
"description": "Event handler called when the dialog is opened or closed."
},
"actionsRef": {
"type": "{ current: { unmount: func } }",
"type": "React.RefObject",
"description": "A ref to imperative actions."
},
"onOpenChangeComplete": {
"type": "(open) => void",
"type": "function",
"description": "Event handler called after any animations complete when the dialog is opened or closed."
},
"children": {
"type": "ReactNode",
"required": true
}
},
"dataAttributes": {},
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/generated/alert-dialog-title.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"description": "A heading that labels the dialog.\nRenders an `<h2>` element.",
"props": {
"className": {
"type": "string | (state) => string",
"type": "string | ((state: unknown) => string)",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"type": "React.ReactElement | ((props: unknown, state: unknown) => React.ReactElement)",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
}
},
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/generated/alert-dialog-trigger.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"description": "A button that opens the alert dialog.\nRenders a `<button>` element.",
"props": {
"className": {
"type": "string | (state) => string",
"type": "string | ((state: { disabled, open }) => string)",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"type": "React.ReactElement | ((props: unknown, state: { disabled, open }) => React.ReactElement)",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
}
},
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/generated/avatar-fallback.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"description": "How long to wait before showing the fallback. Specified in milliseconds."
},
"className": {
"type": "string | (state) => string",
"type": "string | ((state: { imageLoadingStatus }) => string)",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"type": "React.ReactElement | ((props: unknown, state: { imageLoadingStatus }) => React.ReactElement)",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
}
},
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/generated/avatar-image.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"description": "The image to be displayed in the avatar.\nRenders an `<img>` element.",
"props": {
"onLoadingStatusChange": {
"type": "(status) => void",
"type": "((status: \"idle\" | \"loading\" | \"loaded\" | \"error\") => void)",
"description": "Callback fired when the loading status changes."
},
"className": {
"type": "string | (state) => string",
"type": "string | ((state: { imageLoadingStatus }) => string)",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"type": "React.ReactElement | ((props: unknown, state: { imageLoadingStatus }) => React.ReactElement)",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
}
},
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/generated/avatar-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"description": "Displays a user's profile picture, initials, or fallback icon.\nRenders a `<span>` element.",
"props": {
"className": {
"type": "string | (state) => string",
"type": "string | ((state: { imageLoadingStatus }) => string)",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"render": {
"type": "React.ReactElement | (props, state) => React.ReactElement",
"type": "React.ReactElement | ((props: unknown, state: { imageLoadingStatus }) => React.ReactElement)",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
}
},
Expand Down
Loading