Make form components require onChange and have a default value (https://github.com/woocommerce/woocommerce-blocks/pull/6636)
This commit is contained in:
parent
b5b454ad42
commit
a1526ed660
|
@ -21,7 +21,7 @@ interface CheckboxListProps {
|
|||
isDisabled?: boolean;
|
||||
limit?: number;
|
||||
checked?: string[];
|
||||
onChange?: ( value: string ) => void;
|
||||
onChange: ( value: string ) => void;
|
||||
options?: CheckboxListOptions[];
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ interface CheckboxListProps {
|
|||
*/
|
||||
const CheckboxList = ( {
|
||||
className,
|
||||
onChange = () => void 0,
|
||||
onChange,
|
||||
options = [],
|
||||
checked = [],
|
||||
isLoading = false,
|
||||
|
|
|
@ -49,7 +49,7 @@ export interface PriceSliderProps {
|
|||
/**
|
||||
* Function to call on the change event.
|
||||
*/
|
||||
onChange?: ( value: [ number, number ] ) => void;
|
||||
onChange: ( value: [ number, number ] ) => void;
|
||||
/**
|
||||
* Function to call when submit event fires.
|
||||
*/
|
||||
|
@ -73,7 +73,7 @@ const PriceSlider = ( {
|
|||
maxPrice,
|
||||
minConstraint,
|
||||
maxConstraint,
|
||||
onChange = () => void 0,
|
||||
onChange,
|
||||
step,
|
||||
currency,
|
||||
showInputFields = true,
|
||||
|
|
|
@ -15,7 +15,7 @@ const RadioControl = ( {
|
|||
className = '',
|
||||
id,
|
||||
selected,
|
||||
onChange = () => void 0,
|
||||
onChange,
|
||||
options = [],
|
||||
}: RadioControlProps ): JSX.Element | null => {
|
||||
const instanceId = useInstanceId( RadioControl );
|
||||
|
|
|
@ -42,7 +42,7 @@ interface SortSelectProps {
|
|||
/**
|
||||
* The selected value.
|
||||
*/
|
||||
value: string;
|
||||
value?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,7 +56,7 @@ const SortSelect = ( {
|
|||
onChange,
|
||||
options,
|
||||
screenReaderLabel,
|
||||
value,
|
||||
value = '',
|
||||
}: SortSelectProps ): JSX.Element => {
|
||||
const selectId = `wc-block-components-sort-select__select-${ instanceId }`;
|
||||
|
||||
|
|
Loading…
Reference in New Issue