react-semaphor 0.1.301 → 0.1.302

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 +1512 -0
  5. package/dist/chunks/{braces-BwK7fWd_.js → braces-CpOcaBNm.js} +1 -1
  6. package/dist/chunks/{braces-Bhqo4iW1.js → braces-TYclg8Hl.js} +1 -1
  7. package/dist/chunks/dashboard-controls-BkuB9TQX.js +47 -0
  8. package/dist/chunks/dashboard-controls-CZuC_QjN.js +2227 -0
  9. package/dist/chunks/dashboard-filter-controls-button-2I1ltWQ9.js +11 -0
  10. package/dist/chunks/{dashboard-filter-controls-button-DjALRkvg.js → dashboard-filter-controls-button-kfb_T18o.js} +205 -216
  11. package/dist/chunks/dashboard-json-C3v6rBdp.js +1 -0
  12. package/dist/chunks/{dashboard-json-D-zIG46N.js → dashboard-json-Df6v2Jem.js} +14 -12
  13. package/dist/chunks/dashboard-summary-settings-dialog-BBALEHJQ.js +1 -0
  14. package/dist/chunks/{dashboard-summary-settings-dialog-D-F1eEJI.js → dashboard-summary-settings-dialog-DKAaWq-G.js} +64 -63
  15. package/dist/chunks/date-formatter-D9Bvw5Qk.js +1 -0
  16. package/dist/chunks/date-formatter-DyIOb6uC.js +333 -0
  17. package/dist/chunks/edit-dashboard-visual-CGBYahAK.js +183 -0
  18. package/dist/chunks/{edit-dashboard-visual-BjflrL8w.js → edit-dashboard-visual-D8L0cl_U.js} +6691 -6679
  19. package/dist/chunks/{index-DDA12yqV.js → index-BmoR3VQT.js} +48608 -66300
  20. package/dist/chunks/index-Cxb9UUro.js +4 -0
  21. package/dist/chunks/index-D7KJindZ.js +1 -0
  22. package/dist/chunks/index-DFOb_6HB.js +1657 -0
  23. package/dist/chunks/index-eM6MU4q_.js +1361 -0
  24. package/dist/chunks/index-uRJmUpof.js +2555 -0
  25. package/dist/chunks/palette-326-dgn0.js +6 -0
  26. package/dist/chunks/palette-jd7xiGTg.js +23 -0
  27. package/dist/chunks/{resource-management-panel-B2558XA1.js → resource-management-panel-C_c-BwrC.js} +116 -115
  28. package/dist/chunks/resource-management-panel-DrcEEARD.js +6 -0
  29. package/dist/chunks/rotate-ccw-BugHcM1w.js +6 -0
  30. package/dist/chunks/rotate-ccw-yFwqBFJZ.js +14 -0
  31. package/dist/chunks/save-CaybXtdd.js +6 -0
  32. package/dist/chunks/save-DU0FXUlM.js +21 -0
  33. package/dist/chunks/switch-AmoR1YIA.js +163 -0
  34. package/dist/chunks/switch-CZtMtqEj.js +19725 -0
  35. package/dist/chunks/{use-create-flow-overlay-state-BUw_JtLs.js → use-create-flow-overlay-state-84Xe8VrP.js} +396 -412
  36. package/dist/chunks/use-create-flow-overlay-state-CiKVJGWF.js +16 -0
  37. package/dist/chunks/use-visual-utils-lp5DfmvL.js +1 -0
  38. package/dist/chunks/{use-visual-utils-C45OxsOf.js → use-visual-utils-z3ifg6Fd.js} +54 -53
  39. package/dist/dashboard/index.cjs +1 -1
  40. package/dist/dashboard/index.js +1 -1
  41. package/dist/format-utils/index.cjs +1 -1
  42. package/dist/format-utils/index.js +2 -2
  43. package/dist/index.cjs +1 -1
  44. package/dist/index.js +210 -207
  45. package/dist/style.css +1 -1
  46. package/dist/surfboard/index.cjs +1 -1
  47. package/dist/surfboard/index.js +2 -2
  48. package/dist/types/appearance.d.ts +176 -0
  49. package/dist/types/brand-studio.d.ts +245 -0
  50. package/dist/types/dashboard.d.ts +134 -0
  51. package/dist/types/main.d.ts +141 -1
  52. package/dist/types/surfboard.d.ts +134 -0
  53. package/dist/types/types.d.ts +139 -0
  54. package/package.json +13 -1
  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,1512 @@
