Fix swatch and product list filters (#2087)

* Fix crashing

* Fix character limit

* Update snapshots
This commit is contained in:
Dominik Żegleń 2022-07-15 12:00:19 +02:00 committed by GitHub
parent 83988f08c5
commit 1879d0cfb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View file

@ -143,7 +143,7 @@ export const ColorPicker: React.FC<ColorPickerProps> = ({
helperText={errors?.value}
className={classes.colorInput}
InputProps={{ startAdornment: "HEX" }}
inputProps={{ pattern: "[A-Za-z0-9]{6}", maxLength: 6 }}
inputProps={{ pattern: "[A-Za-z0-9]{6}", maxLength: 7 }}
value={`#${hex}`}
onChange={event => handleHEXChange(event.target.value)}
/>

View file

@ -60,7 +60,7 @@ const FilterAutocompleteField: React.FC<FilterAutocompleteFieldProps> = ({
}) => {
const classes = useStyles({});
const fieldDisplayValues = displayValues[filter.name];
const fieldDisplayValues = displayValues[filter.name] ?? [];
const initialFieldDisplayValues = initialDisplayValues[filter.name];
const availableOptions = filter.options.filter(option =>
fieldDisplayValues.every(

View file

@ -5912,7 +5912,7 @@ exports[`Storyshots Generics / ColorPicker default 1`] = `
<input
aria-invalid="false"
class="MuiInputBase-input-id MuiOutlinedInput-input-id MuiInputBase-inputAdornedStart-id MuiOutlinedInput-inputAdornedStart-id"
maxlength="6"
maxlength="7"
pattern="[A-Za-z0-9]{6}"
type="text"
value="#000000"