@neuronection/assistant-ui 0.2.0 → 0.3.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.
@@ -0,0 +1,54 @@
1
+ import { cn } from './chunk-BLJWR4ZV.js';
2
+ import * as React from 'react';
3
+ import { jsx, jsxs } from 'react/jsx-runtime';
4
+
5
+ var Table = React.forwardRef(
6
+ function Table2({ headers, rows, emptyText = "Nothing here yet", className, ...props }, ref) {
7
+ return /* @__PURE__ */ jsx(
8
+ "div",
9
+ {
10
+ ref,
11
+ "data-as": "table",
12
+ className: cn("overflow-x-auto", className),
13
+ ...props,
14
+ children: /* @__PURE__ */ jsxs("table", { className: "min-w-full divide-y divide-[var(--as-border)]", children: [
15
+ /* @__PURE__ */ jsx("thead", { className: "bg-[var(--as-muted)]", children: /* @__PURE__ */ jsx("tr", { children: headers.map((header, index) => /* @__PURE__ */ jsx(
16
+ "th",
17
+ {
18
+ scope: "col",
19
+ className: "px-4 py-2.5 text-left text-xs font-medium uppercase tracking-wider text-[var(--as-muted-fg)]",
20
+ children: header
21
+ },
22
+ index
23
+ )) }) }),
24
+ /* @__PURE__ */ jsx("tbody", { className: "divide-y divide-[color-mix(in_srgb,var(--as-border)_55%,transparent)] bg-[var(--as-surface-raised)]", children: rows.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx(
25
+ "td",
26
+ {
27
+ colSpan: headers.length,
28
+ className: "px-4 py-6 text-center text-sm text-[var(--as-muted-fg)]",
29
+ children: emptyText
30
+ }
31
+ ) }) : rows.map((row, rowIndex) => /* @__PURE__ */ jsx(
32
+ "tr",
33
+ {
34
+ className: "transition-colors hover:bg-[color-mix(in_srgb,var(--as-muted)_60%,transparent)]",
35
+ children: row.map((cell, cellIndex) => /* @__PURE__ */ jsx(
36
+ "td",
37
+ {
38
+ className: "whitespace-nowrap px-4 py-3 text-sm text-[var(--as-fg)]",
39
+ children: cell
40
+ },
41
+ cellIndex
42
+ ))
43
+ },
44
+ rowIndex
45
+ )) })
46
+ ] })
47
+ }
48
+ );
49
+ }
50
+ );
51
+
52
+ export { Table };
53
+ //# sourceMappingURL=chunk-5X3RYDPC.js.map
54
+ //# sourceMappingURL=chunk-5X3RYDPC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/table/Table.tsx"],"names":["Table"],"mappings":";;;;AASO,IAAM,KAAA,GAAc,KAAA,CAAA,UAAA;AAAA,EACzB,SAASA,MAAAA,CAAM,EAAE,OAAA,EAAS,IAAA,EAAM,SAAA,GAAY,kBAAA,EAAoB,SAAA,EAAW,GAAG,KAAA,EAAM,EAAG,GAAA,EAAK;AAC1F,IAAA,uBACE,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,SAAA,EAAQ,OAAA;AAAA,QACR,SAAA,EAAW,EAAA,CAAG,iBAAA,EAAmB,SAAS,CAAA;AAAA,QACzC,GAAG,KAAA;AAAA,QAEJ,QAAA,kBAAA,IAAA,CAAC,OAAA,EAAA,EAAM,SAAA,EAAU,+CAAA,EACf,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,OAAA,EAAA,EAAM,WAAU,sBAAA,EACf,QAAA,kBAAA,GAAA,CAAC,QACE,QAAA,EAAA,OAAA,CAAQ,GAAA,CAAI,CAAC,MAAA,EAAQ,KAAA,qBACpB,GAAA;AAAA,YAAC,IAAA;AAAA,YAAA;AAAA,cAEC,KAAA,EAAM,KAAA;AAAA,cACN,SAAA,EAAU,8FAAA;AAAA,cAET,QAAA,EAAA;AAAA,aAAA;AAAA,YAJI;AAAA,WAMR,GACH,CAAA,EACF,CAAA;AAAA,0BACA,GAAA,CAAC,WAAM,SAAA,EAAU,qGAAA,EACd,eAAK,MAAA,KAAW,CAAA,uBACd,IAAA,EAAA,EACC,QAAA,kBAAA,GAAA;AAAA,YAAC,IAAA;AAAA,YAAA;AAAA,cACC,SAAS,OAAA,CAAQ,MAAA;AAAA,cACjB,SAAA,EAAU,yDAAA;AAAA,cAET,QAAA,EAAA;AAAA;AAAA,aAEL,CAAA,GAEA,IAAA,CAAK,GAAA,CAAI,CAAC,KAAK,QAAA,qBACb,GAAA;AAAA,YAAC,IAAA;AAAA,YAAA;AAAA,cAEC,SAAA,EAAU,iFAAA;AAAA,cAET,QAAA,EAAA,GAAA,CAAI,GAAA,CAAI,CAAC,IAAA,EAAM,SAAA,qBACd,GAAA;AAAA,gBAAC,IAAA;AAAA,gBAAA;AAAA,kBAEC,SAAA,EAAU,yDAAA;AAAA,kBAET,QAAA,EAAA;AAAA,iBAAA;AAAA,gBAHI;AAAA,eAKR;AAAA,aAAA;AAAA,YAVI;AAAA,WAYR,CAAA,EAEL;AAAA,SAAA,EACF;AAAA;AAAA,KACF;AAAA,EAEJ;AACF","file":"chunk-5X3RYDPC.js","sourcesContent":["import * as React from 'react'\nimport { cn } from '../../lib/utils'\n\nexport interface TableProps extends React.ComponentProps<'div'> {\n headers: string[]\n rows: React.ReactNode[][]\n emptyText?: string\n}\n\nexport const Table = React.forwardRef<HTMLDivElement, TableProps>(\n function Table({ headers, rows, emptyText = 'Nothing here yet', className, ...props }, ref) {\n return (\n <div\n ref={ref}\n data-as=\"table\"\n className={cn('overflow-x-auto', className)}\n {...props}\n >\n <table className=\"min-w-full divide-y divide-[var(--as-border)]\">\n <thead className=\"bg-[var(--as-muted)]\">\n <tr>\n {headers.map((header, index) => (\n <th\n key={index}\n scope=\"col\"\n className=\"px-4 py-2.5 text-left text-xs font-medium uppercase tracking-wider text-[var(--as-muted-fg)]\"\n >\n {header}\n </th>\n ))}\n </tr>\n </thead>\n <tbody className=\"divide-y divide-[color-mix(in_srgb,var(--as-border)_55%,transparent)] bg-[var(--as-surface-raised)]\">\n {rows.length === 0 ? (\n <tr>\n <td\n colSpan={headers.length}\n className=\"px-4 py-6 text-center text-sm text-[var(--as-muted-fg)]\"\n >\n {emptyText}\n </td>\n </tr>\n ) : (\n rows.map((row, rowIndex) => (\n <tr\n key={rowIndex}\n className=\"transition-colors hover:bg-[color-mix(in_srgb,var(--as-muted)_60%,transparent)]\"\n >\n {row.map((cell, cellIndex) => (\n <td\n key={cellIndex}\n className=\"whitespace-nowrap px-4 py-3 text-sm text-[var(--as-fg)]\"\n >\n {cell}\n </td>\n ))}\n </tr>\n ))\n )}\n </tbody>\n </table>\n </div>\n )\n },\n)\n"]}
@@ -0,0 +1,124 @@
1
+ import { cn } from './chunk-BLJWR4ZV.js';
2
+ import * as React from 'react';
3
+ import { X } from 'lucide-react';
4
+ import { jsxs, jsx } from 'react/jsx-runtime';
5
+
6
+ function escapeRegex(value) {
7
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
8
+ }
9
+ var ChipInput = React.forwardRef(
10
+ function ChipInput2({
11
+ value,
12
+ onChange,
13
+ placeholder,
14
+ separators = [","],
15
+ inputLabel = "Add",
16
+ removeLabel = "Remove",
17
+ disabled = false,
18
+ className,
19
+ ...props
20
+ }, ref) {
21
+ const [draft, setDraft] = React.useState("");
22
+ const inputRef = React.useRef(null);
23
+ const commit = (raw) => {
24
+ const separatorPattern = new RegExp(
25
+ `[${separators.map(escapeRegex).join("")}\\n\\r]`
26
+ );
27
+ const existing = new Set(value.map((chip) => chip.toLowerCase()));
28
+ const next = [...value];
29
+ for (const part of raw.split(separatorPattern)) {
30
+ const trimmed = part.trim();
31
+ if (trimmed && !existing.has(trimmed.toLowerCase())) {
32
+ next.push(trimmed);
33
+ existing.add(trimmed.toLowerCase());
34
+ }
35
+ }
36
+ if (next.length !== value.length) {
37
+ onChange(next);
38
+ }
39
+ setDraft("");
40
+ };
41
+ const handleKeyDown = (event) => {
42
+ if (event.key === "Enter" || separators.includes(event.key)) {
43
+ event.preventDefault();
44
+ commit(draft);
45
+ } else if (event.key === "Backspace" && draft === "" && value.length > 0) {
46
+ event.preventDefault();
47
+ onChange(value.slice(0, -1));
48
+ }
49
+ };
50
+ const handlePaste = (event) => {
51
+ event.preventDefault();
52
+ const text = event.clipboardData.getData("text");
53
+ commit(`${draft}${text}`);
54
+ };
55
+ const removeAt = (index) => {
56
+ onChange(value.filter((_, i) => i !== index));
57
+ };
58
+ return /* @__PURE__ */ jsxs(
59
+ "div",
60
+ {
61
+ ref,
62
+ "data-as": "chip-input",
63
+ role: "group",
64
+ onClick: () => {
65
+ if (!disabled) inputRef.current?.focus();
66
+ },
67
+ className: cn(
68
+ "flex min-h-9 w-full cursor-text flex-wrap items-center gap-1.5 rounded-[var(--as-radius)] border border-[var(--as-border)] bg-[var(--as-surface)] px-2.5 py-1.5 text-sm outline-none transition-colors focus-within:border-[var(--as-focus-ring)] focus-within:ring-2 focus-within:ring-[var(--as-focus-ring)]",
69
+ disabled && "cursor-not-allowed opacity-50",
70
+ className
71
+ ),
72
+ ...props,
73
+ children: [
74
+ value.map((chip, index) => /* @__PURE__ */ jsxs(
75
+ "span",
76
+ {
77
+ className: "inline-flex items-center gap-1 rounded-[calc(var(--as-radius-sm)-2px)] bg-[color-mix(in_srgb,var(--as-primary)_12%,transparent)] py-0.5 pl-2.5 pr-1.5 text-xs font-medium text-[var(--as-primary)]",
78
+ children: [
79
+ chip,
80
+ /* @__PURE__ */ jsx(
81
+ "button",
82
+ {
83
+ type: "button",
84
+ disabled,
85
+ "aria-label": `${removeLabel} ${chip}`,
86
+ onClick: (event) => {
87
+ event.stopPropagation();
88
+ removeAt(index);
89
+ },
90
+ className: "cursor-pointer rounded-full opacity-70 transition-colors hover:text-[var(--as-danger)] hover:opacity-100 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--as-focus-ring)] disabled:pointer-events-none",
91
+ children: /* @__PURE__ */ jsx(X, { className: "size-3", "aria-hidden": true })
92
+ }
93
+ )
94
+ ]
95
+ },
96
+ `${chip}-${index}`
97
+ )),
98
+ /* @__PURE__ */ jsx(
99
+ "input",
100
+ {
101
+ ref: inputRef,
102
+ type: "text",
103
+ "aria-label": inputLabel,
104
+ disabled,
105
+ value: draft,
106
+ onChange: (event) => setDraft(event.target.value),
107
+ onKeyDown: handleKeyDown,
108
+ onPaste: handlePaste,
109
+ onBlur: () => {
110
+ if (draft.trim()) commit(draft);
111
+ },
112
+ placeholder: value.length === 0 ? placeholder : "",
113
+ className: "min-w-24 flex-1 bg-transparent text-sm text-[var(--as-fg)] outline-none placeholder:text-[var(--as-muted-fg)]"
114
+ }
115
+ )
116
+ ]
117
+ }
118
+ );
119
+ }
120
+ );
121
+
122
+ export { ChipInput };
123
+ //# sourceMappingURL=chunk-TPLQL62V.js.map
124
+ //# sourceMappingURL=chunk-TPLQL62V.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chip-input/ChipInput.tsx"],"names":["ChipInput"],"mappings":";;;;;AAeA,SAAS,YAAY,KAAA,EAAuB;AAC1C,EAAA,OAAO,KAAA,CAAM,OAAA,CAAQ,qBAAA,EAAuB,MAAM,CAAA;AACpD;AAEO,IAAM,SAAA,GAAkB,KAAA,CAAA,UAAA;AAAA,EAC7B,SAASA,UAAAA,CACP;AAAA,IACE,KAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA,UAAA,GAAa,CAAC,GAAG,CAAA;AAAA,IACjB,UAAA,GAAa,KAAA;AAAA,IACb,WAAA,GAAc,QAAA;AAAA,IACd,QAAA,GAAW,KAAA;AAAA,IACX,SAAA;AAAA,IACA,GAAG;AAAA,KAEL,GAAA,EACA;AACA,IAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAU,eAAS,EAAE,CAAA;AAC3C,IAAA,MAAM,QAAA,GAAiB,aAAyB,IAAI,CAAA;AAEpD,IAAA,MAAM,MAAA,GAAS,CAAC,GAAA,KAAgB;AAC9B,MAAA,MAAM,mBAAmB,IAAI,MAAA;AAAA,QAC3B,IAAI,UAAA,CAAW,GAAA,CAAI,WAAW,CAAA,CAAE,IAAA,CAAK,EAAE,CAAC,CAAA,OAAA;AAAA,OAC1C;AACA,MAAA,MAAM,QAAA,GAAW,IAAI,GAAA,CAAI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AAA,oBAEV,QAAA,kBAAA,GAAA,CAAC,CAAA,EAAA,EAAE,SAAA,EAAU,QAAA,EAAS,eAAW,IAAA,EAAC;AAAA;AAAA;AACpC;AAAA,aAAA;AAAA,YAfK,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,KAAK,CAAA;AAAA,WAiBxB,CAAA;AAAA,0BACD,GAAA;AAAA,YAAC,OAAA;AAAA,YAAA;AAAA,cACC,GAAA,EAAK,QAAA;AAAA,cACL,IAAA,EAAK,MAAA;AAAA,cACL,YAAA,EAAY,UAAA;AAAA,cACZ,QAAA;AAAA,cACA,KAAA,EAAO,KAAA;AAAA,cACP,UAAU,CAAC,KAAA,KAAU,QAAA,CAAS,KAAA,CAAM,OAAO,KAAK,CAAA;AAAA,cAChD,SAAA,EAAW,aAAA;AAAA,cACX,OAAA,EAAS,WAAA;AAAA,cACT,QAAQ,MAAM;AACZ,gBAAA,IAAI,KAAA,CAAM,IAAA,EAAK,EAAG,MAAA,CAAO,KAAK,CAAA;AAAA,cAChC,CAAA;AAAA,cACA,WAAA,EAAa,KAAA,CAAM,MAAA,KAAW,CAAA,GAAI,WAAA,GAAc,EAAA;AAAA,cAChD,SAAA,EAAU;AAAA;AAAA;AACZ;AAAA;AAAA,KACF;AAAA,EAEJ;AACF","file":"chunk-TPLQL62V.js","sourcesContent":["import * as React from 'react'\nimport { X } from 'lucide-react'\nimport { cn } from '../../lib/utils'\n\nexport interface ChipInputProps\n extends Omit<React.ComponentProps<'div'>, 'onChange'> {\n value: string[]\n onChange: (value: string[]) => void\n placeholder?: string\n separators?: string[]\n inputLabel?: string\n removeLabel?: string\n disabled?: boolean\n}\n\nfunction escapeRegex(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\nexport const ChipInput = React.forwardRef<HTMLDivElement, ChipInputProps>(\n function ChipInput(\n {\n value,\n onChange,\n placeholder,\n separators = [','],\n inputLabel = 'Add',\n removeLabel = 'Remove',\n disabled = false,\n className,\n ...props\n },\n ref,\n ) {\n const [draft, setDraft] = React.useState('')\n const inputRef = React.useRef<HTMLInputElement>(null)\n\n const commit = (raw: string) => {\n const separatorPattern = new RegExp(\n `[${separators.map(escapeRegex).join('')}\\\\n\\\\r]`,\n )\n const existing = new Set(value.map((chip) => chip.toLowerCase()))\n const next = [...value]\n for (const part of raw.split(separatorPattern)) {\n const trimmed = part.trim()\n if (trimmed && !existing.has(trimmed.toLowerCase())) {\n next.push(trimmed)\n existing.add(trimmed.toLowerCase())\n }\n }\n if (next.length !== value.length) {\n onChange(next)\n }\n setDraft('')\n }\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter' || separators.includes(event.key)) {\n event.preventDefault()\n commit(draft)\n } else if (event.key === 'Backspace' && draft === '' && value.length > 0) {\n event.preventDefault()\n onChange(value.slice(0, -1))\n }\n }\n\n const handlePaste = (event: React.ClipboardEvent<HTMLInputElement>) => {\n event.preventDefault()\n const text = event.clipboardData.getData('text')\n commit(`${draft}${text}`)\n }\n\n const removeAt = (index: number) => {\n onChange(value.filter((_, i) => i !== index))\n }\n\n return (\n <div\n ref={ref}\n data-as=\"chip-input\"\n role=\"group\"\n onClick={() => {\n if (!disabled) inputRef.current?.focus()\n }}\n className={cn(\n 'flex min-h-9 w-full cursor-text flex-wrap items-center gap-1.5 rounded-[var(--as-radius)] border border-[var(--as-border)] bg-[var(--as-surface)] px-2.5 py-1.5 text-sm outline-none transition-colors focus-within:border-[var(--as-focus-ring)] focus-within:ring-2 focus-within:ring-[var(--as-focus-ring)]',\n disabled && 'cursor-not-allowed opacity-50',\n className,\n )}\n {...props}\n >\n {value.map((chip, index) => (\n <span\n key={`${chip}-${index}`}\n className=\"inline-flex items-center gap-1 rounded-[calc(var(--as-radius-sm)-2px)] bg-[color-mix(in_srgb,var(--as-primary)_12%,transparent)] py-0.5 pl-2.5 pr-1.5 text-xs font-medium text-[var(--as-primary)]\"\n >\n {chip}\n <button\n type=\"button\"\n disabled={disabled}\n aria-label={`${removeLabel} ${chip}`}\n onClick={(event) => {\n event.stopPropagation()\n removeAt(index)\n }}\n className=\"cursor-pointer rounded-full opacity-70 transition-colors hover:text-[var(--as-danger)] hover:opacity-100 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--as-focus-ring)] disabled:pointer-events-none\"\n >\n <X className=\"size-3\" aria-hidden />\n </button>\n </span>\n ))}\n <input\n ref={inputRef}\n type=\"text\"\n aria-label={inputLabel}\n disabled={disabled}\n value={draft}\n onChange={(event) => setDraft(event.target.value)}\n onKeyDown={handleKeyDown}\n onPaste={handlePaste}\n onBlur={() => {\n if (draft.trim()) commit(draft)\n }}\n placeholder={value.length === 0 ? placeholder : ''}\n className=\"min-w-24 flex-1 bg-transparent text-sm text-[var(--as-fg)] outline-none placeholder:text-[var(--as-muted-fg)]\"\n />\n </div>\n )\n },\n)\n"]}
@@ -0,0 +1,110 @@
1
+ import { cn } from './chunk-BLJWR4ZV.js';
2
+ import * as React from 'react';
3
+ import { jsxs, jsx } from 'react/jsx-runtime';
4
+
5
+ function scaleColorForValue(min, max, value) {
6
+ if (value === "" || value === null || value === void 0) {
7
+ return "var(--as-muted-fg)";
8
+ }
9
+ const numeric = Number(value);
10
+ if (Number.isNaN(numeric)) return "var(--as-muted-fg)";
11
+ return positionColor((numeric - min) / (max - min));
12
+ }
13
+ function positionColor(position) {
14
+ const clamped = Math.max(0, Math.min(1, position));
15
+ const hue = 142 * (1 - clamped);
16
+ return `hsl(${hue.toFixed(0)}, 72%, 48%)`;
17
+ }
18
+ var ScaleSlider = React.forwardRef(
19
+ function ScaleSlider2({
20
+ value,
21
+ onChange,
22
+ min,
23
+ max,
24
+ step = 1,
25
+ lowLabel,
26
+ highLabel,
27
+ showInput = true,
28
+ disabled = false,
29
+ ariaLabel = "Scale",
30
+ className,
31
+ ...props
32
+ }, ref) {
33
+ const numericValue = value === "" || value === null || value === void 0 || Number.isNaN(value) ? null : Number(value);
34
+ const thumbColor = scaleColorForValue(min, max, value);
35
+ const sliderValue = numericValue === null ? min : numericValue;
36
+ const handleSlider = (event) => {
37
+ const numeric = Number(event.target.value);
38
+ onChange(Number.isNaN(numeric) ? "" : numeric);
39
+ };
40
+ const handleInputChange = (event) => {
41
+ const raw = event.target.value;
42
+ if (raw === "") {
43
+ onChange("");
44
+ return;
45
+ }
46
+ const numeric = Number(raw);
47
+ onChange(Number.isNaN(numeric) ? "" : numeric);
48
+ };
49
+ const handleInputBlur = () => {
50
+ if (numericValue === null) return;
51
+ const clamped = Math.max(min, Math.min(max, numericValue));
52
+ if (clamped !== numericValue) onChange(clamped);
53
+ };
54
+ const showLabels = Boolean(lowLabel || highLabel);
55
+ return /* @__PURE__ */ jsxs(
56
+ "div",
57
+ {
58
+ ref,
59
+ "data-as": "scale-slider",
60
+ className: cn("flex flex-col gap-1.5", className),
61
+ ...props,
62
+ children: [
63
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
64
+ /* @__PURE__ */ jsx(
65
+ "input",
66
+ {
67
+ type: "range",
68
+ "aria-label": ariaLabel,
69
+ className: cn(
70
+ "h-1.5 flex-1 cursor-pointer accent-[var(--as-primary)]",
71
+ disabled && "cursor-not-allowed opacity-50"
72
+ ),
73
+ min,
74
+ max,
75
+ step,
76
+ value: sliderValue,
77
+ disabled,
78
+ onChange: handleSlider
79
+ }
80
+ ),
81
+ showInput ? /* @__PURE__ */ jsx(
82
+ "input",
83
+ {
84
+ type: "number",
85
+ "aria-label": `${ariaLabel} value`,
86
+ min,
87
+ max,
88
+ step,
89
+ value: value ?? "",
90
+ disabled,
91
+ onChange: handleInputChange,
92
+ onBlur: handleInputBlur,
93
+ style: { borderColor: thumbColor },
94
+ className: "w-16 rounded-[var(--as-radius-sm)] border-2 bg-[var(--as-surface-raised)] px-2 py-1.5 text-center text-sm font-bold text-[var(--as-fg)] focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--as-focus-ring)] disabled:opacity-50"
95
+ }
96
+ ) : null
97
+ ] }),
98
+ showLabels ? /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-[9px] font-bold uppercase tracking-wider opacity-50", children: [
99
+ /* @__PURE__ */ jsx("span", { style: { color: positionColor(0) }, children: lowLabel }),
100
+ /* @__PURE__ */ jsx("span", { style: { color: positionColor(1) }, children: highLabel })
101
+ ] }) : null
102
+ ]
103
+ }
104
+ );
105
+ }
106
+ );
107
+
108
+ export { ScaleSlider, scaleColorForValue };
109
+ //# sourceMappingURL=chunk-UIUALJNR.js.map
110
+ //# sourceMappingURL=chunk-UIUALJNR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/scale-slider/ScaleSlider.tsx"],"names":["ScaleSlider"],"mappings":";;;;AAiBO,SAAS,kBAAA,CACd,GAAA,EACA,GAAA,EACA,KAAA,EACQ;AACR,EAAA,IAAI,KAAA,KAAU,EAAA,IAAM,KAAA,KAAU,IAAA,IAAQ,UAAU,MAAA,EAAW;AACzD,IAAA,OAAO,oBAAA;AAAA,EACT;AACA,EAAA,MAAM,OAAA,GAAU,OAAO,KAAK,CAAA;AAC5B,EAAA,IAAI,MAAA,CAAO,KAAA,CAAM,OAAO,CAAA,EAAG,OAAO,oBAAA;AAClC,EAAA,OAAO,aAAA,CAAA,CAAe,OAAA,GAAU,GAAA,KAAQ,GAAA,GAAM,GAAA,CAAI,CAAA;AACpD;AAEA,SAAS,cAAc,QAAA,EAA0B;AAC/C,EAAA,MAAM,OAAA,GAAU,KAAK,GAAA,CAAI,CAAA,EAAG,KAAK,GAAA,CAAI,CAAA,EAAG,QAAQ,CAAC,CAAA;AACjD,EAAA,MAAM,GAAA,GAAM,OAAO,CAAA,GAAI,OAAA,CAAA;AACvB,EAAA,OAAO,CAAA,IAAA,EAAO,GAAA,CAAI,OAAA,CAAQ,CAAC,CAAC,CAAA,WAAA,CAAA;AAC9B;AAEO,IAAM,WAAA,GAAoB,KAAA,CAAA,UAAA;AAAA,EAC/B,SAASA,YAAAA,CAC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A,gBACR,KAAA,EAAO,EAAE,WAAA,EAAa,UAAA,EAAW;AAAA,gBACjC,SAAA,EAAU;AAAA;AAAA,aACZ,GACE;AAAA,WAAA,EACN,CAAA;AAAA,UACC,UAAA,mBACC,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,+EAAA,EACb,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,MAAA,EAAA,EAAK,OAAO,EAAE,KAAA,EAAO,cAAc,CAAC,CAAA,IAAM,QAAA,EAAA,QAAA,EAAS,CAAA;AAAA,4BACpD,GAAA,CAAC,UAAK,KAAA,EAAO,EAAE,OAAO,aAAA,CAAc,CAAC,CAAA,EAAE,EAAI,QAAA,EAAA,SAAA,EAAU;AAAA,WAAA,EACvD,CAAA,GACE;AAAA;AAAA;AAAA,KACN;AAAA,EAEJ;AACF","file":"chunk-UIUALJNR.js","sourcesContent":["import * as React from 'react'\nimport { cn } from '../../lib/utils'\n\nexport interface ScaleSliderProps\n extends Omit<React.ComponentProps<'div'>, 'onChange'> {\n value: number | '' | null | undefined\n onChange: (value: number | '') => void\n min: number\n max: number\n step?: number\n lowLabel?: string\n highLabel?: string\n showInput?: boolean\n disabled?: boolean\n ariaLabel?: string\n}\n\nexport function scaleColorForValue(\n min: number,\n max: number,\n value: number | '' | null | undefined,\n): string {\n if (value === '' || value === null || value === undefined) {\n return 'var(--as-muted-fg)'\n }\n const numeric = Number(value)\n if (Number.isNaN(numeric)) return 'var(--as-muted-fg)'\n return positionColor((numeric - min) / (max - min))\n}\n\nfunction positionColor(position: number): string {\n const clamped = Math.max(0, Math.min(1, position))\n const hue = 142 * (1 - clamped)\n return `hsl(${hue.toFixed(0)}, 72%, 48%)`\n}\n\nexport const ScaleSlider = React.forwardRef<HTMLDivElement, ScaleSliderProps>(\n function ScaleSlider(\n {\n value,\n onChange,\n min,\n max,\n step = 1,\n lowLabel,\n highLabel,\n showInput = true,\n disabled = false,\n ariaLabel = 'Scale',\n className,\n ...props\n },\n ref,\n ) {\n const numericValue =\n value === '' ||\n value === null ||\n value === undefined ||\n Number.isNaN(value as number)\n ? null\n : Number(value)\n const thumbColor = scaleColorForValue(min, max, value)\n const sliderValue = numericValue === null ? min : numericValue\n\n const handleSlider = (event: React.ChangeEvent<HTMLInputElement>) => {\n const numeric = Number(event.target.value)\n onChange(Number.isNaN(numeric) ? '' : numeric)\n }\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const raw = event.target.value\n if (raw === '') {\n onChange('')\n return\n }\n const numeric = Number(raw)\n onChange(Number.isNaN(numeric) ? '' : numeric)\n }\n\n const handleInputBlur = () => {\n if (numericValue === null) return\n const clamped = Math.max(min, Math.min(max, numericValue))\n if (clamped !== numericValue) onChange(clamped)\n }\n\n const showLabels = Boolean(lowLabel || highLabel)\n\n return (\n <div\n ref={ref}\n data-as=\"scale-slider\"\n className={cn('flex flex-col gap-1.5', className)}\n {...props}\n >\n <div className=\"flex items-center gap-3\">\n <input\n type=\"range\"\n aria-label={ariaLabel}\n className={cn(\n 'h-1.5 flex-1 cursor-pointer accent-[var(--as-primary)]',\n disabled && 'cursor-not-allowed opacity-50',\n )}\n min={min}\n max={max}\n step={step}\n value={sliderValue}\n disabled={disabled}\n onChange={handleSlider}\n />\n {showInput ? (\n <input\n type=\"number\"\n aria-label={`${ariaLabel} value`}\n min={min}\n max={max}\n step={step}\n value={value ?? ''}\n disabled={disabled}\n onChange={handleInputChange}\n onBlur={handleInputBlur}\n style={{ borderColor: thumbColor }}\n className=\"w-16 rounded-[var(--as-radius-sm)] border-2 bg-[var(--as-surface-raised)] px-2 py-1.5 text-center text-sm font-bold text-[var(--as-fg)] focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--as-focus-ring)] disabled:opacity-50\"\n />\n ) : null}\n </div>\n {showLabels ? (\n <div className=\"flex justify-between text-[9px] font-bold uppercase tracking-wider opacity-50\">\n <span style={{ color: positionColor(0) }}>{lowLabel}</span>\n <span style={{ color: positionColor(1) }}>{highLabel}</span>\n </div>\n ) : null}\n </div>\n )\n },\n)\n"]}
@@ -0,0 +1,82 @@
1
+ import { cn } from './chunk-BLJWR4ZV.js';
2
+ import * as React from 'react';
3
+ import { X, ChevronRight } from 'lucide-react';
4
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
+
6
+ var chipTints = {
7
+ primary: "bg-[color-mix(in_srgb,var(--as-primary)_12%,transparent)] text-[var(--as-primary)]",
8
+ success: "bg-[color-mix(in_srgb,var(--as-success)_14%,transparent)] text-[var(--as-success)]",
9
+ warning: "bg-[color-mix(in_srgb,var(--as-warning)_18%,transparent)] text-[color-mix(in_srgb,var(--as-warning)_72%,var(--as-fg))]",
10
+ danger: "bg-[color-mix(in_srgb,var(--as-danger)_12%,transparent)] text-[var(--as-danger)]"
11
+ };
12
+ var ChipList = React.forwardRef(
13
+ function ChipList2({
14
+ items,
15
+ onRemove,
16
+ onItemClick,
17
+ variant = "neutral",
18
+ emptyText,
19
+ showChevron = false,
20
+ removeLabel = "Remove",
21
+ className,
22
+ ...props
23
+ }, ref) {
24
+ const cleaned = items.filter((item) => Boolean(item));
25
+ if (cleaned.length === 0) {
26
+ if (!emptyText) return null;
27
+ return /* @__PURE__ */ jsx("p", { className: cn("text-sm text-[var(--as-muted-fg)]", className), children: emptyText });
28
+ }
29
+ return /* @__PURE__ */ jsx(
30
+ "div",
31
+ {
32
+ ref,
33
+ "data-as": "chip-list",
34
+ className: cn("flex flex-wrap gap-1.5", className),
35
+ ...props,
36
+ children: cleaned.map((item, index) => {
37
+ const tint = variant === "neutral" ? "bg-[var(--as-secondary)] text-[var(--as-secondary-fg)]" : chipTints[variant];
38
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
39
+ item,
40
+ onItemClick && showChevron ? /* @__PURE__ */ jsx(ChevronRight, { className: "size-3 opacity-60", "aria-hidden": true }) : null
41
+ ] });
42
+ return /* @__PURE__ */ jsxs(
43
+ "span",
44
+ {
45
+ className: cn(
46
+ "inline-flex items-center gap-1 rounded-[calc(var(--as-radius-sm)-2px)] py-0.5 pl-2.5 pr-1.5 text-xs font-medium",
47
+ onItemClick && "cursor-pointer transition-[filter] hover:brightness-95 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--as-focus-ring)]",
48
+ tint
49
+ ),
50
+ children: [
51
+ onItemClick ? /* @__PURE__ */ jsx(
52
+ "button",
53
+ {
54
+ type: "button",
55
+ onClick: () => onItemClick(item, index),
56
+ className: "cursor-pointer bg-transparent p-0 text-inherit outline-none",
57
+ children: content
58
+ }
59
+ ) : content,
60
+ onRemove ? /* @__PURE__ */ jsx(
61
+ "button",
62
+ {
63
+ type: "button",
64
+ "aria-label": `${removeLabel} ${item}`,
65
+ onClick: () => onRemove(item),
66
+ className: "cursor-pointer opacity-70 transition-colors hover:text-[var(--as-danger)] hover:opacity-100 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--as-focus-ring)]",
67
+ children: /* @__PURE__ */ jsx(X, { className: "size-3", "aria-hidden": true })
68
+ }
69
+ ) : null
70
+ ]
71
+ },
72
+ `${item}-${index}`
73
+ );
74
+ })
75
+ }
76
+ );
77
+ }
78
+ );
79
+
80
+ export { ChipList };
81
+ //# sourceMappingURL=chunk-XLD2BPTT.js.map
82
+ //# sourceMappingURL=chunk-XLD2BPTT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chip-list/ChipList.tsx"],"names":["ChipList"],"mappings":";;;;;AAgBA,IAAM,SAAA,GAA6D;AAAA,EACjE,OAAA,EAAS,oFAAA;AAAA,EACT,OAAA,EACE,oFAAA;AAAA,EACF,OAAA,EACE,wHAAA;AAAA,EACF,MAAA,EAAQ;AACV,CAAA;AAEO,IAAM,QAAA,GAAiB,KAAA,CAAA,UAAA;AAAA,EAC5B,SAASA,SAAAA,CACP;AAAA,IACE,KAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAA,GAAU,SAAA;AAAA,IACV,SAAA;AAAA,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;AAAA,oBACC,IAAA,EAAK,QAAA;AAAA,oBACL,OAAA,EAAS,MAAM,WAAA,CAAY,IAAA,EAAM,KAAK,CAAA;AAAA,oBACtC,SAAA,EAAU,6DAAA;AAAA,oBAET,QAAA,EAAA;AAAA;AAAA,iBACH,GAEA,OAAA;AAAA,gBAED,QAAA,mBACC,GAAA;AAAA,kBAAC,QAAA;AAAA,kBAAA;AAAA,oBACC,IAAA,EAAK,QAAA;AAAA,oBACL,YAAA,EAAY,CAAA,EAAG,WAAW,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AAAA,oBAClC,OAAA,EAAS,MAAM,QAAA,CAAS,IAAI,CAAA;AAAA,oBAC5B,SAAA,EAAU,iMAAA;AAAA,oBAEV,QAAA,kBAAA,GAAA,CAAC,CAAA,EAAA,EAAE,SAAA,EAAU,QAAA,EAAS,eAAW,IAAA,EAAC;AAAA;AAAA,iBACpC,GACE;AAAA;AAAA,aAAA;AAAA,YA5BC,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,KAAK,CAAA;AAAA,WA6BvB;AAAA,QAEJ,CAAC;AAAA;AAAA,KACH;AAAA,EAEJ;AACF","file":"chunk-XLD2BPTT.js","sourcesContent":["import * as React from 'react'\nimport { ChevronRight, X } from 'lucide-react'\nimport { cn } from '../../lib/utils'\n\nexport type ChipVariant = 'neutral' | 'primary' | 'success' | 'warning' | 'danger'\n\nexport interface ChipListProps extends React.ComponentProps<'div'> {\n items: ReadonlyArray<string | null | undefined>\n onRemove?: (item: string) => void\n onItemClick?: (value: string, index: number) => void\n variant?: ChipVariant\n emptyText?: string\n showChevron?: boolean\n removeLabel?: string\n}\n\nconst chipTints: Record<Exclude<ChipVariant, 'neutral'>, string> = {\n primary: 'bg-[color-mix(in_srgb,var(--as-primary)_12%,transparent)] text-[var(--as-primary)]',\n success:\n 'bg-[color-mix(in_srgb,var(--as-success)_14%,transparent)] text-[var(--as-success)]',\n warning:\n 'bg-[color-mix(in_srgb,var(--as-warning)_18%,transparent)] text-[color-mix(in_srgb,var(--as-warning)_72%,var(--as-fg))]',\n danger: 'bg-[color-mix(in_srgb,var(--as-danger)_12%,transparent)] text-[var(--as-danger)]',\n}\n\nexport const ChipList = React.forwardRef<HTMLDivElement, ChipListProps>(\n function ChipList(\n {\n items,\n onRemove,\n onItemClick,\n variant = 'neutral',\n emptyText,\n showChevron = false,\n removeLabel = 'Remove',\n className,\n ...props\n },\n ref,\n ) {\n const cleaned = items.filter((item): item is string => Boolean(item))\n\n if (cleaned.length === 0) {\n if (!emptyText) return null\n return (\n <p className={cn('text-sm text-[var(--as-muted-fg)]', className)}>\n {emptyText}\n </p>\n )\n }\n\n return (\n <div\n ref={ref}\n data-as=\"chip-list\"\n className={cn('flex flex-wrap gap-1.5', className)}\n {...props}\n >\n {cleaned.map((item, index) => {\n const tint =\n variant === 'neutral'\n ? 'bg-[var(--as-secondary)] text-[var(--as-secondary-fg)]'\n : chipTints[variant]\n const content = (\n <>\n {item}\n {onItemClick && showChevron ? (\n <ChevronRight className=\"size-3 opacity-60\" aria-hidden />\n ) : null}\n </>\n )\n return (\n <span\n key={`${item}-${index}`}\n className={cn(\n 'inline-flex items-center gap-1 rounded-[calc(var(--as-radius-sm)-2px)] py-0.5 pl-2.5 pr-1.5 text-xs font-medium',\n onItemClick &&\n 'cursor-pointer transition-[filter] hover:brightness-95 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--as-focus-ring)]',\n tint,\n )}\n >\n {onItemClick ? (\n <button\n type=\"button\"\n onClick={() => onItemClick(item, index)}\n className=\"cursor-pointer bg-transparent p-0 text-inherit outline-none\"\n >\n {content}\n </button>\n ) : (\n content\n )}\n {onRemove ? (\n <button\n type=\"button\"\n aria-label={`${removeLabel} ${item}`}\n onClick={() => onRemove(item)}\n className=\"cursor-pointer opacity-70 transition-colors hover:text-[var(--as-danger)] hover:opacity-100 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--as-focus-ring)]\"\n >\n <X className=\"size-3\" aria-hidden />\n </button>\n ) : null}\n </span>\n )\n })}\n </div>\n )\n },\n)\n"]}
@@ -0,0 +1,26 @@
1
+ import * as React from 'react';
2
+
3
+ interface DatePickerProps {
4
+ value: string | null | undefined;
5
+ onChange: (value: string) => void;
6
+ onClear?: () => void;
7
+ allowClear?: boolean;
8
+ clearLabel?: string;
9
+ placeholder?: string;
10
+ displayFormat?: string;
11
+ minDate?: Date;
12
+ maxDate?: Date;
13
+ weekStartsOn?: 0 | 1;
14
+ disabled?: boolean;
15
+ required?: boolean;
16
+ id?: string;
17
+ name?: string;
18
+ label?: string;
19
+ prevLabel?: string;
20
+ nextLabel?: string;
21
+ className?: string;
22
+ panelClassName?: string;
23
+ }
24
+ declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLDivElement>>;
25
+
26
+ export { DatePicker, type DatePickerProps };
@@ -0,0 +1,3 @@
1
+ export { DatePicker } from './chunk-2KO2YIZN.js';
2
+ //# sourceMappingURL=date-picker.js.map
3
+ //# sourceMappingURL=date-picker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"date-picker.js"}
package/dist/index.d.ts CHANGED
@@ -7,9 +7,12 @@ export { Badge, BadgeProps, badgeVariants } from './badge.js';
7
7
  export { Button, ButtonProps, buttonVariants } from './button.js';
