react-semaphor 0.1.60 → 0.1.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/axis-mapping-8ZVwlkl6.js +315 -0
- package/dist/chunks/axis-mapping-Cwa3KrDR.js +16 -0
- package/dist/chunks/bar-chart-settings-B_WyC-7g.js +52 -0
- package/dist/chunks/bar-chart-settings-CvorW7RD.js +1 -0
- package/dist/chunks/bubble-chart-settings-BPtESqYK.js +1 -0
- package/dist/chunks/bubble-chart-settings-CxFAlErV.js +50 -0
- package/dist/chunks/common-chart-settings-CvRrQf-H.js +1 -0
- package/dist/chunks/common-chart-settings-D3ww0Xtx.js +147 -0
- package/dist/chunks/custom-visual-settings-DXWyN2Dr.js +11 -0
- package/dist/chunks/custom-visual-settings-m5o8R5tL.js +243 -0
- package/dist/chunks/dashboard-plus-B8-ocT_Z.js +41 -0
- package/dist/chunks/dashboard-plus-DSUKhvcv.js +2941 -0
- package/dist/chunks/display-labels-BYsRReye.js +1 -0
- package/dist/chunks/display-labels-C_jsL0Jo.js +74 -0
- package/dist/chunks/editor-C7xQi9Ab.js +105 -0
- package/dist/chunks/editor-DqvyBUrl.js +8321 -0
- package/dist/chunks/filter-on-click-columns-6dRYhvgz.js +1 -0
- package/dist/chunks/filter-on-click-columns-BJUGTE6W.js +120 -0
- package/dist/chunks/frame-filters-D9sDN4Vm.js +1 -0
- package/dist/chunks/frame-filters-DFgqSoV2.js +75 -0
- package/dist/chunks/{index-BzapoQUW.js → index--MUeDITx.js} +28320 -25737
- package/dist/chunks/index-Bvtpj-_R.js +1080 -0
- package/dist/chunks/kpi-settings-BONvmfNr.js +1 -0
- package/dist/chunks/kpi-settings-CI-9fp4Z.js +286 -0
- package/dist/chunks/map-chart-settings-CSxZdu_g.js +1 -0
- package/dist/chunks/map-chart-settings-DQIN7Pn8.js +334 -0
- package/dist/chunks/pie-chart-settings-CN3JCLdP.js +86 -0
- package/dist/chunks/pie-chart-settings-CsErfZOL.js +1 -0
- package/dist/chunks/reusable-select-CQbD03nT.js +40 -0
- package/dist/chunks/reusable-select-CVRzPWkg.js +1 -0
- package/dist/chunks/stacked-chart-settings-BfqHFFqA.js +1 -0
- package/dist/chunks/stacked-chart-settings-poYotO6Q.js +90 -0
- package/dist/chunks/table-visual-settings-B46pdUra.js +46 -0
- package/dist/chunks/table-visual-settings-ZKWuNokZ.js +1 -0
- package/dist/chunks/tag-BrxBSbSe.js +20 -0
- package/dist/chunks/tag-D9G2kz2B.js +6 -0
- package/dist/chunks/use-assign-filter-5gplfsO1.js +83 -0
- package/dist/chunks/use-assign-filter-DzmBSsyO.js +1 -0
- package/dist/chunks/use-local-storage-state-CBh2HHB9.js +16 -0
- package/dist/chunks/use-local-storage-state-CL0JsTZM.js +1745 -0
- package/dist/chunks/use-plugin-query-DA6Yrp7P.js +12 -0
- package/dist/chunks/use-plugin-query-JdHNPYZS.js +1 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +103 -103
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/dashboard-plus-BEe61COU.js +0 -17362
- package/dist/chunks/dashboard-plus-Bi6F5Cid.js +0 -225
- package/dist/chunks/index-DvVwuOlu.js +0 -1045
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { jsxs as u, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { E as g, u as h, P as M, g as b, i as w, a0 as K, q as m, aI as L, aJ as A, aK as N, aL as v, aM as D, aN as O, aO as T, aP as P, aQ as H, aR as j, L as k, aS as z, aT as S, aU as E } from "./index--MUeDITx.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import "react-dom";
|
|
5
|
+
import { T as I } from "./tag-BrxBSbSe.js";
|
|
6
|
+
/**
|
|
7
|
+
* @license lucide-react v0.453.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
const X = g("ListEnd", [
|
|
13
|
+
["path", { d: "M16 12H3", key: "1a2rj7" }],
|
|
14
|
+
["path", { d: "M16 6H3", key: "1wxfjs" }],
|
|
15
|
+
["path", { d: "M10 18H3", key: "13769t" }],
|
|
16
|
+
["path", { d: "M21 6v10a2 2 0 0 1-2 2h-5", key: "ilrcs8" }],
|
|
17
|
+
["path", { d: "m16 16-2 2 2 2", key: "kkc6pm" }]
|
|
18
|
+
]);
|
|
19
|
+
/**
|
|
20
|
+
* @license lucide-react v0.453.0 - ISC
|
|
21
|
+
*
|
|
22
|
+
* This source code is licensed under the ISC license.
|
|
23
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
24
|
+
*/
|
|
25
|
+
const B = g("ListStart", [
|
|
26
|
+
["path", { d: "M16 12H3", key: "1a2rj7" }],
|
|
27
|
+
["path", { d: "M16 18H3", key: "12xzn7" }],
|
|
28
|
+
["path", { d: "M10 6H3", key: "lf8lx7" }],
|
|
29
|
+
["path", { d: "M21 18V8a2 2 0 0 0-2-2h-5", key: "1hghli" }],
|
|
30
|
+
["path", { d: "m16 8-2-2 2-2", key: "160uvd" }]
|
|
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 Q = g("ListX", [
|
|
39
|
+
["path", { d: "M11 12H3", key: "51ecnj" }],
|
|
40
|
+
["path", { d: "M16 6H3", key: "1wxfjs" }],
|
|
41
|
+
["path", { d: "M16 18H3", key: "12xzn7" }],
|
|
42
|
+
["path", { d: "m19 10-4 4", key: "1tz659" }],
|
|
43
|
+
["path", { d: "m15 10 4 4", key: "1n7nei" }]
|
|
44
|
+
]);
|
|
45
|
+
function V({ idx: s }) {
|
|
46
|
+
var f;
|
|
47
|
+
const t = h((e) => {
|
|
48
|
+
var o;
|
|
49
|
+
return (o = e.card) == null ? void 0 : o.preferences;
|
|
50
|
+
}), n = h(
|
|
51
|
+
(e) => {
|
|
52
|
+
var o;
|
|
53
|
+
return (o = e.card.preferences) == null ? void 0 : o.datasetOptions;
|
|
54
|
+
}
|
|
55
|
+
), l = h(
|
|
56
|
+
(e) => e.actions.setCardPreferences
|
|
57
|
+
), p = (f = t == null ? void 0 : t.chartOptions) == null ? void 0 : f.indexAxis, d = n == null ? void 0 : n.find((e) => e.idx === s);
|
|
58
|
+
function i(e, o) {
|
|
59
|
+
(e === "end" || e === "start") && L(A());
|
|
60
|
+
const r = {
|
|
61
|
+
display: e !== "none",
|
|
62
|
+
align: e,
|
|
63
|
+
anchor: e,
|
|
64
|
+
clamp: !0
|
|
65
|
+
};
|
|
66
|
+
if (!d)
|
|
67
|
+
l({
|
|
68
|
+
...t,
|
|
69
|
+
datasetOptions: [
|
|
70
|
+
...n || [],
|
|
71
|
+
{
|
|
72
|
+
idx: o,
|
|
73
|
+
datalabels: r
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
else {
|
|
78
|
+
const c = { ...d };
|
|
79
|
+
c.datalabels = r;
|
|
80
|
+
const x = n == null ? void 0 : n.map(
|
|
81
|
+
(y) => y.idx === o ? c : y
|
|
82
|
+
);
|
|
83
|
+
l({
|
|
84
|
+
...t,
|
|
85
|
+
datasetOptions: x
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return /* @__PURE__ */ u(M, { children: [
|
|
90
|
+
/* @__PURE__ */ a(b, { children: /* @__PURE__ */ a(I, { className: "size-4 rotate-[135deg] cursor-pointer text-muted-foreground hover:text-foreground" }) }),
|
|
91
|
+
/* @__PURE__ */ a(w, { className: "w-fit px-2 py-1", children: /* @__PURE__ */ u("div", { className: "flex gap-1", children: [
|
|
92
|
+
/* @__PURE__ */ a(
|
|
93
|
+
"button",
|
|
94
|
+
{
|
|
95
|
+
onClick: () => i("none", s),
|
|
96
|
+
className: "h-7 p-1 text-xs font-normal",
|
|
97
|
+
children: /* @__PURE__ */ a(K, { className: "size-3.5" })
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
/* @__PURE__ */ a(
|
|
101
|
+
"button",
|
|
102
|
+
{
|
|
103
|
+
onClick: () => i("start", s),
|
|
104
|
+
className: "h-7 p-1 text-xs font-normal",
|
|
105
|
+
children: /* @__PURE__ */ a(
|
|
106
|
+
X,
|
|
107
|
+
{
|
|
108
|
+
className: m("h-4 w-4", {
|
|
109
|
+
"rotate-90": p === "y"
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ a(
|
|
116
|
+
"button",
|
|
117
|
+
{
|
|
118
|
+
onClick: () => i("center", s),
|
|
119
|
+
className: "h-7 p-1 text-xs font-normal",
|
|
120
|
+
children: /* @__PURE__ */ a(
|
|
121
|
+
Q,
|
|
122
|
+
{
|
|
123
|
+
className: m("h-4 w-4", {
|
|
124
|
+
"rotate-90": p === "y"
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
/* @__PURE__ */ a(
|
|
131
|
+
"button",
|
|
132
|
+
{
|
|
133
|
+
onClick: () => i("end", s),
|
|
134
|
+
className: "h-7 p-1 text-xs font-normal",
|
|
135
|
+
children: /* @__PURE__ */ a(
|
|
136
|
+
B,
|
|
137
|
+
{
|
|
138
|
+
className: m("h-4 w-4", {
|
|
139
|
+
"rotate-90": p === "y"
|
|
140
|
+
})
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
] }) })
|
|
146
|
+
] });
|
|
147
|
+
}
|
|
148
|
+
function q() {
|
|
149
|
+
const s = h((d) => d.card), { data: t } = N(s), { keys: n } = v((t == null ? void 0 : t.records) || []), l = n.slice(1).filter((d) => !D.includes(d));
|
|
150
|
+
let p = l;
|
|
151
|
+
if (["stackedBar", "stackedLine"].includes(s.type)) {
|
|
152
|
+
const d = O({
|
|
153
|
+
dataArray: (t == null ? void 0 : t.records) || [],
|
|
154
|
+
groupKey: n[0],
|
|
155
|
+
pivotKey: n[1],
|
|
156
|
+
valueKey: n[2]
|
|
157
|
+
}), { keys: i } = v(d);
|
|
158
|
+
p = i.slice(1);
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
transformedMetricKeys: p,
|
|
162
|
+
dimensionKeys: n.slice(0, 1),
|
|
163
|
+
keys: n,
|
|
164
|
+
defaultMetricKeys: l
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function F({
|
|
168
|
+
children: s,
|
|
169
|
+
className: t,
|
|
170
|
+
delayDuration: n
|
|
171
|
+
}) {
|
|
172
|
+
return /* @__PURE__ */ a(T, { children: /* @__PURE__ */ u(P, { delayDuration: n, children: [
|
|
173
|
+
/* @__PURE__ */ a(H, { asChild: !0, children: /* @__PURE__ */ a(
|
|
174
|
+
"span",
|
|
175
|
+
{
|
|
176
|
+
className: m(
|
|
177
|
+
"overflow-hidden text-ellipsis whitespace-nowrap",
|
|
178
|
+
t
|
|
179
|
+
),
|
|
180
|
+
children: s
|
|
181
|
+
}
|
|
182
|
+
) }),
|
|
183
|
+
/* @__PURE__ */ a(j, { children: s })
|
|
184
|
+
] }) });
|
|
185
|
+
}
|
|
186
|
+
function W() {
|
|
187
|
+
const s = h((e) => e.card), t = h(
|
|
188
|
+
(e) => {
|
|
189
|
+
var o, r, c;
|
|
190
|
+
return (c = (r = (o = e == null ? void 0 : e.card) == null ? void 0 : o.preferences) == null ? void 0 : r.chartOptions) == null ? void 0 : c.indexAxis;
|
|
191
|
+
}
|
|
192
|
+
), { data: n } = N(s), l = t === "y" ? "Metric" : "Dimension", p = t === "y" ? "Dimension" : "Metric", { dimensionKeys: d, transformedMetricKeys: i, keys: f } = q();
|
|
193
|
+
return f.length === 0 ? null : /* @__PURE__ */ u("div", { className: "space-y-4", children: [
|
|
194
|
+
/* @__PURE__ */ u("div", { className: "space-y-2", children: [
|
|
195
|
+
/* @__PURE__ */ a(k, { children: l }),
|
|
196
|
+
/* @__PURE__ */ a("div", { className: "max-h-[125px] space-y-1 overflow-y-auto", children: d.map((e) => /* @__PURE__ */ a(
|
|
197
|
+
"p",
|
|
198
|
+
{
|
|
199
|
+
className: "flex h-8 items-center rounded-md bg-muted/70 px-3 hover:bg-muted",
|
|
200
|
+
title: e,
|
|
201
|
+
children: C(e)
|
|
202
|
+
},
|
|
203
|
+
e
|
|
204
|
+
)) })
|
|
205
|
+
] }),
|
|
206
|
+
/* @__PURE__ */ u("div", { className: "space-y-2", children: [
|
|
207
|
+
/* @__PURE__ */ a(k, { children: p }),
|
|
208
|
+
/* @__PURE__ */ a("div", { className: "my-1 max-h-[125px] space-y-1 overflow-y-auto", children: i.map((e, o) => /* @__PURE__ */ a(
|
|
209
|
+
J,
|
|
210
|
+
{
|
|
211
|
+
className: "flex h-8 items-center bg-muted/70 px-3 hover:bg-muted",
|
|
212
|
+
iconClassName: "invisible group-hover:visible",
|
|
213
|
+
col: e,
|
|
214
|
+
idx: o
|
|
215
|
+
},
|
|
216
|
+
e
|
|
217
|
+
)) })
|
|
218
|
+
] })
|
|
219
|
+
] });
|
|
220
|
+
}
|
|
221
|
+
function C(s, t = 30) {
|
|
222
|
+
return s.length > t ? s.slice(0, t) + "..." : s;
|
|
223
|
+
}
|
|
224
|
+
function J({
|
|
225
|
+
col: s,
|
|
226
|
+
idx: t,
|
|
227
|
+
className: n,
|
|
228
|
+
iconClassName: l,
|
|
229
|
+
children: p
|
|
230
|
+
}) {
|
|
231
|
+
const d = h((r) => {
|
|
232
|
+
var c;
|
|
233
|
+
return (c = r.card) == null ? void 0 : c.preferences;
|
|
234
|
+
}), i = h(
|
|
235
|
+
(r) => {
|
|
236
|
+
var c, x;
|
|
237
|
+
return (x = (c = r.card) == null ? void 0 : c.preferences) == null ? void 0 : x.datasetOptions;
|
|
238
|
+
}
|
|
239
|
+
), f = i == null ? void 0 : i.find((r) => r.idx === t), { setCardPreferences: e } = h((r) => r.actions);
|
|
240
|
+
function o(r) {
|
|
241
|
+
if (!f)
|
|
242
|
+
e({
|
|
243
|
+
...d,
|
|
244
|
+
datasetOptions: [
|
|
245
|
+
...i || [],
|
|
246
|
+
{
|
|
247
|
+
idx: t,
|
|
248
|
+
type: r === "area" ? "line" : r,
|
|
249
|
+
fill: r === "area" ? "origin" : ""
|
|
250
|
+
}
|
|
251
|
+
]
|
|
252
|
+
});
|
|
253
|
+
else {
|
|
254
|
+
const c = { ...f };
|
|
255
|
+
c.type = r === "area" ? "line" : r, c.fill = r === "area" ? "origin" : "";
|
|
256
|
+
const x = i == null ? void 0 : i.map(
|
|
257
|
+
(y) => y.idx === t ? c : y
|
|
258
|
+
);
|
|
259
|
+
e({
|
|
260
|
+
...d,
|
|
261
|
+
datasetOptions: x
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return /* @__PURE__ */ u(
|
|
266
|
+
"div",
|
|
267
|
+
{
|
|
268
|
+
className: m(
|
|
269
|
+
"group flex items-center justify-between gap-2 rounded-md",
|
|
270
|
+
n
|
|
271
|
+
),
|
|
272
|
+
children: [
|
|
273
|
+
p || /* @__PURE__ */ a(F, { className: "max-w-[100px]", title: s, children: C(s) }),
|
|
274
|
+
/* @__PURE__ */ u("div", { className: "flex gap-2", children: [
|
|
275
|
+
/* @__PURE__ */ a(
|
|
276
|
+
z,
|
|
277
|
+
{
|
|
278
|
+
onClick: () => o("bar"),
|
|
279
|
+
className: m(
|
|
280
|
+
"size-4 cursor-pointer text-muted-foreground hover:text-foreground",
|
|
281
|
+
l
|
|
282
|
+
)
|
|
283
|
+
}
|
|
284
|
+
),
|
|
285
|
+
/* @__PURE__ */ a(
|
|
286
|
+
S,
|
|
287
|
+
{
|
|
288
|
+
onClick: () => o("line"),
|
|
289
|
+
className: m(
|
|
290
|
+
"size-4 cursor-pointer text-muted-foreground hover:text-foreground",
|
|
291
|
+
l
|
|
292
|
+
)
|
|
293
|
+
}
|
|
294
|
+
),
|
|
295
|
+
/* @__PURE__ */ a(
|
|
296
|
+
E,
|
|
297
|
+
{
|
|
298
|
+
onClick: () => o("area"),
|
|
299
|
+
className: m(
|
|
300
|
+
"size-4 cursor-pointer text-muted-foreground hover:text-foreground",
|
|
301
|
+
l
|
|
302
|
+
)
|
|
303
|
+
}
|
|
304
|
+
),
|
|
305
|
+
/* @__PURE__ */ a(V, { idx: t })
|
|
306
|
+
] })
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
export {
|
|
312
|
+
W as A,
|
|
313
|
+
J as M,
|
|
314
|
+
F as O
|
|
315
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),e=require("./index-Bvtpj-_R.js");require("react");require("react-dom");const j=require("./tag-D9G2kz2B.js");/**
|
|
2
|
+
* @license lucide-react v0.453.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const v=e.createLucideIcon("ListEnd",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M10 18H3",key:"13769t"}],["path",{d:"M21 6v10a2 2 0 0 1-2 2h-5",key:"ilrcs8"}],["path",{d:"m16 16-2 2 2 2",key:"kkc6pm"}]]);/**
|
|
7
|
+
* @license lucide-react v0.453.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const k=e.createLucideIcon("ListStart",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M10 6H3",key:"lf8lx7"}],["path",{d:"M21 18V8a2 2 0 0 0-2-2h-5",key:"1hghli"}],["path",{d:"m16 8-2-2 2-2",key:"160uvd"}]]);/**
|
|
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
|
+
*/const C=e.createLucideIcon("ListX",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"m19 10-4 4",key:"1tz659"}],["path",{d:"m15 10 4 4",key:"1n7nei"}]]);function N({idx:n}){var x;const r=e.useEditorStore(s=>{var i;return(i=s.card)==null?void 0:i.preferences}),o=e.useEditorStore(s=>{var i;return(i=s.card.preferences)==null?void 0:i.datasetOptions}),p=e.useEditorStore(s=>s.actions.setCardPreferences),u=(x=r==null?void 0:r.chartOptions)==null?void 0:x.indexAxis,l=o==null?void 0:o.find(s=>s.idx===n);function c(s,i){(s==="end"||s==="start")&&e.getContrastColor(e.getCanvasBackgroundColor());const a={display:s!=="none",align:s,anchor:s,clamp:!0};if(!l)p({...r,datasetOptions:[...o||[],{idx:i,datalabels:a}]});else{const d={...l};d.datalabels=a;const h=o==null?void 0:o.map(m=>m.idx===i?d:m);p({...r,datasetOptions:h})}}return t.jsxs(e.Popover,{children:[t.jsx(e.PopoverTrigger,{children:t.jsx(j.Tag,{className:"size-4 rotate-[135deg] cursor-pointer text-muted-foreground hover:text-foreground"})}),t.jsx(e.PopoverContent,{className:"w-fit px-2 py-1",children:t.jsxs("div",{className:"flex gap-1",children:[t.jsx("button",{onClick:()=>c("none",n),className:"h-7 p-1 text-xs font-normal",children:t.jsx(e.X,{className:"size-3.5"})}),t.jsx("button",{onClick:()=>c("start",n),className:"h-7 p-1 text-xs font-normal",children:t.jsx(v,{className:e.cn("h-4 w-4",{"rotate-90":u==="y"})})}),t.jsx("button",{onClick:()=>c("center",n),className:"h-7 p-1 text-xs font-normal",children:t.jsx(C,{className:e.cn("h-4 w-4",{"rotate-90":u==="y"})})}),t.jsx("button",{onClick:()=>c("end",n),className:"h-7 p-1 text-xs font-normal",children:t.jsx(k,{className:e.cn("h-4 w-4",{"rotate-90":u==="y"})})})]})})]})}function M(){const n=e.useEditorStore(l=>l.card),{data:r}=e.useDashboardCardQuery(n),{keys:o}=e.getKeys((r==null?void 0:r.records)||[]),p=o.slice(1).filter(l=>!e.METADATA_KEYS.includes(l));let u=p;if(["stackedBar","stackedLine"].includes(n.type)){const l=e.pivotData({dataArray:(r==null?void 0:r.records)||[],groupKey:o[0],pivotKey:o[1],valueKey:o[2]}),{keys:c}=e.getKeys(l);u=c.slice(1)}return{transformedMetricKeys:u,dimensionKeys:o.slice(0,1),keys:o,defaultMetricKeys:p}}function f({children:n,className:r,delayDuration:o}){return t.jsx(e.TooltipProvider,{children:t.jsxs(e.Tooltip,{delayDuration:o,children:[t.jsx(e.TooltipTrigger,{asChild:!0,children:t.jsx("span",{className:e.cn("overflow-hidden text-ellipsis whitespace-nowrap",r),children:n})}),t.jsx(e.TooltipContent,{children:n})]})})}function b(){const n=e.useEditorStore(s=>s.card),r=e.useEditorStore(s=>{var i,a,d;return(d=(a=(i=s==null?void 0:s.card)==null?void 0:i.preferences)==null?void 0:a.chartOptions)==null?void 0:d.indexAxis}),{data:o}=e.useDashboardCardQuery(n),p=r==="y"?"Metric":"Dimension",u=r==="y"?"Dimension":"Metric",{dimensionKeys:l,transformedMetricKeys:c,keys:x}=M();return x.length===0?null:t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(e.Label,{children:p}),t.jsx("div",{className:"max-h-[125px] space-y-1 overflow-y-auto",children:l.map(s=>t.jsx("p",{className:"flex h-8 items-center rounded-md bg-muted/70 px-3 hover:bg-muted",title:s,children:y(s)},s))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(e.Label,{children:u}),t.jsx("div",{className:"my-1 max-h-[125px] space-y-1 overflow-y-auto",children:c.map((s,i)=>t.jsx(g,{className:"flex h-8 items-center bg-muted/70 px-3 hover:bg-muted",iconClassName:"invisible group-hover:visible",col:s,idx:i},s))})]})]})}function y(n,r=30){return n.length>r?n.slice(0,r)+"...":n}function g({col:n,idx:r,className:o,iconClassName:p,children:u}){const l=e.useEditorStore(a=>{var d;return(d=a.card)==null?void 0:d.preferences}),c=e.useEditorStore(a=>{var d,h;return(h=(d=a.card)==null?void 0:d.preferences)==null?void 0:h.datasetOptions}),x=c==null?void 0:c.find(a=>a.idx===r),{setCardPreferences:s}=e.useEditorStore(a=>a.actions);function i(a){if(!x)s({...l,datasetOptions:[...c||[],{idx:r,type:a==="area"?"line":a,fill:a==="area"?"origin":""}]});else{const d={...x};d.type=a==="area"?"line":a,d.fill=a==="area"?"origin":"";const h=c==null?void 0:c.map(m=>m.idx===r?d:m);s({...l,datasetOptions:h})}}return t.jsxs("div",{className:e.cn("group flex items-center justify-between gap-2 rounded-md",o),children:[u||t.jsx(f,{className:"max-w-[100px]",title:n,children:y(n)}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(e.ChartColumnIncreasing,{onClick:()=>i("bar"),className:e.cn("size-4 cursor-pointer text-muted-foreground hover:text-foreground",p)}),t.jsx(e.ChartLine,{onClick:()=>i("line"),className:e.cn("size-4 cursor-pointer text-muted-foreground hover:text-foreground",p)}),t.jsx(e.ChartArea,{onClick:()=>i("area"),className:e.cn("size-4 cursor-pointer text-muted-foreground hover:text-foreground",p)}),t.jsx(N,{idx:r})]})]})}exports.AxisMapping=b;exports.MetricFragment=g;exports.OverflowSpan=f;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { memo as c } from "react";
|
|
3
|
+
import { A as n, a, b as r, t as o, c as t } from "./index--MUeDITx.js";
|
|
4
|
+
import { F as m } from "./filter-on-click-columns-BJUGTE6W.js";
|
|
5
|
+
import { A as d } from "./axis-mapping-8ZVwlkl6.js";
|
|
6
|
+
import { F as h } from "./frame-filters-DFgqSoV2.js";
|
|
7
|
+
function p({
|
|
8
|
+
cardType: s
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ e("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ i(n, { defaultValue: ["item-2"], type: "multiple", children: [
|
|
11
|
+
/* @__PURE__ */ i(a, { value: "item-1", children: [
|
|
12
|
+
/* @__PURE__ */ e(r, { children: `${o(s)} Chart` }),
|
|
13
|
+
/* @__PURE__ */ i(t, { className: "space-y-4 font-mono text-xs", children: [
|
|
14
|
+
/* @__PURE__ */ e("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT x-axis, y-axis-1, y-axis-2,... FROM table" }),
|
|
15
|
+
/* @__PURE__ */ i("ul", { className: "ml-6 list-disc text-xs [&>li]:mt-2", children: [
|
|
16
|
+
/* @__PURE__ */ e("li", { children: "x-axis - category" }),
|
|
17
|
+
/* @__PURE__ */ e("li", { children: "y-axis1 - number" }),
|
|
18
|
+
/* @__PURE__ */ e("li", { children: "y-axis2 - number" })
|
|
19
|
+
] }),
|
|
20
|
+
/* @__PURE__ */ i("div", { children: [
|
|
21
|
+
"See ",
|
|
22
|
+
/* @__PURE__ */ e(
|
|
23
|
+
"a",
|
|
24
|
+
{
|
|
25
|
+
target: "_blank",
|
|
26
|
+
onClick: (l) => l.stopPropagation(),
|
|
27
|
+
className: "text-blue-700",
|
|
28
|
+
href: "https://docs.semaphor.cloud/docs/charts/bar-line-area",
|
|
29
|
+
children: "example"
|
|
30
|
+
}
|
|
31
|
+
),
|
|
32
|
+
" in the docs."
|
|
33
|
+
] })
|
|
34
|
+
] })
|
|
35
|
+
] }),
|
|
36
|
+
/* @__PURE__ */ i(a, { value: "item-2", children: [
|
|
37
|
+
/* @__PURE__ */ e(r, { children: "Settings" }),
|
|
38
|
+
/* @__PURE__ */ e(t, { className: "space-y-4 px-2", children: /* @__PURE__ */ e(d, {}) })
|
|
39
|
+
] }),
|
|
40
|
+
/* @__PURE__ */ i(a, { value: "item-3", children: [
|
|
41
|
+
/* @__PURE__ */ e(r, { children: "Click Filters" }),
|
|
42
|
+
/* @__PURE__ */ i(t, { className: "space-y-4 px-2", children: [
|
|
43
|
+
/* @__PURE__ */ e(m, {}),
|
|
44
|
+
/* @__PURE__ */ e(h, {})
|
|
45
|
+
] })
|
|
46
|
+
] })
|
|
47
|
+
] }) });
|
|
48
|
+
}
|
|
49
|
+
const b = c(p);
|
|
50
|
+
export {
|
|
51
|
+
b as default
|
|
52
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),s=require("./index-Bvtpj-_R.js"),c=require("./filter-on-click-columns-6dRYhvgz.js"),n=require("./axis-mapping-Cwa3KrDR.js"),l=require("./frame-filters-D9sDN4Vm.js");function a({cardType:i}){return e.jsx("div",{className:"space-y-6 px-6 py-2",children:e.jsxs(s.Accordion,{defaultValue:["item-2"],type:"multiple",children:[e.jsxs(s.AccordionItem,{value:"item-1",children:[e.jsx(s.AccordionTrigger,{children:`${s.titleCase(i)} Chart`}),e.jsxs(s.AccordionContent,{className:"space-y-4 font-mono text-xs",children:[e.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:"SELECT x-axis, y-axis-1, y-axis-2,... FROM table"}),e.jsxs("ul",{className:"ml-6 list-disc text-xs [&>li]:mt-2",children:[e.jsx("li",{children:"x-axis - category"}),e.jsx("li",{children:"y-axis1 - number"}),e.jsx("li",{children:"y-axis2 - number"})]}),e.jsxs("div",{children:["See ",e.jsx("a",{target:"_blank",onClick:r=>r.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/docs/charts/bar-line-area",children:"example"})," in the docs."]})]})]}),e.jsxs(s.AccordionItem,{value:"item-2",children:[e.jsx(s.AccordionTrigger,{children:"Settings"}),e.jsx(s.AccordionContent,{className:"space-y-4 px-2",children:e.jsx(n.AxisMapping,{})})]}),e.jsxs(s.AccordionItem,{value:"item-3",children:[e.jsx(s.AccordionTrigger,{children:"Click Filters"}),e.jsxs(s.AccordionContent,{className:"space-y-4 px-2",children:[e.jsx(c.FilterOnClickColumns,{}),e.jsx(l.FrameFilters,{})]})]})]})})}const o=t.memo(a);exports.default=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-Bvtpj-_R.js"),c=require("./filter-on-click-columns-6dRYhvgz.js"),n=require("./frame-filters-D9sDN4Vm.js");function a({cardType:i}){function l(r){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"rounded bg-muted px-2 py-1 text-xs",children:r==="bubble"?"SELECT label, [group], x-axis, y-axis, radius FROM table":"SELECT label, [group], x-axis, y-axis FROM table"}),e.jsxs("ul",{className:"ml-6 list-disc text-xs [&>li]:mt-2",children:[e.jsx("li",{children:"label - category"}),e.jsx("li",{children:"group (optional) - category"}),e.jsx("li",{children:"x-axis - number"}),e.jsx("li",{children:"y-axis - number"}),r==="bubble"&&e.jsx("li",{children:"radius - number"})]}),e.jsxs("div",{children:["See ",e.jsx("a",{target:"_blank",onClick:t=>t.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/docs/charts/bubble",children:"example"})," in the docs."]})]})}return e.jsx("div",{className:"space-y-6 px-6 py-2",children:e.jsxs(s.Accordion,{defaultValue:["item-2"],type:"multiple",children:[e.jsxs(s.AccordionItem,{value:"item-1",children:[e.jsx(s.AccordionTrigger,{children:`${s.titleCase(i)} Chart`}),e.jsx(s.AccordionContent,{className:"space-y-4 font-mono text-xs",children:l(i)})]}),e.jsxs(s.AccordionItem,{value:"item-3",children:[e.jsx(s.AccordionTrigger,{children:"Click Filters"}),e.jsxs(s.AccordionContent,{className:"space-y-4 px-2",children:[e.jsx(c.FilterOnClickColumns,{}),e.jsx(n.FrameFilters,{})]})]})]})})}exports.default=a;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as e, jsxs as l, Fragment as o } from "react/jsx-runtime";
|
|
2
|
+
import { A as d, a as t, b as a, t as u, c as s } from "./index--MUeDITx.js";
|
|
3
|
+
import { F as m } from "./filter-on-click-columns-BJUGTE6W.js";
|
|
4
|
+
import { F as b } from "./frame-filters-DFgqSoV2.js";
|
|
5
|
+
function C({
|
|
6
|
+
cardType: r
|
|
7
|
+
}) {
|
|
8
|
+
function c(i) {
|
|
9
|
+
return /* @__PURE__ */ l(o, { children: [
|
|
10
|
+
/* @__PURE__ */ e("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: i === "bubble" ? "SELECT label, [group], x-axis, y-axis, radius FROM table" : "SELECT label, [group], x-axis, y-axis FROM table" }),
|
|
11
|
+
/* @__PURE__ */ l("ul", { className: "ml-6 list-disc text-xs [&>li]:mt-2", children: [
|
|
12
|
+
/* @__PURE__ */ e("li", { children: "label - category" }),
|
|
13
|
+
/* @__PURE__ */ e("li", { children: "group (optional) - category" }),
|
|
14
|
+
/* @__PURE__ */ e("li", { children: "x-axis - number" }),
|
|
15
|
+
/* @__PURE__ */ e("li", { children: "y-axis - number" }),
|
|
16
|
+
i === "bubble" && /* @__PURE__ */ e("li", { children: "radius - number" })
|
|
17
|
+
] }),
|
|
18
|
+
/* @__PURE__ */ l("div", { children: [
|
|
19
|
+
"See ",
|
|
20
|
+
/* @__PURE__ */ e(
|
|
21
|
+
"a",
|
|
22
|
+
{
|
|
23
|
+
target: "_blank",
|
|
24
|
+
onClick: (n) => n.stopPropagation(),
|
|
25
|
+
className: "text-blue-700",
|
|
26
|
+
href: "https://docs.semaphor.cloud/docs/charts/bubble",
|
|
27
|
+
children: "example"
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
" in the docs."
|
|
31
|
+
] })
|
|
32
|
+
] });
|
|
33
|
+
}
|
|
34
|
+
return /* @__PURE__ */ e("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ l(d, { defaultValue: ["item-2"], type: "multiple", children: [
|
|
35
|
+
/* @__PURE__ */ l(t, { value: "item-1", children: [
|
|
36
|
+
/* @__PURE__ */ e(a, { children: `${u(r)} Chart` }),
|
|
37
|
+
/* @__PURE__ */ e(s, { className: "space-y-4 font-mono text-xs", children: c(r) })
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ l(t, { value: "item-3", children: [
|
|
40
|
+
/* @__PURE__ */ e(a, { children: "Click Filters" }),
|
|
41
|
+
/* @__PURE__ */ l(s, { className: "space-y-4 px-2", children: [
|
|
42
|
+
/* @__PURE__ */ e(m, {}),
|
|
43
|
+
/* @__PURE__ */ e(b, {})
|
|
44
|
+
] })
|
|
45
|
+
] })
|
|
46
|
+
] }) });
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
C as default
|
|
50
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-Bvtpj-_R.js"),r=require("./display-labels-BYsRReye.js"),n=require("./filter-on-click-columns-6dRYhvgz.js"),t=require("./frame-filters-D9sDN4Vm.js"),a={datasets:[{type:"line",label:"Sum_sales",data:[]},{type:"bar",label:"Sum_profit",data:[]}]},c={datasets:[{fill:"origin",type:"line",label:"Sum_sales",data:[]}]};function o(){const i=s.useEditorStore(l=>l.card.type);return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx(s.Accordion,{className:" ",type:"single",collapsible:!0,children:d(i)}),!["kpi"].includes(i)&&e.jsxs("div",{className:"space-y-4",children:[e.jsx(r.DisplayLabels,{}),e.jsx(n.FilterOnClickColumns,{}),e.jsx(t.FrameFilters,{})]})]})}function d(i){if(["line","bar"].includes(i))return e.jsxs(e.Fragment,{children:[e.jsxs(s.AccordionItem,{value:"item-1",children:[e.jsx(s.AccordionTrigger,{className:"font-normal",children:e.jsx("p",{children:"Chart Query"})}),e.jsxs(s.AccordionContent,{className:" ",children:[e.jsx("div",{className:"rounded bg-muted px-2 py-1 font-mono text-xs font-semibold",children:"SELECT x-axis, y-axis-1, y-axis-2, y-axis-3,... FROM table"}),e.jsxs("ul",{className:"my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2",children:[e.jsx("li",{children:"X-axis - Category (ex. city)"}),e.jsx("li",{children:"Y-axis - Number (ex. population)"})]})]})]}),e.jsxs(s.AccordionItem,{value:"item-2",children:[e.jsx(s.AccordionTrigger,{className:"font-normal",children:"Mixed Chart"}),e.jsxs(s.AccordionContent,{className:"space-y-2 text-xs",children:[e.jsxs("p",{children:["Click ",e.jsx("b",{children:"Customize"})," and change the `type` property in the dataset."]}),e.jsx("pre",{children:JSON.stringify(a,null,2)})]})]}),e.jsxs(s.AccordionItem,{value:"item-3",children:[e.jsx(s.AccordionTrigger,{className:"font-normal",children:"Area Chart"}),e.jsxs(s.AccordionContent,{className:"space-y-2 text-xs",children:[e.jsxs("p",{children:["Click ",e.jsx("b",{children:"Customize"})," and add `fill` property to the dataset. See",e.jsx("a",{className:"mx-1 text-blue-500 hover:underline",href:"https://www.chartjs.org/docs/latest/samples/area/line-boundaries.html",target:"_blank",children:"docs"}),"for more options."]}),e.jsx("pre",{children:JSON.stringify(c,null,2)})]})]})]});if(i==="bubble")return e.jsx(e.Fragment,{children:e.jsxs(s.AccordionItem,{value:"item-1",children:[e.jsx(s.AccordionTrigger,{className:"font-normal",children:e.jsxs("p",{children:["How to create a ",e.jsx("span",{children:i})," chart query?"]})}),e.jsxs(s.AccordionContent,{className:" ",children:[e.jsx("div",{className:"rounded bg-muted px-2 py-1 font-mono text-xs font-semibold",children:"SELECT label, x-axis, y-axis, radius FROM table"}),e.jsxs("ul",{className:"my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2",children:[e.jsx("li",{children:"Label - Category (ex. city)"}),e.jsx("li",{children:"Bubble Group (opt) - Category (ex. state)"}),e.jsx("li",{children:"X-axis - Number (ex. avg. age)"}),e.jsx("li",{children:"Y-axis - Number (ex. avg. weight)"}),e.jsx("li",{children:"Radius - Number (ex. population)"})]})]})]})});if(i==="scatter")return e.jsx(e.Fragment,{children:e.jsxs(s.AccordionItem,{value:"item-1",children:[e.jsx(s.AccordionTrigger,{className:"font-normal",children:e.jsxs("p",{children:["How to create a ",e.jsx("span",{children:i})," chart query?"]})}),e.jsxs(s.AccordionContent,{className:" ",children:[e.jsx("div",{className:"rounded bg-muted px-2 py-1 font-mono text-xs font-semibold",children:"SELECT label, x-axis, y-axis FROM table"}),e.jsxs("ul",{className:"my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2",children:[e.jsx("li",{children:"Label - Category (ex. city)"}),e.jsx("li",{children:"Group (opt) - Category (ex. state)"}),e.jsx("li",{children:"X-axis - Number (ex. avg. age)"}),e.jsx("li",{children:"Y-axis - Number (ex. avg. weight)"})]})]})]})});if(["pie","doughnut","polarArea","funnel"].includes(i))return e.jsx(e.Fragment,{children:e.jsxs(s.AccordionItem,{value:"item-1",children:[e.jsx(s.AccordionTrigger,{className:"font-normal",children:e.jsxs("p",{children:[e.jsx("span",{children:i==="polarArea"?"Polar":i.charAt(0).toUpperCase()+i.slice(1)})," ","chart query"]})}),e.jsxs(s.AccordionContent,{className:" ",children:[e.jsx("div",{className:"rounded bg-muted px-2 py-1 font-mono text-xs font-semibold",children:"SELECT label, measure FROM table"}),e.jsxs("ul",{className:"my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2",children:[e.jsx("li",{children:"Label - Category (ex. city)"}),e.jsx("li",{children:"Measure - Number (ex. population)"})]})]})]})})}exports.default=o;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { jsxs as l, jsx as e, Fragment as n } from "react/jsx-runtime";
|
|
2
|
+
import { u as c, A as o, a as i, b as r, c as t } from "./index--MUeDITx.js";
|
|
3
|
+
import { D as d } from "./display-labels-C_jsL0Jo.js";
|
|
4
|
+
import { F as m } from "./filter-on-click-columns-BJUGTE6W.js";
|
|
5
|
+
import { F as h } from "./frame-filters-DFgqSoV2.js";
|
|
6
|
+
const u = {
|
|
7
|
+
datasets: [
|
|
8
|
+
{
|
|
9
|
+
type: "line",
|
|
10
|
+
label: "Sum_sales",
|
|
11
|
+
data: []
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
type: "bar",
|
|
15
|
+
label: "Sum_profit",
|
|
16
|
+
data: []
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}, x = {
|
|
20
|
+
datasets: [
|
|
21
|
+
{
|
|
22
|
+
fill: "origin",
|
|
23
|
+
type: "line",
|
|
24
|
+
label: "Sum_sales",
|
|
25
|
+
data: []
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
};
|
|
29
|
+
function C() {
|
|
30
|
+
const a = c((s) => s.card.type);
|
|
31
|
+
return /* @__PURE__ */ l("div", { className: "space-y-6 p-6", children: [
|
|
32
|
+
/* @__PURE__ */ e(
|
|
33
|
+
o,
|
|
34
|
+
{
|
|
35
|
+
className: " ",
|
|
36
|
+
type: "single",
|
|
37
|
+
collapsible: !0,
|
|
38
|
+
children: p(a)
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
!["kpi"].includes(a) && /* @__PURE__ */ l("div", { className: "space-y-4", children: [
|
|
42
|
+
/* @__PURE__ */ e(d, {}),
|
|
43
|
+
/* @__PURE__ */ e(m, {}),
|
|
44
|
+
/* @__PURE__ */ e(h, {})
|
|
45
|
+
] })
|
|
46
|
+
] });
|
|
47
|
+
}
|
|
48
|
+
function p(a) {
|
|
49
|
+
if (["line", "bar"].includes(a))
|
|
50
|
+
return /* @__PURE__ */ l(n, { children: [
|
|
51
|
+
/* @__PURE__ */ l(i, { value: "item-1", children: [
|
|
52
|
+
/* @__PURE__ */ e(r, { className: "font-normal", children: /* @__PURE__ */ e("p", { children: "Chart Query" }) }),
|
|
53
|
+
/* @__PURE__ */ l(t, { className: " ", children: [
|
|
54
|
+
/* @__PURE__ */ e("div", { className: "rounded bg-muted px-2 py-1 font-mono text-xs font-semibold", children: "SELECT x-axis, y-axis-1, y-axis-2, y-axis-3,... FROM table" }),
|
|
55
|
+
/* @__PURE__ */ l("ul", { className: "my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2", children: [
|
|
56
|
+
/* @__PURE__ */ e("li", { children: "X-axis - Category (ex. city)" }),
|
|
57
|
+
/* @__PURE__ */ e("li", { children: "Y-axis - Number (ex. population)" })
|
|
58
|
+
] })
|
|
59
|
+
] })
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ l(i, { value: "item-2", children: [
|
|
62
|
+
/* @__PURE__ */ e(r, { className: "font-normal", children: "Mixed Chart" }),
|
|
63
|
+
/* @__PURE__ */ l(t, { className: "space-y-2 text-xs", children: [
|
|
64
|
+
/* @__PURE__ */ l("p", { children: [
|
|
65
|
+
"Click ",
|
|
66
|
+
/* @__PURE__ */ e("b", { children: "Customize" }),
|
|
67
|
+
" and change the `type` property in the dataset."
|
|
68
|
+
] }),
|
|
69
|
+
/* @__PURE__ */ e("pre", { children: JSON.stringify(u, null, 2) })
|
|
70
|
+
] })
|
|
71
|
+
] }),
|
|
72
|
+
/* @__PURE__ */ l(i, { value: "item-3", children: [
|
|
73
|
+
/* @__PURE__ */ e(r, { className: "font-normal", children: "Area Chart" }),
|
|
74
|
+
/* @__PURE__ */ l(t, { className: "space-y-2 text-xs", children: [
|
|
75
|
+
/* @__PURE__ */ l("p", { children: [
|
|
76
|
+
"Click ",
|
|
77
|
+
/* @__PURE__ */ e("b", { children: "Customize" }),
|
|
78
|
+
" and add `fill` property to the dataset. See",
|
|
79
|
+
/* @__PURE__ */ e(
|
|
80
|
+
"a",
|
|
81
|
+
{
|
|
82
|
+
className: "mx-1 text-blue-500 hover:underline",
|
|
83
|
+
href: "https://www.chartjs.org/docs/latest/samples/area/line-boundaries.html",
|
|
84
|
+
target: "_blank",
|
|
85
|
+
children: "docs"
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
"for more options."
|
|
89
|
+
] }),
|
|
90
|
+
/* @__PURE__ */ e("pre", { children: JSON.stringify(x, null, 2) })
|
|
91
|
+
] })
|
|
92
|
+
] })
|
|
93
|
+
] });
|
|
94
|
+
if (a === "bubble")
|
|
95
|
+
return /* @__PURE__ */ e(n, { children: /* @__PURE__ */ l(i, { value: "item-1", children: [
|
|
96
|
+
/* @__PURE__ */ e(r, { className: "font-normal", children: /* @__PURE__ */ l("p", { children: [
|
|
97
|
+
"How to create a ",
|
|
98
|
+
/* @__PURE__ */ e("span", { children: a }),
|
|
99
|
+
" chart query?"
|
|
100
|
+
] }) }),
|
|
101
|
+
/* @__PURE__ */ l(t, { className: " ", children: [
|
|
102
|
+
/* @__PURE__ */ e("div", { className: "rounded bg-muted px-2 py-1 font-mono text-xs font-semibold", children: "SELECT label, x-axis, y-axis, radius FROM table" }),
|
|
103
|
+
/* @__PURE__ */ l("ul", { className: "my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2", children: [
|
|
104
|
+
/* @__PURE__ */ e("li", { children: "Label - Category (ex. city)" }),
|
|
105
|
+
/* @__PURE__ */ e("li", { children: "Bubble Group (opt) - Category (ex. state)" }),
|
|
106
|
+
/* @__PURE__ */ e("li", { children: "X-axis - Number (ex. avg. age)" }),
|
|
107
|
+
/* @__PURE__ */ e("li", { children: "Y-axis - Number (ex. avg. weight)" }),
|
|
108
|
+
/* @__PURE__ */ e("li", { children: "Radius - Number (ex. population)" })
|
|
109
|
+
] })
|
|
110
|
+
] })
|
|
111
|
+
] }) });
|
|
112
|
+
if (a === "scatter")
|
|
113
|
+
return /* @__PURE__ */ e(n, { children: /* @__PURE__ */ l(i, { value: "item-1", children: [
|
|
114
|
+
/* @__PURE__ */ e(r, { className: "font-normal", children: /* @__PURE__ */ l("p", { children: [
|
|
115
|
+
"How to create a ",
|
|
116
|
+
/* @__PURE__ */ e("span", { children: a }),
|
|
117
|
+
" chart query?"
|
|
118
|
+
] }) }),
|
|
119
|
+
/* @__PURE__ */ l(t, { className: " ", children: [
|
|
120
|
+
/* @__PURE__ */ e("div", { className: "rounded bg-muted px-2 py-1 font-mono text-xs font-semibold", children: "SELECT label, x-axis, y-axis FROM table" }),
|
|
121
|
+
/* @__PURE__ */ l("ul", { className: "my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2", children: [
|
|
122
|
+
/* @__PURE__ */ e("li", { children: "Label - Category (ex. city)" }),
|
|
123
|
+
/* @__PURE__ */ e("li", { children: "Group (opt) - Category (ex. state)" }),
|
|
124
|
+
/* @__PURE__ */ e("li", { children: "X-axis - Number (ex. avg. age)" }),
|
|
125
|
+
/* @__PURE__ */ e("li", { children: "Y-axis - Number (ex. avg. weight)" })
|
|
126
|
+
] })
|
|
127
|
+
] })
|
|
128
|
+
] }) });
|
|
129
|
+
if (["pie", "doughnut", "polarArea", "funnel"].includes(a))
|
|
130
|
+
return /* @__PURE__ */ e(n, { children: /* @__PURE__ */ l(i, { value: "item-1", children: [
|
|
131
|
+
/* @__PURE__ */ e(r, { className: "font-normal", children: /* @__PURE__ */ l("p", { children: [
|
|
132
|
+
/* @__PURE__ */ e("span", { children: a === "polarArea" ? "Polar" : a.charAt(0).toUpperCase() + a.slice(1) }),
|
|
133
|
+
" ",
|
|
134
|
+
"chart query"
|
|
135
|
+
] }) }),
|
|
136
|
+
/* @__PURE__ */ l(t, { className: " ", children: [
|
|
137
|
+
/* @__PURE__ */ e("div", { className: "rounded bg-muted px-2 py-1 font-mono text-xs font-semibold", children: "SELECT label, measure FROM table" }),
|
|
138
|
+
/* @__PURE__ */ l("ul", { className: "my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2", children: [
|
|
139
|
+
/* @__PURE__ */ e("li", { children: "Label - Category (ex. city)" }),
|
|
140
|
+
/* @__PURE__ */ e("li", { children: "Measure - Number (ex. population)" })
|
|
141
|
+
] })
|
|
142
|
+
] })
|
|
143
|
+
] }) });
|
|
144
|
+
}
|
|
145
|
+
export {
|
|
146
|
+
C as default
|
|
147
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),e=require("./index-Bvtpj-_R.js"),h=require("./reusable-select-CVRzPWkg.js"),R=require("./use-plugin-query-JdHNPYZS.js");/**
|
|
2
|
+
* @license lucide-react v0.453.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const q=e.createLucideIcon("Blocks",[["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["path",{d:"M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3",key:"1fpvtg"}]]);/**
|
|
7
|
+
* @license lucide-react v0.453.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const L=e.createLucideIcon("Component",[["path",{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1uwlt4"}],["path",{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z",key:"10291m"}],["path",{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z",key:"1tqoq1"}],["path",{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1x6lto"}]]);function f(){var N,y;const l=e.useEditorStore(a=>a.card.customCardPreferences),{data:r}=R.usePluginQuery(),I=(r==null?void 0:r.plugins)||[],x=e.useEditorStore(a=>a.card),j=e.useEditorStore(a=>a.frame),v=(l==null?void 0:l.visualType)||"single",{setCustomCardPreferences:c}=e.useEditorActions(),{components:g,manifest:m}=e.useCustomVisual((l==null?void 0:l.url)||""),d=(N=m==null?void 0:m.visuals)==null?void 0:N.find(a=>a.name===(l==null?void 0:l.componentName));function S(a,i){if(!l)return;const t={...(l==null?void 0:l.dataInputCardIds)||{},[a]:{cardId:i,hookRef:null}};c({...l,dataInputCardIds:t})}function T(a){var o,t;const i=(o=j==null?void 0:j.cards)==null?void 0:o.filter(n=>{var u;return((u=n==null?void 0:n.customCardPreferences)==null?void 0:u.visualType)!=="multiple"}).map(n=>({value:n.id,label:n.tabTitle||n.title}));return s.jsx("div",{className:"space-y-2",children:(t=a==null?void 0:a.dataInputs)==null?void 0:t.map((n,u)=>{var p,b;return s.jsxs("div",{className:"grid grid-cols-10 gap-2",children:[s.jsx("div",{className:"col-span-4 flex items-center",children:n}),s.jsx(h.ReusableSelect,{className:"col-span-6 h-8 w-full justify-between",label:"",options:i||[],value:((b=(p=l==null?void 0:l.dataInputCardIds)==null?void 0:p[u])==null?void 0:b.cardId)||"",onValueChange:A=>S(u,A)})]},u+Math.random())})})}function w(a,i,o=[],t=""){var n,u;return l?a==="input"?s.jsx(e.Input,{className:`h-8 w-full ${e.removeRing}`,value:((n=l==null?void 0:l.settings)==null?void 0:n[i])||t,onChange:p=>{c({...l,settings:{...l==null?void 0:l.settings,[i]:p.target.value}})}},i):a==="select"?s.jsx(h.ReusableSelect,{className:"h-8 w-full",label:"",options:o,value:((u=l==null?void 0:l.settings)==null?void 0:u[i])||t,onValueChange:p=>{c({...l,settings:{...l==null?void 0:l.settings,[i]:p}})}}):null:null}function V(a){const i=Object.entries((a==null?void 0:a.settings)||{});return s.jsx("div",{className:"space-y-3",children:i.map(([o,t])=>s.jsxs("div",{className:"space-y-1",children:[s.jsx(e.Label,{children:t.title}),w(t.ui,o,t.options,t.defaultValue)]},o))})}function M(a){l&&c({...l,visualType:a,componentName:""})}return s.jsxs(e.Accordion,{type:"multiple",defaultValue:["component-settings"],className:"px-6 py-2",children:[s.jsxs(e.AccordionItem,{value:"plugin-settings",children:[s.jsx(e.AccordionTrigger,{children:"Plugin"}),s.jsx(e.AccordionContent,{children:s.jsxs("div",{className:"space-y-4 text-sm",children:[s.jsx("div",{className:"space-y-2",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx(h.ReusableSelect,{icon:s.jsx(q,{className:"h-3.5 w-3.5"}),className:"h-9 w-full",label:"Select Plugin",options:I,value:(l==null?void 0:l.url)||"",onValueChange:a=>c({...l||{url:"",componentName:""},url:a})}),((l==null?void 0:l.type)==="component"||(l==null?void 0:l.type)===void 0)&&s.jsx(e.Tabs,{value:v,onValueChange:M,children:s.jsxs(e.TabsList,{className:"h-9 w-full",children:[s.jsx(e.TabsTrigger,{className:"h-7 w-full",value:"single",children:"Single Visual"}),s.jsx(e.TabsTrigger,{className:"h-7 w-full",value:"multiple",children:"Multi-Visual"})]})})]})}),((l==null?void 0:l.type)==="component"||(l==null?void 0:l.type)===void 0)&&l&&s.jsx(s.Fragment,{children:g&&s.jsx(h.ReusableSelect,{icon:s.jsx(L,{className:"h-3.5 w-3.5"}),className:"h-9 w-full",label:"Select Component",options:(g==null?void 0:g.filter(a=>a.type===v).map(a=>({value:a.name,label:a.name})))||[],value:l.componentName,onValueChange:a=>{console.log("changing value",a),c({...l,componentName:a})}})})]})})]}),((y=x==null?void 0:x.customCardPreferences)==null?void 0:y.componentName)&&s.jsxs(e.AccordionItem,{className:"border-none",value:"component-settings",children:[s.jsx(e.AccordionTrigger,{children:"Settings"}),s.jsxs(e.AccordionContent,{children:[d&&d.dataInputs&&s.jsxs("div",{className:"space-y-3",children:[s.jsx(e.Label,{children:"Input Mapping"}),s.jsx("div",{className:"px-2",children:T(d)})]}),d&&d.settings&&s.jsx("div",{className:"space-y-3",children:s.jsx("div",{className:"px-2",children:V(d)})})]})]})]})}exports.CustomVisualSettings=f;
|