react-semaphor 0.1.301 → 0.1.303

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 (66) hide show
  1. package/dist/appearance/index.cjs +1 -0
  2. package/dist/appearance/index.js +9 -0
  3. package/dist/brand-studio/index.cjs +21 -0
  4. package/dist/brand-studio/index.js +1461 -0
  5. package/dist/chunks/dashboard-controls-BCJZOzrL.js +2226 -0
  6. package/dist/chunks/dashboard-controls-CVFoOPti.js +47 -0
  7. package/dist/chunks/dashboard-filter-controls-button-C-e7230k.js +11 -0
  8. package/dist/chunks/{dashboard-filter-controls-button-DjALRkvg.js → dashboard-filter-controls-button-Cfbac4Jw.js} +205 -216
  9. package/dist/chunks/dashboard-json-BM5ywMgp.js +1 -0
  10. package/dist/chunks/{dashboard-json-D-zIG46N.js → dashboard-json-BzvLPhGM.js} +14 -12
  11. package/dist/chunks/dashboard-summary-settings-dialog-BdxKl1UF.js +1 -0
  12. package/dist/chunks/{dashboard-summary-settings-dialog-D-F1eEJI.js → dashboard-summary-settings-dialog-ChK3344r.js} +64 -63
  13. package/dist/chunks/date-formatter-D9Bvw5Qk.js +1 -0
  14. package/dist/chunks/date-formatter-DyIOb6uC.js +333 -0
  15. package/dist/chunks/{edit-dashboard-visual-BjflrL8w.js → edit-dashboard-visual-D725CWD5.js} +6690 -6679
  16. package/dist/chunks/edit-dashboard-visual-nNaZ2IK1.js +183 -0
  17. package/dist/chunks/index-BWjB_9uz.js +1356 -0
  18. package/dist/chunks/index-CJdxSyQq.js +2578 -0
  19. package/dist/chunks/{index-DDA12yqV.js → index-CYWgnME0.js} +48994 -66425
  20. package/dist/chunks/index-D7KJindZ.js +1 -0
  21. package/dist/chunks/index-DFOb_6HB.js +1657 -0
  22. package/dist/chunks/index-DRlMUglg.js +4 -0
  23. package/dist/chunks/palette-B9DJXMGo.js +11 -0
  24. package/dist/chunks/palette-DGOzbtsn.js +43 -0
  25. package/dist/chunks/{resource-management-panel-B2558XA1.js → resource-management-panel-CE0-NcLL.js} +116 -115
  26. package/dist/chunks/resource-management-panel-mJmc5dMT.js +6 -0
  27. package/dist/chunks/rotate-ccw-Bs7YJn10.js +6 -0
  28. package/dist/chunks/rotate-ccw-YsjQwpKm.js +14 -0
  29. package/dist/chunks/save-Bj1y1rug.js +6 -0
  30. package/dist/chunks/save-CUrexoNl.js +21 -0
  31. package/dist/chunks/switch-CiEX68py.js +163 -0
  32. package/dist/chunks/switch-oojO-gal.js +19730 -0
  33. package/dist/chunks/{use-create-flow-overlay-state-BUw_JtLs.js → use-create-flow-overlay-state-BHDKxe7I.js} +396 -412
  34. package/dist/chunks/use-create-flow-overlay-state-D2I2wNey.js +16 -0
  35. package/dist/chunks/{use-visual-utils-C45OxsOf.js → use-visual-utils-CjFzlR0P.js} +54 -53
  36. package/dist/chunks/use-visual-utils-DYDXMl5v.js +1 -0
  37. package/dist/dashboard/index.cjs +1 -1
  38. package/dist/dashboard/index.js +1 -1
  39. package/dist/format-utils/index.cjs +1 -1
  40. package/dist/format-utils/index.js +2 -2
  41. package/dist/index.cjs +1 -1
  42. package/dist/index.js +210 -207
  43. package/dist/style.css +1 -1
  44. package/dist/surfboard/index.cjs +1 -1
  45. package/dist/surfboard/index.js +2 -2
  46. package/dist/types/appearance.d.ts +176 -0
  47. package/dist/types/brand-studio.d.ts +245 -0
  48. package/dist/types/dashboard.d.ts +134 -0
  49. package/dist/types/main.d.ts +142 -1
  50. package/dist/types/surfboard.d.ts +134 -0
  51. package/dist/types/types.d.ts +139 -0
  52. package/package.json +13 -1
  53. package/dist/chunks/braces-Bhqo4iW1.js +0 -23
  54. package/dist/chunks/braces-BwK7fWd_.js +0 -6
  55. package/dist/chunks/dashboard-controls-BIRiWCUK.js +0 -47
  56. package/dist/chunks/dashboard-controls-DIlnYo96.js +0 -2219
  57. package/dist/chunks/dashboard-filter-controls-button-CK1-mKQh.js +0 -11
  58. package/dist/chunks/dashboard-json-DK4mQ1gS.js +0 -1
  59. package/dist/chunks/dashboard-summary-settings-dialog-DSxNqxFI.js +0 -1
  60. package/dist/chunks/date-formatter-CqXdM6JO.js +0 -1
  61. package/dist/chunks/date-formatter-vkCj9Ct-.js +0 -1982
  62. package/dist/chunks/edit-dashboard-visual-DCsrtJr_.js +0 -193
  63. package/dist/chunks/index-8GnvL1_L.js +0 -1523
  64. package/dist/chunks/resource-management-panel-CKp4_aem.js +0 -6
  65. package/dist/chunks/use-create-flow-overlay-state-CWcCdPbC.js +0 -21
  66. package/dist/chunks/use-visual-utils-DyaThRzf.js +0 -1
