@actionexec/dashboards 0.4.0 → 0.5.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/README.md CHANGED
@@ -34,8 +34,8 @@ Unico componente exposto. Renderiza um dashboard completo com interatividade.
34
34
  | Prop | Tipo | Default | Descricao |
35
35
  |---|---|---|---|
36
36
  | `token` | `string` | — | Token Bearer do dashboard (obrigatorio) |
37
- | `rowHeight` | `number` | `40` | Altura de cada linha do grid em pixels |
38
- | `gridGap` | `number` | `6` | Gap entre widgets em pixels |
37
+ | `rowHeight` | `number` | `2.5` | Altura de cada linha do grid em rem |
38
+ | `gridGap` | `number` | `0.375` | Gap entre widgets em rem |
39
39
  | `className` | `string` | — | Classe CSS adicional no container raiz |
40
40
 
41
41
  ### `ApiError`
@@ -1,9 +1,9 @@
1
1
  interface DashboardProps {
2
2
  /** Token Bearer de acesso ao dashboard. */
3
3
  token: string;
4
- /** Altura de cada linha do grid em pixels. Default 40. */
4
+ /** Altura de cada linha do grid em rem. Default 2.5 (40px no base 16). */
5
5
  rowHeight?: number;
6
- /** Gap entre widgets em pixels. Default 6. */
6
+ /** Gap entre widgets em rem. Default 0.375 (6px no base 16). */
7
7
  gridGap?: number;
8
8
  /** Classe CSS adicional no container raiz. */
9
9
  className?: string;
@@ -1,4 +1,7 @@
1
1
  import type { LayoutResponse, RenderResponse } from '../types';
2
+ /** Sobrescreve a URL base da API. Destinado ao builder da plataforma em dev —
3
+ * consumidores externos nao devem chamar (usam a URL de producao por default). */
4
+ export declare function setApiUrl(url: string): void;
2
5
  export declare class ApiError extends Error {
3
6
  status?: number | undefined;
4
7
  payload?: unknown | undefined;
@@ -1,6 +1,37 @@
1
- import { jsx as u, jsxs as S } from "react/jsx-runtime";
2
- import y from "react-datepicker";
3
- const o = {
1
+ import { jsx as u, jsxs as h } from "react/jsx-runtime";
2
+ import N from "react-datepicker";
3
+ const A = "https://action-data-api.fly.dev/api", O = "/external/dashboards";
4
+ let E = A;
5
+ function j(e) {
6
+ E = e.replace(/\/$/, "");
7
+ }
8
+ class x extends Error {
9
+ constructor(t, r, a) {
10
+ super(t), this.status = r, this.payload = a, this.name = "ApiError";
11
+ }
12
+ }
13
+ async function y(e, t, r) {
14
+ const a = new URL(`${E}${O}${e}`);
15
+ if (r)
16
+ for (const [n, i] of Object.entries(r)) a.searchParams.set(n, i);
17
+ const s = await fetch(a.toString(), {
18
+ headers: { Authorization: `Bearer ${t}` }
19
+ });
20
+ if (!s.ok) {
21
+ let n;
22
+ try {
23
+ n = await s.json();
24
+ } catch {
25
+ }
26
+ throw new x(
27
+ `Requisicao falhou (${s.status}) em ${e}`,
28
+ s.status,
29
+ n
30
+ );
31
+ }
32
+ return await s.json();
33
+ }
34
+ const J = (e) => y("/layout", e), z = (e, t) => y("/render", e, t), o = {
4
35
  series0: 0,
5
36
  series1: 1,
6
37
  series2: 2,
@@ -14,7 +45,7 @@ const o = {
14
45
  accent: 10,
15
46
  success: 11,
16
47
  error: 12
17
- }, M = 5, T = 13, N = {
48
+ }, L = 5, T = 13, P = {
18
49
  series0: "Série 1",
19
50
  series1: "Série 2",
20
51
  series2: "Série 3",
@@ -28,7 +59,7 @@ const o = {
28
59
  accent: "Destaque",
29
60
  success: "Sucesso",
30
61
  error: "Erro"
31
- }, h = {
62
+ }, S = {
32
63
  action: {
33
64
  label: "Action",
34
65
  colors: [
@@ -119,19 +150,19 @@ const o = {
119
150
  "#e11d48"
120
151
  ]
121
152
  }
122
- }, E = h.action.colors;
153
+ }, v = S.action.colors;
123
154
  function _(e) {
124
- const t = E;
155
+ const t = v;
125
156
  if (!e || e.length === 0) return [...t];
126
157
  if (e.length >= T) return e.slice(0, T);
127
158
  const r = [...e];
128
159
  for (let a = e.length; a < T; a++) r.push(t[a]);
129
160
  return r;
130
161
  }
131
- function x(e) {
132
- return _(e).slice(0, M);
162
+ function w(e) {
163
+ return _(e).slice(0, L);
133
164
  }
134
- function R(e) {
165
+ function H(e) {
135
166
  const t = _(e);
136
167
  return {
137
168
  "--bg-dark": t[o.bgDark],
@@ -148,7 +179,7 @@ function R(e) {
148
179
  "--color-warning": t[o.series3]
149
180
  };
150
181
  }
151
- const Y = [
182
+ const V = [
152
183
  "Jan",
153
184
  "Fev",
154
185
  "Mar",
@@ -161,7 +192,7 @@ const Y = [
161
192
  "Out",
162
193
  "Nov",
163
194
  "Dez"
164
- ], U = [
195
+ ], K = [
165
196
  "Janeiro",
166
197
  "Fevereiro",
167
198
  "Marco",
@@ -175,38 +206,38 @@ const Y = [
175
206
  "Novembro",
176
207
  "Dezembro"
177
208
  ];
178
- function G(e) {
209
+ function q(e) {
179
210
  return { start: `${e}-01-01`, end: `${e}-12-31` };
180
211
  }
181
- function W(e) {
212
+ function X(e) {
182
213
  if (!e) return null;
183
214
  const t = e.match(/^(\d{4})/);
184
215
  return t ? { year: parseInt(t[1]) } : null;
185
216
  }
186
- function J(e, t) {
217
+ function Q(e, t) {
187
218
  const r = new Date(e, t, 0).getDate(), a = (s) => String(s).padStart(2, "0");
188
219
  return {
189
220
  start: `${e}-${a(t)}-01`,
190
221
  end: `${e}-${a(t)}-${a(r)}`
191
222
  };
192
223
  }
193
- function v(e) {
224
+ function M(e) {
194
225
  const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate()));
195
226
  t.setUTCDate(t.getUTCDate() + 4 - (t.getUTCDay() || 7));
196
227
  const r = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
197
228
  return Math.ceil(((t.getTime() - r.getTime()) / 864e5 + 1) / 7);
198
229
  }
199
- function j(e, t) {
230
+ function Z(e, t) {
200
231
  const r = new Date(e, 0, 4), a = (r.getDay() + 6) % 7, s = new Date(r.getTime() - a * 864e5), n = new Date(s.getTime() + (t - 1) * 7 * 864e5), i = new Date(n.getTime() + 6 * 864e5), f = (g) => String(g).padStart(2, "0"), d = (g) => `${g.getFullYear()}-${f(g.getMonth() + 1)}-${f(g.getDate())}`;
201
232
  return { start: d(n), end: d(i) };
202
233
  }
203
- function z(e, t) {
234
+ function B(e, t) {
204
235
  const r = /* @__PURE__ */ new Set(), a = new Date(e, t, 0).getDate();
205
236
  for (let s = 1; s <= a; s++)
206
- r.add(v(new Date(e, t - 1, s)));
237
+ r.add(M(new Date(e, t - 1, s)));
207
238
  return Array.from(r).sort((s, n) => s - n);
208
239
  }
209
- function H(e, t) {
240
+ function ee(e, t) {
210
241
  const r = new Date(e, t, 0).getDate(), a = (f) => String(f).padStart(2, "0"), s = [];
211
242
  let n = 1, i = 1;
212
243
  for (; n <= r; ) {
@@ -215,24 +246,24 @@ function H(e, t) {
215
246
  }
216
247
  return s;
217
248
  }
218
- function V(e, t, r) {
249
+ function te(e, t, r) {
219
250
  if (!e) return 1;
220
251
  const a = (i) => String(i).padStart(2, "0"), s = e.match(new RegExp(`^${t}-${a(r)}-(\\d{2})`));
221
252
  if (!s) return 1;
222
253
  const n = parseInt(s[1]);
223
254
  return Math.ceil(n / 7);
224
255
  }
225
- function K(e) {
256
+ function ae(e) {
226
257
  if (!e) return null;
227
258
  const t = e.match(/^(\d{4})-(\d{2})/);
228
259
  return t ? { year: parseInt(t[1]), month: parseInt(t[2]) } : null;
229
260
  }
230
- function q(e) {
261
+ function re(e) {
231
262
  if (!e) return null;
232
263
  const t = /* @__PURE__ */ new Date(e + "T00:00:00");
233
- return isNaN(t.getTime()) ? null : { year: t.getFullYear(), week: v(t) };
264
+ return isNaN(t.getTime()) ? null : { year: t.getFullYear(), week: M(t) };
234
265
  }
235
- function X(e) {
266
+ function se(e) {
236
267
  const t = /* @__PURE__ */ new Date(), r = e != null && e.min ? parseInt(e.min.slice(0, 4)) : t.getFullYear() - 2, a = e != null && e.max ? parseInt(e.max.slice(0, 4)) : t.getFullYear(), s = [];
237
268
  for (let n = a; n >= r; n--) s.push(n);
238
269
  return s;
@@ -242,12 +273,12 @@ function m(e) {
242
273
  const [t, r, a] = e.split("-").map(Number);
243
274
  return !t || !r || !a ? null : new Date(t, r - 1, a);
244
275
  }
245
- function O(e) {
276
+ function C(e) {
246
277
  if (!e) return "";
247
278
  const t = e.getFullYear(), r = String(e.getMonth() + 1).padStart(2, "0"), a = String(e.getDate()).padStart(2, "0");
248
279
  return `${t}-${r}-${a}`;
249
280
  }
250
- function Q({
281
+ function ne({
251
282
  value: e,
252
283
  onChange: t,
253
284
  minIso: r,
@@ -261,10 +292,10 @@ function Q({
261
292
  disabled: c
262
293
  }) {
263
294
  return /* @__PURE__ */ u("div", { className: `ddp-field ${g ?? ""}`, children: /* @__PURE__ */ u(
264
- y,
295
+ N,
265
296
  {
266
297
  selected: m(e),
267
- onChange: (l) => t(O(l)),
298
+ onChange: (l) => t(C(l)),
268
299
  selectsStart: n,
269
300
  selectsEnd: i,
270
301
  startDate: m(f) ?? void 0,
@@ -286,26 +317,26 @@ function Q({
286
317
  }
287
318
  ) });
288
319
  }
289
- const A = [
320
+ const $ = [
290
321
  o.bgDark,
291
322
  o.bgPaper,
292
323
  o.bgElevated,
293
324
  o.accent,
294
325
  o.success
295
326
  ];
296
- function P(e) {
327
+ function I(e) {
297
328
  if (!e) return !0;
298
329
  const t = _(e);
299
- return Object.values(h).some(
330
+ return Object.values(S).some(
300
331
  (r) => JSON.stringify(r.colors) === JSON.stringify(t)
301
332
  );
302
333
  }
303
- const L = [
334
+ const k = [
304
335
  { label: "Series", slots: ["series0", "series1", "series2", "series3", "series4"] },
305
336
  { label: "Tema", slots: ["bgDark", "bgPaper", "bgElevated", "textPrimary", "textMuted"] },
306
337
  { label: "Estados", slots: ["accent", "success", "error"] }
307
338
  ];
308
- function Z({
339
+ function oe({
309
340
  selected: e,
310
341
  onSelect: t,
311
342
  customMode: r,
@@ -313,15 +344,15 @@ function Z({
313
344
  disabled: s
314
345
  }) {
315
346
  var g;
316
- const n = r ?? !P(e), i = _(e), f = n || (g = Object.entries(h).find(
347
+ const n = r ?? !I(e), i = _(e), f = n || (g = Object.entries(S).find(
317
348
  ([, c]) => JSON.stringify(c.colors) === JSON.stringify(i)
318
349
  )) == null ? void 0 : g[0], d = (c, l) => {
319
350
  const p = [...i];
320
351
  for (; p.length < T; ) p.push("#000000");
321
352
  p[c] = l, t(p);
322
353
  };
323
- return /* @__PURE__ */ S("div", { className: `palette-selector ${s ? "palette-selector--disabled" : ""}`, children: [
324
- a && /* @__PURE__ */ S("label", { className: "config-panel__checkbox", children: [
354
+ return /* @__PURE__ */ h("div", { className: `palette-selector ${s ? "palette-selector--disabled" : ""}`, children: [
355
+ a && /* @__PURE__ */ h("label", { className: "config-panel__checkbox", children: [
325
356
  /* @__PURE__ */ u(
326
357
  "input",
327
358
  {
@@ -333,7 +364,7 @@ function Z({
333
364
  ),
334
365
  "Customizar"
335
366
  ] }),
336
- n ? /* @__PURE__ */ u("div", { className: "palette-selector__custom", children: L.map((c) => /* @__PURE__ */ S("div", { className: "palette-selector__row", children: [
367
+ n ? /* @__PURE__ */ u("div", { className: "palette-selector__custom", children: k.map((c) => /* @__PURE__ */ h("div", { className: "palette-selector__row", children: [
337
368
  /* @__PURE__ */ u("span", { className: "palette-selector__row-label", children: c.label }),
338
369
  /* @__PURE__ */ u("div", { className: "palette-selector__row-slots", children: c.slots.map((l) => {
339
370
  const p = o[l];
@@ -345,21 +376,21 @@ function Z({
345
376
  value: i[p] || "#000000",
346
377
  onChange: (b) => d(p, b.target.value),
347
378
  disabled: s,
348
- title: N[l]
379
+ title: P[l]
349
380
  },
350
381
  l
351
382
  );
352
383
  }) })
353
- ] }, c.label)) }) : /* @__PURE__ */ u("div", { className: "palette-selector__options", children: Object.entries(h).map(([c, l]) => {
384
+ ] }, c.label)) }) : /* @__PURE__ */ u("div", { className: "palette-selector__options", children: Object.entries(S).map(([c, l]) => {
354
385
  const p = _(l.colors);
355
- return /* @__PURE__ */ S(
386
+ return /* @__PURE__ */ h(
356
387
  "button",
357
388
  {
358
389
  className: `palette-selector__option ${f === c ? "palette-selector__option--active" : ""}`,
359
390
  onClick: () => t(l.colors),
360
391
  disabled: s,
361
392
  children: [
362
- /* @__PURE__ */ u("div", { className: "palette-selector__bar", children: x(l.colors).map((b, D) => /* @__PURE__ */ u(
393
+ /* @__PURE__ */ u("div", { className: "palette-selector__bar", children: w(l.colors).map((b, D) => /* @__PURE__ */ u(
363
394
  "span",
364
395
  {
365
396
  className: "palette-selector__swatch",
@@ -367,7 +398,7 @@ function Z({
367
398
  },
368
399
  D
369
400
  )) }),
370
- /* @__PURE__ */ u("div", { className: "palette-selector__bar palette-selector__bar--theme", children: A.map((b, D) => /* @__PURE__ */ u(
401
+ /* @__PURE__ */ u("div", { className: "palette-selector__bar palette-selector__bar--theme", children: $.map((b, D) => /* @__PURE__ */ u(
371
402
  "span",
372
403
  {
373
404
  className: "palette-selector__swatch",
@@ -383,102 +414,106 @@ function Z({
383
414
  }) })
384
415
  ] });
385
416
  }
386
- const C = E, w = 30, k = 10, B = {
387
- gridColumns: w,
388
- gridRows: k,
417
+ const F = v, R = 30, U = 10, ce = {
418
+ gridColumns: R,
419
+ gridRows: U,
389
420
  widgets: []
390
- }, ee = {
421
+ }, le = {
391
422
  kpi_card: "KPI Card",
392
423
  gauge: "Gauge",
393
424
  chart: "Gráfico",
394
425
  filter: "Filtro",
395
426
  variable: "Variável",
396
427
  color_palette: "Paleta de Cores"
397
- }, te = ["kpi_card", "gauge", "chart"], ae = ["filter", "variable", "color_palette"], re = /* @__PURE__ */ new Set(["filter", "variable", "color_palette"]), se = {
428
+ }, ie = ["kpi_card", "gauge", "chart"], ue = ["filter", "variable", "color_palette"], fe = /* @__PURE__ */ new Set(["filter", "variable", "color_palette"]), ge = {
398
429
  sum: "Soma",
399
430
  avg: "Média",
400
431
  count: "Contagem",
401
432
  min: "Mínimo",
402
433
  max: "Máximo",
403
434
  count_distinct: "Contagem Distinta"
404
- }, F = {
435
+ }, Y = {
405
436
  currency: "Moeda (R$)",
406
437
  number: "Número",
407
438
  integer: "Inteiro",
408
439
  percentage: "Porcentagem",
409
440
  date: "Data",
410
441
  text: "Texto"
411
- }, ne = Object.entries(F).filter(([e]) => e !== "date" && e !== "text"), oe = {
442
+ }, de = Object.entries(Y).filter(([e]) => e !== "date" && e !== "text"), pe = {
412
443
  yoy: "vs Ano Anterior",
413
444
  mom: "vs Mês Anterior",
414
445
  target: "vs Meta",
415
446
  none: "Nenhuma"
416
- }, ce = {
447
+ }, be = {
417
448
  bar: "Barras",
418
449
  line: "Linhas",
419
450
  area: "Área",
420
451
  pie: "Pizza"
421
- }, le = {
452
+ }, me = {
422
453
  date_range: "Periodo",
423
454
  select: "Seleção Única",
424
455
  multi_select: "Seleção Múltipla"
425
- }, ie = {
456
+ }, _e = {
426
457
  kpi_card: { x: 0, y: 0, w: 6, h: 3 },
427
458
  gauge: { x: 0, y: 0, w: 6, h: 5 },
428
459
  chart: { x: 0, y: 0, w: 6, h: 6 },
429
460
  filter: { x: 0, y: 0, w: 4, h: 2 },
430
461
  variable: { x: 0, y: 0, w: 4, h: 2 },
431
462
  color_palette: { x: 0, y: 0, w: 4, h: 2 }
432
- }, ue = {
463
+ }, he = {
433
464
  kpi_card: { label: "Novo KPI", aggregation: "sum", format: "number" },
434
465
  gauge: { label: "Novo Gauge", aggregation: "sum" },
435
466
  chart: { label: "Novo Grafico", chartType: "bar", xAxis: { column: "", granularity: "day" }, series: [] },
436
467
  filter: { label: "Novo Filtro", filterType: "select" },
437
468
  variable: { label: "Nova Variavel", variableValue: 0, variableFormat: "number", locked: !1 },
438
- color_palette: { label: "Paleta de Cores", paletteColors: C, locked: !1 }
469
+ color_palette: { label: "Paleta de Cores", paletteColors: F, locked: !1 }
439
470
  };
440
471
  export {
441
- se as A,
472
+ ge as A,
442
473
  m as B,
443
- ce as C,
444
- te as D,
445
- B as E,
446
- le as F,
447
- K as G,
448
- V as H,
449
- q as I,
450
- W as J,
451
- U as M,
452
- ne as N,
453
- h as P,
454
- M as S,
474
+ be as C,
475
+ ie as D,
476
+ ce as E,
477
+ me as F,
478
+ ae as G,
479
+ te as H,
480
+ re as I,
481
+ X as J,
482
+ j as K,
483
+ J as L,
484
+ K as M,
485
+ de as N,
486
+ z as O,
487
+ S as P,
488
+ x as Q,
489
+ L as S,
455
490
  T,
456
- ee as W,
457
- oe as a,
458
- re as b,
459
- ae as c,
460
- Z as d,
461
- ue as e,
462
- ie as f,
463
- w as g,
464
- k as h,
465
- C as i,
466
- E as j,
467
- Q as k,
468
- F as l,
469
- Y as m,
491
+ le as W,
492
+ pe as a,
493
+ fe as b,
494
+ ue as c,
495
+ oe as d,
496
+ he as e,
497
+ _e as f,
498
+ R as g,
499
+ U as h,
500
+ F as i,
501
+ v as j,
502
+ ne as k,
503
+ Y as l,
504
+ V as m,
470
505
  o as n,
471
- N as o,
472
- O as p,
506
+ P as o,
507
+ C as p,
473
508
  _ as q,
474
- G as r,
475
- v as s,
476
- J as t,
477
- H as u,
478
- R as v,
479
- x as w,
480
- j as x,
481
- z as y,
482
- X as z
509
+ q as r,
510
+ M as s,
511
+ Q as t,
512
+ ee as u,
513
+ H as v,
514
+ w,
515
+ Z as x,
516
+ B as y,
517
+ se as z
483
518
  };
484
- //# sourceMappingURL=index-BHv7_r-h.js.map
519
+ //# sourceMappingURL=index-C3jiurhg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-C3jiurhg.js","sources":["../src/api/fetcher.ts","../src/palettes/index.ts","../src/utils/date.ts","../src/components/DashboardDatePicker.tsx","../src/components/ColorPaletteSelector.tsx","../src/types/index.ts"],"sourcesContent":["// Purpose: Client HTTP interno da API Action (endpoints /external/dashboards).\n// Scope: Infraestrutura da lib — nao exportado no index publico. Consumidor\n// externo usa <Dashboard token /> que encapsula tudo.\n// Public API (interno): fetchLayout, fetchRender, ApiError, setApiUrl\n\nimport type { LayoutResponse, RenderResponse } from '../types';\n\nconst DEFAULT_API_URL = 'https://action-data-api.fly.dev/api';\nconst ENDPOINT_PREFIX = '/external/dashboards';\n\n// URL efetiva — pode ser sobrescrita via `setApiUrl` (uso interno em dev).\nlet apiUrl = DEFAULT_API_URL;\n\n/** Sobrescreve a URL base da API. Destinado ao builder da plataforma em dev —\n * consumidores externos nao devem chamar (usam a URL de producao por default). */\nexport function setApiUrl(url: string): void {\n apiUrl = url.replace(/\\/$/, '');\n}\n\nexport class ApiError extends Error {\n constructor(\n message: string,\n public status?: number,\n public payload?: unknown,\n ) {\n super(message);\n this.name = 'ApiError';\n }\n}\n\nasync function get<T>(path: string, token: string, params?: Record<string, string>): Promise<T> {\n const url = new URL(`${apiUrl}${ENDPOINT_PREFIX}${path}`);\n if (params) {\n for (const [k, v] of Object.entries(params)) url.searchParams.set(k, v);\n }\n\n const res = await fetch(url.toString(), {\n headers: { Authorization: `Bearer ${token}` },\n });\n\n if (!res.ok) {\n let payload: unknown;\n try { payload = await res.json(); } catch { /* non-json */ }\n throw new ApiError(\n `Requisicao falhou (${res.status}) em ${path}`,\n res.status,\n payload,\n );\n }\n return (await res.json()) as T;\n}\n\nexport const fetchLayout = (token: string) =>\n get<LayoutResponse>('/layout', token);\n\nexport const fetchRender = (token: string, params?: Record<string, string>) =>\n get<RenderResponse>('/render', token, params);\n","// Purpose: Paletas de cores completas para dashboards (series de dados + cores de UI).\n// Scope: Define paletas com 13 slots semanticos (5 series + 8 cores de UI) e helpers\n// para extrair series e gerar CSS variables aplicaveis ao escopo do dashboard.\n// Public API: PALETTES, PaletteKey, Palette, getSeries, getPaletteCssVars,\n// SLOT_INDEX, SLOT_LABELS, DEFAULT_PALETTE_COLORS, ensurePaletteShape\n\nexport interface Palette {\n label: string;\n colors: string[]; // 13 cores ordenadas pelos slots semanticos\n}\n\nexport type PaletteKey = 'action' | 'westCoast' | 'mono' | 'ocean' | 'princess';\n\n// -------Slots semanticos (indices fixos no array de cores)-------\n//\n// Convencao posicional para manter o storage como string[] (compativel com schemas\n// Pydantic e o tipo `PaletteConfig.paletteColors`). Cada paleta deve ter 13 cores.\n\nexport const SLOT_INDEX = {\n series0: 0,\n series1: 1,\n series2: 2,\n series3: 3,\n series4: 4,\n bgDark: 5,\n bgPaper: 6,\n bgElevated: 7,\n textPrimary: 8,\n textMuted: 9,\n accent: 10,\n success: 11,\n error: 12,\n} as const;\n\nexport const SERIES_COUNT = 5;\nexport const TOTAL_SLOTS = 13;\n\nexport const SLOT_LABELS: Record<keyof typeof SLOT_INDEX, string> = {\n series0: 'Série 1',\n series1: 'Série 2',\n series2: 'Série 3',\n series3: 'Série 4',\n series4: 'Série 5',\n bgDark: 'Fundo Escuro',\n bgPaper: 'Fundo Cartão',\n bgElevated: 'Fundo Elevado',\n textPrimary: 'Texto Primário',\n textMuted: 'Texto Secundário',\n accent: 'Destaque',\n success: 'Sucesso',\n error: 'Erro',\n};\n\n// -------Presets-------\n\nexport const PALETTES: Record<PaletteKey, Palette> = {\n action: {\n label: 'Action',\n colors: [\n '#ff6b00', '#a3e635', '#e3f544', '#65ffd1', '#ff0404',\n '#1a1a1a',\n '#262626',\n '#333333',\n '#f5f5f5',\n '#999999',\n '#ff6b00',\n '#a3e635',\n '#ef4444',\n ],\n },\n westCoast: {\n label: 'West Coast',\n colors: [\n '#a3b86c', '#c89b3c', '#8b6f47', '#6b8e23', '#d2691e',\n '#1f1a14',\n '#2a241b',\n '#3a3225',\n '#e8dcc4',\n '#a89878',\n '#c89b3c',\n '#a3b86c',\n '#c44536',\n ],\n },\n mono: {\n label: 'Monocromático',\n colors: [\n '#f8fafc', '#cbd5e1', '#94a3b8', '#64748b', '#475569',\n '#0a0a0a',\n '#171717',\n '#262626',\n '#fafafa',\n '#a3a3a3',\n '#e5e5e5',\n '#cbd5e1',\n '#ef4444',\n ],\n },\n ocean: {\n label: 'Ocean',\n colors: [\n '#0ea5e9', '#06b6d4', '#0891b2', '#3b82f6', '#22d3ee',\n '#0a1929',\n '#0f2740',\n '#173554',\n '#e0f2fe',\n '#7dd3fc',\n '#22d3ee',\n '#10b981',\n '#f43f5e',\n ],\n },\n princess: {\n label: 'Cute Pink',\n colors: [\n '#ff79bc', '#a855f7', '#f472b6', '#d946ef', '#fb7185',\n '#fff0f6',\n '#ffe4ec',\n '#ffffff',\n '#ff4099',\n '#ffadd5',\n '#ec4899',\n '#10b981',\n '#e11d48',\n ],\n },\n};\n\nexport const DEFAULT_PALETTE: PaletteKey = 'action';\n\n// Array de cores default expandido (13 slots)\nexport const DEFAULT_PALETTE_COLORS: string[] = PALETTES.action.colors;\n\n// -------Helpers-------\n\n/** Garante que a paleta tem TOTAL_SLOTS cores. Preenche faltantes com fallback do default. */\nexport function ensurePaletteShape(colors?: string[]): string[] {\n const fallback = DEFAULT_PALETTE_COLORS;\n if (!colors || colors.length === 0) return [...fallback];\n if (colors.length >= TOTAL_SLOTS) return colors.slice(0, TOTAL_SLOTS);\n const result = [...colors];\n for (let i = colors.length; i < TOTAL_SLOTS; i++) result.push(fallback[i]);\n return result;\n}\n\n/** Extrai apenas as cores de series (uso em charts/gauge). */\nexport function getSeries(colors?: string[]): string[] {\n const full = ensurePaletteShape(colors);\n return full.slice(0, SERIES_COUNT);\n}\n\n/** Gera objeto de CSS variables para aplicar inline no escopo do dashboard. */\nexport function getPaletteCssVars(colors?: string[]): Record<string, string> {\n const c = ensurePaletteShape(colors);\n return {\n '--bg-dark': c[SLOT_INDEX.bgDark],\n '--bg-paper': c[SLOT_INDEX.bgPaper],\n '--bg-elevated': c[SLOT_INDEX.bgElevated],\n '--text-primary': c[SLOT_INDEX.textPrimary],\n '--text-secondary': c[SLOT_INDEX.textMuted],\n '--text-muted': c[SLOT_INDEX.textMuted],\n '--action-orange': c[SLOT_INDEX.accent],\n '--action-green': c[SLOT_INDEX.success],\n '--color-success': c[SLOT_INDEX.success],\n '--color-error': c[SLOT_INDEX.error],\n '--color-info': c[SLOT_INDEX.series2],\n '--color-warning': c[SLOT_INDEX.series3],\n };\n}\n","// Purpose: Utilitarios de data para filtros temporais de dashboards.\n// Scope: Calculo de intervalos anuais/mensais/semanais, parse de ranges, ISO week.\n// Public API: MONTH_NAMES_*, getFullYearRange, getMonthRange, getWeekRange, getISOWeek,\n// getWeeksInMonth, parseYearFromRange, parseMonthFromRange, parseWeekFromRange,\n// getYearRange, getMonthWeeks, MonthWeek\n\nexport const MONTH_NAMES_SHORT = [\n 'Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun',\n 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez',\n];\n\nexport const MONTH_NAMES_FULL = [\n 'Janeiro', 'Fevereiro', 'Marco', 'Abril', 'Maio', 'Junho',\n 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro',\n];\n\nexport function getFullYearRange(year: number): { start: string; end: string } {\n return { start: `${year}-01-01`, end: `${year}-12-31` };\n}\n\nexport function parseYearFromRange(start: string): { year: number } | null {\n if (!start) return null;\n const m = start.match(/^(\\d{4})/);\n return m ? { year: parseInt(m[1]) } : null;\n}\n\nexport function getMonthRange(year: number, month: number): { start: string; end: string } {\n const lastDay = new Date(year, month, 0).getDate();\n const pad = (n: number) => String(n).padStart(2, '0');\n return {\n start: `${year}-${pad(month)}-01`,\n end: `${year}-${pad(month)}-${pad(lastDay)}`,\n };\n}\n\nexport function getISOWeek(dt: Date): number {\n const d = new Date(Date.UTC(dt.getFullYear(), dt.getMonth(), dt.getDate()));\n d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));\n const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));\n return Math.ceil(((d.getTime() - yearStart.getTime()) / 86400000 + 1) / 7);\n}\n\nexport function getWeekRange(year: number, week: number): { start: string; end: string } {\n const jan4 = new Date(year, 0, 4);\n const dayOfWeek = (jan4.getDay() + 6) % 7;\n const firstMonday = new Date(jan4.getTime() - dayOfWeek * 86400000);\n const start = new Date(firstMonday.getTime() + (week - 1) * 7 * 86400000);\n const end = new Date(start.getTime() + 6 * 86400000);\n const pad = (n: number) => String(n).padStart(2, '0');\n const fmt = (d: Date) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;\n return { start: fmt(start), end: fmt(end) };\n}\n\nexport function getWeeksInMonth(year: number, month: number): number[] {\n const weeks: Set<number> = new Set();\n const daysInMonth = new Date(year, month, 0).getDate();\n for (let d = 1; d <= daysInMonth; d++) {\n weeks.add(getISOWeek(new Date(year, month - 1, d)));\n }\n return Array.from(weeks).sort((a, b) => a - b);\n}\n\nexport interface MonthWeek {\n index: number;\n startDay: number;\n endDay: number;\n start: string;\n end: string;\n label: string;\n}\n\nexport function getMonthWeeks(year: number, month: number): MonthWeek[] {\n const daysInMonth = new Date(year, month, 0).getDate();\n const pad = (n: number) => String(n).padStart(2, '0');\n const weeks: MonthWeek[] = [];\n let day = 1;\n let index = 1;\n\n while (day <= daysInMonth) {\n const startDay = day;\n const endDay = Math.min(day + 6, daysInMonth);\n const start = `${year}-${pad(month)}-${pad(startDay)}`;\n const end = `${year}-${pad(month)}-${pad(endDay)}`;\n const label = `${index}° Semana (${pad(startDay)}/${pad(month)} - ${pad(endDay)}/${pad(month)})`;\n weeks.push({ index, startDay, endDay, start, end, label });\n day = endDay + 1;\n index++;\n }\n\n return weeks;\n}\n\nexport function parseMonthWeekFromRange(start: string, year: number, month: number): number {\n if (!start) return 1;\n const pad = (n: number) => String(n).padStart(2, '0');\n const dayMatch = start.match(new RegExp(`^${year}-${pad(month)}-(\\\\d{2})`));\n if (!dayMatch) return 1;\n const day = parseInt(dayMatch[1]);\n return Math.ceil(day / 7);\n}\n\nexport function parseMonthFromRange(start: string): { year: number; month: number } | null {\n if (!start) return null;\n const m = start.match(/^(\\d{4})-(\\d{2})/);\n return m ? { year: parseInt(m[1]), month: parseInt(m[2]) } : null;\n}\n\nexport function parseWeekFromRange(start: string): { year: number; week: number } | null {\n if (!start) return null;\n const d = new Date(start + 'T00:00:00');\n if (isNaN(d.getTime())) return null;\n return { year: d.getFullYear(), week: getISOWeek(d) };\n}\n\nexport function getYearRange(dateBounds?: { min: string | null; max: string | null } | null): number[] {\n const now = new Date();\n const minYear = dateBounds?.min ? parseInt(dateBounds.min.slice(0, 4)) : now.getFullYear() - 2;\n const maxYear = dateBounds?.max ? parseInt(dateBounds.max.slice(0, 4)) : now.getFullYear();\n const years: number[] = [];\n for (let y = maxYear; y >= minYear; y--) years.push(y);\n return years;\n}\n","// Purpose: Wrapper react-datepicker para dashboards.\n// Scope: Converte YYYY-MM-DD <-> Date, aplica estilos escopados via .ddp-field.\n// Public API: DashboardDatePicker, isoToDate, dateToIso\n\nimport DatePicker from 'react-datepicker';\nimport 'react-datepicker/dist/react-datepicker.css';\n\n// -------Helpers ISO <-> Date-------\n// Usam local-time para evitar timezone shift (toISOString() converte para UTC).\n\nexport function isoToDate(iso?: string | null): Date | null {\n if (!iso) return null;\n const [y, m, d] = iso.split('-').map(Number);\n if (!y || !m || !d) return null;\n return new Date(y, m - 1, d);\n}\n\nexport function dateToIso(date?: Date | null): string {\n if (!date) return '';\n const y = date.getFullYear();\n const m = String(date.getMonth() + 1).padStart(2, '0');\n const d = String(date.getDate()).padStart(2, '0');\n return `${y}-${m}-${d}`;\n}\n\n// -------Componente-------\n\ninterface Props {\n value: string; // 'YYYY-MM-DD' ou ''\n onChange: (iso: string) => void; // emite '' quando limpo\n minIso?: string | null;\n maxIso?: string | null;\n placeholder?: string;\n selectsStart?: boolean;\n selectsEnd?: boolean;\n startIso?: string | null;\n endIso?: string | null;\n className?: string;\n disabled?: boolean;\n}\n\nexport function DashboardDatePicker({\n value, onChange, minIso, maxIso, placeholder,\n selectsStart, selectsEnd, startIso, endIso, className, disabled,\n}: Props) {\n return (\n <div className={`ddp-field ${className ?? ''}`}>\n <DatePicker\n selected={isoToDate(value)}\n onChange={(d: Date | null) => onChange(dateToIso(d))}\n selectsStart={selectsStart}\n selectsEnd={selectsEnd}\n startDate={isoToDate(startIso) ?? undefined}\n endDate={isoToDate(endIso) ?? undefined}\n minDate={isoToDate(minIso) ?? undefined}\n maxDate={isoToDate(maxIso) ?? undefined}\n dateFormat=\"dd/MM/yyyy\"\n placeholderText={placeholder ?? 'Selecione...'}\n disabled={disabled}\n portalId=\"ddp-portal\"\n popperPlacement=\"bottom-start\"\n popperModifiers={[\n {\n name: 'flip',\n options: { fallbackPlacements: ['bottom-end', 'top-start', 'top-end'] },\n fn: (state) => state,\n },\n ]}\n />\n </div>\n );\n}\n","// Purpose: Seletor de paleta de cores (13 slots semanticos).\n// Scope: Presets pre-definidos + modo customizado com color pickers nomeados por slot.\n// Public API: ColorPaletteSelector\n\nimport {\n PALETTES, ensurePaletteShape, getSeries, SLOT_INDEX, SLOT_LABELS, TOTAL_SLOTS,\n type PaletteKey,\n} from '../palettes';\n\n// Slots de tema usados para a segunda barra de preview do preset\nconst THEME_PREVIEW_SLOTS = [\n SLOT_INDEX.bgDark,\n SLOT_INDEX.bgPaper,\n SLOT_INDEX.bgElevated,\n SLOT_INDEX.accent,\n SLOT_INDEX.success,\n];\n\ninterface Props {\n selected?: string[];\n onSelect: (colors: string[]) => void;\n customMode?: boolean;\n onCustomModeChange?: (custom: boolean) => void;\n disabled?: boolean;\n}\n\nfunction isPreset(colors?: string[]): boolean {\n if (!colors) return true;\n const normalized = ensurePaletteShape(colors);\n return Object.values(PALETTES).some(\n (p) => JSON.stringify(p.colors) === JSON.stringify(normalized)\n );\n}\n\n// Slots agrupados por categoria para a UI customizada\nconst SLOT_ROWS: { label: string; slots: (keyof typeof SLOT_INDEX)[] }[] = [\n { label: 'Series', slots: ['series0', 'series1', 'series2', 'series3', 'series4'] },\n { label: 'Tema', slots: ['bgDark', 'bgPaper', 'bgElevated', 'textPrimary', 'textMuted'] },\n { label: 'Estados', slots: ['accent', 'success', 'error'] },\n];\n\nexport function ColorPaletteSelector({\n selected, onSelect, customMode, onCustomModeChange, disabled,\n}: Props) {\n const isCustom = customMode ?? !isPreset(selected);\n const colors = ensurePaletteShape(selected);\n\n const selectedKey = !isCustom\n ? (Object.entries(PALETTES).find(\n ([, p]) => JSON.stringify(p.colors) === JSON.stringify(colors)\n )?.[0] as PaletteKey | undefined)\n : undefined;\n\n const handleSlotChange = (slotIdx: number, color: string) => {\n const updated = [...colors];\n while (updated.length < TOTAL_SLOTS) updated.push('#000000');\n updated[slotIdx] = color;\n onSelect(updated);\n };\n\n return (\n <div className={`palette-selector ${disabled ? 'palette-selector--disabled' : ''}`}>\n {onCustomModeChange && (\n <label className=\"config-panel__checkbox\">\n <input\n type=\"checkbox\"\n checked={isCustom}\n onChange={(e) => onCustomModeChange(e.target.checked)}\n disabled={disabled}\n />\n Customizar\n </label>\n )}\n\n {isCustom ? (\n <div className=\"palette-selector__custom\">\n {SLOT_ROWS.map((row) => (\n <div key={row.label} className=\"palette-selector__row\">\n <span className=\"palette-selector__row-label\">{row.label}</span>\n <div className=\"palette-selector__row-slots\">\n {row.slots.map((slotName) => {\n const slotIdx = SLOT_INDEX[slotName];\n return (\n <input\n key={slotName}\n type=\"color\"\n className=\"palette-selector__color-input\"\n value={colors[slotIdx] || '#000000'}\n onChange={(e) => handleSlotChange(slotIdx, e.target.value)}\n disabled={disabled}\n title={SLOT_LABELS[slotName]}\n />\n );\n })}\n </div>\n </div>\n ))}\n </div>\n ) : (\n <div className=\"palette-selector__options\">\n {(Object.entries(PALETTES) as [PaletteKey, typeof PALETTES[PaletteKey]][]).map(([key, palette]) => {\n const fullColors = ensurePaletteShape(palette.colors);\n return (\n <button\n key={key}\n className={`palette-selector__option ${selectedKey === key ? 'palette-selector__option--active' : ''}`}\n onClick={() => onSelect(palette.colors)}\n disabled={disabled}\n >\n <div className=\"palette-selector__bar\">\n {getSeries(palette.colors).map((color, i) => (\n <span\n key={i}\n className=\"palette-selector__swatch\"\n style={{ backgroundColor: color }}\n />\n ))}\n </div>\n <div className=\"palette-selector__bar palette-selector__bar--theme\">\n {THEME_PREVIEW_SLOTS.map((slotIdx, i) => (\n <span\n key={i}\n className=\"palette-selector__swatch\"\n style={{ backgroundColor: fullColors[slotIdx] }}\n />\n ))}\n </div>\n <span className=\"palette-selector__label\">{palette.label}</span>\n </button>\n );\n })}\n </div>\n )}\n </div>\n );\n}\n","// Purpose: Tipos compartilhados entre backend Python (schemas Pydantic) e frontend.\n// Scope: Union discriminada de WidgetDefinition, configs por tipo, respostas da API.\n// Public API: Todos os tipos e interfaces exportados + defaults + labels.\n\nimport { DEFAULT_PALETTE_COLORS } from '../palettes';\n\n// -------Enums como string literals-------\n\nexport type AggregationType = 'sum' | 'avg' | 'count' | 'min' | 'max' | 'count_distinct';\nexport type ComparisonType = 'yoy' | 'mom' | 'target' | 'none';\nexport type FilterType = 'date_range' | 'select' | 'multi_select';\nexport type WidgetType = 'kpi_card' | 'gauge' | 'chart' | 'filter' | 'variable' | 'color_palette';\nexport type DataWidgetType = 'kpi_card' | 'gauge' | 'chart';\nexport type ControlWidgetType = 'filter' | 'variable' | 'color_palette';\nexport type ChartType = 'bar' | 'line' | 'area' | 'pie';\nexport type FormatType = 'currency' | 'number' | 'integer' | 'percentage' | 'date' | 'text';\nexport type DateFilterMode = 'range' | 'monthly' | 'weekly' | 'yearly';\nexport type Granularity = 'day' | 'week' | 'month' | 'year' | 'weekday';\n\n// -------Pedacos compartilhados pelos configs-------\n\nexport interface FilterDefinition {\n id: string;\n type: FilterType;\n label: string;\n column?: string | null;\n defaultValue?: unknown;\n}\n\nexport interface TargetDefinition {\n id: string;\n label: string;\n value: number;\n format: FormatType;\n}\n\nexport interface GridPosition {\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\nexport interface ComparisonConfig {\n type: ComparisonType;\n targetId?: string;\n}\n\nexport interface AggregationStep {\n aggregation: AggregationType;\n groupBy: string;\n groupGranularity?: Granularity;\n}\n\nexport interface ColumnExpressionTerm {\n column: string;\n operator?: '+' | '-' | '*' | '/';\n}\n\nexport interface KpiOperand {\n column?: string;\n columnExpression?: ColumnExpressionTerm[];\n intermediateSteps?: AggregationStep[];\n finalAggregation?: AggregationType;\n constant?: number;\n}\n\nexport interface KpiTerm {\n operand: KpiOperand;\n operator?: '+' | '-' | '*' | '/'; // undefined apenas no primeiro termo\n}\n\nexport interface ChartSeriesConfig {\n label: string;\n // Formula simples\n column?: string;\n aggregation?: AggregationType;\n // Formula composta (pipeline identico ao KPI card, avaliado por grupo do eixo X)\n kpiTerms?: KpiTerm[];\n}\n\nexport interface ChartAxisConfig {\n column: string;\n granularity: Granularity;\n}\n\n// -------Config por tipo de widget-------\n\nexport interface KpiCardConfig {\n label: string;\n format?: FormatType;\n column?: string;\n aggregation?: AggregationType;\n groupBy?: string;\n groupGranularity?: Granularity;\n outerAggregation?: AggregationType;\n kpiTerms?: KpiTerm[];\n comparison?: ComparisonConfig;\n filterExpression?: Record<string, unknown>;\n}\n\nexport interface GaugeConfig {\n label: string;\n format?: FormatType;\n column?: string;\n aggregation?: AggregationType;\n targetId?: string;\n comparison?: ComparisonConfig;\n kpiTerms?: KpiTerm[];\n groupBy?: string;\n groupGranularity?: Granularity;\n outerAggregation?: AggregationType;\n filterExpression?: Record<string, unknown>;\n}\n\nexport interface ChartConfig {\n label: string;\n chartType?: ChartType;\n xAxis?: ChartAxisConfig;\n series?: ChartSeriesConfig[];\n categoryColumn?: string;\n format?: FormatType;\n filterExpression?: Record<string, unknown>;\n}\n\nexport interface FilterConfig {\n label: string;\n filterType: FilterType;\n filterColumn?: string;\n defaultValue?: unknown;\n dateFilterMode?: DateFilterMode;\n}\n\nexport interface VariableConfig {\n label: string;\n variableValue?: number;\n variableFormat?: FormatType;\n locked?: boolean;\n}\n\nexport interface PaletteConfig {\n paletteColors: string[];\n label?: string;\n locked?: boolean;\n}\n\nexport type AnyWidgetConfig =\n | KpiCardConfig | GaugeConfig | ChartConfig\n | FilterConfig | VariableConfig | PaletteConfig;\n\n// -------Union discriminada de WidgetDefinition-------\n\nexport type WidgetDefinition =\n | { id: string; type: 'kpi_card'; grid: GridPosition; config: KpiCardConfig }\n | { id: string; type: 'gauge'; grid: GridPosition; config: GaugeConfig }\n | { id: string; type: 'chart'; grid: GridPosition; config: ChartConfig }\n | { id: string; type: 'filter'; grid: GridPosition; config: FilterConfig }\n | { id: string; type: 'variable'; grid: GridPosition; config: VariableConfig }\n | { id: string; type: 'color_palette'; grid: GridPosition; config: PaletteConfig };\n\nexport type WidgetConfigOf<T extends WidgetType> = Extract<WidgetDefinition, { type: T }>['config'];\n\n// -------Layout completo-------\n\nexport interface DashboardLayout {\n gridColumns: number;\n gridRows: number;\n widgets: WidgetDefinition[];\n}\n\n// -------Respostas da API-------\n\nexport interface FilterValuesResponse {\n date_bounds: { min: string | null; max: string | null };\n filter_options: Record<string, string[]>;\n headers: string[];\n column_types: Record<string, string>;\n}\n\nexport interface RenderResponse {\n date_bounds: { min: string; max: string };\n applied: Record<string, unknown>;\n widgets: Record<string, Record<string, unknown>>;\n}\n\nexport interface LayoutResponse {\n name: string;\n palette: string[];\n gridColumns: number;\n gridRows: number;\n dateBounds: { min: string; max: string };\n widgets: WidgetDefinition[];\n}\n\n// -------Defaults-------\n\n// Re-export para compatibilidade com codigo existente que importa de dashboardLayout\nexport const DEFAULT_PALETTE = DEFAULT_PALETTE_COLORS;\n\nexport const DEFAULT_GRID_COLUMNS = 30;\nexport const DEFAULT_GRID_ROWS = 10;\n\nexport const EMPTY_LAYOUT: DashboardLayout = {\n gridColumns: DEFAULT_GRID_COLUMNS,\n gridRows: DEFAULT_GRID_ROWS,\n widgets: [],\n};\n\nexport const WIDGET_TYPE_LABELS: Record<WidgetType, string> = {\n kpi_card: 'KPI Card',\n gauge: 'Gauge',\n chart: 'Gráfico',\n filter: 'Filtro',\n variable: 'Variável',\n color_palette: 'Paleta de Cores',\n};\n\nexport const DATA_WIDGET_TYPES: DataWidgetType[] = ['kpi_card', 'gauge', 'chart'];\nexport const CONTROL_WIDGET_TYPES: ControlWidgetType[] = ['filter', 'variable', 'color_palette'];\nexport const CONTROL_WIDGET_SET = new Set<WidgetType>(['filter', 'variable', 'color_palette']);\n\nexport const AGGREGATION_LABELS: Record<AggregationType, string> = {\n sum: 'Soma',\n avg: 'Média',\n count: 'Contagem',\n min: 'Mínimo',\n max: 'Máximo',\n count_distinct: 'Contagem Distinta',\n};\n\nexport const FORMAT_LABELS: Record<FormatType, string> = {\n currency: 'Moeda (R$)',\n number: 'Número',\n integer: 'Inteiro',\n percentage: 'Porcentagem',\n date: 'Data',\n text: 'Texto',\n};\n\n// Subset de formatos numericos — usado nos configs de KPI, Gauge, Variable\nexport const NUMERIC_FORMAT_OPTIONS = Object.entries(FORMAT_LABELS)\n .filter(([k]) => k !== 'date' && k !== 'text') as [FormatType, string][];\n\nexport const COMPARISON_LABELS: Record<ComparisonType, string> = {\n yoy: 'vs Ano Anterior',\n mom: 'vs Mês Anterior',\n target: 'vs Meta',\n none: 'Nenhuma',\n};\n\nexport const CHART_TYPE_LABELS: Record<ChartType, string> = {\n bar: 'Barras',\n line: 'Linhas',\n area: 'Área',\n pie: 'Pizza',\n};\n\nexport const FILTER_TYPE_LABELS: Record<FilterType, string> = {\n date_range: 'Periodo',\n select: 'Seleção Única',\n multi_select: 'Seleção Múltipla',\n};\n\n// -------Default grid sizes por tipo de widget-------\n\nexport const DEFAULT_GRID: Record<WidgetType, GridPosition> = {\n kpi_card: { x: 0, y: 0, w: 6, h: 3 },\n gauge: { x: 0, y: 0, w: 6, h: 5 },\n chart: { x: 0, y: 0, w: 6, h: 6 },\n filter: { x: 0, y: 0, w: 4, h: 2 },\n variable: { x: 0, y: 0, w: 4, h: 2 },\n color_palette: { x: 0, y: 0, w: 4, h: 2 },\n};\n\nexport const DEFAULT_CONFIG: { [K in WidgetType]: Partial<WidgetConfigOf<K>> } = {\n kpi_card: { label: 'Novo KPI', aggregation: 'sum', format: 'number' },\n gauge: { label: 'Novo Gauge', aggregation: 'sum' },\n chart: { label: 'Novo Grafico', chartType: 'bar', xAxis: { column: '', granularity: 'day' }, series: [] },\n filter: { label: 'Novo Filtro', filterType: 'select' },\n variable: { label: 'Nova Variavel', variableValue: 0, variableFormat: 'number', locked: false },\n color_palette: { label: 'Paleta de Cores', paletteColors: DEFAULT_PALETTE, locked: false },\n};\n"],"names":["DEFAULT_API_URL","ENDPOINT_PREFIX","apiUrl","setApiUrl","url","ApiError","message","status","payload","get","path","token","params","k","v","res","fetchLayout","fetchRender","SLOT_INDEX","SERIES_COUNT","TOTAL_SLOTS","SLOT_LABELS","PALETTES","DEFAULT_PALETTE_COLORS","ensurePaletteShape","colors","fallback","result","i","getSeries","getPaletteCssVars","c","MONTH_NAMES_SHORT","MONTH_NAMES_FULL","getFullYearRange","year","parseYearFromRange","start","m","getMonthRange","month","lastDay","pad","n","getISOWeek","dt","d","yearStart","getWeekRange","week","jan4","dayOfWeek","firstMonday","end","fmt","getWeeksInMonth","weeks","daysInMonth","a","b","getMonthWeeks","day","index","startDay","endDay","label","parseMonthWeekFromRange","dayMatch","parseMonthFromRange","parseWeekFromRange","getYearRange","dateBounds","now","minYear","maxYear","years","y","isoToDate","iso","dateToIso","date","DashboardDatePicker","value","onChange","minIso","maxIso","placeholder","selectsStart","selectsEnd","startIso","endIso","className","disabled","jsx","DatePicker","state","THEME_PREVIEW_SLOTS","isPreset","normalized","p","SLOT_ROWS","ColorPaletteSelector","selected","onSelect","customMode","onCustomModeChange","isCustom","selectedKey","_a","handleSlotChange","slotIdx","color","updated","jsxs","e","row","slotName","key","palette","fullColors","DEFAULT_PALETTE","DEFAULT_GRID_COLUMNS","DEFAULT_GRID_ROWS","EMPTY_LAYOUT","WIDGET_TYPE_LABELS","DATA_WIDGET_TYPES","CONTROL_WIDGET_TYPES","CONTROL_WIDGET_SET","AGGREGATION_LABELS","FORMAT_LABELS","NUMERIC_FORMAT_OPTIONS","COMPARISON_LABELS","CHART_TYPE_LABELS","FILTER_TYPE_LABELS","DEFAULT_GRID","DEFAULT_CONFIG"],"mappings":";;AAOA,MAAMA,IAAkB,uCAClBC,IAAkB;AAGxB,IAAIC,IAASF;AAIN,SAASG,EAAUC,GAAmB;AAC3C,EAAAF,IAASE,EAAI,QAAQ,OAAO,EAAE;AAChC;AAEO,MAAMC,UAAiB,MAAM;AAAA,EAClC,YACEC,GACOC,GACAC,GACP;AACA,UAAMF,CAAO,GAHN,KAAA,SAAAC,GACA,KAAA,UAAAC,GAGP,KAAK,OAA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