import { ChangeEventHandler, CSSProperties, ReactNode, SelectHTMLAttributes } from 'react'; import { IconDropdown } from 'components/IconDropdown'; import { useDayPicker } from 'contexts/DayPicker'; /** The props for the {@link Dropdown} component. */ export interface DropdownProps { /** The name attribute of the element. */ name?: string; /** The caption displayed to replace the hidden select. */ caption?: ReactNode; children?: SelectHTMLAttributes['children']; className?: string; ['aria-label']?: string; style?: CSSProperties; /** The selected value. */ value?: string | number; onChange?: ChangeEventHandler; } /** * Render a styled select component – displaying a caption and a custom * drop-down icon. */ export function Dropdown(props: DropdownProps): JSX.Element { const { onChange, value, children, caption, className, style } = props; const dayPicker = useDayPicker(); const IconDropdownComponent = dayPicker.components?.IconDropdown ?? IconDropdown; return (
{props['aria-label']}
); }