@epilot/spark-ui 0.32.1 → 0.32.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/dist/{button-i1Bgbw4p.d.ts → button-4QGaO78M.d.ts} +2 -2
  2. package/dist/{button-CT39v1M3.d.cts → button-C-KeUy2j.d.cts} +2 -2
  3. package/dist/components/accordion.cjs +2 -2
  4. package/dist/components/accordion.d.ts +1 -1
  5. package/dist/components/accordion.js +2 -2
  6. package/dist/components/alert-dialog.cjs +1 -1
  7. package/dist/components/alert-dialog.d.cts +1 -1
  8. package/dist/components/alert-dialog.d.ts +1 -1
  9. package/dist/components/alert-dialog.js +1 -1
  10. package/dist/components/attachment.cjs +3 -3
  11. package/dist/components/attachment.cjs.map +1 -1
  12. package/dist/components/attachment.d.cts +3 -3
  13. package/dist/components/attachment.d.ts +3 -3
  14. package/dist/components/attachment.js +3 -3
  15. package/dist/components/attachment.js.map +1 -1
  16. package/dist/components/autocomplete.cjs +1 -1
  17. package/dist/components/autocomplete.js +1 -1
  18. package/dist/components/avatar.js +1 -1
  19. package/dist/components/badge.cjs +1 -1
  20. package/dist/components/badge.js +2 -2
  21. package/dist/components/banner.cjs +1 -1
  22. package/dist/components/banner.js +1 -1
  23. package/dist/components/bar-chart.js +1 -1
  24. package/dist/components/breadcrumbs.cjs +1 -1
  25. package/dist/components/breadcrumbs.js +1 -1
  26. package/dist/components/bubble.cjs +2 -2
  27. package/dist/components/bubble.cjs.map +1 -1
  28. package/dist/components/bubble.d.cts +1 -1
  29. package/dist/components/bubble.d.ts +1 -1
  30. package/dist/components/bubble.js +2 -2
  31. package/dist/components/bubble.js.map +1 -1
  32. package/dist/components/button-group.cjs +1 -1
  33. package/dist/components/button-group.js +2 -2
  34. package/dist/components/button.cjs +1 -1
  35. package/dist/components/button.d.cts +1 -1
  36. package/dist/components/button.d.ts +1 -1
  37. package/dist/components/button.js +2 -2
  38. package/dist/components/calendar.cjs +3 -3
  39. package/dist/components/calendar.js +3 -3
  40. package/dist/components/callout.cjs +2 -2
  41. package/dist/components/callout.d.cts +1 -1
  42. package/dist/components/callout.d.ts +2 -2
  43. package/dist/components/callout.js +2 -2
  44. package/dist/components/card.cjs +1 -1
  45. package/dist/components/card.js +1 -1
  46. package/dist/components/checkbox-group.js +1 -1
  47. package/dist/components/checkbox.js +1 -1
  48. package/dist/components/combobox.cjs +70 -25
  49. package/dist/components/combobox.cjs.map +1 -1
  50. package/dist/components/combobox.d.cts +2 -5
  51. package/dist/components/combobox.d.ts +2 -5
  52. package/dist/components/combobox.js +70 -25
  53. package/dist/components/combobox.js.map +1 -1
  54. package/dist/components/dialog.cjs +1 -1
  55. package/dist/components/dialog.js +1 -1
  56. package/dist/components/drawer.cjs +1 -1
  57. package/dist/components/drawer.js +1 -1
  58. package/dist/components/dropdown-menu.cjs +2 -2
  59. package/dist/components/dropdown-menu.cjs.map +1 -1
  60. package/dist/components/dropdown-menu.js +2 -2
  61. package/dist/components/dropdown-menu.js.map +1 -1
  62. package/dist/components/dropzone.cjs +1 -1
  63. package/dist/components/dropzone.cjs.map +1 -1
  64. package/dist/components/dropzone.d.cts +1 -1
  65. package/dist/components/dropzone.d.ts +1 -1
  66. package/dist/components/dropzone.js +1 -1
  67. package/dist/components/dropzone.js.map +1 -1
  68. package/dist/components/empty-state.cjs +1 -1
  69. package/dist/components/empty-state.d.cts +1 -1
  70. package/dist/components/empty-state.d.ts +2 -2
  71. package/dist/components/empty-state.js +1 -1
  72. package/dist/components/entity-card.cjs +4 -4
  73. package/dist/components/entity-card.cjs.map +1 -1
  74. package/dist/components/entity-card.d.ts +1 -1
  75. package/dist/components/entity-card.js +4 -4
  76. package/dist/components/entity-card.js.map +1 -1
  77. package/dist/components/field.cjs +8 -8
  78. package/dist/components/field.cjs.map +1 -1
  79. package/dist/components/field.js +8 -8
  80. package/dist/components/field.js.map +1 -1
  81. package/dist/components/hero-metric.cjs +4 -4
  82. package/dist/components/hero-metric.cjs.map +1 -1
  83. package/dist/components/hero-metric.js +4 -4
  84. package/dist/components/hero-metric.js.map +1 -1
  85. package/dist/components/icon.js +1 -1
  86. package/dist/components/image-carousel.cjs +2 -2
  87. package/dist/components/image-carousel.d.cts +1 -1
  88. package/dist/components/image-carousel.d.ts +1 -1
  89. package/dist/components/image-carousel.js +3 -3
  90. package/dist/components/info-block.cjs +1 -1
  91. package/dist/components/info-block.js +1 -1
  92. package/dist/components/input-group.cjs +4 -4
  93. package/dist/components/input-group.cjs.map +1 -1
  94. package/dist/components/input-group.js +4 -4
  95. package/dist/components/input-group.js.map +1 -1
  96. package/dist/components/input-otp.cjs +3 -3
  97. package/dist/components/input-otp.cjs.map +1 -1
  98. package/dist/components/input-otp.js +3 -3
  99. package/dist/components/input-otp.js.map +1 -1
  100. package/dist/components/input.cjs +3 -3
  101. package/dist/components/input.cjs.map +1 -1
  102. package/dist/components/input.js +3 -3
  103. package/dist/components/input.js.map +1 -1
  104. package/dist/components/line-chart.cjs +1 -1
  105. package/dist/components/line-chart.js +2 -2
  106. package/dist/components/list.cjs +1 -1
  107. package/dist/components/list.js +1 -1
  108. package/dist/components/marker.cjs +1 -1
  109. package/dist/components/marker.d.cts +1 -1
  110. package/dist/components/marker.d.ts +1 -1
  111. package/dist/components/marker.js +1 -1
  112. package/dist/components/message-scroller.cjs +2 -2
  113. package/dist/components/message-scroller.d.cts +1 -1
  114. package/dist/components/message-scroller.d.ts +1 -1
  115. package/dist/components/message-scroller.js +2 -2
  116. package/dist/components/page-header.cjs +2 -2
  117. package/dist/components/page-header.d.cts +2 -2
  118. package/dist/components/page-header.d.ts +2 -2
  119. package/dist/components/page-header.js +2 -2
  120. package/dist/components/pagination.cjs +1 -1
  121. package/dist/components/pagination.d.cts +1 -1
  122. package/dist/components/pagination.d.ts +1 -1
  123. package/dist/components/pagination.js +1 -1
  124. package/dist/components/period-tabs.d.cts +1 -1
  125. package/dist/components/period-tabs.d.ts +1 -1
  126. package/dist/components/pill.cjs +1 -1
  127. package/dist/components/pill.d.cts +1 -1
  128. package/dist/components/pill.d.ts +1 -1
  129. package/dist/components/pill.js +2 -2
  130. package/dist/components/popover.cjs +1 -1
  131. package/dist/components/popover.js +1 -1
  132. package/dist/components/power-history-chart.cjs +1 -1
  133. package/dist/components/power-history-chart.js +2 -2
  134. package/dist/components/power-network.cjs +2 -2
  135. package/dist/components/power-network.js +2 -2
  136. package/dist/components/radio-card-group.cjs +2 -2
  137. package/dist/components/radio-card-group.cjs.map +1 -1
  138. package/dist/components/radio-card-group.js +2 -2
  139. package/dist/components/radio-card-group.js.map +1 -1
  140. package/dist/components/radio.js +1 -1
  141. package/dist/components/schedule-list.cjs +2 -2
  142. package/dist/components/schedule-list.cjs.map +1 -1
  143. package/dist/components/schedule-list.js +2 -2
  144. package/dist/components/schedule-list.js.map +1 -1
  145. package/dist/components/select.cjs +2 -2
  146. package/dist/components/select.js +2 -2
  147. package/dist/components/separator.cjs +1 -1
  148. package/dist/components/separator.js +1 -1
  149. package/dist/components/sheet.cjs +1 -1
  150. package/dist/components/sheet.js +1 -1
  151. package/dist/components/skeleton.cjs +1 -1
  152. package/dist/components/skeleton.js +1 -1
  153. package/dist/components/solar-forecast-chart.d.ts +1 -1
  154. package/dist/components/step-indicator.cjs +2 -2
  155. package/dist/components/step-indicator.js +2 -2
  156. package/dist/components/stepper.cjs +1 -1
  157. package/dist/components/stepper.js +1 -1
  158. package/dist/components/switch-group.js +1 -1
  159. package/dist/components/switch.js +1 -1
  160. package/dist/components/table.cjs +1 -1
  161. package/dist/components/table.js +1 -1
  162. package/dist/components/tabs.cjs +22 -11
  163. package/dist/components/tabs.cjs.map +1 -1
  164. package/dist/components/tabs.d.cts +5 -1
  165. package/dist/components/tabs.d.ts +5 -1
  166. package/dist/components/tabs.js +23 -12
  167. package/dist/components/tabs.js.map +1 -1
  168. package/dist/components/textarea.cjs +3 -3
  169. package/dist/components/textarea.cjs.map +1 -1
  170. package/dist/components/textarea.js +3 -3
  171. package/dist/components/textarea.js.map +1 -1
  172. package/dist/components/theme.cjs +1 -1
  173. package/dist/components/theme.js +2 -2
  174. package/dist/components/toast.cjs +4 -4
  175. package/dist/components/toast.cjs.map +1 -1
  176. package/dist/components/toast.js +4 -4
  177. package/dist/components/toast.js.map +1 -1
  178. package/dist/components/toggle-group.js +1 -1
  179. package/dist/components/toggle.d.cts +1 -1
  180. package/dist/components/toggle.d.ts +1 -1
  181. package/dist/components/toggle.js +1 -1
  182. package/dist/components/tooltip.cjs +1 -1
  183. package/dist/components/tooltip.js +1 -1
  184. package/dist/components/trace.cjs +3 -3
  185. package/dist/components/trace.cjs.map +1 -1
  186. package/dist/components/trace.js +3 -3
  187. package/dist/components/trace.js.map +1 -1
  188. package/dist/hooks/use-overflow-list.cjs +79 -0
  189. package/dist/hooks/use-overflow-list.cjs.map +1 -0
  190. package/dist/hooks/use-overflow-list.d.cts +48 -0
  191. package/dist/hooks/use-overflow-list.d.ts +48 -0
  192. package/dist/hooks/use-overflow-list.js +77 -0
  193. package/dist/hooks/use-overflow-list.js.map +1 -0
  194. package/dist/lib/calendar-lists.cjs +2 -2
  195. package/dist/lib/calendar-lists.js +2 -2
  196. package/dist/lib/date-field.cjs +8 -7
  197. package/dist/lib/date-field.cjs.map +1 -1
  198. package/dist/lib/date-field.d.cts +7 -1
  199. package/dist/lib/date-field.d.ts +7 -1
  200. package/dist/lib/date-field.js +8 -7
  201. package/dist/lib/date-field.js.map +1 -1
  202. package/dist/lib/input-box-variants.cjs +3 -3
  203. package/dist/lib/input-box-variants.cjs.map +1 -1
  204. package/dist/lib/input-box-variants.d.cts +1 -1
  205. package/dist/lib/input-box-variants.d.ts +1 -1
  206. package/dist/lib/input-box-variants.js +3 -3
  207. package/dist/lib/input-box-variants.js.map +1 -1
  208. package/dist/lib/toggle-group-context.d.cts +1 -1
  209. package/dist/lib/toggle-group-context.d.ts +1 -1
  210. package/dist/styles/theme.css +10 -5
  211. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { cn } from "../utils/cn.js";
3
- import * as React$1 from "react";
4
3
  import { ChevronLeft, ChevronRight } from "@epilot/spark-icons";
