acai-ui-library 0.1.19 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/date-time-picker.tsx","../../src/lib/utils.ts","../../src/components/button.tsx","../../src/components/calendar.tsx","../../src/components/popover.tsx","../../src/components/time-picker.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { CalendarClockIcon } from \"lucide-react\"\nimport type { Matcher } from \"react-day-picker\"\nimport { cn } from \"../lib/utils\"\nimport { Button } from \"./button\"\nimport { Calendar } from \"./calendar\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\"\nimport {\n TimePickerPanel,\n buildAllowedSlots,\n buildMinuteList,\n formatTimeLabel,\n formatTimeValue,\n isTimeInRange,\n parseTimeValue,\n snapToAllowedSlot,\n type TimeValue,\n} from \"./time-picker\"\n\nfunction startOfDay(date: Date): Date {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate())\n}\n\nfunction isSameDay(a: Date, b: Date): boolean {\n return (\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate()\n )\n}\n\n/** Minutes since midnight for a Date, in local time. */\nfunction minutesOfDay(date: Date): number {\n return date.getHours() * 60 + date.getMinutes()\n}\n\n/** A new Date on `day` at `minutes` past midnight, seconds zeroed. */\nfunction withTime(day: Date, minutes: number): Date {\n return new Date(\n day.getFullYear(),\n day.getMonth(),\n day.getDate(),\n Math.floor(minutes / 60),\n minutes % 60,\n 0,\n 0\n )\n}\n\nexport interface DateTimePickerProps {\n /** The selected moment. One value covers both the date and the time. */\n value?: Date\n /**\n * Called with the new moment, or with undefined when the value is cleared.\n * Fires only on Apply — edits inside the popover are held as a draft until\n * then.\n */\n onValueChange?: (value: Date | undefined) => void\n /**\n * Earliest selectable moment. Days before it are disabled in the calendar\n * and, on the boundary day itself, the times before it are disabled too.\n */\n minDate?: Date\n /**\n * Latest selectable moment. Days after it are disabled in the calendar and,\n * on the boundary day itself, the times after it are disabled too.\n */\n maxDate?: Date\n /** Extra day matchers passed through to the underlying Calendar. */\n disabledDates?: Matcher | Matcher[]\n /** Minute granularity offered by the minute column. Defaults to 5. */\n minuteStep?: number\n /** 12 adds an AM/PM column, 24 lists hours 00-23. Defaults to 12. */\n hourCycle?: 12 | 24\n /**\n * Time applied when a date is picked before any time has been chosen, as\n * \"HH:mm\". Defaults to \"09:00\" and is moved to the nearest allowed slot when\n * the bound forbids it.\n */\n defaultTime?: TimeValue\n /** Trigger text shown when nothing is selected. */\n placeholder?: string\n /** Overrides how the selected moment is rendered on the trigger. */\n formatValue?: (value: Date) => string\n /** Shows a Clear action in the popover. Defaults to true. */\n clearable?: boolean\n /** Text of the Clear action, which empties the draft. Defaults to \"Clear\". */\n clearLabel?: string\n /** Text of the action that commits the draft. Defaults to \"Apply\". */\n applyLabel?: string\n /** Text of the action that discards the draft. Defaults to \"Cancel\". */\n cancelLabel?: string\n /** Heading above the time columns. Defaults to \"Time\". */\n timeLabel?: string\n /** Disables the whole control. */\n disabled?: boolean\n /** Accessible name for the trigger. Defaults to the placeholder. */\n \"aria-label\"?: string\n /** Id of an element that labels the trigger. */\n \"aria-labelledby\"?: string\n /** Id applied to the trigger button. */\n id?: string\n /** Name reported on a hidden input, so the value posts with a plain form. */\n name?: string\n /** Classname applied to the trigger button. */\n className?: string\n /** Classname applied to the popover content. */\n contentClassName?: string\n /** Controlled open state of the popover. */\n open?: boolean\n /** Called when the popover opens or closes. */\n onOpenChange?: (open: boolean) => void\n /** Side the popover is aligned to. Defaults to \"start\". */\n align?: \"start\" | \"center\" | \"end\"\n}\n\n/**\n * A date and a time in one popover, reporting a single Date. Drop-in\n * replacement for a native `datetime-local` input: the calendar and the time\n * columns write to the same value, and `minDate` / `maxDate` are enforced on\n * both halves, including on the boundary day where only part of the day is\n * still allowed.\n *\n * Edits are committed explicitly. Picking a day, an hour, a minute or a period\n * moves a draft held inside the popover; `onValueChange` fires once, on Apply.\n * Cancel, Escape and a click outside all discard the draft, so a stray click\n * cannot write a deadline.\n */\nconst DateTimePicker = React.forwardRef<HTMLButtonElement, DateTimePickerProps>(\n (\n {\n value,\n onValueChange,\n minDate,\n maxDate,\n disabledDates,\n minuteStep = 5,\n hourCycle = 12,\n defaultTime = \"09:00\",\n placeholder = \"Pick a date and time\",\n formatValue,\n clearable = true,\n clearLabel = \"Clear\",\n applyLabel = \"Apply\",\n cancelLabel = \"Cancel\",\n timeLabel = \"Time\",\n disabled,\n id,\n name,\n className,\n contentClassName,\n open,\n onOpenChange,\n align = \"start\",\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n },\n ref\n ) => {\n // Every interaction inside the popover edits this draft, never `value`.\n // The trigger keeps showing `value`, so an uncommitted edit can never be\n // mistaken for a saved one.\n const [draft, setDraft] = React.useState<Date | undefined>(value)\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(false)\n const isOpen = open ?? uncontrolledOpen\n\n // Opening re-seeds the draft. The effect covers a controlled consumer that\n // flips `open` itself, which never reaches our onOpenChange handler.\n const wasOpen = React.useRef(isOpen)\n React.useEffect(() => {\n if (isOpen && !wasOpen.current) setDraft(value)\n wasOpen.current = isOpen\n }, [isOpen, value])\n\n const setOpenState = (next: boolean) => {\n if (open === undefined) setUncontrolledOpen(next)\n onOpenChange?.(next)\n }\n\n // The trigger, Escape and a click outside all land here. None of them\n // commits: the draft goes back to `value` whichever way the popover moves.\n const handleOpenChange = (next: boolean) => {\n setDraft(value)\n setOpenState(next)\n }\n\n const handleCancel = () => {\n setDraft(value)\n setOpenState(false)\n }\n\n // The one path that reports to the consumer, including the undefined left\n // behind by Clear.\n const handleApply = () => {\n onValueChange?.(draft)\n setOpenState(false)\n }\n\n // The day the time columns are bound against. Without a draft yet that is\n // today, pulled inside the allowed range so the columns are usable.\n const activeDay = React.useMemo(() => {\n if (draft) return startOfDay(draft)\n const today = startOfDay(new Date())\n if (minDate && today < startOfDay(minDate)) return startOfDay(minDate)\n if (maxDate && today > startOfDay(maxDate)) return startOfDay(maxDate)\n return today\n }, [draft, minDate, maxDate])\n\n /** The time window still open on a given day, once the bound is applied. */\n const timeWindowFor = React.useCallback(\n (day: Date): { minTime?: TimeValue; maxTime?: TimeValue } => ({\n minTime:\n minDate && isSameDay(day, minDate)\n ? formatTimeValue(minutesOfDay(minDate))\n : undefined,\n maxTime:\n maxDate && isSameDay(day, maxDate)\n ? formatTimeValue(minutesOfDay(maxDate))\n : undefined,\n }),\n [minDate, maxDate]\n )\n\n const activeWindow = timeWindowFor(activeDay)\n\n // The year dropdown follows the bound rather than Calendar's generic\n // default: with minDate set to now, a deadline picker offering 2016 would\n // be offering years every one of whose days it then refuses.\n const calendarStartMonth = React.useMemo(\n () => (minDate ? new Date(minDate.getFullYear(), minDate.getMonth(), 1) : undefined),\n [minDate],\n )\n const calendarEndMonth = React.useMemo(\n () => (maxDate ? new Date(maxDate.getFullYear(), maxDate.getMonth(), 1) : undefined),\n [maxDate],\n )\n\n const calendarDisabled = React.useMemo(() => {\n const matchers: Matcher[] = []\n if (minDate) matchers.push({ before: startOfDay(minDate) })\n if (maxDate) matchers.push({ after: startOfDay(maxDate) })\n if (Array.isArray(disabledDates)) matchers.push(...disabledDates)\n else if (disabledDates !== undefined) matchers.push(disabledDates)\n return matchers\n }, [minDate, maxDate, disabledDates])\n\n const handleDaySelect = (day: Date | undefined) => {\n // Clicking the selected day again deselects in react-day-picker. A\n // deadline should not disappear by accident, so Clear is the only way out.\n if (!day) return\n const desired = draft ? minutesOfDay(draft) : (parseTimeValue(defaultTime) ?? 0)\n const { minTime, maxTime } = timeWindowFor(day)\n const min = parseTimeValue(minTime)\n const max = parseTimeValue(maxTime)\n if (isTimeInRange(desired, min, max)) {\n setDraft(withTime(day, desired))\n return\n }\n const snapped = snapToAllowedSlot(\n desired,\n buildAllowedSlots(buildMinuteList(minuteStep, desired % 60), min, max)\n )\n if (snapped === undefined) return\n setDraft(withTime(day, snapped))\n }\n\n const handleTimeChange = (next: TimeValue) => {\n const minutes = parseTimeValue(next)\n if (minutes === undefined) return\n setDraft(withTime(draft ?? activeDay, minutes))\n }\n\n const label = value\n ? (formatValue?.(value) ??\n `${value.toLocaleDateString()} ${formatTimeLabel(minutesOfDay(value), hourCycle)}`)\n : placeholder\n\n return (\n <Popover open={isOpen} onOpenChange={handleOpenChange}>\n <PopoverTrigger asChild>\n <Button\n ref={ref}\n id={id}\n type=\"button\"\n variant=\"outline\"\n disabled={disabled}\n aria-label={ariaLabelledBy ? undefined : (ariaLabel ?? placeholder)}\n aria-labelledby={ariaLabelledBy}\n className={cn(\n \"w-[280px] justify-start text-left font-normal\",\n !value && \"text-muted-foreground\",\n className\n )}\n >\n <CalendarClockIcon className=\"me-2 h-4 w-4\" aria-hidden=\"true\" />\n {label}\n </Button>\n </PopoverTrigger>\n <PopoverContent\n className={cn(\"w-auto p-0\", contentClassName)}\n align={align}\n aria-label={ariaLabel ?? placeholder}\n >\n <div className=\"flex flex-col sm:flex-row sm:items-start sm:divide-x sm:divide-border\">\n <Calendar\n mode=\"single\"\n selected={draft}\n defaultMonth={activeDay}\n startMonth={calendarStartMonth}\n endMonth={calendarEndMonth}\n onSelect={handleDaySelect}\n disabled={calendarDisabled}\n // Focus moves into the calendar the user just opened (keyboard navigation).\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus\n />\n <div className=\"border-t border-border p-2 sm:border-t-0\">\n <div className=\"px-1 pb-1 text-xs font-medium uppercase tracking-wider text-muted-foreground\">\n {timeLabel}\n </div>\n <TimePickerPanel\n value={draft ? formatTimeValue(minutesOfDay(draft)) : undefined}\n onValueChange={handleTimeChange}\n minTime={activeWindow.minTime}\n maxTime={activeWindow.maxTime}\n minuteStep={minuteStep}\n hourCycle={hourCycle}\n />\n </div>\n </div>\n <div className=\"flex items-center gap-2 border-t border-border p-2\">\n {clearable && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"font-normal\"\n disabled={!draft}\n onClick={() => setDraft(undefined)}\n >\n {clearLabel}\n </Button>\n )}\n <div className=\"ms-auto flex items-center gap-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"font-normal\"\n onClick={handleCancel}\n >\n {cancelLabel}\n </Button>\n <Button type=\"button\" variant=\"default\" size=\"sm\" onClick={handleApply}>\n {applyLabel}\n </Button>\n </div>\n </div>\n </PopoverContent>\n {name && (\n <input\n type=\"hidden\"\n name={name}\n value={\n value\n ? `${value.getFullYear()}-${String(value.getMonth() + 1).padStart(2, \"0\")}-${String(\n value.getDate()\n ).padStart(2, \"0\")}T${formatTimeValue(minutesOfDay(value))}`\n : \"\"\n }\n />\n )}\n </Popover>\n )\n }\n)\nDateTimePicker.displayName = \"DateTimePicker\"\n\nexport { DateTimePicker }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","\nimport * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Loader2 } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground hover:bg-primary-hover\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive-hover\",\n outline:\n \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary-hover\",\n ghost:\n \"hover:bg-accent hover:text-accent-foreground\",\n link:\n \"text-primary underline-offset-4 hover:underline\",\n success:\n \"bg-success text-success-foreground hover:bg-success-hover\",\n },\n size: {\n xs: \"h-7 px-2.5 text-xs\",\n sm: \"h-9 px-3\",\n default: \"h-10 px-4 py-2\",\n lg: \"h-11 px-8\",\n icon: \"h-10 w-10\",\n \"icon-sm\": \"h-8 w-8\",\n },\n shape: {\n default: \"rounded-md\",\n rounded: \"rounded-lg\",\n pill: \"rounded-full\",\n square: \"rounded-none\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n shape: \"default\",\n },\n }\n)\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean\n loading?: boolean\n prefixIcon?: React.ReactNode\n suffixIcon?: React.ReactNode\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n size,\n shape,\n asChild = false,\n loading = false,\n prefixIcon,\n suffixIcon,\n children,\n disabled,\n ...props\n },\n ref\n ) => {\n const Comp = asChild ? Slot : \"button\"\n const isDisabled = disabled || loading\n\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, shape, className }))}\n ref={ref}\n disabled={isDisabled}\n {...props}\n >\n {loading && <Loader2 className=\"animate-spin\" />}\n {!loading && prefixIcon}\n {children}\n {suffixIcon}\n </Comp>\n )\n }\n)\nButton.displayName = \"Button\"\n\nexport { Button, buttonVariants }\n","import * as React from \"react\"\nimport { DayPicker } from \"react-day-picker\"\nimport { ChevronLeft, ChevronRight } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>\n\n/**\n * How far the year dropdown reaches when the caller gives no bounds.\n *\n * `captionLayout` defaults to \"dropdown\" here, and react-day-picker then falls\n * back to [currentYear - 100, currentYear] for the year list. That is wrong in\n * both directions: a hundred dead years to scroll past, and no future year at\n * all - a deadline could not be set beyond December of the current year.\n * Callers that know their range pass `startMonth` / `endMonth` and these are\n * not used.\n */\nconst DEFAULT_YEARS_BACK = 10\nconst DEFAULT_YEARS_FORWARD = 10\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = \"dropdown\",\n startMonth,\n endMonth,\n ...props\n}: CalendarProps) {\n const now = new Date()\n const defaultedStartMonth =\n startMonth ?? new Date(now.getFullYear() - DEFAULT_YEARS_BACK, 0, 1)\n const defaultedEndMonth =\n endMonth ?? new Date(now.getFullYear() + DEFAULT_YEARS_FORWARD, 11, 1)\n\n return (\n <DayPicker\n startMonth={defaultedStartMonth}\n endMonth={defaultedEndMonth}\n showOutsideDays={showOutsideDays}\n className={cn(\"w-[260px] rounded-lg p-3\", className)}\n classNames={{\n months: \"flex flex-col\",\n month: \"space-y-3\",\n month_caption: \"relative flex h-8 items-center justify-center\",\n caption_label: \"text-sm font-medium hidden\",\n nav: \"flex items-center\",\n button_previous: cn(\n \"absolute start-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-[var(--hc-color-border-subtle)] hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n button_next: cn(\n \"absolute end-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-[var(--hc-color-border-subtle)] hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n month_grid: \"w-full border-collapse\",\n weekdays: \"flex w-full\",\n weekday:\n \"flex-1 h-8 flex items-center justify-center text-[11px] font-medium text-muted-foreground uppercase tracking-wider\",\n week: \"flex w-full mt-1\",\n day: \"flex-1 h-8 p-0 relative focus-within:z-20 flex items-center justify-center text-sm\",\n day_button: cn(\n \"inline-flex size-8 items-center justify-center rounded-md bg-transparent text-sm font-normal cursor-pointer border-none hover:bg-[var(--hc-color-border-subtle)] transition-colors\"\n ),\n range_end: \"day-range-end\",\n selected:\n \"[&>button]:bg-[var(--hc-primary-600)] [&>button]:text-white [&>button]:hover:bg-[var(--hc-primary-600)] [&>button]:hover:text-white [&>button]:font-medium\",\n today: \"[&>button]:font-semibold [&>button]:text-[var(--hc-primary-600)]\",\n outside:\n \"day-outside [&>button]:bg-transparent [&>button]:text-[var(--hc-grey-200)]\",\n disabled: \"[&>button]:text-[var(--hc-grey-200)] [&>button]:opacity-50 [&>button]:cursor-default\",\n range_middle:\n \"[&>button]:bg-[var(--hc-primary-100)] [&>button]:text-foreground [&>button]:rounded-none\",\n range_start: \"[&>button]:rounded-e-none\",\n dropdowns: \"flex items-center gap-1.5 justify-center [&>select]:flex-1\",\n dropdown:\n \"h-7 w-[88px] rounded-md border border-[var(--hc-color-border-subtle)] bg-background px-2 text-xs font-medium text-foreground cursor-pointer outline-none accent-[var(--hc-primary-600)] focus:border-[var(--hc-primary-500)] focus:ring-[2px] focus:ring-[var(--hc-primary-500)]/20 [&>option:checked]:bg-[var(--hc-primary-600)] [&>option:checked]:text-white [&>option]:py-1\",\n hidden: \"invisible\",\n ...classNames,\n }}\n captionLayout={captionLayout}\n components={{\n Chevron: ({ orientation }) => {\n const Icon = orientation === \"left\" ? ChevronLeft : ChevronRight\n return <Icon className=\"size-4\" />\n },\n }}\n {...props}\n />\n )\n}\nCalendar.displayName = \"Calendar\"\n\nexport { Calendar }\n","import * as React from \"react\"\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\"\nimport { cn } from \"../lib/utils\"\n\nconst Popover = PopoverPrimitive.Root\nconst PopoverTrigger = PopoverPrimitive.Trigger\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n))\nPopoverContent.displayName = PopoverPrimitive.Content.displayName\n\nexport { Popover, PopoverTrigger, PopoverContent }\n","import * as React from \"react\"\nimport { ClockIcon } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\nimport { Button } from \"./button\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\"\n\n/** Matches a 24-hour clock time, \"HH:mm\". */\nconst TIME_VALUE_PATTERN = /^([01]\\d|2[0-3]):([0-5]\\d)$/\n\nconst MINUTES_PER_DAY = 24 * 60\nconst NOON = 12 * 60\n\n/** A 24-hour clock time such as \"09:00\" or \"17:30\". */\nexport type TimeValue = string\n\ntype Period = \"AM\" | \"PM\"\n\nfunction pad2(value: number): string {\n return value.toString().padStart(2, \"0\")\n}\n\n/**\n * Turns a \"HH:mm\" string into minutes since midnight. Returns undefined for\n * anything that is not a valid 24-hour time, so a bad prop degrades to\n * \"nothing selected\" rather than throwing inside a render.\n */\nfunction parseTimeValue(value?: string | null): number | undefined {\n if (!value) return undefined\n const match = TIME_VALUE_PATTERN.exec(value.trim())\n if (!match) return undefined\n return Number(match[1]) * 60 + Number(match[2])\n}\n\n/** Turns minutes since midnight back into the canonical \"HH:mm\" string. */\nfunction formatTimeValue(minutesOfDay: number): string {\n const normalised = ((minutesOfDay % MINUTES_PER_DAY) + MINUTES_PER_DAY) % MINUTES_PER_DAY\n return `${pad2(Math.floor(normalised / 60))}:${pad2(normalised % 60)}`\n}\n\n/** Human-readable time, either \"17:30\" or \"05:30 PM\" depending on the cycle. */\nfunction formatTimeLabel(minutesOfDay: number, hourCycle: 12 | 24): string {\n const normalised = ((minutesOfDay % MINUTES_PER_DAY) + MINUTES_PER_DAY) % MINUTES_PER_DAY\n const hours = Math.floor(normalised / 60)\n const minutes = normalised % 60\n if (hourCycle === 24) return `${pad2(hours)}:${pad2(minutes)}`\n const period: Period = hours < NOON / 60 ? \"AM\" : \"PM\"\n const hour12 = hours % 12 === 0 ? 12 : hours % 12\n return `${pad2(hour12)}:${pad2(minutes)} ${period}`\n}\n\nfunction isTimeInRange(minutesOfDay: number, min?: number, max?: number): boolean {\n if (min !== undefined && minutesOfDay < min) return false\n if (max !== undefined && minutesOfDay > max) return false\n return true\n}\n\n/** The hour a 12-hour-cycle cell stands for once its period is applied. */\nfunction to24Hour(hour12: number, period: Period): number {\n const base = hour12 % 12\n return period === \"AM\" ? base : base + 12\n}\n\n/**\n * The minute offsets the minute column offers. `extra` keeps a value that does\n * not sit on the step grid visible — a consumer may hand us \"14:07\" with a\n * 5-minute step and we must not silently fail to reflect it.\n */\nfunction buildMinuteList(minuteStep: number, extra?: number): number[] {\n const step = Number.isFinite(minuteStep) ? Math.min(60, Math.max(1, Math.floor(minuteStep))) : 5\n const minutes: number[] = []\n for (let minute = 0; minute < 60; minute += step) minutes.push(minute)\n if (extra !== undefined && extra >= 0 && extra < 60 && !minutes.includes(extra)) {\n minutes.push(extra)\n minutes.sort((a, b) => a - b)\n }\n return minutes\n}\n\n/** Every selectable slot of the day that the bound allows, ascending. */\nfunction buildAllowedSlots(minutes: number[], min?: number, max?: number): number[] {\n const slots: number[] = []\n for (let hour = 0; hour < 24; hour += 1) {\n for (const minute of minutes) {\n const slot = hour * 60 + minute\n if (isTimeInRange(slot, min, max)) slots.push(slot)\n }\n }\n return slots\n}\n\n/**\n * The allowed slot closest to `desired`, preferring one at or after it, so a\n * time that has fallen outside the bound moves forward to the next legal slot\n * instead of backwards.\n */\nfunction snapToAllowedSlot(desired: number, allowedSlots: number[]): number | undefined {\n if (allowedSlots.length === 0) return undefined\n let best = allowedSlots[0]\n let bestScore = Number.POSITIVE_INFINITY\n for (const slot of allowedSlots) {\n const score = slot >= desired ? slot - desired : desired - slot + MINUTES_PER_DAY\n if (score < bestScore) {\n bestScore = score\n best = slot\n }\n }\n return best\n}\n\nconst columnClasses =\n \"flex max-h-[216px] w-16 flex-col gap-1 overflow-y-auto overscroll-contain p-1\"\n\nconst cellClasses =\n \"shrink-0 rounded-md px-2 py-1.5 text-sm font-normal text-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-pressed:bg-primary aria-pressed:font-medium aria-pressed:text-primary-foreground aria-pressed:hover:bg-primary aria-pressed:hover:text-primary-foreground disabled:pointer-events-none disabled:text-muted-foreground disabled:opacity-50\"\n\ninterface TimeCellProps {\n label: string\n accessibleName: string\n pressed: boolean\n disabled: boolean\n onSelect: () => void\n}\n\nfunction TimeCell({ label, accessibleName, pressed, disabled, onSelect }: TimeCellProps) {\n return (\n <button\n type=\"button\"\n aria-label={accessibleName}\n aria-pressed={pressed}\n disabled={disabled}\n onClick={onSelect}\n className={cn(cellClasses)}\n >\n {label}\n </button>\n )\n}\n\nexport interface TimePickerPanelProps {\n /** Selected time as a 24-hour \"HH:mm\" string. */\n value?: TimeValue\n /** Called with the newly selected 24-hour \"HH:mm\" string. */\n onValueChange?: (value: TimeValue) => void\n /** Earliest selectable time as \"HH:mm\". Earlier times are disabled. */\n minTime?: TimeValue\n /** Latest selectable time as \"HH:mm\". Later times are disabled. */\n maxTime?: TimeValue\n /** Minute granularity offered by the minute column. Defaults to 5. */\n minuteStep?: number\n /** 12 adds an AM/PM column, 24 lists hours 00-23. Defaults to 12. */\n hourCycle?: 12 | 24\n /** Accessible name for the hour column. Defaults to \"Hour\". */\n hourLabel?: string\n /** Accessible name for the minute column. Defaults to \"Minute\". */\n minuteLabel?: string\n /** Accessible name for the AM/PM column. Defaults to \"Period\". */\n periodLabel?: string\n /** Classname applied to the panel wrapper. */\n className?: string\n}\n\n/**\n * The bare hour/minute columns, without a popover around them. Used by\n * TimePicker and by DateTimePicker, which supplies its own popover.\n */\nfunction TimePickerPanel({\n value,\n onValueChange,\n minTime,\n maxTime,\n minuteStep = 5,\n hourCycle = 12,\n hourLabel = \"Hour\",\n minuteLabel = \"Minute\",\n periodLabel = \"Period\",\n className,\n}: TimePickerPanelProps) {\n const minMinutes = parseTimeValue(minTime)\n const maxMinutes = parseTimeValue(maxTime)\n const selected = parseTimeValue(value)\n\n const minuteList = React.useMemo(\n () => buildMinuteList(minuteStep, selected === undefined ? undefined : selected % 60),\n [minuteStep, selected]\n )\n const allowedSlots = React.useMemo(\n () => buildAllowedSlots(minuteList, minMinutes, maxMinutes),\n [minuteList, minMinutes, maxMinutes]\n )\n\n // Each click reports a complete time, so with nothing selected yet the\n // columns work against the first slot the bound allows.\n const active = selected ?? allowedSlots[0]\n const activeHour = active === undefined ? undefined : Math.floor(active / 60)\n const activeMinute = active === undefined ? undefined : active % 60\n const activePeriod: Period =\n activeHour !== undefined && activeHour >= 12 ? \"PM\" : \"AM\"\n\n const hourHasSlot = (hour: number) =>\n allowedSlots.some((slot) => Math.floor(slot / 60) === hour)\n const firstSlotInHour = (hour: number) =>\n allowedSlots.find((slot) => Math.floor(slot / 60) === hour)\n const periodHasSlot = (period: Period) =>\n allowedSlots.some((slot) => (slot < NOON ? \"AM\" : \"PM\") === period)\n const firstSlotInPeriod = (period: Period) =>\n allowedSlots.find((slot) => (slot < NOON ? \"AM\" : \"PM\") === period)\n\n const commit = (minutesOfDay: number | undefined) => {\n if (minutesOfDay === undefined) return\n onValueChange?.(formatTimeValue(minutesOfDay))\n }\n\n const selectHour = (hour: number) => {\n const desired = hour * 60 + (activeMinute ?? 0)\n commit(isTimeInRange(desired, minMinutes, maxMinutes) ? desired : firstSlotInHour(hour))\n }\n\n const selectMinute = (minute: number) => {\n if (activeHour === undefined) return\n commit(activeHour * 60 + minute)\n }\n\n const selectPeriod = (period: Period) => {\n if (activeHour === undefined || activeMinute === undefined) {\n commit(firstSlotInPeriod(period))\n return\n }\n const hour12 = activeHour % 12 === 0 ? 12 : activeHour % 12\n const desired = to24Hour(hour12, period) * 60 + activeMinute\n commit(\n isTimeInRange(desired, minMinutes, maxMinutes) ? desired : firstSlotInPeriod(period)\n )\n }\n\n const hourCells =\n hourCycle === 24\n ? Array.from({ length: 24 }, (_, hour) => hour)\n : [12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\n\n return (\n <div className={cn(\"flex items-start divide-x divide-border\", className)}>\n <div className={cn(columnClasses)} role=\"group\" aria-label={hourLabel}>\n {hourCells.map((cell) => {\n const hour = hourCycle === 24 ? cell : to24Hour(cell, activePeriod)\n const label = pad2(cell)\n return (\n <TimeCell\n key={`hour-${cell}`}\n label={label}\n accessibleName={`${hourLabel} ${label}`}\n pressed={activeHour === hour && selected !== undefined}\n disabled={!hourHasSlot(hour)}\n onSelect={() => selectHour(hour)}\n />\n )\n })}\n </div>\n <div className={cn(columnClasses)} role=\"group\" aria-label={minuteLabel}>\n {minuteList.map((minute) => {\n const label = pad2(minute)\n const disabled =\n activeHour === undefined ||\n !isTimeInRange(activeHour * 60 + minute, minMinutes, maxMinutes)\n return (\n <TimeCell\n key={`minute-${minute}`}\n label={label}\n accessibleName={`${minuteLabel} ${label}`}\n pressed={activeMinute === minute && selected !== undefined}\n disabled={disabled}\n onSelect={() => selectMinute(minute)}\n />\n )\n })}\n </div>\n {hourCycle === 12 && (\n <div className={cn(columnClasses)} role=\"group\" aria-label={periodLabel}>\n {([\"AM\", \"PM\"] as Period[]).map((period) => (\n <TimeCell\n key={period}\n label={period}\n accessibleName={period}\n pressed={activePeriod === period && selected !== undefined}\n disabled={!periodHasSlot(period)}\n onSelect={() => selectPeriod(period)}\n />\n ))}\n </div>\n )}\n </div>\n )\n}\nTimePickerPanel.displayName = \"TimePickerPanel\"\n\nexport interface TimePickerProps {\n /** Selected time as a 24-hour \"HH:mm\" string. */\n value?: TimeValue\n /** Called with the new time, or with undefined when the value is cleared. */\n onValueChange?: (value: TimeValue | undefined) => void\n /** Earliest selectable time as \"HH:mm\". Earlier times are disabled. */\n minTime?: TimeValue\n /** Latest selectable time as \"HH:mm\". Later times are disabled. */\n maxTime?: TimeValue\n /** Minute granularity offered by the minute column. Defaults to 5. */\n minuteStep?: number\n /** 12 adds an AM/PM column, 24 lists hours 00-23. Defaults to 12. */\n hourCycle?: 12 | 24\n /** Trigger text shown when nothing is selected. */\n placeholder?: string\n /** Shows a Clear action in the popover. Defaults to true. */\n clearable?: boolean\n /** Text of the Clear action. Defaults to \"Clear\". */\n clearLabel?: string\n /** Disables the whole control. */\n disabled?: boolean\n /** Accessible name for the trigger. Defaults to the placeholder. */\n \"aria-label\"?: string\n /** Id of an element that labels the trigger. */\n \"aria-labelledby\"?: string\n /** Id applied to the trigger button. */\n id?: string\n /** Name reported on a hidden input, so the value posts with a plain form. */\n name?: string\n /** Classname applied to the trigger button. */\n className?: string\n /** Classname applied to the popover content. */\n contentClassName?: string\n /** Controlled open state of the popover. */\n open?: boolean\n /** Called when the popover opens or closes. */\n onOpenChange?: (open: boolean) => void\n /** Side the popover is aligned to. Defaults to \"start\". */\n align?: \"start\" | \"center\" | \"end\"\n}\n\n/**\n * A time control: a popover trigger showing the selected time, over hour and\n * minute columns. The value is always a 24-hour \"HH:mm\" string, so it survives\n * a round trip through JSON and through a `datetime-local`-shaped API.\n */\nconst TimePicker = React.forwardRef<HTMLButtonElement, TimePickerProps>(\n (\n {\n value,\n onValueChange,\n minTime,\n maxTime,\n minuteStep = 5,\n hourCycle = 12,\n placeholder = \"Pick a time\",\n clearable = true,\n clearLabel = \"Clear\",\n disabled,\n id,\n name,\n className,\n contentClassName,\n open,\n onOpenChange,\n align = \"start\",\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n },\n ref\n ) => {\n const selected = parseTimeValue(value)\n const label =\n selected === undefined ? placeholder : formatTimeLabel(selected, hourCycle)\n\n return (\n <Popover open={open} onOpenChange={onOpenChange}>\n <PopoverTrigger asChild>\n <Button\n ref={ref}\n id={id}\n type=\"button\"\n variant=\"outline\"\n disabled={disabled}\n aria-label={ariaLabelledBy ? undefined : (ariaLabel ?? placeholder)}\n aria-labelledby={ariaLabelledBy}\n className={cn(\n \"w-[180px] justify-start text-left font-normal\",\n selected === undefined && \"text-muted-foreground\",\n className\n )}\n >\n <ClockIcon className=\"me-2 h-4 w-4\" aria-hidden=\"true\" />\n {label}\n </Button>\n </PopoverTrigger>\n <PopoverContent\n className={cn(\"w-auto p-0\", contentClassName)}\n align={align}\n aria-label={ariaLabel ?? placeholder}\n >\n <TimePickerPanel\n value={value}\n onValueChange={(next) => onValueChange?.(next)}\n minTime={minTime}\n maxTime={maxTime}\n minuteStep={minuteStep}\n hourCycle={hourCycle}\n />\n {clearable && (\n <div className=\"flex justify-end border-t border-border p-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"font-normal\"\n disabled={selected === undefined}\n onClick={() => onValueChange?.(undefined)}\n >\n {clearLabel}\n </Button>\n </div>\n )}\n </PopoverContent>\n {name && <input type=\"hidden\" name={name} value={value ?? \"\"} />}\n </Popover>\n )\n }\n)\nTimePicker.displayName = \"TimePicker\"\n\nexport {\n TimePicker,\n TimePickerPanel,\n formatTimeLabel,\n formatTimeValue,\n parseTimeValue,\n isTimeInRange,\n buildMinuteList,\n buildAllowedSlots,\n snapToAllowedSlot,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,SAAuB;AACvB,IAAAC,uBAAkC;;;ACDlC,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ACJA,YAAuB;AACvB,wBAAqB;AACrB,sCAAuC;AACvC,0BAAwB;AA4ElB;AAzEN,IAAM,qBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,WACE;AAAA,QACF,OACE;AAAA,QACF,MACE;AAA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AAA,oBACV,SAAS;AAAA,oBAER;AAAA;AAAA,gBACH;AAAA,gBACA,6CAAC,UAAO,MAAK,UAAS,SAAQ,WAAU,MAAK,MAAK,SAAS,aACxD,sBACH;AAAA,iBACF;AAAA,eACF;AAAA;AAAA;AAAA,MACF;AAAA,MACC,QACC;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL;AAAA,UACA,OACE,QACI,GAAG,MAAM,YAAY,CAAC,IAAI,OAAO,MAAM,SAAS,IAAI,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI;AAAA,YACzE,MAAM,QAAQ;AAAA,UAChB,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,gBAAgB,aAAa,KAAK,CAAC,CAAC,KAC1D;AAAA;AAAA,MAER;AAAA,OAEJ;AAAA,EAEJ;AACF;AACA,eAAe,cAAc;","names":["React","import_lucide_react","import_lucide_react","import_jsx_runtime","React","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","minutesOfDay","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../../src/components/date-time-picker.tsx","../../src/lib/utils.ts","../../src/components/button.tsx","../../src/components/calendar.tsx","../../src/components/popover.tsx","../../src/components/time-picker.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { CalendarClockIcon } from \"lucide-react\"\nimport type { Matcher } from \"react-day-picker\"\nimport { cn } from \"../lib/utils\"\nimport { Button } from \"./button\"\nimport { Calendar } from \"./calendar\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\"\nimport {\n TimePickerPanel,\n buildAllowedSlots,\n buildMinuteList,\n formatTimeLabel,\n formatTimeValue,\n isTimeInRange,\n parseTimeValue,\n snapToAllowedSlot,\n type TimeValue,\n} from \"./time-picker\"\n\nfunction startOfDay(date: Date): Date {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate())\n}\n\nfunction isSameDay(a: Date, b: Date): boolean {\n return (\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate()\n )\n}\n\n/** Minutes since midnight for a Date, in local time. */\nfunction minutesOfDay(date: Date): number {\n return date.getHours() * 60 + date.getMinutes()\n}\n\n/** A new Date on `day` at `minutes` past midnight, seconds zeroed. */\nfunction withTime(day: Date, minutes: number): Date {\n return new Date(\n day.getFullYear(),\n day.getMonth(),\n day.getDate(),\n Math.floor(minutes / 60),\n minutes % 60,\n 0,\n 0\n )\n}\n\nexport interface DateTimePickerProps {\n /** The selected moment. One value covers both the date and the time. */\n value?: Date\n /**\n * Called with the new moment, or with undefined when the value is cleared.\n * Fires only on Apply — edits inside the popover are held as a draft until\n * then.\n */\n onValueChange?: (value: Date | undefined) => void\n /**\n * Earliest selectable moment. Days before it are disabled in the calendar\n * and, on the boundary day itself, the times before it are disabled too.\n */\n minDate?: Date\n /**\n * Latest selectable moment. Days after it are disabled in the calendar and,\n * on the boundary day itself, the times after it are disabled too.\n */\n maxDate?: Date\n /** Extra day matchers passed through to the underlying Calendar. */\n disabledDates?: Matcher | Matcher[]\n /** Minute granularity offered by the minute column. Defaults to 5. */\n minuteStep?: number\n /** 12 adds an AM/PM column, 24 lists hours 00-23. Defaults to 12. */\n hourCycle?: 12 | 24\n /**\n * Time applied when a date is picked before any time has been chosen, as\n * \"HH:mm\". Defaults to \"09:00\" and is moved to the nearest allowed slot when\n * the bound forbids it.\n */\n defaultTime?: TimeValue\n /** Trigger text shown when nothing is selected. */\n placeholder?: string\n /** Overrides how the selected moment is rendered on the trigger. */\n formatValue?: (value: Date) => string\n /** Shows a Clear action in the popover. Defaults to true. */\n clearable?: boolean\n /** Text of the Clear action, which empties the draft. Defaults to \"Clear\". */\n clearLabel?: string\n /** Text of the action that commits the draft. Defaults to \"Apply\". */\n applyLabel?: string\n /** Text of the action that discards the draft. Defaults to \"Cancel\". */\n cancelLabel?: string\n /** Heading above the time columns. Defaults to \"Time\". */\n timeLabel?: string\n /** Disables the whole control. */\n disabled?: boolean\n /** Accessible name for the trigger. Defaults to the placeholder. */\n \"aria-label\"?: string\n /** Id of an element that labels the trigger. */\n \"aria-labelledby\"?: string\n /** Id applied to the trigger button. */\n id?: string\n /** Name reported on a hidden input, so the value posts with a plain form. */\n name?: string\n /** Classname applied to the trigger button. */\n className?: string\n /** Classname applied to the popover content. */\n contentClassName?: string\n /** Controlled open state of the popover. */\n open?: boolean\n /** Called when the popover opens or closes. */\n onOpenChange?: (open: boolean) => void\n /** Side the popover is aligned to. Defaults to \"start\". */\n align?: \"start\" | \"center\" | \"end\"\n}\n\n/**\n * A date and a time in one popover, reporting a single Date. Drop-in\n * replacement for a native `datetime-local` input: the calendar and the time\n * columns write to the same value, and `minDate` / `maxDate` are enforced on\n * both halves, including on the boundary day where only part of the day is\n * still allowed.\n *\n * Edits are committed explicitly. Picking a day, an hour, a minute or a period\n * moves a draft held inside the popover; `onValueChange` fires once, on Apply.\n * Cancel, Escape and a click outside all discard the draft, so a stray click\n * cannot write a deadline.\n */\nconst DateTimePicker = React.forwardRef<HTMLButtonElement, DateTimePickerProps>(\n (\n {\n value,\n onValueChange,\n minDate,\n maxDate,\n disabledDates,\n minuteStep = 5,\n hourCycle = 12,\n defaultTime = \"09:00\",\n placeholder = \"Pick a date and time\",\n formatValue,\n clearable = true,\n clearLabel = \"Clear\",\n applyLabel = \"Apply\",\n cancelLabel = \"Cancel\",\n timeLabel = \"Time\",\n disabled,\n id,\n name,\n className,\n contentClassName,\n open,\n onOpenChange,\n align = \"start\",\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n },\n ref\n ) => {\n // Every interaction inside the popover edits this draft, never `value`.\n // The trigger keeps showing `value`, so an uncommitted edit can never be\n // mistaken for a saved one.\n const [draft, setDraft] = React.useState<Date | undefined>(value)\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(false)\n const isOpen = open ?? uncontrolledOpen\n\n // Opening re-seeds the draft. The effect covers a controlled consumer that\n // flips `open` itself, which never reaches our onOpenChange handler.\n const wasOpen = React.useRef(isOpen)\n React.useEffect(() => {\n if (isOpen && !wasOpen.current) setDraft(value)\n wasOpen.current = isOpen\n }, [isOpen, value])\n\n const setOpenState = (next: boolean) => {\n if (open === undefined) setUncontrolledOpen(next)\n onOpenChange?.(next)\n }\n\n // The trigger, Escape and a click outside all land here. None of them\n // commits: the draft goes back to `value` whichever way the popover moves.\n const handleOpenChange = (next: boolean) => {\n setDraft(value)\n setOpenState(next)\n }\n\n const handleCancel = () => {\n setDraft(value)\n setOpenState(false)\n }\n\n // The one path that reports to the consumer, including the undefined left\n // behind by Clear.\n const handleApply = () => {\n onValueChange?.(draft)\n setOpenState(false)\n }\n\n // The day the time columns are bound against. Without a draft yet that is\n // today, pulled inside the allowed range so the columns are usable.\n const activeDay = React.useMemo(() => {\n if (draft) return startOfDay(draft)\n const today = startOfDay(new Date())\n if (minDate && today < startOfDay(minDate)) return startOfDay(minDate)\n if (maxDate && today > startOfDay(maxDate)) return startOfDay(maxDate)\n return today\n }, [draft, minDate, maxDate])\n\n /** The time window still open on a given day, once the bound is applied. */\n const timeWindowFor = React.useCallback(\n (day: Date): { minTime?: TimeValue; maxTime?: TimeValue } => ({\n minTime:\n minDate && isSameDay(day, minDate)\n ? formatTimeValue(minutesOfDay(minDate))\n : undefined,\n maxTime:\n maxDate && isSameDay(day, maxDate)\n ? formatTimeValue(minutesOfDay(maxDate))\n : undefined,\n }),\n [minDate, maxDate]\n )\n\n const activeWindow = timeWindowFor(activeDay)\n\n // The year dropdown follows the bound rather than Calendar's generic\n // default: with minDate set to now, a deadline picker offering 2016 would\n // be offering years every one of whose days it then refuses.\n const calendarStartMonth = React.useMemo(\n () => (minDate ? new Date(minDate.getFullYear(), minDate.getMonth(), 1) : undefined),\n [minDate],\n )\n const calendarEndMonth = React.useMemo(\n () => (maxDate ? new Date(maxDate.getFullYear(), maxDate.getMonth(), 1) : undefined),\n [maxDate],\n )\n\n const calendarDisabled = React.useMemo(() => {\n const matchers: Matcher[] = []\n if (minDate) matchers.push({ before: startOfDay(minDate) })\n if (maxDate) matchers.push({ after: startOfDay(maxDate) })\n if (Array.isArray(disabledDates)) matchers.push(...disabledDates)\n else if (disabledDates !== undefined) matchers.push(disabledDates)\n return matchers\n }, [minDate, maxDate, disabledDates])\n\n const handleDaySelect = (day: Date | undefined) => {\n // Clicking the selected day again deselects in react-day-picker. A\n // deadline should not disappear by accident, so Clear is the only way out.\n if (!day) return\n const desired = draft ? minutesOfDay(draft) : (parseTimeValue(defaultTime) ?? 0)\n const { minTime, maxTime } = timeWindowFor(day)\n const min = parseTimeValue(minTime)\n const max = parseTimeValue(maxTime)\n if (isTimeInRange(desired, min, max)) {\n setDraft(withTime(day, desired))\n return\n }\n const snapped = snapToAllowedSlot(\n desired,\n buildAllowedSlots(buildMinuteList(minuteStep, desired % 60), min, max)\n )\n if (snapped === undefined) return\n setDraft(withTime(day, snapped))\n }\n\n const handleTimeChange = (next: TimeValue) => {\n const minutes = parseTimeValue(next)\n if (minutes === undefined) return\n setDraft(withTime(draft ?? activeDay, minutes))\n }\n\n const label = value\n ? (formatValue?.(value) ??\n `${value.toLocaleDateString()} ${formatTimeLabel(minutesOfDay(value), hourCycle)}`)\n : placeholder\n\n return (\n <Popover open={isOpen} onOpenChange={handleOpenChange}>\n <PopoverTrigger asChild>\n <Button\n ref={ref}\n id={id}\n type=\"button\"\n variant=\"outline\"\n disabled={disabled}\n aria-label={ariaLabelledBy ? undefined : (ariaLabel ?? placeholder)}\n aria-labelledby={ariaLabelledBy}\n className={cn(\n \"w-[280px] justify-start text-left font-normal\",\n !value && \"text-muted-foreground\",\n className\n )}\n >\n <CalendarClockIcon className=\"me-2 h-4 w-4\" aria-hidden=\"true\" />\n {label}\n </Button>\n </PopoverTrigger>\n <PopoverContent\n className={cn(\"w-auto p-0\", contentClassName)}\n align={align}\n aria-label={ariaLabel ?? placeholder}\n >\n <div className=\"flex flex-col sm:flex-row sm:items-start sm:divide-x sm:divide-border\">\n <Calendar\n mode=\"single\"\n selected={draft}\n defaultMonth={activeDay}\n startMonth={calendarStartMonth}\n endMonth={calendarEndMonth}\n onSelect={handleDaySelect}\n disabled={calendarDisabled}\n // Focus moves into the calendar the user just opened (keyboard navigation).\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus\n />\n <div className=\"border-t border-border p-2 sm:border-t-0\">\n <div className=\"px-1 pb-1 text-xs font-medium uppercase tracking-wider text-muted-foreground\">\n {timeLabel}\n </div>\n <TimePickerPanel\n value={draft ? formatTimeValue(minutesOfDay(draft)) : undefined}\n onValueChange={handleTimeChange}\n minTime={activeWindow.minTime}\n maxTime={activeWindow.maxTime}\n minuteStep={minuteStep}\n hourCycle={hourCycle}\n />\n </div>\n </div>\n <div className=\"flex items-center gap-2 border-t border-border p-2\">\n {clearable && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"font-normal\"\n disabled={!draft}\n onClick={() => setDraft(undefined)}\n >\n {clearLabel}\n </Button>\n )}\n <div className=\"ms-auto flex items-center gap-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"font-normal\"\n onClick={handleCancel}\n >\n {cancelLabel}\n </Button>\n <Button type=\"button\" variant=\"default\" size=\"sm\" onClick={handleApply}>\n {applyLabel}\n </Button>\n </div>\n </div>\n </PopoverContent>\n {name && (\n <input\n type=\"hidden\"\n name={name}\n value={\n value\n ? `${value.getFullYear()}-${String(value.getMonth() + 1).padStart(2, \"0\")}-${String(\n value.getDate()\n ).padStart(2, \"0\")}T${formatTimeValue(minutesOfDay(value))}`\n : \"\"\n }\n />\n )}\n </Popover>\n )\n }\n)\nDateTimePicker.displayName = \"DateTimePicker\"\n\nexport { DateTimePicker }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","\nimport * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Loader2 } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground hover:bg-primary-hover\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive-hover\",\n outline:\n \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary-hover\",\n ghost:\n \"hover:bg-accent hover:text-accent-foreground\",\n link:\n \"text-primary underline-offset-4 hover:underline\",\n success:\n \"bg-success text-success-foreground hover:bg-success-hover\",\n },\n size: {\n xs: \"h-7 px-2.5 text-xs\",\n sm: \"h-9 px-3\",\n default: \"h-10 px-4 py-2\",\n lg: \"h-11 px-8\",\n icon: \"h-10 w-10\",\n \"icon-sm\": \"h-8 w-8\",\n },\n shape: {\n default: \"rounded-md\",\n rounded: \"rounded-lg\",\n pill: \"rounded-full\",\n square: \"rounded-none\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n shape: \"default\",\n },\n }\n)\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean\n loading?: boolean\n prefixIcon?: React.ReactNode\n suffixIcon?: React.ReactNode\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n size,\n shape,\n asChild = false,\n loading = false,\n prefixIcon,\n suffixIcon,\n children,\n disabled,\n ...props\n },\n ref\n ) => {\n const Comp = asChild ? Slot : \"button\"\n const isDisabled = disabled || loading\n\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, shape, className }))}\n ref={ref}\n disabled={isDisabled}\n {...props}\n >\n {loading && <Loader2 className=\"animate-spin\" />}\n {!loading && prefixIcon}\n {children}\n {suffixIcon}\n </Comp>\n )\n }\n)\nButton.displayName = \"Button\"\n\nexport { Button, buttonVariants }\n","import * as React from \"react\"\nimport { DayPicker } from \"react-day-picker\"\nimport { ChevronLeft, ChevronRight } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>\n\n/**\n * How far the year dropdown reaches when the caller gives no bounds.\n *\n * `captionLayout` defaults to \"dropdown\" here, and react-day-picker then falls\n * back to [currentYear - 100, currentYear] for the year list. That is wrong in\n * both directions: a hundred dead years to scroll past, and no future year at\n * all - a deadline could not be set beyond December of the current year.\n * Callers that know their range pass `startMonth` / `endMonth` and these are\n * not used.\n */\nconst DEFAULT_YEARS_BACK = 10\nconst DEFAULT_YEARS_FORWARD = 10\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = \"dropdown\",\n startMonth,\n endMonth,\n ...props\n}: CalendarProps) {\n const now = new Date()\n const defaultedStartMonth =\n startMonth ?? new Date(now.getFullYear() - DEFAULT_YEARS_BACK, 0, 1)\n const defaultedEndMonth =\n endMonth ?? new Date(now.getFullYear() + DEFAULT_YEARS_FORWARD, 11, 1)\n\n return (\n <DayPicker\n startMonth={defaultedStartMonth}\n endMonth={defaultedEndMonth}\n showOutsideDays={showOutsideDays}\n className={cn(\"w-[260px] rounded-lg p-3\", className)}\n classNames={{\n months: \"flex flex-col\",\n month: \"space-y-3\",\n month_caption: \"relative flex h-8 items-center justify-center\",\n caption_label: \"text-sm font-medium hidden\",\n nav: \"flex items-center\",\n button_previous: cn(\n \"absolute start-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n button_next: cn(\n \"absolute end-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n month_grid: \"w-full border-collapse\",\n weekdays: \"flex w-full\",\n weekday:\n \"flex-1 h-8 flex items-center justify-center text-[11px] font-medium text-muted-foreground uppercase tracking-wider\",\n week: \"flex w-full mt-1\",\n day: \"flex-1 h-8 p-0 relative focus-within:z-20 flex items-center justify-center text-sm\",\n day_button: cn(\n \"inline-flex size-8 items-center justify-center rounded-md bg-transparent text-sm font-normal cursor-pointer border-none hover:bg-muted transition-colors\"\n ),\n range_end: \"day-range-end\",\n selected:\n \"[&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:hover:bg-primary [&>button]:hover:text-primary-foreground [&>button]:font-medium\",\n today: \"[&>button]:font-semibold [&>button]:text-primary\",\n outside:\n \"day-outside [&>button]:bg-transparent [&>button]:text-muted-foreground [&>button]:opacity-50\",\n disabled: \"[&>button]:text-muted-foreground [&>button]:opacity-40 [&>button]:cursor-default\",\n range_middle:\n \"[&>button]:bg-accent [&>button]:text-accent-foreground [&>button]:rounded-none\",\n range_start: \"[&>button]:rounded-e-none\",\n dropdowns: \"flex items-center gap-1.5 justify-center\",\n dropdown:\n \"h-7 rounded-md border border-input bg-background px-2 text-xs font-medium text-foreground cursor-pointer outline-none accent-primary focus:border-ring focus:ring-[2px] focus:ring-ring/20 [&>option:checked]:bg-primary [&>option:checked]:text-primary-foreground [&>option]:py-1\",\n months_dropdown: \"w-[104px]\",\n years_dropdown: \"w-[72px]\",\n hidden: \"invisible\",\n ...classNames,\n }}\n captionLayout={captionLayout}\n components={{\n Chevron: ({ orientation }) => {\n const Icon = orientation === \"left\" ? ChevronLeft : ChevronRight\n return <Icon className=\"size-4\" />\n },\n }}\n {...props}\n />\n )\n}\nCalendar.displayName = \"Calendar\"\n\nexport { Calendar }\n","import * as React from \"react\"\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\"\nimport { cn } from \"../lib/utils\"\n\nconst Popover = PopoverPrimitive.Root\nconst PopoverTrigger = PopoverPrimitive.Trigger\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n))\nPopoverContent.displayName = PopoverPrimitive.Content.displayName\n\nexport { Popover, PopoverTrigger, PopoverContent }\n","import * as React from \"react\"\nimport { ClockIcon } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\nimport { Button } from \"./button\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\"\n\n/** Matches a 24-hour clock time, \"HH:mm\". */\nconst TIME_VALUE_PATTERN = /^([01]\\d|2[0-3]):([0-5]\\d)$/\n\nconst MINUTES_PER_DAY = 24 * 60\nconst NOON = 12 * 60\n\n/** A 24-hour clock time such as \"09:00\" or \"17:30\". */\nexport type TimeValue = string\n\ntype Period = \"AM\" | \"PM\"\n\nfunction pad2(value: number): string {\n return value.toString().padStart(2, \"0\")\n}\n\n/**\n * Turns a \"HH:mm\" string into minutes since midnight. Returns undefined for\n * anything that is not a valid 24-hour time, so a bad prop degrades to\n * \"nothing selected\" rather than throwing inside a render.\n */\nfunction parseTimeValue(value?: string | null): number | undefined {\n if (!value) return undefined\n const match = TIME_VALUE_PATTERN.exec(value.trim())\n if (!match) return undefined\n return Number(match[1]) * 60 + Number(match[2])\n}\n\n/** Turns minutes since midnight back into the canonical \"HH:mm\" string. */\nfunction formatTimeValue(minutesOfDay: number): string {\n const normalised = ((minutesOfDay % MINUTES_PER_DAY) + MINUTES_PER_DAY) % MINUTES_PER_DAY\n return `${pad2(Math.floor(normalised / 60))}:${pad2(normalised % 60)}`\n}\n\n/** Human-readable time, either \"17:30\" or \"05:30 PM\" depending on the cycle. */\nfunction formatTimeLabel(minutesOfDay: number, hourCycle: 12 | 24): string {\n const normalised = ((minutesOfDay % MINUTES_PER_DAY) + MINUTES_PER_DAY) % MINUTES_PER_DAY\n const hours = Math.floor(normalised / 60)\n const minutes = normalised % 60\n if (hourCycle === 24) return `${pad2(hours)}:${pad2(minutes)}`\n const period: Period = hours < NOON / 60 ? \"AM\" : \"PM\"\n const hour12 = hours % 12 === 0 ? 12 : hours % 12\n return `${pad2(hour12)}:${pad2(minutes)} ${period}`\n}\n\nfunction isTimeInRange(minutesOfDay: number, min?: number, max?: number): boolean {\n if (min !== undefined && minutesOfDay < min) return false\n if (max !== undefined && minutesOfDay > max) return false\n return true\n}\n\n/** The hour a 12-hour-cycle cell stands for once its period is applied. */\nfunction to24Hour(hour12: number, period: Period): number {\n const base = hour12 % 12\n return period === \"AM\" ? base : base + 12\n}\n\n/**\n * The minute offsets the minute column offers. `extra` keeps a value that does\n * not sit on the step grid visible — a consumer may hand us \"14:07\" with a\n * 5-minute step and we must not silently fail to reflect it.\n */\nfunction buildMinuteList(minuteStep: number, extra?: number): number[] {\n const step = Number.isFinite(minuteStep) ? Math.min(60, Math.max(1, Math.floor(minuteStep))) : 5\n const minutes: number[] = []\n for (let minute = 0; minute < 60; minute += step) minutes.push(minute)\n if (extra !== undefined && extra >= 0 && extra < 60 && !minutes.includes(extra)) {\n minutes.push(extra)\n minutes.sort((a, b) => a - b)\n }\n return minutes\n}\n\n/** Every selectable slot of the day that the bound allows, ascending. */\nfunction buildAllowedSlots(minutes: number[], min?: number, max?: number): number[] {\n const slots: number[] = []\n for (let hour = 0; hour < 24; hour += 1) {\n for (const minute of minutes) {\n const slot = hour * 60 + minute\n if (isTimeInRange(slot, min, max)) slots.push(slot)\n }\n }\n return slots\n}\n\n/**\n * The allowed slot closest to `desired`, preferring one at or after it, so a\n * time that has fallen outside the bound moves forward to the next legal slot\n * instead of backwards.\n */\nfunction snapToAllowedSlot(desired: number, allowedSlots: number[]): number | undefined {\n if (allowedSlots.length === 0) return undefined\n let best = allowedSlots[0]\n let bestScore = Number.POSITIVE_INFINITY\n for (const slot of allowedSlots) {\n const score = slot >= desired ? slot - desired : desired - slot + MINUTES_PER_DAY\n if (score < bestScore) {\n bestScore = score\n best = slot\n }\n }\n return best\n}\n\nconst columnClasses =\n \"flex max-h-[216px] w-16 flex-col gap-1 overflow-y-auto overscroll-contain p-1\"\n\nconst cellClasses =\n \"shrink-0 rounded-md px-2 py-1.5 text-sm font-normal text-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-pressed:bg-primary aria-pressed:font-medium aria-pressed:text-primary-foreground aria-pressed:hover:bg-primary aria-pressed:hover:text-primary-foreground disabled:pointer-events-none disabled:text-muted-foreground disabled:opacity-50\"\n\ninterface TimeCellProps {\n label: string\n accessibleName: string\n pressed: boolean\n disabled: boolean\n onSelect: () => void\n}\n\nfunction TimeCell({ label, accessibleName, pressed, disabled, onSelect }: TimeCellProps) {\n return (\n <button\n type=\"button\"\n aria-label={accessibleName}\n aria-pressed={pressed}\n disabled={disabled}\n onClick={onSelect}\n className={cn(cellClasses)}\n >\n {label}\n </button>\n )\n}\n\nexport interface TimePickerPanelProps {\n /** Selected time as a 24-hour \"HH:mm\" string. */\n value?: TimeValue\n /** Called with the newly selected 24-hour \"HH:mm\" string. */\n onValueChange?: (value: TimeValue) => void\n /** Earliest selectable time as \"HH:mm\". Earlier times are disabled. */\n minTime?: TimeValue\n /** Latest selectable time as \"HH:mm\". Later times are disabled. */\n maxTime?: TimeValue\n /** Minute granularity offered by the minute column. Defaults to 5. */\n minuteStep?: number\n /** 12 adds an AM/PM column, 24 lists hours 00-23. Defaults to 12. */\n hourCycle?: 12 | 24\n /** Accessible name for the hour column. Defaults to \"Hour\". */\n hourLabel?: string\n /** Accessible name for the minute column. Defaults to \"Minute\". */\n minuteLabel?: string\n /** Accessible name for the AM/PM column. Defaults to \"Period\". */\n periodLabel?: string\n /** Classname applied to the panel wrapper. */\n className?: string\n}\n\n/**\n * The bare hour/minute columns, without a popover around them. Used by\n * TimePicker and by DateTimePicker, which supplies its own popover.\n */\nfunction TimePickerPanel({\n value,\n onValueChange,\n minTime,\n maxTime,\n minuteStep = 5,\n hourCycle = 12,\n hourLabel = \"Hour\",\n minuteLabel = \"Minute\",\n periodLabel = \"Period\",\n className,\n}: TimePickerPanelProps) {\n const minMinutes = parseTimeValue(minTime)\n const maxMinutes = parseTimeValue(maxTime)\n const selected = parseTimeValue(value)\n\n const minuteList = React.useMemo(\n () => buildMinuteList(minuteStep, selected === undefined ? undefined : selected % 60),\n [minuteStep, selected]\n )\n const allowedSlots = React.useMemo(\n () => buildAllowedSlots(minuteList, minMinutes, maxMinutes),\n [minuteList, minMinutes, maxMinutes]\n )\n\n // Each click reports a complete time, so with nothing selected yet the\n // columns work against the first slot the bound allows.\n const active = selected ?? allowedSlots[0]\n const activeHour = active === undefined ? undefined : Math.floor(active / 60)\n const activeMinute = active === undefined ? undefined : active % 60\n const activePeriod: Period =\n activeHour !== undefined && activeHour >= 12 ? \"PM\" : \"AM\"\n\n const hourHasSlot = (hour: number) =>\n allowedSlots.some((slot) => Math.floor(slot / 60) === hour)\n const firstSlotInHour = (hour: number) =>\n allowedSlots.find((slot) => Math.floor(slot / 60) === hour)\n const periodHasSlot = (period: Period) =>\n allowedSlots.some((slot) => (slot < NOON ? \"AM\" : \"PM\") === period)\n const firstSlotInPeriod = (period: Period) =>\n allowedSlots.find((slot) => (slot < NOON ? \"AM\" : \"PM\") === period)\n\n const commit = (minutesOfDay: number | undefined) => {\n if (minutesOfDay === undefined) return\n onValueChange?.(formatTimeValue(minutesOfDay))\n }\n\n const selectHour = (hour: number) => {\n const desired = hour * 60 + (activeMinute ?? 0)\n commit(isTimeInRange(desired, minMinutes, maxMinutes) ? desired : firstSlotInHour(hour))\n }\n\n const selectMinute = (minute: number) => {\n if (activeHour === undefined) return\n commit(activeHour * 60 + minute)\n }\n\n const selectPeriod = (period: Period) => {\n if (activeHour === undefined || activeMinute === undefined) {\n commit(firstSlotInPeriod(period))\n return\n }\n const hour12 = activeHour % 12 === 0 ? 12 : activeHour % 12\n const desired = to24Hour(hour12, period) * 60 + activeMinute\n commit(\n isTimeInRange(desired, minMinutes, maxMinutes) ? desired : firstSlotInPeriod(period)\n )\n }\n\n const hourCells =\n hourCycle === 24\n ? Array.from({ length: 24 }, (_, hour) => hour)\n : [12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\n\n return (\n <div className={cn(\"flex items-start divide-x divide-border\", className)}>\n <div className={cn(columnClasses)} role=\"group\" aria-label={hourLabel}>\n {hourCells.map((cell) => {\n const hour = hourCycle === 24 ? cell : to24Hour(cell, activePeriod)\n const label = pad2(cell)\n return (\n <TimeCell\n key={`hour-${cell}`}\n label={label}\n accessibleName={`${hourLabel} ${label}`}\n pressed={activeHour === hour && selected !== undefined}\n disabled={!hourHasSlot(hour)}\n onSelect={() => selectHour(hour)}\n />\n )\n })}\n </div>\n <div className={cn(columnClasses)} role=\"group\" aria-label={minuteLabel}>\n {minuteList.map((minute) => {\n const label = pad2(minute)\n const disabled =\n activeHour === undefined ||\n !isTimeInRange(activeHour * 60 + minute, minMinutes, maxMinutes)\n return (\n <TimeCell\n key={`minute-${minute}`}\n label={label}\n accessibleName={`${minuteLabel} ${label}`}\n pressed={activeMinute === minute && selected !== undefined}\n disabled={disabled}\n onSelect={() => selectMinute(minute)}\n />\n )\n })}\n </div>\n {hourCycle === 12 && (\n <div className={cn(columnClasses)} role=\"group\" aria-label={periodLabel}>\n {([\"AM\", \"PM\"] as Period[]).map((period) => (\n <TimeCell\n key={period}\n label={period}\n accessibleName={period}\n pressed={activePeriod === period && selected !== undefined}\n disabled={!periodHasSlot(period)}\n onSelect={() => selectPeriod(period)}\n />\n ))}\n </div>\n )}\n </div>\n )\n}\nTimePickerPanel.displayName = \"TimePickerPanel\"\n\nexport interface TimePickerProps {\n /** Selected time as a 24-hour \"HH:mm\" string. */\n value?: TimeValue\n /** Called with the new time, or with undefined when the value is cleared. */\n onValueChange?: (value: TimeValue | undefined) => void\n /** Earliest selectable time as \"HH:mm\". Earlier times are disabled. */\n minTime?: TimeValue\n /** Latest selectable time as \"HH:mm\". Later times are disabled. */\n maxTime?: TimeValue\n /** Minute granularity offered by the minute column. Defaults to 5. */\n minuteStep?: number\n /** 12 adds an AM/PM column, 24 lists hours 00-23. Defaults to 12. */\n hourCycle?: 12 | 24\n /** Trigger text shown when nothing is selected. */\n placeholder?: string\n /** Shows a Clear action in the popover. Defaults to true. */\n clearable?: boolean\n /** Text of the Clear action. Defaults to \"Clear\". */\n clearLabel?: string\n /** Disables the whole control. */\n disabled?: boolean\n /** Accessible name for the trigger. Defaults to the placeholder. */\n \"aria-label\"?: string\n /** Id of an element that labels the trigger. */\n \"aria-labelledby\"?: string\n /** Id applied to the trigger button. */\n id?: string\n /** Name reported on a hidden input, so the value posts with a plain form. */\n name?: string\n /** Classname applied to the trigger button. */\n className?: string\n /** Classname applied to the popover content. */\n contentClassName?: string\n /** Controlled open state of the popover. */\n open?: boolean\n /** Called when the popover opens or closes. */\n onOpenChange?: (open: boolean) => void\n /** Side the popover is aligned to. Defaults to \"start\". */\n align?: \"start\" | \"center\" | \"end\"\n}\n\n/**\n * A time control: a popover trigger showing the selected time, over hour and\n * minute columns. The value is always a 24-hour \"HH:mm\" string, so it survives\n * a round trip through JSON and through a `datetime-local`-shaped API.\n */\nconst TimePicker = React.forwardRef<HTMLButtonElement, TimePickerProps>(\n (\n {\n value,\n onValueChange,\n minTime,\n maxTime,\n minuteStep = 5,\n hourCycle = 12,\n placeholder = \"Pick a time\",\n clearable = true,\n clearLabel = \"Clear\",\n disabled,\n id,\n name,\n className,\n contentClassName,\n open,\n onOpenChange,\n align = \"start\",\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n },\n ref\n ) => {\n const selected = parseTimeValue(value)\n const label =\n selected === undefined ? placeholder : formatTimeLabel(selected, hourCycle)\n\n return (\n <Popover open={open} onOpenChange={onOpenChange}>\n <PopoverTrigger asChild>\n <Button\n ref={ref}\n id={id}\n type=\"button\"\n variant=\"outline\"\n disabled={disabled}\n aria-label={ariaLabelledBy ? undefined : (ariaLabel ?? placeholder)}\n aria-labelledby={ariaLabelledBy}\n className={cn(\n \"w-[180px] justify-start text-left font-normal\",\n selected === undefined && \"text-muted-foreground\",\n className\n )}\n >\n <ClockIcon className=\"me-2 h-4 w-4\" aria-hidden=\"true\" />\n {label}\n </Button>\n </PopoverTrigger>\n <PopoverContent\n className={cn(\"w-auto p-0\", contentClassName)}\n align={align}\n aria-label={ariaLabel ?? placeholder}\n >\n <TimePickerPanel\n value={value}\n onValueChange={(next) => onValueChange?.(next)}\n minTime={minTime}\n maxTime={maxTime}\n minuteStep={minuteStep}\n hourCycle={hourCycle}\n />\n {clearable && (\n <div className=\"flex justify-end border-t border-border p-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"font-normal\"\n disabled={selected === undefined}\n onClick={() => onValueChange?.(undefined)}\n >\n {clearLabel}\n </Button>\n </div>\n )}\n </PopoverContent>\n {name && <input type=\"hidden\" name={name} value={value ?? \"\"} />}\n </Popover>\n )\n }\n)\nTimePicker.displayName = \"TimePicker\"\n\nexport {\n TimePicker,\n TimePickerPanel,\n formatTimeLabel,\n formatTimeValue,\n parseTimeValue,\n isTimeInRange,\n buildMinuteList,\n buildAllowedSlots,\n snapToAllowedSlot,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,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A,oBACA;AAAA;AAAA,gBACF;AAAA,iBACF;AAAA,eACF;AAAA,YACA,8CAAC,SAAI,WAAU,sDACZ;AAAA,2BACC;AAAA,gBAAC;AAAA;AAAA,kBACC,MAAK;AAAA,kBACL,SAAQ;AAAA,kBACR,MAAK;AAAA,kBACL,WAAU;AAAA,kBACV,UAAU,CAAC;AAAA,kBACX,SAAS,MAAM,SAAS,MAAS;AAAA,kBAEhC;AAAA;AAAA,cACH;AAAA,cAEF,8CAAC,SAAI,WAAU,mCACb;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACC,MAAK;AAAA,oBACL,SAAQ;AAAA,oBACR,MAAK;AAAA,oBACL,WAAU;AAAA,oBACV,SAAS;AAAA,oBAER;AAAA;AAAA,gBACH;AAAA,gBACA,6CAAC,UAAO,MAAK,UAAS,SAAQ,WAAU,MAAK,MAAK,SAAS,aACxD,sBACH;AAAA,iBACF;AAAA,eACF;AAAA;AAAA;AAAA,MACF;AAAA,MACC,QACC;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL;AAAA,UACA,OACE,QACI,GAAG,MAAM,YAAY,CAAC,IAAI,OAAO,MAAM,SAAS,IAAI,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI;AAAA,YACzE,MAAM,QAAQ;AAAA,UAChB,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,gBAAgB,aAAa,KAAK,CAAC,CAAC,KAC1D;AAAA;AAAA,MAER;AAAA,OAEJ;AAAA,EAEJ;AACF;AACA,eAAe,cAAc;","names":["React","import_lucide_react","import_lucide_react","import_jsx_runtime","React","import_jsx_runtime","React","import_lucide_react","import_jsx_runtime","minutesOfDay","import_jsx_runtime"]}
@@ -117,10 +117,10 @@ function Calendar({
117
117
  caption_label: "text-sm font-medium hidden",
118
118
  nav: "flex items-center",
119
119
  button_previous: cn(
120
- "absolute start-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-[var(--hc-color-border-subtle)] hover:text-foreground transition-colors cursor-pointer border-none"
120
+ "absolute start-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors cursor-pointer border-none"
121
121
  ),
122
122
  button_next: cn(
123
- "absolute end-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-[var(--hc-color-border-subtle)] hover:text-foreground transition-colors cursor-pointer border-none"
123
+ "absolute end-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors cursor-pointer border-none"
124
124
  ),
125
125
  month_grid: "w-full border-collapse",
126
126
  weekdays: "flex w-full",
@@ -128,17 +128,19 @@ function Calendar({
128
128
  week: "flex w-full mt-1",
129
129
  day: "flex-1 h-8 p-0 relative focus-within:z-20 flex items-center justify-center text-sm",
130
130
  day_button: cn(
131
- "inline-flex size-8 items-center justify-center rounded-md bg-transparent text-sm font-normal cursor-pointer border-none hover:bg-[var(--hc-color-border-subtle)] transition-colors"
131
+ "inline-flex size-8 items-center justify-center rounded-md bg-transparent text-sm font-normal cursor-pointer border-none hover:bg-muted transition-colors"
132
132
  ),
133
133
  range_end: "day-range-end",
134
- selected: "[&>button]:bg-[var(--hc-primary-600)] [&>button]:text-white [&>button]:hover:bg-[var(--hc-primary-600)] [&>button]:hover:text-white [&>button]:font-medium",
135
- today: "[&>button]:font-semibold [&>button]:text-[var(--hc-primary-600)]",
136
- outside: "day-outside [&>button]:bg-transparent [&>button]:text-[var(--hc-grey-200)]",
137
- disabled: "[&>button]:text-[var(--hc-grey-200)] [&>button]:opacity-50 [&>button]:cursor-default",
138
- range_middle: "[&>button]:bg-[var(--hc-primary-100)] [&>button]:text-foreground [&>button]:rounded-none",
134
+ selected: "[&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:hover:bg-primary [&>button]:hover:text-primary-foreground [&>button]:font-medium",
135
+ today: "[&>button]:font-semibold [&>button]:text-primary",
136
+ outside: "day-outside [&>button]:bg-transparent [&>button]:text-muted-foreground [&>button]:opacity-50",
137
+ disabled: "[&>button]:text-muted-foreground [&>button]:opacity-40 [&>button]:cursor-default",
138
+ range_middle: "[&>button]:bg-accent [&>button]:text-accent-foreground [&>button]:rounded-none",
139
139
  range_start: "[&>button]:rounded-e-none",
140
- dropdowns: "flex items-center gap-1.5 justify-center [&>select]:flex-1",
141
- dropdown: "h-7 w-[88px] rounded-md border border-[var(--hc-color-border-subtle)] bg-background px-2 text-xs font-medium text-foreground cursor-pointer outline-none accent-[var(--hc-primary-600)] focus:border-[var(--hc-primary-500)] focus:ring-[2px] focus:ring-[var(--hc-primary-500)]/20 [&>option:checked]:bg-[var(--hc-primary-600)] [&>option:checked]:text-white [&>option]:py-1",
140
+ dropdowns: "flex items-center gap-1.5 justify-center",
141
+ dropdown: "h-7 rounded-md border border-input bg-background px-2 text-xs font-medium text-foreground cursor-pointer outline-none accent-primary focus:border-ring focus:ring-[2px] focus:ring-ring/20 [&>option:checked]:bg-primary [&>option:checked]:text-primary-foreground [&>option]:py-1",
142
+ months_dropdown: "w-[104px]",
143
+ years_dropdown: "w-[72px]",
142
144
  hidden: "invisible",
143
145
  ...classNames
144
146
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/date-time-picker.tsx","../../src/lib/utils.ts","../../src/components/button.tsx","../../src/components/calendar.tsx","../../src/components/popover.tsx","../../src/components/time-picker.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { CalendarClockIcon } from \"lucide-react\"\nimport type { Matcher } from \"react-day-picker\"\nimport { cn } from \"../lib/utils\"\nimport { Button } from \"./button\"\nimport { Calendar } from \"./calendar\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\"\nimport {\n TimePickerPanel,\n buildAllowedSlots,\n buildMinuteList,\n formatTimeLabel,\n formatTimeValue,\n isTimeInRange,\n parseTimeValue,\n snapToAllowedSlot,\n type TimeValue,\n} from \"./time-picker\"\n\nfunction startOfDay(date: Date): Date {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate())\n}\n\nfunction isSameDay(a: Date, b: Date): boolean {\n return (\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate()\n )\n}\n\n/** Minutes since midnight for a Date, in local time. */\nfunction minutesOfDay(date: Date): number {\n return date.getHours() * 60 + date.getMinutes()\n}\n\n/** A new Date on `day` at `minutes` past midnight, seconds zeroed. */\nfunction withTime(day: Date, minutes: number): Date {\n return new Date(\n day.getFullYear(),\n day.getMonth(),\n day.getDate(),\n Math.floor(minutes / 60),\n minutes % 60,\n 0,\n 0\n )\n}\n\nexport interface DateTimePickerProps {\n /** The selected moment. One value covers both the date and the time. */\n value?: Date\n /**\n * Called with the new moment, or with undefined when the value is cleared.\n * Fires only on Apply — edits inside the popover are held as a draft until\n * then.\n */\n onValueChange?: (value: Date | undefined) => void\n /**\n * Earliest selectable moment. Days before it are disabled in the calendar\n * and, on the boundary day itself, the times before it are disabled too.\n */\n minDate?: Date\n /**\n * Latest selectable moment. Days after it are disabled in the calendar and,\n * on the boundary day itself, the times after it are disabled too.\n */\n maxDate?: Date\n /** Extra day matchers passed through to the underlying Calendar. */\n disabledDates?: Matcher | Matcher[]\n /** Minute granularity offered by the minute column. Defaults to 5. */\n minuteStep?: number\n /** 12 adds an AM/PM column, 24 lists hours 00-23. Defaults to 12. */\n hourCycle?: 12 | 24\n /**\n * Time applied when a date is picked before any time has been chosen, as\n * \"HH:mm\". Defaults to \"09:00\" and is moved to the nearest allowed slot when\n * the bound forbids it.\n */\n defaultTime?: TimeValue\n /** Trigger text shown when nothing is selected. */\n placeholder?: string\n /** Overrides how the selected moment is rendered on the trigger. */\n formatValue?: (value: Date) => string\n /** Shows a Clear action in the popover. Defaults to true. */\n clearable?: boolean\n /** Text of the Clear action, which empties the draft. Defaults to \"Clear\". */\n clearLabel?: string\n /** Text of the action that commits the draft. Defaults to \"Apply\". */\n applyLabel?: string\n /** Text of the action that discards the draft. Defaults to \"Cancel\". */\n cancelLabel?: string\n /** Heading above the time columns. Defaults to \"Time\". */\n timeLabel?: string\n /** Disables the whole control. */\n disabled?: boolean\n /** Accessible name for the trigger. Defaults to the placeholder. */\n \"aria-label\"?: string\n /** Id of an element that labels the trigger. */\n \"aria-labelledby\"?: string\n /** Id applied to the trigger button. */\n id?: string\n /** Name reported on a hidden input, so the value posts with a plain form. */\n name?: string\n /** Classname applied to the trigger button. */\n className?: string\n /** Classname applied to the popover content. */\n contentClassName?: string\n /** Controlled open state of the popover. */\n open?: boolean\n /** Called when the popover opens or closes. */\n onOpenChange?: (open: boolean) => void\n /** Side the popover is aligned to. Defaults to \"start\". */\n align?: \"start\" | \"center\" | \"end\"\n}\n\n/**\n * A date and a time in one popover, reporting a single Date. Drop-in\n * replacement for a native `datetime-local` input: the calendar and the time\n * columns write to the same value, and `minDate` / `maxDate` are enforced on\n * both halves, including on the boundary day where only part of the day is\n * still allowed.\n *\n * Edits are committed explicitly. Picking a day, an hour, a minute or a period\n * moves a draft held inside the popover; `onValueChange` fires once, on Apply.\n * Cancel, Escape and a click outside all discard the draft, so a stray click\n * cannot write a deadline.\n */\nconst DateTimePicker = React.forwardRef<HTMLButtonElement, DateTimePickerProps>(\n (\n {\n value,\n onValueChange,\n minDate,\n maxDate,\n disabledDates,\n minuteStep = 5,\n hourCycle = 12,\n defaultTime = \"09:00\",\n placeholder = \"Pick a date and time\",\n formatValue,\n clearable = true,\n clearLabel = \"Clear\",\n applyLabel = \"Apply\",\n cancelLabel = \"Cancel\",\n timeLabel = \"Time\",\n disabled,\n id,\n name,\n className,\n contentClassName,\n open,\n onOpenChange,\n align = \"start\",\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n },\n ref\n ) => {\n // Every interaction inside the popover edits this draft, never `value`.\n // The trigger keeps showing `value`, so an uncommitted edit can never be\n // mistaken for a saved one.\n const [draft, setDraft] = React.useState<Date | undefined>(value)\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(false)\n const isOpen = open ?? uncontrolledOpen\n\n // Opening re-seeds the draft. The effect covers a controlled consumer that\n // flips `open` itself, which never reaches our onOpenChange handler.\n const wasOpen = React.useRef(isOpen)\n React.useEffect(() => {\n if (isOpen && !wasOpen.current) setDraft(value)\n wasOpen.current = isOpen\n }, [isOpen, value])\n\n const setOpenState = (next: boolean) => {\n if (open === undefined) setUncontrolledOpen(next)\n onOpenChange?.(next)\n }\n\n // The trigger, Escape and a click outside all land here. None of them\n // commits: the draft goes back to `value` whichever way the popover moves.\n const handleOpenChange = (next: boolean) => {\n setDraft(value)\n setOpenState(next)\n }\n\n const handleCancel = () => {\n setDraft(value)\n setOpenState(false)\n }\n\n // The one path that reports to the consumer, including the undefined left\n // behind by Clear.\n const handleApply = () => {\n onValueChange?.(draft)\n setOpenState(false)\n }\n\n // The day the time columns are bound against. Without a draft yet that is\n // today, pulled inside the allowed range so the columns are usable.\n const activeDay = React.useMemo(() => {\n if (draft) return startOfDay(draft)\n const today = startOfDay(new Date())\n if (minDate && today < startOfDay(minDate)) return startOfDay(minDate)\n if (maxDate && today > startOfDay(maxDate)) return startOfDay(maxDate)\n return today\n }, [draft, minDate, maxDate])\n\n /** The time window still open on a given day, once the bound is applied. */\n const timeWindowFor = React.useCallback(\n (day: Date): { minTime?: TimeValue; maxTime?: TimeValue } => ({\n minTime:\n minDate && isSameDay(day, minDate)\n ? formatTimeValue(minutesOfDay(minDate))\n : undefined,\n maxTime:\n maxDate && isSameDay(day, maxDate)\n ? formatTimeValue(minutesOfDay(maxDate))\n : undefined,\n }),\n [minDate, maxDate]\n )\n\n const activeWindow = timeWindowFor(activeDay)\n\n // The year dropdown follows the bound rather than Calendar's generic\n // default: with minDate set to now, a deadline picker offering 2016 would\n // be offering years every one of whose days it then refuses.\n const calendarStartMonth = React.useMemo(\n () => (minDate ? new Date(minDate.getFullYear(), minDate.getMonth(), 1) : undefined),\n [minDate],\n )\n const calendarEndMonth = React.useMemo(\n () => (maxDate ? new Date(maxDate.getFullYear(), maxDate.getMonth(), 1) : undefined),\n [maxDate],\n )\n\n const calendarDisabled = React.useMemo(() => {\n const matchers: Matcher[] = []\n if (minDate) matchers.push({ before: startOfDay(minDate) })\n if (maxDate) matchers.push({ after: startOfDay(maxDate) })\n if (Array.isArray(disabledDates)) matchers.push(...disabledDates)\n else if (disabledDates !== undefined) matchers.push(disabledDates)\n return matchers\n }, [minDate, maxDate, disabledDates])\n\n const handleDaySelect = (day: Date | undefined) => {\n // Clicking the selected day again deselects in react-day-picker. A\n // deadline should not disappear by accident, so Clear is the only way out.\n if (!day) return\n const desired = draft ? minutesOfDay(draft) : (parseTimeValue(defaultTime) ?? 0)\n const { minTime, maxTime } = timeWindowFor(day)\n const min = parseTimeValue(minTime)\n const max = parseTimeValue(maxTime)\n if (isTimeInRange(desired, min, max)) {\n setDraft(withTime(day, desired))\n return\n }\n const snapped = snapToAllowedSlot(\n desired,\n buildAllowedSlots(buildMinuteList(minuteStep, desired % 60), min, max)\n )\n if (snapped === undefined) return\n setDraft(withTime(day, snapped))\n }\n\n const handleTimeChange = (next: TimeValue) => {\n const minutes = parseTimeValue(next)\n if (minutes === undefined) return\n setDraft(withTime(draft ?? activeDay, minutes))\n }\n\n const label = value\n ? (formatValue?.(value) ??\n `${value.toLocaleDateString()} ${formatTimeLabel(minutesOfDay(value), hourCycle)}`)\n : placeholder\n\n return (\n <Popover open={isOpen} onOpenChange={handleOpenChange}>\n <PopoverTrigger asChild>\n <Button\n ref={ref}\n id={id}\n type=\"button\"\n variant=\"outline\"\n disabled={disabled}\n aria-label={ariaLabelledBy ? undefined : (ariaLabel ?? placeholder)}\n aria-labelledby={ariaLabelledBy}\n className={cn(\n \"w-[280px] justify-start text-left font-normal\",\n !value && \"text-muted-foreground\",\n className\n )}\n >\n <CalendarClockIcon className=\"me-2 h-4 w-4\" aria-hidden=\"true\" />\n {label}\n </Button>\n </PopoverTrigger>\n <PopoverContent\n className={cn(\"w-auto p-0\", contentClassName)}\n align={align}\n aria-label={ariaLabel ?? placeholder}\n >\n <div className=\"flex flex-col sm:flex-row sm:items-start sm:divide-x sm:divide-border\">\n <Calendar\n mode=\"single\"\n selected={draft}\n defaultMonth={activeDay}\n startMonth={calendarStartMonth}\n endMonth={calendarEndMonth}\n onSelect={handleDaySelect}\n disabled={calendarDisabled}\n // Focus moves into the calendar the user just opened (keyboard navigation).\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus\n />\n <div className=\"border-t border-border p-2 sm:border-t-0\">\n <div className=\"px-1 pb-1 text-xs font-medium uppercase tracking-wider text-muted-foreground\">\n {timeLabel}\n </div>\n <TimePickerPanel\n value={draft ? formatTimeValue(minutesOfDay(draft)) : undefined}\n onValueChange={handleTimeChange}\n minTime={activeWindow.minTime}\n maxTime={activeWindow.maxTime}\n minuteStep={minuteStep}\n hourCycle={hourCycle}\n />\n </div>\n </div>\n <div className=\"flex items-center gap-2 border-t border-border p-2\">\n {clearable && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"font-normal\"\n disabled={!draft}\n onClick={() => setDraft(undefined)}\n >\n {clearLabel}\n </Button>\n )}\n <div className=\"ms-auto flex items-center gap-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"font-normal\"\n onClick={handleCancel}\n >\n {cancelLabel}\n </Button>\n <Button type=\"button\" variant=\"default\" size=\"sm\" onClick={handleApply}>\n {applyLabel}\n </Button>\n </div>\n </div>\n </PopoverContent>\n {name && (\n <input\n type=\"hidden\"\n name={name}\n value={\n value\n ? `${value.getFullYear()}-${String(value.getMonth() + 1).padStart(2, \"0\")}-${String(\n value.getDate()\n ).padStart(2, \"0\")}T${formatTimeValue(minutesOfDay(value))}`\n : \"\"\n }\n />\n )}\n </Popover>\n )\n }\n)\nDateTimePicker.displayName = \"DateTimePicker\"\n\nexport { DateTimePicker }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","\nimport * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Loader2 } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground hover:bg-primary-hover\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive-hover\",\n outline:\n \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary-hover\",\n ghost:\n \"hover:bg-accent hover:text-accent-foreground\",\n link:\n \"text-primary underline-offset-4 hover:underline\",\n success:\n \"bg-success text-success-foreground hover:bg-success-hover\",\n },\n size: {\n xs: \"h-7 px-2.5 text-xs\",\n sm: \"h-9 px-3\",\n default: \"h-10 px-4 py-2\",\n lg: \"h-11 px-8\",\n icon: \"h-10 w-10\",\n \"icon-sm\": \"h-8 w-8\",\n },\n shape: {\n default: \"rounded-md\",\n rounded: \"rounded-lg\",\n pill: \"rounded-full\",\n square: \"rounded-none\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n shape: \"default\",\n },\n }\n)\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean\n loading?: boolean\n prefixIcon?: React.ReactNode\n suffixIcon?: React.ReactNode\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n size,\n shape,\n asChild = false,\n loading = false,\n prefixIcon,\n suffixIcon,\n children,\n disabled,\n ...props\n },\n ref\n ) => {\n const Comp = asChild ? Slot : \"button\"\n const isDisabled = disabled || loading\n\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, shape, className }))}\n ref={ref}\n disabled={isDisabled}\n {...props}\n >\n {loading && <Loader2 className=\"animate-spin\" />}\n {!loading && prefixIcon}\n {children}\n {suffixIcon}\n </Comp>\n )\n }\n)\nButton.displayName = \"Button\"\n\nexport { Button, buttonVariants }\n","import * as React from \"react\"\nimport { DayPicker } from \"react-day-picker\"\nimport { ChevronLeft, ChevronRight } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>\n\n/**\n * How far the year dropdown reaches when the caller gives no bounds.\n *\n * `captionLayout` defaults to \"dropdown\" here, and react-day-picker then falls\n * back to [currentYear - 100, currentYear] for the year list. That is wrong in\n * both directions: a hundred dead years to scroll past, and no future year at\n * all - a deadline could not be set beyond December of the current year.\n * Callers that know their range pass `startMonth` / `endMonth` and these are\n * not used.\n */\nconst DEFAULT_YEARS_BACK = 10\nconst DEFAULT_YEARS_FORWARD = 10\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = \"dropdown\",\n startMonth,\n endMonth,\n ...props\n}: CalendarProps) {\n const now = new Date()\n const defaultedStartMonth =\n startMonth ?? new Date(now.getFullYear() - DEFAULT_YEARS_BACK, 0, 1)\n const defaultedEndMonth =\n endMonth ?? new Date(now.getFullYear() + DEFAULT_YEARS_FORWARD, 11, 1)\n\n return (\n <DayPicker\n startMonth={defaultedStartMonth}\n endMonth={defaultedEndMonth}\n showOutsideDays={showOutsideDays}\n className={cn(\"w-[260px] rounded-lg p-3\", className)}\n classNames={{\n months: \"flex flex-col\",\n month: \"space-y-3\",\n month_caption: \"relative flex h-8 items-center justify-center\",\n caption_label: \"text-sm font-medium hidden\",\n nav: \"flex items-center\",\n button_previous: cn(\n \"absolute start-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-[var(--hc-color-border-subtle)] hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n button_next: cn(\n \"absolute end-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-[var(--hc-color-border-subtle)] hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n month_grid: \"w-full border-collapse\",\n weekdays: \"flex w-full\",\n weekday:\n \"flex-1 h-8 flex items-center justify-center text-[11px] font-medium text-muted-foreground uppercase tracking-wider\",\n week: \"flex w-full mt-1\",\n day: \"flex-1 h-8 p-0 relative focus-within:z-20 flex items-center justify-center text-sm\",\n day_button: cn(\n \"inline-flex size-8 items-center justify-center rounded-md bg-transparent text-sm font-normal cursor-pointer border-none hover:bg-[var(--hc-color-border-subtle)] transition-colors\"\n ),\n range_end: \"day-range-end\",\n selected:\n \"[&>button]:bg-[var(--hc-primary-600)] [&>button]:text-white [&>button]:hover:bg-[var(--hc-primary-600)] [&>button]:hover:text-white [&>button]:font-medium\",\n today: \"[&>button]:font-semibold [&>button]:text-[var(--hc-primary-600)]\",\n outside:\n \"day-outside [&>button]:bg-transparent [&>button]:text-[var(--hc-grey-200)]\",\n disabled: \"[&>button]:text-[var(--hc-grey-200)] [&>button]:opacity-50 [&>button]:cursor-default\",\n range_middle:\n \"[&>button]:bg-[var(--hc-primary-100)] [&>button]:text-foreground [&>button]:rounded-none\",\n range_start: \"[&>button]:rounded-e-none\",\n dropdowns: \"flex items-center gap-1.5 justify-center [&>select]:flex-1\",\n dropdown:\n \"h-7 w-[88px] rounded-md border border-[var(--hc-color-border-subtle)] bg-background px-2 text-xs font-medium text-foreground cursor-pointer outline-none accent-[var(--hc-primary-600)] focus:border-[var(--hc-primary-500)] focus:ring-[2px] focus:ring-[var(--hc-primary-500)]/20 [&>option:checked]:bg-[var(--hc-primary-600)] [&>option:checked]:text-white [&>option]:py-1\",\n hidden: \"invisible\",\n ...classNames,\n }}\n captionLayout={captionLayout}\n components={{\n Chevron: ({ orientation }) => {\n const Icon = orientation === \"left\" ? ChevronLeft : ChevronRight\n return <Icon className=\"size-4\" />\n },\n }}\n {...props}\n />\n )\n}\nCalendar.displayName = \"Calendar\"\n\nexport { Calendar }\n","import * as React from \"react\"\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\"\nimport { cn } from \"../lib/utils\"\n\nconst Popover = PopoverPrimitive.Root\nconst PopoverTrigger = PopoverPrimitive.Trigger\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n))\nPopoverContent.displayName = PopoverPrimitive.Content.displayName\n\nexport { Popover, PopoverTrigger, PopoverContent }\n","import * as React from \"react\"\nimport { ClockIcon } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\nimport { Button } from \"./button\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\"\n\n/** Matches a 24-hour clock time, \"HH:mm\". */\nconst TIME_VALUE_PATTERN = /^([01]\\d|2[0-3]):([0-5]\\d)$/\n\nconst MINUTES_PER_DAY = 24 * 60\nconst NOON = 12 * 60\n\n/** A 24-hour clock time such as \"09:00\" or \"17:30\". */\nexport type TimeValue = string\n\ntype Period = \"AM\" | \"PM\"\n\nfunction pad2(value: number): string {\n return value.toString().padStart(2, \"0\")\n}\n\n/**\n * Turns a \"HH:mm\" string into minutes since midnight. Returns undefined for\n * anything that is not a valid 24-hour time, so a bad prop degrades to\n * \"nothing selected\" rather than throwing inside a render.\n */\nfunction parseTimeValue(value?: string | null): number | undefined {\n if (!value) return undefined\n const match = TIME_VALUE_PATTERN.exec(value.trim())\n if (!match) return undefined\n return Number(match[1]) * 60 + Number(match[2])\n}\n\n/** Turns minutes since midnight back into the canonical \"HH:mm\" string. */\nfunction formatTimeValue(minutesOfDay: number): string {\n const normalised = ((minutesOfDay % MINUTES_PER_DAY) + MINUTES_PER_DAY) % MINUTES_PER_DAY\n return `${pad2(Math.floor(normalised / 60))}:${pad2(normalised % 60)}`\n}\n\n/** Human-readable time, either \"17:30\" or \"05:30 PM\" depending on the cycle. */\nfunction formatTimeLabel(minutesOfDay: number, hourCycle: 12 | 24): string {\n const normalised = ((minutesOfDay % MINUTES_PER_DAY) + MINUTES_PER_DAY) % MINUTES_PER_DAY\n const hours = Math.floor(normalised / 60)\n const minutes = normalised % 60\n if (hourCycle === 24) return `${pad2(hours)}:${pad2(minutes)}`\n const period: Period = hours < NOON / 60 ? \"AM\" : \"PM\"\n const hour12 = hours % 12 === 0 ? 12 : hours % 12\n return `${pad2(hour12)}:${pad2(minutes)} ${period}`\n}\n\nfunction isTimeInRange(minutesOfDay: number, min?: number, max?: number): boolean {\n if (min !== undefined && minutesOfDay < min) return false\n if (max !== undefined && minutesOfDay > max) return false\n return true\n}\n\n/** The hour a 12-hour-cycle cell stands for once its period is applied. */\nfunction to24Hour(hour12: number, period: Period): number {\n const base = hour12 % 12\n return period === \"AM\" ? base : base + 12\n}\n\n/**\n * The minute offsets the minute column offers. `extra` keeps a value that does\n * not sit on the step grid visible — a consumer may hand us \"14:07\" with a\n * 5-minute step and we must not silently fail to reflect it.\n */\nfunction buildMinuteList(minuteStep: number, extra?: number): number[] {\n const step = Number.isFinite(minuteStep) ? Math.min(60, Math.max(1, Math.floor(minuteStep))) : 5\n const minutes: number[] = []\n for (let minute = 0; minute < 60; minute += step) minutes.push(minute)\n if (extra !== undefined && extra >= 0 && extra < 60 && !minutes.includes(extra)) {\n minutes.push(extra)\n minutes.sort((a, b) => a - b)\n }\n return minutes\n}\n\n/** Every selectable slot of the day that the bound allows, ascending. */\nfunction buildAllowedSlots(minutes: number[], min?: number, max?: number): number[] {\n const slots: number[] = []\n for (let hour = 0; hour < 24; hour += 1) {\n for (const minute of minutes) {\n const slot = hour * 60 + minute\n if (isTimeInRange(slot, min, max)) slots.push(slot)\n }\n }\n return slots\n}\n\n/**\n * The allowed slot closest to `desired`, preferring one at or after it, so a\n * time that has fallen outside the bound moves forward to the next legal slot\n * instead of backwards.\n */\nfunction snapToAllowedSlot(desired: number, allowedSlots: number[]): number | undefined {\n if (allowedSlots.length === 0) return undefined\n let best = allowedSlots[0]\n let bestScore = Number.POSITIVE_INFINITY\n for (const slot of allowedSlots) {\n const score = slot >= desired ? slot - desired : desired - slot + MINUTES_PER_DAY\n if (score < bestScore) {\n bestScore = score\n best = slot\n }\n }\n return best\n}\n\nconst columnClasses =\n \"flex max-h-[216px] w-16 flex-col gap-1 overflow-y-auto overscroll-contain p-1\"\n\nconst cellClasses =\n \"shrink-0 rounded-md px-2 py-1.5 text-sm font-normal text-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-pressed:bg-primary aria-pressed:font-medium aria-pressed:text-primary-foreground aria-pressed:hover:bg-primary aria-pressed:hover:text-primary-foreground disabled:pointer-events-none disabled:text-muted-foreground disabled:opacity-50\"\n\ninterface TimeCellProps {\n label: string\n accessibleName: string\n pressed: boolean\n disabled: boolean\n onSelect: () => void\n}\n\nfunction TimeCell({ label, accessibleName, pressed, disabled, onSelect }: TimeCellProps) {\n return (\n <button\n type=\"button\"\n aria-label={accessibleName}\n aria-pressed={pressed}\n disabled={disabled}\n onClick={onSelect}\n className={cn(cellClasses)}\n >\n {label}\n </button>\n )\n}\n\nexport interface TimePickerPanelProps {\n /** Selected time as a 24-hour \"HH:mm\" string. */\n value?: TimeValue\n /** Called with the newly selected 24-hour \"HH:mm\" string. */\n onValueChange?: (value: TimeValue) => void\n /** Earliest selectable time as \"HH:mm\". Earlier times are disabled. */\n minTime?: TimeValue\n /** Latest selectable time as \"HH:mm\". Later times are disabled. */\n maxTime?: TimeValue\n /** Minute granularity offered by the minute column. Defaults to 5. */\n minuteStep?: number\n /** 12 adds an AM/PM column, 24 lists hours 00-23. Defaults to 12. */\n hourCycle?: 12 | 24\n /** Accessible name for the hour column. Defaults to \"Hour\". */\n hourLabel?: string\n /** Accessible name for the minute column. Defaults to \"Minute\". */\n minuteLabel?: string\n /** Accessible name for the AM/PM column. Defaults to \"Period\". */\n periodLabel?: string\n /** Classname applied to the panel wrapper. */\n className?: string\n}\n\n/**\n * The bare hour/minute columns, without a popover around them. Used by\n * TimePicker and by DateTimePicker, which supplies its own popover.\n */\nfunction TimePickerPanel({\n value,\n onValueChange,\n minTime,\n maxTime,\n minuteStep = 5,\n hourCycle = 12,\n hourLabel = \"Hour\",\n minuteLabel = \"Minute\",\n periodLabel = \"Period\",\n className,\n}: TimePickerPanelProps) {\n const minMinutes = parseTimeValue(minTime)\n const maxMinutes = parseTimeValue(maxTime)\n const selected = parseTimeValue(value)\n\n const minuteList = React.useMemo(\n () => buildMinuteList(minuteStep, selected === undefined ? undefined : selected % 60),\n [minuteStep, selected]\n )\n const allowedSlots = React.useMemo(\n () => buildAllowedSlots(minuteList, minMinutes, maxMinutes),\n [minuteList, minMinutes, maxMinutes]\n )\n\n // Each click reports a complete time, so with nothing selected yet the\n // columns work against the first slot the bound allows.\n const active = selected ?? allowedSlots[0]\n const activeHour = active === undefined ? undefined : Math.floor(active / 60)\n const activeMinute = active === undefined ? undefined : active % 60\n const activePeriod: Period =\n activeHour !== undefined && activeHour >= 12 ? \"PM\" : \"AM\"\n\n const hourHasSlot = (hour: number) =>\n allowedSlots.some((slot) => Math.floor(slot / 60) === hour)\n const firstSlotInHour = (hour: number) =>\n allowedSlots.find((slot) => Math.floor(slot / 60) === hour)\n const periodHasSlot = (period: Period) =>\n allowedSlots.some((slot) => (slot < NOON ? \"AM\" : \"PM\") === period)\n const firstSlotInPeriod = (period: Period) =>\n allowedSlots.find((slot) => (slot < NOON ? \"AM\" : \"PM\") === period)\n\n const commit = (minutesOfDay: number | undefined) => {\n if (minutesOfDay === undefined) return\n onValueChange?.(formatTimeValue(minutesOfDay))\n }\n\n const selectHour = (hour: number) => {\n const desired = hour * 60 + (activeMinute ?? 0)\n commit(isTimeInRange(desired, minMinutes, maxMinutes) ? desired : firstSlotInHour(hour))\n }\n\n const selectMinute = (minute: number) => {\n if (activeHour === undefined) return\n commit(activeHour * 60 + minute)\n }\n\n const selectPeriod = (period: Period) => {\n if (activeHour === undefined || activeMinute === undefined) {\n commit(firstSlotInPeriod(period))\n return\n }\n const hour12 = activeHour % 12 === 0 ? 12 : activeHour % 12\n const desired = to24Hour(hour12, period) * 60 + activeMinute\n commit(\n isTimeInRange(desired, minMinutes, maxMinutes) ? desired : firstSlotInPeriod(period)\n )\n }\n\n const hourCells =\n hourCycle === 24\n ? Array.from({ length: 24 }, (_, hour) => hour)\n : [12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\n\n return (\n <div className={cn(\"flex items-start divide-x divide-border\", className)}>\n <div className={cn(columnClasses)} role=\"group\" aria-label={hourLabel}>\n {hourCells.map((cell) => {\n const hour = hourCycle === 24 ? cell : to24Hour(cell, activePeriod)\n const label = pad2(cell)\n return (\n <TimeCell\n key={`hour-${cell}`}\n label={label}\n accessibleName={`${hourLabel} ${label}`}\n pressed={activeHour === hour && selected !== undefined}\n disabled={!hourHasSlot(hour)}\n onSelect={() => selectHour(hour)}\n />\n )\n })}\n </div>\n <div className={cn(columnClasses)} role=\"group\" aria-label={minuteLabel}>\n {minuteList.map((minute) => {\n const label = pad2(minute)\n const disabled =\n activeHour === undefined ||\n !isTimeInRange(activeHour * 60 + minute, minMinutes, maxMinutes)\n return (\n <TimeCell\n key={`minute-${minute}`}\n label={label}\n accessibleName={`${minuteLabel} ${label}`}\n pressed={activeMinute === minute && selected !== undefined}\n disabled={disabled}\n onSelect={() => selectMinute(minute)}\n />\n )\n })}\n </div>\n {hourCycle === 12 && (\n <div className={cn(columnClasses)} role=\"group\" aria-label={periodLabel}>\n {([\"AM\", \"PM\"] as Period[]).map((period) => (\n <TimeCell\n key={period}\n label={period}\n accessibleName={period}\n pressed={activePeriod === period && selected !== undefined}\n disabled={!periodHasSlot(period)}\n onSelect={() => selectPeriod(period)}\n />\n ))}\n </div>\n )}\n </div>\n )\n}\nTimePickerPanel.displayName = \"TimePickerPanel\"\n\nexport interface TimePickerProps {\n /** Selected time as a 24-hour \"HH:mm\" string. */\n value?: TimeValue\n /** Called with the new time, or with undefined when the value is cleared. */\n onValueChange?: (value: TimeValue | undefined) => void\n /** Earliest selectable time as \"HH:mm\". Earlier times are disabled. */\n minTime?: TimeValue\n /** Latest selectable time as \"HH:mm\". Later times are disabled. */\n maxTime?: TimeValue\n /** Minute granularity offered by the minute column. Defaults to 5. */\n minuteStep?: number\n /** 12 adds an AM/PM column, 24 lists hours 00-23. Defaults to 12. */\n hourCycle?: 12 | 24\n /** Trigger text shown when nothing is selected. */\n placeholder?: string\n /** Shows a Clear action in the popover. Defaults to true. */\n clearable?: boolean\n /** Text of the Clear action. Defaults to \"Clear\". */\n clearLabel?: string\n /** Disables the whole control. */\n disabled?: boolean\n /** Accessible name for the trigger. Defaults to the placeholder. */\n \"aria-label\"?: string\n /** Id of an element that labels the trigger. */\n \"aria-labelledby\"?: string\n /** Id applied to the trigger button. */\n id?: string\n /** Name reported on a hidden input, so the value posts with a plain form. */\n name?: string\n /** Classname applied to the trigger button. */\n className?: string\n /** Classname applied to the popover content. */\n contentClassName?: string\n /** Controlled open state of the popover. */\n open?: boolean\n /** Called when the popover opens or closes. */\n onOpenChange?: (open: boolean) => void\n /** Side the popover is aligned to. Defaults to \"start\". */\n align?: \"start\" | \"center\" | \"end\"\n}\n\n/**\n * A time control: a popover trigger showing the selected time, over hour and\n * minute columns. The value is always a 24-hour \"HH:mm\" string, so it survives\n * a round trip through JSON and through a `datetime-local`-shaped API.\n */\nconst TimePicker = React.forwardRef<HTMLButtonElement, TimePickerProps>(\n (\n {\n value,\n onValueChange,\n minTime,\n maxTime,\n minuteStep = 5,\n hourCycle = 12,\n placeholder = \"Pick a time\",\n clearable = true,\n clearLabel = \"Clear\",\n disabled,\n id,\n name,\n className,\n contentClassName,\n open,\n onOpenChange,\n align = \"start\",\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n },\n ref\n ) => {\n const selected = parseTimeValue(value)\n const label =\n selected === undefined ? placeholder : formatTimeLabel(selected, hourCycle)\n\n return (\n <Popover open={open} onOpenChange={onOpenChange}>\n <PopoverTrigger asChild>\n <Button\n ref={ref}\n id={id}\n type=\"button\"\n variant=\"outline\"\n disabled={disabled}\n aria-label={ariaLabelledBy ? undefined : (ariaLabel ?? placeholder)}\n aria-labelledby={ariaLabelledBy}\n className={cn(\n \"w-[180px] justify-start text-left font-normal\",\n selected === undefined && \"text-muted-foreground\",\n className\n )}\n >\n <ClockIcon className=\"me-2 h-4 w-4\" aria-hidden=\"true\" />\n {label}\n </Button>\n </PopoverTrigger>\n <PopoverContent\n className={cn(\"w-auto p-0\", contentClassName)}\n align={align}\n aria-label={ariaLabel ?? placeholder}\n >\n <TimePickerPanel\n value={value}\n onValueChange={(next) => onValueChange?.(next)}\n minTime={minTime}\n maxTime={maxTime}\n minuteStep={minuteStep}\n hourCycle={hourCycle}\n />\n {clearable && (\n <div className=\"flex justify-end border-t border-border p-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"font-normal\"\n disabled={selected === undefined}\n onClick={() => onValueChange?.(undefined)}\n >\n {clearLabel}\n </Button>\n </div>\n )}\n </PopoverContent>\n {name && <input type=\"hidden\" name={name} value={value ?? \"\"} />}\n </Popover>\n )\n }\n)\nTimePicker.displayName = \"TimePicker\"\n\nexport {\n TimePicker,\n TimePickerPanel,\n formatTimeLabel,\n formatTimeValue,\n parseTimeValue,\n isTimeInRange,\n buildMinuteList,\n buildAllowedSlots,\n snapToAllowedSlot,\n}\n"],"mappings":";AAAA,YAAYA,YAAW;AACvB,SAAS,yBAAyB;;;ACDlC,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACJA,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,WAA8B;AACvC,SAAS,eAAe;AA4ElB,SAMc,KANd;AAzEN,IAAM,iBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,WACE;AAAA,QACF,OACE;AAAA,QACF,MACE;AAAA,QACF,SACE;AAAA,MACJ;AAAA,MACA,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,WAAW;AAAA,MACb;AAAA,MACA,OAAO;AAAA,QACL,SAAS;AAAA,QACT,SAAS;AAAA,QACT,MAAM;AAAA,QACN,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,EACF;AACF;AAWA,IAAM,SAAe;AAAA,EACnB,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GACA,QACG;AACH,UAAM,OAAO,UAAU,OAAO;AAC9B,UAAM,aAAa,YAAY;AAE/B,WACE;AAAA,M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SAAS,IAAI,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI;AAAA,YACzE,MAAM,QAAQ;AAAA,UAChB,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,gBAAgB,aAAa,KAAK,CAAC,CAAC,KAC1D;AAAA;AAAA,MAER;AAAA,OAEJ;AAAA,EAEJ;AACF;AACA,eAAe,cAAc;","names":["React","jsx","React","jsx","React","jsx","jsxs","minutesOfDay","jsx","jsxs"]}
1
+ {"version":3,"sources":["../../src/components/date-time-picker.tsx","../../src/lib/utils.ts","../../src/components/button.tsx","../../src/components/calendar.tsx","../../src/components/popover.tsx","../../src/components/time-picker.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { CalendarClockIcon } from \"lucide-react\"\nimport type { Matcher } from \"react-day-picker\"\nimport { cn } from \"../lib/utils\"\nimport { Button } from \"./button\"\nimport { Calendar } from \"./calendar\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\"\nimport {\n TimePickerPanel,\n buildAllowedSlots,\n buildMinuteList,\n formatTimeLabel,\n formatTimeValue,\n isTimeInRange,\n parseTimeValue,\n snapToAllowedSlot,\n type TimeValue,\n} from \"./time-picker\"\n\nfunction startOfDay(date: Date): Date {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate())\n}\n\nfunction isSameDay(a: Date, b: Date): boolean {\n return (\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate()\n )\n}\n\n/** Minutes since midnight for a Date, in local time. */\nfunction minutesOfDay(date: Date): number {\n return date.getHours() * 60 + date.getMinutes()\n}\n\n/** A new Date on `day` at `minutes` past midnight, seconds zeroed. */\nfunction withTime(day: Date, minutes: number): Date {\n return new Date(\n day.getFullYear(),\n day.getMonth(),\n day.getDate(),\n Math.floor(minutes / 60),\n minutes % 60,\n 0,\n 0\n )\n}\n\nexport interface DateTimePickerProps {\n /** The selected moment. One value covers both the date and the time. */\n value?: Date\n /**\n * Called with the new moment, or with undefined when the value is cleared.\n * Fires only on Apply — edits inside the popover are held as a draft until\n * then.\n */\n onValueChange?: (value: Date | undefined) => void\n /**\n * Earliest selectable moment. Days before it are disabled in the calendar\n * and, on the boundary day itself, the times before it are disabled too.\n */\n minDate?: Date\n /**\n * Latest selectable moment. Days after it are disabled in the calendar and,\n * on the boundary day itself, the times after it are disabled too.\n */\n maxDate?: Date\n /** Extra day matchers passed through to the underlying Calendar. */\n disabledDates?: Matcher | Matcher[]\n /** Minute granularity offered by the minute column. Defaults to 5. */\n minuteStep?: number\n /** 12 adds an AM/PM column, 24 lists hours 00-23. Defaults to 12. */\n hourCycle?: 12 | 24\n /**\n * Time applied when a date is picked before any time has been chosen, as\n * \"HH:mm\". Defaults to \"09:00\" and is moved to the nearest allowed slot when\n * the bound forbids it.\n */\n defaultTime?: TimeValue\n /** Trigger text shown when nothing is selected. */\n placeholder?: string\n /** Overrides how the selected moment is rendered on the trigger. */\n formatValue?: (value: Date) => string\n /** Shows a Clear action in the popover. Defaults to true. */\n clearable?: boolean\n /** Text of the Clear action, which empties the draft. Defaults to \"Clear\". */\n clearLabel?: string\n /** Text of the action that commits the draft. Defaults to \"Apply\". */\n applyLabel?: string\n /** Text of the action that discards the draft. Defaults to \"Cancel\". */\n cancelLabel?: string\n /** Heading above the time columns. Defaults to \"Time\". */\n timeLabel?: string\n /** Disables the whole control. */\n disabled?: boolean\n /** Accessible name for the trigger. Defaults to the placeholder. */\n \"aria-label\"?: string\n /** Id of an element that labels the trigger. */\n \"aria-labelledby\"?: string\n /** Id applied to the trigger button. */\n id?: string\n /** Name reported on a hidden input, so the value posts with a plain form. */\n name?: string\n /** Classname applied to the trigger button. */\n className?: string\n /** Classname applied to the popover content. */\n contentClassName?: string\n /** Controlled open state of the popover. */\n open?: boolean\n /** Called when the popover opens or closes. */\n onOpenChange?: (open: boolean) => void\n /** Side the popover is aligned to. Defaults to \"start\". */\n align?: \"start\" | \"center\" | \"end\"\n}\n\n/**\n * A date and a time in one popover, reporting a single Date. Drop-in\n * replacement for a native `datetime-local` input: the calendar and the time\n * columns write to the same value, and `minDate` / `maxDate` are enforced on\n * both halves, including on the boundary day where only part of the day is\n * still allowed.\n *\n * Edits are committed explicitly. Picking a day, an hour, a minute or a period\n * moves a draft held inside the popover; `onValueChange` fires once, on Apply.\n * Cancel, Escape and a click outside all discard the draft, so a stray click\n * cannot write a deadline.\n */\nconst DateTimePicker = React.forwardRef<HTMLButtonElement, DateTimePickerProps>(\n (\n {\n value,\n onValueChange,\n minDate,\n maxDate,\n disabledDates,\n minuteStep = 5,\n hourCycle = 12,\n defaultTime = \"09:00\",\n placeholder = \"Pick a date and time\",\n formatValue,\n clearable = true,\n clearLabel = \"Clear\",\n applyLabel = \"Apply\",\n cancelLabel = \"Cancel\",\n timeLabel = \"Time\",\n disabled,\n id,\n name,\n className,\n contentClassName,\n open,\n onOpenChange,\n align = \"start\",\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n },\n ref\n ) => {\n // Every interaction inside the popover edits this draft, never `value`.\n // The trigger keeps showing `value`, so an uncommitted edit can never be\n // mistaken for a saved one.\n const [draft, setDraft] = React.useState<Date | undefined>(value)\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(false)\n const isOpen = open ?? uncontrolledOpen\n\n // Opening re-seeds the draft. The effect covers a controlled consumer that\n // flips `open` itself, which never reaches our onOpenChange handler.\n const wasOpen = React.useRef(isOpen)\n React.useEffect(() => {\n if (isOpen && !wasOpen.current) setDraft(value)\n wasOpen.current = isOpen\n }, [isOpen, value])\n\n const setOpenState = (next: boolean) => {\n if (open === undefined) setUncontrolledOpen(next)\n onOpenChange?.(next)\n }\n\n // The trigger, Escape and a click outside all land here. None of them\n // commits: the draft goes back to `value` whichever way the popover moves.\n const handleOpenChange = (next: boolean) => {\n setDraft(value)\n setOpenState(next)\n }\n\n const handleCancel = () => {\n setDraft(value)\n setOpenState(false)\n }\n\n // The one path that reports to the consumer, including the undefined left\n // behind by Clear.\n const handleApply = () => {\n onValueChange?.(draft)\n setOpenState(false)\n }\n\n // The day the time columns are bound against. Without a draft yet that is\n // today, pulled inside the allowed range so the columns are usable.\n const activeDay = React.useMemo(() => {\n if (draft) return startOfDay(draft)\n const today = startOfDay(new Date())\n if (minDate && today < startOfDay(minDate)) return startOfDay(minDate)\n if (maxDate && today > startOfDay(maxDate)) return startOfDay(maxDate)\n return today\n }, [draft, minDate, maxDate])\n\n /** The time window still open on a given day, once the bound is applied. */\n const timeWindowFor = React.useCallback(\n (day: Date): { minTime?: TimeValue; maxTime?: TimeValue } => ({\n minTime:\n minDate && isSameDay(day, minDate)\n ? formatTimeValue(minutesOfDay(minDate))\n : undefined,\n maxTime:\n maxDate && isSameDay(day, maxDate)\n ? formatTimeValue(minutesOfDay(maxDate))\n : undefined,\n }),\n [minDate, maxDate]\n )\n\n const activeWindow = timeWindowFor(activeDay)\n\n // The year dropdown follows the bound rather than Calendar's generic\n // default: with minDate set to now, a deadline picker offering 2016 would\n // be offering years every one of whose days it then refuses.\n const calendarStartMonth = React.useMemo(\n () => (minDate ? new Date(minDate.getFullYear(), minDate.getMonth(), 1) : undefined),\n [minDate],\n )\n const calendarEndMonth = React.useMemo(\n () => (maxDate ? new Date(maxDate.getFullYear(), maxDate.getMonth(), 1) : undefined),\n [maxDate],\n )\n\n const calendarDisabled = React.useMemo(() => {\n const matchers: Matcher[] = []\n if (minDate) matchers.push({ before: startOfDay(minDate) })\n if (maxDate) matchers.push({ after: startOfDay(maxDate) })\n if (Array.isArray(disabledDates)) matchers.push(...disabledDates)\n else if (disabledDates !== undefined) matchers.push(disabledDates)\n return matchers\n }, [minDate, maxDate, disabledDates])\n\n const handleDaySelect = (day: Date | undefined) => {\n // Clicking the selected day again deselects in react-day-picker. A\n // deadline should not disappear by accident, so Clear is the only way out.\n if (!day) return\n const desired = draft ? minutesOfDay(draft) : (parseTimeValue(defaultTime) ?? 0)\n const { minTime, maxTime } = timeWindowFor(day)\n const min = parseTimeValue(minTime)\n const max = parseTimeValue(maxTime)\n if (isTimeInRange(desired, min, max)) {\n setDraft(withTime(day, desired))\n return\n }\n const snapped = snapToAllowedSlot(\n desired,\n buildAllowedSlots(buildMinuteList(minuteStep, desired % 60), min, max)\n )\n if (snapped === undefined) return\n setDraft(withTime(day, snapped))\n }\n\n const handleTimeChange = (next: TimeValue) => {\n const minutes = parseTimeValue(next)\n if (minutes === undefined) return\n setDraft(withTime(draft ?? activeDay, minutes))\n }\n\n const label = value\n ? (formatValue?.(value) ??\n `${value.toLocaleDateString()} ${formatTimeLabel(minutesOfDay(value), hourCycle)}`)\n : placeholder\n\n return (\n <Popover open={isOpen} onOpenChange={handleOpenChange}>\n <PopoverTrigger asChild>\n <Button\n ref={ref}\n id={id}\n type=\"button\"\n variant=\"outline\"\n disabled={disabled}\n aria-label={ariaLabelledBy ? undefined : (ariaLabel ?? placeholder)}\n aria-labelledby={ariaLabelledBy}\n className={cn(\n \"w-[280px] justify-start text-left font-normal\",\n !value && \"text-muted-foreground\",\n className\n )}\n >\n <CalendarClockIcon className=\"me-2 h-4 w-4\" aria-hidden=\"true\" />\n {label}\n </Button>\n </PopoverTrigger>\n <PopoverContent\n className={cn(\"w-auto p-0\", contentClassName)}\n align={align}\n aria-label={ariaLabel ?? placeholder}\n >\n <div className=\"flex flex-col sm:flex-row sm:items-start sm:divide-x sm:divide-border\">\n <Calendar\n mode=\"single\"\n selected={draft}\n defaultMonth={activeDay}\n startMonth={calendarStartMonth}\n endMonth={calendarEndMonth}\n onSelect={handleDaySelect}\n disabled={calendarDisabled}\n // Focus moves into the calendar the user just opened (keyboard navigation).\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus\n />\n <div className=\"border-t border-border p-2 sm:border-t-0\">\n <div className=\"px-1 pb-1 text-xs font-medium uppercase tracking-wider text-muted-foreground\">\n {timeLabel}\n </div>\n <TimePickerPanel\n value={draft ? formatTimeValue(minutesOfDay(draft)) : undefined}\n onValueChange={handleTimeChange}\n minTime={activeWindow.minTime}\n maxTime={activeWindow.maxTime}\n minuteStep={minuteStep}\n hourCycle={hourCycle}\n />\n </div>\n </div>\n <div className=\"flex items-center gap-2 border-t border-border p-2\">\n {clearable && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"font-normal\"\n disabled={!draft}\n onClick={() => setDraft(undefined)}\n >\n {clearLabel}\n </Button>\n )}\n <div className=\"ms-auto flex items-center gap-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"font-normal\"\n onClick={handleCancel}\n >\n {cancelLabel}\n </Button>\n <Button type=\"button\" variant=\"default\" size=\"sm\" onClick={handleApply}>\n {applyLabel}\n </Button>\n </div>\n </div>\n </PopoverContent>\n {name && (\n <input\n type=\"hidden\"\n name={name}\n value={\n value\n ? `${value.getFullYear()}-${String(value.getMonth() + 1).padStart(2, \"0\")}-${String(\n value.getDate()\n ).padStart(2, \"0\")}T${formatTimeValue(minutesOfDay(value))}`\n : \"\"\n }\n />\n )}\n </Popover>\n )\n }\n)\nDateTimePicker.displayName = \"DateTimePicker\"\n\nexport { DateTimePicker }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","\nimport * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Loader2 } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground hover:bg-primary-hover\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive-hover\",\n outline:\n \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary-hover\",\n ghost:\n \"hover:bg-accent hover:text-accent-foreground\",\n link:\n \"text-primary underline-offset-4 hover:underline\",\n success:\n \"bg-success text-success-foreground hover:bg-success-hover\",\n },\n size: {\n xs: \"h-7 px-2.5 text-xs\",\n sm: \"h-9 px-3\",\n default: \"h-10 px-4 py-2\",\n lg: \"h-11 px-8\",\n icon: \"h-10 w-10\",\n \"icon-sm\": \"h-8 w-8\",\n },\n shape: {\n default: \"rounded-md\",\n rounded: \"rounded-lg\",\n pill: \"rounded-full\",\n square: \"rounded-none\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n shape: \"default\",\n },\n }\n)\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean\n loading?: boolean\n prefixIcon?: React.ReactNode\n suffixIcon?: React.ReactNode\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n size,\n shape,\n asChild = false,\n loading = false,\n prefixIcon,\n suffixIcon,\n children,\n disabled,\n ...props\n },\n ref\n ) => {\n const Comp = asChild ? Slot : \"button\"\n const isDisabled = disabled || loading\n\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, shape, className }))}\n ref={ref}\n disabled={isDisabled}\n {...props}\n >\n {loading && <Loader2 className=\"animate-spin\" />}\n {!loading && prefixIcon}\n {children}\n {suffixIcon}\n </Comp>\n )\n }\n)\nButton.displayName = \"Button\"\n\nexport { Button, buttonVariants }\n","import * as React from \"react\"\nimport { DayPicker } from \"react-day-picker\"\nimport { ChevronLeft, ChevronRight } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>\n\n/**\n * How far the year dropdown reaches when the caller gives no bounds.\n *\n * `captionLayout` defaults to \"dropdown\" here, and react-day-picker then falls\n * back to [currentYear - 100, currentYear] for the year list. That is wrong in\n * both directions: a hundred dead years to scroll past, and no future year at\n * all - a deadline could not be set beyond December of the current year.\n * Callers that know their range pass `startMonth` / `endMonth` and these are\n * not used.\n */\nconst DEFAULT_YEARS_BACK = 10\nconst DEFAULT_YEARS_FORWARD = 10\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = \"dropdown\",\n startMonth,\n endMonth,\n ...props\n}: CalendarProps) {\n const now = new Date()\n const defaultedStartMonth =\n startMonth ?? new Date(now.getFullYear() - DEFAULT_YEARS_BACK, 0, 1)\n const defaultedEndMonth =\n endMonth ?? new Date(now.getFullYear() + DEFAULT_YEARS_FORWARD, 11, 1)\n\n return (\n <DayPicker\n startMonth={defaultedStartMonth}\n endMonth={defaultedEndMonth}\n showOutsideDays={showOutsideDays}\n className={cn(\"w-[260px] rounded-lg p-3\", className)}\n classNames={{\n months: \"flex flex-col\",\n month: \"space-y-3\",\n month_caption: \"relative flex h-8 items-center justify-center\",\n caption_label: \"text-sm font-medium hidden\",\n nav: \"flex items-center\",\n button_previous: cn(\n \"absolute start-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n button_next: cn(\n \"absolute end-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors cursor-pointer border-none\"\n ),\n month_grid: \"w-full border-collapse\",\n weekdays: \"flex w-full\",\n weekday:\n \"flex-1 h-8 flex items-center justify-center text-[11px] font-medium text-muted-foreground uppercase tracking-wider\",\n week: \"flex w-full mt-1\",\n day: \"flex-1 h-8 p-0 relative focus-within:z-20 flex items-center justify-center text-sm\",\n day_button: cn(\n \"inline-flex size-8 items-center justify-center rounded-md bg-transparent text-sm font-normal cursor-pointer border-none hover:bg-muted transition-colors\"\n ),\n range_end: \"day-range-end\",\n selected:\n \"[&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:hover:bg-primary [&>button]:hover:text-primary-foreground [&>button]:font-medium\",\n today: \"[&>button]:font-semibold [&>button]:text-primary\",\n outside:\n \"day-outside [&>button]:bg-transparent [&>button]:text-muted-foreground [&>button]:opacity-50\",\n disabled: \"[&>button]:text-muted-foreground [&>button]:opacity-40 [&>button]:cursor-default\",\n range_middle:\n \"[&>button]:bg-accent [&>button]:text-accent-foreground [&>button]:rounded-none\",\n range_start: \"[&>button]:rounded-e-none\",\n dropdowns: \"flex items-center gap-1.5 justify-center\",\n dropdown:\n \"h-7 rounded-md border border-input bg-background px-2 text-xs font-medium text-foreground cursor-pointer outline-none accent-primary focus:border-ring focus:ring-[2px] focus:ring-ring/20 [&>option:checked]:bg-primary [&>option:checked]:text-primary-foreground [&>option]:py-1\",\n months_dropdown: \"w-[104px]\",\n years_dropdown: \"w-[72px]\",\n hidden: \"invisible\",\n ...classNames,\n }}\n captionLayout={captionLayout}\n components={{\n Chevron: ({ orientation }) => {\n const Icon = orientation === \"left\" ? ChevronLeft : ChevronRight\n return <Icon className=\"size-4\" />\n },\n }}\n {...props}\n />\n )\n}\nCalendar.displayName = \"Calendar\"\n\nexport { Calendar }\n","import * as React from \"react\"\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\"\nimport { cn } from \"../lib/utils\"\n\nconst Popover = PopoverPrimitive.Root\nconst PopoverTrigger = PopoverPrimitive.Trigger\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n))\nPopoverContent.displayName = PopoverPrimitive.Content.displayName\n\nexport { Popover, PopoverTrigger, PopoverContent }\n","import * as React from \"react\"\nimport { ClockIcon } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\nimport { Button } from \"./button\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\"\n\n/** Matches a 24-hour clock time, \"HH:mm\". */\nconst TIME_VALUE_PATTERN = /^([01]\\d|2[0-3]):([0-5]\\d)$/\n\nconst MINUTES_PER_DAY = 24 * 60\nconst NOON = 12 * 60\n\n/** A 24-hour clock time such as \"09:00\" or \"17:30\". */\nexport type TimeValue = string\n\ntype Period = \"AM\" | \"PM\"\n\nfunction pad2(value: number): string {\n return value.toString().padStart(2, \"0\")\n}\n\n/**\n * Turns a \"HH:mm\" string into minutes since midnight. Returns undefined for\n * anything that is not a valid 24-hour time, so a bad prop degrades to\n * \"nothing selected\" rather than throwing inside a render.\n */\nfunction parseTimeValue(value?: string | null): number | undefined {\n if (!value) return undefined\n const match = TIME_VALUE_PATTERN.exec(value.trim())\n if (!match) return undefined\n return Number(match[1]) * 60 + Number(match[2])\n}\n\n/** Turns minutes since midnight back into the canonical \"HH:mm\" string. */\nfunction formatTimeValue(minutesOfDay: number): string {\n const normalised = ((minutesOfDay % MINUTES_PER_DAY) + MINUTES_PER_DAY) % MINUTES_PER_DAY\n return `${pad2(Math.floor(normalised / 60))}:${pad2(normalised % 60)}`\n}\n\n/** Human-readable time, either \"17:30\" or \"05:30 PM\" depending on the cycle. */\nfunction formatTimeLabel(minutesOfDay: number, hourCycle: 12 | 24): string {\n const normalised = ((minutesOfDay % MINUTES_PER_DAY) + MINUTES_PER_DAY) % MINUTES_PER_DAY\n const hours = Math.floor(normalised / 60)\n const minutes = normalised % 60\n if (hourCycle === 24) return `${pad2(hours)}:${pad2(minutes)}`\n const period: Period = hours < NOON / 60 ? \"AM\" : \"PM\"\n const hour12 = hours % 12 === 0 ? 12 : hours % 12\n return `${pad2(hour12)}:${pad2(minutes)} ${period}`\n}\n\nfunction isTimeInRange(minutesOfDay: number, min?: number, max?: number): boolean {\n if (min !== undefined && minutesOfDay < min) return false\n if (max !== undefined && minutesOfDay > max) return false\n return true\n}\n\n/** The hour a 12-hour-cycle cell stands for once its period is applied. */\nfunction to24Hour(hour12: number, period: Period): number {\n const base = hour12 % 12\n return period === \"AM\" ? base : base + 12\n}\n\n/**\n * The minute offsets the minute column offers. `extra` keeps a value that does\n * not sit on the step grid visible — a consumer may hand us \"14:07\" with a\n * 5-minute step and we must not silently fail to reflect it.\n */\nfunction buildMinuteList(minuteStep: number, extra?: number): number[] {\n const step = Number.isFinite(minuteStep) ? Math.min(60, Math.max(1, Math.floor(minuteStep))) : 5\n const minutes: number[] = []\n for (let minute = 0; minute < 60; minute += step) minutes.push(minute)\n if (extra !== undefined && extra >= 0 && extra < 60 && !minutes.includes(extra)) {\n minutes.push(extra)\n minutes.sort((a, b) => a - b)\n }\n return minutes\n}\n\n/** Every selectable slot of the day that the bound allows, ascending. */\nfunction buildAllowedSlots(minutes: number[], min?: number, max?: number): number[] {\n const slots: number[] = []\n for (let hour = 0; hour < 24; hour += 1) {\n for (const minute of minutes) {\n const slot = hour * 60 + minute\n if (isTimeInRange(slot, min, max)) slots.push(slot)\n }\n }\n return slots\n}\n\n/**\n * The allowed slot closest to `desired`, preferring one at or after it, so a\n * time that has fallen outside the bound moves forward to the next legal slot\n * instead of backwards.\n */\nfunction snapToAllowedSlot(desired: number, allowedSlots: number[]): number | undefined {\n if (allowedSlots.length === 0) return undefined\n let best = allowedSlots[0]\n let bestScore = Number.POSITIVE_INFINITY\n for (const slot of allowedSlots) {\n const score = slot >= desired ? slot - desired : desired - slot + MINUTES_PER_DAY\n if (score < bestScore) {\n bestScore = score\n best = slot\n }\n }\n return best\n}\n\nconst columnClasses =\n \"flex max-h-[216px] w-16 flex-col gap-1 overflow-y-auto overscroll-contain p-1\"\n\nconst cellClasses =\n \"shrink-0 rounded-md px-2 py-1.5 text-sm font-normal text-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-pressed:bg-primary aria-pressed:font-medium aria-pressed:text-primary-foreground aria-pressed:hover:bg-primary aria-pressed:hover:text-primary-foreground disabled:pointer-events-none disabled:text-muted-foreground disabled:opacity-50\"\n\ninterface TimeCellProps {\n label: string\n accessibleName: string\n pressed: boolean\n disabled: boolean\n onSelect: () => void\n}\n\nfunction TimeCell({ label, accessibleName, pressed, disabled, onSelect }: TimeCellProps) {\n return (\n <button\n type=\"button\"\n aria-label={accessibleName}\n aria-pressed={pressed}\n disabled={disabled}\n onClick={onSelect}\n className={cn(cellClasses)}\n >\n {label}\n </button>\n )\n}\n\nexport interface TimePickerPanelProps {\n /** Selected time as a 24-hour \"HH:mm\" string. */\n value?: TimeValue\n /** Called with the newly selected 24-hour \"HH:mm\" string. */\n onValueChange?: (value: TimeValue) => void\n /** Earliest selectable time as \"HH:mm\". Earlier times are disabled. */\n minTime?: TimeValue\n /** Latest selectable time as \"HH:mm\". Later times are disabled. */\n maxTime?: TimeValue\n /** Minute granularity offered by the minute column. Defaults to 5. */\n minuteStep?: number\n /** 12 adds an AM/PM column, 24 lists hours 00-23. Defaults to 12. */\n hourCycle?: 12 | 24\n /** Accessible name for the hour column. Defaults to \"Hour\". */\n hourLabel?: string\n /** Accessible name for the minute column. Defaults to \"Minute\". */\n minuteLabel?: string\n /** Accessible name for the AM/PM column. Defaults to \"Period\". */\n periodLabel?: string\n /** Classname applied to the panel wrapper. */\n className?: string\n}\n\n/**\n * The bare hour/minute columns, without a popover around them. Used by\n * TimePicker and by DateTimePicker, which supplies its own popover.\n */\nfunction TimePickerPanel({\n value,\n onValueChange,\n minTime,\n maxTime,\n minuteStep = 5,\n hourCycle = 12,\n hourLabel = \"Hour\",\n minuteLabel = \"Minute\",\n periodLabel = \"Period\",\n className,\n}: TimePickerPanelProps) {\n const minMinutes = parseTimeValue(minTime)\n const maxMinutes = parseTimeValue(maxTime)\n const selected = parseTimeValue(value)\n\n const minuteList = React.useMemo(\n () => buildMinuteList(minuteStep, selected === undefined ? undefined : selected % 60),\n [minuteStep, selected]\n )\n const allowedSlots = React.useMemo(\n () => buildAllowedSlots(minuteList, minMinutes, maxMinutes),\n [minuteList, minMinutes, maxMinutes]\n )\n\n // Each click reports a complete time, so with nothing selected yet the\n // columns work against the first slot the bound allows.\n const active = selected ?? allowedSlots[0]\n const activeHour = active === undefined ? undefined : Math.floor(active / 60)\n const activeMinute = active === undefined ? undefined : active % 60\n const activePeriod: Period =\n activeHour !== undefined && activeHour >= 12 ? \"PM\" : \"AM\"\n\n const hourHasSlot = (hour: number) =>\n allowedSlots.some((slot) => Math.floor(slot / 60) === hour)\n const firstSlotInHour = (hour: number) =>\n allowedSlots.find((slot) => Math.floor(slot / 60) === hour)\n const periodHasSlot = (period: Period) =>\n allowedSlots.some((slot) => (slot < NOON ? \"AM\" : \"PM\") === period)\n const firstSlotInPeriod = (period: Period) =>\n allowedSlots.find((slot) => (slot < NOON ? \"AM\" : \"PM\") === period)\n\n const commit = (minutesOfDay: number | undefined) => {\n if (minutesOfDay === undefined) return\n onValueChange?.(formatTimeValue(minutesOfDay))\n }\n\n const selectHour = (hour: number) => {\n const desired = hour * 60 + (activeMinute ?? 0)\n commit(isTimeInRange(desired, minMinutes, maxMinutes) ? desired : firstSlotInHour(hour))\n }\n\n const selectMinute = (minute: number) => {\n if (activeHour === undefined) return\n commit(activeHour * 60 + minute)\n }\n\n const selectPeriod = (period: Period) => {\n if (activeHour === undefined || activeMinute === undefined) {\n commit(firstSlotInPeriod(period))\n return\n }\n const hour12 = activeHour % 12 === 0 ? 12 : activeHour % 12\n const desired = to24Hour(hour12, period) * 60 + activeMinute\n commit(\n isTimeInRange(desired, minMinutes, maxMinutes) ? desired : firstSlotInPeriod(period)\n )\n }\n\n const hourCells =\n hourCycle === 24\n ? Array.from({ length: 24 }, (_, hour) => hour)\n : [12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\n\n return (\n <div className={cn(\"flex items-start divide-x divide-border\", className)}>\n <div className={cn(columnClasses)} role=\"group\" aria-label={hourLabel}>\n {hourCells.map((cell) => {\n const hour = hourCycle === 24 ? cell : to24Hour(cell, activePeriod)\n const label = pad2(cell)\n return (\n <TimeCell\n key={`hour-${cell}`}\n label={label}\n accessibleName={`${hourLabel} ${label}`}\n pressed={activeHour === hour && selected !== undefined}\n disabled={!hourHasSlot(hour)}\n onSelect={() => selectHour(hour)}\n />\n )\n })}\n </div>\n <div className={cn(columnClasses)} role=\"group\" aria-label={minuteLabel}>\n {minuteList.map((minute) => {\n const label = pad2(minute)\n const disabled =\n activeHour === undefined ||\n !isTimeInRange(activeHour * 60 + minute, minMinutes, maxMinutes)\n return (\n <TimeCell\n key={`minute-${minute}`}\n label={label}\n accessibleName={`${minuteLabel} ${label}`}\n pressed={activeMinute === minute && selected !== undefined}\n disabled={disabled}\n onSelect={() => selectMinute(minute)}\n />\n )\n })}\n </div>\n {hourCycle === 12 && (\n <div className={cn(columnClasses)} role=\"group\" aria-label={periodLabel}>\n {([\"AM\", \"PM\"] as Period[]).map((period) => (\n <TimeCell\n key={period}\n label={period}\n accessibleName={period}\n pressed={activePeriod === period && selected !== undefined}\n disabled={!periodHasSlot(period)}\n onSelect={() => selectPeriod(period)}\n />\n ))}\n </div>\n )}\n </div>\n )\n}\nTimePickerPanel.displayName = \"TimePickerPanel\"\n\nexport interface TimePickerProps {\n /** Selected time as a 24-hour \"HH:mm\" string. */\n value?: TimeValue\n /** Called with the new time, or with undefined when the value is cleared. */\n onValueChange?: (value: TimeValue | undefined) => void\n /** Earliest selectable time as \"HH:mm\". Earlier times are disabled. */\n minTime?: TimeValue\n /** Latest selectable time as \"HH:mm\". Later times are disabled. */\n maxTime?: TimeValue\n /** Minute granularity offered by the minute column. Defaults to 5. */\n minuteStep?: number\n /** 12 adds an AM/PM column, 24 lists hours 00-23. Defaults to 12. */\n hourCycle?: 12 | 24\n /** Trigger text shown when nothing is selected. */\n placeholder?: string\n /** Shows a Clear action in the popover. Defaults to true. */\n clearable?: boolean\n /** Text of the Clear action. Defaults to \"Clear\". */\n clearLabel?: string\n /** Disables the whole control. */\n disabled?: boolean\n /** Accessible name for the trigger. Defaults to the placeholder. */\n \"aria-label\"?: string\n /** Id of an element that labels the trigger. */\n \"aria-labelledby\"?: string\n /** Id applied to the trigger button. */\n id?: string\n /** Name reported on a hidden input, so the value posts with a plain form. */\n name?: string\n /** Classname applied to the trigger button. */\n className?: string\n /** Classname applied to the popover content. */\n contentClassName?: string\n /** Controlled open state of the popover. */\n open?: boolean\n /** Called when the popover opens or closes. */\n onOpenChange?: (open: boolean) => void\n /** Side the popover is aligned to. Defaults to \"start\". */\n align?: \"start\" | \"center\" | \"end\"\n}\n\n/**\n * A time control: a popover trigger showing the selected time, over hour and\n * minute columns. The value is always a 24-hour \"HH:mm\" string, so it survives\n * a round trip through JSON and through a `datetime-local`-shaped API.\n */\nconst TimePicker = React.forwardRef<HTMLButtonElement, TimePickerProps>(\n (\n {\n value,\n onValueChange,\n minTime,\n maxTime,\n minuteStep = 5,\n hourCycle = 12,\n placeholder = \"Pick a time\",\n clearable = true,\n clearLabel = \"Clear\",\n disabled,\n id,\n name,\n className,\n contentClassName,\n open,\n onOpenChange,\n align = \"start\",\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n },\n ref\n ) => {\n const selected = parseTimeValue(value)\n const label =\n selected === undefined ? placeholder : formatTimeLabel(selected, hourCycle)\n\n return (\n <Popover open={open} onOpenChange={onOpenChange}>\n <PopoverTrigger asChild>\n <Button\n ref={ref}\n id={id}\n type=\"button\"\n variant=\"outline\"\n disabled={disabled}\n aria-label={ariaLabelledBy ? undefined : (ariaLabel ?? placeholder)}\n aria-labelledby={ariaLabelledBy}\n className={cn(\n \"w-[180px] justify-start text-left font-normal\",\n selected === undefined && \"text-muted-foreground\",\n className\n )}\n >\n <ClockIcon className=\"me-2 h-4 w-4\" aria-hidden=\"true\" />\n {label}\n </Button>\n </PopoverTrigger>\n <PopoverContent\n className={cn(\"w-auto p-0\", contentClassName)}\n align={align}\n aria-label={ariaLabel ?? placeholder}\n >\n <TimePickerPanel\n value={value}\n onValueChange={(next) => onValueChange?.(next)}\n minTime={minTime}\n maxTime={maxTime}\n minuteStep={minuteStep}\n hourCycle={hourCycle}\n />\n {clearable && (\n <div className=\"flex justify-end border-t border-border p-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"font-normal\"\n disabled={selected === undefined}\n onClick={() => onValueChange?.(undefined)}\n >\n {clearLabel}\n </Button>\n </div>\n )}\n </PopoverContent>\n {name && <input type=\"hidden\" name={name} value={value ?? \"\"} />}\n </Popover>\n )\n }\n)\nTimePicker.displayName = \"TimePicker\"\n\nexport {\n TimePicker,\n TimePickerPanel,\n formatTimeLabel,\n formatTimeValue,\n parseTimeValue,\n isTimeInRange,\n buildMinuteList,\n buildAllowedSlots,\n snapToAllowedSlot,\n}\n"],"mappings":";AAAA,YAAYA,YAAW;AACvB,SAAS,yBAAyB;;;ACDlC,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACJA,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,WAA8B;AACvC,SAAS,eAAe;AA4ElB,SAMc,KANd;AAzEN,IAAM,iBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,WACE;AAAA,QACF,OACE;AAAA,QACF,MACE;A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