react-semaphor 0.1.179 → 0.1.180
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-CeT5saB7.js → dashboard-controls-Baw7eUyM.js} +3 -3
- package/dist/chunks/{dashboard-controls-O2Vl2SaH.js → dashboard-controls-CS3pAVZi.js} +339 -337
- package/dist/chunks/{dashboard-json--jGkpREU.js → dashboard-json-ClalWYi4.js} +1 -1
- package/dist/chunks/{dashboard-json-d1qZ8OYo.js → dashboard-json-Cz4bNnCC.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-ViDNkE8Q.js → edit-dashboard-visual-BMElXt-n.js} +30 -35
- package/dist/chunks/{edit-dashboard-visual-BsP87bZV.js → edit-dashboard-visual-DFJ5FJ7y.js} +11 -22
- package/dist/chunks/editor-action-buttons-DVWnnC_r.js +11 -0
- package/dist/chunks/{editor-action-buttons-F4_UU-Mk.js → editor-action-buttons-MtNYw1Bb.js} +57 -45
- package/dist/chunks/{index-v6ayK5K2.js → index-CAeKp6K8.js} +22589 -22037
- package/dist/chunks/{index-CFWw2cJ5.js → index-CfPKTeUk.js} +232 -227
- package/dist/chunks/notification-bell-2dZI5OV0.js +21 -0
- package/dist/chunks/notification-bell-YZ8VqdwA.js +870 -0
- package/dist/chunks/{resource-management-panel-Cn1aOr6L.js → resource-management-panel-Buhi-kvP.js} +1 -1
- package/dist/chunks/{resource-management-panel-CApVr9Vd.js → resource-management-panel-pxL28GXq.js} +133 -133
- package/dist/chunks/{use-role-aware-display-preferences-C-N0-Iik.js → use-role-aware-display-preferences-B_i2f9tn.js} +1 -1
- package/dist/chunks/{use-role-aware-display-preferences-Bxp6i8c7.js → use-role-aware-display-preferences-JljRcjrP.js} +1 -1
- package/dist/chunks/{use-visual-utils-D9lMGeVv.js → use-visual-utils-D3HjbsKO.js} +38 -38
- package/dist/chunks/{use-visual-utils-D19qzwzI.js → use-visual-utils-DPEHcmFT.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -6
- package/dist/index.js +133 -126
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/main.d.ts +262 -0
- package/package.json +1 -1
- package/dist/chunks/editor-action-buttons-DseT424l.js +0 -6
- package/dist/chunks/schedule-dashboard-B4KUKLfW.js +0 -416
- package/dist/chunks/schedule-dashboard-vvFw8B1E.js +0 -6
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as a, Fragment as F } from "react/jsx-runtime";
|
|
2
|
-
import { l as _, aF as $, aG as q, aH as K, aI as X, aJ as Y, aK as T, aL as G, aM as J, aN as E, aO as Q, B as I, L as H, n as k, q as Z, u as g, aB as ee, o as R, aP as ae, aQ as O, t as y, R as se, aR as te, c as w, aS as B, aT as P, aU as L, aV as U, aW as z, m as de, aX as le, aY as ne, aZ as re, a_ as oe, a$ as ie, b0 as ce, b1 as he, b2 as ue, b3 as me, b4 as ve, b5 as pe, b6 as be, a5 as fe, K as ge, b7 as Ce, b8 as De } from "./index-v6ayK5K2.js";
|
|
3
|
-
import { E as xe, V as Ae, a as Se, b as Ne, S as j, c as ye } from "./editor-action-buttons-F4_UU-Mk.js";
|
|
4
|
-
import we, { useState as D, useContext as Ie, useEffect as ke } from "react";
|
|
5
|
-
import { a as W } from "./use-visual-utils-D9lMGeVv.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 Fe = _("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 Ve({
|
|
18
|
-
open: l,
|
|
19
|
-
onOpenChange: n,
|
|
20
|
-
isLibraryVisual: t,
|
|
21
|
-
currentVisualName: s,
|
|
22
|
-
isSaving: r = !1,
|
|
23
|
-
onConfirm: u
|
|
24
|
-
}) {
|
|
25
|
-
const [i, d] = D(
|
|
26
|
-
t && s ? `Copy of ${s}` : s || ""
|
|
27
|
-
), [c, v] = D(""), [b, C] = D(!t), [f, x] = D(!0);
|
|
28
|
-
we.useEffect(() => {
|
|
29
|
-
l && (d(
|
|
30
|
-
t && s ? `Copy of ${s}` : s || ""
|
|
31
|
-
), v(""), C(!t), x(!0));
|
|
32
|
-
}, [l, t, s]);
|
|
33
|
-
const S = () => {
|
|
34
|
-
i.trim() && (!b && !f || u({
|
|
35
|
-
name: i.trim(),
|
|
36
|
-
description: c.trim() || void 0,
|
|
37
|
-
saveToLibrary: b,
|
|
38
|
-
saveToCurrentDashboard: f
|
|
39
|
-
}));
|
|
40
|
-
}, A = i.trim() && (b || f);
|
|
41
|
-
return /* @__PURE__ */ e($, { open: l, onOpenChange: n, children: /* @__PURE__ */ a(q, { className: "sm:max-w-[425px]", children: [
|
|
42
|
-
/* @__PURE__ */ a(K, { children: [
|
|
43
|
-
/* @__PURE__ */ e(X, { children: "Save Visual As" }),
|
|
44
|
-
/* @__PURE__ */ e(Y, { 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(T, { htmlFor: "name", children: "Name" }),
|
|
49
|
-
/* @__PURE__ */ e(
|
|
50
|
-
G,
|
|
51
|
-
{
|
|
52
|
-
id: "name",
|
|
53
|
-
value: i,
|
|
54
|
-
onChange: (m) => d(m.target.value),
|
|
55
|
-
placeholder: "Enter visual name",
|
|
56
|
-
disabled: r
|
|
57
|
-
}
|
|
58
|
-
)
|
|
59
|
-
] }),
|
|
60
|
-
/* @__PURE__ */ a("div", { className: "grid gap-2", children: [
|
|
61
|
-
/* @__PURE__ */ e(T, { htmlFor: "description", children: "Description (optional)" }),
|
|
62
|
-
/* @__PURE__ */ e(
|
|
63
|
-
J,
|
|
64
|
-
{
|
|
65
|
-
id: "description",
|
|
66
|
-
value: c,
|
|
67
|
-
onChange: (m) => v(m.target.value),
|
|
68
|
-
placeholder: "Enter visual description",
|
|
69
|
-
rows: 3,
|
|
70
|
-
disabled: r
|
|
71
|
-
}
|
|
72
|
-
)
|
|
73
|
-
] }),
|
|
74
|
-
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
75
|
-
/* @__PURE__ */ e(T, { 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
|
-
E,
|
|
80
|
-
{
|
|
81
|
-
id: "save-to-dashboard",
|
|
82
|
-
checked: f,
|
|
83
|
-
onCheckedChange: (m) => x(!!m),
|
|
84
|
-
disabled: r
|
|
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
|
-
E,
|
|
102
|
-
{
|
|
103
|
-
id: "save-to-library",
|
|
104
|
-
checked: b,
|
|
105
|
-
onCheckedChange: (m) => C(!!m),
|
|
106
|
-
disabled: r
|
|
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 && !f && /* @__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
|
-
I,
|
|
128
|
-
{
|
|
129
|
-
variant: "outline",
|
|
130
|
-
onClick: () => n(!1),
|
|
131
|
-
disabled: r,
|
|
132
|
-
children: "Cancel"
|
|
133
|
-
}
|
|
134
|
-
),
|
|
135
|
-
/* @__PURE__ */ a(I, { onClick: S, disabled: !A || r, children: [
|
|
136
|
-
r && /* @__PURE__ */ e(H, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
137
|
-
r ? "Saving..." : "Save"
|
|
138
|
-
] })
|
|
139
|
-
] })
|
|
140
|
-
] }) });
|
|
141
|
-
}
|
|
142
|
-
function Me() {
|
|
143
|
-
const [l, n] = D(!1), [t, s] = D(!1), [r, u] = D(null), i = k((o) => o.frame), d = k((o) => o.card), c = Z(), v = g((o) => o.selectedSheetId), b = g(
|
|
144
|
-
(o) => o.actions.setIsDashboardPanelOpen
|
|
145
|
-
), { getUpdatedFrame: C } = W(), { selectVisual: f } = ee(), { addFrame: x, setSelectedFrameId: S, setIsVisualEditing: A } = R(), m = !!(i != null && i.visualId), V = (() => {
|
|
146
|
-
var o, p;
|
|
147
|
-
return ((o = i == null ? void 0 : i.cards) == null ? void 0 : o.length) === 1 && ((p = i.cards[0]) != null && p.title) ? i.cards[0].title : c != null && c.title ? c.title : (d == null ? void 0 : d.title) || "Untitled Visual";
|
|
148
|
-
})(), h = ae((o) => {
|
|
149
|
-
if (o != null && o.id) {
|
|
150
|
-
if (f(o), t && r && v) {
|
|
151
|
-
const p = {
|
|
152
|
-
...r,
|
|
153
|
-
id: O(),
|
|
154
|
-
visualId: o.id
|
|
155
|
-
// Link to the newly created library visual
|
|
156
|
-
};
|
|
157
|
-
x(v, p, "end"), S(p.id), s(!1), u(null), A(!1);
|
|
158
|
-
}
|
|
159
|
-
b(!0), n(!1);
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
return {
|
|
163
|
-
saveAsDialogOpen: l,
|
|
164
|
-
setSaveAsDialogOpen: n,
|
|
165
|
-
handleSaveAs: async (o) => {
|
|
166
|
-
if (!v) {
|
|
167
|
-
y.error("No sheet selected");
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
const p = C(), M = p.cards.length === 1 ? {
|
|
171
|
-
...p,
|
|
172
|
-
cards: p.cards.map((N) => ({
|
|
173
|
-
...N,
|
|
174
|
-
title: o.name
|
|
175
|
-
// Use visual name as card title
|
|
176
|
-
}))
|
|
177
|
-
} : p;
|
|
178
|
-
if (o.saveToLibrary) {
|
|
179
|
-
s(o.saveToCurrentDashboard), u(M);
|
|
180
|
-
const N = {
|
|
181
|
-
title: o.name,
|
|
182
|
-
description: o.description,
|
|
183
|
-
frameObject: M,
|
|
184
|
-
// Card title synced for single-card frames
|
|
185
|
-
isPrivate: !1
|
|
186
|
-
};
|
|
187
|
-
h.mutate(N);
|
|
188
|
-
} else if (o.saveToCurrentDashboard) {
|
|
189
|
-
const N = {
|
|
190
|
-
...M,
|
|
191
|
-
// Card title already synced
|
|
192
|
-
id: O(),
|
|
193
|
-
visualId: void 0
|
|
194
|
-
// Explicitly no visualId for local visuals
|
|
195
|
-
};
|
|
196
|
-
x(v, N, "end"), S(N.id), y.success("Visual saved to dashboard"), n(!1), A(!1);
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
isLibraryVisual: m,
|
|
200
|
-
currentVisualName: V,
|
|
201
|
-
isSaving: h.isPending
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
function ze({
|
|
205
|
-
className: l
|
|
206
|
-
}) {
|
|
207
|
-
const n = k((h) => h.frame), t = k((h) => h.card), s = se((h) => h.selectedVisual), r = g((h) => h.selectedFrameId), u = g((h) => h.selectedSheetId), { setIsVisualEditing: i } = R(), d = !!(n != null && n.visualId || s != null && s.id), c = !!(n != null && n.visualId && r), v = d && !c, {
|
|
208
|
-
saveAsDialogOpen: b,
|
|
209
|
-
setSaveAsDialogOpen: C,
|
|
210
|
-
handleSaveAs: f,
|
|
211
|
-
isLibraryVisual: x,
|
|
212
|
-
currentVisualName: S,
|
|
213
|
-
isSaving: A
|
|
214
|
-
} = Me(), { handleAddLibraryVisual: m } = W(), V = async () => {
|
|
215
|
-
if (!u) {
|
|
216
|
-
y.error("No dashboard sheet selected");
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
if (!s) {
|
|
220
|
-
y.error("No visual selected");
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
const h = await m(s);
|
|
224
|
-
h.success ? (y.success("Visual added to dashboard"), i(!1)) : y.error(h.error || "Failed to add visual to dashboard");
|
|
225
|
-
};
|
|
226
|
-
return /* @__PURE__ */ a(F, { children: [
|
|
227
|
-
!d && /* @__PURE__ */ e(xe, { className: l, variant: "default" }),
|
|
228
|
-
d && /* @__PURE__ */ a(F, { children: [
|
|
229
|
-
c && /* @__PURE__ */ e(Ae, { className: l }),
|
|
230
|
-
v && u && t && (t.sql || te(t.config)) && /* @__PURE__ */ a(
|
|
231
|
-
I,
|
|
232
|
-
{
|
|
233
|
-
onClick: V,
|
|
234
|
-
className: w(l),
|
|
235
|
-
size: "sm",
|
|
236
|
-
variant: "outline",
|
|
237
|
-
children: [
|
|
238
|
-
/* @__PURE__ */ e(Fe, { className: "mr-2 size-4 font-bold" }),
|
|
239
|
-
"Add to Dashboard"
|
|
240
|
-
]
|
|
241
|
-
}
|
|
242
|
-
),
|
|
243
|
-
v && /* @__PURE__ */ e(Se, { className: l, variant: "default" }),
|
|
244
|
-
c && /* @__PURE__ */ e(Ne, { className: l }),
|
|
245
|
-
/* @__PURE__ */ a(B, { modal: !1, children: [
|
|
246
|
-
/* @__PURE__ */ e(P, { asChild: !0, children: /* @__PURE__ */ e(
|
|
247
|
-
I,
|
|
248
|
-
{
|
|
249
|
-
variant: "outline",
|
|
250
|
-
size: "sm",
|
|
251
|
-
className: w(l, "w-8 p-0"),
|
|
252
|
-
children: /* @__PURE__ */ e(L, { className: "h-4 w-4" })
|
|
253
|
-
}
|
|
254
|
-
) }),
|
|
255
|
-
/* @__PURE__ */ e(U, { align: "end", children: /* @__PURE__ */ a(
|
|
256
|
-
z,
|
|
257
|
-
{
|
|
258
|
-
onClick: (h) => {
|
|
259
|
-
h.stopPropagation(), C(!0);
|
|
260
|
-
},
|
|
261
|
-
children: [
|
|
262
|
-
/* @__PURE__ */ e(j, { className: "mr-2 h-4 w-4" }),
|
|
263
|
-
"Save As..."
|
|
264
|
-
]
|
|
265
|
-
}
|
|
266
|
-
) })
|
|
267
|
-
] })
|
|
268
|
-
] }),
|
|
269
|
-
!d && /* @__PURE__ */ a(B, { modal: !1, children: [
|
|
270
|
-
/* @__PURE__ */ e(P, { asChild: !0, children: /* @__PURE__ */ e(
|
|
271
|
-
I,
|
|
272
|
-
{
|
|
273
|
-
variant: "outline",
|
|
274
|
-
size: "sm",
|
|
275
|
-
className: w(l, "w-8 p-0"),
|
|
276
|
-
children: /* @__PURE__ */ e(L, { className: "h-4 w-4" })
|
|
277
|
-
}
|
|
278
|
-
) }),
|
|
279
|
-
/* @__PURE__ */ e(U, { align: "end", children: /* @__PURE__ */ a(z, { onClick: () => C(!0), children: [
|
|
280
|
-
/* @__PURE__ */ e(j, { className: "mr-2 h-4 w-4" }),
|
|
281
|
-
"Save As..."
|
|
282
|
-
] }) })
|
|
283
|
-
] }),
|
|
284
|
-
/* @__PURE__ */ e(ye, { className: l }),
|
|
285
|
-
/* @__PURE__ */ e(
|
|
286
|
-
Ve,
|
|
287
|
-
{
|
|
288
|
-
open: b,
|
|
289
|
-
onOpenChange: (h) => {
|
|
290
|
-
A || C(h);
|
|
291
|
-
},
|
|
292
|
-
isLibraryVisual: x,
|
|
293
|
-
currentVisualName: S,
|
|
294
|
-
isSaving: A,
|
|
295
|
-
onConfirm: f
|
|
296
|
-
}
|
|
297
|
-
)
|
|
298
|
-
] });
|
|
299
|
-
}
|
|
300
|
-
function je({
|
|
301
|
-
className: l,
|
|
302
|
-
//labelClassName,
|
|
303
|
-
switchClassName: n
|
|
304
|
-
}) {
|
|
305
|
-
const t = k((d) => d.isDevMode), s = g((d) => d.isVisualEditing), { setIsDevMode: r } = de(), { config: u } = Ie(le).tokenProps, i = (u == null ? void 0 : u.showAdvancedMode) !== !1;
|
|
306
|
-
return !s || !i ? null : /* @__PURE__ */ a("div", { className: w("flex items-center space-x-2", l), children: [
|
|
307
|
-
/* @__PURE__ */ e(
|
|
308
|
-
ne,
|
|
309
|
-
{
|
|
310
|
-
className: w("", n),
|
|
311
|
-
checked: t,
|
|
312
|
-
onCheckedChange: () => r(!t),
|
|
313
|
-
id: "advanced-mode",
|
|
314
|
-
icon: /* @__PURE__ */ e(re, { className: "h-4 w-4" }),
|
|
315
|
-
tooltip: "Advanced Mode"
|
|
316
|
-
}
|
|
317
|
-
),
|
|
318
|
-
/* @__PURE__ */ e("label", { htmlFor: "advanced-mode", className: "sr-only", children: "Advanced Mode" })
|
|
319
|
-
] });
|
|
320
|
-
}
|
|
321
|
-
function He({
|
|
322
|
-
open: l,
|
|
323
|
-
onOpenChange: n,
|
|
324
|
-
onSave: t,
|
|
325
|
-
onDiscard: s,
|
|
326
|
-
isSaving: r
|
|
327
|
-
}) {
|
|
328
|
-
return /* @__PURE__ */ e(oe, { open: l, onOpenChange: (i) => {
|
|
329
|
-
!i && r || n(i);
|
|
330
|
-
}, children: /* @__PURE__ */ a(ie, { className: "max-w-md", children: [
|
|
331
|
-
/* @__PURE__ */ a(ce, { 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(he, { className: "h-5 w-5 text-amber-600" }) }),
|
|
334
|
-
/* @__PURE__ */ e(ue, { className: "text-xl", children: "Unsaved Changes" })
|
|
335
|
-
] }),
|
|
336
|
-
/* @__PURE__ */ e(me, { 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(ve, { className: "flex-col gap-2 sm:flex-row sm:gap-2", children: [
|
|
339
|
-
/* @__PURE__ */ e(
|
|
340
|
-
pe,
|
|
341
|
-
{
|
|
342
|
-
disabled: r,
|
|
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: s,
|
|
351
|
-
disabled: r,
|
|
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
|
-
be,
|
|
358
|
-
{
|
|
359
|
-
onClick: t,
|
|
360
|
-
disabled: r,
|
|
361
|
-
className: "order-3 m-0 bg-primary text-primary-foreground hover:bg-primary/90 sm:order-3",
|
|
362
|
-
children: r ? /* @__PURE__ */ a(F, { children: [
|
|
363
|
-
/* @__PURE__ */ e(H, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
364
|
-
"Saving..."
|
|
365
|
-
] }) : "Save & Close"
|
|
366
|
-
}
|
|
367
|
-
)
|
|
368
|
-
] })
|
|
369
|
-
] }) });
|
|
370
|
-
}
|
|
371
|
-
function Re(l, n, t, s) {
|
|
372
|
-
ke(() => {
|
|
373
|
-
l && !t && n && s(fe(n));
|
|
374
|
-
}, [l, t, n, s]);
|
|
375
|
-
}
|
|
376
|
-
function We({
|
|
377
|
-
triggerButtonClassName: l
|
|
378
|
-
}) {
|
|
379
|
-
const [n, t] = D(!1), s = g((d) => {
|
|
380
|
-
var c;
|
|
381
|
-
return (c = d.dashboard) == null ? void 0 : c.id;
|
|
382
|
-
}), r = g((d) => {
|
|
383
|
-
var c;
|
|
384
|
-
return (c = d.dashboard) == null ? void 0 : c.title;
|
|
385
|
-
}), u = g((d) => {
|
|
386
|
-
var c;
|
|
387
|
-
return (c = d.dashboard) == null ? void 0 : c.sheets;
|
|
388
|
-
}), i = g((d) => d.selectedSheetId);
|
|
389
|
-
return u == null || u.find((d) => d.id === i), s ? /* @__PURE__ */ a(F, { children: [
|
|
390
|
-
/* @__PURE__ */ e(
|
|
391
|
-
ge,
|
|
392
|
-
{
|
|
393
|
-
tooltip: "Schedule Dashboard",
|
|
394
|
-
className: w("h-7 p-2", l),
|
|
395
|
-
onClick: () => t(!0),
|
|
396
|
-
children: /* @__PURE__ */ e(Ce, { className: "size-4" })
|
|
397
|
-
}
|
|
398
|
-
),
|
|
399
|
-
/* @__PURE__ */ e(
|
|
400
|
-
De,
|
|
401
|
-
{
|
|
402
|
-
open: n,
|
|
403
|
-
onOpenChange: t,
|
|
404
|
-
dashboardId: s,
|
|
405
|
-
dashboardName: r
|
|
406
|
-
}
|
|
407
|
-
)
|
|
408
|
-
] }) : null;
|
|
409
|
-
}
|
|
410
|
-
export {
|
|
411
|
-
je as A,
|
|
412
|
-
We as S,
|
|
413
|
-
He as U,
|
|
414
|
-
ze as V,
|
|
415
|
-
Re as u
|
|
416
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";const s=require("react/jsx-runtime"),e=require("./index-CFWw2cJ5.js"),C=require("./editor-action-buttons-DseT424l.js"),x=require("react"),y=require("./use-visual-utils-D19qzwzI.js");/**
|
|
2
|
-
* @license lucide-react v0.453.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const I=e.createLucideIcon("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);function k({open:r,onOpenChange:d,isLibraryVisual:t,currentVisualName:a,isSaving:o=!1,onConfirm:h}){const[i,n]=x.useState(t&&a?`Copy of ${a}`:a||""),[c,v]=x.useState(""),[b,j]=x.useState(!t),[g,f]=x.useState(!0);x.useEffect(()=>{r&&(n(t&&a?`Copy of ${a}`:a||""),v(""),j(!t),f(!0))},[r,t,a]);const S=()=>{i.trim()&&(!b&&!g||h({name:i.trim(),description:c.trim()||void 0,saveToLibrary:b,saveToCurrentDashboard:g}))},D=i.trim()&&(b||g);return s.jsx(e.Dialog,{open:r,onOpenChange:d,children:s.jsxs(e.DialogContent,{className:"sm:max-w-[425px]",children:[s.jsxs(e.DialogHeader,{children:[s.jsx(e.DialogTitle,{children:"Save Visual As"}),s.jsx(e.DialogDescription,{children:t?"Create a copy of this visual with a new name":"Save this visual to make it reusable"})]}),s.jsxs("div",{className:"grid gap-4 py-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(e.Label,{htmlFor:"name",children:"Name"}),s.jsx(e.Input,{id:"name",value:i,onChange:m=>n(m.target.value),placeholder:"Enter visual name",disabled:o})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(e.Label,{htmlFor:"description",children:"Description (optional)"}),s.jsx(e.Textarea,{id:"description",value:c,onChange:m=>v(m.target.value),placeholder:"Enter visual description",rows:3,disabled:o})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx(e.Label,{children:"Save to:"}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(e.Checkbox,{id:"save-to-dashboard",checked:g,onCheckedChange:m=>f(!!m),disabled:o}),s.jsxs("label",{htmlFor:"save-to-dashboard",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:["Current Dashboard",s.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:t?"(add copy to this dashboard)":"(keep as local visual)"})]})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(e.Checkbox,{id:"save-to-library",checked:b,onCheckedChange:m=>j(!!m),disabled:o}),s.jsxs("label",{htmlFor:"save-to-library",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:["Visual Library",s.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:t?"(save as new reusable visual)":"(make available to all dashboards)"})]})]})]}),!b&&!g&&s.jsx("p",{className:"text-sm text-destructive",children:"Please select at least one destination"})]})]}),s.jsxs(e.DialogFooter,{children:[s.jsx(e.Button,{variant:"outline",onClick:()=>d(!1),disabled:o,children:"Cancel"}),s.jsxs(e.Button,{onClick:S,disabled:!D||o,children:[o&&s.jsx(e.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),o?"Saving...":"Save"]})]})]})})}function F(){const[r,d]=x.useState(!1),[t,a]=x.useState(!1),[o,h]=x.useState(null),i=e.useEditorStore(l=>l.frame),n=e.useEditorStore(l=>l.card),c=e.useSelectedVisual(),v=e.useDashboardStore(l=>l.selectedSheetId),b=e.useDashboardStore(l=>l.actions.setIsDashboardPanelOpen),{getUpdatedFrame:j}=y.useVisualUtils(),{selectVisual:g}=e.useManagementActions(),{addFrame:f,setSelectedFrameId:S,setIsVisualEditing:D}=e.useDashboardActions(),m=!!(i!=null&&i.visualId),w=(()=>{var l,p;return((l=i==null?void 0:i.cards)==null?void 0:l.length)===1&&((p=i.cards[0])!=null&&p.title)?i.cards[0].title:c!=null&&c.title?c.title:(n==null?void 0:n.title)||"Untitled Visual"})(),u=e.useCreateVisualWithFrame(l=>{if(l!=null&&l.id){if(g(l),t&&o&&v){const p={...o,id:e.v4(),visualId:l.id};f(v,p,"end"),S(p.id),a(!1),h(null),D(!1)}b(!0),d(!1)}});return{saveAsDialogOpen:r,setSaveAsDialogOpen:d,handleSaveAs:async l=>{if(!v){e.ue.error("No sheet selected");return}const p=j(),N=p.cards.length===1?{...p,cards:p.cards.map(A=>({...A,title:l.name}))}:p;if(l.saveToLibrary){a(l.saveToCurrentDashboard),h(N);const A={title:l.name,description:l.description,frameObject:N,isPrivate:!1};u.mutate(A)}else if(l.saveToCurrentDashboard){const A={...N,id:e.v4(),visualId:void 0};f(v,A,"end"),S(A.id),e.ue.success("Visual saved to dashboard"),d(!1),D(!1)}},isLibraryVisual:m,currentVisualName:w,isSaving:u.isPending}}function M({className:r}){const d=e.useEditorStore(u=>u.frame),t=e.useEditorStore(u=>u.card),a=e.useManagementStore(u=>u.selectedVisual),o=e.useDashboardStore(u=>u.selectedFrameId),h=e.useDashboardStore(u=>u.selectedSheetId),{setIsVisualEditing:i}=e.useDashboardActions(),n=!!(d!=null&&d.visualId||a!=null&&a.id),c=!!(d!=null&&d.visualId&&o),v=n&&!c,{saveAsDialogOpen:b,setSaveAsDialogOpen:j,handleSaveAs:g,isLibraryVisual:f,currentVisualName:S,isSaving:D}=F(),{handleAddLibraryVisual:m}=y.useVisualUtils(),w=async()=>{if(!h){e.ue.error("No dashboard sheet selected");return}if(!a){e.ue.error("No visual selected");return}const u=await m(a);u.success?(e.ue.success("Visual added to dashboard"),i(!1)):e.ue.error(u.error||"Failed to add visual to dashboard")};return s.jsxs(s.Fragment,{children:[!n&&s.jsx(C.EditorAcceptButton,{className:r,variant:"default"}),n&&s.jsxs(s.Fragment,{children:[c&&s.jsx(C.VisualApplyLocalButton,{className:r}),v&&h&&t&&(t.sql||e.hasValidCardConfig(t.config))&&s.jsxs(e.Button,{onClick:w,className:e.cn(r),size:"sm",variant:"outline",children:[s.jsx(I,{className:"mr-2 size-4 font-bold"}),"Add to Dashboard"]}),v&&s.jsx(C.VisualSaveButton,{className:r,variant:"default"}),c&&s.jsx(C.VisualSaveAndApplyButton,{className:r}),s.jsxs(e.DropdownMenu,{modal:!1,children:[s.jsx(e.DropdownMenuTrigger,{asChild:!0,children:s.jsx(e.Button,{variant:"outline",size:"sm",className:e.cn(r,"w-8 p-0"),children:s.jsx(e.EllipsisVertical,{className:"h-4 w-4"})})}),s.jsx(e.DropdownMenuContent,{align:"end",children:s.jsxs(e.DropdownMenuItem,{onClick:u=>{u.stopPropagation(),j(!0)},children:[s.jsx(C.Save,{className:"mr-2 h-4 w-4"}),"Save As..."]})})]})]}),!n&&s.jsxs(e.DropdownMenu,{modal:!1,children:[s.jsx(e.DropdownMenuTrigger,{asChild:!0,children:s.jsx(e.Button,{variant:"outline",size:"sm",className:e.cn(r,"w-8 p-0"),children:s.jsx(e.EllipsisVertical,{className:"h-4 w-4"})})}),s.jsx(e.DropdownMenuContent,{align:"end",children:s.jsxs(e.DropdownMenuItem,{onClick:()=>j(!0),children:[s.jsx(C.Save,{className:"mr-2 h-4 w-4"}),"Save As..."]})})]}),s.jsx(C.EditorCancelButton,{className:r}),s.jsx(k,{open:b,onOpenChange:u=>{D||j(u)},isLibraryVisual:f,currentVisualName:S,isSaving:D,onConfirm:g})]})}function V({className:r,switchClassName:d}){const t=e.useEditorStore(n=>n.isDevMode),a=e.useDashboardStore(n=>n.isVisualEditing),{setIsDevMode:o}=e.useEditorActions(),{config:h}=x.useContext(e.SemaphorContext).tokenProps,i=(h==null?void 0:h.showAdvancedMode)!==!1;return!a||!i?null:s.jsxs("div",{className:e.cn("flex items-center space-x-2",r),children:[s.jsx(e.DevModeSwitch,{className:e.cn("",d),checked:t,onCheckedChange:()=>o(!t),id:"advanced-mode",icon:s.jsx(e.CodeXml,{className:"h-4 w-4"}),tooltip:"Advanced Mode"}),s.jsx("label",{htmlFor:"advanced-mode",className:"sr-only",children:"Advanced Mode"})]})}function E({open:r,onOpenChange:d,onSave:t,onDiscard:a,isSaving:o}){const h=i=>{!i&&o||d(i)};return s.jsx(e.AlertDialog,{open:r,onOpenChange:h,children:s.jsxs(e.AlertDialogContent,{className:"max-w-md",children:[s.jsxs(e.AlertDialogHeader,{children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-amber-100",children:s.jsx(e.TriangleAlert,{className:"h-5 w-5 text-amber-600"})}),s.jsx(e.AlertDialogTitle,{className:"text-xl",children:"Unsaved Changes"})]}),s.jsx(e.AlertDialogDescription,{className:"pt-2 text-base leading-relaxed",children:"You have unsaved changes to this dashboard. What would you like to do?"})]}),s.jsxs(e.AlertDialogFooter,{className:"flex-col gap-2 sm:flex-row sm:gap-2",children:[s.jsx(e.AlertDialogCancel,{disabled:o,className:"order-1 m-0 border-border/50 sm:order-1",children:"Cancel"}),s.jsx("button",{onClick:a,disabled:o,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",children:"Discard"}),s.jsx(e.AlertDialogAction,{onClick:t,disabled:o,className:"order-3 m-0 bg-primary text-primary-foreground hover:bg-primary/90 sm:order-3",children:o?s.jsxs(s.Fragment,{children:[s.jsx(e.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save & Close"})]})]})})}function T(r,d,t,a){x.useEffect(()=>{r&&!t&&d&&a(e.cloneDeep(d))},[r,t,d,a])}function B({triggerButtonClassName:r}){const[d,t]=x.useState(!1),a=e.useDashboardStore(n=>{var c;return(c=n.dashboard)==null?void 0:c.id}),o=e.useDashboardStore(n=>{var c;return(c=n.dashboard)==null?void 0:c.title}),h=e.useDashboardStore(n=>{var c;return(c=n.dashboard)==null?void 0:c.sheets}),i=e.useDashboardStore(n=>n.selectedSheetId);return h==null||h.find(n=>n.id===i),a?s.jsxs(s.Fragment,{children:[s.jsx(e.IconButton,{tooltip:"Schedule Dashboard",className:e.cn("h-7 p-2",r),onClick:()=>t(!0),children:s.jsx(e.Clock,{className:"size-4"})}),s.jsx(e.EmailScheduleDialog,{open:d,onOpenChange:t,dashboardId:a,dashboardName:o})]}):null}exports.AdvancedModeToggle=V;exports.ScheduleDashboard=B;exports.UnsavedChangesAlert=E;exports.VisualEditingControls=M;exports.usePristineSnapshotInitializer=T;
|