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