@epilot/spark-ui 0.18.2 → 0.19.0

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 (109) hide show
  1. package/dist/components/accordion.cjs +2 -2
  2. package/dist/components/accordion.d.ts +1 -1
  3. package/dist/components/accordion.js +1 -1
  4. package/dist/components/alert-dialog.cjs +1 -1
  5. package/dist/components/alert-dialog.js +1 -1
  6. package/dist/components/attachment.d.cts +1 -1
  7. package/dist/components/attachment.d.ts +1 -1
  8. package/dist/components/autocomplete.cjs +1 -1
  9. package/dist/components/autocomplete.js +1 -1
  10. package/dist/components/bar-chart.cjs +1 -1
  11. package/dist/components/bar-chart.js +2 -2
  12. package/dist/components/battery-progress-row.cjs +1 -1
  13. package/dist/components/battery-progress-row.js +1 -1
  14. package/dist/components/button.d.cts +3 -3
  15. package/dist/components/button.d.ts +3 -3
  16. package/dist/components/calendar.cjs +3 -3
  17. package/dist/components/calendar.cjs.map +1 -1
  18. package/dist/components/calendar.js +3 -3
  19. package/dist/components/calendar.js.map +1 -1
  20. package/dist/components/callout.cjs +1 -1
  21. package/dist/components/callout.d.cts +1 -1
  22. package/dist/components/callout.d.ts +2 -2
  23. package/dist/components/callout.js +1 -1
  24. package/dist/components/device-card.d.ts +1 -1
  25. package/dist/components/dialog.cjs +1 -1
  26. package/dist/components/dialog.js +1 -1
  27. package/dist/components/dropdown-menu.cjs +1 -1
  28. package/dist/components/dropdown-menu.js +1 -1
  29. package/dist/components/empty-state.d.ts +1 -1
  30. package/dist/components/field.cjs +1 -1
  31. package/dist/components/field.cjs.map +1 -1
  32. package/dist/components/field.js +1 -1
  33. package/dist/components/field.js.map +1 -1
  34. package/dist/components/input-date.cjs +7 -7
  35. package/dist/components/input-date.cjs.map +1 -1
  36. package/dist/components/input-date.d.cts +2 -1
  37. package/dist/components/input-date.d.ts +2 -1
  38. package/dist/components/input-date.js +7 -7
  39. package/dist/components/input-date.js.map +1 -1
  40. package/dist/components/input-group.d.cts +1 -1
  41. package/dist/components/input-group.d.ts +1 -1
  42. package/dist/components/input-otp.cjs +2 -2
  43. package/dist/components/input-otp.cjs.map +1 -1
  44. package/dist/components/input-otp.js +2 -2
  45. package/dist/components/input-otp.js.map +1 -1
  46. package/dist/components/input.cjs +2 -2
  47. package/dist/components/input.cjs.map +1 -1
  48. package/dist/components/input.js +2 -2
  49. package/dist/components/input.js.map +1 -1
  50. package/dist/components/label.cjs +1 -1
  51. package/dist/components/label.cjs.map +1 -1
  52. package/dist/components/label.js +1 -1
  53. package/dist/components/label.js.map +1 -1
  54. package/dist/components/line-chart.cjs +3 -3
  55. package/dist/components/line-chart.js +4 -4
  56. package/dist/components/marker.d.cts +1 -1
  57. package/dist/components/marker.d.ts +1 -1
  58. package/dist/components/message-scroller.cjs +3 -3
  59. package/dist/components/message-scroller.js +3 -3
  60. package/dist/components/page-header.cjs +1 -1
  61. package/dist/components/page-header.d.cts +1 -1
  62. package/dist/components/page-header.d.ts +1 -1
  63. package/dist/components/page-header.js +1 -1
  64. package/dist/components/pill.cjs +1 -1
  65. package/dist/components/pill.js +1 -1
  66. package/dist/components/power-history-chart.cjs +3 -3
  67. package/dist/components/power-history-chart.js +4 -4
  68. package/dist/components/power-history.cjs +1 -1
  69. package/dist/components/power-history.js +1 -1
  70. package/dist/components/power-network.cjs +2 -2
  71. package/dist/components/power-network.js +2 -2
  72. package/dist/components/schedule-list.cjs +1 -1
  73. package/dist/components/schedule-list.js +1 -1
  74. package/dist/components/select.cjs +3 -3
  75. package/dist/components/select.cjs.map +1 -1
  76. package/dist/components/select.js +3 -3
  77. package/dist/components/select.js.map +1 -1
  78. package/dist/components/sheet.cjs +1 -1
  79. package/dist/components/sheet.js +1 -1
  80. package/dist/components/solar-forecast-chart.d.ts +1 -1
  81. package/dist/components/solar-forecast-chart.js +1 -1
  82. package/dist/components/stepper.cjs +1 -1
  83. package/dist/components/stepper.js +1 -1
  84. package/dist/components/table.cjs +147 -0
  85. package/dist/components/table.cjs.map +1 -0
  86. package/dist/components/table.d.cts +75 -0
  87. package/dist/components/table.d.ts +75 -0
  88. package/dist/components/table.js +138 -0
  89. package/dist/components/table.js.map +1 -0
  90. package/dist/components/tabs.cjs +1 -1
  91. package/dist/components/tabs.js +1 -1
  92. package/dist/components/textarea.cjs +2 -2
  93. package/dist/components/textarea.cjs.map +1 -1
  94. package/dist/components/textarea.js +2 -2
  95. package/dist/components/textarea.js.map +1 -1
  96. package/dist/components/toast.cjs +1 -1
  97. package/dist/components/toast.js +1 -1
  98. package/dist/components/tooltip.cjs +1 -1
  99. package/dist/components/tooltip.js +1 -1
  100. package/dist/lib/accent-theme.cjs +144 -9
  101. package/dist/lib/accent-theme.cjs.map +1 -1
  102. package/dist/lib/accent-theme.d.cts +37 -1
  103. package/dist/lib/accent-theme.d.ts +37 -1
  104. package/dist/lib/accent-theme.js +140 -10
  105. package/dist/lib/accent-theme.js.map +1 -1
  106. package/dist/styles/index.css +9 -0
  107. package/dist/styles/spark-default.css +38 -19
  108. package/dist/styles/theme.css +2 -2
  109. package/package.json +1 -1
