Make form components require onChange and have a default value (https://github.com/woocommerce/woocommerce-blocks/pull/6636)

This commit is contained in:
Tarun Vijwani 2022-07-01 21:50:44 +04:00 committed by GitHub
parent b5b454ad42
commit a1526ed660
4 changed files with 7 additions and 7 deletions

View File

@ -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,

View File

@ -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,

View File

@ -15,7 +15,7 @@ const RadioControl = ( {
className = '',
id,
selected,
onChange = () => void 0,
onChange,
options = [],
}: RadioControlProps ): JSX.Element | null => {
const instanceId = useInstanceId( RadioControl );

View File

@ -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 }`;