react-semaphor 0.1.375 → 0.1.377

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 (67) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +47 -43
  3. package/dist/brand-studio/index.cjs +4 -9
  4. package/dist/brand-studio/index.js +98 -108
  5. package/dist/chunks/{braces-C3-w6xDL.js → braces-C2uBgj3t.js} +1 -1
  6. package/dist/chunks/{braces-C8QqW4wu.js → braces-CkXyWzRh.js} +1 -1
  7. package/dist/chunks/{calendar-preferences-dialog-DXgi7q5u.js → calendar-preferences-dialog-C55VOTIy.js} +6 -5
  8. package/dist/chunks/calendar-preferences-dialog-DAukJOaP.js +1 -0
  9. package/dist/chunks/catalog-field-grounding-BGW0hnB9.js +1 -0
  10. package/dist/chunks/catalog-field-grounding-DHXEI7cW.js +199 -0
  11. package/dist/chunks/{chevrons-up-down-DSvLu4Ye.js → chevrons-up-down-BnzChFLU.js} +1 -1
  12. package/dist/chunks/{chevrons-up-down-CnCSGY02.js → chevrons-up-down-W0nzHzx0.js} +1 -1
  13. package/dist/chunks/{dashboard-briefing-launcher-Jwbmrcl_.js → dashboard-briefing-launcher-CUyeiL_T.js} +3141 -2372
  14. package/dist/chunks/dashboard-briefing-launcher-DMKfG_z3.js +111 -0
  15. package/dist/chunks/dashboard-controls-B4hxFc3Q.js +2279 -0
  16. package/dist/chunks/dashboard-controls-D4vI0wvU.js +52 -0
  17. package/dist/chunks/dashboard-json-DQnm6daE.js +1 -0
  18. package/dist/chunks/{dashboard-json-Cl1O3uh0.js → dashboard-json-pl1_mFqJ.js} +14 -13
  19. package/dist/chunks/{edit-dashboard-visual-B_0sbc43.js → edit-dashboard-visual-CF4aSsav.js} +4729 -4645
  20. package/dist/chunks/edit-dashboard-visual-CjTXY51a.js +178 -0
  21. package/dist/chunks/{index-BIks0ktd.js → index-B2kPleRS.js} +186 -181
  22. package/dist/chunks/{index-BSkBy5cH.js → index-Bn866BBY.js} +22824 -22664
  23. package/dist/chunks/layout-grid-BFmJ7vmH.js +16 -0
  24. package/dist/chunks/layout-grid-CTOW9oTg.js +6 -0
  25. package/dist/chunks/{palette-DUGktM-M.js → palette-DrhPeer-.js} +1 -1
  26. package/dist/chunks/{palette-D-f4-82S.js → palette-OFaniMPn.js} +1 -1
  27. package/dist/chunks/{save-D3YYinDz.js → save-BxWBiQv1.js} +1 -1
  28. package/dist/chunks/{save-kkBEBeLg.js → save-Dh6gSC4x.js} +1 -1
  29. package/dist/chunks/{switch-Dkx2qEOr.js → switch-C-fGjxjY.js} +2002 -1983
  30. package/dist/chunks/switch-D5xopzFD.js +168 -0
  31. package/dist/chunks/use-create-flow-overlay-state-Dg2ffpCE.js +21 -0
  32. package/dist/chunks/use-create-flow-overlay-state-DrKP0jWE.js +1968 -0
  33. package/dist/chunks/{validation-1V7bWmYw.js → validation-BHFaWDU-.js} +1 -1
  34. package/dist/chunks/{validation-DlrTIf1N.js → validation-bMedDBOo.js} +1 -1
  35. package/dist/dashboard/index.cjs +1 -1
  36. package/dist/dashboard/index.js +1 -1
  37. package/dist/dashboard-authoring/index.cjs +1 -1
  38. package/dist/dashboard-authoring/index.js +1 -1
  39. package/dist/data-app-builder/index.cjs +18 -13
  40. package/dist/data-app-builder/index.js +141 -131
  41. package/dist/data-app-sdk/index.cjs +1 -1
  42. package/dist/data-app-sdk/index.js +22 -21
  43. package/dist/data-app-sdk-validation/index.cjs +1 -1
  44. package/dist/data-app-sdk-validation/index.js +2 -2
  45. package/dist/index.cjs +1 -1
  46. package/dist/index.js +151 -151
  47. package/dist/style.css +1 -1
  48. package/dist/surfboard/index.cjs +1 -1
  49. package/dist/surfboard/index.js +2 -2
  50. package/dist/types/analytics-protocol.d.ts +84 -0
  51. package/dist/types/main.d.ts +8 -12
  52. package/package.json +1 -1
  53. package/dist/chunks/calendar-preferences-dialog-CsRzDpDs.js +0 -1
  54. package/dist/chunks/catalog-field-grounding-DoEBOXQd.js +0 -100
  55. package/dist/chunks/catalog-field-grounding-Du6mKDcF.js +0 -1
  56. package/dist/chunks/dashboard-briefing-launcher-C-G6vQTL.js +0 -106
  57. package/dist/chunks/dashboard-controls-DzGGNQxv.js +0 -2269
  58. package/dist/chunks/dashboard-controls-p7VKzWSb.js +0 -57
  59. package/dist/chunks/dashboard-json-CvPhMpbM.js +0 -1
  60. package/dist/chunks/edit-dashboard-visual-CSrdS10O.js +0 -178
  61. package/dist/chunks/resource-management-panel-IHbUOh2g.js +0 -6
  62. package/dist/chunks/resource-management-panel-tFjbtgPw.js +0 -1018
  63. package/dist/chunks/switch-fIkmwzUt.js +0 -168
  64. package/dist/chunks/use-create-flow-overlay-state-D-yGZTR3.js +0 -1647
  65. package/dist/chunks/use-create-flow-overlay-state-DbaUD5xc.js +0 -26
  66. package/dist/chunks/use-visual-utils-B5hwU_av.js +0 -1
  67. package/dist/chunks/use-visual-utils-Dj82r7DA.js +0 -340