4
+ import * as React$1 from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  //#region src/components/stepper.tsx
7
7
  const STEP_BUTTON = "touch-target inline-flex size-8 items-center justify-center rounded-sm text-gray transition-colors hover:bg-gray-a3 disabled:opacity-40 disabled:hover:bg-transparent motion-reduce:transition-none";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { accentByColor } from "../lib/accent-colors.js";
3
2
  import { cn } from "../utils/cn.js";
3
+ import { accentByColor } from "../lib/accent-colors.js";
4
4
  import { useFieldSetInvalid } from "./field.js";
5
5
  import { selectionListClasses } from "../lib/selection-list.js";
6
6
  import "react";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { accentByColor } from "../lib/accent-colors.js";
3
2
  import { cn } from "../utils/cn.js";
3
+ import { accentByColor } from "../lib/accent-colors.js";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { Switch as Switch$1 } from "@base-ui/react/switch";
6
6
  //#region src/components/switch.tsx
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_chunk = require("../chunk-DY84GLCh.cjs");
4
4
  const require_components_skeleton = require("./skeleton.cjs");
5
+ let _epilot_spark_icons = require("@epilot/spark-icons");
5
6
  let react = require("react");
6
7
  react = require_chunk.__toESM(react);
7
- let _epilot_spark_icons = require("@epilot/spark-icons");
8
8
  let react_jsx_runtime = require("react/jsx-runtime");
9
9
  let cn = require("cn");
10
10
  //#region src/components/table.tsx
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { cn } from "../utils/cn.js";
3
3
  import { Skeleton } from "./skeleton.js";
4
- import * as React$1 from "react";
5
4
  import { ArrowDownward, ArrowUpward, SwapVert } from "@epilot/spark-icons";
5
+ import * as React$1 from "react";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  //#region src/components/table.tsx
8
8
  const TableContext = React$1.createContext({
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_chunk = require("../chunk-DY84GLCh.cjs");
4
4
  const require_hooks_use_isomorphic_layout_effect = require("../hooks/use-isomorphic-layout-effect.cjs");
5
+ let _epilot_spark_icons = require("@epilot/spark-icons");
5
6
  let react = require("react");
6
7
  react = require_chunk.__toESM(react);
7
- let _epilot_spark_icons = require("@epilot/spark-icons");
8
8
  let react_jsx_runtime = require("react/jsx-runtime");
9
9
  let _base_ui_react_tabs = require("@base-ui/react/tabs");
10
10
  let cn = require("cn");
@@ -119,20 +119,31 @@ const TabsList = react.forwardRef(function TabsList({ className, style, variant:
119
119
  ]
120
120
  });
121
121
  });
122
- function TabsTrigger({ className, children, ...props }) {
122
+ function TabsTrigger({ className, children, invalidLabel, "aria-describedby": ariaDescribedByProp, ...props }) {
123
+ const invalidLabelId = react.useId();
124
+ const describesInvalid = (props["aria-invalid"] === true || props["aria-invalid"] === "true") && !!invalidLabel;
123
125
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_tabs.Tabs.Tab, {
124
126
  "data-slot": "tabs-trigger",
125
127
  className: (0, cn.cn)("group/trigger touch-target inline-flex min-w-(--tabs-trigger-minw,5rem) shrink-0 cursor-pointer scroll-mx-10 flex-col items-center justify-center rounded-sm text-base font-bold whitespace-nowrap text-gray focus-visible:outline-offset-[-2px]", "group-data-fill/tabs:shrink group-data-fill/tabs:grow group-data-fill/tabs:basis-0", "data-disabled:pointer-events-none data-disabled:opacity-50", "aria-invalid:text-error-soft-foreground", "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4", className),
126
128
  ...props,
127
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
128
- "data-slot": "tabs-trigger-inner",
129
- className: "inline-flex items-center gap-1",
130
- children
131
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
132
- "aria-hidden": "true",
133
- "data-slot": "tabs-indicator",
134
- className: "mt-1.5 flex h-1 w-full px-4 group-data-active/trigger:bg-(--spark-tabs-indicator,var(--color-base-accent-solid)) group-data-active/trigger:group-aria-[invalid=true]/trigger:bg-input-invalid"
135
- })]
129
+ "aria-describedby": [describesInvalid && invalidLabelId, ariaDescribedByProp].filter(Boolean).join(" ") || void 0,
130
+ children: [
131
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
132
+ "data-slot": "tabs-trigger-inner",
133
+ className: "inline-flex items-center gap-1",
134
+ children
135
+ }),
136
+ describesInvalid ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
137
+ hidden: true,
138
+ id: invalidLabelId,
139
+ children: invalidLabel
140
+ }) : null,
141
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
142
+ "aria-hidden": "true",
143
+ "data-slot": "tabs-indicator",
144
+ className: "mt-1.5 flex h-1 w-full px-4 group-data-active/trigger:bg-(--spark-tabs-indicator,var(--color-base-accent-solid)) group-data-active/trigger:group-aria-[invalid=true]/trigger:bg-input-invalid"
145
+ })
146
+ ]
136
147
  });
137
148
  }
