UNPKG

@stanfordspezi/spezi-web-design-system

Version:

Stanford Biodesign Digital Health Spezi Web Design System

33 lines (32 loc) 1.07 kB
import { ComponentProps } from 'react'; import { Select } from '../Select'; declare const minuteValues: readonly [0, 30]; type TimeSelectMinute = (typeof minuteValues)[number]; export interface TimeSelectValue { hours: number; minutes: TimeSelectMinute; } export interface TimeSelectProps extends Omit<ComponentProps<typeof Select>, "value" | "onValueChange" | "children"> { id?: string; value?: TimeSelectValue | null; onChange: (value: TimeSelectValue) => void; placeholder?: string; className?: string; } /** * A time picker component that renders a Select dropdown with 48 half-hour time slots * covering the full 24-hour day. Labels are formatted using locale-aware time formatting. * * @example * ```tsx * const [time, setTime] = useState<TimeSelectValue | null>(null); * * <TimeSelect * value={time} * onChange={setTime} * placeholder="Select time" * /> * ``` */ export declare const TimeSelect: ({ id, value, onChange, placeholder, className, ...props }: TimeSelectProps) => import("react").JSX.Element; export {};