@praxical/ui 0.0.0-stage → 0.11.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 (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +23 -2
  3. package/dist/activity-calendar.d.ts +13 -0
  4. package/dist/activity-calendar.js +7 -0
  5. package/dist/activity-heatmap.d.ts +14 -0
  6. package/dist/activity-heatmap.js +13 -0
  7. package/dist/chart-data.d.ts +9 -0
  8. package/dist/chart-data.js +9 -0
  9. package/dist/charts.d.ts +56 -0
  10. package/dist/charts.js +424 -0
  11. package/dist/chunk-7RMPDKZV.js +541 -0
  12. package/dist/chunk-7RTW3X7C.js +142 -0
  13. package/dist/chunk-EBF2F3LN.js +1523 -0
  14. package/dist/chunk-FCYIZANU.js +385 -0
  15. package/dist/chunk-HMO4VQZN.js +58 -0
  16. package/dist/chunk-II677WPC.js +177 -0
  17. package/dist/chunk-KZHUBPY6.js +102 -0
  18. package/dist/chunk-OLGZOPLD.js +166 -0
  19. package/dist/chunk-PDSV773E.js +52 -0
  20. package/dist/chunk-Q4ARHP76.js +457 -0
  21. package/dist/chunk-U5W7O3QV.js +22 -0
  22. package/dist/chunk-V6MXR4P2.js +275 -0
  23. package/dist/chunk-VZZDLRM5.js +152 -0
  24. package/dist/chunk-WEM2UQPR.js +110 -0
  25. package/dist/chunk-XFNDEA5M.js +104 -0
  26. package/dist/chunk-YKFAA7GU.js +72 -0
  27. package/dist/code-editor.css +76 -0
  28. package/dist/code-editor.d.ts +44 -0
  29. package/dist/code-editor.js +287 -0
  30. package/dist/code-value.d.ts +13 -0
  31. package/dist/code-value.js +10 -0
  32. package/dist/code.d.ts +36 -0
  33. package/dist/code.js +198 -0
  34. package/dist/collection.d.ts +21 -0
  35. package/dist/collection.js +48 -0
  36. package/dist/content.d.ts +42 -0
  37. package/dist/content.js +122 -0
  38. package/dist/display.d.ts +58 -0
  39. package/dist/display.js +27 -0
  40. package/dist/feedback.d.ts +34 -0
  41. package/dist/feedback.js +184 -0
  42. package/dist/file-tree.d.ts +17 -0
  43. package/dist/file-tree.js +11 -0
  44. package/dist/forms.d.ts +69 -0
  45. package/dist/forms.js +273 -0
  46. package/dist/git-graph.d.ts +8 -0
  47. package/dist/git-graph.js +15 -0
  48. package/dist/git-layout.d.ts +24 -0
  49. package/dist/git-layout.js +7 -0
  50. package/dist/image-viewer.d.ts +18 -0
  51. package/dist/image-viewer.js +11 -0
  52. package/dist/index.d.ts +363 -0
  53. package/dist/index.js +98 -0
  54. package/dist/inputs.d.ts +112 -0
  55. package/dist/inputs.js +938 -0
  56. package/dist/layout.d.ts +56 -0
  57. package/dist/layout.js +180 -0
  58. package/dist/map-frame.d.ts +37 -0
  59. package/dist/map-frame.js +13 -0
  60. package/dist/media.d.ts +40 -0
  61. package/dist/media.js +19 -0
  62. package/dist/network-layout.d.ts +94 -0
  63. package/dist/network-layout.js +19 -0
  64. package/dist/network.d.ts +111 -0
  65. package/dist/network.js +354 -0
  66. package/dist/overlays.d.ts +95 -0
  67. package/dist/overlays.js +25 -0
  68. package/dist/patterns.d.ts +117 -0
  69. package/dist/patterns.js +387 -0
  70. package/dist/power-layout.d.ts +91 -0
  71. package/dist/power-layout.js +13 -0
  72. package/dist/power.d.ts +91 -0
  73. package/dist/power.js +353 -0
  74. package/dist/signal-context.d.ts +11 -0
  75. package/dist/signal-context.js +15 -0
  76. package/dist/strings-es-419.d.ts +13 -0
  77. package/dist/strings-es-419.js +357 -0
  78. package/dist/strings-fr.d.ts +15 -0
  79. package/dist/strings-fr.js +359 -0
  80. package/dist/strings-ja.d.ts +16 -0
  81. package/dist/strings-ja.js +357 -0
  82. package/dist/strings-pt-BR.d.ts +13 -0
  83. package/dist/strings-pt-BR.js +357 -0
  84. package/dist/strings.d.ts +394 -0
  85. package/dist/strings.js +15 -0
  86. package/dist/styles.css +2 -0
  87. package/dist/tab-bar.d.ts +20 -0
  88. package/dist/tab-bar.js +114 -0
  89. package/package.json +199 -3
@@ -0,0 +1,1523 @@
1
+ 'use client';
2
+ import {
3
+ LocaleContext,
4
+ StringsContext,
5
+ useSignalLocale,
6
+ useSignalStrings
7
+ } from "./chunk-U5W7O3QV.js";
8
+ import {
9
+ mergeStrings
10
+ } from "./chunk-FCYIZANU.js";
11
+
12
+ // packages/ui/src/index.tsx
13
+ import {
14
+ createContext,
15
+ useContext,
16
+ useId as useId2,
17
+ useState as useState2,
18
+ useEffect as useEffect2,
19
+ useMemo,
20
+ useRef as useRef2,
21
+ forwardRef,
22
+ isValidElement,
23
+ cloneElement
24
+ } from "react";
25
+ import { Button as BaseButton } from "@base-ui/react/button";
26
+ import { Input as BaseInput } from "@base-ui/react/input";
27
+ import { Select as BaseSelect } from "@base-ui/react/select";
28
+ import { Checkbox as BaseCheckbox } from "@base-ui/react/checkbox";
29
+ import { Switch as BaseSwitch } from "@base-ui/react/switch";
30
+ import { Tabs as BaseTabs } from "@base-ui/react/tabs";
31
+ import { Dialog as BaseDialog } from "@base-ui/react/dialog";
32
+ import { Menu as BaseMenu } from "@base-ui/react/menu";
33
+ import { Tooltip as BaseTooltip } from "@base-ui/react/tooltip";
34
+ import { Collapsible } from "@base-ui/react/collapsible";
35
+ import { Autocomplete } from "@base-ui/react/autocomplete";
36
+ import { Popover as BasePopover } from "@base-ui/react/popover";
37
+ import { RadioGroup } from "@base-ui/react/radio-group";
38
+ import { Radio } from "@base-ui/react/radio";
39
+ import {
40
+ Check as Check2,
41
+ ChevronDown,
42
+ Search,
43
+ X,
44
+ Minus,
45
+ Monitor,
46
+ Sun,
47
+ Moon,
48
+ LayoutPanelTop,
49
+ Rows3,
50
+ ArrowDown,
51
+ ArrowUp,
52
+ ArrowUpDown,
53
+ MoreHorizontal,
54
+ SquareTerminal,
55
+ CaseSensitive,
56
+ Code2,
57
+ PanelTop
58
+ } from "lucide-react";
59
+
60
+ // packages/ui/src/code-value.tsx
61
+ import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
62
+ import { Check, CircleAlert, Copy } from "lucide-react";
63
+ import { jsx, jsxs } from "react/jsx-runtime";
64
+ var useCommitEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
65
+ function CodeValue({ value, label, onCopy, disabled = false, className }) {
66
+ if (/[\r\n\u2028\u2029]/u.test(value))
67
+ throw new Error("CodeValue requires a single line; use SyntaxCodeBlock for multiline text.");
68
+ const strings = useSignalStrings();
69
+ const statusId = useId();
70
+ const [feedback, setFeedback] = useState({ value, status: "idle" });
71
+ const revision = useRef(0), pending = useRef(false), mounted = useRef(false);
72
+ useCommitEffect(() => {
73
+ mounted.current = true;
74
+ revision.current += 1;
75
+ setFeedback({ value, status: pending.current ? "pending" : "idle" });
76
+ return () => {
77
+ mounted.current = false;
78
+ revision.current += 1;
79
+ };
80
+ }, [value]);
81
+ const status = feedback.value === value || feedback.status === "pending" ? feedback.status : "idle";
82
+ const message = status === "pending" ? strings.codeValue.copying(label) : status === "copied" ? strings.codeValue.copied(label) : status === "error" ? strings.codeValue.failed(label) : "";
83
+ async function copy() {
84
+ if (disabled || value.length === 0 || pending.current) return;
85
+ pending.current = true;
86
+ const started = revision.current;
87
+ setFeedback({ value, status: "pending" });
88
+ let result;
89
+ try {
90
+ if (onCopy) await onCopy(value);
91
+ else {
92
+ if (!navigator.clipboard?.writeText) throw new Error("Clipboard unavailable");
93
+ await navigator.clipboard.writeText(value);
94
+ }
95
+ result = "copied";
96
+ } catch {
97
+ result = "error";
98
+ } finally {
99
+ pending.current = false;
100
+ }
101
+ if (mounted.current) {
102
+ setFeedback((current) => ({ ...current, status: started === revision.current ? result : "idle" }));
103
+ }
104
+ }
105
+ return /* @__PURE__ */ jsxs("span", { className: ["signal-code-value", className].filter(Boolean).join(" "), "data-state": status, children: [
106
+ /* @__PURE__ */ jsx(
107
+ "input",
108
+ {
109
+ className: "signal-code-value-text",
110
+ type: "text",
111
+ value,
112
+ readOnly: true,
113
+ "aria-label": label,
114
+ placeholder: "\u2014",
115
+ spellCheck: false,
116
+ autoComplete: "off",
117
+ translate: "no"
118
+ }
119
+ ),
120
+ /* @__PURE__ */ jsx(
121
+ Button,
122
+ {
123
+ className: "signal-code-value-copy",
124
+ variant: "ghost",
125
+ iconOnly: true,
126
+ disabled: disabled || value.length === 0,
127
+ loading: status === "pending",
128
+ focusableWhenDisabled: true,
129
+ "aria-label": strings.codeValue.copy(label),
130
+ "aria-describedby": message ? statusId : void 0,
131
+ title: message || strings.codeValue.copy(label),
132
+ onClick: copy,
133
+ children: status === "copied" ? /* @__PURE__ */ jsx(Check, { "aria-hidden": "true" }) : status === "error" ? /* @__PURE__ */ jsx(CircleAlert, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(Copy, { "aria-hidden": "true" })
134
+ }
135
+ ),
136
+ /* @__PURE__ */ jsx("span", { id: statusId, className: "signal-sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: message })
137
+ ] });
138
+ }
139
+
140
+ // packages/ui/src/index.tsx
141
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
142
+ var defaults = {
143
+ appearance: "system",
144
+ palette: "sapphire",
145
+ density: "store",
146
+ corners: "core",
147
+ shell: "hybrid",
148
+ face: "sans"
149
+ };
150
+ var ThemeContext = createContext(defaults);
151
+ var classes = (...values) => values.filter(Boolean).join(" ");
152
+ function attributes(theme) {
153
+ return {
154
+ "data-signal-appearance": theme.appearance,
155
+ "data-signal-palette": theme.palette,
156
+ "data-signal-density": theme.density,
157
+ "data-signal-corners": theme.corners,
158
+ "data-signal-shell": theme.shell,
159
+ "data-signal-face": theme.face
160
+ };
161
+ }
162
+ function SignalProvider({
163
+ children,
164
+ scope = true,
165
+ appearance,
166
+ palette,
167
+ density,
168
+ corners,
169
+ shell,
170
+ face,
171
+ locale,
172
+ strings,
173
+ className,
174
+ style,
175
+ lang,
176
+ ...props
177
+ }) {
178
+ const parent = useContext(ThemeContext);
179
+ const parentLocale = useContext(LocaleContext);
180
+ const parentStrings = useContext(StringsContext);
181
+ const value = {
182
+ appearance: appearance ?? parent.appearance,
183
+ palette: palette ?? parent.palette,
184
+ density: density ?? parent.density,
185
+ corners: corners ?? parent.corners,
186
+ shell: shell ?? parent.shell,
187
+ face: face ?? parent.face
188
+ };
189
+ const tag = locale ?? parentLocale;
190
+ const table = useMemo(
191
+ () => strings ? mergeStrings(parentStrings, strings) : parentStrings,
192
+ [parentStrings, strings]
193
+ );
194
+ return /* @__PURE__ */ jsx2(ThemeContext.Provider, { value, children: /* @__PURE__ */ jsx2(LocaleContext.Provider, { value: tag, children: /* @__PURE__ */ jsx2(StringsContext.Provider, { value: table, children: scope ? /* @__PURE__ */ jsx2(
195
+ "div",
196
+ {
197
+ ...props,
198
+ ...attributes(value),
199
+ lang: lang ?? tag,
200
+ className: classes("signal", className),
201
+ style,
202
+ children
203
+ }
204
+ ) : children }) }) });
205
+ }
206
+ function ShellChrome({
207
+ as: Element = "div",
208
+ className,
209
+ children,
210
+ ...props
211
+ }) {
212
+ const parent = useContext(ThemeContext);
213
+ const theme = {
214
+ ...parent,
215
+ appearance: parent.shell === "hybrid" ? "dark" : parent.appearance
216
+ };
217
+ return /* @__PURE__ */ jsx2(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ jsx2(
218
+ Element,
219
+ {
220
+ ...props,
221
+ ...attributes(theme),
222
+ className: classes("signal", "signal-shell-chrome", className),
223
+ children
224
+ }
225
+ ) });
226
+ }
227
+ function PortalScope({ children }) {
228
+ return /* @__PURE__ */ jsx2(
229
+ "div",
230
+ {
231
+ className: "signal signal-portal",
232
+ lang: useContext(LocaleContext),
233
+ ...attributes(useContext(ThemeContext)),
234
+ children
235
+ }
236
+ );
237
+ }
238
+ var Button = forwardRef(
239
+ function Button2({
240
+ variant = "secondary",
241
+ loading = false,
242
+ iconOnly = false,
243
+ tooltip,
244
+ className,
245
+ children,
246
+ disabled,
247
+ ...props
248
+ }, ref) {
249
+ const content = /* @__PURE__ */ jsxs2(
250
+ BaseButton,
251
+ {
252
+ ...props,
253
+ ref,
254
+ type: props.nativeButton === false ? props.type : props.type ?? "button",
255
+ disabled: disabled || loading,
256
+ "aria-busy": loading || void 0,
257
+ "data-variant": variant,
258
+ "data-icon-only": iconOnly || void 0,
259
+ className: classes("signal-button", className),
260
+ children: [
261
+ /* @__PURE__ */ jsx2("span", { className: "signal-button-content", children }),
262
+ loading && /* @__PURE__ */ jsxs2("span", { className: "signal-busy", "aria-hidden": "true", children: [
263
+ /* @__PURE__ */ jsx2("i", {}),
264
+ /* @__PURE__ */ jsx2("i", {}),
265
+ /* @__PURE__ */ jsx2("i", {})
266
+ ] })
267
+ ]
268
+ }
269
+ );
270
+ const label = typeof tooltip === "string" ? tooltip : props["aria-label"];
271
+ return tooltip && label ? /* @__PURE__ */ jsx2(Tooltip, { content: label, children: content }) : content;
272
+ }
273
+ );
274
+ var Input = forwardRef(function Input2({ className, ...props }, ref) {
275
+ return /* @__PURE__ */ jsx2(
276
+ BaseInput,
277
+ {
278
+ ...props,
279
+ ref,
280
+ className: classes("signal-input", className)
281
+ }
282
+ );
283
+ });
284
+ function Textarea({
285
+ className,
286
+ autosize = false,
287
+ minRows = 3,
288
+ maxRows = 12,
289
+ onInput,
290
+ ...props
291
+ }) {
292
+ const fit = (el) => {
293
+ if (!autosize) return;
294
+ const line = parseFloat(getComputedStyle(el).lineHeight) || 20;
295
+ el.style.height = "auto";
296
+ const padding = el.offsetHeight - el.clientHeight;
297
+ el.style.height = `${Math.min(Math.max(el.scrollHeight, line * minRows + padding), line * maxRows + padding)}px`;
298
+ };
299
+ return /* @__PURE__ */ jsx2(
300
+ "textarea",
301
+ {
302
+ ...props,
303
+ ref: (el) => {
304
+ if (el) fit(el);
305
+ },
306
+ rows: props.rows ?? minRows,
307
+ onInput: (e) => {
308
+ fit(e.currentTarget);
309
+ onInput?.(e);
310
+ },
311
+ "data-autosize": autosize || void 0,
312
+ className: classes("signal-input signal-textarea", className)
313
+ }
314
+ );
315
+ }
316
+ function Field({
317
+ label,
318
+ hint,
319
+ error,
320
+ id,
321
+ children
322
+ }) {
323
+ const generated = useId2(), controlId = id ?? generated;
324
+ const control = {
325
+ id: controlId,
326
+ "aria-describedby": hint || error ? `${controlId}-help` : void 0,
327
+ "aria-invalid": error ? true : void 0
328
+ };
329
+ const labelled = isValidElement(children) && typeof children.type === "function" && children.type.signalLabelled === true;
330
+ return /* @__PURE__ */ jsxs2("div", { className: "signal-field", "data-labelled": labelled || void 0, children: [
331
+ !labelled && /* @__PURE__ */ jsx2("label", { htmlFor: controlId, children: label }),
332
+ typeof children === "function" ? children(control) : isValidElement(children) ? cloneElement(
333
+ children,
334
+ labelled ? { ...control, label } : control
335
+ ) : children,
336
+ (hint || error) && /* @__PURE__ */ jsx2(
337
+ "span",
338
+ {
339
+ id: `${controlId}-help`,
340
+ className: error ? "signal-error" : "signal-muted",
341
+ role: error ? "alert" : void 0,
342
+ children: error || hint
343
+ }
344
+ )
345
+ ] });
346
+ }
347
+ function groupOptions(options) {
348
+ const groups = /* @__PURE__ */ new Map();
349
+ for (const option of options) {
350
+ const list = groups.get(option.group) ?? [];
351
+ list.push(option);
352
+ groups.set(option.group, list);
353
+ }
354
+ return [...groups.entries()];
355
+ }
356
+ function Select({
357
+ label,
358
+ options,
359
+ placeholder,
360
+ invalid,
361
+ id,
362
+ "aria-describedby": description,
363
+ ...props
364
+ }) {
365
+ const strings = useSignalStrings();
366
+ return /* @__PURE__ */ jsxs2(BaseSelect.Root, { ...props, items: options, children: [
367
+ /* @__PURE__ */ jsxs2("div", { className: "signal-field", children: [
368
+ /* @__PURE__ */ jsx2(BaseSelect.Label, { className: "signal-control-label", children: label }),
369
+ /* @__PURE__ */ jsxs2(
370
+ BaseSelect.Trigger,
371
+ {
372
+ id,
373
+ "aria-describedby": description,
374
+ "aria-invalid": invalid || void 0,
375
+ className: "signal-select",
376
+ children: [
377
+ /* @__PURE__ */ jsx2(
378
+ BaseSelect.Value,
379
+ {
380
+ placeholder: options.find((option) => option.value === "")?.label ?? placeholder ?? strings.select.placeholder
381
+ }
382
+ ),
383
+ /* @__PURE__ */ jsx2(BaseSelect.Icon, { children: /* @__PURE__ */ jsx2(ChevronDown, { size: 14 }) })
384
+ ]
385
+ }
386
+ )
387
+ ] }),
388
+ /* @__PURE__ */ jsx2(BaseSelect.Portal, { children: /* @__PURE__ */ jsx2(PortalScope, { children: /* @__PURE__ */ jsx2(
389
+ BaseSelect.Positioner,
390
+ {
391
+ className: "signal-positioner",
392
+ sideOffset: 4,
393
+ alignItemWithTrigger: false,
394
+ children: /* @__PURE__ */ jsx2(BaseSelect.Popup, { className: "signal-popup", children: /* @__PURE__ */ jsx2(BaseSelect.List, { children: groupOptions(options).map(([group, members]) => {
395
+ const items = members.map((option) => /* @__PURE__ */ jsxs2(
396
+ BaseSelect.Item,
397
+ {
398
+ className: "signal-option",
399
+ value: option.value,
400
+ disabled: option.disabled,
401
+ children: [
402
+ /* @__PURE__ */ jsx2("span", { className: "signal-option-check", children: /* @__PURE__ */ jsx2(BaseSelect.ItemIndicator, { children: /* @__PURE__ */ jsx2(Check2, { size: 14 }) }) }),
403
+ option.icon,
404
+ /* @__PURE__ */ jsxs2("span", { className: "signal-option-text", children: [
405
+ /* @__PURE__ */ jsx2(BaseSelect.ItemText, { children: option.label }),
406
+ option.description && /* @__PURE__ */ jsx2("small", { children: option.description })
407
+ ] })
408
+ ]
409
+ },
410
+ option.value
411
+ ));
412
+ return group === void 0 ? items : /* @__PURE__ */ jsxs2(BaseSelect.Group, { className: "signal-option-group", children: [
413
+ /* @__PURE__ */ jsx2(BaseSelect.GroupLabel, { className: "signal-option-group-label", children: group }),
414
+ items
415
+ ] }, group);
416
+ }) }) })
417
+ }
418
+ ) }) })
419
+ ] });
420
+ }
421
+ function Checkbox({
422
+ label,
423
+ description,
424
+ indeterminate,
425
+ hideLabel = false,
426
+ ...props
427
+ }) {
428
+ return /* @__PURE__ */ jsxs2("label", { className: "signal-check-label", children: [
429
+ /* @__PURE__ */ jsx2(
430
+ BaseCheckbox.Root,
431
+ {
432
+ ...props,
433
+ indeterminate,
434
+ className: "signal-checkbox",
435
+ children: /* @__PURE__ */ jsx2(BaseCheckbox.Indicator, { children: indeterminate ? /* @__PURE__ */ jsx2(Minus, { size: 12 }) : /* @__PURE__ */ jsx2(
436
+ "svg",
437
+ {
438
+ className: "signal-checkmark",
439
+ width: "10",
440
+ height: "10",
441
+ viewBox: "0 0 12 12",
442
+ fill: "none",
443
+ "aria-hidden": "true",
444
+ children: /* @__PURE__ */ jsx2(
445
+ "path",
446
+ {
447
+ d: "M1.5 5.5 4.5 8.5 10.5 2.5",
448
+ stroke: "currentColor",
449
+ strokeWidth: "2",
450
+ strokeLinecap: "square",
451
+ strokeLinejoin: "miter"
452
+ }
453
+ )
454
+ }
455
+ ) })
456
+ }
457
+ ),
458
+ /* @__PURE__ */ jsxs2("span", { className: hideLabel ? "signal-sr-only" : void 0, children: [
459
+ label,
460
+ description && /* @__PURE__ */ jsx2("small", { className: "signal-muted", children: description })
461
+ ] })
462
+ ] });
463
+ }
464
+ function Switch({
465
+ label,
466
+ ...props
467
+ }) {
468
+ return /* @__PURE__ */ jsxs2("label", { className: "signal-check-label", children: [
469
+ /* @__PURE__ */ jsx2(BaseSwitch.Root, { ...props, className: "signal-switch", children: /* @__PURE__ */ jsx2(BaseSwitch.Thumb, { className: "signal-switch-thumb" }) }),
470
+ /* @__PURE__ */ jsx2("span", { children: label })
471
+ ] });
472
+ }
473
+ function SegmentedControl({
474
+ label,
475
+ options,
476
+ collapsible,
477
+ ...props
478
+ }) {
479
+ return /* @__PURE__ */ jsx2(
480
+ RadioGroup,
481
+ {
482
+ ...props,
483
+ "aria-label": label,
484
+ className: "signal-segmented",
485
+ "data-collapsible": collapsible || void 0,
486
+ children: options.map((option) => /* @__PURE__ */ jsxs2(
487
+ "label",
488
+ {
489
+ className: "signal-segment",
490
+ title: option.label,
491
+ children: [
492
+ /* @__PURE__ */ jsx2(
493
+ Radio.Root,
494
+ {
495
+ value: option.value,
496
+ disabled: option.disabled,
497
+ className: "signal-radio"
498
+ }
499
+ ),
500
+ /* @__PURE__ */ jsxs2("span", { children: [
501
+ option.icon,
502
+ /* @__PURE__ */ jsx2("span", { className: "signal-segment-label", children: option.label })
503
+ ] })
504
+ ]
505
+ },
506
+ option.value
507
+ ))
508
+ }
509
+ );
510
+ }
511
+ function Pane({
512
+ footer,
513
+ footerActions,
514
+ padding = "normal",
515
+ title,
516
+ description,
517
+ actions,
518
+ collapsible = false,
519
+ defaultOpen = true,
520
+ open,
521
+ onOpenChange,
522
+ children,
523
+ className,
524
+ ...props
525
+ }) {
526
+ const id = useId2();
527
+ const strings = useSignalStrings();
528
+ const [localOpen, setLocalOpen] = useState2(defaultOpen);
529
+ const isOpen = open ?? localOpen;
530
+ const header = /* @__PURE__ */ jsxs2("header", { className: "signal-pane-header", children: [
531
+ /* @__PURE__ */ jsxs2("div", { children: [
532
+ /* @__PURE__ */ jsx2("h2", { id, children: title }),
533
+ description && /* @__PURE__ */ jsx2("p", { children: description })
534
+ ] }),
535
+ (actions || collapsible) && /* @__PURE__ */ jsxs2("div", { className: "signal-pane-header-actions", children: [
536
+ actions,
537
+ collapsible && /* @__PURE__ */ jsx2(
538
+ Collapsible.Trigger,
539
+ {
540
+ render: /* @__PURE__ */ jsx2(
541
+ Button,
542
+ {
543
+ variant: "ghost",
544
+ iconOnly: true,
545
+ className: "signal-pane-collapse",
546
+ "aria-label": isOpen ? strings.pane.collapse : strings.pane.expand
547
+ }
548
+ ),
549
+ children: /* @__PURE__ */ jsx2(ChevronDown, { size: 16 })
550
+ }
551
+ )
552
+ ] })
553
+ ] });
554
+ const body = /* @__PURE__ */ jsxs2(Fragment, { children: [
555
+ /* @__PURE__ */ jsx2("div", { className: "signal-pane-body", children }),
556
+ (footer || footerActions) && /* @__PURE__ */ jsxs2("footer", { className: "signal-pane-footer", children: [
557
+ footer,
558
+ footerActions && /* @__PURE__ */ jsx2("div", { className: "signal-pane-footer-actions", children: footerActions })
559
+ ] })
560
+ ] });
561
+ if (!collapsible)
562
+ return /* @__PURE__ */ jsxs2(
563
+ "section",
564
+ {
565
+ ...props,
566
+ className: classes("signal-pane", className),
567
+ "data-padding": padding,
568
+ "aria-labelledby": id,
569
+ children: [
570
+ header,
571
+ body
572
+ ]
573
+ }
574
+ );
575
+ return /* @__PURE__ */ jsxs2(
576
+ Collapsible.Root,
577
+ {
578
+ open: isOpen,
579
+ onOpenChange: (next) => {
580
+ setLocalOpen(next);
581
+ onOpenChange?.(next);
582
+ },
583
+ render: /* @__PURE__ */ jsx2(
584
+ "section",
585
+ {
586
+ ...props,
587
+ className: classes("signal-pane", className),
588
+ "data-padding": padding,
589
+ "data-collapsed": !isOpen || void 0,
590
+ "aria-labelledby": id
591
+ }
592
+ ),
593
+ children: [
594
+ header,
595
+ /* @__PURE__ */ jsx2(Collapsible.Panel, { className: "signal-pane-collapsible", children: body })
596
+ ]
597
+ }
598
+ );
599
+ }
600
+ function ServiceRow({
601
+ icon,
602
+ title,
603
+ description,
604
+ action,
605
+ children,
606
+ href,
607
+ render,
608
+ onClick,
609
+ disabled
610
+ }) {
611
+ const content = /* @__PURE__ */ jsxs2(Fragment, { children: [
612
+ /* @__PURE__ */ jsx2("span", { className: "signal-service-glyph", "aria-hidden": "true", children: icon }),
613
+ /* @__PURE__ */ jsxs2("span", { className: "signal-service-copy", children: [
614
+ /* @__PURE__ */ jsx2("strong", { children: title }),
615
+ description && /* @__PURE__ */ jsx2("span", { className: "signal-service-description", children: description }),
616
+ children
617
+ ] }),
618
+ action && /* @__PURE__ */ jsx2("span", { className: "signal-service-action", children: action })
619
+ ] });
620
+ if (render && !disabled) {
621
+ const own = render.props;
622
+ return cloneElement(render, {
623
+ className: classes("signal-service-row", own.className),
624
+ children: content,
625
+ ...onClick && {
626
+ onClick: (event) => {
627
+ own.onClick?.(event);
628
+ onClick(event);
629
+ }
630
+ }
631
+ });
632
+ }
633
+ if (href && !disabled)
634
+ return /* @__PURE__ */ jsx2("a", { className: "signal-service-row", href, onClick, children: content });
635
+ if (onClick || href || render)
636
+ return /* @__PURE__ */ jsx2(
637
+ BaseButton,
638
+ {
639
+ className: "signal-service-row",
640
+ onClick,
641
+ disabled,
642
+ children: content
643
+ }
644
+ );
645
+ return /* @__PURE__ */ jsx2("div", { className: "signal-service-row", children: content });
646
+ }
647
+ function ServiceList({
648
+ children,
649
+ label
650
+ }) {
651
+ return /* @__PURE__ */ jsx2(
652
+ "div",
653
+ {
654
+ className: "signal-service-list",
655
+ role: label ? "group" : void 0,
656
+ "aria-label": label,
657
+ children
658
+ }
659
+ );
660
+ }
661
+ function Badge({
662
+ tone = "neutral",
663
+ children,
664
+ ...props
665
+ }) {
666
+ return /* @__PURE__ */ jsx2(
667
+ "span",
668
+ {
669
+ ...props,
670
+ "data-tone": tone,
671
+ className: classes("signal-badge", props.className),
672
+ children
673
+ }
674
+ );
675
+ }
676
+ function Tabs({
677
+ label,
678
+ items,
679
+ ...props
680
+ }) {
681
+ return /* @__PURE__ */ jsxs2(BaseTabs.Root, { ...props, className: "signal-tabs", children: [
682
+ /* @__PURE__ */ jsx2(BaseTabs.List, { "aria-label": label, className: "signal-tab-list", children: items.map((item) => /* @__PURE__ */ jsx2(
683
+ BaseTabs.Tab,
684
+ {
685
+ className: "signal-tab",
686
+ value: item.value,
687
+ disabled: item.disabled,
688
+ children: item.label
689
+ },
690
+ item.value
691
+ )) }),
692
+ items.map((item) => /* @__PURE__ */ jsx2(
693
+ BaseTabs.Panel,
694
+ {
695
+ className: "signal-tab-panel",
696
+ value: item.value,
697
+ children: item.content
698
+ },
699
+ item.value
700
+ ))
701
+ ] });
702
+ }
703
+ Select.signalLabelled = true;
704
+ function Dialog({
705
+ trigger,
706
+ title,
707
+ description,
708
+ actions,
709
+ children,
710
+ ...props
711
+ }) {
712
+ const strings = useSignalStrings();
713
+ return /* @__PURE__ */ jsxs2(BaseDialog.Root, { ...props, children: [
714
+ trigger !== void 0 && /* @__PURE__ */ jsx2(BaseDialog.Trigger, { render: /* @__PURE__ */ jsx2(Button, {}), children: trigger }),
715
+ /* @__PURE__ */ jsx2(BaseDialog.Portal, { children: /* @__PURE__ */ jsxs2(PortalScope, { children: [
716
+ /* @__PURE__ */ jsx2(BaseDialog.Backdrop, { className: "signal-backdrop" }),
717
+ /* @__PURE__ */ jsxs2(BaseDialog.Popup, { className: "signal-dialog", children: [
718
+ /* @__PURE__ */ jsxs2("header", { children: [
719
+ /* @__PURE__ */ jsx2(BaseDialog.Title, { children: title }),
720
+ /* @__PURE__ */ jsx2(
721
+ BaseDialog.Close,
722
+ {
723
+ render: /* @__PURE__ */ jsx2(Button, { iconOnly: true, "aria-label": strings.dialog.close }),
724
+ children: /* @__PURE__ */ jsx2(X, { size: 16 })
725
+ }
726
+ )
727
+ ] }),
728
+ /* @__PURE__ */ jsx2(BaseDialog.Description, { className: "signal-muted", children: description }),
729
+ children,
730
+ actions && /* @__PURE__ */ jsx2("div", { className: "signal-dialog-actions", children: actions })
731
+ ] })
732
+ ] }) })
733
+ ] });
734
+ }
735
+ function ConfirmDialog({
736
+ open,
737
+ onOpenChange,
738
+ title,
739
+ description,
740
+ confirmLabel,
741
+ cancelLabel,
742
+ destructive = false,
743
+ pending = false,
744
+ onConfirm,
745
+ children
746
+ }) {
747
+ const strings = useSignalStrings();
748
+ return /* @__PURE__ */ jsx2(
749
+ Dialog,
750
+ {
751
+ open,
752
+ onOpenChange,
753
+ title,
754
+ description,
755
+ actions: /* @__PURE__ */ jsxs2(Fragment, { children: [
756
+ /* @__PURE__ */ jsx2(Button, { onClick: () => onOpenChange(false), disabled: pending, children: cancelLabel ?? strings.dialog.cancel }),
757
+ /* @__PURE__ */ jsx2(
758
+ Button,
759
+ {
760
+ variant: destructive ? "destructive" : "primary",
761
+ loading: pending,
762
+ onClick: () => void onConfirm(),
763
+ children: confirmLabel
764
+ }
765
+ )
766
+ ] }),
767
+ children
768
+ }
769
+ );
770
+ }
771
+ function Menu({
772
+ label,
773
+ items,
774
+ trigger,
775
+ iconOnly = false,
776
+ align = "start"
777
+ }) {
778
+ return /* @__PURE__ */ jsxs2(BaseMenu.Root, { children: [
779
+ /* @__PURE__ */ jsxs2(
780
+ BaseMenu.Trigger,
781
+ {
782
+ render: /* @__PURE__ */ jsx2(
783
+ Button,
784
+ {
785
+ className: "signal-menu-trigger",
786
+ iconOnly,
787
+ "aria-label": iconOnly ? label : void 0
788
+ }
789
+ ),
790
+ children: [
791
+ trigger ?? (iconOnly ? /* @__PURE__ */ jsx2(MoreHorizontal, {}) : label),
792
+ !iconOnly && trigger === void 0 && /* @__PURE__ */ jsx2(ChevronDown, { size: 14 })
793
+ ]
794
+ }
795
+ ),
796
+ /* @__PURE__ */ jsx2(BaseMenu.Portal, { children: /* @__PURE__ */ jsx2(PortalScope, { children: /* @__PURE__ */ jsx2(
797
+ BaseMenu.Positioner,
798
+ {
799
+ className: "signal-positioner",
800
+ sideOffset: 4,
801
+ align,
802
+ children: /* @__PURE__ */ jsx2(BaseMenu.Popup, { className: "signal-popup", children: items.map(
803
+ (item, index) => item.separator ? /* @__PURE__ */ jsx2(
804
+ BaseMenu.Separator,
805
+ {
806
+ className: "signal-menu-separator"
807
+ },
808
+ item.id ?? `separator-${index}`
809
+ ) : (item.href !== void 0 || item.render) && !item.disabled ? /* @__PURE__ */ jsxs2(
810
+ BaseMenu.LinkItem,
811
+ {
812
+ className: "signal-option",
813
+ href: item.href,
814
+ target: item.target,
815
+ rel: item.rel,
816
+ render: item.render,
817
+ onClick: item.onClick,
818
+ closeOnClick: true,
819
+ "data-danger": item.danger || void 0,
820
+ children: [
821
+ item.icon,
822
+ /* @__PURE__ */ jsx2("span", { className: "signal-option-text", children: item.label }),
823
+ item.shortcut && /* @__PURE__ */ jsx2("kbd", { children: item.shortcut })
824
+ ]
825
+ },
826
+ item.id ?? item.label
827
+ ) : /* @__PURE__ */ jsxs2(
828
+ BaseMenu.Item,
829
+ {
830
+ className: "signal-option",
831
+ onClick: item.onClick,
832
+ disabled: item.disabled,
833
+ "data-danger": item.danger || void 0,
834
+ children: [
835
+ item.icon,
836
+ /* @__PURE__ */ jsx2("span", { className: "signal-option-text", children: item.label }),
837
+ item.shortcut && /* @__PURE__ */ jsx2("kbd", { children: item.shortcut })
838
+ ]
839
+ },
840
+ item.id ?? item.label
841
+ )
842
+ ) })
843
+ }
844
+ ) }) })
845
+ ] });
846
+ }
847
+ function Tooltip({
848
+ children,
849
+ content
850
+ }) {
851
+ return /* @__PURE__ */ jsx2(BaseTooltip.Provider, { children: /* @__PURE__ */ jsxs2(BaseTooltip.Root, { children: [
852
+ /* @__PURE__ */ jsx2(BaseTooltip.Trigger, { render: children }),
853
+ /* @__PURE__ */ jsx2(BaseTooltip.Portal, { children: /* @__PURE__ */ jsx2(PortalScope, { children: /* @__PURE__ */ jsx2(
854
+ BaseTooltip.Positioner,
855
+ {
856
+ className: "signal-positioner",
857
+ sideOffset: 6,
858
+ children: /* @__PURE__ */ jsx2(BaseTooltip.Popup, { className: "signal-tooltip", children: content })
859
+ }
860
+ ) }) })
861
+ ] }) });
862
+ }
863
+ function Disclosure({
864
+ title,
865
+ children,
866
+ ...props
867
+ }) {
868
+ return /* @__PURE__ */ jsxs2(Collapsible.Root, { ...props, className: "signal-disclosure", children: [
869
+ /* @__PURE__ */ jsxs2(Collapsible.Trigger, { className: "signal-disclosure-trigger", children: [
870
+ title,
871
+ /* @__PURE__ */ jsx2(ChevronDown, { size: 14 })
872
+ ] }),
873
+ /* @__PURE__ */ jsx2(Collapsible.Panel, { className: "signal-disclosure-panel", children })
874
+ ] });
875
+ }
876
+ function EmptyState({
877
+ title,
878
+ children,
879
+ action,
880
+ icon,
881
+ compact = false,
882
+ className,
883
+ ...props
884
+ }) {
885
+ return /* @__PURE__ */ jsxs2(
886
+ "div",
887
+ {
888
+ ...props,
889
+ className: classes("signal-empty", className),
890
+ "data-compact": compact || void 0,
891
+ role: "status",
892
+ children: [
893
+ icon && /* @__PURE__ */ jsx2("span", { className: "signal-empty-icon", "aria-hidden": "true", children: icon }),
894
+ /* @__PURE__ */ jsx2("strong", { children: title }),
895
+ children && /* @__PURE__ */ jsx2("p", { className: "signal-muted", children }),
896
+ action && /* @__PURE__ */ jsx2("div", { className: "signal-empty-action", children: action })
897
+ ]
898
+ }
899
+ );
900
+ }
901
+ function Alert({
902
+ title,
903
+ children,
904
+ tone = "neutral"
905
+ }) {
906
+ return /* @__PURE__ */ jsxs2(
907
+ "div",
908
+ {
909
+ className: "signal-alert",
910
+ "data-tone": tone,
911
+ role: tone === "danger" ? "alert" : "status",
912
+ children: [
913
+ /* @__PURE__ */ jsx2("strong", { children: title }),
914
+ children && /* @__PURE__ */ jsx2("p", { children })
915
+ ]
916
+ }
917
+ );
918
+ }
919
+ function Progress({
920
+ value,
921
+ max = 100,
922
+ label
923
+ }) {
924
+ const strings = useSignalStrings();
925
+ const percent = new Intl.NumberFormat(useSignalLocale(), {
926
+ style: "percent",
927
+ maximumFractionDigits: 0
928
+ });
929
+ return /* @__PURE__ */ jsxs2("label", { className: "signal-field", children: [
930
+ label,
931
+ /* @__PURE__ */ jsx2(
932
+ "progress",
933
+ {
934
+ className: "signal-progress",
935
+ value: value === null ? void 0 : value,
936
+ max
937
+ }
938
+ ),
939
+ /* @__PURE__ */ jsx2("span", { className: "signal-muted", children: value === null ? strings.progress.indeterminate : percent.format(value / max) })
940
+ ] });
941
+ }
942
+ function DataTable({
943
+ caption,
944
+ rows,
945
+ columns,
946
+ rowKey,
947
+ empty,
948
+ emptyAction,
949
+ sort: controlledSort,
950
+ onSortChange,
951
+ selectable = false,
952
+ selected,
953
+ onSelectedChange,
954
+ selectionLabel = (row) => rowKey(row),
955
+ rowActions,
956
+ actionsHeader,
957
+ onRowClick,
958
+ loading = false,
959
+ stickyHeader = false,
960
+ hideCaption = false
961
+ }) {
962
+ const strings = useSignalStrings();
963
+ const [localSort, setLocalSort] = useState2(null);
964
+ const sort = controlledSort !== void 0 ? controlledSort : localSort;
965
+ const requestSort = (key) => {
966
+ const next = { key, desc: sort?.key === key && !sort.desc };
967
+ if (onSortChange) onSortChange(next);
968
+ else setLocalSort(next);
969
+ };
970
+ const column = columns.find((c) => c.key === sort?.key);
971
+ const ordered = !onSortChange && column?.sortValue ? [...rows].sort((a, b) => {
972
+ const x = column.sortValue(a), y = column.sortValue(b);
973
+ if (x == null) return y == null ? 0 : 1;
974
+ if (y == null) return -1;
975
+ return (typeof x === "number" && typeof y === "number" ? x - y : String(x).localeCompare(String(y))) * (sort?.desc ? -1 : 1);
976
+ }) : rows;
977
+ const keys = ordered.map(rowKey);
978
+ const chosen = new Set(selected ?? []);
979
+ const allChosen = keys.length > 0 && keys.every((k) => chosen.has(k));
980
+ const someChosen = !allChosen && keys.some((k) => chosen.has(k));
981
+ const toggleAll = () => onSelectedChange?.(
982
+ allChosen ? [...chosen].filter((k) => !keys.includes(k)) : [.../* @__PURE__ */ new Set([...chosen, ...keys])]
983
+ );
984
+ const toggle = (key) => onSelectedChange?.(
985
+ chosen.has(key) ? [...chosen].filter((k) => k !== key) : [...chosen, key]
986
+ );
987
+ const span = columns.length + (selectable ? 1 : 0) + (rowActions ? 1 : 0);
988
+ const scroller = useRef2(null);
989
+ useEffect2(() => {
990
+ const el = scroller.current;
991
+ if (!el) return;
992
+ const update = () => {
993
+ const scrolled = Math.abs(el.scrollLeft), rest = el.scrollWidth - el.clientWidth - scrolled;
994
+ const edge = scrolled > 1 && rest > 1 ? "both" : scrolled > 1 ? "start" : rest > 1 ? "end" : "";
995
+ if (edge) el.dataset.overflow = edge;
996
+ else delete el.dataset.overflow;
997
+ };
998
+ update();
999
+ el.addEventListener("scroll", update, { passive: true });
1000
+ const observer = new ResizeObserver(update);
1001
+ observer.observe(el);
1002
+ if (el.firstElementChild) observer.observe(el.firstElementChild);
1003
+ return () => {
1004
+ el.removeEventListener("scroll", update);
1005
+ observer.disconnect();
1006
+ };
1007
+ }, []);
1008
+ return /* @__PURE__ */ jsx2(
1009
+ "div",
1010
+ {
1011
+ ref: scroller,
1012
+ className: "signal-table-scroll",
1013
+ role: "region",
1014
+ "aria-label": caption,
1015
+ "aria-busy": loading || void 0,
1016
+ "data-sticky": stickyHeader || void 0,
1017
+ tabIndex: 0,
1018
+ children: /* @__PURE__ */ jsxs2("table", { className: "signal-table", children: [
1019
+ /* @__PURE__ */ jsx2("caption", { className: hideCaption ? "signal-sr-only" : void 0, children: caption }),
1020
+ /* @__PURE__ */ jsx2("thead", { children: /* @__PURE__ */ jsxs2("tr", { children: [
1021
+ selectable && /* @__PURE__ */ jsx2("th", { scope: "col", className: "signal-table-select", children: /* @__PURE__ */ jsx2(
1022
+ BaseCheckbox.Root,
1023
+ {
1024
+ className: "signal-checkbox",
1025
+ "aria-label": strings.table.selectAll,
1026
+ checked: allChosen,
1027
+ indeterminate: someChosen,
1028
+ onCheckedChange: toggleAll,
1029
+ disabled: !keys.length,
1030
+ children: /* @__PURE__ */ jsx2(BaseCheckbox.Indicator, { className: "signal-checkmark", children: someChosen ? /* @__PURE__ */ jsx2(Minus, { size: 11 }) : /* @__PURE__ */ jsx2(Check2, { size: 11 }) })
1031
+ }
1032
+ ) }),
1033
+ columns.map((c) => {
1034
+ const sortable = Boolean(c.sortValue || c.sortable);
1035
+ const active = sort?.key === c.key;
1036
+ return /* @__PURE__ */ jsx2(
1037
+ "th",
1038
+ {
1039
+ scope: "col",
1040
+ "data-align": c.align,
1041
+ style: { textAlign: c.align, width: c.width },
1042
+ "aria-sort": sortable ? active ? sort.desc ? "descending" : "ascending" : "none" : void 0,
1043
+ children: sortable ? /* @__PURE__ */ jsxs2(
1044
+ "button",
1045
+ {
1046
+ type: "button",
1047
+ className: "signal-sort",
1048
+ "aria-pressed": active,
1049
+ onClick: () => requestSort(c.key),
1050
+ children: [
1051
+ c.header,
1052
+ active ? sort.desc ? /* @__PURE__ */ jsx2(ArrowDown, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx2(ArrowUp, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx2(ArrowUpDown, { "aria-hidden": "true" })
1053
+ ]
1054
+ }
1055
+ ) : c.header
1056
+ },
1057
+ c.key
1058
+ );
1059
+ }),
1060
+ rowActions && /* @__PURE__ */ jsx2("th", { scope: "col", className: "signal-table-actions", children: /* @__PURE__ */ jsx2("span", { className: "signal-sr-only", children: actionsHeader ?? strings.table.actions }) })
1061
+ ] }) }),
1062
+ /* @__PURE__ */ jsxs2("tbody", { children: [
1063
+ loading && /* @__PURE__ */ jsx2("tr", { className: "signal-table-loading", "aria-hidden": "true", children: /* @__PURE__ */ jsx2("td", { colSpan: span, children: /* @__PURE__ */ jsx2("progress", { className: "signal-progress" }) }) }),
1064
+ ordered.map((row) => {
1065
+ const key = rowKey(row);
1066
+ return /* @__PURE__ */ jsxs2(
1067
+ "tr",
1068
+ {
1069
+ "aria-selected": selectable ? chosen.has(key) : void 0,
1070
+ "data-clickable": onRowClick ? "" : void 0,
1071
+ onClick: onRowClick ? () => onRowClick(row) : void 0,
1072
+ children: [
1073
+ selectable && /* @__PURE__ */ jsx2(
1074
+ "td",
1075
+ {
1076
+ className: "signal-table-select",
1077
+ onClick: (e) => e.stopPropagation(),
1078
+ children: /* @__PURE__ */ jsx2(
1079
+ BaseCheckbox.Root,
1080
+ {
1081
+ className: "signal-checkbox",
1082
+ "aria-label": strings.table.selectRow(selectionLabel(row)),
1083
+ checked: chosen.has(key),
1084
+ onCheckedChange: () => toggle(key),
1085
+ children: /* @__PURE__ */ jsx2(BaseCheckbox.Indicator, { className: "signal-checkmark", children: /* @__PURE__ */ jsx2(Check2, { size: 11 }) })
1086
+ }
1087
+ )
1088
+ }
1089
+ ),
1090
+ columns.map((c) => /* @__PURE__ */ jsx2("td", { style: { textAlign: c.align }, children: c.render(row) }, c.key)),
1091
+ rowActions && /* @__PURE__ */ jsx2(
1092
+ "td",
1093
+ {
1094
+ className: "signal-table-actions",
1095
+ onClick: (e) => e.stopPropagation(),
1096
+ children: rowActions(row)
1097
+ }
1098
+ )
1099
+ ]
1100
+ },
1101
+ key
1102
+ );
1103
+ }),
1104
+ !ordered.length && !loading && /* @__PURE__ */ jsx2("tr", { children: /* @__PURE__ */ jsx2("td", { colSpan: span, className: "signal-table-empty", children: /* @__PURE__ */ jsxs2("div", { children: [
1105
+ /* @__PURE__ */ jsx2("span", { children: empty ?? strings.table.empty }),
1106
+ emptyAction
1107
+ ] }) }) })
1108
+ ] })
1109
+ ] })
1110
+ }
1111
+ );
1112
+ }
1113
+ function Stat({
1114
+ label,
1115
+ value,
1116
+ detail,
1117
+ trend,
1118
+ tone
1119
+ }) {
1120
+ return /* @__PURE__ */ jsxs2("div", { className: "signal-stat", "data-trend": trend ? "" : void 0, children: [
1121
+ /* @__PURE__ */ jsx2("span", { className: "signal-muted", children: label }),
1122
+ /* @__PURE__ */ jsx2("strong", { "data-tone": tone, children: value }),
1123
+ trend && /* @__PURE__ */ jsx2("span", { className: "signal-stat-trend", children: trend }),
1124
+ detail && /* @__PURE__ */ jsx2("small", { children: detail })
1125
+ ] });
1126
+ }
1127
+ function Toolbar({
1128
+ label,
1129
+ children
1130
+ }) {
1131
+ return /* @__PURE__ */ jsx2("div", { className: "signal-toolbar", role: "group", "aria-label": label, children });
1132
+ }
1133
+ function SearchField({
1134
+ label,
1135
+ value,
1136
+ onValueChange,
1137
+ onSearch,
1138
+ suggestions = [],
1139
+ placeholder,
1140
+ status,
1141
+ error,
1142
+ disabled,
1143
+ shortcut = false
1144
+ }) {
1145
+ const strings = useSignalStrings();
1146
+ const id = useId2(), input = useRef2(null), [mac, setMac] = useState2(false);
1147
+ useEffect2(() => {
1148
+ if (!shortcut) return;
1149
+ setMac(/Mac|iPhone|iPad/.test(navigator.platform));
1150
+ const focus = (event) => {
1151
+ if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "k" && !event.defaultPrevented && !disabled) {
1152
+ event.preventDefault();
1153
+ input.current?.focus();
1154
+ }
1155
+ };
1156
+ document.addEventListener("keydown", focus);
1157
+ return () => document.removeEventListener("keydown", focus);
1158
+ }, [shortcut, disabled]);
1159
+ return /* @__PURE__ */ jsxs2(
1160
+ "form",
1161
+ {
1162
+ className: "signal-field",
1163
+ role: "search",
1164
+ "aria-label": label,
1165
+ onSubmit: (event) => {
1166
+ event.preventDefault();
1167
+ onSearch(String(new FormData(event.currentTarget).get("query") ?? ""));
1168
+ },
1169
+ children: [
1170
+ /* @__PURE__ */ jsx2("label", { htmlFor: id, children: label }),
1171
+ /* @__PURE__ */ jsxs2(
1172
+ Autocomplete.Root,
1173
+ {
1174
+ items: suggestions,
1175
+ value,
1176
+ onValueChange,
1177
+ submitOnItemClick: true,
1178
+ openOnInputClick: true,
1179
+ disabled,
1180
+ children: [
1181
+ /* @__PURE__ */ jsxs2(Autocomplete.InputGroup, { className: "signal-search", children: [
1182
+ /* @__PURE__ */ jsx2(Search, { "aria-hidden": "true" }),
1183
+ /* @__PURE__ */ jsx2(
1184
+ Autocomplete.Input,
1185
+ {
1186
+ ref: input,
1187
+ id,
1188
+ name: "query",
1189
+ className: "signal-input",
1190
+ placeholder,
1191
+ "aria-invalid": error ? true : void 0,
1192
+ "aria-describedby": status || error ? `${id}-status` : void 0,
1193
+ "aria-keyshortcuts": shortcut ? "Control+k Meta+k" : void 0
1194
+ }
1195
+ ),
1196
+ value && /* @__PURE__ */ jsx2(
1197
+ Autocomplete.Clear,
1198
+ {
1199
+ render: /* @__PURE__ */ jsx2(Button, { iconOnly: true, "aria-label": strings.search.clear }),
1200
+ children: /* @__PURE__ */ jsx2(X, { size: 14 })
1201
+ }
1202
+ ),
1203
+ shortcut && /* @__PURE__ */ jsx2("kbd", { className: "signal-search-shortcut", "aria-hidden": "true", children: mac ? strings.search.shortcutCommand : strings.search.shortcutControl }),
1204
+ /* @__PURE__ */ jsx2(Button, { type: "submit", disabled, children: strings.search.submit })
1205
+ ] }),
1206
+ /* @__PURE__ */ jsx2(Autocomplete.Portal, { children: /* @__PURE__ */ jsx2(PortalScope, { children: /* @__PURE__ */ jsx2(
1207
+ Autocomplete.Positioner,
1208
+ {
1209
+ className: "signal-positioner",
1210
+ sideOffset: 4,
1211
+ children: /* @__PURE__ */ jsxs2(Autocomplete.Popup, { className: "signal-popup", children: [
1212
+ /* @__PURE__ */ jsx2(Autocomplete.Empty, { children: /* @__PURE__ */ jsx2("div", { className: "signal-option", children: strings.search.noSuggestions }) }),
1213
+ /* @__PURE__ */ jsx2(Autocomplete.List, { children: (item) => /* @__PURE__ */ jsx2(
1214
+ Autocomplete.Item,
1215
+ {
1216
+ className: "signal-option",
1217
+ value: item,
1218
+ children: item
1219
+ },
1220
+ item
1221
+ ) })
1222
+ ] })
1223
+ }
1224
+ ) }) })
1225
+ ]
1226
+ }
1227
+ ),
1228
+ (status || error) && /* @__PURE__ */ jsx2(
1229
+ "span",
1230
+ {
1231
+ id: `${id}-status`,
1232
+ className: error ? "signal-error" : "signal-muted",
1233
+ role: error ? "alert" : "status",
1234
+ children: error || status
1235
+ }
1236
+ )
1237
+ ]
1238
+ }
1239
+ );
1240
+ }
1241
+ function AppearanceSwitch({
1242
+ variant = "compact",
1243
+ value,
1244
+ onValueChange
1245
+ }) {
1246
+ const strings = useSignalStrings();
1247
+ if (variant === "cards")
1248
+ return /* @__PURE__ */ jsx2(
1249
+ RadioGroup,
1250
+ {
1251
+ className: "signal-appearance-cards",
1252
+ "aria-label": strings.appearance.label,
1253
+ value,
1254
+ onValueChange: (v) => onValueChange(v),
1255
+ children: [
1256
+ ["dark", strings.appearance.dark, Moon],
1257
+ ["light", strings.appearance.light, Sun],
1258
+ ["system", strings.appearance.system, Monitor]
1259
+ ].map(([mode, label, Icon]) => /* @__PURE__ */ jsxs2(
1260
+ "label",
1261
+ {
1262
+ className: "signal-appearance-card",
1263
+ "data-selected": mode === value || void 0,
1264
+ children: [
1265
+ /* @__PURE__ */ jsx2(Radio.Root, { value: mode, className: "signal-appearance-radio" }),
1266
+ /* @__PURE__ */ jsx2(
1267
+ "span",
1268
+ {
1269
+ className: "signal-appearance-sample",
1270
+ "data-mode": mode,
1271
+ "aria-hidden": "true",
1272
+ children: (mode === "system" ? ["light", "dark"] : [mode]).map(
1273
+ (sample) => /* @__PURE__ */ jsxs2(SignalProvider, { appearance: sample, children: [
1274
+ /* @__PURE__ */ jsxs2("span", { className: "signal-appearance-sidebar", children: [
1275
+ /* @__PURE__ */ jsx2("i", {}),
1276
+ /* @__PURE__ */ jsx2("i", {}),
1277
+ /* @__PURE__ */ jsx2("i", {})
1278
+ ] }),
1279
+ /* @__PURE__ */ jsxs2("span", { className: "signal-appearance-workspace", children: [
1280
+ /* @__PURE__ */ jsx2("i", {}),
1281
+ /* @__PURE__ */ jsx2("span", {}),
1282
+ /* @__PURE__ */ jsx2("span", {})
1283
+ ] })
1284
+ ] }, sample)
1285
+ )
1286
+ }
1287
+ ),
1288
+ /* @__PURE__ */ jsxs2("span", { className: "signal-appearance-label", children: [
1289
+ /* @__PURE__ */ jsx2(Icon, { "aria-hidden": "true" }),
1290
+ label,
1291
+ mode === value && /* @__PURE__ */ jsx2(Check2, { "aria-hidden": "true" })
1292
+ ] })
1293
+ ]
1294
+ },
1295
+ mode
1296
+ ))
1297
+ }
1298
+ );
1299
+ return /* @__PURE__ */ jsxs2("div", { className: "signal-field", children: [
1300
+ /* @__PURE__ */ jsx2("span", { className: "signal-control-label", children: strings.appearance.label }),
1301
+ /* @__PURE__ */ jsx2(
1302
+ SegmentedControl,
1303
+ {
1304
+ label: strings.appearance.label,
1305
+ value,
1306
+ onValueChange: (v) => onValueChange(v),
1307
+ collapsible: true,
1308
+ options: [
1309
+ {
1310
+ value: "system",
1311
+ label: strings.appearance.system,
1312
+ icon: /* @__PURE__ */ jsx2(Monitor, {})
1313
+ },
1314
+ { value: "light", label: strings.appearance.light, icon: /* @__PURE__ */ jsx2(Sun, {}) },
1315
+ { value: "dark", label: strings.appearance.dark, icon: /* @__PURE__ */ jsx2(Moon, {}) }
1316
+ ]
1317
+ }
1318
+ )
1319
+ ] });
1320
+ }
1321
+ function DensitySwitch({
1322
+ value,
1323
+ onValueChange
1324
+ }) {
1325
+ const strings = useSignalStrings();
1326
+ return /* @__PURE__ */ jsxs2("div", { className: "signal-field", children: [
1327
+ /* @__PURE__ */ jsx2("span", { className: "signal-control-label", children: strings.density.label }),
1328
+ /* @__PURE__ */ jsx2(
1329
+ SegmentedControl,
1330
+ {
1331
+ label: strings.density.label,
1332
+ value,
1333
+ onValueChange: (v) => onValueChange(v),
1334
+ collapsible: true,
1335
+ options: [
1336
+ {
1337
+ value: "store",
1338
+ label: strings.density.comfortable,
1339
+ icon: /* @__PURE__ */ jsx2(LayoutPanelTop, {})
1340
+ },
1341
+ {
1342
+ value: "workspace",
1343
+ label: strings.density.compact,
1344
+ icon: /* @__PURE__ */ jsx2(Rows3, {})
1345
+ },
1346
+ {
1347
+ value: "editor",
1348
+ label: strings.density.editor,
1349
+ icon: /* @__PURE__ */ jsx2(SquareTerminal, {})
1350
+ }
1351
+ ]
1352
+ }
1353
+ )
1354
+ ] });
1355
+ }
1356
+ function Popover({
1357
+ label,
1358
+ trigger,
1359
+ children
1360
+ }) {
1361
+ return /* @__PURE__ */ jsxs2(BasePopover.Root, { children: [
1362
+ /* @__PURE__ */ jsx2(BasePopover.Trigger, { render: /* @__PURE__ */ jsx2(Button, { iconOnly: true, "aria-label": label }), children: trigger }),
1363
+ /* @__PURE__ */ jsx2(BasePopover.Portal, { children: /* @__PURE__ */ jsx2(PortalScope, { children: /* @__PURE__ */ jsx2(BasePopover.Positioner, { className: "signal-positioner", sideOffset: 6, children: /* @__PURE__ */ jsx2(
1364
+ BasePopover.Popup,
1365
+ {
1366
+ className: "signal-popup signal-popover",
1367
+ "aria-label": label,
1368
+ children
1369
+ }
1370
+ ) }) }) })
1371
+ ] });
1372
+ }
1373
+ function FaceSwitch({
1374
+ value,
1375
+ onValueChange
1376
+ }) {
1377
+ const strings = useSignalStrings();
1378
+ return /* @__PURE__ */ jsxs2("div", { className: "signal-field", children: [
1379
+ /* @__PURE__ */ jsx2("span", { className: "signal-control-label", children: strings.face.label }),
1380
+ /* @__PURE__ */ jsx2(
1381
+ SegmentedControl,
1382
+ {
1383
+ label: strings.face.control,
1384
+ value,
1385
+ onValueChange: (v) => onValueChange(v),
1386
+ collapsible: true,
1387
+ options: [
1388
+ { value: "sans", label: strings.face.sans, icon: /* @__PURE__ */ jsx2(CaseSensitive, {}) },
1389
+ {
1390
+ value: "chrome",
1391
+ label: strings.face.chrome,
1392
+ icon: /* @__PURE__ */ jsx2(PanelTop, {})
1393
+ },
1394
+ { value: "mono", label: strings.face.mono, icon: /* @__PURE__ */ jsx2(Code2, {}) }
1395
+ ]
1396
+ }
1397
+ )
1398
+ ] });
1399
+ }
1400
+ function Tiles({
1401
+ columns = "1fr",
1402
+ rows,
1403
+ className,
1404
+ style,
1405
+ children,
1406
+ ...props
1407
+ }) {
1408
+ return /* @__PURE__ */ jsx2(
1409
+ "div",
1410
+ {
1411
+ ...props,
1412
+ className: classes("signal-tiles", className),
1413
+ style: { gridTemplateColumns: columns, gridTemplateRows: rows, ...style },
1414
+ children
1415
+ }
1416
+ );
1417
+ }
1418
+ function Kbd({ className, ...props }) {
1419
+ return /* @__PURE__ */ jsx2("kbd", { ...props, className: classes("signal-kbd", className) });
1420
+ }
1421
+ function StatusBar({
1422
+ label,
1423
+ className,
1424
+ children,
1425
+ ...props
1426
+ }) {
1427
+ const strings = useSignalStrings();
1428
+ return /* @__PURE__ */ jsx2(
1429
+ ShellChrome,
1430
+ {
1431
+ ...props,
1432
+ as: "footer",
1433
+ "aria-label": label ?? strings.statusBar.label,
1434
+ className: classes("signal-statusbar", className),
1435
+ children
1436
+ }
1437
+ );
1438
+ }
1439
+ function StatusItem({
1440
+ icon,
1441
+ tone,
1442
+ end,
1443
+ className,
1444
+ children,
1445
+ ...props
1446
+ }) {
1447
+ return /* @__PURE__ */ jsxs2(
1448
+ "span",
1449
+ {
1450
+ ...props,
1451
+ className: classes("signal-status-item", className),
1452
+ "data-tone": tone,
1453
+ "data-align": end ? "end" : void 0,
1454
+ children: [
1455
+ icon,
1456
+ children
1457
+ ]
1458
+ }
1459
+ );
1460
+ }
1461
+ function StatusButton({
1462
+ icon,
1463
+ tone,
1464
+ end,
1465
+ className,
1466
+ children,
1467
+ ...props
1468
+ }) {
1469
+ return /* @__PURE__ */ jsxs2(
1470
+ "button",
1471
+ {
1472
+ type: "button",
1473
+ ...props,
1474
+ className: classes("signal-status-item", "signal-status-button", className),
1475
+ "data-tone": tone,
1476
+ "data-align": end ? "end" : void 0,
1477
+ children: [
1478
+ icon,
1479
+ children
1480
+ ]
1481
+ }
1482
+ );
1483
+ }
1484
+
1485
+ export {
1486
+ SignalProvider,
1487
+ ShellChrome,
1488
+ Button,
1489
+ Input,
1490
+ Textarea,
1491
+ Field,
1492
+ Select,
1493
+ Checkbox,
1494
+ Switch,
1495
+ SegmentedControl,
1496
+ Pane,
1497
+ ServiceRow,
1498
+ ServiceList,
1499
+ Badge,
1500
+ Tabs,
1501
+ Dialog,
1502
+ ConfirmDialog,
1503
+ Menu,
1504
+ Tooltip,
1505
+ Disclosure,
1506
+ EmptyState,
1507
+ Alert,
1508
+ Progress,
1509
+ DataTable,
1510
+ Stat,
1511
+ Toolbar,
1512
+ SearchField,
1513
+ AppearanceSwitch,
1514
+ DensitySwitch,
1515
+ Popover,
1516
+ FaceSwitch,
1517
+ Tiles,
1518
+ Kbd,
1519
+ StatusBar,
1520
+ StatusItem,
1521
+ StatusButton,
1522
+ CodeValue
1523
+ };