Skip to content

Commit

Permalink
[joy-ui][docs] Document missing Autocomplete props (#39979)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeeshanTamboli authored Dec 13, 2023
1 parent ba4b1ce commit 12f773a
Show file tree
Hide file tree
Showing 7 changed files with 198 additions and 43 deletions.
27 changes: 27 additions & 0 deletions docs/pages/joy-ui/api/autocomplete.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@
"aria-describedby": { "type": { "name": "string" } },
"aria-label": { "type": { "name": "string" } },
"aria-labelledby": { "type": { "name": "string" } },
"autoComplete": { "type": { "name": "bool" }, "default": "false" },
"autoFocus": { "type": { "name": "bool" } },
"autoHighlight": { "type": { "name": "bool" }, "default": "false" },
"autoSelect": { "type": { "name": "bool" }, "default": "false" },
"blurOnSelect": {
"type": {
"name": "union",
"description": "'mouse'<br>&#124;&nbsp;'touch'<br>&#124;&nbsp;bool"
},
"default": "false"
},
"clearIcon": { "type": { "name": "node" }, "default": "<ClearIcon fontSize=\"md\" />" },
"clearOnBlur": { "type": { "name": "bool" }, "default": "!props.freeSolo" },
"clearOnEscape": { "type": { "name": "bool" }, "default": "false" },
"clearText": { "type": { "name": "string" }, "default": "'Clear'" },
"closeText": { "type": { "name": "string" }, "default": "'Close'" },
"color": {
Expand All @@ -21,7 +33,10 @@
"default": "props.multiple ? [] : null"
},
"disableClearable": { "type": { "name": "bool" }, "default": "false" },
"disableCloseOnSelect": { "type": { "name": "bool" }, "default": "false" },
"disabled": { "type": { "name": "bool" }, "default": "false" },
"disabledItemsFocusable": { "type": { "name": "bool" }, "default": "false" },
"disableListWrap": { "type": { "name": "bool" }, "default": "false" },
"endDecorator": { "type": { "name": "node" } },
"error": { "type": { "name": "bool" }, "default": "false" },
"filterOptions": {
Expand All @@ -32,6 +47,7 @@
"describedArgs": ["options", "state"]
}
},
"filterSelectedOptions": { "type": { "name": "bool" }, "default": "false" },
"forcePopupIcon": {
"type": { "name": "union", "description": "'auto'<br>&#124;&nbsp;bool" },
"default": "'auto'"
Expand All @@ -49,6 +65,13 @@
"type": { "name": "func" },
"signature": { "type": "function(option: Value) => boolean", "describedArgs": ["option"] }
},
"getOptionKey": {
"type": { "name": "func" },
"signature": {
"type": "function(option: Value) => string | number",
"describedArgs": ["option"]
}
},
"getOptionLabel": {
"type": { "name": "func" },
"default": "(option) => option.label ?? option",
Expand All @@ -58,7 +81,9 @@
"type": { "name": "func" },
"signature": { "type": "function(options: Value) => string", "describedArgs": ["options"] }
},
"handleHomeEndKeys": { "type": { "name": "bool" }, "default": "!props.freeSolo" },
"id": { "type": { "name": "string" } },
"includeInputInList": { "type": { "name": "bool" }, "default": "false" },
"inputValue": { "type": { "name": "string" } },
"isOptionEqualToValue": {
"type": { "name": "func" },
Expand Down Expand Up @@ -109,6 +134,7 @@
}
},
"open": { "type": { "name": "bool" } },
"openOnFocus": { "type": { "name": "bool" }, "default": "false" },
"openText": { "type": { "name": "string" }, "default": "'Open'" },
"placeholder": { "type": { "name": "string" } },
"popupIcon": { "type": { "name": "node" }, "default": "<ArrowDropDownIcon />" },
Expand All @@ -135,6 +161,7 @@
}
},
"required": { "type": { "name": "bool" } },
"selectOnFocus": { "type": { "name": "bool" }, "default": "!props.freeSolo" },
"size": {
"type": {
"name": "union",
Expand Down
44 changes: 44 additions & 0 deletions docs/translations/api-docs-joy/autocomplete/autocomplete.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,28 @@
"aria-labelledby": {
"description": "Identifies the element (or elements) that labels the current element."
},
"autoComplete": {
"description": "If <code>true</code>, the portion of the selected suggestion that the user hasn&#39;t typed, known as the completion string, appears inline after the input cursor in the textbox. The inline completion string is visually highlighted and has a selected state."
},
"autoFocus": {
"description": "If <code>true</code>, the <code>input</code> element is focused during the first mount."
},
"autoHighlight": {
"description": "If <code>true</code>, the first option is automatically highlighted."
},
"autoSelect": {
"description": "If <code>true</code>, the selected option becomes the value of the input when the Autocomplete loses focus unless the user chooses a different option or changes the character string in the input.<br>When using the <code>freeSolo</code> mode, the typed value will be the input value if the Autocomplete loses focus without highlighting an option."
},
"blurOnSelect": {
"description": "<p>Control if the input should be blurred when an option is selected:</p>\n<ul>\n<li><code>false</code> the input is not blurred.</li>\n<li><code>true</code> the input is always blurred.</li>\n<li><code>touch</code> the input is blurred after a touch event.</li>\n<li><code>mouse</code> the input is blurred after a mouse event.</li>\n</ul>\n"
},
"clearIcon": { "description": "The icon to display in place of the default clear icon." },
"clearOnBlur": {
"description": "If <code>true</code>, the input&#39;s text is cleared on blur if no value is selected.<br>Set it to <code>true</code> if you want to help the user enter a new value. Set it to <code>false</code> if you want to help the user resume their search."
},
"clearOnEscape": {
"description": "If <code>true</code>, clear all values when the user presses escape and the popup is closed."
},
"clearText": {
"description": "Override the default text for the <em>clear</em> icon button.<br>For localization purposes, you can use the provided <a href=\"/material-ui/guides/localization/\">translations</a>."
},
Expand All @@ -25,7 +43,16 @@
"description": "The default value. Use when the component is not controlled."
},
"disableClearable": { "description": "If <code>true</code>, the input can&#39;t be cleared." },
"disableCloseOnSelect": {
"description": "If <code>true</code>, the popup won&#39;t close when a value is selected."
},
"disabled": { "description": "If <code>true</code>, the component is disabled." },
"disabledItemsFocusable": {
"description": "If <code>true</code>, will allow focus on disabled items."
},
"disableListWrap": {
"description": "If <code>true</code>, the list box in the popup will not wrap focus."
},
"endDecorator": { "description": "Trailing adornment for this input." },
"error": {
"description": "If <code>true</code>, the <code>input</code> will indicate an error. The prop defaults to the value (<code>false</code>) inherited from the parent FormControl component."
Expand All @@ -37,6 +64,9 @@
"state": "The state of the component."
}
},
"filterSelectedOptions": {
"description": "If <code>true</code>, hide the selected options from the list box."
},
"forcePopupIcon": { "description": "Force the visibility display of the popup icon." },
"freeSolo": {
"description": "If <code>true</code>, the Autocomplete is free solo, meaning that the user input is not bound to provided options."
Expand All @@ -49,16 +79,26 @@
"description": "Used to determine the disabled state for a given option.",
"typeDescriptions": { "option": "The option to test." }
},
"getOptionKey": {
"description": "Used to determine the key for a given option. This can be useful when the labels of options are not unique (since labels are used as keys by default).",
"typeDescriptions": { "option": "The option to get the key for." }
},
"getOptionLabel": {
"description": "Used to determine the string value for a given option. It&#39;s used to fill the input (and the list box options if <code>renderOption</code> is not provided).<br>If used in free solo mode, it must accept both the type of the options and a string."
},
"groupBy": {
"description": "If provided, the options will be grouped under the returned string. The groupBy value is also used as the text for group headings when <code>renderGroup</code> is not provided.",
"typeDescriptions": { "options": "The options to group." }
},
"handleHomeEndKeys": {
"description": "If <code>true</code>, the component handles the &quot;Home&quot; and &quot;End&quot; keys when the popup is open. It should move focus to the first option and last option, respectively."
},
"id": {
"description": "This prop is used to help implement the accessibility logic. If you don&#39;t provide an id it will fall back to a randomly generated one."
},
"includeInputInList": {
"description": "If <code>true</code>, the highlight can move to the input."
},
"inputValue": { "description": "The input value." },
"isOptionEqualToValue": {
"description": "Used to determine if the option represents the given value. Uses strict equality by default. ⚠️ Both arguments need to be handled, an option can only match with one value.",
Expand Down Expand Up @@ -116,6 +156,7 @@
"typeDescriptions": { "event": "The event source of the callback." }
},
"open": { "description": "If <code>true</code>, the component is shown." },
"openOnFocus": { "description": "If <code>true</code>, the popup will open on input focus." },
"openText": {
"description": "Override the default text for the <em>open popup</em> icon button.<br>For localization purposes, you can use the provided <a href=\"/material-ui/guides/localization/\">translations</a>."
},
Expand Down Expand Up @@ -148,6 +189,9 @@
"required": {
"description": "If <code>true</code>, the <code>input</code> element is required. The prop defaults to the value (<code>false</code>) inherited from the parent FormControl component."
},
"selectOnFocus": {
"description": "If <code>true</code>, the input&#39;s text is selected on focus. It helps the user clear the selected value."
},
"size": { "description": "The size of the component." },
"slotProps": { "description": "The props used for each slot inside." },
"slots": { "description": "The components used for each slot inside." },
Expand Down
6 changes: 3 additions & 3 deletions docs/translations/api-docs/autocomplete/autocomplete.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"componentDescription": "",
"propDescriptions": {
"autoComplete": {
"description": "If <code>true</code>, the portion of the selected suggestion that has not been typed by the user, known as the completion string, appears inline after the input cursor in the textbox. The inline completion string is visually highlighted and has a selected state."
"description": "If <code>true</code>, the portion of the selected suggestion that the user hasn&#39;t typed, known as the completion string, appears inline after the input cursor in the textbox. The inline completion string is visually highlighted and has a selected state."
},
"autoHighlight": {
"description": "If <code>true</code>, the first option is automatically highlighted."
},
"autoSelect": {
"description": "If <code>true</code>, the selected option becomes the value of the input when the Autocomplete loses focus unless the user chooses a different option or changes the character string in the input.<br>When using <code>freeSolo</code> mode, the typed value will be the input value if the Autocomplete loses focus without highlighting an option."
"description": "If <code>true</code>, the selected option becomes the value of the input when the Autocomplete loses focus unless the user chooses a different option or changes the character string in the input.<br>When using the <code>freeSolo</code> mode, the typed value will be the input value if the Autocomplete loses focus without highlighting an option."
},
"blurOnSelect": {
"description": "<p>Control if the input should be blurred when an option is selected:</p>\n<ul>\n<li><code>false</code> the input is not blurred.</li>\n<li><code>true</code> the input is always blurred.</li>\n<li><code>touch</code> the input is blurred after a touch event.</li>\n<li><code>mouse</code> the input is blurred after a mouse event.</li>\n</ul>\n"
Expand All @@ -19,7 +19,7 @@
"classes": { "description": "Override or extend the styles applied to the component." },
"clearIcon": { "description": "The icon to display in place of the default clear icon." },
"clearOnBlur": {
"description": "If <code>true</code>, the input&#39;s text is cleared on blur if no value is selected.<br>Set to <code>true</code> if you want to help the user enter a new value. Set to <code>false</code> if you want to help the user resume their search."
"description": "If <code>true</code>, the input&#39;s text is cleared on blur if no value is selected.<br>Set it to <code>true</code> if you want to help the user enter a new value. Set it to <code>false</code> if you want to help the user resume their search."
},
"clearOnEscape": {
"description": "If <code>true</code>, clear all values when the user presses escape and the popup is closed."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
"hookDescription": "",
"parametersDescriptions": {
"autoComplete": {
"description": "If <code>true</code>, the portion of the selected suggestion that has not been typed by the user, known as the completion string, appears inline after the input cursor in the textbox. The inline completion string is visually highlighted and has a selected state."
"description": "If <code>true</code>, the portion of the selected suggestion that the user hasn&#39;t typed, known as the completion string, appears inline after the input cursor in the textbox. The inline completion string is visually highlighted and has a selected state."
},
"autoHighlight": {
"description": "If <code>true</code>, the first option is automatically highlighted."
},
"autoSelect": {
"description": "If <code>true</code>, the selected option becomes the value of the input when the Autocomplete loses focus unless the user chooses a different option or changes the character string in the input.<br>When using <code>freeSolo</code> mode, the typed value will be the input value if the Autocomplete loses focus without highlighting an option."
"description": "If <code>true</code>, the selected option becomes the value of the input when the Autocomplete loses focus unless the user chooses a different option or changes the character string in the input.<br>When using the <code>freeSolo</code> mode, the typed value will be the input value if the Autocomplete loses focus without highlighting an option."
},
"blurOnSelect": {
"description": "<p>Control if the input should be blurred when an option is selected:</p>\n<ul>\n<li><code>false</code> the input is not blurred.</li>\n<li><code>true</code> the input is always blurred.</li>\n<li><code>touch</code> the input is blurred after a touch event.</li>\n<li><code>mouse</code> the input is blurred after a mouse event.</li>\n</ul>\n"
},
"clearOnBlur": {
"description": "If <code>true</code>, the input&#39;s text is cleared on blur if no value is selected.<br>Set to <code>true</code> if you want to help the user enter a new value. Set to <code>false</code> if you want to help the user resume their search."
"description": "If <code>true</code>, the input&#39;s text is cleared on blur if no value is selected.<br>Set it to <code>true</code> if you want to help the user enter a new value. Set it to <code>false</code> if you want to help the user resume their search."
},
"clearOnEscape": {
"description": "If <code>true</code>, clear all values when the user presses escape and the popup is closed."
Expand Down
8 changes: 4 additions & 4 deletions packages/mui-base/src/useAutocomplete/useAutocomplete.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export interface UseAutocompleteProps<
*/
unstable_isActiveElementInListbox?: (listbox: React.RefObject<HTMLElement>) => boolean;
/**
* If `true`, the portion of the selected suggestion that has not been typed by the user,
* If `true`, the portion of the selected suggestion that the user hasn't typed,
* known as the completion string, appears inline after the input cursor in the textbox.
* The inline completion string is visually highlighted and has a selected state.
* @default false
Expand All @@ -67,7 +67,7 @@ export interface UseAutocompleteProps<
* when the Autocomplete loses focus unless the user chooses
* a different option or changes the character string in the input.
*
* When using `freeSolo` mode, the typed value will be the input value
* When using the `freeSolo` mode, the typed value will be the input value
* if the Autocomplete loses focus without highlighting an option.
* @default false
*/
Expand All @@ -85,8 +85,8 @@ export interface UseAutocompleteProps<
/**
* If `true`, the input's text is cleared on blur if no value is selected.
*
* Set to `true` if you want to help the user enter a new value.
* Set to `false` if you want to help the user resume their search.
* Set it to `true` if you want to help the user enter a new value.
* Set it to `false` if you want to help the user resume their search.
* @default !props.freeSolo
*/
clearOnBlur?: boolean;
Expand Down
Loading

0 comments on commit 12f773a

Please sign in to comment.