@epilot/spark-ui 0.30.2 → 0.30.3

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.
Files changed (133) hide show
  1. package/dist/components/accordion.cjs +1 -1
  2. package/dist/components/accordion.js +1 -1
  3. package/dist/components/alert-dialog.cjs +1 -1
  4. package/dist/components/alert-dialog.js +1 -1
  5. package/dist/components/attachment.cjs +1 -1
  6. package/dist/components/attachment.d.cts +1 -1
  7. package/dist/components/attachment.d.ts +1 -1
  8. package/dist/components/attachment.js +1 -1
  9. package/dist/components/autocomplete.cjs +1 -1
  10. package/dist/components/autocomplete.js +1 -1
  11. package/dist/components/badge.cjs +1 -1
  12. package/dist/components/badge.js +1 -1
  13. package/dist/components/banner.cjs +1 -1
  14. package/dist/components/banner.js +1 -1
  15. package/dist/components/breadcrumbs.cjs +1 -1
  16. package/dist/components/breadcrumbs.js +1 -1
  17. package/dist/components/bubble.cjs +1 -1
  18. package/dist/components/bubble.d.cts +1 -1
  19. package/dist/components/bubble.d.ts +1 -1
  20. package/dist/components/bubble.js +1 -1
  21. package/dist/components/button-group.cjs +1 -1
  22. package/dist/components/button-group.js +1 -1
  23. package/dist/components/button.cjs +1 -1
  24. package/dist/components/button.d.cts +2 -2
  25. package/dist/components/button.d.ts +2 -2
  26. package/dist/components/button.js +1 -1
  27. package/dist/components/calendar.cjs +3 -1
  28. package/dist/components/calendar.cjs.map +1 -1
  29. package/dist/components/calendar.js +3 -1
  30. package/dist/components/calendar.js.map +1 -1
  31. package/dist/components/callout.cjs +1 -1
  32. package/dist/components/callout.js +1 -1
  33. package/dist/components/card.cjs +1 -1
  34. package/dist/components/card.js +1 -1
  35. package/dist/components/combobox.cjs +1 -1
  36. package/dist/components/combobox.js +1 -1
  37. package/dist/components/dialog.cjs +1 -1
  38. package/dist/components/dialog.js +1 -1
  39. package/dist/components/drawer.cjs +1 -1
  40. package/dist/components/drawer.js +1 -1
  41. package/dist/components/dropdown-menu.cjs +1 -1
  42. package/dist/components/dropdown-menu.js +1 -1
  43. package/dist/components/empty-state.cjs +1 -1
  44. package/dist/components/empty-state.d.cts +1 -1
  45. package/dist/components/empty-state.d.ts +1 -1
  46. package/dist/components/empty-state.js +1 -1
  47. package/dist/components/entity-card.cjs +1 -1
  48. package/dist/components/entity-card.js +1 -1
  49. package/dist/components/field.cjs +1 -1
  50. package/dist/components/field.js +1 -1
  51. package/dist/components/hero-metric.cjs +1 -1
  52. package/dist/components/hero-metric.js +1 -1
  53. package/dist/components/info-block.cjs +1 -1
  54. package/dist/components/info-block.d.cts +1 -1
  55. package/dist/components/info-block.d.ts +1 -1
  56. package/dist/components/info-block.js +1 -1
  57. package/dist/components/input-date-time.cjs +7 -2
  58. package/dist/components/input-date-time.cjs.map +1 -1
  59. package/dist/components/input-date-time.js +7 -2
  60. package/dist/components/input-date-time.js.map +1 -1
  61. package/dist/components/input-date.cjs +1 -1
  62. package/dist/components/input-date.js +1 -1
  63. package/dist/components/input-group.cjs +1 -1
  64. package/dist/components/input-group.js +1 -1
  65. package/dist/components/input-otp.cjs +1 -1
  66. package/dist/components/input-otp.js +1 -1
  67. package/dist/components/input.cjs +1 -1
  68. package/dist/components/input.js +1 -1
  69. package/dist/components/list.cjs +1 -1
  70. package/dist/components/list.js +1 -1
  71. package/dist/components/marker.cjs +1 -1
  72. package/dist/components/marker.d.cts +1 -1
  73. package/dist/components/marker.d.ts +1 -1
  74. package/dist/components/marker.js +1 -1
  75. package/dist/components/message-scroller.cjs +1 -1
  76. package/dist/components/message-scroller.js +1 -1
  77. package/dist/components/page-header.cjs +1 -1
  78. package/dist/components/page-header.js +1 -1
  79. package/dist/components/period-tabs.cjs +1 -1
  80. package/dist/components/period-tabs.js +1 -1
  81. package/dist/components/pill.cjs +1 -1
  82. package/dist/components/pill.js +1 -1
  83. package/dist/components/popover.cjs +1 -1
  84. package/dist/components/popover.js +1 -1
  85. package/dist/components/power-network.cjs +1 -1
  86. package/dist/components/power-network.js +1 -1
  87. package/dist/components/schedule-list.cjs +1 -1
  88. package/dist/components/schedule-list.js +1 -1
  89. package/dist/components/select.cjs +1 -1
  90. package/dist/components/select.js +1 -1
  91. package/dist/components/separator.cjs +1 -1
  92. package/dist/components/separator.js +1 -1
  93. package/dist/components/sheet.cjs +1 -1
  94. package/dist/components/sheet.js +1 -1
  95. package/dist/components/skeleton.cjs +1 -1
  96. package/dist/components/skeleton.js +1 -1
  97. package/dist/components/stepper.cjs +1 -1
  98. package/dist/components/stepper.js +1 -1
  99. package/dist/components/table.cjs +1 -1
  100. package/dist/components/table.js +1 -1
  101. package/dist/components/tabs.cjs +1 -1
  102. package/dist/components/tabs.js +1 -1
  103. package/dist/components/textarea.cjs +1 -1
  104. package/dist/components/textarea.js +1 -1
  105. package/dist/components/theme.cjs +1 -1
  106. package/dist/components/theme.js +1 -1
  107. package/dist/components/toast.cjs +1 -1
  108. package/dist/components/toast.js +1 -1
  109. package/dist/components/tooltip.cjs +1 -1
  110. package/dist/components/tooltip.js +1 -1
  111. package/dist/components/trace.cjs +1 -1
  112. package/dist/components/trace.js +1 -1
  113. package/dist/lib/calendar-day-button.cjs +23 -0
  114. package/dist/lib/calendar-day-button.cjs.map +1 -0
  115. package/dist/lib/calendar-day-button.d.cts +14 -0
  116. package/dist/lib/calendar-day-button.d.ts +14 -0
  117. package/dist/lib/calendar-day-button.js +20 -0
  118. package/dist/lib/calendar-day-button.js.map +1 -0
  119. package/dist/lib/calendar-lists.cjs +6 -5
  120. package/dist/lib/calendar-lists.cjs.map +1 -1
  121. package/dist/lib/calendar-lists.js +6 -5
  122. package/dist/lib/calendar-lists.js.map +1 -1
  123. package/dist/lib/input-date-parts.cjs +3 -2
  124. package/dist/lib/input-date-parts.cjs.map +1 -1
  125. package/dist/lib/input-date-parts.js +3 -2
  126. package/dist/lib/input-date-parts.js.map +1 -1
  127. package/dist/lib/scroll-within.cjs +27 -0
  128. package/dist/lib/scroll-within.cjs.map +1 -0
  129. package/dist/lib/scroll-within.d.cts +14 -0
  130. package/dist/lib/scroll-within.d.ts +14 -0
  131. package/dist/lib/scroll-within.js +25 -0
  132. package/dist/lib/scroll-within.js.map +1 -0
  133. package/package.json +1 -1
@@ -2,8 +2,8 @@
2
2
  import { cn } from "../utils/cn.js";
3
3
  import { Icon } from "./icon.js";
4
4
  import { createContext, useContext } from "react";
5
- import { cva } from "class-variance-authority";
6
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { cva } from "class-variance-authority";
7
7
  //#region src/components/empty-state.tsx
