@actionexec/dashboards 0.5.4 → 0.6.0

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/index.js CHANGED
@@ -1,80 +1,80 @@
1
- import { jsxs as _, jsx as l } from "react/jsx-runtime";
2
- import { useState as N, useRef as F, useEffect as T, useCallback as M, useMemo as j } from "react";
3
- import { O as G, Q as z, K as H, B as I, H as W, m as D, v as R, I as X, k as L, p as q, u as Q, s as U, d as J, x as Z, w as B, b as ee } from "./index-BXIn44vr.js";
4
- import { R as je } from "./index-BXIn44vr.js";
5
- import { PieChart as te, Pie as ae, Cell as re, Tooltip as P, LineChart as le, Line as ne, AreaChart as ie, Area as se, BarChart as ce, Bar as oe, CartesianGrid as de, XAxis as he, YAxis as ge, Legend as ue } from "recharts";
6
- const me = 300;
7
- function pe(a) {
8
- const [r, n] = N(null), [t, e] = N(null), [i, c] = N({}), [s, m] = N({}), [o, d] = N(null), [h, u] = N(!0), [w, g] = N(null), p = F(), k = F(!1);
1
+ import { jsxs as _, jsx as a } from "react/jsx-runtime";
2
+ import { useState as k, useRef as F, useEffect as T, useCallback as R, useMemo as j } from "react";
3
+ import { Q as z, R as U, n as L, L as H, G as I, I as D, m as P, w as M, J as X, k as A, q, v as Q, t as J, d as Z, y as B, x as ee, b as te } from "./ColorPaletteSelector-Bsda66uL.js";
4
+ import { U as Ue } from "./ColorPaletteSelector-Bsda66uL.js";
5
+ import { PieChart as ae, Pie as re, Cell as le, Tooltip as Y, LineChart as ne, Line as ie, AreaChart as se, Area as ce, BarChart as oe, Bar as de, CartesianGrid as ge, XAxis as he, YAxis as ue, Legend as me } from "recharts";
6
+ const _e = 300;
7
+ function be(t) {
8
+ const [l, n] = k(null), [r, e] = k(null), [i, c] = k({}), [s, m] = k({}), [g, o] = k(null), [d, h] = k(!0), [w, u] = k(null), b = F(), y = F(!1);
9
9
  T(() => {
10
10
  let v = !1;
11
- return G(a).then((f) => {
11
+ return z(t).then((f) => {
12
12
  v || n(f);
13
13
  }).catch((f) => {
14
- v || g(f.message);
14
+ v || u(f.message);
15
15
  }), () => {
16
16
  v = !0;
17
17
  };
18
- }, [a]), T(() => {
19
- if (r)
20
- return p.current && clearTimeout(p.current), p.current = setTimeout(() => {
21
- const v = _e(i, s);
22
- u(!0), z(a, v).then((f) => {
23
- e(f), !k.current && f.applied && (k.current = !0, c(($) => ({ ...be(f.applied), ...$ }))), g(null);
24
- }).catch((f) => g(f.message)).finally(() => u(!1));
25
- }, me), () => {
26
- p.current && clearTimeout(p.current);
18
+ }, [t]), T(() => {
19
+ if (l)
20
+ return b.current && clearTimeout(b.current), b.current = setTimeout(() => {
21
+ const v = pe(i, s);
22
+ h(!0), U(t, v).then((f) => {
23
+ e(f), !y.current && f.applied && (y.current = !0, c(($) => ({ ...fe(f.applied), ...$ }))), u(null);
24
+ }).catch((f) => u(f.message)).finally(() => h(!1));
25
+ }, _e), () => {
26
+ b.current && clearTimeout(b.current);
27
27
  };
28
- }, [a, r, i, s]);
29
- const b = M((v, f) => {
28
+ }, [t, l, i, s]);
29
+ const p = R((v, f) => {
30
30
  c(($) => ({ ...$, [v]: f }));
31
- }, []), S = M((v, f) => {
31
+ }, []), S = R((v, f) => {
32
32
  m(($) => ({ ...$, [v]: f }));
33
- }, []), y = M((v) => {
34
- d(v);
33
+ }, []), N = R((v) => {
34
+ o(v);
35
35
  }, []), C = j(
36
- () => o ?? (r == null ? void 0 : r.palette) ?? [],
37
- [o, r]
36
+ () => g ?? (l == null ? void 0 : l.palette) ?? [],
37
+ [g, l]
38
38
  );
39
39
  return {
40
- layout: r,
41
- renderData: t,
42
- loading: h,
40
+ layout: l,
41
+ renderData: r,
42
+ loading: d,
43
43
  error: w,
44
44
  filters: i,
45
45
  variables: s,
46
46
  palette: C,
47
- setFilter: b,
47
+ setFilter: p,
48
48
  setVariable: S,
49
- setPalette: y
49
+ setPalette: N
50
50
  };
51
51
  }
52
- function _e(a, r) {
52
+ function pe(t, l) {
53
53
  const n = {};
54
- for (const [t, e] of Object.entries(a))
54
+ for (const [r, e] of Object.entries(t))
55
55
  if (e.includes("|")) {
56
56
  const [i, c] = e.split("|");
57
57
  i && (n.f_date_start = i), c && (n.f_date_end = c);
58
58
  } else
59
- n[`f_${t}`] = e;
60
- for (const [t, e] of Object.entries(r))
61
- n[`v_${t}`] = String(e);
59
+ n[`f_${r}`] = e;
60
+ for (const [r, e] of Object.entries(l))
61
+ n[`v_${r}`] = String(e);
62
62
  return n;
63
63
  }
64
- function be(a) {
65
- const r = {};
66
- for (const [n, t] of Object.entries(a))
67
- if (t && typeof t == "object" && "start" in t) {
68
- const e = t;
69
- r[n] = `${e.start || ""}|${e.end || ""}`;
70
- } else Array.isArray(t) ? r[n] = t.join(",") : typeof t == "string" && (r[n] = t);
71
- return r;
64
+ function fe(t) {
65
+ const l = {};
66
+ for (const [n, r] of Object.entries(t))
67
+ if (r && typeof r == "object" && "start" in r) {
68
+ const e = r;
69
+ l[n] = `${e.start || ""}|${e.end || ""}`;
70
+ } else Array.isArray(r) ? l[n] = r.join(L) : typeof r == "string" && (l[n] = r);
71
+ return l;
72
72
  }
73
- function fe({ data: a, label: r }) {
74
- const n = r || String(a.label || ""), t = String(a.formatted || "-"), e = a.comparison, i = (e == null ? void 0 : e.trend) === "up" ? "widget-kpi__trend--up" : (e == null ? void 0 : e.trend) === "down" ? "widget-kpi__trend--down" : "", c = (e == null ? void 0 : e.trend) === "up" ? "↑" : (e == null ? void 0 : e.trend) === "down" ? "↓" : "";
73
+ function we({ data: t, label: l }) {
74
+ const n = l || String(t.label || ""), r = String(t.formatted || "-"), e = t.comparison, i = (e == null ? void 0 : e.trend) === "up" ? "widget-kpi__trend--up" : (e == null ? void 0 : e.trend) === "down" ? "widget-kpi__trend--down" : "", c = (e == null ? void 0 : e.trend) === "up" ? "↑" : (e == null ? void 0 : e.trend) === "down" ? "↓" : "";
75
75
  return /* @__PURE__ */ _("div", { className: "widget widget-kpi", children: [
76
- /* @__PURE__ */ l("span", { className: "widget-kpi__label", children: n }),
77
- /* @__PURE__ */ l("span", { className: "widget-kpi__value", children: t }),
76
+ /* @__PURE__ */ a("span", { className: "widget-kpi__label", children: n }),
77
+ /* @__PURE__ */ a("span", { className: "widget-kpi__value", children: r }),
78
78
  e && e.variance_pct != null && /* @__PURE__ */ _("div", { className: `widget-kpi__trend ${i}`, children: [
79
79
  /* @__PURE__ */ _("span", { className: "widget-kpi__variance", children: [
80
80
  c,
@@ -83,45 +83,45 @@ function fe({ data: a, label: r }) {
83
83
  e.variance_pct.toFixed(1),
84
84
  "%"
85
85
  ] }),
86
- e.label && /* @__PURE__ */ l("span", { className: "widget-kpi__trend-label", children: e.label })
86
+ e.label && /* @__PURE__ */ a("span", { className: "widget-kpi__trend-label", children: e.label })
87
87
  ] })
88
88
  ] });
89
89
  }
90
90
  const ve = "var(--bg-elevated)";
91
- function O(a, r, n, t) {
92
- if (t <= 0) return "";
93
- if (t >= 1)
94
- return `M ${a - n} ${r} A ${n} ${n} 0 0 1 ${a} ${r - n} A ${n} ${n} 0 0 1 ${a + n} ${r}`;
95
- const e = t * Math.PI, i = a - n * Math.cos(e), c = r - n * Math.sin(e);
96
- return `M ${a - n} ${r} A ${n} ${n} 0 0 1 ${i} ${c}`;
91
+ function E(t, l, n, r) {
92
+ if (r <= 0) return "";
93
+ if (r >= 1)
94
+ return `M ${t - n} ${l} A ${n} ${n} 0 0 1 ${t} ${l - n} A ${n} ${n} 0 0 1 ${t + n} ${l}`;
95
+ const e = r * Math.PI, i = t - n * Math.cos(e), c = l - n * Math.sin(e);
96
+ return `M ${t - n} ${l} A ${n} ${n} 0 0 1 ${i} ${c}`;
97
97
  }
98
- function A(a) {
99
- const r = Math.abs(a);
100
- return r >= 1e6 ? `${(a / 1e6).toFixed(1)}M` : r >= 1e3 ? `${(a / 1e3).toFixed(1)}K` : a.toLocaleString("pt-BR");
98
+ function O(t) {
99
+ const l = Math.abs(t);
100
+ return l >= 1e6 ? `${(t / 1e6).toFixed(1)}M` : l >= 1e3 ? `${(t / 1e3).toFixed(1)}K` : t.toLocaleString("pt-BR");
101
101
  }
102
- function we({ data: a, palette: r, label: n }) {
103
- const t = n || String(a.label || ""), e = typeof a.value == "number" ? a.value : null, i = e != null ? A(e) : "-", c = String(a.formatted || "-"), s = typeof a.ratio == "number" ? a.ratio : 0, m = a.target_value, o = a.comparison_label, d = s >= 1, h = Math.min(Math.max(s, 0), 1), u = d ? "var(--action-green)" : s >= 0.7 ? r[0] || "var(--color-info)" : s >= 0.4 ? "var(--color-warning)" : "var(--color-error)", w = m != null ? A(m) : "-", g = 50, p = 50, k = 44, b = 10;
102
+ function ye({ data: t, palette: l, label: n }) {
103
+ const r = n || String(t.label || ""), e = typeof t.value == "number" ? t.value : null, i = e != null ? O(e) : "-", c = String(t.formatted || "-"), s = typeof t.ratio == "number" ? t.ratio : 0, m = t.target_value, g = t.comparison_label, o = s >= 1, d = Math.min(Math.max(s, 0), 1), h = o ? "var(--action-green)" : s >= 0.7 ? l[0] || "var(--color-info)" : s >= 0.4 ? "var(--color-warning)" : "var(--color-error)", w = m != null ? O(m) : "-", u = 50, b = 50, y = 44, p = 10;
104
104
  return /* @__PURE__ */ _("div", { className: "widget widget-gauge", children: [
105
- /* @__PURE__ */ l("span", { className: "widget-gauge__label", children: t }),
105
+ /* @__PURE__ */ a("span", { className: "widget-gauge__label", children: r }),
106
106
  /* @__PURE__ */ _("div", { className: "widget-gauge__chart", children: [
107
107
  /* @__PURE__ */ _("svg", { viewBox: "0 0 100 56", preserveAspectRatio: "xMidYMax meet", children: [
108
- /* @__PURE__ */ l("path", { d: O(g, p, k, 1), fill: "none", stroke: ve, strokeWidth: b, strokeLinecap: "butt" }),
109
- h > 0 && /* @__PURE__ */ l("path", { d: O(g, p, k, h), fill: "none", stroke: u, strokeWidth: b, strokeLinecap: "butt" })
108
+ /* @__PURE__ */ a("path", { d: E(u, b, y, 1), fill: "none", stroke: ve, strokeWidth: p, strokeLinecap: "butt" }),
109
+ d > 0 && /* @__PURE__ */ a("path", { d: E(u, b, y, d), fill: "none", stroke: h, strokeWidth: p, strokeLinecap: "butt" })
110
110
  ] }),
111
111
  /* @__PURE__ */ _("div", { className: "widget-gauge__center", children: [
112
- /* @__PURE__ */ l("span", { className: "widget-gauge__percent", children: c }),
112
+ /* @__PURE__ */ a("span", { className: "widget-gauge__percent", children: c }),
113
113
  /* @__PURE__ */ _("span", { className: "widget-gauge__comparison", children: [
114
114
  i,
115
115
  " / ",
116
116
  w
117
117
  ] }),
118
- d && /* @__PURE__ */ l("span", { className: "widget-gauge__badge", children: o || "Meta batida" }),
119
- !d && o && /* @__PURE__ */ l("span", { className: "widget-gauge__comparison", children: o })
118
+ o && /* @__PURE__ */ a("span", { className: "widget-gauge__badge", children: g || "Meta batida" }),
119
+ !o && g && /* @__PURE__ */ a("span", { className: "widget-gauge__comparison", children: g })
120
120
  ] })
121
121
  ] })
122
122
  ] });
123
123
  }
124
- const E = { fontSize: 10, fill: "var(--text-muted)" }, ye = "var(--bg-elevated)", Y = {
124
+ const W = { fontSize: 10, fill: "var(--text-muted)" }, Ne = "var(--bg-elevated)", V = {
125
125
  backgroundColor: "var(--bg-elevated)",
126
126
  border: "1px solid var(--bg-paper)",
127
127
  borderRadius: "6px",
@@ -130,342 +130,408 @@ const E = { fontSize: 10, fill: "var(--text-muted)" }, ye = "var(--bg-elevated)"
130
130
  color: "var(--text-primary)",
131
131
  fontWeight: 600
132
132
  };
133
- function V(a, r) {
133
+ function G(t, l) {
134
134
  var e;
135
- const n = Array.isArray(r) ? r[0] : void 0, t = (e = n == null ? void 0 : n.payload) == null ? void 0 : e.tooltipLabel;
136
- return typeof t == "string" && t ? t : String(a ?? "");
135
+ const n = Array.isArray(l) ? l[0] : void 0, r = (e = n == null ? void 0 : n.payload) == null ? void 0 : e.tooltipLabel;
136
+ return typeof r == "string" && r ? r : String(t ?? "");
137
137
  }
138
- function Ne(a) {
139
- const [r, n] = N({ width: 0, height: 0 });
138
+ function ke(t) {
139
+ const [l, n] = k({ width: 0, height: 0 });
140
140
  return T(() => {
141
- const t = a.current;
142
- if (!t) return;
141
+ const r = t.current;
142
+ if (!r) return;
143
143
  const e = new ResizeObserver(([i]) => {
144
144
  const { width: c, height: s } = i.contentRect;
145
145
  n(
146
146
  (m) => m.width !== Math.floor(c) || m.height !== Math.floor(s) ? { width: Math.floor(c), height: Math.floor(s) } : m
147
147
  );
148
148
  });
149
- return e.observe(t), () => e.disconnect();
150
- }, [a]), r;
149
+ return e.observe(r), () => e.disconnect();
150
+ }, [t]), l;
151
151
  }
152
- function x({ Chart: a, chartData: r, xKey: n, series: t, palette: e, renderSeries: i, width: c, height: s }) {
153
- return /* @__PURE__ */ _(a, { data: r, width: c, height: s, children: [
154
- /* @__PURE__ */ l(de, { strokeDasharray: "3 3", stroke: ye }),
155
- /* @__PURE__ */ l(he, { dataKey: n, tick: E }),
156
- /* @__PURE__ */ l(ge, { tick: E }),
157
- /* @__PURE__ */ l(
158
- P,
152
+ function x({ Chart: t, chartData: l, xKey: n, series: r, palette: e, renderSeries: i, width: c, height: s }) {
153
+ return /* @__PURE__ */ _(t, { data: l, width: c, height: s, children: [
154
+ /* @__PURE__ */ a(ge, { strokeDasharray: "3 3", stroke: Ne }),
155
+ /* @__PURE__ */ a(he, { dataKey: n, tick: W }),
156
+ /* @__PURE__ */ a(ue, { tick: W }),
157
+ /* @__PURE__ */ a(
158
+ Y,
159
159
  {
160
- contentStyle: Y,
160
+ contentStyle: V,
161
161
  labelStyle: K,
162
- labelFormatter: V,
162
+ labelFormatter: G,
163
163
  cursor: { fill: "var(--bg-paper)", opacity: 0.3 }
164
164
  }
165
165
  ),
166
- t.length > 1 && /* @__PURE__ */ l(ue, {}),
167
- t.map((m, o) => i(m, e[o % e.length], o))
166
+ r.length > 1 && /* @__PURE__ */ a(me, {}),
167
+ r.map((m, g) => i(m, e[g % e.length], g))
168
168
  ] });
169
169
  }
170
- function ke({ data: a, palette: r, label: n }) {
171
- const t = String(a.chartType || "bar"), e = n || String(a.label || ""), i = String(a.xKey || "label"), c = a.series || [], s = a.data || [], m = F(null), { width: o, height: d } = Ne(m);
172
- return s.length ? /* @__PURE__ */ _("div", { className: "widget widget-chart", children: [
173
- e && /* @__PURE__ */ l("h4", { className: "widget-chart__title", children: e }),
174
- /* @__PURE__ */ l("div", { ref: m, className: "widget-chart__container", children: (() => {
175
- var w;
176
- if (o <= 0 || d <= 0) return null;
177
- if (t === "pie")
178
- return /* @__PURE__ */ _(te, { width: o, height: d, children: [
179
- /* @__PURE__ */ l(
180
- ae,
181
- {
182
- data: s,
183
- dataKey: ((w = c[0]) == null ? void 0 : w.key) || "s0",
184
- nameKey: i,
185
- cx: "50%",
186
- cy: "50%",
187
- outerRadius: "75%",
188
- label: ({ name: g, percent: p }) => `${g}: ${(p * 100).toFixed(0)}%`,
189
- labelLine: !1,
190
- children: s.map((g, p) => /* @__PURE__ */ l(re, { fill: r[p % r.length] }, p))
191
- }
192
- ),
193
- /* @__PURE__ */ l(
194
- P,
195
- {
196
- contentStyle: Y,
197
- labelStyle: K,
198
- labelFormatter: V
199
- }
200
- )
201
- ] });
202
- const u = { chartData: s, xKey: i, series: c, palette: r, width: o, height: d };
203
- return t === "line" ? /* @__PURE__ */ l(x, { ...u, Chart: le, renderSeries: (g, p) => /* @__PURE__ */ l(
204
- ne,
205
- {
206
- type: "monotone",
207
- dataKey: g.key,
208
- name: g.label,
209
- stroke: p,
210
- strokeWidth: 2,
211
- dot: s.length <= 31
212
- },
213
- g.key
214
- ) }) : t === "area" ? /* @__PURE__ */ l(x, { ...u, Chart: ie, renderSeries: (g, p) => /* @__PURE__ */ l(
215
- se,
216
- {
217
- type: "monotone",
218
- dataKey: g.key,
219
- name: g.label,
220
- fill: p,
221
- stroke: p,
222
- fillOpacity: 0.3
223
- },
224
- g.key
225
- ) }) : /* @__PURE__ */ l(x, { ...u, Chart: ce, renderSeries: (g, p) => /* @__PURE__ */ l(
226
- oe,
227
- {
228
- dataKey: g.key,
229
- name: g.label,
230
- fill: p,
231
- radius: [3, 3, 0, 0]
232
- },
233
- g.key
234
- ) });
235
- })() })
236
- ] }) : /* @__PURE__ */ l("div", { className: "widget widget-chart widget-chart--empty", children: "Sem dados" });
170
+ function $e({ data: t, palette: l, label: n }) {
171
+ const r = String(t.chartType || "bar"), e = n || String(t.label || ""), i = String(t.xKey || "label"), c = t.series || [], s = t.data || [], m = F(null), { width: g, height: o } = ke(m), d = () => {
172
+ var w;
173
+ if (g <= 0 || o <= 0) return null;
174
+ if (r === "pie")
175
+ return /* @__PURE__ */ _(ae, { width: g, height: o, children: [
176
+ /* @__PURE__ */ a(
177
+ re,
178
+ {
179
+ data: s,
180
+ dataKey: ((w = c[0]) == null ? void 0 : w.key) || "s0",
181
+ nameKey: i,
182
+ cx: "50%",
183
+ cy: "50%",
184
+ outerRadius: "75%",
185
+ label: ({ name: u, percent: b }) => `${u}: ${(b * 100).toFixed(0)}%`,
186
+ labelLine: !1,
187
+ children: s.map((u, b) => /* @__PURE__ */ a(le, { fill: l[b % l.length] }, b))
188
+ }
189
+ ),
190
+ /* @__PURE__ */ a(
191
+ Y,
192
+ {
193
+ contentStyle: V,
194
+ labelStyle: K,
195
+ labelFormatter: G
196
+ }
197
+ )
198
+ ] });
199
+ const h = { chartData: s, xKey: i, series: c, palette: l, width: g, height: o };
200
+ return r === "line" ? /* @__PURE__ */ a(x, { ...h, Chart: ne, renderSeries: (u, b) => /* @__PURE__ */ a(
201
+ ie,
202
+ {
203
+ type: "monotone",
204
+ dataKey: u.key,
205
+ name: u.label,
206
+ stroke: b,
207
+ strokeWidth: 2,
208
+ dot: s.length <= 31
209
+ },
210
+ u.key
211
+ ) }) : r === "area" ? /* @__PURE__ */ a(x, { ...h, Chart: se, renderSeries: (u, b) => /* @__PURE__ */ a(
212
+ ce,
213
+ {
214
+ type: "monotone",
215
+ dataKey: u.key,
216
+ name: u.label,
217
+ fill: b,
218
+ stroke: b,
219
+ fillOpacity: 0.3
220
+ },
221
+ u.key
222
+ ) }) : /* @__PURE__ */ a(x, { ...h, Chart: oe, renderSeries: (u, b) => /* @__PURE__ */ a(
223
+ de,
224
+ {
225
+ dataKey: u.key,
226
+ name: u.label,
227
+ fill: b,
228
+ radius: [3, 3, 0, 0]
229
+ },
230
+ u.key
231
+ ) });
232
+ };
233
+ return /* @__PURE__ */ _("div", { className: "widget widget-chart", children: [
234
+ e && /* @__PURE__ */ a("h4", { className: "widget-chart__title", children: e }),
235
+ /* @__PURE__ */ a("div", { ref: m, className: "widget-chart__container", children: s.length === 0 ? /* @__PURE__ */ a("div", { className: "widget-chart__empty", children: "Sem dados" }) : d() })
236
+ ] });
237
237
  }
238
- function $e({ config: a, value: r, options: n = [], dateBounds: t, onChange: e }) {
239
- const i = a.filterType || "select", c = a.label || "Filtro", s = a.dateFilterMode || "range";
238
+ function Se(t, l) {
239
+ if (t == null || t === "") return "-";
240
+ const n = typeof t == "number" ? t : Number(t), r = t !== "" && !Number.isNaN(n);
241
+ switch (l) {
242
+ case "currency":
243
+ return r ? n.toLocaleString("pt-BR", { style: "currency", currency: "BRL" }) : String(t);
244
+ case "integer":
245
+ return r ? Math.round(n).toLocaleString("pt-BR") : String(t);
246
+ case "number":
247
+ return r ? n.toLocaleString("pt-BR", { maximumFractionDigits: 1 }) : String(t);
248
+ case "percentage":
249
+ return r ? `${n > 0 ? "+" : ""}${Math.round(n)}%` : String(t);
250
+ default:
251
+ return String(t);
252
+ }
253
+ }
254
+ function Ce({ data: t, label: l }) {
255
+ var g;
256
+ const [n, r] = k(0), e = t.columns || [], i = t.tabs || [], c = i.length > 0, s = c ? ((g = i[Math.min(n, i.length - 1)]) == null ? void 0 : g.rows) || [] : t.rows || [], m = l || String(t.label || "");
257
+ return e.length === 0 ? /* @__PURE__ */ _("div", { className: "widget widget-table", children: [
258
+ m && /* @__PURE__ */ a("span", { className: "widget-table__label", children: m }),
259
+ /* @__PURE__ */ a("span", { className: "widget-table__empty", children: "Configure as colunas da tabela." })
260
+ ] }) : /* @__PURE__ */ _("div", { className: "widget widget-table", children: [
261
+ m && /* @__PURE__ */ a("span", { className: "widget-table__label", children: m }),
262
+ c && /* @__PURE__ */ a("div", { className: "widget-table__tabs", role: "tablist", children: i.map((o, d) => /* @__PURE__ */ a(
263
+ "button",
264
+ {
265
+ type: "button",
266
+ role: "tab",
267
+ "aria-selected": d === n,
268
+ className: `widget-table__tab${d === n ? " widget-table__tab--active" : ""}`,
269
+ onClick: () => r(d),
270
+ children: o.label
271
+ },
272
+ d
273
+ )) }),
274
+ /* @__PURE__ */ a("div", { className: "widget-table__scroll", children: /* @__PURE__ */ _("table", { className: "widget-table__table", children: [
275
+ /* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a("tr", { children: e.map((o) => {
276
+ const d = !!o.format && o.format !== "text";
277
+ return /* @__PURE__ */ a("th", { className: `widget-table__th${d ? " widget-table__th--num" : ""}`, children: o.label || o.key }, o.key);
278
+ }) }) }),
279
+ /* @__PURE__ */ a("tbody", { children: s.length === 0 ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { className: "widget-table__td widget-table__empty", colSpan: e.length, children: "Sem dados" }) }) : s.map((o, d) => /* @__PURE__ */ a("tr", { children: e.map((h) => {
280
+ const w = o[h.key], u = !!h.format && h.format !== "text";
281
+ let b = "";
282
+ if (h.format === "percentage") {
283
+ const y = Number(w);
284
+ Number.isNaN(y) || (b = y > 0 ? " widget-table__td--up" : y < 0 ? " widget-table__td--down" : "");
285
+ }
286
+ return /* @__PURE__ */ a("td", { className: `widget-table__td${u ? " widget-table__td--num" : ""}${b}`, children: Se(w, h.format) }, h.key);
287
+ }) }, d)) })
288
+ ] }) })
289
+ ] });
290
+ }
291
+ function Re({ config: t, value: l, options: n = [], dateBounds: r, onChange: e }) {
292
+ const i = t.filterType || "select", c = t.label || "Filtro", s = t.dateFilterMode || "range";
240
293
  return /* @__PURE__ */ _("div", { className: "widget-filter", children: [
241
- /* @__PURE__ */ l("label", { className: "widget-filter__label", children: c }),
242
- i === "date_range" ? s === "yearly" ? /* @__PURE__ */ l(Ce, { value: r, dateBounds: t, onChange: e }) : s === "monthly" ? /* @__PURE__ */ l(Me, { value: r, dateBounds: t, onChange: e }) : s === "weekly" ? /* @__PURE__ */ l(Re, { value: r, dateBounds: t, onChange: e }) : /* @__PURE__ */ l(Se, { value: r, dateBounds: t, onChange: e }) : /* @__PURE__ */ l(
243
- xe,
294
+ /* @__PURE__ */ a("label", { className: "widget-filter__label", children: c }),
295
+ i === "date_range" ? s === "yearly" ? /* @__PURE__ */ a(xe, { value: l, dateBounds: r, onChange: e }) : s === "monthly" ? /* @__PURE__ */ a(Fe, { value: l, dateBounds: r, onChange: e }) : s === "weekly" ? /* @__PURE__ */ a(Te, { value: l, dateBounds: r, onChange: e }) : /* @__PURE__ */ a(Me, { value: l, dateBounds: r, onChange: e }) : /* @__PURE__ */ a(
296
+ Le,
244
297
  {
245
- value: r,
298
+ value: l,
246
299
  options: n,
247
300
  multi: i === "multi_select",
248
- searchable: a.searchable || !1,
301
+ searchable: t.searchable || !1,
249
302
  onChange: e
250
303
  }
251
304
  )
252
305
  ] });
253
306
  }
254
- function Se({ value: a, dateBounds: r, onChange: n }) {
255
- const [t, e] = a ? a.split("|") : ["", ""];
307
+ function Me({ value: t, dateBounds: l, onChange: n }) {
308
+ const [r, e] = t ? t.split("|") : ["", ""];
256
309
  return /* @__PURE__ */ _("div", { className: "widget-filter__date-range widget-filter__date-range--stacked", children: [
257
- /* @__PURE__ */ l(
258
- L,
310
+ /* @__PURE__ */ a(
311
+ A,
259
312
  {
260
- value: t,
261
- minIso: r == null ? void 0 : r.min,
262
- maxIso: e || (r == null ? void 0 : r.max),
313
+ value: r,
314
+ minIso: l == null ? void 0 : l.min,
315
+ maxIso: e || (l == null ? void 0 : l.max),
263
316
  selectsStart: !0,
264
- startIso: t,
317
+ startIso: r,
265
318
  endIso: e,
266
319
  placeholder: "Data inicial",
267
320
  onChange: (i) => n(`${i}|${e}`)
268
321
  }
269
322
  ),
270
- /* @__PURE__ */ l(
271
- L,
323
+ /* @__PURE__ */ a(
324
+ A,
272
325
  {
273
326
  value: e,
274
- minIso: t || (r == null ? void 0 : r.min),
275
- maxIso: r == null ? void 0 : r.max,
327
+ minIso: r || (l == null ? void 0 : l.min),
328
+ maxIso: l == null ? void 0 : l.max,
276
329
  selectsEnd: !0,
277
- startIso: t,
330
+ startIso: r,
278
331
  endIso: e,
279
332
  placeholder: "Data final",
280
- onChange: (i) => n(`${t}|${i}`)
333
+ onChange: (i) => n(`${r}|${i}`)
281
334
  }
282
335
  )
283
336
  ] });
284
337
  }
285
- function Ce({ value: a, dateBounds: r, onChange: n }) {
286
- const [t] = a ? a.split("|") : [""], e = H(t), i = /* @__PURE__ */ new Date(), c = (e == null ? void 0 : e.year) ?? i.getFullYear(), s = I(r), m = (o) => {
287
- const d = U(o);
288
- n(`${d.start}|${d.end}`);
338
+ function xe({ value: t, dateBounds: l, onChange: n }) {
339
+ const [r] = t ? t.split("|") : [""], e = H(r), i = /* @__PURE__ */ new Date(), c = (e == null ? void 0 : e.year) ?? i.getFullYear(), s = I(l), m = (g) => {
340
+ const o = J(g);
341
+ n(`${o.start}|${o.end}`);
289
342
  };
290
- return /* @__PURE__ */ l("div", { className: "widget-filter__date-range widget-filter__date-range--year", children: /* @__PURE__ */ l(
343
+ return /* @__PURE__ */ a("div", { className: "widget-filter__date-range widget-filter__date-range--year", children: /* @__PURE__ */ a(
291
344
  "select",
292
345
  {
293
346
  className: "widget-filter__select",
294
347
  value: c,
295
- onChange: (o) => m(parseInt(o.target.value)),
296
- children: s.map((o) => /* @__PURE__ */ l("option", { value: o, children: o }, o))
348
+ onChange: (g) => m(parseInt(g.target.value)),
349
+ children: s.map((g) => /* @__PURE__ */ a("option", { value: g, children: g }, g))
297
350
  }
298
351
  ) });
299
352
  }
300
- function Me({ value: a, dateBounds: r, onChange: n }) {
301
- const [t] = a ? a.split("|") : [""], e = W(t), i = /* @__PURE__ */ new Date(), c = (e == null ? void 0 : e.year) ?? i.getFullYear(), s = (e == null ? void 0 : e.month) ?? i.getMonth() + 1, m = I(r), o = (d, h) => {
302
- const u = Q(d, h);
303
- n(`${u.start}|${u.end}`);
353
+ function Fe({ value: t, dateBounds: l, onChange: n }) {
354
+ const [r] = t ? t.split("|") : [""], e = D(r), i = /* @__PURE__ */ new Date(), c = (e == null ? void 0 : e.year) ?? i.getFullYear(), s = (e == null ? void 0 : e.month) ?? i.getMonth() + 1, m = I(l), g = (o, d) => {
355
+ const h = Q(o, d);
356
+ n(`${h.start}|${h.end}`);
304
357
  };
305
358
  return /* @__PURE__ */ _("div", { className: "widget-filter__date-range widget-filter__date-range--month", children: [
306
- /* @__PURE__ */ l(
359
+ /* @__PURE__ */ a(
307
360
  "select",
308
361
  {
309
362
  className: "widget-filter__select",
310
363
  value: s,
311
- onChange: (d) => o(c, parseInt(d.target.value)),
312
- children: D.map((d, h) => /* @__PURE__ */ l("option", { value: h + 1, children: d }, h + 1))
364
+ onChange: (o) => g(c, parseInt(o.target.value)),
365
+ children: P.map((o, d) => /* @__PURE__ */ a("option", { value: d + 1, children: o }, d + 1))
313
366
  }
314
367
  ),
315
- /* @__PURE__ */ l(
368
+ /* @__PURE__ */ a(
316
369
  "select",
317
370
  {
318
371
  className: "widget-filter__select",
319
372
  value: c,
320
- onChange: (d) => o(parseInt(d.target.value), s),
321
- children: m.map((d) => /* @__PURE__ */ l("option", { value: d, children: d }, d))
373
+ onChange: (o) => g(parseInt(o.target.value), s),
374
+ children: m.map((o) => /* @__PURE__ */ a("option", { value: o, children: o }, o))
322
375
  }
323
376
  )
324
377
  ] });
325
378
  }
326
- function Re({ value: a, dateBounds: r, onChange: n }) {
327
- const [t] = a ? a.split("|") : [""], e = W(t), i = /* @__PURE__ */ new Date(), c = (e == null ? void 0 : e.year) ?? i.getFullYear(), s = (e == null ? void 0 : e.month) ?? i.getMonth() + 1, m = I(r), o = R(c, s), d = X(t, c, s) || 1;
379
+ function Te({ value: t, dateBounds: l, onChange: n }) {
380
+ const [r] = t ? t.split("|") : [""], e = D(r), i = /* @__PURE__ */ new Date(), c = (e == null ? void 0 : e.year) ?? i.getFullYear(), s = (e == null ? void 0 : e.month) ?? i.getMonth() + 1, m = I(l), g = M(c, s), o = X(r, c, s) || 1;
328
381
  return /* @__PURE__ */ _("div", { className: "widget-filter__date-range widget-filter__date-range--week", children: [
329
- /* @__PURE__ */ l(
382
+ /* @__PURE__ */ a(
330
383
  "select",
331
384
  {
332
385
  className: "widget-filter__select",
333
386
  value: c,
334
- onChange: (h) => {
335
- const u = parseInt(h.target.value), g = R(u, s)[0];
336
- g && n(`${g.start}|${g.end}`);
387
+ onChange: (d) => {
388
+ const h = parseInt(d.target.value), u = M(h, s)[0];
389
+ u && n(`${u.start}|${u.end}`);
337
390
  },
338
- children: m.map((h) => /* @__PURE__ */ l("option", { value: h, children: h }, h))
391
+ children: m.map((d) => /* @__PURE__ */ a("option", { value: d, children: d }, d))
339
392
  }
340
393
  ),
341
- /* @__PURE__ */ l(
394
+ /* @__PURE__ */ a(
342
395
  "select",
343
396
  {
344
397
  className: "widget-filter__select",
345
398
  value: s,
346
- onChange: (h) => {
347
- const u = parseInt(h.target.value), g = R(c, u)[0];
348
- g && n(`${g.start}|${g.end}`);
399
+ onChange: (d) => {
400
+ const h = parseInt(d.target.value), u = M(c, h)[0];
401
+ u && n(`${u.start}|${u.end}`);
349
402
  },
350
- children: D.map((h, u) => /* @__PURE__ */ l("option", { value: u + 1, children: h }, u + 1))
403
+ children: P.map((d, h) => /* @__PURE__ */ a("option", { value: h + 1, children: d }, h + 1))
351
404
  }
352
405
  ),
353
- /* @__PURE__ */ l(
406
+ /* @__PURE__ */ a(
354
407
  "select",
355
408
  {
356
409
  className: "widget-filter__select",
357
- value: d,
358
- onChange: (h) => {
359
- const u = o[parseInt(h.target.value) - 1];
360
- u && n(`${u.start}|${u.end}`);
410
+ value: o,
411
+ onChange: (d) => {
412
+ const h = g[parseInt(d.target.value) - 1];
413
+ h && n(`${h.start}|${h.end}`);
361
414
  },
362
- children: o.map((h) => /* @__PURE__ */ l("option", { value: h.index, children: h.label }, h.index))
415
+ children: g.map((d) => /* @__PURE__ */ a("option", { value: d.index, children: d.label }, d.index))
363
416
  }
364
417
  )
365
418
  ] });
366
419
  }
367
- function xe({ value: a, options: r, multi: n, searchable: t, onChange: e }) {
368
- if (t)
369
- return /* @__PURE__ */ l(
420
+ function Le({ value: t, options: l, multi: n, searchable: r, onChange: e }) {
421
+ if (r)
422
+ return /* @__PURE__ */ a(
370
423
  q,
371
424
  {
372
- value: a,
373
- options: r,
425
+ value: t,
426
+ options: l,
374
427
  multi: n,
375
428
  onChange: e
376
429
  }
377
430
  );
378
431
  if (n) {
379
- const i = a ? a.split(",") : [], c = (s) => {
380
- const m = i.includes(s) ? i.filter((o) => o !== s) : [...i, s];
381
- e(m.join(","));
432
+ const i = t ? t.split(L) : [], c = (s) => {
433
+ const m = i.includes(s) ? i.filter((g) => g !== s) : [...i, s];
434
+ e(m.join(L));
382
435
  };
383
- return /* @__PURE__ */ l("div", { className: "widget-filter__multi", children: r.map((s) => /* @__PURE__ */ _("label", { className: "widget-filter__multi-option", children: [
384
- /* @__PURE__ */ l(
385
- "input",
436
+ return /* @__PURE__ */ _("div", { className: "widget-filter__multi", children: [
437
+ i.length > 0 && /* @__PURE__ */ a(
438
+ "button",
386
439
  {
387
- type: "checkbox",
388
- checked: i.includes(s),
389
- onChange: () => c(s)
440
+ type: "button",
441
+ className: "widget-filter__multi-clear",
442
+ onClick: () => e(""),
443
+ children: "Limpar filtro"
390
444
  }
391
445
  ),
392
- s
393
- ] }, s)) });
446
+ l.map((s) => /* @__PURE__ */ _("label", { className: "widget-filter__multi-option", children: [
447
+ /* @__PURE__ */ a(
448
+ "input",
449
+ {
450
+ type: "checkbox",
451
+ checked: i.includes(s),
452
+ onChange: () => c(s)
453
+ }
454
+ ),
455
+ s
456
+ ] }, s))
457
+ ] });
394
458
  }
395
459
  return /* @__PURE__ */ _(
396
460
  "select",
397
461
  {
398
462
  className: "widget-filter__select",
399
- value: a,
463
+ value: t,
400
464
  onChange: (i) => e(i.target.value),
401
465
  children: [
402
- /* @__PURE__ */ l("option", { value: "", children: "Todos" }),
403
- r.map((i) => /* @__PURE__ */ l("option", { value: i, children: i }, i))
466
+ /* @__PURE__ */ a("option", { value: "", children: "Todos" }),
467
+ l.map((i) => /* @__PURE__ */ a("option", { value: i, children: i }, i))
404
468
  ]
405
469
  }
406
470
  );
407
471
  }
408
- const Fe = {
472
+ const Ie = {
409
473
  currency: "R$",
410
474
  percentage: "%"
411
475
  };
412
- function Te({ config: a, value: r, onChange: n }) {
413
- const t = a.label || "Variavel", e = a.locked || !1, i = a.variableFormat || "number", c = Fe[i] || "";
476
+ function Ae({ config: t, value: l, onChange: n }) {
477
+ const r = t.label || "Variavel", e = t.locked || !1, i = t.variableFormat || "number", c = Ie[i] || "";
414
478
  return /* @__PURE__ */ _("div", { className: `widget-variable ${e ? "widget-variable--locked" : ""}`, children: [
415
- /* @__PURE__ */ l("label", { className: "widget-variable__label", children: t }),
479
+ /* @__PURE__ */ a("label", { className: "widget-variable__label", children: r }),
416
480
  /* @__PURE__ */ _("div", { className: "widget-variable__input-wrapper", children: [
417
- /* @__PURE__ */ l(
481
+ /* @__PURE__ */ a(
418
482
  "input",
419
483
  {
420
484
  className: "widget-variable__input",
421
485
  type: "number",
422
- value: r,
486
+ value: l,
423
487
  onChange: (s) => n(parseFloat(s.target.value) || 0),
424
488
  disabled: e,
425
489
  step: i === "integer" ? 1 : 0.01
426
490
  }
427
491
  ),
428
- c && /* @__PURE__ */ l("span", { className: "widget-variable__suffix", children: c })
492
+ c && /* @__PURE__ */ a("span", { className: "widget-variable__suffix", children: c })
429
493
  ] }),
430
- e && /* @__PURE__ */ l("span", { className: "widget-variable__lock-icon", title: "Bloqueado", children: "🔒" })
494
+ e && /* @__PURE__ */ a("span", { className: "widget-variable__lock-icon", title: "Bloqueado", children: "🔒" })
431
495
  ] });
432
496
  }
433
- function Ie({ config: a, palette: r, onChange: n }) {
434
- const t = a.label || "Cores", e = a.locked || !1;
497
+ function Ee({ config: t, palette: l, onChange: n }) {
498
+ const r = t.label || "Cores", e = t.locked || !1;
435
499
  return /* @__PURE__ */ _("div", { className: `widget-palette ${e ? "widget-palette--locked" : ""}`, children: [
436
- /* @__PURE__ */ l("label", { className: "widget-palette__label", children: t }),
437
- /* @__PURE__ */ l(J, { selected: r, onSelect: n, customMode: !0, disabled: e }),
438
- e && /* @__PURE__ */ l("span", { className: "widget-palette__lock-icon", title: "Bloqueado", children: "🔒" })
500
+ /* @__PURE__ */ a("label", { className: "widget-palette__label", children: r }),
501
+ /* @__PURE__ */ a(Z, { selected: l, onSelect: n, customMode: !0, disabled: e }),
502
+ e && /* @__PURE__ */ a("span", { className: "widget-palette__lock-icon", title: "Bloqueado", children: "🔒" })
439
503
  ] });
440
504
  }
441
- function Le({
442
- type: a,
443
- computed: r,
505
+ function Oe({
506
+ type: t,
507
+ computed: l,
444
508
  palette: n,
445
- config: t,
509
+ config: r,
446
510
  filterValue: e,
447
511
  filterOptions: i,
448
512
  dateBounds: c,
449
513
  onFilterChange: s,
450
514
  variableValue: m,
451
- onVariableChange: o,
452
- onPaletteChange: d
515
+ onVariableChange: g,
516
+ onPaletteChange: o
453
517
  }) {
454
- if (r.error)
455
- return /* @__PURE__ */ l("div", { className: "widget widget--error", children: /* @__PURE__ */ l("span", { className: "widget__error-text", children: String(r.error) }) });
456
- const h = Z(n);
457
- switch (a) {
518
+ if (l.error)
519
+ return /* @__PURE__ */ a("div", { className: "widget widget--error", children: /* @__PURE__ */ a("span", { className: "widget__error-text", children: String(l.error) }) });
520
+ const d = B(n);
521
+ switch (t) {
458
522
  case "kpi_card":
459
- return /* @__PURE__ */ l(fe, { data: r, label: t == null ? void 0 : t.label });
523
+ return /* @__PURE__ */ a(we, { data: l, label: r == null ? void 0 : r.label });
460
524
  case "gauge":
461
- return /* @__PURE__ */ l(we, { data: r, palette: h, label: t == null ? void 0 : t.label });
525
+ return /* @__PURE__ */ a(ye, { data: l, palette: d, label: r == null ? void 0 : r.label });
462
526
  case "chart":
463
- return /* @__PURE__ */ l(ke, { data: r, palette: h, label: t == null ? void 0 : t.label });
527
+ return /* @__PURE__ */ a($e, { data: l, palette: d, label: r == null ? void 0 : r.label });
528
+ case "table":
529
+ return /* @__PURE__ */ a(Ce, { data: l, label: r == null ? void 0 : r.label });
464
530
  case "filter":
465
- return t && s ? /* @__PURE__ */ l(
466
- $e,
531
+ return r && s ? /* @__PURE__ */ a(
532
+ Re,
467
533
  {
468
- config: t,
534
+ config: r,
469
535
  value: e || "",
470
536
  options: i,
471
537
  dateBounds: c,
@@ -473,38 +539,38 @@ function Le({
473
539
  }
474
540
  ) : null;
475
541
  case "variable": {
476
- const u = t;
477
- return u && o ? /* @__PURE__ */ l(
478
- Te,
542
+ const h = r;
543
+ return h && g ? /* @__PURE__ */ a(
544
+ Ae,
479
545
  {
480
- config: u,
481
- value: m ?? u.variableValue ?? 0,
482
- onChange: o
546
+ config: h,
547
+ value: m ?? h.variableValue ?? 0,
548
+ onChange: g
483
549
  }
484
550
  ) : null;
485
551
  }
486
552
  case "color_palette":
487
- return t && d ? /* @__PURE__ */ l(
488
- Ie,
553
+ return r && o ? /* @__PURE__ */ a(
554
+ Ee,
489
555
  {
490
- config: t,
556
+ config: r,
491
557
  palette: n,
492
- onChange: d
558
+ onChange: o
493
559
  }
494
560
  ) : null;
495
561
  default:
496
562
  return /* @__PURE__ */ _("div", { className: "widget", children: [
497
563
  "Widget: ",
498
- a
564
+ t
499
565
  ] });
500
566
  }
501
567
  }
502
- const Oe = 2.5, Ae = 0.375;
503
- function Ye({
504
- token: a,
505
- rowHeight: r = Oe,
506
- gridGap: n = Ae,
507
- className: t
568
+ const We = 2.5, De = 0.375;
569
+ function Ge({
570
+ token: t,
571
+ rowHeight: l = We,
572
+ gridGap: n = De,
573
+ className: r
508
574
  }) {
509
575
  const {
510
576
  layout: e,
@@ -512,62 +578,62 @@ function Ye({
512
578
  loading: c,
513
579
  error: s,
514
580
  filters: m,
515
- variables: o,
516
- palette: d,
517
- setFilter: h,
518
- setVariable: u,
581
+ variables: g,
582
+ palette: o,
583
+ setFilter: d,
584
+ setVariable: h,
519
585
  setPalette: w
520
- } = pe(a);
586
+ } = be(t);
521
587
  if (s && !e)
522
- return /* @__PURE__ */ l("div", { className: `preview-tab ${t ?? ""}`, children: /* @__PURE__ */ l("div", { className: "preview-tab__error", children: s }) });
588
+ return /* @__PURE__ */ a("div", { className: `preview-tab ${r ?? ""}`, children: /* @__PURE__ */ a("div", { className: "preview-tab__error", children: s }) });
523
589
  if (!e)
524
- return /* @__PURE__ */ l("div", { className: `preview-tab ${t ?? ""}`, children: /* @__PURE__ */ l("div", { className: "preview-tab__loading", children: "Carregando dashboard..." }) });
590
+ return /* @__PURE__ */ a("div", { className: `preview-tab ${r ?? ""}`, children: /* @__PURE__ */ a("div", { className: "preview-tab__loading", children: "Carregando dashboard..." }) });
525
591
  if (e.widgets.length === 0)
526
- return /* @__PURE__ */ l("div", { className: `preview-tab ${t ?? ""}`, children: /* @__PURE__ */ l("div", { className: "preview-tab__empty", children: "Este dashboard nao possui widgets." }) });
527
- const g = (i == null ? void 0 : i.widgets) ?? {}, p = (i == null ? void 0 : i.date_bounds) ?? null, k = {
592
+ return /* @__PURE__ */ a("div", { className: `preview-tab ${r ?? ""}`, children: /* @__PURE__ */ a("div", { className: "preview-tab__empty", children: "Este dashboard nao possui widgets." }) });
593
+ const u = (i == null ? void 0 : i.widgets) ?? {}, b = (i == null ? void 0 : i.date_bounds) ?? null, y = {
528
594
  display: "grid",
529
595
  gridTemplateColumns: `repeat(${e.gridColumns}, 1fr)`,
530
- gridTemplateRows: `repeat(${e.gridRows}, ${r}rem)`,
596
+ gridTemplateRows: `repeat(${e.gridRows}, ${l}rem)`,
531
597
  gap: `${n}rem`,
532
- ...B(d)
598
+ ...ee(o)
533
599
  };
534
- return /* @__PURE__ */ _("div", { className: `preview-tab ${t ?? ""}`, children: [
535
- s && !i && /* @__PURE__ */ l("div", { className: "preview-tab__error", children: s }),
536
- i && /* @__PURE__ */ l("div", { className: "preview-tab__grid", style: k, children: e.widgets.map((b) => {
537
- const S = ee.has(b.type), y = g[b.id], C = {
538
- gridColumn: `${b.grid.x + 1} / span ${b.grid.w}`,
539
- gridRow: `${b.grid.y + 1} / span ${b.grid.h}`
540
- }, v = b.type === "variable" ? o[b.id] ?? (y == null ? void 0 : y.value) ?? b.config.variableValue ?? 0 : void 0;
541
- return /* @__PURE__ */ l(
600
+ return /* @__PURE__ */ _("div", { className: `preview-tab ${r ?? ""}`, children: [
601
+ s && !i && /* @__PURE__ */ a("div", { className: "preview-tab__error", children: s }),
602
+ i && /* @__PURE__ */ a("div", { className: "preview-tab__grid", style: y, children: e.widgets.map((p) => {
603
+ const S = te.has(p.type), N = u[p.id], C = {
604
+ gridColumn: `${p.grid.x + 1} / span ${p.grid.w}`,
605
+ gridRow: `${p.grid.y + 1} / span ${p.grid.h}`
606
+ }, v = p.type === "variable" ? g[p.id] ?? (N == null ? void 0 : N.value) ?? p.config.variableValue ?? 0 : void 0;
607
+ return /* @__PURE__ */ a(
542
608
  "div",
543
609
  {
544
610
  className: `preview-tab__widget ${S ? "preview-tab__widget--control" : ""}`,
545
611
  style: C,
546
- children: S || y ? /* @__PURE__ */ l(
547
- Le,
612
+ children: S || N ? /* @__PURE__ */ a(
613
+ Oe,
548
614
  {
549
- type: b.type,
550
- computed: y || {},
551
- palette: d,
552
- config: b.config,
553
- filterValue: m[b.id] || "",
554
- filterOptions: (y == null ? void 0 : y.available_values) || [],
555
- dateBounds: p,
556
- onFilterChange: (f) => h(b.id, f),
615
+ type: p.type,
616
+ computed: N || {},
617
+ palette: o,
618
+ config: p.config,
619
+ filterValue: m[p.id] || "",
620
+ filterOptions: (N == null ? void 0 : N.available_values) || [],
621
+ dateBounds: b,
622
+ onFilterChange: (f) => d(p.id, f),
557
623
  variableValue: v,
558
- onVariableChange: (f) => u(b.id, f),
624
+ onVariableChange: (f) => h(p.id, f),
559
625
  onPaletteChange: w
560
626
  }
561
- ) : /* @__PURE__ */ l("div", { className: "preview-tab__widget-loading", children: c ? "Carregando..." : "Sem dados" })
627
+ ) : /* @__PURE__ */ a("div", { className: "preview-tab__widget-loading", children: c ? "Carregando..." : "Sem dados" })
562
628
  },
563
- b.id
629
+ p.id
564
630
  );
565
631
  }) }),
566
- c && i && /* @__PURE__ */ l("div", { className: "preview-tab__recalculating", children: "Atualizando..." })
632
+ c && i && /* @__PURE__ */ a("div", { className: "preview-tab__recalculating", children: "Atualizando..." })
567
633
  ] });
568
634
  }
569
635
  export {
570
- je as ApiError,
571
- Ye as Dashboard
636
+ Ue as ApiError,
637
+ Ge as Dashboard
572
638
  };
573
639
  //# sourceMappingURL=index.js.map