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