8
8
  const emptyStateVariants = cva("flex", {
9
9
  variants: {
@@ -3,8 +3,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_chunk = require("../chunk-DY84GLCh.cjs");
4
4
  let react = require("react");
5
5
  react = require_chunk.__toESM(react);
6
- let class_variance_authority = require("class-variance-authority");
7
6
  let react_jsx_runtime = require("react/jsx-runtime");
7
+ let class_variance_authority = require("class-variance-authority");
8
8
  let cn = require("cn");
9
9
  //#region src/components/entity-card.tsx
10
10
  const EntityCard = ({ className, ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { cn } from "../utils/cn.js";
3
3
  import "react";
4
- import { cva } from "class-variance-authority";
5
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { cva } from "class-variance-authority";
6
6
  //#region src/components/entity-card.tsx
7
7
  const EntityCard = ({ className, ...rest }) => /* @__PURE__ */ jsx("div", {
8
8
  className: cn("flex flex-col overflow-hidden rounded-lg border border-gray bg-(--spark-background)", className),
@@ -8,9 +8,9 @@ const require_components_separator = require("./separator.cjs");
8
8
  const require_components_skeleton = require("./skeleton.cjs");
9
9
  let react = require("react");
10
10
  react = require_chunk.__toESM(react);
11
+ let react_jsx_runtime = require("react/jsx-runtime");
11
12
  let class_variance_authority = require("class-variance-authority");
12
13
  let _base_ui_react_use_render = require("@base-ui/react/use-render");
13
- let react_jsx_runtime = require("react/jsx-runtime");
14
14
  let cn = require("cn");
15
15
  //#region src/components/field.tsx
16
16
  const FieldContext = react.createContext(null);
@@ -7,9 +7,9 @@ import { Separator } from "./separator.js";
7
7
  import { Skeleton } from "./skeleton.js";
8
8
  import * as React$1 from "react";
9
9
  import { useId } from "react";
10
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
11
  import { cva } from "class-variance-authority";
11
12
  import { useRender } from "@base-ui/react/use-render";
12
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
13
  //#region src/components/field.tsx
14
14
  const FieldContext = React$1.createContext(null);
15
15
  function useFieldContext() {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- let class_variance_authority = require("class-variance-authority");
4
3
  let react_jsx_runtime = require("react/jsx-runtime");
4
+ let class_variance_authority = require("class-variance-authority");
5
5
  let cn = require("cn");
6
6
  //#region src/components/hero-metric.tsx
7
7
  const HeroMetric = ({ className, ...rest }) => {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { cn } from "../utils/cn.js";
3
- import { cva } from "class-variance-authority";
4
3
  import { jsx } from "react/jsx-runtime";
4
+ import { cva } from "class-variance-authority";
5
5
  //#region src/components/hero-metric.tsx
6
6
  const HeroMetric = ({ className, ...rest }) => {
7
7
  return /* @__PURE__ */ jsx("div", {
@@ -3,8 +3,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_chunk = require("../chunk-DY84GLCh.cjs");
4
4
  let react = require("react");
5
5
  react = require_chunk.__toESM(react);
6
- let class_variance_authority = require("class-variance-authority");
7
6
  let react_jsx_runtime = require("react/jsx-runtime");
7
+ let class_variance_authority = require("class-variance-authority");
8
8
  let cn = require("cn");
9
9
  //#region src/components/info-block.tsx
10
10
  const infoBlockVariants = (0, class_variance_authority.cva)("flex items-center gap-3", {
@@ -5,7 +5,7 @@ import { VariantProps } from "class-variance-authority";
5
5
 
6
6
  //#region src/components/info-block.d.ts
7
7
  declare const InfoBlock: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
8
- variant?: "default" | "bare" | null | undefined;
8
+ variant?: "bare" | "default" | null | undefined;
9
9
  } & import("class-variance-authority/types").ClassProp) | undefined) => string> & React$1.RefAttributes<HTMLDivElement>>;
10
10
  declare const InfoBlockIcon: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
11
11
  declare const InfoBlockContent: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
@@ -5,7 +5,7 @@ import { VariantProps } from "class-variance-authority";
5
5
 
6
6
  //#region src/components/info-block.d.ts
7
7
  declare const InfoBlock: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
8
- variant?: "default" | "bare" | null | undefined;
8
+ variant?: "bare" | "default" | null | undefined;
9
9
  } & import("class-variance-authority/types").ClassProp) | undefined) => string> & React$1.RefAttributes<HTMLDivElement>>;
10
10
  declare const InfoBlockIcon: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
11
11
  declare const InfoBlockContent: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { cn } from "../utils/cn.js";
3
3
  import * as React$1 from "react";
4
- import { cva } from "class-variance-authority";
5
4
  import { jsx } from "react/jsx-runtime";
5
+ import { cva } from "class-variance-authority";
6
6
  //#region src/components/info-block.tsx
7
7
  const infoBlockVariants = cva("flex items-center gap-3", {
8
8
  variants: { variant: {
@@ -2,6 +2,7 @@
2
2
  "use client";
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  const require_chunk = require("../chunk-DY84GLCh.cjs");
5
+ const require_lib_calendar_day_button = require("../lib/calendar-day-button.cjs");
5
6
  const require_components_button = require("./button.cjs");
6
7
  const require_lib_date_time_mask = require("../lib/date-time-mask.cjs");
7
8
  const require_lib_input_date_parts = require("../lib/input-date-parts.cjs");
@@ -10,8 +11,8 @@ const require_components_calendar = require("./calendar.cjs");
10
11
  const require_components_popover = require("./popover.cjs");
11
12
  let react = require("react");
12
13
  react = require_chunk.__toESM(react);
13
- let _epilot_spark_icons = require("@epilot/spark-icons");
14
14
  let react_jsx_runtime = require("react/jsx-runtime");
15
+ let _epilot_spark_icons = require("@epilot/spark-icons");
15
16
  let ictus_time = require("ictus/time");
16
17
  let cn = require("cn");
17
18
  //#region src/components/input-date-time.tsx
@@ -171,6 +172,10 @@ const InputDateTime = react.forwardRef(function InputDateTime({ calendarLabel, c
171
172
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_calendar.Calendar, {
172
173
  autoFocus: true,
173
174
  ...calendarProps,
175
+ components: {
176
+ DayButton: require_lib_calendar_day_button.ScrollFreeDayButton,
177
+ ...calendarProps?.components
178
+ },
174
179
  mode: "single",
175
180
  month: calendarProps?.month ?? month,
176
181
  onMonthChange: (next) => {
@@ -192,7 +197,7 @@ const InputDateTime = react.forwardRef(function InputDateTime({ calendarLabel, c
192
197
  onPick: (time) => {
193
198
  commitDate(selected ?? getDefaultDate(), time);
194
199
  setOpen(false);
195
- inputRef.current?.focus();
200
+ inputRef.current?.focus({ preventScroll: true });
196
201
  },
197
202
  open,
198
203
  selectedTime,
@@ -1 +1 @@
1
- {"version":3,"file":"input-date-time.cjs","names":["React","parseDatePart","parseDateTime","formatDateTime","useAnnouncement","timesOf","useMaskHandlers","Popover","PopoverAnchor","InputGroup","InputGroupInput","InputGroupAddon","PopoverTrigger","Button","CalendarMonth","PopoverContent","Calendar","TimeList"],"sources":["../../src/components/input-date-time.tsx"],"sourcesContent":["'use client'\n\nimport { CalendarMonth } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport {\n formatDateTime,\n formatTime,\n parseDatePart,\n parseDateTime,\n} from '../lib/date-time-mask'\nimport {\n TimeList,\n timesOf,\n useAnnouncement,\n useMaskHandlers,\n} from '../lib/input-date-parts'\nimport { cn } from '../utils/cn'\nimport { Button } from './button'\nimport { Calendar, type CalendarProps } from './calendar'\nimport { InputGroup, InputGroupAddon, InputGroupInput } from './input-group'\nimport {\n Popover,\n PopoverAnchor,\n PopoverContent,\n PopoverTrigger,\n} from './popover'\n\nfunction useControllableState<T>({\n defaultProp,\n onChange,\n prop,\n}: {\n defaultProp: T\n onChange?: (value: T) => void\n prop?: T\n}) {\n const [uncontrolled, setUncontrolled] = React.useState(defaultProp)\n const isControlled = prop !== undefined\n const value = isControlled ? prop : uncontrolled\n\n const setValue = React.useCallback(\n (next: T) => {\n if (!isControlled) setUncontrolled(next)\n onChange?.(next)\n },\n [isControlled, onChange],\n )\n\n return [value, setValue] as const\n}\n\nconst today = () => new Date()\n\nconst placeholderOf = (separator: string, withTime: boolean) =>\n `DD${separator}MM${separator}YYYY${withTime ? ', HH:MM' : ''}`\n\n/** The field text, the popup and the month shown, and how a pick becomes text. */\nfunction useInputDateTimeState({\n calendarMonth,\n defaultOpen = false,\n defaultValue = '',\n getDefaultDate,\n onDateChange,\n onOpenChange,\n onValueChange,\n open: openProp,\n separator,\n value,\n withTime,\n}: {\n calendarMonth?: Date\n defaultOpen?: boolean\n defaultValue?: string\n getDefaultDate: () => Date\n onDateChange?: (date: Date | undefined) => void\n onOpenChange?: (open: boolean) => void\n onValueChange?: (value: string) => void\n open?: boolean\n separator: string\n value?: string\n withTime: boolean\n}) {\n const [text, setText] = useControllableState({\n defaultProp: defaultValue,\n onChange: onValueChange,\n prop: value,\n })\n const [open, setOpenState] = useControllableState({\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n prop: openProp,\n })\n // the day stays picked while its time is still being typed\n const selected = parseDatePart(text)\n const parsed = parseDateTime(text, withTime)\n const selectedTime = withTime && parsed ? formatTime(parsed) : undefined\n const [month, setMonth] = React.useState<Date | undefined>(\n () => selected ?? calendarMonth,\n )\n const setOpen = React.useCallback(\n (next: boolean) => {\n if (next && calendarMonth === undefined) {\n setMonth(parseDatePart(text) ?? getDefaultDate())\n }\n setOpenState(next)\n },\n [calendarMonth, getDefaultDate, setOpenState, text],\n )\n const commit = React.useCallback(\n (next: string) => {\n if (next === text) return\n setText(next)\n onDateChange?.(parseDateTime(next, withTime))\n },\n [onDateChange, setText, text, withTime],\n )\n const commitDate = (day: Date, time = '00:00') => {\n const next = new Date(day)\n const [hours = 0, minutes = 0] = time.split(':').map(Number)\n next.setHours(hours, minutes, 0, 0)\n commit(formatDateTime(next, separator, withTime))\n }\n return {\n commit,\n commitDate,\n month,\n open,\n selected,\n selectedTime,\n setMonth,\n setOpen,\n text,\n }\n}\n\n/**\n * A date, or a date and a time (`withTime`), in one field with a calendar popup.\n * Input Date's journey-grade sibling: the chosen day takes focus on open, Backspace\n * after a separator deletes the digit before it, pastes go through the mask, and\n * ignored keys can be read out.\n */\nexport type InputDateTimeProps = Omit<\n React.ComponentProps<'input'>,\n 'children' | 'defaultValue' | 'onChange' | 'readOnly' | 'type' | 'value'\n> & {\n calendarLabel: string\n calendarProps?: Omit<CalendarProps, 'mode' | 'onSelect' | 'selected'>\n /** Element the calendar popup mounts into, e.g. the drawer it sits in. */\n container?: React.ComponentProps<typeof PopoverContent>['container']\n defaultOpen?: boolean\n /** `HH:MM` a day picked from the calendar gets while no time is set. */\n defaultTime?: string\n defaultValue?: string\n /** The day a time picked before any date applies to; today by default. */\n getDefaultDate?: () => Date\n /** The date, with its time when `withTime`; undefined until complete. */\n onDateChange?: (date: Date | undefined) => void\n onOpenChange?: (open: boolean) => void\n onValueChange?: (value: string) => void\n open?: boolean\n pickerOnly?: boolean\n /** Read out politely when a key the field ignores is typed, e.g. \"Only numbers are allowed\". */\n rejectedKeyMessage?: string\n separator?: string\n /** Names the time list. */\n timeLabel?: string\n /** Minutes between the times offered; 30 by default, 5 at least. */\n timeStep?: number\n value?: string\n /** Adds `, HH:MM` to the field and a time list beside the calendar. */\n withTime?: boolean\n}\n\nconst InputDateTime = React.forwardRef<HTMLInputElement, InputDateTimeProps>(\n function InputDateTime(\n {\n calendarLabel,\n calendarProps,\n className,\n container,\n defaultOpen,\n defaultTime = '08:00',\n defaultValue,\n disabled,\n getDefaultDate = today,\n id,\n onDateChange,\n onKeyDown,\n onOpenChange,\n onPaste,\n onValueChange,\n open: openProp,\n pickerOnly = false,\n placeholder,\n rejectedKeyMessage,\n separator = '.',\n timeLabel,\n timeStep = 30,\n value: valueProp,\n withTime = false,\n ...props\n },\n ref,\n ) {\n const inputRef = React.useRef<HTMLInputElement>(null)\n const [status, announce] = useAnnouncement()\n const {\n commit,\n commitDate,\n month,\n open,\n selected,\n selectedTime,\n setMonth,\n setOpen,\n text,\n } = useInputDateTimeState({\n calendarMonth: calendarProps?.month,\n defaultOpen,\n defaultValue,\n getDefaultDate,\n onDateChange,\n onOpenChange,\n onValueChange,\n open: openProp,\n separator,\n value: valueProp,\n withTime,\n })\n\n const setInputRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) ref.current = node\n },\n [ref],\n )\n\n const times = React.useMemo(\n () => (withTime ? timesOf(timeStep, selectedTime) : []),\n [selectedTime, timeStep, withTime],\n )\n\n const handlers = useMaskHandlers({\n commit,\n inputRef,\n onKeyDown,\n onOpen: () => setOpen(true),\n onPaste,\n onRejectedKey: () => {\n if (rejectedKeyMessage) announce(rejectedKeyMessage)\n },\n pickerOnly,\n separator,\n withTime,\n })\n\n return (\n <Popover onOpenChange={setOpen} open={open}>\n {/* a plain element anchors the popup: InputGroup drops its ref on React 18 */}\n <PopoverAnchor render={<div className=\"min-w-0\" />}>\n <InputGroup className={className}>\n <InputGroupInput\n autoComplete=\"off\"\n {...props}\n className={cn(pickerOnly && 'cursor-pointer')}\n disabled={disabled}\n id={id}\n inputMode={pickerOnly ? undefined : 'numeric'}\n onChange={() => {}}\n onClick={(event) => {\n props.onClick?.(event)\n // picker-only: the value opens the calendar instead of taking a caret\n if (pickerOnly && !disabled && !event.defaultPrevented)\n setOpen(true)\n }}\n {...handlers}\n placeholder={placeholder ?? placeholderOf(separator, withTime)}\n readOnly={pickerOnly}\n ref={setInputRef}\n spellCheck={false}\n value={text}\n />\n <InputGroupAddon align=\"inline-end\">\n <PopoverTrigger\n render={\n <Button\n aria-label={calendarLabel}\n color=\"neutral\"\n disabled={disabled}\n size=\"icon-small\"\n styleVariant=\"ghost\"\n >\n <CalendarMonth />\n </Button>\n }\n />\n </InputGroupAddon>\n </InputGroup>\n </PopoverAnchor>\n {status}\n <PopoverContent\n align=\"start\"\n aria-label={calendarLabel}\n className=\"w-auto p-0\"\n collisionAvoidance={{ side: 'flip', fallbackAxisSide: 'none' }}\n container={container}\n >\n {/* a month or year list replaces the days, and the times step aside for it */}\n <div className=\"flex max-sm:flex-col has-[[data-slot=calendar-list]]:[&>[data-slot=input-date-times]]:hidden\">\n <Calendar\n // oxlint-disable-next-line jsx-a11y/no-autofocus -- DayPicker prop: the picked day takes focus when the popup opens\n autoFocus\n {...calendarProps}\n mode=\"single\"\n month={calendarProps?.month ?? month}\n onMonthChange={(next) => {\n calendarProps?.onMonthChange?.(next)\n if (calendarProps?.month === undefined) setMonth(next)\n }}\n onSelect={(next) => {\n if (!withTime) {\n commit(next ? formatDateTime(next, separator) : '')\n setOpen(false)\n return\n }\n // a time is picked next, so the popup stays open\n if (next) commitDate(next, selectedTime ?? defaultTime)\n }}\n selected={selected}\n />\n {withTime && (\n <TimeList\n defaultTime={defaultTime}\n label={timeLabel}\n onPick={(time) => {\n commitDate(selected ?? getDefaultDate(), time)\n setOpen(false)\n inputRef.current?.focus()\n }}\n open={open}\n selectedTime={selectedTime}\n times={times}\n />\n )}\n </div>\n </PopoverContent>\n </Popover>\n )\n },\n)\n\nexport { InputDateTime }\nexport {\n dateTimeStatus,\n formatDateTime,\n parseDateTime,\n type D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eAAf,CACE,iBAAA,GAAA,kBAAA,KAACC,4BAAAA,UAAD;MAEE,WAAA;MACA,GAAI;MACJ,MAAK;MACL,OAAO,eAAe,SAAS;MAC/B,gBAAgB,SAAS;OACvB,eAAe,gBAAgB,IAAI;OACnC,IAAI,eAAe,UAAU,KAAA,GAAW,SAAS,IAAI;MACvD;MACA,WAAW,SAAS;OAClB,IAAI,CAAC,UAAU;QACb,OAAO,OAAOb,2BAAAA,eAAe,MAAM,SAAS,IAAI,EAAE;QAClD,QAAQ,KAAK;QACb;OACF;OAEA,IAAI,MAAM,WAAW,MAAM,gBAAgB,WAAW;MACxD;MACU;KACX,CAAA,GACA,YACC,iBAAA,GAAA,kBAAA,KAACc,6BAAAA,UAAD;MACe;MACb,OAAO;MACP,SAAS,SAAS;OAChB,WAAW,YAAY,eAAe,GAAG,IAAI;OAC7C,QAAQ,KAAK;OACb,SAAS,SAAS,MAAM;MAC1B;MACM;MACQ;MACP;KACR,CAAA,CAEA;;GACS,CAAA;EACT;;AAEb,CACF"}
1
+ {"version":3,"file":"input-date-time.cjs","names":["React","parseDatePart","parseDateTime","formatDateTime","useAnnouncement","timesOf","useMaskHandlers","Popover","PopoverAnchor","InputGroup","InputGroupInput","InputGroupAddon","PopoverTrigger","Button","CalendarMonth","PopoverContent","Calendar","ScrollFreeDayButton","TimeList"],"sources":["../../src/components/input-date-time.tsx"],"sourcesContent":["'use client'\n\nimport { CalendarMonth } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { ScrollFreeDayButton } from '../lib/calendar-day-button'\nimport {\n formatDateTime,\n formatTime,\n parseDatePart,\n parseDateTime,\n} from '../lib/date-time-mask'\nimport {\n TimeList,\n timesOf,\n useAnnouncement,\n useMaskHandlers,\n} from '../lib/input-date-parts'\nimport { cn } from '../utils/cn'\nimport { Button } from './button'\nimport { Calendar, type CalendarProps } from './calendar'\nimport { InputGroup, InputGroupAddon, InputGroupInput } from './input-group'\nimport {\n Popover,\n PopoverAnchor,\n PopoverContent,\n PopoverTrigger,\n} from './popover'\n\nfunction useControllableState<T>({\n defaultProp,\n onChange,\n prop,\n}: {\n defaultProp: T\n onChange?: (value: T) => void\n prop?: T\n}) {\n const [uncontrolled, setUncontrolled] = React.useState(defaultProp)\n const isControlled = prop !== undefined\n const value = isControlled ? prop : uncontrolled\n\n const setValue = React.useCallback(\n (next: T) => {\n if (!isControlled) setUncontrolled(next)\n onChange?.(next)\n },\n [isControlled, onChange],\n )\n\n return [value, setValue] as const\n}\n\nconst today = () => new Date()\n\nconst placeholderOf = (separator: string, withTime: boolean) =>\n `DD${separator}MM${separator}YYYY${withTime ? ', HH:MM' : ''}`\n\n/** The field text, the popup and the month shown, and how a pick becomes text. */\nfunction useInputDateTimeState({\n calendarMonth,\n defaultOpen = false,\n defaultValue = '',\n getDefaultDate,\n onDateChange,\n onOpenChange,\n onValueChange,\n open: openProp,\n separator,\n value,\n withTime,\n}: {\n calendarMonth?: Date\n defaultOpen?: boolean\n defaultValue?: string\n getDefaultDate: () => Date\n onDateChange?: (date: Date | undefined) => void\n onOpenChange?: (open: boolean) => void\n onValueChange?: (value: string) => void\n open?: boolean\n separator: string\n value?: string\n withTime: boolean\n}) {\n const [text, setText] = useControllableState({\n defaultProp: defaultValue,\n onChange: onValueChange,\n prop: value,\n })\n const [open, setOpenState] = useControllableState({\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n prop: openProp,\n })\n // the day stays picked while its time is still being typed\n const selected = parseDatePart(text)\n const parsed = parseDateTime(text, withTime)\n const selectedTime = withTime && parsed ? formatTime(parsed) : undefined\n const [month, setMonth] = React.useState<Date | undefined>(\n () => selected ?? calendarMonth,\n )\n const setOpen = React.useCallback(\n (next: boolean) => {\n if (next && calendarMonth === undefined) {\n setMonth(parseDatePart(text) ?? getDefaultDate())\n }\n setOpenState(next)\n },\n [calendarMonth, getDefaultDate, setOpenState, text],\n )\n const commit = React.useCallback(\n (next: string) => {\n if (next === text) return\n setText(next)\n onDateChange?.(parseDateTime(next, withTime))\n },\n [onDateChange, setText, text, withTime],\n )\n const commitDate = (day: Date, time = '00:00') => {\n const next = new Date(day)\n const [hours = 0, minutes = 0] = time.split(':').map(Number)\n next.setHours(hours, minutes, 0, 0)\n commit(formatDateTime(next, separator, withTime))\n }\n return {\n commit,\n commitDate,\n month,\n open,\n selected,\n selectedTime,\n setMonth,\n setOpen,\n text,\n }\n}\n\n/**\n * A date, or a date and a time (`withTime`), in one field with a calendar popup.\n * Input Date's journey-grade sibling: the chosen day takes focus on open, Backspace\n * after a separator deletes the digit before it, pastes go through the mask, and\n * ignored keys can be read out.\n */\nexport type InputDateTimeProps = Omit<\n React.ComponentProps<'input'>,\n 'children' | 'defaultValue' | 'onChange' | 'readOnly' | 'type' | 'value'\n> & {\n calendarLabel: string\n calendarProps?: Omit<CalendarProps, 'mode' | 'onSelect' | 'selected'>\n /** Element the calendar popup mounts into, e.g. the drawer it sits in. */\n container?: React.ComponentProps<typeof PopoverContent>['container']\n defaultOpen?: boolean\n /** `HH:MM` a day picked from the calendar gets while no time is set. */\n defaultTime?: string\n defaultValue?: string\n /** The day a time picked before any date applies to; today by default. */\n getDefaultDate?: () => Date\n /** The date, with its time when `withTime`; undefined until complete. */\n onDateChange?: (date: Date | undefined) => void\n onOpenChange?: (open: boolean) => void\n onValueChange?: (value: string) => void\n open?: boolean\n pickerOnly?: boolean\n /** Read out politely when a key the field ignores is typed, e.g. \"Only numbers are allowed\". */\n rejectedKeyMessage?: string\n separator?: string\n /** Names the time list. */\n timeLabel?: string\n /** Minutes between the times offered; 30 by default, 5 at least. */\n timeStep?: number\n value?: string\n /** Adds `, HH:MM` to the field and a time list beside the calendar. */\n withTime?: boolean\n}\n\nconst InputDateTime = React.forwardRef<HTMLInputElement, InputDateTimeProps>(\n function InputDateTime(\n {\n calendarLabel,\n calendarProps,\n className,\n container,\n defaultOpen,\n defaultTime = '08:00',\n defaultValue,\n disabled,\n getDefaultDate = today,\n id,\n onDateChange,\n onKeyDown,\n onOpenChange,\n onPaste,\n onValueChange,\n open: openProp,\n pickerOnly = false,\n placeholder,\n rejectedKeyMessage,\n separator = '.',\n timeLabel,\n timeStep = 30,\n value: valueProp,\n withTime = false,\n ...props\n },\n ref,\n ) {\n const inputRef = React.useRef<HTMLInputElement>(null)\n const [status, announce] = useAnnouncement()\n const {\n commit,\n commitDate,\n month,\n open,\n selected,\n selectedTime,\n setMonth,\n setOpen,\n text,\n } = useInputDateTimeState({\n calendarMonth: calendarProps?.month,\n defaultOpen,\n defaultValue,\n getDefaultDate,\n onDateChange,\n onOpenChange,\n onValueChange,\n open: openProp,\n separator,\n value: valueProp,\n withTime,\n })\n\n const setInputRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) ref.current = node\n },\n [ref],\n )\n\n const times = React.useMemo(\n () => (withTime ? timesOf(timeStep, selectedTime) : []),\n [selectedTime, timeStep, withTime],\n )\n\n const handlers = useMaskHandlers({\n commit,\n inputRef,\n onKeyDown,\n onOpen: () => setOpen(true),\n onPaste,\n onRejectedKey: () => {\n if (rejectedKeyMessage) announce(rejectedKeyMessage)\n },\n pickerOnly,\n separator,\n withTime,\n })\n\n return (\n <Popover onOpenChange={setOpen} open={open}>\n {/* a plain element anchors the popup: InputGroup drops its ref on React 18 */}\n <PopoverAnchor render={<div className=\"min-w-0\" />}>\n <InputGroup className={className}>\n <InputGroupInput\n autoComplete=\"off\"\n {...props}\n className={cn(pickerOnly && 'cursor-pointer')}\n disabled={disabled}\n id={id}\n inputMode={pickerOnly ? undefined : 'numeric'}\n onChange={() => {}}\n onClick={(event) => {\n props.onClick?.(event)\n // picker-only: the value opens the calendar instead of taking a caret\n if (pickerOnly && !disabled && !event.defaultPrevented)\n setOpen(true)\n }}\n {...handlers}\n placeholder={placeholder ?? placeholderOf(separator, withTime)}\n readOnly={pickerOnly}\n ref={setInputRef}\n spellCheck={false}\n value={text}\n />\n <InputGroupAddon align=\"inline-end\">\n <PopoverTrigger\n render={\n <Button\n aria-label={calendarLabel}\n color=\"neutral\"\n disabled={disabled}\n size=\"icon-small\"\n styleVariant=\"ghost\"\n >\n <CalendarMonth />\n </Button>\n }\n />\n </InputGroupAddon>\n </InputGroup>\n </PopoverAnchor>\n {status}\n <PopoverContent\n align=\"start\"\n aria-label={calendarLabel}\n className=\"w-auto p-0\"\n collisionAvoidance={{ side: 'flip', fallbackAxisSide: 'none' }}\n container={container}\n >\n {/* a month or year list replaces the days, and the times step aside for it */}\n <div className=\"flex max-sm:flex-col has-[[data-slot=calendar-list]]:[&>[data-slot=input-date-times]]:hidden\">\n <Calendar\n // oxlint-disable-next-line jsx-a11y/no-autofocus -- DayPicker prop: the picked day takes focus when the popup opens\n autoFocus\n {...calendarProps}\n // the picked day takes focus on open without scrolling the page\n components={{\n DayButton: ScrollFreeDayButton,\n ...calendarProps?.components,\n }}\n mode=\"single\"\n month={calendarProps?.month ?? month}\n onMonthChange={(next) => {\n calendarProps?.onMonthChange?.(next)\n if (calendarProps?.month === undefined) setMonth(next)\n }}\n onSelect={(next) => {\n if (!withTime) {\n commit(next ? formatDateTime(next, separator) : '')\n setOpen(false)\n return\n }\n // a time is picked next, so the popup stays open\n if (next) commitDate(next, selectedTime ?? defaultTime)\n }}\n selected={selected}\n />\n {withTime && (\n <TimeList\n defaultTime={defaultTime}\n label={timeLabel}\n onPick={(time) => {\n commitDate(selected ?? getDefaultDate(), time)\n setOpen(false)\n inputRef.current?.focus({ preventScroll: true })\n }}\n open={open}\n selectedTime={selectedTime}\n times={times}\n />\n )}\n </div>\n </PopoverContent>\n </Popover>\n )\n },\n)\n\nexport { InputDateTime }\nexport {\n dateTimeStatus,\n formatDateTime,\n parseDateTime,\n type DateTimeStatus,\n} from '../lib/date-time-mask'\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,SAAS,qBAAwB,EAC/B,aACA,UACA,QAKC;CACD,MAAM,CAAC,cAAc,mBAAmBA,MAAM,SAAS,WAAW;CAClE,MAAM,eAAe,SAAS,KA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AAS;OACvB,eAAe,gBAAgB,IAAI;OACnC,IAAI,eAAe,UAAU,KAAA,GAAW,SAAS,IAAI;MACvD;MACA,WAAW,SAAS;OAClB,IAAI,CAAC,UAAU;QACb,OAAO,OAAOd,2BAAAA,eAAe,MAAM,SAAS,IAAI,EAAE;QAClD,QAAQ,KAAK;QACb;OACF;OAEA,IAAI,MAAM,WAAW,MAAM,gBAAgB,WAAW;MACxD;MACU;KACX,CAAA,GACA,YACC,iBAAA,GAAA,kBAAA,KAACe,6BAAAA,UAAD;MACe;MACb,OAAO;MACP,SAAS,SAAS;OAChB,WAAW,YAAY,eAAe,GAAG,IAAI;OAC7C,QAAQ,KAAK;OACb,SAAS,SAAS,MAAM,EAAE,eAAe,KAAK,CAAC;MACjD;MACM;MACQ;MACP;KACR,CAAA,CAEA;;GACS,CAAA;EACT;;AAEb,CACF"}
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  "use client";
3
+ import { ScrollFreeDayButton } from "../lib/calendar-day-button.js";
3
4
  import { cn } from "../utils/cn.js";
4
5
  import { Button } from "./button.js";
5
6
  import { dateTimeStatus, formatDateTime, formatTime, parseDatePart, parseDateTime } from "../lib/date-time-mask.js";
@@ -8,8 +9,8 @@ import { InputGroup, InputGroupAddon, InputGroupInput } from "./input-group.js";
8
9
  import { Calendar } from "./calendar.js";
9
10
  import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "./popover.js";
10
11
  import * as React$1 from "react";
11
- import { CalendarMonth } from "@epilot/spark-icons";
12
12
  import { jsx, jsxs } from "react/jsx-runtime";
13
+ import { CalendarMonth } from "@epilot/spark-icons";
13
14
  //#region src/components/input-date-time.tsx
14
15
  function useControllableState({ defaultProp, onChange, prop }) {
15
16
  const [uncontrolled, setUncontrolled] = React$1.useState(defaultProp);
@@ -167,6 +168,10 @@ const InputDateTime = React$1.forwardRef(function InputDateTime({ calendarLabel,
167
168
  children: [/* @__PURE__ */ jsx(Calendar, {
168
169
  autoFocus: true,
169
170
  ...calendarProps,
171
+ components: {
172
+ DayButton: ScrollFreeDayButton,
173
+ ...calendarProps?.components
174
+ },
170
175
  mode: "single",
171
176
  month: calendarProps?.month ?? month,
172
177
  onMonthChange: (next) => {
@@ -188,7 +193,7 @@ const InputDateTime = React$1.forwardRef(function InputDateTime({ calendarLabel,
188
193
  onPick: (time) => {
189
194
  commitDate(selected ?? getDefaultDate(), time);
190
195
  setOpen(false);
191
- inputRef.current?.focus();
196
+ inputRef.current?.focus({ preventScroll: true });
192
197
  },
193
198
  open,
194
199
  selectedTime,
@@ -1 +1 @@
1
- {"version":3,"file":"input-date-time.js","names":["React"],"sources":["../../src/components/input-date-time.tsx"],"sourcesContent":["'use client'\n\nimport { CalendarMonth } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport {\n formatDateTime,\n formatTime,\n parseDatePart,\n parseDateTime,\n} from '../lib/date-time-mask'\nimport {\n TimeList,\n timesOf,\n useAnnouncement,\n useMaskHandlers,\n} from '../lib/input-date-parts'\nimport { cn } from '../utils/cn'\nimport { Button } from './button'\nimport { Calendar, type CalendarProps } from './calendar'\nimport { InputGroup, InputGroupAddon, InputGroupInput } from './input-group'\nimport {\n Popover,\n PopoverAnchor,\n PopoverContent,\n PopoverTrigger,\n} from './popover'\n\nfunction useControllableState<T>({\n defaultProp,\n onChange,\n prop,\n}: {\n defaultProp: T\n onChange?: (value: T) => void\n prop?: T\n}) {\n const [uncontrolled, setUncontrolled] = React.useState(defaultProp)\n const isControlled = prop !== undefined\n const value = isControlled ? prop : uncontrolled\n\n const setValue = React.useCallback(\n (next: T) => {\n if (!isControlled) setUncontrolled(next)\n onChange?.(next)\n },\n [isControlled, onChange],\n )\n\n return [value, setValue] as const\n}\n\nconst today = () => new Date()\n\nconst placeholderOf = (separator: string, withTime: boolean) =>\n `DD${separator}MM${separator}YYYY${withTime ? ', HH:MM' : ''}`\n\n/** The field text, the popup and the month shown, and how a pick becomes text. */\nfunction useInputDateTimeState({\n calendarMonth,\n defaultOpen = false,\n defaultValue = '',\n getDefaultDate,\n onDateChange,\n onOpenChange,\n onValueChange,\n open: openProp,\n separator,\n value,\n withTime,\n}: {\n calendarMonth?: Date\n defaultOpen?: boolean\n defaultValue?: string\n getDefaultDate: () => Date\n onDateChange?: (date: Date | undefined) => void\n onOpenChange?: (open: boolean) => void\n onValueChange?: (value: string) => void\n open?: boolean\n separator: string\n value?: string\n withTime: boolean\n}) {\n const [text, setText] = useControllableState({\n defaultProp: defaultValue,\n onChange: onValueChange,\n prop: value,\n })\n const [open, setOpenState] = useControllableState({\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n prop: openProp,\n })\n // the day stays picked while its time is still being typed\n const selected = parseDatePart(text)\n const parsed = parseDateTime(text, withTime)\n const selectedTime = withTime && parsed ? formatTime(parsed) : undefined\n const [month, setMonth] = React.useState<Date | undefined>(\n () => selected ?? calendarMonth,\n )\n const setOpen = React.useCallback(\n (next: boolean) => {\n if (next && calendarMonth === undefined) {\n setMonth(parseDatePart(text) ?? getDefaultDate())\n }\n setOpenState(next)\n },\n [calendarMonth, getDefaultDate, setOpenState, text],\n )\n const commit = React.useCallback(\n (next: string) => {\n if (next === text) return\n setText(next)\n onDateChange?.(parseDateTime(next, withTime))\n },\n [onDateChange, setText, text, withTime],\n )\n const commitDate = (day: Date, time = '00:00') => {\n const next = new Date(day)\n const [hours = 0, minutes = 0] = time.split(':').map(Number)\n next.setHours(hours, minutes, 0, 0)\n commit(formatDateTime(next, separator, withTime))\n }\n return {\n commit,\n commitDate,\n month,\n open,\n selected,\n selectedTime,\n setMonth,\n setOpen,\n text,\n }\n}\n\n/**\n * A date, or a date and a time (`withTime`), in one field with a calendar popup.\n * Input Date's journey-grade sibling: the chosen day takes focus on open, Backspace\n * after a separator deletes the digit before it, pastes go through the mask, and\n * ignored keys can be read out.\n */\nexport type InputDateTimeProps = Omit<\n React.ComponentProps<'input'>,\n 'children' | 'defaultValue' | 'onChange' | 'readOnly' | 'type' | 'value'\n> & {\n calendarLabel: string\n calendarProps?: Omit<CalendarProps, 'mode' | 'onSelect' | 'selected'>\n /** Element the calendar popup mounts into, e.g. the drawer it sits in. */\n container?: React.ComponentProps<typeof PopoverContent>['container']\n defaultOpen?: boolean\n /** `HH:MM` a day picked from the calendar gets while no time is set. */\n defaultTime?: string\n defaultValue?: string\n /** The day a time picked before any date applies to; today by default. */\n getDefaultDate?: () => Date\n /** The date, with its time when `withTime`; undefined until complete. */\n onDateChange?: (date: Date | undefined) => void\n onOpenChange?: (open: boolean) => void\n onValueChange?: (value: string) => void\n open?: boolean\n pickerOnly?: boolean\n /** Read out politely when a key the field ignores is typed, e.g. \"Only numbers are allowed\". */\n rejectedKeyMessage?: string\n separator?: string\n /** Names the time list. */\n timeLabel?: string\n /** Minutes between the times offered; 30 by default, 5 at least. */\n timeStep?: number\n value?: string\n /** Adds `, HH:MM` to the field and a time list beside the calendar. */\n withTime?: boolean\n}\n\nconst InputDateTime = React.forwardRef<HTMLInputElement, InputDateTimeProps>(\n function InputDateTime(\n {\n calendarLabel,\n calendarProps,\n className,\n container,\n defaultOpen,\n defaultTime = '08:00',\n defaultValue,\n disabled,\n getDefaultDate = today,\n id,\n onDateChange,\n onKeyDown,\n onOpenChange,\n onPaste,\n onValueChange,\n open: openProp,\n pickerOnly = false,\n placeholder,\n rejectedKeyMessage,\n separator = '.',\n timeLabel,\n timeStep = 30,\n value: valueProp,\n withTime = false,\n ...props\n },\n ref,\n ) {\n const inputRef = React.useRef<HTMLInputElement>(null)\n const [status, announce] = useAnnouncement()\n const {\n commit,\n commitDate,\n month,\n open,\n selected,\n selectedTime,\n setMonth,\n setOpen,\n text,\n } = useInputDateTimeState({\n calendarMonth: calendarProps?.month,\n defaultOpen,\n defaultValue,\n getDefaultDate,\n onDateChange,\n onOpenChange,\n onValueChange,\n open: openProp,\n separator,\n value: valueProp,\n withTime,\n })\n\n const setInputRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) ref.current = node\n },\n [ref],\n )\n\n const times = React.useMemo(\n () => (withTime ? timesOf(timeStep, selectedTime) : []),\n [selectedTime, timeStep, withTime],\n )\n\n const handlers = useMaskHandlers({\n commit,\n inputRef,\n onKeyDown,\n onOpen: () => setOpen(true),\n onPaste,\n onRejectedKey: () => {\n if (rejectedKeyMessage) announce(rejectedKeyMessage)\n },\n pickerOnly,\n separator,\n withTime,\n })\n\n return (\n <Popover onOpenChange={setOpen} open={open}>\n {/* a plain element anchors the popup: InputGroup drops its ref on React 18 */}\n <PopoverAnchor render={<div className=\"min-w-0\" />}>\n <InputGroup className={className}>\n <InputGroupInput\n autoComplete=\"off\"\n {...props}\n className={cn(pickerOnly && 'cursor-pointer')}\n disabled={disabled}\n id={id}\n inputMode={pickerOnly ? undefined : 'numeric'}\n onChange={() => {}}\n onClick={(event) => {\n props.onClick?.(event)\n // picker-only: the value opens the calendar instead of taking a caret\n if (pickerOnly && !disabled && !event.defaultPrevented)\n setOpen(true)\n }}\n {...handlers}\n placeholder={placeholder ?? placeholderOf(separator, withTime)}\n readOnly={pickerOnly}\n ref={setInputRef}\n spellCheck={false}\n value={text}\n />\n <InputGroupAddon align=\"inline-end\">\n <PopoverTrigger\n render={\n <Button\n aria-label={calendarLabel}\n color=\"neutral\"\n disabled={disabled}\n size=\"icon-small\"\n styleVariant=\"ghost\"\n >\n <CalendarMonth />\n </Button>\n }\n />\n </InputGroupAddon>\n </InputGroup>\n </PopoverAnchor>\n {status}\n <PopoverContent\n align=\"start\"\n aria-label={calendarLabel}\n className=\"w-auto p-0\"\n collisionAvoidance={{ side: 'flip', fallbackAxisSide: 'none' }}\n container={container}\n >\n {/* a month or year list replaces the days, and the times step aside for it */}\n <div className=\"flex max-sm:flex-col has-[[data-slot=calendar-list]]:[&>[data-slot=input-date-times]]:hidden\">\n <Calendar\n // oxlint-disable-next-line jsx-a11y/no-autofocus -- DayPicker prop: the picked day takes focus when the popup opens\n autoFocus\n {...calendarProps}\n mode=\"single\"\n month={calendarProps?.month ?? month}\n onMonthChange={(next) => {\n calendarProps?.onMonthChange?.(next)\n if (calendarProps?.month === undefined) setMonth(next)\n }}\n onSelect={(next) => {\n if (!withTime) {\n commit(next ? formatDateTime(next, separator) : '')\n setOpen(false)\n return\n }\n // a time is picked next, so the popup stays open\n if (next) commitDate(next, selectedTime ?? defaultTime)\n }}\n selected={selected}\n />\n {withTime && (\n <TimeList\n defaultTime={defaultTime}\n label={timeLabel}\n onPick={(time) => {\n commitDate(selected ?? getDefaultDate(), time)\n setOpen(false)\n inputRef.current?.focus()\n }}\n open={open}\n selectedTime={selectedTime}\n times={times}\n />\n )}\n </div>\n </PopoverContent>\n </Popover>\n )\n },\n)\n\nexport { InputDateTime }\nexport {\n dateTimeStatus,\n formatDateTime,\n parseDateTime,\n type DateTimeStatus,\n} from '../lib/date-time-mask'\n"],"mappings":";;;;;;;;;;;;;AA2BA,SAAS,qBAAwB,EAC/B,aACA,UACA,QAKC;CACD,MAAM,CAAC,cAAc,mBAAmBA,QAAM,SAAS,WAAW;CAClE,MAAM,eAAe,SAAS,KAAA;CAW9B,OAAO,CAVO,eAAe,OAAO,cAEnBA,QAAM,aACpB,SAAY;EACX,IAAI,CAAC,cAAc,gBAAgB,IAAI;EACvC,WAAW,IAAI;CACjB,GACA,CAAC,cAAc,QAAQ,CAGH,CAAC;AACzB;AAEA,MAAM,8BAAc,IAAI,KAAK;AAE7B,MAAM,iBAAiB,WAAmB,aACxC,KAAK,UAAU,IAAI,UAAU,MAAM,WAAW,YAAY;;AAG5D,SAAS,sBAAsB,EAC7B,eACA,cAAc,OACd,eAAe,IACf,gBACA,cACA,cACA,eACA,MAAM,UACN,WACA,OACA,YAaC;CACD,MAAM,CAAC,MAAM,WAAW,qBAAqB;EAC3C,aAAa;EACb,UAAU;EACV,MAAM;CACR,CAAC;CACD,MAAM,CAAC,MAAM,gBAAgB,qBAAqB;EAChD,aAAa;EACb,UAAU;EACV,MAAM;CACR,CAAC;CAED,MAAM,WAAW,cAAc,IAAI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WAAU;IACV,oBAAoB;KAAE,MAAM;KAAQ,kBAAkB;IAAO;IAClD;cAGX,qBAAC,OAAD;KAAK,WAAU;eAAf,CACE,oBAAC,UAAD;MAEE,WAAA;MACA,GAAI;MACJ,MAAK;MACL,OAAO,eAAe,SAAS;MAC/B,gBAAgB,SAAS;OACvB,eAAe,gBAAgB,IAAI;OACnC,IAAI,eAAe,UAAU,KAAA,GAAW,SAAS,IAAI;MACvD;MACA,WAAW,SAAS;OAClB,IAAI,CAAC,UAAU;QACb,OAAO,OAAO,eAAe,MAAM,SAAS,IAAI,EAAE;QAClD,QAAQ,KAAK;QACb;OACF;OAEA,IAAI,MAAM,WAAW,MAAM,gBAAgB,WAAW;MACxD;MACU;KACX,CAAA,GACA,YACC,oBAAC,UAAD;MACe;MACb,OAAO;MACP,SAAS,SAAS;OAChB,WAAW,YAAY,eAAe,GAAG,IAAI;OAC7C,QAAQ,KAAK;OACb,SAAS,SAAS,MAAM;MAC1B;MACM;MACQ;MACP;KACR,CAAA,CAEA;;GACS,CAAA;EACT;;AAEb,CACF"}
1
+ {"version":3,"file":"input-date-time.js","names":["React"],"sources":["../../src/components/input-date-time.tsx"],"sourcesContent":["'use client'\n\nimport { CalendarMonth } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { ScrollFreeDayButton } from '../lib/calendar-day-button'\nimport {\n formatDateTime,\n formatTime,\n parseDatePart,\n parseDateTime,\n} from '../lib/date-time-mask'\nimport {\n TimeList,\n timesOf,\n useAnnouncement,\n useMaskHandlers,\n} from '../lib/input-date-parts'\nimport { cn } from '../utils/cn'\nimport { Button } from './button'\nimport { Calendar, type CalendarProps } from './calendar'\nimport { InputGroup, InputGroupAddon, InputGroupInput } from './input-group'\nimport {\n Popover,\n PopoverAnchor,\n PopoverContent,\n PopoverTrigger,\n} from './popover'\n\nfunction useControllableState<T>({\n defaultProp,\n onChange,\n prop,\n}: {\n defaultProp: T\n onChange?: (value: T) => void\n prop?: T\n}) {\n const [uncontrolled, setUncontrolled] = React.useState(defaultProp)\n const isControlled = prop !== undefined\n const value = isControlled ? prop : uncontrolled\n\n const setValue = React.useCallback(\n (next: T) => {\n if (!isControlled) setUncontrolled(next)\n onChange?.(next)\n },\n [isControlled, onChange],\n )\n\n return [value, setValue] as const\n}\n\nconst today = () => new Date()\n\nconst placeholderOf = (separator: string, withTime: boolean) =>\n `DD${separator}MM${separator}YYYY${withTime ? ', HH:MM' : ''}`\n\n/** The field text, the popup and the month shown, and how a pick becomes text. */\nfunction useInputDateTimeState({\n calendarMonth,\n defaultOpen = false,\n defaultValue = '',\n getDefaultDate,\n onDateChange,\n onOpenChange,\n onValueChange,\n open: openProp,\n separator,\n value,\n withTime,\n}: {\n calendarMonth?: Date\n defaultOpen?: boolean\n defaultValue?: string\n getDefaultDate: () => Date\n onDateChange?: (date: Date | undefined) => void\n onOpenChange?: (open: boolean) => void\n onValueChange?: (value: string) => void\n open?: boolean\n separator: string\n value?: string\n withTime: boolean\n}) {\n const [text, setText] = useControllableState({\n defaultProp: defaultValue,\n onChange: onValueChange,\n prop: value,\n })\n const [open, setOpenState] = useControllableState({\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n prop: openProp,\n })\n // the day stays picked while its time is still being typed\n const selected = parseDatePart(text)\n const parsed = parseDateTime(text, withTime)\n const selectedTime = withTime && parsed ? formatTime(parsed) : undefined\n const [month, setMonth] = React.useState<Date | undefined>(\n () => selected ?? calendarMonth,\n )\n const setOpen = React.useCallback(\n (next: boolean) => {\n if (next && calendarMonth === undefined) {\n setMonth(parseDatePart(text) ?? getDefaultDate())\n }\n setOpenState(next)\n },\n [calendarMonth, getDefaultDate, setOpenState, text],\n )\n const commit = React.useCallback(\n (next: string) => {\n if (next === text) return\n setText(next)\n onDateChange?.(parseDateTime(next, withTime))\n },\n [onDateChange, setText, text, withTime],\n )\n const commitDate = (day: Date, time = '00:00') => {\n const next = new Date(day)\n const [hours = 0, minutes = 0] = time.split(':').map(Number)\n next.setHours(hours, minutes, 0, 0)\n commit(formatDateTime(next, separator, withTime))\n }\n return {\n commit,\n commitDate,\n month,\n open,\n selected,\n selectedTime,\n setMonth,\n setOpen,\n text,\n }\n}\n\n/**\n * A date, or a date and a time (`withTime`), in one field with a calendar popup.\n * Input Date's journey-grade sibling: the chosen day takes focus on open, Backspace\n * after a separator deletes the digit before it, pastes go through the mask, and\n * ignored keys can be read out.\n */\nexport type InputDateTimeProps = Omit<\n React.ComponentProps<'input'>,\n 'children' | 'defaultValue' | 'onChange' | 'readOnly' | 'type' | 'value'\n> & {\n calendarLabel: string\n calendarProps?: Omit<CalendarProps, 'mode' | 'onSelect' | 'selected'>\n /** Element the calendar popup mounts into, e.g. the drawer it sits in. */\n container?: React.ComponentProps<typeof PopoverContent>['container']\n defaultOpen?: boolean\n /** `HH:MM` a day picked from the calendar gets while no time is set. */\n defaultTime?: string\n defaultValue?: string\n /** The day a time picked before any date applies to; today by default. */\n getDefaultDate?: () => Date\n /** The date, with its time when `withTime`; undefined until complete. */\n onDateChange?: (date: Date | undefined) => void\n onOpenChange?: (open: boolean) => void\n onValueChange?: (value: string) => void\n open?: boolean\n pickerOnly?: boolean\n /** Read out politely when a key the field ignores is typed, e.g. \"Only numbers are allowed\". */\n rejectedKeyMessage?: string\n separator?: string\n /** Names the time list. */\n timeLabel?: string\n /** Minutes between the times offered; 30 by default, 5 at least. */\n timeStep?: number\n value?: string\n /** Adds `, HH:MM` to the field and a time list beside the calendar. */\n withTime?: boolean\n}\n\nconst InputDateTime = React.forwardRef<HTMLInputElement, InputDateTimeProps>(\n function InputDateTime(\n {\n calendarLabel,\n calendarProps,\n className,\n container,\n defaultOpen,\n defaultTime = '08:00',\n defaultValue,\n disabled,\n getDefaultDate = today,\n id,\n onDateChange,\n onKeyDown,\n onOpenChange,\n onPaste,\n onValueChange,\n open: openProp,\n pickerOnly = false,\n placeholder,\n rejectedKeyMessage,\n separator = '.',\n timeLabel,\n timeStep = 30,\n value: valueProp,\n withTime = false,\n ...props\n },\n ref,\n ) {\n const inputRef = React.useRef<HTMLInputElement>(null)\n const [status, announce] = useAnnouncement()\n const {\n commit,\n commitDate,\n month,\n open,\n selected,\n selectedTime,\n setMonth,\n setOpen,\n text,\n } = useInputDateTimeState({\n calendarMonth: calendarProps?.month,\n defaultOpen,\n defaultValue,\n getDefaultDate,\n onDateChange,\n onOpenChange,\n onValueChange,\n open: openProp,\n separator,\n value: valueProp,\n withTime,\n })\n\n const setInputRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) ref.current = node\n },\n [ref],\n )\n\n const times = React.useMemo(\n () => (withTime ? timesOf(timeStep, selectedTime) : []),\n [selectedTime, timeStep, withTime],\n )\n\n const handlers = useMaskHandlers({\n commit,\n inputRef,\n onKeyDown,\n onOpen: () => setOpen(true),\n onPaste,\n onRejectedKey: () => {\n if (rejectedKeyMessage) announce(rejectedKeyMessage)\n },\n pickerOnly,\n separator,\n withTime,\n })\n\n return (\n <Popover onOpenChange={setOpen} open={open}>\n {/* a plain element anchors the popup: InputGroup drops its ref on React 18 */}\n <PopoverAnchor render={<div className=\"min-w-0\" />}>\n <InputGroup className={className}>\n <InputGroupInput\n autoComplete=\"off\"\n {...props}\n className={cn(pickerOnly && 'cursor-pointer')}\n disabled={disabled}\n id={id}\n inputMode={pickerOnly ? undefined : 'numeric'}\n onChange={() => {}}\n onClick={(event) => {\n props.onClick?.(event)\n // picker-only: the value opens the calendar instead of taking a caret\n if (pickerOnly && !disabled && !event.defaultPrevented)\n setOpen(true)\n }}\n {...handlers}\n placeholder={placeholder ?? placeholderOf(separator, withTime)}\n readOnly={pickerOnly}\n ref={setInputRef}\n spellCheck={false}\n value={text}\n />\n <InputGroupAddon align=\"inline-end\">\n <PopoverTrigger\n render={\n <Button\n aria-label={calendarLabel}\n color=\"neutral\"\n disabled={disabled}\n size=\"icon-small\"\n styleVariant=\"ghost\"\n >\n <CalendarMonth />\n </Button>\n }\n />\n </InputGroupAddon>\n </InputGroup>\n </PopoverAnchor>\n {status}\n <PopoverContent\n align=\"start\"\n aria-label={calendarLabel}\n className=\"w-auto p-0\"\n collisionAvoidance={{ side: 'flip', fallbackAxisSide: 'none' }}\n container={container}\n >\n {/* a month or year list replaces the days, and the times step aside for it */}\n <div className=\"flex max-sm:flex-col has-[[data-slot=calendar-list]]:[&>[data-slot=input-date-times]]:hidden\">\n <Calendar\n // oxlint-disable-next-line jsx-a11y/no-autofocus -- DayPicker prop: the picked day takes focus when the popup opens\n autoFocus\n {...calendarProps}\n // the picked day takes focus on open without scrolling the page\n components={{\n DayButton: ScrollFreeDayButton,\n ...calendarProps?.components,\n }}\n mode=\"single\"\n month={calendarProps?.month ?? month}\n onMonthChange={(next) => {\n calendarProps?.onMonthChange?.(next)\n if (calendarProps?.month === undefined) setMonth(next)\n }}\n onSelect={(next) => {\n if (!withTime) {\n commit(next ? formatDateTime(next, separator) : '')\n setOpen(false)\n return\n }\n // a time is picked next, so the popup stays open\n if (next) commitDate(next, selectedTime ?? defaultTime)\n }}\n selected={selected}\n />\n {withTime && (\n <TimeList\n defaultTime={defaultTime}\n label={timeLabel}\n onPick={(time) => {\n commitDate(selected ?? getDefaultDate(), time)\n setOpen(false)\n inputRef.current?.focus({ preventScroll: true })\n }}\n open={open}\n selectedTime={selectedTime}\n times={times}\n />\n )}\n </div>\n </PopoverContent>\n </Popover>\n )\n },\n)\n\nexport { InputDateTime }\nexport {\n dateTimeStatus,\n formatDateTime,\n parseDateTime,\n type DateTimeStatus,\n} from '../lib/date-time-mask'\n"],"mappings":";;;;;;;;;;;;;;AA4BA,SAAS,qBAAwB,EAC/B,aACA,UACA,QAKC;CACD,MAAM,CAAC,cAAc,mBAAmBA,QAAM,SAAS,WAAW;CAClE,MAAM,eAAe,SAAS,KAAA;CAW9B,OAAO,CAVO,eAAe,OAAO,cAEnBA,QAAM,aACpB,SAAY;EACX,IAAI,CAAC,cAAc,gBAAgB,IAAI;EACvC,WAAW,IAAI;CACjB,GACA,CAAC,cA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AErB,IAAI,cAAc,CAAC,YAAY,CAAC,MAAM,kBACpC,QAAQ,IAAI;MAChB;MACA,GAAI;MACJ,aAAa,eAAe,cAAc,WAAW,QAAQ;MAC7D,UAAU;MACV,KAAK;MACL,YAAY;MACZ,OAAO;KACR,CAAA,GACD,oBAAC,iBAAD;MAAiB,OAAM;gBACrB,oBAAC,gBAAD,EACE,QACE,oBAAC,QAAD;OACE,cAAY;OACZ,OAAM;OACI;OACV,MAAK;OACL,cAAa;iBAEb,oBAAC,eAAD,CAAgB,CAAA;MACV,CAAA,EAEX,CAAA;KACc,CAAA,CACP;;GACC,CAAA;GACd;GACD,oBAAC,gBAAD;IACE,OAAM;IACN,cAAY;IACZ,WAAU;IACV,oBAAoB;KAAE,MAAM;KAAQ,kBAAkB;IAAO;IAClD;cAGX,qBAAC,OAAD;KAAK,WAAU;eAAf,CACE,oBAAC,UAAD;MAEE,WAAA;MACA,GAAI;MAEJ,YAAY;OACV,WAAW;OACX,GAAG,eAAe;MACpB;MACA,MAAK;MACL,OAAO,eAAe,SAAS;MAC/B,gBAAgB,SAAS;OACvB,eAAe,gBAAgB,IAAI;OACnC,IAAI,eAAe,UAAU,KAAA,GAAW,SAAS,IAAI;MACvD;MACA,WAAW,SAAS;OAClB,IAAI,CAAC,UAAU;QACb,OAAO,OAAO,eAAe,MAAM,SAAS,IAAI,EAAE;QAClD,QAAQ,KAAK;QACb;OACF;OAEA,IAAI,MAAM,WAAW,MAAM,gBAAgB,WAAW;MACxD;MACU;KACX,CAAA,GACA,YACC,oBAAC,UAAD;MACe;MACb,OAAO;MACP,SAAS,SAAS;OAChB,WAAW,YAAY,eAAe,GAAG,IAAI;OAC7C,QAAQ,KAAK;OACb,SAAS,SAAS,MAAM,EAAE,eAAe,KAAK,CAAC;MACjD;MACM;MACQ;MACP;KACR,CAAA,CAEA;;GACS,CAAA;EACT;;AAEb,CACF"}
@@ -9,8 +9,8 @@ const require_components_calendar = require("./calendar.cjs");
9
9
  const require_components_popover = require("./popover.cjs");
10
10
  let react = require("react");
11
11
  react = require_chunk.__toESM(react);
12
- let _epilot_spark_icons = require("@epilot/spark-icons");
13
12
  let react_jsx_runtime = require("react/jsx-runtime");
13
+ let _epilot_spark_icons = require("@epilot/spark-icons");
14
14
  let ictus = require("ictus");
15
15
  let cn = require("cn");
16
16
  //#region src/components/input-date.tsx
@@ -7,8 +7,8 @@ import { InputGroup, InputGroupAddon, InputGroupInput } from "./input-group.js";
7
7
  import { Calendar } from "./calendar.js";
8
8
  import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "./popover.js";
9
9
  import * as React$1 from "react";
10
- import { CalendarMonth } from "@epilot/spark-icons";
11
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
+ import { CalendarMonth } from "@epilot/spark-icons";
12
12
  import { apply, formatDate, isDateMaskKey, parseDate } from "ictus";
13
13
  //#region src/components/input-date.tsx
14
14
  function useControllableState({ defaultProp, onChange, prop }) {
@@ -8,8 +8,8 @@ const require_components_field = require("./field.cjs");
8
8
  const require_components_input = require("./input.cjs");
9
9
  let react = require("react");
10
10
  react = require_chunk.__toESM(react);
11
- let class_variance_authority = require("class-variance-authority");
12
11
  let react_jsx_runtime = require("react/jsx-runtime");
12
+ let class_variance_authority = require("class-variance-authority");
13
13
  let cn = require("cn");
14
14
  //#region src/components/input-group.tsx
15
15
  const GHOST = "rounded-none border-0 border-b-2 px-0 has-[:focus-visible]:border-b-input-active has-[[data-slot=input][aria-invalid=true]]:border-b-input-invalid has-[[data-slot=input][aria-invalid=true]]:has-[:focus-visible]:border-b-(--color-error-active)! group-data-[invalid=true]/field:border-b-input-invalid! group-data-[invalid=true]/field:has-[:focus-visible]:border-b-(--color-error-active)!";
@@ -6,8 +6,8 @@ import "../lib/input-box-variants.js";
6
6
  import { useFieldContext } from "./field.js";
7
7
  import { Input } from "./input.js";
8
8
  import * as React$1 from "react";
9
- import { cva } from "class-variance-authority";
10
9
  import { jsx, jsxs } from "react/jsx-runtime";
10
+ import { cva } from "class-variance-authority";
11
11
  //#region src/components/input-group.tsx
12
12
  const GHOST = "rounded-none border-0 border-b-2 px-0 has-[:focus-visible]:border-b-input-active has-[[data-slot=input][aria-invalid=true]]:border-b-input-invalid has-[[data-slot=input][aria-invalid=true]]:has-[:focus-visible]:border-b-(--color-error-active)! group-data-[invalid=true]/field:border-b-input-invalid! group-data-[invalid=true]/field:has-[:focus-visible]:border-b-(--color-error-active)!";
13
13
  const inputGroupVariants = cva("group/input-group relative flex h-10 w-full min-w-0 items-center gap-2 bg-transparent transition-[color,border-color] motion-reduce:transition-none", {
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_lib_input_box_variants = require("../lib/input-box-variants.cjs");
4
4
  const require_components_field = require("./field.cjs");
5
- let class_variance_authority = require("class-variance-authority");
6
5
  let react_jsx_runtime = require("react/jsx-runtime");
6
+ let class_variance_authority = require("class-variance-authority");
7
7
  let _base_ui_react_otp_field = require("@base-ui/react/otp-field");
8
8
  let cn = require("cn");
9
9
  //#region src/components/input-otp.tsx
@@ -2,8 +2,8 @@
2
2
  import { cn } from "../utils/cn.js";
3
3
  import { INSET_UNDERLINE, boxChrome } from "../lib/input-box-variants.js";
4
4
  import { useFieldControl, useKeepLabelOutset } from "./field.js";
5
- import { cva } from "class-variance-authority";
6
5
  import { jsx } from "react/jsx-runtime";
6
+ import { cva } from "class-variance-authority";
7
7
  import { OTPField } from "@base-ui/react/otp-field";
8
8
  //#region src/components/input-otp.tsx
9
9
  const slotVariants = cva("flex w-11 min-w-0 items-center justify-center bg-transparent text-center text-base font-medium text-gray tabular-nums transition-[color,background-color,border-color] group-data-[invalid=true]/field:text-error placeholder:text-gray-placeholder disabled:cursor-not-allowed disabled:text-gray-disabled disabled:placeholder:text-gray-disabled aria-invalid:text-error motion-reduce:transition-none", {
@@ -5,8 +5,8 @@ const require_lib_input_box_variants = require("../lib/input-box-variants.cjs");
5
5
  const require_components_field = require("./field.cjs");
6
6
  let react = require("react");
7
7
  react = require_chunk.__toESM(react);
8
- let class_variance_authority = require("class-variance-authority");
9
8
  let react_jsx_runtime = require("react/jsx-runtime");
9
+ let class_variance_authority = require("class-variance-authority");
10
10
  let cn = require("cn");
11
11
  //#region src/components/input.tsx
12
12
  const inputVariants = (0, class_variance_authority.cva)("flex h-10 w-full min-w-0 [appearance:textfield] bg-transparent text-gray transition-[color,background-color,border-color] group-data-[invalid=true]/field:text-error placeholder:text-gray-placeholder disabled:cursor-not-allowed disabled:text-gray-disabled disabled:placeholder:text-gray-disabled aria-invalid:text-error motion-reduce:transition-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none", {
@@ -3,8 +3,8 @@ import { cn } from "../utils/cn.js";
3
3
  import { INSET_UNDERLINE, boxChrome, floatingChrome } from "../lib/input-box-variants.js";
4
4
  import { useFieldControl } from "./field.js";
5
5
  import * as React$1 from "react";
6
- import { cva } from "class-variance-authority";
7
6
  import { jsx } from "react/jsx-runtime";
7
+ import { cva } from "class-variance-authority";
8
8
  //#region src/components/input.tsx
9
9
  const inputVariants = cva("flex h-10 w-full min-w-0 [appearance:textfield] bg-transparent text-gray transition-[color,background-color,border-color] group-data-[invalid=true]/field:text-error placeholder:text-gray-placeholder disabled:cursor-not-allowed disabled:text-gray-disabled disabled:placeholder:text-gray-disabled aria-invalid:text-error motion-reduce:transition-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none", {
10
10
  variants: {
@@ -4,9 +4,9 @@ const require_chunk = require("../chunk-DY84GLCh.cjs");
4
4
  const require_components_skeleton = require("./skeleton.cjs");
5
5
  let react = require("react");
6
6
  react = require_chunk.__toESM(react);
7
+ let react_jsx_runtime = require("react/jsx-runtime");
7
8
  let class_variance_authority = require("class-variance-authority");
8
9
  let _base_ui_react_use_render = require("@base-ui/react/use-render");
9
- let react_jsx_runtime = require("react/jsx-runtime");
10
10
  let cn = require("cn");
11
11
  //#region src/components/list.tsx
12
12
  const radiusRowClasses = {
@@ -2,9 +2,9 @@
2
2
  import { cn } from "../utils/cn.js";
3
3
  import { Skeleton } from "./skeleton.js";
4
4
  import * as React$1 from "react";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
6
  import { cva } from "class-variance-authority";
6
7
  import { useRender } from "@base-ui/react/use-render";
7
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
8
  //#region src/components/list.tsx
9
9
  const radiusRowClasses = {
10
10
  none: "group-data-[list-radius=none]/list:first:rounded-t-none group-data-[list-radius=none]/list:last:rounded-b-none",
@@ -3,10 +3,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_chunk = require("../chunk-DY84GLCh.cjs");
4
4
  let react = require("react");
5
5
  react = require_chunk.__toESM(react);
6
+ let react_jsx_runtime = require("react/jsx-runtime");
6
7
  let class_variance_authority = require("class-variance-authority");
7
8
  let _base_ui_react_merge_props = require("@base-ui/react/merge-props");
8
9
  let _base_ui_react_use_render = require("@base-ui/react/use-render");
9
- let react_jsx_runtime = require("react/jsx-runtime");
10
10
  let cn = require("cn");
11
11
  //#region src/components/marker.tsx
12
12
  const markerVariants = (0, class_variance_authority.cva)("group/marker relative flex min-h-4 w-full items-center gap-2 text-left text-sm text-gray-light [&_svg:not([class*='size-'])]:size-4 [a]:underline [a]:underline-offset-3 [a]:hover:text-gray [&:is(button,a)]:focus-visible:rounded-sm", { variants: { variant: {
@@ -6,7 +6,7 @@ import { useRender } from "@base-ui/react/use-render";
6
6
 
7
7
  //#region src/components/marker.d.ts
8
8
  declare const markerVariants: (props?: ({
9
- variant?: "separator" | "default" | "border" | null | undefined;
9
+ variant?: "separator" | "border" | "default" | null | undefined;
10
10
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
11
11
  declare function Marker({
12
12
  className,
@@ -6,7 +6,7 @@ import { useRender } from "@base-ui/react/use-render";
6
6
 
7
7
  //#region src/components/marker.d.ts
8
8
  declare const markerVariants: (props?: ({
9
- variant?: "separator" | "default" | "border" | null | undefined;
9
+ variant?: "separator" | "border" | "default" | null | undefined;
10
10
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
11
11
  declare function Marker({
12
12
  className,
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { cn } from "../utils/cn.js";
3
3
  import "react";
4
+ import { jsx } from "react/jsx-runtime";
4
5
  import { cva } from "class-variance-authority";
5
6
  import { mergeProps } from "@base-ui/react/merge-props";
6
7
  import { useRender } from "@base-ui/react/use-render";
7
- import { jsx } from "react/jsx-runtime";
8
8
  //#region src/components/marker.tsx
9
9
  const markerVariants = cva("group/marker relative flex min-h-4 w-full items-center gap-2 text-left text-sm text-gray-light [&_svg:not([class*='size-'])]:size-4 [a]:underline [a]:underline-offset-3 [a]:hover:text-gray [&:is(button,a)]:focus-visible:rounded-sm", { variants: { variant: {
10
10
  default: "[&:is(button,a)]:touch-target",
@@ -6,8 +6,8 @@ const require_components_button = require("./button.cjs");
6
6
  const require_lib_message_animations = require("../lib/message-animations.cjs");
7
7
  let react = require("react");
8
8
  react = require_chunk.__toESM(react);
9
- let _epilot_spark_icons = require("@epilot/spark-icons");
10
9
  let react_jsx_runtime = require("react/jsx-runtime");
10
+ let _epilot_spark_icons = require("@epilot/spark-icons");
11
11
  let _shadcn_react_message_scroller = require("@shadcn/react/message-scroller");
12
12
  let motion_react = require("motion/react");
13
13
  let motion_react_m = require("motion/react-m");
@@ -4,8 +4,8 @@ import { cn } from "../utils/cn.js";
4
4
  import { Button } from "./button.js";
5
5
  import { MESSAGE_ANIMATIONS } from "../lib/message-animations.js";
6
6
  import * as React$1 from "react";
7
- import { ArrowDownward, ArrowUpward } from "@epilot/spark-icons";
8
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { ArrowDownward, ArrowUpward } from "@epilot/spark-icons";
9
9
  import { MessageScroller as MessageScroller$1, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility } from "@shadcn/react/message-scroller";
10
10
  import { LazyMotion, domAnimation } from "motion/react";
11
11
  import { create } from "motion/react-m";
@@ -5,10 +5,10 @@ const require_components_button = require("./button.cjs");
5
5
  const require_components_typography = require("./typography.cjs");
6
6
  let react = require("react");
7
7
  react = require_chunk.__toESM(react);
8
+ let react_jsx_runtime = require("react/jsx-runtime");
8
9
  let _epilot_spark_icons = require("@epilot/spark-icons");
9
10
  let _base_ui_react_merge_props = require("@base-ui/react/merge-props");
10
11
  let _base_ui_react_use_render = require("@base-ui/react/use-render");
11
- let react_jsx_runtime = require("react/jsx-runtime");
12
12
  let cn = require("cn");
13
13
  //#region src/components/page-header.tsx
14
14
  const PageHeader = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
@@ -3,10 +3,10 @@ import { cn } from "../utils/cn.js";
3
3
  import { Button } from "./button.js";
4
4
  import { PageTitle } from "./typography.js";
5
5
  import * as React$1 from "react";
6
+ import { jsx } from "react/jsx-runtime";
6
7
  import { ChevronLeft } from "@epilot/spark-icons";
7
8
  import { mergeProps } from "@base-ui/react/merge-props";
8
9
  import { useRender } from "@base-ui/react/use-render";
9
- import { jsx } from "react/jsx-runtime";
10
10
  //#region src/components/page-header.tsx
11
11
  const PageHeader = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("header", {
12
12
  ref,
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_components_button = require("./button.cjs");
4
- let _epilot_spark_icons = require("@epilot/spark-icons");
5
4
  let react_jsx_runtime = require("react/jsx-runtime");
5
+ let _epilot_spark_icons = require("@epilot/spark-icons");
6
6
  let cn = require("cn");
7
7
  //#region src/components/period-tabs.tsx
8
8
  const PeriodTabs = ({ className, ...rest }) => {
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { cn } from "../utils/cn.js";
3
3
  import { Button } from "./button.js";
4
- import { ChevronLeft, ChevronRight } from "@epilot/spark-icons";
5
4
  import { jsx } from "react/jsx-runtime";
5
+ import { ChevronLeft, ChevronRight } from "@epilot/spark-icons";
6
6
  //#region src/components/period-tabs.tsx
7
7
  const PeriodTabs = ({ className, ...rest }) => {
8
8
  return /* @__PURE__ */ jsx("div", {
@@ -4,8 +4,8 @@ const require_chunk = require("../chunk-DY84GLCh.cjs");
4
4
  const require_lib_accent_colors = require("../lib/accent-colors.cjs");
5
5
  let react = require("react");
6
6
  react = require_chunk.__toESM(react);
7
- let _epilot_spark_icons = require("@epilot/spark-icons");
8
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
+ let _epilot_spark_icons = require("@epilot/spark-icons");
9
9
  let cn = require("cn");
10
10
  //#region src/components/pill.tsx
11
11
  /**
@@ -2,8 +2,8 @@
2
2
  import { accentByColor } from "../lib/accent-colors.js";
3
3
  import { cn } from "../utils/cn.js";
4
4
  import * as React$1 from "react";
5
- import { Close } from "@epilot/spark-icons";
6
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ import { Close } from "@epilot/spark-icons";
7
7
  //#region src/components/pill.tsx
8
8
  /**
9
9
  * Like Badge, but interactive: `onClick` makes the whole pill a button