@actionexec/dashboards 0.12.0 → 0.14.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.
@@ -1,39 +1,42 @@
1
- import { jsx as l, jsxs as E } from "react/jsx-runtime";
2
- import Q from "react-datepicker";
3
- import { useState as x, useRef as $, useMemo as k, useLayoutEffect as Z, useEffect as ee } from "react";
4
- import { createPortal as te } from "react-dom";
5
- const ae = "https://action-data-api-7mbrztperq-rj.a.run.app", ne = "/external/dashboards";
6
- let G = ae;
7
- function ye(e) {
8
- G = e.replace(/\/$/, "");
9
- }
10
- class re extends Error {
1
+ import { jsx as u, jsxs as E } from "react/jsx-runtime";
2
+ import te from "react-datepicker";
3
+ import { useState as x, useRef as U, useMemo as G, useLayoutEffect as ae, useEffect as ne } from "react";
4
+ import { createPortal as re } from "react-dom";
5
+ const se = "https://action-data-api-7mbrztperq-rj.a.run.app", W = "/external/dashboards", C = "/external/statements";
6
+ let H = se;
7
+ function Ae(e) {
8
+ H = e.replace(/\/$/, "");
9
+ }
10
+ class oe extends Error {
11
11
  constructor(t, a, n) {
12
12
  super(t), this.status = a, this.payload = n, this.name = "ApiError";
13
13
  }
14
14
  }
15
- async function Y(e, t, a) {
16
- const n = new URL(`${G}${ne}${e}`);
17
- if (a)
18
- for (const [o, i] of Object.entries(a)) n.searchParams.set(o, i);
19
- const r = await fetch(n.toString(), {
20
- headers: { Authorization: `Bearer ${t}` }
15
+ async function B(e, t, a, n) {
16
+ const r = new URL(`${H}${e}${t}`);
17
+ if (n)
18
+ for (const [c, l] of Object.entries(n)) r.searchParams.set(c, l);
19
+ const o = await fetch(r.toString(), {
20
+ headers: { Authorization: `Bearer ${a}` }
21
21
  });
22
- if (!r.ok) {
23
- let o;
22
+ if (!o.ok) {
23
+ let c;
24
24
  try {
25
- o = await r.json();
25
+ c = await o.json();
26
26
  } catch {
27
27
  }
28
- throw new re(
29
- `Requisicao falhou (${r.status}) em ${e}`,
30
- r.status,
31
- o
28
+ throw new oe(
29
+ `Requisicao falhou (${o.status}) em ${t}`,
30
+ o.status,
31
+ c
32
32
  );
33
33
  }
34
- return await r.json();
34
+ return o;
35
35
  }
36
- const Ne = (e) => Y("/layout", e), Ae = (e, t) => Y("/render", e, t), f = {
36
+ async function O(e, t, a, n) {
37
+ return await (await B(e, t, a, n)).json();
38
+ }
39
+ const Me = (e) => O(W, "/layout", e), Oe = (e, t) => O(W, "/render", e, t), Re = (e) => O(C, "/layout", e), xe = (e, t) => O(C, "/render", e, t), Pe = async (e, t) => (await B(C, "/pdf", e, t)).blob(), d = {
37
40
  series0: 0,
38
41
  series1: 1,
39
42
  series2: 2,
@@ -51,7 +54,7 @@ const Ne = (e) => Y("/layout", e), Ae = (e, t) => Y("/render", e, t), f = {
51
54
  // trocar a cor de uma serie mudar o significado semantico de "atencao".
52
55
  warning: 13,
53
56
  info: 14
54
- }, se = 5, A = 15, oe = {
57
+ }, ce = 5, A = 15, ie = {
55
58
  series0: "Série 1",
56
59
  series1: "Série 2",
57
60
  series2: "Série 3",
@@ -168,42 +171,42 @@ const Ne = (e) => Y("/layout", e), Ae = (e, t) => Y("/render", e, t), f = {
168
171
  "#8b5cf6"
169
172
  ]
170
173
  }
171
- }, W = M.action.colors;
174
+ }, j = M.action.colors;
172
175
  function N(e) {
173
- const t = W;
176
+ const t = j;
174
177
  if (!e || e.length === 0) return [...t];
175
178
  if (e.length >= A) return e.slice(0, A);
176
179
  const a = [...e];
177
180
  for (let n = e.length; n < A; n++) a.push(t[n]);
178
181
  return a;
179
182
  }
180
- function ce(e) {
181
- return N(e).slice(0, se);
183
+ function le(e) {
184
+ return N(e).slice(0, ce);
182
185
  }
183
- function Me(e) {
186
+ function Ce(e) {
184
187
  const t = N(e);
185
188
  return {
186
- "--bg-dark": t[f.bgDark],
187
- "--bg-paper": t[f.bgPaper],
188
- "--bg-elevated": t[f.bgElevated],
189
- "--text-primary": t[f.textPrimary],
190
- "--text-secondary": t[f.textMuted],
191
- "--text-muted": t[f.textMuted],
192
- "--color-accent": t[f.accent],
193
- "--color-success": t[f.success],
194
- "--color-error": t[f.error],
195
- "--color-warning": t[f.warning],
196
- "--color-info": t[f.info],
189
+ "--bg-dark": t[d.bgDark],
190
+ "--bg-paper": t[d.bgPaper],
191
+ "--bg-elevated": t[d.bgElevated],
192
+ "--text-primary": t[d.textPrimary],
193
+ "--text-secondary": t[d.textMuted],
194
+ "--text-muted": t[d.textMuted],
195
+ "--color-accent": t[d.accent],
196
+ "--color-success": t[d.success],
197
+ "--color-error": t[d.error],
198
+ "--color-warning": t[d.warning],
199
+ "--color-info": t[d.info],
197
200
  // Aliases historicos, mantidos para nao quebrar CSS de consumidores.
198
- "--action-orange": t[f.accent],
199
- "--action-green": t[f.success]
201
+ "--action-orange": t[d.accent],
202
+ "--action-green": t[d.success]
200
203
  };
201
204
  }
202
- const ie = W, le = 30, ue = 10, Oe = {
203
- gridColumns: le,
204
- gridRows: ue,
205
+ const ue = j, fe = 30, de = 10, Ie = {
206
+ gridColumns: fe,
207
+ gridRows: de,
205
208
  widgets: []
206
- }, xe = {
209
+ }, Fe = {
207
210
  kpi_card: "Card",
208
211
  gauge: "Gauge",
209
212
  chart: "Gráfico",
@@ -212,39 +215,39 @@ const ie = W, le = 30, ue = 10, Oe = {
212
215
  filter: "Filtro",
213
216
  variable: "Variável",
214
217
  color_palette: "Paleta de Cores"
215
- }, Pe = ["kpi_card", "gauge", "chart", "composition", "table"], Re = ["filter", "variable", "color_palette"], Ce = /* @__PURE__ */ new Set(["filter", "variable", "color_palette"]), Ie = {
218
+ }, ve = ["kpi_card", "gauge", "chart", "composition", "table"], $e = ["filter", "variable", "color_palette"], ke = /* @__PURE__ */ new Set(["filter", "variable", "color_palette"]), Ue = {
216
219
  day: ["dia", "dias"],
217
220
  week: ["semana", "semanas"],
218
221
  month: ["mês", "meses"],
219
222
  quarter: ["trimestre", "trimestres"],
220
223
  year: ["ano", "anos"]
221
- }, ve = ["período", "períodos"], Fe = {
224
+ }, Ge = ["período", "períodos"], Ye = {
222
225
  sum: "Soma",
223
226
  avg: "Média",
224
227
  count: "Contagem",
225
228
  min: "Mínimo",
226
229
  max: "Máximo",
227
230
  count_distinct: "Contagem Distinta"
228
- }, fe = {
231
+ }, ge = {
229
232
  currency: "Moeda (R$)",
230
233
  number: "Número",
231
234
  integer: "Inteiro",
232
235
  percentage: "Porcentagem",
233
236
  date: "Data",
234
237
  text: "Texto"
235
- }, $e = Object.entries(fe).filter(([e]) => e !== "date" && e !== "text"), ke = {
238
+ }, We = Object.entries(ge).filter(([e]) => e !== "date" && e !== "text"), He = {
236
239
  variance: "Variação %",
237
240
  difference: "Diferença",
238
241
  ratio: "Proporção",
239
242
  value: "Base"
240
- }, Ue = {
243
+ }, Be = {
241
244
  scroll: "Rolar",
242
245
  clip: "Cortar"
243
- }, Ge = {
246
+ }, je = {
244
247
  higher: "Positivo",
245
248
  lower: "Negativo",
246
249
  neutral: "Neutro"
247
- }, Ye = {
250
+ }, ze = {
248
251
  eq: "Igual a",
249
252
  neq: "Diferente de",
250
253
  in: "Está entre os valores",
@@ -258,21 +261,21 @@ const ie = W, le = 30, ue = 10, Oe = {
258
261
  not_contains: "Não contém",
259
262
  is_empty: "Está vazio",
260
263
  not_empty: "Não está vazio"
261
- }, We = ["is_empty", "not_empty"], He = ["in", "not_in"], Be = {
264
+ }, qe = ["is_empty", "not_empty"], Ve = ["in", "not_in"], Je = {
262
265
  bar: "Barras",
263
266
  line: "Linhas",
264
267
  area: "Área"
265
- }, je = {
268
+ }, Xe = {
266
269
  pie: "Pizza",
267
270
  bridge: "Ponte"
268
- }, ze = {
271
+ }, Ke = {
269
272
  descending: "Descendente",
270
273
  ascending: "Ascendente"
271
- }, Ve = {
274
+ }, Qe = {
272
275
  date_range: "Periodo",
273
276
  select: "Seleção Única",
274
277
  multi_select: "Seleção Múltipla"
275
- }, U = "", qe = {
278
+ }, Y = "", Ze = {
276
279
  kpi_card: { x: 0, y: 0, w: 6, h: 3 },
277
280
  gauge: { x: 0, y: 0, w: 6, h: 5 },
278
281
  chart: { x: 0, y: 0, w: 6, h: 6 },
@@ -281,7 +284,7 @@ const ie = W, le = 30, ue = 10, Oe = {
281
284
  filter: { x: 0, y: 0, w: 4, h: 2 },
282
285
  variable: { x: 0, y: 0, w: 4, h: 2 },
283
286
  color_palette: { x: 0, y: 0, w: 4, h: 2 }
284
- }, Je = {
287
+ }, et = {
285
288
  kpi_card: { label: "Novo card", aggregation: "sum", format: "number" },
286
289
  gauge: { label: "Novo Gauge", aggregation: "sum" },
287
290
  chart: { label: "Novo gráfico", chartType: "bar", xAxis: { column: "", granularity: "day" }, series: [] },
@@ -294,59 +297,59 @@ const ie = W, le = 30, ue = 10, Oe = {
294
297
  table: { label: "Nova Tabela", columns: [] },
295
298
  filter: { label: "Novo Filtro", filterType: "select" },
296
299
  variable: { label: "Nova Variavel", variableValue: 0, variableFormat: "number", locked: !1 },
297
- color_palette: { label: "Paleta de Cores", paletteColors: ie, locked: !1 }
298
- }, R = 6, C = 16, I = 1, P = 24, de = 80, ge = (e, t, a) => Math.min(Math.max(e, t), a), S = (e) => Number.isFinite(e) && e > 0;
299
- function Xe(e, t, a = R, n = C) {
300
+ color_palette: { label: "Paleta de Cores", paletteColors: ue, locked: !1 }
301
+ }, I = 6, F = 16, v = 1, P = 24, me = 80, pe = (e, t, a) => Math.min(Math.max(e, t), a), S = (e) => Number.isFinite(e) && e > 0;
302
+ function tt(e, t, a = I, n = F) {
300
303
  if (!S(t) || !Number.isFinite(e)) return 0;
301
304
  const r = e - n * 2 - a * (t - 1);
302
305
  return Math.max(0, r / t);
303
306
  }
304
- function Ke(e, t = I) {
305
- return !S(e) || !S(t) ? P : ge(e / t, P, de);
307
+ function at(e, t = v) {
308
+ return !S(e) || !S(t) ? P : pe(e / t, P, me);
306
309
  }
307
- function Qe(e, t, a = R, n = C) {
310
+ function nt(e, t, a = I, n = F) {
308
311
  return e <= 0 ? n * 2 : e * t + (e - 1) * a + n * 2;
309
312
  }
310
- function Ze(e, t, a = I) {
313
+ function rt(e, t, a = v) {
311
314
  return !S(e) || !S(t) || !S(a) ? 1 : e * a / t;
312
315
  }
313
- function et(e, t = I, a = R, n = C) {
316
+ function st(e, t = v, a = I, n = F) {
314
317
  return !S(e) || !S(t) ? 0 : P * t * e + a * (e - 1) + n * 2;
315
318
  }
316
- const y = "pt-BR", me = 100, pe = /* @__PURE__ */ new Set(["currency", "number", "integer", "percentage"]);
317
- function tt(e) {
318
- return !!e && pe.has(e);
319
+ const D = "pt-BR", be = 100, _e = /* @__PURE__ */ new Set(["currency", "number", "integer", "percentage"]);
320
+ function ot(e) {
321
+ return !!e && _e.has(e);
319
322
  }
320
- function H(e) {
323
+ function z(e) {
321
324
  if (e == null || e === "") return null;
322
325
  const t = typeof e == "number" ? e : Number(e);
323
326
  return Number.isFinite(t) ? t : null;
324
327
  }
325
- function _e(e, t, a = "-") {
328
+ function he(e, t, a = "-") {
326
329
  if (e == null || e === "") return a;
327
- const n = H(e);
330
+ const n = z(e);
328
331
  if (n === null) return String(e);
329
332
  switch (t) {
330
333
  case "currency":
331
- return n.toLocaleString(y, { style: "currency", currency: "BRL" });
334
+ return n.toLocaleString(D, { style: "currency", currency: "BRL" });
332
335
  case "integer":
333
- return Math.round(n).toLocaleString(y);
336
+ return Math.round(n).toLocaleString(D);
334
337
  case "percentage":
335
- return `${(n * me).toLocaleString(y, { maximumFractionDigits: 1 })}%`;
338
+ return `${(n * be).toLocaleString(D, { maximumFractionDigits: 1 })}%`;
336
339
  case "number":
337
- return n.toLocaleString(y, { maximumFractionDigits: 2 });
340
+ return n.toLocaleString(D, { maximumFractionDigits: 2 });
338
341
  default:
339
342
  return String(e);
340
343
  }
341
344
  }
342
- function at(e, t) {
343
- const a = H(e);
345
+ function ct(e, t) {
346
+ const a = z(e);
344
347
  if (a === null) return "-";
345
- if (t === "percentage") return _e(a, "percentage");
348
+ if (t === "percentage") return he(a, "percentage");
346
349
  const n = t === "currency" ? "R$ " : "", r = Math.abs(a);
347
- return r >= 1e9 ? `${n}${(a / 1e9).toFixed(1)}B` : r >= 1e6 ? `${n}${(a / 1e6).toFixed(1)}M` : r >= 1e3 ? `${n}${(a / 1e3).toFixed(1)}K` : `${n}${a.toLocaleString(y, { maximumFractionDigits: 2 })}`;
350
+ return r >= 1e9 ? `${n}${(a / 1e9).toFixed(1)}B` : r >= 1e6 ? `${n}${(a / 1e6).toFixed(1)}M` : r >= 1e3 ? `${n}${(a / 1e3).toFixed(1)}K` : `${n}${a.toLocaleString(D, { maximumFractionDigits: 2 })}`;
348
351
  }
349
- const nt = [
352
+ const it = [
350
353
  "Jan",
351
354
  "Fev",
352
355
  "Mar",
@@ -359,7 +362,7 @@ const nt = [
359
362
  "Out",
360
363
  "Nov",
361
364
  "Dez"
362
- ], rt = [
365
+ ], lt = [
363
366
  "Janeiro",
364
367
  "Fevereiro",
365
368
  "Marco",
@@ -373,169 +376,169 @@ const nt = [
373
376
  "Novembro",
374
377
  "Dezembro"
375
378
  ];
376
- function st(e) {
379
+ function ut(e) {
377
380
  return { start: `${e}-01-01`, end: `${e}-12-31` };
378
381
  }
379
- function ot(e) {
382
+ function ft(e) {
380
383
  if (!e) return null;
381
384
  const t = e.match(/^(\d{4})/);
382
385
  return t ? { year: parseInt(t[1]) } : null;
383
386
  }
384
- function ct(e, t) {
387
+ function dt(e, t) {
385
388
  const a = new Date(e, t, 0).getDate(), n = (r) => String(r).padStart(2, "0");
386
389
  return {
387
390
  start: `${e}-${n(t)}-01`,
388
391
  end: `${e}-${n(t)}-${n(a)}`
389
392
  };
390
393
  }
391
- function B(e) {
394
+ function q(e) {
392
395
  const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate()));
393
396
  t.setUTCDate(t.getUTCDate() + 4 - (t.getUTCDay() || 7));
394
397
  const a = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
395
398
  return Math.ceil(((t.getTime() - a.getTime()) / 864e5 + 1) / 7);
396
399
  }
397
- function it(e, t) {
398
- const a = new Date(e, 0, 4), n = (a.getDay() + 6) % 7, r = new Date(a.getTime() - n * 864e5), o = new Date(r.getTime() + (t - 1) * 7 * 864e5), i = new Date(o.getTime() + 6 * 864e5), d = (_) => String(_).padStart(2, "0"), g = (_) => `${_.getFullYear()}-${d(_.getMonth() + 1)}-${d(_.getDate())}`;
399
- return { start: g(o), end: g(i) };
400
+ function gt(e, t) {
401
+ const a = new Date(e, 0, 4), n = (a.getDay() + 6) % 7, r = new Date(a.getTime() - n * 864e5), o = new Date(r.getTime() + (t - 1) * 7 * 864e5), c = new Date(o.getTime() + 6 * 864e5), l = (b) => String(b).padStart(2, "0"), g = (b) => `${b.getFullYear()}-${l(b.getMonth() + 1)}-${l(b.getDate())}`;
402
+ return { start: g(o), end: g(c) };
400
403
  }
401
- function lt(e, t) {
404
+ function mt(e, t) {
402
405
  const a = /* @__PURE__ */ new Set(), n = new Date(e, t, 0).getDate();
403
406
  for (let r = 1; r <= n; r++)
404
- a.add(B(new Date(e, t - 1, r)));
407
+ a.add(q(new Date(e, t - 1, r)));
405
408
  return Array.from(a).sort((r, o) => r - o);
406
409
  }
407
- function ut(e, t) {
408
- const a = new Date(e, t, 0).getDate(), n = (d) => String(d).padStart(2, "0"), r = [];
409
- let o = 1, i = 1;
410
+ function pt(e, t) {
411
+ const a = new Date(e, t, 0).getDate(), n = (l) => String(l).padStart(2, "0"), r = [];
412
+ let o = 1, c = 1;
410
413
  for (; o <= a; ) {
411
- const d = o, g = Math.min(o + 6, a), _ = `${e}-${n(t)}-${n(d)}`, c = `${e}-${n(t)}-${n(g)}`, u = `${i}° Semana (${n(d)}/${n(t)} - ${n(g)}/${n(t)})`;
412
- r.push({ index: i, startDay: d, endDay: g, start: _, end: c, label: u }), o = g + 1, i++;
414
+ const l = o, g = Math.min(o + 6, a), b = `${e}-${n(t)}-${n(l)}`, i = `${e}-${n(t)}-${n(g)}`, f = `${c}° Semana (${n(l)}/${n(t)} - ${n(g)}/${n(t)})`;
415
+ r.push({ index: c, startDay: l, endDay: g, start: b, end: i, label: f }), o = g + 1, c++;
413
416
  }
414
417
  return r;
415
418
  }
416
- function ft(e, t, a) {
419
+ function bt(e, t, a) {
417
420
  if (!e) return 1;
418
- const n = (i) => String(i).padStart(2, "0"), r = e.match(new RegExp(`^${t}-${n(a)}-(\\d{2})`));
421
+ const n = (c) => String(c).padStart(2, "0"), r = e.match(new RegExp(`^${t}-${n(a)}-(\\d{2})`));
419
422
  if (!r) return 1;
420
423
  const o = parseInt(r[1]);
421
424
  return Math.ceil(o / 7);
422
425
  }
423
- function dt(e) {
426
+ function _t(e) {
424
427
  if (!e) return null;
425
428
  const t = e.match(/^(\d{4})-(\d{2})/);
426
429
  return t ? { year: parseInt(t[1]), month: parseInt(t[2]) } : null;
427
430
  }
428
- function gt(e) {
431
+ function ht(e) {
429
432
  if (!e) return null;
430
433
  const t = /* @__PURE__ */ new Date(e + "T00:00:00");
431
- return isNaN(t.getTime()) ? null : { year: t.getFullYear(), week: B(t) };
434
+ return isNaN(t.getTime()) ? null : { year: t.getFullYear(), week: q(t) };
432
435
  }
433
- function mt(e) {
436
+ function Et(e) {
434
437
  const t = /* @__PURE__ */ new Date(), a = e != null && e.min ? parseInt(e.min.slice(0, 4)) : t.getFullYear() - 2, n = e != null && e.max ? parseInt(e.max.slice(0, 4)) : t.getFullYear(), r = [];
435
438
  for (let o = n; o >= a; o--) r.push(o);
436
439
  return r;
437
440
  }
438
- function D(e) {
441
+ function y(e) {
439
442
  if (!e) return null;
440
443
  const [t, a, n] = e.split("-").map(Number);
441
444
  return !t || !a || !n ? null : new Date(t, a - 1, n);
442
445
  }
443
- function be(e) {
446
+ function Ee(e) {
444
447
  if (!e) return "";
445
448
  const t = e.getFullYear(), a = String(e.getMonth() + 1).padStart(2, "0"), n = String(e.getDate()).padStart(2, "0");
446
449
  return `${t}-${a}-${n}`;
447
450
  }
448
- function pt({
451
+ function St({
449
452
  value: e,
450
453
  onChange: t,
451
454
  minIso: a,
452
455
  maxIso: n,
453
456
  placeholder: r,
454
457
  selectsStart: o,
455
- selectsEnd: i,
456
- startIso: d,
458
+ selectsEnd: c,
459
+ startIso: l,
457
460
  endIso: g,
458
- className: _,
459
- disabled: c
461
+ className: b,
462
+ disabled: i
460
463
  }) {
461
- return /* @__PURE__ */ l("div", { className: `ddp-field ${_ ?? ""}`, children: /* @__PURE__ */ l(
462
- Q,
464
+ return /* @__PURE__ */ u("div", { className: `ddp-field ${b ?? ""}`, children: /* @__PURE__ */ u(
465
+ te,
463
466
  {
464
- selected: D(e),
465
- onChange: (u) => t(be(u)),
467
+ selected: y(e),
468
+ onChange: (f) => t(Ee(f)),
466
469
  selectsStart: o,
467
- selectsEnd: i,
468
- startDate: D(d) ?? void 0,
469
- endDate: D(g) ?? void 0,
470
- minDate: D(a) ?? void 0,
471
- maxDate: D(n) ?? void 0,
470
+ selectsEnd: c,
471
+ startDate: y(l) ?? void 0,
472
+ endDate: y(g) ?? void 0,
473
+ minDate: y(a) ?? void 0,
474
+ maxDate: y(n) ?? void 0,
472
475
  dateFormat: "dd/MM/yyyy",
473
476
  placeholderText: r ?? "Selecione...",
474
- disabled: c,
477
+ disabled: i,
475
478
  portalId: "ddp-portal",
476
479
  popperPlacement: "bottom-start",
477
480
  popperModifiers: [
478
481
  {
479
482
  name: "flip",
480
483
  options: { fallbackPlacements: ["bottom-end", "top-start", "top-end"] },
481
- fn: (u) => u
484
+ fn: (f) => f
482
485
  }
483
486
  ]
484
487
  }
485
488
  ) });
486
489
  }
487
- function _t({ options: e, value: t, multi: a, onChange: n }) {
488
- const [r, o] = x(!1), [i, d] = x(""), [g, _] = x(null), c = $(null), u = $(null), m = k(
489
- () => t ? t.split(U).filter(Boolean) : [],
490
+ function Tt({ options: e, value: t, multi: a, onChange: n }) {
491
+ const [r, o] = x(!1), [c, l] = x(""), [g, b] = x(null), i = U(null), f = U(null), m = G(
492
+ () => t ? t.split(Y).filter(Boolean) : [],
490
493
  [t]
491
- ), b = k(() => {
492
- const s = i.trim().toLowerCase();
494
+ ), _ = G(() => {
495
+ const s = c.trim().toLowerCase();
493
496
  return s ? e.filter((p) => p.toLowerCase().includes(s)) : e;
494
- }, [e, i]), T = () => {
495
- const s = c.current;
497
+ }, [e, c]), T = () => {
498
+ const s = i.current;
496
499
  if (!s) return;
497
- const p = s.getBoundingClientRect(), h = 4, L = window.innerHeight - p.bottom - h, w = p.top - h, F = L < 200 && w > L, K = Math.max(150, Math.min(360, F ? w : L));
498
- _({
500
+ const p = s.getBoundingClientRect(), h = 4, L = window.innerHeight - p.bottom - h, w = p.top - h, k = L < 200 && w > L, ee = Math.max(150, Math.min(360, k ? w : L));
501
+ b({
499
502
  left: p.left,
500
503
  width: p.width,
501
- maxHeight: K,
502
- ...F ? { bottom: window.innerHeight - p.top + h } : { top: p.bottom + h }
504
+ maxHeight: ee,
505
+ ...k ? { bottom: window.innerHeight - p.top + h } : { top: p.bottom + h }
503
506
  });
504
507
  };
505
- Z(() => {
508
+ ae(() => {
506
509
  if (!r) return;
507
510
  T();
508
511
  const s = () => T();
509
512
  return window.addEventListener("scroll", s, !0), window.addEventListener("resize", s), () => {
510
513
  window.removeEventListener("scroll", s, !0), window.removeEventListener("resize", s);
511
514
  };
512
- }, [r]), ee(() => {
515
+ }, [r]), ne(() => {
513
516
  if (!r) return;
514
517
  const s = (p) => {
515
518
  var L, w;
516
519
  const h = p.target;
517
- (L = c.current) != null && L.contains(h) || (w = u.current) != null && w.contains(h) || o(!1);
520
+ (L = i.current) != null && L.contains(h) || (w = f.current) != null && w.contains(h) || o(!1);
518
521
  };
519
522
  return document.addEventListener("mousedown", s), () => document.removeEventListener("mousedown", s);
520
523
  }, [r]);
521
- const j = () => {
522
- o(!1), d("");
523
- }, O = (s) => {
524
+ const V = () => {
525
+ o(!1), l("");
526
+ }, R = (s) => {
524
527
  var p;
525
- n(s), d(""), o(!1), (p = c.current) == null || p.blur();
526
- }, v = (s) => {
528
+ n(s), l(""), o(!1), (p = i.current) == null || p.blur();
529
+ }, $ = (s) => {
527
530
  const p = m.includes(s) ? m.filter((h) => h !== s) : [...m, s];
528
- n(p.join(U));
529
- }, z = () => {
530
- o(!0), a || d("");
531
- }, V = (s) => {
531
+ n(p.join(Y));
532
+ }, J = () => {
533
+ o(!0), a || l("");
534
+ }, X = (s) => {
532
535
  var p;
533
- s.key === "Escape" ? (j(), (p = c.current) == null || p.blur()) : s.key === "Enter" && b.length > 0 && (s.preventDefault(), a ? (v(b[0]), d("")) : O(b[0]));
534
- }, q = a || r ? i : t || "", J = a && m.length > 0 ? `${m.length} selecionado(s)` : r ? "Buscar..." : "Todos", X = r && g ? te(
535
- /* @__PURE__ */ l(
536
+ s.key === "Escape" ? (V(), (p = i.current) == null || p.blur()) : s.key === "Enter" && _.length > 0 && (s.preventDefault(), a ? ($(_[0]), l("")) : R(_[0]));
537
+ }, K = a || r ? c : t || "", Q = a && m.length > 0 ? `${m.length} selecionado(s)` : r ? "Buscar..." : "Todos", Z = r && g ? re(
538
+ /* @__PURE__ */ u(
536
539
  "div",
537
540
  {
538
- ref: u,
541
+ ref: f,
539
542
  className: "widget-filter__search-panel",
540
543
  style: {
541
544
  position: "fixed",
@@ -546,7 +549,7 @@ function _t({ options: e, value: t, multi: a, onChange: n }) {
546
549
  maxHeight: g.maxHeight
547
550
  },
548
551
  children: /* @__PURE__ */ E("div", { className: "widget-filter__search-list", children: [
549
- a && m.length > 0 && /* @__PURE__ */ l(
552
+ a && m.length > 0 && /* @__PURE__ */ u(
550
553
  "button",
551
554
  {
552
555
  type: "button",
@@ -560,25 +563,25 @@ function _t({ options: e, value: t, multi: a, onChange: n }) {
560
563
  {
561
564
  type: "button",
562
565
  className: `widget-filter__search-option${t ? "" : " is-selected"}`,
563
- onClick: () => O(""),
566
+ onClick: () => R(""),
564
567
  children: [
565
- /* @__PURE__ */ l("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t ? "" : "✓" }),
568
+ /* @__PURE__ */ u("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t ? "" : "✓" }),
566
569
  "Todos"
567
570
  ]
568
571
  }
569
572
  ),
570
- b.length === 0 ? /* @__PURE__ */ l("span", { className: "widget-filter__search-empty", children: "Nenhuma opção" }) : b.map(
573
+ _.length === 0 ? /* @__PURE__ */ u("span", { className: "widget-filter__search-empty", children: "Nenhuma opção" }) : _.map(
571
574
  (s) => a ? /* @__PURE__ */ E(
572
575
  "label",
573
576
  {
574
577
  className: `widget-filter__search-option${m.includes(s) ? " is-selected" : ""}`,
575
578
  children: [
576
- /* @__PURE__ */ l(
579
+ /* @__PURE__ */ u(
577
580
  "input",
578
581
  {
579
582
  type: "checkbox",
580
583
  checked: m.includes(s),
581
- onChange: () => v(s)
584
+ onChange: () => $(s)
582
585
  }
583
586
  ),
584
587
  s
@@ -590,9 +593,9 @@ function _t({ options: e, value: t, multi: a, onChange: n }) {
590
593
  {
591
594
  type: "button",
592
595
  className: `widget-filter__search-option${t === s ? " is-selected" : ""}`,
593
- onClick: () => O(s),
596
+ onClick: () => R(s),
594
597
  children: [
595
- /* @__PURE__ */ l("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t === s ? "✓" : "" }),
598
+ /* @__PURE__ */ u("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t === s ? "✓" : "" }),
596
599
  s
597
600
  ]
598
601
  },
@@ -605,192 +608,195 @@ function _t({ options: e, value: t, multi: a, onChange: n }) {
605
608
  document.body
606
609
  ) : null;
607
610
  return /* @__PURE__ */ E("div", { className: "widget-filter__search", children: [
608
- /* @__PURE__ */ l(
611
+ /* @__PURE__ */ u(
609
612
  "input",
610
613
  {
611
- ref: c,
614
+ ref: i,
612
615
  type: "text",
613
616
  className: "widget-filter__search-field",
614
- value: q,
615
- placeholder: J,
616
- onFocus: z,
617
+ value: K,
618
+ placeholder: Q,
619
+ onFocus: J,
617
620
  onClick: () => o(!0),
618
621
  onChange: (s) => {
619
- d(s.target.value), o(!0);
622
+ l(s.target.value), o(!0);
620
623
  },
621
- onKeyDown: V
624
+ onKeyDown: X
622
625
  }
623
626
  ),
624
- X
627
+ Z
625
628
  ] });
626
629
  }
627
- const he = [
628
- f.bgDark,
629
- f.bgPaper,
630
- f.bgElevated,
631
- f.accent,
632
- f.success
630
+ const Se = [
631
+ d.bgDark,
632
+ d.bgPaper,
633
+ d.bgElevated,
634
+ d.accent,
635
+ d.success
633
636
  ];
634
- function Ee(e) {
637
+ function Te(e) {
635
638
  if (!e) return !0;
636
639
  const t = N(e);
637
640
  return Object.values(M).some(
638
641
  (a) => JSON.stringify(a.colors) === JSON.stringify(t)
639
642
  );
640
643
  }
641
- const Se = [
644
+ const Le = [
642
645
  { label: "Series", slots: ["series0", "series1", "series2", "series3", "series4"] },
643
646
  { label: "Tema", slots: ["bgDark", "bgPaper", "bgElevated", "textPrimary", "textMuted"] },
644
647
  { label: "Estados", slots: ["accent", "success", "error"] }
645
648
  ];
646
- function bt({
649
+ function Lt({
647
650
  selected: e,
648
651
  onSelect: t,
649
652
  customMode: a,
650
653
  onCustomModeChange: n,
651
654
  disabled: r
652
655
  }) {
653
- var _;
654
- const o = a ?? !Ee(e), i = N(e), d = o || (_ = Object.entries(M).find(
655
- ([, c]) => JSON.stringify(c.colors) === JSON.stringify(i)
656
- )) == null ? void 0 : _[0], g = (c, u) => {
657
- const m = [...i];
656
+ var b;
657
+ const o = a ?? !Te(e), c = N(e), l = o || (b = Object.entries(M).find(
658
+ ([, i]) => JSON.stringify(i.colors) === JSON.stringify(c)
659
+ )) == null ? void 0 : b[0], g = (i, f) => {
660
+ const m = [...c];
658
661
  for (; m.length < A; ) m.push("#000000");
659
- m[c] = u, t(m);
662
+ m[i] = f, t(m);
660
663
  };
661
664
  return /* @__PURE__ */ E("div", { className: `palette-selector ${r ? "palette-selector--disabled" : ""}`, children: [
662
665
  n && /* @__PURE__ */ E("label", { className: "config-panel__checkbox", children: [
663
- /* @__PURE__ */ l(
666
+ /* @__PURE__ */ u(
664
667
  "input",
665
668
  {
666
669
  type: "checkbox",
667
670
  checked: o,
668
- onChange: (c) => n(c.target.checked),
671
+ onChange: (i) => n(i.target.checked),
669
672
  disabled: r
670
673
  }
671
674
  ),
672
675
  "Customizar"
673
676
  ] }),
674
- o ? /* @__PURE__ */ l("div", { className: "palette-selector__custom", children: Se.map((c) => /* @__PURE__ */ E("div", { className: "palette-selector__row", children: [
675
- /* @__PURE__ */ l("span", { className: "palette-selector__row-label", children: c.label }),
676
- /* @__PURE__ */ l("div", { className: "palette-selector__row-slots", children: c.slots.map((u) => {
677
- const m = f[u];
678
- return /* @__PURE__ */ l(
677
+ o ? /* @__PURE__ */ u("div", { className: "palette-selector__custom", children: Le.map((i) => /* @__PURE__ */ E("div", { className: "palette-selector__row", children: [
678
+ /* @__PURE__ */ u("span", { className: "palette-selector__row-label", children: i.label }),
679
+ /* @__PURE__ */ u("div", { className: "palette-selector__row-slots", children: i.slots.map((f) => {
680
+ const m = d[f];
681
+ return /* @__PURE__ */ u(
679
682
  "input",
680
683
  {
681
684
  type: "color",
682
685
  className: "palette-selector__color-input",
683
- value: i[m] || "#000000",
684
- onChange: (b) => g(m, b.target.value),
686
+ value: c[m] || "#000000",
687
+ onChange: (_) => g(m, _.target.value),
685
688
  disabled: r,
686
- title: oe[u]
689
+ title: ie[f]
687
690
  },
688
- u
691
+ f
689
692
  );
690
693
  }) })
691
- ] }, c.label)) }) : /* @__PURE__ */ l("div", { className: "palette-selector__options", children: Object.entries(M).map(([c, u]) => {
692
- const m = N(u.colors);
694
+ ] }, i.label)) }) : /* @__PURE__ */ u("div", { className: "palette-selector__options", children: Object.entries(M).map(([i, f]) => {
695
+ const m = N(f.colors);
693
696
  return /* @__PURE__ */ E(
694
697
  "button",
695
698
  {
696
- className: `palette-selector__option ${d === c ? "palette-selector__option--active" : ""}`,
697
- onClick: () => t(u.colors),
699
+ className: `palette-selector__option ${l === i ? "palette-selector__option--active" : ""}`,
700
+ onClick: () => t(f.colors),
698
701
  disabled: r,
699
702
  children: [
700
- /* @__PURE__ */ l("div", { className: "palette-selector__bar", children: ce(u.colors).map((b, T) => /* @__PURE__ */ l(
703
+ /* @__PURE__ */ u("div", { className: "palette-selector__bar", children: le(f.colors).map((_, T) => /* @__PURE__ */ u(
701
704
  "span",
702
705
  {
703
706
  className: "palette-selector__swatch",
704
- style: { backgroundColor: b }
707
+ style: { backgroundColor: _ }
705
708
  },
706
709
  T
707
710
  )) }),
708
- /* @__PURE__ */ l("div", { className: "palette-selector__bar palette-selector__bar--theme", children: he.map((b, T) => /* @__PURE__ */ l(
711
+ /* @__PURE__ */ u("div", { className: "palette-selector__bar palette-selector__bar--theme", children: Se.map((_, T) => /* @__PURE__ */ u(
709
712
  "span",
710
713
  {
711
714
  className: "palette-selector__swatch",
712
- style: { backgroundColor: m[b] }
715
+ style: { backgroundColor: m[_] }
713
716
  },
714
717
  T
715
718
  )) }),
716
- /* @__PURE__ */ l("span", { className: "palette-selector__label", children: u.label })
719
+ /* @__PURE__ */ u("span", { className: "palette-selector__label", children: f.label })
717
720
  ]
718
721
  },
719
- c
722
+ i
720
723
  );
721
724
  }) })
722
725
  ] });
723
726
  }
724
727
  export {
725
- $e as $,
726
- re as A,
727
- ze as B,
728
- bt as C,
729
- pt as D,
730
- Be as E,
731
- ke as F,
732
- C as G,
733
- je as H,
734
- Re as I,
735
- Pe as J,
736
- Je as K,
737
- qe as L,
738
- U as M,
739
- le as N,
740
- ue as O,
741
- ie as P,
742
- W as Q,
743
- Oe as R,
744
- _t as S,
745
- ve as T,
746
- Ye as U,
747
- Ve as V,
748
- fe as W,
749
- Ge as X,
750
- He as Y,
751
- de as Z,
752
- rt as _,
753
- Ae as a,
754
- M as a0,
755
- se as a1,
756
- f as a2,
757
- oe as a3,
758
- Ue as a4,
759
- A as a5,
760
- We as a6,
761
- xe as a7,
762
- be as a8,
763
- N as a9,
764
- B as aa,
765
- it as ab,
766
- lt as ac,
767
- D as ad,
728
+ Ve as $,
729
+ Pe as A,
730
+ oe as B,
731
+ Lt as C,
732
+ St as D,
733
+ Ue as E,
734
+ Ye as F,
735
+ F as G,
736
+ Ke as H,
737
+ Je as I,
738
+ He as J,
739
+ Xe as K,
740
+ $e as L,
741
+ Y as M,
742
+ ve as N,
743
+ et as O,
744
+ Ze as P,
745
+ fe as Q,
746
+ de as R,
747
+ Tt as S,
748
+ Ge as T,
749
+ ue as U,
750
+ j as V,
751
+ Ie as W,
752
+ ze as X,
753
+ Qe as Y,
754
+ ge as Z,
755
+ je as _,
756
+ Oe as a,
757
+ me as a0,
758
+ lt as a1,
759
+ We as a2,
760
+ M as a3,
761
+ ce as a4,
762
+ d as a5,
763
+ ie as a6,
764
+ Be as a7,
765
+ A as a8,
766
+ qe as a9,
767
+ Fe as aa,
768
+ Ee as ab,
769
+ N as ac,
770
+ q as ad,
768
771
  gt as ae,
769
- ye as af,
770
- Xe as b,
771
- Ke as c,
772
- et as d,
773
- at as e,
774
- Ne as f,
775
- _e as g,
776
- mt as h,
777
- tt as i,
778
- dt as j,
779
- nt as k,
780
- ut as l,
781
- ft as m,
782
- ct as n,
783
- st as o,
784
- ot as p,
785
- ce as q,
786
- Me as r,
787
- Ce as s,
788
- Qe as t,
789
- Ze as u,
790
- R as v,
791
- I as w,
772
+ mt as af,
773
+ y as ag,
774
+ ht as ah,
775
+ Ae as ai,
776
+ tt as b,
777
+ at as c,
778
+ st as d,
779
+ ct as e,
780
+ Me as f,
781
+ he as g,
782
+ Et as h,
783
+ ot as i,
784
+ _t as j,
785
+ it as k,
786
+ pt as l,
787
+ bt as m,
788
+ dt as n,
789
+ ut as o,
790
+ ft as p,
791
+ le as q,
792
+ Ce as r,
793
+ ke as s,
794
+ nt as t,
795
+ rt as u,
796
+ I as v,
797
+ v as w,
792
798
  P as x,
793
- Ie as y,
794
- Fe as z
799
+ Re as y,
800
+ xe as z
795
801
  };
796
- //# sourceMappingURL=ColorPaletteSelector-DJge9VhO.js.map
802
+ //# sourceMappingURL=ColorPaletteSelector-CZP3HDNJ.js.map