@actionexec/dashboards 0.6.0 → 0.7.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-Bsda66uL.js → ColorPaletteSelector-BSAe2YMH.js} +230 -202
- package/dist/ColorPaletteSelector-BSAe2YMH.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 +502 -400
- package/dist/index.js.map +1 -1
- package/dist/internals.d.ts +2 -0
- package/dist/internals.js +45 -35
- package/dist/styles.css +1 -1
- package/dist/utils/grid.d.ts +77 -0
- package/package.json +1 -1
- package/dist/ColorPaletteSelector-Bsda66uL.js.map +0 -1
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { useState as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
const
|
|
6
|
-
let
|
|
7
|
-
function
|
|
8
|
-
|
|
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
9
|
}
|
|
10
|
-
class
|
|
10
|
+
class ae extends Error {
|
|
11
11
|
constructor(t, a, r) {
|
|
12
12
|
super(t), this.status = a, this.payload = r, this.name = "ApiError";
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
async function
|
|
16
|
-
const r = new URL(`${
|
|
15
|
+
async function G(e, t, a) {
|
|
16
|
+
const r = new URL(`${U}${te}${e}`);
|
|
17
17
|
if (a)
|
|
18
18
|
for (const [o, l] of Object.entries(a)) r.searchParams.set(o, l);
|
|
19
|
-
const
|
|
19
|
+
const n = await fetch(r.toString(), {
|
|
20
20
|
headers: { Authorization: `Bearer ${t}` }
|
|
21
21
|
});
|
|
22
|
-
if (!
|
|
22
|
+
if (!n.ok) {
|
|
23
23
|
let o;
|
|
24
24
|
try {
|
|
25
|
-
o = await
|
|
25
|
+
o = await n.json();
|
|
26
26
|
} catch {
|
|
27
27
|
}
|
|
28
|
-
throw new
|
|
29
|
-
`Requisicao falhou (${
|
|
30
|
-
|
|
28
|
+
throw new ae(
|
|
29
|
+
`Requisicao falhou (${n.status}) em ${e}`,
|
|
30
|
+
n.status,
|
|
31
31
|
o
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
|
-
return await
|
|
34
|
+
return await n.json();
|
|
35
35
|
}
|
|
36
|
-
const
|
|
36
|
+
const Se = (e) => G("/layout", e), we = (e, t) => G("/render", e, t), m = {
|
|
37
37
|
series0: 0,
|
|
38
38
|
series1: 1,
|
|
39
39
|
series2: 2,
|
|
@@ -47,7 +47,7 @@ const pe = (e) => R("/layout", e), me = (e, t) => R("/render", e, t), m = {
|
|
|
47
47
|
accent: 10,
|
|
48
48
|
success: 11,
|
|
49
49
|
error: 12
|
|
50
|
-
},
|
|
50
|
+
}, re = 5, L = 13, ne = {
|
|
51
51
|
series0: "Série 1",
|
|
52
52
|
series1: "Série 2",
|
|
53
53
|
series2: "Série 3",
|
|
@@ -152,20 +152,20 @@ const pe = (e) => R("/layout", e), me = (e, t) => R("/render", e, t), m = {
|
|
|
152
152
|
"#e11d48"
|
|
153
153
|
]
|
|
154
154
|
}
|
|
155
|
-
},
|
|
156
|
-
function
|
|
157
|
-
const t =
|
|
155
|
+
}, Y = v.action.colors;
|
|
156
|
+
function N(e) {
|
|
157
|
+
const t = Y;
|
|
158
158
|
if (!e || e.length === 0) return [...t];
|
|
159
|
-
if (e.length >=
|
|
159
|
+
if (e.length >= L) return e.slice(0, L);
|
|
160
160
|
const a = [...e];
|
|
161
|
-
for (let r = e.length; r <
|
|
161
|
+
for (let r = e.length; r < L; r++) a.push(t[r]);
|
|
162
162
|
return a;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
return
|
|
164
|
+
function se(e) {
|
|
165
|
+
return N(e).slice(0, re);
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
const t =
|
|
167
|
+
function De(e) {
|
|
168
|
+
const t = N(e);
|
|
169
169
|
return {
|
|
170
170
|
"--bg-dark": t[m.bgDark],
|
|
171
171
|
"--bg-paper": t[m.bgPaper],
|
|
@@ -181,11 +181,11 @@ function he(e) {
|
|
|
181
181
|
"--color-warning": t[m.series3]
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
-
const
|
|
185
|
-
gridColumns:
|
|
186
|
-
gridRows:
|
|
184
|
+
const oe = Y, ce = 30, le = 10, ye = {
|
|
185
|
+
gridColumns: ce,
|
|
186
|
+
gridRows: le,
|
|
187
187
|
widgets: []
|
|
188
|
-
},
|
|
188
|
+
}, Ne = {
|
|
189
189
|
kpi_card: "KPI Card",
|
|
190
190
|
gauge: "Gauge",
|
|
191
191
|
chart: "Gráfico",
|
|
@@ -193,35 +193,35 @@ const te = $, ae = 30, re = 10, be = {
|
|
|
193
193
|
filter: "Filtro",
|
|
194
194
|
variable: "Variável",
|
|
195
195
|
color_palette: "Paleta de Cores"
|
|
196
|
-
},
|
|
196
|
+
}, Le = ["kpi_card", "gauge", "chart", "table"], ve = ["filter", "variable", "color_palette"], Me = /* @__PURE__ */ new Set(["filter", "variable", "color_palette"]), Pe = {
|
|
197
197
|
sum: "Soma",
|
|
198
198
|
avg: "Média",
|
|
199
199
|
count: "Contagem",
|
|
200
200
|
min: "Mínimo",
|
|
201
201
|
max: "Máximo",
|
|
202
202
|
count_distinct: "Contagem Distinta"
|
|
203
|
-
},
|
|
203
|
+
}, ie = {
|
|
204
204
|
currency: "Moeda (R$)",
|
|
205
205
|
number: "Número",
|
|
206
206
|
integer: "Inteiro",
|
|
207
207
|
percentage: "Porcentagem",
|
|
208
208
|
date: "Data",
|
|
209
209
|
text: "Texto"
|
|
210
|
-
},
|
|
210
|
+
}, xe = Object.entries(ie).filter(([e]) => e !== "date" && e !== "text"), Ae = {
|
|
211
211
|
yoy: "vs Ano Anterior",
|
|
212
212
|
mom: "vs Mês Anterior",
|
|
213
213
|
target: "vs Meta",
|
|
214
214
|
none: "Nenhuma"
|
|
215
|
-
},
|
|
215
|
+
}, Ce = {
|
|
216
216
|
bar: "Barras",
|
|
217
217
|
line: "Linhas",
|
|
218
218
|
area: "Área",
|
|
219
219
|
pie: "Pizza"
|
|
220
|
-
},
|
|
220
|
+
}, ke = {
|
|
221
221
|
date_range: "Periodo",
|
|
222
222
|
select: "Seleção Única",
|
|
223
223
|
multi_select: "Seleção Múltipla"
|
|
224
|
-
},
|
|
224
|
+
}, F = "", Oe = {
|
|
225
225
|
kpi_card: { x: 0, y: 0, w: 6, h: 3 },
|
|
226
226
|
gauge: { x: 0, y: 0, w: 6, h: 5 },
|
|
227
227
|
chart: { x: 0, y: 0, w: 6, h: 6 },
|
|
@@ -229,15 +229,33 @@ const te = $, ae = 30, re = 10, be = {
|
|
|
229
229
|
filter: { x: 0, y: 0, w: 4, h: 2 },
|
|
230
230
|
variable: { x: 0, y: 0, w: 4, h: 2 },
|
|
231
231
|
color_palette: { x: 0, y: 0, w: 4, h: 2 }
|
|
232
|
-
},
|
|
232
|
+
}, Ie = {
|
|
233
233
|
kpi_card: { label: "Novo KPI", aggregation: "sum", format: "number" },
|
|
234
234
|
gauge: { label: "Novo Gauge", aggregation: "sum" },
|
|
235
235
|
chart: { label: "Novo Grafico", chartType: "bar", xAxis: { column: "", granularity: "day" }, series: [] },
|
|
236
236
|
table: { label: "Nova Tabela", columns: [] },
|
|
237
237
|
filter: { label: "Novo Filtro", filterType: "select" },
|
|
238
238
|
variable: { label: "Nova Variavel", variableValue: 0, variableFormat: "number", locked: !1 },
|
|
239
|
-
color_palette: { label: "Paleta de Cores", paletteColors:
|
|
240
|
-
},
|
|
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 = [
|
|
241
259
|
"Jan",
|
|
242
260
|
"Fev",
|
|
243
261
|
"Mar",
|
|
@@ -250,7 +268,7 @@ const te = $, ae = 30, re = 10, be = {
|
|
|
250
268
|
"Out",
|
|
251
269
|
"Nov",
|
|
252
270
|
"Dez"
|
|
253
|
-
],
|
|
271
|
+
], He = [
|
|
254
272
|
"Janeiro",
|
|
255
273
|
"Fevereiro",
|
|
256
274
|
"Marco",
|
|
@@ -264,84 +282,84 @@ const te = $, ae = 30, re = 10, be = {
|
|
|
264
282
|
"Novembro",
|
|
265
283
|
"Dezembro"
|
|
266
284
|
];
|
|
267
|
-
function
|
|
285
|
+
function We(e) {
|
|
268
286
|
return { start: `${e}-01-01`, end: `${e}-12-31` };
|
|
269
287
|
}
|
|
270
|
-
function
|
|
288
|
+
function je(e) {
|
|
271
289
|
if (!e) return null;
|
|
272
290
|
const t = e.match(/^(\d{4})/);
|
|
273
291
|
return t ? { year: parseInt(t[1]) } : null;
|
|
274
292
|
}
|
|
275
|
-
function
|
|
276
|
-
const a = new Date(e, t, 0).getDate(), r = (
|
|
293
|
+
function ze(e, t) {
|
|
294
|
+
const a = new Date(e, t, 0).getDate(), r = (n) => String(n).padStart(2, "0");
|
|
277
295
|
return {
|
|
278
296
|
start: `${e}-${r(t)}-01`,
|
|
279
297
|
end: `${e}-${r(t)}-${r(a)}`
|
|
280
298
|
};
|
|
281
299
|
}
|
|
282
|
-
function
|
|
300
|
+
function H(e) {
|
|
283
301
|
const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate()));
|
|
284
302
|
t.setUTCDate(t.getUTCDate() + 4 - (t.getUTCDay() || 7));
|
|
285
303
|
const a = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
|
|
286
304
|
return Math.ceil(((t.getTime() - a.getTime()) / 864e5 + 1) / 7);
|
|
287
305
|
}
|
|
288
|
-
function
|
|
289
|
-
const a = new Date(e, 0, 4), r = (a.getDay() + 6) % 7,
|
|
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())}`;
|
|
290
308
|
return { start: f(o), end: f(l) };
|
|
291
309
|
}
|
|
292
|
-
function
|
|
310
|
+
function Ve(e, t) {
|
|
293
311
|
const a = /* @__PURE__ */ new Set(), r = new Date(e, t, 0).getDate();
|
|
294
|
-
for (let
|
|
295
|
-
a.add(
|
|
296
|
-
return Array.from(a).sort((
|
|
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);
|
|
297
315
|
}
|
|
298
|
-
function
|
|
299
|
-
const a = new Date(e, t, 0).getDate(), r = (d) => String(d).padStart(2, "0"),
|
|
316
|
+
function Xe(e, t) {
|
|
317
|
+
const a = new Date(e, t, 0).getDate(), r = (d) => String(d).padStart(2, "0"), n = [];
|
|
300
318
|
let o = 1, l = 1;
|
|
301
319
|
for (; o <= a; ) {
|
|
302
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)})`;
|
|
303
|
-
|
|
321
|
+
n.push({ index: l, startDay: d, endDay: f, start: h, end: c, label: u }), o = f + 1, l++;
|
|
304
322
|
}
|
|
305
|
-
return
|
|
323
|
+
return n;
|
|
306
324
|
}
|
|
307
|
-
function
|
|
325
|
+
function qe(e, t, a) {
|
|
308
326
|
if (!e) return 1;
|
|
309
|
-
const r = (l) => String(l).padStart(2, "0"),
|
|
310
|
-
if (!
|
|
311
|
-
const o = parseInt(
|
|
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]);
|
|
312
330
|
return Math.ceil(o / 7);
|
|
313
331
|
}
|
|
314
|
-
function
|
|
332
|
+
function Ke(e) {
|
|
315
333
|
if (!e) return null;
|
|
316
334
|
const t = e.match(/^(\d{4})-(\d{2})/);
|
|
317
335
|
return t ? { year: parseInt(t[1]), month: parseInt(t[2]) } : null;
|
|
318
336
|
}
|
|
319
|
-
function
|
|
337
|
+
function Be(e) {
|
|
320
338
|
if (!e) return null;
|
|
321
339
|
const t = /* @__PURE__ */ new Date(e + "T00:00:00");
|
|
322
|
-
return isNaN(t.getTime()) ? null : { year: t.getFullYear(), week:
|
|
340
|
+
return isNaN(t.getTime()) ? null : { year: t.getFullYear(), week: H(t) };
|
|
323
341
|
}
|
|
324
|
-
function
|
|
325
|
-
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(),
|
|
326
|
-
for (let o = r; o >= a; o--)
|
|
327
|
-
return
|
|
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;
|
|
328
346
|
}
|
|
329
347
|
function y(e) {
|
|
330
348
|
if (!e) return null;
|
|
331
349
|
const [t, a, r] = e.split("-").map(Number);
|
|
332
350
|
return !t || !a || !r ? null : new Date(t, a - 1, r);
|
|
333
351
|
}
|
|
334
|
-
function
|
|
352
|
+
function fe(e) {
|
|
335
353
|
if (!e) return "";
|
|
336
354
|
const t = e.getFullYear(), a = String(e.getMonth() + 1).padStart(2, "0"), r = String(e.getDate()).padStart(2, "0");
|
|
337
355
|
return `${t}-${a}-${r}`;
|
|
338
356
|
}
|
|
339
|
-
function
|
|
357
|
+
function Ze({
|
|
340
358
|
value: e,
|
|
341
359
|
onChange: t,
|
|
342
360
|
minIso: a,
|
|
343
361
|
maxIso: r,
|
|
344
|
-
placeholder:
|
|
362
|
+
placeholder: n,
|
|
345
363
|
selectsStart: o,
|
|
346
364
|
selectsEnd: l,
|
|
347
365
|
startIso: d,
|
|
@@ -350,10 +368,10 @@ function Ge({
|
|
|
350
368
|
disabled: c
|
|
351
369
|
}) {
|
|
352
370
|
return /* @__PURE__ */ i("div", { className: `ddp-field ${h ?? ""}`, children: /* @__PURE__ */ i(
|
|
353
|
-
|
|
371
|
+
K,
|
|
354
372
|
{
|
|
355
373
|
selected: y(e),
|
|
356
|
-
onChange: (u) => t(
|
|
374
|
+
onChange: (u) => t(fe(u)),
|
|
357
375
|
selectsStart: o,
|
|
358
376
|
selectsEnd: l,
|
|
359
377
|
startDate: y(d) ?? void 0,
|
|
@@ -361,7 +379,7 @@ function Ge({
|
|
|
361
379
|
minDate: y(a) ?? void 0,
|
|
362
380
|
maxDate: y(r) ?? void 0,
|
|
363
381
|
dateFormat: "dd/MM/yyyy",
|
|
364
|
-
placeholderText:
|
|
382
|
+
placeholderText: n ?? "Selecione...",
|
|
365
383
|
disabled: c,
|
|
366
384
|
portalId: "ddp-portal",
|
|
367
385
|
popperPlacement: "bottom-start",
|
|
@@ -375,54 +393,54 @@ function Ge({
|
|
|
375
393
|
}
|
|
376
394
|
) });
|
|
377
395
|
}
|
|
378
|
-
function
|
|
379
|
-
const [
|
|
380
|
-
() => t ? t.split(
|
|
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) : [],
|
|
381
399
|
[t]
|
|
382
|
-
), b =
|
|
383
|
-
const
|
|
384
|
-
return
|
|
385
|
-
}, [e, l]),
|
|
386
|
-
const
|
|
387
|
-
if (!
|
|
388
|
-
const p =
|
|
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));
|
|
389
407
|
h({
|
|
390
408
|
left: p.left,
|
|
391
409
|
width: p.width,
|
|
392
|
-
maxHeight:
|
|
393
|
-
...
|
|
410
|
+
maxHeight: q,
|
|
411
|
+
...I ? { bottom: window.innerHeight - p.top + _ } : { top: p.bottom + _ }
|
|
394
412
|
});
|
|
395
413
|
};
|
|
396
|
-
|
|
397
|
-
if (!
|
|
398
|
-
|
|
399
|
-
const
|
|
400
|
-
return window.addEventListener("scroll",
|
|
401
|
-
window.removeEventListener("scroll",
|
|
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);
|
|
402
420
|
};
|
|
403
|
-
}, [
|
|
404
|
-
if (!
|
|
405
|
-
const
|
|
406
|
-
var
|
|
421
|
+
}, [n]), Q(() => {
|
|
422
|
+
if (!n) return;
|
|
423
|
+
const s = (p) => {
|
|
424
|
+
var w, D;
|
|
407
425
|
const _ = p.target;
|
|
408
|
-
(
|
|
426
|
+
(w = c.current) != null && w.contains(_) || (D = u.current) != null && D.contains(_) || o(!1);
|
|
409
427
|
};
|
|
410
|
-
return document.addEventListener("mousedown",
|
|
411
|
-
}, [
|
|
412
|
-
const
|
|
428
|
+
return document.addEventListener("mousedown", s), () => document.removeEventListener("mousedown", s);
|
|
429
|
+
}, [n]);
|
|
430
|
+
const W = () => {
|
|
413
431
|
o(!1), d("");
|
|
414
|
-
},
|
|
432
|
+
}, M = (s) => {
|
|
415
433
|
var p;
|
|
416
|
-
r(
|
|
417
|
-
},
|
|
418
|
-
const p = g.includes(
|
|
419
|
-
r(p.join(
|
|
420
|
-
},
|
|
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 = () => {
|
|
421
439
|
o(!0), a || d("");
|
|
422
|
-
},
|
|
440
|
+
}, z = (s) => {
|
|
423
441
|
var p;
|
|
424
|
-
|
|
425
|
-
},
|
|
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(
|
|
426
444
|
/* @__PURE__ */ i(
|
|
427
445
|
"div",
|
|
428
446
|
{
|
|
@@ -436,7 +454,7 @@ function We({ options: e, value: t, multi: a, onChange: r }) {
|
|
|
436
454
|
bottom: f.bottom,
|
|
437
455
|
maxHeight: f.maxHeight
|
|
438
456
|
},
|
|
439
|
-
children: /* @__PURE__ */
|
|
457
|
+
children: /* @__PURE__ */ T("div", { className: "widget-filter__search-list", children: [
|
|
440
458
|
a && g.length > 0 && /* @__PURE__ */ i(
|
|
441
459
|
"button",
|
|
442
460
|
{
|
|
@@ -446,12 +464,12 @@ function We({ options: e, value: t, multi: a, onChange: r }) {
|
|
|
446
464
|
children: "Limpar seleção"
|
|
447
465
|
}
|
|
448
466
|
),
|
|
449
|
-
!a && /* @__PURE__ */
|
|
467
|
+
!a && /* @__PURE__ */ T(
|
|
450
468
|
"button",
|
|
451
469
|
{
|
|
452
470
|
type: "button",
|
|
453
471
|
className: `widget-filter__search-option${t ? "" : " is-selected"}`,
|
|
454
|
-
onClick: () =>
|
|
472
|
+
onClick: () => M(""),
|
|
455
473
|
children: [
|
|
456
474
|
/* @__PURE__ */ i("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t ? "" : "✓" }),
|
|
457
475
|
"Todos"
|
|
@@ -459,35 +477,35 @@ function We({ options: e, value: t, multi: a, onChange: r }) {
|
|
|
459
477
|
}
|
|
460
478
|
),
|
|
461
479
|
b.length === 0 ? /* @__PURE__ */ i("span", { className: "widget-filter__search-empty", children: "Nenhuma opção" }) : b.map(
|
|
462
|
-
(
|
|
480
|
+
(s) => a ? /* @__PURE__ */ T(
|
|
463
481
|
"label",
|
|
464
482
|
{
|
|
465
|
-
className: `widget-filter__search-option${g.includes(
|
|
483
|
+
className: `widget-filter__search-option${g.includes(s) ? " is-selected" : ""}`,
|
|
466
484
|
children: [
|
|
467
485
|
/* @__PURE__ */ i(
|
|
468
486
|
"input",
|
|
469
487
|
{
|
|
470
488
|
type: "checkbox",
|
|
471
|
-
checked: g.includes(
|
|
472
|
-
onChange: () =>
|
|
489
|
+
checked: g.includes(s),
|
|
490
|
+
onChange: () => O(s)
|
|
473
491
|
}
|
|
474
492
|
),
|
|
475
|
-
|
|
493
|
+
s
|
|
476
494
|
]
|
|
477
495
|
},
|
|
478
|
-
|
|
479
|
-
) : /* @__PURE__ */
|
|
496
|
+
s
|
|
497
|
+
) : /* @__PURE__ */ T(
|
|
480
498
|
"button",
|
|
481
499
|
{
|
|
482
500
|
type: "button",
|
|
483
|
-
className: `widget-filter__search-option${t ===
|
|
484
|
-
onClick: () =>
|
|
501
|
+
className: `widget-filter__search-option${t === s ? " is-selected" : ""}`,
|
|
502
|
+
onClick: () => M(s),
|
|
485
503
|
children: [
|
|
486
|
-
/* @__PURE__ */ i("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t ===
|
|
487
|
-
|
|
504
|
+
/* @__PURE__ */ i("span", { className: "widget-filter__search-check", "aria-hidden": !0, children: t === s ? "✓" : "" }),
|
|
505
|
+
s
|
|
488
506
|
]
|
|
489
507
|
},
|
|
490
|
-
|
|
508
|
+
s
|
|
491
509
|
)
|
|
492
510
|
)
|
|
493
511
|
] })
|
|
@@ -495,74 +513,74 @@ function We({ options: e, value: t, multi: a, onChange: r }) {
|
|
|
495
513
|
),
|
|
496
514
|
document.body
|
|
497
515
|
) : null;
|
|
498
|
-
return /* @__PURE__ */
|
|
516
|
+
return /* @__PURE__ */ T("div", { className: "widget-filter__search", children: [
|
|
499
517
|
/* @__PURE__ */ i(
|
|
500
518
|
"input",
|
|
501
519
|
{
|
|
502
520
|
ref: c,
|
|
503
521
|
type: "text",
|
|
504
522
|
className: "widget-filter__search-field",
|
|
505
|
-
value:
|
|
506
|
-
placeholder:
|
|
507
|
-
onFocus:
|
|
523
|
+
value: J,
|
|
524
|
+
placeholder: V,
|
|
525
|
+
onFocus: j,
|
|
508
526
|
onClick: () => o(!0),
|
|
509
|
-
onChange: (
|
|
510
|
-
d(
|
|
527
|
+
onChange: (s) => {
|
|
528
|
+
d(s.target.value), o(!0);
|
|
511
529
|
},
|
|
512
|
-
onKeyDown:
|
|
530
|
+
onKeyDown: z
|
|
513
531
|
}
|
|
514
532
|
),
|
|
515
|
-
|
|
533
|
+
X
|
|
516
534
|
] });
|
|
517
535
|
}
|
|
518
|
-
const
|
|
536
|
+
const ge = [
|
|
519
537
|
m.bgDark,
|
|
520
538
|
m.bgPaper,
|
|
521
539
|
m.bgElevated,
|
|
522
540
|
m.accent,
|
|
523
541
|
m.success
|
|
524
542
|
];
|
|
525
|
-
function
|
|
543
|
+
function pe(e) {
|
|
526
544
|
if (!e) return !0;
|
|
527
|
-
const t =
|
|
545
|
+
const t = N(e);
|
|
528
546
|
return Object.values(v).some(
|
|
529
547
|
(a) => JSON.stringify(a.colors) === JSON.stringify(t)
|
|
530
548
|
);
|
|
531
549
|
}
|
|
532
|
-
const
|
|
550
|
+
const me = [
|
|
533
551
|
{ label: "Series", slots: ["series0", "series1", "series2", "series3", "series4"] },
|
|
534
552
|
{ label: "Tema", slots: ["bgDark", "bgPaper", "bgElevated", "textPrimary", "textMuted"] },
|
|
535
553
|
{ label: "Estados", slots: ["accent", "success", "error"] }
|
|
536
554
|
];
|
|
537
|
-
function
|
|
555
|
+
function tt({
|
|
538
556
|
selected: e,
|
|
539
557
|
onSelect: t,
|
|
540
558
|
customMode: a,
|
|
541
559
|
onCustomModeChange: r,
|
|
542
|
-
disabled:
|
|
560
|
+
disabled: n
|
|
543
561
|
}) {
|
|
544
562
|
var h;
|
|
545
|
-
const o = a ?? !
|
|
563
|
+
const o = a ?? !pe(e), l = N(e), d = o || (h = Object.entries(v).find(
|
|
546
564
|
([, c]) => JSON.stringify(c.colors) === JSON.stringify(l)
|
|
547
565
|
)) == null ? void 0 : h[0], f = (c, u) => {
|
|
548
566
|
const g = [...l];
|
|
549
|
-
for (; g.length <
|
|
567
|
+
for (; g.length < L; ) g.push("#000000");
|
|
550
568
|
g[c] = u, t(g);
|
|
551
569
|
};
|
|
552
|
-
return /* @__PURE__ */
|
|
553
|
-
r && /* @__PURE__ */
|
|
570
|
+
return /* @__PURE__ */ T("div", { className: `palette-selector ${n ? "palette-selector--disabled" : ""}`, children: [
|
|
571
|
+
r && /* @__PURE__ */ T("label", { className: "config-panel__checkbox", children: [
|
|
554
572
|
/* @__PURE__ */ i(
|
|
555
573
|
"input",
|
|
556
574
|
{
|
|
557
575
|
type: "checkbox",
|
|
558
576
|
checked: o,
|
|
559
577
|
onChange: (c) => r(c.target.checked),
|
|
560
|
-
disabled:
|
|
578
|
+
disabled: n
|
|
561
579
|
}
|
|
562
580
|
),
|
|
563
581
|
"Customizar"
|
|
564
582
|
] }),
|
|
565
|
-
o ? /* @__PURE__ */ i("div", { className: "palette-selector__custom", children:
|
|
583
|
+
o ? /* @__PURE__ */ i("div", { className: "palette-selector__custom", children: me.map((c) => /* @__PURE__ */ T("div", { className: "palette-selector__row", children: [
|
|
566
584
|
/* @__PURE__ */ i("span", { className: "palette-selector__row-label", children: c.label }),
|
|
567
585
|
/* @__PURE__ */ i("div", { className: "palette-selector__row-slots", children: c.slots.map((u) => {
|
|
568
586
|
const g = m[u];
|
|
@@ -573,36 +591,36 @@ function je({
|
|
|
573
591
|
className: "palette-selector__color-input",
|
|
574
592
|
value: l[g] || "#000000",
|
|
575
593
|
onChange: (b) => f(g, b.target.value),
|
|
576
|
-
disabled:
|
|
577
|
-
title:
|
|
594
|
+
disabled: n,
|
|
595
|
+
title: ne[u]
|
|
578
596
|
},
|
|
579
597
|
u
|
|
580
598
|
);
|
|
581
599
|
}) })
|
|
582
600
|
] }, c.label)) }) : /* @__PURE__ */ i("div", { className: "palette-selector__options", children: Object.entries(v).map(([c, u]) => {
|
|
583
|
-
const g =
|
|
584
|
-
return /* @__PURE__ */
|
|
601
|
+
const g = N(u.colors);
|
|
602
|
+
return /* @__PURE__ */ T(
|
|
585
603
|
"button",
|
|
586
604
|
{
|
|
587
605
|
className: `palette-selector__option ${d === c ? "palette-selector__option--active" : ""}`,
|
|
588
606
|
onClick: () => t(u.colors),
|
|
589
|
-
disabled:
|
|
607
|
+
disabled: n,
|
|
590
608
|
children: [
|
|
591
|
-
/* @__PURE__ */ i("div", { className: "palette-selector__bar", children:
|
|
609
|
+
/* @__PURE__ */ i("div", { className: "palette-selector__bar", children: se(u.colors).map((b, S) => /* @__PURE__ */ i(
|
|
592
610
|
"span",
|
|
593
611
|
{
|
|
594
612
|
className: "palette-selector__swatch",
|
|
595
613
|
style: { backgroundColor: b }
|
|
596
614
|
},
|
|
597
|
-
|
|
615
|
+
S
|
|
598
616
|
)) }),
|
|
599
|
-
/* @__PURE__ */ i("div", { className: "palette-selector__bar palette-selector__bar--theme", children:
|
|
617
|
+
/* @__PURE__ */ i("div", { className: "palette-selector__bar palette-selector__bar--theme", children: ge.map((b, S) => /* @__PURE__ */ i(
|
|
600
618
|
"span",
|
|
601
619
|
{
|
|
602
620
|
className: "palette-selector__swatch",
|
|
603
621
|
style: { backgroundColor: g[b] }
|
|
604
622
|
},
|
|
605
|
-
|
|
623
|
+
S
|
|
606
624
|
)) }),
|
|
607
625
|
/* @__PURE__ */ i("span", { className: "palette-selector__label", children: u.label })
|
|
608
626
|
]
|
|
@@ -613,53 +631,63 @@ function je({
|
|
|
613
631
|
] });
|
|
614
632
|
}
|
|
615
633
|
export {
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
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,
|
|
631
650
|
v as P,
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
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
|
|
664
692
|
};
|
|
665
|
-
//# sourceMappingURL=ColorPaletteSelector-
|
|
693
|
+
//# sourceMappingURL=ColorPaletteSelector-BSAe2YMH.js.map
|