@actionexec/dashboards 0.10.0 → 0.11.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,6 +1,6 @@
1
1
  import { jsx as l, jsxs as E } from "react/jsx-runtime";
2
2
  import Q from "react-datepicker";
3
- import { useState as O, useRef as $, useMemo as k, useLayoutEffect as Z, useEffect as ee } from "react";
3
+ import { useState as x, useRef as $, useMemo as k, useLayoutEffect as Z, useEffect as ee } from "react";
4
4
  import { createPortal as te } from "react-dom";
5
5
  const ae = "https://action-data-api-7mbrztperq-rj.a.run.app", ne = "/external/dashboards";
6
6
  let G = ae;
@@ -199,11 +199,11 @@ function Me(e) {
199
199
  "--action-green": t[f.success]
200
200
  };
201
201
  }
202
- const ie = W, le = 30, ue = 10, xe = {
202
+ const ie = W, le = 30, ue = 10, Oe = {
203
203
  gridColumns: le,
204
204
  gridRows: ue,
205
205
  widgets: []
206
- }, Oe = {
206
+ }, xe = {
207
207
  kpi_card: "Card",
208
208
  gauge: "Gauge",
209
209
  chart: "Gráfico",
@@ -238,10 +238,13 @@ const ie = W, le = 30, ue = 10, xe = {
238
238
  ratio: "Proporção",
239
239
  value: "Base"
240
240
  }, Ue = {
241
+ scroll: "Rolar",
242
+ clip: "Cortar"
243
+ }, Ge = {
241
244
  higher: "Positivo",
242
245
  lower: "Negativo",
243
246
  neutral: "Neutro"
244
- }, Ge = {
247
+ }, Ye = {
245
248
  eq: "Igual a",
246
249
  neq: "Diferente de",
247
250
  in: "Está entre os valores",
@@ -255,17 +258,17 @@ const ie = W, le = 30, ue = 10, xe = {
255
258
  not_contains: "Não contém",
256
259
  is_empty: "Está vazio",
257
260
  not_empty: "Não está vazio"
258
- }, Ye = ["is_empty", "not_empty"], We = ["in", "not_in"], He = {
261
+ }, We = ["is_empty", "not_empty"], He = ["in", "not_in"], Be = {
259
262
  bar: "Barras",
260
263
  line: "Linhas",
261
264
  area: "Área"
262
- }, Be = {
265
+ }, je = {
263
266
  pie: "Pizza",
264
267
  bridge: "Ponte"
265
- }, je = {
268
+ }, ze = {
266
269
  descending: "Descendente",
267
270
  ascending: "Ascendente"
268
- }, ze = {
271
+ }, Ve = {
269
272
  date_range: "Periodo",
270
273
  select: "Seleção Única",
271
274
  multi_select: "Seleção Múltipla"
@@ -293,25 +296,25 @@ const ie = W, le = 30, ue = 10, xe = {
293
296
  variable: { label: "Nova Variavel", variableValue: 0, variableFormat: "number", locked: !1 },
294
297
  color_palette: { label: "Paleta de Cores", paletteColors: ie, locked: !1 }
295
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;
296
- function Ve(e, t, a = R, n = C) {
299
+ function Xe(e, t, a = R, n = C) {
297
300
  if (!S(t) || !Number.isFinite(e)) return 0;
298
301
  const r = e - n * 2 - a * (t - 1);
299
302
  return Math.max(0, r / t);
300
303
  }
301
- function Xe(e, t = I) {
304
+ function Ke(e, t = I) {
302
305
  return !S(e) || !S(t) ? P : ge(e / t, P, de);
303
306
  }
304
- function Ke(e, t, a = R, n = C) {
307
+ function Qe(e, t, a = R, n = C) {
305
308
  return e <= 0 ? n * 2 : e * t + (e - 1) * a + n * 2;
306
309
  }
307
- function Qe(e, t, a = I) {
310
+ function Ze(e, t, a = I) {
308
311
  return !S(e) || !S(t) || !S(a) ? 1 : e * a / t;
309
312
  }
310
- function Ze(e, t = I, a = R, n = C) {
313
+ function et(e, t = I, a = R, n = C) {
311
314
  return !S(e) || !S(t) ? 0 : P * t * e + a * (e - 1) + n * 2;
312
315
  }
313
316
  const y = "pt-BR", me = 100, pe = /* @__PURE__ */ new Set(["currency", "number", "integer", "percentage"]);
314
- function et(e) {
317
+ function tt(e) {
315
318
  return !!e && pe.has(e);
316
319
  }
317
320
  function H(e) {
@@ -319,7 +322,7 @@ function H(e) {
319
322
  const t = typeof e == "number" ? e : Number(e);
320
323
  return Number.isFinite(t) ? t : null;
321
324
  }
322
- function be(e, t, a = "-") {
325
+ function _e(e, t, a = "-") {
323
326
  if (e == null || e === "") return a;
324
327
  const n = H(e);
325
328
  if (n === null) return String(e);
@@ -336,14 +339,14 @@ function be(e, t, a = "-") {
336
339
  return String(e);
337
340
  }
338
341
  }
339
- function tt(e, t) {
342
+ function at(e, t) {
340
343
  const a = H(e);
341
344
  if (a === null) return "-";
342
- if (t === "percentage") return be(a, "percentage");
345
+ if (t === "percentage") return _e(a, "percentage");
343
346
  const n = t === "currency" ? "R$ " : "", r = Math.abs(a);
344
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 })}`;
345
348
  }
346
- const at = [
349
+ const nt = [
347
350
  "Jan",
348
351
  "Fev",
349
352
  "Mar",
@@ -356,7 +359,7 @@ const at = [
356
359
  "Out",
357
360
  "Nov",
358
361
  "Dez"
359
- ], nt = [
362
+ ], rt = [
360
363
  "Janeiro",
361
364
  "Fevereiro",
362
365
  "Marco",
@@ -370,15 +373,15 @@ const at = [
370
373
  "Novembro",
371
374
  "Dezembro"
372
375
  ];
373
- function rt(e) {
376
+ function st(e) {
374
377
  return { start: `${e}-01-01`, end: `${e}-12-31` };
375
378
  }
376
- function st(e) {
379
+ function ot(e) {
377
380
  if (!e) return null;
378
381
  const t = e.match(/^(\d{4})/);
379
382
  return t ? { year: parseInt(t[1]) } : null;
380
383
  }
381
- function ot(e, t) {
384
+ function ct(e, t) {
382
385
  const a = new Date(e, t, 0).getDate(), n = (r) => String(r).padStart(2, "0");
383
386
  return {
384
387
  start: `${e}-${n(t)}-01`,
@@ -391,43 +394,43 @@ function B(e) {
391
394
  const a = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
392
395
  return Math.ceil(((t.getTime() - a.getTime()) / 864e5 + 1) / 7);
393
396
  }
394
- function ct(e, t) {
395
- 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 = (b) => String(b).padStart(2, "0"), g = (b) => `${b.getFullYear()}-${d(b.getMonth() + 1)}-${d(b.getDate())}`;
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())}`;
396
399
  return { start: g(o), end: g(i) };
397
400
  }
398
- function it(e, t) {
401
+ function lt(e, t) {
399
402
  const a = /* @__PURE__ */ new Set(), n = new Date(e, t, 0).getDate();
400
403
  for (let r = 1; r <= n; r++)
401
404
  a.add(B(new Date(e, t - 1, r)));
402
405
  return Array.from(a).sort((r, o) => r - o);
403
406
  }
404
- function lt(e, t) {
407
+ function ut(e, t) {
405
408
  const a = new Date(e, t, 0).getDate(), n = (d) => String(d).padStart(2, "0"), r = [];
406
409
  let o = 1, i = 1;
407
410
  for (; o <= a; ) {
408
- const d = o, g = Math.min(o + 6, a), b = `${e}-${n(t)}-${n(d)}`, c = `${e}-${n(t)}-${n(g)}`, u = `${i}° Semana (${n(d)}/${n(t)} - ${n(g)}/${n(t)})`;
409
- r.push({ index: i, startDay: d, endDay: g, start: b, end: c, label: u }), o = g + 1, i++;
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++;
410
413
  }
411
414
  return r;
412
415
  }
413
- function ut(e, t, a) {
416
+ function ft(e, t, a) {
414
417
  if (!e) return 1;
415
418
  const n = (i) => String(i).padStart(2, "0"), r = e.match(new RegExp(`^${t}-${n(a)}-(\\d{2})`));
416
419
  if (!r) return 1;
417
420
  const o = parseInt(r[1]);
418
421
  return Math.ceil(o / 7);
419
422
  }
420
- function ft(e) {
423
+ function dt(e) {
421
424
  if (!e) return null;
422
425
  const t = e.match(/^(\d{4})-(\d{2})/);
423
426
  return t ? { year: parseInt(t[1]), month: parseInt(t[2]) } : null;
424
427
  }
425
- function dt(e) {
428
+ function gt(e) {
426
429
  if (!e) return null;
427
430
  const t = /* @__PURE__ */ new Date(e + "T00:00:00");
428
431
  return isNaN(t.getTime()) ? null : { year: t.getFullYear(), week: B(t) };
429
432
  }
430
- function gt(e) {
433
+ function mt(e) {
431
434
  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 = [];
432
435
  for (let o = n; o >= a; o--) r.push(o);
433
436
  return r;
@@ -437,12 +440,12 @@ function D(e) {
437
440
  const [t, a, n] = e.split("-").map(Number);
438
441
  return !t || !a || !n ? null : new Date(t, a - 1, n);
439
442
  }
440
- function _e(e) {
443
+ function be(e) {
441
444
  if (!e) return "";
442
445
  const t = e.getFullYear(), a = String(e.getMonth() + 1).padStart(2, "0"), n = String(e.getDate()).padStart(2, "0");
443
446
  return `${t}-${a}-${n}`;
444
447
  }
445
- function mt({
448
+ function pt({
446
449
  value: e,
447
450
  onChange: t,
448
451
  minIso: a,
@@ -452,14 +455,14 @@ function mt({
452
455
  selectsEnd: i,
453
456
  startIso: d,
454
457
  endIso: g,
455
- className: b,
458
+ className: _,
456
459
  disabled: c
457
460
  }) {
458
- return /* @__PURE__ */ l("div", { className: `ddp-field ${b ?? ""}`, children: /* @__PURE__ */ l(
461
+ return /* @__PURE__ */ l("div", { className: `ddp-field ${_ ?? ""}`, children: /* @__PURE__ */ l(
459
462
  Q,
460
463
  {
461
464
  selected: D(e),
462
- onChange: (u) => t(_e(u)),
465
+ onChange: (u) => t(be(u)),
463
466
  selectsStart: o,
464
467
  selectsEnd: i,
465
468
  startDate: D(d) ?? void 0,
@@ -481,18 +484,18 @@ function mt({
481
484
  }
482
485
  ) });
483
486
  }
484
- function pt({ options: e, value: t, multi: a, onChange: n }) {
485
- const [r, o] = O(!1), [i, d] = O(""), [g, b] = O(null), c = $(null), u = $(null), m = k(
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(
486
489
  () => t ? t.split(U).filter(Boolean) : [],
487
490
  [t]
488
- ), _ = k(() => {
491
+ ), b = k(() => {
489
492
  const s = i.trim().toLowerCase();
490
493
  return s ? e.filter((p) => p.toLowerCase().includes(s)) : e;
491
494
  }, [e, i]), T = () => {
492
495
  const s = c.current;
493
496
  if (!s) return;
494
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));
495
- b({
498
+ _({
496
499
  left: p.left,
497
500
  width: p.width,
498
501
  maxHeight: K,
@@ -517,7 +520,7 @@ function pt({ options: e, value: t, multi: a, onChange: n }) {
517
520
  }, [r]);
518
521
  const j = () => {
519
522
  o(!1), d("");
520
- }, x = (s) => {
523
+ }, O = (s) => {
521
524
  var p;
522
525
  n(s), d(""), o(!1), (p = c.current) == null || p.blur();
523
526
  }, v = (s) => {
@@ -525,10 +528,10 @@ function pt({ options: e, value: t, multi: a, onChange: n }) {
525
528
  n(p.join(U));
526
529
  }, z = () => {
527
530
  o(!0), a || d("");
528
- }, q = (s) => {
531
+ }, V = (s) => {
529
532
  var p;
530
- s.key === "Escape" ? (j(), (p = c.current) == null || p.blur()) : s.key === "Enter" && _.length > 0 && (s.preventDefault(), a ? (v(_[0]), d("")) : x(_[0]));
531
- }, J = a || r ? i : t || "", V = a && m.length > 0 ? `${m.length} selecionado(s)` : r ? "Buscar..." : "Todos", X = r && g ? te(
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(
532
535
  /* @__PURE__ */ l(
533
536
  "div",
534
537
  {
@@ -557,14 +560,14 @@ function pt({ options: e, value: t, multi: a, onChange: n }) {
557
560
  {
558
561
  type: "button",
559
562
  className: `widget-filter__search-option${t ? "" : " is-selected"}`,
560
- onClick: () => x(""),
563
+ onClick: () => O(""),
561
564
  children: [
562
565
  /* @__PURE__ */ l("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t ? "" : "✓" }),
563
566
  "Todos"
564
567
  ]
565
568
  }
566
569
  ),
567
- _.length === 0 ? /* @__PURE__ */ l("span", { className: "widget-filter__search-empty", children: "Nenhuma opção" }) : _.map(
570
+ b.length === 0 ? /* @__PURE__ */ l("span", { className: "widget-filter__search-empty", children: "Nenhuma opção" }) : b.map(
568
571
  (s) => a ? /* @__PURE__ */ E(
569
572
  "label",
570
573
  {
@@ -587,7 +590,7 @@ function pt({ options: e, value: t, multi: a, onChange: n }) {
587
590
  {
588
591
  type: "button",
589
592
  className: `widget-filter__search-option${t === s ? " is-selected" : ""}`,
590
- onClick: () => x(s),
593
+ onClick: () => O(s),
591
594
  children: [
592
595
  /* @__PURE__ */ l("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t === s ? "✓" : "" }),
593
596
  s
@@ -608,14 +611,14 @@ function pt({ options: e, value: t, multi: a, onChange: n }) {
608
611
  ref: c,
609
612
  type: "text",
610
613
  className: "widget-filter__search-field",
611
- value: J,
612
- placeholder: V,
614
+ value: q,
615
+ placeholder: J,
613
616
  onFocus: z,
614
617
  onClick: () => o(!0),
615
618
  onChange: (s) => {
616
619
  d(s.target.value), o(!0);
617
620
  },
618
- onKeyDown: q
621
+ onKeyDown: V
619
622
  }
620
623
  ),
621
624
  X
@@ -647,10 +650,10 @@ function bt({
647
650
  onCustomModeChange: n,
648
651
  disabled: r
649
652
  }) {
650
- var b;
651
- const o = a ?? !Ee(e), i = N(e), d = o || (b = Object.entries(M).find(
653
+ var _;
654
+ const o = a ?? !Ee(e), i = N(e), d = o || (_ = Object.entries(M).find(
652
655
  ([, c]) => JSON.stringify(c.colors) === JSON.stringify(i)
653
- )) == null ? void 0 : b[0], g = (c, u) => {
656
+ )) == null ? void 0 : _[0], g = (c, u) => {
654
657
  const m = [...i];
655
658
  for (; m.length < A; ) m.push("#000000");
656
659
  m[c] = u, t(m);
@@ -678,7 +681,7 @@ function bt({
678
681
  type: "color",
679
682
  className: "palette-selector__color-input",
680
683
  value: i[m] || "#000000",
681
- onChange: (_) => g(m, _.target.value),
684
+ onChange: (b) => g(m, b.target.value),
682
685
  disabled: r,
683
686
  title: oe[u]
684
687
  },
@@ -694,19 +697,19 @@ function bt({
694
697
  onClick: () => t(u.colors),
695
698
  disabled: r,
696
699
  children: [
697
- /* @__PURE__ */ l("div", { className: "palette-selector__bar", children: ce(u.colors).map((_, T) => /* @__PURE__ */ l(
700
+ /* @__PURE__ */ l("div", { className: "palette-selector__bar", children: ce(u.colors).map((b, T) => /* @__PURE__ */ l(
698
701
  "span",
699
702
  {
700
703
  className: "palette-selector__swatch",
701
- style: { backgroundColor: _ }
704
+ style: { backgroundColor: b }
702
705
  },
703
706
  T
704
707
  )) }),
705
- /* @__PURE__ */ l("div", { className: "palette-selector__bar palette-selector__bar--theme", children: he.map((_, T) => /* @__PURE__ */ l(
708
+ /* @__PURE__ */ l("div", { className: "palette-selector__bar palette-selector__bar--theme", children: he.map((b, T) => /* @__PURE__ */ l(
706
709
  "span",
707
710
  {
708
711
  className: "palette-selector__swatch",
709
- style: { backgroundColor: m[_] }
712
+ style: { backgroundColor: m[b] }
710
713
  },
711
714
  T
712
715
  )) }),
@@ -721,13 +724,13 @@ function bt({
721
724
  export {
722
725
  $e as $,
723
726
  re as A,
724
- je as B,
727
+ ze as B,
725
728
  bt as C,
726
- mt as D,
727
- He as E,
729
+ pt as D,
730
+ Be as E,
728
731
  ke as F,
729
732
  C as G,
730
- Be as H,
733
+ je as H,
731
734
  Re as I,
732
735
  Pe as J,
733
736
  Je as K,
@@ -737,56 +740,57 @@ export {
737
740
  ue as O,
738
741
  ie as P,
739
742
  W as Q,
740
- xe as R,
741
- pt as S,
743
+ Oe as R,
744
+ _t as S,
742
745
  ve as T,
743
- Ge as U,
744
- ze as V,
746
+ Ye as U,
747
+ Ve as V,
745
748
  fe as W,
746
- Ue as X,
747
- We as Y,
749
+ Ge as X,
750
+ He as Y,
748
751
  de as Z,
749
- nt as _,
752
+ rt as _,
750
753
  Ae as a,
751
754
  M as a0,
752
755
  se as a1,
753
756
  f as a2,
754
757
  oe as a3,
755
- A as a4,
756
- Ye as a5,
757
- Oe as a6,
758
- _e as a7,
759
- N as a8,
760
- B as a9,
761
- ct as aa,
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,
762
765
  it as ab,
763
- D as ac,
764
- dt as ad,
765
- ye as ae,
766
- Ve as b,
767
- Xe as c,
768
- Ze as d,
769
- tt as e,
766
+ lt as ac,
767
+ D as ad,
768
+ gt as ae,
769
+ ye as af,
770
+ Xe as b,
771
+ Ke as c,
772
+ et as d,
773
+ at as e,
770
774
  Ne as f,
771
- be as g,
772
- gt as h,
773
- et as i,
774
- ft as j,
775
- at as k,
776
- lt as l,
777
- ut as m,
778
- ot as n,
779
- rt as o,
780
- st as p,
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,
781
785
  ce as q,
782
786
  Me as r,
783
787
  Ce as s,
784
- Ke as t,
785
- Qe as u,
788
+ Qe as t,
789
+ Ze as u,
786
790
  R as v,
787
791
  I as w,
788
792
  P as x,
789
793
  Ie as y,
790
794
  Fe as z
791
795
  };
792
- //# sourceMappingURL=ColorPaletteSelector-CsByaRmM.js.map
796
+ //# sourceMappingURL=ColorPaletteSelector-DJge9VhO.js.map