@epilot/spark-ui 0.29.0 → 0.30.1

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 (148) hide show
  1. package/dist/calendar-lists-CTby2kR5.d.cts +27 -0
  2. package/dist/calendar-lists-DoloqsCN.d.ts +27 -0
  3. package/dist/components/accordion.cjs +1 -1
  4. package/dist/components/accordion.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 +10 -2
  10. package/dist/components/autocomplete.cjs.map +1 -1
  11. package/dist/components/autocomplete.js +11 -3
  12. package/dist/components/autocomplete.js.map +1 -1
  13. package/dist/components/badge.cjs +1 -1
  14. package/dist/components/badge.js +1 -1
  15. package/dist/components/banner.cjs +1 -1
  16. package/dist/components/banner.js +1 -1
  17. package/dist/components/box.js +1 -1
  18. package/dist/components/breadcrumbs.cjs +1 -1
  19. package/dist/components/breadcrumbs.js +1 -1
  20. package/dist/components/bubble.cjs +1 -1
  21. package/dist/components/bubble.d.cts +1 -1
  22. package/dist/components/bubble.d.ts +1 -1
  23. package/dist/components/bubble.js +1 -1
  24. package/dist/components/button-group.cjs +1 -1
  25. package/dist/components/button-group.js +1 -1
  26. package/dist/components/button.cjs +1 -1
  27. package/dist/components/button.d.cts +1 -1
  28. package/dist/components/button.d.ts +1 -1
  29. package/dist/components/button.js +1 -1
  30. package/dist/components/calendar.cjs +23 -4
  31. package/dist/components/calendar.cjs.map +1 -1
  32. package/dist/components/calendar.d.cts +11 -2
  33. package/dist/components/calendar.d.ts +11 -2
  34. package/dist/components/calendar.js +23 -4
  35. package/dist/components/calendar.js.map +1 -1
  36. package/dist/components/callout.cjs +1 -1
  37. package/dist/components/callout.js +1 -1
  38. package/dist/components/card.cjs +1 -1
  39. package/dist/components/card.js +2 -2
  40. package/dist/components/combobox.cjs +47 -16
  41. package/dist/components/combobox.cjs.map +1 -1
  42. package/dist/components/combobox.d.cts +2 -0
  43. package/dist/components/combobox.d.ts +2 -0
  44. package/dist/components/combobox.js +48 -17
  45. package/dist/components/combobox.js.map +1 -1
  46. package/dist/components/drawer.cjs +1 -1
  47. package/dist/components/drawer.js +1 -1
  48. package/dist/components/empty-state.cjs +1 -1
  49. package/dist/components/empty-state.js +1 -1
  50. package/dist/components/entity-card.cjs +1 -1
  51. package/dist/components/entity-card.js +1 -1
  52. package/dist/components/field.cjs +19 -4
  53. package/dist/components/field.cjs.map +1 -1
  54. package/dist/components/field.d.cts +3 -1
  55. package/dist/components/field.d.ts +3 -1
  56. package/dist/components/field.js +19 -5
  57. package/dist/components/field.js.map +1 -1
  58. package/dist/components/hero-metric.cjs +1 -1
  59. package/dist/components/hero-metric.js +1 -1
  60. package/dist/components/info-block.cjs +1 -1
  61. package/dist/components/info-block.js +1 -1
  62. package/dist/components/input-date-time.cjs +212 -0
  63. package/dist/components/input-date-time.cjs.map +1 -0
  64. package/dist/components/input-date-time.d.cts +38 -0
  65. package/dist/components/input-date-time.d.ts +38 -0
  66. package/dist/components/input-date-time.js +205 -0
  67. package/dist/components/input-date-time.js.map +1 -0
  68. package/dist/components/input-date.cjs +11 -1
  69. package/dist/components/input-date.cjs.map +1 -1
  70. package/dist/components/input-date.js +11 -1
  71. package/dist/components/input-date.js.map +1 -1
  72. package/dist/components/input-group.cjs +2 -2
  73. package/dist/components/input-group.js +2 -2
  74. package/dist/components/input-otp.cjs +2 -1
  75. package/dist/components/input-otp.cjs.map +1 -1
  76. package/dist/components/input-otp.js +3 -2
  77. package/dist/components/input-otp.js.map +1 -1
  78. package/dist/components/input.cjs +1 -1
  79. package/dist/components/input.js +1 -1
  80. package/dist/components/list.cjs +1 -1
  81. package/dist/components/list.js +1 -1
  82. package/dist/components/marker.cjs +1 -1
  83. package/dist/components/marker.d.cts +1 -1
  84. package/dist/components/marker.d.ts +1 -1
  85. package/dist/components/marker.js +1 -1
  86. package/dist/components/message-scroller.cjs +1 -1
  87. package/dist/components/message-scroller.js +1 -1
  88. package/dist/components/page-header.cjs +1 -1
  89. package/dist/components/page-header.d.cts +1 -1
  90. package/dist/components/page-header.d.ts +1 -1
  91. package/dist/components/page-header.js +1 -1
  92. package/dist/components/popover.cjs +1 -1
  93. package/dist/components/popover.js +1 -1
  94. package/dist/components/select.cjs +2 -1
  95. package/dist/components/select.cjs.map +1 -1
  96. package/dist/components/select.js +2 -1
  97. package/dist/components/select.js.map +1 -1
  98. package/dist/components/separator.cjs +1 -1
  99. package/dist/components/separator.js +1 -1
  100. package/dist/components/skeleton.cjs +1 -1
  101. package/dist/components/skeleton.js +1 -1
  102. package/dist/components/textarea.cjs +1 -1
  103. package/dist/components/textarea.js +1 -1
  104. package/dist/components/theme.cjs +3 -1
  105. package/dist/components/theme.cjs.map +1 -1
  106. package/dist/components/theme.js +3 -1
  107. package/dist/components/theme.js.map +1 -1
  108. package/dist/components/toggle.cjs +1 -1
  109. package/dist/components/toggle.js +1 -1
  110. package/dist/hooks/use-focus-modality.cjs +55 -0
  111. package/dist/hooks/use-focus-modality.cjs.map +1 -0
  112. package/dist/hooks/use-focus-modality.d.cts +8 -0
  113. package/dist/hooks/use-focus-modality.d.ts +8 -0
  114. package/dist/hooks/use-focus-modality.js +53 -0
  115. package/dist/hooks/use-focus-modality.js.map +1 -0
  116. package/dist/lib/accent-theme.cjs +75 -17
  117. package/dist/lib/accent-theme.cjs.map +1 -1
  118. package/dist/lib/accent-theme.d.cts +14 -1
  119. package/dist/lib/accent-theme.d.ts +14 -1
  120. package/dist/lib/accent-theme.js +74 -18
  121. package/dist/lib/accent-theme.js.map +1 -1
  122. package/dist/lib/calendar-lists.cjs +222 -0
  123. package/dist/lib/calendar-lists.cjs.map +1 -0
  124. package/dist/lib/calendar-lists.d.cts +4 -0
  125. package/dist/lib/calendar-lists.d.ts +4 -0
  126. package/dist/lib/calendar-lists.js +217 -0
  127. package/dist/lib/calendar-lists.js.map +1 -0
  128. package/dist/lib/control-glyphs.cjs +37 -0
  129. package/dist/lib/control-glyphs.cjs.map +1 -0
  130. package/dist/lib/control-glyphs.d.cts +11 -0
  131. package/dist/lib/control-glyphs.d.ts +11 -0
  132. package/dist/lib/control-glyphs.js +35 -0
  133. package/dist/lib/control-glyphs.js.map +1 -0
  134. package/dist/lib/date-time-mask.cjs +155 -0
  135. package/dist/lib/date-time-mask.cjs.map +1 -0
  136. package/dist/lib/date-time-mask.d.cts +56 -0
  137. package/dist/lib/date-time-mask.d.ts +56 -0
  138. package/dist/lib/date-time-mask.js +147 -0
  139. package/dist/lib/date-time-mask.js.map +1 -0
  140. package/dist/lib/input-date-parts.cjs +154 -0
  141. package/dist/lib/input-date-parts.cjs.map +1 -0
  142. package/dist/lib/input-date-parts.d.cts +53 -0
  143. package/dist/lib/input-date-parts.d.ts +53 -0
  144. package/dist/lib/input-date-parts.js +147 -0
  145. package/dist/lib/input-date-parts.js.map +1 -0
  146. package/dist/styles/spark-default.css +366 -24
  147. package/dist/styles/theme.css +45 -3
  148. package/package.json +1 -1
@@ -1,13 +1,15 @@
1
1
  "use client";
2
2
  "use client";
3
3
  import { cn } from "../utils/cn.js";
4
- import { boxChrome } from "../lib/input-box-variants.js";
5
4
  import { PortalTheme } from "./theme.js";
6
5
  import { buttonVariants } from "./button.js";
6
+ import { ChevronDownGlyph, ClearGlyph } from "../lib/control-glyphs.js";
7
+ import { boxChrome, floatingChrome } from "../lib/input-box-variants.js";
7
8
  import { useFieldControl } from "./field.js";
9
+ import { Checkbox } from "./checkbox.js";
8
10
  import { Pill } from "./pill.js";
9
11
  import * as React$1 from "react";
10
- import { Add, Check, Close, KeyboardArrowDown, Search } from "@epilot/spark-icons";
12
+ import { Add, Check, Search } from "@epilot/spark-icons";
11
13
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
14
  import { Combobox as Combobox$1 } from "@base-ui/react/combobox";
13
15
  //#region src/components/combobox.tsx
@@ -66,17 +68,17 @@ function ComboboxTrigger({ className, children, variant, id: idProp, "aria-descr
66
68
  });
67
69
  const inset = !variant && field?.labelPosition === "inset";
68
70
  const isGhost = inputStyle === "ghost" || inset;
71
+ const floating = !variant && field?.labelPosition === "floating";
69
72
  return /* @__PURE__ */ jsxs(Combobox$1.Trigger, {
70
73
  "data-slot": "combobox-trigger",
71
74
  id,
72
- className: cn("relative flex w-full min-w-0 items-center gap-1.5 rounded-md px-3 text-left text-base text-gray transition-colors select-none disabled:cursor-not-allowed disabled:text-gray-disabled motion-reduce:transition-none", !isGhost && "h-11 min-h-[2.75rem]", boxChrome[isGhost ? "ghost" : inputStyle][inputColor], "pr-8", inset && "focus-visible:outline-hidden", className),
75
+ className: cn("relative flex w-full min-w-0 items-center gap-1.5 rounded-md px-3 text-left text-base text-gray transition-colors select-none disabled:cursor-not-allowed disabled:text-gray-disabled motion-reduce:transition-none", !isGhost && "h-11 min-h-[2.75rem]", boxChrome[isGhost ? "ghost" : inputStyle][inputColor], floating && cn(floatingChrome(inputStyle), inputStyle !== "outlined" && "[&_[data-slot=combobox-chevron]]:-translate-y-2", "[&[data-placeholder]:not(:focus-visible,[data-popup-open])>:not([data-slot=combobox-chevron])]:invisible"), "pr-8", inset && "focus-visible:outline-hidden", className),
73
76
  "aria-invalid": ariaInvalid,
74
77
  ...props,
75
78
  "aria-describedby": ariaDescribedBy,
76
- children: [children, /* @__PURE__ */ jsx(KeyboardArrowDown, {
77
- "aria-hidden": true,
79
+ children: [children, /* @__PURE__ */ jsx(ChevronDownGlyph, {
78
80
  "data-slot": "combobox-chevron",
79
- className: cn("pointer-events-none absolute shrink-0 text-gray-light transition-transform [--spark-icon-size:14px] in-data-popup-open:rotate-180 motion-reduce:transition-none", isGhost ? "right-1" : "right-3")
81
+ className: cn("pointer-events-none absolute shrink-0 text-gray-light transition-transform in-data-popup-open:rotate-180 motion-reduce:transition-none", isGhost ? "right-1" : "right-3")
80
82
  })]
81
83
  });
82
84
  }
@@ -143,14 +145,17 @@ function ComboboxClear({ className, children, onClick, ...props }) {
143
145
  },
144
146
  ...props,
145
147
  hidden: group.disabled || group.readOnly || props.hidden,
146
- children: children ?? /* @__PURE__ */ jsx(Close, {
147
- "aria-hidden": true,
148
- className: "[--spark-icon-size:14px]"
149
- })
148
+ children: children ?? /* @__PURE__ */ jsx(ClearGlyph, {})
150
149
  });
151
150
  }
152
151
  const ComboboxToggleContext = React$1.createContext(null);
153
- function ComboboxContent({ className, children, align = "start", alignOffset, side, sideOffset = 4, container, ...props }) {
152
+ const HIGHLIGHT_KEYS = new Set([
153
+ "ArrowDown",
154
+ "ArrowUp",
155
+ "Home",
156
+ "End"
157
+ ]);
158
+ function ComboboxContent({ className, children, align = "start", alignOffset, side, sideOffset = 4, container, onKeyDownCapture, onPointerDownCapture, ...props }) {
154
159
  const [tracker] = React$1.useState(() => ({
155
160
  pending: null,
156
161
  values: /* @__PURE__ */ new WeakMap()
@@ -172,6 +177,14 @@ function ComboboxContent({ className, children, align = "start", alignOffset, si
172
177
  "data-slot": "combobox-content",
173
178
  className: cn("relative isolate z-50 flex max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) origin-(--transform-origin) flex-col overflow-hidden rounded-lg border border-gray-a1 bg-gray-1 p-1 text-gray-a12 shadow-lg dark:bg-gray-3 [[data-high-contrast]_&]:border-gray-a11", "transition-[opacity,scale,translate] duration-100 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none", "sm:data-[side=bottom]:data-starting-style:-translate-y-2 sm:data-[side=left]:data-starting-style:translate-x-2 sm:data-[side=right]:data-starting-style:-translate-x-2 sm:data-[side=top]:data-starting-style:translate-y-2", "max-sm:max-h-[80dvh] max-sm:w-full max-sm:max-w-none max-sm:rounded-b-none max-sm:border-x-0 max-sm:border-b-0 max-sm:px-4 max-sm:pt-3 max-sm:pb-[calc(env(safe-area-inset-bottom)+var(--spacing)*4)] max-sm:data-ending-style:translate-y-full max-sm:data-ending-style:scale-100 max-sm:data-ending-style:opacity-100 max-sm:data-starting-style:translate-y-full max-sm:data-starting-style:scale-100 max-sm:data-starting-style:opacity-100", className),
174
179
  ...props,
180
+ onKeyDownCapture: (event) => {
181
+ onKeyDownCapture?.(event);
182
+ if (HIGHLIGHT_KEYS.has(event.key)) event.currentTarget.setAttribute("data-keyboard", "");
183
+ },
184
+ onPointerDownCapture: (event) => {
185
+ onPointerDownCapture?.(event);
186
+ event.currentTarget.removeAttribute("data-keyboard");
187
+ },
175
188
  children
176
189
  })
177
190
  })] })
