react-semaphor 0.1.125 → 0.1.127
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/dashboard-controls-BFo8ClGD.js +1473 -0
- package/dist/chunks/dashboard-controls-CpNsaWbB.js +26 -0
- package/dist/chunks/dashboard-export-dialog-CKGJIz95.js +6 -0
- package/dist/chunks/dashboard-export-dialog-CKr9o8DW.js +600 -0
- package/dist/chunks/{dashboard-json-BlEVRs4V.js → dashboard-json-Bqddgxcf.js} +1 -1
- package/dist/chunks/{dashboard-json-Cn2IxIvK.js → dashboard-json-CZrxKZBn.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-CHqS0-RO.js → edit-dashboard-visual-Du3rYBkf.js} +5966 -4980
- package/dist/chunks/edit-dashboard-visual-Kg8h34hs.js +195 -0
- package/dist/chunks/{editor-action-buttons-BjVPDqso.js → editor-action-buttons-BMeOcqc2.js} +2 -2
- package/dist/chunks/{editor-action-buttons-j0OdQL7Y.js → editor-action-buttons-DHk1Cdb6.js} +1 -1
- package/dist/chunks/{index-CZGIYFfM.js → index-DJmpV5Lg.js} +163 -158
- package/dist/chunks/{index-BQPGBZP4.js → index-DLxVadBx.js} +5788 -5769
- package/dist/chunks/{resource-management-panel-CaktfbhQ.js → resource-management-panel-D6gqCHWr.js} +1 -1
- package/dist/chunks/{resource-management-panel-BD6pGiUl.js → resource-management-panel-VT7LYPp8.js} +88 -88
- package/dist/chunks/{use-visual-utils-uElEhCM9.js → use-visual-utils-DpxMI5Pe.js} +1 -1
- package/dist/chunks/{use-visual-utils-Dhcu2Fn4.js → use-visual-utils-O1QcxL8l.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +25 -24
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/dashboard.d.ts +1 -1
- package/dist/types/main.d.ts +9 -2
- package/dist/types/surfboard.d.ts +1 -1
- package/dist/types/types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-Bx-ySdim.js +0 -1561
- package/dist/chunks/dashboard-controls-CZkFeNrk.js +0 -26
- package/dist/chunks/edit-dashboard-visual-Cm5Mc4Um.js +0 -170
- package/dist/chunks/schedule-dashboard-BQ5u1NRe.js +0 -415
- package/dist/chunks/schedule-dashboard-Cul4sDBY.js +0 -6
package/dist/chunks/{resource-management-panel-CaktfbhQ.js → resource-management-panel-D6gqCHWr.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-DJmpV5Lg.js"),m=require("react"),re=require("./use-visual-utils-O1QcxL8l.js"),ue=require("./use-click-outside-B9T3lmcw.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
package/dist/chunks/{resource-management-panel-BD6pGiUl.js → resource-management-panel-VT7LYPp8.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a, Fragment as me } from "react/jsx-runtime";
|
|
2
|
-
import { b as Ke, u as de, f as We, am as ne,
|
|
2
|
+
import { b as Ke, u as de, f as We, am as ne, aW as Ye, aX as Je, c as ee, aY as Xe, aE as Ze, aF as $e, B as G, aG as Qe, aH as ke, aI as J, aZ as ce, L as ie, a_ as et, a$ as tt, b0 as st, b1 as Ne, b2 as pe, b3 as at, b4 as nt, I as it, b5 as we, b6 as re, b7 as Ce, b8 as ve, b9 as rt, J as ye, R as Se, ba as Ve, bb as Ee, bc as Le, bd as Te, be as Ae, bf as Oe, bg as Pe, bh as Re, bi as Ie, bj as ot, bk as lt, bl as Ue, bm as je, bn as Me, bo as dt, bp as Fe, bq as ct, aC as ae, al as ut, br as ht, bs as ze, bt as mt, bu as pt, aq as ft, ar as gt, as as Dt, at as xt, au as Nt, av as be, aw as ue, az as bt, bv as wt, bw as Ct, bx as vt, by as yt } from "./index-DLxVadBx.js";
|
|
3
3
|
import St, { useState as g, useEffect as he } from "react";
|
|
4
|
-
import { a as Be } from "./use-visual-utils-
|
|
4
|
+
import { a as Be } from "./use-visual-utils-DpxMI5Pe.js";
|
|
5
5
|
import { u as Vt } from "./use-click-outside-CMeO_QFI.js";
|
|
6
6
|
/**
|
|
7
7
|
* @license lucide-react v0.453.0 - ISC
|
|
@@ -51,8 +51,8 @@ function Tt({
|
|
|
51
51
|
onShareVisual: N,
|
|
52
52
|
formatDate: S
|
|
53
53
|
}) {
|
|
54
|
-
var P, y, C,
|
|
55
|
-
const { selectVisual: l } = ne(), d = Ye(t.id), h = Lt(t.id), { isConsoleMode: V } = Je(), E = St.useRef(null), [
|
|
54
|
+
var P, y, C, A;
|
|
55
|
+
const { selectVisual: l } = ne(), d = Ye(t.id), h = Lt(t.id), { isConsoleMode: V } = Je(), E = St.useRef(null), [b, v] = g(!1), [L, T] = g(!1);
|
|
56
56
|
he(() => {
|
|
57
57
|
p ? (v(!0), T(!0)) : L && (v(!1), T(!1));
|
|
58
58
|
}, [p, L]), he(() => {
|
|
@@ -74,7 +74,7 @@ function Tt({
|
|
|
74
74
|
),
|
|
75
75
|
onClick: I,
|
|
76
76
|
children: [
|
|
77
|
-
/* @__PURE__ */ e(
|
|
77
|
+
/* @__PURE__ */ e(Xe, { className: "mt-0.5 h-4 w-4 flex-shrink-0 text-muted-foreground/50" }),
|
|
78
78
|
/* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ a("div", { className: "flex items-start justify-between gap-2", children: [
|
|
79
79
|
/* @__PURE__ */ a("div", { className: "min-w-0 flex-1", children: [
|
|
80
80
|
/* @__PURE__ */ e(
|
|
@@ -101,13 +101,13 @@ function Tt({
|
|
|
101
101
|
onClick: (c) => c.stopPropagation(),
|
|
102
102
|
children: [
|
|
103
103
|
/* @__PURE__ */ e("div", { className: "opacity-0 transition-opacity group-hover:opacity-100", children: /* @__PURE__ */ a(
|
|
104
|
-
|
|
104
|
+
Ze,
|
|
105
105
|
{
|
|
106
106
|
modal: !1,
|
|
107
|
-
open:
|
|
107
|
+
open: b,
|
|
108
108
|
onOpenChange: v,
|
|
109
109
|
children: [
|
|
110
|
-
/* @__PURE__ */ e(
|
|
110
|
+
/* @__PURE__ */ e($e, { asChild: !0, children: /* @__PURE__ */ e(G, { size: "sm", variant: "ghost", className: "h-6 w-6 p-0", children: /* @__PURE__ */ e(Qe, { className: "h-3 w-3" }) }) }),
|
|
111
111
|
/* @__PURE__ */ a(ke, { align: "end", className: "z-[51] w-40", children: [
|
|
112
112
|
/* @__PURE__ */ a(
|
|
113
113
|
J,
|
|
@@ -191,7 +191,7 @@ function Tt({
|
|
|
191
191
|
/* @__PURE__ */ a("div", { className: "space-y-1 px-2 py-2 text-xs text-slate-500 dark:text-slate-400", children: [
|
|
192
192
|
(((y = t.ownership.createdBy) == null ? void 0 : y.type) === "tenant" || ((C = t.ownership.createdBy) == null ? void 0 : C.type) === "organization" && V) && /* @__PURE__ */ a("div", { className: "flex items-center gap-1", children: [
|
|
193
193
|
/* @__PURE__ */ e(at, { className: "h-3 w-3" }),
|
|
194
|
-
/* @__PURE__ */ e("span", { children: ((
|
|
194
|
+
/* @__PURE__ */ e("span", { children: ((A = t.ownership.createdBy) == null ? void 0 : A.name) || "Unknown" })
|
|
195
195
|
] }),
|
|
196
196
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-1", children: [
|
|
197
197
|
/* @__PURE__ */ e(nt, { className: "h-3 w-3" }),
|
|
@@ -226,12 +226,12 @@ function Tt({
|
|
|
226
226
|
t.id
|
|
227
227
|
);
|
|
228
228
|
}
|
|
229
|
-
function
|
|
229
|
+
function At({ searchQuery: t }) {
|
|
230
230
|
const [f, p] = g(!1), [i, r] = g(
|
|
231
231
|
null
|
|
232
232
|
), [D, x] = g(!1), [m, N] = g(null), [S, l] = g(null), [d, h] = g(
|
|
233
233
|
null
|
|
234
|
-
), { selectVisual: V } = ne(), { handleEditLibraryVisual: E, handleAddLibraryVisual:
|
|
234
|
+
), { selectVisual: V } = ne(), { handleEditLibraryVisual: E, handleAddLibraryVisual: b } = Be(), {
|
|
235
235
|
resources: v,
|
|
236
236
|
isLoading: L,
|
|
237
237
|
isError: T,
|
|
@@ -239,14 +239,14 @@ function Ot({ searchQuery: t }) {
|
|
|
239
239
|
deleteResource: P,
|
|
240
240
|
duplicateResource: y,
|
|
241
241
|
isDeleting: C
|
|
242
|
-
} =
|
|
242
|
+
} = we(() => {
|
|
243
243
|
x(!1), N(null);
|
|
244
244
|
});
|
|
245
245
|
re();
|
|
246
|
-
const
|
|
246
|
+
const A = v.filter(
|
|
247
247
|
(n) => {
|
|
248
|
-
var
|
|
249
|
-
return ((
|
|
248
|
+
var O, o;
|
|
249
|
+
return ((O = n == null ? void 0 : n.title) == null ? void 0 : O.toLowerCase().includes(t.toLowerCase())) || ((o = n == null ? void 0 : n.description) == null ? void 0 : o.toLowerCase().includes(t.toLowerCase()));
|
|
250
250
|
}
|
|
251
251
|
), c = (n) => new Date(n).toLocaleDateString("en-US", {
|
|
252
252
|
month: "short",
|
|
@@ -254,16 +254,16 @@ function Ot({ searchQuery: t }) {
|
|
|
254
254
|
year: "numeric"
|
|
255
255
|
}), M = (n) => {
|
|
256
256
|
N(n), x(!0);
|
|
257
|
-
},
|
|
257
|
+
}, X = () => {
|
|
258
258
|
m && P(m.id);
|
|
259
259
|
}, {
|
|
260
260
|
startUpdating: F,
|
|
261
261
|
stopUpdating: K,
|
|
262
262
|
isUpdating: R
|
|
263
|
-
} = Ce(), z = (n,
|
|
263
|
+
} = Ce(), z = (n, O, o) => {
|
|
264
264
|
var se;
|
|
265
265
|
const Y = Object.fromEntries(
|
|
266
|
-
Object.entries(
|
|
266
|
+
Object.entries(O).filter(([, j]) => j !== void 0)
|
|
267
267
|
);
|
|
268
268
|
if (Object.keys(Y).length === 0) {
|
|
269
269
|
(se = o == null ? void 0 : o.onSuccess) == null || se.call(o);
|
|
@@ -290,32 +290,32 @@ function Ot({ searchQuery: t }) {
|
|
|
290
290
|
l(n), y(n, {
|
|
291
291
|
onSettled: () => l(null)
|
|
292
292
|
});
|
|
293
|
-
},
|
|
293
|
+
}, Z = (n) => {
|
|
294
294
|
E(n);
|
|
295
295
|
}, H = (n) => {
|
|
296
|
-
|
|
297
|
-
},
|
|
298
|
-
const
|
|
299
|
-
|
|
296
|
+
b(n);
|
|
297
|
+
}, $ = (n) => {
|
|
298
|
+
const O = v.find((o) => o.id === n);
|
|
299
|
+
O && I({
|
|
300
300
|
resourceId: n,
|
|
301
301
|
data: {
|
|
302
|
-
isPrivate: !
|
|
302
|
+
isPrivate: !O.isPrivate
|
|
303
303
|
}
|
|
304
304
|
});
|
|
305
305
|
}, _ = (n) => {
|
|
306
306
|
r(n), p(!0);
|
|
307
307
|
}, W = (n) => {
|
|
308
308
|
h(n);
|
|
309
|
-
},
|
|
309
|
+
}, w = () => {
|
|
310
310
|
h(null);
|
|
311
|
-
},
|
|
311
|
+
}, Q = ({
|
|
312
312
|
title: n,
|
|
313
|
-
description:
|
|
313
|
+
description: O
|
|
314
314
|
}) => {
|
|
315
315
|
if (!d)
|
|
316
316
|
return;
|
|
317
317
|
const o = {};
|
|
318
|
-
n !== d.title && (o.title = n), (d.description || "") !==
|
|
318
|
+
n !== d.title && (o.title = n), (d.description || "") !== O && (o.description = O), z(d.id, o, {
|
|
319
319
|
onSuccess: () => {
|
|
320
320
|
h(null);
|
|
321
321
|
}
|
|
@@ -334,20 +334,20 @@ function Ot({ searchQuery: t }) {
|
|
|
334
334
|
}
|
|
335
335
|
)
|
|
336
336
|
] }) }) : /* @__PURE__ */ a("div", { className: "flex h-full flex-1 flex-col", children: [
|
|
337
|
-
/* @__PURE__ */ e("div", { className: "flex flex-1 basis-0 flex-col gap-3 overflow-y-auto", children:
|
|
337
|
+
/* @__PURE__ */ e("div", { className: "flex flex-1 basis-0 flex-col gap-3 overflow-y-auto", children: A.length === 0 ? /* @__PURE__ */ a("div", { className: "py-8 text-center", children: [
|
|
338
338
|
/* @__PURE__ */ e("div", { className: "mb-3", children: /* @__PURE__ */ e(rt, { className: "mx-auto h-12 w-12 text-muted-foreground/50" }) }),
|
|
339
339
|
/* @__PURE__ */ e("h3", { className: "mb-1 font-medium text-foreground", children: t ? "No visuals found" : "No visuals yet" }),
|
|
340
340
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t ? "Try adjusting your search" : 'Click "Create" above to add your first visual' })
|
|
341
|
-
] }) :
|
|
341
|
+
] }) : A.map((n) => /* @__PURE__ */ e(
|
|
342
342
|
Tt,
|
|
343
343
|
{
|
|
344
344
|
visual: n,
|
|
345
345
|
onAddVisual: H,
|
|
346
|
-
onOpenVisual:
|
|
346
|
+
onOpenVisual: Z,
|
|
347
347
|
onEditDetails: W,
|
|
348
348
|
onDeleteClick: M,
|
|
349
349
|
onDuplicateVisual: B,
|
|
350
|
-
onTogglePrivacy:
|
|
350
|
+
onTogglePrivacy: $,
|
|
351
351
|
onShareVisual: _,
|
|
352
352
|
isDeleting: C,
|
|
353
353
|
isDuplicating: S === n.id,
|
|
@@ -372,8 +372,8 @@ function Ot({ searchQuery: t }) {
|
|
|
372
372
|
resourceLabel: "Visual",
|
|
373
373
|
initialTitle: d.title || "",
|
|
374
374
|
initialDescription: d.description || "",
|
|
375
|
-
onClose:
|
|
376
|
-
onSave:
|
|
375
|
+
onClose: w,
|
|
376
|
+
onSave: Q,
|
|
377
377
|
isSaving: R(d.id)
|
|
378
378
|
}
|
|
379
379
|
),
|
|
@@ -386,8 +386,8 @@ function Ot({ searchQuery: t }) {
|
|
|
386
386
|
},
|
|
387
387
|
children: /* @__PURE__ */ a(Le, { children: [
|
|
388
388
|
/* @__PURE__ */ a(Te, { children: [
|
|
389
|
-
/* @__PURE__ */ e(
|
|
390
|
-
/* @__PURE__ */ a(
|
|
389
|
+
/* @__PURE__ */ e(Ae, { children: "Delete Visual" }),
|
|
390
|
+
/* @__PURE__ */ a(Oe, { children: [
|
|
391
391
|
'Are you sure you want to delete "',
|
|
392
392
|
m == null ? void 0 : m.title,
|
|
393
393
|
'"? This action cannot be undone.'
|
|
@@ -399,7 +399,7 @@ function Ot({ searchQuery: t }) {
|
|
|
399
399
|
Ie,
|
|
400
400
|
{
|
|
401
401
|
onClick: (n) => {
|
|
402
|
-
n.preventDefault(), n.stopPropagation(),
|
|
402
|
+
n.preventDefault(), n.stopPropagation(), X();
|
|
403
403
|
},
|
|
404
404
|
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
405
405
|
disabled: C,
|
|
@@ -415,7 +415,7 @@ function Ot({ searchQuery: t }) {
|
|
|
415
415
|
)
|
|
416
416
|
] });
|
|
417
417
|
}
|
|
418
|
-
function
|
|
418
|
+
function Ot({
|
|
419
419
|
dashboard: t,
|
|
420
420
|
isDeleting: f,
|
|
421
421
|
isDuplicating: p,
|
|
@@ -429,10 +429,10 @@ function At({
|
|
|
429
429
|
onDashboardItemClick: l
|
|
430
430
|
}) {
|
|
431
431
|
var P, y;
|
|
432
|
-
const { selectDashboard: d } = ne(), h = ot(t.id), { userContext: V, isLoading: E } = re(), { mutate:
|
|
432
|
+
const { selectDashboard: d } = ne(), h = ot(t.id), { userContext: V, isLoading: E } = re(), { mutate: b } = lt(), v = ((P = V == null ? void 0 : V.permissions) == null ? void 0 : P.canEdit) ?? !1, L = E || !v, T = () => {
|
|
433
433
|
d(t), r(t.id), l == null || l(t.id);
|
|
434
434
|
}, I = (C) => {
|
|
435
|
-
C.stopPropagation(),
|
|
435
|
+
C.stopPropagation(), b({ dashboardId: i ? null : t.id });
|
|
436
436
|
};
|
|
437
437
|
return /* @__PURE__ */ e(Ue, { children: /* @__PURE__ */ a(
|
|
438
438
|
"div",
|
|
@@ -511,7 +511,7 @@ function Rt(t) {
|
|
|
511
511
|
var fe, ge;
|
|
512
512
|
const { searchQuery: f, onLoadDashboard: p, onEditDashboard: i, onDashboardItemClick: r } = t, [D, x] = g(!1), [m, N] = g(
|
|
513
513
|
null
|
|
514
|
-
), [S, l] = g(!1), [d, h] = g(null), [V, E] = g(null), [
|
|
514
|
+
), [S, l] = g(!1), [d, h] = g(null), [V, E] = g(null), [b, v] = g(null), L = ae(
|
|
515
515
|
(s) => s.lastSelectedDashboard
|
|
516
516
|
), T = ae(
|
|
517
517
|
(s) => s.selectedDashboard
|
|
@@ -522,10 +522,10 @@ function Rt(t) {
|
|
|
522
522
|
), { tokenProps: y, id: C } = ut();
|
|
523
523
|
ht();
|
|
524
524
|
const {
|
|
525
|
-
resources:
|
|
525
|
+
resources: A,
|
|
526
526
|
isLoading: c,
|
|
527
527
|
isError: M,
|
|
528
|
-
updateResource:
|
|
528
|
+
updateResource: X,
|
|
529
529
|
deleteResource: F,
|
|
530
530
|
duplicateResource: K,
|
|
531
531
|
isDeleting: R
|
|
@@ -533,7 +533,7 @@ function Rt(t) {
|
|
|
533
533
|
l(!1);
|
|
534
534
|
const s = d == null ? void 0 : d.id;
|
|
535
535
|
h(null), (T == null ? void 0 : T.id) === s && (!(y != null && y.dashboard_id) && !C ? P() : L && L.id !== s && I(L));
|
|
536
|
-
}), { currentUser: z, userContext: B } = re(),
|
|
536
|
+
}), { currentUser: z, userContext: B } = re(), Z = ((fe = B == null ? void 0 : B.permissions) == null ? void 0 : fe.canCreateDashboard) ?? !1, { data: H } = mt(), $ = ((ge = H == null ? void 0 : H.preference) == null ? void 0 : ge.defaultDashboardId) || null, _ = A.filter(
|
|
537
537
|
(s) => {
|
|
538
538
|
var U, u;
|
|
539
539
|
return ((U = s == null ? void 0 : s.title) == null ? void 0 : U.toLowerCase().includes(f.toLowerCase())) || ((u = s == null ? void 0 : s.description) == null ? void 0 : u.toLowerCase().includes(f.toLowerCase()));
|
|
@@ -542,13 +542,13 @@ function Rt(t) {
|
|
|
542
542
|
month: "short",
|
|
543
543
|
day: "numeric",
|
|
544
544
|
year: "numeric"
|
|
545
|
-
}),
|
|
545
|
+
}), w = (s) => {
|
|
546
546
|
p == null || p(s);
|
|
547
|
-
},
|
|
547
|
+
}, Q = (s) => {
|
|
548
548
|
h(s), l(!0);
|
|
549
549
|
}, n = () => {
|
|
550
550
|
d && F(d.id);
|
|
551
|
-
},
|
|
551
|
+
}, O = (s) => {
|
|
552
552
|
E(s), K(s, {
|
|
553
553
|
onSettled: () => E(null)
|
|
554
554
|
});
|
|
@@ -566,7 +566,7 @@ function Rt(t) {
|
|
|
566
566
|
return;
|
|
567
567
|
}
|
|
568
568
|
const De = Object.keys(oe), le = De.length === 1 ? De[0] : void 0;
|
|
569
|
-
o(s, le),
|
|
569
|
+
o(s, le), X(
|
|
570
570
|
{
|
|
571
571
|
resourceId: s,
|
|
572
572
|
data: oe
|
|
@@ -583,10 +583,10 @@ function Rt(t) {
|
|
|
583
583
|
}
|
|
584
584
|
);
|
|
585
585
|
}, se = (s) => {
|
|
586
|
-
const U =
|
|
586
|
+
const U = A.find(
|
|
587
587
|
(u) => u.id === s
|
|
588
588
|
);
|
|
589
|
-
U &&
|
|
589
|
+
U && X({
|
|
590
590
|
resourceId: s,
|
|
591
591
|
data: {
|
|
592
592
|
isPrivate: !U.isPrivate
|
|
@@ -602,10 +602,10 @@ function Rt(t) {
|
|
|
602
602
|
title: s,
|
|
603
603
|
description: U
|
|
604
604
|
}) => {
|
|
605
|
-
if (!
|
|
605
|
+
if (!b)
|
|
606
606
|
return;
|
|
607
607
|
const u = {};
|
|
608
|
-
s !==
|
|
608
|
+
s !== b.title && (u.title = s), (b.description || "") !== U && (u.description = U), k(b.id, u, {
|
|
609
609
|
onSuccess: () => {
|
|
610
610
|
v(null);
|
|
611
611
|
}
|
|
@@ -615,18 +615,18 @@ function Rt(t) {
|
|
|
615
615
|
/* @__PURE__ */ e("div", { className: "flex flex-1 basis-0 flex-col gap-3 overflow-y-auto", children: _.length === 0 ? /* @__PURE__ */ a("div", { className: "py-8 text-center", children: [
|
|
616
616
|
/* @__PURE__ */ e("div", { className: "mb-3", children: /* @__PURE__ */ e(pt, { className: "mx-auto h-12 w-12 text-muted-foreground/50" }) }),
|
|
617
617
|
/* @__PURE__ */ e("h3", { className: "mb-1 font-medium text-foreground", children: f ? "No dashboards found" : "No dashboards yet" }),
|
|
618
|
-
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: f ? "Try adjusting your search" :
|
|
618
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: f ? "Try adjusting your search" : Z ? 'Click "Create" above to add your first dashboard' : "No dashboards have been shared with you yet" })
|
|
619
619
|
] }) : _.map((s) => /* @__PURE__ */ e(
|
|
620
|
-
|
|
620
|
+
Ot,
|
|
621
621
|
{
|
|
622
622
|
dashboard: s,
|
|
623
623
|
isDeleting: R,
|
|
624
624
|
isDuplicating: V === s.id,
|
|
625
|
-
isDefault: s.id ===
|
|
626
|
-
onLoadDashboard:
|
|
625
|
+
isDefault: s.id === $,
|
|
626
|
+
onLoadDashboard: w,
|
|
627
627
|
onEditDetails: _e,
|
|
628
|
-
onDeleteClick:
|
|
629
|
-
onDuplicateDashboard:
|
|
628
|
+
onDeleteClick: Q,
|
|
629
|
+
onDuplicateDashboard: O,
|
|
630
630
|
onTogglePrivacy: se,
|
|
631
631
|
onShareDashboard: j,
|
|
632
632
|
formatDate: W,
|
|
@@ -653,8 +653,8 @@ function Rt(t) {
|
|
|
653
653
|
},
|
|
654
654
|
children: /* @__PURE__ */ a(Le, { children: [
|
|
655
655
|
/* @__PURE__ */ a(Te, { children: [
|
|
656
|
-
/* @__PURE__ */ e(
|
|
657
|
-
/* @__PURE__ */ a(
|
|
656
|
+
/* @__PURE__ */ e(Ae, { children: "Delete Dashboard" }),
|
|
657
|
+
/* @__PURE__ */ a(Oe, { children: [
|
|
658
658
|
'Are you sure you want to delete "',
|
|
659
659
|
d == null ? void 0 : d.title,
|
|
660
660
|
'"? This action cannot be undone.'
|
|
@@ -680,16 +680,16 @@ function Rt(t) {
|
|
|
680
680
|
] })
|
|
681
681
|
}
|
|
682
682
|
),
|
|
683
|
-
|
|
683
|
+
b && /* @__PURE__ */ e(
|
|
684
684
|
Ve,
|
|
685
685
|
{
|
|
686
|
-
open: !!
|
|
686
|
+
open: !!b,
|
|
687
687
|
resourceLabel: "Dashboard",
|
|
688
|
-
initialTitle:
|
|
689
|
-
initialDescription:
|
|
688
|
+
initialTitle: b.title || "",
|
|
689
|
+
initialDescription: b.description || "",
|
|
690
690
|
onClose: qe,
|
|
691
691
|
onSave: Ge,
|
|
692
|
-
isSaving: te(
|
|
692
|
+
isSaving: te(b.id)
|
|
693
693
|
}
|
|
694
694
|
)
|
|
695
695
|
] });
|
|
@@ -716,7 +716,7 @@ function It({
|
|
|
716
716
|
] }),
|
|
717
717
|
/* @__PURE__ */ a("div", { className: "space-y-4 py-4", children: [
|
|
718
718
|
/* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
719
|
-
/* @__PURE__ */ e(
|
|
719
|
+
/* @__PURE__ */ e(be, { htmlFor: "title", children: "Visual Title" }),
|
|
720
720
|
/* @__PURE__ */ e(
|
|
721
721
|
ue,
|
|
722
722
|
{
|
|
@@ -732,7 +732,7 @@ function It({
|
|
|
732
732
|
)
|
|
733
733
|
] }),
|
|
734
734
|
/* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
735
|
-
/* @__PURE__ */ e(
|
|
735
|
+
/* @__PURE__ */ e(be, { htmlFor: "description", children: "Description (optional)" }),
|
|
736
736
|
/* @__PURE__ */ e(
|
|
737
737
|
ue,
|
|
738
738
|
{
|
|
@@ -745,7 +745,7 @@ function It({
|
|
|
745
745
|
)
|
|
746
746
|
] })
|
|
747
747
|
] }),
|
|
748
|
-
/* @__PURE__ */ a(
|
|
748
|
+
/* @__PURE__ */ a(bt, { children: [
|
|
749
749
|
/* @__PURE__ */ e(
|
|
750
750
|
G,
|
|
751
751
|
{
|
|
@@ -778,39 +778,39 @@ function Bt({
|
|
|
778
778
|
}) {
|
|
779
779
|
var _, W;
|
|
780
780
|
const D = de(
|
|
781
|
-
(
|
|
782
|
-
), [x, m] = g(!1), [N, S] = g(""), [l, d] = g(!1), { currentUser: h, userContext: V } = re(), E = ((_ = V == null ? void 0 : V.permissions) == null ? void 0 : _.canCreateDashboard) ?? !1, { onCreateSuccess:
|
|
781
|
+
(w) => w.isDashboardEditing
|
|
782
|
+
), [x, m] = g(!1), [N, S] = g(""), [l, d] = g(!1), { currentUser: h, userContext: V } = re(), E = ((_ = V == null ? void 0 : V.permissions) == null ? void 0 : _.canCreateDashboard) ?? !1, { onCreateSuccess: b } = wt({
|
|
783
783
|
onDashboardSelect: i
|
|
784
784
|
}), { selectVisual: v } = ne(), { handleEditLibraryVisual: L } = Be(), {
|
|
785
785
|
createResource: T,
|
|
786
786
|
isCreating: I,
|
|
787
787
|
refetch: P
|
|
788
|
-
} = ze(), { createResource: y, isCreating: C } =
|
|
788
|
+
} = ze(), { createResource: y, isCreating: C } = we(
|
|
789
789
|
void 0,
|
|
790
790
|
// onDeleteSuccess (not needed here)
|
|
791
|
-
(
|
|
792
|
-
m(!1),
|
|
791
|
+
(w) => {
|
|
792
|
+
m(!1), w && (v(w), L(w));
|
|
793
793
|
}
|
|
794
|
-
),
|
|
795
|
-
enabled: t &&
|
|
794
|
+
), A = r === "overlay", c = ((h == null ? void 0 : h.name) ?? "").trim(), M = ((h == null ? void 0 : h.email) ?? "").trim(), F = c && c.toLowerCase() !== "undefined" ? c : M || "Current user", K = ((W = F.charAt(0)) == null ? void 0 : W.toUpperCase()) || "?", R = M && M.toLowerCase() !== "undefined" ? M : "", z = Vt(f, {
|
|
795
|
+
enabled: t && A
|
|
796
796
|
}), B = ee(
|
|
797
797
|
"flex h-full flex-col border-r bg-background",
|
|
798
|
-
|
|
798
|
+
A ? ee(
|
|
799
799
|
"absolute inset-y-0 left-0 z-[51] w-60 shadow-lg transition-transform duration-300 ease-in-out",
|
|
800
800
|
t ? "translate-x-0" : "pointer-events-none -translate-x-full"
|
|
801
801
|
) : "w-full max-w-[17rem] min-w-[11rem] overflow-hidden shadow-sm",
|
|
802
802
|
p
|
|
803
|
-
),
|
|
804
|
-
}, H = (
|
|
805
|
-
console.log("Editing dashboard:",
|
|
806
|
-
},
|
|
807
|
-
T(
|
|
808
|
-
onSuccess: (
|
|
809
|
-
m(!1),
|
|
803
|
+
), Z = (w) => {
|
|
804
|
+
}, H = (w) => {
|
|
805
|
+
console.log("Editing dashboard:", w);
|
|
806
|
+
}, $ = (w) => {
|
|
807
|
+
T(w, {
|
|
808
|
+
onSuccess: (Q) => {
|
|
809
|
+
m(!1), b(Q, P);
|
|
810
810
|
}
|
|
811
811
|
});
|
|
812
812
|
};
|
|
813
|
-
return /* @__PURE__ */ e(me, { children: (!
|
|
813
|
+
return /* @__PURE__ */ e(me, { children: (!A || t) && /* @__PURE__ */ a("div", { ref: z, className: B, children: [
|
|
814
814
|
/* @__PURE__ */ a("div", { className: "border-b border-border", children: [
|
|
815
815
|
/* @__PURE__ */ a("div", { className: "flex items-center justify-between px-4 py-1.5", children: [
|
|
816
816
|
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e("h2", { className: "whitespace-nowrap text-sm font-semibold", children: D ? "Visuals" : "Dashboards" }) }),
|
|
@@ -842,17 +842,17 @@ function Bt({
|
|
|
842
842
|
{
|
|
843
843
|
placeholder: "Search...",
|
|
844
844
|
value: N,
|
|
845
|
-
onChange: (
|
|
845
|
+
onChange: (w) => S(w.target.value),
|
|
846
846
|
className: "h-8 border-muted-foreground/20 bg-background text-sm focus-visible:border-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0",
|
|
847
847
|
autoFocus: !0
|
|
848
848
|
}
|
|
849
849
|
) })
|
|
850
850
|
] }),
|
|
851
|
-
/* @__PURE__ */ e("div", { className: "flex flex-1 flex-col overflow-auto px-2 py-2", children: D ? /* @__PURE__ */ e(
|
|
851
|
+
/* @__PURE__ */ e("div", { className: "flex flex-1 flex-col overflow-auto px-2 py-2", children: D ? /* @__PURE__ */ e(At, { searchQuery: N }) : /* @__PURE__ */ e(
|
|
852
852
|
Rt,
|
|
853
853
|
{
|
|
854
854
|
searchQuery: N,
|
|
855
|
-
onLoadDashboard:
|
|
855
|
+
onLoadDashboard: Z,
|
|
856
856
|
onEditDashboard: H,
|
|
857
857
|
onDashboardItemClick: i
|
|
858
858
|
}
|
|
@@ -884,7 +884,7 @@ function Bt({
|
|
|
884
884
|
{
|
|
885
885
|
open: x,
|
|
886
886
|
onOpenChange: m,
|
|
887
|
-
onSubmit:
|
|
887
|
+
onSubmit: $,
|
|
888
888
|
isCreating: I
|
|
889
889
|
}
|
|
890
890
|
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ak as G, al as z, h as Y, i as J, am as K, e as _, g as X, u as U, an as Z, ao as q, l as v, ap as ee, f as h } from "./index-
|
|
1
|
+
import { ak as G, al as z, h as Y, i as J, am as K, e as _, g as X, u as U, an as Z, ao as q, l as v, ap as ee, f as h } from "./index-DLxVadBx.js";
|
|
2
2
|
import { useState as T, useEffect as te, useCallback as V } from "react";
|
|
3
3
|
function re(e) {
|
|
4
4
|
const o = e.toUpperCase().indexOf("WHERE"), r = e.toUpperCase().indexOf("GROUP BY"), t = e.toUpperCase().indexOf("LIMIT"), i = e.toUpperCase().indexOf("ORDER BY");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("./index-
|
|
1
|
+
"use strict";const o=require("./index-DJmpV5Lg.js"),b=require("react");function _(e){const a=e.toUpperCase().indexOf("WHERE"),r=e.toUpperCase().indexOf("GROUP BY"),t=e.toUpperCase().indexOf("LIMIT"),d=e.toUpperCase().indexOf("ORDER BY");let c=e.length;if(d!==-1&&(c=d),t!==-1&&t<c&&(c=t),a!==-1){const n=e.substring(0,a),s=e.substring(a);return`${n} {{ filters | where }} AND ${s.substring(6)}`}else if(r!==-1){const n=e.substring(0,r),s=e.substring(r);return`${n} {{ filters | where }} ${s}`}else{const n=e.substring(0,c),s=e.substring(c);return console.log("beforeClause",n),console.log("afterClause",s),s?`${n} {{ filters | where }} ${s}`:`${n.replace(/;$/,"")} {{ filters | where }}`}}function B(e){const[a,r]=b.useState(null),[t,d]=b.useState(null),c=o.useEnsureReactGlobals();return b.useEffect(()=>{if(!e||e.trim()===""){r(null),d(null);return}if(!c)return;(async()=>{try{if(!e.startsWith("http://")&&!e.startsWith("https://"))throw new Error(`Invalid URL format: ${e}`);try{new URL(e)}catch{throw new Error(`Invalid URL: ${e}`)}const l=`${e.endsWith("/")?e:`${e}/`}index.js`;try{if(!(await fetch(l,{method:"HEAD"})).ok)throw new Error(`Module not found at ${l}`)}catch{}const m=await import(l);if(typeof m.useChartStore!="function")throw new Error("useChartStore is not a function");r(()=>m.useChartStore),d(null)}catch(s){const l=s instanceof Error?s.message:"Unknown error";console.error("Failed to load remote chart store:",l),d(l),r(null)}})()},[e,c]),a}function H(e,a){if(e.length===0)return"";if(a){const r=e.find(t=>t.id===a);if(r){const t=r.tabTitle;if(t=="All__Header")return e[0].id;if(t&&t.endsWith("__Header")){const c=t.split("__")[0],n=e.find(s=>s.tabTitle===c);return n?n.id:e[0].id}return a}}return e[0].id}async function j(e,a,r,t){if(!a||!r)throw new Error("Missing auth token or visual ID");const d=["resource-by-id","visual",r],c=t.getQueryData(d);if(c)return console.log("Using cached visual data for:",r),{data:c,fromCache:!0};console.log("Fetching visual data from network for:",r);const n=o.ue.loading("Loading visual...",{position:"top-center"});try{const s=await fetch(`${e}/management/v1/visuals/${r}`,{headers:{Authorization:`Bearer ${a}`}});if(!s.ok)throw new Error("Failed to load visual");const l=await s.json();return t.setQueryData(d,l),o.ue.dismiss(n),{data:l,fromCache:!1}}catch(s){throw o.ue.dismiss(n),s}}function T(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function Q(e,a){var c,n;const r=(e==null?void 0:e.frameObject)??((c=e==null?void 0:e.visual)==null?void 0:c.frameObject);if(!r)return!1;const t=T(r);if(!(t!=null&&t.cards)||t.cards.length===0)return!1;const d=(n=t.cards)==null?void 0:n.find(s=>s.id===t.activeCardId);return d?(o.setupEditorWithCard({...a,frame:t,card:d,visualId:(e==null?void 0:e.id)||t.visualId}),!0):!1}function G(){var g;const{setCardSql:e}=o.useEditorActions(),a=o.useEditorStore(i=>i.frame),r=o.useEditorStore(i=>i.card),t=B(((g=r.customCardPreferences)==null?void 0:g.url)||""),d=o.useEditorStore(i=>i.selectedSchemaName),c=o.useEditorStore(i=>i.selectedDatamodelId),n=o.useEditorStore(i=>i.selectedDatabaseName),s=o.useEditorStore(i=>i.selectedTableName),l=o.useEditorStore(i=>i.selectedConnectionId),m=o.useEditorStore(i=>i.isShowingVisual),f=r.sql;return{getUpdatedFrame:b.useCallback(()=>{var E;let i=f;f&&!f.includes("{{")&&(i=_(f),e(i));const C=(E=t==null?void 0:t.getState())==null?void 0:E.settings,U={...r,dataSource:r.dataSource||{mode:"directSource"},lastSelectedSchema:d,lastSelectedDatamodelId:c,lastSelectedDatabase:n,lastSelectedTable:s,connectionId:l,sql:i,customCfg:m?r.customCfg:null,preferences:r.preferences,...C&&{customCardPreferences:{...r.customCardPreferences,settings:C}}},w=a.cards.map(S=>S.id===r.id?U:S);return{...a,cards:w,activeCardId:H(w,a.activeCardId)}},[r,a,m,d,c,n,s,l,e,t,f])}}function z(){const{authToken:e,tokenProps:a}=o.useSemaphorContext(),r=o.useQueryClient(),t=o.useSelectedVisual(),{selectVisual:d}=o.useManagementActions(),{setFrame:c,setCard:n,setIsDevMode:s,setActiveTabCardId:l,updateDataSource:m,setQueryResultColumns:f,setSelectedConnectionId:V,setSelectedDatabaseName:g,setSelectedSchemaName:i,setSelectedTableName:C,setSelectedDatamodelId:U,setFilterValues:w,setApplyFilters:E}=o.useEditorActions(),{setIsDashboardEditing:S,setIsVisualEditing:$,setSelectedFrameId:v,clearSelectedFrameId:A,addFrame:N,setIsDashboardPanelOpen:R}=o.useDashboardActions(),I=o.useDashboardStore(u=>u.selectedSheetId),D=o.useDashboardStore(u=>u.selectedFrameId),O=o.useDashboardStore(u=>u.dashboard),x=o.useDashboardStore(u=>u.filterValues),y=o.useVisualById((t==null?void 0:t.id)||"",{enabled:!!(t!=null&&t.id)&&!!(e!=null&&e.accessToken)}),M=b.useCallback(async u=>{try{d(u),A();const{data:p,fromCache:h}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,r);if(!Q(p,{setFrame:c,setCard:n,setIsDevMode:s,setActiveTabCardId:l,updateDataSource:m,setQueryResultColumns:f,setSelectedConnectionId:V,setSelectedDatabaseName:g,setSelectedSchemaName:i,setSelectedTableName:C,setSelectedDatamodelId:U,setFilterValues:w,setApplyFilters:E,setIsDashboardEditing:S,setIsVisualEditing:$,dashboard:O,selectedSheetId:I,selectedFrameId:D,filterValues:x}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:h}}catch(p){return console.error("Error editing visual:",p),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,r,d,c,n,S,$,s,l,m,f,V,g,i,C,U,w,E,A,O,I,D,x]),k=b.useCallback(async u=>{var p;try{if(d(u),!I)return{success:!1,error:"No sheet selected. Please select a sheet first."};const{data:h,fromCache:W}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,r),L=(h==null?void 0:h.frameObject)??((p=h==null?void 0:h.visual)==null?void 0:p.frameObject);if(!L)return{success:!1,error:"Visual has no frame data"};const F=T(L);if(!(F!=null&&F.cards)||F.cards.length===0)return{success:!1,error:"Visual frame is malformed"};const P={...o.cloneFrameWithNewIds(F),visualId:u.id};return N(I,P,"end"),S(!0),v(P.id),R(!1),{success:!0,fromCache:W}}catch(h){return console.error("Error adding visual:",h),{success:!1,error:"Failed to add visual to dashboard"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,r,d,I,N,S,v,R]);return{visual:y.data,isLoading:y.isLoading,isError:y.isError,error:y.error,handleEditLibraryVisual:M,handleAddLibraryVisual:k,getUpdatedFrame:G().getUpdatedFrame,refetch:y.refetch}}exports.useRemoteChartStore=B;exports.useVisualUtils=z;
|
package/dist/dashboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-DJmpV5Lg.js"),r=require("../types/index.cjs");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
|
package/dist/dashboard/index.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-DJmpV5Lg.js"),S=require("./types/index.cjs"),a=require("react/jsx-runtime"),g=require("react"),j=require("./chunks/resource-management-panel-D6gqCHWr.js"),u=require("./chunks/dashboard-export-dialog-CKGJIz95.js");require("react-dom");function N(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}return t.default=r,Object.freeze(t)}const C=N(g);/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const P=e.createLucideIcon("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);function M(
|
|
6
|
+
*/const P=e.createLucideIcon("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);function M(r){const{displayPreferences:t,...s}=r,i={...s,id:r.dashboardId};return a.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:a.jsx(e.SemaphorContextProvider,{dashboardProps:i,children:a.jsx(e.UXProvider,{children:a.jsx(e.DisplayPreferencesProvider,{displayPreferences:t,children:a.jsx(e.Container,{type:"visual",...i,children:a.jsx(A,{cardId:r.cardId})})})})})})}function A({cardId:r}){const t=e.useDashboardStore(n=>{var l;return(l=n.dashboard)==null?void 0:l.sheets}),{card:s,frame:i}=g.useMemo(()=>{const n=t==null?void 0:t.flatMap(o=>o.frames),l=n==null?void 0:n.flatMap(o=>o==null?void 0:o.cards),m=l==null?void 0:l.find(o=>(o==null?void 0:o.id)===r),f=n==null?void 0:n.find(o=>{var p;return(p=o==null?void 0:o.cards)==null?void 0:p.find(c=>(c==null?void 0:c.id)===r)});return{card:m,frame:f}},[t,r]);return!s||!i?a.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${r}`}):a.jsx("main",{className:"flex h-full grow flex-col",children:a.jsx(e.ErrorBoundary,{FallbackComponent:({error:n,resetErrorBoundary:l})=>a.jsx(e.FallbackVisual,{error:n,resetErrorBoundary:l,customerFacingMessage:"Error creating visual. Please try again."}),children:a.jsx(e.DashboardCard,{card:s,frame:i})})})}function k({name:r,items:t,value:s,onChange:i,isLoading:n,isError:l,refetch:m,className:f,icon:o,showNone:p=!1}){const c=C.useRef(null),[b,x]=C.useState(!1),[y,T]=C.useState("100%"),D=p?[...t||[],{id:"none",name:"None"}]:t;C.useLayoutEffect(()=>{c.current&&T(c.current.offsetWidth)},[]);function v(){var d;return n?"Loading...":l?"Error":s?(d=t==null?void 0:t.find(h=>h.id===s))==null?void 0:d.name:`Select ${r}`}function E(d,h){i(h),x(!1)}return a.jsxs(e.Popover,{open:b,onOpenChange:x,children:[a.jsx(e.PopoverTrigger,{asChild:!0,children:a.jsxs(e.Button,{ref:c,variant:"outline",role:"combobox","aria-expanded":b,className:e.cn("flex h-9 w-full justify-between",f),children:[a.jsxs("div",{className:"flex items-center gap-2",children:[o&&a.jsx("div",{className:"mr-2",children:o}),a.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:v()})]}),a.jsx(e.ChevronDown,{className:"size-4 opacity-50"})]})}),a.jsx(e.PopoverContent,{className:"w-full p-0",style:{minWidth:y},children:a.jsxs(e.Command,{children:[a.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[a.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),a.jsx(e.IconButton,{className:"h-7",onClick:m,children:a.jsx(P,{className:e.cn("size-3.5 opacity-50",n&&"animate-spin")})})]}),a.jsxs(e.CommandList,{children:[a.jsxs(e.CommandEmpty,{children:["No ",r==null?void 0:r.toLowerCase()," found."]}),a.jsx(e.CommandGroup,{children:D==null?void 0:D.map(d=>a.jsx(e.CommandItem,{className:"overflow-x-auto",value:d.name,onSelect:h=>E(h,d.id),children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(e.Check,{className:e.cn("size-4",s===d.id?"opacity-100":"opacity-0")}),a.jsx("div",{title:d.name,children:d.name})]})},d.id))})]})]})})]})}exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.Dashboard=e.Dashboard;exports.DashboardWC=e.DashboardWC;exports.PivotMarkerEnum=e.PivotMarkerEnum;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.Surfboard=e.DashboardPlus;exports.createEmptyKpiConfig=e.createEmptyKpiConfig;exports.createSqlGenConfig=e.createSqlGenConfig;exports.downloadPdf=e.downloadPdf;exports.emitDashboardLoad=e.emitDashboardLoad;exports.emitDashboardUnload=e.emitDashboardUnload;exports.fmt=e.fmt;exports.getColumnDataType=e.getColumnDataType;exports.getFilterValueType=e.getFilterValueType;exports.getFormattedTableNameForQuery=e.getFormattedTableNameForQuery;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.invalidateToken=e.invalidateToken;exports.isBooleanDataType=e.isBooleanDataType;exports.isCalculatedDimension=e.isCalculatedDimension;exports.isCalculatedField=e.isCalculatedField;exports.isCalculatedMetric=e.isCalculatedMetric;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.isDateDataType=e.isDateDataType;exports.isNumberDataType=e.isNumberDataType;exports.isTextDataType=e.isTextDataType;exports.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.useCard=e.useCard;exports.useCurrentActiveCard=e.useCurrentActiveCard;exports.useCurrentCardConfig=e.useCurrentCardConfig;exports.useCurrentSheetActiveCards=e.useCurrentSheetActiveCards;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardStore=e.useDashboardStore;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorActions=e.useEditorActions;exports.useEditorAside=e.useEditorAside;exports.useEditorStore=e.useEditorStore;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=S.EMPTY_SELECTION;exports.ResourceManagementPanel=j.ResourceManagementPanel;exports.AdvancedModeToggle=u.AdvancedModeToggle;exports.DashboardExportDialog=u.DashboardExportDialog;exports.ScheduleDashboard=u.ScheduleDashboard;exports.VisualEditingControls=u.VisualEditingControls;exports.cleanCard=u.cleanCard;exports.getDashbaordStateWithoutData=u.getDashbaordStateWithoutData;exports.Combobox=k;exports.Visual=M;
|