react-semaphor 0.1.127 → 0.1.129
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-CdYJPicU.js +1539 -0
- package/dist/chunks/dashboard-controls-D9rqbD5g.js +26 -0
- package/dist/chunks/dashboard-export-dialog-BjqND5hL.js +6 -0
- package/dist/chunks/dashboard-export-dialog-DNF_PQZb.js +601 -0
- package/dist/chunks/{dashboard-json-Bqddgxcf.js → dashboard-json-Dtshd-QS.js} +1 -1
- package/dist/chunks/{dashboard-json-CZrxKZBn.js → dashboard-json-xVrkPU1h.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-Du3rYBkf.js → edit-dashboard-visual-VEw_9V-L.js} +187 -187
- package/dist/chunks/{edit-dashboard-visual-Kg8h34hs.js → edit-dashboard-visual-YSsXOgAP.js} +1 -1
- package/dist/chunks/{editor-action-buttons-BMeOcqc2.js → editor-action-buttons-BFF_pszh.js} +2 -2
- package/dist/chunks/{editor-action-buttons-DHk1Cdb6.js → editor-action-buttons-C3KskLE0.js} +1 -1
- package/dist/chunks/{index-DJmpV5Lg.js → index-Df1tIEqs.js} +219 -219
- package/dist/chunks/{index-DLxVadBx.js → index-vRQsO2Ki.js} +20503 -20317
- package/dist/chunks/{resource-management-panel-D6gqCHWr.js → resource-management-panel-C2Ee-LoN.js} +1 -1
- package/dist/chunks/{resource-management-panel-VT7LYPp8.js → resource-management-panel-DBZxxjm6.js} +88 -88
- package/dist/chunks/{use-visual-utils-DpxMI5Pe.js → use-visual-utils-BMr6v4np.js} +8 -8
- package/dist/chunks/{use-visual-utils-O1QcxL8l.js → use-visual-utils-Cdg5yE9F.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 +88 -87
- 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 +9 -0
- package/dist/types/main.d.ts +27 -42
- package/dist/types/surfboard.d.ts +9 -0
- package/dist/types/types.d.ts +9 -0
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-BFo8ClGD.js +0 -1473
- package/dist/chunks/dashboard-controls-CpNsaWbB.js +0 -26
- package/dist/chunks/dashboard-export-dialog-CKGJIz95.js +0 -6
- package/dist/chunks/dashboard-export-dialog-CKr9o8DW.js +0 -600
|
@@ -0,0 +1,601 @@
|
|
|
1
|
+
import { jsx as e, jsxs as a, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { b as q, ar as $, as as H, at as W, au as _, av as K, aw as S, ax as J, ay as Z, az as V, aA as Q, B as A, L as T, f as E, i as ee, u as x, an as ae, g as X, aB as se, aC as O, l as g, aD as te, aE as re, c as k, aF as B, aG as L, aH as z, aI as U, aJ as G, e as oe, aK as le, aL as ne, aM as de, aN as ie, aO as ce, aP as he, aQ as ue, aR as me, aS as pe, aT as fe, aU as ve, aV as ge, Q as be, I as Ce, aW as we, aX as xe, am as De, aY as ye, aZ as R, a_ as Ne, a$ as Se, b0 as Ae, b1 as Pe, b2 as Fe, b3 as Ie, V as ke } from "./index-vRQsO2Ki.js";
|
|
3
|
+
import { E as Ee, V as Me, a as Ve, b as Te, S as j, c as Oe } from "./editor-action-buttons-BFF_pszh.js";
|
|
4
|
+
import Be, { useState as D, useContext as Le, useEffect as ze } from "react";
|
|
5
|
+
import { a as Y } from "./use-visual-utils-BMr6v4np.js";
|
|
6
|
+
/**
|
|
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
|
+
*/
|
|
12
|
+
const Ue = q("CirclePlus", [
|
|
13
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
14
|
+
["path", { d: "M8 12h8", key: "1wcyev" }],
|
|
15
|
+
["path", { d: "M12 8v8", key: "napkw2" }]
|
|
16
|
+
]);
|
|
17
|
+
function Ge({
|
|
18
|
+
open: c,
|
|
19
|
+
onOpenChange: i,
|
|
20
|
+
isLibraryVisual: t,
|
|
21
|
+
currentVisualName: r,
|
|
22
|
+
isSaving: n = !1,
|
|
23
|
+
onConfirm: u
|
|
24
|
+
}) {
|
|
25
|
+
const [s, o] = D(
|
|
26
|
+
t && r ? `Copy of ${r}` : r || ""
|
|
27
|
+
), [l, f] = D(""), [b, v] = D(!t), [C, w] = D(!0);
|
|
28
|
+
Be.useEffect(() => {
|
|
29
|
+
c && (o(
|
|
30
|
+
t && r ? `Copy of ${r}` : r || ""
|
|
31
|
+
), f(""), v(!t), w(!0));
|
|
32
|
+
}, [c, t, r]);
|
|
33
|
+
const N = () => {
|
|
34
|
+
s.trim() && (!b && !C || u({
|
|
35
|
+
name: s.trim(),
|
|
36
|
+
description: l.trim() || void 0,
|
|
37
|
+
saveToLibrary: b,
|
|
38
|
+
saveToCurrentDashboard: C
|
|
39
|
+
}));
|
|
40
|
+
}, d = s.trim() && (b || C);
|
|
41
|
+
return /* @__PURE__ */ e($, { open: c, onOpenChange: i, children: /* @__PURE__ */ a(H, { className: "sm:max-w-[425px]", children: [
|
|
42
|
+
/* @__PURE__ */ a(W, { children: [
|
|
43
|
+
/* @__PURE__ */ e(_, { children: "Save Visual As" }),
|
|
44
|
+
/* @__PURE__ */ e(K, { children: t ? "Create a copy of this visual with a new name" : "Save this visual to make it reusable" })
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ a("div", { className: "grid gap-4 py-4", children: [
|
|
47
|
+
/* @__PURE__ */ a("div", { className: "grid gap-2", children: [
|
|
48
|
+
/* @__PURE__ */ e(S, { htmlFor: "name", children: "Name" }),
|
|
49
|
+
/* @__PURE__ */ e(
|
|
50
|
+
J,
|
|
51
|
+
{
|
|
52
|
+
id: "name",
|
|
53
|
+
value: s,
|
|
54
|
+
onChange: (p) => o(p.target.value),
|
|
55
|
+
placeholder: "Enter visual name",
|
|
56
|
+
disabled: n
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
] }),
|
|
60
|
+
/* @__PURE__ */ a("div", { className: "grid gap-2", children: [
|
|
61
|
+
/* @__PURE__ */ e(S, { htmlFor: "description", children: "Description (optional)" }),
|
|
62
|
+
/* @__PURE__ */ e(
|
|
63
|
+
Z,
|
|
64
|
+
{
|
|
65
|
+
id: "description",
|
|
66
|
+
value: l,
|
|
67
|
+
onChange: (p) => f(p.target.value),
|
|
68
|
+
placeholder: "Enter visual description",
|
|
69
|
+
rows: 3,
|
|
70
|
+
disabled: n
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
] }),
|
|
74
|
+
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
75
|
+
/* @__PURE__ */ e(S, { children: "Save to:" }),
|
|
76
|
+
/* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
77
|
+
/* @__PURE__ */ a("div", { className: "flex items-center space-x-2", children: [
|
|
78
|
+
/* @__PURE__ */ e(
|
|
79
|
+
V,
|
|
80
|
+
{
|
|
81
|
+
id: "save-to-dashboard",
|
|
82
|
+
checked: C,
|
|
83
|
+
onCheckedChange: (p) => w(!!p),
|
|
84
|
+
disabled: n
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ a(
|
|
88
|
+
"label",
|
|
89
|
+
{
|
|
90
|
+
htmlFor: "save-to-dashboard",
|
|
91
|
+
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
92
|
+
children: [
|
|
93
|
+
"Current Dashboard",
|
|
94
|
+
/* @__PURE__ */ e("span", { className: "ml-2 text-xs text-muted-foreground", children: t ? "(add copy to this dashboard)" : "(keep as local visual)" })
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ a("div", { className: "flex items-center space-x-2", children: [
|
|
100
|
+
/* @__PURE__ */ e(
|
|
101
|
+
V,
|
|
102
|
+
{
|
|
103
|
+
id: "save-to-library",
|
|
104
|
+
checked: b,
|
|
105
|
+
onCheckedChange: (p) => v(!!p),
|
|
106
|
+
disabled: n
|
|
107
|
+
}
|
|
108
|
+
),
|
|
109
|
+
/* @__PURE__ */ a(
|
|
110
|
+
"label",
|
|
111
|
+
{
|
|
112
|
+
htmlFor: "save-to-library",
|
|
113
|
+
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
114
|
+
children: [
|
|
115
|
+
"Visual Library",
|
|
116
|
+
/* @__PURE__ */ e("span", { className: "ml-2 text-xs text-muted-foreground", children: t ? "(save as new reusable visual)" : "(make available to all dashboards)" })
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
] })
|
|
121
|
+
] }),
|
|
122
|
+
!b && !C && /* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: "Please select at least one destination" })
|
|
123
|
+
] })
|
|
124
|
+
] }),
|
|
125
|
+
/* @__PURE__ */ a(Q, { children: [
|
|
126
|
+
/* @__PURE__ */ e(
|
|
127
|
+
A,
|
|
128
|
+
{
|
|
129
|
+
variant: "outline",
|
|
130
|
+
onClick: () => i(!1),
|
|
131
|
+
disabled: n,
|
|
132
|
+
children: "Cancel"
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
/* @__PURE__ */ a(A, { onClick: N, disabled: !d || n, children: [
|
|
136
|
+
n && /* @__PURE__ */ e(T, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
137
|
+
n ? "Saving..." : "Save"
|
|
138
|
+
] })
|
|
139
|
+
] })
|
|
140
|
+
] }) });
|
|
141
|
+
}
|
|
142
|
+
function Re() {
|
|
143
|
+
const [c, i] = D(!1), [t, r] = D(!1), [n, u] = D(null), s = E((h) => h.frame), o = E((h) => h.card), l = ee(), f = x((h) => h.selectedSheetId), b = x(
|
|
144
|
+
(h) => h.actions.setIsDashboardPanelOpen
|
|
145
|
+
), { getUpdatedFrame: v } = Y(), { selectVisual: C } = ae(), { addFrame: w, setSelectedFrameId: N, setIsVisualEditing: d } = X(), p = !!(s != null && s.visualId), P = (() => {
|
|
146
|
+
var h, y;
|
|
147
|
+
return ((h = s == null ? void 0 : s.cards) == null ? void 0 : h.length) === 1 && ((y = s.cards[0]) != null && y.title) ? s.cards[0].title : l != null && l.title ? l.title : (o == null ? void 0 : o.title) || "Untitled Visual";
|
|
148
|
+
})(), m = se((h) => {
|
|
149
|
+
if (h != null && h.id) {
|
|
150
|
+
if (C(h), t && n && f) {
|
|
151
|
+
const y = {
|
|
152
|
+
...n,
|
|
153
|
+
id: O(),
|
|
154
|
+
visualId: h.id
|
|
155
|
+
// Link to the newly created library visual
|
|
156
|
+
};
|
|
157
|
+
w(f, y, "end"), N(y.id), r(!1), u(null), d(!1);
|
|
158
|
+
}
|
|
159
|
+
b(!0), i(!1);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return {
|
|
163
|
+
saveAsDialogOpen: c,
|
|
164
|
+
setSaveAsDialogOpen: i,
|
|
165
|
+
handleSaveAs: async (h) => {
|
|
166
|
+
if (!f) {
|
|
167
|
+
g.error("No sheet selected");
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const y = v(), M = y.cards.length === 1 ? {
|
|
171
|
+
...y,
|
|
172
|
+
cards: y.cards.map((I) => ({
|
|
173
|
+
...I,
|
|
174
|
+
title: h.name
|
|
175
|
+
// Use visual name as card title
|
|
176
|
+
}))
|
|
177
|
+
} : y;
|
|
178
|
+
if (h.saveToLibrary) {
|
|
179
|
+
r(h.saveToCurrentDashboard), u(M);
|
|
180
|
+
const I = {
|
|
181
|
+
title: h.name,
|
|
182
|
+
description: h.description,
|
|
183
|
+
frameObject: M,
|
|
184
|
+
// Card title synced for single-card frames
|
|
185
|
+
isPrivate: !1
|
|
186
|
+
};
|
|
187
|
+
m.mutate(I);
|
|
188
|
+
} else if (h.saveToCurrentDashboard) {
|
|
189
|
+
const I = {
|
|
190
|
+
...M,
|
|
191
|
+
// Card title already synced
|
|
192
|
+
id: O(),
|
|
193
|
+
visualId: void 0
|
|
194
|
+
// Explicitly no visualId for local visuals
|
|
195
|
+
};
|
|
196
|
+
w(f, I, "end"), N(I.id), g.success("Visual saved to dashboard"), i(!1), d(!1);
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
isLibraryVisual: p,
|
|
200
|
+
currentVisualName: P,
|
|
201
|
+
isSaving: m.isPending
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
function Xe({
|
|
205
|
+
className: c
|
|
206
|
+
}) {
|
|
207
|
+
const i = E((m) => m.frame), t = E((m) => m.card), r = te((m) => m.selectedVisual), n = x((m) => m.selectedFrameId), u = x((m) => m.selectedSheetId), { setIsVisualEditing: s } = X(), o = !!(i != null && i.visualId || r != null && r.id), l = !!(i != null && i.visualId && n), f = o && !l, {
|
|
208
|
+
saveAsDialogOpen: b,
|
|
209
|
+
setSaveAsDialogOpen: v,
|
|
210
|
+
handleSaveAs: C,
|
|
211
|
+
isLibraryVisual: w,
|
|
212
|
+
currentVisualName: N,
|
|
213
|
+
isSaving: d
|
|
214
|
+
} = Re(), { handleAddLibraryVisual: p } = Y(), P = async () => {
|
|
215
|
+
if (!u) {
|
|
216
|
+
g.error("No dashboard sheet selected");
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
if (!r) {
|
|
220
|
+
g.error("No visual selected");
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const m = await p(r);
|
|
224
|
+
m.success ? (g.success("Visual added to dashboard"), s(!1)) : g.error(m.error || "Failed to add visual to dashboard");
|
|
225
|
+
};
|
|
226
|
+
return /* @__PURE__ */ a(F, { children: [
|
|
227
|
+
!o && /* @__PURE__ */ e(Ee, { className: c, variant: "default" }),
|
|
228
|
+
o && /* @__PURE__ */ a(F, { children: [
|
|
229
|
+
l && /* @__PURE__ */ e(Me, { className: c }),
|
|
230
|
+
f && u && t && (t.sql || re(t.config)) && /* @__PURE__ */ a(
|
|
231
|
+
A,
|
|
232
|
+
{
|
|
233
|
+
onClick: P,
|
|
234
|
+
className: k(c),
|
|
235
|
+
size: "sm",
|
|
236
|
+
variant: "outline",
|
|
237
|
+
children: [
|
|
238
|
+
/* @__PURE__ */ e(Ue, { className: "mr-2 size-4 font-bold" }),
|
|
239
|
+
"Add to Dashboard"
|
|
240
|
+
]
|
|
241
|
+
}
|
|
242
|
+
),
|
|
243
|
+
f && /* @__PURE__ */ e(Ve, { className: c, variant: "default" }),
|
|
244
|
+
l && /* @__PURE__ */ e(Te, { className: c }),
|
|
245
|
+
/* @__PURE__ */ a(B, { modal: !1, children: [
|
|
246
|
+
/* @__PURE__ */ e(L, { asChild: !0, children: /* @__PURE__ */ e(
|
|
247
|
+
A,
|
|
248
|
+
{
|
|
249
|
+
variant: "outline",
|
|
250
|
+
size: "sm",
|
|
251
|
+
className: k(c, "w-8 p-0"),
|
|
252
|
+
children: /* @__PURE__ */ e(z, { className: "h-4 w-4" })
|
|
253
|
+
}
|
|
254
|
+
) }),
|
|
255
|
+
/* @__PURE__ */ e(U, { align: "end", children: /* @__PURE__ */ a(
|
|
256
|
+
G,
|
|
257
|
+
{
|
|
258
|
+
onClick: (m) => {
|
|
259
|
+
m.stopPropagation(), v(!0);
|
|
260
|
+
},
|
|
261
|
+
children: [
|
|
262
|
+
/* @__PURE__ */ e(j, { className: "mr-2 h-4 w-4" }),
|
|
263
|
+
"Save As..."
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
) })
|
|
267
|
+
] })
|
|
268
|
+
] }),
|
|
269
|
+
!o && /* @__PURE__ */ a(B, { modal: !1, children: [
|
|
270
|
+
/* @__PURE__ */ e(L, { asChild: !0, children: /* @__PURE__ */ e(
|
|
271
|
+
A,
|
|
272
|
+
{
|
|
273
|
+
variant: "outline",
|
|
274
|
+
size: "sm",
|
|
275
|
+
className: k(c, "w-8 p-0"),
|
|
276
|
+
children: /* @__PURE__ */ e(z, { className: "h-4 w-4" })
|
|
277
|
+
}
|
|
278
|
+
) }),
|
|
279
|
+
/* @__PURE__ */ e(U, { align: "end", children: /* @__PURE__ */ a(G, { onClick: () => v(!0), children: [
|
|
280
|
+
/* @__PURE__ */ e(j, { className: "mr-2 h-4 w-4" }),
|
|
281
|
+
"Save As..."
|
|
282
|
+
] }) })
|
|
283
|
+
] }),
|
|
284
|
+
/* @__PURE__ */ e(Oe, { className: c }),
|
|
285
|
+
/* @__PURE__ */ e(
|
|
286
|
+
Ge,
|
|
287
|
+
{
|
|
288
|
+
open: b,
|
|
289
|
+
onOpenChange: (m) => {
|
|
290
|
+
d || v(m);
|
|
291
|
+
},
|
|
292
|
+
isLibraryVisual: w,
|
|
293
|
+
currentVisualName: N,
|
|
294
|
+
isSaving: d,
|
|
295
|
+
onConfirm: C
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
] });
|
|
299
|
+
}
|
|
300
|
+
function Ye({
|
|
301
|
+
className: c,
|
|
302
|
+
//labelClassName,
|
|
303
|
+
switchClassName: i
|
|
304
|
+
}) {
|
|
305
|
+
const t = E((o) => o.isDevMode), r = x((o) => o.isVisualEditing), { setIsDevMode: n } = oe(), { config: u } = Le(le).tokenProps, s = (u == null ? void 0 : u.showAdvancedMode) !== !1;
|
|
306
|
+
return !r || !s ? null : /* @__PURE__ */ a("div", { className: k("flex items-center space-x-2", c), children: [
|
|
307
|
+
/* @__PURE__ */ e(
|
|
308
|
+
ne,
|
|
309
|
+
{
|
|
310
|
+
className: k("", i),
|
|
311
|
+
checked: t,
|
|
312
|
+
onCheckedChange: () => n(!t),
|
|
313
|
+
id: "advanced-mode",
|
|
314
|
+
icon: /* @__PURE__ */ e(de, { className: "h-4 w-4" }),
|
|
315
|
+
tooltip: t ? "Standard Mode" : "Advanced Mode"
|
|
316
|
+
}
|
|
317
|
+
),
|
|
318
|
+
/* @__PURE__ */ e("label", { htmlFor: "advanced-mode", className: "sr-only", children: "Advanced Mode" })
|
|
319
|
+
] });
|
|
320
|
+
}
|
|
321
|
+
function qe({
|
|
322
|
+
open: c,
|
|
323
|
+
onOpenChange: i,
|
|
324
|
+
onSave: t,
|
|
325
|
+
onDiscard: r,
|
|
326
|
+
isSaving: n
|
|
327
|
+
}) {
|
|
328
|
+
return /* @__PURE__ */ e(ie, { open: c, onOpenChange: (s) => {
|
|
329
|
+
!s && n || i(s);
|
|
330
|
+
}, children: /* @__PURE__ */ a(ce, { className: "max-w-md", children: [
|
|
331
|
+
/* @__PURE__ */ a(he, { children: [
|
|
332
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-3", children: [
|
|
333
|
+
/* @__PURE__ */ e("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-amber-100", children: /* @__PURE__ */ e(ue, { className: "h-5 w-5 text-amber-600" }) }),
|
|
334
|
+
/* @__PURE__ */ e(me, { className: "text-xl", children: "Unsaved Changes" })
|
|
335
|
+
] }),
|
|
336
|
+
/* @__PURE__ */ e(pe, { className: "pt-2 text-base leading-relaxed", children: "You have unsaved changes to this dashboard. What would you like to do?" })
|
|
337
|
+
] }),
|
|
338
|
+
/* @__PURE__ */ a(fe, { className: "flex-col gap-2 sm:flex-row sm:gap-2", children: [
|
|
339
|
+
/* @__PURE__ */ e(
|
|
340
|
+
ve,
|
|
341
|
+
{
|
|
342
|
+
disabled: n,
|
|
343
|
+
className: "order-1 m-0 border-border/50 sm:order-1",
|
|
344
|
+
children: "Cancel"
|
|
345
|
+
}
|
|
346
|
+
),
|
|
347
|
+
/* @__PURE__ */ e(
|
|
348
|
+
"button",
|
|
349
|
+
{
|
|
350
|
+
onClick: r,
|
|
351
|
+
disabled: n,
|
|
352
|
+
className: "order-2 rounded-md border border-destructive/20 bg-destructive/10 px-4 py-2 text-sm font-medium text-destructive transition-colors hover:bg-destructive/20 disabled:pointer-events-none disabled:opacity-50 sm:order-2",
|
|
353
|
+
children: "Discard"
|
|
354
|
+
}
|
|
355
|
+
),
|
|
356
|
+
/* @__PURE__ */ e(
|
|
357
|
+
ge,
|
|
358
|
+
{
|
|
359
|
+
onClick: t,
|
|
360
|
+
disabled: n,
|
|
361
|
+
className: "order-3 m-0 bg-primary text-primary-foreground hover:bg-primary/90 sm:order-3",
|
|
362
|
+
children: n ? /* @__PURE__ */ a(F, { children: [
|
|
363
|
+
/* @__PURE__ */ e(T, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
364
|
+
"Saving..."
|
|
365
|
+
] }) : "Save & Close"
|
|
366
|
+
}
|
|
367
|
+
)
|
|
368
|
+
] })
|
|
369
|
+
] }) });
|
|
370
|
+
}
|
|
371
|
+
function Je(c, i, t, r) {
|
|
372
|
+
ze(() => {
|
|
373
|
+
c && !t && i && r(be(i));
|
|
374
|
+
}, [c, t, i, r]);
|
|
375
|
+
}
|
|
376
|
+
function Ze({
|
|
377
|
+
triggerButtonClassName: c
|
|
378
|
+
}) {
|
|
379
|
+
const [i, t] = D(!1), r = x((o) => {
|
|
380
|
+
var l;
|
|
381
|
+
return (l = o.dashboard) == null ? void 0 : l.id;
|
|
382
|
+
}), n = x((o) => {
|
|
383
|
+
var l;
|
|
384
|
+
return (l = o.dashboard) == null ? void 0 : l.title;
|
|
385
|
+
}), u = x((o) => {
|
|
386
|
+
var l;
|
|
387
|
+
return (l = o.dashboard) == null ? void 0 : l.sheets;
|
|
388
|
+
}), s = x((o) => o.selectedSheetId);
|
|
389
|
+
return u == null || u.find((o) => o.id === s), r ? /* @__PURE__ */ a(F, { children: [
|
|
390
|
+
/* @__PURE__ */ e(
|
|
391
|
+
Ce,
|
|
392
|
+
{
|
|
393
|
+
tooltip: "Schedule Dashboard",
|
|
394
|
+
className: k("h-7 p-2", c),
|
|
395
|
+
onClick: () => t(!0),
|
|
396
|
+
children: /* @__PURE__ */ e(we, { className: "size-4" })
|
|
397
|
+
}
|
|
398
|
+
),
|
|
399
|
+
/* @__PURE__ */ e(
|
|
400
|
+
xe,
|
|
401
|
+
{
|
|
402
|
+
open: i,
|
|
403
|
+
onOpenChange: t,
|
|
404
|
+
dashboardId: r,
|
|
405
|
+
dashboardName: n
|
|
406
|
+
}
|
|
407
|
+
)
|
|
408
|
+
] }) : null;
|
|
409
|
+
}
|
|
410
|
+
function ea({
|
|
411
|
+
open: c,
|
|
412
|
+
onOpenChange: i
|
|
413
|
+
}) {
|
|
414
|
+
const [t, r] = D(!1), [n, u] = D(!1), [s, o] = D({
|
|
415
|
+
sheetSelection: "current",
|
|
416
|
+
protectPdf: !1,
|
|
417
|
+
password: ""
|
|
418
|
+
}), l = x((d) => {
|
|
419
|
+
var p;
|
|
420
|
+
return (p = d.dashboard) == null ? void 0 : p.sheets;
|
|
421
|
+
}), f = x((d) => d.selectedSheetId), { tokenProps: b } = De(), v = l == null ? void 0 : l.find((d) => d.id === f), C = ((l == null ? void 0 : l.length) || 0) > 1, w = () => {
|
|
422
|
+
o({
|
|
423
|
+
sheetSelection: "current",
|
|
424
|
+
protectPdf: !1,
|
|
425
|
+
password: ""
|
|
426
|
+
}), r(!1), i(!1);
|
|
427
|
+
};
|
|
428
|
+
async function N() {
|
|
429
|
+
if (s.protectPdf && !s.password) {
|
|
430
|
+
g.error("Please enter a password to protect the PDF");
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
u(!0);
|
|
434
|
+
const d = s.sheetSelection === "all" ? "Generating PDF for all sheets... This may take a while." : s.protectPdf ? "Generating protected PDF... may take up to 60 seconds" : "Generating PDF... may take up to 60 seconds", p = g.loading(d);
|
|
435
|
+
try {
|
|
436
|
+
await ke(
|
|
437
|
+
b.apiServiceUrl,
|
|
438
|
+
s.protectPdf ? s.password : void 0,
|
|
439
|
+
s.sheetSelection
|
|
440
|
+
), g.dismiss(p);
|
|
441
|
+
const P = s.sheetSelection === "all" ? "All sheets PDF downloaded successfully!" : s.protectPdf ? "Protected PDF downloaded successfully!" : "PDF downloaded successfully!";
|
|
442
|
+
g.success(P, {
|
|
443
|
+
duration: 2e3
|
|
444
|
+
}), w();
|
|
445
|
+
} catch (P) {
|
|
446
|
+
g.dismiss(p), g.error("Failed to download PDF", {
|
|
447
|
+
description: "Please try again or contact support.",
|
|
448
|
+
richColors: !0
|
|
449
|
+
}), console.error("PDF download error:", P);
|
|
450
|
+
} finally {
|
|
451
|
+
u(!1);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
return /* @__PURE__ */ e(
|
|
455
|
+
$,
|
|
456
|
+
{
|
|
457
|
+
open: c,
|
|
458
|
+
onOpenChange: (d) => {
|
|
459
|
+
if (!d) {
|
|
460
|
+
w();
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
i(!0);
|
|
464
|
+
},
|
|
465
|
+
children: /* @__PURE__ */ a(H, { className: "sm:max-w-[425px]", children: [
|
|
466
|
+
/* @__PURE__ */ a(W, { children: [
|
|
467
|
+
/* @__PURE__ */ e(_, { children: "Export Dashboard" }),
|
|
468
|
+
/* @__PURE__ */ e(K, { children: "Export your dashboard as a PDF document." })
|
|
469
|
+
] }),
|
|
470
|
+
/* @__PURE__ */ a("div", { className: "space-y-4 py-4", children: [
|
|
471
|
+
C && /* @__PURE__ */ a(F, { children: [
|
|
472
|
+
/* @__PURE__ */ a("div", { className: "space-y-3", children: [
|
|
473
|
+
/* @__PURE__ */ e(S, { children: "Export Scope" }),
|
|
474
|
+
/* @__PURE__ */ a(
|
|
475
|
+
ye,
|
|
476
|
+
{
|
|
477
|
+
value: s.sheetSelection,
|
|
478
|
+
onValueChange: (d) => o({
|
|
479
|
+
...s,
|
|
480
|
+
sheetSelection: d
|
|
481
|
+
}),
|
|
482
|
+
children: [
|
|
483
|
+
/* @__PURE__ */ a("div", { className: "flex items-center space-x-2", children: [
|
|
484
|
+
/* @__PURE__ */ e(R, { value: "current", id: "scope-current" }),
|
|
485
|
+
/* @__PURE__ */ a(
|
|
486
|
+
S,
|
|
487
|
+
{
|
|
488
|
+
htmlFor: "scope-current",
|
|
489
|
+
className: "cursor-pointer font-normal",
|
|
490
|
+
children: [
|
|
491
|
+
"This sheet (",
|
|
492
|
+
(v == null ? void 0 : v.title) || "Current",
|
|
493
|
+
")"
|
|
494
|
+
]
|
|
495
|
+
}
|
|
496
|
+
)
|
|
497
|
+
] }),
|
|
498
|
+
/* @__PURE__ */ a("div", { className: "flex items-center space-x-2", children: [
|
|
499
|
+
/* @__PURE__ */ e(R, { value: "all", id: "scope-all" }),
|
|
500
|
+
/* @__PURE__ */ a(
|
|
501
|
+
S,
|
|
502
|
+
{
|
|
503
|
+
htmlFor: "scope-all",
|
|
504
|
+
className: "cursor-pointer font-normal",
|
|
505
|
+
children: [
|
|
506
|
+
"All sheets (",
|
|
507
|
+
l == null ? void 0 : l.length,
|
|
508
|
+
" sheets)"
|
|
509
|
+
]
|
|
510
|
+
}
|
|
511
|
+
)
|
|
512
|
+
] })
|
|
513
|
+
]
|
|
514
|
+
}
|
|
515
|
+
)
|
|
516
|
+
] }),
|
|
517
|
+
/* @__PURE__ */ e(Ne, {})
|
|
518
|
+
] }),
|
|
519
|
+
/* @__PURE__ */ a("div", { className: "space-y-3", children: [
|
|
520
|
+
/* @__PURE__ */ a("div", { className: "flex items-center space-x-2", children: [
|
|
521
|
+
/* @__PURE__ */ e(
|
|
522
|
+
V,
|
|
523
|
+
{
|
|
524
|
+
id: "protect-pdf",
|
|
525
|
+
checked: s.protectPdf,
|
|
526
|
+
onCheckedChange: (d) => {
|
|
527
|
+
o({
|
|
528
|
+
...s,
|
|
529
|
+
protectPdf: d,
|
|
530
|
+
password: d ? s.password : ""
|
|
531
|
+
}), d || r(!1);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
),
|
|
535
|
+
/* @__PURE__ */ a(
|
|
536
|
+
S,
|
|
537
|
+
{
|
|
538
|
+
htmlFor: "protect-pdf",
|
|
539
|
+
className: "flex cursor-pointer items-center text-sm font-normal",
|
|
540
|
+
children: [
|
|
541
|
+
/* @__PURE__ */ e(Se, { className: "mr-2 h-3.5 w-3.5" }),
|
|
542
|
+
"Password protect PDF"
|
|
543
|
+
]
|
|
544
|
+
}
|
|
545
|
+
)
|
|
546
|
+
] }),
|
|
547
|
+
s.protectPdf && /* @__PURE__ */ a("div", { className: "ml-6 space-y-2", children: [
|
|
548
|
+
/* @__PURE__ */ e(S, { htmlFor: "pdf-password", className: "text-sm", children: "Password" }),
|
|
549
|
+
/* @__PURE__ */ a("div", { className: "relative", children: [
|
|
550
|
+
/* @__PURE__ */ e(
|
|
551
|
+
Ae,
|
|
552
|
+
{
|
|
553
|
+
id: "pdf-password",
|
|
554
|
+
type: t ? "text" : "password",
|
|
555
|
+
value: s.password,
|
|
556
|
+
onChange: (d) => o({ ...s, password: d.target.value }),
|
|
557
|
+
placeholder: "Enter password",
|
|
558
|
+
className: "pr-10",
|
|
559
|
+
onKeyDown: (d) => {
|
|
560
|
+
d.key === "Enter" && s.password && N();
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
),
|
|
564
|
+
/* @__PURE__ */ e(
|
|
565
|
+
A,
|
|
566
|
+
{
|
|
567
|
+
type: "button",
|
|
568
|
+
variant: "ghost",
|
|
569
|
+
size: "sm",
|
|
570
|
+
className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
|
|
571
|
+
onClick: () => r(!t),
|
|
572
|
+
children: t ? /* @__PURE__ */ e(Pe, { className: "h-4 w-4 text-muted-foreground" }) : /* @__PURE__ */ e(Fe, { className: "h-4 w-4 text-muted-foreground" })
|
|
573
|
+
}
|
|
574
|
+
)
|
|
575
|
+
] }),
|
|
576
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: "Recipients will need this password to open the PDF" })
|
|
577
|
+
] })
|
|
578
|
+
] })
|
|
579
|
+
] }),
|
|
580
|
+
/* @__PURE__ */ a(Q, { children: [
|
|
581
|
+
/* @__PURE__ */ e(A, { variant: "outline", onClick: w, disabled: n, children: "Cancel" }),
|
|
582
|
+
/* @__PURE__ */ e(A, { onClick: N, disabled: n, children: n ? /* @__PURE__ */ a(F, { children: [
|
|
583
|
+
/* @__PURE__ */ e(T, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
584
|
+
"Exporting..."
|
|
585
|
+
] }) : /* @__PURE__ */ a(F, { children: [
|
|
586
|
+
/* @__PURE__ */ e(Ie, { className: "mr-2 h-4 w-4" }),
|
|
587
|
+
"Export"
|
|
588
|
+
] }) })
|
|
589
|
+
] })
|
|
590
|
+
] })
|
|
591
|
+
}
|
|
592
|
+
);
|
|
593
|
+
}
|
|
594
|
+
export {
|
|
595
|
+
Ye as A,
|
|
596
|
+
ea as D,
|
|
597
|
+
Ze as S,
|
|
598
|
+
qe as U,
|
|
599
|
+
Xe as V,
|
|
600
|
+
Je as u
|
|
601
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),a=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),a=require("./index-Df1tIEqs.js");require("react");require("react-dom");function i(){const o=a.useDashboardStore(e=>e.dashboard),r=a.useDashboardStore(e=>e.actions.setDashboard),t=a.useDashboardStore(e=>e.showDashboardJSON),n=a.useDashboardStore(e=>e.actions.setShowDashboardJSON);return s.jsxs("div",{className:a.cn("relative p-2",{hidden:!t}),children:[s.jsxs(a.Button,{variant:"secondary",size:"sm",className:"absolute right-2 top-2 z-10 h-8",onClick:()=>n(!1),children:[s.jsx(a.X,{className:"mr-2 h-4 w-4"}),"Close"]}),s.jsx(a.de,{onChange:e=>{if(e)try{JSON.parse(e),r(JSON.parse(e))}catch{}},defaultLanguage:"json",className:"h-[550px] overflow-y-auto",value:JSON.stringify(o,null,2),options:{minimap:{enabled:!1},glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})]})}exports.default=i;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as o, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { u as s, c as l, B as h, X as d, d as c } from "./index-
|
|
2
|
+
import { u as s, c as l, B as h, X as d, d as c } from "./index-vRQsO2Ki.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "react-dom";
|
|
5
5
|
function N() {
|