138
149
  /** @deprecated Use `TabsTrigger`. */
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.cjs","names":["TabsPrimitive","React","ChevronRight","ChevronLeft"],"sources":["../../src/components/tabs.tsx"],"sourcesContent":["import { Tabs as TabsPrimitive } from '@base-ui/react/tabs'\nimport { ChevronLeft, ChevronRight } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect'\nimport { cn } from '../utils/cn'\n\n// Merge our internal scroller ref with a consumer-forwarded ref. Written locally\n// and React 19-correct: it propagates cleanup-returning callback refs and nulls\n// plain refs on unmount.\ntype PossibleRef<T> = React.Ref<T> | undefined\n\nfunction setRef<T>(ref: PossibleRef<T>, value: T | null) {\n if (typeof ref === 'function') return ref(value)\n if (ref) ref.current = value\n return undefined\n}\n\nfunction composeRefs<T>(...refs: PossibleRef<T>[]) {\n return (node: T) => {\n let hasCleanup = false\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node)\n if (typeof cleanup === 'function') hasCleanup = true\n return cleanup\n })\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < refs.length; i++) {\n const cleanup = cleanups[i]\n if (typeof cleanup === 'function') cleanup()\n else setRef(refs[i], null)\n }\n }\n }\n return undefined\n }\n}\n\ntype TabsProps = React.ComponentProps<typeof TabsPrimitive.Root>\n\nfunction Tabs(props: TabsProps) {\n return <TabsPrimitive.Root data-slot=\"tabs\" {...props} />\n}\n\ntype TabsListVariant = 'underline' | 'portal' | 'default' | 'pill'\n\ntype TabsListProps = Omit<\n React.ComponentProps<typeof TabsPrimitive.List>,\n 'style'\n> & {\n /** @deprecated Tabs have a single look; this prop has no effect. */\n variant?: TabsListVariant\n /**\n * Stretch the strip to its container's full width and divide it evenly\n * among the triggers, instead of shrinking to fit their labels. Each\n * trigger's `--tabs-trigger-minw` floor still applies — once there's no\n * longer room to keep every trigger at least that wide, the strip hands\n * over to the scroller exactly like the non-`fill` case.\n */\n fill?: boolean\n // style lands on the plain wrapper div, so no Base UI state-callback form\n style?: React.CSSProperties\n}\n\n// how much of a neighboring tab a scroll-into-view reveals (matches scroll-mx-10)\nconst REVEAL_PEEK = 40\n\nconst TabsList = React.forwardRef<HTMLDivElement, Omit<TabsListProps, 'ref'>>(\n function TabsList(\n // oxlint-disable-next-line typescript/no-deprecated -- strips the no-op legacy prop\n { className, style, variant: _variant, fill, ...props },\n ref,\n ) {\n const wrapperRef = React.useRef<HTMLDivElement | null>(null)\n const scrollerRef = React.useRef<HTMLDivElement | null>(null)\n // stable identity (keyed on the forwarded ref) so React doesn't detach/re-attach\n // the scroller ref on every render — TabsList re-renders on each selection.\n const scrollerCallbackRef = React.useMemo(\n () => composeRefs<HTMLDivElement>(scrollerRef, ref),\n [ref],\n )\n\n // Overflow state + travel-into-view. The MutationObserver tracks selection,\n // children and text changes; the ResizeObserver re-measures on reflow.\n useIsomorphicLayoutEffect(() => {\n const wrapper = wrapperRef.current\n const scroller = scrollerRef.current\n if (!wrapper || !scroller) return\n // the edge chevrons show per side while more content hides in that direction\n const syncOverflow = () => {\n // 2px epsilon absorbs sub-pixel rounding at fractional browser zoom\n // (scrollWidth/clientWidth round to int, scrollLeft is fractional). Assumes\n // LTR (scrollLeft >= 0) — Spark's tab strips are LTR.\n const max = scroller.scrollWidth - scroller.clientWidth\n wrapper.toggleAttribute('data-overflow-start', scroller.scrollLeft > 2)\n wrapper.toggleAttribute(\n 'data-overflow-end',\n scroller.scrollLeft < max - 2,\n )\n }\n // scroller-local reveal — deliberately NOT scrollIntoView, which also scrolls\n // ancestors and would yank the page when the list is half off-screen. The peek\n // keeps the neighboring tab partially visible (\"there's more here\").\n const reveal = (el: HTMLElement) => {\n // jsdom (unit tests) doesn't implement Element.scrollTo\n if (typeof scroller.scrollTo !== 'function') return\n const start = el.offsetLeft - REVEAL_PEEK\n const end = el.offsetLeft + el.offsetWidth + REVEAL_PEEK\n if (start < scroller.scrollLeft) {\n scroller.scrollTo({ left: Math.max(0, start), behavior: 'instant' })\n } else if (end > scroller.scrollLeft + scroller.clientWidth) {\n scroller.scrollTo({\n left: end - scroller.clientWidth,\n behavior: 'instant',\n })\n }\n }\n let lastActive: HTMLElement | null = null\n const measure = () => {\n const active = scroller.querySelector<HTMLElement>(\n '[data-slot=\"tabs-trigger\"][data-active]',\n )\n syncOverflow()\n // travel the active tab into view on selection change — and on mount, so a\n // defaulted off-screen tab is visible\n if (active && active !== lastActive) reveal(active)\n lastActive = active\n }\n measure()\n scroller.addEventListener('scroll', syncOverflow, { passive: true })\n const mo = new MutationObserver(measure)\n mo.observe(scroller, {\n subtree: true,\n childList: true,\n characterData: true,\n attributeFilter: ['data-active'],\n })\n const ro = new ResizeObserver(measure)\n ro.observe(scroller)\n return () => {\n scroller.removeEventListener('scroll', syncOverflow)\n mo.disconnect()\n ro.disconnect()\n }\n }, [])\n\n const scrollByPage = (dir: 1 | -1) => () => {\n const scroller = scrollerRef.current\n if (typeof scroller?.scrollBy !== 'function') return\n // behavior omitted → follows the scroller's CSS scroll-behavior (smooth,\n // motion-reduce → auto)\n scroller.scrollBy({ left: dir * scroller.clientWidth * 0.6 })\n }\n const chevron = (dir: 1 | -1) => (\n <button\n aria-hidden=\"true\"\n data-slot={dir === 1 ? 'tabs-scroll-next' : 'tabs-scroll-prev'}\n onClick={scrollByPage(dir)}\n tabIndex={-1}\n type=\"button\"\n className={cn(\n 'touch-target absolute top-1/2 z-1 hidden size-10 -translate-y-1/2 cursor-pointer items-center justify-center rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))] bg-gray-1/72 text-gray-a11 backdrop-blur-sm hover:text-gray-12',\n dir === 1\n ? 'right-0 group-data-overflow-end/tabs:flex'\n : 'left-0 group-data-overflow-start/tabs:flex',\n )}\n >\n {dir === 1 ? <ChevronRight /> : <ChevronLeft />}\n </button>\n )\n\n return (\n <div\n className={cn(\n 'group/tabs relative max-w-full',\n fill ? 'block w-full' : 'inline-block',\n className,\n )}\n data-fill={fill ? true : undefined}\n data-slot=\"tabs-list\"\n ref={wrapperRef}\n style={style}\n >\n {chevron(-1)}\n <TabsPrimitive.List\n data-slot=\"tabs-scroller\"\n ref={scrollerCallbackRef}\n className=\"relative no-scrollbar flex h-10 w-full items-center gap-4 overflow-x-auto overflow-y-hidden scroll-smooth text-gray motion-reduce:scroll-auto\"\n {...props}\n />\n {chevron(1)}\n </div>\n )\n },\n)\n\ntype TabsTriggerProps = React.ComponentProps<typeof TabsPrimitive.Tab>\n\nfunction TabsTrigger({ className, children, ...props }: TabsTriggerProps) {\n return (\n <TabsPrimitive.Tab\n data-slot=\"tabs-trigger\"\n className={cn(\n 'group/trigger touch-target inline-flex min-w-(--tabs-trigger-minw,5rem) shrink-0 cursor-pointer scroll-mx-10 flex-col items-center justify-center rounded-sm text-base font-bold whitespace-nowrap text-gray focus-visible:outline-offset-[-2px]',\n // fill: divide the strip evenly instead of sizing to each label — the\n // min-w floor above still applies, so a strip too narrow to keep every\n // trigger at least that wide still hands over to the scroller.\n 'group-data-fill/tabs:shrink group-data-fill/tabs:grow group-data-fill/tabs:basis-0',\n 'data-disabled:pointer-events-none data-disabled:opacity-50',\n 'aria-invalid:text-error-soft-foreground',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n <span\n data-slot=\"tabs-trigger-inner\"\n className=\"inline-flex items-center gap-1\"\n >\n {children}\n </span>\n <span\n aria-hidden=\"true\"\n data-slot=\"tabs-indicator\"\n className=\"mt-1.5 flex h-1 w-full px-4 group-data-active/trigger:bg-(--spark-tabs-indicator,var(--color-base-accent-solid)) group-data-active/trigger:group-aria-[invalid=true]/trigger:bg-input-invalid\"\n />\n </TabsPrimitive.Tab>\n )\n}\n\n/** @deprecated Use `TabsTrigger`. */\nexport const TabsTriggerUnderline = TabsTrigger\n\n/** @deprecated Use `TabsTrigger`. */\nexport const TabsTriggerPill = TabsTrigger\n\ntype TabsContentProps = React.ComponentProps<typeof TabsPrimitive.Panel>\n\nfunction TabsContent({ className, ...props }: TabsContentProps) {\n return (\n <TabsPrimitive.Panel\n data-slot=\"tabs-content\"\n className={cn('focus-visible:outline-offset-0', className)}\n {...props}\n />\n )\n}\n\nexport { Tabs, TabsContent, TabsList, TabsTrigger }\nexport type { TabsListProps, TabsListVariant, TabsProps, TabsTriggerProps }\n"],"mappings":";;;;;;;;;;;AAWA,SAAS,OAAU,KAAqB,OAAiB;CACvD,IAAI,OAAO,QAAQ,YAAY,OAAO,IAAI,KAAK;CAC/C,IAAI,KAAK,IAAI,UAAU;AAEzB;AAEA,SAAS,YAAe,GAAG,MAAwB;CACjD,QAAQ,SAAY;EAClB,IAAI,aAAa;EACjB,MAAM,WAAW,KAAK,KAAK,QAAQ;GACjC,MAAM,UAAU,OAAO,KAAK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EACE;YATT;GAWG,QAAQ,EAAE;GACX,iBAAA,GAAA,kBAAA,KAACH,oBAAAA,KAAc,MAAf;IACE,aAAU;IACV,KAAK;IACL,WAAU;IACV,GAAI;GACL,CAAA;GACA,QAAQ,CAAC;EACP;;AAET,CACF;AAIA,SAAS,YAAY,EAAE,WAAW,UAAU,GAAG,SAA2B;CACxE,OACE,iBAAA,GAAA,kBAAA,MAACA,oBAAAA,KAAc,KAAf;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IACE,oPAIA,sFACA,8DACA,2CACA,mFACA,SACF;EACA,GAAI;YAbN,CAeE,iBAAA,GAAA,kBAAA,KAAC,QAAD;GACE,aAAU;GACV,WAAU;GAET;EACG,CAAA,GACN,iBAAA,GAAA,kBAAA,KAAC,QAAD;GACE,eAAY;GACZ,aAAU;GACV,WAAU;EACX,CAAA,CACgB;;AAEvB;;AAGA,MAAa,uBAAuB;;AAGpC,MAAa,kBAAkB;AAI/B,SAAS,YAAY,EAAE,WAAW,GAAG,SAA2B;CAC9D,OACE,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,KAAc,OAAf;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IAAc,kCAAkC,SAAS;EACzD,GAAI;CACL,CAAA;AAEL"}
1
+ {"version":3,"file":"tabs.cjs","names":["TabsPrimitive","React","ChevronRight","ChevronLeft"],"sources":["../../src/components/tabs.tsx"],"sourcesContent":["import { Tabs as TabsPrimitive } from '@base-ui/react/tabs'\nimport { ChevronLeft, ChevronRight } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect'\nimport { cn } from '../utils/cn'\n\n// Merge our internal scroller ref with a consumer-forwarded ref. Written locally\n// and React 19-correct: it propagates cleanup-returning callback refs and nulls\n// plain refs on unmount.\ntype PossibleRef<T> = React.Ref<T> | undefined\n\nfunction setRef<T>(ref: PossibleRef<T>, value: T | null) {\n if (typeof ref === 'function') return ref(value)\n if (ref) ref.current = value\n return undefined\n}\n\nfunction composeRefs<T>(...refs: PossibleRef<T>[]) {\n return (node: T) => {\n let hasCleanup = false\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node)\n if (typeof cleanup === 'function') hasCleanup = true\n return cleanup\n })\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < refs.length; i++) {\n const cleanup = cleanups[i]\n if (typeof cleanup === 'function') cleanup()\n else setRef(refs[i], null)\n }\n }\n }\n return undefined\n }\n}\n\ntype TabsProps = React.ComponentProps<typeof TabsPrimitive.Root>\n\nfunction Tabs(props: TabsProps) {\n return <TabsPrimitive.Root data-slot=\"tabs\" {...props} />\n}\n\ntype TabsListVariant = 'underline' | 'portal' | 'default' | 'pill'\n\ntype TabsListProps = Omit<\n React.ComponentProps<typeof TabsPrimitive.List>,\n 'style'\n> & {\n /** @deprecated Tabs have a single look; this prop has no effect. */\n variant?: TabsListVariant\n /**\n * Stretch the strip to its container's full width and divide it evenly\n * among the triggers, instead of shrinking to fit their labels. Each\n * trigger's `--tabs-trigger-minw` floor still applies — once there's no\n * longer room to keep every trigger at least that wide, the strip hands\n * over to the scroller exactly like the non-`fill` case.\n */\n fill?: boolean\n // style lands on the plain wrapper div, so no Base UI state-callback form\n style?: React.CSSProperties\n}\n\n// how much of a neighboring tab a scroll-into-view reveals (matches scroll-mx-10)\nconst REVEAL_PEEK = 40\n\nconst TabsList = React.forwardRef<HTMLDivElement, Omit<TabsListProps, 'ref'>>(\n function TabsList(\n // oxlint-disable-next-line typescript/no-deprecated -- strips the no-op legacy prop\n { className, style, variant: _variant, fill, ...props },\n ref,\n ) {\n const wrapperRef = React.useRef<HTMLDivElement | null>(null)\n const scrollerRef = React.useRef<HTMLDivElement | null>(null)\n // stable identity (keyed on the forwarded ref) so React doesn't detach/re-attach\n // the scroller ref on every render — TabsList re-renders on each selection.\n const scrollerCallbackRef = React.useMemo(\n () => composeRefs<HTMLDivElement>(scrollerRef, ref),\n [ref],\n )\n\n // Overflow state + travel-into-view. The MutationObserver tracks selection,\n // children and text changes; the ResizeObserver re-measures on reflow.\n useIsomorphicLayoutEffect(() => {\n const wrapper = wrapperRef.current\n const scroller = scrollerRef.current\n if (!wrapper || !scroller) return\n // the edge chevrons show per side while more content hides in that direction\n const syncOverflow = () => {\n // 2px epsilon absorbs sub-pixel rounding at fractional browser zoom\n // (scrollWidth/clientWidth round to int, scrollLeft is fractional). Assumes\n // LTR (scrollLeft >= 0) — Spark's tab strips are LTR.\n const max = scroller.scrollWidth - scroller.clientWidth\n wrapper.toggleAttribute('data-overflow-start', scroller.scrollLeft > 2)\n wrapper.toggleAttribute(\n 'data-overflow-end',\n scroller.scrollLeft < max - 2,\n )\n }\n // scroller-local reveal — deliberately NOT scrollIntoView, which also scrolls\n // ancestors and would yank the page when the list is half off-screen. The peek\n // keeps the neighboring tab partially visible (\"there's more here\").\n const reveal = (el: HTMLElement) => {\n // jsdom (unit tests) doesn't implement Element.scrollTo\n if (typeof scroller.scrollTo !== 'function') return\n const start = el.offsetLeft - REVEAL_PEEK\n const end = el.offsetLeft + el.offsetWidth + REVEAL_PEEK\n if (start < scroller.scrollLeft) {\n scroller.scrollTo({ left: Math.max(0, start), behavior: 'instant' })\n } else if (end > scroller.scrollLeft + scroller.clientWidth) {\n scroller.scrollTo({\n left: end - scroller.clientWidth,\n behavior: 'instant',\n })\n }\n }\n let lastActive: HTMLElement | null = null\n const measure = () => {\n const active = scroller.querySelector<HTMLElement>(\n '[data-slot=\"tabs-trigger\"][data-active]',\n )\n syncOverflow()\n // travel the active tab into view on selection change — and on mount, so a\n // defaulted off-screen tab is visible\n if (active && active !== lastActive) reveal(active)\n lastActive = active\n }\n measure()\n scroller.addEventListener('scroll', syncOverflow, { passive: true })\n const mo = new MutationObserver(measure)\n mo.observe(scroller, {\n subtree: true,\n childList: true,\n characterData: true,\n attributeFilter: ['data-active'],\n })\n const ro = new ResizeObserver(measure)\n ro.observe(scroller)\n return () => {\n scroller.removeEventListener('scroll', syncOverflow)\n mo.disconnect()\n ro.disconnect()\n }\n }, [])\n\n const scrollByPage = (dir: 1 | -1) => () => {\n const scroller = scrollerRef.current\n if (typeof scroller?.scrollBy !== 'function') return\n // behavior omitted → follows the scroller's CSS scroll-behavior (smooth,\n // motion-reduce → auto)\n scroller.scrollBy({ left: dir * scroller.clientWidth * 0.6 })\n }\n const chevron = (dir: 1 | -1) => (\n <button\n aria-hidden=\"true\"\n data-slot={dir === 1 ? 'tabs-scroll-next' : 'tabs-scroll-prev'}\n onClick={scrollByPage(dir)}\n tabIndex={-1}\n type=\"button\"\n className={cn(\n 'touch-target absolute top-1/2 z-1 hidden size-10 -translate-y-1/2 cursor-pointer items-center justify-center rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))] bg-gray-1/72 text-gray-a11 backdrop-blur-sm hover:text-gray-12',\n dir === 1\n ? 'right-0 group-data-overflow-end/tabs:flex'\n : 'left-0 group-data-overflow-start/tabs:flex',\n )}\n >\n {dir === 1 ? <ChevronRight /> : <ChevronLeft />}\n </button>\n )\n\n return (\n <div\n className={cn(\n 'group/tabs relative max-w-full',\n fill ? 'block w-full' : 'inline-block',\n className,\n )}\n data-fill={fill ? true : undefined}\n data-slot=\"tabs-list\"\n ref={wrapperRef}\n style={style}\n >\n {chevron(-1)}\n <TabsPrimitive.List\n data-slot=\"tabs-scroller\"\n ref={scrollerCallbackRef}\n className=\"relative no-scrollbar flex h-10 w-full items-center gap-4 overflow-x-auto overflow-y-hidden scroll-smooth text-gray motion-reduce:scroll-auto\"\n {...props}\n />\n {chevron(1)}\n </div>\n )\n },\n)\n\ntype TabsTriggerProps = React.ComponentProps<typeof TabsPrimitive.Tab> & {\n /** Read as the tab's description while it is `aria-invalid`, e.g. \"has errors\". */\n invalidLabel?: string\n}\n\nfunction TabsTrigger({\n className,\n children,\n invalidLabel,\n 'aria-describedby': ariaDescribedByProp,\n ...props\n}: TabsTriggerProps) {\n const invalidLabelId = React.useId()\n const describesInvalid =\n (props['aria-invalid'] === true || props['aria-invalid'] === 'true') &&\n !!invalidLabel\n return (\n <TabsPrimitive.Tab\n data-slot=\"tabs-trigger\"\n className={cn(\n 'group/trigger touch-target inline-flex min-w-(--tabs-trigger-minw,5rem) shrink-0 cursor-pointer scroll-mx-10 flex-col items-center justify-center rounded-sm text-base font-bold whitespace-nowrap text-gray focus-visible:outline-offset-[-2px]',\n // fill: divide the strip evenly instead of sizing to each label — the\n // min-w floor above still applies, so a strip too narrow to keep every\n // trigger at least that wide still hands over to the scroller.\n 'group-data-fill/tabs:shrink group-data-fill/tabs:grow group-data-fill/tabs:basis-0',\n 'data-disabled:pointer-events-none data-disabled:opacity-50',\n 'aria-invalid:text-error-soft-foreground',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n aria-describedby={\n [describesInvalid && invalidLabelId, ariaDescribedByProp]\n .filter(Boolean)\n .join(' ') || undefined\n }\n >\n <span\n data-slot=\"tabs-trigger-inner\"\n className=\"inline-flex items-center gap-1\"\n >\n {children}\n </span>\n {describesInvalid ? (\n <span hidden id={invalidLabelId}>\n {invalidLabel}\n </span>\n ) : null}\n <span\n aria-hidden=\"true\"\n data-slot=\"tabs-indicator\"\n className=\"mt-1.5 flex h-1 w-full px-4 group-data-active/trigger:bg-(--spark-tabs-indicator,var(--color-base-accent-solid)) group-data-active/trigger:group-aria-[invalid=true]/trigger:bg-input-invalid\"\n />\n </TabsPrimitive.Tab>\n )\n}\n\n/** @deprecated Use `TabsTrigger`. */\nexport const TabsTriggerUnderline = TabsTrigger\n\n/** @deprecated Use `TabsTrigger`. */\nexport const TabsTriggerPill = TabsTrigger\n\ntype TabsContentProps = React.ComponentProps<typeof TabsPrimitive.Panel>\n\nfunction TabsContent({ className, ...props }: TabsContentProps) {\n return (\n <TabsPrimitive.Panel\n data-slot=\"tabs-content\"\n className={cn('focus-visible:outline-offset-0', className)}\n {...props}\n />\n )\n}\n\nexport { Tabs, TabsContent, TabsList, TabsTrigger }\nexport type { T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WAAW,GAAG,SAA2B;CAC9D,OACE,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,KAAc,OAAf;EACE,aAAU;EACV,YAAA,GAAA,GAAA,IAAc,kCAAkC,SAAS;EACzD,GAAI;CACL,CAAA;AAEL"}
@@ -20,10 +20,14 @@ type TabsListProps = Omit<React$1.ComponentProps<typeof Tabs$1.List>, 'style'> &
20
20
  style?: React$1.CSSProperties;
21
21
  };
