Skip to content

Commit

Permalink
[docs] Add default value annotations to JSDocs (#833)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaldudak authored Nov 19, 2024
1 parent c39d873 commit 9555490
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/data/api/alert-dialog-root.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"props": {
"animated": { "type": { "name": "bool" }, "default": "true" },
"defaultOpen": { "type": { "name": "bool" } },
"defaultOpen": { "type": { "name": "bool" }, "default": "false" },
"onOpenChange": { "type": { "name": "func" } },
"open": { "type": { "name": "bool" } }
},
Expand Down
2 changes: 1 addition & 1 deletion docs/data/api/dialog-root.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"props": {
"animated": { "type": { "name": "bool" }, "default": "true" },
"defaultOpen": { "type": { "name": "bool" } },
"defaultOpen": { "type": { "name": "bool" }, "default": "false" },
"dismissible": { "type": { "name": "bool" }, "default": "true" },
"modal": { "type": { "name": "bool" }, "default": "true" },
"onOpenChange": { "type": { "name": "func" } },
Expand Down
3 changes: 3 additions & 0 deletions docs/data/api/menu-checkbox-item.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"props": {
"checked": { "type": { "name": "bool" } },
"closeOnClick": { "type": { "name": "bool" }, "default": "true" },
"defaultChecked": { "type": { "name": "bool" }, "default": "false" },
"disabled": { "type": { "name": "bool" }, "default": "false" },
"id": { "type": { "name": "string" } },
"label": { "type": { "name": "string" } },
"onCheckedChange": { "type": { "name": "func" } },
"onClick": { "type": { "name": "func" } }
},
"name": "MenuCheckboxItem",
Expand Down
2 changes: 1 addition & 1 deletion docs/data/api/switch-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"props": {
"checked": { "type": { "name": "bool" } },
"className": { "type": { "name": "union", "description": "func<br>&#124;&nbsp;string" } },
"defaultChecked": { "type": { "name": "bool" } },
"defaultChecked": { "type": { "name": "bool" }, "default": "false" },
"disabled": { "type": { "name": "bool" }, "default": "false" },
"inputRef": { "type": { "name": "custom", "description": "ref" } },
"name": { "type": { "name": "string" } },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
{
"componentDescription": "An unstyled checkbox menu item to be used within a Menu.",
"propDescriptions": {
"checked": { "description": "If <code>true</code>, the checkbox is checked." },
"closeOnClick": {
"description": "If <code>true</code>, the menu will close when the menu item is clicked."
},
"defaultChecked": {
"description": "The default checked state. Use when the component is uncontrolled."
},
"disabled": { "description": "If <code>true</code>, the menu item will be disabled." },
"id": { "description": "The id of the menu item." },
"label": {
"description": "A text representation of the menu item&#39;s content. Used for keyboard text navigation matching."
},
"onCheckedChange": { "description": "Callback fired when the checked state is changed." },
"onClick": { "description": "The click handler for the menu item." }
},
"classDescriptions": {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"description": "Class names applied to the element or a function that returns them based on the component&#39;s state."
},
"defaultChecked": {
"description": "The default checked state. Use when the component is not controlled."
"description": "The default checked state. Use when the component is uncontrolled."
},
"disabled": {
"description": "If <code>true</code>, the component is disabled and can&#39;t be interacted with."
Expand Down
1 change: 1 addition & 0 deletions docs/reference/generated/alert-dialog-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"defaultOpen": {
"type": "boolean",
"default": "false",
"description": "Determines whether the dialog is initally open.\nThis is an uncontrolled equivalent of the `open` prop."
},
"onOpenChange": {
Expand Down
1 change: 1 addition & 0 deletions docs/reference/generated/dialog-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"defaultOpen": {
"type": "boolean",
"default": "false",
"description": "Determines whether the dialog is initally open.\nThis is an uncontrolled equivalent of the `open` prop."
},
"dismissible": {
Expand Down
13 changes: 13 additions & 0 deletions docs/reference/generated/menu-checkbox-item.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@
"name": "MenuCheckboxItem",
"description": "An unstyled checkbox menu item to be used within a Menu.",
"props": {
"checked": {
"type": "boolean",
"description": "If `true`, the checkbox is checked."
},
"closeOnClick": {
"type": "boolean",
"default": "true",
"description": "If `true`, the menu will close when the menu item is clicked."
},
"defaultChecked": {
"type": "boolean",
"default": "false",
"description": "The default checked state. Use when the component is uncontrolled."
},
"disabled": {
"type": "boolean",
"default": "false",
Expand All @@ -20,6 +29,10 @@
"type": "string",
"description": "A text representation of the menu item's content.\nUsed for keyboard text navigation matching."
},
"onCheckedChange": {
"type": "function",
"description": "Callback fired when the checked state is changed."
},
"onClick": {
"type": "(event) => void",
"description": "The click handler for the menu item."
Expand Down
3 changes: 2 additions & 1 deletion docs/reference/generated/switch-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
"defaultChecked": {
"type": "boolean",
"description": "The default checked state. Use when the component is not controlled."
"default": "false",
"description": "The default checked state. Use when the component is uncontrolled."
},
"disabled": {
"type": "boolean",
Expand Down
2 changes: 2 additions & 0 deletions packages/mui-base/src/AlertDialog/Root/AlertDialogRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ AlertDialogRoot.propTypes /* remove-proptypes */ = {
/**
* Determines whether the dialog is initally open.
* This is an uncontrolled equivalent of the `open` prop.
*
* @default false
*/
defaultOpen: PropTypes.bool,
/**
Expand Down
4 changes: 3 additions & 1 deletion packages/mui-base/src/Dialog/Root/DialogRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const DialogRoot = function DialogRoot(props: DialogRoot.Props) {
const {
animated = true,
children,
defaultOpen,
defaultOpen = false,
dismissible = true,
modal = true,
onOpenChange,
Expand Down Expand Up @@ -73,6 +73,8 @@ DialogRoot.propTypes /* remove-proptypes */ = {
/**
* Determines whether the dialog is initally open.
* This is an uncontrolled equivalent of the `open` prop.
*
* @default false
*/
defaultOpen: PropTypes.bool,
/**
Expand Down
2 changes: 2 additions & 0 deletions packages/mui-base/src/Dialog/Root/useDialogRoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ export interface CommonParameters {
/**
* Determines whether the dialog is initally open.
* This is an uncontrolled equivalent of the `open` prop.
*
* @default false
*/
defaultOpen?: boolean;
/**
Expand Down
27 changes: 21 additions & 6 deletions packages/mui-base/src/Menu/CheckboxItem/MenuCheckboxItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ InnerMenuCheckboxItem.propTypes /* remove-proptypes */ = {
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
// └─────────────────────────────────────────────────────────────────────┘
/**
* @ignore
* If `true`, the checkbox is checked.
*/
checked: PropTypes.bool,
/**
Expand All @@ -91,7 +91,9 @@ InnerMenuCheckboxItem.propTypes /* remove-proptypes */ = {
*/
closeOnClick: PropTypes.bool,
/**
* @ignore
* The default checked state. Use when the component is uncontrolled.
*
* @default false
*/
defaultChecked: PropTypes.bool,
/**
Expand Down Expand Up @@ -121,7 +123,7 @@ InnerMenuCheckboxItem.propTypes /* remove-proptypes */ = {
on: PropTypes.func.isRequired,
}).isRequired,
/**
* @ignore
* Callback fired when the checked state is changed.
*/
onCheckedChange: PropTypes.func,
/**
Expand Down Expand Up @@ -211,8 +213,19 @@ namespace MenuCheckboxItem {
};

export interface Props extends BaseUIComponentProps<'div', OwnerState> {
/**
* If `true`, the checkbox is checked.
*/
checked?: boolean;
/**
* The default checked state. Use when the component is uncontrolled.
*
* @default false
*/
defaultChecked?: boolean;
/**
* Callback fired when the checked state is changed.
*/
onCheckedChange?: (checked: boolean, event: Event) => void;
children?: React.ReactNode;
/**
Expand Down Expand Up @@ -248,7 +261,7 @@ MenuCheckboxItem.propTypes /* remove-proptypes */ = {
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
// └─────────────────────────────────────────────────────────────────────┘
/**
* @ignore
* If `true`, the checkbox is checked.
*/
checked: PropTypes.bool,
/**
Expand All @@ -262,7 +275,9 @@ MenuCheckboxItem.propTypes /* remove-proptypes */ = {
*/
closeOnClick: PropTypes.bool,
/**
* @ignore
* The default checked state. Use when the component is uncontrolled.
*
* @default false
*/
defaultChecked: PropTypes.bool,
/**
Expand All @@ -280,7 +295,7 @@ MenuCheckboxItem.propTypes /* remove-proptypes */ = {
*/
label: PropTypes.string,
/**
* @ignore
* Callback fired when the checked state is changed.
*/
onCheckedChange: PropTypes.func,
/**
Expand Down
4 changes: 3 additions & 1 deletion packages/mui-base/src/Switch/Root/SwitchRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ SwitchRoot.propTypes /* remove-proptypes */ = {
*/
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
/**
* The default checked state. Use when the component is not controlled.
* The default checked state. Use when the component is uncontrolled.
*
* @default false
*/
defaultChecked: PropTypes.bool,
/**
Expand Down
4 changes: 3 additions & 1 deletion packages/mui-base/src/Switch/Root/useSwitchRoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ export namespace useSwitchRoot {
*/
checked?: boolean;
/**
* The default checked state. Use when the component is not controlled.
* The default checked state. Use when the component is uncontrolled.
*
* @default false
*/
defaultChecked?: boolean;
/**
Expand Down

0 comments on commit 9555490

Please sign in to comment.