@@ -0,0 +1,1461 @@
1
+ import { jsxs as d, jsx as r, Fragment as ce } from "react/jsx-runtime";
2
+ import m from "react";
3
+ import { c as $, a as K, P as ge, b as be, B as C, d as fe, U as De, C as Ie, f as le, X as je, p as se, e as Je, T as Le, q as $e, r as G, s as _e, t as M, v as Ue, w as Ve, x as Ge, y as Me, L as E, z as Q, A as ee, D as re, E as me, F as oe, I as ae, g as he, h as xe, i as ye, j as ke, k as ve, S as We } from "../chunks/switch-oojO-gal.js";
4
+ import { r as He, v as Xe, A as Ye, a as qe, p as Ze } from "../chunks/index-CJdxSyQq.js";
5
+ import { P as W, B as Ke } from "../chunks/palette-DGOzbtsn.js";
6
+ import { R as Ce } from "../chunks/rotate-ccw-YsjQwpKm.js";
7
+ import { S as Qe } from "../chunks/save-CUrexoNl.js";
8
+ /**
9
+ * @license lucide-react v0.453.0 - ISC
10
+ *
11
+ * This source code is licensed under the ISC license.
12
+ * See the LICENSE file in the root directory of this source tree.
13
+ */
14
+ const er = $("Ban", [
15
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
16
+ ["path", { d: "m4.9 4.9 14.2 14.2", key: "1m5liu" }]
17
+ ]);
18
+ /**
19
+ * @license lucide-react v0.453.0 - ISC
20
+ *
21
+ * This source code is licensed under the ISC license.
22
+ * See the LICENSE file in the root directory of this source tree.
23
+ */
24
+ const rr = $("Clipboard", [
25
+ ["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
26
+ [
27
+ "path",
28
+ {
29
+ d: "M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",
30
+ key: "116196"
31
+ }
32
+ ]
33
+ ]);
34
+ /**
35
+ * @license lucide-react v0.453.0 - ISC
36
+ *
37
+ * This source code is licensed under the ISC license.
38
+ * See the LICENSE file in the root directory of this source tree.
39
+ */
40
+ const or = $("LayoutGrid", [
41
+ ["rect", { width: "7", height: "7", x: "3", y: "3", rx: "1", key: "1g98yp" }],
42
+ ["rect", { width: "7", height: "7", x: "14", y: "3", rx: "1", key: "6d4xhi" }],
43
+ ["rect", { width: "7", height: "7", x: "14", y: "14", rx: "1", key: "nxv5o0" }],
44
+ ["rect", { width: "7", height: "7", x: "3", y: "14", rx: "1", key: "1bb6yr" }]
45
+ ]);
46
+ /**
47
+ * @license lucide-react v0.453.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */
52
+ const ar = $("Pipette", [
53
+ ["path", { d: "m2 22 1-1h3l9-9", key: "1sre89" }],
54
+ ["path", { d: "M3 21v-3l9-9", key: "hpe2y6" }],
55
+ [
56
+ "path",
57
+ {
58
+ d: "m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z",
59
+ key: "196du1"
60
+ }
61
+ ]
62
+ ]), Ne = [
63
+ {
64
+ id: "semaphor",
65
+ name: "Semaphor",
66
+ description: "Dense neutral system defaults for embedded analytics.",
67
+ primary: "#18181b",
68
+ accent: "#f4f4f5",
69
+ light: {
70
+ background: "#ffffff",
71
+ foreground: "#18181b",
72
+ muted: "#fafafa",
73
+ mutedForeground: "#71717a",
74
+ border: "#e4e4e7",
75
+ primary: "#18181b",
76
+ primaryForeground: "#ffffff",
77
+ accent: "#f4f4f5",
78
+ accentForeground: "#18181b",
79
+ card: "#ffffff",
80
+ cardForeground: "#18181b",
81
+ chartPalette: [
82
+ "#3b82f6",
83
+ "#10b981",
84
+ "#f59e0b",
85
+ "#ef4444",
86
+ "#8b5cf6",
87
+ "#06b6d4"
88
+ ]
89
+ },
90
+ dark: {
91
+ background: "#09090b",
92
+ foreground: "#fafafa",
93
+ muted: "#18181b",
94
+ mutedForeground: "#a1a1aa",
95
+ border: "#27272a",
96
+ primary: "#fafafa",
97
+ primaryForeground: "#09090b",
98
+ accent: "#27272a",
99
+ accentForeground: "#fafafa",
100
+ card: "#09090b",
101
+ cardForeground: "#fafafa",
102
+ chartPalette: [
103
+ "#60a5fa",
104
+ "#34d399",
105
+ "#fbbf24",
106
+ "#f87171",
107
+ "#a78bfa",
108
+ "#22d3ee"
109
+ ]
110
+ }
111
+ },
112
+ {
113
+ id: "atlas-blue",
114
+ name: "Atlas Blue",
115
+ description: "Crisp enterprise blue with restrained neutral surfaces.",
116
+ primary: "#2563eb",
117
+ accent: "#dbeafe",
118
+ light: {
119
+ background: "#f8fafc",
120
+ foreground: "#0f172a",
121
+ muted: "#f1f5f9",
122
+ mutedForeground: "#64748b",
123
+ border: "#cbd5e1",
124
+ primary: "#2563eb",
125
+ primaryForeground: "#ffffff",
126
+ accent: "#dbeafe",
127
+ accentForeground: "#1e3a8a",
128
+ card: "#ffffff",
129
+ cardForeground: "#0f172a",
130
+ chartPalette: [
131
+ "#2563eb",
132
+ "#0f766e",
133
+ "#ca8a04",
134
+ "#dc2626",
135
+ "#7c3aed",
136
+ "#0891b2"
137
+ ]
138
+ },
139
+ dark: {
140
+ background: "#020617",
141
+ foreground: "#e2e8f0",
142
+ muted: "#0f172a",
143
+ mutedForeground: "#94a3b8",
144
+ border: "#1e293b",
145
+ primary: "#60a5fa",
146
+ primaryForeground: "#020617",
147
+ accent: "#1e3a8a",
148
+ accentForeground: "#dbeafe",
149
+ card: "#0f172a",
150
+ cardForeground: "#e2e8f0",
151
+ chartPalette: [
152
+ "#60a5fa",
153
+ "#2dd4bf",
154
+ "#facc15",
155
+ "#f87171",
156
+ "#a78bfa",
157
+ "#22d3ee"
158
+ ]
159
+ }
160
+ },
161
+ {
162
+ id: "field-green",
163
+ name: "Field Green",
164
+ description: "Operational green accents with quiet, readable canvases.",
165
+ primary: "#047857",
166
+ accent: "#d1fae5",
167
+ light: {
168
+ background: "#fbfdfb",
169
+ foreground: "#10231d",
170
+ muted: "#f1f5f3",
171
+ mutedForeground: "#64746d",
172
+ border: "#d7ded9",
173
+ primary: "#047857",
174
+ primaryForeground: "#ffffff",
175
+ accent: "#d1fae5",
176
+ accentForeground: "#064e3b",
177
+ card: "#ffffff",
178
+ cardForeground: "#10231d",
179
+ chartPalette: [
180
+ "#047857",
181
+ "#2563eb",
182
+ "#d97706",
183
+ "#dc2626",
184
+ "#7c3aed",
185
+ "#0891b2"
186
+ ]
187
+ },
188
+ dark: {
189
+ background: "#071511",
190
+ foreground: "#e7f4ef",
191
+ muted: "#10231d",
192
+ mutedForeground: "#92aaa1",
193
+ border: "#244139",
194
+ primary: "#34d399",
195
+ primaryForeground: "#071511",
196
+ accent: "#064e3b",
197
+ accentForeground: "#d1fae5",
198
+ card: "#0b1d17",
199
+ cardForeground: "#e7f4ef",
200
+ chartPalette: [
201
+ "#34d399",
202
+ "#60a5fa",
203
+ "#fbbf24",
204
+ "#f87171",
205
+ "#a78bfa",
206
+ "#22d3ee"
207
+ ]
208
+ }
209
+ }
210
+ ];
211
+ function J(e) {
212
+ const n = He({
213
+ organizationAppearance: e ?? void 0
214
+ });
215
+ return tr(R(n));
216
+ }
217
+ function L(e) {
218
+ const n = R({
219
+ version: Ye,
220
+ mode: e.mode,
221
+ schemes: e.schemes
222
+ }), t = Xe(n);
223
+ if (!t.success) {
224
+ const u = t.issues[0];
225
+ throw new Error(
226
+ `Invalid Brand Studio appearance at ${u.path}: ${u.message}`
227
+ );
228
+ }
229
+ return t.value;
230
+ }
231
+ function nr(e, n) {
232
+ const t = Ne.find((c) => c.id === n);
233
+ if (!t)
234
+ return e;
235
+ const u = R(e);
236
+ return ue(u.schemes.light, t.light), ue(u.schemes.dark, t.dark), u;
237
+ }
238
+ function ue(e, n) {
239
+ e.tokens.color.background = n.background, e.tokens.color.foreground = n.foreground, e.tokens.color.muted = n.muted, e.tokens.color.mutedForeground = n.mutedForeground, e.tokens.color.border = n.border, e.tokens.color.input = n.border, e.tokens.color.primary = n.primary, e.tokens.color.primaryForeground = n.primaryForeground, e.tokens.color.accent = n.accent, e.tokens.color.accentForeground = n.accentForeground, e.tokens.color.card = n.card, e.tokens.color.cardForeground = n.cardForeground, e.components.dashboard.background = n.background, e.components.dashboard.foreground = n.foreground, e.components.dashboard.borderColor = n.border, e.components.card.background = n.card, e.components.card.foreground = n.cardForeground, e.components.card.borderColor = n.border, e.components.interactive.toolbarBackground = n.background, e.components.interactive.background = n.card, e.components.interactive.foreground = n.foreground, e.components.interactive.borderColor = n.border, e.components.chart.palette = [...n.chartPalette], e.components.chart.background = n.card, e.components.chart.foreground = n.foreground, e.components.chart.gridColor = n.border, e.components.chart.axisColor = n.mutedForeground, e.components.table.container.background = n.card, e.components.table.container.borderColor = n.border, e.components.table.header.background = n.muted, e.components.table.header.foreground = n.mutedForeground, e.components.table.header.dividerColor = n.border, e.components.table.row.dividerColor = n.border, e.components.table.row.zebraBackground = n.muted, e.components.table.pagination.background = n.card, e.components.table.pagination.foreground = n.foreground, e.components.table.pagination.borderColor = n.border, s(e, "aggregateTable"), s(e, "pivotTable");
240
+ }
241
+ function s(e, n) {
242
+ e.components[n] = R(e.components.table);
243
+ }
244
+ function pe(e, n, t) {
245
+ switch (e.tokens.color[n] = t, n) {
246
+ case "background":
247
+ e.components.dashboard.background = t, e.components.interactive.toolbarBackground = t;
248
+ break;
249
+ case "foreground":
250
+ e.components.dashboard.foreground = t, e.components.interactive.foreground = t, e.components.pagination.foreground = t, e.components.chart.foreground = t, e.components.table.pagination.foreground = t, e.components.table.subtotal.foreground = t, e.components.table.grandTotal.foreground = t, s(e, "aggregateTable"), s(e, "pivotTable");
251
+ break;
252
+ case "card":
253
+ e.components.card.background = t, e.components.interactive.background = t, e.components.pagination.background = t, e.components.chart.background = t, e.components.table.container.background = t, e.components.table.pagination.background = t, s(e, "aggregateTable"), s(e, "pivotTable");
254
+ break;
255
+ case "cardForeground":
256
+ e.components.card.foreground = t;
257
+ break;
258
+ case "muted":
259
+ e.components.table.header.background = t, e.components.table.row.zebraBackground = t, e.components.table.subtotal.background = t, e.components.table.grandTotal.background = t, s(e, "aggregateTable"), s(e, "pivotTable");
260
+ break;
261
+ case "mutedForeground":
262
+ e.components.table.header.foreground = t, e.components.chart.axisColor = t, s(e, "aggregateTable"), s(e, "pivotTable");
263
+ break;
264
+ case "border":
265
+ e.tokens.color.input = t, e.components.dashboard.borderColor = t, e.components.card.borderColor = t, e.components.interactive.borderColor = t, e.components.pagination.borderColor = t, e.components.chart.gridColor = t, e.components.table.container.borderColor = t, e.components.table.header.dividerColor = t, e.components.table.row.dividerColor = t, e.components.table.grandTotal.borderColor = t, e.components.table.pagination.borderColor = t, s(e, "aggregateTable"), s(e, "pivotTable");
266
+ break;
267
+ case "accent":
268
+ e.components.table.row.hoverBackground = t, e.components.table.row.selectedBackground = t, s(e, "aggregateTable"), s(e, "pivotTable");
269
+ break;
270
+ }
271
+ }
272
+ function H(e, n, t) {
273
+ switch (e.tokens.radius[n] = t, n) {
274
+ case "control":
275
+ e.components.interactive.borderRadius = t, e.components.pagination.borderRadius = t;
276
+ break;
277
+ case "card":
278
+ e.components.card.borderRadius = t;
279
+ break;
280
+ case "table":
281
+ e.components.table.container.borderRadius = t, s(e, "aggregateTable"), s(e, "pivotTable");
282
+ break;
283
+ }
284
+ }
285
+ function tr(e) {
286
+ var n, t;
287
+ for (const u of ["light", "dark"]) {
288
+ const c = e.schemes[u], l = c.tokens, i = l.color, k = (n = c.components) == null ? void 0 : n.aggregateTable, y = (t = c.components) == null ? void 0 : t.pivotTable, S = {
289
+ fontFamily: "",
290
+ headingFontFamily: "",
291
+ monoFontFamily: "",
292
+ baseFontSize: 14,
293
+ density: "comfortable"
294
+ };
295
+ l.typography = { ...S, ...l.typography };
296
+ const f = {
297
+ control: 5,
298
+ card: 5,
299
+ table: 5,
300
+ badge: 999
301
+ };
302
+ l.radius = { ...f, ...l.radius };
303
+ const g = {
304
+ dashboardPadding: 16,
305
+ gridGap: 12,
306
+ cardPadding: 16,
307
+ controlGap: 8,
308
+ tableCellX: 12,
309
+ tableCellY: 8
310
+ };
311
+ l.spacing = { ...g, ...l.spacing };
312
+ const T = {
313
+ card: "none",
314
+ popover: "0 12px 32px rgba(15, 23, 42, 0.14)",
315
+ focusRing: "0 0 0 2px rgba(37, 99, 235, 0.35)"
316
+ };
317
+ l.shadow = { ...T, ...l.shadow };
318
+ const F = {
319
+ dashboard: {
320
+ background: i.background,
321
+ foreground: i.foreground,
322
+ borderColor: i.border,
323
+ padding: l.spacing.dashboardPadding
324
+ },
325
+ card: {
326
+ background: i.card,
327
+ foreground: i.cardForeground,
328
+ borderColor: i.border,
329
+ borderRadius: l.radius.card,
330
+ padding: l.spacing.cardPadding,
331
+ shadow: l.shadow.card
332
+ },
333
+ interactive: {
334
+ toolbarBackground: i.background,
335
+ background: i.card,
336
+ foreground: i.foreground,
337
+ borderColor: i.border,
338
+ borderRadius: l.radius.control
339
+ },
340
+ chart: {
341
+ palette: [],
342
+ background: i.card,
343
+ foreground: i.foreground,
344
+ gridColor: i.border,
345
+ axisColor: i.mutedForeground
346
+ },
347
+ table: B(i, l),
348
+ aggregateTable: B(i, l),
349
+ pivotTable: B(i, l),
350
+ pagination: {
351
+ background: i.card,
352
+ foreground: i.foreground,
353
+ borderColor: i.border,
354
+ borderRadius: l.radius.control
355
+ }
356
+ };
357
+ c.components = { ...F, ...c.components };
358
+ const _ = {
359
+ palette: [],
360
+ background: i.card,
361
+ foreground: i.foreground,
362
+ gridColor: i.border,
363
+ axisColor: i.mutedForeground
364
+ };
365
+ c.components.chart = { ..._, ...c.components.chart }, c.components.table = {
366
+ ...B(i, l),
367
+ ...c.components.table
368
+ }, c.components.aggregateTable = k ? {
369
+ ...B(i, l),
370
+ ...k
371
+ } : R(c.components.table), c.components.pivotTable = y ? {
372
+ ...B(i, l),
373
+ ...y
374
+ } : R(c.components.table);
375
+ }
376
+ return e;
377
+ }
378
+ function B(e, n) {
379
+ return {
380
+ density: n.typography.density,
381
+ container: {
382
+ background: e.card,
383
+ borderColor: e.border,
384
+ borderRadius: n.radius.table,
385
+ shadow: n.shadow.card
386
+ },
387
+ header: {
388
+ background: e.muted,
389
+ foreground: e.mutedForeground,
390
+ dividerColor: e.border,
391
+ fontWeight: 600,
392
+ uppercase: !0,
393
+ sticky: !0
394
+ },
395
+ row: {
396
+ height: 32,
397
+ dividerColor: e.border,
398
+ zebra: !1,
399
+ zebraBackground: e.muted,
400
+ hoverBackground: e.accent,
401
+ selectedBackground: e.accent
402
+ },
403
+ cell: {
404
+ paddingX: n.spacing.tableCellX,
405
+ paddingY: n.spacing.tableCellY,
406
+ verticalAlign: "middle",
407
+ wrap: "nowrap"
408
+ },
409
+ subtotal: {
410
+ background: e.muted,
411
+ foreground: e.foreground,
412
+ fontWeight: 600
413
+ },
414
+ grandTotal: {
415
+ background: e.muted,
416
+ foreground: e.foreground,
417
+ fontWeight: 700,
418
+ borderColor: e.border
419
+ },
420
+ pagination: {
421
+ background: e.card,
422
+ foreground: e.foreground,
423
+ borderColor: e.border
424
+ }
425
+ };
426
+ }
427
+ function R(e) {
428
+ return JSON.parse(JSON.stringify(e));
429
+ }
430
+ const dr = [
431
+ ["background", "Canvas"],
432
+ ["foreground", "Text"],
433
+ ["card", "Card"],
434
+ ["cardForeground", "Card text"],
435
+ ["primary", "Primary"],
436
+ ["primaryForeground", "Primary text"],
437
+ ["accent", "Accent"],
438
+ ["accentForeground", "Accent text"],
439
+ ["muted", "Muted"],
440
+ ["mutedForeground", "Muted text"],
441
+ ["border", "Border"],
442
+ ["positive", "Positive"],
443
+ ["negative", "Negative"],
444
+ ["warning", "Warning"],
445
+ ["info", "Info"]
446
+ ], ir = [0, 1, 2, 3, 4, 5], X = qe, cr = [
447
+ "#ffffff",
448
+ "#f8fafc",
449
+ "#f4f4f5",
450
+ "#e4e4e7",
451
+ "#18181b",
452
+ "#09090b",
453
+ "#2563eb",
454
+ "#0f766e",
455
+ "#047857",
456
+ "#d97706",
457
+ "#dc2626",
458
+ "#7c3aed"
459
+ ];
460
+ function vr({
461
+ appearance: e,
462
+ previewTitle: n,
463
+ isLoading: t = !1,
464
+ isSaving: u = !1,
465
+ error: c = null,
466
+ className: l,
467
+ onDraftChange: i,
468
+ onSave: k,
469
+ onClearConfig: y,
470
+ onCancel: S
471
+ }) {
472
+ const [f, g] = m.useState(null), [T, F] = m.useState("light"), [_, z] = m.useState(!1), [we, O] = m.useState(
473
+ "idle"
474
+ ), [ne, Se] = m.useState(!1), [D, U] = m.useState(""), [I, h] = m.useState(null), te = m.useRef(null), j = m.useRef(i), A = m.useRef(!1);
475
+ m.useEffect(() => {
476
+ j.current = i;
477
+ }, [i]), m.useEffect(() => {
478
+ if (e === void 0) {
479
+ A.current = !0, g(null);
480
+ return;
481
+ }
482
+ const o = J(e);
483
+ A.current = !0, g(o), F("light"), h(null);
484
+ }, [e]), m.useEffect(() => {
485
+ var o;
486
+ if (f) {
487
+ if (A.current) {
488
+ A.current = !1;
489
+ return;
490
+ }
491
+ try {
492
+ const a = L(f);
493
+ (o = j.current) == null || o.call(j, a), h(null);
494
+ } catch (a) {
495
+ h(
496
+ a instanceof Error ? a.message : "Appearance is invalid"
497
+ );
498
+ }
499
+ }
500
+ }, [f]);
501
+ const p = f == null ? void 0 : f.schemes[T], V = u || _, Te = m.useMemo(
502
+ () => p ? ur(p.tokens.radius.control) : void 0,
503
+ [p]
504
+ ), Fe = (o) => {
505
+ g((a) => {
506
+ if (!a) return a;
507
+ const x = pr(a);
508
+ return o(x), x;
509
+ });
510
+ }, b = (o) => {
511
+ Fe((a) => {
512
+ o(a.schemes[T]);
513
+ });
514
+ }, Pe = async () => {
515
+ if (!f || !k) return;
516
+ let o;
517
+ try {
518
+ o = L(f);
519
+ } catch (a) {
520
+ h(
521
+ a instanceof Error ? a.message : "Appearance is invalid"
522
+ );
523
+ return;
524
+ }
525
+ z(!0);
526
+ try {
527
+ await k(o);
528
+ } finally {
529
+ z(!1);
530
+ }
531
+ }, Be = () => {
532
+ const o = J(null);
533
+ O("idle"), g(o);
534
+ }, Re = async () => {
535
+ if (y) {
536
+ z(!0), h(null), O("idle");
537
+ try {
538
+ await y(), A.current = !0, g(J(null)), F("light");
539
+ } catch (o) {
540
+ h(
541
+ o instanceof Error ? o.message : "Unable to clear organization appearance"
542
+ );
543
+ } finally {
544
+ z(!1);
545
+ }
546
+ }
547
+ }, de = m.useCallback(() => f ? JSON.stringify(L(f), null, 2) : "", [f]), Oe = (o) => {
548
+ if (Se(o), o)
549
+ try {
550
+ U(de()), h(null);
551
+ } catch (a) {
552
+ h(
553
+ a instanceof Error ? a.message : "Appearance is invalid"
554
+ );
555
+ }
556
+ }, Ae = async () => {
557
+ if (f)
558
+ try {
559
+ const o = ne && D ? D : de();
560
+ await navigator.clipboard.writeText(o), h(null), O("copied");
561
+ } catch (o) {
562
+ h(
563
+ o instanceof Error ? o.message : "Unable to copy brand spec"
564
+ );
565
+ }
566
+ }, ie = (o) => {
567
+ const a = JSON.parse(o), x = J(a), P = L(x);
568
+ O("idle"), F("light"), g(x), U(JSON.stringify(P, null, 2));
569
+ }, Ee = () => {
570
+ try {
571
+ ie(D);
572
+ } catch (o) {
573
+ h(
574
+ o instanceof Error ? o.message : "Brand spec must be valid JSON"
575
+ );
576
+ }
577
+ }, ze = async (o) => {
578
+ var x;
579
+ const a = (x = o.target.files) == null ? void 0 : x[0];
580
+ if (o.target.value = "", !!a)
581
+ try {
582
+ ie(await gr(a));
583
+ } catch (P) {
584
+ h(
585
+ P instanceof Error ? P.message : "Uploaded file must be a valid brand spec"
586
+ );
587
+ }
588
+ };
589
+ return /* @__PURE__ */ d(
590
+ "div",
591
+ {
592
+ className: K(
593
+ "flex min-h-0 flex-1 flex-col bg-background text-foreground",
594
+ l
595
+ ),
596
+ style: Te,
597
+ children: [
598
+ /* @__PURE__ */ d("header", { className: "flex h-11 shrink-0 items-start gap-3 border-b border-border/60 px-4 pt-2", children: [
599
+ /* @__PURE__ */ r("div", { className: "mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-control border border-border/70", children: /* @__PURE__ */ r(W, { className: "h-3.5 w-3.5" }) }),
600
+ /* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
601
+ /* @__PURE__ */ r("h2", { className: "truncate text-[13px] font-semibold leading-tight", children: "Brand Studio" }),
602
+ /* @__PURE__ */ d("p", { className: "truncate text-[11px] leading-tight text-muted-foreground", children: [
603
+ "Previewing ",
604
+ n || "current dashboard"
605
+ ] })
606
+ ] }),
607
+ /* @__PURE__ */ d(
608
+ ge,
609
+ {
610
+ open: ne,
611
+ onOpenChange: Oe,
612
+ children: [
613
+ /* @__PURE__ */ r(be, { asChild: !0, children: /* @__PURE__ */ d(C, { type: "button", size: "xs", variant: "ghost", disabled: !f, children: [
614
+ /* @__PURE__ */ r(Ke, { className: "h-3.5 w-3.5" }),
615
+ "Brand Spec"
616
+ ] }) }),
617
+ /* @__PURE__ */ d(
618
+ fe,
619
+ {
620
+ align: "end",
621
+ sideOffset: 6,
622
+ className: "z-[60] w-[min(520px,calc(100vw-24px))] rounded-control p-2",
623
+ children: [
624
+ /* @__PURE__ */ d("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
625
+ /* @__PURE__ */ d("div", { className: "min-w-0", children: [
626
+ /* @__PURE__ */ r("div", { className: "text-[12px] font-medium", children: "Brand spec" }),
627
+ /* @__PURE__ */ r("div", { className: "text-[11px] text-muted-foreground", children: "Edit, apply, copy, or upload your brand spec." })
628
+ ] }),
629
+ /* @__PURE__ */ d("div", { className: "flex shrink-0 items-center gap-1", children: [
630
+ /* @__PURE__ */ d(
631
+ C,
632
+ {
633
+ type: "button",
634
+ size: "xs",
635
+ variant: "ghost",
636
+ onClick: Ae,
637
+ children: [
638
+ /* @__PURE__ */ r(rr, { className: "h-3.5 w-3.5" }),
639
+ we === "copied" ? "Copied" : "Copy"
640
+ ]
641
+ }
642
+ ),
643
+ /* @__PURE__ */ d(
644
+ C,
645
+ {
646
+ type: "button",
647
+ size: "xs",
648
+ variant: "ghost",
649
+ onClick: () => {
650
+ var o;
651
+ return (o = te.current) == null ? void 0 : o.click();
652
+ },
653
+ children: [
654
+ /* @__PURE__ */ r(De, { className: "h-3.5 w-3.5" }),
655
+ "Upload"
656
+ ]
657
+ }
658
+ ),
659
+ /* @__PURE__ */ r(C, { type: "button", size: "xs", onClick: Ee, children: "Apply" })
660
+ ] })
661
+ ] }),
662
+ /* @__PURE__ */ r("div", { className: "h-[320px] overflow-hidden rounded-control border border-input", children: /* @__PURE__ */ r(
663
+ Ie,
664
+ {
665
+ ariaLabel: "Brand spec",
666
+ value: D,
667
+ onValueChange: (o) => {
668
+ U(o), O("idle");
669
+ },
670
+ language: "json",
671
+ embedded: !0,
672
+ hideLineNumbers: !0,
673
+ dense: !0
674
+ }
675
+ ) })
676
+ ]
677
+ }
678
+ )
679
+ ]
680
+ }
681
+ ),
682
+ /* @__PURE__ */ r(
683
+ "input",
684
+ {
685
+ ref: te,
686
+ "aria-label": "Upload brand spec",
687
+ type: "file",
688
+ accept: "application/json,.json",
689
+ className: "sr-only",
690
+ onChange: ze
691
+ }
692
+ ),
693
+ /* @__PURE__ */ d(
694
+ C,
695
+ {
696
+ type: "button",
697
+ size: "xs",
698
+ variant: "ghost",
699
+ onClick: Be,
700
+ disabled: !f,
701
+ children: [
702
+ /* @__PURE__ */ r(Ce, { className: "h-3.5 w-3.5" }),
703
+ "Reset"
704
+ ]
705
+ }
706
+ ),
707
+ y && /* @__PURE__ */ d(
708
+ C,
709
+ {
710
+ type: "button",
711
+ size: "xs",
712
+ variant: "ghost",
713
+ onClick: Re,
714
+ disabled: V,
715
+ children: [
716
+ /* @__PURE__ */ r(er, { className: "h-3.5 w-3.5" }),
717
+ "No config"
718
+ ]
719
+ }
720
+ ),
721
+ /* @__PURE__ */ d(
722
+ C,
723
+ {
724
+ type: "button",
725
+ size: "xs",
726
+ onClick: Pe,
727
+ disabled: !f || V || !!I || !k,
728
+ children: [
729
+ V ? /* @__PURE__ */ r(le, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ r(Qe, { className: "h-3.5 w-3.5" }),
730
+ "Save"
731
+ ]
732
+ }
733
+ ),
734
+ S && /* @__PURE__ */ r(
735
+ "button",
736
+ {
737
+ type: "button",
738
+ "aria-label": "Close Brand Studio",
739
+ className: "flex h-7 w-7 items-center justify-center rounded-control text-muted-foreground hover:bg-muted hover:text-foreground",
740
+ onClick: S,
741
+ children: /* @__PURE__ */ r(je, { className: "h-3.5 w-3.5" })
742
+ }
743
+ )
744
+ ] }),
745
+ /* @__PURE__ */ d("div", { className: "flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-2", children: [
746
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2 text-[12px] text-muted-foreground", children: I ? /* @__PURE__ */ d(ce, { children: [
747
+ /* @__PURE__ */ r(se, { className: "h-3.5 w-3.5 text-destructive" }),
748
+ "Preview keeps the last valid draft"
749
+ ] }) : /* @__PURE__ */ d(ce, { children: [
750
+ /* @__PURE__ */ r(Je, { className: "h-3.5 w-3.5 text-emerald-500" }),
751
+ "Draft is applied to the live dashboard preview"
752
+ ] }) }),
753
+ /* @__PURE__ */ r("div", { className: "inline-flex h-7 items-center overflow-hidden rounded-control border border-border/70", children: ["light", "dark"].map((o) => /* @__PURE__ */ r(
754
+ "button",
755
+ {
756
+ type: "button",
757
+ className: K(
758
+ "h-full px-2.5 text-[12px] capitalize transition-colors",
759
+ T === o ? "bg-muted text-foreground" : "text-muted-foreground hover:text-foreground"
760
+ ),
761
+ onClick: () => F(o),
762
+ children: o
763
+ },
764
+ o
765
+ )) })
766
+ ] }),
767
+ I && /* @__PURE__ */ r("div", { className: "border-b border-destructive/20 bg-destructive/5 px-4 py-2 text-[12px] text-destructive", children: I }),
768
+ t ? /* @__PURE__ */ r("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ r(le, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : c ? /* @__PURE__ */ r("div", { className: "p-4 text-[13px] text-muted-foreground", children: c }) : f && p ? /* @__PURE__ */ d(Le, { defaultValue: "style", className: "flex min-h-0 flex-1 flex-col", children: [
769
+ /* @__PURE__ */ r("div", { className: "shrink-0 px-4 pt-3", children: /* @__PURE__ */ d($e, { variant: "underline", className: "w-full gap-5", children: [
770
+ /* @__PURE__ */ r(G, { value: "style", children: "Style" }),
771
+ /* @__PURE__ */ r(G, { value: "surfaces", children: "Surfaces" }),
772
+ /* @__PURE__ */ r(G, { value: "data", children: "Data" })
773
+ ] }) }),
774
+ /* @__PURE__ */ d(_e, { className: "min-h-0 flex-1", children: [
775
+ /* @__PURE__ */ d(M, { value: "style", className: "m-0 p-4", children: [
776
+ /* @__PURE__ */ r(
777
+ N,
778
+ {
779
+ icon: W,
780
+ title: "Presets",
781
+ description: "Start from a full light and dark appearance.",
782
+ children: /* @__PURE__ */ r("div", { className: "grid grid-cols-1 gap-2", children: Ne.map((o) => /* @__PURE__ */ d(
783
+ "button",
784
+ {
785
+ type: "button",
786
+ className: "flex items-center gap-3 rounded-control border border-border/70 px-3 py-2 text-left hover:bg-muted/60",
787
+ onClick: () => {
788
+ const a = nr(f, o.id);
789
+ g(a);
790
+ },
791
+ children: [
792
+ /* @__PURE__ */ d("div", { className: "flex h-7 w-10 overflow-hidden rounded-control border border-border/70", children: [
793
+ /* @__PURE__ */ r(
794
+ "span",
795
+ {
796
+ className: "h-full flex-1",
797
+ style: { backgroundColor: o.primary }
798
+ }
799
+ ),
800
+ /* @__PURE__ */ r(
801
+ "span",
802
+ {
803
+ className: "h-full flex-1",
804
+ style: { backgroundColor: o.accent }
805
+ }
806
+ )
807
+ ] }),
808
+ /* @__PURE__ */ d("span", { className: "min-w-0 flex-1", children: [
809
+ /* @__PURE__ */ r("span", { className: "block text-[13px] font-medium", children: o.name }),
810
+ /* @__PURE__ */ r("span", { className: "block truncate text-[12px] text-muted-foreground", children: o.description })
811
+ ] })
812
+ ]
813
+ },
814
+ o.id
815
+ )) })
816
+ }
817
+ ),
818
+ /* @__PURE__ */ r(
819
+ N,
820
+ {
821
+ icon: W,
822
+ title: "Color",
823
+ description: `Editing the ${T} scheme.`,
824
+ children: /* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-2", children: dr.map(([o, a]) => /* @__PURE__ */ r(
825
+ v,
826
+ {
827
+ label: a,
828
+ value: p.tokens.color[o],
829
+ onChange: (x) => b((P) => {
830
+ pe(P, o, x);
831
+ })
832
+ },
833
+ o
834
+ )) })
835
+ }
836
+ ),
837
+ /* @__PURE__ */ d(
838
+ N,
839
+ {
840
+ icon: Ue,
841
+ title: "Typography",
842
+ description: "Fonts and density used by dashboard and workflow chrome.",
843
+ children: [
844
+ /* @__PURE__ */ r(
845
+ lr,
846
+ {
847
+ value: p.tokens.typography.fontFamily,
848
+ onChange: (o) => b((a) => {
849
+ a.tokens.typography.fontFamily = o, a.tokens.typography.headingFontFamily = o;
850
+ })
851
+ }
852
+ ),
853
+ /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
854
+ /* @__PURE__ */ r(
855
+ w,
856
+ {
857
+ label: "Base size",
858
+ value: p.tokens.typography.baseFontSize,
859
+ min: 11,
860
+ max: 18,
861
+ onChange: (o) => b((a) => {
862
+ a.tokens.typography.baseFontSize = o;
863
+ })
864
+ }
865
+ ),
866
+ /* @__PURE__ */ r(
867
+ q,
868
+ {
869
+ label: "Density",
870
+ value: p.tokens.typography.density,
871
+ options: [
872
+ ["compact", "Compact"],
873
+ ["comfortable", "Comfortable"],
874
+ ["spacious", "Spacious"]
875
+ ],
876
+ onChange: (o) => b((a) => {
877
+ a.tokens.typography.density = o, a.components.table.density = a.tokens.typography.density, s(a, "aggregateTable"), s(a, "pivotTable");
878
+ })
879
+ }
880
+ )
881
+ ] })
882
+ ]
883
+ }
884
+ )
885
+ ] }),
886
+ /* @__PURE__ */ d(M, { value: "surfaces", className: "m-0 p-4", children: [
887
+ /* @__PURE__ */ d(
888
+ N,
889
+ {
890
+ icon: or,
891
+ title: "Layout",
892
+ description: "Canvas, grid, and card rhythm for embedded dashboards.",
893
+ children: [
894
+ /* @__PURE__ */ d("div", { className: "grid grid-cols-3 gap-2", children: [
895
+ /* @__PURE__ */ r(
896
+ w,
897
+ {
898
+ label: "Canvas pad",
899
+ tooltip: "Outer padding around the dashboard canvas before cards begin.",
900
+ value: p.tokens.spacing.dashboardPadding,
901
+ min: 0,
902
+ max: 48,
903
+ onChange: (o) => b((a) => {
904
+ a.tokens.spacing.dashboardPadding = o, a.components.dashboard.padding = o;
905
+ })
906
+ }
907
+ ),
908
+ /* @__PURE__ */ r(
909
+ w,
910
+ {
911
+ label: "Grid gap",
912
+ tooltip: "Spacing between dashboard cards in the grid.",
913
+ value: p.tokens.spacing.gridGap,
914
+ min: 0,
915
+ max: 32,
916
+ onChange: (o) => b((a) => {
917
+ a.tokens.spacing.gridGap = o;
918
+ })
919
+ }
920
+ ),
921
+ /* @__PURE__ */ r(
922
+ w,
923
+ {
924
+ label: "Card pad",
925
+ tooltip: "Inner padding inside card/widget frames around titles, controls, and visual content.",
926
+ value: p.tokens.spacing.cardPadding,
927
+ min: 0,
928
+ max: 32,
929
+ onChange: (o) => b((a) => {
930
+ a.tokens.spacing.cardPadding = o, a.components.card.padding = o;
931
+ })
932
+ }
933
+ )
934
+ ] }),
935
+ /* @__PURE__ */ d("div", { className: "grid grid-cols-3 gap-2", children: [
936
+ /* @__PURE__ */ r(
937
+ w,
938
+ {
939
+ label: "Control radius",
940
+ tooltip: "Corner radius for buttons, inputs, selects, checkboxes, segmented controls, and similar interactive controls.",
941
+ value: p.tokens.radius.control,
942
+ min: 0,
943
+ max: 12,
944
+ onChange: (o) => b((a) => {
945
+ H(a, "control", o);
946
+ })
947
+ }
948
+ ),
949
+ /* @__PURE__ */ r(
950
+ w,
951
+ {
952
+ label: "Card/widget radius",
953
+ tooltip: "Corner radius for dashboard card frames and widget containers.",
954
+ value: p.tokens.radius.card,
955
+ min: 0,
956
+ max: 12,
957
+ onChange: (o) => b((a) => {
958
+ H(a, "card", o);
959
+ })
960
+ }
961
+ ),
962
+ /* @__PURE__ */ r(
963
+ w,
964
+ {
965
+ label: "Table radius",
966
+ tooltip: "Corner radius for table containers, table chrome, and table pagination surfaces.",
967
+ value: p.tokens.radius.table,
968
+ min: 0,
969
+ max: 12,
970
+ onChange: (o) => b((a) => {
971
+ H(a, "table", o);
972
+ })
973
+ }
974
+ )
975
+ ] })
976
+ ]
977
+ }
978
+ ),
979
+ /* @__PURE__ */ r(
980
+ N,
981
+ {
982
+ icon: se,
983
+ title: "Filters and Controls",
984
+ description: "Dashboard filter/control toolbar, chip states, menus, and settings panels.",
985
+ children: /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
986
+ /* @__PURE__ */ r(
987
+ v,
988
+ {
989
+ label: "Toolbar background",
990
+ tooltip: "Background color for the dashboard filter/control toolbar strip. This is separate from chip state colors.",
991
+ value: p.components.interactive.toolbarBackground || p.tokens.color.background,
992
+ onChange: (o) => b((a) => {
993
+ a.components.interactive.toolbarBackground = o;
994
+ })
995
+ }
996
+ ),
997
+ /* @__PURE__ */ r(
998
+ v,
999
+ {
1000
+ label: "Default state",
1001
+ tooltip: "Unselected filter/control chips plus the base surface for their menus, dialogs, and pagination fallback.",
1002
+ value: p.components.interactive.background || p.tokens.color.card,
1003
+ onChange: (o) => b((a) => {
1004
+ a.components.interactive.background = o, a.components.pagination.background = o;
1005
+ })
1006
+ }
1007
+ ),
1008
+ /* @__PURE__ */ r(
1009
+ v,
1010
+ {
1011
+ label: "Border",
1012
+ tooltip: "Border color for filter/control chips, runtime inputs, settings panels, and related popover chrome.",
1013
+ value: p.components.interactive.borderColor || p.tokens.color.border,
1014
+ onChange: (o) => b((a) => {
1015
+ a.components.interactive.borderColor = o, a.components.pagination.borderColor = o;
1016
+ })
1017
+ }
1018
+ ),
1019
+ /* @__PURE__ */ r(
1020
+ v,
1021
+ {
1022
+ label: "Selected state",
1023
+ tooltip: "Selected filter/control chips and hover feedback. This keeps a lighter default state and a stronger selected state.",
1024
+ value: p.tokens.color.accent,
1025
+ onChange: (o) => b((a) => {
1026
+ pe(a, "accent", o);
1027
+ })
1028
+ }
1029
+ )
1030
+ ] })
1031
+ }
1032
+ )
1033
+ ] }),
1034
+ /* @__PURE__ */ d(M, { value: "data", className: "m-0 p-4", children: [
1035
+ /* @__PURE__ */ d(
1036
+ N,
1037
+ {
1038
+ icon: Ve,
1039
+ title: "Charts",
1040
+ description: "Palette and semantic chart text/grid colors.",
1041
+ children: [
1042
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-3 gap-2", children: ir.map((o) => /* @__PURE__ */ r(
1043
+ v,
1044
+ {
1045
+ label: `Series ${o + 1}`,
1046
+ value: p.components.chart.palette[o] || "#000000",
1047
+ onChange: (a) => b((x) => {
1048
+ x.components.chart.palette[o] = a;
1049
+ })
1050
+ },
1051
+ o
1052
+ )) }),
1053
+ /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
1054
+ /* @__PURE__ */ r(
1055
+ v,
1056
+ {
1057
+ label: "Grid",
1058
+ value: p.components.chart.gridColor,
1059
+ onChange: (o) => b((a) => {
1060
+ a.components.chart.gridColor = o;
1061
+ })
1062
+ }
1063
+ ),
1064
+ /* @__PURE__ */ r(
1065
+ v,
1066
+ {
1067
+ label: "Axis",
1068
+ value: p.components.chart.axisColor,
1069
+ onChange: (o) => b((a) => {
1070
+ a.components.chart.axisColor = o;
1071
+ })
1072
+ }
1073
+ )
1074
+ ] })
1075
+ ]
1076
+ }
1077
+ ),
1078
+ /* @__PURE__ */ d(
1079
+ N,
1080
+ {
1081
+ icon: Ge,
1082
+ title: "Tables",
1083
+ description: "Flat, aggregate, and pivot tables share this V1 table appearance.",
1084
+ children: [
1085
+ /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
1086
+ /* @__PURE__ */ r(
1087
+ q,
1088
+ {
1089
+ label: "Density",
1090
+ value: p.components.table.density,
1091
+ options: [
1092
+ ["compact", "Compact"],
1093
+ ["comfortable", "Comfortable"],
1094
+ ["spacious", "Spacious"]
1095
+ ],
1096
+ onChange: (o) => b((a) => {
1097
+ a.components.table.density = o, s(a, "aggregateTable"), s(a, "pivotTable");
1098
+ })
1099
+ }
1100
+ ),
1101
+ /* @__PURE__ */ r(
1102
+ q,
1103
+ {
1104
+ label: "Cell wrap",
1105
+ value: p.components.table.cell.wrap,
1106
+ options: [
1107
+ ["nowrap", "No wrap"],
1108
+ ["wrap", "Wrap"]
1109
+ ],
1110
+ onChange: (o) => b((a) => {
1111
+ a.components.table.cell.wrap = o, s(a, "aggregateTable"), s(a, "pivotTable");
1112
+ })
1113
+ }
1114
+ )
1115
+ ] }),
1116
+ /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
1117
+ /* @__PURE__ */ r(
1118
+ v,
1119
+ {
1120
+ label: "Header",
1121
+ value: p.components.table.header.background,
1122
+ onChange: (o) => b((a) => {
1123
+ a.components.table.header.background = o, s(a, "aggregateTable"), s(a, "pivotTable");
1124
+ })
1125
+ }
1126
+ ),
1127
+ /* @__PURE__ */ r(
1128
+ v,
1129
+ {
1130
+ label: "Divider",
1131
+ value: p.components.table.row.dividerColor,
1132
+ onChange: (o) => b((a) => {
1133
+ a.components.table.row.dividerColor = o, a.components.table.header.dividerColor = o, s(a, "aggregateTable"), s(a, "pivotTable");
1134
+ })
1135
+ }
1136
+ )
1137
+ ] }),
1138
+ /* @__PURE__ */ r(
1139
+ Z,
1140
+ {
1141
+ label: "Zebra rows",
1142
+ checked: p.components.table.row.zebra,
1143
+ onCheckedChange: (o) => b((a) => {
1144
+ a.components.table.row.zebra = o, s(a, "aggregateTable"), s(a, "pivotTable");
1145
+ })
1146
+ }
1147
+ ),
1148
+ /* @__PURE__ */ r(
1149
+ Z,
1150
+ {
1151
+ label: "Sticky headers",
1152
+ checked: p.components.table.header.sticky,
1153
+ onCheckedChange: (o) => b((a) => {
1154
+ a.components.table.header.sticky = o, s(a, "aggregateTable"), s(a, "pivotTable");
1155
+ })
1156
+ }
1157
+ ),
1158
+ /* @__PURE__ */ r(
1159
+ Z,
1160
+ {
1161
+ label: "Uppercase headers",
1162
+ checked: p.components.table.header.uppercase,
1163
+ onCheckedChange: (o) => b((a) => {
1164
+ a.components.table.header.uppercase = o, s(a, "aggregateTable"), s(a, "pivotTable");
1165
+ })
1166
+ }
1167
+ )
1168
+ ]
1169
+ }
1170
+ )
1171
+ ] })
1172
+ ] })
1173
+ ] }) : null
1174
+ ]
1175
+ }
1176
+ );
1177
+ }
1178
+ function N({
1179
+ icon: e,
1180
+ title: n,
1181
+ description: t,
1182
+ children: u
1183
+ }) {
1184
+ return /* @__PURE__ */ d("section", { className: "mb-6 last:mb-0", children: [
1185
+ /* @__PURE__ */ d("div", { className: "mb-3 flex items-start gap-2", children: [
1186
+ /* @__PURE__ */ r("div", { className: "mt-0.5 flex h-5 w-5 items-center justify-center rounded-control border border-border/70", children: /* @__PURE__ */ r(e, { className: "h-3 w-3 text-muted-foreground" }) }),
1187
+ /* @__PURE__ */ d("div", { className: "min-w-0", children: [
1188
+ /* @__PURE__ */ r("h3", { className: "text-[13px] font-semibold", children: n }),
1189
+ /* @__PURE__ */ r("p", { className: "mt-0.5 text-[12px] leading-4 text-muted-foreground", children: t })
1190
+ ] })
1191
+ ] }),
1192
+ /* @__PURE__ */ r("div", { className: "space-y-2", children: u }),
1193
+ /* @__PURE__ */ r(Me, { className: "mt-5 bg-border/60" })
1194
+ ] });
1195
+ }
1196
+ function lr({
1197
+ value: e,
1198
+ onChange: n
1199
+ }) {
1200
+ var u;
1201
+ const t = (u = X.find((c) => c.value === e)) == null ? void 0 : u.id;
1202
+ return /* @__PURE__ */ d("div", { children: [
1203
+ /* @__PURE__ */ r(E, { className: "mb-1 block text-[11px] font-normal text-muted-foreground", children: "Font family" }),
1204
+ /* @__PURE__ */ d("div", { className: "grid grid-cols-[minmax(0,1fr)_150px] gap-2", children: [
1205
+ /* @__PURE__ */ d(
1206
+ he,
1207
+ {
1208
+ value: t,
1209
+ onValueChange: (c) => {
1210
+ const l = X.find(
1211
+ (i) => i.id === c
1212
+ );
1213
+ l && n(l.value);
1214
+ },
1215
+ children: [
1216
+ /* @__PURE__ */ r(xe, { size: "xs", "aria-label": "Font family preset", children: /* @__PURE__ */ r(ye, { placeholder: "Select font" }) }),
1217
+ /* @__PURE__ */ r(ke, { children: X.map((c) => /* @__PURE__ */ r(ve, { value: c.id, children: c.label }, c.id)) })
1218
+ ]
1219
+ }
1220
+ ),
1221
+ /* @__PURE__ */ r(
1222
+ "div",
1223
+ {
1224
+ className: "flex h-7 items-center rounded-control border border-border/60 bg-muted/30 px-2 text-[12px]",
1225
+ style: { fontFamily: e },
1226
+ children: "Aa 123"
1227
+ }
1228
+ )
1229
+ ] })
1230
+ ] });
1231
+ }
1232
+ function v({
1233
+ label: e,
1234
+ tooltip: n,
1235
+ value: t,
1236
+ onChange: u
1237
+ }) {
1238
+ const [c, l] = m.useState(!1), [i, k] = m.useState(t), y = sr(t), S = t !== i, f = (g) => {
1239
+ l(g), g && k(t);
1240
+ };
1241
+ return /* @__PURE__ */ d("div", { className: "block", children: [
1242
+ /* @__PURE__ */ d("div", { className: "mb-1 flex items-center gap-1", children: [
1243
+ /* @__PURE__ */ r(E, { className: "text-[11px] font-normal text-muted-foreground", children: e }),
1244
+ n ? /* @__PURE__ */ r(Q, { children: /* @__PURE__ */ d(ee, { children: [
1245
+ /* @__PURE__ */ r(re, { asChild: !0, children: /* @__PURE__ */ r(
1246
+ "button",
1247
+ {
1248
+ type: "button",
1249
+ "aria-label": `${e} details`,
1250
+ className: "inline-flex h-3.5 w-3.5 items-center justify-center rounded-control text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground",
1251
+ children: /* @__PURE__ */ r(me, { className: "h-3 w-3" })
1252
+ }
1253
+ ) }),
1254
+ /* @__PURE__ */ r(oe, { side: "top", className: "max-w-64", children: n })
1255
+ ] }) }) : null
1256
+ ] }),
1257
+ /* @__PURE__ */ d("div", { className: "flex h-7 items-center overflow-hidden rounded-control border border-input bg-background", children: [
1258
+ /* @__PURE__ */ d(ge, { open: c, onOpenChange: f, children: [
1259
+ /* @__PURE__ */ r(be, { asChild: !0, children: /* @__PURE__ */ r(
1260
+ "button",
1261
+ {
1262
+ type: "button",
1263
+ "aria-label": `Open ${e} color picker`,
1264
+ className: "ml-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-control border border-border/70",
1265
+ style: { backgroundColor: t },
1266
+ children: /* @__PURE__ */ r("span", { className: "sr-only", children: e })
1267
+ }
1268
+ ) }),
1269
+ /* @__PURE__ */ d(
1270
+ fe,
1271
+ {
1272
+ align: "start",
1273
+ sideOffset: 6,
1274
+ className: "z-[60] w-64 rounded-control p-2",
1275
+ children: [
1276
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
1277
+ /* @__PURE__ */ d(
1278
+ "label",
1279
+ {
1280
+ className: "relative flex h-16 w-16 shrink-0 cursor-pointer items-center justify-center overflow-hidden rounded-control border border-border/70",
1281
+ style: { backgroundColor: t },
1282
+ children: [
1283
+ /* @__PURE__ */ r(
1284
+ "input",
1285
+ {
1286
+ "aria-label": `${e} native color picker`,
1287
+ type: "color",
1288
+ value: y,
1289
+ onChange: (g) => u(g.target.value),
1290
+ className: "absolute inset-0 h-full w-full cursor-pointer opacity-0"
1291
+ }
1292
+ ),
1293
+ /* @__PURE__ */ r("span", { className: "rounded-control bg-black/45 p-1 text-white shadow-sm", children: /* @__PURE__ */ r(ar, { className: "h-3.5 w-3.5" }) })
1294
+ ]
1295
+ }
1296
+ ),
1297
+ /* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
1298
+ /* @__PURE__ */ d("div", { className: "mb-1 flex items-center justify-between gap-2", children: [
1299
+ /* @__PURE__ */ r(E, { className: "block text-[11px] font-normal text-muted-foreground", children: "Color value" }),
1300
+ /* @__PURE__ */ r(Q, { children: /* @__PURE__ */ d(ee, { children: [
1301
+ /* @__PURE__ */ r(re, { asChild: !0, children: /* @__PURE__ */ r(
1302
+ "button",
1303
+ {
1304
+ type: "button",
1305
+ "aria-label": `Reset ${e} color to previous value`,
1306
+ disabled: !S,
1307
+ className: "inline-flex h-5 w-5 items-center justify-center rounded-control text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-35",
1308
+ onClick: () => u(i),
1309
+ children: /* @__PURE__ */ r(Ce, { className: "h-3 w-3" })
1310
+ }
1311
+ ) }),
1312
+ /* @__PURE__ */ r(oe, { side: "top", children: "Reset to previous value" })
1313
+ ] }) })
1314
+ ] }),
1315
+ /* @__PURE__ */ r(
1316
+ ae,
1317
+ {
1318
+ size: "xs",
1319
+ "aria-label": `${e} popover color value`,
1320
+ value: t,
1321
+ onChange: (g) => u(g.target.value),
1322
+ className: "font-mono"
1323
+ }
1324
+ )
1325
+ ] })
1326
+ ] }),
1327
+ /* @__PURE__ */ r("div", { className: "mt-2 grid grid-cols-6 gap-1", children: cr.map((g) => /* @__PURE__ */ r(
1328
+ "button",
1329
+ {
1330
+ type: "button",
1331
+ "aria-label": `Set ${e} to ${g}`,
1332
+ className: K(
1333
+ "h-6 rounded-control border border-border/70 shadow-sm",
1334
+ t.toLowerCase() === g && "ring-2 ring-ring"
1335
+ ),
1336
+ style: { backgroundColor: g },
1337
+ onClick: () => u(g)
1338
+ },
1339
+ g
1340
+ )) })
1341
+ ]
1342
+ }
1343
+ )
1344
+ ] }),
1345
+ /* @__PURE__ */ r(
1346
+ ae,
1347
+ {
1348
+ size: "xs",
1349
+ "aria-label": `${e} color value`,
1350
+ value: t,
1351
+ onChange: (g) => u(g.target.value),
1352
+ className: "h-full border-0 px-2 font-mono shadow-none focus-visible:border-0"
1353
+ }
1354
+ )
1355
+ ] })
1356
+ ] });
1357
+ }
1358
+ function sr(e) {
1359
+ const n = Ze(e);
1360
+ return n ? `#${Y(n.r)}${Y(n.g)}${Y(n.b)}` : "#000000";
1361
+ }
1362
+ function Y(e) {
1363
+ return Math.round(e).toString(16).padStart(2, "0");
1364
+ }
1365
+ function w({
1366
+ label: e,
1367
+ tooltip: n,
1368
+ value: t,
1369
+ min: u,
1370
+ max: c,
1371
+ onChange: l
1372
+ }) {
1373
+ const i = m.useId();
1374
+ return /* @__PURE__ */ d("div", { className: "block", children: [
1375
+ /* @__PURE__ */ d("div", { className: "mb-1 flex items-center gap-1", children: [
1376
+ /* @__PURE__ */ r(
1377
+ E,
1378
+ {
1379
+ htmlFor: i,
1380
+ className: "text-[11px] font-normal text-muted-foreground",
1381
+ children: e
1382
+ }
1383
+ ),
1384
+ n ? /* @__PURE__ */ r(Q, { children: /* @__PURE__ */ d(ee, { children: [
1385
+ /* @__PURE__ */ r(re, { asChild: !0, children: /* @__PURE__ */ r(
1386
+ "button",
1387
+ {
1388
+ type: "button",
1389
+ "aria-label": `${e} details`,
1390
+ className: "inline-flex h-3.5 w-3.5 items-center justify-center rounded-control text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground",
1391
+ children: /* @__PURE__ */ r(me, { className: "h-3 w-3" })
1392
+ }
1393
+ ) }),
1394
+ /* @__PURE__ */ r(oe, { side: "top", className: "max-w-56", children: n })
1395
+ ] }) }) : null
1396
+ ] }),
1397
+ /* @__PURE__ */ r(
1398
+ ae,
1399
+ {
1400
+ id: i,
1401
+ size: "xs",
1402
+ type: "number",
1403
+ min: u,
1404
+ max: c,
1405
+ value: t,
1406
+ onChange: (k) => {
1407
+ const y = Number(k.target.value);
1408
+ Number.isNaN(y) || l(y);
1409
+ }
1410
+ }
1411
+ )
1412
+ ] });
1413
+ }
1414
+ function q({
1415
+ label: e,
1416
+ value: n,
1417
+ options: t,
1418
+ onChange: u
1419
+ }) {
1420
+ return /* @__PURE__ */ d("div", { children: [
1421
+ /* @__PURE__ */ r(E, { className: "mb-1 block text-[11px] font-normal text-muted-foreground", children: e }),
1422
+ /* @__PURE__ */ d(he, { value: n, onValueChange: u, children: [
1423
+ /* @__PURE__ */ r(xe, { size: "xs", children: /* @__PURE__ */ r(ye, {}) }),
1424
+ /* @__PURE__ */ r(ke, { children: t.map(([c, l]) => /* @__PURE__ */ r(ve, { value: c, children: l }, c)) })
1425
+ ] })
1426
+ ] });
1427
+ }
1428
+ function Z({
1429
+ label: e,
1430
+ checked: n,
1431
+ onCheckedChange: t
1432
+ }) {
1433
+ return /* @__PURE__ */ d("div", { className: "flex h-8 items-center justify-between rounded-control border border-border/60 px-2", children: [
1434
+ /* @__PURE__ */ r("span", { className: "text-[12px]", children: e }),
1435
+ /* @__PURE__ */ r(We, { size: "xs", checked: n, onCheckedChange: t })
1436
+ ] });
1437
+ }
1438
+ function ur(e) {
1439
+ const n = `${Number((e / 16).toFixed(4))}rem`;
1440
+ return {
1441
+ "--semaphor-radius": n,
1442
+ "--semaphor-control-radius": n
1443
+ };
1444
+ }
1445
+ function pr(e) {
1446
+ return JSON.parse(JSON.stringify(e));
1447
+ }
1448
+ function gr(e) {
1449
+ return typeof e.text == "function" ? e.text() : new Promise((n, t) => {
1450
+ const u = new FileReader();
1451
+ u.onload = () => n(String(u.result ?? "")), u.onerror = () => t(u.error ?? new Error("Unable to read file")), u.readAsText(e);
1452
+ });
1453
+ }
1454
+ export {
1455
+ Ne as BRAND_STUDIO_PRESETS,
1456
+ vr as BrandStudioEditor,
1457
+ nr as applyBrandStudioPreset,
1458
+ L as buildAppearanceSpecFromDraft,
1459
+ J as createBrandStudioDraft,
1460
+ s as mirrorTableAppearance
1461
+ };