@@ -246,20 +259,38 @@ const ComboboxItem = React$1.forwardRef(function ComboboxItem({ className, value
246
259
  },
247
260
  value,
248
261
  "data-slot": "combobox-item",
249
- className: cn("relative flex w-full cursor-default items-center gap-1.5 rounded-sm px-1.5 py-1.5 text-sm text-gray outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 motion-reduce:transition-none max-sm:gap-3 max-sm:text-base", className),
262
+ className: cn("relative flex w-full cursor-default items-center gap-1.5 rounded-sm px-1.5 py-1.5 text-sm text-gray outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 motion-reduce:transition-none max-sm:gap-3 max-sm:text-base [@media(hover:none)]:[[data-slot=combobox-content]:not([data-keyboard])_&]:data-highlighted:bg-transparent", className),
250
263
  ...props
251
264
  });
252
265
  });
266
+ const setInert = (node) => {
267
+ node?.setAttribute("inert", "");
268
+ };
253
269
  function ComboboxItemIndicator({ className, children, keepMounted = true, ...props }) {
254
270
  return /* @__PURE__ */ jsx(Combobox$1.ItemIndicator, {
255
271
  "data-slot": "combobox-item-indicator",
256
272
  keepMounted,
257
- className: cn("flex size-3.5 shrink-0 items-center justify-center [[data-slot=combobox-item]:not([data-selected])_&_svg]:invisible", "max-sm:size-5 max-sm:rounded-sm max-sm:border-2 max-sm:border-(--color-accent-ui) max-sm:bg-base-accent-soft max-sm:[[data-selected]_&]:border-(--color-primary) max-sm:[[data-selected]_&]:bg-(--color-primary) max-sm:[[data-selected]_&]:text-(--spark-on-solid)", className),
273
+ className: cn("flex shrink-0 items-center justify-center", className),
258
274
  ...props,
259
- children: children ?? /* @__PURE__ */ jsx(Check, {
260
- "aria-hidden": true,
261
- className: "[--spark-icon-size:11px]"
262
- })
275
+ render: props.render ?? ((indicatorProps, { selected }) => /* @__PURE__ */ jsxs("span", {
276
+ ...indicatorProps,
277
+ children: [/* @__PURE__ */ jsx("span", {
278
+ className: cn("flex size-3.5 items-center justify-center max-sm:hidden", !selected && "invisible"),
279
+ children: children ?? /* @__PURE__ */ jsx(Check, {
280
+ "aria-hidden": true,
281
+ className: "[--spark-icon-size:11px]"
282
+ })
283
+ }), /* @__PURE__ */ jsx("span", {
284
+ className: "flex sm:hidden",
285
+ ref: setInert,
286
+ children: /* @__PURE__ */ jsx(Checkbox, {
287
+ checked: selected,
288
+ className: "my-0 any-pointer-coarse:my-0",
289
+ readOnly: true,
290
+ render: /* @__PURE__ */ jsx("span", {})
291
+ })
292
+ })]
293
+ }))
263
294
  });
264
295
  }
265
296
  const isSelectedGroup = (group) => typeof group === "object" && group !== null && "optionCount" in group;