8
8
  export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './card.js';
9
9
  export { CheckIndicator, CheckIndicatorProps } from './check-indicator.js';
10
+ export { ChipInput, ChipInputProps } from './chip-input.js';
11
+ export { ChipList, ChipListProps, ChipVariant } from './chip-list.js';
10
12
  export { Combobox, ComboboxMulti, ComboboxMultiProps, ComboboxOption, ComboboxProps } from './combobox.js';
11
13
  export { ConfirmationModal, ConfirmationModalProps } from './confirmation-modal.js';
12
14
  export { ContextMenu, ContextMenuItem, ContextMenuProps } from './context-menu.js';
15
+ export { DatePicker, DatePickerProps } from './date-picker.js';
13
16
  export { EmptyState, EmptyStateProps } from './empty-state.js';
14
17
  export { ErrorBanner, ErrorBannerProps } from './error-banner.js';
15
18
  export { ExpandableSearch, ExpandableSearchProps } from './expandable-search.js';
@@ -20,11 +23,14 @@ export { Input, InputProps } from './input.js';
20
23
  export { MarqueeBand, MarqueePhase, MarqueeSelection, MarqueeSurface, MarqueeSurfaceProps, Rect, UseMarqueeOptions, hitTestIds, marqueeRect, rectsIntersect, useMarquee } from './marquee.js';
