import type { ChangeEventHandler, FocusEventHandler, ReactNode, Ref } from 'react'; import type { ComponentSize } from './types'; type DatePickerKind = 'date' | 'datetime-local' | 'time'; type Layout = 'stacked' | 'inline'; export type DatePickerProps = { label?: string; placeholder?: string; type: DatePickerKind; size?: ComponentSize; width?: ComponentSize; layout?: Layout; value: string; name?: string; onChange?: ChangeEventHandler; onBlur?: FocusEventHandler; inputRef?: Ref; disabled?: boolean; required?: boolean; error?: string; rightIcon?: ReactNode; className?: string; inputClassName?: string; }; export function DatePicker({ label, placeholder = '', type, size = 'md', width = 'md', layout = 'stacked', value, name, onChange, onBlur, inputRef, disabled = false, required = false, error, rightIcon, className = '', inputClassName = '', }: Readonly) { const containerWidthClass = { sm: 'max-w-xs', md: 'max-w-sm', lg: 'max-w-md', full: 'max-w-none', }[width]; const inputSizeClass = { sm: 'h-8 !text-xs', md: 'h-10 text-sm', lg: 'h-12 text-sm', full: 'h-10 text-sm', }[size]; const wrapperClass = layout === 'inline' ? 'inline-flex w-auto items-center gap-2' : 'block w-full gap-1'; const labelClass = layout === 'inline' ? 'text-xs ui-body-secondary' : ''; const hasTrailingIcon = Boolean(rightIcon); const inputWrapperClass = layout === 'inline' ? 'relative' : 'relative mt-1'; return ( ); }