-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] Add hooks API pages for MUI Base (#35828)
- Loading branch information
Showing
89 changed files
with
2,407 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as React from 'react'; | ||
import HookApiPage from 'docs/src/modules/components/HookApiPage'; | ||
import mapApiPageTranslations from 'docs/src/modules/utils/mapApiPageTranslations'; | ||
import jsonPageContent from './use-autocomplete.json'; | ||
|
||
export default function Page(props) { | ||
const { descriptions, pageContent } = props; | ||
return <HookApiPage descriptions={descriptions} pageContent={pageContent} />; | ||
} | ||
|
||
Page.getInitialProps = () => { | ||
const req = require.context( | ||
'docs/translations/api-docs/use-autocomplete', | ||
false, | ||
/use-autocomplete.*.json$/, | ||
); | ||
const descriptions = mapApiPageTranslations(req); | ||
|
||
return { | ||
descriptions, | ||
pageContent: jsonPageContent, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,237 @@ | ||
{ | ||
"parameters": { | ||
"options": { | ||
"type": { "name": "ReadonlyArray<T>", "description": "Array of options." }, | ||
"required": true | ||
}, | ||
"autoComplete": { | ||
"type": { | ||
"name": "boolean", | ||
"description": "If `true`, the portion of the selected suggestion that has not been typed by the user,\nknown as the completion string, appears inline after the input cursor in the textbox.\nThe inline completion string is visually highlighted and has a selected state." | ||
}, | ||
"default": "false" | ||
}, | ||
"autoHighlight": { | ||
"type": { | ||
"name": "boolean", | ||
"description": "If `true`, the first option is automatically highlighted." | ||
}, | ||
"default": "false" | ||
}, | ||
"autoSelect": { | ||
"type": { | ||
"name": "boolean", | ||
"description": "If `true`, the selected option becomes the value of the input\nwhen the Autocomplete loses focus unless the user chooses\na different option or changes the character string in the input." | ||
}, | ||
"default": "false" | ||
}, | ||
"blurOnSelect": { | ||
"type": { | ||
"name": "'touch' | 'mouse' | true | false", | ||
"description": "Control if the input should be blurred when an option is selected:\n\n- `false` the input is not blurred.\n- `true` the input is always blurred.\n- `touch` the input is blurred after a touch event.\n- `mouse` the input is blurred after a mouse event." | ||
}, | ||
"default": "false" | ||
}, | ||
"clearOnBlur": { | ||
"type": { | ||
"name": "boolean", | ||
"description": "If `true`, the input's text is cleared on blur if no value is selected.\n\nSet to `true` if you want to help the user enter a new value.\nSet to `false` if you want to help the user resume their search." | ||
}, | ||
"default": "!props.freeSolo" | ||
}, | ||
"clearOnEscape": { | ||
"type": { | ||
"name": "boolean", | ||
"description": "If `true`, clear all values when the user presses escape and the popup is closed." | ||
}, | ||
"default": "false" | ||
}, | ||
"componentName": { | ||
"type": { | ||
"name": "string", | ||
"description": "The component name that is using this hook. Used for warnings." | ||
} | ||
}, | ||
"defaultValue": { | ||
"type": { | ||
"name": "AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>", | ||
"description": "The default value. Use when the component is not controlled." | ||
}, | ||
"default": "props.multiple ? [] : null" | ||
}, | ||
"disableClearable": { | ||
"type": { | ||
"name": "DisableClearable", | ||
"description": "If `true`, the input can't be cleared." | ||
}, | ||
"default": "false" | ||
}, | ||
"disableCloseOnSelect": { | ||
"type": { | ||
"name": "boolean", | ||
"description": "If `true`, the popup won't close when a value is selected." | ||
}, | ||
"default": "false" | ||
}, | ||
"disabled": { | ||
"type": { "name": "boolean", "description": "If `true`, the component is disabled." }, | ||
"default": "false" | ||
}, | ||
"disabledItemsFocusable": { | ||
"type": { | ||
"name": "boolean", | ||
"description": "If `true`, will allow focus on disabled items." | ||
}, | ||
"default": "false" | ||
}, | ||
"disableListWrap": { | ||
"type": { | ||
"name": "boolean", | ||
"description": "If `true`, the list box in the popup will not wrap focus." | ||
}, | ||
"default": "false" | ||
}, | ||
"filterOptions": { | ||
"type": { | ||
"name": "(options: T[], state: FilterOptionsState<T>) => T[]", | ||
"description": "A function that determines the filtered options to be rendered on search." | ||
} | ||
}, | ||
"filterSelectedOptions": { | ||
"type": { | ||
"name": "boolean", | ||
"description": "If `true`, hide the selected options from the list box." | ||
}, | ||
"default": "false" | ||
}, | ||
"freeSolo": { | ||
"type": { | ||
"name": "FreeSolo", | ||
"description": "If `true`, the Autocomplete is free solo, meaning that the user input is not bound to provided options." | ||
}, | ||
"default": "false" | ||
}, | ||
"getOptionDisabled": { | ||
"type": { | ||
"name": "(option: T) => boolean", | ||
"description": "Used to determine the disabled state for a given option." | ||
} | ||
}, | ||
"getOptionLabel": { | ||
"type": { | ||
"name": "(option: T | AutocompleteFreeSoloValueMapping<FreeSolo>) => string", | ||
"description": "Used to determine the string value for a given option.\nIt's used to fill the input (and the list box options if `renderOption` is not provided).\n\nIf used in free solo mode, it must accept both the type of the options and a string." | ||
}, | ||
"default": "(option) => option.label ?? option" | ||
}, | ||
"groupBy": { | ||
"type": { | ||
"name": "(option: T) => string", | ||
"description": "If provided, the options will be grouped under the returned string.\nThe groupBy value is also used as the text for group headings when `renderGroup` is not provided." | ||
} | ||
}, | ||
"handleHomeEndKeys": { | ||
"type": { | ||
"name": "boolean", | ||
"description": "If `true`, the component handles the \"Home\" and \"End\" keys when the popup is open.\nIt should move focus to the first option and last option, respectively." | ||
}, | ||
"default": "!props.freeSolo" | ||
}, | ||
"id": { | ||
"type": { | ||
"name": "string", | ||
"description": "This prop is used to help implement the accessibility logic.\nIf you don't provide an id it will fall back to a randomly generated one." | ||
} | ||
}, | ||
"includeInputInList": { | ||
"type": { | ||
"name": "boolean", | ||
"description": "If `true`, the highlight can move to the input." | ||
}, | ||
"default": "false" | ||
}, | ||
"inputValue": { "type": { "name": "string", "description": "The input value." } }, | ||
"isOptionEqualToValue": { | ||
"type": { | ||
"name": "(option: T, value: T) => boolean", | ||
"description": "Used to determine if the option represents the given value.\nUses strict equality by default.\n⚠️ Both arguments need to be handled, an option can only match with one value." | ||
} | ||
}, | ||
"multiple": { | ||
"type": { | ||
"name": "Multiple", | ||
"description": "If `true`, `value` must be an array and the menu will support multiple selections." | ||
}, | ||
"default": "false" | ||
}, | ||
"onChange": { | ||
"type": { | ||
"name": "(event: React.SyntheticEvent, value: AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>, reason: AutocompleteChangeReason, details?: AutocompleteChangeDetails<T>) => void", | ||
"description": "Callback fired when the value changes." | ||
} | ||
}, | ||
"onClose": { | ||
"type": { | ||
"name": "(event: React.SyntheticEvent, reason: AutocompleteCloseReason) => void", | ||
"description": "Callback fired when the popup requests to be closed.\nUse in controlled mode (see open)." | ||
} | ||
}, | ||
"onHighlightChange": { | ||
"type": { | ||
"name": "(event: React.SyntheticEvent, option: T | null, reason: AutocompleteHighlightChangeReason) => void", | ||
"description": "Callback fired when the highlight option changes." | ||
} | ||
}, | ||
"onInputChange": { | ||
"type": { | ||
"name": "(event: React.SyntheticEvent, value: string, reason: AutocompleteInputChangeReason) => void", | ||
"description": "Callback fired when the input value changes." | ||
} | ||
}, | ||
"onOpen": { | ||
"type": { | ||
"name": "(event: React.SyntheticEvent) => void", | ||
"description": "Callback fired when the popup requests to be opened.\nUse in controlled mode (see open)." | ||
} | ||
}, | ||
"open": { "type": { "name": "boolean", "description": "If `true`, the component is shown." } }, | ||
"openOnFocus": { | ||
"type": { | ||
"name": "boolean", | ||
"description": "If `true`, the popup will open on input focus." | ||
}, | ||
"default": "false" | ||
}, | ||
"readOnly": { | ||
"type": { | ||
"name": "boolean", | ||
"description": "If `true`, the component becomes readonly. It is also supported for multiple tags where the tag cannot be deleted." | ||
}, | ||
"default": "false" | ||
}, | ||
"selectOnFocus": { | ||
"type": { | ||
"name": "boolean", | ||
"description": "If `true`, the input's text is selected on focus.\nIt helps the user clear the selected value." | ||
}, | ||
"default": "!props.freeSolo" | ||
}, | ||
"unstable_classNamePrefix": { | ||
"type": { "name": "string", "description": "" }, | ||
"default": "'Mui'" | ||
}, | ||
"unstable_isActiveElementInListbox": { | ||
"type": { "name": "(listbox: React.RefObject<HTMLElement>) => boolean", "description": "" } | ||
}, | ||
"value": { | ||
"type": { | ||
"name": "AutocompleteValue<T, Multiple, DisableClearable, FreeSolo>", | ||
"description": "The value of the autocomplete.\n\nThe value must have reference equality with the option in order to be selected.\nYou can customize the equality behavior with the `isOptionEqualToValue` prop." | ||
} | ||
} | ||
}, | ||
"returnValue": {}, | ||
"name": "useAutocomplete", | ||
"filename": "/packages/mui-base/src/AutocompleteUnstyled/useAutocomplete.js", | ||
"demos": "<ul></ul>" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as React from 'react'; | ||
import HookApiPage from 'docs/src/modules/components/HookApiPage'; | ||
import mapApiPageTranslations from 'docs/src/modules/utils/mapApiPageTranslations'; | ||
import jsonPageContent from './use-badge.json'; | ||
|
||
export default function Page(props) { | ||
const { descriptions, pageContent } = props; | ||
return <HookApiPage descriptions={descriptions} pageContent={pageContent} />; | ||
} | ||
|
||
Page.getInitialProps = () => { | ||
const req = require.context('docs/translations/api-docs/use-badge', false, /use-badge.*.json$/); | ||
const descriptions = mapApiPageTranslations(req); | ||
|
||
return { | ||
descriptions, | ||
pageContent: jsonPageContent, | ||
}; | ||
}; |
Oops, something went wrong.