21
24
  export { ActionMenu, ActionMenuItem, ActionMenuProps, Menu, MenuContent, MenuGroup, MenuItem, MenuItemProps, MenuLabel, MenuSeparator, MenuTrigger } from './menu.js';
22
25
  export { Modal, ModalClose, ModalContent, ModalContentProps, ModalDescription, ModalFooter, ModalHeader, ModalTitle, ModalTrigger, modalContentVariants } from './modal.js';
23
- export { PopoverButton, PopoverButtonProps } from './popover-button.js';
24
26
  export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger } from './popover.js';
27
+ export { PopoverButton, PopoverButtonProps } from './popover-button.js';
28
+ export { RangeBar, RangeBarProps } from './range-bar.js';
29
+ export { ScaleSlider, ScaleSliderProps, scaleColorForValue } from './scale-slider.js';
25
30
  export { SearchInput, SearchInputProps } from './search-input.js';
26
31
  export { SelectionBar, SelectionBarProps } from './selection-bar.js';
27
32
  export { Spinner, SpinnerProps } from './spinner.js';
33
+ export { Table, TableProps } from './table.js';
28
34
  export { InfoTooltip, InfoTooltipProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './tooltip.js';
29
35
  export { UndoNotice, UndoNoticeProps } from './undo-notice.js';
30
36
  export { ViewToggle, ViewToggleProps, ViewToggleView } from './view-toggle.js';
package/dist/index.js CHANGED
@@ -1,32 +1,38 @@
1
- export { ThemeScope } from './chunk-TGU3PKNM.js';
2
1
  export { InfoTooltip, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './chunk-TJGX27YO.js';
3
2
  export { UndoNotice } from './chunk-OUHUVACM.js';
4
3
  export { ViewToggle } from './chunk-MXOBOS4Y.js';
5
4
  export { Stepper, Wizard } from './chunk-LEDQQBVV.js';
6
- export { MarqueeBand, MarqueeSurface, hitTestIds, marqueeRect, rectsIntersect, useMarquee } from './chunk-RU3DEF2O.js';
7
- export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger } from './chunk-CI56SSO2.js';
8
5
  export { Portal } from './chunk-7YLR4AGA.js';
6
+ export { RangeBar } from './chunk-5AVBKEDQ.js';
7
+ export { ScaleSlider, scaleColorForValue } from './chunk-UIUALJNR.js';
9
8
  export { SearchInput } from './chunk-H5U4KNXF.js';
10
9
  export { SelectionBar } from './chunk-HSUCCANX.js';
10
+ export { Table } from './chunk-5X3RYDPC.js';
11
+ export { ThemeScope } from './chunk-TGU3PKNM.js';
12
+ export { FormModal } from './chunk-GPIN2ITX.js';
13
+ export { Input } from './chunk-COPPAHR5.js';
14
+ export { MarqueeBand, MarqueeSurface, hitTestIds, marqueeRect, rectsIntersect, useMarquee } from './chunk-RU3DEF2O.js';
15
+ export { Combobox, ComboboxMulti } from './chunk-3522NABN.js';
16
+ export { ConfirmationModal } from './chunk-GA3XIDVX.js';
17
+ export { Modal, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalTitle, ModalTrigger, modalContentVariants } from './chunk-RHBQ3GZE.js';
11
18
  export { ContextMenu } from './chunk-WZSAUESL.js';
12
19
  export { ActionMenu, Menu, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuSeparator, MenuTrigger } from './chunk-KXLMTAZ5.js';
20
+ export { DatePicker } from './chunk-2KO2YIZN.js';
21
+ export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger } from './chunk-CI56SSO2.js';
13
22
  export { EmptyState } from './chunk-KDJLYKR6.js';