22
22
  declare const TabsList: React$1.ForwardRefExoticComponent<Omit<TabsListProps, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
23
- type TabsTriggerProps = React$1.ComponentProps<typeof Tabs$1.Tab>;
23
+ type TabsTriggerProps = React$1.ComponentProps<typeof Tabs$1.Tab> & {
24
+ /** Read as the tab's description while it is `aria-invalid`, e.g. "has errors". */invalidLabel?: string;
25
+ };
24
26
  declare function TabsTrigger({
25
27
  className,
26
28
  children,
29
+ invalidLabel,
30
+ 'aria-describedby': ariaDescribedByProp,
27
31
  ...props
28
32
  }: TabsTriggerProps): import("react/jsx-runtime").JSX.Element;
29
33
  /** @deprecated Use `TabsTrigger`. */
@@ -20,10 +20,14 @@ type TabsListProps = Omit<React$1.ComponentProps<typeof Tabs$1.List>, 'style'> &
20
20
  style?: React$1.CSSProperties;
21
21
  };
22
22
  declare const TabsList: React$1.ForwardRefExoticComponent<Omit<TabsListProps, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
23
- type TabsTriggerProps = React$1.ComponentProps<typeof Tabs$1.Tab>;
23
+ type TabsTriggerProps = React$1.ComponentProps<typeof Tabs$1.Tab> & {
24
+ /** Read as the tab's description while it is `aria-invalid`, e.g. "has errors". */invalidLabel?: string;
25
+ };
24
26
  declare function TabsTrigger({
25
27
  className,
26
28
  children,
29
+ invalidLabel,
30
+ 'aria-describedby': ariaDescribedByProp,
27
31
  ...props
28
32
  }: TabsTriggerProps): import("react/jsx-runtime").JSX.Element;
29
33
  /** @deprecated Use `TabsTrigger`. */
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { useIsomorphicLayoutEffect } from "../hooks/use-isomorphic-layout-effect.js";
3
2
  import { cn } from "../utils/cn.js";
4
- import * as React$1 from "react";
3
+ import { useIsomorphicLayoutEffect } from "../hooks/use-isomorphic-layout-effect.js";
5
4
  import { ChevronLeft, ChevronRight } from "@epilot/spark-icons";
5
+ import * as React$1 from "react";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
8
8
  //#region src/components/tabs.tsx
@@ -116,20 +116,31 @@ const TabsList = React$1.forwardRef(function TabsList({ className, style, varian
116
116
  ]
117
117
  });
118
118
  });
