/** * External dependencies */ import { Icon, chevronDown } from '@wordpress/icons'; import { useCallback, useId } from '@wordpress/element'; /** * Internal dependencies */ import './style.scss'; type SelectProps = Omit< React.SelectHTMLAttributes< HTMLSelectElement >, 'onChange' > & { options: { value: string; label: string }[]; label: string; onChange: ( newVal: string ) => void; }; export const Select = ( props: SelectProps ) => { const { onChange, options, label, value, className, size, ...restOfProps } = props; const selectOnChange = useCallback( ( event: React.ChangeEvent< HTMLSelectElement > ) => { onChange( event.target.value ); }, [ onChange ] ); const generatedId = useId(); const inputId = restOfProps.id || `wc-blocks-components-select-${ generatedId }`; return (
); };