react-semaphor 0.1.375 → 0.1.377
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/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +47 -43
- package/dist/brand-studio/index.cjs +4 -9
- package/dist/brand-studio/index.js +98 -108
- package/dist/chunks/{braces-C3-w6xDL.js → braces-C2uBgj3t.js} +1 -1
- package/dist/chunks/{braces-C8QqW4wu.js → braces-CkXyWzRh.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-DXgi7q5u.js → calendar-preferences-dialog-C55VOTIy.js} +6 -5
- package/dist/chunks/calendar-preferences-dialog-DAukJOaP.js +1 -0
- package/dist/chunks/catalog-field-grounding-BGW0hnB9.js +1 -0
- package/dist/chunks/catalog-field-grounding-DHXEI7cW.js +199 -0
- package/dist/chunks/{chevrons-up-down-DSvLu4Ye.js → chevrons-up-down-BnzChFLU.js} +1 -1
- package/dist/chunks/{chevrons-up-down-CnCSGY02.js → chevrons-up-down-W0nzHzx0.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-Jwbmrcl_.js → dashboard-briefing-launcher-CUyeiL_T.js} +3141 -2372
- package/dist/chunks/dashboard-briefing-launcher-DMKfG_z3.js +111 -0
- package/dist/chunks/dashboard-controls-B4hxFc3Q.js +2279 -0
- package/dist/chunks/dashboard-controls-D4vI0wvU.js +52 -0
- package/dist/chunks/dashboard-json-DQnm6daE.js +1 -0
- package/dist/chunks/{dashboard-json-Cl1O3uh0.js → dashboard-json-pl1_mFqJ.js} +14 -13
- package/dist/chunks/{edit-dashboard-visual-B_0sbc43.js → edit-dashboard-visual-CF4aSsav.js} +4729 -4645
- package/dist/chunks/edit-dashboard-visual-CjTXY51a.js +178 -0
- package/dist/chunks/{index-BIks0ktd.js → index-B2kPleRS.js} +186 -181
- package/dist/chunks/{index-BSkBy5cH.js → index-Bn866BBY.js} +22824 -22664
- package/dist/chunks/layout-grid-BFmJ7vmH.js +16 -0
- package/dist/chunks/layout-grid-CTOW9oTg.js +6 -0
- package/dist/chunks/{palette-DUGktM-M.js → palette-DrhPeer-.js} +1 -1
- package/dist/chunks/{palette-D-f4-82S.js → palette-OFaniMPn.js} +1 -1
- package/dist/chunks/{save-D3YYinDz.js → save-BxWBiQv1.js} +1 -1
- package/dist/chunks/{save-kkBEBeLg.js → save-Dh6gSC4x.js} +1 -1
- package/dist/chunks/{switch-Dkx2qEOr.js → switch-C-fGjxjY.js} +2002 -1983
- package/dist/chunks/switch-D5xopzFD.js +168 -0
- package/dist/chunks/use-create-flow-overlay-state-Dg2ffpCE.js +21 -0
- package/dist/chunks/use-create-flow-overlay-state-DrKP0jWE.js +1968 -0
- package/dist/chunks/{validation-1V7bWmYw.js → validation-BHFaWDU-.js} +1 -1
- package/dist/chunks/{validation-DlrTIf1N.js → validation-bMedDBOo.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +1 -1
- package/dist/dashboard-authoring/index.js +1 -1
- package/dist/data-app-builder/index.cjs +18 -13
- package/dist/data-app-builder/index.js +141 -131
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +22 -21
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +151 -151
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +84 -0
- package/dist/types/main.d.ts +8 -12
- package/package.json +1 -1
- package/dist/chunks/calendar-preferences-dialog-CsRzDpDs.js +0 -1
- package/dist/chunks/catalog-field-grounding-DoEBOXQd.js +0 -100
- package/dist/chunks/catalog-field-grounding-Du6mKDcF.js +0 -1
- package/dist/chunks/dashboard-briefing-launcher-C-G6vQTL.js +0 -106
- package/dist/chunks/dashboard-controls-DzGGNQxv.js +0 -2269
- package/dist/chunks/dashboard-controls-p7VKzWSb.js +0 -57
- package/dist/chunks/dashboard-json-CvPhMpbM.js +0 -1
- package/dist/chunks/edit-dashboard-visual-CSrdS10O.js +0 -178
- package/dist/chunks/resource-management-panel-IHbUOh2g.js +0 -6
- package/dist/chunks/resource-management-panel-tFjbtgPw.js +0 -1018
- package/dist/chunks/switch-fIkmwzUt.js +0 -168
- package/dist/chunks/use-create-flow-overlay-state-D-yGZTR3.js +0 -1647
- package/dist/chunks/use-create-flow-overlay-state-DbaUD5xc.js +0 -26
- package/dist/chunks/use-visual-utils-B5hwU_av.js +0 -1
- package/dist/chunks/use-visual-utils-Dj82r7DA.js +0 -340
|
@@ -1,1647 +0,0 @@
|
|
|
1
|
-
import { c as te, G as L, H as ne, u as oe, Y as ft, Z as ht, _ as bt, a as ie, a0 as gt, a8 as yt, B as V, e as xt, X as He, E as Ye, f as Ke, a9 as vt, aa as Ct, ab as se, ac as Ae, ad as ze, ae as ge, af as ye, ag as kt, ah as Me, ai as Nt, aj as St, ak as le, al as Dt, am as Oe, g as Be, an as Ge, ao as Xe, ap as Ze, L as Y, a1 as Je, a2 as xe, a3 as ve, a4 as Ce, a5 as ke, a6 as Ne, aq as We, ar as wt, as as It, at as Re, au as Tt, av as Qe, aw as Et, ax as Se } from "./switch-Dkx2qEOr.js";
|
|
2
|
-
import { useEffect as de, useMemo as z, useState as Q, useRef as De, useCallback as O, Fragment as Vt } from "react";
|
|
3
|
-
import { aL as _t, aM as et, aN as qt, aO as Ft, aP as Lt, aQ as At, aR as zt, x as Mt, aS as Ot, ae as ue, aT as tt, ag as at, aU as rt, aV as Bt, o as R, aW as Rt, aX as Qt, aG as je, aY as jt, aZ as Ut, a_ as st, a$ as lt, b0 as Pt, b1 as $t, b2 as Ht, b3 as Yt, b4 as Kt, ay as Gt, b5 as Xt, b6 as Zt } from "./index-BSkBy5cH.js";
|
|
4
|
-
import { jsx as t, jsxs as d, Fragment as $ } from "react/jsx-runtime";
|
|
5
|
-
import "./index-CuHybtft.js";
|
|
6
|
-
import { u as we } from "./use-visual-utils-Dj82r7DA.js";
|
|
7
|
-
import { S as nt } from "./save-kkBEBeLg.js";
|
|
8
|
-
/**
|
|
9
|
-
* @license lucide-react v0.453.0 - ISC
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the ISC license.
|
|
12
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
13
|
-
*/
|
|
14
|
-
const pa = te("CircleX", [
|
|
15
|
-
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
16
|
-
["path", { d: "m15 9-6 6", key: "1uzhvr" }],
|
|
17
|
-
["path", { d: "m9 9 6 6", key: "z0biqf" }]
|
|
18
|
-
]);
|
|
19
|
-
/**
|
|
20
|
-
* @license lucide-react v0.453.0 - ISC
|
|
21
|
-
*
|
|
22
|
-
* This source code is licensed under the ISC license.
|
|
23
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
24
|
-
*/
|
|
25
|
-
const Jt = te("Library", [
|
|
26
|
-
["path", { d: "m16 6 4 14", key: "ji33uf" }],
|
|
27
|
-
["path", { d: "M12 6v14", key: "1n7gus" }],
|
|
28
|
-
["path", { d: "M8 8v12", key: "1gg7y9" }],
|
|
29
|
-
["path", { d: "M4 4v16", key: "6qkkli" }]
|
|
30
|
-
]);
|
|
31
|
-
/**
|
|
32
|
-
* @license lucide-react v0.453.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/
|
|
37
|
-
const Wt = te("Link2", [
|
|
38
|
-
["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
|
|
39
|
-
["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
|
|
40
|
-
["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
|
|
41
|
-
]);
|
|
42
|
-
/**
|
|
43
|
-
* @license lucide-react v0.453.0 - ISC
|
|
44
|
-
*
|
|
45
|
-
* This source code is licensed under the ISC license.
|
|
46
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
47
|
-
*/
|
|
48
|
-
const ma = te("Rows3", [
|
|
49
|
-
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
50
|
-
["path", { d: "M21 9H3", key: "1338ky" }],
|
|
51
|
-
["path", { d: "M21 15H3", key: "9uk58r" }]
|
|
52
|
-
]);
|
|
53
|
-
/**
|
|
54
|
-
* @license lucide-react v0.453.0 - ISC
|
|
55
|
-
*
|
|
56
|
-
* This source code is licensed under the ISC license.
|
|
57
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
58
|
-
*/
|
|
59
|
-
const fa = te("SendHorizontal", [
|
|
60
|
-
[
|
|
61
|
-
"path",
|
|
62
|
-
{
|
|
63
|
-
d: "M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",
|
|
64
|
-
key: "117uat"
|
|
65
|
-
}
|
|
66
|
-
],
|
|
67
|
-
["path", { d: "M6 12h16", key: "s4cdu5" }]
|
|
68
|
-
]);
|
|
69
|
-
function ha() {
|
|
70
|
-
const s = L((h) => h.card.dataSource), {
|
|
71
|
-
setSelectedConnectionId: r,
|
|
72
|
-
setSelectedDatabaseName: o,
|
|
73
|
-
setSelectedSchemaName: i,
|
|
74
|
-
setSelectedTableName: p,
|
|
75
|
-
setSelectedDatamodelId: u
|
|
76
|
-
} = ne();
|
|
77
|
-
de(() => {
|
|
78
|
-
var S;
|
|
79
|
-
if (!s) return;
|
|
80
|
-
const { tableName: h, schemaName: y, databaseName: b, connectionId: v } = _t(s), g = (S = s.selectedEntities) == null ? void 0 : S[0], x = (g == null ? void 0 : g.type) === "model" && "id" in g ? g.id : "";
|
|
81
|
-
r(v || ""), o(b || ""), i(y || ""), p(h || ""), u(x);
|
|
82
|
-
}, [
|
|
83
|
-
s,
|
|
84
|
-
r,
|
|
85
|
-
o,
|
|
86
|
-
i,
|
|
87
|
-
p,
|
|
88
|
-
u
|
|
89
|
-
]);
|
|
90
|
-
}
|
|
91
|
-
function ot() {
|
|
92
|
-
var b, v;
|
|
93
|
-
const s = L((g) => g.card), r = L((g) => g.frame), o = z(
|
|
94
|
-
() => et(r, s),
|
|
95
|
-
[r, s]
|
|
96
|
-
), { manifest: i } = qt(
|
|
97
|
-
((b = o == null ? void 0 : o.customCardPreferences) == null ? void 0 : b.url) || ""
|
|
98
|
-
), p = z(
|
|
99
|
-
() => {
|
|
100
|
-
var g;
|
|
101
|
-
return (g = i == null ? void 0 : i.visuals) == null ? void 0 : g.find(
|
|
102
|
-
(m) => {
|
|
103
|
-
var x;
|
|
104
|
-
return m.name === ((x = o == null ? void 0 : o.customCardPreferences) == null ? void 0 : x.componentName);
|
|
105
|
-
}
|
|
106
|
-
);
|
|
107
|
-
},
|
|
108
|
-
[i, (v = o == null ? void 0 : o.customCardPreferences) == null ? void 0 : v.componentName]
|
|
109
|
-
), u = Ft(o, p), h = z(
|
|
110
|
-
() => Lt({
|
|
111
|
-
frame: r,
|
|
112
|
-
configCard: o,
|
|
113
|
-
isMultiInputVisual: u === "multiple"
|
|
114
|
-
}),
|
|
115
|
-
[r, o, u]
|
|
116
|
-
), y = z(() => {
|
|
117
|
-
const g = h.findIndex(
|
|
118
|
-
(m) => (m == null ? void 0 : m.id) === s.id
|
|
119
|
-
);
|
|
120
|
-
return g < 0 ? -1 : At(s, g);
|
|
121
|
-
}, [h, s]);
|
|
122
|
-
return z(() => !o || u !== "multiple" || y < 0 ? s.type : zt(
|
|
123
|
-
s,
|
|
124
|
-
y,
|
|
125
|
-
p == null ? void 0 : p.slots
|
|
126
|
-
) ?? s.type, [o, u, y, s, p == null ? void 0 : p.slots]);
|
|
127
|
-
}
|
|
128
|
-
function ba({
|
|
129
|
-
type: s,
|
|
130
|
-
isLinked: r,
|
|
131
|
-
className: o,
|
|
132
|
-
showLabel: i = !1,
|
|
133
|
-
showLocal: p = !1
|
|
134
|
-
}) {
|
|
135
|
-
const u = oe((D) => D.selectedFrameId), h = Mt((D) => D.selectedVisual), y = L((D) => D.frame);
|
|
136
|
-
let b;
|
|
137
|
-
if (s)
|
|
138
|
-
b = s;
|
|
139
|
-
else if (r !== void 0)
|
|
140
|
-
b = r ? "linked" : "library";
|
|
141
|
-
else if (!!!(y != null && y.visualId || h != null && h.id) && u)
|
|
142
|
-
b = "local";
|
|
143
|
-
else if (h && !u)
|
|
144
|
-
b = "library";
|
|
145
|
-
else if (y != null && y.visualId && u)
|
|
146
|
-
b = "linked";
|
|
147
|
-
else if (h != null && h.id && u)
|
|
148
|
-
b = "library";
|
|
149
|
-
else
|
|
150
|
-
return null;
|
|
151
|
-
if (b === "local" && !p)
|
|
152
|
-
return null;
|
|
153
|
-
const v = {
|
|
154
|
-
local: "border-slate-200/70 bg-slate-50/80 text-slate-700 shadow-sm hover:bg-slate-100/80 dark:border-slate-700 dark:bg-slate-900/70 dark:text-slate-200 dark:hover:bg-slate-800/80",
|
|
155
|
-
linked: "border-purple-200/70 bg-gradient-to-r from-purple-50/50 to-purple-100/30 text-purple-900 shadow-sm hover:from-purple-100/60 hover:to-purple-100/50 hover:shadow-md dark:border-purple-800/50 dark:from-purple-950/40 dark:to-purple-900/30 dark:text-purple-100 dark:hover:from-purple-950/60 dark:hover:to-purple-900/50",
|
|
156
|
-
library: "border-blue-200/70 bg-gradient-to-r from-blue-50/50 to-blue-100/30 text-blue-900 shadow-sm hover:from-blue-100/60 hover:to-blue-100/50 hover:shadow-md dark:border-blue-800/50 dark:from-blue-950/40 dark:to-blue-900/30 dark:text-blue-100 dark:hover:from-blue-950/60 dark:hover:to-blue-900/50"
|
|
157
|
-
}, g = {
|
|
158
|
-
local: "Local to this dashboard: Changes made here only affect this dashboard copy.",
|
|
159
|
-
linked: "Linked to library: Changes made here update the library visual and all linked instances.",
|
|
160
|
-
library: "Library visual: Share and reuse this visual across multiple dashboards."
|
|
161
|
-
}, m = {
|
|
162
|
-
local: "border-slate-200 bg-slate-50 text-slate-900 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100",
|
|
163
|
-
linked: "border-purple-200 bg-purple-50 text-purple-900 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-100",
|
|
164
|
-
library: "border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-100"
|
|
165
|
-
}, x = {
|
|
166
|
-
local: "fill-slate-50 dark:fill-slate-900",
|
|
167
|
-
linked: "fill-purple-50 dark:fill-purple-950",
|
|
168
|
-
library: "fill-blue-50 dark:fill-blue-950"
|
|
169
|
-
}, S = {
|
|
170
|
-
local: /* @__PURE__ */ t("span", { className: "h-2 w-2 rounded-full bg-current/70" }),
|
|
171
|
-
linked: /* @__PURE__ */ t(Wt, { className: "h-3.5 w-3.5" }),
|
|
172
|
-
library: /* @__PURE__ */ t(Jt, { className: "h-3.5 w-3.5" })
|
|
173
|
-
}, N = {
|
|
174
|
-
local: "Local",
|
|
175
|
-
linked: "Linked",
|
|
176
|
-
library: "Library"
|
|
177
|
-
};
|
|
178
|
-
return /* @__PURE__ */ t(ft, { children: /* @__PURE__ */ d(ht, { delayDuration: 300, children: [
|
|
179
|
-
/* @__PURE__ */ t(bt, { asChild: !0, children: /* @__PURE__ */ d(
|
|
180
|
-
Ot,
|
|
181
|
-
{
|
|
182
|
-
variant: "outline",
|
|
183
|
-
className: ie(
|
|
184
|
-
"cursor-help select-none transition-all",
|
|
185
|
-
v[b],
|
|
186
|
-
o
|
|
187
|
-
),
|
|
188
|
-
children: [
|
|
189
|
-
S[b],
|
|
190
|
-
i && /* @__PURE__ */ t("span", { className: "ml-1 text-xs font-medium leading-none", children: N[b] })
|
|
191
|
-
]
|
|
192
|
-
}
|
|
193
|
-
) }),
|
|
194
|
-
/* @__PURE__ */ d(
|
|
195
|
-
gt,
|
|
196
|
-
{
|
|
197
|
-
side: "bottom",
|
|
198
|
-
className: ie("max-w-xs", m[b]),
|
|
199
|
-
children: [
|
|
200
|
-
/* @__PURE__ */ t(yt, { className: x[b] }),
|
|
201
|
-
/* @__PURE__ */ t("p", { children: g[b] })
|
|
202
|
-
]
|
|
203
|
-
}
|
|
204
|
-
)
|
|
205
|
-
] }) });
|
|
206
|
-
}
|
|
207
|
-
function ea(s, r) {
|
|
208
|
-
return {
|
|
209
|
-
...s,
|
|
210
|
-
sql: "",
|
|
211
|
-
python: "",
|
|
212
|
-
config: void 0,
|
|
213
|
-
customCfg: "",
|
|
214
|
-
preferences: {},
|
|
215
|
-
interactionConfig: void 0,
|
|
216
|
-
linkedInteractionTargetOverrides: void 0,
|
|
217
|
-
dynamicCardPreferences: void 0,
|
|
218
|
-
customCardPreferences: r ? s.customCardPreferences : void 0,
|
|
219
|
-
visualizationMode: "builtin",
|
|
220
|
-
type: r ? s.type : "bar"
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
function Ie(s) {
|
|
224
|
-
const r = vt(s);
|
|
225
|
-
return r ? (R.error(r), !1) : !0;
|
|
226
|
-
}
|
|
227
|
-
function ga({
|
|
228
|
-
className: s,
|
|
229
|
-
variant: r = "outline"
|
|
230
|
-
}) {
|
|
231
|
-
const o = L((u) => u.onSave), { getUpdatedFrame: i } = we();
|
|
232
|
-
function p() {
|
|
233
|
-
const u = i();
|
|
234
|
-
Ie(u) && (o == null || o(u));
|
|
235
|
-
}
|
|
236
|
-
return /* @__PURE__ */ d(
|
|
237
|
-
V,
|
|
238
|
-
{
|
|
239
|
-
onClick: p,
|
|
240
|
-
className: s,
|
|
241
|
-
size: "xs",
|
|
242
|
-
variant: r,
|
|
243
|
-
children: [
|
|
244
|
-
/* @__PURE__ */ t(xt, { className: "h-3.5 w-3.5" }),
|
|
245
|
-
"Accept"
|
|
246
|
-
]
|
|
247
|
-
}
|
|
248
|
-
);
|
|
249
|
-
}
|
|
250
|
-
function ya({
|
|
251
|
-
className: s,
|
|
252
|
-
variant: r = "default"
|
|
253
|
-
}) {
|
|
254
|
-
const o = ue(), [i, p] = Q(!1), u = oe(
|
|
255
|
-
(x) => x.actions.setIsDashboardPanelOpen
|
|
256
|
-
), { setIsVisualEditing: h } = Ye(), { getUpdatedFrame: y } = we(), b = at(), v = L((x) => x.frame), g = rt();
|
|
257
|
-
return /* @__PURE__ */ t(
|
|
258
|
-
V,
|
|
259
|
-
{
|
|
260
|
-
onClick: () => {
|
|
261
|
-
const x = y();
|
|
262
|
-
if (!Ie(x))
|
|
263
|
-
return;
|
|
264
|
-
const S = (v == null ? void 0 : v.visualId) || (b == null ? void 0 : b.id);
|
|
265
|
-
if (!S) {
|
|
266
|
-
R.error("No visual to save");
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
p(!0), g.mutate(
|
|
270
|
-
{
|
|
271
|
-
visualId: S,
|
|
272
|
-
data: {
|
|
273
|
-
frameObject: x
|
|
274
|
-
}
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
onSuccess: () => {
|
|
278
|
-
p(!1), u(!0), R.success("Visual updated successfully"), o.invalidateQueries({
|
|
279
|
-
queryKey: ["resource-by-id", "visual", S],
|
|
280
|
-
exact: !0
|
|
281
|
-
});
|
|
282
|
-
},
|
|
283
|
-
onError: () => {
|
|
284
|
-
p(!1), R.error("Failed to update visual");
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
);
|
|
288
|
-
},
|
|
289
|
-
className: s,
|
|
290
|
-
size: "xs",
|
|
291
|
-
variant: r,
|
|
292
|
-
children: i ? /* @__PURE__ */ d($, { children: [
|
|
293
|
-
/* @__PURE__ */ t(Ke, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
294
|
-
"Saving"
|
|
295
|
-
] }) : /* @__PURE__ */ d($, { children: [
|
|
296
|
-
/* @__PURE__ */ t(nt, { className: "h-3.5 w-3.5" }),
|
|
297
|
-
"Save to Library"
|
|
298
|
-
] })
|
|
299
|
-
}
|
|
300
|
-
);
|
|
301
|
-
}
|
|
302
|
-
function xa({
|
|
303
|
-
className: s
|
|
304
|
-
}) {
|
|
305
|
-
const r = ue(), [o, i] = Q(!1), p = at(), u = L((N) => N.frame), h = oe((N) => N.selectedSheetId), y = oe((N) => N.dashboard), { updateFrame: b, setIsVisualEditing: v } = Ye(), { getUpdatedFrame: g } = we(), m = rt(), x = Bt();
|
|
306
|
-
return /* @__PURE__ */ t(
|
|
307
|
-
V,
|
|
308
|
-
{
|
|
309
|
-
onClick: async () => {
|
|
310
|
-
if (!h) {
|
|
311
|
-
R.error("No sheet selected");
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
const N = (u == null ? void 0 : u.visualId) || (p == null ? void 0 : p.id);
|
|
315
|
-
if (!N) {
|
|
316
|
-
R.error("No visual to update");
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
i(!0);
|
|
320
|
-
try {
|
|
321
|
-
const D = g();
|
|
322
|
-
if (!Ie(D)) {
|
|
323
|
-
i(!1);
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
const q = {
|
|
327
|
-
...D,
|
|
328
|
-
visualId: N
|
|
329
|
-
// Keep the link to library visual
|
|
330
|
-
}, K = Rt(y, q.id), G = await x(q, {
|
|
331
|
-
previousFrame: K
|
|
332
|
-
});
|
|
333
|
-
await m.mutateAsync({
|
|
334
|
-
visualId: N,
|
|
335
|
-
data: {
|
|
336
|
-
frameObject: D
|
|
337
|
-
}
|
|
338
|
-
}), b(h, q, {
|
|
339
|
-
semanticExecutionPayload: G
|
|
340
|
-
}), r.invalidateQueries({ queryKey: ["visuals"] }), r.invalidateQueries({ queryKey: ["visual", N] }), R.success("Saved to library and applied locally"), setTimeout(() => {
|
|
341
|
-
v(!1);
|
|
342
|
-
}, 300);
|
|
343
|
-
} catch (D) {
|
|
344
|
-
console.error("Failed to save and apply:", D), R.error(
|
|
345
|
-
D instanceof Error ? D.message : "Failed to save and apply changes"
|
|
346
|
-
);
|
|
347
|
-
} finally {
|
|
348
|
-
i(!1);
|
|
349
|
-
}
|
|
350
|
-
},
|
|
351
|
-
className: s,
|
|
352
|
-
size: "xs",
|
|
353
|
-
variant: "default",
|
|
354
|
-
disabled: o,
|
|
355
|
-
children: o ? /* @__PURE__ */ d($, { children: [
|
|
356
|
-
/* @__PURE__ */ t(Ke, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
357
|
-
"Saving..."
|
|
358
|
-
] }) : /* @__PURE__ */ d($, { children: [
|
|
359
|
-
/* @__PURE__ */ t(nt, { className: "h-3.5 w-3.5" }),
|
|
360
|
-
"Save & Apply"
|
|
361
|
-
] })
|
|
362
|
-
}
|
|
363
|
-
);
|
|
364
|
-
}
|
|
365
|
-
function va({ className: s }) {
|
|
366
|
-
const { setTempQueryData: r, setSqlGen: o } = ne(), i = ue(), p = L((m) => m.tempQueryData), u = L((m) => m.onClose), h = L((m) => m.card), y = ot(), b = z(() => y !== h.type ? { ...h, type: y } : h, [h, y]), { queryKey: v } = tt(b);
|
|
367
|
-
function g() {
|
|
368
|
-
if (p) {
|
|
369
|
-
const { queryKey: m, queryData: x } = p;
|
|
370
|
-
m && x && i.setQueryData(m, x);
|
|
371
|
-
}
|
|
372
|
-
o({}), u == null || u();
|
|
373
|
-
}
|
|
374
|
-
return /* @__PURE__ */ d(
|
|
375
|
-
V,
|
|
376
|
-
{
|
|
377
|
-
onClick: g,
|
|
378
|
-
className: s,
|
|
379
|
-
size: "xs",
|
|
380
|
-
variant: "outline",
|
|
381
|
-
children: [
|
|
382
|
-
/* @__PURE__ */ t(He, { className: "h-3.5 w-3.5" }),
|
|
383
|
-
"Close"
|
|
384
|
-
]
|
|
385
|
-
}
|
|
386
|
-
);
|
|
387
|
-
}
|
|
388
|
-
function Ca({
|
|
389
|
-
label: s = "Clear",
|
|
390
|
-
variant: r = "secondary",
|
|
391
|
-
className: o
|
|
392
|
-
} = {}) {
|
|
393
|
-
const { setTempQueryData: i } = ne(), p = ue(), u = L((M) => M.tempQueryData), h = L((M) => M.card), y = ot(), b = z(() => y !== h.type ? { ...h, type: y } : h, [h, y]), { queryKey: v } = tt(b), {
|
|
394
|
-
setCardSql: g,
|
|
395
|
-
setSqlGen: m,
|
|
396
|
-
setCardPython: x,
|
|
397
|
-
setCardCustomCfg: S,
|
|
398
|
-
setCardPreferences: N,
|
|
399
|
-
clearQueryConfig: D,
|
|
400
|
-
setCardConfig: q,
|
|
401
|
-
setCardType: K,
|
|
402
|
-
setFrame: G,
|
|
403
|
-
setCard: ae,
|
|
404
|
-
setActiveTabCardId: X
|
|
405
|
-
} = ne();
|
|
406
|
-
function pe() {
|
|
407
|
-
var Z, re, _, J;
|
|
408
|
-
const M = p.getQueryData(v);
|
|
409
|
-
u != null && u.queryData || i({
|
|
410
|
-
queryKey: v,
|
|
411
|
-
queryData: M
|
|
412
|
-
}), p.setQueryData(v, null), p.removeQueries({ queryKey: v, exact: !0 }), g(""), m({}), D(), q(void 0), x(""), S(""), N({});
|
|
413
|
-
const a = L.getState().frame, T = L.getState().card, E = et(a, T), B = ((Z = E == null ? void 0 : E.customCardPreferences) == null ? void 0 : Z.visualType) === "multiple" || !!((re = E == null ? void 0 : E.customCardPreferences) != null && re.dataInputCardIds) || (((_ = E == null ? void 0 : E.customCardPreferences) == null ? void 0 : _.minInputs) || 0) > 1 || (((J = E == null ? void 0 : E.customCardPreferences) == null ? void 0 : J.maxInputs) || 0) > 1, j = ea(T, B);
|
|
414
|
-
G({
|
|
415
|
-
...a,
|
|
416
|
-
cards: a.cards.map(
|
|
417
|
-
(U) => U.id === j.id ? j : U
|
|
418
|
-
)
|
|
419
|
-
}), X(j.id), ae(j), B || K("bar");
|
|
420
|
-
}
|
|
421
|
-
return /* @__PURE__ */ d(
|
|
422
|
-
V,
|
|
423
|
-
{
|
|
424
|
-
onClick: pe,
|
|
425
|
-
className: o,
|
|
426
|
-
size: "xs",
|
|
427
|
-
variant: r,
|
|
428
|
-
children: [
|
|
429
|
-
/* @__PURE__ */ t(He, { className: "h-3.5 w-3.5" }),
|
|
430
|
-
s
|
|
431
|
-
]
|
|
432
|
-
}
|
|
433
|
-
);
|
|
434
|
-
}
|
|
435
|
-
function it(s) {
|
|
436
|
-
const { control: r, onChange: o } = s;
|
|
437
|
-
return /* @__PURE__ */ d("div", { className: "flex flex-col gap-1.5", children: [
|
|
438
|
-
/* @__PURE__ */ t(Y, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Label" }),
|
|
439
|
-
/* @__PURE__ */ t(
|
|
440
|
-
Je,
|
|
441
|
-
{
|
|
442
|
-
size: "xs",
|
|
443
|
-
value: r.label,
|
|
444
|
-
placeholder: "Control label",
|
|
445
|
-
onChange: (i) => o(i.target.value)
|
|
446
|
-
}
|
|
447
|
-
)
|
|
448
|
-
] });
|
|
449
|
-
}
|
|
450
|
-
function ta(s) {
|
|
451
|
-
const { currentStep: r, labels: o } = s;
|
|
452
|
-
return /* @__PURE__ */ t("div", { className: "sticky top-0 z-10 -mx-1 border-b border-border/60 bg-background/95 px-1 pb-2.5 pt-1 backdrop-blur supports-[backdrop-filter]:bg-background/85", children: /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-2 sm:gap-2.5", children: o.map((i, p) => {
|
|
453
|
-
const u = p + 1, h = u === r, y = u < r;
|
|
454
|
-
return /* @__PURE__ */ d(Vt, { children: [
|
|
455
|
-
/* @__PURE__ */ d("div", { className: "flex items-center gap-1.5", children: [
|
|
456
|
-
/* @__PURE__ */ t(
|
|
457
|
-
"span",
|
|
458
|
-
{
|
|
459
|
-
className: ie(
|
|
460
|
-
"flex h-5 w-5 items-center justify-center rounded-full border text-[10px] font-medium tabular-nums",
|
|
461
|
-
h ? "border-foreground bg-foreground text-background" : y ? "border-foreground/30 bg-foreground/10 text-foreground" : "border-border/60 bg-background text-muted-foreground"
|
|
462
|
-
),
|
|
463
|
-
children: u
|
|
464
|
-
}
|
|
465
|
-
),
|
|
466
|
-
/* @__PURE__ */ t(
|
|
467
|
-
"span",
|
|
468
|
-
{
|
|
469
|
-
className: ie(
|
|
470
|
-
"text-[12px]",
|
|
471
|
-
h ? "font-medium text-foreground" : "text-muted-foreground"
|
|
472
|
-
),
|
|
473
|
-
children: i
|
|
474
|
-
}
|
|
475
|
-
)
|
|
476
|
-
] }),
|
|
477
|
-
p < o.length - 1 ? /* @__PURE__ */ t(
|
|
478
|
-
"span",
|
|
479
|
-
{
|
|
480
|
-
className: "h-px w-4 bg-border/60 sm:w-6",
|
|
481
|
-
"aria-hidden": "true"
|
|
482
|
-
}
|
|
483
|
-
) : null
|
|
484
|
-
] }, i);
|
|
485
|
-
}) }) });
|
|
486
|
-
}
|
|
487
|
-
function ce(s) {
|
|
488
|
-
const { secondary: r, tertiary: o, primary: i } = s;
|
|
489
|
-
return /* @__PURE__ */ d("div", { className: "sticky bottom-0 z-10 -mx-1 flex justify-end gap-2 border-t bg-background/95 px-1 pb-1 pt-3 backdrop-blur supports-[backdrop-filter]:bg-background/85", children: [
|
|
490
|
-
r,
|
|
491
|
-
o,
|
|
492
|
-
i
|
|
493
|
-
] });
|
|
494
|
-
}
|
|
495
|
-
function aa(s) {
|
|
496
|
-
const { control: r, scope: o, detail: i } = s;
|
|
497
|
-
return /* @__PURE__ */ d("div", { className: "flex items-start gap-2.5 rounded-control border border-border/60 bg-muted/30 px-3 py-2.5", children: [
|
|
498
|
-
/* @__PURE__ */ t(Zt, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-foreground" }),
|
|
499
|
-
/* @__PURE__ */ d("div", { className: "min-w-0 space-y-0.5", children: [
|
|
500
|
-
/* @__PURE__ */ t("div", { className: "text-[13px] font-medium text-foreground", children: r.label }),
|
|
501
|
-
/* @__PURE__ */ d("div", { className: "text-[12px] text-muted-foreground", children: [
|
|
502
|
-
Ge(r.type).label,
|
|
503
|
-
" ·",
|
|
504
|
-
" ",
|
|
505
|
-
Ze(r),
|
|
506
|
-
" ·",
|
|
507
|
-
" ",
|
|
508
|
-
Xe(o, r.placement)
|
|
509
|
-
] }),
|
|
510
|
-
i ? /* @__PURE__ */ t("div", { className: "text-[12px] text-muted-foreground", children: i }) : null
|
|
511
|
-
] })
|
|
512
|
-
] });
|
|
513
|
-
}
|
|
514
|
-
function Ue(s) {
|
|
515
|
-
const {
|
|
516
|
-
control: r,
|
|
517
|
-
defaultValue: o,
|
|
518
|
-
availableFieldChoices: i,
|
|
519
|
-
availableMetricChoices: p,
|
|
520
|
-
previewControlDefinitions: u,
|
|
521
|
-
previewControlValues: h,
|
|
522
|
-
onControlChange: y,
|
|
523
|
-
onLabelChange: b,
|
|
524
|
-
onDefaultValueChange: v,
|
|
525
|
-
onBack: g,
|
|
526
|
-
onNext: m,
|
|
527
|
-
nextDisabled: x
|
|
528
|
-
} = s;
|
|
529
|
-
return /* @__PURE__ */ d("div", { className: "space-y-3", children: [
|
|
530
|
-
/* @__PURE__ */ t(it, { control: r, onChange: b }),
|
|
531
|
-
/* @__PURE__ */ t(
|
|
532
|
-
st,
|
|
533
|
-
{
|
|
534
|
-
control: r,
|
|
535
|
-
availableFieldChoices: i,
|
|
536
|
-
availableMetricChoices: p,
|
|
537
|
-
previewControlDefinitions: u,
|
|
538
|
-
previewControlValues: h,
|
|
539
|
-
controlLifecycle: "create",
|
|
540
|
-
onChange: y
|
|
541
|
-
}
|
|
542
|
-
),
|
|
543
|
-
/* @__PURE__ */ t(
|
|
544
|
-
lt,
|
|
545
|
-
{
|
|
546
|
-
control: r,
|
|
547
|
-
value: o,
|
|
548
|
-
onChange: v,
|
|
549
|
-
allowNoDefault: !0,
|
|
550
|
-
allowCardDefault: !0,
|
|
551
|
-
hint: "This is the value viewers will see first.",
|
|
552
|
-
previewControlDefinitions: u,
|
|
553
|
-
previewControlValues: h
|
|
554
|
-
}
|
|
555
|
-
),
|
|
556
|
-
/* @__PURE__ */ t(
|
|
557
|
-
ce,
|
|
558
|
-
{
|
|
559
|
-
secondary: /* @__PURE__ */ t(V, { type: "button", variant: "outline", size: "xs", onClick: g, children: "Back" }),
|
|
560
|
-
primary: /* @__PURE__ */ t(
|
|
561
|
-
V,
|
|
562
|
-
{
|
|
563
|
-
type: "button",
|
|
564
|
-
size: "xs",
|
|
565
|
-
onClick: m,
|
|
566
|
-
disabled: x,
|
|
567
|
-
children: "Next"
|
|
568
|
-
}
|
|
569
|
-
)
|
|
570
|
-
}
|
|
571
|
-
)
|
|
572
|
-
] });
|
|
573
|
-
}
|
|
574
|
-
const ra = /* @__PURE__ */ new Set([
|
|
575
|
-
"grain_selector",
|
|
576
|
-
"aggregation_selector",
|
|
577
|
-
"field_selector",
|
|
578
|
-
"metric_selector"
|
|
579
|
-
]);
|
|
580
|
-
function Pe(s) {
|
|
581
|
-
const { text: r, ariaLabel: o } = s, [i, p] = Q(!1);
|
|
582
|
-
return /* @__PURE__ */ d(
|
|
583
|
-
"button",
|
|
584
|
-
{
|
|
585
|
-
type: "button",
|
|
586
|
-
"aria-label": o,
|
|
587
|
-
onClick: async () => {
|
|
588
|
-
try {
|
|
589
|
-
await navigator.clipboard.writeText(r), p(!0), setTimeout(() => p(!1), 1200);
|
|
590
|
-
} catch (u) {
|
|
591
|
-
console.error("Failed to copy", u);
|
|
592
|
-
}
|
|
593
|
-
},
|
|
594
|
-
className: "group flex w-full items-center justify-between gap-2 rounded-control bg-muted/40 px-2 py-1 text-left transition-colors hover:bg-muted/60 focus-visible:bg-muted/60 focus-visible:outline-none",
|
|
595
|
-
children: [
|
|
596
|
-
/* @__PURE__ */ t("code", { className: "min-w-0 truncate font-mono text-[12px] text-foreground", children: r }),
|
|
597
|
-
/* @__PURE__ */ t("span", { className: "shrink-0 text-[11px] text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100", children: i ? "Copied" : "Click to copy" })
|
|
598
|
-
]
|
|
599
|
-
}
|
|
600
|
-
);
|
|
601
|
-
}
|
|
602
|
-
function $e(s) {
|
|
603
|
-
const {
|
|
604
|
-
control: r,
|
|
605
|
-
scope: o,
|
|
606
|
-
createdReference: i,
|
|
607
|
-
explorerContent: p,
|
|
608
|
-
sqlDescription: u,
|
|
609
|
-
summaryDetail: h,
|
|
610
|
-
onBack: y,
|
|
611
|
-
onCancel: b,
|
|
612
|
-
onDone: v
|
|
613
|
-
} = s, g = ra.has(r.type), m = i.match(/\[\[param\.(.+?)\]\]/), x = m ? `{{ param('${m[1]}') }}` : "";
|
|
614
|
-
return /* @__PURE__ */ d("div", { className: "space-y-4", children: [
|
|
615
|
-
/* @__PURE__ */ t(
|
|
616
|
-
aa,
|
|
617
|
-
{
|
|
618
|
-
control: r,
|
|
619
|
-
scope: o,
|
|
620
|
-
detail: h
|
|
621
|
-
}
|
|
622
|
-
),
|
|
623
|
-
/* @__PURE__ */ d("div", { className: "space-y-2", children: [
|
|
624
|
-
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-foreground", children: "How cards use this control" }),
|
|
625
|
-
/* @__PURE__ */ d("div", { className: "divide-y divide-border/60 overflow-hidden rounded-control border border-border/60", children: [
|
|
626
|
-
g ? /* @__PURE__ */ d("div", { className: "space-y-1 px-3 py-2.5", children: [
|
|
627
|
-
/* @__PURE__ */ t("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Explorer cards" }),
|
|
628
|
-
/* @__PURE__ */ t("div", { className: "text-[12px] text-muted-foreground", children: p })
|
|
629
|
-
] }) : null,
|
|
630
|
-
/* @__PURE__ */ d("div", { className: "space-y-1.5 px-3 py-2.5", children: [
|
|
631
|
-
/* @__PURE__ */ t("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "SQL cards" }),
|
|
632
|
-
/* @__PURE__ */ t(
|
|
633
|
-
Pe,
|
|
634
|
-
{
|
|
635
|
-
text: i,
|
|
636
|
-
ariaLabel: "Copy SQL control reference"
|
|
637
|
-
}
|
|
638
|
-
),
|
|
639
|
-
x ? /* @__PURE__ */ t(
|
|
640
|
-
Pe,
|
|
641
|
-
{
|
|
642
|
-
text: x,
|
|
643
|
-
ariaLabel: "Copy Jinja control reference"
|
|
644
|
-
}
|
|
645
|
-
) : null,
|
|
646
|
-
/* @__PURE__ */ d("p", { className: "text-[12px] text-muted-foreground", children: [
|
|
647
|
-
u,
|
|
648
|
-
" ",
|
|
649
|
-
/* @__PURE__ */ t(
|
|
650
|
-
"a",
|
|
651
|
-
{
|
|
652
|
-
href: "https://docs.semaphor.cloud/docs/concepts/template-expressions",
|
|
653
|
-
target: "_blank",
|
|
654
|
-
rel: "noreferrer",
|
|
655
|
-
className: "underline underline-offset-2 hover:text-foreground",
|
|
656
|
-
children: "Template expressions docs"
|
|
657
|
-
}
|
|
658
|
-
),
|
|
659
|
-
"."
|
|
660
|
-
] })
|
|
661
|
-
] })
|
|
662
|
-
] })
|
|
663
|
-
] }),
|
|
664
|
-
/* @__PURE__ */ t(
|
|
665
|
-
ce,
|
|
666
|
-
{
|
|
667
|
-
secondary: /* @__PURE__ */ t(V, { type: "button", variant: "outline", size: "xs", onClick: y, children: "Back" }),
|
|
668
|
-
tertiary: /* @__PURE__ */ t(V, { type: "button", variant: "outline", size: "xs", onClick: b, children: "Cancel" }),
|
|
669
|
-
primary: /* @__PURE__ */ t(V, { type: "button", size: "xs", onClick: v, children: "Done" })
|
|
670
|
-
}
|
|
671
|
-
)
|
|
672
|
-
] });
|
|
673
|
-
}
|
|
674
|
-
function sa(s) {
|
|
675
|
-
const r = se(
|
|
676
|
-
s.scope,
|
|
677
|
-
s.existingControls,
|
|
678
|
-
s.reservedIds
|
|
679
|
-
), o = s.type === r.type ? {
|
|
680
|
-
...r,
|
|
681
|
-
label: Se[s.type]
|
|
682
|
-
} : {
|
|
683
|
-
...We({
|
|
684
|
-
controls: [
|
|
685
|
-
{
|
|
686
|
-
...r,
|
|
687
|
-
label: Se[s.type]
|
|
688
|
-
}
|
|
689
|
-
],
|
|
690
|
-
controlId: r.id,
|
|
691
|
-
nextType: s.type
|
|
692
|
-
}).controls[0],
|
|
693
|
-
label: Se[s.type]
|
|
694
|
-
};
|
|
695
|
-
return {
|
|
696
|
-
step: 2,
|
|
697
|
-
control: o,
|
|
698
|
-
defaultValue: le(o, void 0)
|
|
699
|
-
};
|
|
700
|
-
}
|
|
701
|
-
function ka({
|
|
702
|
-
scope: s,
|
|
703
|
-
controls: r,
|
|
704
|
-
reservedControlIds: o,
|
|
705
|
-
defaultValues: i,
|
|
706
|
-
onChange: p,
|
|
707
|
-
emptyMessage: u,
|
|
708
|
-
initialCreateFlow: h = !1,
|
|
709
|
-
usageByControlId: y,
|
|
710
|
-
availableFieldChoices: b,
|
|
711
|
-
availableMetricChoices: v,
|
|
712
|
-
structuralParticipants: g,
|
|
713
|
-
structuralParticipantIdsByControlId: m,
|
|
714
|
-
card: x,
|
|
715
|
-
allowedControlTypes: S,
|
|
716
|
-
onCreateFlowActiveChange: N,
|
|
717
|
-
onCreateFlowComplete: D
|
|
718
|
-
}) {
|
|
719
|
-
const q = z(
|
|
720
|
-
() => new Set(o || []),
|
|
721
|
-
[o]
|
|
722
|
-
), K = wt(s), G = Ct(s), [ae, X] = Q(
|
|
723
|
-
null
|
|
724
|
-
), [pe, M] = Q(
|
|
725
|
-
null
|
|
726
|
-
), [a, T] = Q(
|
|
727
|
-
() => h ? {
|
|
728
|
-
step: 1,
|
|
729
|
-
control: se(s, r, Array.from(q))
|
|
730
|
-
} : null
|
|
731
|
-
), E = De({}), B = De(void 0), j = De(h), Z = z(() => {
|
|
732
|
-
const e = Ae({ scope: s, card: x });
|
|
733
|
-
if (!S)
|
|
734
|
-
return e;
|
|
735
|
-
const n = new Set(S);
|
|
736
|
-
return e.filter((l) => n.has(l.value));
|
|
737
|
-
}, [S, x, s]), re = O(
|
|
738
|
-
(e) => {
|
|
739
|
-
const n = Ae({
|
|
740
|
-
scope: s,
|
|
741
|
-
card: x,
|
|
742
|
-
includeType: S ? void 0 : e
|
|
743
|
-
});
|
|
744
|
-
if (!S)
|
|
745
|
-
return n;
|
|
746
|
-
const l = new Set(S);
|
|
747
|
-
return n.filter((c) => l.has(c.value));
|
|
748
|
-
},
|
|
749
|
-
[S, x, s]
|
|
750
|
-
), _ = O(
|
|
751
|
-
(e) => s === "dashboard" && (e === "field_selector" || e === "metric_selector"),
|
|
752
|
-
[s]
|
|
753
|
-
), J = z(
|
|
754
|
-
() => a ? ze(
|
|
755
|
-
g || [],
|
|
756
|
-
a.control.type
|
|
757
|
-
) : [],
|
|
758
|
-
[a, g]
|
|
759
|
-
), U = z(() => {
|
|
760
|
-
if (!a)
|
|
761
|
-
return {
|
|
762
|
-
fields: b || [],
|
|
763
|
-
metrics: v || []
|
|
764
|
-
};
|
|
765
|
-
if (!_(a.control.type))
|
|
766
|
-
return {
|
|
767
|
-
fields: b || [],
|
|
768
|
-
metrics: v || []
|
|
769
|
-
};
|
|
770
|
-
const e = a.selectedCardIds || [], n = ge({
|
|
771
|
-
controlType: a.control.type,
|
|
772
|
-
participants: g || [],
|
|
773
|
-
selectedCardIds: e
|
|
774
|
-
});
|
|
775
|
-
return {
|
|
776
|
-
fields: a.control.type === "field_selector" ? n.choices.map((l) => ({
|
|
777
|
-
option: l,
|
|
778
|
-
target: n.fieldTargetMap[l.value]
|
|
779
|
-
})) : [],
|
|
780
|
-
metrics: a.control.type === "metric_selector" ? n.choices.map((l) => ({
|
|
781
|
-
option: l,
|
|
782
|
-
target: n.metricTargetMap[l.value]
|
|
783
|
-
})) : []
|
|
784
|
-
};
|
|
785
|
-
}, [
|
|
786
|
-
b,
|
|
787
|
-
v,
|
|
788
|
-
a,
|
|
789
|
-
_,
|
|
790
|
-
g
|
|
791
|
-
]);
|
|
792
|
-
de(() => {
|
|
793
|
-
N == null || N(!!a);
|
|
794
|
-
}, [a, N]), de(() => {
|
|
795
|
-
const e = h && !j.current;
|
|
796
|
-
j.current = h, e && (T({
|
|
797
|
-
step: 1,
|
|
798
|
-
control: se(s, r, Array.from(q))
|
|
799
|
-
}), M(null), X(null));
|
|
800
|
-
}, [r, h, q, s]);
|
|
801
|
-
const dt = (e) => {
|
|
802
|
-
if (!_(e.type))
|
|
803
|
-
return {
|
|
804
|
-
fields: b || [],
|
|
805
|
-
metrics: v || []
|
|
806
|
-
};
|
|
807
|
-
const n = (m == null ? void 0 : m[e.id]) || [];
|
|
808
|
-
if (n.length === 0)
|
|
809
|
-
return {
|
|
810
|
-
fields: b || [],
|
|
811
|
-
metrics: v || []
|
|
812
|
-
};
|
|
813
|
-
const l = ge({
|
|
814
|
-
controlType: e.type,
|
|
815
|
-
participants: g || [],
|
|
816
|
-
selectedCardIds: n
|
|
817
|
-
});
|
|
818
|
-
return {
|
|
819
|
-
fields: e.type === "field_selector" ? l.choices.map((c) => ({
|
|
820
|
-
option: c,
|
|
821
|
-
target: l.fieldTargetMap[c.value]
|
|
822
|
-
})) : [],
|
|
823
|
-
metrics: e.type === "metric_selector" ? l.choices.map((c) => ({
|
|
824
|
-
option: c,
|
|
825
|
-
target: l.metricTargetMap[c.value]
|
|
826
|
-
})) : []
|
|
827
|
-
};
|
|
828
|
-
}, Te = (e) => {
|
|
829
|
-
if (!_(e.control.type))
|
|
830
|
-
return {
|
|
831
|
-
nextControl: e.control,
|
|
832
|
-
cardBindingsById: void 0
|
|
833
|
-
};
|
|
834
|
-
const n = (m == null ? void 0 : m[e.control.id]) || [], l = ge({
|
|
835
|
-
controlType: e.control.type,
|
|
836
|
-
participants: g || [],
|
|
837
|
-
selectedCardIds: e.nextSelectedCardIds
|
|
838
|
-
}), c = Et({
|
|
839
|
-
control: e.control,
|
|
840
|
-
choices: l.choices
|
|
841
|
-
}), C = Object.fromEntries(
|
|
842
|
-
n.filter((k) => !e.nextSelectedCardIds.includes(k)).map((k) => [k, void 0])
|
|
843
|
-
);
|
|
844
|
-
return e.nextSelectedCardIds.length > 0 && c.source.kind === "manual" && c.source.options.length > 0 && Object.assign(
|
|
845
|
-
C,
|
|
846
|
-
Qe({
|
|
847
|
-
control: c,
|
|
848
|
-
participants: g || [],
|
|
849
|
-
selectedCardIds: e.nextSelectedCardIds
|
|
850
|
-
})
|
|
851
|
-
), {
|
|
852
|
-
nextControl: c,
|
|
853
|
-
cardBindingsById: C
|
|
854
|
-
};
|
|
855
|
-
}, A = O(
|
|
856
|
-
(e, n = i, l = { type: "update" }) => {
|
|
857
|
-
const c = e.map((C) => (ye({
|
|
858
|
-
control: C,
|
|
859
|
-
defaultValues: n
|
|
860
|
-
}), kt(
|
|
861
|
-
C
|
|
862
|
-
)));
|
|
863
|
-
p(c, n, l);
|
|
864
|
-
},
|
|
865
|
-
[i, p]
|
|
866
|
-
), W = (e, n) => {
|
|
867
|
-
const l = r.find(
|
|
868
|
-
(I) => I.id === e
|
|
869
|
-
);
|
|
870
|
-
let c = r.map((I) => I.id !== e ? I : n(I));
|
|
871
|
-
const C = c.find(
|
|
872
|
-
(I) => I.id === e
|
|
873
|
-
);
|
|
874
|
-
let k, f;
|
|
875
|
-
if (C && s === "dashboard" && (C.type === "field_selector" || C.type === "metric_selector")) {
|
|
876
|
-
const I = (m == null ? void 0 : m[C.id]) || [], H = Te({
|
|
877
|
-
control: C,
|
|
878
|
-
nextSelectedCardIds: I
|
|
879
|
-
});
|
|
880
|
-
c = c.map(
|
|
881
|
-
(P) => P.id === e ? H.nextControl : P
|
|
882
|
-
), k = H.cardBindingsById, f = [C.id];
|
|
883
|
-
} else if (l && s === "dashboard" && (l.type === "field_selector" || l.type === "metric_selector")) {
|
|
884
|
-
const I = (m == null ? void 0 : m[l.id]) || [];
|
|
885
|
-
k = Object.fromEntries(
|
|
886
|
-
I.map((H) => [H, void 0])
|
|
887
|
-
), f = [l.id];
|
|
888
|
-
}
|
|
889
|
-
const w = c.find(
|
|
890
|
-
(I) => I.id === e
|
|
891
|
-
);
|
|
892
|
-
let F = i;
|
|
893
|
-
if (l && w) {
|
|
894
|
-
const I = ye({
|
|
895
|
-
control: l,
|
|
896
|
-
defaultValues: i
|
|
897
|
-
});
|
|
898
|
-
l.source.kind === "manual" && w.source.kind === "sql_query" && (E.current[e] = I);
|
|
899
|
-
const H = I === void 0 && l.source.kind === "sql_query" && w.source.kind === "manual" ? E.current[e] : I, P = Re({
|
|
900
|
-
previousControl: l,
|
|
901
|
-
nextControl: w,
|
|
902
|
-
currentDefaultValue: H
|
|
903
|
-
});
|
|
904
|
-
w.source.kind === "manual" && (E.current[e] = P), i && (F = { ...i }, P === void 0 ? delete F[e] : F[e] = P), c = c.map(
|
|
905
|
-
(Le) => Le.id === e ? { ...w, defaultValue: P } : Le
|
|
906
|
-
);
|
|
907
|
-
}
|
|
908
|
-
A(c, F, {
|
|
909
|
-
type: "update",
|
|
910
|
-
cardBindingsById: k,
|
|
911
|
-
affectedBindingControlIds: f
|
|
912
|
-
});
|
|
913
|
-
}, ct = (e, n) => {
|
|
914
|
-
if (!n.trim())
|
|
915
|
-
return;
|
|
916
|
-
const l = Xt(n);
|
|
917
|
-
if (l === e || q.has(l) || r.some(
|
|
918
|
-
(k) => k.id === l && k.id !== e
|
|
919
|
-
))
|
|
920
|
-
return;
|
|
921
|
-
const c = r.map(
|
|
922
|
-
(k) => k.id === e ? { ...k, id: l } : k
|
|
923
|
-
);
|
|
924
|
-
if (!i) {
|
|
925
|
-
A(c, void 0, {
|
|
926
|
-
type: "rename",
|
|
927
|
-
oldId: e,
|
|
928
|
-
newId: l
|
|
929
|
-
});
|
|
930
|
-
return;
|
|
931
|
-
}
|
|
932
|
-
const C = { ...i };
|
|
933
|
-
Object.prototype.hasOwnProperty.call(C, e) && (C[l] = C[e], delete C[e]), A(c, C, {
|
|
934
|
-
type: "rename",
|
|
935
|
-
oldId: e,
|
|
936
|
-
newId: l
|
|
937
|
-
});
|
|
938
|
-
}, ut = (e) => {
|
|
939
|
-
const n = r.filter((c) => c.id !== e);
|
|
940
|
-
if (!i) {
|
|
941
|
-
A(n, void 0, { type: "remove", controlId: e });
|
|
942
|
-
return;
|
|
943
|
-
}
|
|
944
|
-
const l = { ...i };
|
|
945
|
-
delete l[e], A(n, l, { type: "remove", controlId: e });
|
|
946
|
-
}, pt = O(() => {
|
|
947
|
-
B.current = void 0, T({
|
|
948
|
-
step: 1,
|
|
949
|
-
control: se(s, r, Array.from(q))
|
|
950
|
-
}), M(null), X(null);
|
|
951
|
-
}, [r, q, s]), ee = (e) => {
|
|
952
|
-
T(
|
|
953
|
-
(n) => n && (() => {
|
|
954
|
-
const l = e(n.control);
|
|
955
|
-
n.control.source.kind === "manual" && l.source.kind === "sql_query" && (B.current = n.defaultValue);
|
|
956
|
-
const c = n.defaultValue === void 0 && n.control.source.kind === "sql_query" && l.source.kind === "manual" ? B.current : n.defaultValue, C = Re({
|
|
957
|
-
previousControl: n.control,
|
|
958
|
-
nextControl: l,
|
|
959
|
-
currentDefaultValue: c
|
|
960
|
-
});
|
|
961
|
-
return l.source.kind === "manual" && (B.current = C), {
|
|
962
|
-
...n,
|
|
963
|
-
control: l,
|
|
964
|
-
defaultValue: C
|
|
965
|
-
};
|
|
966
|
-
})()
|
|
967
|
-
);
|
|
968
|
-
}, Ee = (e) => {
|
|
969
|
-
T(
|
|
970
|
-
(n) => n && (n.control.source.kind === "manual" && (B.current = e), {
|
|
971
|
-
...n,
|
|
972
|
-
defaultValue: e
|
|
973
|
-
})
|
|
974
|
-
);
|
|
975
|
-
}, me = (() => {
|
|
976
|
-
if (!a)
|
|
977
|
-
return !1;
|
|
978
|
-
if (a.step === 2 && _(a.control.type))
|
|
979
|
-
return (a.selectedCardIds || []).length > 0;
|
|
980
|
-
if (a.step !== 2 && a.step !== 3 || !a.control.label.trim())
|
|
981
|
-
return !1;
|
|
982
|
-
const n = a.control.source.kind === "sql_query" ? a.control : Me(a.control);
|
|
983
|
-
if (n.source.kind === "manual" && (Nt(n) && n.source.options.length === 0 || n.source.options.some(
|
|
984
|
-
(c) => c.label.trim().length === 0 || c.value.trim().length === 0
|
|
985
|
-
)))
|
|
986
|
-
return !1;
|
|
987
|
-
if (n.source.kind === "sql_query") {
|
|
988
|
-
const { connectionId: l, sql: c, valueColumn: C } = n.source;
|
|
989
|
-
return l.trim().length > 0 && c.trim().length > 0 && C.trim().length > 0;
|
|
990
|
-
}
|
|
991
|
-
return St(
|
|
992
|
-
le(n, a.defaultValue)
|
|
993
|
-
);
|
|
994
|
-
})(), Ve = () => {
|
|
995
|
-
var k;
|
|
996
|
-
if (!a)
|
|
997
|
-
return;
|
|
998
|
-
const e = Me(a.control), n = Tt({
|
|
999
|
-
label: e.label,
|
|
1000
|
-
fallbackId: e.id,
|
|
1001
|
-
existingControls: r,
|
|
1002
|
-
reservedIds: Array.from(q)
|
|
1003
|
-
}), l = {
|
|
1004
|
-
...e,
|
|
1005
|
-
id: n
|
|
1006
|
-
}, c = s === "dashboard" && (l.type === "field_selector" || l.type === "metric_selector") && ((k = a.selectedCardIds) != null && k.length) ? Qe({
|
|
1007
|
-
control: l,
|
|
1008
|
-
participants: g || [],
|
|
1009
|
-
selectedCardIds: a.selectedCardIds
|
|
1010
|
-
}) : void 0, C = le(
|
|
1011
|
-
l,
|
|
1012
|
-
a.defaultValue
|
|
1013
|
-
);
|
|
1014
|
-
T({
|
|
1015
|
-
step: s === "dashboard" && (l.type === "field_selector" || l.type === "metric_selector") ? 4 : 3,
|
|
1016
|
-
control: l,
|
|
1017
|
-
defaultValue: C,
|
|
1018
|
-
createdControlId: n,
|
|
1019
|
-
selectedCardIds: a.selectedCardIds,
|
|
1020
|
-
cardBindingsById: c
|
|
1021
|
-
});
|
|
1022
|
-
}, fe = O(() => {
|
|
1023
|
-
T(null);
|
|
1024
|
-
}, []), _e = O(() => {
|
|
1025
|
-
if (!(a != null && a.createdControlId)) {
|
|
1026
|
-
T(null);
|
|
1027
|
-
return;
|
|
1028
|
-
}
|
|
1029
|
-
const e = a.control, n = a.createdControlId, l = le(
|
|
1030
|
-
e,
|
|
1031
|
-
a.defaultValue
|
|
1032
|
-
);
|
|
1033
|
-
if (i) {
|
|
1034
|
-
const c = { ...i };
|
|
1035
|
-
l === void 0 ? delete c[n] : c[n] = l, A(
|
|
1036
|
-
[
|
|
1037
|
-
...r,
|
|
1038
|
-
{
|
|
1039
|
-
...e,
|
|
1040
|
-
defaultValue: l
|
|
1041
|
-
}
|
|
1042
|
-
],
|
|
1043
|
-
c,
|
|
1044
|
-
{
|
|
1045
|
-
type: "add",
|
|
1046
|
-
cardBindingsById: a.cardBindingsById
|
|
1047
|
-
}
|
|
1048
|
-
);
|
|
1049
|
-
} else
|
|
1050
|
-
A(
|
|
1051
|
-
[
|
|
1052
|
-
...r,
|
|
1053
|
-
{
|
|
1054
|
-
...e,
|
|
1055
|
-
defaultValue: l
|
|
1056
|
-
}
|
|
1057
|
-
],
|
|
1058
|
-
void 0,
|
|
1059
|
-
{
|
|
1060
|
-
type: "add",
|
|
1061
|
-
cardBindingsById: a.cardBindingsById
|
|
1062
|
-
}
|
|
1063
|
-
);
|
|
1064
|
-
M(n), T(null), D == null || D();
|
|
1065
|
-
}, [r, a, i, A, D]), mt = a ? _(a.control.type) ? ["Choose type", "Select cards", "Configure", "Finish"] : ["Choose type", "Configure", "Finish"] : [], qe = a != null && a.createdControlId ? `[[param.${a.createdControlId}]]` : a ? `[[param.${Dt(a.control.label) || a.control.id}]]` : "", he = Oe({
|
|
1066
|
-
controls: r,
|
|
1067
|
-
defaultValues: i
|
|
1068
|
-
}), be = a ? [...r, a.control] : r, Fe = a ? Oe({
|
|
1069
|
-
controls: be,
|
|
1070
|
-
defaultValues: i,
|
|
1071
|
-
overrides: [
|
|
1072
|
-
{
|
|
1073
|
-
controlId: a.control.id,
|
|
1074
|
-
value: a.defaultValue
|
|
1075
|
-
}
|
|
1076
|
-
]
|
|
1077
|
-
}) : he;
|
|
1078
|
-
return /* @__PURE__ */ d("div", { className: "space-y-4", children: [
|
|
1079
|
-
a ? /* @__PURE__ */ d("div", { className: "space-y-4 pb-1", children: [
|
|
1080
|
-
/* @__PURE__ */ t(
|
|
1081
|
-
ta,
|
|
1082
|
-
{
|
|
1083
|
-
currentStep: a.step,
|
|
1084
|
-
labels: mt
|
|
1085
|
-
}
|
|
1086
|
-
),
|
|
1087
|
-
a.step === 1 && (() => {
|
|
1088
|
-
const e = /* @__PURE__ */ new Set([
|
|
1089
|
-
"grain_selector",
|
|
1090
|
-
"aggregation_selector",
|
|
1091
|
-
"field_selector",
|
|
1092
|
-
"metric_selector"
|
|
1093
|
-
]), n = /* @__PURE__ */ new Set([
|
|
1094
|
-
// Temporarily hide these from the add-control dialog while
|
|
1095
|
-
// keeping the shared definitions for existing controls.
|
|
1096
|
-
"date",
|
|
1097
|
-
"text"
|
|
1098
|
-
]), l = Z.filter(
|
|
1099
|
-
(k) => !e.has(k.value) && !n.has(k.value)
|
|
1100
|
-
), c = Z.filter(
|
|
1101
|
-
(k) => e.has(k.value)
|
|
1102
|
-
), C = (k) => /* @__PURE__ */ d(
|
|
1103
|
-
"button",
|
|
1104
|
-
{
|
|
1105
|
-
type: "button",
|
|
1106
|
-
className: "rounded-control border border-border/60 bg-background px-3 py-2.5 text-left transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:outline-none",
|
|
1107
|
-
onClick: () => T(
|
|
1108
|
-
sa({
|
|
1109
|
-
scope: s,
|
|
1110
|
-
existingControls: r,
|
|
1111
|
-
reservedIds: Array.from(q),
|
|
1112
|
-
type: k.value
|
|
1113
|
-
})
|
|
1114
|
-
),
|
|
1115
|
-
children: [
|
|
1116
|
-
/* @__PURE__ */ t("div", { className: "text-[13px] font-medium text-foreground", children: k.label }),
|
|
1117
|
-
/* @__PURE__ */ t("p", { className: "mt-0.5 text-[12px] text-muted-foreground", children: k.description })
|
|
1118
|
-
]
|
|
1119
|
-
},
|
|
1120
|
-
k.value
|
|
1121
|
-
);
|
|
1122
|
-
return /* @__PURE__ */ d("div", { className: "space-y-4", children: [
|
|
1123
|
-
s === "card" && (x == null ? void 0 : x.sql) == null ? /* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "Explorer cards support displayed metric, group by field, aggregation, and time grain controls here." }) : null,
|
|
1124
|
-
l.length > 0 && /* @__PURE__ */ d("div", { className: "space-y-1.5", children: [
|
|
1125
|
-
/* @__PURE__ */ t("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Input controls" }),
|
|
1126
|
-
/* @__PURE__ */ t("div", { className: "grid gap-1.5 sm:grid-cols-2", children: l.map(C) })
|
|
1127
|
-
] }),
|
|
1128
|
-
c.length > 0 && /* @__PURE__ */ d("div", { className: "space-y-1.5", children: [
|
|
1129
|
-
/* @__PURE__ */ t("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Data-driven controls" }),
|
|
1130
|
-
/* @__PURE__ */ t("div", { className: "grid gap-1.5 sm:grid-cols-2", children: c.map(C) })
|
|
1131
|
-
] }),
|
|
1132
|
-
/* @__PURE__ */ t(
|
|
1133
|
-
ce,
|
|
1134
|
-
{
|
|
1135
|
-
secondary: /* @__PURE__ */ t(
|
|
1136
|
-
V,
|
|
1137
|
-
{
|
|
1138
|
-
type: "button",
|
|
1139
|
-
variant: "outline",
|
|
1140
|
-
size: "xs",
|
|
1141
|
-
onClick: fe,
|
|
1142
|
-
children: "Back to controls"
|
|
1143
|
-
}
|
|
1144
|
-
)
|
|
1145
|
-
}
|
|
1146
|
-
)
|
|
1147
|
-
] });
|
|
1148
|
-
})(),
|
|
1149
|
-
a.step === 2 && _(a.control.type) && /* @__PURE__ */ d("div", { className: "space-y-3", children: [
|
|
1150
|
-
/* @__PURE__ */ d("div", { className: "space-y-3", children: [
|
|
1151
|
-
/* @__PURE__ */ t(
|
|
1152
|
-
it,
|
|
1153
|
-
{
|
|
1154
|
-
control: a.control,
|
|
1155
|
-
onChange: (e) => ee((n) => ({
|
|
1156
|
-
...n,
|
|
1157
|
-
label: e
|
|
1158
|
-
}))
|
|
1159
|
-
}
|
|
1160
|
-
),
|
|
1161
|
-
/* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "Choose which cards should respond to this shared control." })
|
|
1162
|
-
] }),
|
|
1163
|
-
J.length === 0 ? /* @__PURE__ */ t("div", { className: "rounded-control border border-border/60 bg-muted/30 px-3 py-2.5 text-[12px] text-muted-foreground", children: "No eligible cards are available yet. Add compatible metrics or group-by fields to cards first." }) : /* @__PURE__ */ t("div", { className: "space-y-1 rounded-control border border-border/60 bg-background p-2", children: J.map((e) => {
|
|
1164
|
-
const n = (a.selectedCardIds || []).includes(e.cardId);
|
|
1165
|
-
return /* @__PURE__ */ d(
|
|
1166
|
-
"label",
|
|
1167
|
-
{
|
|
1168
|
-
className: "flex items-start gap-2 rounded-control px-1.5 py-1 text-[13px] hover:bg-muted/40",
|
|
1169
|
-
children: [
|
|
1170
|
-
/* @__PURE__ */ t(
|
|
1171
|
-
Qt,
|
|
1172
|
-
{
|
|
1173
|
-
checked: n,
|
|
1174
|
-
onCheckedChange: (l) => T(
|
|
1175
|
-
(c) => c && {
|
|
1176
|
-
...c,
|
|
1177
|
-
selectedCardIds: l === !0 ? [
|
|
1178
|
-
...c.selectedCardIds || [],
|
|
1179
|
-
e.cardId
|
|
1180
|
-
] : (c.selectedCardIds || []).filter(
|
|
1181
|
-
(C) => C !== e.cardId
|
|
1182
|
-
)
|
|
1183
|
-
}
|
|
1184
|
-
)
|
|
1185
|
-
}
|
|
1186
|
-
),
|
|
1187
|
-
/* @__PURE__ */ d("div", { className: "min-w-0", children: [
|
|
1188
|
-
/* @__PURE__ */ t("div", { className: "font-medium text-foreground", children: e.title }),
|
|
1189
|
-
/* @__PURE__ */ t("div", { className: "text-[12px] text-muted-foreground", children: a.control.type === "field_selector" ? `${e.fieldChoices.length} compatible group-by fields` : `${e.metricChoices.length} compatible metrics` })
|
|
1190
|
-
] })
|
|
1191
|
-
]
|
|
1192
|
-
},
|
|
1193
|
-
e.cardId
|
|
1194
|
-
);
|
|
1195
|
-
}) }),
|
|
1196
|
-
/* @__PURE__ */ t(
|
|
1197
|
-
ce,
|
|
1198
|
-
{
|
|
1199
|
-
secondary: /* @__PURE__ */ t(
|
|
1200
|
-
V,
|
|
1201
|
-
{
|
|
1202
|
-
type: "button",
|
|
1203
|
-
variant: "outline",
|
|
1204
|
-
size: "xs",
|
|
1205
|
-
onClick: () => T(
|
|
1206
|
-
(e) => e && {
|
|
1207
|
-
...e,
|
|
1208
|
-
step: 1,
|
|
1209
|
-
selectedCardIds: []
|
|
1210
|
-
}
|
|
1211
|
-
),
|
|
1212
|
-
children: "Back"
|
|
1213
|
-
}
|
|
1214
|
-
),
|
|
1215
|
-
primary: /* @__PURE__ */ t(
|
|
1216
|
-
V,
|
|
1217
|
-
{
|
|
1218
|
-
type: "button",
|
|
1219
|
-
size: "xs",
|
|
1220
|
-
onClick: () => T(
|
|
1221
|
-
(e) => e && {
|
|
1222
|
-
...e,
|
|
1223
|
-
step: 3
|
|
1224
|
-
}
|
|
1225
|
-
),
|
|
1226
|
-
disabled: !me,
|
|
1227
|
-
children: "Next"
|
|
1228
|
-
}
|
|
1229
|
-
)
|
|
1230
|
-
}
|
|
1231
|
-
)
|
|
1232
|
-
] }),
|
|
1233
|
-
a.step === 2 && !_(a.control.type) && /* @__PURE__ */ t(
|
|
1234
|
-
Ue,
|
|
1235
|
-
{
|
|
1236
|
-
control: a.control,
|
|
1237
|
-
defaultValue: a.defaultValue,
|
|
1238
|
-
availableFieldChoices: U.fields,
|
|
1239
|
-
availableMetricChoices: U.metrics,
|
|
1240
|
-
previewControlDefinitions: be,
|
|
1241
|
-
previewControlValues: Fe,
|
|
1242
|
-
onControlChange: (e) => ee(() => e),
|
|
1243
|
-
onLabelChange: (e) => ee((n) => ({
|
|
1244
|
-
...n,
|
|
1245
|
-
label: e
|
|
1246
|
-
})),
|
|
1247
|
-
onDefaultValueChange: Ee,
|
|
1248
|
-
onBack: () => T(
|
|
1249
|
-
(e) => e && {
|
|
1250
|
-
...e,
|
|
1251
|
-
step: 1
|
|
1252
|
-
}
|
|
1253
|
-
),
|
|
1254
|
-
onNext: Ve,
|
|
1255
|
-
nextDisabled: !me
|
|
1256
|
-
}
|
|
1257
|
-
),
|
|
1258
|
-
a.step === 3 && _(a.control.type) && /* @__PURE__ */ t(
|
|
1259
|
-
Ue,
|
|
1260
|
-
{
|
|
1261
|
-
control: a.control,
|
|
1262
|
-
defaultValue: a.defaultValue,
|
|
1263
|
-
availableFieldChoices: U.fields,
|
|
1264
|
-
availableMetricChoices: U.metrics,
|
|
1265
|
-
previewControlDefinitions: be,
|
|
1266
|
-
previewControlValues: Fe,
|
|
1267
|
-
onControlChange: (e) => ee(() => e),
|
|
1268
|
-
onLabelChange: (e) => ee((n) => ({
|
|
1269
|
-
...n,
|
|
1270
|
-
label: e
|
|
1271
|
-
})),
|
|
1272
|
-
onDefaultValueChange: Ee,
|
|
1273
|
-
onBack: () => T(
|
|
1274
|
-
(e) => e && {
|
|
1275
|
-
...e,
|
|
1276
|
-
step: 2
|
|
1277
|
-
}
|
|
1278
|
-
),
|
|
1279
|
-
onNext: Ve,
|
|
1280
|
-
nextDisabled: !me
|
|
1281
|
-
}
|
|
1282
|
-
),
|
|
1283
|
-
a.step === 3 && !_(a.control.type) && /* @__PURE__ */ t(
|
|
1284
|
-
$e,
|
|
1285
|
-
{
|
|
1286
|
-
control: a.control,
|
|
1287
|
-
scope: s,
|
|
1288
|
-
createdReference: qe,
|
|
1289
|
-
explorerContent: /* @__PURE__ */ d($, { children: [
|
|
1290
|
-
"Open the card and use",
|
|
1291
|
-
" ",
|
|
1292
|
-
/* @__PURE__ */ t("span", { className: "font-medium text-foreground", children: "Settings → Controls" }),
|
|
1293
|
-
" ",
|
|
1294
|
-
"to choose what this control changes."
|
|
1295
|
-
] }),
|
|
1296
|
-
sqlDescription: "Reference this control directly in the SQL editor.",
|
|
1297
|
-
onBack: () => T(
|
|
1298
|
-
(e) => e && {
|
|
1299
|
-
...e,
|
|
1300
|
-
step: 2
|
|
1301
|
-
}
|
|
1302
|
-
),
|
|
1303
|
-
onCancel: fe,
|
|
1304
|
-
onDone: _e
|
|
1305
|
-
}
|
|
1306
|
-
),
|
|
1307
|
-
a.step === 4 && _(a.control.type) && /* @__PURE__ */ t(
|
|
1308
|
-
$e,
|
|
1309
|
-
{
|
|
1310
|
-
control: a.control,
|
|
1311
|
-
scope: s,
|
|
1312
|
-
createdReference: qe,
|
|
1313
|
-
summaryDetail: /* @__PURE__ */ d($, { children: [
|
|
1314
|
-
"Used by ",
|
|
1315
|
-
(a.selectedCardIds || []).length,
|
|
1316
|
-
" selected card",
|
|
1317
|
-
(a.selectedCardIds || []).length === 1 ? "" : "s"
|
|
1318
|
-
] }),
|
|
1319
|
-
explorerContent: /* @__PURE__ */ t($, { children: "Selected cards have been set up to respond to this control automatically." }),
|
|
1320
|
-
sqlDescription: "SQL cards can still reference this control directly in the SQL editor.",
|
|
1321
|
-
onBack: () => T(
|
|
1322
|
-
(e) => e && {
|
|
1323
|
-
...e,
|
|
1324
|
-
step: 3
|
|
1325
|
-
}
|
|
1326
|
-
),
|
|
1327
|
-
onCancel: fe,
|
|
1328
|
-
onDone: _e
|
|
1329
|
-
}
|
|
1330
|
-
)
|
|
1331
|
-
] }) : null,
|
|
1332
|
-
!a && r.length === 0 ? /* @__PURE__ */ t("div", { className: "rounded-md border border-dashed p-3 text-sm text-muted-foreground", children: u }) : null,
|
|
1333
|
-
!a && r.map((e) => {
|
|
1334
|
-
const n = dt(e), l = y == null ? void 0 : y[e.id], c = ye({
|
|
1335
|
-
control: e,
|
|
1336
|
-
defaultValues: i
|
|
1337
|
-
}), C = pe === e.id, k = "inline-flex shrink-0 items-center rounded-[4px] border border-border/60 bg-muted/40 px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground";
|
|
1338
|
-
return /* @__PURE__ */ d(
|
|
1339
|
-
"div",
|
|
1340
|
-
{
|
|
1341
|
-
className: "rounded-control border border-border/60",
|
|
1342
|
-
children: [
|
|
1343
|
-
/* @__PURE__ */ d("div", { className: "flex items-center gap-2 px-3 py-2.5", children: [
|
|
1344
|
-
/* @__PURE__ */ d(
|
|
1345
|
-
"button",
|
|
1346
|
-
{
|
|
1347
|
-
type: "button",
|
|
1348
|
-
className: "flex min-w-0 flex-1 items-start gap-2 rounded-control text-left focus:outline-none focus-visible:bg-muted/40",
|
|
1349
|
-
onClick: () => M(
|
|
1350
|
-
(f) => f === e.id ? null : e.id
|
|
1351
|
-
),
|
|
1352
|
-
children: [
|
|
1353
|
-
C ? /* @__PURE__ */ t(Be, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }) : /* @__PURE__ */ t(je, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
1354
|
-
/* @__PURE__ */ d("div", { className: "min-w-0", children: [
|
|
1355
|
-
/* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
1356
|
-
/* @__PURE__ */ t("span", { className: "truncate text-[13px] font-medium text-foreground", children: e.label || "Untitled control" }),
|
|
1357
|
-
/* @__PURE__ */ t("span", { className: k, children: Ge(e.type).label }),
|
|
1358
|
-
/* @__PURE__ */ t("span", { className: k, children: Xe(s, e.placement) })
|
|
1359
|
-
] }),
|
|
1360
|
-
/* @__PURE__ */ d("div", { className: "mt-0.5 text-[12px] text-muted-foreground", children: [
|
|
1361
|
-
Ze(e),
|
|
1362
|
-
l != null && l.status ? ` · ${l.status}` : ""
|
|
1363
|
-
] })
|
|
1364
|
-
] })
|
|
1365
|
-
]
|
|
1366
|
-
}
|
|
1367
|
-
),
|
|
1368
|
-
/* @__PURE__ */ t(
|
|
1369
|
-
V,
|
|
1370
|
-
{
|
|
1371
|
-
type: "button",
|
|
1372
|
-
size: "xs",
|
|
1373
|
-
variant: "ghost",
|
|
1374
|
-
className: "h-7 w-7 shrink-0 p-0 text-muted-foreground",
|
|
1375
|
-
onClick: () => ut(e.id),
|
|
1376
|
-
"aria-label": `Remove ${e.label}`,
|
|
1377
|
-
children: /* @__PURE__ */ t(jt, { className: "h-3.5 w-3.5" })
|
|
1378
|
-
}
|
|
1379
|
-
)
|
|
1380
|
-
] }),
|
|
1381
|
-
C && /* @__PURE__ */ d("div", { className: "space-y-4 border-t border-border/60 px-3 py-3", children: [
|
|
1382
|
-
/* @__PURE__ */ d("div", { className: "grid gap-3 md:grid-cols-3", children: [
|
|
1383
|
-
/* @__PURE__ */ d("div", { className: "flex flex-col gap-1.5", children: [
|
|
1384
|
-
/* @__PURE__ */ t(Y, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Label" }),
|
|
1385
|
-
/* @__PURE__ */ t(
|
|
1386
|
-
Je,
|
|
1387
|
-
{
|
|
1388
|
-
size: "xs",
|
|
1389
|
-
value: e.label,
|
|
1390
|
-
placeholder: "Control label",
|
|
1391
|
-
onChange: (f) => W(e.id, (w) => ({
|
|
1392
|
-
...w,
|
|
1393
|
-
label: f.target.value
|
|
1394
|
-
}))
|
|
1395
|
-
}
|
|
1396
|
-
)
|
|
1397
|
-
] }),
|
|
1398
|
-
/* @__PURE__ */ d("div", { className: "flex flex-col gap-1.5", children: [
|
|
1399
|
-
/* @__PURE__ */ t(Y, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Type" }),
|
|
1400
|
-
/* @__PURE__ */ d(
|
|
1401
|
-
xe,
|
|
1402
|
-
{
|
|
1403
|
-
value: e.type,
|
|
1404
|
-
onValueChange: (f) => {
|
|
1405
|
-
const w = We({
|
|
1406
|
-
controls: r,
|
|
1407
|
-
controlId: e.id,
|
|
1408
|
-
nextType: f,
|
|
1409
|
-
defaultValues: i
|
|
1410
|
-
});
|
|
1411
|
-
A(w.controls, w.defaultValues);
|
|
1412
|
-
},
|
|
1413
|
-
children: [
|
|
1414
|
-
/* @__PURE__ */ t(ve, { size: "xs", children: /* @__PURE__ */ t(Ce, {}) }),
|
|
1415
|
-
/* @__PURE__ */ t(ke, { children: re(e.type).map(
|
|
1416
|
-
(f) => /* @__PURE__ */ t(
|
|
1417
|
-
Ne,
|
|
1418
|
-
{
|
|
1419
|
-
value: f.value,
|
|
1420
|
-
children: f.label
|
|
1421
|
-
},
|
|
1422
|
-
f.value
|
|
1423
|
-
)
|
|
1424
|
-
) })
|
|
1425
|
-
]
|
|
1426
|
-
}
|
|
1427
|
-
)
|
|
1428
|
-
] }),
|
|
1429
|
-
/* @__PURE__ */ d("div", { className: "flex flex-col gap-1.5", children: [
|
|
1430
|
-
/* @__PURE__ */ t(Y, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Show in" }),
|
|
1431
|
-
/* @__PURE__ */ d(
|
|
1432
|
-
xe,
|
|
1433
|
-
{
|
|
1434
|
-
value: e.placement || G,
|
|
1435
|
-
onValueChange: (f) => W(e.id, (w) => ({
|
|
1436
|
-
...w,
|
|
1437
|
-
placement: f
|
|
1438
|
-
})),
|
|
1439
|
-
children: [
|
|
1440
|
-
/* @__PURE__ */ t(ve, { size: "xs", children: /* @__PURE__ */ t(Ce, {}) }),
|
|
1441
|
-
/* @__PURE__ */ t(ke, { children: K.map((f) => /* @__PURE__ */ t(Ne, { value: f.value, children: f.label }, f.value)) })
|
|
1442
|
-
]
|
|
1443
|
-
}
|
|
1444
|
-
)
|
|
1445
|
-
] })
|
|
1446
|
-
] }),
|
|
1447
|
-
_(e.type) ? /* @__PURE__ */ t(
|
|
1448
|
-
Ut,
|
|
1449
|
-
{
|
|
1450
|
-
type: e.type,
|
|
1451
|
-
participants: ze(
|
|
1452
|
-
g || [],
|
|
1453
|
-
e.type
|
|
1454
|
-
).map((f) => ({
|
|
1455
|
-
cardId: f.cardId,
|
|
1456
|
-
title: f.title,
|
|
1457
|
-
choiceCount: e.type === "field_selector" ? f.fieldChoices.length : f.metricChoices.length
|
|
1458
|
-
})),
|
|
1459
|
-
selectedCardIds: (m == null ? void 0 : m[e.id]) || [],
|
|
1460
|
-
onChange: (f) => {
|
|
1461
|
-
const w = Te({
|
|
1462
|
-
control: e,
|
|
1463
|
-
nextSelectedCardIds: f
|
|
1464
|
-
}), F = r.map(
|
|
1465
|
-
(I) => I.id === e.id ? w.nextControl : I
|
|
1466
|
-
);
|
|
1467
|
-
A(F, i, {
|
|
1468
|
-
type: "update",
|
|
1469
|
-
cardBindingsById: w.cardBindingsById
|
|
1470
|
-
});
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
1473
|
-
) : null,
|
|
1474
|
-
/* @__PURE__ */ t(
|
|
1475
|
-
st,
|
|
1476
|
-
{
|
|
1477
|
-
control: e,
|
|
1478
|
-
availableFieldChoices: n.fields,
|
|
1479
|
-
availableMetricChoices: n.metrics,
|
|
1480
|
-
previewControlDefinitions: r,
|
|
1481
|
-
previewControlValues: he,
|
|
1482
|
-
controlLifecycle: "edit",
|
|
1483
|
-
onChange: (f) => W(e.id, () => f)
|
|
1484
|
-
}
|
|
1485
|
-
),
|
|
1486
|
-
e.initialValueStrategy === "saved_default" && /* @__PURE__ */ t(
|
|
1487
|
-
lt,
|
|
1488
|
-
{
|
|
1489
|
-
control: e,
|
|
1490
|
-
value: c,
|
|
1491
|
-
allowNoDefault: !0,
|
|
1492
|
-
allowCardDefault: !0,
|
|
1493
|
-
previewControlDefinitions: r,
|
|
1494
|
-
previewControlValues: he,
|
|
1495
|
-
onChange: (f) => {
|
|
1496
|
-
const w = r.map(
|
|
1497
|
-
(F) => F.id === e.id ? { ...F, defaultValue: f } : F
|
|
1498
|
-
);
|
|
1499
|
-
if (e.source.kind === "manual" && (E.current[e.id] = f), i) {
|
|
1500
|
-
const F = { ...i };
|
|
1501
|
-
f === void 0 ? delete F[e.id] : F[e.id] = f, A(w, F);
|
|
1502
|
-
return;
|
|
1503
|
-
}
|
|
1504
|
-
A(w, void 0);
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
),
|
|
1508
|
-
/* @__PURE__ */ d(
|
|
1509
|
-
Pt,
|
|
1510
|
-
{
|
|
1511
|
-
open: ae === e.id,
|
|
1512
|
-
onOpenChange: (f) => X(f ? e.id : null),
|
|
1513
|
-
children: [
|
|
1514
|
-
/* @__PURE__ */ t($t, { asChild: !0, children: /* @__PURE__ */ d(
|
|
1515
|
-
V,
|
|
1516
|
-
{
|
|
1517
|
-
type: "button",
|
|
1518
|
-
variant: "ghost",
|
|
1519
|
-
size: "xs",
|
|
1520
|
-
className: "-ml-2 gap-1 text-muted-foreground hover:text-foreground",
|
|
1521
|
-
children: [
|
|
1522
|
-
ae === e.id ? /* @__PURE__ */ t(Be, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(je, { className: "h-3.5 w-3.5" }),
|
|
1523
|
-
"Advanced"
|
|
1524
|
-
]
|
|
1525
|
-
}
|
|
1526
|
-
) }),
|
|
1527
|
-
/* @__PURE__ */ d(Ht, { className: "space-y-3 pt-2", children: [
|
|
1528
|
-
/* @__PURE__ */ d("div", { className: "grid gap-3 md:grid-cols-2", children: [
|
|
1529
|
-
/* @__PURE__ */ d("div", { className: "flex flex-col gap-1.5", children: [
|
|
1530
|
-
/* @__PURE__ */ t(Y, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Variable name" }),
|
|
1531
|
-
/* @__PURE__ */ t(
|
|
1532
|
-
Yt,
|
|
1533
|
-
{
|
|
1534
|
-
controlId: e.id,
|
|
1535
|
-
onCommit: (f) => ct(e.id, f)
|
|
1536
|
-
},
|
|
1537
|
-
e.id
|
|
1538
|
-
)
|
|
1539
|
-
] }),
|
|
1540
|
-
/* @__PURE__ */ d("div", { className: "flex flex-col gap-1.5", children: [
|
|
1541
|
-
/* @__PURE__ */ t(Y, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Initial value" }),
|
|
1542
|
-
/* @__PURE__ */ d(
|
|
1543
|
-
xe,
|
|
1544
|
-
{
|
|
1545
|
-
value: e.initialValueStrategy,
|
|
1546
|
-
onValueChange: (f) => W(e.id, (w) => ({
|
|
1547
|
-
...w,
|
|
1548
|
-
initialValueStrategy: f
|
|
1549
|
-
})),
|
|
1550
|
-
children: [
|
|
1551
|
-
/* @__PURE__ */ t(ve, { size: "xs", children: /* @__PURE__ */ t(Ce, {}) }),
|
|
1552
|
-
/* @__PURE__ */ t(ke, { children: It.map((f) => /* @__PURE__ */ t(
|
|
1553
|
-
Ne,
|
|
1554
|
-
{
|
|
1555
|
-
value: f.value,
|
|
1556
|
-
children: f.label
|
|
1557
|
-
},
|
|
1558
|
-
f.value
|
|
1559
|
-
)) })
|
|
1560
|
-
]
|
|
1561
|
-
}
|
|
1562
|
-
)
|
|
1563
|
-
] })
|
|
1564
|
-
] }),
|
|
1565
|
-
/* @__PURE__ */ t(
|
|
1566
|
-
Kt,
|
|
1567
|
-
{
|
|
1568
|
-
control: e,
|
|
1569
|
-
onChange: (f) => W(e.id, () => f)
|
|
1570
|
-
}
|
|
1571
|
-
)
|
|
1572
|
-
] })
|
|
1573
|
-
]
|
|
1574
|
-
}
|
|
1575
|
-
)
|
|
1576
|
-
] })
|
|
1577
|
-
]
|
|
1578
|
-
},
|
|
1579
|
-
e.id
|
|
1580
|
-
);
|
|
1581
|
-
}),
|
|
1582
|
-
!a && /* @__PURE__ */ d(
|
|
1583
|
-
V,
|
|
1584
|
-
{
|
|
1585
|
-
type: "button",
|
|
1586
|
-
variant: "outline",
|
|
1587
|
-
size: "xs",
|
|
1588
|
-
onClick: pt,
|
|
1589
|
-
children: [
|
|
1590
|
-
/* @__PURE__ */ t(Gt, { className: "h-3.5 w-3.5" }),
|
|
1591
|
-
"Add control"
|
|
1592
|
-
]
|
|
1593
|
-
}
|
|
1594
|
-
)
|
|
1595
|
-
] });
|
|
1596
|
-
}
|
|
1597
|
-
function Na(s) {
|
|
1598
|
-
const {
|
|
1599
|
-
open: r,
|
|
1600
|
-
onOpenChange: o,
|
|
1601
|
-
initialCreateFlowActive: i = !1,
|
|
1602
|
-
dismissMode: p = "passive"
|
|
1603
|
-
} = s, u = r !== void 0, [h, y] = Q(!1), [b, v] = Q(
|
|
1604
|
-
i
|
|
1605
|
-
), g = u ? r : h, m = O(
|
|
1606
|
-
(N) => {
|
|
1607
|
-
!N && b && p === "passive" || (u || y(N), N || v(!1), o == null || o(N));
|
|
1608
|
-
},
|
|
1609
|
-
[u, b, p, o]
|
|
1610
|
-
), x = O(() => {
|
|
1611
|
-
u || y(!1), v(!1), o == null || o(!1);
|
|
1612
|
-
}, [u, o]);
|
|
1613
|
-
de(() => {
|
|
1614
|
-
g || v(!1);
|
|
1615
|
-
}, [g]);
|
|
1616
|
-
const S = O(
|
|
1617
|
-
(N) => {
|
|
1618
|
-
b && N.preventDefault();
|
|
1619
|
-
},
|
|
1620
|
-
[b]
|
|
1621
|
-
);
|
|
1622
|
-
return {
|
|
1623
|
-
forceClose: x,
|
|
1624
|
-
handleOpenChange: m,
|
|
1625
|
-
isCreateFlowActive: b,
|
|
1626
|
-
preventPassiveDismissDuringCreate: S,
|
|
1627
|
-
resolvedOpen: g,
|
|
1628
|
-
setIsCreateFlowActive: v
|
|
1629
|
-
};
|
|
1630
|
-
}
|
|
1631
|
-
export {
|
|
1632
|
-
pa as C,
|
|
1633
|
-
ga as E,
|
|
1634
|
-
Jt as L,
|
|
1635
|
-
ma as R,
|
|
1636
|
-
fa as S,
|
|
1637
|
-
ba as V,
|
|
1638
|
-
va as a,
|
|
1639
|
-
ya as b,
|
|
1640
|
-
xa as c,
|
|
1641
|
-
Wt as d,
|
|
1642
|
-
ka as e,
|
|
1643
|
-
ha as f,
|
|
1644
|
-
ot as g,
|
|
1645
|
-
Ca as h,
|
|
1646
|
-
Na as u
|
|
1647
|
-
};
|