react-semaphor 0.1.306 → 0.1.308
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.
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +4 -4
- package/dist/chunks/{braces-CuiOenEA.js → braces-BHDm9arh.js} +1 -1
- package/dist/chunks/{braces-DZxcgUvn.js → braces-DEq8EJtw.js} +1 -1
- package/dist/chunks/chevrons-up-down-Cbtggnqv.js +14 -0
- package/dist/chunks/chevrons-up-down-DDEY9beZ.js +6 -0
- package/dist/chunks/{dashboard-controls-CuQH4inS.js → dashboard-controls-DTxSUWvy.js} +279 -257
- package/dist/chunks/dashboard-controls-DviftQE7.js +57 -0
- package/dist/chunks/dashboard-filter-controls-button-D0nrJ7wl.js +11 -0
- package/dist/chunks/{dashboard-filter-controls-button-NiAIAD1P.js → dashboard-filter-controls-button-DHKfgPah.js} +304 -303
- package/dist/chunks/{dashboard-json-Bk13vadr.js → dashboard-json-DYzZ0G6T.js} +1 -1
- package/dist/chunks/{dashboard-json-DzVn9KAU.js → dashboard-json-DZmsUV5n.js} +2 -2
- package/dist/chunks/dashboard-summary-settings-dialog-Cc3yKCu4.js +1 -0
- package/dist/chunks/{dashboard-summary-settings-dialog-dt20G_7d.js → dashboard-summary-settings-dialog-QbUTp92u.js} +33 -32
- package/dist/chunks/{edit-dashboard-visual-DGhTFzSF.js → edit-dashboard-visual-BS3LKMJe.js} +32 -32
- package/dist/chunks/{edit-dashboard-visual-BIuWXuCC.js → edit-dashboard-visual-CmgculGv.js} +130 -129
- package/dist/chunks/{index-DQApwxKL.js → index-BxYIELMe.js} +62029 -63833
- package/dist/chunks/index-C0zD3JgK.js +1330 -0
- package/dist/chunks/{palette-DFjOzeAG.js → palette-CNKSAIrt.js} +1 -1
- package/dist/chunks/{palette-BwGE32UR.js → palette-CteErylX.js} +1 -1
- package/dist/chunks/{resource-management-panel-CD_TQoTn.js → resource-management-panel-8cHoj8SV.js} +52 -52
- package/dist/chunks/resource-management-panel-B4QM3fZ_.js +6 -0
- package/dist/chunks/{save-QktcpXPy.js → save-B1-nDZwS.js} +1 -1
- package/dist/chunks/{save-B3tqymYm.js → save-BVVnWGeb.js} +1 -1
- package/dist/chunks/{switch-B72T1Hf_.js → switch-BG4RWnrq.js} +2 -2
- package/dist/chunks/{switch-BuZXNXQV.js → switch-BZn7R_Cp.js} +634 -634
- package/dist/chunks/{use-create-flow-overlay-state-iUCs5ZgT.js → use-create-flow-overlay-state-Bmb471Fp.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-Bg-LkLP7.js → use-create-flow-overlay-state-CeWstFjy.js} +49 -49
- package/dist/chunks/{use-visual-utils-D_2r0Fmm.js → use-visual-utils-CmfDomt0.js} +2 -2
- package/dist/chunks/{use-visual-utils-DqVxN0_F.js → use-visual-utils-DflfgX9g.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +76 -76
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/main.d.ts +10 -4
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-BpgZjEDy.js +0 -47
- package/dist/chunks/dashboard-filter-controls-button-Bu90ytxy.js +0 -11
- package/dist/chunks/dashboard-summary-settings-dialog-8vZtKUjh.js +0 -1
- package/dist/chunks/index-CwzM5Lxh.js +0 -1360
- package/dist/chunks/resource-management-panel-BqJAVm7E.js +0 -6
package/dist/chunks/{resource-management-panel-CD_TQoTn.js → resource-management-panel-8cHoj8SV.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as e, jsxs as n, Fragment as le } from "react/jsx-runtime";
|
|
2
|
-
import { c as Fe, u as ne, n as je, a as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { u as Ie } from "./use-visual-utils-
|
|
2
|
+
import { c as Fe, u as ne, n as je, a as W, B as I, f as se, s as be, w as ze, L as fe, I as ge, X as Be, z as He, A as Ke, D as _e, F as Ge, aE as Xe } from "./switch-BZn7R_Cp.js";
|
|
3
|
+
import $e, { useState as b, useEffect as ae, useRef as qe } from "react";
|
|
4
|
+
import { t as de, bn as Je, bo as Qe, bk as ie, bp as We, bq as Ye, br as Ze, bs as ke, bt as Q, bu as et, bv as tt, bw as nt, bx as xe, bb as ce, by as at, bz as st, bA as we, bB as Ne, bC as ot, $ as ye, X as Ce, bD as ve, bE as Se, bF as Ee, bG as Ve, bH as Le, bI as Ae, bJ as Oe, bK as Re, bL as Te, bM as rt, bN as ue, bO as it, V as te, u as lt, bP as Ue, b as dt, c as ct, d as ut, e as ht, f as pt, n as mt, bQ as ft, bR as De, bS as gt, bT as xt } from "./index-BxYIELMe.js";
|
|
5
|
+
import { u as Ie } from "./use-visual-utils-CmfDomt0.js";
|
|
6
6
|
/**
|
|
7
7
|
* @license lucide-react v0.453.0 - ISC
|
|
8
8
|
*
|
|
@@ -18,18 +18,6 @@ const Dt = Fe("FolderOpen", [
|
|
|
18
18
|
}
|
|
19
19
|
]
|
|
20
20
|
]);
|
|
21
|
-
function bt(t, m = {}) {
|
|
22
|
-
const { enabled: p = !0, eventType: l = "mousedown" } = m, i = qe(null);
|
|
23
|
-
return ae(() => {
|
|
24
|
-
const h = (w) => {
|
|
25
|
-
const o = w.target;
|
|
26
|
-
i.current && i.current.contains(o) || o instanceof Element && (o.closest("[data-radix-popper-content-wrapper]") || o.closest("[data-radix-select-content]") || o.closest("[data-radix-popover-content]") || o.closest("[data-radix-dropdown-menu-content]") || o.closest("[data-radix-tooltip-content]") || o.closest('[role="listbox"]') || o.closest('[role="option"]') || o.closest('[role="combobox"]')) || o instanceof Element && o.hasAttribute("data-radix-") || t();
|
|
27
|
-
};
|
|
28
|
-
return p && document.addEventListener(l, h), () => {
|
|
29
|
-
document.removeEventListener(l, h);
|
|
30
|
-
};
|
|
31
|
-
}, [t, p, l]), i;
|
|
32
|
-
}
|
|
33
21
|
function Me() {
|
|
34
22
|
return /* @__PURE__ */ e("div", { className: "space-y-1.5 py-1", children: [...Array(5)].map((t, m) => /* @__PURE__ */ n(
|
|
35
23
|
"div",
|
|
@@ -46,11 +34,11 @@ function Me() {
|
|
|
46
34
|
m
|
|
47
35
|
)) });
|
|
48
36
|
}
|
|
49
|
-
const
|
|
37
|
+
const bt = (t) => {
|
|
50
38
|
const m = ne((i) => i.isVisualEditing), p = ne((i) => i.selectedFrameId), l = je((i) => i.frame);
|
|
51
39
|
return !!(m && p && (l == null ? void 0 : l.visualId) === t);
|
|
52
40
|
};
|
|
53
|
-
function
|
|
41
|
+
function wt({
|
|
54
42
|
visual: t,
|
|
55
43
|
isDeleting: m,
|
|
56
44
|
isDuplicating: p,
|
|
@@ -63,7 +51,7 @@ function Nt({
|
|
|
63
51
|
formatDate: y
|
|
64
52
|
}) {
|
|
65
53
|
var M, U, F, j;
|
|
66
|
-
const { selectVisual: f } = de(), d = Je(t.id), u =
|
|
54
|
+
const { selectVisual: f } = de(), d = Je(t.id), u = bt(t.id), A = ne((r) => r.isVisualEditing), { isConsoleMode: T } = Qe(), x = $e.useRef(null), [S, E] = b(!1), [V, O] = b(!1);
|
|
67
55
|
ae(() => {
|
|
68
56
|
p ? (E(!0), O(!0)) : V && (E(!1), O(!1));
|
|
69
57
|
}, [p, V]), ae(() => {
|
|
@@ -81,7 +69,7 @@ function Nt({
|
|
|
81
69
|
"div",
|
|
82
70
|
{
|
|
83
71
|
ref: x,
|
|
84
|
-
className:
|
|
72
|
+
className: W(
|
|
85
73
|
"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",
|
|
86
74
|
u ? "bg-muted ring-1 ring-inset ring-foreground/20" : d && "bg-muted"
|
|
87
75
|
),
|
|
@@ -117,7 +105,7 @@ function Nt({
|
|
|
117
105
|
/* @__PURE__ */ e(
|
|
118
106
|
"div",
|
|
119
107
|
{
|
|
120
|
-
className:
|
|
108
|
+
className: W(
|
|
121
109
|
"flex shrink-0 items-center transition-opacity",
|
|
122
110
|
d || u || 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"
|
|
123
111
|
),
|
|
@@ -141,13 +129,13 @@ function Nt({
|
|
|
141
129
|
}
|
|
142
130
|
),
|
|
143
131
|
/* @__PURE__ */ n(
|
|
144
|
-
|
|
132
|
+
We,
|
|
145
133
|
{
|
|
146
134
|
modal: !1,
|
|
147
135
|
open: S,
|
|
148
136
|
onOpenChange: E,
|
|
149
137
|
children: [
|
|
150
|
-
/* @__PURE__ */ e(
|
|
138
|
+
/* @__PURE__ */ e(Ye, { asChild: !0, children: /* @__PURE__ */ e(
|
|
151
139
|
I,
|
|
152
140
|
{
|
|
153
141
|
size: "xs",
|
|
@@ -266,7 +254,7 @@ function Nt({
|
|
|
266
254
|
}
|
|
267
255
|
);
|
|
268
256
|
}
|
|
269
|
-
function
|
|
257
|
+
function Nt({ searchQuery: t }) {
|
|
270
258
|
const [m, p] = b(!1), [l, i] = b(
|
|
271
259
|
null
|
|
272
260
|
), [h, w] = b(!1), [o, N] = b(null), [y, f] = b(null), [d, u] = b(
|
|
@@ -296,7 +284,7 @@ function yt({ searchQuery: t }) {
|
|
|
296
284
|
o && O(o.id);
|
|
297
285
|
}, {
|
|
298
286
|
startUpdating: r,
|
|
299
|
-
stopUpdating:
|
|
287
|
+
stopUpdating: X,
|
|
300
288
|
isUpdating: B
|
|
301
289
|
} = Ne(), L = (s, R, c) => {
|
|
302
290
|
var ee;
|
|
@@ -316,15 +304,15 @@ function yt({ searchQuery: t }) {
|
|
|
316
304
|
{
|
|
317
305
|
onSuccess: () => {
|
|
318
306
|
var P;
|
|
319
|
-
|
|
307
|
+
X(s, K), (P = c == null ? void 0 : c.onSuccess) == null || P.call(c);
|
|
320
308
|
},
|
|
321
309
|
onError: () => {
|
|
322
310
|
var P;
|
|
323
|
-
|
|
311
|
+
X(s, K), (P = c == null ? void 0 : c.onError) == null || P.call(c);
|
|
324
312
|
}
|
|
325
313
|
}
|
|
326
314
|
);
|
|
327
|
-
},
|
|
315
|
+
}, $ = (s) => {
|
|
328
316
|
f(s), C(s, {
|
|
329
317
|
onSettled: () => f(null)
|
|
330
318
|
});
|
|
@@ -334,7 +322,7 @@ function yt({ searchQuery: t }) {
|
|
|
334
322
|
T(s);
|
|
335
323
|
}, J = (s) => {
|
|
336
324
|
i(s), p(!0);
|
|
337
|
-
},
|
|
325
|
+
}, Y = (s) => {
|
|
338
326
|
u(s);
|
|
339
327
|
}, Z = () => {
|
|
340
328
|
u(null);
|
|
@@ -368,14 +356,14 @@ function yt({ searchQuery: t }) {
|
|
|
368
356
|
/* @__PURE__ */ e("h3", { className: "text-[13px] font-medium text-foreground", children: t ? "No visuals found" : "No visuals yet" }),
|
|
369
357
|
/* @__PURE__ */ e("p", { className: "text-[12px] text-muted-foreground", children: t ? "Try adjusting your search." : 'Click "New" above to add your first visual.' })
|
|
370
358
|
] }) : M.map((s) => /* @__PURE__ */ e(
|
|
371
|
-
|
|
359
|
+
wt,
|
|
372
360
|
{
|
|
373
361
|
visual: s,
|
|
374
362
|
onAddVisual: q,
|
|
375
363
|
onOpenVisual: H,
|
|
376
|
-
onEditDetails:
|
|
364
|
+
onEditDetails: Y,
|
|
377
365
|
onDeleteClick: F,
|
|
378
|
-
onDuplicateVisual:
|
|
366
|
+
onDuplicateVisual: $,
|
|
379
367
|
onShareVisual: J,
|
|
380
368
|
isDeleting: v,
|
|
381
369
|
isDuplicating: y === s.id,
|
|
@@ -442,7 +430,7 @@ function yt({ searchQuery: t }) {
|
|
|
442
430
|
)
|
|
443
431
|
] });
|
|
444
432
|
}
|
|
445
|
-
function
|
|
433
|
+
function yt({
|
|
446
434
|
dashboard: t,
|
|
447
435
|
isDeleting: m,
|
|
448
436
|
isDuplicating: p,
|
|
@@ -463,7 +451,7 @@ function Ct({
|
|
|
463
451
|
return /* @__PURE__ */ n(
|
|
464
452
|
"div",
|
|
465
453
|
{
|
|
466
|
-
className:
|
|
454
|
+
className: W(
|
|
467
455
|
"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",
|
|
468
456
|
d && "bg-muted"
|
|
469
457
|
),
|
|
@@ -499,7 +487,7 @@ function Ct({
|
|
|
499
487
|
/* @__PURE__ */ e(
|
|
500
488
|
"div",
|
|
501
489
|
{
|
|
502
|
-
className:
|
|
490
|
+
className: W(
|
|
503
491
|
"shrink-0 transition-opacity",
|
|
504
492
|
d ? "opacity-100" : "opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"
|
|
505
493
|
),
|
|
@@ -523,13 +511,13 @@ function Ct({
|
|
|
523
511
|
}
|
|
524
512
|
);
|
|
525
513
|
}
|
|
526
|
-
function
|
|
514
|
+
function Ct({ onRetry: t }) {
|
|
527
515
|
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: [
|
|
528
516
|
/* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: "Failed to load dashboards" }),
|
|
529
517
|
/* @__PURE__ */ e(I, { variant: "outline", size: "sm", className: "mt-2", onClick: t, children: "Retry" })
|
|
530
518
|
] }) });
|
|
531
519
|
}
|
|
532
|
-
function
|
|
520
|
+
function vt(t) {
|
|
533
521
|
var he;
|
|
534
522
|
const { searchQuery: m, onLoadDashboard: p, onEditDashboard: l, onDashboardItemClick: i } = t, [h, w] = b(!1), [o, N] = b(
|
|
535
523
|
null
|
|
@@ -546,14 +534,14 @@ function St(t) {
|
|
|
546
534
|
isLoading: F,
|
|
547
535
|
isError: j,
|
|
548
536
|
updateResource: r,
|
|
549
|
-
deleteResource:
|
|
537
|
+
deleteResource: X,
|
|
550
538
|
duplicateResource: B,
|
|
551
539
|
isDeleting: L
|
|
552
540
|
} = Ue(() => {
|
|
553
541
|
f(!1);
|
|
554
542
|
const a = d == null ? void 0 : d.id;
|
|
555
543
|
u(null), (V == null ? void 0 : V.id) === a && (!(v != null && v.dashboard_id) && !M ? C() : E && E.id !== a && O(E));
|
|
556
|
-
}), { userContext:
|
|
544
|
+
}), { userContext: $ } = ue(), H = ((he = $ == null ? void 0 : $.permissions) == null ? void 0 : he.canCreateDashboard) ?? !1, q = U.filter(
|
|
557
545
|
(a) => {
|
|
558
546
|
var _, g;
|
|
559
547
|
return ((_ = a == null ? void 0 : a.title) == null ? void 0 : _.toLowerCase().includes(m.toLowerCase())) || ((g = a == null ? void 0 : a.description) == null ? void 0 : g.toLowerCase().includes(m.toLowerCase()));
|
|
@@ -562,12 +550,12 @@ function St(t) {
|
|
|
562
550
|
month: "short",
|
|
563
551
|
day: "numeric",
|
|
564
552
|
year: "numeric"
|
|
565
|
-
}),
|
|
553
|
+
}), Y = (a) => {
|
|
566
554
|
p == null || p(a);
|
|
567
555
|
}, Z = (a) => {
|
|
568
556
|
u(a), f(!0);
|
|
569
557
|
}, k = () => {
|
|
570
|
-
d &&
|
|
558
|
+
d && X(d.id);
|
|
571
559
|
}, s = (a) => {
|
|
572
560
|
T(a), B(a, {
|
|
573
561
|
onSettled: () => T(null)
|
|
@@ -621,18 +609,18 @@ function St(t) {
|
|
|
621
609
|
}
|
|
622
610
|
});
|
|
623
611
|
};
|
|
624
|
-
return F ? /* @__PURE__ */ e(Me, {}) : j ? /* @__PURE__ */ e(
|
|
612
|
+
return F ? /* @__PURE__ */ e(Me, {}) : j ? /* @__PURE__ */ e(Ct, { onRetry: () => window.location.reload() }) : /* @__PURE__ */ n("div", { className: "flex h-full flex-1 flex-col", children: [
|
|
625
613
|
/* @__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: [
|
|
626
614
|
/* @__PURE__ */ e(ze, { className: "h-5 w-5 text-muted-foreground/60" }),
|
|
627
615
|
/* @__PURE__ */ e("h3", { className: "text-[13px] font-medium text-foreground", children: m ? "No dashboards found" : "No dashboards yet" }),
|
|
628
616
|
/* @__PURE__ */ e("p", { className: "text-[12px] text-muted-foreground", children: m ? "Try adjusting your search." : H ? 'Click "New" above to add your first dashboard.' : "No dashboards have been shared with you yet." })
|
|
629
617
|
] }) : q.map((a) => /* @__PURE__ */ e(
|
|
630
|
-
|
|
618
|
+
yt,
|
|
631
619
|
{
|
|
632
620
|
dashboard: a,
|
|
633
621
|
isDeleting: L,
|
|
634
622
|
isDuplicating: A === a.id,
|
|
635
|
-
onLoadDashboard:
|
|
623
|
+
onLoadDashboard: Y,
|
|
636
624
|
onEditDetails: ee,
|
|
637
625
|
onDeleteClick: Z,
|
|
638
626
|
onDuplicateDashboard: s,
|
|
@@ -701,6 +689,18 @@ function St(t) {
|
|
|
701
689
|
)
|
|
702
690
|
] });
|
|
703
691
|
}
|
|
692
|
+
function St(t, m = {}) {
|
|
693
|
+
const { enabled: p = !0, eventType: l = "mousedown" } = m, i = qe(null);
|
|
694
|
+
return ae(() => {
|
|
695
|
+
const h = (w) => {
|
|
696
|
+
const o = w.target;
|
|
697
|
+
i.current && i.current.contains(o) || o instanceof Element && (o.closest("[data-radix-popper-content-wrapper]") || o.closest("[data-radix-select-content]") || o.closest("[data-radix-popover-content]") || o.closest("[data-radix-dropdown-menu-content]") || o.closest("[data-radix-tooltip-content]") || o.closest('[role="listbox"]') || o.closest('[role="option"]') || o.closest('[role="combobox"]')) || o instanceof Element && o.hasAttribute("data-radix-") || t();
|
|
698
|
+
};
|
|
699
|
+
return p && document.addEventListener(l, h), () => {
|
|
700
|
+
document.removeEventListener(l, h);
|
|
701
|
+
};
|
|
702
|
+
}, [t, p, l]), i;
|
|
703
|
+
}
|
|
704
704
|
function Et({
|
|
705
705
|
open: t,
|
|
706
706
|
onOpenChange: m,
|
|
@@ -798,11 +798,11 @@ function Tt({
|
|
|
798
798
|
(D) => {
|
|
799
799
|
o(!1), D && (S(D), E(D));
|
|
800
800
|
}
|
|
801
|
-
), U = i === "overlay", F = h ? "New Visual" : "New", j = h ? "New Visual" : "New Dashboard", r = h ? "Search visuals..." : "Search dashboards...",
|
|
801
|
+
), U = i === "overlay", F = h ? "New Visual" : "New", j = h ? "New Visual" : "New Dashboard", r = h ? "Search visuals..." : "Search dashboards...", X = h ? "Collapse visuals panel" : "Collapse dashboard panel", B = ((u == null ? void 0 : u.name) ?? "").trim(), L = ((u == null ? void 0 : u.email) ?? "").trim(), H = B && B.toLowerCase() !== "undefined" ? B : L || "Current user", q = ((z = H.charAt(0)) == null ? void 0 : z.toUpperCase()) || "?", J = L && L.toLowerCase() !== "undefined" ? L : "", Y = St(m, {
|
|
802
802
|
enabled: t && U
|
|
803
|
-
}), Z =
|
|
803
|
+
}), Z = W(
|
|
804
804
|
"flex h-full flex-col border-r border-border/60 bg-background",
|
|
805
|
-
U ?
|
|
805
|
+
U ? W(
|
|
806
806
|
"absolute inset-y-0 left-0 z-[51] w-60 overflow-hidden shadow-lg transition-transform duration-300 ease-in-out",
|
|
807
807
|
t ? "translate-x-0" : "pointer-events-none -translate-x-full"
|
|
808
808
|
) : "w-full max-w-[17rem] min-w-[11rem] overflow-hidden",
|
|
@@ -817,7 +817,7 @@ function Tt({
|
|
|
817
817
|
}
|
|
818
818
|
});
|
|
819
819
|
};
|
|
820
|
-
return /* @__PURE__ */ e(le, { children: (!U || t) && /* @__PURE__ */ n("div", { ref:
|
|
820
|
+
return /* @__PURE__ */ e(le, { children: (!U || t) && /* @__PURE__ */ n("div", { ref: Y, className: Z, children: [
|
|
821
821
|
/* @__PURE__ */ e("div", { className: "border-b border-border/60 bg-background", children: f ? /* @__PURE__ */ n("div", { className: "flex h-10 items-center gap-1 px-3", children: [
|
|
822
822
|
/* @__PURE__ */ e(De, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
823
823
|
/* @__PURE__ */ e(
|
|
@@ -881,14 +881,14 @@ function Tt({
|
|
|
881
881
|
variant: "ghost",
|
|
882
882
|
className: "w-7 px-0 text-muted-foreground hover:text-foreground",
|
|
883
883
|
onClick: m,
|
|
884
|
-
"aria-label":
|
|
884
|
+
"aria-label": X,
|
|
885
885
|
children: /* @__PURE__ */ e(gt, { className: "h-3.5 w-3.5" })
|
|
886
886
|
}
|
|
887
887
|
)
|
|
888
888
|
] })
|
|
889
889
|
] }) }),
|
|
890
|
-
/* @__PURE__ */ e("div", { className: "flex flex-1 flex-col overflow-auto px-1.5 py-2", children: h ? /* @__PURE__ */ e(
|
|
891
|
-
|
|
890
|
+
/* @__PURE__ */ e("div", { className: "flex flex-1 flex-col overflow-auto px-1.5 py-2", children: h ? /* @__PURE__ */ e(Nt, { searchQuery: N }) : /* @__PURE__ */ e(
|
|
891
|
+
vt,
|
|
892
892
|
{
|
|
893
893
|
searchQuery: N,
|
|
894
894
|
onLoadDashboard: k,
|
|
@@ -907,7 +907,7 @@ function Tt({
|
|
|
907
907
|
u.role && /* @__PURE__ */ n("div", { className: "text-[11px] opacity-80", children: [
|
|
908
908
|
"Role:",
|
|
909
909
|
" ",
|
|
910
|
-
|
|
910
|
+
Xe(u.role.replace(/_/g, " "))
|
|
911
911
|
] })
|
|
912
912
|
] }) })
|
|
913
913
|
] }) }) }),
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("./switch-BG4RWnrq.js"),x=require("react"),t=require("./index-C0zD3JgK.js"),oe=require("./use-visual-utils-DflfgX9g.js");/**
|
|
2
|
+
* @license lucide-react v0.453.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const ie=r.createLucideIcon("FolderOpen",[["path",{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",key:"usdka0"}]]);function re(){return e.jsx("div",{className:"space-y-1.5 py-1",children:[...Array(5)].map((s,f)=>e.jsxs("div",{className:"flex animate-pulse items-start gap-3 rounded-xl border border-transparent px-2.5 py-2.5",children:[e.jsx("div",{className:"mt-0.5 h-4 w-4 flex-shrink-0 rounded bg-muted/60"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"h-4 w-3/5 rounded bg-muted/60"}),e.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40"})]})]},f))})}const le=s=>{const f=r.useDashboardStore(l=>l.isVisualEditing),m=r.useDashboardStore(l=>l.selectedFrameId),d=r.useEditorStore(l=>l.frame);return!!(f&&m&&(d==null?void 0:d.visualId)===s)};function de({visual:s,isDeleting:f,isDuplicating:m,onAddVisual:d,onOpenVisual:l,onEditDetails:p,onDeleteClick:N,onDuplicateVisual:a,onShareVisual:b,formatDate:C}){var I,O,P,B;const{selectVisual:g}=t.useManagementActions(),c=t.useIsVisualSelected(s.id),h=le(s.id),L=r.useDashboardStore(i=>i.isVisualEditing),{isConsoleMode:T}=t.useDashboardPreferences(),D=x.useRef(null),[v,E]=x.useState(!1),[V,M]=x.useState(!1);x.useEffect(()=>{m?(E(!0),M(!0)):V&&(E(!1),M(!1))},[m,V]),x.useEffect(()=>{h&&D.current&&D.current.scrollIntoView({behavior:"smooth",block:"center"})},[h]);const y=()=>{g(s),l==null||l(s)},S=i=>{i.currentTarget===i.target&&(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),y())};return e.jsxs("div",{ref:D,className:r.cn("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",h?"bg-muted ring-1 ring-inset ring-foreground/20":c&&"bg-muted"),onClick:y,children:[e.jsxs("div",{role:"button",tabIndex:0,className:"min-w-0 flex-1 cursor-pointer focus-visible:outline-none",onKeyDown:S,children:[e.jsx("p",{className:"truncate text-[13px] font-medium leading-5 text-foreground",title:s.title||"Untitled Visual",children:s.title||"Untitled Visual"}),e.jsx("p",{className:"truncate text-[11px] leading-4 text-muted-foreground",title:s.description||"No description",children:(I=s.description)!=null&&I.trim()?s.description:"No description"})]}),e.jsx("div",{className:r.cn("flex shrink-0 items-center transition-opacity",c||h||v?"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"),onClick:i=>i.stopPropagation(),children:e.jsxs("div",{className:"inline-flex h-7 items-stretch overflow-hidden rounded-[5px] border border-border/60 bg-background",children:[e.jsxs(r.Button,{size:"xs",variant:"ghost",className:"h-full rounded-none border-0 shadow-none hover:bg-accent/50",disabled:L,onClick:i=>{i.stopPropagation(),d(s)},"aria-label":`Add ${s.title||"visual"}`,children:[e.jsx(t.Plus,{className:"h-3.5 w-3.5"}),"Add"]}),e.jsxs(t.DropdownMenu,{modal:!1,open:v,onOpenChange:E,children:[e.jsx(t.DropdownMenuTrigger,{asChild:!0,children:e.jsx(r.Button,{size:"xs",variant:"ghost",className:"h-full w-7 rounded-none border-0 border-l border-border/60 px-0 shadow-none hover:bg-accent/50","aria-label":"Open visual actions",children:e.jsx(t.EllipsisVertical,{className:"h-3.5 w-3.5"})})}),e.jsxs(t.DropdownMenuContent,{align:"end",className:"z-[51] w-44 rounded-[6px] border border-border/60 p-1 shadow-sm",children:[e.jsxs(t.DropdownMenuItem,{onClick:i=>{i.stopPropagation(),d(s)},disabled:L,children:[e.jsx(t.Plus,{className:"h-3.5 w-3.5"}),"Add"]}),e.jsxs(t.DropdownMenuItem,{onClick:i=>{i.stopPropagation(),l==null||l(s)},children:[e.jsx(ie,{className:"h-3.5 w-3.5"}),"Open"]}),e.jsxs(t.DropdownMenuItem,{onClick:i=>{i.preventDefault(),i.stopPropagation(),a(s.id)},disabled:m,children:[m?e.jsx(r.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(t.Copy,{className:"h-3.5 w-3.5"}),m?"Duplicating…":"Duplicate"]}),s.ownership.isOwner&&e.jsxs(e.Fragment,{children:[e.jsxs(t.DropdownMenuItem,{onClick:i=>{i.stopPropagation(),p==null||p(s)},children:[e.jsx(t.PenLine,{className:"h-3.5 w-3.5"}),"Edit details"]}),e.jsxs(t.DropdownMenuItem,{onClick:i=>{i.stopPropagation(),b(s)},children:[e.jsx(t.Users,{className:"h-3.5 w-3.5"}),"Share"]}),e.jsx(t.DropdownMenuSeparator,{}),e.jsxs(t.DropdownMenuItem,{onClick:i=>{i.stopPropagation(),N(s)},className:"text-destructive focus:bg-destructive/10 focus:text-destructive",disabled:f,children:[e.jsx(t.Trash2,{className:"h-3.5 w-3.5"}),f?"Deleting…":"Delete"]})]}),e.jsx(t.DropdownMenuSeparator,{}),e.jsxs("div",{className:"space-y-1 px-2 py-1.5 text-[11px] text-muted-foreground",children:[(((O=s.ownership.createdBy)==null?void 0:O.type)==="tenant"||((P=s.ownership.createdBy)==null?void 0:P.type)==="organization"&&T)&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(t.User,{className:"h-3 w-3"}),e.jsx("span",{children:((B=s.ownership.createdBy)==null?void 0:B.name)||"Unknown"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(t.Calendar,{className:"h-3 w-3"}),e.jsx("span",{children:C(s.lastModified)})]})]})]})]})]})})]})}function ce({searchQuery:s}){const[f,m]=x.useState(!1),[d,l]=x.useState(null),[p,N]=x.useState(!1),[a,b]=x.useState(null),[C,g]=x.useState(null),[c,h]=x.useState(null),{handleEditLibraryVisual:L,handleAddLibraryVisual:T}=oe.useVisualUtils(),{resources:D,isLoading:v,isError:E,updateResource:V,deleteResource:M,duplicateResource:y,isDeleting:S}=t.useVisualManagement(()=>{N(!1),b(null)}),I=D.filter(o=>{var R,u;return((R=o==null?void 0:o.title)==null?void 0:R.toLowerCase().includes(s.toLowerCase()))||((u=o==null?void 0:o.description)==null?void 0:u.toLowerCase().includes(s.toLowerCase()))}),O=o=>new Date(o).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),P=o=>{b(o),N(!0)},B=()=>{a&&M(a.id)},{startUpdating:i,stopUpdating:G,isUpdating:z}=t.useResourceUpdateState(),A=(o,R,u)=>{var Z;const F=Object.fromEntries(Object.entries(R).filter(([,U])=>U!==void 0));if(Object.keys(F).length===0){(Z=u==null?void 0:u.onSuccess)==null||Z.call(u);return}const w=Object.keys(F),K=w.length===1?w[0]:void 0;i(o,K),V({resourceId:o,data:F},{onSuccess:()=>{var U;G(o,K),(U=u==null?void 0:u.onSuccess)==null||U.call(u)},onError:()=>{var U;G(o,K),(U=u==null?void 0:u.onError)==null||U.call(u)}})},W=o=>{g(o),y(o,{onSettled:()=>g(null)})},H=o=>{L(o)},X=o=>{T(o)},Y=o=>{l(o),m(!0)},$=o=>{h(o)},J=()=>{h(null)},Q=({title:o,description:R})=>{if(!c)return;const u={};o!==c.title&&(u.title=o),(c.description||"")!==R&&(u.description=R),A(c.id,u,{onSuccess:()=>{h(null)}})};return v?e.jsx(re,{}):E?e.jsx(r.ScrollArea,{className:"w-full flex-1 pr-2",children:e.jsxs("div",{className:"flex flex-col items-center gap-1.5 px-4 py-10 text-center",children:[e.jsx("p",{className:"text-[12px] text-destructive",children:"Failed to load visuals"}),e.jsx(r.Button,{variant:"outline",size:"xs",onClick:()=>window.location.reload(),children:"Retry"})]})}):e.jsxs("div",{className:"flex h-full flex-1 flex-col",children:[e.jsx("div",{className:"flex flex-1 basis-0 flex-col gap-0.5 overflow-y-auto",children:I.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-1.5 px-4 py-10 text-center",children:[e.jsx(t.Grid3x3,{className:"h-5 w-5 text-muted-foreground/60"}),e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:s?"No visuals found":"No visuals yet"}),e.jsx("p",{className:"text-[12px] text-muted-foreground",children:s?"Try adjusting your search.":'Click "New" above to add your first visual.'})]}):I.map(o=>e.jsx(de,{visual:o,onAddVisual:X,onOpenVisual:H,onEditDetails:$,onDeleteClick:P,onDuplicateVisual:W,onShareVisual:Y,isDeleting:S,isDuplicating:C===o.id,formatDate:O},o.id))}),f&&d&&e.jsx(t.ShareDialog,{resource:d,resourceType:t.ResourceType.VISUAL,onClose:()=>{m(!1),l(null)}}),c&&e.jsx(t.ResourceEditDialog,{open:!!c,resourceLabel:"Visual",initialTitle:c.title||"",initialDescription:c.description||"",onClose:J,onSave:Q,isSaving:z(c.id)}),e.jsx(t.AlertDialog,{open:p,onOpenChange:o=>{!o&&S||(N(o),o||b(null))},children:e.jsxs(t.AlertDialogContent,{children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsx(t.AlertDialogTitle,{children:"Delete Visual"}),e.jsxs(t.AlertDialogDescription,{children:['Are you sure you want to delete "',a==null?void 0:a.title,'"? This action cannot be undone.']})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{disabled:S,children:"Cancel"}),e.jsxs(t.AlertDialogAction,{onClick:o=>{o.preventDefault(),o.stopPropagation(),B()},disabled:S,children:[S?e.jsx(r.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(t.Trash2,{className:"h-3.5 w-3.5"}),S?"Deleting…":"Delete"]})]})]})})]})}function ue({dashboard:s,isDeleting:f,isDuplicating:m,onLoadDashboard:d,onEditDetails:l,onDeleteClick:p,onDuplicateDashboard:N,onShareDashboard:a,formatDate:b,onDashboardItemClick:C}){var V,M;const{selectDashboard:g}=t.useManagementActions(),c=t.useIsDashboardSelected(s.id),{userContext:h,isLoading:L}=t.useCurrentUserInfo(),T=((V=h==null?void 0:h.permissions)==null?void 0:V.canEdit)??!1,D=L||!T,v=()=>{g(s),d(s.id),C==null||C(s.id)},E=y=>{y.currentTarget===y.target&&(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),v())};return e.jsxs("div",{className:r.cn("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",c&&"bg-muted"),onClick:v,children:[e.jsxs("div",{role:"button",tabIndex:0,className:"min-w-0 flex-1 cursor-pointer focus-visible:outline-none",onKeyDown:E,children:[e.jsx("p",{className:"truncate text-[13px] font-medium leading-5 text-foreground",title:s.title||"Untitled Dashboard",children:s.title||"Untitled Dashboard"}),e.jsx("p",{className:"truncate text-[11px] leading-4 text-muted-foreground",title:s.description||"No description",children:(M=s.description)!=null&&M.trim()?s.description:"No description"})]}),e.jsx("div",{className:r.cn("shrink-0 transition-opacity",c?"opacity-100":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"),children:e.jsx(t.DashboardActionsMenu,{dashboard:s,isDeleting:f,isDuplicating:m,shouldHideActions:D,onEditDetails:l,onDeleteClick:p,onDuplicateDashboard:N,onShareDashboard:a,formatDate:b})})]})}function he({onRetry:s}){return e.jsx(r.ScrollArea,{className:"w-full flex-1 pr-2",children:e.jsxs("div",{className:"rounded-xl border border-dashed border-border/60 bg-muted/20 px-4 py-8 text-center text-muted-foreground",children:[e.jsx("p",{className:"text-sm text-destructive",children:"Failed to load dashboards"}),e.jsx(r.Button,{variant:"outline",size:"sm",className:"mt-2",onClick:s,children:"Retry"})]})})}function xe(s){var te;const{searchQuery:f,onLoadDashboard:m,onEditDashboard:d,onDashboardItemClick:l}=s,[p,N]=x.useState(!1),[a,b]=x.useState(null),[C,g]=x.useState(!1),[c,h]=x.useState(null),[L,T]=x.useState(null),[D,v]=x.useState(null),E=t.useManagementStore(n=>n.lastSelectedDashboard),V=t.useManagementStore(n=>n.selectedDashboard),M=t.useManagementStore(n=>n.actions.selectDashboard),y=t.useManagementStore(n=>n.actions.clearSelectedDashboard),{tokenProps:S,id:I}=t.useSemaphorContext(),{resources:O,isLoading:P,isError:B,updateResource:i,deleteResource:G,duplicateResource:z,isDeleting:A}=t.useDashboardManagement(()=>{g(!1);const n=c==null?void 0:c.id;h(null),(V==null?void 0:V.id)===n&&(!(S!=null&&S.dashboard_id)&&!I?y():E&&E.id!==n&&M(E))}),{userContext:W}=t.useCurrentUserInfo(),H=((te=W==null?void 0:W.permissions)==null?void 0:te.canCreateDashboard)??!1,X=O.filter(n=>{var q,j;return((q=n==null?void 0:n.title)==null?void 0:q.toLowerCase().includes(f.toLowerCase()))||((j=n==null?void 0:n.description)==null?void 0:j.toLowerCase().includes(f.toLowerCase()))}),Y=n=>new Date(n).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),$=n=>{m==null||m(n)},J=n=>{h(n),g(!0)},Q=()=>{c&&G(c.id)},o=n=>{T(n),z(n,{onSettled:()=>T(null)})},{startUpdating:R,stopUpdating:u,isUpdating:F}=t.useResourceUpdateState(),w=(n,q,j)=>{var ne;const k=Object.fromEntries(Object.entries(q).filter(([,_])=>_!==void 0));if(Object.keys(k).length===0){(ne=j==null?void 0:j.onSuccess)==null||ne.call(j);return}const se=Object.keys(k),ee=se.length===1?se[0]:void 0;R(n,ee),i({resourceId:n,data:k},{onSuccess:()=>{var _;u(n,ee),(_=j==null?void 0:j.onSuccess)==null||_.call(j)},onError:()=>{var _;u(n,ee),(_=j==null?void 0:j.onError)==null||_.call(j)}})},K=n=>{b(n),N(!0)},Z=n=>{d==null||d(n.id),v(n)},U=()=>{v(null)},ae=({title:n,description:q})=>{if(!D)return;const j={};n!==D.title&&(j.title=n),(D.description||"")!==q&&(j.description=q),w(D.id,j,{onSuccess:()=>{v(null)}})};return P?e.jsx(re,{}):B?e.jsx(he,{onRetry:()=>window.location.reload()}):e.jsxs("div",{className:"flex h-full flex-1 flex-col",children:[e.jsx("div",{className:"flex flex-1 basis-0 flex-col gap-0.5 overflow-y-auto",children:X.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-1.5 px-4 py-10 text-center",children:[e.jsx(r.ChartColumn,{className:"h-5 w-5 text-muted-foreground/60"}),e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:f?"No dashboards found":"No dashboards yet"}),e.jsx("p",{className:"text-[12px] text-muted-foreground",children:f?"Try adjusting your search.":H?'Click "New" above to add your first dashboard.':"No dashboards have been shared with you yet."})]}):X.map(n=>e.jsx(ue,{dashboard:n,isDeleting:A,isDuplicating:L===n.id,onLoadDashboard:$,onEditDetails:Z,onDeleteClick:J,onDuplicateDashboard:o,onShareDashboard:K,formatDate:Y,onDashboardItemClick:l},n.id))}),p&&a&&e.jsx(t.ShareDialog,{resource:a,resourceType:t.ResourceType.DASHBOARD,onClose:()=>{N(!1),b(null)}}),e.jsx(t.AlertDialog,{open:C,onOpenChange:n=>{!n&&A||(g(n),n||h(null))},children:e.jsxs(t.AlertDialogContent,{children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsx(t.AlertDialogTitle,{children:"Delete Dashboard"}),e.jsxs(t.AlertDialogDescription,{children:['Are you sure you want to delete "',c==null?void 0:c.title,'"? This action cannot be undone.']})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{disabled:A,children:"Cancel"}),e.jsxs(t.AlertDialogAction,{onClick:n=>{n.preventDefault(),n.stopPropagation(),Q()},disabled:A,children:[A?e.jsx(r.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(t.Trash2,{className:"h-3.5 w-3.5"}),A?"Deleting…":"Delete"]})]})]})}),D&&e.jsx(t.ResourceEditDialog,{open:!!D,resourceLabel:"Dashboard",initialTitle:D.title||"",initialDescription:D.description||"",onClose:U,onSave:ae,isSaving:F(D.id)})]})}function pe(s,f={}){const{enabled:m=!0,eventType:d="mousedown"}=f,l=x.useRef(null);return x.useEffect(()=>{const p=N=>{const a=N.target;l.current&&l.current.contains(a)||a instanceof Element&&(a.closest("[data-radix-popper-content-wrapper]")||a.closest("[data-radix-select-content]")||a.closest("[data-radix-popover-content]")||a.closest("[data-radix-dropdown-menu-content]")||a.closest("[data-radix-tooltip-content]")||a.closest('[role="listbox"]')||a.closest('[role="option"]')||a.closest('[role="combobox"]'))||a instanceof Element&&a.hasAttribute("data-radix-")||s()};return m&&document.addEventListener(d,p),()=>{document.removeEventListener(d,p)}},[s,m,d]),l}function me({open:s,onOpenChange:f,onSubmit:m,isCreating:d}){const[l,p]=x.useState(""),[N,a]=x.useState("");x.useEffect(()=>{s||(p(""),a(""))},[s]);const b=()=>{l.trim()&&m({title:l,description:N})},C=g=>{f(g)};return e.jsx(t.Dialog,{open:s,onOpenChange:C,children:e.jsxs(t.DialogContent,{children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:"Create New Visual"}),e.jsx(t.DialogDescription,{children:"Add a new visual to your library. You can configure it after creation."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r.Label,{htmlFor:"title",children:"Visual Title"}),e.jsx(r.Input,{id:"title",placeholder:"Enter visual title...",value:l,onChange:g=>p(g.target.value),disabled:d,onKeyDown:g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),b())}})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r.Label,{htmlFor:"description",children:"Description (optional)"}),e.jsx(r.Input,{id:"description",placeholder:"Enter visual description...",value:N,onChange:g=>a(g.target.value),disabled:d})]})]}),e.jsxs(t.DialogFooter,{children:[e.jsx(r.Button,{variant:"outline",onClick:()=>C(!1),disabled:d,children:"Cancel"}),e.jsx(r.Button,{onClick:b,disabled:!l.trim()||d,children:d?e.jsxs(e.Fragment,{children:[e.jsx(r.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Visual"})]})]})})}function fe({isOpen:s,onClose:f,className:m,onDashboardItemClick:d,variant:l="inline"}){var u,F;const p=r.useDashboardStore(w=>w.isDashboardEditing),[N,a]=x.useState(!1),[b,C]=x.useState(""),[g,c]=x.useState(!1),{currentUser:h,userContext:L}=t.useCurrentUserInfo(),T=((u=L==null?void 0:L.permissions)==null?void 0:u.canCreateDashboard)??!1,{onCreateSuccess:D}=t.useDashboardCreation({onDashboardSelect:d}),{selectVisual:v}=t.useManagementActions(),{handleEditLibraryVisual:E}=oe.useVisualUtils(),{createResource:V,isCreating:M,refetch:y}=t.useDashboardManagement(),{createResource:S,isCreating:I}=t.useVisualManagement(void 0,w=>{a(!1),w&&(v(w),E(w))}),O=l==="overlay",P=p?"New Visual":"New",B=p?"New Visual":"New Dashboard",i=p?"Search visuals...":"Search dashboards...",G=p?"Collapse visuals panel":"Collapse dashboard panel",z=((h==null?void 0:h.name)??"").trim(),A=((h==null?void 0:h.email)??"").trim(),H=z&&z.toLowerCase()!=="undefined"?z:A||"Current user",X=((F=H.charAt(0))==null?void 0:F.toUpperCase())||"?",Y=A&&A.toLowerCase()!=="undefined"?A:"",$=pe(f,{enabled:s&&O}),J=r.cn("flex h-full flex-col border-r border-border/60 bg-background",O?r.cn("absolute inset-y-0 left-0 z-[51] w-60 overflow-hidden shadow-lg transition-transform duration-300 ease-in-out",s?"translate-x-0":"pointer-events-none -translate-x-full"):"w-full max-w-[17rem] min-w-[11rem] overflow-hidden",m),Q=w=>{},o=w=>{console.log("Editing dashboard:",w)},R=w=>{V(w,{onSuccess:K=>{a(!1),D(K,y)}})};return e.jsx(e.Fragment,{children:(!O||s)&&e.jsxs("div",{ref:$,className:J,children:[e.jsx("div",{className:"border-b border-border/60 bg-background",children:g?e.jsxs("div",{className:"flex h-10 items-center gap-1 px-3",children:[e.jsx(t.Search,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsx("input",{autoFocus:!0,value:b,onChange:w=>C(w.target.value),onKeyDown:w=>{w.key==="Escape"&&(C(""),c(!1))},placeholder:i,className:"h-7 min-w-0 flex-1 bg-transparent text-[13px] text-foreground placeholder:text-muted-foreground focus:outline-none","aria-label":i}),e.jsx(r.Button,{size:"xs",variant:"ghost",className:"w-7 shrink-0 px-0 text-muted-foreground hover:text-foreground",onClick:()=>{C(""),c(!1)},"aria-label":"Close search",children:e.jsx(r.X,{className:"h-3.5 w-3.5"})})]}):e.jsxs("div",{className:"flex h-10 items-center justify-between gap-2 px-3",children:[e.jsx("h2",{className:"whitespace-nowrap text-[13px] font-medium text-foreground",children:p?"Visuals":"Dashboards"}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(r.Button,{size:"xs",variant:"ghost",onClick:()=>c(!0),className:"w-7 px-0 text-muted-foreground hover:text-foreground","aria-label":"Search",children:e.jsx(t.Search,{className:"h-3.5 w-3.5"})}),(p||T)&&e.jsxs(r.Button,{size:"xs",variant:"outline",onClick:()=>a(!0),"aria-label":B,children:[e.jsx(t.Plus,{className:"h-3.5 w-3.5"}),P]}),e.jsx(r.Button,{size:"xs",variant:"ghost",className:"w-7 px-0 text-muted-foreground hover:text-foreground",onClick:f,"aria-label":G,children:e.jsx(t.PanelLeft,{className:"h-3.5 w-3.5"})})]})]})}),e.jsx("div",{className:"flex flex-1 flex-col overflow-auto px-1.5 py-2",children:p?e.jsx(ce,{searchQuery:b}):e.jsx(xe,{searchQuery:b,onLoadDashboard:Q,onEditDashboard:o,onDashboardItemClick:d})}),h&&e.jsx(r.TooltipProvider,{children:e.jsx("div",{className:"border-t border-border/60 px-3 py-2",children:e.jsxs(r.Tooltip,{children:[e.jsx(r.TooltipTrigger,{asChild:!0,children:e.jsxs("div",{className:"flex cursor-default items-center gap-2",children:[e.jsx("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:X}),e.jsx("span",{className:"truncate text-[12px] text-muted-foreground",children:H})]})}),e.jsx(r.TooltipContent,{side:"top",className:"max-w-xs",children:e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("div",{className:"font-medium",children:H}),Y&&e.jsx("div",{className:"text-[11px] opacity-80",children:Y}),h.role&&e.jsxs("div",{className:"text-[11px] opacity-80",children:["Role:"," ",r.toTitleCase(h.role.replace(/_/g," "))]})]})})]})})}),p?e.jsx(me,{open:N,onOpenChange:a,onSubmit:S,isCreating:I}):e.jsx(t.CreateDashboardDialog,{open:N,onOpenChange:a,onSubmit:R,isCreating:M})]})})}exports.ResourceManagementPanel=fe;
|