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