/** * External dependencies */ import clsx from 'clsx'; import { withInstanceId } from '@wordpress/compose'; import type { ChangeEventHandler } from 'react'; /** * Internal dependencies */ import './style.scss'; import Label from '../label'; // Imported like this because importing from the components package loads the data stores unnecessarily - not a problem in the front end but would require a lot of unit test rewrites to prevent breaking tests due to incorrect mocks. export interface SortSelectProps { /** * Unique id for component instance. */ instanceId: number; /** * CSS class used. */ className?: string; /** * Label for the select. */ label?: string; /** * Function to call on the change event. */ onChange: ChangeEventHandler< HTMLSelectElement >; /** * Option values for the select. */ options: { key: string; label: string; }[]; /** * Screen reader label. */ screenReaderLabel: string; /** * The selected value. */ value?: string; /** * Whether the select is read only. */ readOnly?: boolean; } /** * Component used for 'Order by' selectors, which renders a label * and a { options && options.map( ( option ) => ( ) ) } ); }; export default withInstanceId( SortSelect );