@actionexec/dashboards 0.15.0 → 0.16.1

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,802 +0,0 @@
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
- constructor(t, a, n) {
12
- super(t), this.status = a, this.payload = n, this.name = "ApiError";
13
- }
14
- }
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
- });
22
- if (!o.ok) {
23
- let c;
24
- try {
25
- c = await o.json();
26
- } catch {
27
- }
28
- throw new oe(
29
- `Requisicao falhou (${o.status}) em ${t}`,
30
- o.status,
31
- c
32
- );
33
- }
34
- return o;
35
- }
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 = {
40
- series0: 0,
41
- series1: 1,
42
- series2: 2,
43
- series3: 3,
44
- series4: 4,
45
- bgDark: 5,
46
- bgPaper: 6,
47
- bgElevated: 7,
48
- textPrimary: 8,
49
- textMuted: 9,
50
- accent: 10,
51
- success: 11,
52
- error: 12,
53
- // Alerta e informacao tem slot proprio: derivá-los de cores de serie fazia
54
- // trocar a cor de uma serie mudar o significado semantico de "atencao".
55
- warning: 13,
56
- info: 14
57
- }, ce = 5, A = 15, ie = {
58
- series0: "Série 1",
59
- series1: "Série 2",
60
- series2: "Série 3",
61
- series3: "Série 4",
62
- series4: "Série 5",
63
- bgDark: "Fundo Escuro",
64
- bgPaper: "Fundo Cartão",
65
- bgElevated: "Fundo Elevado",
66
- textPrimary: "Texto Primário",
67
- textMuted: "Texto Secundário",
68
- accent: "Destaque",
69
- success: "Sucesso",
70
- error: "Erro",
71
- warning: "Alerta",
72
- info: "Informação"
73
- }, M = {
74
- action: {
75
- label: "Action",
76
- colors: [
77
- "#ff6b00",
78
- "#a3e635",
79
- "#e3f544",
80
- "#65ffd1",
81
- "#ff0404",
82
- "#1a1a1a",
83
- "#262626",
84
- "#333333",
85
- "#f5f5f5",
86
- "#999999",
87
- "#ff6b00",
88
- "#a3e635",
89
- "#ef4444",
90
- "#f59e0b",
91
- "#38bdf8"
92
- ]
93
- },
94
- westCoast: {
95
- label: "West Coast",
96
- colors: [
97
- "#a3b86c",
98
- "#c89b3c",
99
- "#8b6f47",
100
- "#6b8e23",
101
- "#d2691e",
102
- "#1f1a14",
103
- "#2a241b",
104
- "#3a3225",
105
- "#e8dcc4",
106
- "#a89878",
107
- "#c89b3c",
108
- "#a3b86c",
109
- "#c44536",
110
- "#d99a2b",
111
- "#7c9bb5"
112
- ]
113
- },
114
- mono: {
115
- label: "Monocromático",
116
- colors: [
117
- "#f8fafc",
118
- "#cbd5e1",
119
- "#94a3b8",
120
- "#64748b",
121
- "#475569",
122
- "#0a0a0a",
123
- "#171717",
124
- "#262626",
125
- "#fafafa",
126
- "#a3a3a3",
127
- "#e5e5e5",
128
- "#cbd5e1",
129
- "#ef4444",
130
- "#facc15",
131
- "#7dd3fc"
132
- ]
133
- },
134
- ocean: {
135
- label: "Ocean",
136
- colors: [
137
- "#0ea5e9",
138
- "#06b6d4",
139
- "#0891b2",
140
- "#3b82f6",
141
- "#22d3ee",
142
- "#0a1929",
143
- "#0f2740",
144
- "#173554",
145
- "#e0f2fe",
146
- "#7dd3fc",
147
- "#22d3ee",
148
- "#10b981",
149
- "#f43f5e",
150
- "#fbbf24",
151
- "#60a5fa"
152
- ]
153
- },
154
- princess: {
155
- label: "Cute Pink",
156
- colors: [
157
- "#ff79bc",
158
- "#a855f7",
159
- "#f472b6",
160
- "#d946ef",
161
- "#fb7185",
162
- "#fff0f6",
163
- "#ffe4ec",
164
- "#ffffff",
165
- "#ff4099",
166
- "#ffadd5",
167
- "#ec4899",
168
- "#10b981",
169
- "#e11d48",
170
- "#f59e0b",
171
- "#8b5cf6"
172
- ]
173
- }
174
- }, j = M.action.colors;
175
- function N(e) {
176
- const t = j;
177
- if (!e || e.length === 0) return [...t];
178
- if (e.length >= A) return e.slice(0, A);
179
- const a = [...e];
180
- for (let n = e.length; n < A; n++) a.push(t[n]);
181
- return a;
182
- }
183
- function le(e) {
184
- return N(e).slice(0, ce);
185
- }
186
- function Ce(e) {
187
- const t = N(e);
188
- return {
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],
200
- // Aliases historicos, mantidos para nao quebrar CSS de consumidores.
201
- "--action-orange": t[d.accent],
202
- "--action-green": t[d.success]
203
- };
204
- }
205
- const ue = j, fe = 30, de = 10, Ie = {
206
- gridColumns: fe,
207
- gridRows: de,
208
- widgets: []
209
- }, Fe = {
210
- kpi_card: "Card",
211
- gauge: "Gauge",
212
- chart: "Gráfico",
213
- composition: "Composição",
214
- table: "Tabela",
215
- filter: "Filtro",
216
- variable: "Variável",
217
- color_palette: "Paleta de Cores"
218
- }, ve = ["kpi_card", "gauge", "chart", "composition", "table"], $e = ["filter", "variable", "color_palette"], ke = /* @__PURE__ */ new Set(["filter", "variable", "color_palette"]), Ue = {
219
- day: ["dia", "dias"],
220
- week: ["semana", "semanas"],
221
- month: ["mês", "meses"],
222
- quarter: ["trimestre", "trimestres"],
223
- year: ["ano", "anos"]
224
- }, Ge = ["período", "períodos"], Ye = {
225
- sum: "Soma",
226
- avg: "Média",
227
- count: "Contagem",
228
- min: "Mínimo",
229
- max: "Máximo",
230
- count_distinct: "Contagem Distinta"
231
- }, ge = {
232
- currency: "Moeda (R$)",
233
- number: "Número",
234
- integer: "Inteiro",
235
- percentage: "Porcentagem",
236
- date: "Data",
237
- text: "Texto"
238
- }, We = Object.entries(ge).filter(([e]) => e !== "date" && e !== "text"), He = {
239
- variance: "Variação %",
240
- difference: "Diferença",
241
- ratio: "Proporção",
242
- value: "Base"
243
- }, Be = {
244
- scroll: "Rolar",
245
- clip: "Cortar"
246
- }, je = {
247
- higher: "Positivo",
248
- lower: "Negativo",
249
- neutral: "Neutro"
250
- }, ze = {
251
- eq: "Igual a",
252
- neq: "Diferente de",
253
- in: "Está entre os valores",
254
- not_in: "Não está entre os valores",
255
- gt: "Maior que",
256
- gte: "Maior ou igual a",
257
- lt: "Menor que",
258
- lte: "Menor ou igual a",
259
- between: "Entre (faixa numérica)",
260
- contains: "Contém",
261
- not_contains: "Não contém",
262
- is_empty: "Está vazio",
263
- not_empty: "Não está vazio"
264
- }, qe = ["is_empty", "not_empty"], Ve = ["in", "not_in"], Je = {
265
- bar: "Barras",
266
- line: "Linhas",
267
- area: "Área"
268
- }, Xe = {
269
- pie: "Pizza",
270
- bridge: "Ponte"
271
- }, Ke = {
272
- descending: "Descendente",
273
- ascending: "Ascendente"
274
- }, Qe = {
275
- date_range: "Periodo",
276
- select: "Seleção Única",
277
- multi_select: "Seleção Múltipla"
278
- }, Y = "", Ze = {
279
- kpi_card: { x: 0, y: 0, w: 6, h: 3 },
280
- gauge: { x: 0, y: 0, w: 6, h: 5 },
281
- chart: { x: 0, y: 0, w: 6, h: 6 },
282
- composition: { x: 0, y: 0, w: 6, h: 6 },
283
- table: { x: 0, y: 0, w: 12, h: 7 },
284
- filter: { x: 0, y: 0, w: 4, h: 2 },
285
- variable: { x: 0, y: 0, w: 4, h: 2 },
286
- color_palette: { x: 0, y: 0, w: 4, h: 2 }
287
- }, et = {
288
- kpi_card: { label: "Novo card", aggregation: "sum", format: "number" },
289
- gauge: { label: "Novo Gauge", aggregation: "sum" },
290
- chart: { label: "Novo gráfico", chartType: "bar", xAxis: { column: "", granularity: "day" }, series: [] },
291
- composition: {
292
- label: "Nova composição",
293
- display: "pie",
294
- categories: [],
295
- direction: "descending"
296
- },
297
- table: { label: "Nova Tabela", columns: [] },
298
- filter: { label: "Novo Filtro", filterType: "select" },
299
- variable: { label: "Nova Variavel", variableValue: 0, variableFormat: "number", locked: !1 },
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) {
303
- if (!S(t) || !Number.isFinite(e)) return 0;
304
- const r = e - n * 2 - a * (t - 1);
305
- return Math.max(0, r / t);
306
- }
307
- function at(e, t = v) {
308
- return !S(e) || !S(t) ? P : pe(e / t, P, me);
309
- }
310
- function nt(e, t, a = I, n = F) {
311
- return e <= 0 ? n * 2 : e * t + (e - 1) * a + n * 2;
312
- }
313
- function rt(e, t, a = v) {
314
- return !S(e) || !S(t) || !S(a) ? 1 : e * a / t;
315
- }
316
- function st(e, t = v, a = I, n = F) {
317
- return !S(e) || !S(t) ? 0 : P * t * e + a * (e - 1) + n * 2;
318
- }
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);
322
- }
323
- function z(e) {
324
- if (e == null || e === "") return null;
325
- const t = typeof e == "number" ? e : Number(e);
326
- return Number.isFinite(t) ? t : null;
327
- }
328
- function he(e, t, a = "-") {
329
- if (e == null || e === "") return a;
330
- const n = z(e);
331
- if (n === null) return String(e);
332
- switch (t) {
333
- case "currency":
334
- return n.toLocaleString(D, { style: "currency", currency: "BRL" });
335
- case "integer":
336
- return Math.round(n).toLocaleString(D);
337
- case "percentage":
338
- return `${(n * be).toLocaleString(D, { maximumFractionDigits: 1 })}%`;
339
- case "number":
340
- return n.toLocaleString(D, { maximumFractionDigits: 2 });
341
- default:
342
- return String(e);
343
- }
344
- }
345
- function ct(e, t) {
346
- const a = z(e);
347
- if (a === null) return "-";
348
- if (t === "percentage") return he(a, "percentage");
349
- const n = t === "currency" ? "R$ " : "", r = Math.abs(a);
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 })}`;
351
- }
352
- const it = [
353
- "Jan",
354
- "Fev",
355
- "Mar",
356
- "Abr",
357
- "Mai",
358
- "Jun",
359
- "Jul",
360
- "Ago",
361
- "Set",
362
- "Out",
363
- "Nov",
364
- "Dez"
365
- ], lt = [
366
- "Janeiro",
367
- "Fevereiro",
368
- "Marco",
369
- "Abril",
370
- "Maio",
371
- "Junho",
372
- "Julho",
373
- "Agosto",
374
- "Setembro",
375
- "Outubro",
376
- "Novembro",
377
- "Dezembro"
378
- ];
379
- function ut(e) {
380
- return { start: `${e}-01-01`, end: `${e}-12-31` };
381
- }
382
- function ft(e) {
383
- if (!e) return null;
384
- const t = e.match(/^(\d{4})/);
385
- return t ? { year: parseInt(t[1]) } : null;
386
- }
387
- function dt(e, t) {
388
- const a = new Date(e, t, 0).getDate(), n = (r) => String(r).padStart(2, "0");
389
- return {
390
- start: `${e}-${n(t)}-01`,
391
- end: `${e}-${n(t)}-${n(a)}`
392
- };
393
- }
394
- function q(e) {
395
- const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate()));
396
- t.setUTCDate(t.getUTCDate() + 4 - (t.getUTCDay() || 7));
397
- const a = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
398
- return Math.ceil(((t.getTime() - a.getTime()) / 864e5 + 1) / 7);
399
- }
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) };
403
- }
404
- function mt(e, t) {
405
- const a = /* @__PURE__ */ new Set(), n = new Date(e, t, 0).getDate();
406
- for (let r = 1; r <= n; r++)
407
- a.add(q(new Date(e, t - 1, r)));
408
- return Array.from(a).sort((r, o) => r - o);
409
- }
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;
413
- for (; o <= a; ) {
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++;
416
- }
417
- return r;
418
- }
419
- function bt(e, t, a) {
420
- if (!e) return 1;
421
- const n = (c) => String(c).padStart(2, "0"), r = e.match(new RegExp(`^${t}-${n(a)}-(\\d{2})`));
422
- if (!r) return 1;
423
- const o = parseInt(r[1]);
424
- return Math.ceil(o / 7);
425
- }
426
- function _t(e) {
427
- if (!e) return null;
428
- const t = e.match(/^(\d{4})-(\d{2})/);
429
- return t ? { year: parseInt(t[1]), month: parseInt(t[2]) } : null;
430
- }
431
- function ht(e) {
432
- if (!e) return null;
433
- const t = /* @__PURE__ */ new Date(e + "T00:00:00");
434
- return isNaN(t.getTime()) ? null : { year: t.getFullYear(), week: q(t) };
435
- }
436
- function Et(e) {
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 = [];
438
- for (let o = n; o >= a; o--) r.push(o);
439
- return r;
440
- }
441
- function y(e) {
442
- if (!e) return null;
443
- const [t, a, n] = e.split("-").map(Number);
444
- return !t || !a || !n ? null : new Date(t, a - 1, n);
445
- }
446
- function Ee(e) {
447
- if (!e) return "";
448
- const t = e.getFullYear(), a = String(e.getMonth() + 1).padStart(2, "0"), n = String(e.getDate()).padStart(2, "0");
449
- return `${t}-${a}-${n}`;
450
- }
451
- function St({
452
- value: e,
453
- onChange: t,
454
- minIso: a,
455
- maxIso: n,
456
- placeholder: r,
457
- selectsStart: o,
458
- selectsEnd: c,
459
- startIso: l,
460
- endIso: g,
461
- className: b,
462
- disabled: i
463
- }) {
464
- return /* @__PURE__ */ u("div", { className: `ddp-field ${b ?? ""}`, children: /* @__PURE__ */ u(
465
- te,
466
- {
467
- selected: y(e),
468
- onChange: (f) => t(Ee(f)),
469
- selectsStart: o,
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,
475
- dateFormat: "dd/MM/yyyy",
476
- placeholderText: r ?? "Selecione...",
477
- disabled: i,
478
- portalId: "ddp-portal",
479
- popperPlacement: "bottom-start",
480
- popperModifiers: [
481
- {
482
- name: "flip",
483
- options: { fallbackPlacements: ["bottom-end", "top-start", "top-end"] },
484
- fn: (f) => f
485
- }
486
- ]
487
- }
488
- ) });
489
- }
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) : [],
493
- [t]
494
- ), _ = G(() => {
495
- const s = c.trim().toLowerCase();
496
- return s ? e.filter((p) => p.toLowerCase().includes(s)) : e;
497
- }, [e, c]), T = () => {
498
- const s = i.current;
499
- if (!s) return;
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({
502
- left: p.left,
503
- width: p.width,
504
- maxHeight: ee,
505
- ...k ? { bottom: window.innerHeight - p.top + h } : { top: p.bottom + h }
506
- });
507
- };
508
- ae(() => {
509
- if (!r) return;
510
- T();
511
- const s = () => T();
512
- return window.addEventListener("scroll", s, !0), window.addEventListener("resize", s), () => {
513
- window.removeEventListener("scroll", s, !0), window.removeEventListener("resize", s);
514
- };
515
- }, [r]), ne(() => {
516
- if (!r) return;
517
- const s = (p) => {
518
- var L, w;
519
- const h = p.target;
520
- (L = i.current) != null && L.contains(h) || (w = f.current) != null && w.contains(h) || o(!1);
521
- };
522
- return document.addEventListener("mousedown", s), () => document.removeEventListener("mousedown", s);
523
- }, [r]);
524
- const V = () => {
525
- o(!1), l("");
526
- }, R = (s) => {
527
- var p;
528
- n(s), l(""), o(!1), (p = i.current) == null || p.blur();
529
- }, $ = (s) => {
530
- const p = m.includes(s) ? m.filter((h) => h !== s) : [...m, s];
531
- n(p.join(Y));
532
- }, J = () => {
533
- o(!0), a || l("");
534
- }, X = (s) => {
535
- var p;
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(
539
- "div",
540
- {
541
- ref: f,
542
- className: "widget-filter__search-panel",
543
- style: {
544
- position: "fixed",
545
- left: g.left,
546
- width: g.width,
547
- top: g.top,
548
- bottom: g.bottom,
549
- maxHeight: g.maxHeight
550
- },
551
- children: /* @__PURE__ */ E("div", { className: "widget-filter__search-list", children: [
552
- a && m.length > 0 && /* @__PURE__ */ u(
553
- "button",
554
- {
555
- type: "button",
556
- className: "widget-filter__search-clear",
557
- onClick: () => n(""),
558
- children: "Limpar seleção"
559
- }
560
- ),
561
- !a && /* @__PURE__ */ E(
562
- "button",
563
- {
564
- type: "button",
565
- className: `widget-filter__search-option${t ? "" : " is-selected"}`,
566
- onClick: () => R(""),
567
- children: [
568
- /* @__PURE__ */ u("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t ? "" : "✓" }),
569
- "Todos"
570
- ]
571
- }
572
- ),
573
- _.length === 0 ? /* @__PURE__ */ u("span", { className: "widget-filter__search-empty", children: "Nenhuma opção" }) : _.map(
574
- (s) => a ? /* @__PURE__ */ E(
575
- "label",
576
- {
577
- className: `widget-filter__search-option${m.includes(s) ? " is-selected" : ""}`,
578
- children: [
579
- /* @__PURE__ */ u(
580
- "input",
581
- {
582
- type: "checkbox",
583
- checked: m.includes(s),
584
- onChange: () => $(s)
585
- }
586
- ),
587
- s
588
- ]
589
- },
590
- s
591
- ) : /* @__PURE__ */ E(
592
- "button",
593
- {
594
- type: "button",
595
- className: `widget-filter__search-option${t === s ? " is-selected" : ""}`,
596
- onClick: () => R(s),
597
- children: [
598
- /* @__PURE__ */ u("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t === s ? "✓" : "" }),
599
- s
600
- ]
601
- },
602
- s
603
- )
604
- )
605
- ] })
606
- }
607
- ),
608
- document.body
609
- ) : null;
610
- return /* @__PURE__ */ E("div", { className: "widget-filter__search", children: [
611
- /* @__PURE__ */ u(
612
- "input",
613
- {
614
- ref: i,
615
- type: "text",
616
- className: "widget-filter__search-field",
617
- value: K,
618
- placeholder: Q,
619
- onFocus: J,
620
- onClick: () => o(!0),
621
- onChange: (s) => {
622
- l(s.target.value), o(!0);
623
- },
624
- onKeyDown: X
625
- }
626
- ),
627
- Z
628
- ] });
629
- }
630
- const Se = [
631
- d.bgDark,
632
- d.bgPaper,
633
- d.bgElevated,
634
- d.accent,
635
- d.success
636
- ];
637
- function Te(e) {
638
- if (!e) return !0;
639
- const t = N(e);
640
- return Object.values(M).some(
641
- (a) => JSON.stringify(a.colors) === JSON.stringify(t)
642
- );
643
- }
644
- const Le = [
645
- { label: "Series", slots: ["series0", "series1", "series2", "series3", "series4"] },
646
- { label: "Tema", slots: ["bgDark", "bgPaper", "bgElevated", "textPrimary", "textMuted"] },
647
- { label: "Estados", slots: ["accent", "success", "error"] }
648
- ];
649
- function Lt({
650
- selected: e,
651
- onSelect: t,
652
- customMode: a,
653
- onCustomModeChange: n,
654
- disabled: r
655
- }) {
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];
661
- for (; m.length < A; ) m.push("#000000");
662
- m[i] = f, t(m);
663
- };
664
- return /* @__PURE__ */ E("div", { className: `palette-selector ${r ? "palette-selector--disabled" : ""}`, children: [
665
- n && /* @__PURE__ */ E("label", { className: "config-panel__checkbox", children: [
666
- /* @__PURE__ */ u(
667
- "input",
668
- {
669
- type: "checkbox",
670
- checked: o,
671
- onChange: (i) => n(i.target.checked),
672
- disabled: r
673
- }
674
- ),
675
- "Customizar"
676
- ] }),
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(
682
- "input",
683
- {
684
- type: "color",
685
- className: "palette-selector__color-input",
686
- value: c[m] || "#000000",
687
- onChange: (_) => g(m, _.target.value),
688
- disabled: r,
689
- title: ie[f]
690
- },
691
- f
692
- );
693
- }) })
694
- ] }, i.label)) }) : /* @__PURE__ */ u("div", { className: "palette-selector__options", children: Object.entries(M).map(([i, f]) => {
695
- const m = N(f.colors);
696
- return /* @__PURE__ */ E(
697
- "button",
698
- {
699
- className: `palette-selector__option ${l === i ? "palette-selector__option--active" : ""}`,
700
- onClick: () => t(f.colors),
701
- disabled: r,
702
- children: [
703
- /* @__PURE__ */ u("div", { className: "palette-selector__bar", children: le(f.colors).map((_, T) => /* @__PURE__ */ u(
704
- "span",
705
- {
706
- className: "palette-selector__swatch",
707
- style: { backgroundColor: _ }
708
- },
709
- T
710
- )) }),
711
- /* @__PURE__ */ u("div", { className: "palette-selector__bar palette-selector__bar--theme", children: Se.map((_, T) => /* @__PURE__ */ u(
712
- "span",
713
- {
714
- className: "palette-selector__swatch",
715
- style: { backgroundColor: m[_] }
716
- },
717
- T
718
- )) }),
719
- /* @__PURE__ */ u("span", { className: "palette-selector__label", children: f.label })
720
- ]
721
- },
722
- i
723
- );
724
- }) })
725
- ] });
726
- }
727
- export {
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,
771
- gt as ae,
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,
798
- P as x,
799
- Re as y,
800
- xe as z
801
- };
802
- //# sourceMappingURL=ColorPaletteSelector-CZP3HDNJ.js.map