@@ -0,0 +1,147 @@
1
+ "use client";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const require_chunk = require("../chunk-DY84GLCh.cjs");
4
+ const require_components_skeleton = require("./skeleton.cjs");
5
+ let react = require("react");
6
+ react = require_chunk.__toESM(react);
7
+ let _epilot_spark_icons = require("@epilot/spark-icons");
8
+ let react_jsx_runtime = require("react/jsx-runtime");
9
+ let cnfast = require("cnfast");
10
+ //#region src/components/table.tsx
11
+ const TableContext = react.createContext({
12
+ sort: null,
13
+ stickyHeader: false
14
+ });
15
+ const TableRowContext = react.createContext({ skeleton: false });
16
+ const rowHeight = "h-[calc(var(--spark-layout-gap)*10)]";
17
+ function nextSort(current, key) {
18
+ if (current?.key !== key) return {
19
+ key,
20
+ direction: "asc"
21
+ };
22
+ if (current.direction === "asc") return {
23
+ key,
24
+ direction: "desc"
25
+ };
26
+ return null;
27
+ }
28
+ function Table({ children, className, containerProps, onSortChange, sort = null, stickyHeader = false, ...props }) {
29
+ const { className: containerClassName, ...container } = containerProps ?? {};
30
+ const scrollRegion = container["aria-label"] != null;
31
+ const context = react.useMemo(() => ({
32
+ sort,
33
+ onSortChange,
34
+ stickyHeader
35
+ }), [
36
+ sort,
37
+ onSortChange,
38
+ stickyHeader
39
+ ]);
40
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
41
+ "data-slot": "table-container",
42
+ role: scrollRegion ? "region" : void 0,
43
+ tabIndex: scrollRegion ? 0 : void 0,
44
+ className: (0, cnfast.cn)("relative w-full overflow-x-auto", scrollRegion && "focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-focus", containerClassName),
45
+ ...container,
46
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("table", {
47
+ "data-slot": "table",
48
+ className: (0, cnfast.cn)("w-full border-separate border-spacing-0 text-sm text-gray-12", className),
49
+ ...props,
50
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableContext.Provider, {
51
+ value: context,
52
+ children
53
+ })
54
+ })
55
+ });
56
+ }
57
+ function TableHeader(props) {
58
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", {
59
+ "data-slot": "table-header",
60
+ ...props
61
+ });
62
+ }
63
+ function TableBody(props) {
64
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", {
65
+ "data-slot": "table-body",
66
+ ...props
67
+ });
68
+ }
69
+ function TableRow({ className, onClick, onKeyDown, selected, skeleton, ...props }) {
70
+ const interactive = !skeleton && onClick != null;
71
+ const rowContext = react.useMemo(() => ({ skeleton: skeleton ?? false }), [skeleton]);
72
+ const handleKeyDown = (event) => {
73
+ onKeyDown?.(event);
74
+ if (event.target !== event.currentTarget) return;
75
+ if (!interactive || event.defaultPrevented) return;
76
+ if (event.key !== "Enter" && event.key !== " ") return;
77
+ if (event.key === " ") event.preventDefault();
78
+ event.currentTarget.click();
79
+ };
80
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableRowContext.Provider, {
81
+ value: rowContext,
82
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", {
83
+ "data-slot": "table-row",
84
+ "data-selected": selected ? "" : void 0,
85
+ "aria-hidden": skeleton ? true : void 0,
86
+ tabIndex: interactive ? 0 : void 0,
87
+ onClick: interactive ? onClick : void 0,
88
+ onKeyDown: handleKeyDown,
89
+ className: (0, cnfast.cn)("[&:last-child>td]:border-b-0", selected && !skeleton && "bg-spark-a3", interactive && [
90
+ "cursor-pointer transition-colors duration-150 touch-target-table-row motion-reduce:transition-none",
91
+ "hover:bg-spark-a3 focus-visible:bg-spark-a3",
92
+ "focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-focus"
93
+ ], className),
94
+ ...props
95
+ })
96
+ });
97
+ }
98
+ function TableHead({ align = "start", children, className, sortKey, ...props }) {
99
+ const { onSortChange, sort, stickyHeader } = react.useContext(TableContext);
100
+ const direction = sortKey != null && sort?.key === sortKey ? sort.direction : void 0;
101
+ const Indicator = !direction ? _epilot_spark_icons.SwapVert : direction === "asc" ? _epilot_spark_icons.ArrowUpward : _epilot_spark_icons.ArrowDownward;
102
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
103
+ "data-slot": "table-head",
104
+ "aria-sort": sortKey == null ? void 0 : direction === "asc" ? "ascending" : direction === "desc" ? "descending" : "none",
105
+ className: (0, cnfast.cn)("border-b border-gray-a6 px-3 text-left align-middle text-xs font-medium text-gray-11", rowHeight, align === "end" && "text-right", stickyHeader && "sticky top-0 z-10 bg-gray-2", className),
106
+ ...props,
107
+ children: sortKey == null ? children : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
108
+ type: "button",
109
+ "data-slot": "table-head-sort",
110
+ onClick: () => onSortChange?.(nextSort(sort, sortKey)),
111
+ className: (0, cnfast.cn)("touch-target -mx-1 inline-flex min-h-[1.5rem] cursor-pointer items-center gap-1 rounded-sm px-1 py-0.5 text-left transition-colors [--spark-icon-size:1rem] hover:text-gray-12 motion-reduce:transition-none", "focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-focus", align === "end" && "flex-row-reverse"),
112
+ children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Indicator, { className: (0, cnfast.cn)(!direction && "text-gray-a9") })]
113
+ })
114
+ });
115
+ }
116
+ function TableCell({ align = "start", children, className, ...props }) {
117
+ const { skeleton } = react.useContext(TableRowContext);
118
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
119
+ "data-slot": "table-cell",
120
+ className: (0, cnfast.cn)("border-b border-gray-a6 px-3 align-middle", rowHeight, align === "end" && "text-right tabular-nums", className),
121
+ ...props,
122
+ children: skeleton ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_skeleton.Skeleton, { className: "h-4 w-2/3" }) : children
123
+ });
124
+ }
125
+ function TableStatus({ children, className, colSpan, ...props }) {
126
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", {
127
+ "data-slot": "table-status",
128
+ className,
129
+ ...props,
130
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
131
+ "data-slot": "table-status-cell",
132
+ colSpan,
133
+ className: "px-3 py-3 [&:not(:has(>*))]:py-6 [&:not(:has(>*))]:text-center",
134
+ children
135
+ })
136
+ });
137
+ }
138
+ //#endregion
139
+ exports.Table = Table;
140
+ exports.TableBody = TableBody;
141
+ exports.TableCell = TableCell;
142
+ exports.TableHead = TableHead;
143
+ exports.TableHeader = TableHeader;
144
+ exports.TableRow = TableRow;
145
+ exports.TableStatus = TableStatus;
146
+
147
+ //# sourceMappingURL=table.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.cjs","names":["React","SwapVert","ArrowUpward","ArrowDownward","Skeleton"],"sources":["../../src/components/table.tsx"],"sourcesContent":["import { ArrowDownward, ArrowUpward, SwapVert } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { Skeleton } from './skeleton'\n\ntype SortDirection = 'asc' | 'desc'\n\ninterface TableSort {\n key: string\n direction: SortDirection\n}\n\ninterface TableContextValue {\n sort: TableSort | null\n onSortChange?: (sort: TableSort | null) => void\n stickyHeader: boolean\n}\n\nconst TableContext = React.createContext<TableContextValue>({\n sort: null,\n stickyHeader: false,\n})\n\nconst TableRowContext = React.createContext<{ skeleton: boolean }>({\n skeleton: false,\n})\n\n// Reads --spark-layout-gap like the collection primitives, so a nested <Theme spacing>\n// re-resolves it against the nearest <Theme> scope (an [[data-spacing=…]_&] variant would\n// match any ancestor, not the nearest). height, not min-height, which is inert on table boxes.\nconst rowHeight = 'h-[calc(var(--spark-layout-gap)*10)]'\n\n// A column the table isn't sorted by starts at asc; the sorted one steps asc → desc → off.\nfunction nextSort(current: TableSort | null, key: string): TableSort | null {\n if (current?.key !== key) return { key, direction: 'asc' }\n if (current.direction === 'asc') return { key, direction: 'desc' }\n return null\n}\n\ninterface TableProps extends React.ComponentProps<'table'> {\n stickyHeader?: boolean\n /** Controlled only — the table never reorders rows; sort app-side and pass the result back. */\n sort?: TableSort | null\n onSortChange?: (sort: TableSort | null) => void\n /** Spread onto the scroll wrapper; an `aria-label` here also makes it a focusable region. */\n containerProps?: React.ComponentProps<'div'>\n}\n\nfunction Table({\n children,\n className,\n containerProps,\n onSortChange,\n sort = null,\n stickyHeader = false,\n ...props\n}: TableProps) {\n const { className: containerClassName, ...container } = containerProps ?? {}\n // A scrolling box only reaches the keyboard once it is focusable, and a focusable box\n // has to say what it holds (WCAG 2.1.1 / 4.1.2) — so the label is what turns it on.\n const scrollRegion = container['aria-label'] != null\n\n const context = React.useMemo(\n () => ({ sort, onSortChange, stickyHeader }),\n [sort, onSortChange, stickyHeader],\n )\n\n return (\n <div\n data-slot=\"table-container\"\n role={scrollRegion ? 'region' : undefined}\n tabIndex={scrollRegion ? 0 : undefined}\n className={cn(\n 'relative w-full overflow-x-auto',\n // inset outline, not a ring: ring-offset paints outside the box and this box clips.\n scrollRegion &&\n 'focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-focus',\n containerClassName,\n )}\n {...container}\n >\n <table\n data-slot=\"table\"\n className={cn(\n // border-separate, not collapse: under collapse Chromium drops the border of a\n // sticky <th>, so every rule lives on the cells instead.\n 'w-full border-separate border-spacing-0 text-sm text-gray-12',\n className,\n )}\n {...props}\n >\n <TableContext.Provider value={context}>\n {children}\n </TableContext.Provider>\n </table>\n </div>\n )\n}\n\nfunction TableHeader(props: React.ComponentProps<'thead'>) {\n return <thead data-slot=\"table-header\" {...props} />\n}\n\nfunction TableBody(props: React.ComponentProps<'tbody'>) {\n return <tbody data-slot=\"table-body\" {...props} />\n}\n\ninterface TableRowProps extends React.ComponentProps<'tr'> {\n selected?: boolean\n skeleton?: boolean\n}\n\nfunction TableRow({\n className,\n onClick,\n onKeyDown,\n selected,\n skeleton,\n ...props\n}: TableRowProps) {\n // A skeleton row is a decorative placeholder: never focusable, never clickable, even if\n // the caller passes a handler while the data loads (ListItem precedent).\n const interactive = !skeleton && onClick != null\n\n const rowContext = React.useMemo(\n () => ({ skeleton: skeleton ?? false }),\n [skeleton],\n )\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTableRowElement>) => {\n onKeyDown?.(event)\n // a key pressed inside a nested button, link or input belongs to that control\n if (event.target !== event.currentTarget) return\n if (!interactive || event.defaultPrevented) return\n if (event.key !== 'Enter' && event.key !== ' ') return\n // Space would scroll the page.\n if (event.key === ' ') event.preventDefault()\n event.currentTarget.click()\n }\n\n return (\n <TableRowContext.Provider value={rowContext}>\n <tr\n data-slot=\"table-row\"\n data-selected={selected ? '' : undefined}\n aria-hidden={skeleton ? true : undefined}\n tabIndex={interactive ? 0 : undefined}\n onClick={interactive ? onClick : undefined}\n onKeyDown={handleKeyDown}\n className={cn(\n '[&:last-child>td]:border-b-0',\n selected && !skeleton && 'bg-spark-a3',\n interactive && [\n 'cursor-pointer transition-colors duration-150 touch-target-table-row motion-reduce:transition-none',\n 'hover:bg-spark-a3 focus-visible:bg-spark-a3',\n // the inset recipe: a ring-offset would be clipped by the scroll container.\n 'focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-focus',\n ],\n className,\n )}\n {...props}\n />\n </TableRowContext.Provider>\n )\n}\n\n// `align` shadows the deprecated presentational HTML attribute of the same name, which\n// is why the native one is omitted rather than widened.\ninterface TableHeadProps extends Omit<React.ComponentProps<'th'>, 'align'> {\n /** Pair with the matching `TableCell align` so the column lines up. */\n align?: 'start' | 'end'\n /** Presence turns the header into a sort button with an indicator and `aria-sort`. */\n sortKey?: string\n}\n\nfunction TableHead({\n align = 'start',\n children,\n className,\n sortKey,\n ...props\n}: TableHeadProps) {\n const { onSortChange, sort, stickyHeader } = React.useContext(TableContext)\n const active = sortKey != null && sort?.key === sortKey\n const direction = active ? sort.direction : undefined\n const Indicator = !direction\n ? SwapVert\n : direction === 'asc'\n ? ArrowUpward\n : ArrowDownward\n\n return (\n <th\n data-slot=\"table-head\"\n aria-sort={\n sortKey == null\n ? undefined\n : direction === 'asc'\n ? 'ascending'\n : direction === 'desc'\n ? 'descending'\n : 'none'\n }\n className={cn(\n 'border-b border-gray-a6 px-3 text-left align-middle text-xs font-medium text-gray-11',\n rowHeight,\n align === 'end' && 'text-right',\n // opaque fill, so rows scrolling under a sticky header stay hidden; override via\n // className when the table sits on a non-default surface.\n stickyHeader && 'sticky top-0 z-10 bg-gray-2',\n className,\n )}\n {...props}\n >\n {sortKey == null ? (\n children\n ) : (\n // min-h is a HARD 24px floor (WCAG 2.5.8): unlike h-*, it must not shrink\n // with the scaling knob.\n <button\n type=\"button\"\n data-slot=\"table-head-sort\"\n onClick={() => onSortChange?.(nextSort(sort, sortKey))}\n className={cn(\n 'touch-target -mx-1 inline-flex min-h-[1.5rem] cursor-pointer items-center gap-1 rounded-sm px-1 py-0.5 text-left transition-colors [--spark-icon-size:1rem] hover:text-gray-12 motion-reduce:transition-none',\n // the inset recipe again: the first and the sticky header sit on the edge\n // the scroll container clips.\n 'focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-focus',\n // indicator inboard, so the digits keep a clean alignment edge\n align === 'end' && 'flex-row-reverse',\n )}\n >\n {children}\n <Indicator className={cn(!direction && 'text-gray-a9')} />\n </button>\n )}\n </th>\n )\n}\n\n// `align` shadows the deprecated presentational HTML attribute of the same name, which\n// is why the native one is omitted rather than widened.\ninterface TableCellProps extends Omit<React.ComponentProps<'td'>, 'align'> {\n align?: 'start' | 'end'\n}\n\nfunction TableCell({\n align = 'start',\n children,\n className,\n ...props\n}: TableCellProps) {\n const { skeleton } = React.useContext(TableRowContext)\n\n return (\n <td\n data-slot=\"table-cell\"\n className={cn(\n 'border-b border-gray-a6 px-3 align-middle',\n rowHeight,\n align === 'end' && 'text-right tabular-nums',\n className,\n )}\n {...props}\n >\n {skeleton ? <Skeleton className=\"h-4 w-2/3\" /> : children}\n </td>\n )\n}\n\ninterface TableStatusProps extends React.ComponentProps<'tr'> {\n colSpan: number\n}\n\nfunction TableStatus({\n children,\n className,\n colSpan,\n ...props\n}: TableStatusProps) {\n return (\n <tr data-slot=\"table-status\" className={className} {...props}>\n <td\n data-slot=\"table-status-cell\"\n colSpan={colSpan}\n // an element child (EmptyState, Callout) owns its own alignment and most of its\n // vertical rhythm; the cell only keeps it off the header rule. Bare text takes both.\n className=\"px-3 py-3 [&:not(:has(>*))]:py-6 [&:not(:has(>*))]:text-center\"\n >\n {children}\n </td>\n </tr>\n )\n}\n\nexport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n TableStatus,\n}\nexport type {\n SortDirection,\n TableCellProps,\n TableHeadProps,\n TableProps,\n TableRowProps,\n TableSort,\n TableStatusProps,\n}\n"],"mappings":"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"}
@@ -0,0 +1,75 @@
1
+ "use client";
2
+
3
+ import * as React$1 from "react";
4
+
5
+ //#region src/components/table.d.ts
6
+ type SortDirection = 'asc' | 'desc';
7
+ interface TableSort {
8
+ key: string;
9
+ direction: SortDirection;
10
+ }
11
+ interface TableProps extends React$1.ComponentProps<'table'> {
12
+ stickyHeader?: boolean;
13
+ /** Controlled only — the table never reorders rows; sort app-side and pass the result back. */
14
+ sort?: TableSort | null;
15
+ onSortChange?: (sort: TableSort | null) => void;
16
+ /** Spread onto the scroll wrapper; an `aria-label` here also makes it a focusable region. */
17
+ containerProps?: React$1.ComponentProps<'div'>;
18
+ }
19
+ declare function Table({
20
+ children,
21
+ className,
22
+ containerProps,
23
+ onSortChange,
24
+ sort,
25
+ stickyHeader,
26
+ ...props
27
+ }: TableProps): import("react/jsx-runtime").JSX.Element;
28
+ declare function TableHeader(props: React$1.ComponentProps<'thead'>): import("react/jsx-runtime").JSX.Element;
29
+ declare function TableBody(props: React$1.ComponentProps<'tbody'>): import("react/jsx-runtime").JSX.Element;
30
+ interface TableRowProps extends React$1.ComponentProps<'tr'> {
31
+ selected?: boolean;
32
+ skeleton?: boolean;
33
+ }
34
+ declare function TableRow({
35
+ className,
36
+ onClick,
37
+ onKeyDown,
38
+ selected,
39
+ skeleton,
40
+ ...props
41
+ }: TableRowProps): import("react/jsx-runtime").JSX.Element;
42
+ interface TableHeadProps extends Omit<React$1.ComponentProps<'th'>, 'align'> {
43
+ /** Pair with the matching `TableCell align` so the column lines up. */
44
+ align?: 'start' | 'end';
45
+ /** Presence turns the header into a sort button with an indicator and `aria-sort`. */
46
+ sortKey?: string;
47
+ }
48
+ declare function TableHead({
49
+ align,
50
+ children,
51
+ className,
52
+ sortKey,
53
+ ...props
54
+ }: TableHeadProps): import("react/jsx-runtime").JSX.Element;
55
+ interface TableCellProps extends Omit<React$1.ComponentProps<'td'>, 'align'> {
56
+ align?: 'start' | 'end';
57
+ }
58
+ declare function TableCell({
59
+ align,
60
+ children,
61
+ className,
62
+ ...props
63
+ }: TableCellProps): import("react/jsx-runtime").JSX.Element;
64
+ interface TableStatusProps extends React$1.ComponentProps<'tr'> {
65
+ colSpan: number;
66
+ }
67
+ declare function TableStatus({
68
+ children,
69
+ className,
70
+ colSpan,
71
+ ...props
72
+ }: TableStatusProps): import("react/jsx-runtime").JSX.Element;
73
+ //#endregion
74
+ export { type SortDirection, Table, TableBody, TableCell, type TableCellProps, TableHead, type TableHeadProps, TableHeader, type TableProps, TableRow, type TableRowProps, type TableSort, TableStatus, type TableStatusProps };
75
+ //# sourceMappingURL=table.d.cts.map
@@ -0,0 +1,75 @@
1
+ "use client";
2
+
3
+ import * as React$1 from "react";
4
+
5
+ //#region src/components/table.d.ts
6
+ type SortDirection = 'asc' | 'desc';
7
+ interface TableSort {
8
+ key: string;
9
+ direction: SortDirection;
10
+ }
11
+ interface TableProps extends React$1.ComponentProps<'table'> {
12
+ stickyHeader?: boolean;
13
+ /** Controlled only — the table never reorders rows; sort app-side and pass the result back. */
14
+ sort?: TableSort | null;
15
+ onSortChange?: (sort: TableSort | null) => void;
16
+ /** Spread onto the scroll wrapper; an `aria-label` here also makes it a focusable region. */
17
+ containerProps?: React$1.ComponentProps<'div'>;
18
+ }
19
+ declare function Table({
20
+ children,
21
+ className,
22
+ containerProps,
23
+ onSortChange,
24
+ sort,
25
+ stickyHeader,
26
+ ...props
27
+ }: TableProps): import("react/jsx-runtime").JSX.Element;
28
+ declare function TableHeader(props: React$1.ComponentProps<'thead'>): import("react/jsx-runtime").JSX.Element;
29
+ declare function TableBody(props: React$1.ComponentProps<'tbody'>): import("react/jsx-runtime").JSX.Element;
30
+ interface TableRowProps extends React$1.ComponentProps<'tr'> {
31
+ selected?: boolean;
32
+ skeleton?: boolean;
33
+ }
34
+ declare function TableRow({
35
+ className,
36
+ onClick,
37
+ onKeyDown,
38
+ selected,
39
+ skeleton,
40
+ ...props
41
+ }: TableRowProps): import("react/jsx-runtime").JSX.Element;
42
+ interface TableHeadProps extends Omit<React$1.ComponentProps<'th'>, 'align'> {
43
+ /** Pair with the matching `TableCell align` so the column lines up. */
44
+ align?: 'start' | 'end';
45
+ /** Presence turns the header into a sort button with an indicator and `aria-sort`. */
46
+ sortKey?: string;
47
+ }
48
+ declare function TableHead({
49
+ align,
50
+ children,
51
+ className,
52
+ sortKey,
53
+ ...props
54
+ }: TableHeadProps): import("react/jsx-runtime").JSX.Element;
55
+ interface TableCellProps extends Omit<React$1.ComponentProps<'td'>, 'align'> {
56
+ align?: 'start' | 'end';
57
+ }
58
+ declare function TableCell({
59
+ align,
60
+ children,
61
+ className,
62
+ ...props
63
+ }: TableCellProps): import("react/jsx-runtime").JSX.Element;
64
+ interface TableStatusProps extends React$1.ComponentProps<'tr'> {
65
+ colSpan: number;
66
+ }
67
+ declare function TableStatus({
68
+ children,
69
+ className,
70
+ colSpan,
71
+ ...props
72
+ }: TableStatusProps): import("react/jsx-runtime").JSX.Element;
73
+ //#endregion
74
+ export { type SortDirection, Table, TableBody, TableCell, type TableCellProps, TableHead, type TableHeadProps, TableHeader, type TableProps, TableRow, type TableRowProps, type TableSort, TableStatus, type TableStatusProps };
75
+ //# sourceMappingURL=table.d.ts.map
@@ -0,0 +1,138 @@
1
+ "use client";
2
+ import { cn } from "../utils/cn.js";
3
+ import { Skeleton } from "./skeleton.js";
4
+ import * as React$1 from "react";
5
+ import { ArrowDownward, ArrowUpward, SwapVert } from "@epilot/spark-icons";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/components/table.tsx
8
+ const TableContext = React$1.createContext({
9
+ sort: null,
10
+ stickyHeader: false
11
+ });
12
+ const TableRowContext = React$1.createContext({ skeleton: false });
13
+ const rowHeight = "h-[calc(var(--spark-layout-gap)*10)]";
14
+ function nextSort(current, key) {
15
+ if (current?.key !== key) return {
16
+ key,
17
+ direction: "asc"
18
+ };
19
+ if (current.direction === "asc") return {
20
+ key,
21
+ direction: "desc"
22
+ };
23
+ return null;
24
+ }
25
+ function Table({ children, className, containerProps, onSortChange, sort = null, stickyHeader = false, ...props }) {
26
+ const { className: containerClassName, ...container } = containerProps ?? {};
27
+ const scrollRegion = container["aria-label"] != null;
28
+ const context = React$1.useMemo(() => ({
29
+ sort,
30
+ onSortChange,
31
+ stickyHeader
32
+ }), [
33
+ sort,
34
+ onSortChange,
35
+ stickyHeader
36
+ ]);
37
+ return /* @__PURE__ */ jsx("div", {
38
+ "data-slot": "table-container",
39
+ role: scrollRegion ? "region" : void 0,
40
+ tabIndex: scrollRegion ? 0 : void 0,
41
+ className: cn("relative w-full overflow-x-auto", scrollRegion && "focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-focus", containerClassName),
42
+ ...container,
43
+ children: /* @__PURE__ */ jsx("table", {
44
+ "data-slot": "table",
45
+ className: cn("w-full border-separate border-spacing-0 text-sm text-gray-12", className),
46
+ ...props,
47
+ children: /* @__PURE__ */ jsx(TableContext.Provider, {
48
+ value: context,
49
+ children
50
+ })
51
+ })
52
+ });
53
+ }
54
+ function TableHeader(props) {
55
+ return /* @__PURE__ */ jsx("thead", {
56
+ "data-slot": "table-header",
57
+ ...props
58
+ });
59
+ }
60
+ function TableBody(props) {
61
+ return /* @__PURE__ */ jsx("tbody", {
62
+ "data-slot": "table-body",
63
+ ...props
64
+ });
65
+ }
66
+ function TableRow({ className, onClick, onKeyDown, selected, skeleton, ...props }) {
67
+ const interactive = !skeleton && onClick != null;
68
+ const rowContext = React$1.useMemo(() => ({ skeleton: skeleton ?? false }), [skeleton]);
69
+ const handleKeyDown = (event) => {
70
+ onKeyDown?.(event);
71
+ if (event.target !== event.currentTarget) return;
72
+ if (!interactive || event.defaultPrevented) return;
73
+ if (event.key !== "Enter" && event.key !== " ") return;
74
+ if (event.key === " ") event.preventDefault();
75
+ event.currentTarget.click();
76
+ };
77
+ return /* @__PURE__ */ jsx(TableRowContext.Provider, {
78
+ value: rowContext,
79
+ children: /* @__PURE__ */ jsx("tr", {
80
+ "data-slot": "table-row",
81
+ "data-selected": selected ? "" : void 0,
82
+ "aria-hidden": skeleton ? true : void 0,
83
+ tabIndex: interactive ? 0 : void 0,
84
+ onClick: interactive ? onClick : void 0,
85
+ onKeyDown: handleKeyDown,
86
+ className: cn("[&:last-child>td]:border-b-0", selected && !skeleton && "bg-spark-a3", interactive && [
87
+ "cursor-pointer transition-colors duration-150 touch-target-table-row motion-reduce:transition-none",
88
+ "hover:bg-spark-a3 focus-visible:bg-spark-a3",
89
+ "focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-focus"
90
+ ], className),
91
+ ...props
92
+ })
93
+ });
94
+ }
95
+ function TableHead({ align = "start", children, className, sortKey, ...props }) {
96
+ const { onSortChange, sort, stickyHeader } = React$1.useContext(TableContext);
97
+ const direction = sortKey != null && sort?.key === sortKey ? sort.direction : void 0;
98
+ const Indicator = !direction ? SwapVert : direction === "asc" ? ArrowUpward : ArrowDownward;
99
+ return /* @__PURE__ */ jsx("th", {
100
+ "data-slot": "table-head",
101
+ "aria-sort": sortKey == null ? void 0 : direction === "asc" ? "ascending" : direction === "desc" ? "descending" : "none",
102
+ className: cn("border-b border-gray-a6 px-3 text-left align-middle text-xs font-medium text-gray-11", rowHeight, align === "end" && "text-right", stickyHeader && "sticky top-0 z-10 bg-gray-2", className),
103
+ ...props,
104
+ children: sortKey == null ? children : /* @__PURE__ */ jsxs("button", {
105
+ type: "button",
106
+ "data-slot": "table-head-sort",
107
+ onClick: () => onSortChange?.(nextSort(sort, sortKey)),
108
+ className: cn("touch-target -mx-1 inline-flex min-h-[1.5rem] cursor-pointer items-center gap-1 rounded-sm px-1 py-0.5 text-left transition-colors [--spark-icon-size:1rem] hover:text-gray-12 motion-reduce:transition-none", "focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-focus", align === "end" && "flex-row-reverse"),
109
+ children: [children, /* @__PURE__ */ jsx(Indicator, { className: cn(!direction && "text-gray-a9") })]
110
+ })
111
+ });
112
+ }
113
+ function TableCell({ align = "start", children, className, ...props }) {
114
+ const { skeleton } = React$1.useContext(TableRowContext);
115
+ return /* @__PURE__ */ jsx("td", {
116
+ "data-slot": "table-cell",
117
+ className: cn("border-b border-gray-a6 px-3 align-middle", rowHeight, align === "end" && "text-right tabular-nums", className),
118
+ ...props,
119
+ children: skeleton ? /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-2/3" }) : children
120
+ });
121
+ }
122
+ function TableStatus({ children, className, colSpan, ...props }) {
123
+ return /* @__PURE__ */ jsx("tr", {
124
+ "data-slot": "table-status",
125
+ className,
126
+ ...props,
127
+ children: /* @__PURE__ */ jsx("td", {
128
+ "data-slot": "table-status-cell",
129
+ colSpan,
130
+ className: "px-3 py-3 [&:not(:has(>*))]:py-6 [&:not(:has(>*))]:text-center",
131
+ children
132
+ })
133
+ });
134
+ }
135
+ //#endregion
136
+ export { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, TableStatus };
137
+
138
+ //# sourceMappingURL=table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.js","names":["React"],"sources":["../../src/components/table.tsx"],"sourcesContent":["import { ArrowDownward, ArrowUpward, SwapVert } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { cn } from '../utils/cn'\nimport { Skeleton } from './skeleton'\n\ntype SortDirection = 'asc' | 'desc'\n\ninterface TableSort {\n key: string\n direction: SortDirection\n}\n\ninterface TableContextValue {\n sort: TableSort | null\n onSortChange?: (sort: TableSort | null) => void\n stickyHeader: boolean\n}\n\nconst TableContext = React.createContext<TableContextValue>({\n sort: null,\n stickyHeader: false,\n})\n\nconst TableRowContext = React.createContext<{ skeleton: boolean }>({\n skeleton: false,\n})\n\n// Reads --spark-layout-gap like the collection primitives, so a nested <Theme spacing>\n// re-resolves it against the nearest <Theme> scope (an [[data-spacing=…]_&] variant would\n// match any ancestor, not the nearest). height, not min-height, which is inert on table boxes.\nconst rowHeight = 'h-[calc(var(--spark-layout-gap)*10)]'\n\n// A column the table isn't sorted by starts at asc; the sorted one steps asc → desc → off.\nfunction nextSort(current: TableSort | null, key: string): TableSort | null {\n if (current?.key !== key) return { key, direction: 'asc' }\n if (current.direction === 'asc') return { key, direction: 'desc' }\n return null\n}\n\ninterface TableProps extends React.ComponentProps<'table'> {\n stickyHeader?: boolean\n /** Controlled only — the table never reorders rows; sort app-side and pass the result back. */\n sort?: TableSort | null\n onSortChange?: (sort: TableSort | null) => void\n /** Spread onto the scroll wrapper; an `aria-label` here also makes it a focusable region. */\n containerProps?: React.ComponentProps<'div'>\n}\n\nfunction Table({\n children,\n className,\n containerProps,\n onSortChange,\n sort = null,\n stickyHeader = false,\n ...props\n}: TableProps) {\n const { className: containerClassName, ...container } = containerProps ?? {}\n // A scrolling box only reaches the keyboard once it is focusable, and a focusable box\n // has to say what it holds (WCAG 2.1.1 / 4.1.2) — so the label is what turns it on.\n const scrollRegion = container['aria-label'] != null\n\n const context = React.useMemo(\n () => ({ sort, onSortChange, stickyHeader }),\n [sort, onSortChange, stickyHeader],\n )\n\n return (\n <div\n data-slot=\"table-container\"\n role={scrollRegion ? 'region' : undefined}\n tabIndex={scrollRegion ? 0 : undefined}\n className={cn(\n 'relative w-full overflow-x-auto',\n // inset outline, not a ring: ring-offset paints outside the box and this box clips.\n scrollRegion &&\n 'focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-focus',\n containerClassName,\n )}\n {...container}\n >\n <table\n data-slot=\"table\"\n className={cn(\n // border-separate, not collapse: under collapse Chromium drops the border of a\n // sticky <th>, so every rule lives on the cells instead.\n 'w-full border-separate border-spacing-0 text-sm text-gray-12',\n className,\n )}\n {...props}\n >\n <TableContext.Provider value={context}>\n {children}\n </TableContext.Provider>\n </table>\n </div>\n )\n}\n\nfunction TableHeader(props: React.ComponentProps<'thead'>) {\n return <thead data-slot=\"table-header\" {...props} />\n}\n\nfunction TableBody(props: React.ComponentProps<'tbody'>) {\n return <tbody data-slot=\"table-body\" {...props} />\n}\n\ninterface TableRowProps extends React.ComponentProps<'tr'> {\n selected?: boolean\n skeleton?: boolean\n}\n\nfunction TableRow({\n className,\n onClick,\n onKeyDown,\n selected,\n skeleton,\n ...props\n}: TableRowProps) {\n // A skeleton row is a decorative placeholder: never focusable, never clickable, even if\n // the caller passes a handler while the data loads (ListItem precedent).\n const interactive = !skeleton && onClick != null\n\n const rowContext = React.useMemo(\n () => ({ skeleton: skeleton ?? false }),\n [skeleton],\n )\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTableRowElement>) => {\n onKeyDown?.(event)\n // a key pressed inside a nested button, link or input belongs to that control\n if (event.target !== event.currentTarget) return\n if (!interactive || event.defaultPrevented) return\n if (event.key !== 'Enter' && event.key !== ' ') return\n // Space would scroll the page.\n if (event.key === ' ') event.preventDefault()\n event.currentTarget.click()\n }\n\n return (\n <TableRowContext.Provider value={rowContext}>\n <tr\n data-slot=\"table-row\"\n data-selected={selected ? '' : undefined}\n aria-hidden={skeleton ? true : undefined}\n tabIndex={interactive ? 0 : undefined}\n onClick={interactive ? onClick : undefined}\n onKeyDown={handleKeyDown}\n className={cn(\n '[&:last-child>td]:border-b-0',\n selected && !skeleton && 'bg-spark-a3',\n interactive && [\n 'cursor-pointer transition-colors duration-150 touch-target-table-row motion-reduce:transition-none',\n 'hover:bg-spark-a3 focus-visible:bg-spark-a3',\n // the inset recipe: a ring-offset would be clipped by the scroll container.\n 'focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-focus',\n ],\n className,\n )}\n {...props}\n />\n </TableRowContext.Provider>\n )\n}\n\n// `align` shadows the deprecated presentational HTML attribute of the same name, which\n// is why the native one is omitted rather than widened.\ninterface TableHeadProps extends Omit<React.ComponentProps<'th'>, 'align'> {\n /** Pair with the matching `TableCell align` so the column lines up. */\n align?: 'start' | 'end'\n /** Presence turns the header into a sort button with an indicator and `aria-sort`. */\n sortKey?: string\n}\n\nfunction TableHead({\n align = 'start',\n children,\n className,\n sortKey,\n ...props\n}: TableHeadProps) {\n const { onSortChange, sort, stickyHeader } = React.useContext(TableContext)\n const active = sortKey != null && sort?.key === sortKey\n const direction = active ? sort.direction : undefined\n const Indicator = !direction\n ? SwapVert\n : direction === 'asc'\n ? ArrowUpward\n : ArrowDownward\n\n return (\n <th\n data-slot=\"table-head\"\n aria-sort={\n sortKey == null\n ? undefined\n : direction === 'asc'\n ? 'ascending'\n : direction === 'desc'\n ? 'descending'\n : 'none'\n }\n className={cn(\n 'border-b border-gray-a6 px-3 text-left align-middle text-xs font-medium text-gray-11',\n rowHeight,\n align === 'end' && 'text-right',\n // opaque fill, so rows scrolling under a sticky header stay hidden; override via\n // className when the table sits on a non-default surface.\n stickyHeader && 'sticky top-0 z-10 bg-gray-2',\n className,\n )}\n {...props}\n >\n {sortKey == null ? (\n children\n ) : (\n // min-h is a HARD 24px floor (WCAG 2.5.8): unlike h-*, it must not shrink\n // with the scaling knob.\n <button\n type=\"button\"\n data-slot=\"table-head-sort\"\n onClick={() => onSortChange?.(nextSort(sort, sortKey))}\n className={cn(\n 'touch-target -mx-1 inline-flex min-h-[1.5rem] cursor-pointer items-center gap-1 rounded-sm px-1 py-0.5 text-left transition-colors [--spark-icon-size:1rem] hover:text-gray-12 motion-reduce:transition-none',\n // the inset recipe again: the first and the sticky header sit on the edge\n // the scroll container clips.\n 'focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-focus',\n // indicator inboard, so the digits keep a clean alignment edge\n align === 'end' && 'flex-row-reverse',\n )}\n >\n {children}\n <Indicator className={cn(!direction && 'text-gray-a9')} />\n </button>\n )}\n </th>\n )\n}\n\n// `align` shadows the deprecated presentational HTML attribute of the same name, which\n// is why the native one is omitted rather than widened.\ninterface TableCellProps extends Omit<React.ComponentProps<'td'>, 'align'> {\n align?: 'start' | 'end'\n}\n\nfunction TableCell({\n align = 'start',\n children,\n className,\n ...props\n}: TableCellProps) {\n const { skeleton } = React.useContext(TableRowContext)\n\n return (\n <td\n data-slot=\"table-cell\"\n className={cn(\n 'border-b border-gray-a6 px-3 align-middle',\n rowHeight,\n align === 'end' && 'text-right tabular-nums',\n className,\n )}\n {...props}\n >\n {skeleton ? <Skeleton className=\"h-4 w-2/3\" /> : children}\n </td>\n )\n}\n\ninterface TableStatusProps extends React.ComponentProps<'tr'> {\n colSpan: number\n}\n\nfunction TableStatus({\n children,\n className,\n colSpan,\n ...props\n}: TableStatusProps) {\n return (\n <tr data-slot=\"table-status\" className={className} {...props}>\n <td\n data-slot=\"table-status-cell\"\n colSpan={colSpan}\n // an element child (EmptyState, Callout) owns its own alignment and most of its\n // vertical rhythm; the cell only keeps it off the header rule. Bare text takes both.\n className=\"px-3 py-3 [&:not(:has(>*))]:py-6 [&:not(:has(>*))]:text-center\"\n >\n {children}\n </td>\n </tr>\n )\n}\n\nexport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n TableStatus,\n}\nexport type {\n SortDirection,\n TableCellProps,\n TableHeadProps,\n TableProps,\n TableRowProps,\n TableSort,\n TableStatusProps,\n}\n"],"mappings":";;;;;;;AAkBA,MAAM,eAAeA,QAAM,cAAiC;CAC1D,MAAM;CACN,cAAc;AAChB,CAAC;AAED,MAAM,kBAAkBA,QAAM,cAAqC,EACjE,UAAU,MACZ,CAAC;AAKD,MAAM,YAAY;AAGlB,SAAS,SAAS,SAA2B,KAA+B;CAC1E,IAAI,SAAS,QAAQ,KAAK,OAAO;EAAE;EAAK,WAAW;CAAM;CACzD,IAAI,QAAQ,cAAc,OAAO,OAAO;EAAE;EAAK,WAAW;CAAO;CACjE,OAAO;AACT;AAWA,SAAS,MAAM,EACb,UACA,WACA,gBACA,cACA,OAAO,MACP,eAAe,OACf,GAAG,SACU;CACb,MAAM,EAAE,WAAW,oBAAoB,GAAG,cAAc,kBAAkB,CAAC;CAG3E,MAAM,eAAe,UAAU,iBAAiB;CAEhD,MAAM,UAAUA,QAAM,eACb;EAAE;EAAM;EAAc;CAAa,IAC1C;EAAC;EAAM;EAAc;CAAY,CACnC;CAEA,OACE,oBAAC,OAAD;EACE,aAAU;EACV,MAAM,eAAe,WAAW,KAAA;EAChC,UAAU,eAAe,IAAI,KAAA;EAC7B,WAAW,GACT,mCAEA,gBACE,8FACF,kBACF;EACA,GAAI;YAEJ,oBAAC,SAAD;GACE,aAAU;GACV,WAAW,GAGT,gEACA,SACF;GACA,GAAI;aAEJ,oBAAC,aAAa,UAAd;IAAuB,OAAO;IAC3B;GACoB,CAAA;EAClB,CAAA;CACJ,CAAA;AAET;AAEA,SAAS,YAAY,OAAsC;CACzD,OAAO,oBAAC,SAAD;EAAO,aAAU;EAAe,GAAI;CAAQ,CAAA;AACrD;AAEA,SAAS,UAAU,OAAsC;CACvD,OAAO,oBAAC,SAAD;EAAO,aAAU;EAAa,GAAI;CAAQ,CAAA;AACnD;AAOA,SAAS,SAAS,EAChB,WACA,SACA,WACA,UACA,UACA,GAAG,SACa;CAGhB,MAAM,cAAc,CAAC,YAAY,WAAW;CAE5C,MAAM,aAAaA,QAAM,eAChB,EAAE,UAAU,YAAY,MAAM,IACrC,CAAC,QAAQ,CACX;CAEA,MAAM,iBAAiB,UAAoD;EACzE,YAAY,KAAK;EAEjB,IAAI,MAAM,WAAW,MAAM,eAAe;EAC1C,IAAI,CAAC,eAAe,MAAM,kBAAkB;EAC5C,IAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,KAAK;EAEhD,IAAI,MAAM,QAAQ,KAAK,MAAM,eAAe;EAC5C,MAAM,cAAc,MAAM;CAC5B;CAEA,OACE,oBAAC,gBAAgB,UAAjB;EAA0B,OAAO;YAC/B,oBAAC,MAAD;GACE,aAAU;GACV,iBAAe,WAAW,KAAK,KAAA;GAC/B,eAAa,WAAW,OAAO,KAAA;GAC/B,UAAU,cAAc,IAAI,KAAA;GAC5B,SAAS,cAAc,UAAU,KAAA;GACjC,WAAW;GACX,WAAW,GACT,gCACA,YAAY,CAAC,YAAY,eACzB,eAAe;IACb;IACA;IAEA;GACF,GACA,SACF;GACA,GAAI;EACL,CAAA;CACuB,CAAA;AAE9B;AAWA,SAAS,UAAU,EACjB,QAAQ,SACR,UACA,WACA,SACA,GAAG,SACc;CACjB,MAAM,EAAE,cAAc,MAAM,iBAAiBA,QAAM,WAAW,YAAY;CAE1E,MAAM,YADS,WAAW,QAAQ,MAAM,QAAQ,UACrB,KAAK,YAAY,KAAA;CAC5C,MAAM,YAAY,CAAC,YACf,WACA,cAAc,QACZ,cACA;CAEN,OACE,oBAAC,MAAD;EACE,aAAU;EACV,aACE,WAAW,OACP,KAAA,IACA,cAAc,QACZ,cACA,cAAc,SACZ,eACA;EAEV,WAAW,GACT,wFACA,WACA,UAAU,SAAS,cAGnB,gBAAgB,+BAChB,SACF;EACA,GAAI;YAEH,WAAW,OACV,WAIA,qBAAC,UAAD;GACE,MAAK;GACL,aAAU;GACV,eAAe,eAAe,SAAS,MAAM,OAAO,CAAC;GACrD,WAAW,GACT,gNAGA,8FAEA,UAAU,SAAS,kBACrB;aAXF,CAaG,UACD,oBAAC,WAAD,EAAW,WAAW,GAAG,CAAC,aAAa,cAAc,EAAI,CAAA,CACnD;;CAER,CAAA;AAER;AAQA,SAAS,UAAU,EACjB,QAAQ,SACR,UACA,WACA,GAAG,SACc;CACjB,MAAM,EAAE,aAAaA,QAAM,WAAW,eAAe;CAErD,OACE,oBAAC,MAAD;EACE,aAAU;EACV,WAAW,GACT,6CACA,WACA,UAAU,SAAS,2BACnB,SACF;EACA,GAAI;YAEH,WAAW,oBAAC,UAAD,EAAU,WAAU,YAAa,CAAA,IAAI;CAC/C,CAAA;AAER;AAMA,SAAS,YAAY,EACnB,UACA,WACA,SACA,GAAG,SACgB;CACnB,OACE,oBAAC,MAAD;EAAI,aAAU;EAA0B;EAAW,GAAI;YACrD,oBAAC,MAAD;GACE,aAAU;GACD;GAGT,WAAU;GAET;EACC,CAAA;CACF,CAAA;AAER"}
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_chunk = require("../chunk-DY84GLCh.cjs");
4
- let _epilot_spark_icons = require("@epilot/spark-icons");
5
4
  let react = require("react");
