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][base-ui] Update number input API docs #38363

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
30 changes: 30 additions & 0 deletions docs/pages/base-ui/api/number-input.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,36 @@
},
"name": "NumberInput",
"styles": { "classes": [], "globalClasses": {}, "name": null },
"slots": [
{
"name": "root",
"description": "The component that renders the root.",
"default": "'div'",
"class": ".MuiNumberInput-root"
},
{
"name": "input",
"description": "The component that renders the input.",
"default": "'input'",
"class": ".MuiNumberInput-input"
},
{
"name": "incrementButton",
"description": "The component that renders the increment button.",
"default": "'button'",
"class": ".MuiNumberInput-incrementButton"
},
{
"name": "decrementButton",
"description": "The component that renders the decrement button.",
"default": "'button'",
"class": ".MuiNumberInput-decrementButton"
}
],
"classes": {
"classes": ["disabled", "error", "focused", "formControl", "readOnly"],
"globalClasses": { "focused": "Mui-focused", "disabled": "Mui-disabled", "error": "Mui-error" }
},
"spread": true,
"muiName": "MuiNumberInput",
"forwardsRefTo": "HTMLDivElement",
Expand Down
47 changes: 46 additions & 1 deletion docs/translations/api-docs-base/number-input/number-input.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,50 @@
"step": { "description": "The amount that the value changes on each increment or decrement." },
"value": { "description": "The current value. Use when the component is controlled." }
},
"classDescriptions": {}
"classDescriptions": {
"root": { "description": "Class name applied to the root element." },
"formControl": {
"description": "Class name applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "the component is a descendant of <code>FormControl</code>"
},
"focused": {
"description": "Class name applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "the component is focused"
},
"disabled": {
"description": "Class name applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>disabled={true}</code>"
},
"readOnly": {
"description": "State class applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>readOnly={true}</code>"
},
"error": {
"description": "State class applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>error={true}</code>"
},
"input": {
"description": "Class name applied to {{nodeName}}.",
"nodeName": "the input element"
},
"incrementButton": {
"description": "Class name applied to {{nodeName}}.",
"nodeName": "the increment button element"
},
"decrementButton": {
"description": "Class name applied to {{nodeName}}.",
"nodeName": "the decrement button element"
}
},
"slotDescriptions": {
"root": "The component that renders the root.",
"input": "The component that renders the input.",
"incrementButton": "The component that renders the increment button.",
"decrementButton": "The component that renders the decrement button."
}
}
30 changes: 24 additions & 6 deletions packages/mui-base/src/Unstable_NumberInput/NumberInput.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,32 @@ export type NumberInputOwnProps = Omit<UseNumberInputParameters, 'error'> & {
* Either a string to use a HTML element or a component.
* @default {}
*/
slots?: {
root?: React.ElementType;
input?: React.ElementType;
incrementButton?: React.ElementType;
decrementButton?: React.ElementType;
};
slots?: NumberInputSlots;
};

export interface NumberInputSlots {
/**
* The component that renders the root.
* @default 'div'
*/
root?: React.ElementType;
/**
* The component that renders the input.
* @default 'input'
*/
input?: React.ElementType;
/**
* The component that renders the increment button.
* @default 'button'
*/
incrementButton?: React.ElementType;
/**
* The component that renders the decrement button.
* @default 'button'
*/
decrementButton?: React.ElementType;
}

export interface NumberInputTypeMap<
AdditionalProps = {},
RootComponentType extends React.ElementType = 'div',
Expand Down