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