@hemerson/design-system 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/components/BarChart/BarChart.d.ts +34 -0
- package/dist/components/DateInput/DateInput.d.ts +3 -1
- package/dist/components/Input/Input.d.ts +2 -0
- package/dist/components/Select/Select.d.ts +2 -0
- package/dist/components/Typeahead/Typeahead.d.ts +3 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +294 -187
- package/dist/index.js.map +1 -1
- package/dist/styles.css +154 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -111,14 +111,14 @@ var O = l(function({ variant: e = "primary", size: t = "md", icon: n, iconOnly:
|
|
|
111
111
|
});
|
|
112
112
|
//#endregion
|
|
113
113
|
//#region src/components/NavBar/NavBar.tsx
|
|
114
|
-
function
|
|
114
|
+
function ee({ active: e = !1, className: t, ...n }) {
|
|
115
115
|
return /* @__PURE__ */ b("a", {
|
|
116
116
|
...n,
|
|
117
117
|
"aria-current": e ? "page" : void 0,
|
|
118
118
|
className: C("hds-navbar-link", t)
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function k({ title: e, actions: t, navLabel: n = "Principal", className: r, children: i, ...a }) {
|
|
122
122
|
return /* @__PURE__ */ x(w, {
|
|
123
123
|
...a,
|
|
124
124
|
as: "header",
|
|
@@ -140,10 +140,10 @@ function A({ title: e, actions: t, navLabel: n = "Principal", className: r, chil
|
|
|
140
140
|
]
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
|
-
var
|
|
143
|
+
var A = Object.assign(k, { Link: ee });
|
|
144
144
|
//#endregion
|
|
145
145
|
//#region src/components/Sidebar/Sidebar.tsx
|
|
146
|
-
function
|
|
146
|
+
function j({ items: e, footer: t, floating: n = !1, label: r = "Navegação", className: i }) {
|
|
147
147
|
return /* @__PURE__ */ x(w, {
|
|
148
148
|
as: "nav",
|
|
149
149
|
"aria-label": r,
|
|
@@ -177,13 +177,13 @@ function M({ items: e, footer: t, floating: n = !1, label: r = "Navegação", cl
|
|
|
177
177
|
}
|
|
178
178
|
//#endregion
|
|
179
179
|
//#region src/components/SegmentedControl/SegmentedControl.tsx
|
|
180
|
-
var
|
|
180
|
+
var M = {
|
|
181
181
|
ArrowRight: 1,
|
|
182
182
|
ArrowDown: 1,
|
|
183
183
|
ArrowLeft: -1,
|
|
184
184
|
ArrowUp: -1
|
|
185
185
|
};
|
|
186
|
-
function
|
|
186
|
+
function N({ options: e, value: t, defaultValue: n, onChange: r, label: i, className: a }) {
|
|
187
187
|
let [o, s] = _(n ?? e[0]?.value), c = t === void 0 ? o : t, l = g([]), u = g(null), d = Math.max(0, e.findIndex((e) => e.value === c));
|
|
188
188
|
m(() => {
|
|
189
189
|
function e() {
|
|
@@ -196,7 +196,7 @@ function P({ options: e, value: t, defaultValue: n, onChange: r, label: i, class
|
|
|
196
196
|
t === void 0 && s(e), r?.(e);
|
|
197
197
|
}
|
|
198
198
|
function p(t) {
|
|
199
|
-
let n =
|
|
199
|
+
let n = M[t.key];
|
|
200
200
|
if (!n) return;
|
|
201
201
|
t.preventDefault();
|
|
202
202
|
let r = (d + n + e.length) % e.length;
|
|
@@ -230,13 +230,13 @@ function P({ options: e, value: t, defaultValue: n, onChange: r, label: i, class
|
|
|
230
230
|
})]
|
|
231
231
|
});
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function te(e, t, n) {
|
|
234
234
|
let r = e.getBoundingClientRect(), i = t.offsetWidth, a = t.offsetHeight, o = document.documentElement.clientWidth || window.innerWidth, s = document.documentElement.clientHeight || window.innerHeight, c = r.bottom + 8 + a <= s - 8, l = r.top - 8 - a >= 8, u = c || !l ? r.bottom + 8 : r.top - 8 - a, d = n === "end" ? r.right - i : r.left, f = Math.min(Math.max(8, d), Math.max(8, o - i - 8));
|
|
235
235
|
t.style.top = `${Math.round(u)}px`, t.style.left = `${Math.round(f)}px`, t.dataset.side = c || !l ? "bottom" : "top";
|
|
236
236
|
}
|
|
237
237
|
//#endregion
|
|
238
238
|
//#region src/components/Menu/Menu.tsx
|
|
239
|
-
function
|
|
239
|
+
function P({ label: e, icon: t, iconOnly: n = !1, items: r, align: i = "end", triggerVariant: a = "glass", header: o, className: s }) {
|
|
240
240
|
let [c, l] = _(!1), u = g(null), d = g(null), h = p(), v = () => Array.from(d.current?.querySelectorAll("[role=\"menuitem\"]") ?? []);
|
|
241
241
|
function T(e) {
|
|
242
242
|
l(!1), e && u.current?.focus();
|
|
@@ -244,7 +244,7 @@ function F({ label: e, icon: t, iconOnly: n = !1, items: r, align: i = "end", tr
|
|
|
244
244
|
m(() => {
|
|
245
245
|
if (!c || !u.current || !d.current) return;
|
|
246
246
|
let e = () => {
|
|
247
|
-
u.current && d.current &&
|
|
247
|
+
u.current && d.current && te(u.current, d.current, i);
|
|
248
248
|
};
|
|
249
249
|
return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
250
250
|
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
@@ -309,7 +309,7 @@ function F({ label: e, icon: t, iconOnly: n = !1, items: r, align: i = "end", tr
|
|
|
309
309
|
}
|
|
310
310
|
//#endregion
|
|
311
311
|
//#region src/components/FloatingButton/FloatingButton.tsx
|
|
312
|
-
var
|
|
312
|
+
var F = l(function({ label: e, position: t = "bottom-right", type: n = "button", className: r, ...i }, a) {
|
|
313
313
|
return /* @__PURE__ */ b("button", {
|
|
314
314
|
...i,
|
|
315
315
|
ref: a,
|
|
@@ -318,8 +318,8 @@ var I = l(function({ label: e, position: t = "bottom-right", type: n = "button",
|
|
|
318
318
|
title: e,
|
|
319
319
|
className: C("hds-glass", "hds-fab", `hds-fab--${t}`, r)
|
|
320
320
|
});
|
|
321
|
-
}),
|
|
322
|
-
function
|
|
321
|
+
}), I = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
|
|
322
|
+
function L({ open: e, onClose: t, title: n, description: r, children: i, footer: a, closeLabel: o = "Fechar", initialFocus: s = "first", size: c = "md", className: l }) {
|
|
323
323
|
let u = g(null), d = p(), m = p(), h = g(t);
|
|
324
324
|
return f(() => {
|
|
325
325
|
h.current = t;
|
|
@@ -327,7 +327,7 @@ function R({ open: e, onClose: t, title: n, description: r, children: i, footer:
|
|
|
327
327
|
if (!e) return;
|
|
328
328
|
let t = document.activeElement, n = document.body.style.overflow;
|
|
329
329
|
document.body.style.overflow = "hidden";
|
|
330
|
-
let r = u.current?.querySelectorAll(
|
|
330
|
+
let r = u.current?.querySelectorAll(I) ?? [];
|
|
331
331
|
(s === "panel" || r.length === 0 ? u.current : r[0])?.focus();
|
|
332
332
|
function i(e) {
|
|
333
333
|
if (e.key === "Escape") {
|
|
@@ -336,7 +336,7 @@ function R({ open: e, onClose: t, title: n, description: r, children: i, footer:
|
|
|
336
336
|
return;
|
|
337
337
|
}
|
|
338
338
|
if (e.key !== "Tab" || !u.current) return;
|
|
339
|
-
let t = Array.from(u.current.querySelectorAll(
|
|
339
|
+
let t = Array.from(u.current.querySelectorAll(I));
|
|
340
340
|
if (t.length === 0) return;
|
|
341
341
|
let n = t[0], r = t[t.length - 1];
|
|
342
342
|
e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus());
|
|
@@ -389,13 +389,13 @@ function R({ open: e, onClose: t, title: n, description: r, children: i, footer:
|
|
|
389
389
|
}
|
|
390
390
|
//#endregion
|
|
391
391
|
//#region src/components/Toast/ToastView.tsx
|
|
392
|
-
var
|
|
392
|
+
var R = {
|
|
393
393
|
neutral: "info",
|
|
394
394
|
success: "circle-check",
|
|
395
395
|
warning: "triangle-alert",
|
|
396
396
|
danger: "circle-x"
|
|
397
397
|
};
|
|
398
|
-
function
|
|
398
|
+
function z({ tone: e, title: t, description: n, duration: r, onClose: i, closeLabel: a, className: o }) {
|
|
399
399
|
let [s, c] = _(!1), l = g(i);
|
|
400
400
|
return f(() => {
|
|
401
401
|
l.current = i;
|
|
@@ -411,7 +411,7 @@ function B({ tone: e, title: t, description: n, duration: r, onClose: i, closeLa
|
|
|
411
411
|
onFocus: () => c(!0),
|
|
412
412
|
onBlur: () => c(!1),
|
|
413
413
|
children: [
|
|
414
|
-
/* @__PURE__ */ b(D, { name:
|
|
414
|
+
/* @__PURE__ */ b(D, { name: R[e] }),
|
|
415
415
|
/* @__PURE__ */ x("div", {
|
|
416
416
|
className: "hds-toast-body",
|
|
417
417
|
children: [/* @__PURE__ */ b("p", {
|
|
@@ -435,10 +435,10 @@ function B({ tone: e, title: t, description: n, duration: r, onClose: i, closeLa
|
|
|
435
435
|
}
|
|
436
436
|
//#endregion
|
|
437
437
|
//#region src/components/Toast/Toast.tsx
|
|
438
|
-
function
|
|
438
|
+
function B({ open: e, onClose: t, tone: n = "neutral", title: r, description: i, duration: a = 5e3, closeLabel: o = "Fechar aviso", className: s }) {
|
|
439
439
|
return e ? S(/* @__PURE__ */ b("div", {
|
|
440
440
|
className: "hds-toast-region",
|
|
441
|
-
children: /* @__PURE__ */ b(
|
|
441
|
+
children: /* @__PURE__ */ b(z, {
|
|
442
442
|
tone: n,
|
|
443
443
|
title: r,
|
|
444
444
|
description: i,
|
|
@@ -451,8 +451,8 @@ function V({ open: e, onClose: t, tone: n = "neutral", title: r, description: i,
|
|
|
451
451
|
}
|
|
452
452
|
//#endregion
|
|
453
453
|
//#region src/components/Toast/ToastProvider.tsx
|
|
454
|
-
var
|
|
455
|
-
function
|
|
454
|
+
var V = c(null);
|
|
455
|
+
function ne({ children: e, max: t = 3, closeLabel: n = "Fechar aviso" }) {
|
|
456
456
|
let [r, i] = _([]), a = g(0), o = u((e) => {
|
|
457
457
|
i((t) => t.filter((t) => t.id !== e));
|
|
458
458
|
}, []), s = u(({ title: e, description: n, tone: r = "neutral", duration: o = 5e3 }) => {
|
|
@@ -488,11 +488,11 @@ function U({ children: e, max: t = 3, closeLabel: n = "Fechar aviso" }) {
|
|
|
488
488
|
tone: "neutral"
|
|
489
489
|
})
|
|
490
490
|
}), [s, o]);
|
|
491
|
-
return /* @__PURE__ */ x(
|
|
491
|
+
return /* @__PURE__ */ x(V.Provider, {
|
|
492
492
|
value: c,
|
|
493
493
|
children: [e, r.length ? S(/* @__PURE__ */ b("div", {
|
|
494
494
|
className: "hds-toast-region",
|
|
495
|
-
children: r.map((e) => /* @__PURE__ */ b(
|
|
495
|
+
children: r.map((e) => /* @__PURE__ */ b(z, {
|
|
496
496
|
tone: e.tone,
|
|
497
497
|
title: e.title,
|
|
498
498
|
description: e.description,
|
|
@@ -503,14 +503,14 @@ function U({ children: e, max: t = 3, closeLabel: n = "Fechar aviso" }) {
|
|
|
503
503
|
}), document.body) : null]
|
|
504
504
|
});
|
|
505
505
|
}
|
|
506
|
-
function
|
|
507
|
-
let e = d(
|
|
506
|
+
function H() {
|
|
507
|
+
let e = d(V);
|
|
508
508
|
if (!e) throw Error("useToast must be used inside a ToastProvider.");
|
|
509
509
|
return e;
|
|
510
510
|
}
|
|
511
511
|
//#endregion
|
|
512
512
|
//#region src/internal/field.tsx
|
|
513
|
-
function
|
|
513
|
+
function U(e) {
|
|
514
514
|
let t = p(), n = e ?? t;
|
|
515
515
|
return {
|
|
516
516
|
id: n,
|
|
@@ -518,7 +518,7 @@ function G(e) {
|
|
|
518
518
|
error: `${n}-error`
|
|
519
519
|
};
|
|
520
520
|
}
|
|
521
|
-
function
|
|
521
|
+
function W(e, t) {
|
|
522
522
|
let n = [
|
|
523
523
|
e.hint && t.hint,
|
|
524
524
|
e.error && t.error,
|
|
@@ -526,7 +526,7 @@ function K(e, t) {
|
|
|
526
526
|
].filter(Boolean);
|
|
527
527
|
return n.length ? n.join(" ") : void 0;
|
|
528
528
|
}
|
|
529
|
-
function
|
|
529
|
+
function re({ hint: e, error: t, ids: n }) {
|
|
530
530
|
return /* @__PURE__ */ x(y, { children: [e ? /* @__PURE__ */ b("p", {
|
|
531
531
|
id: n.hint,
|
|
532
532
|
className: "hds-hint",
|
|
@@ -539,58 +539,58 @@ function q({ hint: e, error: t, ids: n }) {
|
|
|
539
539
|
}
|
|
540
540
|
//#endregion
|
|
541
541
|
//#region src/components/Input/Input.tsx
|
|
542
|
-
var
|
|
543
|
-
let
|
|
542
|
+
var G = l(function({ label: e, hint: t, error: n, numeric: r = !1, hideLabel: i = !1, id: a, className: o, ...s }, c) {
|
|
543
|
+
let l = U(a);
|
|
544
544
|
return /* @__PURE__ */ x("div", {
|
|
545
|
-
className: C("hds-field",
|
|
545
|
+
className: C("hds-field", o),
|
|
546
546
|
children: [
|
|
547
547
|
/* @__PURE__ */ b("label", {
|
|
548
|
-
className: "hds-label",
|
|
549
|
-
htmlFor:
|
|
548
|
+
className: C("hds-label", i && "hds-visually-hidden"),
|
|
549
|
+
htmlFor: l.id,
|
|
550
550
|
children: e
|
|
551
551
|
}),
|
|
552
552
|
/* @__PURE__ */ b("input", {
|
|
553
553
|
inputMode: r ? "decimal" : void 0,
|
|
554
|
-
...
|
|
555
|
-
ref:
|
|
556
|
-
id:
|
|
554
|
+
...s,
|
|
555
|
+
ref: c,
|
|
556
|
+
id: l.id,
|
|
557
557
|
"aria-invalid": n ? !0 : void 0,
|
|
558
|
-
"aria-describedby":
|
|
558
|
+
"aria-describedby": W({
|
|
559
559
|
hint: t,
|
|
560
560
|
error: n,
|
|
561
|
-
"aria-describedby":
|
|
562
|
-
},
|
|
561
|
+
"aria-describedby": s["aria-describedby"]
|
|
562
|
+
}, l),
|
|
563
563
|
className: C("hds-input", r && "hds-input--numeric")
|
|
564
564
|
}),
|
|
565
|
-
/* @__PURE__ */ b(
|
|
565
|
+
/* @__PURE__ */ b(re, {
|
|
566
566
|
hint: t,
|
|
567
567
|
error: n,
|
|
568
|
-
ids:
|
|
568
|
+
ids: l
|
|
569
569
|
})
|
|
570
570
|
]
|
|
571
571
|
});
|
|
572
|
-
}),
|
|
573
|
-
let
|
|
572
|
+
}), ie = l(function({ label: e, options: t, placeholder: n, hint: r, error: i, hideLabel: a = !1, id: o, className: s, ...c }, l) {
|
|
573
|
+
let u = U(o);
|
|
574
574
|
return /* @__PURE__ */ x("div", {
|
|
575
|
-
className: C("hds-field",
|
|
575
|
+
className: C("hds-field", s),
|
|
576
576
|
children: [
|
|
577
577
|
/* @__PURE__ */ b("label", {
|
|
578
|
-
className: "hds-label",
|
|
579
|
-
htmlFor:
|
|
578
|
+
className: C("hds-label", a && "hds-visually-hidden"),
|
|
579
|
+
htmlFor: u.id,
|
|
580
580
|
children: e
|
|
581
581
|
}),
|
|
582
582
|
/* @__PURE__ */ x("div", {
|
|
583
583
|
className: "hds-select-wrap",
|
|
584
584
|
children: [/* @__PURE__ */ x("select", {
|
|
585
|
-
...
|
|
586
|
-
ref:
|
|
587
|
-
id:
|
|
585
|
+
...c,
|
|
586
|
+
ref: l,
|
|
587
|
+
id: u.id,
|
|
588
588
|
"aria-invalid": i ? !0 : void 0,
|
|
589
|
-
"aria-describedby":
|
|
589
|
+
"aria-describedby": W({
|
|
590
590
|
hint: r,
|
|
591
591
|
error: i,
|
|
592
|
-
"aria-describedby":
|
|
593
|
-
},
|
|
592
|
+
"aria-describedby": c["aria-describedby"]
|
|
593
|
+
}, u),
|
|
594
594
|
className: "hds-select",
|
|
595
595
|
children: [n ? /* @__PURE__ */ b("option", {
|
|
596
596
|
value: "",
|
|
@@ -603,33 +603,33 @@ var te = l(function({ label: e, hint: t, error: n, numeric: r = !1, id: i, class
|
|
|
603
603
|
}, e.value))]
|
|
604
604
|
}), /* @__PURE__ */ b(D, { name: "chevron-down" })]
|
|
605
605
|
}),
|
|
606
|
-
/* @__PURE__ */ b(
|
|
606
|
+
/* @__PURE__ */ b(re, {
|
|
607
607
|
hint: r,
|
|
608
608
|
error: i,
|
|
609
|
-
ids:
|
|
609
|
+
ids: u
|
|
610
610
|
})
|
|
611
611
|
]
|
|
612
612
|
});
|
|
613
613
|
});
|
|
614
614
|
//#endregion
|
|
615
615
|
//#region src/components/DateInput/dates.ts
|
|
616
|
-
function
|
|
616
|
+
function K(e) {
|
|
617
617
|
let t = (e) => String(e).padStart(2, "0");
|
|
618
618
|
return `${e.getFullYear()}-${t(e.getMonth() + 1)}-${t(e.getDate())}`;
|
|
619
619
|
}
|
|
620
|
-
function
|
|
620
|
+
function q(e) {
|
|
621
621
|
let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e ?? "");
|
|
622
622
|
if (!t) return null;
|
|
623
623
|
let n = new Date(Number(t[1]), Number(t[2]) - 1, Number(t[3]));
|
|
624
|
-
return
|
|
624
|
+
return K(n) === e ? n : null;
|
|
625
625
|
}
|
|
626
|
-
function
|
|
627
|
-
let t =
|
|
626
|
+
function J(e) {
|
|
627
|
+
let t = q(e);
|
|
628
628
|
if (!t) return "";
|
|
629
629
|
let n = (e) => String(e).padStart(2, "0");
|
|
630
630
|
return `${n(t.getDate())}/${n(t.getMonth() + 1)}/${t.getFullYear()}`;
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function ae(e) {
|
|
633
633
|
let t = e.trim(), n = /^\d{8}$/.test(t) ? [
|
|
634
634
|
t.slice(0, 2),
|
|
635
635
|
t.slice(2, 4),
|
|
@@ -637,98 +637,98 @@ function ie(e) {
|
|
|
637
637
|
] : /^(\d{1,2})[/.-](\d{1,2})[/.-](\d{4})$/.exec(t)?.slice(1);
|
|
638
638
|
if (!n) return null;
|
|
639
639
|
let [r, i, a] = n.map(Number), o = new Date(a, i - 1, r);
|
|
640
|
-
return o.getFullYear() === a && o.getMonth() === i - 1 && o.getDate() === r ?
|
|
640
|
+
return o.getFullYear() === a && o.getMonth() === i - 1 && o.getDate() === r ? K(o) : null;
|
|
641
641
|
}
|
|
642
|
-
function
|
|
642
|
+
function Y(e, t) {
|
|
643
643
|
return new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
|
|
644
644
|
}
|
|
645
|
-
function
|
|
645
|
+
function X(e, t) {
|
|
646
646
|
let n = new Date(e.getFullYear(), e.getMonth() + t, 1), r = new Date(n.getFullYear(), n.getMonth() + 1, 0).getDate();
|
|
647
647
|
return new Date(n.getFullYear(), n.getMonth(), Math.min(e.getDate(), r));
|
|
648
648
|
}
|
|
649
649
|
function oe(e, t) {
|
|
650
|
-
let n = new Date(e.getFullYear(), e.getMonth(), 1), r =
|
|
651
|
-
return Array.from({ length: 6 }, (e, t) => Array.from({ length: 7 }, (e, n) =>
|
|
650
|
+
let n = new Date(e.getFullYear(), e.getMonth(), 1), r = Y(n, -((n.getDay() - t + 7) % 7));
|
|
651
|
+
return Array.from({ length: 6 }, (e, t) => Array.from({ length: 7 }, (e, n) => Y(r, t * 7 + n)));
|
|
652
652
|
}
|
|
653
653
|
function se(e, t, n) {
|
|
654
654
|
return (!t || e >= t) && (!n || e <= n);
|
|
655
655
|
}
|
|
656
656
|
//#endregion
|
|
657
657
|
//#region src/components/DateInput/DateInput.tsx
|
|
658
|
-
var ce = () =>
|
|
659
|
-
function le({ label: e, value: t, defaultValue: n = "", onChange: r, min: i, max: a, hint: o, error: s, locale: c = "pt-BR", weekStartsOn: l = 0, calendarLabel: u = "Abrir calendário", previousMonthLabel: d = "Mês anterior", nextMonthLabel: p = "Próximo mês",
|
|
660
|
-
let j =
|
|
661
|
-
|
|
662
|
-
function
|
|
658
|
+
var ce = () => K(/* @__PURE__ */ new Date());
|
|
659
|
+
function le({ label: e, value: t, defaultValue: n = "", onChange: r, min: i, max: a, hint: o, error: s, locale: c = "pt-BR", weekStartsOn: l = 0, calendarLabel: u = "Abrir calendário", previousMonthLabel: d = "Mês anterior", nextMonthLabel: p = "Próximo mês", hideLabel: h = !1, name: v, id: y, disabled: T, required: E, placeholder: ee = "dd/mm/aaaa", className: k, ...A }) {
|
|
660
|
+
let j = U(y), [M, N] = _(n), P = t === void 0 ? M : t, [F, I] = _(() => J(P)), [L, R] = _(!1), [z, B] = _(() => q(P) ?? /* @__PURE__ */ new Date()), V = g(null), ne = g(null), H = g(null), G = g(!1), [ie, le] = _(P);
|
|
661
|
+
ie !== P && (le(P), I(J(P)));
|
|
662
|
+
function Z(e) {
|
|
663
663
|
t === void 0 && N(e), e !== P && r?.(e);
|
|
664
664
|
}
|
|
665
|
-
function
|
|
665
|
+
function ue(e) {
|
|
666
666
|
if (I(e), e.trim() === "") {
|
|
667
|
-
|
|
667
|
+
Z("");
|
|
668
668
|
return;
|
|
669
669
|
}
|
|
670
|
-
let t =
|
|
671
|
-
t && se(t, i, a) &&
|
|
672
|
-
}
|
|
673
|
-
function ue() {
|
|
674
|
-
B(Y(P) ?? Y(ce()) ?? /* @__PURE__ */ new Date()), W.current = !0, R(!0);
|
|
670
|
+
let t = ae(e);
|
|
671
|
+
t && se(t, i, a) && Z(t);
|
|
675
672
|
}
|
|
676
|
-
function de(
|
|
677
|
-
|
|
673
|
+
function de() {
|
|
674
|
+
B(q(P) ?? q(ce()) ?? /* @__PURE__ */ new Date()), G.current = !0, R(!0);
|
|
678
675
|
}
|
|
679
676
|
function fe(e) {
|
|
680
|
-
|
|
681
|
-
|
|
677
|
+
R(!1), e && ne.current?.focus();
|
|
678
|
+
}
|
|
679
|
+
function pe(e) {
|
|
680
|
+
let t = K(e);
|
|
681
|
+
se(t, i, a) && (Z(t), I(J(t)), fe(!0));
|
|
682
682
|
}
|
|
683
683
|
m(() => {
|
|
684
|
-
if (!L || !V.current || !
|
|
684
|
+
if (!L || !V.current || !H.current) return;
|
|
685
685
|
let e = () => {
|
|
686
|
-
V.current &&
|
|
686
|
+
V.current && H.current && te(V.current, H.current, "start");
|
|
687
687
|
};
|
|
688
688
|
return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
689
689
|
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
690
690
|
};
|
|
691
691
|
}, [L]), f(() => {
|
|
692
|
-
L &&
|
|
692
|
+
L && G.current && (G.current = !1, H.current?.querySelector("[tabindex=\"0\"]")?.focus());
|
|
693
693
|
}), f(() => {
|
|
694
694
|
if (!L) return;
|
|
695
695
|
function e(e) {
|
|
696
696
|
let t = e.target;
|
|
697
|
-
V.current?.contains(t) ||
|
|
697
|
+
V.current?.contains(t) || H.current?.contains(t) || R(!1);
|
|
698
698
|
}
|
|
699
699
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
700
700
|
}, [L]);
|
|
701
|
-
function pe(e) {
|
|
702
|
-
W.current = !0, B(e);
|
|
703
|
-
}
|
|
704
701
|
function me(e) {
|
|
702
|
+
G.current = !0, B(e);
|
|
703
|
+
}
|
|
704
|
+
function he(e) {
|
|
705
705
|
let t = {
|
|
706
|
-
ArrowLeft: () =>
|
|
707
|
-
ArrowRight: () =>
|
|
708
|
-
ArrowUp: () =>
|
|
709
|
-
ArrowDown: () =>
|
|
710
|
-
Home: () =>
|
|
711
|
-
End: () =>
|
|
712
|
-
PageUp: () =>
|
|
713
|
-
PageDown: () =>
|
|
706
|
+
ArrowLeft: () => Y(z, -1),
|
|
707
|
+
ArrowRight: () => Y(z, 1),
|
|
708
|
+
ArrowUp: () => Y(z, -7),
|
|
709
|
+
ArrowDown: () => Y(z, 7),
|
|
710
|
+
Home: () => Y(z, -((z.getDay() - l + 7) % 7)),
|
|
711
|
+
End: () => Y(z, 6 - (z.getDay() - l + 7) % 7),
|
|
712
|
+
PageUp: () => X(z, e.shiftKey ? -12 : -1),
|
|
713
|
+
PageDown: () => X(z, e.shiftKey ? 12 : 1)
|
|
714
714
|
}[e.key];
|
|
715
|
-
t && (e.preventDefault(),
|
|
715
|
+
t && (e.preventDefault(), me(t()));
|
|
716
716
|
}
|
|
717
|
-
function
|
|
718
|
-
(e.key === "Escape" || e.key === "Tab") && (e.preventDefault(),
|
|
717
|
+
function ge(e) {
|
|
718
|
+
(e.key === "Escape" || e.key === "Tab") && (e.preventDefault(), fe(!0));
|
|
719
719
|
}
|
|
720
|
-
let
|
|
720
|
+
let _e = new Intl.DateTimeFormat(c, {
|
|
721
721
|
month: "long",
|
|
722
722
|
year: "numeric"
|
|
723
|
-
}).format(z),
|
|
723
|
+
}).format(z), ve = _e.charAt(0).toLocaleUpperCase(c) + _e.slice(1), ye = new Intl.DateTimeFormat(c, { dateStyle: "full" }), be = oe(z, l)[0].map((e) => ({
|
|
724
724
|
short: new Intl.DateTimeFormat(c, { weekday: "narrow" }).format(e),
|
|
725
725
|
long: new Intl.DateTimeFormat(c, { weekday: "long" }).format(e)
|
|
726
|
-
})),
|
|
726
|
+
})), xe = K(z), Se = ce(), Q = `${j.id}-calendar-title`;
|
|
727
727
|
return /* @__PURE__ */ x("div", {
|
|
728
728
|
className: C("hds-field", k),
|
|
729
729
|
children: [
|
|
730
730
|
/* @__PURE__ */ b("label", {
|
|
731
|
-
className: "hds-label",
|
|
731
|
+
className: C("hds-label", h && "hds-visually-hidden"),
|
|
732
732
|
htmlFor: j.id,
|
|
733
733
|
children: e
|
|
734
734
|
}),
|
|
@@ -742,24 +742,24 @@ function le({ label: e, value: t, defaultValue: n = "", onChange: r, min: i, max
|
|
|
742
742
|
type: "text",
|
|
743
743
|
inputMode: "numeric",
|
|
744
744
|
autoComplete: "off",
|
|
745
|
-
placeholder:
|
|
745
|
+
placeholder: ee,
|
|
746
746
|
value: F,
|
|
747
|
-
disabled:
|
|
748
|
-
required:
|
|
747
|
+
disabled: T,
|
|
748
|
+
required: E,
|
|
749
749
|
"aria-invalid": s ? !0 : void 0,
|
|
750
|
-
"aria-describedby":
|
|
750
|
+
"aria-describedby": W({
|
|
751
751
|
hint: o,
|
|
752
752
|
error: s,
|
|
753
753
|
"aria-describedby": A["aria-describedby"]
|
|
754
754
|
}, j),
|
|
755
755
|
className: "hds-input hds-input--numeric hds-date-input",
|
|
756
|
-
onChange: (e) =>
|
|
756
|
+
onChange: (e) => ue(e.target.value),
|
|
757
757
|
onBlur: (e) => {
|
|
758
|
-
A.onBlur?.(e), F.trim() !== "" &&
|
|
758
|
+
A.onBlur?.(e), F.trim() !== "" && ae(F) !== P && I(J(P));
|
|
759
759
|
}
|
|
760
760
|
}),
|
|
761
761
|
/* @__PURE__ */ b(O, {
|
|
762
|
-
ref:
|
|
762
|
+
ref: ne,
|
|
763
763
|
variant: "ghost",
|
|
764
764
|
size: "sm",
|
|
765
765
|
iconOnly: !0,
|
|
@@ -767,29 +767,29 @@ function le({ label: e, value: t, defaultValue: n = "", onChange: r, min: i, max
|
|
|
767
767
|
"aria-label": u,
|
|
768
768
|
"aria-haspopup": "dialog",
|
|
769
769
|
"aria-expanded": L,
|
|
770
|
-
disabled:
|
|
770
|
+
disabled: T,
|
|
771
771
|
className: "hds-date-button",
|
|
772
|
-
onClick: () => L ?
|
|
772
|
+
onClick: () => L ? fe(!1) : de()
|
|
773
773
|
}),
|
|
774
|
-
|
|
774
|
+
v ? /* @__PURE__ */ b("input", {
|
|
775
775
|
type: "hidden",
|
|
776
|
-
name:
|
|
776
|
+
name: v,
|
|
777
777
|
value: P
|
|
778
778
|
}) : null
|
|
779
779
|
]
|
|
780
780
|
}),
|
|
781
|
-
/* @__PURE__ */ b(
|
|
781
|
+
/* @__PURE__ */ b(re, {
|
|
782
782
|
hint: o,
|
|
783
783
|
error: s,
|
|
784
784
|
ids: j
|
|
785
785
|
}),
|
|
786
786
|
L ? S(/* @__PURE__ */ x(w, {
|
|
787
|
-
ref:
|
|
787
|
+
ref: H,
|
|
788
788
|
role: "dialog",
|
|
789
789
|
tone: "thick",
|
|
790
|
-
"aria-labelledby":
|
|
790
|
+
"aria-labelledby": Q,
|
|
791
791
|
className: "hds-date-panel",
|
|
792
|
-
onKeyDown:
|
|
792
|
+
onKeyDown: ge,
|
|
793
793
|
children: [/* @__PURE__ */ x("div", {
|
|
794
794
|
className: "hds-date-header",
|
|
795
795
|
children: [
|
|
@@ -799,13 +799,13 @@ function le({ label: e, value: t, defaultValue: n = "", onChange: r, min: i, max
|
|
|
799
799
|
iconOnly: !0,
|
|
800
800
|
icon: /* @__PURE__ */ b(D, { name: "chevron-left" }),
|
|
801
801
|
"aria-label": d,
|
|
802
|
-
onClick: () => B(
|
|
802
|
+
onClick: () => B(X(z, -1))
|
|
803
803
|
}),
|
|
804
804
|
/* @__PURE__ */ b("h2", {
|
|
805
|
-
id:
|
|
805
|
+
id: Q,
|
|
806
806
|
className: "hds-date-title",
|
|
807
807
|
"aria-live": "polite",
|
|
808
|
-
children:
|
|
808
|
+
children: ve
|
|
809
809
|
}),
|
|
810
810
|
/* @__PURE__ */ b(O, {
|
|
811
811
|
variant: "ghost",
|
|
@@ -813,35 +813,35 @@ function le({ label: e, value: t, defaultValue: n = "", onChange: r, min: i, max
|
|
|
813
813
|
iconOnly: !0,
|
|
814
814
|
icon: /* @__PURE__ */ b(D, { name: "chevron-right" }),
|
|
815
815
|
"aria-label": p,
|
|
816
|
-
onClick: () => B(
|
|
816
|
+
onClick: () => B(X(z, 1))
|
|
817
817
|
})
|
|
818
818
|
]
|
|
819
819
|
}), /* @__PURE__ */ x("table", {
|
|
820
820
|
role: "grid",
|
|
821
|
-
"aria-labelledby":
|
|
821
|
+
"aria-labelledby": Q,
|
|
822
822
|
className: "hds-date-grid",
|
|
823
|
-
onKeyDown:
|
|
824
|
-
children: [/* @__PURE__ */ b("thead", { children: /* @__PURE__ */ b("tr", { children:
|
|
823
|
+
onKeyDown: he,
|
|
824
|
+
children: [/* @__PURE__ */ b("thead", { children: /* @__PURE__ */ b("tr", { children: be.map((e) => /* @__PURE__ */ b("th", {
|
|
825
825
|
scope: "col",
|
|
826
826
|
abbr: e.long,
|
|
827
827
|
children: e.short
|
|
828
828
|
}, e.long)) }) }), /* @__PURE__ */ b("tbody", { children: oe(z, l).map((e) => /* @__PURE__ */ b("tr", { children: e.map((e) => {
|
|
829
|
-
let t =
|
|
829
|
+
let t = K(e), n = se(t, i, a);
|
|
830
830
|
return /* @__PURE__ */ b("td", {
|
|
831
831
|
role: "gridcell",
|
|
832
832
|
"aria-selected": t === P,
|
|
833
833
|
children: /* @__PURE__ */ b("button", {
|
|
834
834
|
type: "button",
|
|
835
|
-
tabIndex: t ===
|
|
836
|
-
"aria-label":
|
|
837
|
-
"aria-current": t ===
|
|
835
|
+
tabIndex: t === xe ? 0 : -1,
|
|
836
|
+
"aria-label": ye.format(e),
|
|
837
|
+
"aria-current": t === Se ? "date" : void 0,
|
|
838
838
|
"aria-disabled": !n || void 0,
|
|
839
839
|
className: C("hds-date-day", e.getMonth() !== z.getMonth() && "hds-date-day--outside", t === P && "hds-date-day--selected"),
|
|
840
|
-
onClick: () =>
|
|
840
|
+
onClick: () => pe(e),
|
|
841
841
|
children: e.getDate()
|
|
842
842
|
})
|
|
843
843
|
}, t);
|
|
844
|
-
}) },
|
|
844
|
+
}) }, K(e[0]))) })]
|
|
845
845
|
})]
|
|
846
846
|
}), document.body) : null
|
|
847
847
|
]
|
|
@@ -872,10 +872,10 @@ function de({ text: e, query: t, locale: n }) {
|
|
|
872
872
|
e.slice(i)
|
|
873
873
|
] });
|
|
874
874
|
}
|
|
875
|
-
function fe({ label: e, value: t, defaultValue: n = "", onChange: r, suggestions: i, maxSuggestions: a = 8, hint: o, error: s, locale: c = "pt-BR",
|
|
876
|
-
let
|
|
875
|
+
function fe({ label: e, value: t, defaultValue: n = "", onChange: r, suggestions: i, maxSuggestions: a = 8, hint: o, error: s, locale: c = "pt-BR", hideLabel: l = !1, id: u, className: d, disabled: p, ...h }) {
|
|
876
|
+
let v = U(u), y = `${v.id}-list`, T = `${v.id}-label`, [E, D] = _(n), O = t === void 0 ? E : t, [ee, k] = _(!1), [A, j] = _(-1), M = g(null), N = g(null), P = ue(i, O, c, a), F = ee && P.length > 0;
|
|
877
877
|
function I(e) {
|
|
878
|
-
t === void 0 &&
|
|
878
|
+
t === void 0 && D(e), r?.(e);
|
|
879
879
|
}
|
|
880
880
|
function L(e) {
|
|
881
881
|
I(e), k(!1), j(-1);
|
|
@@ -883,20 +883,20 @@ function fe({ label: e, value: t, defaultValue: n = "", onChange: r, suggestions
|
|
|
883
883
|
m(() => {
|
|
884
884
|
if (!F || !M.current || !N.current) return;
|
|
885
885
|
let e = () => {
|
|
886
|
-
M.current && N.current && (N.current.style.width = `${M.current.offsetWidth}px`,
|
|
886
|
+
M.current && N.current && (N.current.style.width = `${M.current.offsetWidth}px`, te(M.current, N.current, "start"));
|
|
887
887
|
};
|
|
888
888
|
return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
889
889
|
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
890
890
|
};
|
|
891
891
|
}, [F, P.length]), f(() => {
|
|
892
|
-
!F || A < 0 || document.getElementById(`${
|
|
892
|
+
!F || A < 0 || document.getElementById(`${y}-${A}`)?.scrollIntoView?.({ block: "nearest" });
|
|
893
893
|
}, [
|
|
894
894
|
F,
|
|
895
895
|
A,
|
|
896
|
-
|
|
896
|
+
y
|
|
897
897
|
]);
|
|
898
898
|
function R(e) {
|
|
899
|
-
if (
|
|
899
|
+
if (h.onKeyDown?.(e), e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
900
900
|
if (e.preventDefault(), !F) {
|
|
901
901
|
k(!0), j(e.key === "ArrowDown" ? 0 : P.length - 1);
|
|
902
902
|
return;
|
|
@@ -905,56 +905,56 @@ function fe({ label: e, value: t, defaultValue: n = "", onChange: r, suggestions
|
|
|
905
905
|
} else e.key === "Enter" && F && A >= 0 ? (e.preventDefault(), L(P[A])) : e.key === "Escape" && F ? (e.preventDefault(), k(!1), j(-1)) : e.key === "Tab" && k(!1);
|
|
906
906
|
}
|
|
907
907
|
return /* @__PURE__ */ x("div", {
|
|
908
|
-
className: C("hds-field",
|
|
908
|
+
className: C("hds-field", d),
|
|
909
909
|
children: [
|
|
910
910
|
/* @__PURE__ */ b("label", {
|
|
911
|
-
id:
|
|
912
|
-
className: "hds-label",
|
|
913
|
-
htmlFor:
|
|
911
|
+
id: T,
|
|
912
|
+
className: C("hds-label", l && "hds-visually-hidden"),
|
|
913
|
+
htmlFor: v.id,
|
|
914
914
|
children: e
|
|
915
915
|
}),
|
|
916
916
|
/* @__PURE__ */ b("input", {
|
|
917
917
|
spellCheck: !1,
|
|
918
|
-
...
|
|
918
|
+
...h,
|
|
919
919
|
ref: M,
|
|
920
|
-
id:
|
|
920
|
+
id: v.id,
|
|
921
921
|
type: "text",
|
|
922
922
|
role: "combobox",
|
|
923
923
|
autoComplete: "off",
|
|
924
924
|
"aria-autocomplete": "list",
|
|
925
925
|
"aria-expanded": F,
|
|
926
|
-
"aria-controls": F ?
|
|
927
|
-
"aria-activedescendant": F && A >= 0 ? `${
|
|
926
|
+
"aria-controls": F ? y : void 0,
|
|
927
|
+
"aria-activedescendant": F && A >= 0 ? `${y}-${A}` : void 0,
|
|
928
928
|
"aria-invalid": s ? !0 : void 0,
|
|
929
|
-
"aria-describedby":
|
|
929
|
+
"aria-describedby": W({
|
|
930
930
|
hint: o,
|
|
931
931
|
error: s,
|
|
932
|
-
"aria-describedby":
|
|
933
|
-
},
|
|
932
|
+
"aria-describedby": h["aria-describedby"]
|
|
933
|
+
}, v),
|
|
934
934
|
className: "hds-input",
|
|
935
|
-
disabled:
|
|
936
|
-
value:
|
|
935
|
+
disabled: p,
|
|
936
|
+
value: O,
|
|
937
937
|
onChange: (e) => {
|
|
938
938
|
I(e.target.value), k(!0), j(-1);
|
|
939
939
|
},
|
|
940
940
|
onKeyDown: R,
|
|
941
941
|
onBlur: (e) => {
|
|
942
|
-
|
|
942
|
+
h.onBlur?.(e), k(!1), j(-1);
|
|
943
943
|
}
|
|
944
944
|
}),
|
|
945
|
-
/* @__PURE__ */ b(
|
|
945
|
+
/* @__PURE__ */ b(re, {
|
|
946
946
|
hint: o,
|
|
947
947
|
error: s,
|
|
948
|
-
ids:
|
|
948
|
+
ids: v
|
|
949
949
|
}),
|
|
950
950
|
F ? S(/* @__PURE__ */ b(w, {
|
|
951
951
|
ref: N,
|
|
952
|
-
id:
|
|
952
|
+
id: y,
|
|
953
953
|
role: "listbox",
|
|
954
|
-
"aria-labelledby":
|
|
954
|
+
"aria-labelledby": T,
|
|
955
955
|
className: "hds-typeahead-panel",
|
|
956
956
|
children: P.map((e, t) => /* @__PURE__ */ b("div", {
|
|
957
|
-
id: `${
|
|
957
|
+
id: `${y}-${t}`,
|
|
958
958
|
role: "option",
|
|
959
959
|
"aria-selected": t === A,
|
|
960
960
|
className: "hds-typeahead-option",
|
|
@@ -963,7 +963,7 @@ function fe({ label: e, value: t, defaultValue: n = "", onChange: r, suggestions
|
|
|
963
963
|
onMouseMove: () => j(t),
|
|
964
964
|
children: /* @__PURE__ */ b(de, {
|
|
965
965
|
text: e,
|
|
966
|
-
query:
|
|
966
|
+
query: O,
|
|
967
967
|
locale: c
|
|
968
968
|
})
|
|
969
969
|
}, e))
|
|
@@ -972,9 +972,116 @@ function fe({ label: e, value: t, defaultValue: n = "", onChange: r, suggestions
|
|
|
972
972
|
});
|
|
973
973
|
}
|
|
974
974
|
//#endregion
|
|
975
|
+
//#region src/components/BarChart/BarChart.tsx
|
|
976
|
+
var pe = [
|
|
977
|
+
"accent",
|
|
978
|
+
"secondary",
|
|
979
|
+
"warning",
|
|
980
|
+
"success",
|
|
981
|
+
"danger",
|
|
982
|
+
"neutral"
|
|
983
|
+
], me = (e) => e.toLocaleString("pt-BR");
|
|
984
|
+
function he({ title: e, data: t, series: n = [{ name: "Valor" }], orientation: r = "vertical", formatValue: i = me, empty: a = "Nada para mostrar.", height: o = 200, className: s }) {
|
|
985
|
+
let c = p(), l = n.map((e, t) => e.tone ?? pe[t % pe.length]), u = (e) => e.values.reduce((e, t) => e + Math.max(0, t), 0), d = Math.max(0, ...t.map(u)), f = (e) => d > 0 ? Math.max(0, e) / d * 100 : 0, m = n.length > 1;
|
|
986
|
+
return /* @__PURE__ */ x("figure", {
|
|
987
|
+
"aria-labelledby": c,
|
|
988
|
+
className: C("hds-chart", `hds-chart--${r}`, s),
|
|
989
|
+
children: [/* @__PURE__ */ b("figcaption", {
|
|
990
|
+
id: c,
|
|
991
|
+
className: "hds-chart-title",
|
|
992
|
+
children: e
|
|
993
|
+
}), t.length === 0 || d === 0 ? /* @__PURE__ */ b("p", {
|
|
994
|
+
className: "hds-chart-empty",
|
|
995
|
+
children: a
|
|
996
|
+
}) : /* @__PURE__ */ x(y, { children: [
|
|
997
|
+
m ? /* @__PURE__ */ b("ul", {
|
|
998
|
+
className: "hds-chart-legend",
|
|
999
|
+
"aria-hidden": "true",
|
|
1000
|
+
children: n.map((e, t) => /* @__PURE__ */ x("li", { children: [/* @__PURE__ */ b("span", { className: C("hds-chart-swatch", `hds-chart-tone--${l[t]}`) }), e.name] }, e.name))
|
|
1001
|
+
}) : null,
|
|
1002
|
+
r === "vertical" ? /* @__PURE__ */ b("div", {
|
|
1003
|
+
className: "hds-chart-columns",
|
|
1004
|
+
"aria-hidden": "true",
|
|
1005
|
+
style: { height: o },
|
|
1006
|
+
children: t.map((e) => /* @__PURE__ */ x("div", {
|
|
1007
|
+
className: "hds-chart-column",
|
|
1008
|
+
children: [/* @__PURE__ */ x("div", {
|
|
1009
|
+
className: "hds-chart-plot",
|
|
1010
|
+
children: [/* @__PURE__ */ b("span", {
|
|
1011
|
+
className: "hds-chart-value",
|
|
1012
|
+
children: i(u(e))
|
|
1013
|
+
}), /* @__PURE__ */ b("div", {
|
|
1014
|
+
className: "hds-chart-stack",
|
|
1015
|
+
style: { height: `${f(u(e))}%` },
|
|
1016
|
+
children: e.values.map((e, t) => e > 0 ? /* @__PURE__ */ b("span", {
|
|
1017
|
+
className: C("hds-chart-bar", `hds-chart-tone--${l[t]}`),
|
|
1018
|
+
style: { flexGrow: e }
|
|
1019
|
+
}, n[t]?.name ?? t) : null)
|
|
1020
|
+
})]
|
|
1021
|
+
}), /* @__PURE__ */ b("span", {
|
|
1022
|
+
className: "hds-chart-label",
|
|
1023
|
+
children: e.label
|
|
1024
|
+
})]
|
|
1025
|
+
}, e.label))
|
|
1026
|
+
}) : /* @__PURE__ */ b("div", {
|
|
1027
|
+
className: "hds-chart-rows",
|
|
1028
|
+
"aria-hidden": "true",
|
|
1029
|
+
children: t.map((e) => /* @__PURE__ */ x("div", {
|
|
1030
|
+
className: "hds-chart-row",
|
|
1031
|
+
children: [
|
|
1032
|
+
/* @__PURE__ */ b("span", {
|
|
1033
|
+
className: "hds-chart-label",
|
|
1034
|
+
children: e.label
|
|
1035
|
+
}),
|
|
1036
|
+
/* @__PURE__ */ b("div", {
|
|
1037
|
+
className: "hds-chart-track",
|
|
1038
|
+
children: /* @__PURE__ */ b("div", {
|
|
1039
|
+
className: "hds-chart-stack",
|
|
1040
|
+
style: { width: `${f(u(e))}%` },
|
|
1041
|
+
children: e.values.map((e, t) => e > 0 ? /* @__PURE__ */ b("span", {
|
|
1042
|
+
className: C("hds-chart-bar", `hds-chart-tone--${l[t]}`),
|
|
1043
|
+
style: { flexGrow: e }
|
|
1044
|
+
}, n[t]?.name ?? t) : null)
|
|
1045
|
+
})
|
|
1046
|
+
}),
|
|
1047
|
+
/* @__PURE__ */ b("span", {
|
|
1048
|
+
className: "hds-chart-value",
|
|
1049
|
+
children: i(u(e))
|
|
1050
|
+
})
|
|
1051
|
+
]
|
|
1052
|
+
}, e.label))
|
|
1053
|
+
}),
|
|
1054
|
+
/* @__PURE__ */ x("table", {
|
|
1055
|
+
className: "hds-visually-hidden",
|
|
1056
|
+
children: [/* @__PURE__ */ b("thead", { children: /* @__PURE__ */ x("tr", { children: [
|
|
1057
|
+
/* @__PURE__ */ b("th", {
|
|
1058
|
+
scope: "col",
|
|
1059
|
+
children: typeof e == "string" ? e : ""
|
|
1060
|
+
}),
|
|
1061
|
+
n.map((e) => /* @__PURE__ */ b("th", {
|
|
1062
|
+
scope: "col",
|
|
1063
|
+
children: e.name
|
|
1064
|
+
}, e.name)),
|
|
1065
|
+
m ? /* @__PURE__ */ b("th", {
|
|
1066
|
+
scope: "col",
|
|
1067
|
+
children: "Total"
|
|
1068
|
+
}) : null
|
|
1069
|
+
] }) }), /* @__PURE__ */ b("tbody", { children: t.map((e) => /* @__PURE__ */ x("tr", { children: [
|
|
1070
|
+
/* @__PURE__ */ b("th", {
|
|
1071
|
+
scope: "row",
|
|
1072
|
+
children: e.label
|
|
1073
|
+
}),
|
|
1074
|
+
n.map((t, n) => /* @__PURE__ */ b("td", { children: i(e.values[n] ?? 0) }, t.name)),
|
|
1075
|
+
m ? /* @__PURE__ */ b("td", { children: i(u(e)) }) : null
|
|
1076
|
+
] }, e.label)) })]
|
|
1077
|
+
})
|
|
1078
|
+
] })]
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1081
|
+
//#endregion
|
|
975
1082
|
//#region src/components/Checkbox/Checkbox.tsx
|
|
976
|
-
var
|
|
977
|
-
let o =
|
|
1083
|
+
var ge = l(function({ label: e, hint: t, id: n, className: r, ...i }, a) {
|
|
1084
|
+
let o = U(n);
|
|
978
1085
|
return /* @__PURE__ */ x("label", {
|
|
979
1086
|
className: C("hds-checkbox", r),
|
|
980
1087
|
htmlFor: o.id,
|
|
@@ -1003,7 +1110,7 @@ var pe = l(function({ label: e, hint: t, id: n, className: r, ...i }, a) {
|
|
|
1003
1110
|
});
|
|
1004
1111
|
//#endregion
|
|
1005
1112
|
//#region src/components/Card/Card.tsx
|
|
1006
|
-
function
|
|
1113
|
+
function _e({ as: e = "article", eyebrow: t, title: n, media: r, footer: i, interactive: a = !1, className: o, children: s, ...c }) {
|
|
1007
1114
|
return /* @__PURE__ */ x(e, {
|
|
1008
1115
|
...c,
|
|
1009
1116
|
className: C("hds-card", a && "hds-card--interactive", o),
|
|
@@ -1039,14 +1146,14 @@ function me({ as: e = "article", eyebrow: t, title: n, media: r, footer: i, inte
|
|
|
1039
1146
|
}
|
|
1040
1147
|
//#endregion
|
|
1041
1148
|
//#region src/components/Badge/Badge.tsx
|
|
1042
|
-
var
|
|
1149
|
+
var ve = {
|
|
1043
1150
|
accent: "info",
|
|
1044
1151
|
success: "circle-check",
|
|
1045
1152
|
warning: "triangle-alert",
|
|
1046
1153
|
danger: "circle-x"
|
|
1047
1154
|
};
|
|
1048
|
-
function
|
|
1049
|
-
let i =
|
|
1155
|
+
function ye({ tone: e = "neutral", icon: t, children: n, className: r }) {
|
|
1156
|
+
let i = ve[e], a = t === !1 ? null : t ?? (i ? /* @__PURE__ */ b(D, { name: i }) : null);
|
|
1050
1157
|
return /* @__PURE__ */ x("span", {
|
|
1051
1158
|
className: C("hds-badge", `hds-badge--${e}`, r),
|
|
1052
1159
|
children: [a, n]
|
|
@@ -1054,10 +1161,10 @@ function ge({ tone: e = "neutral", icon: t, children: n, className: r }) {
|
|
|
1054
1161
|
}
|
|
1055
1162
|
//#endregion
|
|
1056
1163
|
//#region src/components/Table/Table.tsx
|
|
1057
|
-
function
|
|
1164
|
+
function be(e) {
|
|
1058
1165
|
return e.numeric ? "hds-cell--numeric" : e.align === "center" ? "hds-cell--center" : void 0;
|
|
1059
1166
|
}
|
|
1060
|
-
function
|
|
1167
|
+
function xe({ columns: e, rows: t, rowKey: n = "id", caption: r, hideCaption: i = !1, empty: a = "Nada para mostrar.", maxHeight: o, glass: s = !1, className: c }) {
|
|
1061
1168
|
return /* @__PURE__ */ b("div", {
|
|
1062
1169
|
className: C("hds-table-wrap", "hds-scroll", s && "hds-glass hds-table-wrap--glass", c),
|
|
1063
1170
|
role: "region",
|
|
@@ -1073,11 +1180,11 @@ function ve({ columns: e, rows: t, rowKey: n = "id", caption: r, hideCaption: i
|
|
|
1073
1180
|
}) : null,
|
|
1074
1181
|
/* @__PURE__ */ b("thead", { children: /* @__PURE__ */ b("tr", { children: e.map((e) => /* @__PURE__ */ b("th", {
|
|
1075
1182
|
scope: "col",
|
|
1076
|
-
className:
|
|
1183
|
+
className: be(e),
|
|
1077
1184
|
children: e.header
|
|
1078
1185
|
}, e.key)) }) }),
|
|
1079
1186
|
/* @__PURE__ */ b("tbody", { children: t.length ? t.map((t, r) => /* @__PURE__ */ b("tr", { children: e.map((e) => /* @__PURE__ */ b("td", {
|
|
1080
|
-
className:
|
|
1187
|
+
className: be(e),
|
|
1081
1188
|
children: e.render ? e.render(t) : t[e.key]
|
|
1082
1189
|
}, e.key)) }, String(t[n] ?? r))) : /* @__PURE__ */ b("tr", { children: /* @__PURE__ */ b("td", {
|
|
1083
1190
|
colSpan: e.length || 1,
|
|
@@ -1090,19 +1197,19 @@ function ve({ columns: e, rows: t, rowKey: n = "id", caption: r, hideCaption: i
|
|
|
1090
1197
|
}
|
|
1091
1198
|
//#endregion
|
|
1092
1199
|
//#region src/appearance/useAppearance.ts
|
|
1093
|
-
var
|
|
1200
|
+
var Se = !1, Q = {
|
|
1094
1201
|
theme: "dark",
|
|
1095
1202
|
transparency: "full"
|
|
1096
|
-
},
|
|
1097
|
-
function
|
|
1203
|
+
}, $ = Q;
|
|
1204
|
+
function Ce() {
|
|
1098
1205
|
let e = a();
|
|
1099
|
-
return (e.theme !==
|
|
1206
|
+
return (e.theme !== $.theme || e.transparency !== $.transparency) && ($ = e), $;
|
|
1100
1207
|
}
|
|
1101
|
-
function
|
|
1208
|
+
function we() {
|
|
1102
1209
|
f(() => {
|
|
1103
|
-
|
|
1210
|
+
Se || (Se = !0, document.documentElement.hasAttribute("data-theme") || r());
|
|
1104
1211
|
}, []);
|
|
1105
|
-
let e = v(o,
|
|
1212
|
+
let e = v(o, Ce, () => Q);
|
|
1106
1213
|
return {
|
|
1107
1214
|
...e,
|
|
1108
1215
|
setTheme: t,
|
|
@@ -1113,8 +1220,8 @@ function xe() {
|
|
|
1113
1220
|
}
|
|
1114
1221
|
//#endregion
|
|
1115
1222
|
//#region src/components/AppearanceToggles/AppearanceToggles.tsx
|
|
1116
|
-
function
|
|
1117
|
-
let { theme: i, toggleTheme: a } =
|
|
1223
|
+
function Te({ lightLabel: e = "Mudar para o tema claro", darkLabel: t = "Mudar para o tema escuro", variant: n = "ghost", ...r }) {
|
|
1224
|
+
let { theme: i, toggleTheme: a } = we(), o = i === "dark" ? e : t;
|
|
1118
1225
|
return /* @__PURE__ */ b(O, {
|
|
1119
1226
|
...r,
|
|
1120
1227
|
variant: n,
|
|
@@ -1125,8 +1232,8 @@ function Se({ lightLabel: e = "Mudar para o tema claro", darkLabel: t = "Mudar p
|
|
|
1125
1232
|
onClick: a
|
|
1126
1233
|
});
|
|
1127
1234
|
}
|
|
1128
|
-
function
|
|
1129
|
-
let { transparency: r, toggleTransparency: i } =
|
|
1235
|
+
function Ee({ label: e = "Reduzir transparência", variant: t = "ghost", ...n }) {
|
|
1236
|
+
let { transparency: r, toggleTransparency: i } = we();
|
|
1130
1237
|
return /* @__PURE__ */ b(O, {
|
|
1131
1238
|
...n,
|
|
1132
1239
|
variant: t,
|
|
@@ -1140,7 +1247,7 @@ function Ce({ label: e = "Reduzir transparência", variant: t = "ghost", ...n })
|
|
|
1140
1247
|
}
|
|
1141
1248
|
//#endregion
|
|
1142
1249
|
//#region src/components/Container/Container.tsx
|
|
1143
|
-
function
|
|
1250
|
+
function De({ as: e = "section", withSidebar: t = !1, className: n, ...r }) {
|
|
1144
1251
|
return /* @__PURE__ */ b(e, {
|
|
1145
1252
|
...r,
|
|
1146
1253
|
className: C("hds-container", t && "hds-container--with-sidebar", n)
|
|
@@ -1148,7 +1255,7 @@ function we({ as: e = "section", withSidebar: t = !1, className: n, ...r }) {
|
|
|
1148
1255
|
}
|
|
1149
1256
|
//#endregion
|
|
1150
1257
|
//#region src/components/SectionTitle/SectionTitle.tsx
|
|
1151
|
-
function
|
|
1258
|
+
function Oe({ children: e, index: t, as: n = "h2", id: r, className: i }) {
|
|
1152
1259
|
return /* @__PURE__ */ x(n, {
|
|
1153
1260
|
id: r,
|
|
1154
1261
|
className: C("hds-section-title", i),
|
|
@@ -1161,7 +1268,7 @@ function Te({ children: e, index: t, as: n = "h2", id: r, className: i }) {
|
|
|
1161
1268
|
}
|
|
1162
1269
|
//#endregion
|
|
1163
1270
|
//#region src/components/Separator/Separator.tsx
|
|
1164
|
-
function
|
|
1271
|
+
function ke({ orientation: e = "horizontal", decorative: t = !1, className: n }) {
|
|
1165
1272
|
return /* @__PURE__ */ b("div", {
|
|
1166
1273
|
role: t ? "none" : "separator",
|
|
1167
1274
|
"aria-orientation": t ? void 0 : e,
|
|
@@ -1170,7 +1277,7 @@ function Ee({ orientation: e = "horizontal", decorative: t = !1, className: n })
|
|
|
1170
1277
|
}
|
|
1171
1278
|
//#endregion
|
|
1172
1279
|
//#region src/components/ScrollArea/ScrollArea.tsx
|
|
1173
|
-
function
|
|
1280
|
+
function Ae({ label: e, maxHeight: t, className: n, style: r, ...i }) {
|
|
1174
1281
|
return /* @__PURE__ */ b("div", {
|
|
1175
1282
|
...i,
|
|
1176
1283
|
role: "region",
|
|
@@ -1185,7 +1292,7 @@ function De({ label: e, maxHeight: t, className: n, style: r, ...i }) {
|
|
|
1185
1292
|
}
|
|
1186
1293
|
//#endregion
|
|
1187
1294
|
//#region src/components/Loading/Loading.tsx
|
|
1188
|
-
function
|
|
1295
|
+
function je({ size: e = "md", label: t = "Carregando…", showLabel: n = !1, className: r }) {
|
|
1189
1296
|
return /* @__PURE__ */ x("span", {
|
|
1190
1297
|
role: "status",
|
|
1191
1298
|
className: C("hds-loading", `hds-loading--${e}`, r),
|
|
@@ -1197,7 +1304,7 @@ function Oe({ size: e = "md", label: t = "Carregando…", showLabel: n = !1, cla
|
|
|
1197
1304
|
}
|
|
1198
1305
|
//#endregion
|
|
1199
1306
|
//#region src/components/GlowAvatar/GlowAvatar.tsx
|
|
1200
|
-
function
|
|
1307
|
+
function Me({ src: e, alt: t, size: n = 96, className: r }) {
|
|
1201
1308
|
return /* @__PURE__ */ x("span", {
|
|
1202
1309
|
className: C("hds-avatar", r),
|
|
1203
1310
|
style: {
|
|
@@ -1217,6 +1324,6 @@ function ke({ src: e, alt: t, size: n = 96, className: r }) {
|
|
|
1217
1324
|
});
|
|
1218
1325
|
}
|
|
1219
1326
|
//#endregion
|
|
1220
|
-
export { s as APPEARANCE_STORAGE_KEYS,
|
|
1327
|
+
export { s as APPEARANCE_STORAGE_KEYS, ye as Badge, he as BarChart, O as Button, _e as Card, ge as Checkbox, De as Container, le as DateInput, L as Dialog, F as FloatingButton, w as GlassPanel, Me as GlowAvatar, G as Input, je as Loading, P as Menu, A as NavBar, Ae as ScrollArea, Oe as SectionTitle, N as SegmentedControl, ie as Select, ke as Separator, j as Sidebar, xe as Table, Te as ThemeToggle, B as Toast, ne as ToastProvider, Ee as TransparencyToggle, fe as Typeahead, r as applyStoredAppearance, e as enableGlassRefraction, a as getAppearance, n as readStoredAppearance, t as setTheme, i as setTransparency, o as subscribeToAppearance, we as useAppearance, H as useToast };
|
|
1221
1328
|
|
|
1222
1329
|
//# sourceMappingURL=index.js.map
|