react-semaphor 0.1.165 → 0.1.166
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-B9UPzyO5.js +26 -0
- package/dist/chunks/{dashboard-controls-BA7vyPHM.js → dashboard-controls-CixEPYYv.js} +273 -298
- package/dist/chunks/{dashboard-json-C8YFsFVt.js → dashboard-json-BYNwk3YG.js} +1 -1
- package/dist/chunks/{dashboard-json-B4UTFvyR.js → dashboard-json-LXUW-x_7.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-BMBiT_V_.js → edit-dashboard-visual-CyW3aGrM.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-DKqjPVRM.js → edit-dashboard-visual-DtiYOHX5.js} +2 -2
- package/dist/chunks/{editor-action-buttons-De18jUjn.js → editor-action-buttons-C2VJa0cF.js} +2 -2
- package/dist/chunks/{editor-action-buttons-xrbSWcSm.js → editor-action-buttons-CFZZpeDq.js} +1 -1
- package/dist/chunks/{index-odiH0LJA.js → index-CQ7RRL9U.js} +167 -167
- package/dist/chunks/{index-5dE6RqWv.js → index-DYeBGt71.js} +13920 -13687
- package/dist/chunks/{resource-management-panel-CjWRsuif.js → resource-management-panel-DJOLQsLL.js} +128 -128
- package/dist/chunks/{resource-management-panel-CK-wL4Jy.js → resource-management-panel-qqHHN4xT.js} +1 -1
- package/dist/chunks/schedule-dashboard-B5cLQ2sk.js +6 -0
- package/dist/chunks/schedule-dashboard-B9Y23qK6.js +416 -0
- package/dist/chunks/{use-role-aware-display-preferences-Bj_-I3oD.js → use-role-aware-display-preferences-8gWJAMO3.js} +1 -1
- package/dist/chunks/{use-role-aware-display-preferences-Cm7hg_Us.js → use-role-aware-display-preferences-BJCLNjn8.js} +1 -1
- package/dist/chunks/{use-visual-utils-Du173Ucu.js → use-visual-utils-Bsvc2KNu.js} +1 -1
- package/dist/chunks/{use-visual-utils-DwnVUHSd.js → use-visual-utils-DA9bk0Rh.js} +10 -10
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +58 -58
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/dashboard.d.ts +5 -0
- package/dist/types/main.d.ts +5 -0
- package/dist/types/surfboard.d.ts +5 -0
- package/dist/types/types.d.ts +5 -0
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-CEnWdjuE.js +0 -26
- package/dist/chunks/dashboard-export-dialog-9nJsWzgJ.js +0 -6
- package/dist/chunks/dashboard-export-dialog-CEVJnrSj.js +0 -602
|
@@ -1,602 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as a, Fragment as F } from "react/jsx-runtime";
|
|
2
|
-
import { l as J, aE as $, aF as H, aG as K, aH as W, aI as _, aJ as A, aK as Q, aL as Z, aM as V, aN as q, B as P, L as T, n as E, q as ee, u as b, aA as ae, o as X, aO as se, aP as O, t as v, R as te, aQ as re, c as I, aR as B, aS as L, aT as z, aU as U, aV as G, m as oe, aW as le, aX as ne, aY as de, aZ as ie, a_ as ce, a$ as he, b0 as ue, b1 as me, b2 as pe, b3 as fe, b4 as ve, b5 as ge, a5 as be, K as Ce, b6 as we, b7 as xe, az as De, b8 as Ne, b9 as R, ba as ye, bb as Se, bc as Ae, bd as Pe, be as Fe, bf as ke, a7 as Ie } from "./index-5dE6RqWv.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-De18jUjn.js";
|
|
4
|
-
import Be, { useState as C, useContext as Le, useEffect as ze } from "react";
|
|
5
|
-
import { a as Y } from "./use-visual-utils-DwnVUHSd.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 = J("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: r,
|
|
21
|
-
currentVisualName: o,
|
|
22
|
-
isSaving: d = !1,
|
|
23
|
-
onConfirm: m
|
|
24
|
-
}) {
|
|
25
|
-
const [s, l] = C(
|
|
26
|
-
r && o ? `Copy of ${o}` : o || ""
|
|
27
|
-
), [n, f] = C(""), [g, w] = C(!r), [p, y] = C(!0);
|
|
28
|
-
Be.useEffect(() => {
|
|
29
|
-
c && (l(
|
|
30
|
-
r && o ? `Copy of ${o}` : o || ""
|
|
31
|
-
), f(""), w(!r), y(!0));
|
|
32
|
-
}, [c, r, o]);
|
|
33
|
-
const x = () => {
|
|
34
|
-
s.trim() && (!g && !p || m({
|
|
35
|
-
name: s.trim(),
|
|
36
|
-
description: n.trim() || void 0,
|
|
37
|
-
saveToLibrary: g,
|
|
38
|
-
saveToCurrentDashboard: p
|
|
39
|
-
}));
|
|
40
|
-
}, D = s.trim() && (g || p);
|
|
41
|
-
return /* @__PURE__ */ e($, { open: c, onOpenChange: i, children: /* @__PURE__ */ a(H, { className: "sm:max-w-[425px]", children: [
|
|
42
|
-
/* @__PURE__ */ a(K, { children: [
|
|
43
|
-
/* @__PURE__ */ e(W, { children: "Save Visual As" }),
|
|
44
|
-
/* @__PURE__ */ e(_, { children: r ? "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(A, { htmlFor: "name", children: "Name" }),
|
|
49
|
-
/* @__PURE__ */ e(
|
|
50
|
-
Q,
|
|
51
|
-
{
|
|
52
|
-
id: "name",
|
|
53
|
-
value: s,
|
|
54
|
-
onChange: (t) => l(t.target.value),
|
|
55
|
-
placeholder: "Enter visual name",
|
|
56
|
-
disabled: d
|
|
57
|
-
}
|
|
58
|
-
)
|
|
59
|
-
] }),
|
|
60
|
-
/* @__PURE__ */ a("div", { className: "grid gap-2", children: [
|
|
61
|
-
/* @__PURE__ */ e(A, { htmlFor: "description", children: "Description (optional)" }),
|
|
62
|
-
/* @__PURE__ */ e(
|
|
63
|
-
Z,
|
|
64
|
-
{
|
|
65
|
-
id: "description",
|
|
66
|
-
value: n,
|
|
67
|
-
onChange: (t) => f(t.target.value),
|
|
68
|
-
placeholder: "Enter visual description",
|
|
69
|
-
rows: 3,
|
|
70
|
-
disabled: d
|
|
71
|
-
}
|
|
72
|
-
)
|
|
73
|
-
] }),
|
|
74
|
-
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
75
|
-
/* @__PURE__ */ e(A, { 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: p,
|
|
83
|
-
onCheckedChange: (t) => y(!!t),
|
|
84
|
-
disabled: d
|
|
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: r ? "(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: g,
|
|
105
|
-
onCheckedChange: (t) => w(!!t),
|
|
106
|
-
disabled: d
|
|
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: r ? "(save as new reusable visual)" : "(make available to all dashboards)" })
|
|
117
|
-
]
|
|
118
|
-
}
|
|
119
|
-
)
|
|
120
|
-
] })
|
|
121
|
-
] }),
|
|
122
|
-
!g && !p && /* @__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
|
-
P,
|
|
128
|
-
{
|
|
129
|
-
variant: "outline",
|
|
130
|
-
onClick: () => i(!1),
|
|
131
|
-
disabled: d,
|
|
132
|
-
children: "Cancel"
|
|
133
|
-
}
|
|
134
|
-
),
|
|
135
|
-
/* @__PURE__ */ a(P, { onClick: x, disabled: !D || d, children: [
|
|
136
|
-
d && /* @__PURE__ */ e(T, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
137
|
-
d ? "Saving..." : "Save"
|
|
138
|
-
] })
|
|
139
|
-
] })
|
|
140
|
-
] }) });
|
|
141
|
-
}
|
|
142
|
-
function Re() {
|
|
143
|
-
const [c, i] = C(!1), [r, o] = C(!1), [d, m] = C(null), s = E((u) => u.frame), l = E((u) => u.card), n = ee(), f = b((u) => u.selectedSheetId), g = b(
|
|
144
|
-
(u) => u.actions.setIsDashboardPanelOpen
|
|
145
|
-
), { getUpdatedFrame: w } = Y(), { selectVisual: p } = ae(), { addFrame: y, setSelectedFrameId: x, setIsVisualEditing: D } = X(), t = !!(s != null && s.visualId), S = (() => {
|
|
146
|
-
var u, N;
|
|
147
|
-
return ((u = s == null ? void 0 : s.cards) == null ? void 0 : u.length) === 1 && ((N = s.cards[0]) != null && N.title) ? s.cards[0].title : n != null && n.title ? n.title : (l == null ? void 0 : l.title) || "Untitled Visual";
|
|
148
|
-
})(), h = se((u) => {
|
|
149
|
-
if (u != null && u.id) {
|
|
150
|
-
if (p(u), r && d && f) {
|
|
151
|
-
const N = {
|
|
152
|
-
...d,
|
|
153
|
-
id: O(),
|
|
154
|
-
visualId: u.id
|
|
155
|
-
// Link to the newly created library visual
|
|
156
|
-
};
|
|
157
|
-
y(f, N, "end"), x(N.id), o(!1), m(null), D(!1);
|
|
158
|
-
}
|
|
159
|
-
g(!0), i(!1);
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
return {
|
|
163
|
-
saveAsDialogOpen: c,
|
|
164
|
-
setSaveAsDialogOpen: i,
|
|
165
|
-
handleSaveAs: async (u) => {
|
|
166
|
-
if (!f) {
|
|
167
|
-
v.error("No sheet selected");
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
const N = w(), M = N.cards.length === 1 ? {
|
|
171
|
-
...N,
|
|
172
|
-
cards: N.cards.map((k) => ({
|
|
173
|
-
...k,
|
|
174
|
-
title: u.name
|
|
175
|
-
// Use visual name as card title
|
|
176
|
-
}))
|
|
177
|
-
} : N;
|
|
178
|
-
if (u.saveToLibrary) {
|
|
179
|
-
o(u.saveToCurrentDashboard), m(M);
|
|
180
|
-
const k = {
|
|
181
|
-
title: u.name,
|
|
182
|
-
description: u.description,
|
|
183
|
-
frameObject: M,
|
|
184
|
-
// Card title synced for single-card frames
|
|
185
|
-
isPrivate: !1
|
|
186
|
-
};
|
|
187
|
-
h.mutate(k);
|
|
188
|
-
} else if (u.saveToCurrentDashboard) {
|
|
189
|
-
const k = {
|
|
190
|
-
...M,
|
|
191
|
-
// Card title already synced
|
|
192
|
-
id: O(),
|
|
193
|
-
visualId: void 0
|
|
194
|
-
// Explicitly no visualId for local visuals
|
|
195
|
-
};
|
|
196
|
-
y(f, k, "end"), x(k.id), v.success("Visual saved to dashboard"), i(!1), D(!1);
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
isLibraryVisual: t,
|
|
200
|
-
currentVisualName: S,
|
|
201
|
-
isSaving: h.isPending
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
function Xe({
|
|
205
|
-
className: c
|
|
206
|
-
}) {
|
|
207
|
-
const i = E((h) => h.frame), r = E((h) => h.card), o = te((h) => h.selectedVisual), d = b((h) => h.selectedFrameId), m = b((h) => h.selectedSheetId), { setIsVisualEditing: s } = X(), l = !!(i != null && i.visualId || o != null && o.id), n = !!(i != null && i.visualId && d), f = l && !n, {
|
|
208
|
-
saveAsDialogOpen: g,
|
|
209
|
-
setSaveAsDialogOpen: w,
|
|
210
|
-
handleSaveAs: p,
|
|
211
|
-
isLibraryVisual: y,
|
|
212
|
-
currentVisualName: x,
|
|
213
|
-
isSaving: D
|
|
214
|
-
} = Re(), { handleAddLibraryVisual: t } = Y(), S = async () => {
|
|
215
|
-
if (!m) {
|
|
216
|
-
v.error("No dashboard sheet selected");
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
if (!o) {
|
|
220
|
-
v.error("No visual selected");
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
const h = await t(o);
|
|
224
|
-
h.success ? (v.success("Visual added to dashboard"), s(!1)) : v.error(h.error || "Failed to add visual to dashboard");
|
|
225
|
-
};
|
|
226
|
-
return /* @__PURE__ */ a(F, { children: [
|
|
227
|
-
!l && /* @__PURE__ */ e(Ee, { className: c, variant: "default" }),
|
|
228
|
-
l && /* @__PURE__ */ a(F, { children: [
|
|
229
|
-
n && /* @__PURE__ */ e(Me, { className: c }),
|
|
230
|
-
f && m && r && (r.sql || re(r.config)) && /* @__PURE__ */ a(
|
|
231
|
-
P,
|
|
232
|
-
{
|
|
233
|
-
onClick: S,
|
|
234
|
-
className: I(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
|
-
n && /* @__PURE__ */ e(Te, { className: c }),
|
|
245
|
-
/* @__PURE__ */ a(B, { modal: !1, children: [
|
|
246
|
-
/* @__PURE__ */ e(L, { asChild: !0, children: /* @__PURE__ */ e(
|
|
247
|
-
P,
|
|
248
|
-
{
|
|
249
|
-
variant: "outline",
|
|
250
|
-
size: "sm",
|
|
251
|
-
className: I(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: (h) => {
|
|
259
|
-
h.stopPropagation(), w(!0);
|
|
260
|
-
},
|
|
261
|
-
children: [
|
|
262
|
-
/* @__PURE__ */ e(j, { className: "mr-2 h-4 w-4" }),
|
|
263
|
-
"Save As..."
|
|
264
|
-
]
|
|
265
|
-
}
|
|
266
|
-
) })
|
|
267
|
-
] })
|
|
268
|
-
] }),
|
|
269
|
-
!l && /* @__PURE__ */ a(B, { modal: !1, children: [
|
|
270
|
-
/* @__PURE__ */ e(L, { asChild: !0, children: /* @__PURE__ */ e(
|
|
271
|
-
P,
|
|
272
|
-
{
|
|
273
|
-
variant: "outline",
|
|
274
|
-
size: "sm",
|
|
275
|
-
className: I(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: () => w(!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: g,
|
|
289
|
-
onOpenChange: (h) => {
|
|
290
|
-
D || w(h);
|
|
291
|
-
},
|
|
292
|
-
isLibraryVisual: y,
|
|
293
|
-
currentVisualName: x,
|
|
294
|
-
isSaving: D,
|
|
295
|
-
onConfirm: p
|
|
296
|
-
}
|
|
297
|
-
)
|
|
298
|
-
] });
|
|
299
|
-
}
|
|
300
|
-
function Ye({
|
|
301
|
-
className: c,
|
|
302
|
-
//labelClassName,
|
|
303
|
-
switchClassName: i
|
|
304
|
-
}) {
|
|
305
|
-
const r = E((l) => l.isDevMode), o = b((l) => l.isVisualEditing), { setIsDevMode: d } = oe(), { config: m } = Le(le).tokenProps, s = (m == null ? void 0 : m.showAdvancedMode) !== !1;
|
|
306
|
-
return !o || !s ? null : /* @__PURE__ */ a("div", { className: I("flex items-center space-x-2", c), children: [
|
|
307
|
-
/* @__PURE__ */ e(
|
|
308
|
-
ne,
|
|
309
|
-
{
|
|
310
|
-
className: I("", i),
|
|
311
|
-
checked: r,
|
|
312
|
-
onCheckedChange: () => d(!r),
|
|
313
|
-
id: "advanced-mode",
|
|
314
|
-
icon: /* @__PURE__ */ e(de, { className: "h-4 w-4" }),
|
|
315
|
-
tooltip: r ? "Standard Mode" : "Advanced Mode"
|
|
316
|
-
}
|
|
317
|
-
),
|
|
318
|
-
/* @__PURE__ */ e("label", { htmlFor: "advanced-mode", className: "sr-only", children: "Advanced Mode" })
|
|
319
|
-
] });
|
|
320
|
-
}
|
|
321
|
-
function Je({
|
|
322
|
-
open: c,
|
|
323
|
-
onOpenChange: i,
|
|
324
|
-
onSave: r,
|
|
325
|
-
onDiscard: o,
|
|
326
|
-
isSaving: d
|
|
327
|
-
}) {
|
|
328
|
-
return /* @__PURE__ */ e(ie, { open: c, onOpenChange: (s) => {
|
|
329
|
-
!s && d || 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: d,
|
|
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: o,
|
|
351
|
-
disabled: d,
|
|
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: r,
|
|
360
|
-
disabled: d,
|
|
361
|
-
className: "order-3 m-0 bg-primary text-primary-foreground hover:bg-primary/90 sm:order-3",
|
|
362
|
-
children: d ? /* @__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 Qe(c, i, r, o) {
|
|
372
|
-
ze(() => {
|
|
373
|
-
c && !r && i && o(be(i));
|
|
374
|
-
}, [c, r, i, o]);
|
|
375
|
-
}
|
|
376
|
-
function Ze({
|
|
377
|
-
triggerButtonClassName: c
|
|
378
|
-
}) {
|
|
379
|
-
const [i, r] = C(!1), o = b((l) => {
|
|
380
|
-
var n;
|
|
381
|
-
return (n = l.dashboard) == null ? void 0 : n.id;
|
|
382
|
-
}), d = b((l) => {
|
|
383
|
-
var n;
|
|
384
|
-
return (n = l.dashboard) == null ? void 0 : n.title;
|
|
385
|
-
}), m = b((l) => {
|
|
386
|
-
var n;
|
|
387
|
-
return (n = l.dashboard) == null ? void 0 : n.sheets;
|
|
388
|
-
}), s = b((l) => l.selectedSheetId);
|
|
389
|
-
return m == null || m.find((l) => l.id === s), o ? /* @__PURE__ */ a(F, { children: [
|
|
390
|
-
/* @__PURE__ */ e(
|
|
391
|
-
Ce,
|
|
392
|
-
{
|
|
393
|
-
tooltip: "Schedule Dashboard",
|
|
394
|
-
className: I("h-7 p-2", c),
|
|
395
|
-
onClick: () => r(!0),
|
|
396
|
-
children: /* @__PURE__ */ e(we, { className: "size-4" })
|
|
397
|
-
}
|
|
398
|
-
),
|
|
399
|
-
/* @__PURE__ */ e(
|
|
400
|
-
xe,
|
|
401
|
-
{
|
|
402
|
-
open: i,
|
|
403
|
-
onOpenChange: r,
|
|
404
|
-
dashboardId: o,
|
|
405
|
-
dashboardName: d
|
|
406
|
-
}
|
|
407
|
-
)
|
|
408
|
-
] }) : null;
|
|
409
|
-
}
|
|
410
|
-
function ea({
|
|
411
|
-
open: c,
|
|
412
|
-
onOpenChange: i
|
|
413
|
-
}) {
|
|
414
|
-
const [r, o] = C(!1), [d, m] = C(!1), [s, l] = C({
|
|
415
|
-
sheetSelection: "current",
|
|
416
|
-
protectPdf: !1,
|
|
417
|
-
password: ""
|
|
418
|
-
}), n = b((t) => {
|
|
419
|
-
var S;
|
|
420
|
-
return (S = t.dashboard) == null ? void 0 : S.sheets;
|
|
421
|
-
}), f = b((t) => t.selectedSheetId), { authToken: g, tokenProps: w } = De(), p = n == null ? void 0 : n.find((t) => t.id === f), y = ((n == null ? void 0 : n.length) || 0) > 1, x = () => {
|
|
422
|
-
l({
|
|
423
|
-
sheetSelection: "current",
|
|
424
|
-
protectPdf: !1,
|
|
425
|
-
password: ""
|
|
426
|
-
}), o(!1), i(!1);
|
|
427
|
-
};
|
|
428
|
-
async function D() {
|
|
429
|
-
if (s.protectPdf && !s.password) {
|
|
430
|
-
v.error("Please enter a password to protect the PDF");
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
m(!0);
|
|
434
|
-
const t = 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", S = v.loading(t);
|
|
435
|
-
try {
|
|
436
|
-
await Ie(
|
|
437
|
-
w.apiServiceUrl,
|
|
438
|
-
g,
|
|
439
|
-
s.protectPdf ? s.password : void 0,
|
|
440
|
-
s.sheetSelection
|
|
441
|
-
), v.dismiss(S);
|
|
442
|
-
const h = s.sheetSelection === "all" ? "All sheets PDF downloaded successfully!" : s.protectPdf ? "Protected PDF downloaded successfully!" : "PDF downloaded successfully!";
|
|
443
|
-
v.success(h, {
|
|
444
|
-
duration: 2e3
|
|
445
|
-
}), x();
|
|
446
|
-
} catch (h) {
|
|
447
|
-
v.dismiss(S), v.error("Failed to download PDF", {
|
|
448
|
-
description: "Please try again or contact support.",
|
|
449
|
-
richColors: !0
|
|
450
|
-
}), console.error("PDF download error:", h);
|
|
451
|
-
} finally {
|
|
452
|
-
m(!1);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
return /* @__PURE__ */ e(
|
|
456
|
-
$,
|
|
457
|
-
{
|
|
458
|
-
open: c,
|
|
459
|
-
onOpenChange: (t) => {
|
|
460
|
-
if (!t) {
|
|
461
|
-
x();
|
|
462
|
-
return;
|
|
463
|
-
}
|
|
464
|
-
i(!0);
|
|
465
|
-
},
|
|
466
|
-
children: /* @__PURE__ */ a(H, { className: "sm:max-w-[425px]", children: [
|
|
467
|
-
/* @__PURE__ */ a(K, { children: [
|
|
468
|
-
/* @__PURE__ */ e(W, { children: "Export Dashboard" }),
|
|
469
|
-
/* @__PURE__ */ e(_, { children: "Export your dashboard as a PDF document." })
|
|
470
|
-
] }),
|
|
471
|
-
/* @__PURE__ */ a("div", { className: "space-y-4 py-4", children: [
|
|
472
|
-
y && /* @__PURE__ */ a(F, { children: [
|
|
473
|
-
/* @__PURE__ */ a("div", { className: "space-y-3", children: [
|
|
474
|
-
/* @__PURE__ */ e(A, { children: "Export Scope" }),
|
|
475
|
-
/* @__PURE__ */ a(
|
|
476
|
-
Ne,
|
|
477
|
-
{
|
|
478
|
-
value: s.sheetSelection,
|
|
479
|
-
onValueChange: (t) => l({
|
|
480
|
-
...s,
|
|
481
|
-
sheetSelection: t
|
|
482
|
-
}),
|
|
483
|
-
children: [
|
|
484
|
-
/* @__PURE__ */ a("div", { className: "flex items-center space-x-2", children: [
|
|
485
|
-
/* @__PURE__ */ e(R, { value: "current", id: "scope-current" }),
|
|
486
|
-
/* @__PURE__ */ a(
|
|
487
|
-
A,
|
|
488
|
-
{
|
|
489
|
-
htmlFor: "scope-current",
|
|
490
|
-
className: "cursor-pointer font-normal",
|
|
491
|
-
children: [
|
|
492
|
-
"This sheet (",
|
|
493
|
-
(p == null ? void 0 : p.title) || "Current",
|
|
494
|
-
")"
|
|
495
|
-
]
|
|
496
|
-
}
|
|
497
|
-
)
|
|
498
|
-
] }),
|
|
499
|
-
/* @__PURE__ */ a("div", { className: "flex items-center space-x-2", children: [
|
|
500
|
-
/* @__PURE__ */ e(R, { value: "all", id: "scope-all" }),
|
|
501
|
-
/* @__PURE__ */ a(
|
|
502
|
-
A,
|
|
503
|
-
{
|
|
504
|
-
htmlFor: "scope-all",
|
|
505
|
-
className: "cursor-pointer font-normal",
|
|
506
|
-
children: [
|
|
507
|
-
"All sheets (",
|
|
508
|
-
n == null ? void 0 : n.length,
|
|
509
|
-
" sheets)"
|
|
510
|
-
]
|
|
511
|
-
}
|
|
512
|
-
)
|
|
513
|
-
] })
|
|
514
|
-
]
|
|
515
|
-
}
|
|
516
|
-
)
|
|
517
|
-
] }),
|
|
518
|
-
/* @__PURE__ */ e(ye, {})
|
|
519
|
-
] }),
|
|
520
|
-
/* @__PURE__ */ a("div", { className: "space-y-3", children: [
|
|
521
|
-
/* @__PURE__ */ a("div", { className: "flex items-center space-x-2", children: [
|
|
522
|
-
/* @__PURE__ */ e(
|
|
523
|
-
V,
|
|
524
|
-
{
|
|
525
|
-
id: "protect-pdf",
|
|
526
|
-
checked: s.protectPdf,
|
|
527
|
-
onCheckedChange: (t) => {
|
|
528
|
-
l({
|
|
529
|
-
...s,
|
|
530
|
-
protectPdf: t,
|
|
531
|
-
password: t ? s.password : ""
|
|
532
|
-
}), t || o(!1);
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
),
|
|
536
|
-
/* @__PURE__ */ a(
|
|
537
|
-
A,
|
|
538
|
-
{
|
|
539
|
-
htmlFor: "protect-pdf",
|
|
540
|
-
className: "flex cursor-pointer items-center text-sm font-normal",
|
|
541
|
-
children: [
|
|
542
|
-
/* @__PURE__ */ e(Se, { className: "mr-2 h-3.5 w-3.5" }),
|
|
543
|
-
"Password protect PDF"
|
|
544
|
-
]
|
|
545
|
-
}
|
|
546
|
-
)
|
|
547
|
-
] }),
|
|
548
|
-
s.protectPdf && /* @__PURE__ */ a("div", { className: "ml-6 space-y-2", children: [
|
|
549
|
-
/* @__PURE__ */ e(A, { htmlFor: "pdf-password", className: "text-sm", children: "Password" }),
|
|
550
|
-
/* @__PURE__ */ a("div", { className: "relative", children: [
|
|
551
|
-
/* @__PURE__ */ e(
|
|
552
|
-
Ae,
|
|
553
|
-
{
|
|
554
|
-
id: "pdf-password",
|
|
555
|
-
type: r ? "text" : "password",
|
|
556
|
-
value: s.password,
|
|
557
|
-
onChange: (t) => l({ ...s, password: t.target.value }),
|
|
558
|
-
placeholder: "Enter password",
|
|
559
|
-
className: "pr-10",
|
|
560
|
-
onKeyDown: (t) => {
|
|
561
|
-
t.key === "Enter" && s.password && D();
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
),
|
|
565
|
-
/* @__PURE__ */ e(
|
|
566
|
-
P,
|
|
567
|
-
{
|
|
568
|
-
type: "button",
|
|
569
|
-
variant: "ghost",
|
|
570
|
-
size: "sm",
|
|
571
|
-
className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
|
|
572
|
-
onClick: () => o(!r),
|
|
573
|
-
children: r ? /* @__PURE__ */ e(Pe, { className: "h-4 w-4 text-muted-foreground" }) : /* @__PURE__ */ e(Fe, { className: "h-4 w-4 text-muted-foreground" })
|
|
574
|
-
}
|
|
575
|
-
)
|
|
576
|
-
] }),
|
|
577
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: "Recipients will need this password to open the PDF" })
|
|
578
|
-
] })
|
|
579
|
-
] })
|
|
580
|
-
] }),
|
|
581
|
-
/* @__PURE__ */ a(q, { children: [
|
|
582
|
-
/* @__PURE__ */ e(P, { variant: "outline", onClick: x, disabled: d, children: "Cancel" }),
|
|
583
|
-
/* @__PURE__ */ e(P, { onClick: D, disabled: d, children: d ? /* @__PURE__ */ a(F, { children: [
|
|
584
|
-
/* @__PURE__ */ e(T, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
585
|
-
"Exporting..."
|
|
586
|
-
] }) : /* @__PURE__ */ a(F, { children: [
|
|
587
|
-
/* @__PURE__ */ e(ke, { className: "mr-2 h-4 w-4" }),
|
|
588
|
-
"Export"
|
|
589
|
-
] }) })
|
|
590
|
-
] })
|
|
591
|
-
] })
|
|
592
|
-
}
|
|
593
|
-
);
|
|
594
|
-
}
|
|
595
|
-
export {
|
|
596
|
-
Ye as A,
|
|
597
|
-
ea as D,
|
|
598
|
-
Ze as S,
|
|
599
|
-
Je as U,
|
|
600
|
-
Xe as V,
|
|
601
|
-
Qe as u
|
|
602
|
-
};
|