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

[Autocomplete] Fix the errors reported by Wave #18283

Merged
merged 1 commit into from
Nov 11, 2019
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
5 changes: 5 additions & 0 deletions docs/src/modules/components/prism-okaidia.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,8 @@ pre[class*="language-"] {
.token.deleted {
color: rgb(252, 146, 158);
}

.token.boolean,
.token.number {
color: #b78eff;
Copy link
Member Author

Choose a reason for hiding this comment

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

Reach AA contrast level. The problem is more visible since the introduction of code previews.

}
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/Asynchronous.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default function Asynchronous() {

return (
<Autocomplete
id="asynchronous-demo"
Copy link
Member Author

Choose a reason for hiding this comment

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

Fix id duplication, server-side as reported by https://validator.w3.org/.

style={{ width: 300 }}
open={open}
onOpen={() => {
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/Asynchronous.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export default function Asynchronous() {

return (
<Autocomplete
id="asynchronous-demo"
style={{ width: 300 }}
open={open}
onOpen={() => {
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/CheckboxesTags.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default function CheckboxesTags() {
return (
<Autocomplete
multiple
id="checkboxes-tags-demo"
options={top100Films}
disableCloseOnSelect
getOptionLabel={option => option.title}
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/CheckboxesTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default function CheckboxesTags() {
return (
<Autocomplete
multiple
id="checkboxes-tags-demo"
options={top100Films}
disableCloseOnSelect
getOptionLabel={(option: FilmOptionType) => option.title}
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/ComboBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Autocomplete from '@material-ui/lab/Autocomplete';
export default function ComboBox() {
return (
<Autocomplete
id="combo-box-demo"
options={top100Films}
getOptionLabel={option => option.title}
style={{ width: 300 }}
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/ComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Autocomplete from '@material-ui/lab/Autocomplete';
export default function ComboBox() {
return (
<Autocomplete
id="combo-box-demo"
options={top100Films}
getOptionLabel={(option: FilmOptionType) => option.title}
style={{ width: 300 }}
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/CountrySelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default function CountrySelect() {

return (
<Autocomplete
id="country-select-demo"
style={{ width: 300 }}
options={countries}
classes={{
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/CountrySelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default function CountrySelect() {

return (
<Autocomplete
id="country-select-demo"
style={{ width: 300 }}
options={countries}
classes={{
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/CustomizedHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export default function CustomizedHook() {
focused,
setAnchorEl,
} = useAutocomplete({
id: 'customized-hook-demo',
defaultValue: [top100Films[1]],
multiple: true,
options: top100Films,
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/CustomizedHook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export default function CustomizedHook() {
focused,
setAnchorEl,
} = useAutocomplete({
id: 'customized-hook-demo',
defaultValue: [top100Films[1]],
multiple: true,
options: top100Films,
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/DisabledOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Autocomplete from '@material-ui/lab/Autocomplete';
export default function DisabledOptions() {
return (
<Autocomplete
id="disabled-options-demo"
options={timeSlots}
getOptionDisabled={option => option === timeSlots[0] || option === timeSlots[2]}
style={{ width: 300 }}
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/DisabledOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Autocomplete from '@material-ui/lab/Autocomplete';
export default function DisabledOptions() {
return (
<Autocomplete
id="disabled-options-demo"
options={timeSlots}
getOptionDisabled={(option: TimeSlot) => option === timeSlots[0] || option === timeSlots[2]}
style={{ width: 300 }}
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/Filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const filterOptions = createFilterOptions({
export default function Filter() {
return (
<Autocomplete
id="filter-demo"
options={top100Films}
getOptionLabel={option => option.title}
filterOptions={filterOptions}
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const filterOptions = createFilterOptions({
export default function Filter() {
return (
<Autocomplete
id="filter-demo"
options={top100Films}
getOptionLabel={(option: FilmOptionType) => option.title}
filterOptions={filterOptions}
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/FixedTags.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default function FixedTags() {
return (
<Autocomplete
multiple
id="fixed-tags-demo"
options={top100Films}
getOptionLabel={option => option.title}
defaultValue={[top100Films[6], top100Films[13]]}
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/FixedTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default function FixedTags() {
return (
<Autocomplete
multiple
id="fixed-tags-demo"
options={top100Films}
getOptionLabel={(option: FilmOptionType) => option.title}
defaultValue={[top100Films[6], top100Films[13]]}
Expand Down
2 changes: 2 additions & 0 deletions docs/src/pages/components/autocomplete/FreeSolo.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default function FreeSolo() {
return (
<div style={{ width: 300 }}>
<Autocomplete
id="free-solo-demo"
freeSolo
options={top100Films.map(option => option.title)}
renderInput={params => (
Expand All @@ -15,6 +16,7 @@ export default function FreeSolo() {
/>
<Autocomplete
freeSolo
id="free-solo-2-demo"
disableClearable
options={top100Films.map(option => option.title)}
renderInput={params => (
Expand Down
2 changes: 2 additions & 0 deletions docs/src/pages/components/autocomplete/FreeSolo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default function FreeSolo() {
return (
<div style={{ width: 300 }}>
<Autocomplete
id="free-solo-demo"
freeSolo
options={top100Films.map(option => option.title)}
renderInput={params => (
Expand All @@ -15,6 +16,7 @@ export default function FreeSolo() {
/>
<Autocomplete
freeSolo
id="free-solo-2-demo"
disableClearable
options={top100Films.map(option => option.title)}
renderInput={params => (
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/GoogleMaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export default function GoogleMaps() {

return (
<Autocomplete
id="google-map-demo"
style={{ width: 300 }}
getOptionLabel={option => option.description}
filterOptions={x => x}
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/GoogleMaps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export default function GoogleMaps() {

return (
<Autocomplete
id="google-map-demo"
style={{ width: 300 }}
getOptionLabel={option => option.description}
filterOptions={x => x}
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/Grouped.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default function Grouped() {

return (
<Autocomplete
id="grouped-demo"
options={options.sort((a, b) => -b.firstLetter.localeCompare(a.firstLetter))}
groupBy={option => option.firstLetter}
getOptionLabel={option => option.title}
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/Grouped.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default function Grouped() {

return (
<Autocomplete
id="grouped-demo"
options={options.sort((a, b) => -b.firstLetter.localeCompare(a.firstLetter))}
groupBy={(option: FilmOptionType) => option.firstLetter}
getOptionLabel={(option: FilmOptionType) => option.title}
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/Highlights.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import match from 'autosuggest-highlight/match';
export default function Highlights() {
return (
<Autocomplete
id="highlights-demo"
style={{ width: 300 }}
options={top100Films}
getOptionLabel={option => option.title}
Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/components/autocomplete/Highlights.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import match from 'autosuggest-highlight/match';
export default function Highlights() {
return (
<Autocomplete
id="highlights-demo"
style={{ width: 300 }}
options={top100Films}
getOptionLabel={(option: FilmOptionType) => option.title}
Expand Down
14 changes: 14 additions & 0 deletions docs/src/pages/components/autocomplete/Playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,50 @@ export default function Playground() {
<div style={{ width: 300 }}>
<Autocomplete
{...defaultProps}
id="debug"
debug
renderInput={params => <TextField {...params} label="debug" margin="normal" fullWidth />}
/>
<Autocomplete
{...defaultProps}
id="disable-close-on-select"
disableCloseOnSelect
renderInput={params => (
<TextField {...params} label="disableCloseOnSelect" margin="normal" fullWidth />
)}
/>
<Autocomplete
{...defaultProps}
id="clear-on-escape"
clearOnEscape
renderInput={params => (
<TextField {...params} label="clearOnEscape" margin="normal" fullWidth />
)}
/>
<Autocomplete
{...defaultProps}
id="disable-clearable"
disableClearable
renderInput={params => (
<TextField {...params} label="disableClearable" margin="normal" fullWidth />
)}
/>
<Autocomplete
{...defaultProps}
id="include-input-in-list"
includeInputInList
renderInput={params => (
<TextField {...params} label="includeInputInList" margin="normal" fullWidth />
)}
/>
<Autocomplete
{...flatProps}
id="flat-demo"
renderInput={params => <TextField {...params} label="flat" margin="normal" fullWidth />}
/>
<Autocomplete
{...defaultProps}
id="controlled-demo"
value={value}
onChange={(event, newValue) => {
setValue(newValue);
Expand All @@ -66,6 +73,7 @@ export default function Playground() {
/>
<Autocomplete
{...defaultProps}
id="auto-complete"
autoComplete
includeInputInList
renderInput={params => (
Expand All @@ -74,39 +82,45 @@ export default function Playground() {
/>
<Autocomplete
{...defaultProps}
id="disable-list-wrap"
disableListWrap
renderInput={params => (
<TextField {...params} label="disableListWrap" margin="normal" fullWidth />
)}
/>
<Autocomplete
{...defaultProps}
id="disable-open-on-focus"
disableOpenOnFocus
renderInput={params => (
<TextField {...params} label="disableOpenOnFocus" margin="normal" fullWidth />
)}
/>
<Autocomplete
{...defaultProps}
id="auto-highlight"
autoHighlight
renderInput={params => (
<TextField {...params} label="autoHighlight" margin="normal" fullWidth />
)}
/>
<Autocomplete
{...defaultProps}
id="auto-select"
autoSelect
renderInput={params => (
<TextField {...params} label="autoSelect" margin="normal" fullWidth />
)}
/>
<Autocomplete
{...defaultProps}
id="disabled"
disabled
renderInput={params => <TextField {...params} label="disabled" margin="normal" fullWidth />}
/>
<Autocomplete
{...defaultProps}
id="disable-portal"
disablePortal
renderInput={params => (
<TextField {...params} label="disablePortal" margin="normal" fullWidth />
Expand Down
Loading