acai-ui-library 0.1.21 → 0.1.23
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.
- package/dist/components/ai-chatbot-logo-glyph.cjs +31 -0
- package/dist/components/ai-chatbot-logo-glyph.cjs.map +1 -0
- package/dist/components/ai-chatbot-logo-glyph.d.cts +3 -0
- package/dist/components/ai-chatbot-logo-glyph.d.ts +3 -0
- package/dist/components/ai-chatbot-logo-glyph.js +6 -0
- package/dist/components/ai-chatbot-logo-glyph.js.map +1 -0
- package/dist/components/ai-chatbot-logo.cjs +136 -0
- package/dist/components/ai-chatbot-logo.cjs.map +1 -0
- package/dist/components/ai-chatbot-logo.d.cts +13 -0
- package/dist/components/ai-chatbot-logo.d.ts +13 -0
- package/dist/components/ai-chatbot-logo.js +102 -0
- package/dist/components/ai-chatbot-logo.js.map +1 -0
- package/dist/components/app-launcher.cjs +224 -0
- package/dist/components/app-launcher.cjs.map +1 -0
- package/dist/components/app-launcher.d.cts +24 -0
- package/dist/components/app-launcher.d.ts +24 -0
- package/dist/components/app-launcher.js +190 -0
- package/dist/components/app-launcher.js.map +1 -0
- package/dist/components/calendar.cjs +13 -5
- package/dist/components/calendar.cjs.map +1 -1
- package/dist/components/calendar.js +15 -7
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/date-picker.cjs +17 -7
- package/dist/components/date-picker.cjs.map +1 -1
- package/dist/components/date-picker.js +23 -13
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/date-time-picker.cjs +13 -5
- package/dist/components/date-time-picker.cjs.map +1 -1
- package/dist/components/date-time-picker.js +28 -20
- package/dist/components/date-time-picker.js.map +1 -1
- package/dist/components/help-widget/app-id-typecheck.cjs +34 -0
- package/dist/components/help-widget/app-id-typecheck.cjs.map +1 -0
- package/dist/components/help-widget/app-id-typecheck.d.cts +17 -0
- package/dist/components/help-widget/app-id-typecheck.d.ts +17 -0
- package/dist/components/help-widget/app-id-typecheck.js +8 -0
- package/dist/components/help-widget/app-id-typecheck.js.map +1 -0
- package/dist/components/help-widget/consent-dialog.cjs +276 -0
- package/dist/components/help-widget/consent-dialog.cjs.map +1 -0
- package/dist/components/help-widget/consent-dialog.d.cts +17 -0
- package/dist/components/help-widget/consent-dialog.d.ts +17 -0
- package/dist/components/help-widget/consent-dialog.js +239 -0
- package/dist/components/help-widget/consent-dialog.js.map +1 -0
- package/dist/components/help-widget/help-session-banner.cjs +85 -0
- package/dist/components/help-widget/help-session-banner.cjs.map +1 -0
- package/dist/components/help-widget/help-session-banner.d.cts +17 -0
- package/dist/components/help-widget/help-session-banner.d.ts +17 -0
- package/dist/components/help-widget/help-session-banner.js +50 -0
- package/dist/components/help-widget/help-session-banner.js.map +1 -0
- package/dist/components/help-widget/help-widget.cjs +503 -0
- package/dist/components/help-widget/help-widget.cjs.map +1 -0
- package/dist/components/help-widget/help-widget.d.cts +32 -0
- package/dist/components/help-widget/help-widget.d.ts +32 -0
- package/dist/components/help-widget/help-widget.js +468 -0
- package/dist/components/help-widget/help-widget.js.map +1 -0
- package/dist/components/help-widget/highlight-overlay.cjs +84 -0
- package/dist/components/help-widget/highlight-overlay.cjs.map +1 -0
- package/dist/components/help-widget/highlight-overlay.d.cts +24 -0
- package/dist/components/help-widget/highlight-overlay.d.ts +24 -0
- package/dist/components/help-widget/highlight-overlay.js +49 -0
- package/dist/components/help-widget/highlight-overlay.js.map +1 -0
- package/dist/components/help-widget/use-help-session.cjs +85 -0
- package/dist/components/help-widget/use-help-session.cjs.map +1 -0
- package/dist/components/help-widget/use-help-session.d.cts +46 -0
- package/dist/components/help-widget/use-help-session.d.ts +46 -0
- package/dist/components/help-widget/use-help-session.js +50 -0
- package/dist/components/help-widget/use-help-session.js.map +1 -0
- package/dist/index.cjs +665 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +699 -126
- package/dist/index.js.map +1 -1
- package/dist/lib/app-ids.cjs +58 -0
- package/dist/lib/app-ids.cjs.map +1 -0
- package/dist/lib/app-ids.d.cts +12 -0
- package/dist/lib/app-ids.d.ts +12 -0
- package/dist/lib/app-ids.js +32 -0
- package/dist/lib/app-ids.js.map +1 -0
- package/dist/lib/mask-snapshot.cjs +66 -0
- package/dist/lib/mask-snapshot.cjs.map +1 -0
- package/dist/lib/mask-snapshot.d.cts +16 -0
- package/dist/lib/mask-snapshot.d.ts +16 -0
- package/dist/lib/mask-snapshot.js +41 -0
- package/dist/lib/mask-snapshot.js.map +1 -0
- package/package.json +2 -1
|
@@ -87,8 +87,14 @@ Button.displayName = "Button";
|
|
|
87
87
|
|
|
88
88
|
// src/components/calendar.tsx
|
|
89
89
|
import { DayPicker } from "react-day-picker";
|
|
90
|
-
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
91
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
90
|
+
import { ChevronDown, ChevronLeft, ChevronRight } from "lucide-react";
|
|
91
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
92
|
+
function CalendarSelect({ children, ...selectProps }) {
|
|
93
|
+
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
94
|
+
/* @__PURE__ */ jsx2("select", { ...selectProps, children }),
|
|
95
|
+
/* @__PURE__ */ jsx2(ChevronDown, { "aria-hidden": "true", className: "pointer-events-none absolute end-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground" })
|
|
96
|
+
] });
|
|
97
|
+
}
|
|
92
98
|
var DEFAULT_YEARS_BACK = 10;
|
|
93
99
|
var DEFAULT_YEARS_FORWARD = 10;
|
|
94
100
|
function Calendar({
|
|
@@ -111,16 +117,16 @@ function Calendar({
|
|
|
111
117
|
showOutsideDays,
|
|
112
118
|
className: cn("w-[260px] rounded-lg p-3", className),
|
|
113
119
|
classNames: {
|
|
114
|
-
months: "flex flex-col",
|
|
120
|
+
months: "relative flex flex-col",
|
|
115
121
|
month: "space-y-3",
|
|
116
122
|
month_caption: "relative flex h-8 items-center justify-center",
|
|
117
123
|
caption_label: "text-sm font-medium hidden",
|
|
118
|
-
nav: "flex items-center",
|
|
124
|
+
nav: "absolute inset-x-0 top-0 z-10 flex h-8 items-center pointer-events-none",
|
|
119
125
|
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-muted hover:text-foreground transition-colors cursor-pointer border-none"
|
|
126
|
+
"pointer-events-auto absolute start-0 top-1/2 -translate-y-1/2 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
127
|
),
|
|
122
128
|
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-muted hover:text-foreground transition-colors cursor-pointer border-none"
|
|
129
|
+
"pointer-events-auto absolute end-0 top-1/2 -translate-y-1/2 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
130
|
),
|
|
125
131
|
month_grid: "w-full border-collapse",
|
|
126
132
|
weekdays: "flex w-full",
|
|
@@ -137,8 +143,9 @@ function Calendar({
|
|
|
137
143
|
disabled: "[&>button]:text-muted-foreground [&>button]:opacity-40 [&>button]:cursor-default",
|
|
138
144
|
range_middle: "[&>button]:bg-accent [&>button]:text-accent-foreground [&>button]:rounded-none",
|
|
139
145
|
range_start: "[&>button]:rounded-e-none",
|
|
146
|
+
dropdown_root: "relative",
|
|
140
147
|
dropdowns: "flex items-center gap-1.5 justify-center",
|
|
141
|
-
dropdown: "h-7 rounded-md border border-input bg-background
|
|
148
|
+
dropdown: "h-7 appearance-none rounded-md border border-input bg-background ps-2 pe-6 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
149
|
months_dropdown: "w-[104px]",
|
|
143
150
|
years_dropdown: "w-[72px]",
|
|
144
151
|
hidden: "invisible",
|
|
@@ -146,6 +153,7 @@ function Calendar({
|
|
|
146
153
|
},
|
|
147
154
|
captionLayout,
|
|
148
155
|
components: {
|
|
156
|
+
Select: CalendarSelect,
|
|
149
157
|
Chevron: ({ orientation }) => {
|
|
150
158
|
const Icon = orientation === "left" ? ChevronLeft : ChevronRight;
|
|
151
159
|
return /* @__PURE__ */ jsx2(Icon, { className: "size-4" });
|
|
@@ -181,7 +189,7 @@ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
|
181
189
|
// src/components/time-picker.tsx
|
|
182
190
|
import * as React3 from "react";
|
|
183
191
|
import { ClockIcon } from "lucide-react";
|
|
184
|
-
import { jsx as jsx4, jsxs as
|
|
192
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
185
193
|
var TIME_VALUE_PATTERN = /^([01]\d|2[0-3]):([0-5]\d)$/;
|
|
186
194
|
var MINUTES_PER_DAY = 24 * 60;
|
|
187
195
|
var NOON = 12 * 60;
|
|
@@ -320,7 +328,7 @@ function TimePickerPanel({
|
|
|
320
328
|
);
|
|
321
329
|
};
|
|
322
330
|
const hourCells = hourCycle === 24 ? Array.from({ length: 24 }, (_, hour) => hour) : [12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
323
|
-
return /* @__PURE__ */
|
|
331
|
+
return /* @__PURE__ */ jsxs3("div", { className: cn("flex items-start divide-x divide-border", className), children: [
|
|
324
332
|
/* @__PURE__ */ jsx4("div", { className: cn(columnClasses), role: "group", "aria-label": hourLabel, children: hourCells.map((cell) => {
|
|
325
333
|
const hour = hourCycle === 24 ? cell : to24Hour(cell, activePeriod);
|
|
326
334
|
const label = pad2(cell);
|
|
@@ -389,8 +397,8 @@ var TimePicker = React3.forwardRef(
|
|
|
389
397
|
}, ref) => {
|
|
390
398
|
const selected = parseTimeValue(value);
|
|
391
399
|
const label = selected === void 0 ? placeholder : formatTimeLabel(selected, hourCycle);
|
|
392
|
-
return /* @__PURE__ */
|
|
393
|
-
/* @__PURE__ */ jsx4(PopoverTrigger, { asChild: true, children: /* @__PURE__ */
|
|
400
|
+
return /* @__PURE__ */ jsxs3(Popover, { open, onOpenChange, children: [
|
|
401
|
+
/* @__PURE__ */ jsx4(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs3(
|
|
394
402
|
Button,
|
|
395
403
|
{
|
|
396
404
|
ref,
|
|
@@ -411,7 +419,7 @@ var TimePicker = React3.forwardRef(
|
|
|
411
419
|
]
|
|
412
420
|
}
|
|
413
421
|
) }),
|
|
414
|
-
/* @__PURE__ */
|
|
422
|
+
/* @__PURE__ */ jsxs3(
|
|
415
423
|
PopoverContent,
|
|
416
424
|
{
|
|
417
425
|
className: cn("w-auto p-0", contentClassName),
|
|
@@ -451,7 +459,7 @@ var TimePicker = React3.forwardRef(
|
|
|
451
459
|
TimePicker.displayName = "TimePicker";
|
|
452
460
|
|
|
453
461
|
// src/components/date-time-picker.tsx
|
|
454
|
-
import { jsx as jsx5, jsxs as
|
|
462
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
455
463
|
function startOfDay(date) {
|
|
456
464
|
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
457
465
|
}
|
|
@@ -578,8 +586,8 @@ var DateTimePicker = React4.forwardRef(
|
|
|
578
586
|
setDraft(withTime(draft ?? activeDay, minutes));
|
|
579
587
|
};
|
|
580
588
|
const label = value ? formatValue?.(value) ?? `${value.toLocaleDateString()} ${formatTimeLabel(minutesOfDay(value), hourCycle)}` : placeholder;
|
|
581
|
-
return /* @__PURE__ */
|
|
582
|
-
/* @__PURE__ */ jsx5(PopoverTrigger, { asChild: true, children: /* @__PURE__ */
|
|
589
|
+
return /* @__PURE__ */ jsxs4(Popover, { open: isOpen, onOpenChange: handleOpenChange, children: [
|
|
590
|
+
/* @__PURE__ */ jsx5(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs4(
|
|
583
591
|
Button,
|
|
584
592
|
{
|
|
585
593
|
ref,
|
|
@@ -600,14 +608,14 @@ var DateTimePicker = React4.forwardRef(
|
|
|
600
608
|
]
|
|
601
609
|
}
|
|
602
610
|
) }),
|
|
603
|
-
/* @__PURE__ */
|
|
611
|
+
/* @__PURE__ */ jsxs4(
|
|
604
612
|
PopoverContent,
|
|
605
613
|
{
|
|
606
614
|
className: cn("w-auto p-0", contentClassName),
|
|
607
615
|
align,
|
|
608
616
|
"aria-label": ariaLabel ?? placeholder,
|
|
609
617
|
children: [
|
|
610
|
-
/* @__PURE__ */
|
|
618
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col sm:flex-row sm:items-start sm:divide-x sm:divide-border", children: [
|
|
611
619
|
/* @__PURE__ */ jsx5(
|
|
612
620
|
Calendar,
|
|
613
621
|
{
|
|
@@ -621,7 +629,7 @@ var DateTimePicker = React4.forwardRef(
|
|
|
621
629
|
autoFocus: true
|
|
622
630
|
}
|
|
623
631
|
),
|
|
624
|
-
/* @__PURE__ */
|
|
632
|
+
/* @__PURE__ */ jsxs4("div", { className: "border-t border-border p-2 sm:border-t-0", children: [
|
|
625
633
|
/* @__PURE__ */ jsx5("div", { className: "px-1 pb-1 text-xs font-medium uppercase tracking-wider text-muted-foreground", children: timeLabel }),
|
|
626
634
|
/* @__PURE__ */ jsx5(
|
|
627
635
|
TimePickerPanel,
|
|
@@ -636,7 +644,7 @@ var DateTimePicker = React4.forwardRef(
|
|
|
636
644
|
)
|
|
637
645
|
] })
|
|
638
646
|
] }),
|
|
639
|
-
/* @__PURE__ */
|
|
647
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 border-t border-border p-2", children: [
|
|
640
648
|
clearable && /* @__PURE__ */ jsx5(
|
|
641
649
|
Button,
|
|
642
650
|
{
|
|
@@ -649,7 +657,7 @@ var DateTimePicker = React4.forwardRef(
|
|
|
649
657
|
children: clearLabel
|
|
650
658
|
}
|
|
651
659
|
),
|
|
652
|
-
/* @__PURE__ */
|
|
660
|
+
/* @__PURE__ */ jsxs4("div", { className: "ms-auto flex items-center gap-2", children: [
|
|
653
661
|
/* @__PURE__ */ jsx5(
|
|
654
662
|
Button,
|
|
655
663
|
{
|
|
@@ -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-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;AAAA,QACF,SACE;AAAA,MACJ;AAAA,MACA,MAA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AAA,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,gBAAAC,MAAC,SAAI,WAAU,mCACb;AAAA,gCAAAD;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,gBAAAA,KAAC,UAAO,MAAK,UAAS,SAAQ,WAAU,MAAK,MAAK,SAAS,aACxD,sBACH;AAAA,iBACF;AAAA,eACF;AAAA;AAAA;AAAA,MACF;AAAA,MACC,QACC,gBAAAA;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","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 { ChevronDown, ChevronLeft, ChevronRight } from \"lucide-react\"\nimport { cn } from \"../lib/utils\"\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>\n\n// Module-level so its identity is stable; an inline component remounts the <select> (losing focus) on every Calendar render.\nfunction CalendarSelect({ children, ...selectProps }: React.SelectHTMLAttributes<HTMLSelectElement>) {\n return (\n <>\n <select {...selectProps}>{children}</select>\n <ChevronDown aria-hidden=\"true\" className=\"pointer-events-none absolute end-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground\" />\n </>\n )\n}\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: \"relative 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: \"absolute inset-x-0 top-0 z-10 flex h-8 items-center pointer-events-none\",\n button_previous: cn(\n \"pointer-events-auto absolute start-0 top-1/2 -translate-y-1/2 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 \"pointer-events-auto absolute end-0 top-1/2 -translate-y-1/2 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 dropdown_root: \"relative\",\n dropdowns: \"flex items-center gap-1.5 justify-center\",\n dropdown:\n \"h-7 appearance-none rounded-md border border-input bg-background ps-2 pe-6 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 Select: CalendarSelect,\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,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AAA,eACF;AAAA,YACA,gBAAAC,MAAC,SAAI,WAAU,sDACZ;AAAA,2BACC,gBAAAD;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,gBAAAC,MAAC,SAAI,WAAU,mCACb;AAAA,gCAAAD;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,gBAAAA,KAAC,UAAO,MAAK,UAAS,SAAQ,WAAU,MAAK,MAAK,SAAS,aACxD,sBACH;AAAA,iBACF;AAAA,eACF;AAAA;AAAA;AAAA,MACF;AAAA,MACC,QACC,gBAAAA;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","jsx","jsxs","React","jsx","React","jsx","jsxs","minutesOfDay","jsx","jsxs"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/help-widget/app-id-typecheck.ts
|
|
21
|
+
var app_id_typecheck_exports = {};
|
|
22
|
+
__export(app_id_typecheck_exports, {
|
|
23
|
+
invalidAppId: () => invalidAppId,
|
|
24
|
+
validAppId: () => validAppId
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(app_id_typecheck_exports);
|
|
27
|
+
var validAppId = "people";
|
|
28
|
+
var invalidAppId = "not-a-real-app";
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
invalidAppId,
|
|
32
|
+
validAppId
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=app-id-typecheck.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/help-widget/app-id-typecheck.ts"],"sourcesContent":["/**\n * Compile-time proof that HelpWidgetProps.appId is a real typed union, not `string`\n * (acai-ai-platform#2831 acceptance: \"an unknown id fails type check\"). Not imported or\n * executed anywhere - `pnpm -r typecheck` is what proves this file.\n */\nimport type { HelpWidgetProps } from \"./help-widget\"\n\nexport const validAppId: HelpWidgetProps[\"appId\"] = \"people\"\n\n// @ts-expect-error - \"not-a-real-app\" is not a SupportAppId\nexport const invalidAppId: HelpWidgetProps[\"appId\"] = \"not-a-real-app\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,IAAM,aAAuC;AAG7C,IAAM,eAAyC;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HelpWidgetProps } from './help-widget.cjs';
|
|
2
|
+
import 'react/jsx-runtime';
|
|
3
|
+
import '../../lib/app-ids.cjs';
|
|
4
|
+
import './highlight-overlay.cjs';
|
|
5
|
+
import './use-help-session.cjs';
|
|
6
|
+
import 'react';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Compile-time proof that HelpWidgetProps.appId is a real typed union, not `string`
|
|
10
|
+
* (acai-ai-platform#2831 acceptance: "an unknown id fails type check"). Not imported or
|
|
11
|
+
* executed anywhere - `pnpm -r typecheck` is what proves this file.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
declare const validAppId: HelpWidgetProps["appId"];
|
|
15
|
+
declare const invalidAppId: HelpWidgetProps["appId"];
|
|
16
|
+
|
|
17
|
+
export { invalidAppId, validAppId };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HelpWidgetProps } from './help-widget.js';
|
|
2
|
+
import 'react/jsx-runtime';
|
|
3
|
+
import '../../lib/app-ids.js';
|
|
4
|
+
import './highlight-overlay.js';
|
|
5
|
+
import './use-help-session.js';
|
|
6
|
+
import 'react';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Compile-time proof that HelpWidgetProps.appId is a real typed union, not `string`
|
|
10
|
+
* (acai-ai-platform#2831 acceptance: "an unknown id fails type check"). Not imported or
|
|
11
|
+
* executed anywhere - `pnpm -r typecheck` is what proves this file.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
declare const validAppId: HelpWidgetProps["appId"];
|
|
15
|
+
declare const invalidAppId: HelpWidgetProps["appId"];
|
|
16
|
+
|
|
17
|
+
export { invalidAppId, validAppId };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/help-widget/app-id-typecheck.ts"],"sourcesContent":["/**\n * Compile-time proof that HelpWidgetProps.appId is a real typed union, not `string`\n * (acai-ai-platform#2831 acceptance: \"an unknown id fails type check\"). Not imported or\n * executed anywhere - `pnpm -r typecheck` is what proves this file.\n */\nimport type { HelpWidgetProps } from \"./help-widget\"\n\nexport const validAppId: HelpWidgetProps[\"appId\"] = \"people\"\n\n// @ts-expect-error - \"not-a-real-app\" is not a SupportAppId\nexport const invalidAppId: HelpWidgetProps[\"appId\"] = \"not-a-real-app\"\n"],"mappings":";AAOO,IAAM,aAAuC;AAG7C,IAAM,eAAyC;","names":[]}
|