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