react-semaphor 0.1.59 → 0.1.61

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.
Files changed (53) hide show
  1. package/dist/chunks/axis-mapping-8ZVwlkl6.js +315 -0
  2. package/dist/chunks/axis-mapping-Cwa3KrDR.js +16 -0
  3. package/dist/chunks/bar-chart-settings-B_WyC-7g.js +52 -0
  4. package/dist/chunks/bar-chart-settings-CvorW7RD.js +1 -0
  5. package/dist/chunks/bubble-chart-settings-BPtESqYK.js +1 -0
  6. package/dist/chunks/bubble-chart-settings-CxFAlErV.js +50 -0
  7. package/dist/chunks/common-chart-settings-CvRrQf-H.js +1 -0
  8. package/dist/chunks/common-chart-settings-D3ww0Xtx.js +147 -0
  9. package/dist/chunks/custom-visual-settings-DXWyN2Dr.js +11 -0
  10. package/dist/chunks/custom-visual-settings-m5o8R5tL.js +243 -0
  11. package/dist/chunks/dashboard-plus-B8-ocT_Z.js +41 -0
  12. package/dist/chunks/dashboard-plus-DSUKhvcv.js +2941 -0
  13. package/dist/chunks/display-labels-BYsRReye.js +1 -0
  14. package/dist/chunks/display-labels-C_jsL0Jo.js +74 -0
  15. package/dist/chunks/editor-C7xQi9Ab.js +105 -0
  16. package/dist/chunks/editor-DqvyBUrl.js +8321 -0
  17. package/dist/chunks/filter-on-click-columns-6dRYhvgz.js +1 -0
  18. package/dist/chunks/filter-on-click-columns-BJUGTE6W.js +120 -0
  19. package/dist/chunks/frame-filters-D9sDN4Vm.js +1 -0
  20. package/dist/chunks/frame-filters-DFgqSoV2.js +75 -0
  21. package/dist/chunks/{index-D4y2uVa5.js → index--MUeDITx.js} +28329 -25746
  22. package/dist/chunks/index-Bvtpj-_R.js +1080 -0
  23. package/dist/chunks/kpi-settings-BONvmfNr.js +1 -0
  24. package/dist/chunks/kpi-settings-CI-9fp4Z.js +286 -0
  25. package/dist/chunks/map-chart-settings-CSxZdu_g.js +1 -0
  26. package/dist/chunks/map-chart-settings-DQIN7Pn8.js +334 -0
  27. package/dist/chunks/pie-chart-settings-CN3JCLdP.js +86 -0
  28. package/dist/chunks/pie-chart-settings-CsErfZOL.js +1 -0
  29. package/dist/chunks/reusable-select-CQbD03nT.js +40 -0
  30. package/dist/chunks/reusable-select-CVRzPWkg.js +1 -0
  31. package/dist/chunks/stacked-chart-settings-BfqHFFqA.js +1 -0
  32. package/dist/chunks/stacked-chart-settings-poYotO6Q.js +90 -0
  33. package/dist/chunks/table-visual-settings-B46pdUra.js +46 -0
  34. package/dist/chunks/table-visual-settings-ZKWuNokZ.js +1 -0
  35. package/dist/chunks/tag-BrxBSbSe.js +20 -0
  36. package/dist/chunks/tag-D9G2kz2B.js +6 -0
  37. package/dist/chunks/use-assign-filter-5gplfsO1.js +83 -0
  38. package/dist/chunks/use-assign-filter-DzmBSsyO.js +1 -0
  39. package/dist/chunks/use-local-storage-state-CBh2HHB9.js +16 -0
  40. package/dist/chunks/use-local-storage-state-CL0JsTZM.js +1745 -0
  41. package/dist/chunks/use-plugin-query-DA6Yrp7P.js +12 -0
  42. package/dist/chunks/use-plugin-query-JdHNPYZS.js +1 -0
  43. package/dist/dashboard/index.cjs +1 -1
  44. package/dist/dashboard/index.js +1 -1
  45. package/dist/index.cjs +1 -1
  46. package/dist/index.js +103 -103
  47. package/dist/style.css +1 -1
  48. package/dist/surfboard/index.cjs +1 -1
  49. package/dist/surfboard/index.js +1 -1
  50. package/package.json +1 -1
  51. package/dist/chunks/dashboard-plus-B-lXkbRY.js +0 -225
  52. package/dist/chunks/dashboard-plus-CHqCwJFO.js +0 -17362
  53. package/dist/chunks/index-CLxl35mK.js +0 -1045
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("react"),s=require("./index-Bvtpj-_R.js");function S({colorRanges:l,setColorRanges:d}){const h={start:-1/0,end:100,color:""};function u(c,a,r){const x=[...l];x[c]={...x[c],[a]:r},d(x)}function m(c){const a=[...l];a.splice(c,1),d(a)}function j(){d([...l,h])}return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Label,{children:"Color Range"}),e.jsx(s.Button,{onClick:j,variant:"secondary",className:"h-5 p-1 text-muted-foreground",children:e.jsx(s.Plus,{className:"size-3"})})]}),l.map((c,a)=>e.jsxs("div",{className:"flex items-center gap-2 px-2",children:[e.jsx(s.Input,{onChange:r=>u(a,"start",r.target.value),value:c.start,className:s.cn(`h-7 ${s.removeRing}`)}),e.jsx("span",{children:"-"}),e.jsx(s.Input,{value:c.end,onChange:r=>u(a,"end",r.target.value),className:s.cn(`h-7 ${s.removeRing}`)}),e.jsx(s.Input,{onChange:r=>u(a,"color",r.target.value),value:c.color,className:s.cn(`h-7 min-w-14 p-0 ${s.removeRing}`),type:"color",list:"presetColors"}),e.jsxs("datalist",{id:"presetColors",children:[e.jsx("option",{children:s.colors.green[600]}),e.jsx("option",{children:s.colors.red[500]}),e.jsx("option",{children:s.colors.yellow[400]}),e.jsx("option",{children:s.colors.orange[500]})]}),e.jsx(s.Button,{onClick:()=>m(a),variant:"secondary",className:"h-5 p-1 text-muted-foreground",children:e.jsx(s.X,{className:"size-3"})})]},a))]})}function C(){var g,N,p,f,b;const l=s.useEditorStore(t=>t.card.preferences),d=s.useEditorStore(t=>t.actions.setCardPreferences),h=s.useEditorStore(t=>t.card),u=s.hasValidCardConfig(h.config),m=s.useEditorStore(t=>t.actions.setNumberFormat);s.useEditorStore(t=>{var o,n;return(n=(o=t.card.preferences)==null?void 0:o.formatNumber)==null?void 0:n.decimalPlaces});const j=s.useEditorStore(t=>{var o,n;return(n=(o=t.card.preferences)==null?void 0:o.formatNumber)==null?void 0:n.locale}),c=s.useEditorStore(t=>{var o,n;return(n=(o=t.card.preferences)==null?void 0:o.formatNumber)==null?void 0:n.currency});s.useEditorStore(t=>t.actions.setFilterOnClickField);const a=s.useEditorStore(t=>{var o,n;return(n=(o=t.card.preferences)==null?void 0:o.formatNumber)==null?void 0:n.colorRanges})||[],r=s.useEditorStore(t=>t.actions.setColorRanges),x=[...new Set(s.LOCALE_CURRENCY_PAIRS.map(t=>t.currency))];return e.jsxs("div",{children:[!u&&e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(s.Checkbox,{checked:!!((g=l==null?void 0:l.formatNumber)!=null&&g.enabled),onCheckedChange:t=>{d({...l,formatNumber:{...l==null?void 0:l.formatNumber,enabled:t}})}}),e.jsx(s.Label,{children:"Format Number"})]}),(((N=l==null?void 0:l.formatNumber)==null?void 0:N.enabled)===!0||u)&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("div",{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"w-full space-y-1",children:[e.jsx(s.Label,{children:"Locale"}),e.jsxs(s.Select,{value:j||"none",onValueChange:t=>{var o,n,i;return m(((o=l==null?void 0:l.formatNumber)==null?void 0:o.decimalPlaces)||0,((n=l==null?void 0:l.formatNumber)==null?void 0:n.currency)||"",t,((i=l==null?void 0:l.formatNumber)==null?void 0:i.suffix)||"")},children:[e.jsx(s.SelectTrigger,{className:"col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0",children:e.jsx(s.SelectValue,{})}),e.jsx(s.SelectContent,{children:e.jsxs(s.SelectGroup,{children:[e.jsx(s.SelectLabel,{children:"Format"}),e.jsx(s.SelectItem,{value:"none",children:"Auto"},"none"),s.LOCALE_CURRENCY_PAIRS.map(t=>e.jsx(s.SelectItem,{value:t.locale,children:t.locale},t.locale))]})})]})]}),e.jsxs("div",{className:"w-full space-y-1",children:[e.jsx(s.Label,{children:"Currency"}),e.jsxs(s.Select,{value:c||"none",onValueChange:t=>{var o,n,i;console.log("currency",t),m(((o=l==null?void 0:l.formatNumber)==null?void 0:o.decimalPlaces)||0,t==="none"?"":t,((n=l==null?void 0:l.formatNumber)==null?void 0:n.locale)||"",((i=l==null?void 0:l.formatNumber)==null?void 0:i.suffix)||"")},children:[e.jsx(s.SelectTrigger,{className:"col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0",children:e.jsx(s.SelectValue,{})}),e.jsx(s.SelectContent,{children:e.jsxs(s.SelectGroup,{children:[e.jsx(s.SelectLabel,{children:"Currency"}),e.jsx(s.SelectItem,{value:"none",children:"None"},"none"),x.map(t=>e.jsx(s.SelectItem,{value:t,children:t},t))]})})]})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"w-full space-y-1",children:[e.jsx(s.Label,{children:"Decimals"}),e.jsxs(s.Select,{value:((f=(p=l==null?void 0:l.formatNumber)==null?void 0:p.decimalPlaces)==null?void 0:f.toString())||"0",onValueChange:t=>{var o,n,i;return m(Number(t),((o=l==null?void 0:l.formatNumber)==null?void 0:o.currency)||"",((n=l==null?void 0:l.formatNumber)==null?void 0:n.locale)||"",((i=l==null?void 0:l.formatNumber)==null?void 0:i.suffix)||"")},children:[e.jsx(s.SelectTrigger,{className:"col-span-3 h-8 w-full focus:ring-1 focus:ring-offset-0",children:e.jsx(s.SelectValue,{})}),e.jsx(s.SelectContent,{children:["0","1","2","3","4"].map(t=>e.jsx(s.SelectItem,{value:t,children:t},t))})]})]}),e.jsxs("div",{className:"w-full space-y-1",children:[e.jsx(s.Label,{children:"Suffix"}),e.jsx(s.Input,{value:((b=l==null?void 0:l.formatNumber)==null?void 0:b.suffix)||"",className:"h-8 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",placeholder:"K, M, B, %",onChange:t=>{var o,n,i;return m(((o=l==null?void 0:l.formatNumber)==null?void 0:o.decimalPlaces)||0,((n=l==null?void 0:l.formatNumber)==null?void 0:n.currency)||"",((i=l==null?void 0:l.formatNumber)==null?void 0:i.locale)||"",t.target.value)}})]})]})]})}),e.jsx(s.Separator,{className:"my-3"}),e.jsx(S,{colorRanges:a,setColorRanges:r})]})]})}function y(){return e.jsxs("div",{className:"space-y-6 px-6 py-2",children:[e.jsx(s.Accordion,{type:"single",collapsible:!0,children:e.jsxs(s.AccordionItem,{value:"item-1",children:[e.jsx(s.AccordionTrigger,{className:"",children:"KPI Query"}),e.jsxs(s.AccordionContent,{className:"font-mono",children:[e.jsx("div",{className:"rounded bg-muted px-2 py-1 font-mono text-xs",children:"SELECT current, previous FROM table"}),e.jsxs("ul",{className:"my-6 ml-6 list-disc text-xs [&>li]:mt-2",children:[e.jsx("li",{children:"current - number"}),e.jsx("li",{children:"previous - number"})]}),e.jsxs("div",{children:["See ",e.jsx("a",{target:"_blank",onClick:l=>l.stopPropagation(),className:"text-blue-700",href:"https://docs.semaphor.cloud/docs/charts/kpi",children:"example"})," in the docs."]})]})]})}),e.jsx("section",{className:"",children:e.jsx(C,{})}),e.jsx("div",{}),e.jsx("div",{})]})}const R=v.memo(y);exports.default=R;
@@ -0,0 +1,286 @@
1
+ import { jsxs as n, jsx as l } from "react/jsx-runtime";
2
+ import { memo as B } from "react";
3
+ import { L as h, B as V, _ as K, I as v, q as x, X as y, $ as g, a0 as O, u as r, a1 as T, a2 as _, C as j, S, s as w, v as R, w as k, x as $, y as z, z as f, W as M, A as X, a as q, b as D, c as G } from "./index--MUeDITx.js";
4
+ function Q({
5
+ colorRanges: e,
6
+ setColorRanges: N
7
+ }) {
8
+ const b = {
9
+ start: -1 / 0,
10
+ end: 100,
11
+ color: ""
12
+ };
13
+ function u(c, s, m) {
14
+ const p = [...e];
15
+ p[c] = {
16
+ ...p[c],
17
+ [s]: m
18
+ }, N(p);
19
+ }
20
+ function d(c) {
21
+ const s = [...e];
22
+ s.splice(c, 1), N(s);
23
+ }
24
+ function C() {
25
+ N([...e, b]);
26
+ }
27
+ return /* @__PURE__ */ n("div", { className: "space-y-3", children: [
28
+ /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
29
+ /* @__PURE__ */ l(h, { children: "Color Range" }),
30
+ /* @__PURE__ */ l(
31
+ V,
32
+ {
33
+ onClick: C,
34
+ variant: "secondary",
35
+ className: "h-5 p-1 text-muted-foreground",
36
+ children: /* @__PURE__ */ l(K, { className: "size-3" })
37
+ }
38
+ )
39
+ ] }),
40
+ e.map((c, s) => /* @__PURE__ */ n("div", { className: "flex items-center gap-2 px-2", children: [
41
+ /* @__PURE__ */ l(
42
+ v,
43
+ {
44
+ onChange: (m) => u(s, "start", m.target.value),
45
+ value: c.start,
46
+ className: x(`h-7 ${y}`)
47
+ }
48
+ ),
49
+ /* @__PURE__ */ l("span", { children: "-" }),
50
+ /* @__PURE__ */ l(
51
+ v,
52
+ {
53
+ value: c.end,
54
+ onChange: (m) => u(s, "end", m.target.value),
55
+ className: x(`h-7 ${y}`)
56
+ }
57
+ ),
58
+ /* @__PURE__ */ l(
59
+ v,
60
+ {
61
+ onChange: (m) => u(s, "color", m.target.value),
62
+ value: c.color,
63
+ className: x(`h-7 min-w-14 p-0 ${y}`),
64
+ type: "color",
65
+ list: "presetColors"
66
+ }
67
+ ),
68
+ /* @__PURE__ */ n("datalist", { id: "presetColors", children: [
69
+ /* @__PURE__ */ l("option", { children: g.green[600] }),
70
+ /* @__PURE__ */ l("option", { children: g.red[500] }),
71
+ /* @__PURE__ */ l("option", { children: g.yellow[400] }),
72
+ /* @__PURE__ */ l("option", { children: g.orange[500] })
73
+ ] }),
74
+ /* @__PURE__ */ l(
75
+ V,
76
+ {
77
+ onClick: () => d(s),
78
+ variant: "secondary",
79
+ className: "h-5 p-1 text-muted-foreground",
80
+ children: /* @__PURE__ */ l(O, { className: "size-3" })
81
+ }
82
+ )
83
+ ] }, s))
84
+ ] });
85
+ }
86
+ function U() {
87
+ var A, F, I, L, E;
88
+ const e = r((a) => a.card.preferences), N = r(
89
+ (a) => a.actions.setCardPreferences
90
+ ), b = r((a) => a.card), u = T(b.config), d = r(
91
+ (a) => a.actions.setNumberFormat
92
+ );
93
+ r(
94
+ (a) => {
95
+ var o, t;
96
+ return (t = (o = a.card.preferences) == null ? void 0 : o.formatNumber) == null ? void 0 : t.decimalPlaces;
97
+ }
98
+ );
99
+ const C = r(
100
+ (a) => {
101
+ var o, t;
102
+ return (t = (o = a.card.preferences) == null ? void 0 : o.formatNumber) == null ? void 0 : t.locale;
103
+ }
104
+ ), c = r(
105
+ (a) => {
106
+ var o, t;
107
+ return (t = (o = a.card.preferences) == null ? void 0 : o.formatNumber) == null ? void 0 : t.currency;
108
+ }
109
+ );
110
+ r(
111
+ (a) => a.actions.setFilterOnClickField
112
+ );
113
+ const s = r(
114
+ (a) => {
115
+ var o, t;
116
+ return (t = (o = a.card.preferences) == null ? void 0 : o.formatNumber) == null ? void 0 : t.colorRanges;
117
+ }
118
+ ) || [], m = r(
119
+ (a) => a.actions.setColorRanges
120
+ ), p = [...new Set(_.map((a) => a.currency))];
121
+ return /* @__PURE__ */ n("div", { children: [
122
+ !u && /* @__PURE__ */ n("div", { className: "mb-3 flex items-center gap-2", children: [
123
+ /* @__PURE__ */ l(
124
+ j,
125
+ {
126
+ checked: !!((A = e == null ? void 0 : e.formatNumber) != null && A.enabled),
127
+ onCheckedChange: (a) => {
128
+ N({
129
+ ...e,
130
+ formatNumber: {
131
+ ...e == null ? void 0 : e.formatNumber,
132
+ enabled: a
133
+ }
134
+ });
135
+ }
136
+ }
137
+ ),
138
+ /* @__PURE__ */ l(h, { children: "Format Number" })
139
+ ] }),
140
+ (((F = e == null ? void 0 : e.formatNumber) == null ? void 0 : F.enabled) === !0 || u) && /* @__PURE__ */ n("div", { className: "flex flex-col gap-2", children: [
141
+ /* @__PURE__ */ l("div", { children: /* @__PURE__ */ n("div", { className: "space-y-4", children: [
142
+ /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
143
+ /* @__PURE__ */ n("div", { className: "w-full space-y-1", children: [
144
+ /* @__PURE__ */ l(h, { children: "Locale" }),
145
+ /* @__PURE__ */ n(
146
+ S,
147
+ {
148
+ value: C || "none",
149
+ onValueChange: (a) => {
150
+ var o, t, i;
151
+ return d(
152
+ ((o = e == null ? void 0 : e.formatNumber) == null ? void 0 : o.decimalPlaces) || 0,
153
+ ((t = e == null ? void 0 : e.formatNumber) == null ? void 0 : t.currency) || "",
154
+ a,
155
+ ((i = e == null ? void 0 : e.formatNumber) == null ? void 0 : i.suffix) || ""
156
+ );
157
+ },
158
+ children: [
159
+ /* @__PURE__ */ l(w, { className: "col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ l(R, {}) }),
160
+ /* @__PURE__ */ l(k, { children: /* @__PURE__ */ n($, { children: [
161
+ /* @__PURE__ */ l(z, { children: "Format" }),
162
+ /* @__PURE__ */ l(f, { value: "none", children: "Auto" }, "none"),
163
+ _.map((a) => /* @__PURE__ */ l(f, { value: a.locale, children: a.locale }, a.locale))
164
+ ] }) })
165
+ ]
166
+ }
167
+ )
168
+ ] }),
169
+ /* @__PURE__ */ n("div", { className: "w-full space-y-1", children: [
170
+ /* @__PURE__ */ l(h, { children: "Currency" }),
171
+ /* @__PURE__ */ n(
172
+ S,
173
+ {
174
+ value: c || "none",
175
+ onValueChange: (a) => {
176
+ var o, t, i;
177
+ console.log("currency", a), d(
178
+ ((o = e == null ? void 0 : e.formatNumber) == null ? void 0 : o.decimalPlaces) || 0,
179
+ a === "none" ? "" : a,
180
+ ((t = e == null ? void 0 : e.formatNumber) == null ? void 0 : t.locale) || "",
181
+ ((i = e == null ? void 0 : e.formatNumber) == null ? void 0 : i.suffix) || ""
182
+ );
183
+ },
184
+ children: [
185
+ /* @__PURE__ */ l(w, { className: "col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ l(R, {}) }),
186
+ /* @__PURE__ */ l(k, { children: /* @__PURE__ */ n($, { children: [
187
+ /* @__PURE__ */ l(z, { children: "Currency" }),
188
+ /* @__PURE__ */ l(f, { value: "none", children: "None" }, "none"),
189
+ p.map((a) => /* @__PURE__ */ l(f, { value: a, children: a }, a))
190
+ ] }) })
191
+ ]
192
+ }
193
+ )
194
+ ] })
195
+ ] }),
196
+ /* @__PURE__ */ n("div", { className: "flex gap-2", children: [
197
+ /* @__PURE__ */ n("div", { className: "w-full space-y-1", children: [
198
+ /* @__PURE__ */ l(h, { children: "Decimals" }),
199
+ /* @__PURE__ */ n(
200
+ S,
201
+ {
202
+ value: ((L = (I = e == null ? void 0 : e.formatNumber) == null ? void 0 : I.decimalPlaces) == null ? void 0 : L.toString()) || "0",
203
+ onValueChange: (a) => {
204
+ var o, t, i;
205
+ return d(
206
+ Number(a),
207
+ ((o = e == null ? void 0 : e.formatNumber) == null ? void 0 : o.currency) || "",
208
+ ((t = e == null ? void 0 : e.formatNumber) == null ? void 0 : t.locale) || "",
209
+ ((i = e == null ? void 0 : e.formatNumber) == null ? void 0 : i.suffix) || ""
210
+ );
211
+ },
212
+ children: [
213
+ /* @__PURE__ */ l(w, { className: "col-span-3 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ l(R, {}) }),
214
+ /* @__PURE__ */ l(k, { children: ["0", "1", "2", "3", "4"].map((a) => /* @__PURE__ */ l(f, { value: a, children: a }, a)) })
215
+ ]
216
+ }
217
+ )
218
+ ] }),
219
+ /* @__PURE__ */ n("div", { className: "w-full space-y-1", children: [
220
+ /* @__PURE__ */ l(h, { children: "Suffix" }),
221
+ /* @__PURE__ */ l(
222
+ v,
223
+ {
224
+ value: ((E = e == null ? void 0 : e.formatNumber) == null ? void 0 : E.suffix) || "",
225
+ className: "h-8 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",
226
+ placeholder: "K, M, B, %",
227
+ onChange: (a) => {
228
+ var o, t, i;
229
+ return d(
230
+ ((o = e == null ? void 0 : e.formatNumber) == null ? void 0 : o.decimalPlaces) || 0,
231
+ ((t = e == null ? void 0 : e.formatNumber) == null ? void 0 : t.currency) || "",
232
+ ((i = e == null ? void 0 : e.formatNumber) == null ? void 0 : i.locale) || "",
233
+ a.target.value
234
+ );
235
+ }
236
+ }
237
+ )
238
+ ] })
239
+ ] })
240
+ ] }) }),
241
+ /* @__PURE__ */ l(M, { className: "my-3" }),
242
+ /* @__PURE__ */ l(
243
+ Q,
244
+ {
245
+ colorRanges: s,
246
+ setColorRanges: m
247
+ }
248
+ )
249
+ ] })
250
+ ] });
251
+ }
252
+ function W() {
253
+ return /* @__PURE__ */ n("div", { className: "space-y-6 px-6 py-2", children: [
254
+ /* @__PURE__ */ l(X, { type: "single", collapsible: !0, children: /* @__PURE__ */ n(q, { value: "item-1", children: [
255
+ /* @__PURE__ */ l(D, { className: "", children: "KPI Query" }),
256
+ /* @__PURE__ */ n(G, { className: "font-mono", children: [
257
+ /* @__PURE__ */ l("div", { className: "rounded bg-muted px-2 py-1 font-mono text-xs", children: "SELECT current, previous FROM table" }),
258
+ /* @__PURE__ */ n("ul", { className: "my-6 ml-6 list-disc text-xs [&>li]:mt-2", children: [
259
+ /* @__PURE__ */ l("li", { children: "current - number" }),
260
+ /* @__PURE__ */ l("li", { children: "previous - number" })
261
+ ] }),
262
+ /* @__PURE__ */ n("div", { children: [
263
+ "See ",
264
+ /* @__PURE__ */ l(
265
+ "a",
266
+ {
267
+ target: "_blank",
268
+ onClick: (e) => e.stopPropagation(),
269
+ className: "text-blue-700",
270
+ href: "https://docs.semaphor.cloud/docs/charts/kpi",
271
+ children: "example"
272
+ }
273
+ ),
274
+ " in the docs."
275
+ ] })
276
+ ] })
277
+ ] }) }),
278
+ /* @__PURE__ */ l("section", { className: "", children: /* @__PURE__ */ l(U, {}) }),
279
+ /* @__PURE__ */ l("div", {}),
280
+ /* @__PURE__ */ l("div", {})
281
+ ] });
282
+ }
283
+ const Z = B(W);
284
+ export {
285
+ Z as default
286
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),l=require("./index-Bvtpj-_R.js"),m=require("./reusable-select-CVRzPWkg.js"),M=require("react"),T=require("./filter-on-click-columns-6dRYhvgz.js");function j({children:e,summary:u,open:t,className:b}){return s.jsxs("details",{open:t,className:l.cn("space-y-4 [&_summary>svg]:open:-rotate-180",b),children:[s.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-4",children:[s.jsx(l.Label,{children:u}),s.jsx(l.ChevronUp,{className:"h-4 w-4"})]}),s.jsx("div",{className:"transition-all ease-in-out",children:e})]})}const A=[{label:"Mercator",value:"mercator"},{label:"Azimuthal Equidistant",value:"azimuthalEquidistant"},{label:"Gnomonic",value:"gnomonic"},{label:"Orthographic",value:"orthographic"},{label:"Stereographic",value:"stereographic"},{label:"Equal Earth",value:"equalEarth"},{label:"Albers",value:"albers"},{label:"Albers USA",value:"albersUsa"},{label:"Conic Conformal",value:"conicConformal"},{label:"Conic Equal Area",value:"conicEqualArea"},{label:"Conic Equidistant",value:"conicEquidistant"},{label:"Equirectangular",value:"equirectangular"},{label:"Transverse Mercator",value:"transverseMercator"},{label:"Natural Earth 1",value:"naturalEarth1"}],J=["blues","brBG","buGn","buPu","cividis","cool","cubehelixDefault","gnBu","greens","greys","inferno","magma","orRd","oranges","pRGn","piYG","plasma","puBu","puBuGn","puOr","puRd","purples","rainbow","rdBu","rdGy","rdPu","rdYlBu","rdYlGn","reds","sinebow","spectral","turbo","viridis","warm","ylGn","ylGnBu","ylOrBr","ylOrRd"],P=J.map(e=>({label:e,value:e}));function I(){var O,f,h,d,v,g,x,C,S,N,y,V,E,R,q,L,U,w;const e=l.useEditorStore(a=>a.card),u=(f=(O=e==null?void 0:e.preferences)==null?void 0:O.mapVisualOptions)==null?void 0:f.topoJsonUrl,[t,b]=M.useState(((d=(h=e==null?void 0:e.preferences)==null?void 0:h.mapVisualOptions)==null?void 0:d.customTopoJsonUrl)||""),{setCardPreferences:n}=l.useEditorActions(),{data:p}=l.useTopoJson(e),B=Object.keys((p==null?void 0:p.objects)||{}).map(a=>({label:a,value:a}))||[],G=[{label:"US States 10m",value:"https://unpkg.com/us-atlas/states-10m.json"},{label:"Countries 50m",value:"https://unpkg.com/world-atlas/countries-50m.json"},{label:"Custom",value:"custom"}];return s.jsxs("div",{className:"p-6",children:[s.jsx(j,{summary:"Map Chart",children:s.jsx("p",{className:"rounded-md bg-muted p-2 font-mono text-xs",children:"SELECT country, value FROM table"})}),s.jsx(l.Separator,{className:"my-4"}),s.jsx(j,{open:!0,summary:"Settings",children:s.jsxs("div",{className:"space-y-3 px-2",children:[s.jsx(m.ReusableSelect,{className:"h-9",options:G,onValueChange:a=>{console.log("value",a),n({...e.preferences,mapVisualOptions:{topoJsonUrl:a}})},value:u||"",label:"Select Map"}),u==="custom"&&s.jsx(l.Input,{onChange:a=>{b(a.target.value)},onBlur:()=>{var a;console.log("onBlur",t),n({...e.preferences,mapVisualOptions:{...(a=e.preferences)==null?void 0:a.mapVisualOptions,customTopoJsonUrl:t}})},value:t,className:`h-9 w-full ${l.removeRing}`,placeholder:"Custom URL"}),p&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(l.Label,{children:"Map Object"}),s.jsx(m.ReusableSelect,{className:"h-9",options:B,value:((g=(v=e.preferences)==null?void 0:v.mapVisualOptions)==null?void 0:g.objectKey)||"",label:"Map Object",onValueChange:a=>{var r;n({...e.preferences,mapVisualOptions:{...(r=e.preferences)==null?void 0:r.mapVisualOptions,objectKey:a}})}})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(l.Label,{children:"Projection"}),s.jsx(m.ReusableSelect,{className:"h-9",options:A,value:((C=(x=e.preferences)==null?void 0:x.mapVisualOptions)==null?void 0:C.projection)||"",label:"Projection",onValueChange:a=>{var r;n({...e.preferences,mapVisualOptions:{...(r=e.preferences)==null?void 0:r.mapVisualOptions,projection:a}})}})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(l.Label,{children:"Colors"}),s.jsx(m.ReusableSelect,{className:"h-9",options:P,value:((N=(S=e.preferences)==null?void 0:S.mapVisualOptions)==null?void 0:N.colorScale)||"",label:"Select Color Scale",onValueChange:a=>{var r;n({...e.preferences,mapVisualOptions:{...(r=e.preferences)==null?void 0:r.mapVisualOptions,colorScale:a}})}})]})]})]})}),s.jsx(l.Separator,{className:"my-4"}),s.jsx(j,{className:"",summary:"Scale Options",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(l.Input,{className:`h-9 w-full ${l.removeRing}`,type:"number",step:.1,value:((V=(y=e.preferences)==null?void 0:y.mapVisualOptions)==null?void 0:V.projectionScale)||1,onChange:a=>{var r;n({...e.preferences,mapVisualOptions:{...(r=e.preferences)==null?void 0:r.mapVisualOptions,projectionScale:Number(a.target.value)}})}}),s.jsx(l.Label,{children:"X"}),s.jsx(l.Input,{className:`h-9 w-full ${l.removeRing}`,type:"number",step:10,value:((q=(R=(E=e.preferences)==null?void 0:E.mapVisualOptions)==null?void 0:R.projectionOffset)==null?void 0:q[0])||0,onChange:a=>{var r,o,i,c;n({...e.preferences,mapVisualOptions:{...(r=e.preferences)==null?void 0:r.mapVisualOptions,projectionOffset:[Number(a.target.value),((c=(i=(o=e.preferences)==null?void 0:o.mapVisualOptions)==null?void 0:i.projectionOffset)==null?void 0:c[1])||0]}})}}),s.jsx(l.Label,{children:"Y"}),s.jsx(l.Input,{className:`h-9 w-full ${l.removeRing}`,type:"number",step:10,value:((w=(U=(L=e.preferences)==null?void 0:L.mapVisualOptions)==null?void 0:U.projectionOffset)==null?void 0:w[1])||0,onChange:a=>{var r,o,i,c;n({...e.preferences,mapVisualOptions:{...(r=e.preferences)==null?void 0:r.mapVisualOptions,projectionOffset:[((c=(i=(o=e.preferences)==null?void 0:o.mapVisualOptions)==null?void 0:i.projectionOffset)==null?void 0:c[0])||0,Number(a.target.value)]}})}})]})}),s.jsx(l.Separator,{className:"my-4"}),s.jsx(T.FilterOnClickColumns,{})]})}exports.default=I;
@@ -0,0 +1,334 @@
1
+ import { jsxs as r, jsx as s, Fragment as L } from "react/jsx-runtime";
2
+ import { q as P, L as o, U as I, u as _, d as F, V as Y, W as d, I as f, X as h } from "./index--MUeDITx.js";
3
+ import { R as O } from "./reusable-select-CQbD03nT.js";
4
+ import { useState as $ } from "react";
5
+ import { F as k } from "./filter-on-click-columns-BJUGTE6W.js";
6
+ function v({
7
+ children: e,
8
+ summary: u,
9
+ open: t,
10
+ className: b
11
+ }) {
12
+ return /* @__PURE__ */ r(
13
+ "details",
14
+ {
15
+ open: t,
16
+ className: P("space-y-4 [&_summary>svg]:open:-rotate-180", b),
17
+ children: [
18
+ /* @__PURE__ */ r("summary", { className: "flex cursor-pointer list-none items-center justify-between gap-4", children: [
19
+ /* @__PURE__ */ s(o, { children: u }),
20
+ /* @__PURE__ */ s(I, { className: "h-4 w-4" })
21
+ ] }),
22
+ /* @__PURE__ */ s("div", { className: "transition-all ease-in-out", children: e })
23
+ ]
24
+ }
25
+ );
26
+ }
27
+ const K = [
28
+ {
29
+ label: "Mercator",
30
+ value: "mercator"
31
+ },
32
+ {
33
+ label: "Azimuthal Equidistant",
34
+ value: "azimuthalEquidistant"
35
+ },
36
+ {
37
+ label: "Gnomonic",
38
+ value: "gnomonic"
39
+ },
40
+ {
41
+ label: "Orthographic",
42
+ value: "orthographic"
43
+ },
44
+ {
45
+ label: "Stereographic",
46
+ value: "stereographic"
47
+ },
48
+ {
49
+ label: "Equal Earth",
50
+ value: "equalEarth"
51
+ },
52
+ {
53
+ label: "Albers",
54
+ value: "albers"
55
+ },
56
+ {
57
+ label: "Albers USA",
58
+ value: "albersUsa"
59
+ },
60
+ {
61
+ label: "Conic Conformal",
62
+ value: "conicConformal"
63
+ },
64
+ {
65
+ label: "Conic Equal Area",
66
+ value: "conicEqualArea"
67
+ },
68
+ {
69
+ label: "Conic Equidistant",
70
+ value: "conicEquidistant"
71
+ },
72
+ {
73
+ label: "Equirectangular",
74
+ value: "equirectangular"
75
+ },
76
+ {
77
+ label: "Transverse Mercator",
78
+ value: "transverseMercator"
79
+ },
80
+ {
81
+ label: "Natural Earth 1",
82
+ value: "naturalEarth1"
83
+ }
84
+ ], z = [
85
+ "blues",
86
+ "brBG",
87
+ "buGn",
88
+ "buPu",
89
+ "cividis",
90
+ "cool",
91
+ "cubehelixDefault",
92
+ "gnBu",
93
+ "greens",
94
+ "greys",
95
+ "inferno",
96
+ "magma",
97
+ "orRd",
98
+ "oranges",
99
+ "pRGn",
100
+ "piYG",
101
+ "plasma",
102
+ "puBu",
103
+ "puBuGn",
104
+ "puOr",
105
+ "puRd",
106
+ "purples",
107
+ "rainbow",
108
+ "rdBu",
109
+ "rdGy",
110
+ "rdPu",
111
+ "rdYlBu",
112
+ "rdYlGn",
113
+ "reds",
114
+ "sinebow",
115
+ "spectral",
116
+ "turbo",
117
+ "viridis",
118
+ "warm",
119
+ "ylGn",
120
+ "ylGnBu",
121
+ "ylOrBr",
122
+ "ylOrRd"
123
+ ], D = z.map((e) => ({
124
+ label: e,
125
+ value: e
126
+ }));
127
+ function ae() {
128
+ var g, C, N, V, y, j, S, E, R, U, q, w, B, G, J, x, A, M;
129
+ const e = _((a) => a.card), u = (C = (g = e == null ? void 0 : e.preferences) == null ? void 0 : g.mapVisualOptions) == null ? void 0 : C.topoJsonUrl, [t, b] = $(
130
+ ((V = (N = e == null ? void 0 : e.preferences) == null ? void 0 : N.mapVisualOptions) == null ? void 0 : V.customTopoJsonUrl) || ""
131
+ ), { setCardPreferences: n } = F(), { data: m } = Y(e), T = Object.keys((m == null ? void 0 : m.objects) || {}).map((a) => ({
132
+ label: a,
133
+ value: a
134
+ })) || [];
135
+ return /* @__PURE__ */ r("div", { className: "p-6", children: [
136
+ /* @__PURE__ */ s(v, { summary: "Map Chart", children: /* @__PURE__ */ s("p", { className: "rounded-md bg-muted p-2 font-mono text-xs", children: "SELECT country, value FROM table" }) }),
137
+ /* @__PURE__ */ s(d, { className: "my-4" }),
138
+ /* @__PURE__ */ s(v, { open: !0, summary: "Settings", children: /* @__PURE__ */ r("div", { className: "space-y-3 px-2", children: [
139
+ /* @__PURE__ */ s(
140
+ O,
141
+ {
142
+ className: "h-9",
143
+ options: [
144
+ {
145
+ label: "US States 10m",
146
+ value: "https://unpkg.com/us-atlas/states-10m.json"
147
+ },
148
+ {
149
+ label: "Countries 50m",
150
+ value: "https://unpkg.com/world-atlas/countries-50m.json"
151
+ },
152
+ {
153
+ label: "Custom",
154
+ value: "custom"
155
+ }
156
+ ],
157
+ onValueChange: (a) => {
158
+ console.log("value", a), n({
159
+ ...e.preferences,
160
+ mapVisualOptions: {
161
+ topoJsonUrl: a
162
+ // customTopoJson: undefined,
163
+ }
164
+ });
165
+ },
166
+ value: u || "",
167
+ label: "Select Map"
168
+ }
169
+ ),
170
+ u === "custom" && /* @__PURE__ */ s(
171
+ f,
172
+ {
173
+ onChange: (a) => {
174
+ b(a.target.value);
175
+ },
176
+ onBlur: () => {
177
+ var a;
178
+ console.log("onBlur", t), n({
179
+ ...e.preferences,
180
+ mapVisualOptions: {
181
+ ...(a = e.preferences) == null ? void 0 : a.mapVisualOptions,
182
+ customTopoJsonUrl: t
183
+ }
184
+ });
185
+ },
186
+ value: t,
187
+ className: `h-9 w-full ${h}`,
188
+ placeholder: "Custom URL"
189
+ }
190
+ ),
191
+ m && /* @__PURE__ */ r(L, { children: [
192
+ /* @__PURE__ */ r("div", { className: "space-y-1", children: [
193
+ /* @__PURE__ */ s(o, { children: "Map Object" }),
194
+ /* @__PURE__ */ s(
195
+ O,
196
+ {
197
+ className: "h-9",
198
+ options: T,
199
+ value: ((j = (y = e.preferences) == null ? void 0 : y.mapVisualOptions) == null ? void 0 : j.objectKey) || "",
200
+ label: "Map Object",
201
+ onValueChange: (a) => {
202
+ var l;
203
+ n({
204
+ ...e.preferences,
205
+ mapVisualOptions: {
206
+ ...(l = e.preferences) == null ? void 0 : l.mapVisualOptions,
207
+ objectKey: a
208
+ }
209
+ });
210
+ }
211
+ }
212
+ )
213
+ ] }),
214
+ /* @__PURE__ */ r("div", { className: "space-y-1", children: [
215
+ /* @__PURE__ */ s(o, { children: "Projection" }),
216
+ /* @__PURE__ */ s(
217
+ O,
218
+ {
219
+ className: "h-9",
220
+ options: K,
221
+ value: ((E = (S = e.preferences) == null ? void 0 : S.mapVisualOptions) == null ? void 0 : E.projection) || "",
222
+ label: "Projection",
223
+ onValueChange: (a) => {
224
+ var l;
225
+ n({
226
+ ...e.preferences,
227
+ mapVisualOptions: {
228
+ ...(l = e.preferences) == null ? void 0 : l.mapVisualOptions,
229
+ projection: a
230
+ }
231
+ });
232
+ }
233
+ }
234
+ )
235
+ ] }),
236
+ /* @__PURE__ */ r("div", { className: "space-y-1", children: [
237
+ /* @__PURE__ */ s(o, { children: "Colors" }),
238
+ /* @__PURE__ */ s(
239
+ O,
240
+ {
241
+ className: "h-9",
242
+ options: D,
243
+ value: ((U = (R = e.preferences) == null ? void 0 : R.mapVisualOptions) == null ? void 0 : U.colorScale) || "",
244
+ label: "Select Color Scale",
245
+ onValueChange: (a) => {
246
+ var l;
247
+ n({
248
+ ...e.preferences,
249
+ mapVisualOptions: {
250
+ ...(l = e.preferences) == null ? void 0 : l.mapVisualOptions,
251
+ colorScale: a
252
+ }
253
+ });
254
+ }
255
+ }
256
+ )
257
+ ] })
258
+ ] })
259
+ ] }) }),
260
+ /* @__PURE__ */ s(d, { className: "my-4" }),
261
+ /* @__PURE__ */ s(v, { className: "", summary: "Scale Options", children: /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
262
+ /* @__PURE__ */ s(
263
+ f,
264
+ {
265
+ className: `h-9 w-full ${h}`,
266
+ type: "number",
267
+ step: 0.1,
268
+ value: ((w = (q = e.preferences) == null ? void 0 : q.mapVisualOptions) == null ? void 0 : w.projectionScale) || 1,
269
+ onChange: (a) => {
270
+ var l;
271
+ n({
272
+ ...e.preferences,
273
+ mapVisualOptions: {
274
+ ...(l = e.preferences) == null ? void 0 : l.mapVisualOptions,
275
+ projectionScale: Number(a.target.value)
276
+ }
277
+ });
278
+ }
279
+ }
280
+ ),
281
+ /* @__PURE__ */ s(o, { children: "X" }),
282
+ /* @__PURE__ */ s(
283
+ f,
284
+ {
285
+ className: `h-9 w-full ${h}`,
286
+ type: "number",
287
+ step: 10,
288
+ value: ((J = (G = (B = e.preferences) == null ? void 0 : B.mapVisualOptions) == null ? void 0 : G.projectionOffset) == null ? void 0 : J[0]) || 0,
289
+ onChange: (a) => {
290
+ var l, i, p, c;
291
+ n({
292
+ ...e.preferences,
293
+ mapVisualOptions: {
294
+ ...(l = e.preferences) == null ? void 0 : l.mapVisualOptions,
295
+ projectionOffset: [
296
+ Number(a.target.value),
297
+ ((c = (p = (i = e.preferences) == null ? void 0 : i.mapVisualOptions) == null ? void 0 : p.projectionOffset) == null ? void 0 : c[1]) || 0
298
+ ]
299
+ }
300
+ });
301
+ }
302
+ }
303
+ ),
304
+ /* @__PURE__ */ s(o, { children: "Y" }),
305
+ /* @__PURE__ */ s(
306
+ f,
307
+ {
308
+ className: `h-9 w-full ${h}`,
309
+ type: "number",
310
+ step: 10,
311
+ value: ((M = (A = (x = e.preferences) == null ? void 0 : x.mapVisualOptions) == null ? void 0 : A.projectionOffset) == null ? void 0 : M[1]) || 0,
312
+ onChange: (a) => {
313
+ var l, i, p, c;
314
+ n({
315
+ ...e.preferences,
316
+ mapVisualOptions: {
317
+ ...(l = e.preferences) == null ? void 0 : l.mapVisualOptions,
318
+ projectionOffset: [
319
+ ((c = (p = (i = e.preferences) == null ? void 0 : i.mapVisualOptions) == null ? void 0 : p.projectionOffset) == null ? void 0 : c[0]) || 0,
320
+ Number(a.target.value)
321
+ ]
322
+ }
323
+ });
324
+ }
325
+ }
326
+ )
327
+ ] }) }),
328
+ /* @__PURE__ */ s(d, { className: "my-4" }),
329
+ /* @__PURE__ */ s(k, {})
330
+ ] });
331
+ }
332
+ export {
333
+ ae as default
334
+ };