1
+ import { jsxs as d, jsx as r, Fragment as se } from "react/jsx-runtime";
2
+ import m from "react";
3
+ import { c as $, a as Q, P as ge, b as fe, B as C, d as me, U as Je, C as De, f as le, X as je, p as ce, e as Le, T as Ue, q as $e, r as G, s as Ve, t as W, v as Me, w as _e, x as Ge, y as We, L as z, z as ee, A as re, D as ae, E as he, F as oe, I as U, g as ye, h as xe, i as ke, j as ve, k as Ce, S as He } from "../chunks/switch-CZtMtqEj.js";
4
+ import { r as Xe, v as Ye, A as qe, p as Ze } from "../chunks/index-uRJmUpof.js";
5
+ import { P as H } from "../chunks/palette-jd7xiGTg.js";
6
+ import { R as Ne } from "../chunks/rotate-ccw-yFwqBFJZ.js";
7
+ import { S as Ke } from "../chunks/save-DU0FXUlM.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 Qe = $("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 ue = $("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 er = $("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 rr = $("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
+ ]), Se = [
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 = Xe({
213
+ organizationAppearance: e ?? void 0
214
+ });
215
+ return or(O(n));
216
+ }
217
+ function L(e) {
218
+ const n = O({
219
+ version: qe,
220
+ mode: e.mode,
221
+ schemes: e.schemes
222
+ }), t = Ye(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 ar(e, n) {
232
+ const t = Se.find((s) => s.id === n);
233
+ if (!t)
234
+ return e;
235
+ const u = O(e);
236
+ return pe(u.schemes.light, t.light), pe(u.schemes.dark, t.dark), u;
237
+ }
238
+ function pe(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, c(e, "aggregateTable"), c(e, "pivotTable");
240
+ }
241
+ function c(e, n) {
242
+ e.components[n] = O(e.components.table);
243
+ }
244
+ function be(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, c(e, "aggregateTable"), c(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, c(e, "aggregateTable"), c(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, c(e, "aggregateTable"), c(e, "pivotTable");
260
+ break;
261
+ case "mutedForeground":
262
+ e.components.table.header.foreground = t, e.components.chart.axisColor = t, c(e, "aggregateTable"), c(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, c(e, "aggregateTable"), c(e, "pivotTable");
266
+ break;
267
+ case "accent":
268
+ e.components.table.row.hoverBackground = t, e.components.table.row.selectedBackground = t, c(e, "aggregateTable"), c(e, "pivotTable");
269
+ break;
270
+ }
271
+ }
272
+ function X(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, c(e, "aggregateTable"), c(e, "pivotTable");
282
+ break;
283
+ }
284
+ }
285
+ function or(e) {
286
+ var n, t;
287
+ for (const u of ["light", "dark"]) {
288
+ const s = e.schemes[u], l = s.tokens, i = l.color, k = (n = s.components) == null ? void 0 : n.aggregateTable, x = (t = s.components) == null ? void 0 : t.pivotTable, A = {
289
+ fontFamily: "",
290
+ headingFontFamily: "",
291
+ monoFontFamily: "",
292
+ baseFontSize: 14,
293
+ density: "comfortable"
294
+ };
295
+ l.typography = { ...A, ...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 b = {
304
+ dashboardPadding: 16,
305
+ gridGap: 12,
306
+ cardPadding: 16,
307
+ controlGap: 8,
308
+ tableCellX: 12,
309
+ tableCellY: 8
310
+ };
311
+ l.spacing = { ...b, ...l.spacing };
312
+ const w = {
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 = { ...w, ...l.shadow };
318
+ const T = {
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: P(i, l),
348
+ aggregateTable: P(i, l),
349
+ pivotTable: P(i, l),
350
+ pagination: {
351
+ background: i.card,
352
+ foreground: i.foreground,
353
+ borderColor: i.border,
354
+ borderRadius: l.radius.control
355
+ }
356
+ };
357
+ s.components = { ...T, ...s.components };
358
+ const V = {
359
+ palette: [],
360
+ background: i.card,
361
+ foreground: i.foreground,
362
+ gridColor: i.border,
363
+ axisColor: i.mutedForeground
364
+ };
365
+ s.components.chart = { ...V, ...s.components.chart }, s.components.table = {
366
+ ...P(i, l),
367
+ ...s.components.table
368
+ }, s.components.aggregateTable = k ? {
369
+ ...P(i, l),
370
+ ...k
371
+ } : O(s.components.table), s.components.pivotTable = x ? {
372
+ ...P(i, l),
373
+ ...x
374
+ } : O(s.components.table);
375
+ }
376
+ return e;
377
+ }
378
+ function P(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 O(e) {
428
+ return JSON.parse(JSON.stringify(e));
429
+ }
430
+ const nr = [
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
+ ], tr = [0, 1, 2, 3, 4, 5], Y = [
447
+ {
448
+ id: "semaphor",
449
+ label: "Semaphor / Inter",
450
+ value: 'Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
451
+ },
452
+ {
453
+ id: "system",
454
+ label: "System UI",
455
+ value: 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
456
+ },
457
+ {
458
+ id: "aptos",
459
+ label: "Aptos",
460
+ value: 'Aptos, "Segoe UI", ui-sans-serif, system-ui, sans-serif'
461
+ },
462
+ {
463
+ id: "ibm-plex-sans",
464
+ label: "IBM Plex Sans",
465
+ value: '"IBM Plex Sans", Inter, ui-sans-serif, system-ui, sans-serif'
466
+ },
467
+ {
468
+ id: "roboto",
469
+ label: "Roboto",
470
+ value: "Roboto, Arial, ui-sans-serif, system-ui, sans-serif"
471
+ },
472
+ {
473
+ id: "open-sans",
474
+ label: "Open Sans",
475
+ value: '"Open Sans", Arial, ui-sans-serif, system-ui, sans-serif'
476
+ },
477
+ {
478
+ id: "source-sans",
479
+ label: "Source Sans 3",
480
+ value: '"Source Sans 3", Arial, ui-sans-serif, system-ui, sans-serif'
481
+ },
482
+ {
483
+ id: "custom",
484
+ label: "Custom stack",
485
+ value: ""
486
+ }
487
+ ], dr = [
488
+ "#ffffff",
489
+ "#f8fafc",
490
+ "#f4f4f5",
491
+ "#e4e4e7",
492
+ "#18181b",
493
+ "#09090b",
494
+ "#2563eb",
495
+ "#0f766e",
496
+ "#047857",
497
+ "#d97706",
498
+ "#dc2626",
499
+ "#7c3aed"
500
+ ];
501
+ function xr({
502
+ appearance: e,
503
+ previewTitle: n,
504
+ isLoading: t = !1,
505
+ isSaving: u = !1,
506
+ error: s = null,
507
+ className: l,
508
+ onDraftChange: i,
509
+ onSave: k,
510
+ onClearConfig: x,
511
+ onCancel: A
512
+ }) {
513
+ const [f, b] = m.useState(null), [w, T] = m.useState("light"), [V, I] = m.useState(!1), [we, B] = m.useState(
514
+ "idle"
515
+ ), [ne, Te] = m.useState(!1), [E, M] = m.useState(""), [J, h] = m.useState(null), te = m.useRef(null), D = m.useRef(i), R = m.useRef(!1);
516
+ m.useEffect(() => {
517
+ D.current = i;
518
+ }, [i]), m.useEffect(() => {
519
+ if (e === void 0) {
520
+ R.current = !0, b(null);
521
+ return;
522
+ }
523
+ const a = j(e);
524
+ R.current = !0, b(a), T("light"), h(null);
525
+ }, [e]), m.useEffect(() => {
526
+ var a;
527
+ if (f) {
528
+ if (R.current) {
529
+ R.current = !1;
530
+ return;
531
+ }
532
+ try {
533
+ const o = L(f);
534
+ (a = D.current) == null || a.call(D, o), h(null);
535
+ } catch (o) {
536
+ h(
537
+ o instanceof Error ? o.message : "Appearance is invalid"
538
+ );
539
+ }
540
+ }
541
+ }, [f]);
542
+ const p = f == null ? void 0 : f.schemes[w], _ = u || V, Fe = m.useMemo(
543
+ () => p ? lr(p.tokens.radius.control) : void 0,
544
+ [p]
545
+ ), Pe = (a) => {
546
+ b((o) => {
547
+ if (!o) return o;
548
+ const y = cr(o);
549
+ return a(y), y;
550
+ });
551
+ }, g = (a) => {
552
+ Pe((o) => {
553
+ a(o.schemes[w]);
554
+ });
555
+ }, Oe = async () => {
556
+ if (!f || !k) return;
557
+ let a;
558
+ try {
559
+ a = L(f);
560
+ } catch (o) {
561
+ h(
562
+ o instanceof Error ? o.message : "Appearance is invalid"
563
+ );
564
+ return;
565
+ }
566
+ I(!0);
567
+ try {
568
+ await k(a);
569
+ } finally {
570
+ I(!1);
571
+ }
572
+ }, Ae = () => {
573
+ const a = j(null);
574
+ B("idle"), b(a);
575
+ }, Be = async () => {
576
+ if (x) {
577
+ I(!0), h(null), B("idle");
578
+ try {
579
+ await x(), R.current = !0, b(j(null)), T("light");
580
+ } catch (a) {
581
+ h(
582
+ a instanceof Error ? a.message : "Unable to clear organization appearance"
583
+ );
584
+ } finally {
585
+ I(!1);
586
+ }
587
+ }
588
+ }, de = m.useCallback(() => f ? JSON.stringify(L(f), null, 2) : "", [f]), Re = (a) => {
589
+ if (Te(a), a)
590
+ try {
591
+ M(de()), h(null);
592
+ } catch (o) {
593
+ h(
594
+ o instanceof Error ? o.message : "Appearance is invalid"
595
+ );
596
+ }
597
+ }, ze = async () => {
598
+ if (f)
599
+ try {
600
+ const a = ne && E ? E : de();
601
+ await navigator.clipboard.writeText(a), h(null), B("copied");
602
+ } catch (a) {
603
+ h(
604
+ a instanceof Error ? a.message : "Unable to copy appearance JSON"
605
+ );
606
+ }
607
+ }, ie = (a) => {
608
+ const o = JSON.parse(a), y = j(o), F = L(y);
609
+ B("idle"), T("light"), b(y), M(JSON.stringify(F, null, 2));
610
+ }, Ie = () => {
611
+ try {
612
+ ie(E);
613
+ } catch (a) {
614
+ h(
615
+ a instanceof Error ? a.message : "JSON must be a valid AppearanceSpec"
616
+ );
617
+ }
618
+ }, Ee = async (a) => {
619
+ var y;
620
+ const o = (y = a.target.files) == null ? void 0 : y[0];
621
+ if (a.target.value = "", !!o)
622
+ try {
623
+ ie(await ur(o));
624
+ } catch (F) {
625
+ h(
626
+ F instanceof Error ? F.message : "Uploaded file must be valid AppearanceSpec JSON"
627
+ );
628
+ }
629
+ };
630
+ return /* @__PURE__ */ d(
631
+ "div",
632
+ {
633
+ className: Q(
634
+ "flex min-h-0 flex-1 flex-col bg-background text-foreground",
635
+ l
636
+ ),
637
+ style: Fe,
638
+ children: [
639
+ /* @__PURE__ */ d("header", { className: "flex h-12 shrink-0 items-center gap-3 border-b border-border/60 px-4", children: [
640
+ /* @__PURE__ */ r("div", { className: "flex h-6 w-6 items-center justify-center rounded-control border border-border/70", children: /* @__PURE__ */ r(H, { className: "h-3.5 w-3.5" }) }),
641
+ /* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
642
+ /* @__PURE__ */ r("h2", { className: "truncate text-[13px] font-semibold", children: "Brand Studio" }),
643
+ /* @__PURE__ */ d("p", { className: "truncate text-[11px] text-muted-foreground", children: [
644
+ "Previewing ",
645
+ n || "current dashboard"
646
+ ] })
647
+ ] }),
648
+ /* @__PURE__ */ d(
649
+ ge,
650
+ {
651
+ open: ne,
652
+ onOpenChange: Re,
653
+ children: [
654
+ /* @__PURE__ */ r(fe, { asChild: !0, children: /* @__PURE__ */ d(C, { type: "button", size: "xs", variant: "ghost", disabled: !f, children: [
655
+ /* @__PURE__ */ r(ue, { className: "h-3.5 w-3.5" }),
656
+ "JSON"
657
+ ] }) }),
658
+ /* @__PURE__ */ d(
659
+ me,
660
+ {
661
+ align: "end",
662
+ sideOffset: 6,
663
+ className: "z-[60] w-[min(520px,calc(100vw-24px))] rounded-control p-2",
664
+ children: [
665
+ /* @__PURE__ */ d("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
666
+ /* @__PURE__ */ d("div", { className: "min-w-0", children: [
667
+ /* @__PURE__ */ r("div", { className: "text-[12px] font-medium", children: "AppearanceSpec JSON" }),
668
+ /* @__PURE__ */ r("div", { className: "text-[11px] text-muted-foreground", children: "Edit, apply, copy, or upload the active spec." })
669
+ ] }),
670
+ /* @__PURE__ */ d("div", { className: "flex shrink-0 items-center gap-1", children: [
671
+ /* @__PURE__ */ d(
672
+ C,
673
+ {
674
+ type: "button",
675
+ size: "xs",
676
+ variant: "ghost",
677
+ onClick: ze,
678
+ children: [
679
+ /* @__PURE__ */ r(ue, { className: "h-3.5 w-3.5" }),
680
+ we === "copied" ? "Copied" : "Copy"
681
+ ]
682
+ }
683
+ ),
684
+ /* @__PURE__ */ d(
685
+ C,
686
+ {
687
+ type: "button",
688
+ size: "xs",
689
+ variant: "ghost",
690
+ onClick: () => {
691
+ var a;
692
+ return (a = te.current) == null ? void 0 : a.click();
693
+ },
694
+ children: [
695
+ /* @__PURE__ */ r(Je, { className: "h-3.5 w-3.5" }),
696
+ "Upload"
697
+ ]
698
+ }
699
+ ),
700
+ /* @__PURE__ */ r(C, { type: "button", size: "xs", onClick: Ie, children: "Apply" })
701
+ ] })
702
+ ] }),
703
+ /* @__PURE__ */ r("div", { className: "h-[320px] overflow-hidden rounded-control border border-input", children: /* @__PURE__ */ r(
704
+ De,
705
+ {
706
+ ariaLabel: "AppearanceSpec JSON",
707
+ value: E,
708
+ onValueChange: (a) => {
709
+ M(a), B("idle");
710
+ },
711
+ language: "json",
712
+ embedded: !0,
713
+ hideLineNumbers: !0,
714
+ dense: !0
715
+ }
716
+ ) })
717
+ ]
718
+ }
719
+ )
720
+ ]
721
+ }
722
+ ),
723
+ /* @__PURE__ */ r(
724
+ "input",
725
+ {
726
+ ref: te,
727
+ "aria-label": "Upload AppearanceSpec JSON",
728
+ type: "file",
729
+ accept: "application/json,.json",
730
+ className: "sr-only",
731
+ onChange: Ee
732
+ }
733
+ ),
734
+ /* @__PURE__ */ d(
735
+ C,
736
+ {
737
+ type: "button",
738
+ size: "xs",
739
+ variant: "ghost",
740
+ onClick: Ae,
741
+ disabled: !f,
742
+ children: [
743
+ /* @__PURE__ */ r(Ne, { className: "h-3.5 w-3.5" }),
744
+ "Reset"
745
+ ]
746
+ }
747
+ ),
748
+ x && /* @__PURE__ */ d(
749
+ C,
750
+ {
751
+ type: "button",
752
+ size: "xs",
753
+ variant: "ghost",
754
+ onClick: Be,
755
+ disabled: _,
756
+ children: [
757
+ /* @__PURE__ */ r(Qe, { className: "h-3.5 w-3.5" }),
758
+ "No config"
759
+ ]
760
+ }
761
+ ),
762
+ /* @__PURE__ */ d(
763
+ C,
764
+ {
765
+ type: "button",
766
+ size: "xs",
767
+ onClick: Oe,
768
+ disabled: !f || _ || !!J || !k,
769
+ children: [
770
+ _ ? /* @__PURE__ */ r(le, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ r(Ke, { className: "h-3.5 w-3.5" }),
771
+ "Save"
772
+ ]
773
+ }
774
+ ),
775
+ /* @__PURE__ */ r(
776
+ "button",
777
+ {
778
+ type: "button",
779
+ "aria-label": "Close Brand Studio",
780
+ className: "flex h-7 w-7 items-center justify-center rounded-control text-muted-foreground hover:bg-muted hover:text-foreground",
781
+ onClick: A,
782
+ children: /* @__PURE__ */ r(je, { className: "h-3.5 w-3.5" })
783
+ }
784
+ )
785
+ ] }),
786
+ /* @__PURE__ */ d("div", { className: "flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-2", children: [
787
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2 text-[12px] text-muted-foreground", children: J ? /* @__PURE__ */ d(se, { children: [
788
+ /* @__PURE__ */ r(ce, { className: "h-3.5 w-3.5 text-destructive" }),
789
+ "Preview keeps the last valid draft"
790
+ ] }) : /* @__PURE__ */ d(se, { children: [
791
+ /* @__PURE__ */ r(Le, { className: "h-3.5 w-3.5 text-emerald-500" }),
792
+ "Draft is applied to the live dashboard preview"
793
+ ] }) }),
794
+ /* @__PURE__ */ r("div", { className: "inline-flex h-7 items-center overflow-hidden rounded-control border border-border/70", children: ["light", "dark"].map((a) => /* @__PURE__ */ r(
795
+ "button",
796
+ {
797
+ type: "button",
798
+ className: Q(
799
+ "h-full px-2.5 text-[12px] capitalize transition-colors",
800
+ w === a ? "bg-muted text-foreground" : "text-muted-foreground hover:text-foreground"
801
+ ),
802
+ onClick: () => T(a),
803
+ children: a
804
+ },
805
+ a
806
+ )) })
807
+ ] }),
808
+ J && /* @__PURE__ */ r("div", { className: "border-b border-destructive/20 bg-destructive/5 px-4 py-2 text-[12px] text-destructive", children: J }),
809
+ 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" }) }) : s ? /* @__PURE__ */ r("div", { className: "p-4 text-[13px] text-muted-foreground", children: s }) : f && p ? /* @__PURE__ */ d(Ue, { defaultValue: "style", className: "flex min-h-0 flex-1 flex-col", children: [
810
+ /* @__PURE__ */ r("div", { className: "shrink-0 px-4 pt-3", children: /* @__PURE__ */ d($e, { variant: "underline", className: "w-full gap-5", children: [
811
+ /* @__PURE__ */ r(G, { value: "style", children: "Style" }),
812
+ /* @__PURE__ */ r(G, { value: "surfaces", children: "Surfaces" }),
813
+ /* @__PURE__ */ r(G, { value: "data", children: "Data" })
814
+ ] }) }),
815
+ /* @__PURE__ */ d(Ve, { className: "min-h-0 flex-1", children: [
816
+ /* @__PURE__ */ d(W, { value: "style", className: "m-0 p-4", children: [
817
+ /* @__PURE__ */ r(
818
+ N,
819
+ {
820
+ icon: H,
821
+ title: "Presets",
822
+ description: "Start from a full light and dark appearance.",
823
+ children: /* @__PURE__ */ r("div", { className: "grid grid-cols-1 gap-2", children: Se.map((a) => /* @__PURE__ */ d(
824
+ "button",
825
+ {
826
+ type: "button",
827
+ className: "flex items-center gap-3 rounded-control border border-border/70 px-3 py-2 text-left hover:bg-muted/60",
828
+ onClick: () => {
829
+ const o = ar(f, a.id);
830
+ b(o);
831
+ },
832
+ children: [
833
+ /* @__PURE__ */ d("div", { className: "flex h-7 w-10 overflow-hidden rounded-control border border-border/70", children: [
834
+ /* @__PURE__ */ r(
835
+ "span",
836
+ {
837
+ className: "h-full flex-1",
838
+ style: { backgroundColor: a.primary }
839
+ }
840
+ ),
841
+ /* @__PURE__ */ r(
842
+ "span",
843
+ {
844
+ className: "h-full flex-1",
845
+ style: { backgroundColor: a.accent }
846
+ }
847
+ )
848
+ ] }),
849
+ /* @__PURE__ */ d("span", { className: "min-w-0 flex-1", children: [
850
+ /* @__PURE__ */ r("span", { className: "block text-[13px] font-medium", children: a.name }),
851
+ /* @__PURE__ */ r("span", { className: "block truncate text-[12px] text-muted-foreground", children: a.description })
852
+ ] })
853
+ ]
854
+ },
855
+ a.id
856
+ )) })
857
+ }
858
+ ),
859
+ /* @__PURE__ */ r(
860
+ N,
861
+ {
862
+ icon: H,
863
+ title: "Color",
864
+ description: `Editing the ${w} scheme.`,
865
+ children: /* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-2", children: nr.map(([a, o]) => /* @__PURE__ */ r(
866
+ v,
867
+ {
868
+ label: o,
869
+ value: p.tokens.color[a],
870
+ onChange: (y) => g((F) => {
871
+ be(F, a, y);
872
+ })
873
+ },
874
+ a
875
+ )) })
876
+ }
877
+ ),
878
+ /* @__PURE__ */ d(
879
+ N,
880
+ {
881
+ icon: Me,
882
+ title: "Typography",
883
+ description: "Fonts and density used by dashboard and workflow chrome.",
884
+ children: [
885
+ /* @__PURE__ */ r(
886
+ ir,
887
+ {
888
+ value: p.tokens.typography.fontFamily,
889
+ onChange: (a) => g((o) => {
890
+ o.tokens.typography.fontFamily = a, o.tokens.typography.headingFontFamily = a;
891
+ })
892
+ }
893
+ ),
894
+ /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
895
+ /* @__PURE__ */ r(
896
+ S,
897
+ {
898
+ label: "Base size",
899
+ value: p.tokens.typography.baseFontSize,
900
+ min: 11,
901
+ max: 18,
902
+ onChange: (a) => g((o) => {
903
+ o.tokens.typography.baseFontSize = a;
904
+ })
905
+ }
906
+ ),
907
+ /* @__PURE__ */ r(
908
+ Z,
909
+ {
910
+ label: "Density",
911
+ value: p.tokens.typography.density,
912
+ options: [
913
+ ["compact", "Compact"],
914
+ ["comfortable", "Comfortable"],
915
+ ["spacious", "Spacious"]
916
+ ],
917
+ onChange: (a) => g((o) => {
918
+ o.tokens.typography.density = a, o.components.table.density = o.tokens.typography.density, c(o, "aggregateTable"), c(o, "pivotTable");
919
+ })
920
+ }
921
+ )
922
+ ] })
923
+ ]
924
+ }
925
+ )
926
+ ] }),
927
+ /* @__PURE__ */ d(W, { value: "surfaces", className: "m-0 p-4", children: [
928
+ /* @__PURE__ */ d(
929
+ N,
930
+ {
931
+ icon: er,
932
+ title: "Layout",
933
+ description: "Canvas, grid, and card rhythm for embedded dashboards.",
934
+ children: [
935
+ /* @__PURE__ */ d("div", { className: "grid grid-cols-3 gap-2", children: [
936
+ /* @__PURE__ */ r(
937
+ S,
938
+ {
939
+ label: "Canvas pad",
940
+ tooltip: "Outer padding around the dashboard canvas before cards begin.",
941
+ value: p.tokens.spacing.dashboardPadding,
942
+ min: 0,
943
+ max: 48,
944
+ onChange: (a) => g((o) => {
945
+ o.tokens.spacing.dashboardPadding = a, o.components.dashboard.padding = a;
946
+ })
947
+ }
948
+ ),
949
+ /* @__PURE__ */ r(
950
+ S,
951
+ {
952
+ label: "Grid gap",
953
+ tooltip: "Spacing between dashboard cards in the grid.",
954
+ value: p.tokens.spacing.gridGap,
955
+ min: 0,
956
+ max: 32,
957
+ onChange: (a) => g((o) => {
958
+ o.tokens.spacing.gridGap = a;
959
+ })
960
+ }
961
+ ),
962
+ /* @__PURE__ */ r(
963
+ S,
964
+ {
965
+ label: "Card pad",
966
+ tooltip: "Inner padding inside card/widget frames around titles, controls, and visual content.",
967
+ value: p.tokens.spacing.cardPadding,
968
+ min: 0,
969
+ max: 32,
970
+ onChange: (a) => g((o) => {
971
+ o.tokens.spacing.cardPadding = a, o.components.card.padding = a;
972
+ })
973
+ }
974
+ )
975
+ ] }),
976
+ /* @__PURE__ */ d("div", { className: "grid grid-cols-3 gap-2", children: [
977
+ /* @__PURE__ */ r(
978
+ S,
979
+ {
980
+ label: "Control radius",
981
+ tooltip: "Corner radius for buttons, inputs, selects, checkboxes, segmented controls, and similar interactive controls.",
982
+ value: p.tokens.radius.control,
983
+ min: 0,
984
+ max: 12,
985
+ onChange: (a) => g((o) => {
986
+ X(o, "control", a);
987
+ })
988
+ }
989
+ ),
990
+ /* @__PURE__ */ r(
991
+ S,
992
+ {
993
+ label: "Card/widget radius",
994
+ tooltip: "Corner radius for dashboard card frames and widget containers.",
995
+ value: p.tokens.radius.card,
996
+ min: 0,
997
+ max: 12,
998
+ onChange: (a) => g((o) => {
999
+ X(o, "card", a);
1000
+ })
1001
+ }
1002
+ ),
1003
+ /* @__PURE__ */ r(
1004
+ S,
1005
+ {
1006
+ label: "Table radius",
1007
+ tooltip: "Corner radius for table containers, table chrome, and table pagination surfaces.",
1008
+ value: p.tokens.radius.table,
1009
+ min: 0,
1010
+ max: 12,
1011
+ onChange: (a) => g((o) => {
1012
+ X(o, "table", a);
1013
+ })
1014
+ }
1015
+ )
1016
+ ] })
1017
+ ]
1018
+ }
1019
+ ),
1020
+ /* @__PURE__ */ r(
1021
+ N,
1022
+ {
1023
+ icon: ce,
1024
+ title: "Filters and Controls",
1025
+ description: "Dashboard filter/control toolbar, chip states, menus, and settings panels.",
1026
+ children: /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
1027
+ /* @__PURE__ */ r(
1028
+ v,
1029
+ {
1030
+ label: "Toolbar background",
1031
+ tooltip: "Background color for the dashboard filter/control toolbar strip. This is separate from chip state colors.",
1032
+ value: p.components.interactive.toolbarBackground || p.tokens.color.background,
1033
+ onChange: (a) => g((o) => {
1034
+ o.components.interactive.toolbarBackground = a;
1035
+ })
1036
+ }
1037
+ ),
1038
+ /* @__PURE__ */ r(
1039
+ v,
1040
+ {
1041
+ label: "Default state",
1042
+ tooltip: "Unselected filter/control chips plus the base surface for their menus, dialogs, and pagination fallback.",
1043
+ value: p.components.interactive.background || p.tokens.color.card,
1044
+ onChange: (a) => g((o) => {
1045
+ o.components.interactive.background = a, o.components.pagination.background = a;
1046
+ })
1047
+ }
1048
+ ),
1049
+ /* @__PURE__ */ r(
1050
+ v,
1051
+ {
1052
+ label: "Border",
1053
+ tooltip: "Border color for filter/control chips, runtime inputs, settings panels, and related popover chrome.",
1054
+ value: p.components.interactive.borderColor || p.tokens.color.border,
1055
+ onChange: (a) => g((o) => {
1056
+ o.components.interactive.borderColor = a, o.components.pagination.borderColor = a;
1057
+ })
1058
+ }
1059
+ ),
1060
+ /* @__PURE__ */ r(
1061
+ v,
1062
+ {
1063
+ label: "Selected state",
1064
+ tooltip: "Selected filter/control chips and hover feedback. This keeps a lighter default state and a stronger selected state.",
1065
+ value: p.tokens.color.accent,
1066
+ onChange: (a) => g((o) => {
1067
+ be(o, "accent", a);
1068
+ })
1069
+ }
1070
+ )
1071
+ ] })
1072
+ }
1073
+ )
1074
+ ] }),
1075
+ /* @__PURE__ */ d(W, { value: "data", className: "m-0 p-4", children: [
1076
+ /* @__PURE__ */ d(
1077
+ N,
1078
+ {
1079
+ icon: _e,
1080
+ title: "Charts",
1081
+ description: "Palette and semantic chart text/grid colors.",
1082
+ children: [
1083
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-3 gap-2", children: tr.map((a) => /* @__PURE__ */ r(
1084
+ v,
1085
+ {
1086
+ label: `Series ${a + 1}`,
1087
+ value: p.components.chart.palette[a] || "#000000",
1088
+ onChange: (o) => g((y) => {
1089
+ y.components.chart.palette[a] = o;
1090
+ })
1091
+ },
1092
+ a
1093
+ )) }),
1094
+ /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
1095
+ /* @__PURE__ */ r(
1096
+ v,
1097
+ {
1098
+ label: "Grid",
1099
+ value: p.components.chart.gridColor,
1100
+ onChange: (a) => g((o) => {
1101
+ o.components.chart.gridColor = a;
1102
+ })
1103
+ }
1104
+ ),
1105
+ /* @__PURE__ */ r(
1106
+ v,
1107
+ {
1108
+ label: "Axis",
1109
+ value: p.components.chart.axisColor,
1110
+ onChange: (a) => g((o) => {
1111
+ o.components.chart.axisColor = a;
1112
+ })
1113
+ }
1114
+ )
1115
+ ] })
1116
+ ]
1117
+ }
1118
+ ),
1119
+ /* @__PURE__ */ d(
1120
+ N,
1121
+ {
1122
+ icon: Ge,
1123
+ title: "Tables",
1124
+ description: "Flat, aggregate, and pivot tables share this V1 table appearance.",
1125
+ children: [
1126
+ /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
1127
+ /* @__PURE__ */ r(
1128
+ Z,
1129
+ {
1130
+ label: "Density",
1131
+ value: p.components.table.density,
1132
+ options: [
1133
+ ["compact", "Compact"],
1134
+ ["comfortable", "Comfortable"],
1135
+ ["spacious", "Spacious"]
1136
+ ],
1137
+ onChange: (a) => g((o) => {
1138
+ o.components.table.density = a, c(o, "aggregateTable"), c(o, "pivotTable");
1139
+ })
1140
+ }
1141
+ ),
1142
+ /* @__PURE__ */ r(
1143
+ Z,
1144
+ {
1145
+ label: "Cell wrap",
1146
+ value: p.components.table.cell.wrap,
1147
+ options: [
1148
+ ["nowrap", "No wrap"],
1149
+ ["wrap", "Wrap"]
1150
+ ],
1151
+ onChange: (a) => g((o) => {
1152
+ o.components.table.cell.wrap = a, c(o, "aggregateTable"), c(o, "pivotTable");
1153
+ })
1154
+ }
1155
+ )
1156
+ ] }),
1157
+ /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
1158
+ /* @__PURE__ */ r(
1159
+ v,
1160
+ {
1161
+ label: "Header",
1162
+ value: p.components.table.header.background,
1163
+ onChange: (a) => g((o) => {
1164
+ o.components.table.header.background = a, c(o, "aggregateTable"), c(o, "pivotTable");
1165
+ })
1166
+ }
1167
+ ),
1168
+ /* @__PURE__ */ r(
1169
+ v,
1170
+ {
1171
+ label: "Divider",
1172
+ value: p.components.table.row.dividerColor,
1173
+ onChange: (a) => g((o) => {
1174
+ o.components.table.row.dividerColor = a, o.components.table.header.dividerColor = a, c(o, "aggregateTable"), c(o, "pivotTable");
1175
+ })
1176
+ }
1177
+ )
1178
+ ] }),
1179
+ /* @__PURE__ */ r(
1180
+ K,
1181
+ {
1182
+ label: "Zebra rows",
1183
+ checked: p.components.table.row.zebra,
1184
+ onCheckedChange: (a) => g((o) => {
1185
+ o.components.table.row.zebra = a, c(o, "aggregateTable"), c(o, "pivotTable");
1186
+ })
1187
+ }
1188
+ ),
1189
+ /* @__PURE__ */ r(
1190
+ K,
1191
+ {
1192
+ label: "Sticky headers",
1193
+ checked: p.components.table.header.sticky,
1194
+ onCheckedChange: (a) => g((o) => {
1195
+ o.components.table.header.sticky = a, c(o, "aggregateTable"), c(o, "pivotTable");
1196
+ })
1197
+ }
1198
+ ),
1199
+ /* @__PURE__ */ r(
1200
+ K,
1201
+ {
1202
+ label: "Uppercase headers",
1203
+ checked: p.components.table.header.uppercase,
1204
+ onCheckedChange: (a) => g((o) => {
1205
+ o.components.table.header.uppercase = a, c(o, "aggregateTable"), c(o, "pivotTable");
1206
+ })
1207
+ }
1208
+ )
1209
+ ]
1210
+ }
1211
+ )
1212
+ ] })
1213
+ ] })
1214
+ ] }) : null
1215
+ ]
1216
+ }
1217
+ );
1218
+ }
1219
+ function N({
1220
+ icon: e,
1221
+ title: n,
1222
+ description: t,
1223
+ children: u
1224
+ }) {
1225
+ return /* @__PURE__ */ d("section", { className: "mb-6 last:mb-0", children: [
1226
+ /* @__PURE__ */ d("div", { className: "mb-3 flex items-start gap-2", children: [
1227
+ /* @__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" }) }),
1228
+ /* @__PURE__ */ d("div", { className: "min-w-0", children: [
1229
+ /* @__PURE__ */ r("h3", { className: "text-[13px] font-semibold", children: n }),
1230
+ /* @__PURE__ */ r("p", { className: "mt-0.5 text-[12px] leading-4 text-muted-foreground", children: t })
1231
+ ] })
1232
+ ] }),
1233
+ /* @__PURE__ */ r("div", { className: "space-y-2", children: u }),
1234
+ /* @__PURE__ */ r(We, { className: "mt-5 bg-border/60" })
1235
+ ] });
1236
+ }
1237
+ function ir({
1238
+ value: e,
1239
+ onChange: n
1240
+ }) {
1241
+ var u;
1242
+ const t = ((u = Y.find((s) => s.value === e)) == null ? void 0 : u.id) ?? "custom";
1243
+ return /* @__PURE__ */ d("div", { children: [
1244
+ /* @__PURE__ */ r(z, { className: "mb-1 block text-[11px] font-normal text-muted-foreground", children: "Font family" }),
1245
+ /* @__PURE__ */ d("div", { className: "grid grid-cols-[minmax(0,1fr)_150px] gap-2", children: [
1246
+ /* @__PURE__ */ d(
1247
+ ye,
1248
+ {
1249
+ value: t,
1250
+ onValueChange: (s) => {
1251
+ const l = Y.find(
1252
+ (i) => i.id === s
1253
+ );
1254
+ !l || l.id === "custom" || n(l.value);
1255
+ },
1256
+ children: [
1257
+ /* @__PURE__ */ r(xe, { size: "xs", "aria-label": "Font family preset", children: /* @__PURE__ */ r(ke, {}) }),
1258
+ /* @__PURE__ */ r(ve, { children: Y.map((s) => /* @__PURE__ */ r(Ce, { value: s.id, children: s.label }, s.id)) })
1259
+ ]
1260
+ }
1261
+ ),
1262
+ /* @__PURE__ */ r(
1263
+ "div",
1264
+ {
1265
+ className: "flex h-7 items-center rounded-control border border-border/60 bg-muted/30 px-2 text-[12px]",
1266
+ style: { fontFamily: e },
1267
+ children: "Aa 123"
1268
+ }
1269
+ )
1270
+ ] }),
1271
+ /* @__PURE__ */ r(
1272
+ U,
1273
+ {
1274
+ size: "xs",
1275
+ "aria-label": "Custom font family",
1276
+ value: e,
1277
+ onChange: (s) => n(s.target.value),
1278
+ className: "mt-2 font-mono"
1279
+ }
1280
+ )
1281
+ ] });
1282
+ }
1283
+ function v({
1284
+ label: e,
1285
+ tooltip: n,
1286
+ value: t,
1287
+ onChange: u
1288
+ }) {
1289
+ const [s, l] = m.useState(!1), [i, k] = m.useState(t), x = sr(t), A = t !== i, f = (b) => {
1290
+ l(b), b && k(t);
1291
+ };
1292
+ return /* @__PURE__ */ d("div", { className: "block", children: [
1293
+ /* @__PURE__ */ d("div", { className: "mb-1 flex items-center gap-1", children: [
1294
+ /* @__PURE__ */ r(z, { className: "text-[11px] font-normal text-muted-foreground", children: e }),
1295
+ n ? /* @__PURE__ */ r(ee, { children: /* @__PURE__ */ d(re, { children: [
1296
+ /* @__PURE__ */ r(ae, { asChild: !0, children: /* @__PURE__ */ r(
1297
+ "button",
1298
+ {
1299
+ type: "button",
1300
+ "aria-label": `${e} details`,
1301
+ 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",
1302
+ children: /* @__PURE__ */ r(he, { className: "h-3 w-3" })
1303
+ }
1304
+ ) }),
1305
+ /* @__PURE__ */ r(oe, { side: "top", className: "max-w-64", children: n })
1306
+ ] }) }) : null
1307
+ ] }),
1308
+ /* @__PURE__ */ d("div", { className: "flex h-7 items-center overflow-hidden rounded-control border border-input bg-background", children: [
1309
+ /* @__PURE__ */ d(ge, { open: s, onOpenChange: f, children: [
1310
+ /* @__PURE__ */ r(fe, { asChild: !0, children: /* @__PURE__ */ r(
1311
+ "button",
1312
+ {
1313
+ type: "button",
1314
+ "aria-label": `Open ${e} color picker`,
1315
+ className: "ml-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-control border border-border/70",
1316
+ style: { backgroundColor: t },
1317
+ children: /* @__PURE__ */ r("span", { className: "sr-only", children: e })
1318
+ }
1319
+ ) }),
1320
+ /* @__PURE__ */ d(
1321
+ me,
1322
+ {
1323
+ align: "start",
1324
+ sideOffset: 6,
1325
+ className: "z-[60] w-64 rounded-control p-2",
1326
+ children: [
1327
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
1328
+ /* @__PURE__ */ d(
1329
+ "label",
1330
+ {
1331
+ className: "relative flex h-16 w-16 shrink-0 cursor-pointer items-center justify-center overflow-hidden rounded-control border border-border/70",
1332
+ style: { backgroundColor: t },
1333
+ children: [
1334
+ /* @__PURE__ */ r(
1335
+ "input",
1336
+ {
1337
+ "aria-label": `${e} native color picker`,
1338
+ type: "color",
1339
+ value: x,
1340
+ onChange: (b) => u(b.target.value),
1341
+ className: "absolute inset-0 h-full w-full cursor-pointer opacity-0"
1342
+ }
1343
+ ),
1344
+ /* @__PURE__ */ r("span", { className: "rounded-control bg-black/45 p-1 text-white shadow-sm", children: /* @__PURE__ */ r(rr, { className: "h-3.5 w-3.5" }) })
1345
+ ]
1346
+ }
1347
+ ),
1348
+ /* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
1349
+ /* @__PURE__ */ d("div", { className: "mb-1 flex items-center justify-between gap-2", children: [
1350
+ /* @__PURE__ */ r(z, { className: "block text-[11px] font-normal text-muted-foreground", children: "Color value" }),
1351
+ /* @__PURE__ */ r(ee, { children: /* @__PURE__ */ d(re, { children: [
1352
+ /* @__PURE__ */ r(ae, { asChild: !0, children: /* @__PURE__ */ r(
1353
+ "button",
1354
+ {
1355
+ type: "button",
1356
+ "aria-label": `Reset ${e} color to previous value`,
1357
+ disabled: !A,
1358
+ 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",
1359
+ onClick: () => u(i),
1360
+ children: /* @__PURE__ */ r(Ne, { className: "h-3 w-3" })
1361
+ }
1362
+ ) }),
1363
+ /* @__PURE__ */ r(oe, { side: "top", children: "Reset to previous value" })
1364
+ ] }) })
1365
+ ] }),
1366
+ /* @__PURE__ */ r(
1367
+ U,
1368
+ {
1369
+ size: "xs",
1370
+ "aria-label": `${e} popover color value`,
1371
+ value: t,
1372
+ onChange: (b) => u(b.target.value),
1373
+ className: "font-mono"
1374
+ }
1375
+ )
1376
+ ] })
1377
+ ] }),
1378
+ /* @__PURE__ */ r("div", { className: "mt-2 grid grid-cols-6 gap-1", children: dr.map((b) => /* @__PURE__ */ r(
1379
+ "button",
1380
+ {
1381
+ type: "button",
1382
+ "aria-label": `Set ${e} to ${b}`,
1383
+ className: Q(
1384
+ "h-6 rounded-control border border-border/70 shadow-sm",
1385
+ t.toLowerCase() === b && "ring-2 ring-ring"
1386
+ ),
1387
+ style: { backgroundColor: b },
1388
+ onClick: () => u(b)
1389
+ },
1390
+ b
1391
+ )) })
1392
+ ]
1393
+ }
1394
+ )
1395
+ ] }),
1396
+ /* @__PURE__ */ r(
1397
+ U,
1398
+ {
1399
+ size: "xs",
1400
+ "aria-label": `${e} color value`,
1401
+ value: t,
1402
+ onChange: (b) => u(b.target.value),
1403
+ className: "h-full border-0 px-2 font-mono shadow-none focus-visible:border-0"
1404
+ }
1405
+ )
1406
+ ] })
1407
+ ] });
1408
+ }
1409
+ function sr(e) {
1410
+ const n = Ze(e);
1411
+ return n ? `#${q(n.r)}${q(n.g)}${q(n.b)}` : "#000000";
1412
+ }
1413
+ function q(e) {
1414
+ return Math.round(e).toString(16).padStart(2, "0");
1415
+ }
1416
+ function S({
1417
+ label: e,
1418
+ tooltip: n,
1419
+ value: t,
1420
+ min: u,
1421
+ max: s,
1422
+ onChange: l
1423
+ }) {
1424
+ const i = m.useId();
1425
+ return /* @__PURE__ */ d("div", { className: "block", children: [
1426
+ /* @__PURE__ */ d("div", { className: "mb-1 flex items-center gap-1", children: [
1427
+ /* @__PURE__ */ r(
1428
+ z,
1429
+ {
1430
+ htmlFor: i,
1431
+ className: "text-[11px] font-normal text-muted-foreground",
1432
+ children: e
1433
+ }
1434
+ ),
1435
+ n ? /* @__PURE__ */ r(ee, { children: /* @__PURE__ */ d(re, { children: [
1436
+ /* @__PURE__ */ r(ae, { asChild: !0, children: /* @__PURE__ */ r(
1437
+ "button",
1438
+ {
1439
+ type: "button",
1440
+ "aria-label": `${e} details`,
1441
+ 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",
1442
+ children: /* @__PURE__ */ r(he, { className: "h-3 w-3" })
1443
+ }
1444
+ ) }),
1445
+ /* @__PURE__ */ r(oe, { side: "top", className: "max-w-56", children: n })
1446
+ ] }) }) : null
1447
+ ] }),
1448
+ /* @__PURE__ */ r(
1449
+ U,
1450
+ {
1451
+ id: i,
1452
+ size: "xs",
1453
+ type: "number",
1454
+ min: u,
1455
+ max: s,
1456
+ value: t,
1457
+ onChange: (k) => {
1458
+ const x = Number(k.target.value);
1459
+ Number.isNaN(x) || l(x);
1460
+ }
1461
+ }
1462
+ )
1463
+ ] });
1464
+ }
1465
+ function Z({
1466
+ label: e,
1467
+ value: n,
1468
+ options: t,
1469
+ onChange: u
1470
+ }) {
1471
+ return /* @__PURE__ */ d("div", { children: [
1472
+ /* @__PURE__ */ r(z, { className: "mb-1 block text-[11px] font-normal text-muted-foreground", children: e }),
1473
+ /* @__PURE__ */ d(ye, { value: n, onValueChange: u, children: [
1474
+ /* @__PURE__ */ r(xe, { size: "xs", children: /* @__PURE__ */ r(ke, {}) }),
1475
+ /* @__PURE__ */ r(ve, { children: t.map(([s, l]) => /* @__PURE__ */ r(Ce, { value: s, children: l }, s)) })
1476
+ ] })
1477
+ ] });
1478
+ }
1479
+ function K({
1480
+ label: e,
1481
+ checked: n,
1482
+ onCheckedChange: t
1483
+ }) {
1484
+ return /* @__PURE__ */ d("div", { className: "flex h-8 items-center justify-between rounded-control border border-border/60 px-2", children: [
1485
+ /* @__PURE__ */ r("span", { className: "text-[12px]", children: e }),
1486
+ /* @__PURE__ */ r(He, { size: "xs", checked: n, onCheckedChange: t })
1487
+ ] });
1488
+ }
1489
+ function lr(e) {
1490
+ const n = `${Number((e / 16).toFixed(4))}rem`;
1491
+ return {
1492
+ "--semaphor-radius": n,
1493
+ "--semaphor-control-radius": n
1494
+ };
1495
+ }
1496
+ function cr(e) {
1497
+ return JSON.parse(JSON.stringify(e));
1498
+ }
1499
+ function ur(e) {
1500
+ return typeof e.text == "function" ? e.text() : new Promise((n, t) => {
1501
+ const u = new FileReader();
1502
+ u.onload = () => n(String(u.result ?? "")), u.onerror = () => t(u.error ?? new Error("Unable to read file")), u.readAsText(e);
1503
+ });
1504
+ }
1505
+ export {
1506
+ Se as BRAND_STUDIO_PRESETS,
1507
+ xr as BrandStudioEditor,
1508
+ ar as applyBrandStudioPreset,
1509
+ L as buildAppearanceSpecFromDraft,
1510
+ j as createBrandStudioDraft,
1511
+ c as mirrorTableAppearance
1512
+ };