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