react-semaphor 0.1.293 → 0.1.294
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/chunks/{braces-C7GP95Fp.js → braces-DR-GdaLC.js} +1 -1
- package/dist/chunks/{braces-BwW2HFlB.js → braces-DfDQiR3J.js} +1 -1
- package/dist/chunks/{dashboard-controls-jrkoCSY_.js → dashboard-controls-C3Z9bpYE.js} +504 -472
- package/dist/chunks/{dashboard-controls-DgUc38Tn.js → dashboard-controls-DGEVXgP5.js} +9 -9
- package/dist/chunks/dashboard-filter-controls-button-BIYT1ucX.js +11 -0
- package/dist/chunks/dashboard-filter-controls-button-DxgGUl00.js +1152 -0
- package/dist/chunks/{dashboard-json-COjT-zjQ.js → dashboard-json-BvTeHePu.js} +1 -1
- package/dist/chunks/{dashboard-json-C0NiRL-A.js → dashboard-json-DQW8TN0I.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-CXqaN_zj.js → dashboard-summary-settings-dialog-BsmKiGud.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-CGuFl7Xe.js → dashboard-summary-settings-dialog-q7fx3YAK.js} +1 -1
- package/dist/chunks/edit-dashboard-visual-ChKj-Lzr.js +183 -0
- package/dist/chunks/{edit-dashboard-visual-ppdXk86H.js → edit-dashboard-visual-RVl9nbDZ.js} +2175 -2160
- package/dist/chunks/index-BlspGR07.js +1435 -0
- package/dist/chunks/{index-9z-jMqN8.js → index-DerPpfv0.js} +32720 -31308
- package/dist/chunks/{resource-management-panel-CP8cegZP.js → resource-management-panel-DnZ1rw1A.js} +64 -64
- package/dist/chunks/{resource-management-panel-os6AuEKT.js → resource-management-panel-epydPwyM.js} +1 -1
- package/dist/chunks/use-create-flow-overlay-state-Bcg4EgoD.js +21 -0
- package/dist/chunks/{use-create-flow-overlay-state-wpuqRZX5.js → use-create-flow-overlay-state-C5vdfXhM.js} +430 -425
- package/dist/chunks/use-visual-utils-D9Kknvjl.js +337 -0
- package/dist/chunks/use-visual-utils-Dw_yw9zU.js +1 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +258 -253
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/dashboard.d.ts +28 -0
- package/dist/types/main.d.ts +42 -4
- package/dist/types/shared.d.ts +3 -0
- package/dist/types/surfboard.d.ts +28 -0
- package/dist/types/types.d.ts +28 -0
- package/package.json +1 -1
- package/dist/chunks/dashboard-filter-controls-button-B19UWmsK.js +0 -11
- package/dist/chunks/dashboard-filter-controls-button-DGH4DxJ8.js +0 -1109
- package/dist/chunks/edit-dashboard-visual-CDOz4LWO.js +0 -183
- package/dist/chunks/index-K25f5Rqr.js +0 -1435
- package/dist/chunks/use-create-flow-overlay-state-CecnMS_v.js +0 -21
- package/dist/chunks/use-visual-utils-BTfG-ppd.js +0 -1
- package/dist/chunks/use-visual-utils-BhRKGJql.js +0 -334
package/dist/chunks/{resource-management-panel-CP8cegZP.js → resource-management-panel-DnZ1rw1A.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as n, Fragment as le } from "react/jsx-runtime";
|
|
2
|
-
import { c as je, u as ne,
|
|
2
|
+
import { c as je, u as ne, W as Fe, N as de, cD as ze, cE as Be, b as Q, B as I, cw as ie, cF as He, cG as Ke, cH as _e, cI as We, cJ as J, x as se, cK as Xe, cL as Ge, cM as Ye, cN as fe, ck as ce, cO as $e, cP as Je, cQ as we, cR as Ne, cS as be, cT as Qe, ao as ye, ak as Ce, cU as ve, cV as Se, cW as Ee, cX as Ve, cY as Le, cZ as Ae, c_ as Oe, c$ as Re, d0 as Te, d1 as Ze, d2 as ue, d3 as ke, ai as te, d as qe, d4 as Ue, d5 as et, e as tt, f as nt, g as at, h as st, i as ot, L as ge, I as xe, w as rt, d6 as it, d7 as De, X as lt, d8 as dt, bU as ct, bV as ut, bW as ht, bX as pt, d9 as mt, da as ft } from "./index-DerPpfv0.js";
|
|
3
3
|
import gt, { useRef as xt, useEffect as ae, useState as w } from "react";
|
|
4
|
-
import { u as Ie } from "./use-visual-utils-
|
|
4
|
+
import { u as Ie } from "./use-visual-utils-D9Kknvjl.js";
|
|
5
5
|
/**
|
|
6
6
|
* @license lucide-react v0.453.0 - ISC
|
|
7
7
|
*
|
|
@@ -62,7 +62,7 @@ function bt({
|
|
|
62
62
|
formatDate: y
|
|
63
63
|
}) {
|
|
64
64
|
var M, U, j, F;
|
|
65
|
-
const { selectVisual: f } = de(), d =
|
|
65
|
+
const { selectVisual: f } = de(), d = ze(t.id), u = Nt(t.id), A = ne((r) => r.isVisualEditing), { isConsoleMode: T } = Be(), x = gt.useRef(null), [S, E] = w(!1), [V, O] = w(!1);
|
|
66
66
|
ae(() => {
|
|
67
67
|
p ? (E(!0), O(!0)) : V && (E(!1), O(!1));
|
|
68
68
|
}, [p, V]), ae(() => {
|
|
@@ -195,7 +195,7 @@ function bt({
|
|
|
195
195
|
},
|
|
196
196
|
disabled: p,
|
|
197
197
|
children: [
|
|
198
|
-
p ? /* @__PURE__ */ e(se, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(
|
|
198
|
+
p ? /* @__PURE__ */ e(se, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(Xe, { className: "h-3.5 w-3.5" }),
|
|
199
199
|
p ? "Duplicating…" : "Duplicate"
|
|
200
200
|
]
|
|
201
201
|
}
|
|
@@ -208,7 +208,7 @@ function bt({
|
|
|
208
208
|
r.stopPropagation(), h == null || h(t);
|
|
209
209
|
},
|
|
210
210
|
children: [
|
|
211
|
-
/* @__PURE__ */ e(
|
|
211
|
+
/* @__PURE__ */ e(Ge, { className: "h-3.5 w-3.5" }),
|
|
212
212
|
"Edit details"
|
|
213
213
|
]
|
|
214
214
|
}
|
|
@@ -243,7 +243,7 @@ function bt({
|
|
|
243
243
|
] }),
|
|
244
244
|
/* @__PURE__ */ e(fe, {}),
|
|
245
245
|
/* @__PURE__ */ n("div", { className: "space-y-1 px-2 py-1.5 text-[11px] text-muted-foreground", children: [
|
|
246
|
-
(((U = t.ownership.createdBy) == null ? void 0 : U.type) === "tenant" || ((j = t.ownership.createdBy) == null ? void 0 : j.type) === "organization" &&
|
|
246
|
+
(((U = t.ownership.createdBy) == null ? void 0 : U.type) === "tenant" || ((j = t.ownership.createdBy) == null ? void 0 : j.type) === "organization" && T) && /* @__PURE__ */ n("div", { className: "flex items-center gap-1.5", children: [
|
|
247
247
|
/* @__PURE__ */ e($e, { className: "h-3 w-3" }),
|
|
248
248
|
/* @__PURE__ */ e("span", { children: ((F = t.ownership.createdBy) == null ? void 0 : F.name) || "Unknown" })
|
|
249
249
|
] }),
|
|
@@ -270,7 +270,7 @@ function yt({ searchQuery: t }) {
|
|
|
270
270
|
null
|
|
271
271
|
), [h, N] = w(!1), [o, b] = w(null), [y, f] = w(null), [d, u] = w(
|
|
272
272
|
null
|
|
273
|
-
), { handleEditLibraryVisual: A, handleAddLibraryVisual:
|
|
273
|
+
), { handleEditLibraryVisual: A, handleAddLibraryVisual: T } = Ie(), {
|
|
274
274
|
resources: x,
|
|
275
275
|
isLoading: S,
|
|
276
276
|
isError: E,
|
|
@@ -282,8 +282,8 @@ function yt({ searchQuery: t }) {
|
|
|
282
282
|
N(!1), b(null);
|
|
283
283
|
}), M = x.filter(
|
|
284
284
|
(s) => {
|
|
285
|
-
var
|
|
286
|
-
return ((
|
|
285
|
+
var R, c;
|
|
286
|
+
return ((R = s == null ? void 0 : s.title) == null ? void 0 : R.toLowerCase().includes(t.toLowerCase())) || ((c = s == null ? void 0 : s.description) == null ? void 0 : c.toLowerCase().includes(t.toLowerCase()));
|
|
287
287
|
}
|
|
288
288
|
), U = (s) => new Date(s).toLocaleDateString("en-US", {
|
|
289
289
|
month: "short",
|
|
@@ -295,56 +295,56 @@ function yt({ searchQuery: t }) {
|
|
|
295
295
|
o && O(o.id);
|
|
296
296
|
}, {
|
|
297
297
|
startUpdating: r,
|
|
298
|
-
stopUpdating:
|
|
299
|
-
isUpdating:
|
|
300
|
-
} = Ne(), L = (s,
|
|
298
|
+
stopUpdating: X,
|
|
299
|
+
isUpdating: B
|
|
300
|
+
} = Ne(), L = (s, R, c) => {
|
|
301
301
|
var ee;
|
|
302
|
-
const
|
|
303
|
-
Object.entries(
|
|
302
|
+
const z = Object.fromEntries(
|
|
303
|
+
Object.entries(R).filter(([, P]) => P !== void 0)
|
|
304
304
|
);
|
|
305
|
-
if (Object.keys(
|
|
305
|
+
if (Object.keys(z).length === 0) {
|
|
306
306
|
(ee = c == null ? void 0 : c.onSuccess) == null || ee.call(c);
|
|
307
307
|
return;
|
|
308
308
|
}
|
|
309
|
-
const D = Object.keys(
|
|
309
|
+
const D = Object.keys(z), K = D.length === 1 ? D[0] : void 0;
|
|
310
310
|
r(s, K), V(
|
|
311
311
|
{
|
|
312
312
|
resourceId: s,
|
|
313
|
-
data:
|
|
313
|
+
data: z
|
|
314
314
|
},
|
|
315
315
|
{
|
|
316
316
|
onSuccess: () => {
|
|
317
317
|
var P;
|
|
318
|
-
|
|
318
|
+
X(s, K), (P = c == null ? void 0 : c.onSuccess) == null || P.call(c);
|
|
319
319
|
},
|
|
320
320
|
onError: () => {
|
|
321
321
|
var P;
|
|
322
|
-
|
|
322
|
+
X(s, K), (P = c == null ? void 0 : c.onError) == null || P.call(c);
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
);
|
|
326
|
-
},
|
|
326
|
+
}, G = (s) => {
|
|
327
327
|
f(s), C(s, {
|
|
328
328
|
onSettled: () => f(null)
|
|
329
329
|
});
|
|
330
330
|
}, H = (s) => {
|
|
331
331
|
A(s);
|
|
332
332
|
}, Y = (s) => {
|
|
333
|
-
|
|
333
|
+
T(s);
|
|
334
334
|
}, $ = (s) => {
|
|
335
335
|
i(s), p(!0);
|
|
336
336
|
}, Z = (s) => {
|
|
337
337
|
u(s);
|
|
338
|
-
},
|
|
338
|
+
}, k = () => {
|
|
339
339
|
u(null);
|
|
340
|
-
},
|
|
340
|
+
}, q = ({
|
|
341
341
|
title: s,
|
|
342
|
-
description:
|
|
342
|
+
description: R
|
|
343
343
|
}) => {
|
|
344
344
|
if (!d)
|
|
345
345
|
return;
|
|
346
346
|
const c = {};
|
|
347
|
-
s !== d.title && (c.title = s), (d.description || "") !==
|
|
347
|
+
s !== d.title && (c.title = s), (d.description || "") !== R && (c.description = R), L(d.id, c, {
|
|
348
348
|
onSuccess: () => {
|
|
349
349
|
u(null);
|
|
350
350
|
}
|
|
@@ -374,7 +374,7 @@ function yt({ searchQuery: t }) {
|
|
|
374
374
|
onOpenVisual: H,
|
|
375
375
|
onEditDetails: Z,
|
|
376
376
|
onDeleteClick: j,
|
|
377
|
-
onDuplicateVisual:
|
|
377
|
+
onDuplicateVisual: G,
|
|
378
378
|
onShareVisual: $,
|
|
379
379
|
isDeleting: v,
|
|
380
380
|
isDuplicating: y === s.id,
|
|
@@ -399,9 +399,9 @@ function yt({ searchQuery: t }) {
|
|
|
399
399
|
resourceLabel: "Visual",
|
|
400
400
|
initialTitle: d.title || "",
|
|
401
401
|
initialDescription: d.description || "",
|
|
402
|
-
onClose:
|
|
403
|
-
onSave:
|
|
404
|
-
isSaving:
|
|
402
|
+
onClose: k,
|
|
403
|
+
onSave: q,
|
|
404
|
+
isSaving: B(d.id)
|
|
405
405
|
}
|
|
406
406
|
),
|
|
407
407
|
/* @__PURE__ */ e(
|
|
@@ -421,9 +421,9 @@ function yt({ searchQuery: t }) {
|
|
|
421
421
|
] })
|
|
422
422
|
] }),
|
|
423
423
|
/* @__PURE__ */ n(Oe, { children: [
|
|
424
|
-
/* @__PURE__ */ e(
|
|
424
|
+
/* @__PURE__ */ e(Re, { disabled: v, children: "Cancel" }),
|
|
425
425
|
/* @__PURE__ */ n(
|
|
426
|
-
|
|
426
|
+
Te,
|
|
427
427
|
{
|
|
428
428
|
onClick: (s) => {
|
|
429
429
|
s.preventDefault(), s.stopPropagation(), F();
|
|
@@ -454,7 +454,7 @@ function Ct({
|
|
|
454
454
|
onDashboardItemClick: y
|
|
455
455
|
}) {
|
|
456
456
|
var V, O;
|
|
457
|
-
const { selectDashboard: f } = de(), d = Ze(t.id), { userContext: u, isLoading: A } = ue(),
|
|
457
|
+
const { selectDashboard: f } = de(), d = Ze(t.id), { userContext: u, isLoading: A } = ue(), T = ((V = u == null ? void 0 : u.permissions) == null ? void 0 : V.canEdit) ?? !1, x = A || !T, S = () => {
|
|
458
458
|
f(t), l(t.id), y == null || y(t.id);
|
|
459
459
|
}, E = (C) => {
|
|
460
460
|
C.currentTarget === C.target && (C.key === "Enter" || C.key === " ") && (C.preventDefault(), S());
|
|
@@ -503,7 +503,7 @@ function Ct({
|
|
|
503
503
|
d ? "opacity-100" : "opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"
|
|
504
504
|
),
|
|
505
505
|
children: /* @__PURE__ */ e(
|
|
506
|
-
|
|
506
|
+
ke,
|
|
507
507
|
{
|
|
508
508
|
dashboard: t,
|
|
509
509
|
isDeleting: m,
|
|
@@ -532,7 +532,7 @@ function St(t) {
|
|
|
532
532
|
var he;
|
|
533
533
|
const { searchQuery: m, onLoadDashboard: p, onEditDashboard: l, onDashboardItemClick: i } = t, [h, N] = w(!1), [o, b] = w(
|
|
534
534
|
null
|
|
535
|
-
), [y, f] = w(!1), [d, u] = w(null), [A,
|
|
535
|
+
), [y, f] = w(!1), [d, u] = w(null), [A, T] = w(null), [x, S] = w(null), E = te(
|
|
536
536
|
(a) => a.lastSelectedDashboard
|
|
537
537
|
), V = te(
|
|
538
538
|
(a) => a.selectedDashboard
|
|
@@ -540,19 +540,19 @@ function St(t) {
|
|
|
540
540
|
(a) => a.actions.selectDashboard
|
|
541
541
|
), C = te(
|
|
542
542
|
(a) => a.actions.clearSelectedDashboard
|
|
543
|
-
), { tokenProps: v, id: M } =
|
|
543
|
+
), { tokenProps: v, id: M } = qe(), {
|
|
544
544
|
resources: U,
|
|
545
545
|
isLoading: j,
|
|
546
546
|
isError: F,
|
|
547
547
|
updateResource: r,
|
|
548
|
-
deleteResource:
|
|
549
|
-
duplicateResource:
|
|
548
|
+
deleteResource: X,
|
|
549
|
+
duplicateResource: B,
|
|
550
550
|
isDeleting: L
|
|
551
551
|
} = Ue(() => {
|
|
552
552
|
f(!1);
|
|
553
553
|
const a = d == null ? void 0 : d.id;
|
|
554
554
|
u(null), (V == null ? void 0 : V.id) === a && (!(v != null && v.dashboard_id) && !M ? C() : E && E.id !== a && O(E));
|
|
555
|
-
}), { userContext:
|
|
555
|
+
}), { userContext: G } = ue(), H = ((he = G == null ? void 0 : G.permissions) == null ? void 0 : he.canCreateDashboard) ?? !1, Y = U.filter(
|
|
556
556
|
(a) => {
|
|
557
557
|
var _, g;
|
|
558
558
|
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()));
|
|
@@ -563,18 +563,18 @@ function St(t) {
|
|
|
563
563
|
year: "numeric"
|
|
564
564
|
}), Z = (a) => {
|
|
565
565
|
p == null || p(a);
|
|
566
|
-
},
|
|
566
|
+
}, k = (a) => {
|
|
567
567
|
u(a), f(!0);
|
|
568
|
-
},
|
|
569
|
-
d &&
|
|
568
|
+
}, q = () => {
|
|
569
|
+
d && X(d.id);
|
|
570
570
|
}, s = (a) => {
|
|
571
|
-
|
|
572
|
-
onSettled: () =>
|
|
571
|
+
T(a), B(a, {
|
|
572
|
+
onSettled: () => T(null)
|
|
573
573
|
});
|
|
574
574
|
}, {
|
|
575
|
-
startUpdating:
|
|
575
|
+
startUpdating: R,
|
|
576
576
|
stopUpdating: c,
|
|
577
|
-
isUpdating:
|
|
577
|
+
isUpdating: z
|
|
578
578
|
} = Ne(), D = (a, _, g) => {
|
|
579
579
|
var me;
|
|
580
580
|
const oe = Object.fromEntries(
|
|
@@ -585,7 +585,7 @@ function St(t) {
|
|
|
585
585
|
return;
|
|
586
586
|
}
|
|
587
587
|
const pe = Object.keys(oe), re = pe.length === 1 ? pe[0] : void 0;
|
|
588
|
-
|
|
588
|
+
R(a, re), r(
|
|
589
589
|
{
|
|
590
590
|
resourceId: a,
|
|
591
591
|
data: oe
|
|
@@ -633,7 +633,7 @@ function St(t) {
|
|
|
633
633
|
isDuplicating: A === a.id,
|
|
634
634
|
onLoadDashboard: Z,
|
|
635
635
|
onEditDetails: ee,
|
|
636
|
-
onDeleteClick:
|
|
636
|
+
onDeleteClick: k,
|
|
637
637
|
onDuplicateDashboard: s,
|
|
638
638
|
onShareDashboard: K,
|
|
639
639
|
formatDate: $,
|
|
@@ -668,12 +668,12 @@ function St(t) {
|
|
|
668
668
|
] })
|
|
669
669
|
] }),
|
|
670
670
|
/* @__PURE__ */ n(Oe, { children: [
|
|
671
|
-
/* @__PURE__ */ e(
|
|
671
|
+
/* @__PURE__ */ e(Re, { disabled: L, children: "Cancel" }),
|
|
672
672
|
/* @__PURE__ */ n(
|
|
673
|
-
|
|
673
|
+
Te,
|
|
674
674
|
{
|
|
675
675
|
onClick: (a) => {
|
|
676
|
-
a.preventDefault(), a.stopPropagation(),
|
|
676
|
+
a.preventDefault(), a.stopPropagation(), q();
|
|
677
677
|
},
|
|
678
678
|
disabled: L,
|
|
679
679
|
children: [
|
|
@@ -695,7 +695,7 @@ function St(t) {
|
|
|
695
695
|
initialDescription: x.description || "",
|
|
696
696
|
onClose: P,
|
|
697
697
|
onSave: Pe,
|
|
698
|
-
isSaving:
|
|
698
|
+
isSaving: z(x.id)
|
|
699
699
|
}
|
|
700
700
|
)
|
|
701
701
|
] });
|
|
@@ -775,17 +775,17 @@ function Et({
|
|
|
775
775
|
] })
|
|
776
776
|
] }) });
|
|
777
777
|
}
|
|
778
|
-
function
|
|
778
|
+
function Rt({
|
|
779
779
|
isOpen: t,
|
|
780
780
|
onClose: m,
|
|
781
781
|
className: p,
|
|
782
782
|
onDashboardItemClick: l,
|
|
783
783
|
variant: i = "inline"
|
|
784
784
|
}) {
|
|
785
|
-
var c,
|
|
785
|
+
var c, z;
|
|
786
786
|
const h = ne(
|
|
787
787
|
(D) => D.isDashboardEditing
|
|
788
|
-
), [N, o] = w(!1), [b, y] = w(""), [f, d] = w(!1), { currentUser: u, userContext: A } = ue(),
|
|
788
|
+
), [N, o] = w(!1), [b, y] = w(""), [f, d] = w(!1), { currentUser: u, userContext: A } = ue(), T = ((c = A == null ? void 0 : A.permissions) == null ? void 0 : c.canCreateDashboard) ?? !1, { onCreateSuccess: x } = it({
|
|
789
789
|
onDashboardSelect: l
|
|
790
790
|
}), { selectVisual: S } = de(), { handleEditLibraryVisual: E } = Ie(), {
|
|
791
791
|
createResource: V,
|
|
@@ -797,26 +797,26 @@ function Tt({
|
|
|
797
797
|
(D) => {
|
|
798
798
|
o(!1), D && (S(D), E(D));
|
|
799
799
|
}
|
|
800
|
-
), U = i === "overlay", j = h ? "New Visual" : "New", F = h ? "New Visual" : "New Dashboard", r = h ? "Search visuals..." : "Search dashboards...",
|
|
800
|
+
), U = i === "overlay", j = h ? "New Visual" : "New", F = 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", Y = ((z = H.charAt(0)) == null ? void 0 : z.toUpperCase()) || "?", $ = L && L.toLowerCase() !== "undefined" ? L : "", Z = wt(m, {
|
|
801
801
|
enabled: t && U
|
|
802
|
-
}),
|
|
802
|
+
}), k = Q(
|
|
803
803
|
"flex h-full flex-col border-r border-border/60 bg-background",
|
|
804
804
|
U ? Q(
|
|
805
805
|
"absolute inset-y-0 left-0 z-[51] w-60 overflow-hidden shadow-lg transition-transform duration-300 ease-in-out",
|
|
806
806
|
t ? "translate-x-0" : "pointer-events-none -translate-x-full"
|
|
807
807
|
) : "w-full max-w-[17rem] min-w-[11rem] overflow-hidden",
|
|
808
808
|
p
|
|
809
|
-
),
|
|
809
|
+
), q = (D) => {
|
|
810
810
|
}, s = (D) => {
|
|
811
811
|
console.log("Editing dashboard:", D);
|
|
812
|
-
},
|
|
812
|
+
}, R = (D) => {
|
|
813
813
|
V(D, {
|
|
814
814
|
onSuccess: (K) => {
|
|
815
815
|
o(!1), x(K, C);
|
|
816
816
|
}
|
|
817
817
|
});
|
|
818
818
|
};
|
|
819
|
-
return /* @__PURE__ */ e(le, { children: (!U || t) && /* @__PURE__ */ n("div", { ref: Z, className:
|
|
819
|
+
return /* @__PURE__ */ e(le, { children: (!U || t) && /* @__PURE__ */ n("div", { ref: Z, className: k, children: [
|
|
820
820
|
/* @__PURE__ */ e("div", { className: "border-b border-border/60 bg-background", children: f ? /* @__PURE__ */ n("div", { className: "flex h-11 items-center gap-1 px-3", children: [
|
|
821
821
|
/* @__PURE__ */ e(De, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
822
822
|
/* @__PURE__ */ e(
|
|
@@ -860,7 +860,7 @@ function Tt({
|
|
|
860
860
|
children: /* @__PURE__ */ e(De, { className: "h-3.5 w-3.5" })
|
|
861
861
|
}
|
|
862
862
|
),
|
|
863
|
-
(h ||
|
|
863
|
+
(h || T) && /* @__PURE__ */ n(
|
|
864
864
|
I,
|
|
865
865
|
{
|
|
866
866
|
size: "xs",
|
|
@@ -880,7 +880,7 @@ function Tt({
|
|
|
880
880
|
variant: "ghost",
|
|
881
881
|
className: "w-7 px-0 text-muted-foreground hover:text-foreground",
|
|
882
882
|
onClick: m,
|
|
883
|
-
"aria-label":
|
|
883
|
+
"aria-label": X,
|
|
884
884
|
children: /* @__PURE__ */ e(dt, { className: "h-3.5 w-3.5" })
|
|
885
885
|
}
|
|
886
886
|
)
|
|
@@ -890,7 +890,7 @@ function Tt({
|
|
|
890
890
|
St,
|
|
891
891
|
{
|
|
892
892
|
searchQuery: b,
|
|
893
|
-
onLoadDashboard:
|
|
893
|
+
onLoadDashboard: q,
|
|
894
894
|
onEditDashboard: s,
|
|
895
895
|
onDashboardItemClick: l
|
|
896
896
|
}
|
|
@@ -922,12 +922,12 @@ function Tt({
|
|
|
922
922
|
{
|
|
923
923
|
open: N,
|
|
924
924
|
onOpenChange: o,
|
|
925
|
-
onSubmit:
|
|
925
|
+
onSubmit: R,
|
|
926
926
|
isCreating: O
|
|
927
927
|
}
|
|
928
928
|
)
|
|
929
929
|
] }) });
|
|
930
930
|
}
|
|
931
931
|
export {
|
|
932
|
-
|
|
932
|
+
Rt as ResourceManagementPanel
|
|
933
933
|
};
|
package/dist/chunks/{resource-management-panel-os6AuEKT.js → resource-management-panel-epydPwyM.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-BlspGR07.js"),h=require("react"),ne=require("./use-visual-utils-Dw_yw9zU.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";const t=require("./index-BlspGR07.js"),e=require("react/jsx-runtime"),v=require("react"),se=require("./use-visual-utils-Dw_yw9zU.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 je=t.createLucideIcon("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
|
|
7
|
+
* @license lucide-react v0.453.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const fe=t.createLucideIcon("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
|
|
12
|
+
* @license lucide-react v0.453.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const he=t.createLucideIcon("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
|
|
17
|
+
* @license lucide-react v0.453.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const re=t.createLucideIcon("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);function le(){var f,j;const a=t.useEditorStore(b=>b.card),l=t.useEditorStore(b=>b.frame),i=v.useMemo(()=>t.findCustomVisualConfigCard(l,a),[l,a]),{manifest:d}=t.useCustomVisual(((f=i==null?void 0:i.customCardPreferences)==null?void 0:f.url)||""),x=v.useMemo(()=>{var b;return(b=d==null?void 0:d.visuals)==null?void 0:b.find(p=>{var C;return p.name===((C=i==null?void 0:i.customCardPreferences)==null?void 0:C.componentName)})},[d,(j=i==null?void 0:i.customCardPreferences)==null?void 0:j.componentName]),u=t.resolveMultiInputType(i,x),h=v.useMemo(()=>t.getCustomVisualInputCards({frame:l,configCard:i,isMultiInputVisual:u==="multiple"}),[l,i,u]),y=v.useMemo(()=>{const b=h.findIndex(p=>(p==null?void 0:p.id)===a.id);return b<0?-1:t.getSlotIndexForCard(a,b)},[h,a]);return v.useMemo(()=>!i||u!=="multiple"||y<0?a.type:t.getEffectiveCardTypeForSlot(a,y,x==null?void 0:x.slots)??a.type,[i,u,y,a,x==null?void 0:x.slots])}function ke({type:a,isLinked:l,className:i,showLabel:d=!1,showLocal:x=!1}){const u=t.useDashboardStore(S=>S.selectedFrameId),h=t.useManagementStore(S=>S.selectedVisual),y=t.useEditorStore(S=>S.frame);let f;if(a)f=a;else if(l!==void 0)f=l?"linked":"library";else if(!!!(y!=null&&y.visualId||h!=null&&h.id)&&u)f="local";else if(h&&!u)f="library";else if(y!=null&&y.visualId&&u)f="linked";else if(h!=null&&h.id&&u)f="library";else return null;if(f==="local"&&!x)return null;const j={local:"border-slate-200/70 bg-slate-50/80 text-slate-700 shadow-sm hover:bg-slate-100/80 dark:border-slate-700 dark:bg-slate-900/70 dark:text-slate-200 dark:hover:bg-slate-800/80",linked:"border-purple-200/70 bg-gradient-to-r from-purple-50/50 to-purple-100/30 text-purple-900 shadow-sm hover:from-purple-100/60 hover:to-purple-100/50 hover:shadow-md dark:border-purple-800/50 dark:from-purple-950/40 dark:to-purple-900/30 dark:text-purple-100 dark:hover:from-purple-950/60 dark:hover:to-purple-900/50",library:"border-blue-200/70 bg-gradient-to-r from-blue-50/50 to-blue-100/30 text-blue-900 shadow-sm hover:from-blue-100/60 hover:to-blue-100/50 hover:shadow-md dark:border-blue-800/50 dark:from-blue-950/40 dark:to-blue-900/30 dark:text-blue-100 dark:hover:from-blue-950/60 dark:hover:to-blue-900/50"},b={local:"Local to this dashboard: Changes made here only affect this dashboard copy.",linked:"Linked to library: Changes made here update the library visual and all linked instances.",library:"Library visual: Share and reuse this visual across multiple dashboards."},p={local:"border-slate-200 bg-slate-50 text-slate-900 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100",linked:"border-purple-200 bg-purple-50 text-purple-900 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-100",library:"border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-100"},C={local:"fill-slate-50 dark:fill-slate-900",linked:"fill-purple-50 dark:fill-purple-950",library:"fill-blue-50 dark:fill-blue-950"},T={local:e.jsx("span",{className:"h-2 w-2 rounded-full bg-current/70"}),linked:e.jsx(he,{className:"h-3.5 w-3.5"}),library:e.jsx(fe,{className:"h-3.5 w-3.5"})},k={local:"Local",linked:"Linked",library:"Library"};return e.jsx(t.TooltipProvider,{children:e.jsxs(t.Tooltip,{delayDuration:300,children:[e.jsx(t.TooltipTrigger,{asChild:!0,children:e.jsxs(t.Badge,{variant:"outline",className:t.cn("cursor-help select-none transition-all",j[f],i),children:[T[f],d&&e.jsx("span",{className:"ml-1 text-xs font-medium leading-none",children:k[f]})]})}),e.jsxs(t.TooltipContent,{side:"bottom",className:t.cn("max-w-xs",p[f]),children:[e.jsx(t.TooltipArrow,{className:C[f]}),e.jsx("p",{children:b[f]})]})]})})}function Se(a,l){return{...a,sql:"",python:"",config:void 0,customCfg:"",preferences:{},interactionConfig:void 0,linkedInteractionTargetOverrides:void 0,dynamicCardPreferences:void 0,customCardPreferences:l?a.customCardPreferences:void 0,visualizationMode:"builtin",type:l?a.type:"bar"}}function ae(a){const l=t.getDynamicFrameSaveIssue(a);return l?(t.ue.error(l),!1):!0}function Ne({className:a,variant:l="outline"}){const i=t.useEditorStore(u=>u.onSave),{getUpdatedFrame:d}=se.useVisualUtils();function x(){const u=d();ae(u)&&(i==null||i(u))}return e.jsxs(t.Button,{onClick:x,className:a,size:"xs",variant:l,children:[e.jsx(t.Check,{className:"h-3.5 w-3.5"}),"Accept"]})}function De({className:a,variant:l="default"}){const i=t.useQueryClient(),[d,x]=v.useState(!1),u=t.useDashboardStore(C=>C.actions.setIsDashboardPanelOpen),{setIsVisualEditing:h}=t.useDashboardActions(),{getUpdatedFrame:y}=se.useVisualUtils(),f=t.useSelectedVisual(),j=t.useEditorStore(C=>C.frame),b=t.useUpdateVisualMutation(),p=()=>{const C=y();if(!ae(C))return;const T=(j==null?void 0:j.visualId)||(f==null?void 0:f.id);if(!T){t.ue.error("No visual to save");return}x(!0),b.mutate({visualId:T,data:{frameObject:C}},{onSuccess:()=>{x(!1),u(!0),t.ue.success("Visual updated successfully"),i.invalidateQueries({queryKey:["resource-by-id","visual",T],exact:!0})},onError:()=>{x(!1),t.ue.error("Failed to update visual")}})};return e.jsx(t.Button,{onClick:p,className:a,size:"xs",variant:l,children:d?e.jsxs(e.Fragment,{children:[e.jsx(t.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving"]}):e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"h-3.5 w-3.5"}),"Save to Library"]})})}function we({className:a}){const l=t.useQueryClient(),[i,d]=v.useState(!1),x=t.useSelectedVisual(),u=t.useEditorStore(k=>k.frame),h=t.useDashboardStore(k=>k.selectedSheetId),y=t.useDashboardStore(k=>k.dashboard),{updateFrame:f,setIsVisualEditing:j}=t.useDashboardActions(),{getUpdatedFrame:b}=se.useVisualUtils(),p=t.useUpdateVisualMutation(),C=t.useResolveExistingFrameSemanticExecutionPayload(),T=async()=>{if(!h){t.ue.error("No sheet selected");return}const k=(u==null?void 0:u.visualId)||(x==null?void 0:x.id);if(!k){t.ue.error("No visual to update");return}d(!0);try{const S=b();if(!ae(S)){d(!1);return}const B={...S,visualId:k},R=t.findDashboardFrameById(y,B.id),O=await C(B,{previousFrame:R});await p.mutateAsync({visualId:k,data:{frameObject:S}}),f(h,B,{semanticExecutionPayload:O}),l.invalidateQueries({queryKey:["visuals"]}),l.invalidateQueries({queryKey:["visual",k]}),t.ue.success("Saved to library and applied locally"),setTimeout(()=>{j(!1)},300)}catch(S){console.error("Failed to save and apply:",S),t.ue.error(S instanceof Error?S.message:"Failed to save and apply changes")}finally{d(!1)}};return e.jsx(t.Button,{onClick:T,className:a,size:"xs",variant:"default",disabled:i,children:i?e.jsxs(e.Fragment,{children:[e.jsx(t.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"h-3.5 w-3.5"}),"Save & Apply"]})})}function Ee({className:a}){const{setTempQueryData:l,setSqlGen:i}=t.useEditorActions(),d=t.useQueryClient(),x=t.useEditorStore(p=>p.tempQueryData),u=t.useEditorStore(p=>p.onClose),h=t.useEditorStore(p=>p.card),y=le(),f=v.useMemo(()=>y!==h.type?{...h,type:y}:h,[h,y]),{queryKey:j}=t.useEditorCardQuery(f);function b(){if(x){const{queryKey:p,queryData:C}=x;p&&C&&d.setQueryData(p,C)}i({}),u==null||u()}return e.jsxs(t.Button,{onClick:b,className:a,size:"xs",variant:"outline",children:[e.jsx(t.X,{className:"h-3.5 w-3.5"}),"Close"]})}function Ve({label:a="Clear",variant:l="secondary",className:i}={}){const{setTempQueryData:d}=t.useEditorActions(),x=t.useQueryClient(),u=t.useEditorStore(r=>r.tempQueryData),h=t.useEditorStore(r=>r.card),y=le(),f=v.useMemo(()=>y!==h.type?{...h,type:y}:h,[h,y]),{queryKey:j}=t.useEditorCardQuery(f),{setCardSql:b,setSqlGen:p,setCardPython:C,setCardCustomCfg:T,setCardPreferences:k,clearQueryConfig:S,setCardConfig:B,setCardType:R,setFrame:O,setCard:U,setActiveTabCardId:J}=t.useEditorActions();function z(){var I,Y,A,H;const r=x.getQueryData(j);u!=null&&u.queryData||d({queryKey:j,queryData:r}),x.setQueryData(j,null),x.removeQueries({queryKey:j,exact:!0}),b(""),p({}),S(),B(void 0),C(""),T(""),k({});const D=t.useEditorStore.getState().frame,_=t.useEditorStore.getState().card,V=t.findCustomVisualConfigCard(D,_),P=((I=V==null?void 0:V.customCardPreferences)==null?void 0:I.visualType)==="multiple"||!!((Y=V==null?void 0:V.customCardPreferences)!=null&&Y.dataInputCardIds)||(((A=V==null?void 0:V.customCardPreferences)==null?void 0:A.minInputs)||0)>1||(((H=V==null?void 0:V.customCardPreferences)==null?void 0:H.maxInputs)||0)>1,q=Se(_,P);O({...D,cards:D.cards.map(K=>K.id===q.id?q:K)}),J(q.id),U(q),P||R("bar")}return e.jsxs(t.Button,{onClick:z,className:i,size:"xs",variant:l,children:[e.jsx(t.X,{className:"h-3.5 w-3.5"}),a]})}function ge(a){const{control:l,onChange:i}=a;return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(t.Label,{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Label"}),e.jsx(t.Input,{size:"xs",value:l.label,placeholder:"Control label",onChange:d=>i(d.target.value)})]})}function Te(a){const{currentStep:l,labels:i}=a;return e.jsx("div",{className:"sticky top-0 z-10 -mx-1 border-b border-border/60 bg-background/95 px-1 pb-2.5 pt-1 backdrop-blur supports-[backdrop-filter]:bg-background/85",children:e.jsx("div",{className:"flex flex-wrap items-center gap-2 sm:gap-2.5",children:i.map((d,x)=>{const u=x+1,h=u===l,y=u<l;return e.jsxs(v.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:t.cn("flex h-5 w-5 items-center justify-center rounded-full border text-[10px] font-medium tabular-nums",h?"border-foreground bg-foreground text-background":y?"border-foreground/30 bg-foreground/10 text-foreground":"border-border/60 bg-background text-muted-foreground"),children:u}),e.jsx("span",{className:t.cn("text-[12px]",h?"font-medium text-foreground":"text-muted-foreground"),children:d})]}),x<i.length-1?e.jsx("span",{className:"h-px w-4 bg-border/60 sm:w-6","aria-hidden":"true"}):null]},d)})})})}function G(a){const{secondary:l,tertiary:i,primary:d}=a;return e.jsxs("div",{className:"sticky bottom-0 z-10 -mx-1 flex justify-end gap-2 border-t bg-background/95 px-1 pb-1 pt-3 backdrop-blur supports-[backdrop-filter]:bg-background/85",children:[l,i,d]})}function Ie(a){const{control:l,scope:i,detail:d}=a;return e.jsxs("div",{className:"flex items-start gap-2.5 rounded-[6px] border border-border/60 bg-muted/30 px-3 py-2.5",children:[e.jsx(t.CircleCheck,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-foreground"}),e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsx("div",{className:"text-[13px] font-medium text-foreground",children:l.label}),e.jsxs("div",{className:"text-[12px] text-muted-foreground",children:[t.getFriendlyTypeOption(l.type).label," ·"," ",t.getControlOptionPreview(l)," ·"," ",t.getPlacementLabel(i,l.placement)]}),d?e.jsx("div",{className:"text-[12px] text-muted-foreground",children:d}):null]})]})}function pe(a){const{control:l,defaultValue:i,availableFieldChoices:d,availableMetricChoices:x,previewControlDefinitions:u,previewControlValues:h,onControlChange:y,onLabelChange:f,onDefaultValueChange:j,onBack:b,onNext:p,nextDisabled:C}=a;return e.jsxs("div",{className:"space-y-3",children:[e.jsx(ge,{control:l,onChange:f}),e.jsx(t.ControlDefinitionOptionsEditor,{control:l,availableFieldChoices:d,availableMetricChoices:x,previewControlDefinitions:u,previewControlValues:h,controlLifecycle:"create",onChange:y}),e.jsx(t.ControlDefaultValueEditor,{control:l,value:i,onChange:j,allowNoDefault:!0,allowCardDefault:!0,hint:"This is the value viewers will see first.",previewControlDefinitions:u,previewControlValues:h}),e.jsx(G,{secondary:e.jsx(t.Button,{type:"button",variant:"outline",size:"xs",onClick:b,children:"Back"}),primary:e.jsx(t.Button,{type:"button",size:"xs",onClick:p,disabled:C,children:"Next"})})]})}const Fe=new Set(["grain_selector","aggregation_selector","field_selector","metric_selector"]);function me(a){const{text:l,ariaLabel:i}=a,[d,x]=v.useState(!1);return e.jsxs("button",{type:"button","aria-label":i,onClick:async()=>{try{await navigator.clipboard.writeText(l),x(!0),setTimeout(()=>x(!1),1200)}catch(u){console.error("Failed to copy",u)}},className:"group flex w-full items-center justify-between gap-2 rounded-[4px] bg-muted/40 px-2 py-1 text-left transition-colors hover:bg-muted/60 focus-visible:bg-muted/60 focus-visible:outline-none",children:[e.jsx("code",{className:"min-w-0 truncate font-mono text-[12px] text-foreground",children:l}),e.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",children:d?"Copied":"Click to copy"})]})}function xe(a){const{control:l,scope:i,createdReference:d,explorerContent:x,sqlDescription:u,summaryDetail:h,onBack:y,onCancel:f,onDone:j}=a,b=Fe.has(l.type),p=d.match(/\[\[param\.(.+?)\]\]/),C=p?`{{ param('${p[1]}') }}`:"";return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Ie,{control:l,scope:i,detail:h}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[13px] font-medium text-foreground",children:"How cards use this control"}),e.jsxs("div",{className:"divide-y divide-border/60 overflow-hidden rounded-[6px] border border-border/60",children:[b?e.jsxs("div",{className:"space-y-1 px-3 py-2.5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Explorer cards"}),e.jsx("div",{className:"text-[12px] text-muted-foreground",children:x})]}):null,e.jsxs("div",{className:"space-y-1.5 px-3 py-2.5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"SQL cards"}),e.jsx(me,{text:d,ariaLabel:"Copy SQL control reference"}),C?e.jsx(me,{text:C,ariaLabel:"Copy Jinja control reference"}):null,e.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[u," ",e.jsx("a",{href:"https://docs.semaphor.cloud/docs/concepts/template-expressions",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Template expressions docs"}),"."]})]})]})]}),e.jsx(G,{secondary:e.jsx(t.Button,{type:"button",variant:"outline",size:"xs",onClick:y,children:"Back"}),tertiary:e.jsx(t.Button,{type:"button",variant:"outline",size:"xs",onClick:f,children:"Cancel"}),primary:e.jsx(t.Button,{type:"button",size:"xs",onClick:j,children:"Done"})})]})}function Le(a){const l=t.createBlankControl(a.scope,a.existingControls,a.reservedIds),i=a.type===l.type?{...l,label:t.DEFAULT_LABEL_BY_TYPE[a.type]}:{...t.applyControlTypeChange({controls:[{...l,label:t.DEFAULT_LABEL_BY_TYPE[a.type]}],controlId:l.id,nextType:a.type}).controls[0],label:t.DEFAULT_LABEL_BY_TYPE[a.type]};return{step:2,control:i,defaultValue:t.getDefaultValueForType(i,void 0)}}function Be({scope:a,controls:l,reservedControlIds:i,defaultValues:d,onChange:x,emptyMessage:u,initialCreateFlow:h=!1,usageByControlId:y,availableFieldChoices:f,availableMetricChoices:j,structuralParticipants:b,structuralParticipantIdsByControlId:p,card:C,onCreateFlowActiveChange:T,onCreateFlowComplete:k}){const S=v.useMemo(()=>new Set(i||[]),[i]),B=t.getPlacementOptionsForScope(a),R=t.getDefaultPlacement(a),[O,U]=v.useState(null),[J,z]=v.useState(null),[r,D]=v.useState(()=>h?{step:1,control:t.createBlankControl(a,l,Array.from(S))}:null),_=v.useRef({}),V=v.useRef(void 0),P=v.useRef(h),q=v.useMemo(()=>t.getFriendlyControlTypeOptions({scope:a,card:C}),[C,a]),I=v.useCallback(s=>a==="dashboard"&&(s==="field_selector"||s==="metric_selector"),[a]),Y=v.useMemo(()=>r?t.getEligibleParticipantsForStructuralControl(b||[],r.control.type):[],[r,b]),A=v.useMemo(()=>{if(!r)return{fields:f||[],metrics:j||[]};if(!I(r.control.type))return{fields:f||[],metrics:j||[]};const s=r.selectedCardIds||[],o=t.getCompatibleStructuralChoiceCatalog({controlType:r.control.type,participants:b||[],selectedCardIds:s});return{fields:r.control.type==="field_selector"?o.choices.map(n=>({option:n,target:o.fieldTargetMap[n.value]})):[],metrics:r.control.type==="metric_selector"?o.choices.map(n=>({option:n,target:o.metricTargetMap[n.value]})):[]}},[f,j,r,I,b]);v.useEffect(()=>{T==null||T(!!r)},[r,T]),v.useEffect(()=>{const s=h&&!P.current;P.current=h,s&&(D({step:1,control:t.createBlankControl(a,l,Array.from(S))}),z(null),U(null))},[l,h,S,a]);const H=s=>{if(!I(s.type))return{fields:f||[],metrics:j||[]};const o=(p==null?void 0:p[s.id])||[];if(o.length===0)return{fields:f||[],metrics:j||[]};const n=t.getCompatibleStructuralChoiceCatalog({controlType:s.type,participants:b||[],selectedCardIds:o});return{fields:s.type==="field_selector"?n.choices.map(c=>({option:c,target:n.fieldTargetMap[c.value]})):[],metrics:s.type==="metric_selector"?n.choices.map(c=>({option:c,target:n.metricTargetMap[c.value]})):[]}},K=s=>{if(!I(s.control.type))return{nextControl:s.control,cardBindingsById:void 0};const o=(p==null?void 0:p[s.control.id])||[],n=t.getCompatibleStructuralChoiceCatalog({controlType:s.control.type,participants:b||[],selectedCardIds:s.nextSelectedCardIds}),c=t.reconcileStructuralControlChoices({control:s.control,choices:n.choices}),g=Object.fromEntries(o.filter(w=>!s.nextSelectedCardIds.includes(w)).map(w=>[w,void 0]));return s.nextSelectedCardIds.length>0&&c.source.kind==="manual"&&c.source.options.length>0&&Object.assign(g,t.buildStructuralControlBindingsForParticipants({control:c,participants:b||[],selectedCardIds:s.nextSelectedCardIds})),{nextControl:c,cardBindingsById:g}},L=v.useCallback((s,o=d,n={type:"update"})=>{const c=s.map(g=>(t.resolveAuthoringControlDefaultValue({control:g,defaultValues:o}),t.syncSqlQueryControlExecutionRequirement(g)));x(c,o,n)},[d,x]),X=(s,o)=>{const n=l.find(E=>E.id===s);let c=l.map(E=>E.id!==s?E:o(E));const g=c.find(E=>E.id===s);let w,m;if(g&&a==="dashboard"&&(g.type==="field_selector"||g.type==="metric_selector")){const E=(p==null?void 0:p[g.id])||[],Q=K({control:g,nextSelectedCardIds:E});c=c.map(M=>M.id===s?Q.nextControl:M),w=Q.cardBindingsById,m=[g.id]}else if(n&&a==="dashboard"&&(n.type==="field_selector"||n.type==="metric_selector")){const E=(p==null?void 0:p[n.id])||[];w=Object.fromEntries(E.map(Q=>[Q,void 0])),m=[n.id]}const N=c.find(E=>E.id===s);let F=d;if(n&&N){const E=t.resolveAuthoringControlDefaultValue({control:n,defaultValues:d});n.source.kind==="manual"&&N.source.kind==="sql_query"&&(_.current[s]=E);const Q=E===void 0&&n.source.kind==="sql_query"&&N.source.kind==="manual"?_.current[s]:E,M=t.getNextEditedControlDefaultValue({previousControl:n,nextControl:N,currentDefaultValue:Q});N.source.kind==="manual"&&(_.current[s]=M),d&&(F={...d},M===void 0?delete F[s]:F[s]=M),c=c.map(ue=>ue.id===s?{...N,defaultValue:M}:ue)}L(c,F,{type:"update",cardBindingsById:w,affectedBindingControlIds:m})},be=(s,o)=>{const n=o.trim();if(n.length===0||n===s||S.has(n)||l.some(w=>w.id===n&&w.id!==s))return;const c=l.map(w=>w.id===s?{...w,id:n}:w);if(!d){L(c,void 0,{type:"rename",oldId:s,newId:n});return}const g={...d};Object.prototype.hasOwnProperty.call(g,s)&&(g[n]=g[s],delete g[s]),L(c,g,{type:"rename",oldId:s,newId:n})},ye=s=>{const o=l.filter(c=>c.id!==s);if(!d){L(o,void 0,{type:"remove",controlId:s});return}const n={...d};delete n[s],L(o,n,{type:"remove",controlId:s})},ve=v.useCallback(()=>{V.current=void 0,D({step:1,control:t.createBlankControl(a,l,Array.from(S))}),z(null),U(null)},[l,S,a]),$=s=>{D(o=>o&&(()=>{const n=s(o.control);o.control.source.kind==="manual"&&n.source.kind==="sql_query"&&(V.current=o.defaultValue);const c=o.defaultValue===void 0&&o.control.source.kind==="sql_query"&&n.source.kind==="manual"?V.current:o.defaultValue,g=t.getNextEditedControlDefaultValue({previousControl:o.control,nextControl:n,currentDefaultValue:c});return n.source.kind==="manual"&&(V.current=g),{...o,control:n,defaultValue:g}})())},ne=s=>{D(o=>o&&(o.control.source.kind==="manual"&&(V.current=s),{...o,defaultValue:s}))},W=(()=>{if(!r)return!1;if(r.step===2&&I(r.control.type))return(r.selectedCardIds||[]).length>0;if(r.step!==2&&r.step!==3||!r.control.label.trim())return!1;const o=r.control.source.kind==="sql_query"?r.control:t.ensureManualSource(r.control);if(o.source.kind==="manual"&&(t.needsManualOptions(o)&&o.source.options.length===0||o.source.options.some(c=>c.label.trim().length===0||c.value.trim().length===0)))return!1;if(o.source.kind==="sql_query"){const{connectionId:n,sql:c,valueColumn:g}=o.source;return n.trim().length>0&&c.trim().length>0&&g.trim().length>0}return t.hasConcreteDefaultValue(t.getDefaultValueForType(o,r.defaultValue))})(),oe=()=>{var w;if(!r)return;const s=t.ensureManualSource(r.control),o=t.deriveUniqueControlId({label:s.label,fallbackId:s.id,existingControls:l,reservedIds:Array.from(S)}),n={...s,id:o},c=a==="dashboard"&&(n.type==="field_selector"||n.type==="metric_selector")&&((w=r.selectedCardIds)!=null&&w.length)?t.buildStructuralControlBindingsForParticipants({control:n,participants:b||[],selectedCardIds:r.selectedCardIds}):void 0,g=t.getDefaultValueForType(n,r.defaultValue);D({step:a==="dashboard"&&(n.type==="field_selector"||n.type==="metric_selector")?4:3,control:n,defaultValue:g,createdControlId:o,selectedCardIds:r.selectedCardIds,cardBindingsById:c})},Z=v.useCallback(()=>{D(null)},[]),ie=v.useCallback(()=>{if(!(r!=null&&r.createdControlId)){D(null);return}const s=r.control,o=r.createdControlId,n=t.getDefaultValueForType(s,r.defaultValue);if(d){const c={...d};n===void 0?delete c[o]:c[o]=n,L([...l,{...s,defaultValue:n}],c,{type:"add",cardBindingsById:r.cardBindingsById})}else L([...l,{...s,defaultValue:n}],void 0,{type:"add",cardBindingsById:r.cardBindingsById});z(o),D(null),k==null||k()},[l,r,d,L,k]),Ce=r?I(r.control.type)?["Choose type","Select cards","Configure","Finish"]:["Choose type","Configure","Finish"]:[],de=r!=null&&r.createdControlId?`[[param.${r.createdControlId}]]`:r?`[[param.${t.slugifyControlValue(r.control.label)||r.control.id}]]`:"",ee=t.buildAuthoringPreviewControlValues({controls:l,defaultValues:d}),te=r?[...l,r.control]:l,ce=r?t.buildAuthoringPreviewControlValues({controls:te,defaultValues:d,overrides:[{controlId:r.control.id,value:r.defaultValue}]}):ee;return e.jsxs("div",{className:"space-y-4",children:[r?e.jsxs("div",{className:"space-y-4 pb-1",children:[e.jsx(Te,{currentStep:r.step,labels:Ce}),r.step===1&&(()=>{const s=new Set(["grain_selector","aggregation_selector","field_selector","metric_selector"]),o=q.filter(g=>!s.has(g.value)),n=q.filter(g=>s.has(g.value)),c=g=>e.jsxs("button",{type:"button",className:"rounded-[6px] border border-border/60 bg-background px-3 py-2.5 text-left transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:outline-none",onClick:()=>D(Le({scope:a,existingControls:l,reservedIds:Array.from(S),type:g.value})),children:[e.jsx("div",{className:"text-[13px] font-medium text-foreground",children:g.label}),e.jsx("p",{className:"mt-0.5 text-[12px] text-muted-foreground",children:g.description})]},g.value);return e.jsxs("div",{className:"space-y-4",children:[a==="card"&&(C==null?void 0:C.sql)==null?e.jsx("p",{className:"text-[12px] text-muted-foreground",children:"Explorer cards support displayed metric, group by field, aggregation, and time grain controls here."}):null,o.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Input controls"}),e.jsx("div",{className:"grid gap-1.5 sm:grid-cols-2",children:o.map(c)})]}),n.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Data-driven controls"}),e.jsx("div",{className:"grid gap-1.5 sm:grid-cols-2",children:n.map(c)})]}),e.jsx(G,{secondary:e.jsx(t.Button,{type:"button",variant:"outline",size:"xs",onClick:Z,children:"Back to controls"})})]})})(),r.step===2&&I(r.control.type)&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(ge,{control:r.control,onChange:s=>$(o=>({...o,label:s}))}),e.jsx("p",{className:"text-[12px] text-muted-foreground",children:"Choose which cards should respond to this shared control."})]}),Y.length===0?e.jsx("div",{className:"rounded-[6px] border border-border/60 bg-muted/30 px-3 py-2.5 text-[12px] text-muted-foreground",children:"No eligible cards are available yet. Add compatible metrics or group-by fields to cards first."}):e.jsx("div",{className:"space-y-1 rounded-[6px] border border-border/60 bg-background p-2",children:Y.map(s=>{const o=(r.selectedCardIds||[]).includes(s.cardId);return e.jsxs("label",{className:"flex items-start gap-2 rounded-[4px] px-1.5 py-1 text-[13px] hover:bg-muted/40",children:[e.jsx(t.Checkbox,{checked:o,onCheckedChange:n=>D(c=>c&&{...c,selectedCardIds:n===!0?[...c.selectedCardIds||[],s.cardId]:(c.selectedCardIds||[]).filter(g=>g!==s.cardId)})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-foreground",children:s.title}),e.jsx("div",{className:"text-[12px] text-muted-foreground",children:r.control.type==="field_selector"?`${s.fieldChoices.length} compatible group-by fields`:`${s.metricChoices.length} compatible metrics`})]})]},s.cardId)})}),e.jsx(G,{secondary:e.jsx(t.Button,{type:"button",variant:"outline",size:"xs",onClick:()=>D(s=>s&&{...s,step:1,selectedCardIds:[]}),children:"Back"}),primary:e.jsx(t.Button,{type:"button",size:"xs",onClick:()=>D(s=>s&&{...s,step:3}),disabled:!W,children:"Next"})})]}),r.step===2&&!I(r.control.type)&&e.jsx(pe,{control:r.control,defaultValue:r.defaultValue,availableFieldChoices:A.fields,availableMetricChoices:A.metrics,previewControlDefinitions:te,previewControlValues:ce,onControlChange:s=>$(()=>s),onLabelChange:s=>$(o=>({...o,label:s})),onDefaultValueChange:ne,onBack:()=>D(s=>s&&{...s,step:1}),onNext:oe,nextDisabled:!W}),r.step===3&&I(r.control.type)&&e.jsx(pe,{control:r.control,defaultValue:r.defaultValue,availableFieldChoices:A.fields,availableMetricChoices:A.metrics,previewControlDefinitions:te,previewControlValues:ce,onControlChange:s=>$(()=>s),onLabelChange:s=>$(o=>({...o,label:s})),onDefaultValueChange:ne,onBack:()=>D(s=>s&&{...s,step:2}),onNext:oe,nextDisabled:!W}),r.step===3&&!I(r.control.type)&&e.jsx(xe,{control:r.control,scope:a,createdReference:de,explorerContent:e.jsxs(e.Fragment,{children:["Open the card and use"," ",e.jsx("span",{className:"font-medium text-foreground",children:"Settings → Controls"})," ","to choose what this control changes."]}),sqlDescription:"Reference this control directly in the SQL editor.",onBack:()=>D(s=>s&&{...s,step:2}),onCancel:Z,onDone:ie}),r.step===4&&I(r.control.type)&&e.jsx(xe,{control:r.control,scope:a,createdReference:de,summaryDetail:e.jsxs(e.Fragment,{children:["Used by ",(r.selectedCardIds||[]).length," ","selected card",(r.selectedCardIds||[]).length===1?"":"s"]}),explorerContent:e.jsx(e.Fragment,{children:"Selected cards have been set up to respond to this control automatically."}),sqlDescription:"SQL cards can still reference this control directly in the SQL editor.",onBack:()=>D(s=>s&&{...s,step:3}),onCancel:Z,onDone:ie})]}):null,!r&&l.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-sm text-muted-foreground",children:u}):null,!r&&l.map(s=>{const o=H(s),n=y==null?void 0:y[s.id],c=t.resolveAuthoringControlDefaultValue({control:s,defaultValues:d}),g=J===s.id,w="inline-flex shrink-0 items-center rounded-[4px] border border-border/60 bg-muted/40 px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground";return e.jsxs("div",{className:"rounded-[6px] border border-border/60",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[e.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-start gap-2 rounded-[4px] text-left focus:outline-none focus-visible:bg-muted/40",onClick:()=>z(m=>m===s.id?null:s.id),children:[g?e.jsx(t.ChevronDown,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}):e.jsx(t.ChevronRight,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-[13px] font-medium text-foreground",children:s.label||"Untitled control"}),e.jsx("span",{className:w,children:t.getFriendlyTypeOption(s.type).label}),e.jsx("span",{className:w,children:t.getPlacementLabel(a,s.placement)})]}),e.jsxs("div",{className:"mt-0.5 text-[12px] text-muted-foreground",children:[t.getControlOptionPreview(s),n!=null&&n.status?` · ${n.status}`:""]})]})]}),e.jsx(t.Button,{type:"button",size:"xs",variant:"ghost",className:"h-7 w-7 shrink-0 p-0 text-muted-foreground",onClick:()=>ye(s.id),"aria-label":`Remove ${s.label}`,children:e.jsx(t.Trash2,{className:"h-3.5 w-3.5"})})]}),g&&e.jsxs("div",{className:"space-y-4 border-t border-border/60 px-3 py-3",children:[e.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(t.Label,{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Label"}),e.jsx(t.Input,{size:"xs",value:s.label,placeholder:"Control label",onChange:m=>X(s.id,N=>({...N,label:m.target.value}))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(t.Label,{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Type"}),e.jsxs(t.Select,{value:s.type,onValueChange:m=>{const N=t.applyControlTypeChange({controls:l,controlId:s.id,nextType:m,defaultValues:d});L(N.controls,N.defaultValues)},children:[e.jsx(t.SelectTrigger,{size:"xs",children:e.jsx(t.SelectValue,{})}),e.jsx(t.SelectContent,{children:t.getFriendlyControlTypeOptions({scope:a,card:C,includeType:s.type}).map(m=>e.jsx(t.SelectItem,{value:m.value,children:m.label},m.value))})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(t.Label,{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Show in"}),e.jsxs(t.Select,{value:s.placement||R,onValueChange:m=>X(s.id,N=>({...N,placement:m})),children:[e.jsx(t.SelectTrigger,{size:"xs",children:e.jsx(t.SelectValue,{})}),e.jsx(t.SelectContent,{children:B.map(m=>e.jsx(t.SelectItem,{value:m.value,children:m.label},m.value))})]})]})]}),I(s.type)?e.jsx(t.StructuralParticipantSelector,{type:s.type,participants:t.getEligibleParticipantsForStructuralControl(b||[],s.type).map(m=>({cardId:m.cardId,title:m.title,choiceCount:s.type==="field_selector"?m.fieldChoices.length:m.metricChoices.length})),selectedCardIds:(p==null?void 0:p[s.id])||[],onChange:m=>{const N=K({control:s,nextSelectedCardIds:m}),F=l.map(E=>E.id===s.id?N.nextControl:E);L(F,d,{type:"update",cardBindingsById:N.cardBindingsById})}}):null,e.jsx(t.ControlDefinitionOptionsEditor,{control:s,availableFieldChoices:o.fields,availableMetricChoices:o.metrics,previewControlDefinitions:l,previewControlValues:ee,controlLifecycle:"edit",onChange:m=>X(s.id,()=>m)}),s.initialValueStrategy==="saved_default"&&e.jsx(t.ControlDefaultValueEditor,{control:s,value:c,allowNoDefault:!0,allowCardDefault:!0,previewControlDefinitions:l,previewControlValues:ee,onChange:m=>{const N=l.map(F=>F.id===s.id?{...F,defaultValue:m}:F);if(s.source.kind==="manual"&&(_.current[s.id]=m),d){const F={...d};m===void 0?delete F[s.id]:F[s.id]=m,L(N,F);return}L(N,void 0)}}),e.jsxs(t.Collapsible,{open:O===s.id,onOpenChange:m=>U(m?s.id:null),children:[e.jsx(t.CollapsibleTrigger,{asChild:!0,children:e.jsxs(t.Button,{type:"button",variant:"ghost",size:"xs",className:"-ml-2 gap-1 text-muted-foreground hover:text-foreground",children:[O===s.id?e.jsx(t.ChevronDown,{className:"h-3.5 w-3.5"}):e.jsx(t.ChevronRight,{className:"h-3.5 w-3.5"}),"Advanced"]})}),e.jsxs(t.CollapsibleContent,{className:"space-y-3 pt-2",children:[e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(t.Label,{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Control ID"}),e.jsx(t.ControlIdInput,{controlId:s.id,onCommit:m=>be(s.id,m)},s.id)]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(t.Label,{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Initial value"}),e.jsxs(t.Select,{value:s.initialValueStrategy,onValueChange:m=>X(s.id,N=>({...N,initialValueStrategy:m})),children:[e.jsx(t.SelectTrigger,{size:"xs",children:e.jsx(t.SelectValue,{})}),e.jsx(t.SelectContent,{children:t.INITIAL_VALUE_STRATEGY_OPTIONS.map(m=>e.jsx(t.SelectItem,{value:m.value,children:m.label},m.value))})]})]})]}),e.jsx(t.ControlVisibilitySettings,{control:s,onChange:m=>X(s.id,()=>m)})]})]})]})]},s.id)}),!r&&e.jsxs(t.Button,{type:"button",variant:"outline",size:"xs",onClick:ve,children:[e.jsx(t.Plus,{className:"h-3.5 w-3.5"}),"Add control"]})]})}function _e(a){const{open:l,onOpenChange:i,initialCreateFlowActive:d=!1,dismissMode:x="passive"}=a,u=l!==void 0,[h,y]=v.useState(!1),[f,j]=v.useState(d),b=u?l:h,p=v.useCallback(k=>{!k&&f&&x==="passive"||(u||y(k),k||j(!1),i==null||i(k))},[u,f,x,i]),C=v.useCallback(()=>{u||y(!1),j(!1),i==null||i(!1)},[u,i]);v.useEffect(()=>{b||j(!1)},[b]);const T=v.useCallback(k=>{f&&k.preventDefault()},[f]);return{forceClose:C,handleOpenChange:p,isCreateFlowActive:f,preventPassiveDismissDuringCreate:T,resolvedOpen:b,setIsCreateFlowActive:j}}exports.CircleX=je;exports.ControlDefinitionListEditor=Be;exports.EditorAcceptButton=Ne;exports.EditorCancelButton=Ee;exports.EditorClearButton=Ve;exports.Library=fe;exports.Link2=he;exports.Save=re;exports.VisualBadge=ke;exports.VisualSaveAndApplyButton=we;exports.VisualSaveButton=De;exports.useCreateFlowOverlayState=_e;exports.useEffectiveEditorCardType=le;
|