14
23
  export { ErrorBanner } from './chunk-BJOY3XL7.js';
15
24
  export { ExpandableSearch } from './chunk-4SW3ESVI.js';
16
25
  export { FieldLabel } from './chunk-ESUTPQDO.js';
17
- export { FormModal } from './chunk-GPIN2ITX.js';
18
26
  export { InfoButton } from './chunk-DV3MXDLN.js';
19
27
  export { PopoverButton } from './chunk-N5KQRHXU.js';
20
- export { Input } from './chunk-COPPAHR5.js';
21
28
  export { rawTokens, semanticTokens } from './chunk-3HFL3JGP.js';
22
29
  export { Badge, badgeVariants } from './chunk-SKTLC2XY.js';
23
- export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './chunk-HSWSYEFQ.js';
24
- export { CheckIndicator } from './chunk-XE4TFW63.js';
25
- export { Combobox, ComboboxMulti } from './chunk-3522NABN.js';
26
- export { ConfirmationModal } from './chunk-GA3XIDVX.js';
27
- export { Modal, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalTitle, ModalTrigger, modalContentVariants } from './chunk-RHBQ3GZE.js';
28
30
  export { Button, buttonVariants } from './chunk-GTXGTQ6F.js';
29
31
  export { Spinner } from './chunk-INTST5VG.js';
