import React, { ChangeEvent, SelectHTMLAttributes } from 'react';
import { Stack } from './Stack';
import { Text } from './Text';
interface SelectOption {
value: string;
label: string;
}
interface SelectProps extends SelectHTMLAttributes {
id?: string;
'aria-label'?: string;
value?: string;
onChange?: (e: ChangeEvent) => void;
options: SelectOption[];
className?: string;
style?: React.CSSProperties;
label?: string;
fullWidth?: boolean;
pl?: number;
}
export function Select({
id,
'aria-label': ariaLabel,
value,
onChange,
options,
className = '',
style,
label,
fullWidth = true,
pl,
...props
}: SelectProps) {
const spacingMap: Record = {
10: 'pl-10'
};
const defaultClasses = `${fullWidth ? 'w-full' : 'w-auto'} px-3 py-2 bg-deep-graphite border border-charcoal-outline rounded-lg text-white focus:outline-none focus:border-primary-blue transition-colors`;
const classes = [
defaultClasses,
pl !== undefined ? spacingMap[pl] : '',
className
].filter(Boolean).join(' ');
return (
{label && (
{label}
)}
);
}