119
- function TabsTrigger({ className, children, ...props }) {
119
+ function TabsTrigger({ className, children, invalidLabel, "aria-describedby": ariaDescribedByProp, ...props }) {
120
+ const invalidLabelId = React$1.useId();
121
+ const describesInvalid = (props["aria-invalid"] === true || props["aria-invalid"] === "true") && !!invalidLabel;
120
122
  return /* @__PURE__ */ jsxs(Tabs$1.Tab, {
121
123
  "data-slot": "tabs-trigger",
122
124
  className: cn("group/trigger touch-target inline-flex min-w-(--tabs-trigger-minw,5rem) shrink-0 cursor-pointer scroll-mx-10 flex-col items-center justify-center rounded-sm text-base font-bold whitespace-nowrap text-gray focus-visible:outline-offset-[-2px]", "group-data-fill/tabs:shrink group-data-fill/tabs:grow group-data-fill/tabs:basis-0", "data-disabled:pointer-events-none data-disabled:opacity-50", "aria-invalid:text-error-soft-foreground", "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4", className),
123
125
  ...props,
124
- children: [/* @__PURE__ */ jsx("span", {
125
- "data-slot": "tabs-trigger-inner",
126
- className: "inline-flex items-center gap-1",
127
- children
128
- }), /* @__PURE__ */ jsx("span", {
129
- "aria-hidden": "true",
130
- "data-slot": "tabs-indicator",
131
- className: "mt-1.5 flex h-1 w-full px-4 group-data-active/trigger:bg-(--spark-tabs-indicator,var(--color-base-accent-solid)) group-data-active/trigger:group-aria-[invalid=true]/trigger:bg-input-invalid"
132
- })]
126
+ "aria-describedby": [describesInvalid && invalidLabelId, ariaDescribedByProp].filter(Boolean).join(" ") || void 0,
127
+ children: [
128
+ /* @__PURE__ */ jsx("span", {
129
+ "data-slot": "tabs-trigger-inner",
130
+ className: "inline-flex items-center gap-1",
131
+ children
132
+ }),
133
+ describesInvalid ? /* @__PURE__ */ jsx("span", {
134
+ hidden: true,
135
+ id: invalidLabelId,
136
+ children: invalidLabel
137
+ }) : null,
138
+ /* @__PURE__ */ jsx("span", {
139
+ "aria-hidden": "true",
140
+ "data-slot": "tabs-indicator",
141
+ className: "mt-1.5 flex h-1 w-full px-4 group-data-active/trigger:bg-(--spark-tabs-indicator,var(--color-base-accent-solid)) group-data-active/trigger:group-aria-[invalid=true]/trigger:bg-input-invalid"
142
+ })
143
+ ]
133
144
  });
134
145
  }
135
146
  /** @deprecated Use `TabsTrigger`. */
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.js","names":["TabsPrimitive","React"],"sources":["../../src/components/tabs.tsx"],"sourcesContent":["import { Tabs as TabsPrimitive } from '@base-ui/react/tabs'\nimport { ChevronLeft, ChevronRight } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect'\nimport { cn } from '../utils/cn'\n\n// Merge our internal scroller ref with a consumer-forwarded ref. Written locally\n// and React 19-correct: it propagates cleanup-returning callback refs and nulls\n// plain refs on unmount.\ntype PossibleRef<T> = React.Ref<T> | undefined\n\nfunction setRef<T>(ref: PossibleRef<T>, value: T | null) {\n if (typeof ref === 'function') return ref(value)\n if (ref) ref.current = value\n return undefined\n}\n\nfunction composeRefs<T>(...refs: PossibleRef<T>[]) {\n return (node: T) => {\n let hasCleanup = false\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node)\n if (typeof cleanup === 'function') hasCleanup = true\n return cleanup\n })\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < refs.length; i++) {\n const cleanup = cleanups[i]\n if (typeof cleanup === 'function') cleanup()\n else setRef(refs[i], null)\n }\n }\n }\n return undefined\n }\n}\n\ntype TabsProps = React.ComponentProps<typeof TabsPrimitive.Root>\n\nfunction Tabs(props: TabsProps) {\n return <TabsPrimitive.Root data-slot=\"tabs\" {...props} />\n}\n\ntype TabsListVariant = 'underline' | 'portal' | 'default' | 'pill'\n\ntype TabsListProps = Omit<\n React.ComponentProps<typeof TabsPrimitive.List>,\n 'style'\n> & {\n /** @deprecated Tabs have a single look; this prop has no effect. */\n variant?: TabsListVariant\n /**\n * Stretch the strip to its container's full width and divide it evenly\n * among the triggers, instead of shrinking to fit their labels. Each\n * trigger's `--tabs-trigger-minw` floor still applies — once there's no\n * longer room to keep every trigger at least that wide, the strip hands\n * over to the scroller exactly like the non-`fill` case.\n */\n fill?: boolean\n // style lands on the plain wrapper div, so no Base UI state-callback form\n style?: React.CSSProperties\n}\n\n// how much of a neighboring tab a scroll-into-view reveals (matches scroll-mx-10)\nconst REVEAL_PEEK = 40\n\nconst TabsList = React.forwardRef<HTMLDivElement, Omit<TabsListProps, 'ref'>>(\n function TabsList(\n // oxlint-disable-next-line typescript/no-deprecated -- strips the no-op legacy prop\n { className, style, variant: _variant, fill, ...props },\n ref,\n ) {\n const wrapperRef = React.useRef<HTMLDivElement | null>(null)\n const scrollerRef = React.useRef<HTMLDivElement | null>(null)\n // stable identity (keyed on the forwarded ref) so React doesn't detach/re-attach\n // the scroller ref on every render — TabsList re-renders on each selection.\n const scrollerCallbackRef = React.useMemo(\n () => composeRefs<HTMLDivElement>(scrollerRef, ref),\n [ref],\n )\n\n // Overflow state + travel-into-view. The MutationObserver tracks selection,\n // children and text changes; the ResizeObserver re-measures on reflow.\n useIsomorphicLayoutEffect(() => {\n const wrapper = wrapperRef.current\n const scroller = scrollerRef.current\n if (!wrapper || !scroller) return\n // the edge chevrons show per side while more content hides in that direction\n const syncOverflow = () => {\n // 2px epsilon absorbs sub-pixel rounding at fractional browser zoom\n // (scrollWidth/clientWidth round to int, scrollLeft is fractional). Assumes\n // LTR (scrollLeft >= 0) — Spark's tab strips are LTR.\n const max = scroller.scrollWidth - scroller.clientWidth\n wrapper.toggleAttribute('data-overflow-start', scroller.scrollLeft > 2)\n wrapper.toggleAttribute(\n 'data-overflow-end',\n scroller.scrollLeft < max - 2,\n )\n }\n // scroller-local reveal — deliberately NOT scrollIntoView, which also scrolls\n // ancestors and would yank the page when the list is half off-screen. The peek\n // keeps the neighboring tab partially visible (\"there's more here\").\n const reveal = (el: HTMLElement) => {\n // jsdom (unit tests) doesn't implement Element.scrollTo\n if (typeof scroller.scrollTo !== 'function') return\n const start = el.offsetLeft - REVEAL_PEEK\n const end = el.offsetLeft + el.offsetWidth + REVEAL_PEEK\n if (start < scroller.scrollLeft) {\n scroller.scrollTo({ left: Math.max(0, start), behavior: 'instant' })\n } else if (end > scroller.scrollLeft + scroller.clientWidth) {\n scroller.scrollTo({\n left: end - scroller.clientWidth,\n behavior: 'instant',\n })\n }\n }\n let lastActive: HTMLElement | null = null\n const measure = () => {\n const active = scroller.querySelector<HTMLElement>(\n '[data-slot=\"tabs-trigger\"][data-active]',\n )\n syncOverflow()\n // travel the active tab into view on selection change — and on mount, so a\n // defaulted off-screen tab is visible\n if (active && active !== lastActive) reveal(active)\n lastActive = active\n }\n measure()\n scroller.addEventListener('scroll', syncOverflow, { passive: true })\n const mo = new MutationObserver(measure)\n mo.observe(scroller, {\n subtree: true,\n childList: true,\n characterData: true,\n attributeFilter: ['data-active'],\n })\n const ro = new ResizeObserver(measure)\n ro.observe(scroller)\n return () => {\n scroller.removeEventListener('scroll', syncOverflow)\n mo.disconnect()\n ro.disconnect()\n }\n }, [])\n\n const scrollByPage = (dir: 1 | -1) => () => {\n const scroller = scrollerRef.current\n if (typeof scroller?.scrollBy !== 'function') return\n // behavior omitted → follows the scroller's CSS scroll-behavior (smooth,\n // motion-reduce → auto)\n scroller.scrollBy({ left: dir * scroller.clientWidth * 0.6 })\n }\n const chevron = (dir: 1 | -1) => (\n <button\n aria-hidden=\"true\"\n data-slot={dir === 1 ? 'tabs-scroll-next' : 'tabs-scroll-prev'}\n onClick={scrollByPage(dir)}\n tabIndex={-1}\n type=\"button\"\n className={cn(\n 'touch-target absolute top-1/2 z-1 hidden size-10 -translate-y-1/2 cursor-pointer items-center justify-center rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))] bg-gray-1/72 text-gray-a11 backdrop-blur-sm hover:text-gray-12',\n dir === 1\n ? 'right-0 group-data-overflow-end/tabs:flex'\n : 'left-0 group-data-overflow-start/tabs:flex',\n )}\n >\n {dir === 1 ? <ChevronRight /> : <ChevronLeft />}\n </button>\n )\n\n return (\n <div\n className={cn(\n 'group/tabs relative max-w-full',\n fill ? 'block w-full' : 'inline-block',\n className,\n )}\n data-fill={fill ? true : undefined}\n data-slot=\"tabs-list\"\n ref={wrapperRef}\n style={style}\n >\n {chevron(-1)}\n <TabsPrimitive.List\n data-slot=\"tabs-scroller\"\n ref={scrollerCallbackRef}\n className=\"relative no-scrollbar flex h-10 w-full items-center gap-4 overflow-x-auto overflow-y-hidden scroll-smooth text-gray motion-reduce:scroll-auto\"\n {...props}\n />\n {chevron(1)}\n </div>\n )\n },\n)\n\ntype TabsTriggerProps = React.ComponentProps<typeof TabsPrimitive.Tab>\n\nfunction TabsTrigger({ className, children, ...props }: TabsTriggerProps) {\n return (\n <TabsPrimitive.Tab\n data-slot=\"tabs-trigger\"\n className={cn(\n 'group/trigger touch-target inline-flex min-w-(--tabs-trigger-minw,5rem) shrink-0 cursor-pointer scroll-mx-10 flex-col items-center justify-center rounded-sm text-base font-bold whitespace-nowrap text-gray focus-visible:outline-offset-[-2px]',\n // fill: divide the strip evenly instead of sizing to each label — the\n // min-w floor above still applies, so a strip too narrow to keep every\n // trigger at least that wide still hands over to the scroller.\n 'group-data-fill/tabs:shrink group-data-fill/tabs:grow group-data-fill/tabs:basis-0',\n 'data-disabled:pointer-events-none data-disabled:opacity-50',\n 'aria-invalid:text-error-soft-foreground',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n >\n <span\n data-slot=\"tabs-trigger-inner\"\n className=\"inline-flex items-center gap-1\"\n >\n {children}\n </span>\n <span\n aria-hidden=\"true\"\n data-slot=\"tabs-indicator\"\n className=\"mt-1.5 flex h-1 w-full px-4 group-data-active/trigger:bg-(--spark-tabs-indicator,var(--color-base-accent-solid)) group-data-active/trigger:group-aria-[invalid=true]/trigger:bg-input-invalid\"\n />\n </TabsPrimitive.Tab>\n )\n}\n\n/** @deprecated Use `TabsTrigger`. */\nexport const TabsTriggerUnderline = TabsTrigger\n\n/** @deprecated Use `TabsTrigger`. */\nexport const TabsTriggerPill = TabsTrigger\n\ntype TabsContentProps = React.ComponentProps<typeof TabsPrimitive.Panel>\n\nfunction TabsContent({ className, ...props }: TabsContentProps) {\n return (\n <TabsPrimitive.Panel\n data-slot=\"tabs-content\"\n className={cn('focus-visible:outline-offset-0', className)}\n {...props}\n />\n )\n}\n\nexport { Tabs, TabsContent, TabsList, TabsTrigger }\nexport type { TabsListProps, TabsListVariant, TabsProps, TabsTriggerProps }\n"],"mappings":";;;;;;;;AAWA,SAAS,OAAU,KAAqB,OAAiB;CACvD,IAAI,OAAO,QAAQ,YAAY,OAAO,IAAI,KAAK;CAC/C,IAAI,KAAK,IAAI,UAAU;AAEzB;AAEA,SAAS,YAAe,GAAG,MAAwB;CACjD,QAAQ,SAAY;EAClB,IAAI,aAAa;EACjB,MAAM,WAAW,KAAK,KAAK,QAAQ;GACjC,MAAM,UAAU,OAAO,KAAK,IAAI;GAChC,IAAI,OAAO,YAAY,YAAY,aAAa;GAChD,OAAO;EACT,CAAC;EACD,IAAI,YACF,aAAa;GACX,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;IACpC,MAAM,UAAU,SAAS;IACzB,IAAI,OAAO,YAAY,YAAY,QAAQ;SACtC,OAAO,KAAK,IAAI,IAAI;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ACZ,aAAU;GACV,WAAU;EACX,CAAA,CACgB;;AAEvB;;AAGA,MAAa,uBAAuB;;AAGpC,MAAa,kBAAkB;AAI/B,SAAS,YAAY,EAAE,WAAW,GAAG,SAA2B;CAC9D,OACE,oBAACA,OAAc,OAAf;EACE,aAAU;EACV,WAAW,GAAG,kCAAkC,SAAS;EACzD,GAAI;CACL,CAAA;AAEL"}
1
+ {"version":3,"file":"tabs.js","names":["TabsPrimitive","React"],"sources":["../../src/components/tabs.tsx"],"sourcesContent":["import { Tabs as TabsPrimitive } from '@base-ui/react/tabs'\nimport { ChevronLeft, ChevronRight } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect'\nimport { cn } from '../utils/cn'\n\n// Merge our internal scroller ref with a consumer-forwarded ref. Written locally\n// and React 19-correct: it propagates cleanup-returning callback refs and nulls\n// plain refs on unmount.\ntype PossibleRef<T> = React.Ref<T> | undefined\n\nfunction setRef<T>(ref: PossibleRef<T>, value: T | null) {\n if (typeof ref === 'function') return ref(value)\n if (ref) ref.current = value\n return undefined\n}\n\nfunction composeRefs<T>(...refs: PossibleRef<T>[]) {\n return (node: T) => {\n let hasCleanup = false\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node)\n if (typeof cleanup === 'function') hasCleanup = true\n return cleanup\n })\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < refs.length; i++) {\n const cleanup = cleanups[i]\n if (typeof cleanup === 'function') cleanup()\n else setRef(refs[i], null)\n }\n }\n }\n return undefined\n }\n}\n\ntype TabsProps = React.ComponentProps<typeof TabsPrimitive.Root>\n\nfunction Tabs(props: TabsProps) {\n return <TabsPrimitive.Root data-slot=\"tabs\" {...props} />\n}\n\ntype TabsListVariant = 'underline' | 'portal' | 'default' | 'pill'\n\ntype TabsListProps = Omit<\n React.ComponentProps<typeof TabsPrimitive.List>,\n 'style'\n> & {\n /** @deprecated Tabs have a single look; this prop has no effect. */\n variant?: TabsListVariant\n /**\n * Stretch the strip to its container's full width and divide it evenly\n * among the triggers, instead of shrinking to fit their labels. Each\n * trigger's `--tabs-trigger-minw` floor still applies — once there's no\n * longer room to keep every trigger at least that wide, the strip hands\n * over to the scroller exactly like the non-`fill` case.\n */\n fill?: boolean\n // style lands on the plain wrapper div, so no Base UI state-callback form\n style?: React.CSSProperties\n}\n\n// how much of a neighboring tab a scroll-into-view reveals (matches scroll-mx-10)\nconst REVEAL_PEEK = 40\n\nconst TabsList = React.forwardRef<HTMLDivElement, Omit<TabsListProps, 'ref'>>(\n function TabsList(\n // oxlint-disable-next-line typescript/no-deprecated -- strips the no-op legacy prop\n { className, style, variant: _variant, fill, ...props },\n ref,\n ) {\n const wrapperRef = React.useRef<HTMLDivElement | null>(null)\n const scrollerRef = React.useRef<HTMLDivElement | null>(null)\n // stable identity (keyed on the forwarded ref) so React doesn't detach/re-attach\n // the scroller ref on every render — TabsList re-renders on each selection.\n const scrollerCallbackRef = React.useMemo(\n () => composeRefs<HTMLDivElement>(scrollerRef, ref),\n [ref],\n )\n\n // Overflow state + travel-into-view. The MutationObserver tracks selection,\n // children and text changes; the ResizeObserver re-measures on reflow.\n useIsomorphicLayoutEffect(() => {\n const wrapper = wrapperRef.current\n const scroller = scrollerRef.current\n if (!wrapper || !scroller) return\n // the edge chevrons show per side while more content hides in that direction\n const syncOverflow = () => {\n // 2px epsilon absorbs sub-pixel rounding at fractional browser zoom\n // (scrollWidth/clientWidth round to int, scrollLeft is fractional). Assumes\n // LTR (scrollLeft >= 0) — Spark's tab strips are LTR.\n const max = scroller.scrollWidth - scroller.clientWidth\n wrapper.toggleAttribute('data-overflow-start', scroller.scrollLeft > 2)\n wrapper.toggleAttribute(\n 'data-overflow-end',\n scroller.scrollLeft < max - 2,\n )\n }\n // scroller-local reveal — deliberately NOT scrollIntoView, which also scrolls\n // ancestors and would yank the page when the list is half off-screen. The peek\n // keeps the neighboring tab partially visible (\"there's more here\").\n const reveal = (el: HTMLElement) => {\n // jsdom (unit tests) doesn't implement Element.scrollTo\n if (typeof scroller.scrollTo !== 'function') return\n const start = el.offsetLeft - REVEAL_PEEK\n const end = el.offsetLeft + el.offsetWidth + REVEAL_PEEK\n if (start < scroller.scrollLeft) {\n scroller.scrollTo({ left: Math.max(0, start), behavior: 'instant' })\n } else if (end > scroller.scrollLeft + scroller.clientWidth) {\n scroller.scrollTo({\n left: end - scroller.clientWidth,\n behavior: 'instant',\n })\n }\n }\n let lastActive: HTMLElement | null = null\n const measure = () => {\n const active = scroller.querySelector<HTMLElement>(\n '[data-slot=\"tabs-trigger\"][data-active]',\n )\n syncOverflow()\n // travel the active tab into view on selection change — and on mount, so a\n // defaulted off-screen tab is visible\n if (active && active !== lastActive) reveal(active)\n lastActive = active\n }\n measure()\n scroller.addEventListener('scroll', syncOverflow, { passive: true })\n const mo = new MutationObserver(measure)\n mo.observe(scroller, {\n subtree: true,\n childList: true,\n characterData: true,\n attributeFilter: ['data-active'],\n })\n const ro = new ResizeObserver(measure)\n ro.observe(scroller)\n return () => {\n scroller.removeEventListener('scroll', syncOverflow)\n mo.disconnect()\n ro.disconnect()\n }\n }, [])\n\n const scrollByPage = (dir: 1 | -1) => () => {\n const scroller = scrollerRef.current\n if (typeof scroller?.scrollBy !== 'function') return\n // behavior omitted → follows the scroller's CSS scroll-behavior (smooth,\n // motion-reduce → auto)\n scroller.scrollBy({ left: dir * scroller.clientWidth * 0.6 })\n }\n const chevron = (dir: 1 | -1) => (\n <button\n aria-hidden=\"true\"\n data-slot={dir === 1 ? 'tabs-scroll-next' : 'tabs-scroll-prev'}\n onClick={scrollByPage(dir)}\n tabIndex={-1}\n type=\"button\"\n className={cn(\n 'touch-target absolute top-1/2 z-1 hidden size-10 -translate-y-1/2 cursor-pointer items-center justify-center rounded-[max(var(--spark-rounded-md),var(--spark-rounded-full))] bg-gray-1/72 text-gray-a11 backdrop-blur-sm hover:text-gray-12',\n dir === 1\n ? 'right-0 group-data-overflow-end/tabs:flex'\n : 'left-0 group-data-overflow-start/tabs:flex',\n )}\n >\n {dir === 1 ? <ChevronRight /> : <ChevronLeft />}\n </button>\n )\n\n return (\n <div\n className={cn(\n 'group/tabs relative max-w-full',\n fill ? 'block w-full' : 'inline-block',\n className,\n )}\n data-fill={fill ? true : undefined}\n data-slot=\"tabs-list\"\n ref={wrapperRef}\n style={style}\n >\n {chevron(-1)}\n <TabsPrimitive.List\n data-slot=\"tabs-scroller\"\n ref={scrollerCallbackRef}\n className=\"relative no-scrollbar flex h-10 w-full items-center gap-4 overflow-x-auto overflow-y-hidden scroll-smooth text-gray motion-reduce:scroll-auto\"\n {...props}\n />\n {chevron(1)}\n </div>\n )\n },\n)\n\ntype TabsTriggerProps = React.ComponentProps<typeof TabsPrimitive.Tab> & {\n /** Read as the tab's description while it is `aria-invalid`, e.g. \"has errors\". */\n invalidLabel?: string\n}\n\nfunction TabsTrigger({\n className,\n children,\n invalidLabel,\n 'aria-describedby': ariaDescribedByProp,\n ...props\n}: TabsTriggerProps) {\n const invalidLabelId = React.useId()\n const describesInvalid =\n (props['aria-invalid'] === true || props['aria-invalid'] === 'true') &&\n !!invalidLabel\n return (\n <TabsPrimitive.Tab\n data-slot=\"tabs-trigger\"\n className={cn(\n 'group/trigger touch-target inline-flex min-w-(--tabs-trigger-minw,5rem) shrink-0 cursor-pointer scroll-mx-10 flex-col items-center justify-center rounded-sm text-base font-bold whitespace-nowrap text-gray focus-visible:outline-offset-[-2px]',\n // fill: divide the strip evenly instead of sizing to each label — the\n // min-w floor above still applies, so a strip too narrow to keep every\n // trigger at least that wide still hands over to the scroller.\n 'group-data-fill/tabs:shrink group-data-fill/tabs:grow group-data-fill/tabs:basis-0',\n 'data-disabled:pointer-events-none data-disabled:opacity-50',\n 'aria-invalid:text-error-soft-foreground',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',\n className,\n )}\n {...props}\n aria-describedby={\n [describesInvalid && invalidLabelId, ariaDescribedByProp]\n .filter(Boolean)\n .join(' ') || undefined\n }\n >\n <span\n data-slot=\"tabs-trigger-inner\"\n className=\"inline-flex items-center gap-1\"\n >\n {children}\n </span>\n {describesInvalid ? (\n <span hidden id={invalidLabelId}>\n {invalidLabel}\n </span>\n ) : null}\n <span\n aria-hidden=\"true\"\n data-slot=\"tabs-indicator\"\n className=\"mt-1.5 flex h-1 w-full px-4 group-data-active/trigger:bg-(--spark-tabs-indicator,var(--color-base-accent-solid)) group-data-active/trigger:group-aria-[invalid=true]/trigger:bg-input-invalid\"\n />\n </TabsPrimitive.Tab>\n )\n}\n\n/** @deprecated Use `TabsTrigger`. */\nexport const TabsTriggerUnderline = TabsTrigger\n\n/** @deprecated Use `TabsTrigger`. */\nexport const TabsTriggerPill = TabsTrigger\n\ntype TabsContentProps = React.ComponentProps<typeof TabsPrimitive.Panel>\n\nfunction TabsContent({ className, ...props }: TabsContentProps) {\n return (\n <TabsPrimitive.Panel\n data-slot=\"tabs-content\"\n className={cn('focus-visible:outline-offset-0', className)}\n {...props}\n />\n )\n}\n\nexport { Tabs, TabsContent, TabsList, TabsTrigger }\nexport type { TabsListProps, TabsListVariant, TabsProps, TabsTriggerProps }\n"],"mappings":";;;;;;;;AAWA,SAAS,OAAU,KAAqB,OAAiB;CACvD,IAAI,OAAO,QAAQ,YAAY,OAAO,IAAI,KAAK;CAC/C,IAAI,KAAK,IAAI,UAAU;AAEzB;AAEA,SAAS,YAAe,GAAG,MAAwB;CACjD,QAAQ,SAAY;EAClB,IAAI,aAAa;EACjB,MAAM,WAAW,KAAK,KAAK,QAAQ;GACjC,MAAM,UAAU,OAAO,KAAK,IAAI;GAChC,IAAI,OAAO,YAAY,YAAY,aAAa;GAChD,OAAO;EACT,CAAC;EACD,IAAI,YACF,aAAa;GACX,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;IACpC,MAAM,UAAU,SAAS;IACzB,IAAI,OAAO,YAAY,YAAY,QAAQ;SACtC,OAAO,KAAK,IAAI,IAAI;GAC3B;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A,mFACA,SACF;EACA,GAAI;EACJ,oBACE,CAAC,oBAAoB,gBAAgB,mBAAmB,EACrD,OAAO,OAAO,EACd,KAAK,GAAG,KAAK,KAAA;YAjBpB;GAoBE,oBAAC,QAAD;IACE,aAAU;IACV,WAAU;IAET;GACG,CAAA;GACL,mBACC,oBAAC,QAAD;IAAM,QAAA;IAAO,IAAI;cACd;GACG,CAAA,IACJ;GACJ,oBAAC,QAAD;IACE,eAAY;IACZ,aAAU;IACV,WAAU;GACX,CAAA;EACgB;;AAEvB;;AAGA,MAAa,uBAAuB;;AAGpC,MAAa,kBAAkB;AAI/B,SAAS,YAAY,EAAE,WAAW,GAAG,SAA2B;CAC9D,OACE,oBAACA,OAAc,OAAf;EACE,aAAU;EACV,WAAW,GAAG,kCAAkC,SAAS;EACzD,GAAI;CACL,CAAA;AAEL"}
@@ -1,15 +1,15 @@
1
1
  "use client";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_chunk = require("../chunk-DY84GLCh.cjs");
4
- const require_lib_input_box_variants = require("../lib/input-box-variants.cjs");
5
4
  const require_components_field = require("./field.cjs");
5
+ const require_lib_input_box_variants = require("../lib/input-box-variants.cjs");
6
6
  let react = require("react");
7
7
  react = require_chunk.__toESM(react);
8
- let class_variance_authority = require("class-variance-authority");
9
8
  let react_jsx_runtime = require("react/jsx-runtime");
9
+ let class_variance_authority = require("class-variance-authority");
10
10
  let cn = require("cn");
11
11
  //#region src/components/textarea.tsx
12
- const textareaVariants = (0, class_variance_authority.cva)("flex w-full min-w-0 bg-transparent text-gray transition-[color,background-color,border-color] group-data-[invalid=true]/field:text-error placeholder:text-gray-placeholder disabled:cursor-not-allowed disabled:text-gray-disabled disabled:placeholder:text-gray-disabled aria-invalid:text-error motion-reduce:transition-none", {
12
+ const textareaVariants = (0, class_variance_authority.cva)("flex w-full min-w-0 bg-transparent text-gray transition-[color,background-color,border-color] placeholder:text-gray-placeholder disabled:cursor-not-allowed disabled:text-gray-disabled disabled:placeholder:text-gray-disabled motion-reduce:transition-none", {
13
13
  variants: {
14
14
  chrome: {
15
15
  none: "border-0 px-0 focus-visible:outline-hidden",
@@ -1 +1 @@
1
- {"version":3,"file":"textarea.cjs","names":["INSET_UNDERLINE","boxChrome","React","useFieldControl"],"sources":["../../src/components/textarea.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport {\n boxChrome,\n FLOATING_PLACEHOLDER,\n FLOATING_SURFACE_FOCUS,\n INSET_UNDERLINE,\n} from '../lib/input-box-variants'\nimport type { SparkInputStyle } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\nimport { useFieldControl } from './field'\n\ntype TextareaVariant = SparkInputStyle | 'none'\n\nconst textareaVariants = cva(\n 'flex w-full min-w-0 bg-transparent text-gray transition-[color,background-color,border-color] group-data-[invalid=true]/field:text-error placeholder:text-gray-placeholder disabled:cursor-not-allowed disabled:text-gray-disabled disabled:placeholder:text-gray-disabled aria-invalid:text-error motion-reduce:transition-none',\n {\n variants: {\n chrome: {\n none: 'border-0 px-0 focus-visible:outline-hidden',\n inset: INSET_UNDERLINE,\n box: 'min-h-11 rounded-md px-3 py-2 text-base transition-[color,background-color,border-color] motion-reduce:transition-none',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n autoResize: {\n true: 'field-sizing-content resize-none',\n false: 'resize-y',\n },\n },\n compoundVariants: [\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'brand',\n class: boxChrome.soft.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'gray',\n class: boxChrome.soft.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'brand',\n class: boxChrome.surface.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'gray',\n class: boxChrome.surface.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class: boxChrome.outlined.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class: boxChrome.outlined.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'brand',\n class: boxChrome.ghost.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'gray',\n class: boxChrome.ghost.gray,\n },\n { chrome: 'inset', inputColor: 'brand', class: 'border-b-input' },\n { chrome: 'inset', inputColor: 'gray', class: 'border-b-input-gray' },\n // GHOST_UNDERLINE and boxChrome.ghost.* hardcode h-10; un-clamp for\n // textarea's min-height model — must come after those compounds above\n { chrome: 'inset', class: 'h-auto min-h-10' },\n { chrome: 'box', inputStyle: 'ghost', class: 'h-auto' },\n ],\n },\n)\n\nfunction floatingTextareaChrome(inputStyle: SparkInputStyle) {\n if (inputStyle === 'outlined')\n return 'border-0! px-3 pt-3 pb-3 focus-visible:outline-hidden!'\n return cn(\n 'pt-6 pb-2 field-unlabeled:pt-2',\n inputStyle === 'surface' && FLOATING_SURFACE_FOCUS,\n )\n}\n\ninterface TextareaProps extends React.ComponentProps<'textarea'> {\n variant?: TextareaVariant\n autoResize?: boolean\n}\n\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n function Textarea(\n {\n variant,\n autoResize = false,\n rows = 3,\n className,\n placeholder,\n id: idProp,\n 'aria-describedby': ariaDescribedByProp,\n ...props\n },\n ref,\n ) {\n const { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor } =\n useFieldControl({\n id: idProp,\n ariaDescribedBy: ariaDescribedByProp,\n variant: variant !== 'none' ? variant : undefined,\n })\n // an explicit variant prop keeps the box even inside an inset field\n const chrome =\n variant === 'none'\n ? 'none'\n : !variant && field?.labelPosition === 'inset'\n ? 'inset'\n : 'box'\n const floating = field?.labelPosition === 'floating'\n const floatingBox = floating && chrome === 'box'\n\n return (\n <textarea\n data-slot=\"textarea\"\n data-floating-control={floatingBox || undefined}\n className={cn(\n textareaVariants({ chrome, inputStyle, inputColor, autoResize }),\n floatingBox && floatingTextareaChrome(inputStyle),\n className,\n )}\n id={id}\n placeholder={\n placeholder ?? (floating ? FLOATING_PLACEHOLDER : undefined)\n }\n rows={rows}\n ref={ref}\n aria-invalid={ariaInvalid}\n {...props}\n aria-describedby={ariaDescribedBy}\n />\n )\n },\n)\n\nexport { Textarea }\nexport type { TextareaProps, TextareaVariant }\n"],"mappings":";;;;;;;;;;;AAcA,MAAM,oBAAA,GAAA,yBAAA,KACJ,oUACA;CACE,UAAU;EACR,QAAQ;GACN,MAAM;GACN,OAAOA,+BAAAA;GACP,KAAK;EACP;EACA,YAAY;GAAE,MAAM;GAAI,SAAS;GAAI,UAAU;GAAI,OAAO;EAAG;EAC7D,YAAY;GAAE,OAAO;GAAI,MAAM;EAAG;EAClC,YAAY;GACV,MAAM;GACN,OAAO;EACT;CACF;CACA,kBAAkB;EAChB;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAOC,+BAAAA,UAAU,KAAK;EACxB;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAOA,+BAAAA,UAAU,KAAK;EACxB;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAOA,+BAAAA,UAAU,QAAQ;EAC3B;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAOA,+BAAAA,UAAU,QAAQ;EAC3B;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAOA,+BAAAA,UAAU,SAAS;EAC5B;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAOA,+BAAAA,UAAU,SAAS;EAC5B;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAOA,+BAAAA,UAAU,MAAM;EACzB;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAOA,+BAAAA,UAAU,MAAM;EACzB;EACA;GAAE,QAAQ;GAAS,YAAY;GAAS,OAAO;EAAiB;EAChE;GAAE,QAAQ;GAAS,YAAY;GAAQ,OAAO;EAAsB;EAGpE;GAAE,QAAQ;GAAS,OAAO;EAAkB;EAC5C;GAAE,QAAQ;GAAO,YAAY;GAAS,OAAO;EAAS;CACxD;AACF,CACF;AAEA,SAAS,uBAAuB,YAA6B;CAC3D,IAAI,eAAe,YACjB,OAAO;CACT,QAAA,GAAA,GAAA,IACE,kCACA,eAAe,aAAA,sCACjB;AACF;AAOA,MAAM,WAAWC,MAAM,WACrB,SAAS,SACP,EACE,SACA,aAAa,OACb,OAAO,GACP,WACA,aACA,IAAI,QACJ,oBAAoB,qBACpB,GAAG,SAEL,KACA;CACA,MAAM,EAAE,OAAO,IAAI,iBAAiB,aAAa,YAAY,eAC3DC,yBAAAA,gBAAgB;EACd,IAAI;EACJ,iBAAiB;EACjB,SAAS,YAAY,SAAS,UAAU,KAAA;CAC1C,CAAC;CAEH,MAAM,SACJ,YAAY,SACR,SACA,CAAC,WAAW,OAAO,kBAAkB,UACnC,UACA;CACR,MAAM,WAAW,OAAO,kBAAkB;CAC1C,MAAM,cAAc,YAAY,WAAW;CAE3C,OACE,iBAAA,GAAA,kBAAA,KAAC,YAAD;EACE,aAAU;EACV,yBAAuB,eAAe,KAAA;EACtC,YAAA,GAAA,GAAA,IACE,iBAAiB;GAAE;GAAQ;GAAY;GAAY;EAAW,CAAC,GAC/D,eAAe,uBAAuB,UAAU,GAChD,SACF;EACI;EACJ,aACE,gBAAgB,WAAA,MAAkC,KAAA;EAE9C;EACD;EACL,gBAAc;EACd,GAAI;EACJ,oBAAkB;CACnB,CAAA;AAEL,CACF"}
1
+ {"version":3,"file":"textarea.cjs","names":["INSET_UNDERLINE","boxChrome","React","useFieldControl"],"sources":["../../src/components/textarea.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport {\n boxChrome,\n FLOATING_PLACEHOLDER,\n FLOATING_SURFACE_FOCUS,\n INSET_UNDERLINE,\n} from '../lib/input-box-variants'\nimport type { SparkInputStyle } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\nimport { useFieldControl } from './field'\n\ntype TextareaVariant = SparkInputStyle | 'none'\n\nconst textareaVariants = cva(\n 'flex w-full min-w-0 bg-transparent text-gray transition-[color,background-color,border-color] placeholder:text-gray-placeholder disabled:cursor-not-allowed disabled:text-gray-disabled disabled:placeholder:text-gray-disabled motion-reduce:transition-none',\n {\n variants: {\n chrome: {\n none: 'border-0 px-0 focus-visible:outline-hidden',\n inset: INSET_UNDERLINE,\n box: 'min-h-11 rounded-md px-3 py-2 text-base transition-[color,background-color,border-color] motion-reduce:transition-none',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n autoResize: {\n true: 'field-sizing-content resize-none',\n false: 'resize-y',\n },\n },\n compoundVariants: [\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'brand',\n class: boxChrome.soft.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'gray',\n class: boxChrome.soft.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'brand',\n class: boxChrome.surface.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'gray',\n class: boxChrome.surface.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class: boxChrome.outlined.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class: boxChrome.outlined.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'brand',\n class: boxChrome.ghost.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'gray',\n class: boxChrome.ghost.gray,\n },\n { chrome: 'inset', inputColor: 'brand', class: 'border-b-input' },\n { chrome: 'inset', inputColor: 'gray', class: 'border-b-input-gray' },\n // GHOST_UNDERLINE and boxChrome.ghost.* hardcode h-10; un-clamp for\n // textarea's min-height model — must come after those compounds above\n { chrome: 'inset', class: 'h-auto min-h-10' },\n { chrome: 'box', inputStyle: 'ghost', class: 'h-auto' },\n ],\n },\n)\n\nfunction floatingTextareaChrome(inputStyle: SparkInputStyle) {\n if (inputStyle === 'outlined')\n return 'border-0! px-3 pt-3 pb-3 focus-visible:outline-hidden!'\n return cn(\n 'pt-6 pb-2 field-unlabeled:pt-2',\n inputStyle === 'surface' && FLOATING_SURFACE_FOCUS,\n )\n}\n\ninterface TextareaProps extends React.ComponentProps<'textarea'> {\n variant?: TextareaVariant\n autoResize?: boolean\n}\n\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n function Textarea(\n {\n variant,\n autoResize = false,\n rows = 3,\n className,\n placeholder,\n id: idProp,\n 'aria-describedby': ariaDescribedByProp,\n ...props\n },\n ref,\n ) {\n const { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor } =\n useFieldControl({\n id: idProp,\n ariaDescribedBy: ariaDescribedByProp,\n variant: variant !== 'none' ? variant : undefined,\n })\n // an explicit variant prop keeps the box even inside an inset field\n const chrome =\n variant === 'none'\n ? 'none'\n : !variant && field?.labelPosition === 'inset'\n ? 'inset'\n : 'box'\n const floating = field?.labelPosition === 'floating'\n const floatingBox = floating && chrome === 'box'\n\n return (\n <textarea\n data-slot=\"textarea\"\n data-floating-control={floatingBox || undefined}\n className={cn(\n textareaVariants({ chrome, inputStyle, inputColor, autoResize }),\n floatingBox && floatingTextareaChrome(inputStyle),\n className,\n )}\n id={id}\n placeholder={\n placeholder ?? (floating ? FLOATING_PLACEHOLDER : undefined)\n }\n rows={rows}\n ref={ref}\n aria-invalid={ariaInvalid}\n {...props}\n aria-describedby={ariaDescribedBy}\n />\n )\n },\n)\n\nexport { Textarea }\nexport type { TextareaProps, TextareaVariant }\n"],"mappings":";;;;;;;;;;;AAcA,MAAM,oBAAA,GAAA,yBAAA,KACJ,iQACA;CACE,UAAU;EACR,QAAQ;GACN,MAAM;GACN,OAAOA,+BAAAA;GACP,KAAK;E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BAAoB,qBACpB,GAAG,SAEL,KACA;CACA,MAAM,EAAE,OAAO,IAAI,iBAAiB,aAAa,YAAY,eAC3DC,yBAAAA,gBAAgB;EACd,IAAI;EACJ,iBAAiB;EACjB,SAAS,YAAY,SAAS,UAAU,KAAA;CAC1C,CAAC;CAEH,MAAM,SACJ,YAAY,SACR,SACA,CAAC,WAAW,OAAO,kBAAkB,UACnC,UACA;CACR,MAAM,WAAW,OAAO,kBAAkB;CAC1C,MAAM,cAAc,YAAY,WAAW;CAE3C,OACE,iBAAA,GAAA,kBAAA,KAAC,YAAD;EACE,aAAU;EACV,yBAAuB,eAAe,KAAA;EACtC,YAAA,GAAA,GAAA,IACE,iBAAiB;GAAE;GAAQ;GAAY;GAAY;EAAW,CAAC,GAC/D,eAAe,uBAAuB,UAAU,GAChD,SACF;EACI;EACJ,aACE,gBAAgB,WAAA,MAAkC,KAAA;EAE9C;EACD;EACL,gBAAc;EACd,GAAI;EACJ,oBAAkB;CACnB,CAAA;AAEL,CACF"}
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import { cn } from "../utils/cn.js";
3
- import { INSET_UNDERLINE, boxChrome } from "../lib/input-box-variants.js";
4
3
  import { useFieldControl } from "./field.js";
4
+ import { INSET_UNDERLINE, boxChrome } from "../lib/input-box-variants.js";
5
5
  import * as React$1 from "react";
6
- import { cva } from "class-variance-authority";
7
6
  import { jsx } from "react/jsx-runtime";
7
+ import { cva } from "class-variance-authority";
8
8
  //#region src/components/textarea.tsx
9
- const textareaVariants = cva("flex w-full min-w-0 bg-transparent text-gray transition-[color,background-color,border-color] group-data-[invalid=true]/field:text-error placeholder:text-gray-placeholder disabled:cursor-not-allowed disabled:text-gray-disabled disabled:placeholder:text-gray-disabled aria-invalid:text-error motion-reduce:transition-none", {
9
+ const textareaVariants = cva("flex w-full min-w-0 bg-transparent text-gray transition-[color,background-color,border-color] placeholder:text-gray-placeholder disabled:cursor-not-allowed disabled:text-gray-disabled disabled:placeholder:text-gray-disabled motion-reduce:transition-none", {
10
10
  variants: {
11
11
  chrome: {
12
12
  none: "border-0 px-0 focus-visible:outline-hidden",
@@ -1 +1 @@
1
- {"version":3,"file":"textarea.js","names":["React"],"sources":["../../src/components/textarea.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport {\n boxChrome,\n FLOATING_PLACEHOLDER,\n FLOATING_SURFACE_FOCUS,\n INSET_UNDERLINE,\n} from '../lib/input-box-variants'\nimport type { SparkInputStyle } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\nimport { useFieldControl } from './field'\n\ntype TextareaVariant = SparkInputStyle | 'none'\n\nconst textareaVariants = cva(\n 'flex w-full min-w-0 bg-transparent text-gray transition-[color,background-color,border-color] group-data-[invalid=true]/field:text-error placeholder:text-gray-placeholder disabled:cursor-not-allowed disabled:text-gray-disabled disabled:placeholder:text-gray-disabled aria-invalid:text-error motion-reduce:transition-none',\n {\n variants: {\n chrome: {\n none: 'border-0 px-0 focus-visible:outline-hidden',\n inset: INSET_UNDERLINE,\n box: 'min-h-11 rounded-md px-3 py-2 text-base transition-[color,background-color,border-color] motion-reduce:transition-none',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n autoResize: {\n true: 'field-sizing-content resize-none',\n false: 'resize-y',\n },\n },\n compoundVariants: [\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'brand',\n class: boxChrome.soft.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'gray',\n class: boxChrome.soft.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'brand',\n class: boxChrome.surface.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'gray',\n class: boxChrome.surface.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class: boxChrome.outlined.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class: boxChrome.outlined.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'brand',\n class: boxChrome.ghost.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'gray',\n class: boxChrome.ghost.gray,\n },\n { chrome: 'inset', inputColor: 'brand', class: 'border-b-input' },\n { chrome: 'inset', inputColor: 'gray', class: 'border-b-input-gray' },\n // GHOST_UNDERLINE and boxChrome.ghost.* hardcode h-10; un-clamp for\n // textarea's min-height model — must come after those compounds above\n { chrome: 'inset', class: 'h-auto min-h-10' },\n { chrome: 'box', inputStyle: 'ghost', class: 'h-auto' },\n ],\n },\n)\n\nfunction floatingTextareaChrome(inputStyle: SparkInputStyle) {\n if (inputStyle === 'outlined')\n return 'border-0! px-3 pt-3 pb-3 focus-visible:outline-hidden!'\n return cn(\n 'pt-6 pb-2 field-unlabeled:pt-2',\n inputStyle === 'surface' && FLOATING_SURFACE_FOCUS,\n )\n}\n\ninterface TextareaProps extends React.ComponentProps<'textarea'> {\n variant?: TextareaVariant\n autoResize?: boolean\n}\n\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n function Textarea(\n {\n variant,\n autoResize = false,\n rows = 3,\n className,\n placeholder,\n id: idProp,\n 'aria-describedby': ariaDescribedByProp,\n ...props\n },\n ref,\n ) {\n const { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor } =\n useFieldControl({\n id: idProp,\n ariaDescribedBy: ariaDescribedByProp,\n variant: variant !== 'none' ? variant : undefined,\n })\n // an explicit variant prop keeps the box even inside an inset field\n const chrome =\n variant === 'none'\n ? 'none'\n : !variant && field?.labelPosition === 'inset'\n ? 'inset'\n : 'box'\n const floating = field?.labelPosition === 'floating'\n const floatingBox = floating && chrome === 'box'\n\n return (\n <textarea\n data-slot=\"textarea\"\n data-floating-control={floatingBox || undefined}\n className={cn(\n textareaVariants({ chrome, inputStyle, inputColor, autoResize }),\n floatingBox && floatingTextareaChrome(inputStyle),\n className,\n )}\n id={id}\n placeholder={\n placeholder ?? (floating ? FLOATING_PLACEHOLDER : undefined)\n }\n rows={rows}\n ref={ref}\n aria-invalid={ariaInvalid}\n {...props}\n aria-describedby={ariaDescribedBy}\n />\n )\n },\n)\n\nexport { Textarea }\nexport type { TextareaProps, TextareaVariant }\n"],"mappings":";;;;;;;;AAcA,MAAM,mBAAmB,IACvB,oUACA;CACE,UAAU;EACR,QAAQ;GACN,MAAM;GACN,OAAO;GACP,KAAK;EACP;EACA,YAAY;GAAE,MAAM;GAAI,SAAS;GAAI,UAAU;GAAI,OAAO;EAAG;EAC7D,YAAY;GAAE,OAAO;GAAI,MAAM;EAAG;EAClC,YAAY;GACV,MAAM;GACN,OAAO;EACT;CACF;CACA,kBAAkB;EAChB;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAO,UAAU,KAAK;EACxB;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAO,UAAU,KAAK;EACxB;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAO,UAAU,QAAQ;EAC3B;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAO,UAAU,QAAQ;EAC3B;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAO,UAAU,SAAS;EAC5B;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAO,UAAU,SAAS;EAC5B;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAO,UAAU,MAAM;EACzB;EACA;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAO,UAAU,MAAM;EACzB;EACA;GAAE,QAAQ;GAAS,YAAY;GAAS,OAAO;EAAiB;EAChE;GAAE,QAAQ;GAAS,YAAY;GAAQ,OAAO;EAAsB;EAGpE;GAAE,QAAQ;GAAS,OAAO;EAAkB;EAC5C;GAAE,QAAQ;GAAO,YAAY;GAAS,OAAO;EAAS;CACxD;AACF,CACF;AAEA,SAAS,uBAAuB,YAA6B;CAC3D,IAAI,eAAe,YACjB,OAAO;CACT,OAAO,GACL,kCACA,eAAe,aAAA,sCACjB;AACF;AAOA,MAAM,WAAWA,QAAM,WACrB,SAAS,SACP,EACE,SACA,aAAa,OACb,OAAO,GACP,WACA,aACA,IAAI,QACJ,oBAAoB,qBACpB,GAAG,SAEL,KACA;CACA,MAAM,EAAE,OAAO,IAAI,iBAAiB,aAAa,YAAY,eAC3D,gBAAgB;EACd,IAAI;EACJ,iBAAiB;EACjB,SAAS,YAAY,SAAS,UAAU,KAAA;CAC1C,CAAC;CAEH,MAAM,SACJ,YAAY,SACR,SACA,CAAC,WAAW,OAAO,kBAAkB,UACnC,UACA;CACR,MAAM,WAAW,OAAO,kBAAkB;CAC1C,MAAM,cAAc,YAAY,WAAW;CAE3C,OACE,oBAAC,YAAD;EACE,aAAU;EACV,yBAAuB,eAAe,KAAA;EACtC,WAAW,GACT,iBAAiB;GAAE;GAAQ;GAAY;GAAY;EAAW,CAAC,GAC/D,eAAe,uBAAuB,UAAU,GAChD,SACF;EACI;EACJ,aACE,gBAAgB,WAAA,MAAkC,KAAA;EAE9C;EACD;EACL,gBAAc;EACd,GAAI;EACJ,oBAAkB;CACnB,CAAA;AAEL,CACF"}
1
+ {"version":3,"file":"textarea.js","names":["React"],"sources":["../../src/components/textarea.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport {\n boxChrome,\n FLOATING_PLACEHOLDER,\n FLOATING_SURFACE_FOCUS,\n INSET_UNDERLINE,\n} from '../lib/input-box-variants'\nimport type { SparkInputStyle } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\nimport { useFieldControl } from './field'\n\ntype TextareaVariant = SparkInputStyle | 'none'\n\nconst textareaVariants = cva(\n 'flex w-full min-w-0 bg-transparent text-gray transition-[color,background-color,border-color] placeholder:text-gray-placeholder disabled:cursor-not-allowed disabled:text-gray-disabled disabled:placeholder:text-gray-disabled motion-reduce:transition-none',\n {\n variants: {\n chrome: {\n none: 'border-0 px-0 focus-visible:outline-hidden',\n inset: INSET_UNDERLINE,\n box: 'min-h-11 rounded-md px-3 py-2 text-base transition-[color,background-color,border-color] motion-reduce:transition-none',\n },\n inputStyle: { soft: '', surface: '', outlined: '', ghost: '' },\n inputColor: { brand: '', gray: '' },\n autoResize: {\n true: 'field-sizing-content resize-none',\n false: 'resize-y',\n },\n },\n compoundVariants: [\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'brand',\n class: boxChrome.soft.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'soft',\n inputColor: 'gray',\n class: boxChrome.soft.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'brand',\n class: boxChrome.surface.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'surface',\n inputColor: 'gray',\n class: boxChrome.surface.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'brand',\n class: boxChrome.outlined.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'outlined',\n inputColor: 'gray',\n class: boxChrome.outlined.gray,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'brand',\n class: boxChrome.ghost.brand,\n },\n {\n chrome: 'box',\n inputStyle: 'ghost',\n inputColor: 'gray',\n class: boxChrome.ghost.gray,\n },\n { chrome: 'inset', inputColor: 'brand', class: 'border-b-input' },\n { chrome: 'inset', inputColor: 'gray', class: 'border-b-input-gray' },\n // GHOST_UNDERLINE and boxChrome.ghost.* hardcode h-10; un-clamp for\n // textarea's min-height model — must come after those compounds above\n { chrome: 'inset', class: 'h-auto min-h-10' },\n { chrome: 'box', inputStyle: 'ghost', class: 'h-auto' },\n ],\n },\n)\n\nfunction floatingTextareaChrome(inputStyle: SparkInputStyle) {\n if (inputStyle === 'outlined')\n return 'border-0! px-3 pt-3 pb-3 focus-visible:outline-hidden!'\n return cn(\n 'pt-6 pb-2 field-unlabeled:pt-2',\n inputStyle === 'surface' && FLOATING_SURFACE_FOCUS,\n )\n}\n\ninterface TextareaProps extends React.ComponentProps<'textarea'> {\n variant?: TextareaVariant\n autoResize?: boolean\n}\n\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n function Textarea(\n {\n variant,\n autoResize = false,\n rows = 3,\n className,\n placeholder,\n id: idProp,\n 'aria-describedby': ariaDescribedByProp,\n ...props\n },\n ref,\n ) {\n const { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor } =\n useFieldControl({\n id: idProp,\n ariaDescribedBy: ariaDescribedByProp,\n variant: variant !== 'none' ? variant : undefined,\n })\n // an explicit variant prop keeps the box even inside an inset field\n const chrome =\n variant === 'none'\n ? 'none'\n : !variant && field?.labelPosition === 'inset'\n ? 'inset'\n : 'box'\n const floating = field?.labelPosition === 'floating'\n const floatingBox = floating && chrome === 'box'\n\n return (\n <textarea\n data-slot=\"textarea\"\n data-floating-control={floatingBox || undefined}\n className={cn(\n textareaVariants({ chrome, inputStyle, inputColor, autoResize }),\n floatingBox && floatingTextareaChrome(inputStyle),\n className,\n )}\n id={id}\n placeholder={\n placeholder ?? (floating ? FLOATING_PLACEHOLDER : undefined)\n }\n rows={rows}\n ref={ref}\n aria-invalid={ariaInvalid}\n {...props}\n aria-describedby={ariaDescribedBy}\n />\n )\n },\n)\n\nexport { Textarea }\nexport type { TextareaProps, TextareaVariant }\n"],"mappings":";;;;;;;;AAcA,MAAM,mBAAmB,IACvB,iQACA;CACE,UAAU;EACR,QAAQ;GACN,MAAM;GACN,OAAO;GACP,KAAK;EACP;EACA,YAAY;GAAE,MAAM;GAAI,SAAS;GAAI,UAAU;GAAI,OAAO;EAAG;EAC7D,YAAY;GAAE,OAAO;GAAI,MAAM;EAAG;EAClC,YAAY;GACV,MAAM;GACN,OAAO;EACT;CACF;CACA,kBAAkB;EAChB;GACE,QAAQ;GACR,YAAY;GACZ,YAAY;GACZ,OAAO,UAAU,KAAK;EACxB;EACA;GACE,QAAQ;GACR,YAAY;GAC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,KAAA;EACtC,WAAW,GACT,iBAAiB;GAAE;GAAQ;GAAY;GAAY;EAAW,CAAC,GAC/D,eAAe,uBAAuB,UAAU,GAChD,SACF;EACI;EACJ,aACE,gBAAgB,WAAA,MAAkC,KAAA;EAE9C;EACD;EACL,gBAAc;EACd,GAAI;EACJ,oBAAkB;CACnB,CAAA;AAEL,CACF"}
@@ -7,9 +7,9 @@ const require_lib_theme_types = require("../lib/theme-types.cjs");
7
7
  const require_lib_accent_theme = require("../lib/accent-theme.cjs");
8
8
  let react = require("react");
9
9
  react = require_chunk.__toESM(react);
10
+ let react_jsx_runtime = require("react/jsx-runtime");
10
11
  let _base_ui_react_merge_props = require("@base-ui/react/merge-props");
11
12
  let _base_ui_react_use_render = require("@base-ui/react/use-render");
12
- let react_jsx_runtime = require("react/jsx-runtime");
13
13
  let cn = require("cn");
14
14
  //#region src/components/theme.tsx
15
15
  /** The epilot brand accent — the scale `spark-default.css` ships statically. */
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  "use client";
3
+ import { cn } from "../utils/cn.js";
3
4
  import { useFocusModality } from "../hooks/use-focus-modality.js";
4
5
  import { isSparkNeutralFamily } from "../lib/theme-types.js";
5
6
  import { CURATED_ACCENTS, accentSparkVars, appearanceForBackground, generateAccentScale, getMatchingNeutral, invertAccentScale, isParsableColor, neutralFamilyVars, neutralSparkVars, resolveAutoNeutral } from "../lib/accent-theme.js";
6
- import { cn } from "../utils/cn.js";
7
7
  import * as React$1 from "react";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
9
  import { mergeProps } from "@base-ui/react/merge-props";
9
10
  import { useRender } from "@base-ui/react/use-render";
10
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
11
  //#region src/components/theme.tsx
12
12
  /** The epilot brand accent — the scale `spark-default.css` ships statically. */
13
13
  const DEFAULT_ACCENT = "#005EB4";
@@ -5,9 +5,9 @@ const require_chunk = require("../chunk-DY84GLCh.cjs");
5
5
  const require_components_theme = require("./theme.cjs");
6
6
  const require_components_button = require("./button.cjs");
7
7
  const require_components_spinner = require("./spinner.cjs");
8
+ let _epilot_spark_icons = require("@epilot/spark-icons");
8
9
  let react = require("react");
9
10
  react = require_chunk.__toESM(react);
10
- let _epilot_spark_icons = require("@epilot/spark-icons");
11
11
  let react_jsx_runtime = require("react/jsx-runtime");
12
12
  let _base_ui_react_toast = require("@base-ui/react/toast");
13
13
  let cn = require("cn");
@@ -15,7 +15,7 @@ let cn = require("cn");
15
15
  const TOAST_ICONS = {
16
16
  success: {
17
17
  icon: _epilot_spark_icons.CheckCircle,
18
- className: "text-success-light"
18
+ className: "text-success-soft-foreground"
19
19
  },
20
20
  info: {
21
21
  icon: _epilot_spark_icons.Info,
@@ -23,11 +23,11 @@ const TOAST_ICONS = {
23
23
  },
24
24
  warning: {
25
25
  icon: _epilot_spark_icons.Warning,
26
- className: "text-warning-light"
26
+ className: "text-warning-soft-foreground"
27
27
  },
28
28
  error: {
29
29
  icon: _epilot_spark_icons.Cancel,
30
- className: "text-error-light"
30
+ className: "text-error-soft-foreground"
31
31
  }
32
32
  };
33
33
  const TONE_CLASSES = {