@actionexec/dashboards 0.5.4 → 0.5.5

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,14 +1,14 @@
1
1
  import { jsxs as _, jsx as l } from "react/jsx-runtime";
2
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;
3
+ import { Q as z, R as U, n as I, L as H, G as L, I as W, m as D, w as R, 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-B4ojsspD.js";
4
+ import { U as je } from "./ColorPaletteSelector-B4ojsspD.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 he, XAxis as ge, YAxis as ue, Legend as me } from "recharts";
6
+ const _e = 300;
7
7
  function pe(a) {
8
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);
9
9
  T(() => {
10
10
  let v = !1;
11
- return G(a).then((f) => {
11
+ return z(a).then((f) => {
12
12
  v || n(f);
13
13
  }).catch((f) => {
14
14
  v || g(f.message);
@@ -18,11 +18,11 @@ function pe(a) {
18
18
  }, [a]), T(() => {
19
19
  if (r)
20
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);
21
+ const v = be(i, s);
22
+ u(!0), U(a, v).then((f) => {
23
+ e(f), !k.current && f.applied && (k.current = !0, c(($) => ({ ...fe(f.applied), ...$ }))), g(null);
24
24
  }).catch((f) => g(f.message)).finally(() => u(!1));
25
- }, me), () => {
25
+ }, _e), () => {
26
26
  p.current && clearTimeout(p.current);
27
27
  };
28
28
  }, [a, r, i, s]);
@@ -49,7 +49,7 @@ function pe(a) {
49
49
  setPalette: y
50
50
  };
51
51
  }
52
- function _e(a, r) {
52
+ function be(a, r) {
53
53
  const n = {};
54
54
  for (const [t, e] of Object.entries(a))
55
55
  if (e.includes("|")) {
@@ -61,16 +61,16 @@ function _e(a, r) {
61
61
  n[`v_${t}`] = String(e);
62
62
  return n;
63
63
  }
64
- function be(a) {
64
+ function fe(a) {
65
65
  const r = {};
66
66
  for (const [n, t] of Object.entries(a))
67
67
  if (t && typeof t == "object" && "start" in t) {
68
68
  const e = t;
69
69
  r[n] = `${e.start || ""}|${e.end || ""}`;
70
- } else Array.isArray(t) ? r[n] = t.join(",") : typeof t == "string" && (r[n] = t);
70
+ } else Array.isArray(t) ? r[n] = t.join(I) : typeof t == "string" && (r[n] = t);
71
71
  return r;
72
72
  }
73
- function fe({ data: a, label: r }) {
73
+ function ve({ data: a, label: r }) {
74
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" ? "↓" : "";
75
75
  return /* @__PURE__ */ _("div", { className: "widget widget-kpi", children: [
76
76
  /* @__PURE__ */ l("span", { className: "widget-kpi__label", children: n }),
@@ -87,26 +87,26 @@ function fe({ data: a, label: r }) {
87
87
  ] })
88
88
  ] });
89
89
  }
90
- const ve = "var(--bg-elevated)";
91
- function O(a, r, n, t) {
90
+ const we = "var(--bg-elevated)";
91
+ function E(a, r, n, t) {
92
92
  if (t <= 0) return "";
93
93
  if (t >= 1)
94
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
95
  const e = t * Math.PI, i = a - n * Math.cos(e), c = r - n * Math.sin(e);
96
96
  return `M ${a - n} ${r} A ${n} ${n} 0 0 1 ${i} ${c}`;
97
97
  }
98
- function A(a) {
98
+ function O(a) {
99
99
  const r = Math.abs(a);
100
100
  return r >= 1e6 ? `${(a / 1e6).toFixed(1)}M` : r >= 1e3 ? `${(a / 1e3).toFixed(1)}K` : a.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: a, palette: r, label: n }) {
103
+ const t = n || String(a.label || ""), e = typeof a.value == "number" ? a.value : null, i = e != null ? O(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 ? O(m) : "-", g = 50, p = 50, k = 44, b = 10;
104
104
  return /* @__PURE__ */ _("div", { className: "widget widget-gauge", children: [
105
105
  /* @__PURE__ */ l("span", { className: "widget-gauge__label", children: t }),
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__ */ l("path", { d: E(g, p, k, 1), fill: "none", stroke: we, strokeWidth: b, strokeLinecap: "butt" }),
109
+ h > 0 && /* @__PURE__ */ l("path", { d: E(g, p, k, h), fill: "none", stroke: u, strokeWidth: b, strokeLinecap: "butt" })
110
110
  ] }),
111
111
  /* @__PURE__ */ _("div", { className: "widget-gauge__center", children: [
112
112
  /* @__PURE__ */ l("span", { className: "widget-gauge__percent", children: c }),
@@ -121,7 +121,7 @@ function we({ data: a, palette: r, label: n }) {
121
121
  ] })
122
122
  ] });
123
123
  }
124
- const E = { fontSize: 10, fill: "var(--text-muted)" }, ye = "var(--bg-elevated)", Y = {
124
+ const P = { 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,12 +130,12 @@ 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(a, r) {
134
134
  var e;
135
135
  const n = Array.isArray(r) ? r[0] : void 0, t = (e = n == null ? void 0 : n.payload) == null ? void 0 : e.tooltipLabel;
136
136
  return typeof t == "string" && t ? t : String(a ?? "");
137
137
  }
138
- function Ne(a) {
138
+ function ke(a) {
139
139
  const [r, n] = N({ width: 0, height: 0 });
140
140
  return T(() => {
141
141
  const t = a.current;
@@ -151,96 +151,96 @@ function Ne(a) {
151
151
  }
152
152
  function x({ Chart: a, chartData: r, xKey: n, series: t, palette: e, renderSeries: i, width: c, height: s }) {
153
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 }),
154
+ /* @__PURE__ */ l(he, { strokeDasharray: "3 3", stroke: Ne }),
155
+ /* @__PURE__ */ l(ge, { dataKey: n, tick: P }),
156
+ /* @__PURE__ */ l(ue, { tick: P }),
157
157
  /* @__PURE__ */ l(
158
- P,
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, {}),
166
+ t.length > 1 && /* @__PURE__ */ l(me, {}),
167
167
  t.map((m, o) => i(m, e[o % e.length], o))
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: [
170
+ function $e({ 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 } = ke(m), h = () => {
172
+ var w;
173
+ if (o <= 0 || d <= 0) return null;
174
+ if (t === "pie")
175
+ return /* @__PURE__ */ _(ae, { width: o, height: d, children: [
176
+ /* @__PURE__ */ l(
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: g, percent: p }) => `${g}: ${(p * 100).toFixed(0)}%`,
186
+ labelLine: !1,
187
+ children: s.map((g, p) => /* @__PURE__ */ l(le, { fill: r[p % r.length] }, p))
188
+ }
189
+ ),
190
+ /* @__PURE__ */ l(
191
+ Y,
192
+ {
193
+ contentStyle: V,
194
+ labelStyle: K,
195
+ labelFormatter: G
196
+ }
197
+ )
198
+ ] });
199
+ const u = { chartData: s, xKey: i, series: c, palette: r, width: o, height: d };
200
+ return t === "line" ? /* @__PURE__ */ l(x, { ...u, Chart: ne, renderSeries: (g, p) => /* @__PURE__ */ l(
201
+ ie,
202
+ {
203
+ type: "monotone",
204
+ dataKey: g.key,
205
+ name: g.label,
206
+ stroke: p,
207
+ strokeWidth: 2,
208
+ dot: s.length <= 31
209
+ },
210
+ g.key
211
+ ) }) : t === "area" ? /* @__PURE__ */ l(x, { ...u, Chart: se, renderSeries: (g, p) => /* @__PURE__ */ l(
212
+ ce,
213
+ {
214
+ type: "monotone",
215
+ dataKey: g.key,
216
+ name: g.label,
217
+ fill: p,
218
+ stroke: p,
219
+ fillOpacity: 0.3
220
+ },
221
+ g.key
222
+ ) }) : /* @__PURE__ */ l(x, { ...u, Chart: oe, renderSeries: (g, p) => /* @__PURE__ */ l(
223
+ de,
224
+ {
225
+ dataKey: g.key,
226
+ name: g.label,
227
+ fill: p,
228
+ radius: [3, 3, 0, 0]
229
+ },
230
+ g.key
231
+ ) });
232
+ };
233
+ return /* @__PURE__ */ _("div", { className: "widget widget-chart", children: [
173
234
  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" });
235
+ /* @__PURE__ */ l("div", { ref: m, className: "widget-chart__container", children: s.length === 0 ? /* @__PURE__ */ l("div", { className: "widget-chart__empty", children: "Sem dados" }) : h() })
236
+ ] });
237
237
  }
238
- function $e({ config: a, value: r, options: n = [], dateBounds: t, onChange: e }) {
238
+ function Se({ config: a, value: r, options: n = [], dateBounds: t, onChange: e }) {
239
239
  const i = a.filterType || "select", c = a.label || "Filtro", s = a.dateFilterMode || "range";
240
240
  return /* @__PURE__ */ _("div", { className: "widget-filter", children: [
241
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,
242
+ i === "date_range" ? s === "yearly" ? /* @__PURE__ */ l(Me, { value: r, dateBounds: t, onChange: e }) : s === "monthly" ? /* @__PURE__ */ l(Re, { value: r, dateBounds: t, onChange: e }) : s === "weekly" ? /* @__PURE__ */ l(xe, { value: r, dateBounds: t, onChange: e }) : /* @__PURE__ */ l(Ce, { value: r, dateBounds: t, onChange: e }) : /* @__PURE__ */ l(
243
+ Fe,
244
244
  {
245
245
  value: r,
246
246
  options: n,
@@ -251,11 +251,11 @@ function $e({ config: a, value: r, options: n = [], dateBounds: t, onChange: e }
251
251
  )
252
252
  ] });
253
253
  }
254
- function Se({ value: a, dateBounds: r, onChange: n }) {
254
+ function Ce({ value: a, dateBounds: r, onChange: n }) {
255
255
  const [t, e] = a ? a.split("|") : ["", ""];
256
256
  return /* @__PURE__ */ _("div", { className: "widget-filter__date-range widget-filter__date-range--stacked", children: [
257
257
  /* @__PURE__ */ l(
258
- L,
258
+ A,
259
259
  {
260
260
  value: t,
261
261
  minIso: r == null ? void 0 : r.min,
@@ -268,7 +268,7 @@ function Se({ value: a, dateBounds: r, onChange: n }) {
268
268
  }
269
269
  ),
270
270
  /* @__PURE__ */ l(
271
- L,
271
+ A,
272
272
  {
273
273
  value: e,
274
274
  minIso: t || (r == null ? void 0 : r.min),
@@ -282,9 +282,9 @@ function Se({ value: a, dateBounds: r, onChange: n }) {
282
282
  )
283
283
  ] });
284
284
  }
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);
285
+ function Me({ 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 = L(r), m = (o) => {
287
+ const d = J(o);
288
288
  n(`${d.start}|${d.end}`);
289
289
  };
290
290
  return /* @__PURE__ */ l("div", { className: "widget-filter__date-range widget-filter__date-range--year", children: /* @__PURE__ */ l(
@@ -297,8 +297,8 @@ function Ce({ value: a, dateBounds: r, onChange: n }) {
297
297
  }
298
298
  ) });
299
299
  }
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) => {
300
+ function Re({ 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 = L(r), o = (d, h) => {
302
302
  const u = Q(d, h);
303
303
  n(`${u.start}|${u.end}`);
304
304
  };
@@ -323,8 +323,8 @@ function Me({ value: a, dateBounds: r, onChange: n }) {
323
323
  )
324
324
  ] });
325
325
  }
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;
326
+ function xe({ 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 = L(r), o = R(c, s), d = X(t, c, s) || 1;
328
328
  return /* @__PURE__ */ _("div", { className: "widget-filter__date-range widget-filter__date-range--week", children: [
329
329
  /* @__PURE__ */ l(
330
330
  "select",
@@ -364,7 +364,7 @@ function Re({ value: a, dateBounds: r, onChange: n }) {
364
364
  )
365
365
  ] });
366
366
  }
367
- function xe({ value: a, options: r, multi: n, searchable: t, onChange: e }) {
367
+ function Fe({ value: a, options: r, multi: n, searchable: t, onChange: e }) {
368
368
  if (t)
369
369
  return /* @__PURE__ */ l(
370
370
  q,
@@ -376,21 +376,32 @@ function xe({ value: a, options: r, multi: n, searchable: t, onChange: e }) {
376
376
  }
377
377
  );
378
378
  if (n) {
379
- const i = a ? a.split(",") : [], c = (s) => {
379
+ const i = a ? a.split(I) : [], c = (s) => {
380
380
  const m = i.includes(s) ? i.filter((o) => o !== s) : [...i, s];
381
- e(m.join(","));
381
+ e(m.join(I));
382
382
  };
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",
383
+ return /* @__PURE__ */ _("div", { className: "widget-filter__multi", children: [
384
+ i.length > 0 && /* @__PURE__ */ l(
385
+ "button",
386
386
  {
387
- type: "checkbox",
388
- checked: i.includes(s),
389
- onChange: () => c(s)
387
+ type: "button",
388
+ className: "widget-filter__multi-clear",
389
+ onClick: () => e(""),
390
+ children: "Limpar filtro"
390
391
  }
391
392
  ),
392
- s
393
- ] }, s)) });
393
+ r.map((s) => /* @__PURE__ */ _("label", { className: "widget-filter__multi-option", children: [
394
+ /* @__PURE__ */ l(
395
+ "input",
396
+ {
397
+ type: "checkbox",
398
+ checked: i.includes(s),
399
+ onChange: () => c(s)
400
+ }
401
+ ),
402
+ s
403
+ ] }, s))
404
+ ] });
394
405
  }
395
406
  return /* @__PURE__ */ _(
396
407
  "select",
@@ -405,12 +416,12 @@ function xe({ value: a, options: r, multi: n, searchable: t, onChange: e }) {
405
416
  }
406
417
  );
407
418
  }
408
- const Fe = {
419
+ const Te = {
409
420
  currency: "R$",
410
421
  percentage: "%"
411
422
  };
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] || "";
423
+ function Ie({ config: a, value: r, onChange: n }) {
424
+ const t = a.label || "Variavel", e = a.locked || !1, i = a.variableFormat || "number", c = Te[i] || "";
414
425
  return /* @__PURE__ */ _("div", { className: `widget-variable ${e ? "widget-variable--locked" : ""}`, children: [
415
426
  /* @__PURE__ */ l("label", { className: "widget-variable__label", children: t }),
416
427
  /* @__PURE__ */ _("div", { className: "widget-variable__input-wrapper", children: [
@@ -430,15 +441,15 @@ function Te({ config: a, value: r, onChange: n }) {
430
441
  e && /* @__PURE__ */ l("span", { className: "widget-variable__lock-icon", title: "Bloqueado", children: "🔒" })
431
442
  ] });
432
443
  }
433
- function Ie({ config: a, palette: r, onChange: n }) {
444
+ function Le({ config: a, palette: r, onChange: n }) {
434
445
  const t = a.label || "Cores", e = a.locked || !1;
435
446
  return /* @__PURE__ */ _("div", { className: `widget-palette ${e ? "widget-palette--locked" : ""}`, children: [
436
447
  /* @__PURE__ */ l("label", { className: "widget-palette__label", children: t }),
437
- /* @__PURE__ */ l(J, { selected: r, onSelect: n, customMode: !0, disabled: e }),
448
+ /* @__PURE__ */ l(Z, { selected: r, onSelect: n, customMode: !0, disabled: e }),
438
449
  e && /* @__PURE__ */ l("span", { className: "widget-palette__lock-icon", title: "Bloqueado", children: "🔒" })
439
450
  ] });
440
451
  }
441
- function Le({
452
+ function Ae({
442
453
  type: a,
443
454
  computed: r,
444
455
  palette: n,
@@ -453,17 +464,17 @@ function Le({
453
464
  }) {
454
465
  if (r.error)
455
466
  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);
467
+ const h = B(n);
457
468
  switch (a) {
458
469
  case "kpi_card":
459
- return /* @__PURE__ */ l(fe, { data: r, label: t == null ? void 0 : t.label });
470
+ return /* @__PURE__ */ l(ve, { data: r, label: t == null ? void 0 : t.label });
460
471
  case "gauge":
461
- return /* @__PURE__ */ l(we, { data: r, palette: h, label: t == null ? void 0 : t.label });
472
+ return /* @__PURE__ */ l(ye, { data: r, palette: h, label: t == null ? void 0 : t.label });
462
473
  case "chart":
463
- return /* @__PURE__ */ l(ke, { data: r, palette: h, label: t == null ? void 0 : t.label });
474
+ return /* @__PURE__ */ l($e, { data: r, palette: h, label: t == null ? void 0 : t.label });
464
475
  case "filter":
465
476
  return t && s ? /* @__PURE__ */ l(
466
- $e,
477
+ Se,
467
478
  {
468
479
  config: t,
469
480
  value: e || "",
@@ -475,7 +486,7 @@ function Le({
475
486
  case "variable": {
476
487
  const u = t;
477
488
  return u && o ? /* @__PURE__ */ l(
478
- Te,
489
+ Ie,
479
490
  {
480
491
  config: u,
481
492
  value: m ?? u.variableValue ?? 0,
@@ -485,7 +496,7 @@ function Le({
485
496
  }
486
497
  case "color_palette":
487
498
  return t && d ? /* @__PURE__ */ l(
488
- Ie,
499
+ Le,
489
500
  {
490
501
  config: t,
491
502
  palette: n,
@@ -499,11 +510,11 @@ function Le({
499
510
  ] });
500
511
  }
501
512
  }
502
- const Oe = 2.5, Ae = 0.375;
503
- function Ye({
513
+ const Ee = 2.5, Oe = 0.375;
514
+ function Ve({
504
515
  token: a,
505
- rowHeight: r = Oe,
506
- gridGap: n = Ae,
516
+ rowHeight: r = Ee,
517
+ gridGap: n = Oe,
507
518
  className: t
508
519
  }) {
509
520
  const {
@@ -529,12 +540,12 @@ function Ye({
529
540
  gridTemplateColumns: `repeat(${e.gridColumns}, 1fr)`,
530
541
  gridTemplateRows: `repeat(${e.gridRows}, ${r}rem)`,
531
542
  gap: `${n}rem`,
532
- ...B(d)
543
+ ...ee(d)
533
544
  };
534
545
  return /* @__PURE__ */ _("div", { className: `preview-tab ${t ?? ""}`, children: [
535
546
  s && !i && /* @__PURE__ */ l("div", { className: "preview-tab__error", children: s }),
536
547
  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 = {
548
+ const S = te.has(b.type), y = g[b.id], C = {
538
549
  gridColumn: `${b.grid.x + 1} / span ${b.grid.w}`,
539
550
  gridRow: `${b.grid.y + 1} / span ${b.grid.h}`
540
551
  }, v = b.type === "variable" ? o[b.id] ?? (y == null ? void 0 : y.value) ?? b.config.variableValue ?? 0 : void 0;
@@ -544,7 +555,7 @@ function Ye({
544
555
  className: `preview-tab__widget ${S ? "preview-tab__widget--control" : ""}`,
545
556
  style: C,
546
557
  children: S || y ? /* @__PURE__ */ l(
547
- Le,
558
+ Ae,
548
559
  {
549
560
  type: b.type,
550
561
  computed: y || {},
@@ -568,6 +579,6 @@ function Ye({
568
579
  }
569
580
  export {
570
581
  je as ApiError,
571
- Ye as Dashboard
582
+ Ve as Dashboard
572
583
  };
573
584
  //# sourceMappingURL=index.js.map