@@ -1,1018 +0,0 @@
1
- import { jsx as e, jsxs as n, Fragment as oe } from "react/jsx-runtime";
2
- import { c as _e, u as se, G as ke, a as X, B as O, f as te, M as be, Q as Ge, L as ie, a1 as de, X as Ye, Y as qe, Z as Qe, _ as We, a0 as Xe, ay as Ze } from "./switch-Dkx2qEOr.js";
3
- import $e, { useState as b, useEffect as ee, useRef as Je } from "react";
4
- import { ah as ue, b7 as et, b8 as tt, ay as ce, b9 as nt, ba as at, bb as st, bc as it, bd as W, aD as ot, be as rt, bf as lt, bg as xe, aY as he, bh as dt, bi as ct, bj as we, bk as Ne, bl as ut, H as ye, z as Ce, bm as ve, ao as Se, ar as Ee, as as Ve, at as Le, au as Ae, av as Oe, aw as Te, ax as Re, bn as ht, bo as pe, bp as pt, x as ae, u as mt, bq as Ue, b as Ie, c as Me, d as ze, e as Pe, f as je, br as ft, n as Fe, bs as gt, aI as De, aB as xt } from "./index-BSkBy5cH.js";
5
- import "./index-CuHybtft.js";
6
- import { u as Be } from "./use-visual-utils-Dj82r7DA.js";
7
- /**
8
- * @license lucide-react v0.453.0 - ISC
9
- *
10
- * This source code is licensed under the ISC license.
11
- * See the LICENSE file in the root directory of this source tree.
12
- */
13
- const Dt = _e("FolderOpen", [
14
- [
15
- "path",
16
- {
17
- d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
18
- key: "usdka0"
19
- }
20
- ]
21
- ]);
22
- function Ke() {
23
- return /* @__PURE__ */ e("div", { className: "space-y-1.5 py-1", children: [...Array(5)].map((t, f) => /* @__PURE__ */ n(
24
- "div",
25
- {
26
- className: "flex animate-pulse items-start gap-3 rounded-xl border border-transparent px-2.5 py-2.5",
27
- children: [
28
- /* @__PURE__ */ e("div", { className: "mt-0.5 h-4 w-4 flex-shrink-0 rounded bg-muted/60" }),
29
- /* @__PURE__ */ n("div", { className: "flex-1 space-y-1.5", children: [
30
- /* @__PURE__ */ e("div", { className: "h-4 w-3/5 rounded bg-muted/60" }),
31
- /* @__PURE__ */ e("div", { className: "h-3 w-4/5 rounded bg-muted/40" })
32
- ] })
33
- ]
34
- },
35
- f
36
- )) });
37
- }
38
- const bt = (t) => {
39
- const f = se((o) => o.isVisualEditing), m = se((o) => o.selectedFrameId), r = ke((o) => o.frame);
40
- return !!(f && m && (r == null ? void 0 : r.visualId) === t);
41
- };
42
- function wt({
43
- visual: t,
44
- isDeleting: f,
45
- isDuplicating: m,
46
- onAddVisual: r,
47
- onOpenVisual: o,
48
- onEditDetails: h,
49
- onDeleteClick: x,
50
- onDuplicateVisual: i,
51
- onShareVisual: D,
52
- formatDate: w
53
- }) {
54
- var M, I, P, j;
55
- const { selectVisual: l } = ue(), c = et(t.id), p = bt(t.id), A = se((d) => d.isVisualEditing), { isConsoleMode: U } = tt(), N = $e.useRef(null), [S, E] = b(!1), [V, T] = b(!1);
56
- ee(() => {
57
- m ? (E(!0), T(!0)) : V && (E(!1), T(!1));
58
- }, [m, V]), ee(() => {
59
- p && N.current && N.current.scrollIntoView({
60
- behavior: "smooth",
61
- block: "center"
62
- });
63
- }, [p]);
64
- const C = () => {
65
- l(t), o == null || o(t);
66
- }, v = (d) => {
67
- d.currentTarget === d.target && (d.key === "Enter" || d.key === " ") && (d.preventDefault(), C());
68
- };
69
- return /* @__PURE__ */ n(
70
- "div",
71
- {
72
- ref: N,
73
- className: X(
74
- "group flex cursor-pointer items-start gap-1 rounded-[5px] px-2 py-1.5 transition-colors hover:bg-muted/50 focus-within:bg-muted/50",
75
- p ? "bg-muted ring-1 ring-inset ring-foreground/20" : c && "bg-muted"
76
- ),
77
- onClick: C,
78
- children: [
79
- /* @__PURE__ */ n(
80
- "div",
81
- {
82
- role: "button",
83
- tabIndex: 0,
84
- className: "min-w-0 flex-1 cursor-pointer focus-visible:outline-none",
85
- onKeyDown: v,
86
- children: [
87
- /* @__PURE__ */ e(
88
- "p",
89
- {
90
- className: "truncate text-[13px] font-medium leading-5 text-foreground",
91
- title: t.title || "Untitled Visual",
92
- children: t.title || "Untitled Visual"
93
- }
94
- ),
95
- /* @__PURE__ */ e(
96
- "p",
97
- {
98
- className: "truncate text-[11px] leading-4 text-muted-foreground",
99
- title: t.description || "No description",
100
- children: (M = t.description) != null && M.trim() ? t.description : "No description"
101
- }
102
- )
103
- ]
104
- }
105
- ),
106
- /* @__PURE__ */ e(
107
- "div",
108
- {
109
- className: X(
110
- "flex shrink-0 items-center transition-opacity",
111
- c || p || S ? "pointer-events-auto opacity-100" : "pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100"
112
- ),
113
- onClick: (d) => d.stopPropagation(),
114
- children: /* @__PURE__ */ n("div", { className: "inline-flex h-7 items-stretch overflow-hidden rounded-[5px] border border-border/60 bg-background", children: [
115
- /* @__PURE__ */ n(
116
- O,
117
- {
118
- size: "xs",
119
- variant: "ghost",
120
- className: "h-full rounded-none border-0 shadow-none hover:bg-accent/50",
121
- disabled: A,
122
- onClick: (d) => {
123
- d.stopPropagation(), r(t);
124
- },
125
- "aria-label": `Add ${t.title || "visual"}`,
126
- children: [
127
- /* @__PURE__ */ e(ce, { className: "h-3.5 w-3.5" }),
128
- "Add"
129
- ]
130
- }
131
- ),
132
- /* @__PURE__ */ n(
133
- nt,
134
- {
135
- modal: !1,
136
- open: S,
137
- onOpenChange: E,
138
- children: [
139
- /* @__PURE__ */ e(at, { asChild: !0, children: /* @__PURE__ */ e(
140
- O,
141
- {
142
- size: "xs",
143
- variant: "ghost",
144
- className: "h-full w-7 rounded-none border-0 border-l border-border/60 px-0 shadow-none hover:bg-accent/50",
145
- "aria-label": "Open visual actions",
146
- children: /* @__PURE__ */ e(st, { className: "h-3.5 w-3.5" })
147
- }
148
- ) }),
149
- /* @__PURE__ */ n(
150
- it,
151
- {
152
- align: "end",
153
- className: "z-[51] w-44 rounded-[6px] border border-border/60 p-1 shadow-sm",
154
- children: [
155
- /* @__PURE__ */ n(
156
- W,
157
- {
158
- onClick: (d) => {
159
- d.stopPropagation(), r(t);
160
- },
161
- disabled: A,
162
- children: [
163
- /* @__PURE__ */ e(ce, { className: "h-3.5 w-3.5" }),
164
- "Add"
165
- ]
166
- }
167
- ),
168
- /* @__PURE__ */ n(
169
- W,
170
- {
171
- onClick: (d) => {
172
- d.stopPropagation(), o == null || o(t);
173
- },
174
- children: [
175
- /* @__PURE__ */ e(Dt, { className: "h-3.5 w-3.5" }),
176
- "Open"
177
- ]
178
- }
179
- ),
180
- /* @__PURE__ */ n(
181
- W,
182
- {
183
- onClick: (d) => {
184
- d.preventDefault(), d.stopPropagation(), i(t.id);
185
- },
186
- disabled: m,
187
- children: [
188
- m ? /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(ot, { className: "h-3.5 w-3.5" }),
189
- m ? "Duplicating…" : "Duplicate"
190
- ]
191
- }
192
- ),
193
- t.ownership.isOwner && /* @__PURE__ */ n(oe, { children: [
194
- /* @__PURE__ */ n(
195
- W,
196
- {
197
- onClick: (d) => {
198
- d.stopPropagation(), h == null || h(t);
199
- },
200
- children: [
201
- /* @__PURE__ */ e(rt, { className: "h-3.5 w-3.5" }),
202
- "Edit details"
203
- ]
204
- }
205
- ),
206
- /* @__PURE__ */ n(
207
- W,
208
- {
209
- onClick: (d) => {
210
- d.stopPropagation(), D(t);
211
- },
212
- children: [
213
- /* @__PURE__ */ e(lt, { className: "h-3.5 w-3.5" }),
214
- "Share"
215
- ]
216
- }
217
- ),
218
- /* @__PURE__ */ e(xe, {}),
219
- /* @__PURE__ */ n(
220
- W,
221
- {
222
- onClick: (d) => {
223
- d.stopPropagation(), x(t);
224
- },
225
- className: "text-destructive focus:bg-destructive/10 focus:text-destructive",
226
- disabled: f,
227
- children: [
228
- /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5" }),
229
- f ? "Deleting…" : "Delete"
230
- ]
231
- }
232
- )
233
- ] }),
234
- /* @__PURE__ */ e(xe, {}),
235
- /* @__PURE__ */ n("div", { className: "space-y-1 px-2 py-1.5 text-[11px] text-muted-foreground", children: [
236
- (((I = t.ownership.createdBy) == null ? void 0 : I.type) === "tenant" || ((P = t.ownership.createdBy) == null ? void 0 : P.type) === "organization" && U) && /* @__PURE__ */ n("div", { className: "flex items-center gap-1.5", children: [
237
- /* @__PURE__ */ e(dt, { className: "h-3 w-3" }),
238
- /* @__PURE__ */ e("span", { children: ((j = t.ownership.createdBy) == null ? void 0 : j.name) || "Unknown" })
239
- ] }),
240
- /* @__PURE__ */ n("div", { className: "flex items-center gap-1.5", children: [
241
- /* @__PURE__ */ e(ct, { className: "h-3 w-3" }),
242
- /* @__PURE__ */ e("span", { children: w(t.lastModified) })
243
- ] })
244
- ] })
245
- ]
246
- }
247
- )
248
- ]
249
- }
250
- )
251
- ] })
252
- }
253
- )
254
- ]
255
- }
256
- );
257
- }
258
- function Nt({ searchQuery: t }) {
259
- const [f, m] = b(!1), [r, o] = b(
260
- null
261
- ), [h, x] = b(!1), [i, D] = b(null), [w, l] = b(null), [c, p] = b(
262
- null
263
- ), { handleEditLibraryVisual: A, handleAddLibraryVisual: U } = Be(), {
264
- resources: N,
265
- isLoading: S,
266
- isError: E,
267
- updateResource: V,
268
- deleteResource: T,
269
- duplicateResource: C,
270
- isDeleting: v
271
- } = we(() => {
272
- x(!1), D(null);
273
- }), M = N.filter(
274
- (s) => {
275
- var R, u;
276
- return ((R = s == null ? void 0 : s.title) == null ? void 0 : R.toLowerCase().includes(t.toLowerCase())) || ((u = s == null ? void 0 : s.description) == null ? void 0 : u.toLowerCase().includes(t.toLowerCase()));
277
- }
278
- ), I = (s) => new Date(s).toLocaleDateString("en-US", {
279
- month: "short",
280
- day: "numeric",
281
- year: "numeric"
282
- }), P = (s) => {
283
- D(s), x(!0);
284
- }, j = () => {
285
- i && T(i.id);
286
- }, {
287
- startUpdating: d,
288
- stopUpdating: G,
289
- isUpdating: B
290
- } = Ne(), L = (s, R, u) => {
291
- var ne;
292
- const F = Object.fromEntries(
293
- Object.entries(R).filter(([, z]) => z !== void 0)
294
- );
295
- if (Object.keys(F).length === 0) {
296
- (ne = u == null ? void 0 : u.onSuccess) == null || ne.call(u);
297
- return;
298
- }
299
- const y = Object.keys(F), H = y.length === 1 ? y[0] : void 0;
300
- d(s, H), V(
301
- {
302
- resourceId: s,
303
- data: F
304
- },
305
- {
306
- onSuccess: () => {
307
- var z;
308
- G(s, H), (z = u == null ? void 0 : u.onSuccess) == null || z.call(u);
309
- },
310
- onError: () => {
311
- var z;
312
- G(s, H), (z = u == null ? void 0 : u.onError) == null || z.call(u);
313
- }
314
- }
315
- );
316
- }, Y = (s) => {
317
- l(s), C(s, {
318
- onSettled: () => l(null)
319
- });
320
- }, K = (s) => {
321
- A(s);
322
- }, q = (s) => {
323
- U(s);
324
- }, Q = (s) => {
325
- o(s), m(!0);
326
- }, Z = (s) => {
327
- p(s);
328
- }, $ = () => {
329
- p(null);
330
- }, J = ({
331
- title: s,
332
- description: R
333
- }) => {
334
- if (!c)
335
- return;
336
- const u = {};
337
- s !== c.title && (u.title = s), (c.description || "") !== R && (u.description = R), L(c.id, u, {
338
- onSuccess: () => {
339
- p(null);
340
- }
341
- });
342
- };
343
- return S ? /* @__PURE__ */ e(Ke, {}) : E ? /* @__PURE__ */ e(be, { className: "w-full flex-1 pr-2", children: /* @__PURE__ */ n("div", { className: "flex flex-col items-center gap-1.5 px-4 py-10 text-center", children: [
344
- /* @__PURE__ */ e("p", { className: "text-[12px] text-destructive", children: "Failed to load visuals" }),
345
- /* @__PURE__ */ e(
346
- O,
347
- {
348
- variant: "outline",
349
- size: "xs",
350
- onClick: () => window.location.reload(),
351
- children: "Retry"
352
- }
353
- )
354
- ] }) }) : /* @__PURE__ */ n("div", { className: "flex h-full flex-1 flex-col", children: [
355
- /* @__PURE__ */ e("div", { className: "flex flex-1 basis-0 flex-col gap-0.5 overflow-y-auto", children: M.length === 0 ? /* @__PURE__ */ n("div", { className: "flex flex-col items-center gap-1.5 px-4 py-10 text-center", children: [
356
- /* @__PURE__ */ e(ut, { className: "h-5 w-5 text-muted-foreground/60" }),
357
- /* @__PURE__ */ e("h3", { className: "text-[13px] font-medium text-foreground", children: t ? "No visuals found" : "No visuals yet" }),
358
- /* @__PURE__ */ e("p", { className: "text-[12px] text-muted-foreground", children: t ? "Try adjusting your search." : 'Click "New" above to add your first visual.' })
359
- ] }) : M.map((s) => /* @__PURE__ */ e(
360
- wt,
361
- {
362
- visual: s,
363
- onAddVisual: q,
364
- onOpenVisual: K,
365
- onEditDetails: Z,
366
- onDeleteClick: P,
367
- onDuplicateVisual: Y,
368
- onShareVisual: Q,
369
- isDeleting: v,
370
- isDuplicating: w === s.id,
371
- formatDate: I
372
- },
373
- s.id
374
- )) }),
375
- f && r && /* @__PURE__ */ e(
376
- ye,
377
- {
378
- resource: r,
379
- resourceType: Ce.VISUAL,
380
- onClose: () => {
381
- m(!1), o(null);
382
- }
383
- }
384
- ),
385
- c && /* @__PURE__ */ e(
386
- ve,
387
- {
388
- open: !!c,
389
- resourceLabel: "Visual",
390
- initialTitle: c.title || "",
391
- initialDescription: c.description || "",
392
- onClose: $,
393
- onSave: J,
394
- isSaving: B(c.id)
395
- }
396
- ),
397
- /* @__PURE__ */ e(
398
- Se,
399
- {
400
- open: h,
401
- onOpenChange: (s) => {
402
- !s && v || (x(s), s || D(null));
403
- },
404
- children: /* @__PURE__ */ n(Ee, { children: [
405
- /* @__PURE__ */ n(Ve, { children: [
406
- /* @__PURE__ */ e(Le, { children: "Delete Visual" }),
407
- /* @__PURE__ */ n(Ae, { children: [
408
- 'Are you sure you want to delete "',
409
- i == null ? void 0 : i.title,
410
- '"? This action cannot be undone.'
411
- ] })
412
- ] }),
413
- /* @__PURE__ */ n(Oe, { children: [
414
- /* @__PURE__ */ e(Te, { disabled: v, children: "Cancel" }),
415
- /* @__PURE__ */ n(
416
- Re,
417
- {
418
- onClick: (s) => {
419
- s.preventDefault(), s.stopPropagation(), j();
420
- },
421
- disabled: v,
422
- children: [
423
- v ? /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5" }),
424
- v ? "Deleting…" : "Delete"
425
- ]
426
- }
427
- )
428
- ] })
429
- ] })
430
- }
431
- )
432
- ] });
433
- }
434
- function yt({
435
- dashboard: t,
436
- isDeleting: f,
437
- isDuplicating: m,
438
- onLoadDashboard: r,
439
- onEditDetails: o,
440
- onDeleteClick: h,
441
- onDuplicateDashboard: x,
442
- onShareDashboard: i,
443
- formatDate: D,
444
- onDashboardItemClick: w
445
- }) {
446
- var V, T;
447
- const { selectDashboard: l } = ue(), c = ht(t.id), { userContext: p, isLoading: A } = pe(), U = ((V = p == null ? void 0 : p.permissions) == null ? void 0 : V.canEdit) ?? !1, N = A || !U, S = () => {
448
- l(t), r(t.id), w == null || w(t.id);
449
- }, E = (C) => {
450
- C.currentTarget === C.target && (C.key === "Enter" || C.key === " ") && (C.preventDefault(), S());
451
- };
452
- return /* @__PURE__ */ n(
453
- "div",
454
- {
455
- className: X(
456
- "group flex cursor-pointer items-start gap-1 rounded-[5px] px-2 py-1.5 transition-colors hover:bg-muted/50 focus-within:bg-muted/50",
457
- c && "bg-muted"
458
- ),
459
- onClick: S,
460
- children: [
461
- /* @__PURE__ */ n(
462
- "div",
463
- {
464
- role: "button",
465
- tabIndex: 0,
466
- className: "min-w-0 flex-1 cursor-pointer focus-visible:outline-none",
467
- onKeyDown: E,
468
- children: [
469
- /* @__PURE__ */ e(
470
- "p",
471
- {
472
- className: "truncate text-[13px] font-medium leading-5 text-foreground",
473
- title: t.title || "Untitled Dashboard",
474
- children: t.title || "Untitled Dashboard"
475
- }
476
- ),
477
- /* @__PURE__ */ e(
478
- "p",
479
- {
480
- className: "truncate text-[11px] leading-4 text-muted-foreground",
481
- title: t.description || "No description",
482
- children: (T = t.description) != null && T.trim() ? t.description : "No description"
483
- }
484
- )
485
- ]
486
- }
487
- ),
488
- /* @__PURE__ */ e(
489
- "div",
490
- {
491
- className: X(
492
- "shrink-0 transition-opacity",
493
- c ? "opacity-100" : "opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"
494
- ),
495
- children: /* @__PURE__ */ e(
496
- pt,
497
- {
498
- dashboard: t,
499
- isDeleting: f,
500
- isDuplicating: m,
501
- shouldHideActions: N,
502
- onEditDetails: o,
503
- onDeleteClick: h,
504
- onDuplicateDashboard: x,
505
- onShareDashboard: i,
506
- formatDate: D
507
- }
508
- )
509
- }
510
- )
511
- ]
512
- }
513
- );
514
- }
515
- function Ct({ onRetry: t }) {
516
- return /* @__PURE__ */ e(be, { className: "w-full flex-1 pr-2", children: /* @__PURE__ */ n("div", { className: "rounded-xl border border-dashed border-border/60 bg-muted/20 px-4 py-8 text-center text-muted-foreground", children: [
517
- /* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: "Failed to load dashboards" }),
518
- /* @__PURE__ */ e(O, { variant: "outline", size: "sm", className: "mt-2", onClick: t, children: "Retry" })
519
- ] }) });
520
- }
521
- function vt(t) {
522
- var me;
523
- const { searchQuery: f, onLoadDashboard: m, onEditDashboard: r, onDashboardItemClick: o } = t, [h, x] = b(!1), [i, D] = b(
524
- null
525
- ), [w, l] = b(!1), [c, p] = b(null), [A, U] = b(null), [N, S] = b(null), E = ae(
526
- (a) => a.lastSelectedDashboard
527
- ), V = ae(
528
- (a) => a.selectedDashboard
529
- ), T = ae(
530
- (a) => a.actions.selectDashboard
531
- ), C = ae(
532
- (a) => a.actions.clearSelectedDashboard
533
- ), { tokenProps: v, id: M } = mt(), {
534
- resources: I,
535
- isLoading: P,
536
- isError: j,
537
- updateResource: d,
538
- deleteResource: G,
539
- duplicateResource: B,
540
- isDeleting: L
541
- } = Ue(() => {
542
- l(!1);
543
- const a = c == null ? void 0 : c.id;
544
- p(null), (V == null ? void 0 : V.id) === a && (!(v != null && v.dashboard_id) && !M ? C() : E && E.id !== a && T(E));
545
- }), { userContext: Y } = pe(), K = ((me = Y == null ? void 0 : Y.permissions) == null ? void 0 : me.canCreateDashboard) ?? !1, q = I.filter(
546
- (a) => {
547
- var _, g;
548
- return ((_ = a == null ? void 0 : a.title) == null ? void 0 : _.toLowerCase().includes(f.toLowerCase())) || ((g = a == null ? void 0 : a.description) == null ? void 0 : g.toLowerCase().includes(f.toLowerCase()));
549
- }
550
- ), Q = (a) => new Date(a).toLocaleDateString("en-US", {
551
- month: "short",
552
- day: "numeric",
553
- year: "numeric"
554
- }), Z = (a) => {
555
- m == null || m(a);
556
- }, $ = (a) => {
557
- p(a), l(!0);
558
- }, J = () => {
559
- c && G(c.id);
560
- }, s = (a) => {
561
- U(a), B(a, {
562
- onSettled: () => U(null)
563
- });
564
- }, {
565
- startUpdating: R,
566
- stopUpdating: u,
567
- isUpdating: F
568
- } = Ne(), y = (a, _, g) => {
569
- var ge;
570
- const re = Object.fromEntries(
571
- Object.entries(_).filter(([, k]) => k !== void 0)
572
- );
573
- if (Object.keys(re).length === 0) {
574
- (ge = g == null ? void 0 : g.onSuccess) == null || ge.call(g);
575
- return;
576
- }
577
- const fe = Object.keys(re), le = fe.length === 1 ? fe[0] : void 0;
578
- R(a, le), d(
579
- {
580
- resourceId: a,
581
- data: re
582
- },
583
- {
584
- onSuccess: () => {
585
- var k;
586
- u(a, le), (k = g == null ? void 0 : g.onSuccess) == null || k.call(g);
587
- },
588
- onError: () => {
589
- var k;
590
- u(a, le), (k = g == null ? void 0 : g.onError) == null || k.call(g);
591
- }
592
- }
593
- );
594
- }, H = (a) => {
595
- D(a), x(!0);
596
- }, ne = (a) => {
597
- r == null || r(a.id), S(a);
598
- }, z = () => {
599
- S(null);
600
- }, He = ({
601
- title: a,
602
- description: _
603
- }) => {
604
- if (!N)
605
- return;
606
- const g = {};
607
- a !== N.title && (g.title = a), (N.description || "") !== _ && (g.description = _), y(N.id, g, {
608
- onSuccess: () => {
609
- S(null);
610
- }
611
- });
612
- };
613
- return P ? /* @__PURE__ */ e(Ke, {}) : j ? /* @__PURE__ */ e(Ct, { onRetry: () => window.location.reload() }) : /* @__PURE__ */ n("div", { className: "flex h-full flex-1 flex-col", children: [
614
- /* @__PURE__ */ e("div", { className: "flex flex-1 basis-0 flex-col gap-0.5 overflow-y-auto", children: q.length === 0 ? /* @__PURE__ */ n("div", { className: "flex flex-col items-center gap-1.5 px-4 py-10 text-center", children: [
615
- /* @__PURE__ */ e(Ge, { className: "h-5 w-5 text-muted-foreground/60" }),
616
- /* @__PURE__ */ e("h3", { className: "text-[13px] font-medium text-foreground", children: f ? "No dashboards found" : "No dashboards yet" }),
617
- /* @__PURE__ */ e("p", { className: "text-[12px] text-muted-foreground", children: f ? "Try adjusting your search." : K ? 'Click "New" above to add your first dashboard.' : "No dashboards have been shared with you yet." })
618
- ] }) : q.map((a) => /* @__PURE__ */ e(
619
- yt,
620
- {
621
- dashboard: a,
622
- isDeleting: L,
623
- isDuplicating: A === a.id,
624
- onLoadDashboard: Z,
625
- onEditDetails: ne,
626
- onDeleteClick: $,
627
- onDuplicateDashboard: s,
628
- onShareDashboard: H,
629
- formatDate: Q,
630
- onDashboardItemClick: o
631
- },
632
- a.id
633
- )) }),
634
- h && i && /* @__PURE__ */ e(
635
- ye,
636
- {
637
- resource: i,
638
- resourceType: Ce.DASHBOARD,
639
- onClose: () => {
640
- x(!1), D(null);
641
- }
642
- }
643
- ),
644
- /* @__PURE__ */ e(
645
- Se,
646
- {
647
- open: w,
648
- onOpenChange: (a) => {
649
- !a && L || (l(a), a || p(null));
650
- },
651
- children: /* @__PURE__ */ n(Ee, { children: [
652
- /* @__PURE__ */ n(Ve, { children: [
653
- /* @__PURE__ */ e(Le, { children: "Delete Dashboard" }),
654
- /* @__PURE__ */ n(Ae, { children: [
655
- 'Are you sure you want to delete "',
656
- c == null ? void 0 : c.title,
657
- '"? This action cannot be undone.'
658
- ] })
659
- ] }),
660
- /* @__PURE__ */ n(Oe, { children: [
661
- /* @__PURE__ */ e(Te, { disabled: L, children: "Cancel" }),
662
- /* @__PURE__ */ n(
663
- Re,
664
- {
665
- onClick: (a) => {
666
- a.preventDefault(), a.stopPropagation(), J();
667
- },
668
- disabled: L,
669
- children: [
670
- L ? /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5" }),
671
- L ? "Deleting…" : "Delete"
672
- ]
673
- }
674
- )
675
- ] })
676
- ] })
677
- }
678
- ),
679
- N && /* @__PURE__ */ e(
680
- ve,
681
- {
682
- open: !!N,
683
- resourceLabel: "Dashboard",
684
- initialTitle: N.title || "",
685
- initialDescription: N.description || "",
686
- onClose: z,
687
- onSave: He,
688
- isSaving: F(N.id)
689
- }
690
- )
691
- ] });
692
- }
693
- function St(t, f = {}) {
694
- const { enabled: m = !0, eventType: r = "mousedown" } = f, o = Je(null);
695
- return ee(() => {
696
- const h = (x) => {
697
- const i = x.target;
698
- o.current && o.current.contains(i) || i instanceof Element && (i.closest("[data-radix-popper-content-wrapper]") || i.closest("[data-radix-select-content]") || i.closest("[data-radix-popover-content]") || i.closest("[data-radix-dropdown-menu-content]") || i.closest("[data-radix-tooltip-content]") || i.closest('[role="listbox"]') || i.closest('[role="option"]') || i.closest('[role="combobox"]')) || i instanceof Element && i.hasAttribute("data-radix-") || t();
699
- };
700
- return m && document.addEventListener(r, h), () => {
701
- document.removeEventListener(r, h);
702
- };
703
- }, [t, m, r]), o;
704
- }
705
- function Et({
706
- open: t,
707
- onOpenChange: f,
708
- onSubmit: m,
709
- isCreating: r
710
- }) {
711
- const [o, h] = b(""), [x, i] = b("");
712
- ee(() => {
713
- t || (h(""), i(""));
714
- }, [t]);
715
- const D = () => {
716
- o.trim() && m({ title: o, description: x });
717
- }, w = (l) => {
718
- f(l);
719
- };
720
- return /* @__PURE__ */ e(Ie, { open: t, onOpenChange: w, children: /* @__PURE__ */ n(Me, { className: "sm:max-w-[480px]", children: [
721
- /* @__PURE__ */ n(ze, { children: [
722
- /* @__PURE__ */ e(Pe, { className: "text-[15px]", children: "New dashboard" }),
723
- /* @__PURE__ */ e(je, { className: "text-[13px]", children: "Give it a name and an optional description." })
724
- ] }),
725
- /* @__PURE__ */ n("div", { className: "space-y-3", children: [
726
- /* @__PURE__ */ n("div", { className: "flex flex-col gap-1.5", children: [
727
- /* @__PURE__ */ e(ie, { htmlFor: "title", className: "text-[13px] font-medium", children: "Title" }),
728
- /* @__PURE__ */ e(
729
- de,
730
- {
731
- id: "title",
732
- size: "xs",
733
- placeholder: "e.g. Sales analytics, User engagement",
734
- value: o,
735
- onChange: (l) => h(l.target.value),
736
- disabled: r,
737
- onKeyDown: (l) => {
738
- l.key === "Enter" && !l.shiftKey && (l.preventDefault(), D());
739
- }
740
- }
741
- )
742
- ] }),
743
- /* @__PURE__ */ n("div", { className: "flex flex-col gap-1.5", children: [
744
- /* @__PURE__ */ e(ie, { htmlFor: "description", className: "text-[13px] font-medium", children: "Description" }),
745
- /* @__PURE__ */ e(
746
- ft,
747
- {
748
- id: "description",
749
- placeholder: "Optional — briefly describe what this dashboard tracks",
750
- rows: 3,
751
- value: x,
752
- onChange: (l) => i(l.target.value),
753
- disabled: r,
754
- className: "resize-none text-[12px]"
755
- }
756
- )
757
- ] })
758
- ] }),
759
- /* @__PURE__ */ n(Fe, { className: "gap-1.5", children: [
760
- /* @__PURE__ */ e(
761
- O,
762
- {
763
- type: "button",
764
- variant: "outline",
765
- size: "xs",
766
- onClick: () => w(!1),
767
- disabled: r,
768
- children: "Cancel"
769
- }
770
- ),
771
- /* @__PURE__ */ e(
772
- O,
773
- {
774
- type: "button",
775
- size: "xs",
776
- onClick: D,
777
- disabled: !o.trim() || r,
778
- children: r ? /* @__PURE__ */ n(oe, { children: [
779
- /* @__PURE__ */ e(te, { className: "h-3 w-3 animate-spin" }),
780
- "Creating…"
781
- ] }) : "Create dashboard"
782
- }
783
- )
784
- ] })
785
- ] }) });
786
- }
787
- function Vt({
788
- open: t,
789
- onOpenChange: f,
790
- onSubmit: m,
791
- isCreating: r
792
- }) {
793
- const [o, h] = b(""), [x, i] = b("");
794
- ee(() => {
795
- t || (h(""), i(""));
796
- }, [t]);
797
- const D = () => {
798
- o.trim() && m({ title: o, description: x });
799
- }, w = (l) => {
800
- f(l);
801
- };
802
- return /* @__PURE__ */ e(Ie, { open: t, onOpenChange: w, children: /* @__PURE__ */ n(Me, { children: [
803
- /* @__PURE__ */ n(ze, { children: [
804
- /* @__PURE__ */ e(Pe, { children: "Create New Visual" }),
805
- /* @__PURE__ */ e(je, { children: "Add a new visual to your library. You can configure it after creation." })
806
- ] }),
807
- /* @__PURE__ */ n("div", { className: "space-y-4 py-4", children: [
808
- /* @__PURE__ */ n("div", { className: "space-y-2", children: [
809
- /* @__PURE__ */ e(ie, { htmlFor: "title", children: "Visual Title" }),
810
- /* @__PURE__ */ e(
811
- de,
812
- {
813
- id: "title",
814
- placeholder: "Enter visual title...",
815
- value: o,
816
- onChange: (l) => h(l.target.value),
817
- disabled: r,
818
- onKeyDown: (l) => {
819
- l.key === "Enter" && !l.shiftKey && (l.preventDefault(), D());
820
- }
821
- }
822
- )
823
- ] }),
824
- /* @__PURE__ */ n("div", { className: "space-y-2", children: [
825
- /* @__PURE__ */ e(ie, { htmlFor: "description", children: "Description (optional)" }),
826
- /* @__PURE__ */ e(
827
- de,
828
- {
829
- id: "description",
830
- placeholder: "Enter visual description...",
831
- value: x,
832
- onChange: (l) => i(l.target.value),
833
- disabled: r
834
- }
835
- )
836
- ] })
837
- ] }),
838
- /* @__PURE__ */ n(Fe, { children: [
839
- /* @__PURE__ */ e(
840
- O,
841
- {
842
- variant: "outline",
843
- onClick: () => w(!1),
844
- disabled: r,
845
- children: "Cancel"
846
- }
847
- ),
848
- /* @__PURE__ */ e(
849
- O,
850
- {
851
- onClick: D,
852
- disabled: !o.trim() || r,
853
- children: r ? /* @__PURE__ */ n(oe, { children: [
854
- /* @__PURE__ */ e(te, { className: "mr-2 h-4 w-4 animate-spin" }),
855
- "Creating..."
856
- ] }) : "Create Visual"
857
- }
858
- )
859
- ] })
860
- ] }) });
861
- }
862
- function It({
863
- isOpen: t,
864
- onClose: f,
865
- className: m,
866
- onDashboardItemClick: r,
867
- variant: o = "inline"
868
- }) {
869
- var u, F;
870
- const h = se(
871
- (y) => y.isDashboardEditing
872
- ), [x, i] = b(!1), [D, w] = b(""), [l, c] = b(!1), { currentUser: p, userContext: A } = pe(), U = ((u = A == null ? void 0 : A.permissions) == null ? void 0 : u.canCreateDashboard) ?? !1, { onCreateSuccess: N } = gt({
873
- onDashboardSelect: r
874
- }), { selectVisual: S } = ue(), { handleEditLibraryVisual: E } = Be(), {
875
- createResource: V,
876
- isCreating: T,
877
- refetch: C
878
- } = Ue(), { createResource: v, isCreating: M } = we(
879
- void 0,
880
- // onDeleteSuccess (not needed here)
881
- (y) => {
882
- i(!1), y && (S(y), E(y));
883
- }
884
- ), I = o === "overlay", P = h ? "New Visual" : "New", j = h ? "New Visual" : "New Dashboard", d = h ? "Search visuals..." : "Search dashboards...", G = h ? "Collapse visuals panel" : "Collapse dashboard panel", B = ((p == null ? void 0 : p.name) ?? "").trim(), L = ((p == null ? void 0 : p.email) ?? "").trim(), K = B && B.toLowerCase() !== "undefined" ? B : L || "Current user", q = ((F = K.charAt(0)) == null ? void 0 : F.toUpperCase()) || "?", Q = L && L.toLowerCase() !== "undefined" ? L : "", Z = St(f, {
885
- enabled: t && I
886
- }), $ = X(
887
- "flex h-full flex-col border-r border-border/60 bg-background",
888
- I ? X(
889
- "absolute inset-y-0 left-0 z-[51] w-60 overflow-hidden shadow-lg transition-transform duration-300 ease-in-out",
890
- t ? "translate-x-0" : "pointer-events-none -translate-x-full"
891
- ) : "w-full max-w-[17rem] min-w-[11rem] overflow-hidden",
892
- m
893
- ), J = (y) => {
894
- }, s = (y) => {
895
- console.log("Editing dashboard:", y);
896
- }, R = (y) => {
897
- V(y, {
898
- onSuccess: (H) => {
899
- i(!1), N(H, C);
900
- }
901
- });
902
- };
903
- return /* @__PURE__ */ e(oe, { children: (!I || t) && /* @__PURE__ */ n("div", { ref: Z, className: $, children: [
904
- /* @__PURE__ */ e("div", { className: "border-b border-border/60 bg-background", children: l ? /* @__PURE__ */ n("div", { className: "flex h-10 items-center gap-1 px-3", children: [
905
- /* @__PURE__ */ e(De, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
906
- /* @__PURE__ */ e(
907
- "input",
908
- {
909
- autoFocus: !0,
910
- value: D,
911
- onChange: (y) => w(y.target.value),
912
- onKeyDown: (y) => {
913
- y.key === "Escape" && (w(""), c(!1));
914
- },
915
- placeholder: d,
916
- className: "h-7 min-w-0 flex-1 bg-transparent text-[13px] text-foreground placeholder:text-muted-foreground focus:outline-none",
917
- "aria-label": d
918
- }
919
- ),
920
- /* @__PURE__ */ e(
921
- O,
922
- {
923
- size: "xs",
924
- variant: "ghost",
925
- className: "w-7 shrink-0 px-0 text-muted-foreground hover:text-foreground",
926
- onClick: () => {
927
- w(""), c(!1);
928
- },
929
- "aria-label": "Close search",
930
- children: /* @__PURE__ */ e(Ye, { className: "h-3.5 w-3.5" })
931
- }
932
- )
933
- ] }) : /* @__PURE__ */ n("div", { className: "flex h-10 items-center justify-between gap-2 px-3", children: [
934
- /* @__PURE__ */ e("h2", { className: "whitespace-nowrap text-[13px] font-medium text-foreground", children: h ? "Visuals" : "Dashboards" }),
935
- /* @__PURE__ */ n("div", { className: "flex items-center gap-0.5", children: [
936
- /* @__PURE__ */ e(
937
- O,
938
- {
939
- size: "xs",
940
- variant: "ghost",
941
- onClick: () => c(!0),
942
- className: "w-7 px-0 text-muted-foreground hover:text-foreground",
943
- "aria-label": "Search",
944
- children: /* @__PURE__ */ e(De, { className: "h-3.5 w-3.5" })
945
- }
946
- ),
947
- (h || U) && /* @__PURE__ */ n(
948
- O,
949
- {
950
- size: "xs",
951
- variant: "outline",
952
- onClick: () => i(!0),
953
- "aria-label": j,
954
- children: [
955
- /* @__PURE__ */ e(ce, { className: "h-3.5 w-3.5" }),
956
- P
957
- ]
958
- }
959
- ),
960
- /* @__PURE__ */ e(
961
- O,
962
- {
963
- size: "xs",
964
- variant: "ghost",
965
- className: "w-7 px-0 text-muted-foreground hover:text-foreground",
966
- onClick: f,
967
- "aria-label": G,
968
- children: /* @__PURE__ */ e(xt, { className: "h-3.5 w-3.5" })
969
- }
970
- )
971
- ] })
972
- ] }) }),
973
- /* @__PURE__ */ e("div", { className: "flex flex-1 flex-col overflow-auto px-1.5 py-2", children: h ? /* @__PURE__ */ e(Nt, { searchQuery: D }) : /* @__PURE__ */ e(
974
- vt,
975
- {
976
- searchQuery: D,
977
- onLoadDashboard: J,
978
- onEditDashboard: s,
979
- onDashboardItemClick: r
980
- }
981
- ) }),
982
- p && /* @__PURE__ */ e(qe, { children: /* @__PURE__ */ e("div", { className: "border-t border-border/60 px-3 py-2", children: /* @__PURE__ */ n(Qe, { children: [
983
- /* @__PURE__ */ e(We, { asChild: !0, children: /* @__PURE__ */ n("div", { className: "flex cursor-default items-center gap-2", children: [
984
- /* @__PURE__ */ e("div", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-muted text-[10px] font-medium text-muted-foreground", children: q }),
985
- /* @__PURE__ */ e("span", { className: "truncate text-[12px] text-muted-foreground", children: K })
986
- ] }) }),
987
- /* @__PURE__ */ e(Xe, { side: "top", className: "max-w-xs", children: /* @__PURE__ */ n("div", { className: "space-y-0.5", children: [
988
- /* @__PURE__ */ e("div", { className: "font-medium", children: K }),
989
- Q && /* @__PURE__ */ e("div", { className: "text-[11px] opacity-80", children: Q }),
990
- p.role && /* @__PURE__ */ n("div", { className: "text-[11px] opacity-80", children: [
991
- "Role:",
992
- " ",
993
- Ze(p.role.replace(/_/g, " "))
994
- ] })
995
- ] }) })
996
- ] }) }) }),
997
- h ? /* @__PURE__ */ e(
998
- Vt,
999
- {
1000
- open: x,
1001
- onOpenChange: i,
1002
- onSubmit: v,
1003
- isCreating: M
1004
- }
1005
- ) : /* @__PURE__ */ e(
1006
- Et,
1007
- {
1008
- open: x,
1009
- onOpenChange: i,
1010
- onSubmit: R,
1011
- isCreating: T
1012
- }
1013
- )
1014
- ] }) });
1015
- }
1016
- export {
1017
- It as ResourceManagementPanel
1018
- };