6
5
  react = require_chunk.__toESM(react);
6
+ let _epilot_spark_icons = require("@epilot/spark-icons");
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
8
  let _base_ui_react_tabs = require("@base-ui/react/tabs");
9
9
  let cnfast = require("cnfast");
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { cn } from "../utils/cn.js";
3
- import { ChevronLeft, ChevronRight } from "@epilot/spark-icons";
4
3
  import * as React$1 from "react";
4
+ import { ChevronLeft, ChevronRight } from "@epilot/spark-icons";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
7
7
  //#region src/components/tabs.tsx
@@ -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_components_field = require("./field.cjs");
5
4
  const require_lib_input_box_variants = require("../lib/input-box-variants.cjs");
5
+ const require_components_field = require("./field.cjs");
6
6
  let react = require("react");
7
7
  react = require_chunk.__toESM(react);
8
8
  let react_jsx_runtime = require("react/jsx-runtime");
9
9
  let class_variance_authority = require("class-variance-authority");
10
10
  let cnfast = require("cnfast");
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 outline-hidden transition-all group-data-[invalid=true]/field:text-error placeholder:text-gray-disabled disabled:cursor-not-allowed disabled: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 outline-hidden transition-all 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", {
13
13
  variants: {
14
14
  chrome: {
15
15
  none: "border-0 px-0",
@@ -1 +1 @@
1
- {"version":3,"file":"textarea.cjs","names":["GHOST_UNDERLINE","boxChrome","React","useFieldControl"],"sources":["../../src/components/textarea.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport { boxChrome, GHOST_UNDERLINE } 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 outline-hidden transition-all group-data-[invalid=true]/field:text-error placeholder:text-gray-disabled disabled:cursor-not-allowed disabled:text-gray-disabled aria-invalid:text-error motion-reduce:transition-none',\n {\n variants: {\n chrome: {\n none: 'border-0 px-0',\n inset: GHOST_UNDERLINE,\n box: 'min-h-11 rounded-md px-3 py-2 text-base transition-all 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\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 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\n return (\n <textarea\n data-slot=\"textarea\"\n className={cn(\n textareaVariants({ chrome, inputStyle, inputColor, autoResize }),\n className,\n )}\n id={id}\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":";;;;;;;;;;;AASA,MAAM,oBAAA,GAAA,yBAAA,KACJ,sQACA;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;AAOA,MAAM,WAAWC,MAAM,WACrB,SAAS,SACP,EACE,SACA,aAAa,OACb,OAAO,GACP,WACA,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;CASH,OACE,iBAAA,GAAA,kBAAA,KAAC,YAAD;EACE,aAAU;EACV,YAAA,GAAA,OAAA,IACE,iBAAiB;GAAE,QAVvB,YAAY,SACR,SACA,CAAC,WAAW,OAAO,kBAAkB,UACnC,UACA;GAMyB;GAAY;GAAY;EAAW,CAAC,GAC/D,SACF;EACI;EACE;EACD;EACL,gBAAc;EACd,GAAI;EACJ,oBAAkB;CACnB,CAAA;AAEL,CACF"}
1
+ {"version":3,"file":"textarea.cjs","names":["GHOST_UNDERLINE","boxChrome","React","useFieldControl"],"sources":["../../src/components/textarea.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport { boxChrome, GHOST_UNDERLINE } 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 outline-hidden transition-all 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',\n inset: GHOST_UNDERLINE,\n box: 'min-h-11 rounded-md px-3 py-2 text-base transition-all 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\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 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\n return (\n <textarea\n data-slot=\"textarea\"\n className={cn(\n textareaVariants({ chrome, inputStyle, inputColor, autoResize }),\n className,\n )}\n id={id}\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":";;;;;;;;;;;AASA,MAAM,oBAAA,GAAA,yBAAA,KACJ,iTACA;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;AAOA,MAAM,WAAWC,MAAM,WACrB,SAAS,SACP,EACE,SACA,aAAa,OACb,OAAO,GACP,WACA,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;CASH,OACE,iBAAA,GAAA,kBAAA,KAAC,YAAD;EACE,aAAU;EACV,YAAA,GAAA,OAAA,IACE,iBAAiB;GAAE,QAVvB,YAAY,SACR,SACA,CAAC,WAAW,OAAO,kBAAkB,UACnC,UACA;GAMyB;GAAY;GAAY;EAAW,CAAC,GAC/D,SACF;EACI;EACE;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 { useFieldControl } from "./field.js";
4
3
  import { GHOST_UNDERLINE, boxChrome } from "../lib/input-box-variants.js";
4
+ import { useFieldControl } from "./field.js";
5
5
  import * as React$1 from "react";
6
6
  import { jsx } from "react/jsx-runtime";
7
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 outline-hidden transition-all group-data-[invalid=true]/field:text-error placeholder:text-gray-disabled disabled:cursor-not-allowed disabled: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 outline-hidden transition-all 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", {
10
10
  variants: {
11
11
  chrome: {
12
12
  none: "border-0 px-0",
@@ -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 { boxChrome, GHOST_UNDERLINE } 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 outline-hidden transition-all group-data-[invalid=true]/field:text-error placeholder:text-gray-disabled disabled:cursor-not-allowed disabled:text-gray-disabled aria-invalid:text-error motion-reduce:transition-none',\n {\n variants: {\n chrome: {\n none: 'border-0 px-0',\n inset: GHOST_UNDERLINE,\n box: 'min-h-11 rounded-md px-3 py-2 text-base transition-all 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\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 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\n return (\n <textarea\n data-slot=\"textarea\"\n className={cn(\n textareaVariants({ chrome, inputStyle, inputColor, autoResize }),\n className,\n )}\n id={id}\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":";;;;;;;;AASA,MAAM,mBAAmB,IACvB,sQACA;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;AAOA,MAAM,WAAWA,QAAM,WACrB,SAAS,SACP,EACE,SACA,aAAa,OACb,OAAO,GACP,WACA,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;CASH,OACE,oBAAC,YAAD;EACE,aAAU;EACV,WAAW,GACT,iBAAiB;GAAE,QAVvB,YAAY,SACR,SACA,CAAC,WAAW,OAAO,kBAAkB,UACnC,UACA;GAMyB;GAAY;GAAY;EAAW,CAAC,GAC/D,SACF;EACI;EACE;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 { boxChrome, GHOST_UNDERLINE } 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 outline-hidden transition-all 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',\n inset: GHOST_UNDERLINE,\n box: 'min-h-11 rounded-md px-3 py-2 text-base transition-all 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\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 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\n return (\n <textarea\n data-slot=\"textarea\"\n className={cn(\n textareaVariants({ chrome, inputStyle, inputColor, autoResize }),\n className,\n )}\n id={id}\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":";;;;;;;;AASA,MAAM,mBAAmB,IACvB,iTACA;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;AAOA,MAAM,WAAWA,QAAM,WACrB,SAAS,SACP,EACE,SACA,aAAa,OACb,OAAO,GACP,WACA,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;CASH,OACE,oBAAC,YAAD;EACE,aAAU;EACV,WAAW,GACT,iBAAiB;GAAE,QAVvB,YAAY,SACR,SACA,CAAC,WAAW,OAAO,kBAAkB,UACnC,UACA;GAMyB;GAAY;GAAY;EAAW,CAAC,GAC/D,SACF;EACI;EACE;EACD;EACL,gBAAc;EACd,GAAI;EACJ,oBAAkB;CACnB,CAAA;AAEL,CACF"}
@@ -4,9 +4,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  const require_chunk = require("../chunk-DY84GLCh.cjs");
5
5
  const require_components_button = require("./button.cjs");
6
6
  const require_components_spinner = require("./spinner.cjs");
7
- let _epilot_spark_icons = require("@epilot/spark-icons");
8
7
  let react = require("react");
9
8
  react = require_chunk.__toESM(react);
9
+ let _epilot_spark_icons = require("@epilot/spark-icons");
10
10
  let react_jsx_runtime = require("react/jsx-runtime");
11
11
  let _base_ui_react_toast = require("@base-ui/react/toast");
12
12
  let cnfast = require("cnfast");