import { OptionHTMLAttributes, SelectHTMLAttributes, forwardRef, ForwardedRef, useId, ReactNode } from 'react';
import clsx from 'clsx';
import { InputProps } from '../../types';
import { InputWrapper } from '../utils';
import styles from './Select.module.scss';
type Props = Omit, 'size'> &
InputProps &
(
| {
options: OptionHTMLAttributes[] | Readonly[]>;
}
| { children: ReactNode }
);
const Select = forwardRef((props: Props, ref: ForwardedRef) => {
const {
label,
className,
error,
gap,
tooltip,
block,
color = 'dark',
size = 'normal',
direction = 'x',
...attrs
} = props;
const { disabled } = attrs;
const selectClassName = clsx(
styles.select,
styles[color],
styles[size],
error && styles.error,
block && styles.block,
);
const id = useId();
const getOptions = () =>
'options' in props ? props.options.map((option, index) => ) : props.children;
return (
);
});
export { Select, styles as selectStyles };
export type { Props as SelectProps };