@@ -1 +1 @@
1
- {"version":3,"file":"combobox.js","names":["ComboboxPrimitive","React"],"sources":["../../src/components/combobox.tsx"],"sourcesContent":["'use client'\n\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react/combobox'\nimport {\n Add,\n Check,\n Close,\n KeyboardArrowDown,\n Search,\n} from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { boxChrome } from '../lib/input-box-variants'\nimport type { SparkInputStyle } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\nimport { useFieldControl } from './field'\nimport { Pill } from './pill'\nimport { PortalTheme } from './theme'\n\nconst Combobox = ComboboxPrimitive.Root\nconst ComboboxValue = ComboboxPrimitive.Value\nconst ComboboxCollection = ComboboxPrimitive.Collection\nconst useComboboxFilter = ComboboxPrimitive.useFilter\nconst useComboboxFilteredItems = ComboboxPrimitive.useFilteredItems\n\ntype ComboboxSelectedGroup<Item> = {\n value: 'selected' | 'items'\n label: string\n items: Item[]\n /** Options left unpicked before the search filters them; ComboboxEmpty reads it. */\n optionCount: number\n}\n\n/** Splits `items` into a group with every pick, never filtered, and a group with the rest. */\nfunction useComboboxSelectedGroups<Item>(\n items: readonly Item[],\n value: readonly Item[],\n {\n selected,\n items: itemsLabel,\n isItemEqualToValue = Object.is,\n }: {\n selected: string\n items: string\n isItemEqualToValue?: (item: Item, value: Item) => boolean\n },\n) {\n const { contains } = useComboboxFilter()\n const isPicked = (item: Item) =>\n value.some((picked) => isItemEqualToValue(item, picked))\n const options = items.filter((item) => !isPicked(item))\n const groups: ComboboxSelectedGroup<Item>[] = [\n {\n value: 'selected',\n label: selected,\n items: [...value],\n optionCount: options.length,\n },\n {\n value: 'items',\n label: itemsLabel,\n items: options,\n optionCount: options.length,\n },\n ]\n const filter = (\n item: Item,\n query: string,\n itemToString?: (item: Item) => string,\n ) => isPicked(item) || contains(item, query, itemToString)\n return { items: groups, filter, isItemEqualToValue }\n}\n\nconst CLEAR_BUTTON =\n \"relative inline-flex size-6 min-h-[24px] min-w-[24px] shrink-0 items-center justify-center rounded-sm p-0 text-gray-light outline-hidden transition-colors hover:text-gray focus-visible:ring-2 focus-visible:ring-(--color-focus-root)! focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 before:absolute before:top-1/2 before:left-1/2 before:size-10 before:-translate-x-1/2 before:-translate-y-1/2 before:content-['']\"\n\nconst ComboboxGroupStateContext = React.createContext({\n disabled: false,\n readOnly: false,\n})\n\n// the trigger is a native <button>, so ComboboxClear sits beside it, not inside it;\n// Base UI's InputGroup is the only part whose state carries readOnly, so its render stays ours\nfunction ComboboxTriggerGroup({\n className,\n ...props\n}: Omit<React.ComponentProps<typeof ComboboxPrimitive.InputGroup>, 'render'>) {\n return (\n <ComboboxPrimitive.InputGroup\n data-slot=\"combobox-trigger-group\"\n className={cn(\n 'relative flex w-full items-center has-[[data-slot=combobox-clear]:not([hidden])]:[&_[data-slot=combobox-trigger]]:pr-15',\n className,\n )}\n {...props}\n render={({ role: _group, ...groupProps }, state) => (\n <ComboboxGroupStateContext.Provider\n value={{ disabled: state.disabled, readOnly: state.readOnly }}\n >\n <div {...groupProps} />\n </ComboboxGroupStateContext.Provider>\n )}\n />\n )\n}\n\nfunction ComboboxTrigger({\n className,\n children,\n variant,\n id: idProp,\n 'aria-describedby': ariaDescribedByProp,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Trigger> & {\n // input-style override; falls back to Field / <Theme>, then soft (like Input)\n variant?: SparkInputStyle\n}) {\n const { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor } =\n useFieldControl({\n id: idProp,\n ariaDescribedBy: ariaDescribedByProp,\n variant,\n })\n const inset = !variant && field?.labelPosition === 'inset'\n const isGhost = inputStyle === 'ghost' || inset\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n id={id}\n className={cn(\n 'relative flex w-full min-w-0 items-center gap-1.5 rounded-md px-3 text-left text-base text-gray transition-colors select-none disabled:cursor-not-allowed disabled:text-gray-disabled motion-reduce:transition-none',\n !isGhost && 'h-11 min-h-[2.75rem]',\n boxChrome[isGhost ? 'ghost' : inputStyle][inputColor],\n 'pr-8',\n // the inset Field shell draws the outline (field.tsx)\n inset && 'focus-visible:outline-hidden',\n className,\n )}\n aria-invalid={ariaInvalid}\n {...props}\n aria-describedby={ariaDescribedBy}\n >\n {children}\n <KeyboardArrowDown\n aria-hidden\n data-slot=\"combobox-chevron\"\n className={cn(\n 'pointer-events-none absolute shrink-0 text-gray-light transition-transform [--spark-icon-size:14px] in-data-popup-open:rotate-180 motion-reduce:transition-none',\n isGhost ? 'right-1' : 'right-3',\n )}\n />\n </ComboboxPrimitive.Trigger>\n )\n}\n\ntype ComboboxChipsProps<Item> = Omit<\n React.ComponentProps<'div'>,\n 'children'\n> & {\n /** Renders one chip per selected value, in pick order. */\n children: (item: Item, index: number) => React.ReactNode\n /** Renders at most this many chips, then a \"+N\" pill for the rest. */\n max?: number\n overflowLabel?: (count: number) => string\n /** Shown while nothing is selected: text, or a `ComboboxAddChip`. */\n placeholder?: React.ReactNode\n}\n\n// one row that never wraps: chips past the row's width are clipped, `max` folds them into \"+N\"\nfunction ComboboxChips<Item>({\n className,\n children,\n max,\n overflowLabel = (count) => `${count} more selected`,\n placeholder,\n ...props\n}: ComboboxChipsProps<Item>) {\n return (\n <div\n data-slot=\"combobox-chips\"\n className={cn(\n 'flex min-w-0 flex-1 flex-nowrap items-center gap-1 overflow-hidden',\n className,\n )}\n {...props}\n >\n <ComboboxPrimitive.Value>\n {(value: Item[]) => {\n if (value.length === 0) {\n return typeof placeholder === 'string' ? (\n <span className=\"truncate text-gray-placeholder in-data-disabled:text-gray-disabled\">\n {placeholder}\n </span>\n ) : (\n placeholder\n )\n }\n const shown = max === undefined ? value : value.slice(0, max)\n const hidden = value.length - shown.length\n return (\n <>\n {shown.map(children)}\n {hidden > 0 && (\n <Pill\n data-slot=\"combobox-chips-overflow\"\n className=\"shrink-0 in-data-disabled:opacity-50\"\n >\n <span aria-hidden=\"true\">+{hidden}</span>\n <span className=\"sr-only\">{overflowLabel(hidden)}</span>\n </Pill>\n )}\n </>\n )\n }}\n </ComboboxPrimitive.Value>\n </div>\n )\n}\n\n// display-only: chips sit inside the trigger button, so nothing in them may be interactive\nfunction ComboboxChip({\n className,\n children,\n ...props\n}: Omit<React.HTMLAttributes<HTMLSpanElement>, 'onClick' | 'color'>) {\n return (\n <Pill\n data-slot=\"combobox-chip\"\n className={cn('min-w-0 shrink in-data-disabled:opacity-50', className)}\n {...props}\n >\n <span className=\"truncate\">{children}</span>\n </Pill>\n )\n}\n\nfunction ComboboxAddChip({\n className,\n children,\n ...props\n}: Omit<React.HTMLAttributes<HTMLSpanElement>, 'onClick' | 'color'>) {\n return (\n <Pill\n data-slot=\"combobox-add-chip\"\n className={cn(\n 'shrink-0 border border-dashed border-spark-a6 bg-transparent pl-1.5 text-spark-a11 in-data-disabled:opacity-50',\n className,\n )}\n {...props}\n >\n <Add aria-hidden className=\"[--spark-icon-size:14px]\" />\n {children}\n </Pill>\n )\n}\n\nfunction ComboboxClear({\n className,\n children,\n onClick,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Clear>) {\n const group = React.useContext(ComboboxGroupStateContext)\n return (\n <ComboboxPrimitive.Clear\n data-slot=\"combobox-clear\"\n render={(buttonProps, state) => (\n <button\n {...buttonProps}\n hidden={state.disabled || buttonProps.hidden}\n />\n )}\n className={cn(CLEAR_BUTTON, 'absolute right-8', className)}\n onClick={(event) => {\n onClick?.(event)\n // Base UI refocuses the search input, which is unmounted while the popup is closed\n event.currentTarget\n .closest('[data-slot=\"combobox-trigger-group\"]')\n ?.querySelector<HTMLElement>('[data-slot=\"combobox-trigger\"]')\n ?.focus()\n }}\n {...props}\n hidden={group.disabled || group.readOnly || props.hidden}\n >\n {children ?? <Close aria-hidden className=\"[--spark-icon-size:14px]\" />}\n </ComboboxPrimitive.Clear>\n )\n}\n\ntype ComboboxContentProps = React.ComponentProps<\n typeof ComboboxPrimitive.Popup\n> &\n Pick<\n ComboboxPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n > &\n Pick<ComboboxPrimitive.Portal.Props, 'container'>\n\n// a toggled item changes group and so its index; Enter records it so the remounted\n// item can take the highlight back (Base UI only highlights on hover or arrow keys)\ntype ComboboxToggleTracker = {\n pending: { value: unknown } | null\n values: WeakMap<Element, unknown>\n}\nconst ComboboxToggleContext = React.createContext<ComboboxToggleTracker | null>(\n null,\n)\n\n// below `sm` the popup is a bottom sheet; `!` beats the positioner's inline position styles\nfunction ComboboxContent({\n className,\n children,\n align = 'start',\n alignOffset,\n side,\n sideOffset = 4,\n container,\n ...props\n}: ComboboxContentProps) {\n const [tracker] = React.useState<ComboboxToggleTracker>(() => ({\n pending: null,\n values: new WeakMap(),\n }))\n return (\n <ComboboxToggleContext.Provider value={tracker}>\n <ComboboxPrimitive.Portal container={container}>\n <PortalTheme>\n <ComboboxPrimitive.Backdrop\n data-slot=\"combobox-backdrop\"\n className=\"fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:transition-none sm:hidden\"\n />\n <ComboboxPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n className=\"z-50 max-sm:fixed! max-sm:inset-x-0! max-sm:top-auto! max-sm:bottom-(--spark-viewport-bottom-offset,0)! max-sm:transform-none!\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n className={cn(\n 'relative isolate z-50 flex max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) origin-(--transform-origin) flex-col overflow-hidden rounded-lg border border-gray-a1 bg-gray-1 p-1 text-gray-a12 shadow-lg dark:bg-gray-3 [[data-high-contrast]_&]:border-gray-a11',\n 'transition-[opacity,scale,translate] duration-100 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none',\n 'sm:data-[side=bottom]:data-starting-style:-translate-y-2 sm:data-[side=left]:data-starting-style:translate-x-2 sm:data-[side=right]:data-starting-style:-translate-x-2 sm:data-[side=top]:data-starting-style:translate-y-2',\n 'max-sm:max-h-[80dvh] max-sm:w-full max-sm:max-w-none max-sm:rounded-b-none max-sm:border-x-0 max-sm:border-b-0 max-sm:px-4 max-sm:pt-3 max-sm:pb-[calc(env(safe-area-inset-bottom)+var(--spacing)*4)] max-sm:data-ending-style:translate-y-full max-sm:data-ending-style:scale-100 max-sm:data-ending-style:opacity-100 max-sm:data-starting-style:translate-y-full max-sm:data-starting-style:scale-100 max-sm:data-starting-style:opacity-100',\n className,\n )}\n {...props}\n >\n {children}\n </ComboboxPrimitive.Popup>\n </ComboboxPrimitive.Positioner>\n </PortalTheme>\n </ComboboxPrimitive.Portal>\n </ComboboxToggleContext.Provider>\n )\n}\n\n// Base UI removes the last pick on Backspace in the empty input only inside Chips\nfunction ComboboxInput({\n className,\n onKeyDown,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Input>) {\n const tracker = React.useContext(ComboboxToggleContext)\n return (\n <ComboboxPrimitive.Chips\n data-slot=\"combobox-search\"\n // Chips adds role=\"toolbar\" for arrow keys between chips; this row holds none\n render={({ role: _toolbar, ...chipsProps }) => <div {...chipsProps} />}\n className=\"-mx-1 -mt-1 mb-1 flex shrink-0 items-center gap-1.5 border-b border-gray-a4 px-2.5 text-gray-light max-sm:mx-0 max-sm:mt-0 max-sm:mb-2 max-sm:rounded-md max-sm:border-b-0 max-sm:bg-gray-a3\"\n >\n <Search aria-hidden className=\"shrink-0 [--spark-icon-size:16px]\" />\n <ComboboxPrimitive.Input\n data-slot=\"combobox-input\"\n className={cn(\n 'h-10 w-full min-w-0 bg-transparent text-base text-gray outline-hidden placeholder:text-gray-placeholder',\n className,\n )}\n onKeyDown={(event) => {\n onKeyDown?.(event)\n if (!tracker || event.key !== 'Enter') return\n const highlighted = event.currentTarget\n .closest('[data-slot=\"combobox-content\"]')\n ?.querySelector('[data-slot=\"combobox-item\"][data-highlighted]')\n if (!highlighted) return\n tracker.pending = { value: tracker.values.get(highlighted) }\n setTimeout(() => {\n tracker.pending = null\n })\n }}\n {...props}\n />\n </ComboboxPrimitive.Chips>\n )\n}\n\n// the bottom sheet's \"Done\"; hidden from `sm` up, where the popup closes on outside press\nfunction ComboboxClose({\n className,\n onClick,\n ...props\n}: React.ComponentProps<'button'>) {\n return (\n <button\n data-slot=\"combobox-close\"\n type=\"button\"\n className={cn(\n buttonVariants({ variant: 'primary' }),\n 'mt-3 w-full shrink-0 sm:hidden',\n className,\n )}\n onClick={(event) => {\n onClick?.(event)\n // Combobox has no Close part; Escape is the key Base UI closes on\n event.currentTarget.dispatchEvent(\n new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }),\n )\n }}\n {...props}\n />\n )\n}\n\nfunction ComboboxList({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.List>) {\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n className={cn(\n 'min-h-0 flex-1 overflow-y-auto overscroll-contain outline-hidden data-empty:p-0',\n className,\n )}\n {...props}\n />\n )\n}\n\n// forwardRef keeps refs working for React 18 consumers (ref-as-prop is 19-only)\nconst ComboboxItem = React.forwardRef<\n HTMLDivElement,\n ComboboxPrimitive.Item.Props\n>(function ComboboxItem({ className, value, ...props }, refProp) {\n const tracker = React.useContext(ComboboxToggleContext)\n const ref = React.useRef<HTMLDivElement | null>(null)\n React.useEffect(() => {\n const node = ref.current\n if (!tracker || !node) return\n tracker.values.set(node, value)\n if (!tracker.pending || !Object.is(tracker.pending.value, value)) return\n tracker.pending = null\n // after Base UI has registered the remounted item's new index\n const timer = setTimeout(() =>\n node.dispatchEvent(new MouseEvent('mousemove', { bubbles: true })),\n )\n return () => clearTimeout(timer)\n }, [tracker, value])\n return (\n <ComboboxPrimitive.Item\n ref={(node: HTMLDivElement | null) => {\n ref.current = node\n if (typeof refProp === 'function') refProp(node)\n else if (refProp) refProp.current = node\n }}\n value={value}\n data-slot=\"combobox-item\"\n className={cn(\n 'relative flex w-full cursor-default items-center gap-1.5 rounded-sm px-1.5 py-1.5 text-sm text-gray outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 motion-reduce:transition-none max-sm:gap-3 max-sm:text-base',\n className,\n )}\n {...props}\n />\n )\n})\n\n// kept mounted so the bottom sheet draws an empty checkbox for unpicked items\nfunction ComboboxItemIndicator({\n className,\n children,\n keepMounted = true,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.ItemIndicator>) {\n return (\n <ComboboxPrimitive.ItemIndicator\n data-slot=\"combobox-item-indicator\"\n keepMounted={keepMounted}\n className={cn(\n 'flex size-3.5 shrink-0 items-center justify-center [[data-slot=combobox-item]:not([data-selected])_&_svg]:invisible',\n 'max-sm:size-5 max-sm:rounded-sm max-sm:border-2 max-sm:border-(--color-accent-ui) max-sm:bg-base-accent-soft max-sm:[[data-selected]_&]:border-(--color-primary) max-sm:[[data-selected]_&]:bg-(--color-primary) max-sm:[[data-selected]_&]:text-(--spark-on-solid)',\n className,\n )}\n {...props}\n >\n {children ?? <Check aria-hidden className=\"[--spark-icon-size:11px]\" />}\n </ComboboxPrimitive.ItemIndicator>\n )\n}\n\nconst isSelectedGroup = (\n group: unknown,\n): group is ComboboxSelectedGroup<unknown> =>\n typeof group === 'object' && group !== null && 'optionCount' in group\n\n// with useComboboxSelectedGroups the picks never filter out, so Base UI alone would never\n// see an empty list; \"no matches\" is the options group gone while it had options\nfunction ComboboxEmpty({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Empty>) {\n const filtered: readonly unknown[] = useComboboxFilteredItems()\n const groups = filtered.filter(isSelectedGroup)\n const noOptionMatches =\n groups.some((group) => group.optionCount > 0) &&\n !groups.some((group) => group.value === 'items')\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={cn(\n 'px-1.5 py-1.5 text-sm text-gray-light empty:p-0',\n className,\n )}\n {...props}\n render={({ children: _baseChildren, ...emptyProps }) => (\n <div {...emptyProps}>\n {filtered.length === 0 || noOptionMatches ? children : null}\n </div>\n )}\n />\n )\n}\n\nfunction ComboboxStatus({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Status>) {\n return (\n <ComboboxPrimitive.Status\n data-slot=\"combobox-status\"\n className={cn(\n 'px-1.5 py-1.5 text-sm text-gray-light empty:p-0',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxGroup({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Group>) {\n return (\n <ComboboxPrimitive.Group\n data-slot=\"combobox-group\"\n className={cn(\n 'scroll-my-1 [&+&]:mt-1 [&+&]:border-t [&+&]:border-gray-a4 [&+&]:pt-1',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxGroupLabel({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.GroupLabel>) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-group-label\"\n className={cn(\n 'px-1.5 py-1 text-xs font-medium text-gray-light [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxSeparator({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n aria-hidden=\"true\"\n data-slot=\"combobox-separator\"\n className={cn(\n 'pointer-events-none -mx-1 my-1 h-px bg-gray-a3 [[data-high-contrast]_&]:bg-gray-a6',\n className,\n )}\n {...props}\n />\n )\n}\n\nexport {\n Combobox,\n ComboboxAddChip,\n ComboboxChip,\n ComboboxChips,\n ComboboxClear,\n ComboboxClose,\n ComboboxCollection,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxGroup,\n ComboboxGroupLabel,\n ComboboxInput,\n ComboboxItem,\n ComboboxItemIndicator,\n ComboboxList,\n ComboboxSeparator,\n ComboboxStatus,\n ComboboxTrigger,\n ComboboxTriggerGroup,\n ComboboxValue,\n useComboboxFilter,\n useComboboxFilteredItems,\n useComboboxSelectedGroups,\n}\nexport type { ComboboxSelectedGroup }\n"],"mappings":";;;;;;;;;;;;;AAmBA,MAAM,WAAWA,WAAkB;AACnC,MAAM,gBAAgBA,WAAkB;AACxC,MAAM,qBAAqBA,WAAkB;AAC7C,MAAM,oBAAoBA,WAAkB;AAC5C,MAAM,2BAA2BA,WAAkB;;AAWnD,SAAS,0BACP,OACA,OACA,EACE,UACA,OAAO,YACP,qBAAqB,OAAO,MAM9B;CACA,MAAM,EAAE,aAAa,kBAAkB;CACvC,MAAM,YAAY,SAChB,MAAM,MAAM,WA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KAAK,kBAAkB,WAAW;EACpD,CAAA;CAER,CAAA;AAEL;AAEA,SAAS,eAAe,EACtB,WACA,GAAG,SACqD;CACxD,OACE,oBAACA,WAAkB,QAAnB;EACE,aAAU;EACV,WAAW,GACT,mDACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,cAAc,EACrB,WACA,GAAG,SACoD;CACvD,OACE,oBAACA,WAAkB,OAAnB;EACE,aAAU;EACV,WAAW,GACT,yEACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,mBAAmB,EAC1B,WACA,GAAG,SACyD;CAC5D,OACE,oBAACA,WAAkB,YAAnB;EACE,aAAU;EACV,WAAW,GACT,0FACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SAC2B;CAC9B,OACE,oBAAC,OAAD;EACE,eAAY;EACZ,aAAU;EACV,WAAW,GACT,sFACA,SACF;EACA,GAAI;CACL,CAAA;AAEL"}
1
+ {"version":3,"file":"combobox.js","names":["ComboboxPrimitive","React"],"sources":["../../src/components/combobox.tsx"],"sourcesContent":["'use client'\n\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react/combobox'\nimport { Add, Check, Search } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { ChevronDownGlyph, ClearGlyph } from '../lib/control-glyphs'\nimport { boxChrome, floatingChrome } from '../lib/input-box-variants'\nimport type { SparkInputStyle } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\nimport { Checkbox } from './checkbox'\nimport { useFieldControl } from './field'\nimport { Pill } from './pill'\nimport { PortalTheme } from './theme'\n\nconst Combobox = ComboboxPrimitive.Root\nconst ComboboxValue = ComboboxPrimitive.Value\nconst ComboboxCollection = ComboboxPrimitive.Collection\nconst useComboboxFilter = ComboboxPrimitive.useFilter\nconst useComboboxFilteredItems = ComboboxPrimitive.useFilteredItems\n\ntype ComboboxSelectedGroup<Item> = {\n value: 'selected' | 'items'\n label: string\n items: Item[]\n /** Options left unpicked before the search filters them; ComboboxEmpty reads it. */\n optionCount: number\n}\n\n/** Splits `items` into a group with every pick, never filtered, and a group with the rest. */\nfunction useComboboxSelectedGroups<Item>(\n items: readonly Item[],\n value: readonly Item[],\n {\n selected,\n items: itemsLabel,\n isItemEqualToValue = Object.is,\n }: {\n selected: string\n items: string\n isItemEqualToValue?: (item: Item, value: Item) => boolean\n },\n) {\n const { contains } = useComboboxFilter()\n const isPicked = (item: Item) =>\n value.some((picked) => isItemEqualToValue(item, picked))\n const options = items.filter((item) => !isPicked(item))\n const groups: ComboboxSelectedGroup<Item>[] = [\n {\n value: 'selected',\n label: selected,\n items: [...value],\n optionCount: options.length,\n },\n {\n value: 'items',\n label: itemsLabel,\n items: options,\n optionCount: options.length,\n },\n ]\n const filter = (\n item: Item,\n query: string,\n itemToString?: (item: Item) => string,\n ) => isPicked(item) || contains(item, query, itemToString)\n return { items: groups, filter, isItemEqualToValue }\n}\n\nconst CLEAR_BUTTON =\n \"relative inline-flex size-6 min-h-[24px] min-w-[24px] shrink-0 items-center justify-center rounded-sm p-0 text-gray-light outline-hidden transition-colors hover:text-gray focus-visible:ring-2 focus-visible:ring-(--color-focus-root)! focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 before:absolute before:top-1/2 before:left-1/2 before:size-10 before:-translate-x-1/2 before:-translate-y-1/2 before:content-['']\"\n\nconst ComboboxGroupStateContext = React.createContext({\n disabled: false,\n readOnly: false,\n})\n\n// the trigger is a native <button>, so ComboboxClear sits beside it, not inside it;\n// Base UI's InputGroup is the only part whose state carries readOnly, so its render stays ours\nfunction ComboboxTriggerGroup({\n className,\n ...props\n}: Omit<React.ComponentProps<typeof ComboboxPrimitive.InputGroup>, 'render'>) {\n return (\n <ComboboxPrimitive.InputGroup\n data-slot=\"combobox-trigger-group\"\n className={cn(\n 'relative flex w-full items-center has-[[data-slot=combobox-clear]:not([hidden])]:[&_[data-slot=combobox-trigger]]:pr-15',\n className,\n )}\n {...props}\n render={({ role: _group, ...groupProps }, state) => (\n <ComboboxGroupStateContext.Provider\n value={{ disabled: state.disabled, readOnly: state.readOnly }}\n >\n <div {...groupProps} />\n </ComboboxGroupStateContext.Provider>\n )}\n />\n )\n}\n\nfunction ComboboxTrigger({\n className,\n children,\n variant,\n id: idProp,\n 'aria-describedby': ariaDescribedByProp,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Trigger> & {\n // input-style override; falls back to Field / <Theme>, then soft (like Input)\n variant?: SparkInputStyle\n}) {\n const { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor } =\n useFieldControl({\n id: idProp,\n ariaDescribedBy: ariaDescribedByProp,\n variant,\n })\n const inset = !variant && field?.labelPosition === 'inset'\n const isGhost = inputStyle === 'ghost' || inset\n const floating = !variant && field?.labelPosition === 'floating'\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n id={id}\n className={cn(\n 'relative flex w-full min-w-0 items-center gap-1.5 rounded-md px-3 text-left text-base text-gray transition-colors select-none disabled:cursor-not-allowed disabled:text-gray-disabled motion-reduce:transition-none',\n !isGhost && 'h-11 min-h-[2.75rem]',\n boxChrome[isGhost ? 'ghost' : inputStyle][inputColor],\n floating &&\n cn(\n floatingChrome(inputStyle),\n inputStyle !== 'outlined' &&\n '[&_[data-slot=combobox-chevron]]:-translate-y-2',\n '[&[data-placeholder]:not(:focus-visible,[data-popup-open])>:not([data-slot=combobox-chevron])]:invisible',\n ),\n 'pr-8',\n // the inset Field shell draws the outline (field.tsx)\n inset && 'focus-visible:outline-hidden',\n className,\n )}\n aria-invalid={ariaInvalid}\n {...props}\n aria-describedby={ariaDescribedBy}\n >\n {children}\n <ChevronDownGlyph\n data-slot=\"combobox-chevron\"\n className={cn(\n 'pointer-events-none absolute shrink-0 text-gray-light transition-transform in-data-popup-open:rotate-180 motion-reduce:transition-none',\n isGhost ? 'right-1' : 'right-3',\n )}\n />\n </ComboboxPrimitive.Trigger>\n )\n}\n\ntype ComboboxChipsProps<Item> = Omit<\n React.ComponentProps<'div'>,\n 'children'\n> & {\n /** Renders one chip per selected value, in pick order. */\n children: (item: Item, index: number) => React.ReactNode\n /** Renders at most this many chips, then a \"+N\" pill for the rest. */\n max?: number\n overflowLabel?: (count: number) => string\n /** Shown while nothing is selected: text, or a `ComboboxAddChip`. */\n placeholder?: React.ReactNode\n}\n\n// one row that never wraps: chips past the row's width are clipped, `max` folds them into \"+N\"\nfunction ComboboxChips<Item>({\n className,\n children,\n max,\n overflowLabel = (count) => `${count} more selected`,\n placeholder,\n ...props\n}: ComboboxChipsProps<Item>) {\n return (\n <div\n data-slot=\"combobox-chips\"\n className={cn(\n 'flex min-w-0 flex-1 flex-nowrap items-center gap-1 overflow-hidden',\n className,\n )}\n {...props}\n >\n <ComboboxPrimitive.Value>\n {(value: Item[]) => {\n if (value.length === 0) {\n return typeof placeholder === 'string' ? (\n <span className=\"truncate text-gray-placeholder in-data-disabled:text-gray-disabled\">\n {placeholder}\n </span>\n ) : (\n placeholder\n )\n }\n const shown = max === undefined ? value : value.slice(0, max)\n const hidden = value.length - shown.length\n return (\n <>\n {shown.map(children)}\n {hidden > 0 && (\n <Pill\n data-slot=\"combobox-chips-overflow\"\n className=\"shrink-0 in-data-disabled:opacity-50\"\n >\n <span aria-hidden=\"true\">+{hidden}</span>\n <span className=\"sr-only\">{overflowLabel(hidden)}</span>\n </Pill>\n )}\n </>\n )\n }}\n </ComboboxPrimitive.Value>\n </div>\n )\n}\n\n// display-only: chips sit inside the trigger button, so nothing in them may be interactive\nfunction ComboboxChip({\n className,\n children,\n ...props\n}: Omit<React.HTMLAttributes<HTMLSpanElement>, 'onClick' | 'color'>) {\n return (\n <Pill\n data-slot=\"combobox-chip\"\n className={cn('min-w-0 shrink in-data-disabled:opacity-50', className)}\n {...props}\n >\n <span className=\"truncate\">{children}</span>\n </Pill>\n )\n}\n\nfunction ComboboxAddChip({\n className,\n children,\n ...props\n}: Omit<React.HTMLAttributes<HTMLSpanElement>, 'onClick' | 'color'>) {\n return (\n <Pill\n data-slot=\"combobox-add-chip\"\n className={cn(\n 'shrink-0 border border-dashed border-spark-a6 bg-transparent pl-1.5 text-spark-a11 in-data-disabled:opacity-50',\n className,\n )}\n {...props}\n >\n <Add aria-hidden className=\"[--spark-icon-size:14px]\" />\n {children}\n </Pill>\n )\n}\n\nfunction ComboboxClear({\n className,\n children,\n onClick,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Clear>) {\n const group = React.useContext(ComboboxGroupStateContext)\n return (\n <ComboboxPrimitive.Clear\n data-slot=\"combobox-clear\"\n render={(buttonProps, state) => (\n <button\n {...buttonProps}\n hidden={state.disabled || buttonProps.hidden}\n />\n )}\n className={cn(CLEAR_BUTTON, 'absolute right-8', className)}\n onClick={(event) => {\n onClick?.(event)\n // Base UI refocuses the search input, which is unmounted while the popup is closed\n event.currentTarget\n .closest('[data-slot=\"combobox-trigger-group\"]')\n ?.querySelector<HTMLElement>('[data-slot=\"combobox-trigger\"]')\n ?.focus()\n }}\n {...props}\n hidden={group.disabled || group.readOnly || props.hidden}\n >\n {children ?? <ClearGlyph />}\n </ComboboxPrimitive.Clear>\n )\n}\n\ntype ComboboxContentProps = React.ComponentProps<\n typeof ComboboxPrimitive.Popup\n> &\n Pick<\n ComboboxPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n > &\n Pick<ComboboxPrimitive.Portal.Props, 'container'>\n\n// a toggled item changes group and so its index; Enter records it so the remounted\n// item can take the highlight back (Base UI only highlights on hover or arrow keys)\ntype ComboboxToggleTracker = {\n pending: { value: unknown } | null\n values: WeakMap<Element, unknown>\n}\nconst ComboboxToggleContext = React.createContext<ComboboxToggleTracker | null>(\n null,\n)\n\n// a tap leaves Base UI's highlight on a list index, which the next pick moves to another\n// option; without hover the highlight shows only once these keys have moved it\nconst HIGHLIGHT_KEYS = new Set(['ArrowDown', 'ArrowUp', 'Home', 'End'])\n\n// below `sm` the popup is a bottom sheet; `!` beats the positioner's inline position styles\nfunction ComboboxContent({\n className,\n children,\n align = 'start',\n alignOffset,\n side,\n sideOffset = 4,\n container,\n onKeyDownCapture,\n onPointerDownCapture,\n ...props\n}: ComboboxContentProps) {\n const [tracker] = React.useState<ComboboxToggleTracker>(() => ({\n pending: null,\n values: new WeakMap(),\n }))\n return (\n <ComboboxToggleContext.Provider value={tracker}>\n <ComboboxPrimitive.Portal container={container}>\n <PortalTheme>\n <ComboboxPrimitive.Backdrop\n data-slot=\"combobox-backdrop\"\n className=\"fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:transition-none sm:hidden\"\n />\n <ComboboxPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n className=\"z-50 max-sm:fixed! max-sm:inset-x-0! max-sm:top-auto! max-sm:bottom-(--spark-viewport-bottom-offset,0)! max-sm:transform-none!\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n className={cn(\n 'relative isolate z-50 flex max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) origin-(--transform-origin) flex-col overflow-hidden rounded-lg border border-gray-a1 bg-gray-1 p-1 text-gray-a12 shadow-lg dark:bg-gray-3 [[data-high-contrast]_&]:border-gray-a11',\n 'transition-[opacity,scale,translate] duration-100 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none',\n 'sm:data-[side=bottom]:data-starting-style:-translate-y-2 sm:data-[side=left]:data-starting-style:translate-x-2 sm:data-[side=right]:data-starting-style:-translate-x-2 sm:data-[side=top]:data-starting-style:translate-y-2',\n 'max-sm:max-h-[80dvh] max-sm:w-full max-sm:max-w-none max-sm:rounded-b-none max-sm:border-x-0 max-sm:border-b-0 max-sm:px-4 max-sm:pt-3 max-sm:pb-[calc(env(safe-area-inset-bottom)+var(--spacing)*4)] max-sm:data-ending-style:translate-y-full max-sm:data-ending-style:scale-100 max-sm:data-ending-style:opacity-100 max-sm:data-starting-style:translate-y-full max-sm:data-starting-style:scale-100 max-sm:data-starting-style:opacity-100',\n className,\n )}\n {...props}\n onKeyDownCapture={(event) => {\n onKeyDownCapture?.(event)\n if (HIGHLIGHT_KEYS.has(event.key))\n event.currentTarget.setAttribute('data-keyboard', '')\n }}\n onPointerDownCapture={(event) => {\n onPointerDownCapture?.(event)\n event.currentTarget.removeAttribute('data-keyboard')\n }}\n >\n {children}\n </ComboboxPrimitive.Popup>\n </ComboboxPrimitive.Positioner>\n </PortalTheme>\n </ComboboxPrimitive.Portal>\n </ComboboxToggleContext.Provider>\n )\n}\n\n// Base UI removes the last pick on Backspace in the empty input only inside Chips\nfunction ComboboxInput({\n className,\n onKeyDown,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Input>) {\n const tracker = React.useContext(ComboboxToggleContext)\n return (\n <ComboboxPrimitive.Chips\n data-slot=\"combobox-search\"\n // Chips adds role=\"toolbar\" for arrow keys between chips; this row holds none\n render={({ role: _toolbar, ...chipsProps }) => <div {...chipsProps} />}\n className=\"-mx-1 -mt-1 mb-1 flex shrink-0 items-center gap-1.5 border-b border-gray-a4 px-2.5 text-gray-light max-sm:mx-0 max-sm:mt-0 max-sm:mb-2 max-sm:rounded-md max-sm:border-b-0 max-sm:bg-gray-a3\"\n >\n <Search aria-hidden className=\"shrink-0 [--spark-icon-size:16px]\" />\n <ComboboxPrimitive.Input\n data-slot=\"combobox-input\"\n className={cn(\n 'h-10 w-full min-w-0 bg-transparent text-base text-gray outline-hidden placeholder:text-gray-placeholder',\n className,\n )}\n onKeyDown={(event) => {\n onKeyDown?.(event)\n if (!tracker || event.key !== 'Enter') return\n const highlighted = event.currentTarget\n .closest('[data-slot=\"combobox-content\"]')\n ?.querySelector('[data-slot=\"combobox-item\"][data-highlighted]')\n if (!highlighted) return\n tracker.pending = { value: tracker.values.get(highlighted) }\n setTimeout(() => {\n tracker.pending = null\n })\n }}\n {...props}\n />\n </ComboboxPrimitive.Chips>\n )\n}\n\n// the bottom sheet's \"Done\"; hidden from `sm` up, where the popup closes on outside press\nfunction ComboboxClose({\n className,\n onClick,\n ...props\n}: React.ComponentProps<'button'>) {\n return (\n <button\n data-slot=\"combobox-close\"\n type=\"button\"\n className={cn(\n buttonVariants({ variant: 'primary' }),\n 'mt-3 w-full shrink-0 sm:hidden',\n className,\n )}\n onClick={(event) => {\n onClick?.(event)\n // Combobox has no Close part; Escape is the key Base UI closes on\n event.currentTarget.dispatchEvent(\n new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }),\n )\n }}\n {...props}\n />\n )\n}\n\nfunction ComboboxList({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.List>) {\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n className={cn(\n 'min-h-0 flex-1 overflow-y-auto overscroll-contain outline-hidden data-empty:p-0',\n className,\n )}\n {...props}\n />\n )\n}\n\n// forwardRef keeps refs working for React 18 consumers (ref-as-prop is 19-only)\nconst ComboboxItem = React.forwardRef<\n HTMLDivElement,\n ComboboxPrimitive.Item.Props\n>(function ComboboxItem({ className, value, ...props }, refProp) {\n const tracker = React.useContext(ComboboxToggleContext)\n const ref = React.useRef<HTMLDivElement | null>(null)\n React.useEffect(() => {\n const node = ref.current\n if (!tracker || !node) return\n tracker.values.set(node, value)\n if (!tracker.pending || !Object.is(tracker.pending.value, value)) return\n tracker.pending = null\n // after Base UI has registered the remounted item's new index\n const timer = setTimeout(() =>\n node.dispatchEvent(new MouseEvent('mousemove', { bubbles: true })),\n )\n return () => clearTimeout(timer)\n }, [tracker, value])\n return (\n <ComboboxPrimitive.Item\n ref={(node: HTMLDivElement | null) => {\n ref.current = node\n if (typeof refProp === 'function') refProp(node)\n else if (refProp) refProp.current = node\n }}\n value={value}\n data-slot=\"combobox-item\"\n className={cn(\n 'relative flex w-full cursor-default items-center gap-1.5 rounded-sm px-1.5 py-1.5 text-sm text-gray outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 motion-reduce:transition-none max-sm:gap-3 max-sm:text-base [@media(hover:none)]:[[data-slot=combobox-content]:not([data-keyboard])_&]:data-highlighted:bg-transparent',\n className,\n )}\n {...props}\n />\n )\n})\n\nconst setInert = (node: HTMLElement | null) => {\n node?.setAttribute('inert', '')\n}\n\n// kept mounted so the bottom sheet draws an empty checkbox for unpicked items\nfunction ComboboxItemIndicator({\n className,\n children,\n keepMounted = true,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.ItemIndicator>) {\n return (\n <ComboboxPrimitive.ItemIndicator\n data-slot=\"combobox-item-indicator\"\n keepMounted={keepMounted}\n className={cn('flex shrink-0 items-center justify-center', className)}\n {...props}\n render={\n props.render ??\n ((indicatorProps, { selected }) => (\n <span {...indicatorProps}>\n <span\n className={cn(\n 'flex size-3.5 items-center justify-center max-sm:hidden',\n !selected && 'invisible',\n )}\n >\n {children ?? (\n <Check aria-hidden className=\"[--spark-icon-size:11px]\" />\n )}\n </span>\n {/* the option owns the press and the selected state; this only draws\n it. inert is set on the node as React 18 has no `inert` prop */}\n <span className=\"flex sm:hidden\" ref={setInert}>\n <Checkbox\n checked={selected}\n className=\"my-0 any-pointer-coarse:my-0\"\n readOnly\n render={<span />}\n />\n </span>\n </span>\n ))\n }\n />\n )\n}\n\nconst isSelectedGroup = (\n group: unknown,\n): group is ComboboxSelectedGroup<unknown> =>\n typeof group === 'object' && group !== null && 'optionCount' in group\n\n// with useComboboxSelectedGroups the picks never filter out, so Base UI alone would never\n// see an empty list; \"no matches\" is the options group gone while it had options\nfunction ComboboxEmpty({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Empty>) {\n const filtered: readonly unknown[] = useComboboxFilteredItems()\n const groups = filtered.filter(isSelectedGroup)\n const noOptionMatches =\n groups.some((group) => group.optionCount > 0) &&\n !groups.some((group) => group.value === 'items')\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={cn(\n 'px-1.5 py-1.5 text-sm text-gray-light empty:p-0',\n className,\n )}\n {...props}\n render={({ children: _baseChildren, ...emptyProps }) => (\n <div {...emptyProps}>\n {filtered.length === 0 || noOptionMatches ? children : null}\n </div>\n )}\n />\n )\n}\n\nfunction ComboboxStatus({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Status>) {\n return (\n <ComboboxPrimitive.Status\n data-slot=\"combobox-status\"\n className={cn(\n 'px-1.5 py-1.5 text-sm text-gray-light empty:p-0',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxGroup({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Group>) {\n return (\n <ComboboxPrimitive.Group\n data-slot=\"combobox-group\"\n className={cn(\n 'scroll-my-1 [&+&]:mt-1 [&+&]:border-t [&+&]:border-gray-a4 [&+&]:pt-1',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxGroupLabel({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.GroupLabel>) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-group-label\"\n className={cn(\n 'px-1.5 py-1 text-xs font-medium text-gray-light [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxSeparator({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n aria-hidden=\"true\"\n data-slot=\"combobox-separator\"\n className={cn(\n 'pointer-events-none -mx-1 my-1 h-px bg-gray-a3 [[data-high-contrast]_&]:bg-gray-a6',\n className,\n )}\n {...props}\n />\n )\n}\n\nexport {\n Combobox,\n ComboboxAddChip,\n ComboboxChip,\n ComboboxChips,\n ComboboxClear,\n ComboboxClose,\n ComboboxCollection,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxGroup,\n ComboboxGroupLabel,\n ComboboxInput,\n ComboboxItem,\n ComboboxItemIndicator,\n ComboboxList,\n ComboboxSeparator,\n ComboboxStatus,\n ComboboxTrigger,\n ComboboxTriggerGroup,\n ComboboxValue,\n useComboboxFilter,\n useComboboxFilteredItems,\n useComboboxSelectedGroups,\n}\nexport type { ComboboxSelectedGroup }\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,WAAWA,WAAkB;AACnC,MAAM,gBAAgBA,WAAkB;AACxC,MAAM,qBAAqBA,WAAkB;AAC7C,MAAM,oBAAoBA,WAAkB;AAC5C,MAAM,2BAA2BA,WAAkB;;AAWnD,SAAS,0BACP,OACA,OACA,EACE,UACA,OAAO,YACP,qBAAqB,OAAO,MAM9B;CACA,MAAM,EAAE,aAAa,kBAAkB;CACvC,MAAM,YAAY,SAChB,MAAM,MAAM,WAAW,mBAAmB,MAAM,MAAM,CAAC;CACzD,MAAM,UAAU,MAAM,QAAQ,SAAS,CAAC,SAAS,IAAI,CAAC;CACtD,MAAM,SAAwC,CAC5C;EACE,OAAO;EACP,OAAO;EACP,OAAO,CAAC,GAAG,KAAK;EAChB,aAAa,QAAQ;CACvB,GACA;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,aAAa,QAAQ;CACvB,CACF;CACA,MAAM,UACJ,MACA,OACA,iBACG,SAAS,IAAI,KAAK,SAAS,MAAM,OAAO,YAAY;CACzD,OAAO;EAAE,OAAO;EAAQ;EAAQ;CAAmB;AACrD;AAEA,MAAM,eACJ;AAEF,MAAM,4BAA4BC,QAAM,cAAc;CACpD,UAAU;CACV,UAAU;AACZ,CAAC;AAID,SAAS,qBAAqB,EAC5B,WACA,GAAG,SACyE;CAC5E,OACE,oBAACD,WAAkB,YAAnB;EACE,aAAU;EACV,WAAW,GACT,2HACA,SACF;EACA,GAAI;EACJ,SAAS,EAAE,MAAM,QAAQ,GAAG,cAAc,UACxC,oBAAC,0BAA0B,UAA3B;GACE,OA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C,OAAD;GAAK,GAAI;aACN,SAAS,WAAW,KAAK,kBAAkB,WAAW;EACpD,CAAA;CAER,CAAA;AAEL;AAEA,SAAS,eAAe,EACtB,WACA,GAAG,SACqD;CACxD,OACE,oBAACA,WAAkB,QAAnB;EACE,aAAU;EACV,WAAW,GACT,mDACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,cAAc,EACrB,WACA,GAAG,SACoD;CACvD,OACE,oBAACA,WAAkB,OAAnB;EACE,aAAU;EACV,WAAW,GACT,yEACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,mBAAmB,EAC1B,WACA,GAAG,SACyD;CAC5D,OACE,oBAACA,WAAkB,YAAnB;EACE,aAAU;EACV,WAAW,GACT,0FACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SAC2B;CAC9B,OACE,oBAAC,OAAD;EACE,eAAY;EACZ,aAAU;EACV,WAAW,GACT,sFACA,SACF;EACA,GAAI;CACL,CAAA;AAEL"}
@@ -4,8 +4,8 @@ const require_chunk = require("../chunk-DY84GLCh.cjs");
4
4
  const require_components_theme = require("./theme.cjs");
5
5
  let react = require("react");
6
6
  react = require_chunk.__toESM(react);
7
- let react_jsx_runtime = require("react/jsx-runtime");
8
7
  let _base_ui_react_use_render = require("@base-ui/react/use-render");
8
+ let react_jsx_runtime = require("react/jsx-runtime");
9
9
  let vaul = require("vaul");
10
10
  let cn = require("cn");
11
11
  //#region src/components/drawer.tsx
@@ -2,8 +2,8 @@
2
2
  import { cn } from "../utils/cn.js";
3
3
  import { PortalTheme } from "./theme.js";
4
4
  import * as React$1 from "react";
5
- import { jsx, jsxs } from "react/jsx-runtime";
6
5
  import { useRender } from "@base-ui/react/use-render";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import { Drawer as Drawer$1 } from "vaul";
8
8
  //#region src/components/drawer.tsx
9
9
  function Drawer({ shouldScaleBackground = true, ...props }) {
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_components_icon = require("./icon.cjs");
4
4
  let react = require("react");
5
- let react_jsx_runtime = require("react/jsx-runtime");
6
5
  let class_variance_authority = require("class-variance-authority");
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
7
  let cn = require("cn");
8
8
  //#region src/components/empty-state.tsx
9
9
  const emptyStateVariants = (0, class_variance_authority.cva)("flex", {
@@ -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 { jsx, jsxs } from "react/jsx-runtime";
6
5
  import { cva } from "class-variance-authority";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
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 react_jsx_runtime = require("react/jsx-runtime");
7
6
  let class_variance_authority = require("class-variance-authority");
7
+ let react_jsx_runtime = require("react/jsx-runtime");
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 { jsx, jsxs } from "react/jsx-runtime";
5
4
  import { cva } from "class-variance-authority";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
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,15 +8,24 @@ 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");
12
11
  let class_variance_authority = require("class-variance-authority");
13
12
  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);
17
17
  function useFieldContext() {
18
18
  return react.useContext(FieldContext);
19
19
  }
20
+ const useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
21
+ function useKeepLabelOutset() {
22
+ const setHasOutsetControl = useFieldContext()?.setHasOutsetControl;
23
+ useIsomorphicLayoutEffect(() => {
24
+ if (!setHasOutsetControl) return;
25
+ setHasOutsetControl(true);
26
+ return () => setHasOutsetControl(false);
27
+ }, [setHasOutsetControl]);
28
+ }
20
29
  function useFieldControl(options) {
21
30
  const field = useFieldContext();
22
31
  const theme = require_components_theme.useTheme();
@@ -214,10 +223,13 @@ function Field({ className, children, labelPosition: labelPositionProp, inputSty
214
223
  const [errorCount, setErrorCount] = react.useState(0);
215
224
  const setHasDescription = react.useCallback((has) => setDescriptionCount((n) => n + (has ? 1 : -1)), []);
216
225
  const setHasError = react.useCallback((has) => setErrorCount((n) => n + (has ? 1 : -1)), []);
226
+ const [outsetControlCount, setOutsetControlCount] = react.useState(0);
227
+ const setHasOutsetControl = react.useCallback((has) => setOutsetControlCount((n) => n + (has ? 1 : -1)), []);
217
228
  const hasDescription = descriptionCount > 0;
218
229
  const hasError = errorCount > 0;
219
230
  const theme = require_components_theme.useTheme();
220
- const labelPosition = labelPositionProp ?? theme.labelPosition ?? "inset";
231
+ const requestedLabelPosition = labelPositionProp ?? theme.labelPosition ?? "inset";
232
+ const labelPosition = requestedLabelPosition === "floating" && outsetControlCount > 0 ? "outset" : requestedLabelPosition;
221
233
  const inputStyle = inputStyleProp ?? theme.inputStyle ?? "soft";
222
234
  const inputColor = inputColorProp ?? theme.inputColor ?? "brand";
223
235
  const fieldId = `field-${id}`;
@@ -234,7 +246,8 @@ function Field({ className, children, labelPosition: labelPositionProp, inputSty
234
246
  readOnly,
235
247
  labelPosition,
236
248
  inputStyle,
237
- inputColor
249
+ inputColor,
250
+ setHasOutsetControl
238
251
  }), [
239
252
  fieldId,
240
253
  labelId,
@@ -245,7 +258,8 @@ function Field({ className, children, labelPosition: labelPositionProp, inputSty
245
258
  readOnly,
246
259
  labelPosition,
247
260
  inputStyle,
248
- inputColor
261
+ inputColor,
262
+ setHasOutsetControl
249
263
  ]);
250
264
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldContext.Provider, {
251
265
  value,
@@ -457,5 +471,6 @@ exports.FieldValue = FieldValue;
457
471
  exports.useFieldContext = useFieldContext;
458
472
  exports.useFieldControl = useFieldControl;
459
473
  exports.useFieldSetInvalid = useFieldSetInvalid;
474
+ exports.useKeepLabelOutset = useKeepLabelOutset;
460
475
 
461
476
  //# sourceMappingURL=field.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"field.cjs","names":["React","useTheme","Skeleton","Separator","Callout"],"sources":["../../src/components/field.tsx"],"sourcesContent":["'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport { useId } from 'react'\nimport type {\n SparkInputColor,\n SparkInputStyle,\n SparkLabelPosition,\n} from '../lib/theme-types'\nimport { cn } from '../utils/cn'\nimport { Callout } from './callout'\nimport { Separator } from './separator'\nimport { Skeleton } from './skeleton'\nimport { useTheme } from './theme'\n\ntype FieldContextValue = {\n id: string\n labelId: string\n descriptionId: string\n hasDescription: boolean\n setHasDescription: (has: boolean) => void\n errorId: string\n hasError: boolean\n setHasError: (has: boolean) => void\n readOnly: boolean\n labelPosition: SparkLabelPosition\n inputStyle: SparkInputStyle\n inputColor: SparkInputColor\n}\n\nconst FieldContext = React.createContext<FieldContextValue | null>(null)\n\nexport function useFieldContext() {\n return React.useContext(FieldContext)\n}\n\n// Field→Theme→default resolution + id/aria-describedby wiring, shared by every\n// control that can sit inside a Field (Input, SelectTrigger, …) so they can't\n// drift on how a style/color/id resolves. `variant` is the control's own\n// per-instance override (already normalized — e.g. Input maps its 'none' to\n// undefined before calling this).\nexport function useFieldControl(options?: {\n id?: string\n ariaDescribedBy?: string\n variant?: SparkInputStyle\n}) {\n const field = useFieldContext()\n const theme = useTheme()\n const id = options?.id ?? field?.id\n const errorId = field?.hasError ? field.errorId : undefined\n const descriptionId = field?.hasDescription ? field.descriptionId : undefined\n // error before hint: the actionable message should be announced first\n const ariaDescribedBy =\n [errorId, descriptionId, options?.ariaDescribedBy]\n .filter(Boolean)\n .join(' ') || undefined\n const inputStyle =\n options?.variant ?? field?.inputStyle ?? theme.inputStyle ?? 'soft'\n const inputColor = field?.inputColor ?? theme.inputColor ?? 'brand'\n const ariaInvalid = field?.hasError || undefined\n return { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor }\n}\n\ntype FieldSetIndicator = 'required' | 'optional'\n\ntype FieldSetContextValue = {\n descriptionId: string\n hasDescription: boolean\n setHasDescription: (has: boolean) => void\n errorId: string\n hasError: boolean\n setHasError: (has: boolean) => void\n /** Marks the set invalid without linking `errorId` (error has a custom id). */\n setHasUnlinkedError: (has: boolean) => void\n invalid: boolean\n indicator?: FieldSetIndicator\n indicatorLabel?: string\n}\n\nconst FieldSetContext = React.createContext<FieldSetContextValue | null>(null)\n\n/** True when the nearest enclosing FieldSet has an error; ignores outer sets. */\nfunction useFieldSetInvalid() {\n return React.useContext(FieldSetContext)?.invalid || undefined\n}\n\nfunction useSlotCount() {\n const [count, setCount] = React.useState(0)\n const setHas = React.useCallback(\n (has: boolean) => setCount((n) => n + (has ? 1 : -1)),\n [],\n )\n return [count > 0, setHas] as const\n}\n\ninterface FieldSetProps extends React.ComponentProps<'fieldset'> {\n /** Marks the legend: `*` plus hidden text, or a visible \"(optional)\". */\n indicator?: FieldSetIndicator\n /** Text for the mark; defaults to `'required'` or `'optional'`. */\n indicatorLabel?: string\n}\n\nfunction FieldSet({\n className,\n indicator,\n indicatorLabel,\n 'aria-describedby': ariaDescribedByProp,\n ...props\n}: FieldSetProps) {\n const id = useId()\n const [hasDescription, setHasDescription] = useSlotCount()\n const [hasError, setHasError] = useSlotCount()\n const [hasUnlinkedError, setHasUnlinkedError] = useSlotCount()\n const invalid = hasError || hasUnlinkedError\n const fieldSetId = `field-set-${id}`\n const descriptionId = `${fieldSetId}-description`\n const errorId = `${fieldSetId}-error`\n const value = React.useMemo<FieldSetContextValue>(\n () => ({\n descriptionId,\n hasDescription,\n setHasDescription,\n errorId,\n hasError,\n setHasError,\n setHasUnlinkedError,\n invalid,\n indicator,\n indicatorLabel,\n }),\n [\n descriptionId,\n hasDescription,\n setHasDescription,\n errorId,\n hasError,\n setHasError,\n setHasUnlinkedError,\n invalid,\n indicator,\n indicatorLabel,\n ],\n )\n const ariaDescribedBy =\n [hasError && errorId, hasDescription && descriptionId, ariaDescribedByProp]\n .filter(Boolean)\n .join(' ') || undefined\n\n return (\n <FieldSetContext.Provider value={value}>\n <fieldset\n data-slot=\"field-set\"\n data-invalid={invalid || undefined}\n aria-describedby={ariaDescribedBy}\n className={cn(\n 'group/field-set flex flex-col gap-[calc(var(--spark-layout-gap)*4)]',\n className,\n )}\n {...props}\n />\n </FieldSetContext.Provider>\n )\n}\n\nfunction FieldLegend({\n className,\n variant = 'legend',\n children,\n ...props\n}: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {\n const fieldSet = React.useContext(FieldSetContext)\n const indicator = fieldSet?.indicator\n const indicatorLabel = fieldSet?.indicatorLabel ?? indicator\n return (\n <legend\n data-invalid={fieldSet?.invalid || undefined}\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn(\n 'mb-1.5 font-medium text-gray data-[invalid=true]:text-error-active! data-[variant=label]:text-sm data-[variant=legend]:text-base',\n className,\n )}\n {...props}\n >\n {children}\n {indicator === 'required' && (\n <>\n {' '}\n <span aria-hidden=\"true\">*</span>\n <span className=\"sr-only\">{indicatorLabel}</span>\n </>\n )}\n {indicator === 'optional' && (\n <>\n {' '}\n <span className=\"font-normal text-gray-light\">\n ({indicatorLabel})\n </span>\n </>\n )}\n </legend>\n )\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group flex w-full flex-col gap-[calc(var(--spark-layout-gap)*4)]',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst fieldVariants = cva(\n 'group/field relative flex w-full flex-col data-[invalid=true]:text-error-active',\n {\n variants: {\n labelPosition: {\n // inset puts label + input inside one shell, so the shell IS the input's box —\n // rounded-md tracks Input/Select/etc.'s own control radius, not the container one.\n // the shell draws the focus outline; the control inside keeps its underline cue\n inset:\n 'gap-y-1 rounded-md px-4 py-3 has-[:is(input,textarea,[data-slot=select-trigger]):focus-visible]:focus-outline has-[:user-invalid:focus-visible]:outline-(--color-error-active) has-[[aria-invalid=true]:focus-visible]:outline-(--color-error-active) data-[invalid=true]:has-[:is(input,textarea,[data-slot=select-trigger]):focus-visible]:outline-(--color-error-active)',\n outset: 'gap-y-2',\n floating:\n 'grid grid-cols-[minmax(0,1fr)] gap-y-1 [--spark-field-label-inset:0px] *:col-start-1 *:row-start-1 has-[[data-slot=input-group-addon][data-align=inline-start]]:[--spark-field-label-inset:1.75rem] [&>[data-slot=field-description]]:row-start-auto [&>[data-slot=field-error]]:row-start-auto',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n },\n compoundVariants: [\n {\n labelPosition: 'inset',\n inputStyle: 'soft',\n inputColor: 'brand',\n class:\n 'bg-input-base has-[:is(input,textarea,[data-slot=select-trigger],[data-slot=combobox-trigger]):not(:disabled)]:hover:bg-input-base-hover',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'soft',\n inputColor: 'gray',\n class:\n 'bg-base-gray-soft has-[:is(input,textarea,[data-slot=select-trigger],[data-slot=combobox-trigger]):not(:disabled)]:hover:bg-gray-a4',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'surface',\n inputColor: 'brand',\n class: 'border border-input bg-base-accent-surface',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'surface',\n inputColor: 'gray',\n class: 'border border-input-gray bg-base-gray-surface',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class: 'border border-input',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class: 'border border-input-gray',\n },\n // ghost inset = bare label + underlined input; the input carries the line\n {\n labelPosition: 'inset',\n inputStyle: 'ghost',\n class: 'rounded-none px-0',\n },\n // shared inset states: filled shells swap bg, bordered shells swap border\n // invalid hover deepens the error tint instead of falling back to accent\n {\n labelPosition: 'inset',\n inputStyle: ['soft', 'surface'],\n class:\n 'data-[disabled=true]:bg-base-gray-soft data-[invalid=true]:bg-base-error-soft data-[invalid=true]:has-[:is(input,textarea,[data-slot=select-trigger],[data-slot=combobox-trigger]):not(:disabled)]:hover:bg-red-a4',\n },\n {\n labelPosition: 'inset',\n inputStyle: ['surface', 'outlined'],\n class:\n 'data-[disabled=true]:border-input-disabled data-[invalid=true]:border-input-invalid',\n },\n ],\n },\n)\n\ninterface FieldProps extends React.ComponentProps<'div'> {\n labelPosition?: SparkLabelPosition\n inputStyle?: SparkInputStyle\n inputColor?: SparkInputColor\n readOnly?: boolean\n 'data-invalid'?: boolean | 'true' | 'false'\n}\n\nfunction Field({\n className,\n children,\n labelPosition: labelPositionProp,\n inputStyle: inputStyleProp,\n inputColor: inputColorProp,\n readOnly = false,\n 'data-invalid': dataInvalid,\n ...props\n}: FieldProps) {\n const id = useId()\n const [descriptionCount, setDescriptionCount] = React.useState(0)\n const [errorCount, setErrorCount] = React.useState(0)\n // counts, not flags: one slot unmounting must not clear what siblings still need\n const setHasDescription = React.useCallback(\n (has: boolean) => setDescriptionCount((n) => n + (has ? 1 : -1)),\n [],\n )\n const setHasError = React.useCallback(\n (has: boolean) => setErrorCount((n) => n + (has ? 1 : -1)),\n [],\n )\n const hasDescription = descriptionCount > 0\n const hasError = errorCount > 0\n // knobs are structural (they move the label / pick the box carrier), so they\n // resolve here via the <Theme> context; props override per instance\n const theme = useTheme()\n const labelPosition = labelPositionProp ?? theme.labelPosition ?? 'inset'\n const inputStyle = inputStyleProp ?? theme.inputStyle ?? 'soft'\n const inputColor = inputColorProp ?? theme.inputColor ?? 'brand'\n const fieldId = `field-${id}`\n const labelId = `${fieldId}-label`\n const value = React.useMemo<FieldContextValue>(\n () => ({\n id: fieldId,\n labelId,\n descriptionId: `${fieldId}-description`,\n hasDescription,\n setHasDescription,\n errorId: `${fieldId}-error`,\n hasError,\n setHasError,\n readOnly,\n labelPosition,\n inputStyle,\n inputColor,\n }),\n [\n fieldId,\n labelId,\n hasDescription,\n setHasDescription,\n hasError,\n setHasError,\n readOnly,\n labelPosition,\n inputStyle,\n inputColor,\n ],\n )\n\n return (\n <FieldContext.Provider value={value}>\n <div\n role=\"group\"\n data-slot=\"field\"\n data-label-position={labelPosition}\n data-input-style={inputStyle}\n data-input-color={inputColor}\n data-invalid={dataInvalid ?? (hasError || undefined)}\n aria-labelledby={readOnly ? labelId : undefined}\n className={cn(\n fieldVariants({ labelPosition, inputStyle, inputColor }),\n className,\n )}\n {...props}\n >\n {children}\n </div>\n </FieldContext.Provider>\n )\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn(\n 'flex min-w-0 flex-1 flex-col gap-1 leading-snug',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst fieldLabelClassName =\n 'text-sm leading-5 font-normal text-gray transition-all group-data-[invalid=true]/field:text-error-active! motion-reduce:transition-none'\n\nconst floatingLabelClassName =\n 'pointer-events-none z-1 mx-3 max-w-[calc(100%-1.5rem)] origin-left translate-x-(--spark-field-label-inset) translate-y-3 self-start justify-self-start truncate text-base leading-6 font-normal text-gray-light transition-[translate,scale,color] duration-200 ease-[cubic-bezier(0,0,0.2,1)] group-focus-within/field:text-accent group-has-[[data-popup-open]]/field:text-accent group-has-[:disabled]/field:text-gray-disabled group-has-[[aria-invalid=true]]/field:text-error-active! group-data-[invalid=true]/field:text-error-active! group-data-[input-style=ghost]/field:mx-0 field-floated:max-w-[calc((100%-1.5rem)/0.75)] field-floated:translate-x-0 field-floated:scale-75 motion-reduce:transition-none'\n\nconst notchClassName =\n 'pointer-events-none -mt-1.5 min-w-0 self-stretch rounded-md border px-[7px] transition-[border-color] duration-200 group-focus-within/field:border-2 group-focus-within/field:border-(--color-focus-root) group-focus-within/field:px-[6px] group-has-[[data-popup-open]]/field:border-2 group-has-[[data-popup-open]]/field:border-(--color-focus-root) group-has-[[data-popup-open]]/field:px-[6px] group-has-[:disabled]/field:border-input-disabled group-has-[[aria-invalid=true]]/field:border-input-invalid! group-data-[invalid=true]/field:border-input-invalid! group-has-[[aria-invalid=true]:focus]/field:border-(--color-error-active)! motion-reduce:transition-none'\n\nconst notchColorClassName: Record<SparkInputColor, string> = {\n brand: 'border-input',\n gray: 'border-input-gray',\n}\n\nfunction FieldNotch({\n inputColor,\n children,\n}: {\n inputColor: SparkInputColor\n children?: React.ReactNode\n}) {\n return (\n <fieldset\n aria-hidden=\"true\"\n data-slot=\"field-notch\"\n className={cn(notchClassName, notchColorClassName[inputColor])}\n >\n <legend className=\"invisible h-3 max-w-[0.01px] p-0 text-xs leading-3 whitespace-nowrap transition-[max-width] duration-50 ease-[cubic-bezier(0,0,0.2,1)] motion-reduce:transition-none field-floated:max-w-full field-floated:delay-50 field-floated:duration-100\">\n {children && <span className=\"inline-block px-1\">{children}</span>}\n </legend>\n </fieldset>\n )\n}\n\nfunction FieldLabel({\n className,\n htmlFor,\n srOnly,\n required,\n children: label,\n ...props\n}: React.ComponentProps<'label'> & {\n srOnly?: boolean\n /** Appends a visual `*`; the control's own `required` announces it. */\n required?: boolean\n}) {\n const field = useFieldContext()\n const floating = field?.labelPosition === 'floating'\n // FieldLegend's visual mark; a read-only value has nothing to fill in\n const children =\n required && !field?.readOnly ? (\n <>\n {label}{' '}\n <span aria-hidden=\"true\" data-slot=\"field-required\">\n *\n </span>\n </>\n ) : (\n label\n )\n const classNames = cn(\n // labels stay full-contrast even when disabled — the control itself\n // (dimmed text, gray shell) signals the state\n floating\n ? cn(\n floatingLabelClassName,\n field.inputStyle === 'outlined'\n ? 'field-floated:-translate-y-1/2'\n : 'field-floated:translate-y-0',\n )\n : fieldLabelClassName,\n // visually hidden but kept in the a11y tree (still names + focuses the control)\n srOnly && 'sr-only',\n className,\n )\n const notch = floating && field.inputStyle === 'outlined' && (\n <FieldNotch inputColor={field.inputColor}>\n {srOnly ? null : children}\n </FieldNotch>\n )\n\n if (field?.readOnly) {\n return (\n <>\n <div data-slot=\"field-label\" id={field.labelId} className={classNames}>\n {children}\n </div>\n {notch}\n </>\n )\n }\n\n return (\n <>\n <label\n data-slot=\"field-label\"\n className={classNames}\n htmlFor={htmlFor ?? field?.id}\n {...props}\n >\n {children}\n </label>\n {notch}\n </>\n )\n}\n\nfunction FieldValue({\n className,\n id,\n title,\n truncate,\n children,\n ...props\n}: React.ComponentProps<'div'> & { truncate?: boolean }) {\n return (\n <div\n data-slot=\"field-value\"\n id={id}\n // truncated string values keep the full text reachable on hover\n title={\n title ??\n (truncate && typeof children === 'string' ? children : undefined)\n }\n className={cn(\n // values are content, not controls — disabled dims but stays ≥4.5:1\n 'min-h-8 w-full text-base text-gray tabular-nums group-data-[disabled=true]/field:opacity-70',\n truncate\n ? 'block truncate leading-8'\n : 'inline-flex items-center wrap-anywhere whitespace-pre-wrap',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n )\n}\n\nfunction FieldSkeleton({\n className,\n labelClassName,\n valueClassName,\n truncate,\n ...props\n}: React.ComponentProps<'div'> & {\n truncate?: boolean\n labelClassName?: string\n valueClassName?: string\n}) {\n return (\n <div\n data-slot=\"field-skeleton\"\n aria-hidden=\"true\"\n className={cn('flex w-full flex-col gap-y-1', className)}\n {...props}\n >\n <Skeleton\n data-slot=\"field-skeleton-label\"\n className={cn('h-5 w-24', labelClassName)}\n />\n <Skeleton\n data-slot=\"field-skeleton-value\"\n className={cn(\n 'h-8 min-h-8 w-full',\n truncate && 'max-w-full truncate',\n valueClassName,\n )}\n />\n </div>\n )\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-title\"\n className={cn(\n 'flex w-fit items-center gap-2 text-sm font-medium text-gray',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction FieldDescription({\n className,\n id,\n render,\n ...props\n}: useRender.ComponentProps<'div'>) {\n const field = useFieldContext()\n const fieldSet = React.useContext(FieldSetContext)\n const owner = field ?? fieldSet\n const setHasDescription = owner?.setHasDescription\n\n React.useEffect(() => {\n if (!setHasDescription) return\n setHasDescription(true)\n return () => setHasDescription(false)\n }, [setHasDescription])\n\n return useRender({\n defaultTagName: 'div',\n render,\n props: {\n 'data-slot': 'field-description',\n id: id ?? owner?.descriptionId,\n className: cn('text-sm leading-normal text-gray-light', className),\n ...props,\n },\n })\n}\n\nfunction FieldSeparator({\n children,\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn('relative -my-2 h-5 text-sm', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n className=\"relative mx-auto block w-fit bg-(--spark-background) px-2 text-gray-light\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n )}\n </div>\n )\n}\n\nfunction FieldError({\n className,\n children,\n errors,\n id,\n ...props\n}: React.ComponentProps<'div'> & {\n errors?: Array<{ message?: string } | undefined>\n}) {\n const field = useFieldContext()\n const fieldSet = React.useContext(FieldSetContext)\n const owner = field ?? fieldSet\n const setHasError = owner?.setHasError\n const content = React.useMemo(() => {\n if (children) return children\n if (!errors?.length) return null\n const messages = [\n ...new Set(errors.map((error) => error?.message).filter(Boolean)),\n ]\n if (messages.length === 0) return null\n if (messages.length === 1) return messages[0]\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {messages.map((message) => (\n <li key={message}>{message}</li>\n ))}\n </ul>\n )\n }, [children, errors])\n\n const hasContent = Boolean(content)\n // a custom id means no element carries owner.errorId, so don't advertise it\n const hasCustomId = id != null\n const setSetUnlinked = !field ? fieldSet?.setHasUnlinkedError : undefined\n\n // must run before the empty-content early return to keep hook order stable\n React.useEffect(() => {\n if (!hasContent) return\n const set = hasCustomId ? setSetUnlinked : setHasError\n if (!set) return\n set(true)\n return () => set(false)\n }, [setHasError, setSetUnlinked, hasContent, hasCustomId])\n\n if (!content) return null\n\n if (!field && fieldSet) {\n // straight into Callout: CalloutDescription's <p> cannot hold the <ul> above\n return (\n <Callout\n variant=\"error\"\n role=\"alert\"\n data-slot=\"field-error\"\n id={id ?? fieldSet.errorId}\n className={className}\n {...props}\n >\n {content}\n </Callout>\n )\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n id={id ?? field?.errorId}\n className={cn('text-sm font-normal text-error', className)}\n {...props}\n >\n {content}\n </div>\n )\n}\n\nexport {\n useFieldSetInvalid,\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldSkeleton,\n FieldTitle,\n FieldValue,\n}\nexport type { FieldProps, FieldSetProps }\n"],"mappings":";;;;;;;;;;;;;;;AAgCA,MAAM,eAAeA,MAAM,cAAwC,IAAI;AAEvE,SAAgB,kBAAkB;CAChC,OAAOA,MAAM,WAAW,YAAY;AACtC;AAOA,SAAgB,gBAAgB,SAI7B;CACD,MAAM,QAAQ,gBAAgB;CAC9B,MAAM,QAAQC,yBAAAA,SAAS;CACvB,MAAM,KAAK,SAAS,MAAM,OAAO;CAIjC,MAAM,kBACJ;EAJc,OAAO,WAA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,SAAD;EACE,SAAQ;EACR,MAAK;EACL,aAAU;EACV,IAAI,MAAM,SAAS;EACR;EACX,GAAI;YAEH;CACM,CAAA;CAIb,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,MAAK;EACL,aAAU;EACV,IAAI,MAAM,OAAO;EACjB,YAAA,GAAA,GAAA,IAAc,kCAAkC,SAAS;EACzD,GAAI;YAEH;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"field.cjs","names":["React","useTheme","Skeleton","Separator","Callout"],"sources":["../../src/components/field.tsx"],"sourcesContent":["'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport { useId } from 'react'\nimport type {\n SparkInputColor,\n SparkInputStyle,\n SparkLabelPosition,\n} from '../lib/theme-types'\nimport { cn } from '../utils/cn'\nimport { Callout } from './callout'\nimport { Separator } from './separator'\nimport { Skeleton } from './skeleton'\nimport { useTheme } from './theme'\n\ntype FieldContextValue = {\n id: string\n labelId: string\n descriptionId: string\n hasDescription: boolean\n setHasDescription: (has: boolean) => void\n errorId: string\n hasError: boolean\n setHasError: (has: boolean) => void\n readOnly: boolean\n labelPosition: SparkLabelPosition\n inputStyle: SparkInputStyle\n inputColor: SparkInputColor\n setHasOutsetControl: (has: boolean) => void\n}\n\nconst FieldContext = React.createContext<FieldContextValue | null>(null)\n\nexport function useFieldContext() {\n return React.useContext(FieldContext)\n}\n\nconst useIsomorphicLayoutEffect =\n typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect\n\nexport function useKeepLabelOutset() {\n const setHasOutsetControl = useFieldContext()?.setHasOutsetControl\n useIsomorphicLayoutEffect(() => {\n if (!setHasOutsetControl) return\n setHasOutsetControl(true)\n return () => setHasOutsetControl(false)\n }, [setHasOutsetControl])\n}\n\n// Field→Theme→default resolution + id/aria-describedby wiring, shared by every\n// control that can sit inside a Field (Input, SelectTrigger, …) so they can't\n// drift on how a style/color/id resolves. `variant` is the control's own\n// per-instance override (already normalized — e.g. Input maps its 'none' to\n// undefined before calling this).\nexport function useFieldControl(options?: {\n id?: string\n ariaDescribedBy?: string\n variant?: SparkInputStyle\n}) {\n const field = useFieldContext()\n const theme = useTheme()\n const id = options?.id ?? field?.id\n const errorId = field?.hasError ? field.errorId : undefined\n const descriptionId = field?.hasDescription ? field.descriptionId : undefined\n // error before hint: the actionable message should be announced first\n const ariaDescribedBy =\n [errorId, descriptionId, options?.ariaDescribedBy]\n .filter(Boolean)\n .join(' ') || undefined\n const inputStyle =\n options?.variant ?? field?.inputStyle ?? theme.inputStyle ?? 'soft'\n const inputColor = field?.inputColor ?? theme.inputColor ?? 'brand'\n const ariaInvalid = field?.hasError || undefined\n return { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor }\n}\n\ntype FieldSetIndicator = 'required' | 'optional'\n\ntype FieldSetContextValue = {\n descriptionId: string\n hasDescription: boolean\n setHasDescription: (has: boolean) => void\n errorId: string\n hasError: boolean\n setHasError: (has: boolean) => void\n /** Marks the set invalid without linking `errorId` (error has a custom id). */\n setHasUnlinkedError: (has: boolean) => void\n invalid: boolean\n indicator?: FieldSetIndicator\n indicatorLabel?: string\n}\n\nconst FieldSetContext = React.createContext<FieldSetContextValue | null>(null)\n\n/** True when the nearest enclosing FieldSet has an error; ignores outer sets. */\nfunction useFieldSetInvalid() {\n return React.useContext(FieldSetContext)?.invalid || undefined\n}\n\nfunction useSlotCount() {\n const [count, setCount] = React.useState(0)\n const setHas = React.useCallback(\n (has: boolean) => setCount((n) => n + (has ? 1 : -1)),\n [],\n )\n return [count > 0, setHas] as const\n}\n\ninterface FieldSetProps extends React.ComponentProps<'fieldset'> {\n /** Marks the legend: `*` plus hidden text, or a visible \"(optional)\". */\n indicator?: FieldSetIndicator\n /** Text for the mark; defaults to `'required'` or `'optional'`. */\n indicatorLabel?: string\n}\n\nfunction FieldSet({\n className,\n indicator,\n indicatorLabel,\n 'aria-describedby': ariaDescribedByProp,\n ...props\n}: FieldSetProps) {\n const id = useId()\n const [hasDescription, setHasDescription] = useSlotCount()\n const [hasError, setHasError] = useSlotCount()\n const [hasUnlinkedError, setHasUnlinkedError] = useSlotCount()\n const invalid = hasError || hasUnlinkedError\n const fieldSetId = `field-set-${id}`\n const descriptionId = `${fieldSetId}-description`\n const errorId = `${fieldSetId}-error`\n const value = React.useMemo<FieldSetContextValue>(\n () => ({\n descriptionId,\n hasDescription,\n setHasDescription,\n errorId,\n hasError,\n setHasError,\n setHasUnlinkedError,\n invalid,\n indicator,\n indicatorLabel,\n }),\n [\n descriptionId,\n hasDescription,\n setHasDescription,\n errorId,\n hasError,\n setHasError,\n setHasUnlinkedError,\n invalid,\n indicator,\n indicatorLabel,\n ],\n )\n const ariaDescribedBy =\n [hasError && errorId, hasDescription && descriptionId, ariaDescribedByProp]\n .filter(Boolean)\n .join(' ') || undefined\n\n return (\n <FieldSetContext.Provider value={value}>\n <fieldset\n data-slot=\"field-set\"\n data-invalid={invalid || undefined}\n aria-describedby={ariaDescribedBy}\n className={cn(\n 'group/field-set flex flex-col gap-[calc(var(--spark-layout-gap)*4)]',\n className,\n )}\n {...props}\n />\n </FieldSetContext.Provider>\n )\n}\n\nfunction FieldLegend({\n className,\n variant = 'legend',\n children,\n ...props\n}: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {\n const fieldSet = React.useContext(FieldSetContext)\n const indicator = fieldSet?.indicator\n const indicatorLabel = fieldSet?.indicatorLabel ?? indicator\n return (\n <legend\n data-invalid={fieldSet?.invalid || undefined}\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn(\n 'mb-1.5 font-medium text-gray data-[invalid=true]:text-error-active! data-[variant=label]:text-sm data-[variant=legend]:text-base',\n className,\n )}\n {...props}\n >\n {children}\n {indicator === 'required' && (\n <>\n {' '}\n <span aria-hidden=\"true\">*</span>\n <span className=\"sr-only\">{indicatorLabel}</span>\n </>\n )}\n {indicator === 'optional' && (\n <>\n {' '}\n <span className=\"font-normal text-gray-light\">\n ({indicatorLabel})\n </span>\n </>\n )}\n </legend>\n )\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group flex w-full flex-col gap-[calc(var(--spark-layout-gap)*4)]',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst fieldVariants = cva(\n 'group/field relative flex w-full flex-col data-[invalid=true]:text-error-active',\n {\n variants: {\n labelPosition: {\n // inset puts label + input inside one shell, so the shell IS the input's box —\n // rounded-md tracks Input/Select/etc.'s own control radius, not the container one.\n // the shell draws the focus outline; the control inside keeps its underline cue\n inset:\n 'gap-y-1 rounded-md px-4 py-3 has-[:is(input,textarea,[data-slot=select-trigger]):focus-visible]:focus-outline has-[:user-invalid:focus-visible]:outline-(--color-error-active) has-[[aria-invalid=true]:focus-visible]:outline-(--color-error-active) data-[invalid=true]:has-[:is(input,textarea,[data-slot=select-trigger]):focus-visible]:outline-(--color-error-active)',\n outset: 'gap-y-2',\n floating:\n 'grid grid-cols-[minmax(0,1fr)] gap-y-1 [--spark-field-label-inset:0px] *:col-start-1 *:row-start-1 has-[[data-slot=input-group-addon][data-align=inline-start]]:[--spark-field-label-inset:1.75rem] [&>[data-slot=field-description]]:row-start-auto [&>[data-slot=field-error]]:row-start-auto',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n },\n compoundVariants: [\n {\n labelPosition: 'inset',\n inputStyle: 'soft',\n inputColor: 'brand',\n class:\n 'bg-input-base has-[:is(input,textarea,[data-slot=select-trigger],[data-slot=combobox-trigger]):not(:disabled)]:hover:bg-input-base-hover',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'soft',\n inputColor: 'gray',\n class:\n 'bg-base-gray-soft has-[:is(input,textarea,[data-slot=select-trigger],[data-slot=combobox-trigger]):not(:disabled)]:hover:bg-gray-a4',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'surface',\n inputColor: 'brand',\n class: 'border border-input bg-base-accent-surface',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'surface',\n inputColor: 'gray',\n class: 'border border-input-gray bg-base-gray-surface',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class: 'border border-input',\n },\n {\n labelPosition: 'inset',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class: 'border border-input-gray',\n },\n // ghost inset = bare label + underlined input; the input carries the line\n {\n labelPosition: 'inset',\n inputStyle: 'ghost',\n class: 'rounded-none px-0',\n },\n // shared inset states: filled shells swap bg, bordered shells swap border\n // invalid hover deepens the error tint instead of falling back to accent\n {\n labelPosition: 'inset',\n inputStyle: ['soft', 'surface'],\n class:\n 'data-[disabled=true]:bg-base-gray-soft data-[invalid=true]:bg-base-error-soft data-[invalid=true]:has-[:is(input,textarea,[data-slot=select-trigger],[data-slot=combobox-trigger]):not(:disabled)]:hover:bg-red-a4',\n },\n {\n labelPosition: 'inset',\n inputStyle: ['surface', 'outlined'],\n class:\n 'data-[disabled=true]:border-input-disabled data-[invalid=true]:border-input-invalid',\n },\n ],\n },\n)\n\ninterface FieldProps extends React.ComponentProps<'div'> {\n labelPosition?: SparkLabelPosition\n inputStyle?: SparkInputStyle\n inputColor?: SparkInputColor\n readOnly?: boolean\n 'data-invalid'?: boolean | 'true' | 'false'\n}\n\nfunction Field({\n className,\n children,\n labelPosition: labelPositionProp,\n inputStyle: inputStyleProp,\n inputColor: inputColorProp,\n readOnly = false,\n 'data-invalid': dataInvalid,\n ...props\n}: FieldProps) {\n const id = useId()\n const [descriptionCount, setDescriptionCount] = React.useState(0)\n const [errorCount, setErrorCount] = React.useState(0)\n // counts, not flags: one slot unmounting must not clear what siblings still need\n const setHasDescription = React.useCallback(\n (has: boolean) => setDescriptionCount((n) => n + (has ? 1 : -1)),\n [],\n )\n const setHasError = React.useCallback(\n (has: boolean) => setErrorCount((n) => n + (has ? 1 : -1)),\n [],\n )\n const [outsetControlCount, setOutsetControlCount] = React.useState(0)\n const setHasOutsetControl = React.useCallback(\n (has: boolean) => setOutsetControlCount((n) => n + (has ? 1 : -1)),\n [],\n )\n const hasDescription = descriptionCount > 0\n const hasError = errorCount > 0\n // knobs are structural (they move the label / pick the box carrier), so they\n // resolve here via the <Theme> context; props override per instance\n const theme = useTheme()\n const requestedLabelPosition =\n labelPositionProp ?? theme.labelPosition ?? 'inset'\n const labelPosition =\n requestedLabelPosition === 'floating' && outsetControlCount > 0\n ? 'outset'\n : requestedLabelPosition\n const inputStyle = inputStyleProp ?? theme.inputStyle ?? 'soft'\n const inputColor = inputColorProp ?? theme.inputColor ?? 'brand'\n const fieldId = `field-${id}`\n const labelId = `${fieldId}-label`\n const value = React.useMemo<FieldContextValue>(\n () => ({\n id: fieldId,\n labelId,\n descriptionId: `${fieldId}-description`,\n hasDescription,\n setHasDescription,\n errorId: `${fieldId}-error`,\n hasError,\n setHasError,\n readOnly,\n labelPosition,\n inputStyle,\n inputColor,\n setHasOutsetControl,\n }),\n [\n fieldId,\n labelId,\n hasDescription,\n setHasDescription,\n hasError,\n setHasError,\n readOnly,\n labelPosition,\n inputStyle,\n inputColor,\n setHasOutsetControl,\n ],\n )\n\n return (\n <FieldContext.Provider value={value}>\n <div\n role=\"group\"\n data-slot=\"field\"\n data-label-position={labelPosition}\n data-input-style={inputStyle}\n data-input-color={inputColor}\n data-invalid={dataInvalid ?? (hasError || undefined)}\n aria-labelledby={readOnly ? labelId : undefined}\n className={cn(\n fieldVariants({ labelPosition, inputStyle, inputColor }),\n className,\n )}\n {...props}\n >\n {children}\n </div>\n </FieldContext.Provider>\n )\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn(\n 'flex min-w-0 flex-1 flex-col gap-1 leading-snug',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst fieldLabelClassName =\n 'text-sm leading-5 font-normal text-gray transition-all group-data-[invalid=true]/field:text-error-active! motion-reduce:transition-none'\n\nconst floatingLabelClassName =\n 'pointer-events-none z-1 mx-3 max-w-[calc(100%-1.5rem)] origin-left translate-x-(--spark-field-label-inset) translate-y-3 self-start justify-self-start truncate text-base leading-6 font-normal text-gray-light transition-[translate,scale,color] duration-200 ease-[cubic-bezier(0,0,0.2,1)] group-focus-within/field:text-accent group-has-[[data-popup-open]]/field:text-accent group-has-[:disabled]/field:text-gray-disabled group-has-[[aria-invalid=true]]/field:text-error-active! group-data-[invalid=true]/field:text-error-active! group-data-[input-style=ghost]/field:mx-0 field-floated:max-w-[calc((100%-1.5rem)/0.75)] field-floated:translate-x-0 field-floated:scale-75 motion-reduce:transition-none'\n\nconst notchClassName =\n 'pointer-events-none -mt-1.5 min-w-0 self-stretch rounded-md border px-[7px] transition-[border-color] duration-200 group-focus-within/field:border-2 group-focus-within/field:border-(--color-focus-root) group-focus-within/field:px-[6px] group-has-[[data-popup-open]]/field:border-2 group-has-[[data-popup-open]]/field:border-(--color-focus-root) group-has-[[data-popup-open]]/field:px-[6px] group-has-[:disabled]/field:border-input-disabled group-has-[[aria-invalid=true]]/field:border-input-invalid! group-data-[invalid=true]/field:border-input-invalid! group-has-[[aria-invalid=true]:focus]/field:border-(--color-error-active)! motion-reduce:transition-none'\n\nconst notchColorClassName: Record<SparkInputColor, string> = {\n brand: 'border-input',\n gray: 'border-input-gray',\n}\n\nfunction FieldNotch({\n inputColor,\n children,\n}: {\n inputColor: SparkInputColor\n children?: React.ReactNode\n}) {\n return (\n <fieldset\n aria-hidden=\"true\"\n data-slot=\"field-notch\"\n className={cn(notchClassName, notchColorClassName[inputColor])}\n >\n <legend className=\"invisible h-3 max-w-[0.01px] p-0 text-xs leading-3 whitespace-nowrap transition-[max-width] duration-50 ease-[cubic-bezier(0,0,0.2,1)] motion-reduce:transition-none field-floated:max-w-full field-floated:delay-50 field-floated:duration-100\">\n {children && <span className=\"inline-block px-1\">{children}</span>}\n </legend>\n </fieldset>\n )\n}\n\nfunction FieldLabel({\n className,\n htmlFor,\n srOnly,\n required,\n children: label,\n ...props\n}: React.ComponentProps<'label'> & {\n srOnly?: boolean\n /** Appends a visual `*`; the control's own `required` announces it. */\n required?: boolean\n}) {\n const field = useFieldContext()\n const floating = field?.labelPosition === 'floating'\n // FieldLegend's visual mark; a read-only value has nothing to fill in\n const children =\n required && !field?.readOnly ? (\n <>\n {label}{' '}\n <span aria-hidden=\"true\" data-slot=\"field-required\">\n *\n </span>\n </>\n ) : (\n label\n )\n const classNames = cn(\n // labels stay full-contrast even when disabled — the control itself\n // (dimmed text, gray shell) signals the state\n floating\n ? cn(\n floatingLabelClassName,\n field.inputStyle === 'outlined'\n ? 'field-floated:-translate-y-1/2'\n : 'field-floated:translate-y-0',\n )\n : fieldLabelClassName,\n // visually hidden but kept in the a11y tree (still names + focuses the control)\n srOnly && 'sr-only',\n className,\n )\n const notch = floating && field.inputStyle === 'outlined' && (\n <FieldNotch inputColor={field.inputColor}>\n {srOnly ? null : children}\n </FieldNotch>\n )\n\n if (field?.readOnly) {\n return (\n <>\n <div data-slot=\"field-label\" id={field.labelId} className={classNames}>\n {children}\n </div>\n {notch}\n </>\n )\n }\n\n return (\n <>\n <label\n data-slot=\"field-label\"\n className={classNames}\n htmlFor={htmlFor ?? field?.id}\n {...props}\n >\n {children}\n </label>\n {notch}\n </>\n )\n}\n\nfunction FieldValue({\n className,\n id,\n title,\n truncate,\n children,\n ...props\n}: React.ComponentProps<'div'> & { truncate?: boolean }) {\n return (\n <div\n data-slot=\"field-value\"\n id={id}\n // truncated string values keep the full text reachable on hover\n title={\n title ??\n (truncate && typeof children === 'string' ? children : undefined)\n }\n className={cn(\n // values are content, not controls — disabled dims but stays ≥4.5:1\n 'min-h-8 w-full text-base text-gray tabular-nums group-data-[disabled=true]/field:opacity-70',\n truncate\n ? 'block truncate leading-8'\n : 'inline-flex items-center wrap-anywhere whitespace-pre-wrap',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n )\n}\n\nfunction FieldSkeleton({\n className,\n labelClassName,\n valueClassName,\n truncate,\n ...props\n}: React.ComponentProps<'div'> & {\n truncate?: boolean\n labelClassName?: string\n valueClassName?: string\n}) {\n return (\n <div\n data-slot=\"field-skeleton\"\n aria-hidden=\"true\"\n className={cn('flex w-full flex-col gap-y-1', className)}\n {...props}\n >\n <Skeleton\n data-slot=\"field-skeleton-label\"\n className={cn('h-5 w-24', labelClassName)}\n />\n <Skeleton\n data-slot=\"field-skeleton-value\"\n className={cn(\n 'h-8 min-h-8 w-full',\n truncate && 'max-w-full truncate',\n valueClassName,\n )}\n />\n </div>\n )\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-title\"\n className={cn(\n 'flex w-fit items-center gap-2 text-sm font-medium text-gray',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction FieldDescription({\n className,\n id,\n render,\n ...props\n}: useRender.ComponentProps<'div'>) {\n const field = useFieldContext()\n const fieldSet = React.useContext(FieldSetContext)\n const owner = field ?? fieldSet\n const setHasDescription = owner?.setHasDescription\n\n React.useEffect(() => {\n if (!setHasDescription) return\n setHasDescription(true)\n return () => setHasDescription(false)\n }, [setHasDescription])\n\n return useRender({\n defaultTagName: 'div',\n render,\n props: {\n 'data-slot': 'field-description',\n id: id ?? owner?.descriptionId,\n className: cn('text-sm leading-normal text-gray-light', className),\n ...props,\n },\n })\n}\n\nfunction FieldSeparator({\n children,\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn('relative -my-2 h-5 text-sm', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n className=\"relative mx-auto block w-fit bg-(--spark-background) px-2 text-gray-light\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n )}\n </div>\n )\n}\n\nfunction FieldError({\n className,\n children,\n errors,\n id,\n ...props\n}: React.ComponentProps<'div'> & {\n errors?: Array<{ message?: string } | undefined>\n}) {\n const field = useFieldContext()\n const fieldSet = React.useContext(FieldSetContext)\n const owner = field ?? fieldSet\n const setHasError = owner?.setHasError\n const content = React.useMemo(() => {\n if (children) return children\n if (!errors?.length) return null\n const messages = [\n ...new Set(errors.map((error) => error?.message).filter(Boolean)),\n ]\n if (messages.length === 0) return null\n if (messages.length === 1) return messages[0]\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {messages.map((message) => (\n <li key={message}>{message}</li>\n ))}\n </ul>\n )\n }, [children, errors])\n\n const hasContent = Boolean(content)\n // a custom id means no element carries owner.errorId, so don't advertise it\n const hasCustomId = id != null\n const setSetUnlinked = !field ? fieldSet?.setHasUnlinkedError : undefined\n\n // must run before the empty-content early return to keep hook order stable\n React.useEffect(() => {\n if (!hasContent) return\n const set = hasCustomId ? setSetUnlinked : setHasError\n if (!set) return\n set(true)\n return () => set(false)\n }, [setHasError, setSetUnlinked, hasContent, hasCustomId])\n\n if (!content) return null\n\n if (!field && fieldSet) {\n // straight into Callout: CalloutDescription's <p> cannot hold the <ul> above\n return (\n <Callout\n variant=\"error\"\n role=\"alert\"\n data-slot=\"field-error\"\n id={id ?? fieldSet.errorId}\n className={className}\n {...props}\n >\n {content}\n </Callout>\n )\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n id={id ?? field?.errorId}\n className={cn('text-sm font-normal text-error', className)}\n {...props}\n >\n {content}\n </div>\n )\n}\n\nexport {\n useFieldSetInvalid,\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldSkeleton,\n FieldTitle,\n FieldValue,\n}\nexport type { FieldProps, FieldSetProps }\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,MAAM,eAAeA,MAAM,cAAwC,IAAI;AAEvE,SAAgB,kBAAkB;CAChC,OAAOA,MAAM,WAAW,YAAY;AACtC;AAEA,MAAM,4BACJ,OAAO,WAAW,cAAcA,MAAM,YAAYA,MAAM;AAE1D,SAAgB,qBAAqB;CACnC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AS,KAAK,YACb,iBAAA,GAAA,kBAAA,KAAC,MAAD,EAAA,UAAmB,QAAY,GAAtB,OAAsB,CAChC;EACC,CAAA;CAER,GAAG,CAAC,UAAU,MAAM,CAAC;CAErB,MAAM,aAAa,QAAQ,OAAO;CAElC,MAAM,cAAc,MAAM;CAC1B,MAAM,iBAAiB,CAAC,QAAQ,UAAU,sBAAsB,KAAA;CAGhE,MAAM,gBAAgB;EACpB,IAAI,CAAC,YAAY;EACjB,MAAM,MAAM,cAAc,iBAAiB;EAC3C,IAAI,CAAC,KAAK;EACV,IAAI,IAAI;EACR,aAAa,IAAI,KAAK;CACxB,GAAG;EAAC;EAAa;EAAgB;EAAY;CAAW,CAAC;CAEzD,IAAI,CAAC,SAAS,OAAO;CAErB,IAAI,CAAC,SAAS,UAEZ,OACE,iBAAA,GAAA,kBAAA,KAACI,2BAAAA,SAAD;EACE,SAAQ;EACR,MAAK;EACL,aAAU;EACV,IAAI,MAAM,SAAS;EACR;EACX,GAAI;YAEH;CACM,CAAA;CAIb,OACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EACE,MAAK;EACL,aAAU;EACV,IAAI,MAAM,OAAO;EACjB,YAAA,GAAA,GAAA,IAAc,kCAAkC,SAAS;EACzD,GAAI;YAEH;CACE,CAAA;AAET"}
@@ -18,8 +18,10 @@ type FieldContextValue = {
18
18
  labelPosition: SparkLabelPosition;
19
19
  inputStyle: SparkInputStyle;
20
20
  inputColor: SparkInputColor;
21
+ setHasOutsetControl: (has: boolean) => void;
21
22
  };
22
23
  declare function useFieldContext(): FieldContextValue | null;
24
+ declare function useKeepLabelOutset(): void;
23
25
  declare function useFieldControl(options?: {
24
26
  id?: string;
25
27
  ariaDescribedBy?: string;
@@ -140,5 +142,5 @@ declare function FieldError({
140
142
  } | undefined>;
141
143
  }): import("react/jsx-runtime").JSX.Element | null;
142
144
  //#endregion
143
- export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, type FieldProps, FieldSeparator, FieldSet, type FieldSetProps, FieldSkeleton, FieldTitle, FieldValue, useFieldContext, useFieldControl, useFieldSetInvalid };
145
+ export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, type FieldProps, FieldSeparator, FieldSet, type FieldSetProps, FieldSkeleton, FieldTitle, FieldValue, useFieldContext, useFieldControl, useFieldSetInvalid, useKeepLabelOutset };
144
146
  //# sourceMappingURL=field.d.cts.map
@@ -18,8 +18,10 @@ type FieldContextValue = {
18
18
  labelPosition: SparkLabelPosition;
19
19
  inputStyle: SparkInputStyle;
20
20
  inputColor: SparkInputColor;
21
+ setHasOutsetControl: (has: boolean) => void;
21
22
  };
22
23
  declare function useFieldContext(): FieldContextValue | null;
24
+ declare function useKeepLabelOutset(): void;
23
25
  declare function useFieldControl(options?: {
24
26
  id?: string;
25
27
  ariaDescribedBy?: string;
@@ -140,5 +142,5 @@ declare function FieldError({
140
142
  } | undefined>;
141
143
  }): import("react/jsx-runtime").JSX.Element | null;
142
144
  //#endregion
143
- export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, type FieldProps, FieldSeparator, FieldSet, type FieldSetProps, FieldSkeleton, FieldTitle, FieldValue, useFieldContext, useFieldControl, useFieldSetInvalid };
145
+ export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, type FieldProps, FieldSeparator, FieldSet, type FieldSetProps, FieldSkeleton, FieldTitle, FieldValue, useFieldContext, useFieldControl, useFieldSetInvalid, useKeepLabelOutset };
144
146
  //# sourceMappingURL=field.d.ts.map