react-semaphor 0.1.534 → 0.1.535
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/brand-studio/index.js +25 -25
- package/dist/briefings/index.js +1 -1
- package/dist/chunks/{calculated-field-identity-Cz1ZU_UL.js → calculated-field-identity-BptYhyOP.js} +4 -4
- package/dist/chunks/{card-config-utils-BlIiFn0O.js → card-config-utils-C-QfuqEy.js} +50 -51
- package/dist/chunks/{dashboard-CCK80YKL.js → dashboard-B7y_WeF2.js} +1 -1
- package/dist/chunks/dashboard-briefing-launcher-DwSxDtgZ.js +4224 -0
- package/dist/chunks/{dashboard-controls-CoiTGnEr.js → dashboard-controls-CzTh9J0s.js} +862 -873
- package/dist/chunks/{dashboard-json-BRGozO--.js → dashboard-json-o6tOjNhH.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-CZFnhGZQ.js → edit-dashboard-visual-Lp_iKRGH.js} +8983 -8749
- package/dist/chunks/{index-BQl5rC54.js → index-P5aUuGF1.js} +1 -1
- package/dist/chunks/{matrix-control-sources-Tls-h3AN.js → matrix-control-sources-DTqcA2_L.js} +1 -1
- package/dist/chunks/report-preferences-dialog-BaUr346O.js +1623 -0
- package/dist/chunks/{layout-grid-CiubineE.js → save-kO6cIaob.js} +20 -2
- package/dist/chunks/{semaphor-ready-indicator-z4SNdxiC.js → semaphor-ready-indicator-B017OW6t.js} +61957 -76531
- package/dist/chunks/slider-CrLoCpsr.js +2383 -0
- package/dist/chunks/{switch-BR3Xgbqr.js → switch-ojmMsFMO.js} +4355 -4779
- package/dist/chunks/upload-CAIpsti1.js +15 -0
- package/dist/chunks/use-create-flow-overlay-state-BbwQ0gpQ.js +1457 -0
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.js +4 -4
- package/dist/index.js +221 -220
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/components/surfboard/controls/dashboard-filter-controls-launcher.d.ts +0 -1
- package/dist/types/lib/hooks/use-dashboard-query.d.ts +0 -2
- package/dist/types/lib/hooks/use-dashboard.d.ts +0 -1
- package/dist/types/lib/stores/dashboard-store.d.ts +1 -11
- package/dist/types/lib/stores/editor-store.d.ts +1 -10
- package/dist/types/lib/types/ai-context-types.d.ts +20 -0
- package/dist/types/lib/types/common-types.d.ts +1 -20
- package/dist/types/lib/types/token-types.d.ts +0 -7
- package/dist/types/lib/utils.d.ts +0 -2
- package/package.json +1 -7
- package/dist/chunks/dashboard-briefing-launcher-B9Fq2Rf3.js +0 -3489
- package/dist/chunks/editor-action-buttons-CVtSO3I3.js +0 -2067
- package/dist/chunks/report-preferences-dialog-CWdTlWsr.js +0 -1231
- package/dist/chunks/save-DgMfP0j8.js +0 -21
- package/dist/chunks/slider-DbwmuVB-.js +0 -875
- package/dist/dashboard-assistant/index.js +0 -11
- package/dist/types/dashboard-assistant/index.d.ts +0 -80
- package/dist/types/dashboard-assistant.d.ts +0 -2
- package/dist/types/lib/types/assistant-types.d.ts +0 -127
|
@@ -0,0 +1,1457 @@
|
|
|
1
|
+
import { c as Z, C as De } from "./x-CXDkqdur.js";
|
|
2
|
+
import { useEffect as K, forwardRef as st, useMemo as H, useState as M, useRef as se, useCallback as F, Fragment as ot } from "react";
|
|
3
|
+
import { a1 as ze, a2 as dt, u as it, n as Me, o as Re, p as je, c as R, q as Be, a3 as $e, B as L, a4 as ct, a5 as ut, a6 as G, a7 as we, a8 as Te, a9 as oe, aa as de, ab as mt, ac as pt, ad as _e, ae as ft, af as ht, ag as J, ah as gt, ai as Ee, aj as Ue, ak as Qe, al as Ye, m as z, r as He, s as ie, t as ce, v as ue, w as me, x as pe, am as Xe, an as bt, ao as xt, ap as Ve, aq as vt, ar as Le, as as yt, at as Ct, au as kt, av as Nt, aw as fe } from "./switch-ojmMsFMO.js";
|
|
4
|
+
import { ar as St, u as Dt, as as wt, at as Tt, au as Ie, av as _t, aw as Et, ax as Ge, ay as Je, az as Vt, aA as Lt, aB as It, aC as Ft, aD as At, aE as qt } from "./semaphor-ready-indicator-B017OW6t.js";
|
|
5
|
+
import { jsx as t, jsxs as o, Fragment as X } from "react/jsx-runtime";
|
|
6
|
+
import "./validators-DMSH81OM.js";
|
|
7
|
+
import "./matrix-operation-contract-BKupLHXL.js";
|
|
8
|
+
import "zod";
|
|
9
|
+
import "../value-format-preferences/index.js";
|
|
10
|
+
import { C as Fe } from "./selection-reducer-CiDEtmAq.js";
|
|
11
|
+
/**
|
|
12
|
+
* @license lucide-react v0.453.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/
|
|
17
|
+
const Ot = Z("CircleCheck", [
|
|
18
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
19
|
+
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
|
|
20
|
+
]);
|
|
21
|
+
/**
|
|
22
|
+
* @license lucide-react v0.453.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/
|
|
27
|
+
const ea = Z("FilterX", [
|
|
28
|
+
["path", { d: "M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055", key: "1fi1da" }],
|
|
29
|
+
["path", { d: "m22 3-5 5", key: "12jva0" }],
|
|
30
|
+
["path", { d: "m17 3 5 5", key: "k36vhe" }]
|
|
31
|
+
]);
|
|
32
|
+
/**
|
|
33
|
+
* @license lucide-react v0.453.0 - ISC
|
|
34
|
+
*
|
|
35
|
+
* This source code is licensed under the ISC license.
|
|
36
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
+
*/
|
|
38
|
+
const zt = Z("Library", [
|
|
39
|
+
["path", { d: "m16 6 4 14", key: "ji33uf" }],
|
|
40
|
+
["path", { d: "M12 6v14", key: "1n7gus" }],
|
|
41
|
+
["path", { d: "M8 8v12", key: "1gg7y9" }],
|
|
42
|
+
["path", { d: "M4 4v16", key: "6qkkli" }]
|
|
43
|
+
]);
|
|
44
|
+
/**
|
|
45
|
+
* @license lucide-react v0.453.0 - ISC
|
|
46
|
+
*
|
|
47
|
+
* This source code is licensed under the ISC license.
|
|
48
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
49
|
+
*/
|
|
50
|
+
const Mt = Z("Link2", [
|
|
51
|
+
["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
|
|
52
|
+
["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
|
|
53
|
+
["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
|
|
54
|
+
]), he = /* @__PURE__ */ new Set();
|
|
55
|
+
function ta(s) {
|
|
56
|
+
return he.add(s), () => {
|
|
57
|
+
he.delete(s);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function aa() {
|
|
61
|
+
he.forEach((s) => {
|
|
62
|
+
s();
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function ra() {
|
|
66
|
+
const s = ze((g) => g.card.dataSource), {
|
|
67
|
+
setSelectedConnectionId: n,
|
|
68
|
+
setSelectedDatabaseName: u,
|
|
69
|
+
setSelectedSchemaName: i,
|
|
70
|
+
setSelectedTableName: k,
|
|
71
|
+
setSelectedDatamodelId: b
|
|
72
|
+
} = dt();
|
|
73
|
+
K(() => {
|
|
74
|
+
var T;
|
|
75
|
+
if (!s) return;
|
|
76
|
+
const { tableName: g, schemaName: v, databaseName: p, connectionId: N } = St(s), x = (T = s.selectedEntities) == null ? void 0 : T[0], S = (x == null ? void 0 : x.type) === "model" && "id" in x ? x.id : "";
|
|
77
|
+
n(N || ""), u(p || ""), i(v || ""), k(g || ""), b(S);
|
|
78
|
+
}, [
|
|
79
|
+
s,
|
|
80
|
+
n,
|
|
81
|
+
u,
|
|
82
|
+
i,
|
|
83
|
+
k,
|
|
84
|
+
b
|
|
85
|
+
]);
|
|
86
|
+
}
|
|
87
|
+
function la({
|
|
88
|
+
type: s,
|
|
89
|
+
isLinked: n,
|
|
90
|
+
className: u,
|
|
91
|
+
showLabel: i = !1,
|
|
92
|
+
showLocal: k = !1
|
|
93
|
+
}) {
|
|
94
|
+
const b = it((I) => I.selectedFrameId), g = Dt((I) => I.selectedVisual), v = ze((I) => I.frame);
|
|
95
|
+
let p;
|
|
96
|
+
if (s)
|
|
97
|
+
p = s;
|
|
98
|
+
else if (n !== void 0)
|
|
99
|
+
p = n ? "linked" : "library";
|
|
100
|
+
else if (!!!(v != null && v.visualId || g != null && g.id) && b)
|
|
101
|
+
p = "local";
|
|
102
|
+
else if (g && !b)
|
|
103
|
+
p = "library";
|
|
104
|
+
else if (v != null && v.visualId && b)
|
|
105
|
+
p = "linked";
|
|
106
|
+
else if (g != null && g.id && b)
|
|
107
|
+
p = "library";
|
|
108
|
+
else
|
|
109
|
+
return null;
|
|
110
|
+
if (p === "local" && !k)
|
|
111
|
+
return null;
|
|
112
|
+
const N = {
|
|
113
|
+
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",
|
|
114
|
+
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",
|
|
115
|
+
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"
|
|
116
|
+
}, x = {
|
|
117
|
+
local: "Local to this dashboard: Changes made here only affect this dashboard copy.",
|
|
118
|
+
linked: "Linked to library: Changes made here update the library visual and all linked instances.",
|
|
119
|
+
library: "Library visual: Share and reuse this visual across multiple dashboards."
|
|
120
|
+
}, f = {
|
|
121
|
+
local: "border-slate-200 bg-slate-50 text-slate-900 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100",
|
|
122
|
+
linked: "border-purple-200 bg-purple-50 text-purple-900 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-100",
|
|
123
|
+
library: "border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-100"
|
|
124
|
+
}, S = {
|
|
125
|
+
local: "fill-slate-50 dark:fill-slate-900",
|
|
126
|
+
linked: "fill-purple-50 dark:fill-purple-950",
|
|
127
|
+
library: "fill-blue-50 dark:fill-blue-950"
|
|
128
|
+
}, T = {
|
|
129
|
+
local: /* @__PURE__ */ t("span", { className: "h-2 w-2 rounded-full bg-current/70" }),
|
|
130
|
+
linked: /* @__PURE__ */ t(Mt, { className: "h-3.5 w-3.5" }),
|
|
131
|
+
library: /* @__PURE__ */ t(zt, { className: "h-3.5 w-3.5" })
|
|
132
|
+
}, _ = {
|
|
133
|
+
local: "Local",
|
|
134
|
+
linked: "Linked",
|
|
135
|
+
library: "Library"
|
|
136
|
+
};
|
|
137
|
+
return /* @__PURE__ */ t(Me, { children: /* @__PURE__ */ o(Re, { delayDuration: 300, children: [
|
|
138
|
+
/* @__PURE__ */ t(je, { asChild: !0, children: /* @__PURE__ */ o(
|
|
139
|
+
wt,
|
|
140
|
+
{
|
|
141
|
+
variant: "outline",
|
|
142
|
+
className: R(
|
|
143
|
+
"cursor-help select-none transition-all",
|
|
144
|
+
N[p],
|
|
145
|
+
u
|
|
146
|
+
),
|
|
147
|
+
children: [
|
|
148
|
+
T[p],
|
|
149
|
+
i && /* @__PURE__ */ t("span", { className: "ml-1 text-xs font-medium leading-none", children: _[p] })
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
) }),
|
|
153
|
+
/* @__PURE__ */ o(
|
|
154
|
+
Be,
|
|
155
|
+
{
|
|
156
|
+
side: "bottom",
|
|
157
|
+
className: R("max-w-xs", f[p]),
|
|
158
|
+
children: [
|
|
159
|
+
/* @__PURE__ */ t($e, { className: S[p] }),
|
|
160
|
+
/* @__PURE__ */ t("p", { children: x[p] })
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
] }) });
|
|
165
|
+
}
|
|
166
|
+
const Rt = st(
|
|
167
|
+
({
|
|
168
|
+
side: s = "bottom",
|
|
169
|
+
children: n,
|
|
170
|
+
className: u,
|
|
171
|
+
tooltip: i,
|
|
172
|
+
onClick: k,
|
|
173
|
+
openDelay: b = 300,
|
|
174
|
+
buttonProps: g,
|
|
175
|
+
disabled: v,
|
|
176
|
+
...p
|
|
177
|
+
}, N) => /* @__PURE__ */ t(Me, { children: /* @__PURE__ */ o(Re, { delayDuration: b, children: [
|
|
178
|
+
/* @__PURE__ */ t(je, { asChild: !0, children: /* @__PURE__ */ t(
|
|
179
|
+
L,
|
|
180
|
+
{
|
|
181
|
+
disabled: v,
|
|
182
|
+
ref: N,
|
|
183
|
+
size: "sm",
|
|
184
|
+
variant: "ghost",
|
|
185
|
+
onClick: k,
|
|
186
|
+
...p,
|
|
187
|
+
...g,
|
|
188
|
+
className: R(`${ct}`, u),
|
|
189
|
+
children: n
|
|
190
|
+
}
|
|
191
|
+
) }),
|
|
192
|
+
i && /* @__PURE__ */ o(
|
|
193
|
+
Be,
|
|
194
|
+
{
|
|
195
|
+
side: s,
|
|
196
|
+
sideOffset: 10,
|
|
197
|
+
className: R(
|
|
198
|
+
"border-foreground/20 bg-foreground text-background"
|
|
199
|
+
),
|
|
200
|
+
children: [
|
|
201
|
+
i,
|
|
202
|
+
/* @__PURE__ */ t($e, { className: "fill-foreground" })
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
] }) })
|
|
207
|
+
);
|
|
208
|
+
Rt.displayName = "IconButton";
|
|
209
|
+
function Ke(s) {
|
|
210
|
+
const { control: n, onChange: u } = s;
|
|
211
|
+
return /* @__PURE__ */ o("div", { className: "flex flex-col gap-1.5", children: [
|
|
212
|
+
/* @__PURE__ */ t(z, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Label" }),
|
|
213
|
+
/* @__PURE__ */ t(
|
|
214
|
+
He,
|
|
215
|
+
{
|
|
216
|
+
size: "xs",
|
|
217
|
+
value: n.label,
|
|
218
|
+
placeholder: "Control label",
|
|
219
|
+
onChange: (i) => u(i.target.value)
|
|
220
|
+
}
|
|
221
|
+
)
|
|
222
|
+
] });
|
|
223
|
+
}
|
|
224
|
+
function jt(s) {
|
|
225
|
+
const { currentStep: n, labels: u } = s;
|
|
226
|
+
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: u.map((i, k) => {
|
|
227
|
+
const b = k + 1, g = b === n, v = b < n;
|
|
228
|
+
return /* @__PURE__ */ o(ot, { children: [
|
|
229
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-1.5", children: [
|
|
230
|
+
/* @__PURE__ */ t(
|
|
231
|
+
"span",
|
|
232
|
+
{
|
|
233
|
+
className: R(
|
|
234
|
+
"flex h-5 w-5 items-center justify-center rounded-full border text-[10px] font-medium tabular-nums",
|
|
235
|
+
g ? "border-foreground bg-foreground text-background" : v ? "border-foreground/30 bg-foreground/10 text-foreground" : "border-border/60 bg-background text-muted-foreground"
|
|
236
|
+
),
|
|
237
|
+
children: b
|
|
238
|
+
}
|
|
239
|
+
),
|
|
240
|
+
/* @__PURE__ */ t(
|
|
241
|
+
"span",
|
|
242
|
+
{
|
|
243
|
+
className: R(
|
|
244
|
+
"text-[12px]",
|
|
245
|
+
g ? "font-medium text-foreground" : "text-muted-foreground"
|
|
246
|
+
),
|
|
247
|
+
children: i
|
|
248
|
+
}
|
|
249
|
+
)
|
|
250
|
+
] }),
|
|
251
|
+
k < u.length - 1 ? /* @__PURE__ */ t(
|
|
252
|
+
"span",
|
|
253
|
+
{
|
|
254
|
+
className: "h-px w-4 bg-border/60 sm:w-6",
|
|
255
|
+
"aria-hidden": "true"
|
|
256
|
+
}
|
|
257
|
+
) : null
|
|
258
|
+
] }, i);
|
|
259
|
+
}) }) });
|
|
260
|
+
}
|
|
261
|
+
function W(s) {
|
|
262
|
+
const { secondary: n, tertiary: u, primary: i } = s;
|
|
263
|
+
return /* @__PURE__ */ o("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: [
|
|
264
|
+
n,
|
|
265
|
+
u,
|
|
266
|
+
i
|
|
267
|
+
] });
|
|
268
|
+
}
|
|
269
|
+
function Bt(s) {
|
|
270
|
+
const { control: n, scope: u, detail: i } = s;
|
|
271
|
+
return /* @__PURE__ */ o("div", { className: "flex items-start gap-2.5 rounded-control border border-border/60 bg-muted/30 px-3 py-2.5", children: [
|
|
272
|
+
/* @__PURE__ */ t(Ot, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-foreground" }),
|
|
273
|
+
/* @__PURE__ */ o("div", { className: "min-w-0 space-y-0.5", children: [
|
|
274
|
+
/* @__PURE__ */ t("div", { className: "text-[13px] font-medium text-foreground", children: n.label }),
|
|
275
|
+
/* @__PURE__ */ o("div", { className: "text-[12px] text-muted-foreground", children: [
|
|
276
|
+
Ue(n.type).label,
|
|
277
|
+
" ·",
|
|
278
|
+
" ",
|
|
279
|
+
Ye(n),
|
|
280
|
+
" ·",
|
|
281
|
+
" ",
|
|
282
|
+
Qe(u, n.placement)
|
|
283
|
+
] }),
|
|
284
|
+
i ? /* @__PURE__ */ t("div", { className: "text-[12px] text-muted-foreground", children: i }) : null
|
|
285
|
+
] })
|
|
286
|
+
] });
|
|
287
|
+
}
|
|
288
|
+
function Ae(s) {
|
|
289
|
+
const {
|
|
290
|
+
control: n,
|
|
291
|
+
defaultValue: u,
|
|
292
|
+
availableFieldChoices: i,
|
|
293
|
+
availableMetricChoices: k,
|
|
294
|
+
previewControlDefinitions: b,
|
|
295
|
+
previewControlValues: g,
|
|
296
|
+
onControlChange: v,
|
|
297
|
+
onLabelChange: p,
|
|
298
|
+
onDefaultValueChange: N,
|
|
299
|
+
onBack: x,
|
|
300
|
+
onNext: f,
|
|
301
|
+
nextDisabled: S
|
|
302
|
+
} = s;
|
|
303
|
+
return /* @__PURE__ */ o("div", { className: "space-y-3", children: [
|
|
304
|
+
/* @__PURE__ */ t(Ke, { control: n, onChange: p }),
|
|
305
|
+
/* @__PURE__ */ t(
|
|
306
|
+
Ge,
|
|
307
|
+
{
|
|
308
|
+
control: n,
|
|
309
|
+
availableFieldChoices: i,
|
|
310
|
+
availableMetricChoices: k,
|
|
311
|
+
previewControlDefinitions: b,
|
|
312
|
+
previewControlValues: g,
|
|
313
|
+
controlLifecycle: "create",
|
|
314
|
+
onChange: v
|
|
315
|
+
}
|
|
316
|
+
),
|
|
317
|
+
/* @__PURE__ */ t(
|
|
318
|
+
Je,
|
|
319
|
+
{
|
|
320
|
+
control: n,
|
|
321
|
+
value: u,
|
|
322
|
+
onChange: N,
|
|
323
|
+
allowNoDefault: !0,
|
|
324
|
+
allowCardDefault: !0,
|
|
325
|
+
hint: "This is the value viewers will see first.",
|
|
326
|
+
previewControlDefinitions: b,
|
|
327
|
+
previewControlValues: g
|
|
328
|
+
}
|
|
329
|
+
),
|
|
330
|
+
/* @__PURE__ */ t(
|
|
331
|
+
W,
|
|
332
|
+
{
|
|
333
|
+
secondary: /* @__PURE__ */ t(L, { type: "button", variant: "outline", size: "xs", onClick: x, children: "Back" }),
|
|
334
|
+
primary: /* @__PURE__ */ t(
|
|
335
|
+
L,
|
|
336
|
+
{
|
|
337
|
+
type: "button",
|
|
338
|
+
size: "xs",
|
|
339
|
+
onClick: f,
|
|
340
|
+
disabled: S,
|
|
341
|
+
children: "Next"
|
|
342
|
+
}
|
|
343
|
+
)
|
|
344
|
+
}
|
|
345
|
+
)
|
|
346
|
+
] });
|
|
347
|
+
}
|
|
348
|
+
const $t = /* @__PURE__ */ new Set([
|
|
349
|
+
"grain_selector",
|
|
350
|
+
"aggregation_selector",
|
|
351
|
+
"field_selector",
|
|
352
|
+
"metric_selector"
|
|
353
|
+
]);
|
|
354
|
+
function qe(s) {
|
|
355
|
+
const { text: n, ariaLabel: u } = s, [i, k] = M(!1);
|
|
356
|
+
return /* @__PURE__ */ o(
|
|
357
|
+
"button",
|
|
358
|
+
{
|
|
359
|
+
type: "button",
|
|
360
|
+
"aria-label": u,
|
|
361
|
+
onClick: async () => {
|
|
362
|
+
try {
|
|
363
|
+
await navigator.clipboard.writeText(n), k(!0), setTimeout(() => k(!1), 1200);
|
|
364
|
+
} catch (b) {
|
|
365
|
+
console.error("Failed to copy", b);
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
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",
|
|
369
|
+
children: [
|
|
370
|
+
/* @__PURE__ */ t("code", { className: "min-w-0 truncate font-mono text-[12px] text-foreground", children: n }),
|
|
371
|
+
/* @__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" })
|
|
372
|
+
]
|
|
373
|
+
}
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
function Oe(s) {
|
|
377
|
+
const {
|
|
378
|
+
control: n,
|
|
379
|
+
scope: u,
|
|
380
|
+
createdReference: i,
|
|
381
|
+
explorerContent: k,
|
|
382
|
+
sqlDescription: b,
|
|
383
|
+
summaryDetail: g,
|
|
384
|
+
onBack: v,
|
|
385
|
+
onCancel: p,
|
|
386
|
+
onDone: N
|
|
387
|
+
} = s, x = $t.has(n.type), f = i.match(/\[\[param\.(.+?)\]\]/), S = f ? `{{ param('${f[1]}') }}` : "";
|
|
388
|
+
return /* @__PURE__ */ o("div", { className: "space-y-4", children: [
|
|
389
|
+
/* @__PURE__ */ t(
|
|
390
|
+
Bt,
|
|
391
|
+
{
|
|
392
|
+
control: n,
|
|
393
|
+
scope: u,
|
|
394
|
+
detail: g
|
|
395
|
+
}
|
|
396
|
+
),
|
|
397
|
+
/* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
398
|
+
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-foreground", children: "How cards use this control" }),
|
|
399
|
+
/* @__PURE__ */ o("div", { className: "divide-y divide-border/60 overflow-hidden rounded-control border border-border/60", children: [
|
|
400
|
+
x ? /* @__PURE__ */ o("div", { className: "space-y-1 px-3 py-2.5", children: [
|
|
401
|
+
/* @__PURE__ */ t("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Explorer cards" }),
|
|
402
|
+
/* @__PURE__ */ t("div", { className: "text-[12px] text-muted-foreground", children: k })
|
|
403
|
+
] }) : null,
|
|
404
|
+
/* @__PURE__ */ o("div", { className: "space-y-1.5 px-3 py-2.5", children: [
|
|
405
|
+
/* @__PURE__ */ t("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "SQL cards" }),
|
|
406
|
+
/* @__PURE__ */ t(
|
|
407
|
+
qe,
|
|
408
|
+
{
|
|
409
|
+
text: i,
|
|
410
|
+
ariaLabel: "Copy SQL control reference"
|
|
411
|
+
}
|
|
412
|
+
),
|
|
413
|
+
S ? /* @__PURE__ */ t(
|
|
414
|
+
qe,
|
|
415
|
+
{
|
|
416
|
+
text: S,
|
|
417
|
+
ariaLabel: "Copy Jinja control reference"
|
|
418
|
+
}
|
|
419
|
+
) : null,
|
|
420
|
+
/* @__PURE__ */ o("p", { className: "text-[12px] text-muted-foreground", children: [
|
|
421
|
+
b,
|
|
422
|
+
" ",
|
|
423
|
+
/* @__PURE__ */ t(
|
|
424
|
+
"a",
|
|
425
|
+
{
|
|
426
|
+
href: "https://docs.semaphor.cloud/docs/concepts/template-expressions",
|
|
427
|
+
target: "_blank",
|
|
428
|
+
rel: "noreferrer",
|
|
429
|
+
className: "underline underline-offset-2 hover:text-foreground",
|
|
430
|
+
children: "Template expressions docs"
|
|
431
|
+
}
|
|
432
|
+
),
|
|
433
|
+
"."
|
|
434
|
+
] })
|
|
435
|
+
] })
|
|
436
|
+
] })
|
|
437
|
+
] }),
|
|
438
|
+
/* @__PURE__ */ t(
|
|
439
|
+
W,
|
|
440
|
+
{
|
|
441
|
+
secondary: /* @__PURE__ */ t(L, { type: "button", variant: "outline", size: "xs", onClick: v, children: "Back" }),
|
|
442
|
+
tertiary: /* @__PURE__ */ t(L, { type: "button", variant: "outline", size: "xs", onClick: p, children: "Cancel" }),
|
|
443
|
+
primary: /* @__PURE__ */ t(L, { type: "button", size: "xs", onClick: N, children: "Done" })
|
|
444
|
+
}
|
|
445
|
+
)
|
|
446
|
+
] });
|
|
447
|
+
}
|
|
448
|
+
function Ut(s) {
|
|
449
|
+
const n = G(
|
|
450
|
+
s.scope,
|
|
451
|
+
s.existingControls,
|
|
452
|
+
s.reservedIds
|
|
453
|
+
), u = s.type === n.type ? {
|
|
454
|
+
...n,
|
|
455
|
+
label: fe[s.type]
|
|
456
|
+
} : {
|
|
457
|
+
...Xe({
|
|
458
|
+
controls: [
|
|
459
|
+
{
|
|
460
|
+
...n,
|
|
461
|
+
label: fe[s.type]
|
|
462
|
+
}
|
|
463
|
+
],
|
|
464
|
+
controlId: n.id,
|
|
465
|
+
nextType: s.type
|
|
466
|
+
}).controls[0],
|
|
467
|
+
label: fe[s.type]
|
|
468
|
+
};
|
|
469
|
+
return {
|
|
470
|
+
step: 2,
|
|
471
|
+
control: u,
|
|
472
|
+
defaultValue: J(u, void 0)
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
function na({
|
|
476
|
+
scope: s,
|
|
477
|
+
controls: n,
|
|
478
|
+
reservedControlIds: u,
|
|
479
|
+
defaultValues: i,
|
|
480
|
+
onChange: k,
|
|
481
|
+
emptyMessage: b,
|
|
482
|
+
initialCreateFlow: g = !1,
|
|
483
|
+
usageByControlId: v,
|
|
484
|
+
availableFieldChoices: p,
|
|
485
|
+
availableMetricChoices: N,
|
|
486
|
+
structuralParticipants: x,
|
|
487
|
+
structuralParticipantIdsByControlId: f,
|
|
488
|
+
card: S,
|
|
489
|
+
allowedControlTypes: T,
|
|
490
|
+
onCreateFlowActiveChange: _,
|
|
491
|
+
onCreateFlowComplete: I
|
|
492
|
+
}) {
|
|
493
|
+
const A = H(
|
|
494
|
+
() => new Set(u || []),
|
|
495
|
+
[u]
|
|
496
|
+
), We = bt(s), Ze = ut(s), [ge, P] = M(
|
|
497
|
+
null
|
|
498
|
+
), [Pe, U] = M(
|
|
499
|
+
null
|
|
500
|
+
), [a, D] = M(
|
|
501
|
+
() => g ? {
|
|
502
|
+
step: 1,
|
|
503
|
+
control: G(s, n, Array.from(A))
|
|
504
|
+
} : null
|
|
505
|
+
), Q = se({}), j = se(void 0), be = se(g), xe = H(() => {
|
|
506
|
+
const e = we({ scope: s, card: S });
|
|
507
|
+
if (!T)
|
|
508
|
+
return e;
|
|
509
|
+
const l = new Set(T);
|
|
510
|
+
return e.filter((r) => l.has(r.value));
|
|
511
|
+
}, [T, S, s]), et = F(
|
|
512
|
+
(e) => {
|
|
513
|
+
const l = we({
|
|
514
|
+
scope: s,
|
|
515
|
+
card: S,
|
|
516
|
+
includeType: T ? void 0 : e
|
|
517
|
+
});
|
|
518
|
+
if (!T)
|
|
519
|
+
return l;
|
|
520
|
+
const r = new Set(T);
|
|
521
|
+
return l.filter((d) => r.has(d.value));
|
|
522
|
+
},
|
|
523
|
+
[T, S, s]
|
|
524
|
+
), V = F(
|
|
525
|
+
(e) => s === "dashboard" && (e === "field_selector" || e === "metric_selector"),
|
|
526
|
+
[s]
|
|
527
|
+
), ee = H(
|
|
528
|
+
() => a ? Te(
|
|
529
|
+
x || [],
|
|
530
|
+
a.control.type
|
|
531
|
+
) : [],
|
|
532
|
+
[a, x]
|
|
533
|
+
), Y = H(() => {
|
|
534
|
+
if (!a)
|
|
535
|
+
return {
|
|
536
|
+
fields: p || [],
|
|
537
|
+
metrics: N || []
|
|
538
|
+
};
|
|
539
|
+
if (!V(a.control.type))
|
|
540
|
+
return {
|
|
541
|
+
fields: p || [],
|
|
542
|
+
metrics: N || []
|
|
543
|
+
};
|
|
544
|
+
const e = a.selectedCardIds || [], l = oe({
|
|
545
|
+
controlType: a.control.type,
|
|
546
|
+
participants: x || [],
|
|
547
|
+
selectedCardIds: e
|
|
548
|
+
});
|
|
549
|
+
return {
|
|
550
|
+
fields: a.control.type === "field_selector" ? l.choices.map((r) => ({
|
|
551
|
+
option: r,
|
|
552
|
+
target: l.fieldTargetMap[r.value]
|
|
553
|
+
})) : [],
|
|
554
|
+
metrics: a.control.type === "metric_selector" ? l.choices.map((r) => ({
|
|
555
|
+
option: r,
|
|
556
|
+
target: l.metricTargetMap[r.value]
|
|
557
|
+
})) : []
|
|
558
|
+
};
|
|
559
|
+
}, [
|
|
560
|
+
p,
|
|
561
|
+
N,
|
|
562
|
+
a,
|
|
563
|
+
V,
|
|
564
|
+
x
|
|
565
|
+
]);
|
|
566
|
+
K(() => {
|
|
567
|
+
_ == null || _(!!a);
|
|
568
|
+
}, [a, _]), K(() => {
|
|
569
|
+
const e = g && !be.current;
|
|
570
|
+
be.current = g, e && (D({
|
|
571
|
+
step: 1,
|
|
572
|
+
control: G(s, n, Array.from(A))
|
|
573
|
+
}), U(null), P(null));
|
|
574
|
+
}, [n, g, A, s]);
|
|
575
|
+
const tt = (e) => {
|
|
576
|
+
if (!V(e.type))
|
|
577
|
+
return {
|
|
578
|
+
fields: p || [],
|
|
579
|
+
metrics: N || []
|
|
580
|
+
};
|
|
581
|
+
const l = (f == null ? void 0 : f[e.id]) || [];
|
|
582
|
+
if (l.length === 0)
|
|
583
|
+
return {
|
|
584
|
+
fields: p || [],
|
|
585
|
+
metrics: N || []
|
|
586
|
+
};
|
|
587
|
+
const r = oe({
|
|
588
|
+
controlType: e.type,
|
|
589
|
+
participants: x || [],
|
|
590
|
+
selectedCardIds: l
|
|
591
|
+
});
|
|
592
|
+
return {
|
|
593
|
+
fields: e.type === "field_selector" ? r.choices.map((d) => ({
|
|
594
|
+
option: d,
|
|
595
|
+
target: r.fieldTargetMap[d.value]
|
|
596
|
+
})) : [],
|
|
597
|
+
metrics: e.type === "metric_selector" ? r.choices.map((d) => ({
|
|
598
|
+
option: d,
|
|
599
|
+
target: r.metricTargetMap[d.value]
|
|
600
|
+
})) : []
|
|
601
|
+
};
|
|
602
|
+
}, te = (e) => {
|
|
603
|
+
if (!V(e.control.type))
|
|
604
|
+
return {
|
|
605
|
+
nextControl: e.control,
|
|
606
|
+
cardBindingsById: void 0
|
|
607
|
+
};
|
|
608
|
+
const l = (f == null ? void 0 : f[e.control.id]) || [], r = oe({
|
|
609
|
+
controlType: e.control.type,
|
|
610
|
+
participants: x || [],
|
|
611
|
+
selectedCardIds: e.nextSelectedCardIds
|
|
612
|
+
}), d = kt({
|
|
613
|
+
control: e.control,
|
|
614
|
+
choices: r.choices
|
|
615
|
+
}), m = Object.fromEntries(
|
|
616
|
+
l.filter((h) => !e.nextSelectedCardIds.includes(h)).map((h) => [h, void 0])
|
|
617
|
+
);
|
|
618
|
+
return e.nextSelectedCardIds.length > 0 && d.source.kind === "manual" && d.source.options.length > 0 && Object.assign(
|
|
619
|
+
m,
|
|
620
|
+
Le({
|
|
621
|
+
control: d,
|
|
622
|
+
participants: x || [],
|
|
623
|
+
selectedCardIds: e.nextSelectedCardIds,
|
|
624
|
+
matrixTargetIds: e.matrixTargetIds
|
|
625
|
+
})
|
|
626
|
+
), {
|
|
627
|
+
nextControl: d,
|
|
628
|
+
cardBindingsById: m
|
|
629
|
+
};
|
|
630
|
+
}, E = F(
|
|
631
|
+
(e, l = i, r = { type: "update" }) => {
|
|
632
|
+
const d = e.map((m) => (de({
|
|
633
|
+
control: m,
|
|
634
|
+
defaultValues: l
|
|
635
|
+
}), mt(
|
|
636
|
+
m
|
|
637
|
+
)));
|
|
638
|
+
k(d, l, r);
|
|
639
|
+
},
|
|
640
|
+
[i, k]
|
|
641
|
+
), B = (e, l) => {
|
|
642
|
+
const r = n.find(
|
|
643
|
+
(C) => C.id === e
|
|
644
|
+
);
|
|
645
|
+
let d = n.map((C) => C.id !== e ? C : l(C));
|
|
646
|
+
const m = d.find(
|
|
647
|
+
(C) => C.id === e
|
|
648
|
+
);
|
|
649
|
+
let h, c;
|
|
650
|
+
if (m && (!r || yt({ control: r }, { control: m })) && s === "dashboard" && (m.type === "field_selector" || m.type === "metric_selector")) {
|
|
651
|
+
const C = (f == null ? void 0 : f[m.id]) || [], O = te({
|
|
652
|
+
control: m,
|
|
653
|
+
nextSelectedCardIds: C
|
|
654
|
+
});
|
|
655
|
+
d = d.map(
|
|
656
|
+
(q) => q.id === e ? O.nextControl : q
|
|
657
|
+
), h = O.cardBindingsById, c = [m.id];
|
|
658
|
+
} else if (r && (!m || !Ct(m.type)) && s === "dashboard" && (r.type === "field_selector" || r.type === "metric_selector")) {
|
|
659
|
+
const C = (f == null ? void 0 : f[r.id]) || [];
|
|
660
|
+
h = Object.fromEntries(
|
|
661
|
+
C.map((O) => [O, void 0])
|
|
662
|
+
), c = [r.id];
|
|
663
|
+
}
|
|
664
|
+
const y = d.find(
|
|
665
|
+
(C) => C.id === e
|
|
666
|
+
);
|
|
667
|
+
let w = i;
|
|
668
|
+
if (r && y) {
|
|
669
|
+
const C = de({
|
|
670
|
+
control: r,
|
|
671
|
+
defaultValues: i
|
|
672
|
+
});
|
|
673
|
+
r.source.kind === "manual" && y.source.kind === "sql_query" && (Q.current[e] = C);
|
|
674
|
+
const O = C === void 0 && r.source.kind === "sql_query" && y.source.kind === "manual" ? Q.current[e] : C, q = Ve({
|
|
675
|
+
previousControl: r,
|
|
676
|
+
nextControl: y,
|
|
677
|
+
currentDefaultValue: O
|
|
678
|
+
});
|
|
679
|
+
y.source.kind === "manual" && (Q.current[e] = q), i && (w = { ...i }, q === void 0 ? delete w[e] : w[e] = q), d = d.map(
|
|
680
|
+
(Se) => Se.id === e ? { ...y, defaultValue: q } : Se
|
|
681
|
+
);
|
|
682
|
+
}
|
|
683
|
+
E(d, w, {
|
|
684
|
+
type: "update",
|
|
685
|
+
cardBindingsById: h,
|
|
686
|
+
affectedBindingControlIds: c
|
|
687
|
+
});
|
|
688
|
+
}, at = (e, l) => {
|
|
689
|
+
if (!l.trim())
|
|
690
|
+
return;
|
|
691
|
+
const r = Nt(l);
|
|
692
|
+
if (r === e || A.has(r) || n.some(
|
|
693
|
+
(h) => h.id === r && h.id !== e
|
|
694
|
+
))
|
|
695
|
+
return;
|
|
696
|
+
const d = n.map(
|
|
697
|
+
(h) => h.id === e ? { ...h, id: r } : h
|
|
698
|
+
);
|
|
699
|
+
if (!i) {
|
|
700
|
+
E(d, void 0, {
|
|
701
|
+
type: "rename",
|
|
702
|
+
oldId: e,
|
|
703
|
+
newId: r
|
|
704
|
+
});
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
const m = { ...i };
|
|
708
|
+
Object.prototype.hasOwnProperty.call(m, e) && (m[r] = m[e], delete m[e]), E(d, m, {
|
|
709
|
+
type: "rename",
|
|
710
|
+
oldId: e,
|
|
711
|
+
newId: r
|
|
712
|
+
});
|
|
713
|
+
}, rt = (e) => {
|
|
714
|
+
const l = n.filter((d) => d.id !== e);
|
|
715
|
+
if (!i) {
|
|
716
|
+
E(l, void 0, { type: "remove", controlId: e });
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
const r = { ...i };
|
|
720
|
+
delete r[e], E(l, r, { type: "remove", controlId: e });
|
|
721
|
+
}, lt = F(() => {
|
|
722
|
+
j.current = void 0, D({
|
|
723
|
+
step: 1,
|
|
724
|
+
control: G(s, n, Array.from(A))
|
|
725
|
+
}), U(null), P(null);
|
|
726
|
+
}, [n, A, s]), $ = (e) => {
|
|
727
|
+
D(
|
|
728
|
+
(l) => l && (() => {
|
|
729
|
+
const r = e(l.control);
|
|
730
|
+
l.control.source.kind === "manual" && r.source.kind === "sql_query" && (j.current = l.defaultValue);
|
|
731
|
+
const d = l.defaultValue === void 0 && l.control.source.kind === "sql_query" && r.source.kind === "manual" ? j.current : l.defaultValue, m = Ve({
|
|
732
|
+
previousControl: l.control,
|
|
733
|
+
nextControl: r,
|
|
734
|
+
currentDefaultValue: d
|
|
735
|
+
});
|
|
736
|
+
return r.source.kind === "manual" && (j.current = m), {
|
|
737
|
+
...l,
|
|
738
|
+
control: r,
|
|
739
|
+
defaultValue: m
|
|
740
|
+
};
|
|
741
|
+
})()
|
|
742
|
+
);
|
|
743
|
+
}, ve = (e) => {
|
|
744
|
+
D(
|
|
745
|
+
(l) => l && (l.control.source.kind === "manual" && (j.current = e), {
|
|
746
|
+
...l,
|
|
747
|
+
defaultValue: e
|
|
748
|
+
})
|
|
749
|
+
);
|
|
750
|
+
}, ae = (() => {
|
|
751
|
+
if (!a)
|
|
752
|
+
return !1;
|
|
753
|
+
if (a.step === 2 && V(a.control.type))
|
|
754
|
+
return (a.selectedCardIds || []).length > 0 && pt({
|
|
755
|
+
participants: x || [],
|
|
756
|
+
selectedCardIds: a.selectedCardIds || [],
|
|
757
|
+
control: a.control,
|
|
758
|
+
selected: a.matrixTargetIds
|
|
759
|
+
});
|
|
760
|
+
if (a.step !== 2 && a.step !== 3 || !a.control.label.trim())
|
|
761
|
+
return !1;
|
|
762
|
+
const l = a.control.source.kind === "sql_query" ? a.control : _e(a.control);
|
|
763
|
+
if (l.source.kind === "manual" && (ft(l) && l.source.options.length === 0 || l.source.options.some(
|
|
764
|
+
(d) => d.label.trim().length === 0 || d.value.trim().length === 0
|
|
765
|
+
)))
|
|
766
|
+
return !1;
|
|
767
|
+
if (l.source.kind === "sql_query") {
|
|
768
|
+
const { connectionId: r, sql: d, valueColumn: m } = l.source;
|
|
769
|
+
return r.trim().length > 0 && d.trim().length > 0 && m.trim().length > 0;
|
|
770
|
+
}
|
|
771
|
+
return ht(
|
|
772
|
+
J(l, a.defaultValue)
|
|
773
|
+
);
|
|
774
|
+
})(), ye = () => {
|
|
775
|
+
var h;
|
|
776
|
+
if (!a)
|
|
777
|
+
return;
|
|
778
|
+
const e = _e(a.control), l = vt({
|
|
779
|
+
label: e.label,
|
|
780
|
+
fallbackId: e.id,
|
|
781
|
+
existingControls: n,
|
|
782
|
+
reservedIds: Array.from(A)
|
|
783
|
+
}), r = {
|
|
784
|
+
...e,
|
|
785
|
+
id: l
|
|
786
|
+
}, d = s === "dashboard" && (r.type === "field_selector" || r.type === "metric_selector") && ((h = a.selectedCardIds) != null && h.length) ? Le({
|
|
787
|
+
control: r,
|
|
788
|
+
participants: x || [],
|
|
789
|
+
selectedCardIds: a.selectedCardIds,
|
|
790
|
+
matrixTargetIds: a.matrixTargetIds
|
|
791
|
+
}) : void 0, m = J(
|
|
792
|
+
r,
|
|
793
|
+
a.defaultValue
|
|
794
|
+
);
|
|
795
|
+
D({
|
|
796
|
+
step: s === "dashboard" && (r.type === "field_selector" || r.type === "metric_selector") ? 4 : 3,
|
|
797
|
+
control: r,
|
|
798
|
+
defaultValue: m,
|
|
799
|
+
createdControlId: l,
|
|
800
|
+
selectedCardIds: a.selectedCardIds,
|
|
801
|
+
matrixTargetIds: a.matrixTargetIds,
|
|
802
|
+
cardBindingsById: d
|
|
803
|
+
});
|
|
804
|
+
}, re = F(() => {
|
|
805
|
+
D(null);
|
|
806
|
+
}, []), Ce = F(() => {
|
|
807
|
+
if (!(a != null && a.createdControlId)) {
|
|
808
|
+
D(null);
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
const e = a.control, l = a.createdControlId, r = J(
|
|
812
|
+
e,
|
|
813
|
+
a.defaultValue
|
|
814
|
+
);
|
|
815
|
+
if (i) {
|
|
816
|
+
const d = { ...i };
|
|
817
|
+
r === void 0 ? delete d[l] : d[l] = r, E(
|
|
818
|
+
[
|
|
819
|
+
...n,
|
|
820
|
+
{
|
|
821
|
+
...e,
|
|
822
|
+
defaultValue: r
|
|
823
|
+
}
|
|
824
|
+
],
|
|
825
|
+
d,
|
|
826
|
+
{
|
|
827
|
+
type: "add",
|
|
828
|
+
cardBindingsById: a.cardBindingsById
|
|
829
|
+
}
|
|
830
|
+
);
|
|
831
|
+
} else
|
|
832
|
+
E(
|
|
833
|
+
[
|
|
834
|
+
...n,
|
|
835
|
+
{
|
|
836
|
+
...e,
|
|
837
|
+
defaultValue: r
|
|
838
|
+
}
|
|
839
|
+
],
|
|
840
|
+
void 0,
|
|
841
|
+
{
|
|
842
|
+
type: "add",
|
|
843
|
+
cardBindingsById: a.cardBindingsById
|
|
844
|
+
}
|
|
845
|
+
);
|
|
846
|
+
U(l), D(null), I == null || I();
|
|
847
|
+
}, [n, a, i, E, I]), nt = a ? V(a.control.type) ? ["Choose type", "Select cards", "Configure", "Finish"] : ["Choose type", "Configure", "Finish"] : [], ke = a != null && a.createdControlId ? `[[param.${a.createdControlId}]]` : a ? `[[param.${gt(a.control.label) || a.control.id}]]` : "", le = Ee({
|
|
848
|
+
controls: n,
|
|
849
|
+
defaultValues: i
|
|
850
|
+
}), ne = a ? [...n, a.control] : n, Ne = a ? Ee({
|
|
851
|
+
controls: ne,
|
|
852
|
+
defaultValues: i,
|
|
853
|
+
overrides: [
|
|
854
|
+
{
|
|
855
|
+
controlId: a.control.id,
|
|
856
|
+
value: a.defaultValue
|
|
857
|
+
}
|
|
858
|
+
]
|
|
859
|
+
}) : le;
|
|
860
|
+
return /* @__PURE__ */ o("div", { className: "space-y-4", children: [
|
|
861
|
+
a ? /* @__PURE__ */ o("div", { className: "space-y-4 pb-1", children: [
|
|
862
|
+
/* @__PURE__ */ t(
|
|
863
|
+
jt,
|
|
864
|
+
{
|
|
865
|
+
currentStep: a.step,
|
|
866
|
+
labels: nt
|
|
867
|
+
}
|
|
868
|
+
),
|
|
869
|
+
a.step === 1 && (() => {
|
|
870
|
+
const e = /* @__PURE__ */ new Set([
|
|
871
|
+
"grain_selector",
|
|
872
|
+
"aggregation_selector",
|
|
873
|
+
"field_selector",
|
|
874
|
+
"metric_selector"
|
|
875
|
+
]), l = /* @__PURE__ */ new Set([
|
|
876
|
+
// Temporarily hide these from the add-control dialog while
|
|
877
|
+
// keeping the shared definitions for existing controls.
|
|
878
|
+
"date",
|
|
879
|
+
"text"
|
|
880
|
+
]), r = xe.filter(
|
|
881
|
+
(h) => !e.has(h.value) && !l.has(h.value)
|
|
882
|
+
), d = xe.filter(
|
|
883
|
+
(h) => e.has(h.value)
|
|
884
|
+
), m = (h) => /* @__PURE__ */ o(
|
|
885
|
+
"button",
|
|
886
|
+
{
|
|
887
|
+
type: "button",
|
|
888
|
+
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",
|
|
889
|
+
onClick: () => D(
|
|
890
|
+
Ut({
|
|
891
|
+
scope: s,
|
|
892
|
+
existingControls: n,
|
|
893
|
+
reservedIds: Array.from(A),
|
|
894
|
+
type: h.value
|
|
895
|
+
})
|
|
896
|
+
),
|
|
897
|
+
children: [
|
|
898
|
+
/* @__PURE__ */ t("div", { className: "text-[13px] font-medium text-foreground", children: h.label }),
|
|
899
|
+
/* @__PURE__ */ t("p", { className: "mt-0.5 text-[12px] text-muted-foreground", children: h.description })
|
|
900
|
+
]
|
|
901
|
+
},
|
|
902
|
+
h.value
|
|
903
|
+
);
|
|
904
|
+
return /* @__PURE__ */ o("div", { className: "space-y-4", children: [
|
|
905
|
+
s === "card" && (S == null ? void 0 : S.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,
|
|
906
|
+
r.length > 0 && /* @__PURE__ */ o("div", { className: "space-y-1.5", children: [
|
|
907
|
+
/* @__PURE__ */ t("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Input controls" }),
|
|
908
|
+
/* @__PURE__ */ t("div", { className: "grid gap-1.5 sm:grid-cols-2", children: r.map(m) })
|
|
909
|
+
] }),
|
|
910
|
+
d.length > 0 && /* @__PURE__ */ o("div", { className: "space-y-1.5", children: [
|
|
911
|
+
/* @__PURE__ */ t("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Data-driven controls" }),
|
|
912
|
+
/* @__PURE__ */ t("div", { className: "grid gap-1.5 sm:grid-cols-2", children: d.map(m) })
|
|
913
|
+
] }),
|
|
914
|
+
/* @__PURE__ */ t(
|
|
915
|
+
W,
|
|
916
|
+
{
|
|
917
|
+
secondary: /* @__PURE__ */ t(
|
|
918
|
+
L,
|
|
919
|
+
{
|
|
920
|
+
type: "button",
|
|
921
|
+
variant: "outline",
|
|
922
|
+
size: "xs",
|
|
923
|
+
onClick: re,
|
|
924
|
+
children: "Back to controls"
|
|
925
|
+
}
|
|
926
|
+
)
|
|
927
|
+
}
|
|
928
|
+
)
|
|
929
|
+
] });
|
|
930
|
+
})(),
|
|
931
|
+
a.step === 2 && V(a.control.type) && /* @__PURE__ */ o("div", { className: "space-y-3", children: [
|
|
932
|
+
/* @__PURE__ */ o("div", { className: "space-y-3", children: [
|
|
933
|
+
/* @__PURE__ */ t(
|
|
934
|
+
Ke,
|
|
935
|
+
{
|
|
936
|
+
control: a.control,
|
|
937
|
+
onChange: (e) => $((l) => ({
|
|
938
|
+
...l,
|
|
939
|
+
label: e
|
|
940
|
+
}))
|
|
941
|
+
}
|
|
942
|
+
),
|
|
943
|
+
/* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "Choose which cards should respond to this shared control." })
|
|
944
|
+
] }),
|
|
945
|
+
ee.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: ee.map((e) => {
|
|
946
|
+
const l = (a.selectedCardIds || []).includes(e.cardId);
|
|
947
|
+
return /* @__PURE__ */ o(
|
|
948
|
+
"label",
|
|
949
|
+
{
|
|
950
|
+
className: "flex items-start gap-2 rounded-control px-1.5 py-1 text-[13px] hover:bg-muted/40",
|
|
951
|
+
children: [
|
|
952
|
+
/* @__PURE__ */ t(
|
|
953
|
+
Tt,
|
|
954
|
+
{
|
|
955
|
+
checked: l,
|
|
956
|
+
onCheckedChange: (r) => D(
|
|
957
|
+
(d) => d && {
|
|
958
|
+
...d,
|
|
959
|
+
selectedCardIds: r === !0 ? [
|
|
960
|
+
...d.selectedCardIds || [],
|
|
961
|
+
e.cardId
|
|
962
|
+
] : (d.selectedCardIds || []).filter(
|
|
963
|
+
(m) => m !== e.cardId
|
|
964
|
+
)
|
|
965
|
+
}
|
|
966
|
+
)
|
|
967
|
+
}
|
|
968
|
+
),
|
|
969
|
+
/* @__PURE__ */ o("div", { className: "min-w-0", children: [
|
|
970
|
+
/* @__PURE__ */ t("div", { className: "font-medium text-foreground", children: e.title }),
|
|
971
|
+
/* @__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` })
|
|
972
|
+
] })
|
|
973
|
+
]
|
|
974
|
+
},
|
|
975
|
+
e.cardId
|
|
976
|
+
);
|
|
977
|
+
}) }),
|
|
978
|
+
/* @__PURE__ */ t(
|
|
979
|
+
Ie,
|
|
980
|
+
{
|
|
981
|
+
participants: ee,
|
|
982
|
+
selectedCardIds: a.selectedCardIds || [],
|
|
983
|
+
control: a.control,
|
|
984
|
+
selected: a.matrixTargetIds,
|
|
985
|
+
onChange: (e, l) => D((r) => r && { ...r, matrixTargetIds: { ...r.matrixTargetIds, [e]: l } })
|
|
986
|
+
}
|
|
987
|
+
),
|
|
988
|
+
/* @__PURE__ */ t(
|
|
989
|
+
W,
|
|
990
|
+
{
|
|
991
|
+
secondary: /* @__PURE__ */ t(
|
|
992
|
+
L,
|
|
993
|
+
{
|
|
994
|
+
type: "button",
|
|
995
|
+
variant: "outline",
|
|
996
|
+
size: "xs",
|
|
997
|
+
onClick: () => D(
|
|
998
|
+
(e) => e && {
|
|
999
|
+
...e,
|
|
1000
|
+
step: 1,
|
|
1001
|
+
selectedCardIds: []
|
|
1002
|
+
}
|
|
1003
|
+
),
|
|
1004
|
+
children: "Back"
|
|
1005
|
+
}
|
|
1006
|
+
),
|
|
1007
|
+
primary: /* @__PURE__ */ t(
|
|
1008
|
+
L,
|
|
1009
|
+
{
|
|
1010
|
+
type: "button",
|
|
1011
|
+
size: "xs",
|
|
1012
|
+
onClick: () => D(
|
|
1013
|
+
(e) => e && {
|
|
1014
|
+
...e,
|
|
1015
|
+
step: 3
|
|
1016
|
+
}
|
|
1017
|
+
),
|
|
1018
|
+
disabled: !ae,
|
|
1019
|
+
children: "Next"
|
|
1020
|
+
}
|
|
1021
|
+
)
|
|
1022
|
+
}
|
|
1023
|
+
)
|
|
1024
|
+
] }),
|
|
1025
|
+
a.step === 2 && !V(a.control.type) && /* @__PURE__ */ t(
|
|
1026
|
+
Ae,
|
|
1027
|
+
{
|
|
1028
|
+
control: a.control,
|
|
1029
|
+
defaultValue: a.defaultValue,
|
|
1030
|
+
availableFieldChoices: Y.fields,
|
|
1031
|
+
availableMetricChoices: Y.metrics,
|
|
1032
|
+
previewControlDefinitions: ne,
|
|
1033
|
+
previewControlValues: Ne,
|
|
1034
|
+
onControlChange: (e) => $(() => e),
|
|
1035
|
+
onLabelChange: (e) => $((l) => ({
|
|
1036
|
+
...l,
|
|
1037
|
+
label: e
|
|
1038
|
+
})),
|
|
1039
|
+
onDefaultValueChange: ve,
|
|
1040
|
+
onBack: () => D(
|
|
1041
|
+
(e) => e && {
|
|
1042
|
+
...e,
|
|
1043
|
+
step: 1
|
|
1044
|
+
}
|
|
1045
|
+
),
|
|
1046
|
+
onNext: ye,
|
|
1047
|
+
nextDisabled: !ae
|
|
1048
|
+
}
|
|
1049
|
+
),
|
|
1050
|
+
a.step === 3 && V(a.control.type) && /* @__PURE__ */ t(
|
|
1051
|
+
Ae,
|
|
1052
|
+
{
|
|
1053
|
+
control: a.control,
|
|
1054
|
+
defaultValue: a.defaultValue,
|
|
1055
|
+
availableFieldChoices: Y.fields,
|
|
1056
|
+
availableMetricChoices: Y.metrics,
|
|
1057
|
+
previewControlDefinitions: ne,
|
|
1058
|
+
previewControlValues: Ne,
|
|
1059
|
+
onControlChange: (e) => $(() => e),
|
|
1060
|
+
onLabelChange: (e) => $((l) => ({
|
|
1061
|
+
...l,
|
|
1062
|
+
label: e
|
|
1063
|
+
})),
|
|
1064
|
+
onDefaultValueChange: ve,
|
|
1065
|
+
onBack: () => D(
|
|
1066
|
+
(e) => e && {
|
|
1067
|
+
...e,
|
|
1068
|
+
step: 2
|
|
1069
|
+
}
|
|
1070
|
+
),
|
|
1071
|
+
onNext: ye,
|
|
1072
|
+
nextDisabled: !ae
|
|
1073
|
+
}
|
|
1074
|
+
),
|
|
1075
|
+
a.step === 3 && !V(a.control.type) && /* @__PURE__ */ t(
|
|
1076
|
+
Oe,
|
|
1077
|
+
{
|
|
1078
|
+
control: a.control,
|
|
1079
|
+
scope: s,
|
|
1080
|
+
createdReference: ke,
|
|
1081
|
+
explorerContent: /* @__PURE__ */ o(X, { children: [
|
|
1082
|
+
"Open the card and use",
|
|
1083
|
+
" ",
|
|
1084
|
+
/* @__PURE__ */ t("span", { className: "font-medium text-foreground", children: "Settings → Controls" }),
|
|
1085
|
+
" ",
|
|
1086
|
+
"to choose what this control changes."
|
|
1087
|
+
] }),
|
|
1088
|
+
sqlDescription: "Reference this control directly in the SQL editor.",
|
|
1089
|
+
onBack: () => D(
|
|
1090
|
+
(e) => e && {
|
|
1091
|
+
...e,
|
|
1092
|
+
step: 2
|
|
1093
|
+
}
|
|
1094
|
+
),
|
|
1095
|
+
onCancel: re,
|
|
1096
|
+
onDone: Ce
|
|
1097
|
+
}
|
|
1098
|
+
),
|
|
1099
|
+
a.step === 4 && V(a.control.type) && /* @__PURE__ */ t(
|
|
1100
|
+
Oe,
|
|
1101
|
+
{
|
|
1102
|
+
control: a.control,
|
|
1103
|
+
scope: s,
|
|
1104
|
+
createdReference: ke,
|
|
1105
|
+
summaryDetail: /* @__PURE__ */ o(X, { children: [
|
|
1106
|
+
"Used by ",
|
|
1107
|
+
(a.selectedCardIds || []).length,
|
|
1108
|
+
" selected card",
|
|
1109
|
+
(a.selectedCardIds || []).length === 1 ? "" : "s"
|
|
1110
|
+
] }),
|
|
1111
|
+
explorerContent: /* @__PURE__ */ t(X, { children: "Selected cards have been set up to respond to this control automatically." }),
|
|
1112
|
+
sqlDescription: "SQL cards can still reference this control directly in the SQL editor.",
|
|
1113
|
+
onBack: () => D(
|
|
1114
|
+
(e) => e && {
|
|
1115
|
+
...e,
|
|
1116
|
+
step: 3
|
|
1117
|
+
}
|
|
1118
|
+
),
|
|
1119
|
+
onCancel: re,
|
|
1120
|
+
onDone: Ce
|
|
1121
|
+
}
|
|
1122
|
+
)
|
|
1123
|
+
] }) : null,
|
|
1124
|
+
!a && n.length === 0 ? /* @__PURE__ */ t("div", { className: "rounded-md border border-dashed p-3 text-sm text-muted-foreground", children: b }) : null,
|
|
1125
|
+
!a && n.map((e) => {
|
|
1126
|
+
const l = tt(e), r = v == null ? void 0 : v[e.id], d = de({
|
|
1127
|
+
control: e,
|
|
1128
|
+
defaultValues: i
|
|
1129
|
+
}), m = Pe === e.id, h = "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";
|
|
1130
|
+
return /* @__PURE__ */ o(
|
|
1131
|
+
"div",
|
|
1132
|
+
{
|
|
1133
|
+
className: "rounded-control border border-border/60",
|
|
1134
|
+
children: [
|
|
1135
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-2 px-3 py-2.5", children: [
|
|
1136
|
+
/* @__PURE__ */ o(
|
|
1137
|
+
"button",
|
|
1138
|
+
{
|
|
1139
|
+
type: "button",
|
|
1140
|
+
className: "flex min-w-0 flex-1 items-start gap-2 rounded-control text-left focus:outline-none focus-visible:bg-muted/40",
|
|
1141
|
+
onClick: () => U(
|
|
1142
|
+
(c) => c === e.id ? null : e.id
|
|
1143
|
+
),
|
|
1144
|
+
children: [
|
|
1145
|
+
m ? /* @__PURE__ */ t(De, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }) : /* @__PURE__ */ t(Fe, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
1146
|
+
/* @__PURE__ */ o("div", { className: "min-w-0", children: [
|
|
1147
|
+
/* @__PURE__ */ o("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
1148
|
+
/* @__PURE__ */ t("span", { className: "truncate text-[13px] font-medium text-foreground", children: e.label || "Untitled control" }),
|
|
1149
|
+
/* @__PURE__ */ t("span", { className: h, children: Ue(e.type).label }),
|
|
1150
|
+
/* @__PURE__ */ t("span", { className: h, children: Qe(s, e.placement) })
|
|
1151
|
+
] }),
|
|
1152
|
+
/* @__PURE__ */ o("div", { className: "mt-0.5 text-[12px] text-muted-foreground", children: [
|
|
1153
|
+
Ye(e),
|
|
1154
|
+
r != null && r.status ? ` · ${r.status}` : ""
|
|
1155
|
+
] })
|
|
1156
|
+
] })
|
|
1157
|
+
]
|
|
1158
|
+
}
|
|
1159
|
+
),
|
|
1160
|
+
/* @__PURE__ */ t(
|
|
1161
|
+
L,
|
|
1162
|
+
{
|
|
1163
|
+
type: "button",
|
|
1164
|
+
size: "xs",
|
|
1165
|
+
variant: "ghost",
|
|
1166
|
+
className: "h-7 w-7 shrink-0 p-0 text-muted-foreground",
|
|
1167
|
+
onClick: () => rt(e.id),
|
|
1168
|
+
"aria-label": `Remove ${e.label}`,
|
|
1169
|
+
children: /* @__PURE__ */ t(_t, { className: "h-3.5 w-3.5" })
|
|
1170
|
+
}
|
|
1171
|
+
)
|
|
1172
|
+
] }),
|
|
1173
|
+
m && /* @__PURE__ */ o("div", { className: "space-y-4 border-t border-border/60 px-3 py-3", children: [
|
|
1174
|
+
/* @__PURE__ */ o("div", { className: "grid gap-3 md:grid-cols-3", children: [
|
|
1175
|
+
/* @__PURE__ */ o("div", { className: "flex flex-col gap-1.5", children: [
|
|
1176
|
+
/* @__PURE__ */ t(z, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Label" }),
|
|
1177
|
+
/* @__PURE__ */ t(
|
|
1178
|
+
He,
|
|
1179
|
+
{
|
|
1180
|
+
size: "xs",
|
|
1181
|
+
value: e.label,
|
|
1182
|
+
placeholder: "Control label",
|
|
1183
|
+
onChange: (c) => B(e.id, (y) => ({
|
|
1184
|
+
...y,
|
|
1185
|
+
label: c.target.value
|
|
1186
|
+
}))
|
|
1187
|
+
}
|
|
1188
|
+
)
|
|
1189
|
+
] }),
|
|
1190
|
+
/* @__PURE__ */ o("div", { className: "flex flex-col gap-1.5", children: [
|
|
1191
|
+
/* @__PURE__ */ t(z, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Type" }),
|
|
1192
|
+
/* @__PURE__ */ o(
|
|
1193
|
+
ie,
|
|
1194
|
+
{
|
|
1195
|
+
value: e.type,
|
|
1196
|
+
onValueChange: (c) => {
|
|
1197
|
+
const y = Xe({
|
|
1198
|
+
controls: n,
|
|
1199
|
+
controlId: e.id,
|
|
1200
|
+
nextType: c,
|
|
1201
|
+
defaultValues: i
|
|
1202
|
+
});
|
|
1203
|
+
E(y.controls, y.defaultValues);
|
|
1204
|
+
},
|
|
1205
|
+
children: [
|
|
1206
|
+
/* @__PURE__ */ t(ce, { size: "xs", children: /* @__PURE__ */ t(ue, {}) }),
|
|
1207
|
+
/* @__PURE__ */ t(me, { children: et(e.type).map(
|
|
1208
|
+
(c) => /* @__PURE__ */ t(
|
|
1209
|
+
pe,
|
|
1210
|
+
{
|
|
1211
|
+
value: c.value,
|
|
1212
|
+
children: c.label
|
|
1213
|
+
},
|
|
1214
|
+
c.value
|
|
1215
|
+
)
|
|
1216
|
+
) })
|
|
1217
|
+
]
|
|
1218
|
+
}
|
|
1219
|
+
)
|
|
1220
|
+
] }),
|
|
1221
|
+
/* @__PURE__ */ o("div", { className: "flex flex-col gap-1.5", children: [
|
|
1222
|
+
/* @__PURE__ */ t(z, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Show in" }),
|
|
1223
|
+
/* @__PURE__ */ o(
|
|
1224
|
+
ie,
|
|
1225
|
+
{
|
|
1226
|
+
value: e.placement || Ze,
|
|
1227
|
+
onValueChange: (c) => B(e.id, (y) => ({
|
|
1228
|
+
...y,
|
|
1229
|
+
placement: c
|
|
1230
|
+
})),
|
|
1231
|
+
children: [
|
|
1232
|
+
/* @__PURE__ */ t(ce, { size: "xs", children: /* @__PURE__ */ t(ue, {}) }),
|
|
1233
|
+
/* @__PURE__ */ t(me, { children: We.map((c) => /* @__PURE__ */ t(pe, { value: c.value, children: c.label }, c.value)) })
|
|
1234
|
+
]
|
|
1235
|
+
}
|
|
1236
|
+
)
|
|
1237
|
+
] })
|
|
1238
|
+
] }),
|
|
1239
|
+
V(e.type) ? /* @__PURE__ */ o(X, { children: [
|
|
1240
|
+
/* @__PURE__ */ t(
|
|
1241
|
+
Et,
|
|
1242
|
+
{
|
|
1243
|
+
type: e.type,
|
|
1244
|
+
participants: Te(
|
|
1245
|
+
x || [],
|
|
1246
|
+
e.type
|
|
1247
|
+
).map((c) => ({
|
|
1248
|
+
cardId: c.cardId,
|
|
1249
|
+
title: c.title,
|
|
1250
|
+
choiceCount: e.type === "field_selector" ? c.fieldChoices.length : c.metricChoices.length
|
|
1251
|
+
})),
|
|
1252
|
+
selectedCardIds: (f == null ? void 0 : f[e.id]) || [],
|
|
1253
|
+
onChange: (c) => {
|
|
1254
|
+
const y = te({
|
|
1255
|
+
control: e,
|
|
1256
|
+
nextSelectedCardIds: c
|
|
1257
|
+
}), w = n.map(
|
|
1258
|
+
(C) => C.id === e.id ? y.nextControl : C
|
|
1259
|
+
);
|
|
1260
|
+
E(w, i, {
|
|
1261
|
+
type: "update",
|
|
1262
|
+
cardBindingsById: y.cardBindingsById
|
|
1263
|
+
});
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
),
|
|
1267
|
+
/* @__PURE__ */ t(
|
|
1268
|
+
Ie,
|
|
1269
|
+
{
|
|
1270
|
+
participants: x || [],
|
|
1271
|
+
selectedCardIds: (f == null ? void 0 : f[e.id]) || [],
|
|
1272
|
+
control: e,
|
|
1273
|
+
onChange: (c, y) => {
|
|
1274
|
+
const w = te({
|
|
1275
|
+
control: e,
|
|
1276
|
+
nextSelectedCardIds: (f == null ? void 0 : f[e.id]) || [],
|
|
1277
|
+
matrixTargetIds: { [c]: y }
|
|
1278
|
+
});
|
|
1279
|
+
E(
|
|
1280
|
+
n.map((C) => C.id === e.id ? w.nextControl : C),
|
|
1281
|
+
i,
|
|
1282
|
+
{ type: "update", cardBindingsById: w.cardBindingsById }
|
|
1283
|
+
);
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
)
|
|
1287
|
+
] }) : null,
|
|
1288
|
+
/* @__PURE__ */ t(
|
|
1289
|
+
Ge,
|
|
1290
|
+
{
|
|
1291
|
+
control: e,
|
|
1292
|
+
availableFieldChoices: l.fields,
|
|
1293
|
+
availableMetricChoices: l.metrics,
|
|
1294
|
+
previewControlDefinitions: n,
|
|
1295
|
+
previewControlValues: le,
|
|
1296
|
+
controlLifecycle: "edit",
|
|
1297
|
+
onChange: (c) => B(e.id, () => c)
|
|
1298
|
+
}
|
|
1299
|
+
),
|
|
1300
|
+
e.initialValueStrategy === "saved_default" && /* @__PURE__ */ t(
|
|
1301
|
+
Je,
|
|
1302
|
+
{
|
|
1303
|
+
control: e,
|
|
1304
|
+
value: d,
|
|
1305
|
+
allowNoDefault: !0,
|
|
1306
|
+
allowCardDefault: !0,
|
|
1307
|
+
previewControlDefinitions: n,
|
|
1308
|
+
previewControlValues: le,
|
|
1309
|
+
onChange: (c) => {
|
|
1310
|
+
const y = n.map(
|
|
1311
|
+
(w) => w.id === e.id ? { ...w, defaultValue: c } : w
|
|
1312
|
+
);
|
|
1313
|
+
if (e.source.kind === "manual" && (Q.current[e.id] = c), i) {
|
|
1314
|
+
const w = { ...i };
|
|
1315
|
+
c === void 0 ? delete w[e.id] : w[e.id] = c, E(y, w);
|
|
1316
|
+
return;
|
|
1317
|
+
}
|
|
1318
|
+
E(y, void 0);
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
),
|
|
1322
|
+
/* @__PURE__ */ o(
|
|
1323
|
+
Vt,
|
|
1324
|
+
{
|
|
1325
|
+
open: ge === e.id,
|
|
1326
|
+
onOpenChange: (c) => P(c ? e.id : null),
|
|
1327
|
+
children: [
|
|
1328
|
+
/* @__PURE__ */ t(Lt, { asChild: !0, children: /* @__PURE__ */ o(
|
|
1329
|
+
L,
|
|
1330
|
+
{
|
|
1331
|
+
type: "button",
|
|
1332
|
+
variant: "ghost",
|
|
1333
|
+
size: "xs",
|
|
1334
|
+
className: "-ml-2 gap-1 text-muted-foreground hover:text-foreground",
|
|
1335
|
+
children: [
|
|
1336
|
+
ge === e.id ? /* @__PURE__ */ t(De, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(Fe, { className: "h-3.5 w-3.5" }),
|
|
1337
|
+
"Advanced"
|
|
1338
|
+
]
|
|
1339
|
+
}
|
|
1340
|
+
) }),
|
|
1341
|
+
/* @__PURE__ */ o(It, { className: "space-y-3 pt-2", children: [
|
|
1342
|
+
/* @__PURE__ */ o("div", { className: "grid gap-3 md:grid-cols-2", children: [
|
|
1343
|
+
/* @__PURE__ */ o("div", { className: "flex flex-col gap-1.5", children: [
|
|
1344
|
+
/* @__PURE__ */ t(z, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Variable name" }),
|
|
1345
|
+
/* @__PURE__ */ t(
|
|
1346
|
+
Ft,
|
|
1347
|
+
{
|
|
1348
|
+
controlId: e.id,
|
|
1349
|
+
onCommit: (c) => at(e.id, c)
|
|
1350
|
+
},
|
|
1351
|
+
e.id
|
|
1352
|
+
)
|
|
1353
|
+
] }),
|
|
1354
|
+
/* @__PURE__ */ o("div", { className: "flex flex-col gap-1.5", children: [
|
|
1355
|
+
/* @__PURE__ */ t(z, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Initial value" }),
|
|
1356
|
+
/* @__PURE__ */ o(
|
|
1357
|
+
ie,
|
|
1358
|
+
{
|
|
1359
|
+
value: e.initialValueStrategy,
|
|
1360
|
+
onValueChange: (c) => B(e.id, (y) => ({
|
|
1361
|
+
...y,
|
|
1362
|
+
initialValueStrategy: c
|
|
1363
|
+
})),
|
|
1364
|
+
children: [
|
|
1365
|
+
/* @__PURE__ */ t(ce, { size: "xs", children: /* @__PURE__ */ t(ue, {}) }),
|
|
1366
|
+
/* @__PURE__ */ t(me, { children: xt.map((c) => /* @__PURE__ */ t(
|
|
1367
|
+
pe,
|
|
1368
|
+
{
|
|
1369
|
+
value: c.value,
|
|
1370
|
+
children: c.label
|
|
1371
|
+
},
|
|
1372
|
+
c.value
|
|
1373
|
+
)) })
|
|
1374
|
+
]
|
|
1375
|
+
}
|
|
1376
|
+
)
|
|
1377
|
+
] })
|
|
1378
|
+
] }),
|
|
1379
|
+
/* @__PURE__ */ t(
|
|
1380
|
+
At,
|
|
1381
|
+
{
|
|
1382
|
+
control: e,
|
|
1383
|
+
onChange: (c) => B(e.id, () => c)
|
|
1384
|
+
}
|
|
1385
|
+
)
|
|
1386
|
+
] })
|
|
1387
|
+
]
|
|
1388
|
+
}
|
|
1389
|
+
)
|
|
1390
|
+
] })
|
|
1391
|
+
]
|
|
1392
|
+
},
|
|
1393
|
+
e.id
|
|
1394
|
+
);
|
|
1395
|
+
}),
|
|
1396
|
+
!a && /* @__PURE__ */ o(
|
|
1397
|
+
L,
|
|
1398
|
+
{
|
|
1399
|
+
type: "button",
|
|
1400
|
+
variant: "outline",
|
|
1401
|
+
size: "xs",
|
|
1402
|
+
onClick: lt,
|
|
1403
|
+
children: [
|
|
1404
|
+
/* @__PURE__ */ t(qt, { className: "h-3.5 w-3.5" }),
|
|
1405
|
+
"Add control"
|
|
1406
|
+
]
|
|
1407
|
+
}
|
|
1408
|
+
)
|
|
1409
|
+
] });
|
|
1410
|
+
}
|
|
1411
|
+
function sa(s) {
|
|
1412
|
+
const {
|
|
1413
|
+
open: n,
|
|
1414
|
+
onOpenChange: u,
|
|
1415
|
+
initialCreateFlowActive: i = !1,
|
|
1416
|
+
dismissMode: k = "passive"
|
|
1417
|
+
} = s, b = n !== void 0, [g, v] = M(!1), [p, N] = M(
|
|
1418
|
+
i
|
|
1419
|
+
), x = b ? n : g, f = F(
|
|
1420
|
+
(_) => {
|
|
1421
|
+
!_ && p && k === "passive" || (b || v(_), _ || N(!1), u == null || u(_));
|
|
1422
|
+
},
|
|
1423
|
+
[b, p, k, u]
|
|
1424
|
+
), S = F(() => {
|
|
1425
|
+
b || v(!1), N(!1), u == null || u(!1);
|
|
1426
|
+
}, [b, u]);
|
|
1427
|
+
K(() => {
|
|
1428
|
+
x || N(!1);
|
|
1429
|
+
}, [x]);
|
|
1430
|
+
const T = F(
|
|
1431
|
+
(_) => {
|
|
1432
|
+
p && _.preventDefault();
|
|
1433
|
+
},
|
|
1434
|
+
[p]
|
|
1435
|
+
);
|
|
1436
|
+
return {
|
|
1437
|
+
forceClose: S,
|
|
1438
|
+
handleOpenChange: f,
|
|
1439
|
+
isCreateFlowActive: p,
|
|
1440
|
+
preventPassiveDismissDuringCreate: T,
|
|
1441
|
+
resolvedOpen: x,
|
|
1442
|
+
setIsCreateFlowActive: N
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1445
|
+
export {
|
|
1446
|
+
na as C,
|
|
1447
|
+
ea as F,
|
|
1448
|
+
Rt as I,
|
|
1449
|
+
zt as L,
|
|
1450
|
+
la as V,
|
|
1451
|
+
Mt as a,
|
|
1452
|
+
ra as b,
|
|
1453
|
+
Ot as c,
|
|
1454
|
+
aa as f,
|
|
1455
|
+
ta as r,
|
|
1456
|
+
sa as u
|
|
1457
|
+
};
|