32
+ export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './chunk-HSWSYEFQ.js';
33
+ export { CheckIndicator } from './chunk-XE4TFW63.js';
34
+ export { ChipInput } from './chunk-TPLQL62V.js';
35
+ export { ChipList } from './chunk-XLD2BPTT.js';
30
36
  export { cn } from './chunk-BLJWR4ZV.js';
31
37
  //# sourceMappingURL=index.js.map
32
38
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+
3
+ interface RangeBarProps extends React.ComponentProps<'div'> {
4
+ low: number;
5
+ high: number;
6
+ min?: number;
7
+ max?: number;
8
+ value?: number | null;
9
+ unit?: string;
10
+ label?: string;
11
+ valueLabel?: string;
12
+ }
13
+ declare const RangeBar: React.ForwardRefExoticComponent<Omit<RangeBarProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
14
+
15
+ export { RangeBar, type RangeBarProps };
@@ -0,0 +1,3 @@
1
+ export { RangeBar } from './chunk-5AVBKEDQ.js';
2
+ //# sourceMappingURL=range-bar.js.map
3
+ //# sourceMappingURL=range-bar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"range-bar.js"}
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+
3
+ interface ScaleSliderProps extends Omit<React.ComponentProps<'div'>, 'onChange'> {
4
+ value: number | '' | null | undefined;
5
+ onChange: (value: number | '') => void;
6
+ min: number;
7
+ max: number;
8
+ step?: number;
9
+ lowLabel?: string;
10
+ highLabel?: string;
11
+ showInput?: boolean;
12
+ disabled?: boolean;
13
+ ariaLabel?: string;
14
+ }
15
+ declare function scaleColorForValue(min: number, max: number, value: number | '' | null | undefined): string;
16
+ declare const ScaleSlider: React.ForwardRefExoticComponent<Omit<ScaleSliderProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
17
+
18
+ export { ScaleSlider, type ScaleSliderProps, scaleColorForValue };
@@ -0,0 +1,3 @@
1
+ export { ScaleSlider, scaleColorForValue } from './chunk-UIUALJNR.js';
2
+ //# sourceMappingURL=scale-slider.js.map
3
+ //# sourceMappingURL=scale-slider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"scale-slider.js"}