import { SelectHTMLAttributes, OptionHTMLAttributes, ReactNode, useId, forwardRef } from 'react'; import cx from 'clsx'; import styles from './select.module.scss'; type Props = Omit, 'id' | 'size'> & { options: OptionHTMLAttributes[] | Readonly[]>; size?: 'default' | 'small'; label?: string; error?: ReactNode; block?: boolean; }; const Select = forwardRef( ({ options, className, label, error, size = 'default', block, ...attrs }, ref) => { const { disabled } = attrs; const id = useId(); const getOptions = () => options.map((option, index) => ); return ( {getOptions()} {label && ( {label} )} {label} {error && {error}} ); }, ); export { Select }; export type { Props as SelectProps };
{error}