@hemerson/design-system 0.3.1 → 0.5.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/index.js CHANGED
@@ -19,10 +19,18 @@ var w = l(function({ as: e = "div", tone: t = "regular", className: n, ...r }, i
19
19
  cx: 12,
20
20
  cy: 12,
21
21
  r: 10
22
- }, E = {
22
+ }, ee = {
23
23
  check: ["M20 6 9 17l-5-5"],
24
24
  x: ["M18 6 6 18", "m6 6 12 12"],
25
25
  "chevron-down": ["m6 9 6 6 6-6"],
26
+ "chevron-left": ["m15 18-6-6 6-6"],
27
+ "chevron-right": ["m9 18 6-6-6-6"],
28
+ calendar: [
29
+ "M8 2v4",
30
+ "M16 2v4",
31
+ "M3 10h18",
32
+ "M5 4h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Z"
33
+ ],
26
34
  "circle-check": [T, "m9 12 2 2 4-4"],
27
35
  "circle-x": [
28
36
  T,
@@ -66,8 +74,8 @@ var w = l(function({ as: e = "div", tone: t = "regular", className: n, ...r }, i
66
74
  r: 7
67
75
  }]
68
76
  };
69
- function D({ name: e, className: t }) {
70
- let n = E[e];
77
+ function E({ name: e, className: t }) {
78
+ let n = ee[e];
71
79
  return /* @__PURE__ */ b("svg", {
72
80
  className: C("hds-icon", t),
73
81
  viewBox: "0 0 24 24",
@@ -87,7 +95,7 @@ function D({ name: e, className: t }) {
87
95
  }
88
96
  //#endregion
89
97
  //#region src/components/Button/Button.tsx
90
- var O = l(function({ variant: e = "primary", size: t = "md", icon: n, iconOnly: r = !1, loading: i = !1, disabled: a, type: o = "button", className: s, children: c, ...l }, u) {
98
+ var D = l(function({ variant: e = "primary", size: t = "md", icon: n, iconOnly: r = !1, loading: i = !1, disabled: a, type: o = "button", className: s, children: c, ...l }, u) {
91
99
  return r && !l["aria-label"] && !l["aria-labelledby"] && console.warn("Button: an icon-only button needs an aria-label."), /* @__PURE__ */ x("button", {
92
100
  ...l,
93
101
  ref: u,
@@ -95,7 +103,7 @@ var O = l(function({ variant: e = "primary", size: t = "md", icon: n, iconOnly:
95
103
  disabled: a || i,
96
104
  "aria-busy": i || void 0,
97
105
  className: C("hds-btn", `hds-btn--${e}`, t !== "md" && `hds-btn--${t}`, r && "hds-btn--icon", e === "glass" && "hds-glass", s),
98
- children: [i ? /* @__PURE__ */ b(D, {
106
+ children: [i ? /* @__PURE__ */ b(E, {
99
107
  name: "loader",
100
108
  className: "hds-spin"
101
109
  }) : n, r ? null : c]
@@ -103,14 +111,14 @@ var O = l(function({ variant: e = "primary", size: t = "md", icon: n, iconOnly:
103
111
  });
104
112
  //#endregion
105
113
  //#region src/components/NavBar/NavBar.tsx
106
- function ee({ active: e = !1, className: t, ...n }) {
114
+ function te({ active: e = !1, className: t, ...n }) {
107
115
  return /* @__PURE__ */ b("a", {
108
116
  ...n,
109
117
  "aria-current": e ? "page" : void 0,
110
118
  className: C("hds-navbar-link", t)
111
119
  });
112
120
  }
113
- function k({ title: e, actions: t, navLabel: n = "Principal", className: r, children: i, ...a }) {
121
+ function O({ title: e, actions: t, navLabel: n = "Principal", className: r, children: i, ...a }) {
114
122
  return /* @__PURE__ */ x(w, {
115
123
  ...a,
116
124
  as: "header",
@@ -132,7 +140,7 @@ function k({ title: e, actions: t, navLabel: n = "Principal", className: r, chil
132
140
  ]
133
141
  });
134
142
  }
135
- var te = Object.assign(k, { Link: ee });
143
+ var k = Object.assign(O, { Link: te });
136
144
  //#endregion
137
145
  //#region src/components/Sidebar/Sidebar.tsx
138
146
  function ne({ items: e, footer: t, floating: n = !1, label: r = "Navegação", className: i }) {
@@ -169,13 +177,13 @@ function ne({ items: e, footer: t, floating: n = !1, label: r = "Navegação", c
169
177
  }
170
178
  //#endregion
171
179
  //#region src/components/SegmentedControl/SegmentedControl.tsx
172
- var A = {
180
+ var re = {
173
181
  ArrowRight: 1,
174
182
  ArrowDown: 1,
175
183
  ArrowLeft: -1,
176
184
  ArrowUp: -1
177
185
  };
178
- function j({ options: e, value: t, defaultValue: n, onChange: r, label: i, className: a }) {
186
+ function A({ options: e, value: t, defaultValue: n, onChange: r, label: i, className: a }) {
179
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));
180
188
  m(() => {
181
189
  function e() {
@@ -188,7 +196,7 @@ function j({ options: e, value: t, defaultValue: n, onChange: r, label: i, class
188
196
  t === void 0 && s(e), r?.(e);
189
197
  }
190
198
  function p(t) {
191
- let n = A[t.key];
199
+ let n = re[t.key];
192
200
  if (!n) return;
193
201
  t.preventDefault();
194
202
  let r = (d + n + e.length) % e.length;
@@ -222,14 +230,13 @@ function j({ options: e, value: t, defaultValue: n, onChange: r, label: i, class
222
230
  })]
223
231
  });
224
232
  }
225
- //#endregion
226
- //#region src/components/Menu/Menu.tsx
227
- var M = 8;
228
- function N(e, t, n) {
229
- 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 + M + a <= s - M, l = r.top - M - a >= M, u = c || !l ? r.bottom + M : r.top - M - a, d = n === "end" ? r.right - i : r.left, f = Math.min(Math.max(M, d), Math.max(M, o - i - M));
233
+ function ie(e, t, n) {
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));
230
235
  t.style.top = `${Math.round(u)}px`, t.style.left = `${Math.round(f)}px`, t.dataset.side = c || !l ? "bottom" : "top";
231
236
  }
232
- function P({ label: e, icon: t, iconOnly: n = !1, items: r, align: i = "end", triggerVariant: a = "glass", className: o }) {
237
+ //#endregion
238
+ //#region src/components/Menu/Menu.tsx
239
+ function j({ label: e, icon: t, iconOnly: n = !1, items: r, align: i = "end", triggerVariant: a = "glass", className: o }) {
233
240
  let [s, c] = _(!1), l = g(null), u = g(null), d = p(), h = () => Array.from(u.current?.querySelectorAll("[role=\"menuitem\"]") ?? []);
234
241
  function v(e) {
235
242
  c(!1), e && l.current?.focus();
@@ -237,7 +244,7 @@ function P({ label: e, icon: t, iconOnly: n = !1, items: r, align: i = "end", tr
237
244
  m(() => {
238
245
  if (!s || !l.current || !u.current) return;
239
246
  let e = () => {
240
- l.current && u.current && N(l.current, u.current, i);
247
+ l.current && u.current && ie(l.current, u.current, i);
241
248
  };
242
249
  return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
243
250
  window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
@@ -257,7 +264,7 @@ function P({ label: e, icon: t, iconOnly: n = !1, items: r, align: i = "end", tr
257
264
  }
258
265
  return /* @__PURE__ */ x("div", {
259
266
  className: C("hds-menu", o),
260
- children: [/* @__PURE__ */ b(O, {
267
+ children: [/* @__PURE__ */ b(D, {
261
268
  ref: l,
262
269
  variant: a,
263
270
  icon: t,
@@ -293,7 +300,7 @@ function P({ label: e, icon: t, iconOnly: n = !1, items: r, align: i = "end", tr
293
300
  }
294
301
  //#endregion
295
302
  //#region src/components/FloatingButton/FloatingButton.tsx
296
- var F = l(function({ label: e, position: t = "bottom-right", type: n = "button", className: r, ...i }, a) {
303
+ var M = l(function({ label: e, position: t = "bottom-right", type: n = "button", className: r, ...i }, a) {
297
304
  return /* @__PURE__ */ b("button", {
298
305
  ...i,
299
306
  ref: a,
@@ -302,8 +309,8 @@ var F = l(function({ label: e, position: t = "bottom-right", type: n = "button",
302
309
  title: e,
303
310
  className: C("hds-glass", "hds-fab", `hds-fab--${t}`, r)
304
311
  });
305
- }), I = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
306
- function re({ open: e, onClose: t, title: n, description: r, children: i, footer: a, closeLabel: o = "Fechar", initialFocus: s = "first", size: c = "md", className: l }) {
312
+ }), N = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
313
+ function P({ open: e, onClose: t, title: n, description: r, children: i, footer: a, closeLabel: o = "Fechar", initialFocus: s = "first", size: c = "md", className: l }) {
307
314
  let u = g(null), d = p(), m = p(), h = g(t);
308
315
  return f(() => {
309
316
  h.current = t;
@@ -311,15 +318,16 @@ function re({ open: e, onClose: t, title: n, description: r, children: i, footer
311
318
  if (!e) return;
312
319
  let t = document.activeElement, n = document.body.style.overflow;
313
320
  document.body.style.overflow = "hidden";
314
- let r = u.current?.querySelectorAll(I) ?? [];
321
+ let r = u.current?.querySelectorAll(N) ?? [];
315
322
  (s === "panel" || r.length === 0 ? u.current : r[0])?.focus();
316
323
  function i(e) {
317
324
  if (e.key === "Escape") {
325
+ if (e.defaultPrevented) return;
318
326
  e.preventDefault(), h.current();
319
327
  return;
320
328
  }
321
329
  if (e.key !== "Tab" || !u.current) return;
322
- let t = Array.from(u.current.querySelectorAll(I));
330
+ let t = Array.from(u.current.querySelectorAll(N));
323
331
  if (t.length === 0) return;
324
332
  let n = t[0], r = t[t.length - 1];
325
333
  e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus());
@@ -352,11 +360,11 @@ function re({ open: e, onClose: t, title: n, description: r, children: i, footer
352
360
  id: m,
353
361
  className: "hds-dialog-description",
354
362
  children: r
355
- }) : null] }), /* @__PURE__ */ b(O, {
363
+ }) : null] }), /* @__PURE__ */ b(D, {
356
364
  variant: "ghost",
357
365
  size: "sm",
358
366
  iconOnly: !0,
359
- icon: /* @__PURE__ */ b(D, { name: "x" }),
367
+ icon: /* @__PURE__ */ b(E, { name: "x" }),
360
368
  "aria-label": o,
361
369
  onClick: t
362
370
  })]
@@ -372,13 +380,13 @@ function re({ open: e, onClose: t, title: n, description: r, children: i, footer
372
380
  }
373
381
  //#endregion
374
382
  //#region src/components/Toast/ToastView.tsx
375
- var ie = {
383
+ var F = {
376
384
  neutral: "info",
377
385
  success: "circle-check",
378
386
  warning: "triangle-alert",
379
387
  danger: "circle-x"
380
388
  };
381
- function L({ tone: e, title: t, description: n, duration: r, onClose: i, closeLabel: a, className: o }) {
389
+ function I({ tone: e, title: t, description: n, duration: r, onClose: i, closeLabel: a, className: o }) {
382
390
  let [s, c] = _(!1), l = g(i);
383
391
  return f(() => {
384
392
  l.current = i;
@@ -394,7 +402,7 @@ function L({ tone: e, title: t, description: n, duration: r, onClose: i, closeLa
394
402
  onFocus: () => c(!0),
395
403
  onBlur: () => c(!1),
396
404
  children: [
397
- /* @__PURE__ */ b(D, { name: ie[e] }),
405
+ /* @__PURE__ */ b(E, { name: F[e] }),
398
406
  /* @__PURE__ */ x("div", {
399
407
  className: "hds-toast-body",
400
408
  children: [/* @__PURE__ */ b("p", {
@@ -405,11 +413,11 @@ function L({ tone: e, title: t, description: n, duration: r, onClose: i, closeLa
405
413
  children: n
406
414
  }) : null]
407
415
  }),
408
- i ? /* @__PURE__ */ b(O, {
416
+ i ? /* @__PURE__ */ b(D, {
409
417
  variant: "ghost",
410
418
  size: "sm",
411
419
  iconOnly: !0,
412
- icon: /* @__PURE__ */ b(D, { name: "x" }),
420
+ icon: /* @__PURE__ */ b(E, { name: "x" }),
413
421
  "aria-label": a,
414
422
  onClick: i
415
423
  }) : null
@@ -418,10 +426,10 @@ function L({ tone: e, title: t, description: n, duration: r, onClose: i, closeLa
418
426
  }
419
427
  //#endregion
420
428
  //#region src/components/Toast/Toast.tsx
421
- function R({ open: e, onClose: t, tone: n = "neutral", title: r, description: i, duration: a = 5e3, closeLabel: o = "Fechar aviso", className: s }) {
429
+ function L({ open: e, onClose: t, tone: n = "neutral", title: r, description: i, duration: a = 5e3, closeLabel: o = "Fechar aviso", className: s }) {
422
430
  return e ? S(/* @__PURE__ */ b("div", {
423
431
  className: "hds-toast-region",
424
- children: /* @__PURE__ */ b(L, {
432
+ children: /* @__PURE__ */ b(I, {
425
433
  tone: n,
426
434
  title: r,
427
435
  description: i,
@@ -434,8 +442,8 @@ function R({ open: e, onClose: t, tone: n = "neutral", title: r, description: i,
434
442
  }
435
443
  //#endregion
436
444
  //#region src/components/Toast/ToastProvider.tsx
437
- var z = c(null);
438
- function B({ children: e, max: t = 3, closeLabel: n = "Fechar aviso" }) {
445
+ var R = c(null);
446
+ function z({ children: e, max: t = 3, closeLabel: n = "Fechar aviso" }) {
439
447
  let [r, i] = _([]), a = g(0), o = u((e) => {
440
448
  i((t) => t.filter((t) => t.id !== e));
441
449
  }, []), s = u(({ title: e, description: n, tone: r = "neutral", duration: o = 5e3 }) => {
@@ -471,11 +479,11 @@ function B({ children: e, max: t = 3, closeLabel: n = "Fechar aviso" }) {
471
479
  tone: "neutral"
472
480
  })
473
481
  }), [s, o]);
474
- return /* @__PURE__ */ x(z.Provider, {
482
+ return /* @__PURE__ */ x(R.Provider, {
475
483
  value: c,
476
484
  children: [e, r.length ? S(/* @__PURE__ */ b("div", {
477
485
  className: "hds-toast-region",
478
- children: r.map((e) => /* @__PURE__ */ b(L, {
486
+ children: r.map((e) => /* @__PURE__ */ b(I, {
479
487
  tone: e.tone,
480
488
  title: e.title,
481
489
  description: e.description,
@@ -486,14 +494,14 @@ function B({ children: e, max: t = 3, closeLabel: n = "Fechar aviso" }) {
486
494
  }), document.body) : null]
487
495
  });
488
496
  }
489
- function V() {
490
- let e = d(z);
497
+ function B() {
498
+ let e = d(R);
491
499
  if (!e) throw Error("useToast must be used inside a ToastProvider.");
492
500
  return e;
493
501
  }
494
502
  //#endregion
495
503
  //#region src/internal/field.tsx
496
- function H(e) {
504
+ function V(e) {
497
505
  let t = p(), n = e ?? t;
498
506
  return {
499
507
  id: n,
@@ -501,7 +509,7 @@ function H(e) {
501
509
  error: `${n}-error`
502
510
  };
503
511
  }
504
- function U(e, t) {
512
+ function H(e, t) {
505
513
  let n = [
506
514
  e.hint && t.hint,
507
515
  e.error && t.error,
@@ -509,7 +517,7 @@ function U(e, t) {
509
517
  ].filter(Boolean);
510
518
  return n.length ? n.join(" ") : void 0;
511
519
  }
512
- function W({ hint: e, error: t, ids: n }) {
520
+ function ae({ hint: e, error: t, ids: n }) {
513
521
  return /* @__PURE__ */ x(y, { children: [e ? /* @__PURE__ */ b("p", {
514
522
  id: n.hint,
515
523
  className: "hds-hint",
@@ -517,13 +525,13 @@ function W({ hint: e, error: t, ids: n }) {
517
525
  }) : null, t ? /* @__PURE__ */ x("p", {
518
526
  id: n.error,
519
527
  className: "hds-error",
520
- children: [/* @__PURE__ */ b(D, { name: "circle-x" }), t]
528
+ children: [/* @__PURE__ */ b(E, { name: "circle-x" }), t]
521
529
  }) : null] });
522
530
  }
523
531
  //#endregion
524
532
  //#region src/components/Input/Input.tsx
525
- var G = l(function({ label: e, hint: t, error: n, numeric: r = !1, id: i, className: a, ...o }, s) {
526
- let c = H(i);
533
+ var oe = l(function({ label: e, hint: t, error: n, numeric: r = !1, id: i, className: a, ...o }, s) {
534
+ let c = V(i);
527
535
  return /* @__PURE__ */ x("div", {
528
536
  className: C("hds-field", a),
529
537
  children: [
@@ -538,22 +546,22 @@ var G = l(function({ label: e, hint: t, error: n, numeric: r = !1, id: i, classN
538
546
  ref: s,
539
547
  id: c.id,
540
548
  "aria-invalid": n ? !0 : void 0,
541
- "aria-describedby": U({
549
+ "aria-describedby": H({
542
550
  hint: t,
543
551
  error: n,
544
552
  "aria-describedby": o["aria-describedby"]
545
553
  }, c),
546
554
  className: C("hds-input", r && "hds-input--numeric")
547
555
  }),
548
- /* @__PURE__ */ b(W, {
556
+ /* @__PURE__ */ b(ae, {
549
557
  hint: t,
550
558
  error: n,
551
559
  ids: c
552
560
  })
553
561
  ]
554
562
  });
555
- }), K = l(function({ label: e, options: t, placeholder: n, hint: r, error: i, id: a, className: o, ...s }, c) {
556
- let l = H(a);
563
+ }), se = l(function({ label: e, options: t, placeholder: n, hint: r, error: i, id: a, className: o, ...s }, c) {
564
+ let l = V(a);
557
565
  return /* @__PURE__ */ x("div", {
558
566
  className: C("hds-field", o),
559
567
  children: [
@@ -569,7 +577,7 @@ var G = l(function({ label: e, hint: t, error: n, numeric: r = !1, id: i, classN
569
577
  ref: c,
570
578
  id: l.id,
571
579
  "aria-invalid": i ? !0 : void 0,
572
- "aria-describedby": U({
580
+ "aria-describedby": H({
573
581
  hint: r,
574
582
  error: i,
575
583
  "aria-describedby": s["aria-describedby"]
@@ -584,17 +592,256 @@ var G = l(function({ label: e, hint: t, error: n, numeric: r = !1, id: i, classN
584
592
  disabled: e.disabled,
585
593
  children: e.label
586
594
  }, e.value))]
587
- }), /* @__PURE__ */ b(D, { name: "chevron-down" })]
595
+ }), /* @__PURE__ */ b(E, { name: "chevron-down" })]
588
596
  }),
589
- /* @__PURE__ */ b(W, {
597
+ /* @__PURE__ */ b(ae, {
590
598
  hint: r,
591
599
  error: i,
592
600
  ids: l
593
601
  })
594
602
  ]
595
603
  });
596
- }), q = l(function({ label: e, hint: t, id: n, className: r, ...i }, a) {
597
- let o = H(n);
604
+ });
605
+ //#endregion
606
+ //#region src/components/DateInput/dates.ts
607
+ function U(e) {
608
+ let t = (e) => String(e).padStart(2, "0");
609
+ return `${e.getFullYear()}-${t(e.getMonth() + 1)}-${t(e.getDate())}`;
610
+ }
611
+ function W(e) {
612
+ let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e ?? "");
613
+ if (!t) return null;
614
+ let n = new Date(Number(t[1]), Number(t[2]) - 1, Number(t[3]));
615
+ return U(n) === e ? n : null;
616
+ }
617
+ function G(e) {
618
+ let t = W(e);
619
+ if (!t) return "";
620
+ let n = (e) => String(e).padStart(2, "0");
621
+ return `${n(t.getDate())}/${n(t.getMonth() + 1)}/${t.getFullYear()}`;
622
+ }
623
+ function ce(e) {
624
+ let t = e.trim(), n = /^\d{8}$/.test(t) ? [
625
+ t.slice(0, 2),
626
+ t.slice(2, 4),
627
+ t.slice(4)
628
+ ] : /^(\d{1,2})[/.-](\d{1,2})[/.-](\d{4})$/.exec(t)?.slice(1);
629
+ if (!n) return null;
630
+ let [r, i, a] = n.map(Number), o = new Date(a, i - 1, r);
631
+ return o.getFullYear() === a && o.getMonth() === i - 1 && o.getDate() === r ? U(o) : null;
632
+ }
633
+ function K(e, t) {
634
+ return new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
635
+ }
636
+ function q(e, t) {
637
+ let n = new Date(e.getFullYear(), e.getMonth() + t, 1), r = new Date(n.getFullYear(), n.getMonth() + 1, 0).getDate();
638
+ return new Date(n.getFullYear(), n.getMonth(), Math.min(e.getDate(), r));
639
+ }
640
+ function le(e, t) {
641
+ let n = new Date(e.getFullYear(), e.getMonth(), 1), r = K(n, -((n.getDay() - t + 7) % 7));
642
+ return Array.from({ length: 6 }, (e, t) => Array.from({ length: 7 }, (e, n) => K(r, t * 7 + n)));
643
+ }
644
+ function ue(e, t, n) {
645
+ return (!t || e >= t) && (!n || e <= n);
646
+ }
647
+ //#endregion
648
+ //#region src/components/DateInput/DateInput.tsx
649
+ var de = () => U(/* @__PURE__ */ new Date());
650
+ function J({ 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", name: h, id: v, disabled: y, required: T, placeholder: ee = "dd/mm/aaaa", className: te, ...O }) {
651
+ let k = V(v), [ne, re] = _(n), A = t === void 0 ? ne : t, [j, M] = _(() => G(A)), [N, P] = _(!1), [F, I] = _(() => W(A) ?? /* @__PURE__ */ new Date()), L = g(null), R = g(null), z = g(null), B = g(!1), [oe, se] = _(A);
652
+ oe !== A && (se(A), M(G(A)));
653
+ function J(e) {
654
+ t === void 0 && re(e), e !== A && r?.(e);
655
+ }
656
+ function fe(e) {
657
+ if (M(e), e.trim() === "") {
658
+ J("");
659
+ return;
660
+ }
661
+ let t = ce(e);
662
+ t && ue(t, i, a) && J(t);
663
+ }
664
+ function pe() {
665
+ I(W(A) ?? W(de()) ?? /* @__PURE__ */ new Date()), B.current = !0, P(!0);
666
+ }
667
+ function Y(e) {
668
+ P(!1), e && R.current?.focus();
669
+ }
670
+ function me(e) {
671
+ let t = U(e);
672
+ ue(t, i, a) && (J(t), M(G(t)), Y(!0));
673
+ }
674
+ m(() => {
675
+ if (!N || !L.current || !z.current) return;
676
+ let e = () => {
677
+ L.current && z.current && ie(L.current, z.current, "start");
678
+ };
679
+ return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
680
+ window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
681
+ };
682
+ }, [N]), f(() => {
683
+ N && B.current && (B.current = !1, z.current?.querySelector("[tabindex=\"0\"]")?.focus());
684
+ }), f(() => {
685
+ if (!N) return;
686
+ function e(e) {
687
+ let t = e.target;
688
+ L.current?.contains(t) || z.current?.contains(t) || P(!1);
689
+ }
690
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
691
+ }, [N]);
692
+ function he(e) {
693
+ B.current = !0, I(e);
694
+ }
695
+ function ge(e) {
696
+ let t = {
697
+ ArrowLeft: () => K(F, -1),
698
+ ArrowRight: () => K(F, 1),
699
+ ArrowUp: () => K(F, -7),
700
+ ArrowDown: () => K(F, 7),
701
+ Home: () => K(F, -((F.getDay() - l + 7) % 7)),
702
+ End: () => K(F, 6 - (F.getDay() - l + 7) % 7),
703
+ PageUp: () => q(F, e.shiftKey ? -12 : -1),
704
+ PageDown: () => q(F, e.shiftKey ? 12 : 1)
705
+ }[e.key];
706
+ t && (e.preventDefault(), he(t()));
707
+ }
708
+ function _e(e) {
709
+ (e.key === "Escape" || e.key === "Tab") && (e.preventDefault(), Y(!0));
710
+ }
711
+ let X = new Intl.DateTimeFormat(c, {
712
+ month: "long",
713
+ year: "numeric"
714
+ }).format(F), Z = X.charAt(0).toLocaleUpperCase(c) + X.slice(1), ve = new Intl.DateTimeFormat(c, { dateStyle: "full" }), Q = le(F, l)[0].map((e) => ({
715
+ short: new Intl.DateTimeFormat(c, { weekday: "narrow" }).format(e),
716
+ long: new Intl.DateTimeFormat(c, { weekday: "long" }).format(e)
717
+ })), ye = U(F), be = de(), $ = `${k.id}-calendar-title`;
718
+ return /* @__PURE__ */ x("div", {
719
+ className: C("hds-field", te),
720
+ children: [
721
+ /* @__PURE__ */ b("label", {
722
+ className: "hds-label",
723
+ htmlFor: k.id,
724
+ children: e
725
+ }),
726
+ /* @__PURE__ */ x("div", {
727
+ ref: L,
728
+ className: "hds-date-wrap",
729
+ children: [
730
+ /* @__PURE__ */ b("input", {
731
+ ...O,
732
+ id: k.id,
733
+ type: "text",
734
+ inputMode: "numeric",
735
+ autoComplete: "off",
736
+ placeholder: ee,
737
+ value: j,
738
+ disabled: y,
739
+ required: T,
740
+ "aria-invalid": s ? !0 : void 0,
741
+ "aria-describedby": H({
742
+ hint: o,
743
+ error: s,
744
+ "aria-describedby": O["aria-describedby"]
745
+ }, k),
746
+ className: "hds-input hds-input--numeric hds-date-input",
747
+ onChange: (e) => fe(e.target.value),
748
+ onBlur: (e) => {
749
+ O.onBlur?.(e), j.trim() !== "" && ce(j) !== A && M(G(A));
750
+ }
751
+ }),
752
+ /* @__PURE__ */ b(D, {
753
+ ref: R,
754
+ variant: "ghost",
755
+ size: "sm",
756
+ iconOnly: !0,
757
+ icon: /* @__PURE__ */ b(E, { name: "calendar" }),
758
+ "aria-label": u,
759
+ "aria-haspopup": "dialog",
760
+ "aria-expanded": N,
761
+ disabled: y,
762
+ className: "hds-date-button",
763
+ onClick: () => N ? Y(!1) : pe()
764
+ }),
765
+ h ? /* @__PURE__ */ b("input", {
766
+ type: "hidden",
767
+ name: h,
768
+ value: A
769
+ }) : null
770
+ ]
771
+ }),
772
+ /* @__PURE__ */ b(ae, {
773
+ hint: o,
774
+ error: s,
775
+ ids: k
776
+ }),
777
+ N ? S(/* @__PURE__ */ x(w, {
778
+ ref: z,
779
+ role: "dialog",
780
+ tone: "thick",
781
+ "aria-labelledby": $,
782
+ className: "hds-date-panel",
783
+ onKeyDown: _e,
784
+ children: [/* @__PURE__ */ x("div", {
785
+ className: "hds-date-header",
786
+ children: [
787
+ /* @__PURE__ */ b(D, {
788
+ variant: "ghost",
789
+ size: "sm",
790
+ iconOnly: !0,
791
+ icon: /* @__PURE__ */ b(E, { name: "chevron-left" }),
792
+ "aria-label": d,
793
+ onClick: () => I(q(F, -1))
794
+ }),
795
+ /* @__PURE__ */ b("h2", {
796
+ id: $,
797
+ className: "hds-date-title",
798
+ "aria-live": "polite",
799
+ children: Z
800
+ }),
801
+ /* @__PURE__ */ b(D, {
802
+ variant: "ghost",
803
+ size: "sm",
804
+ iconOnly: !0,
805
+ icon: /* @__PURE__ */ b(E, { name: "chevron-right" }),
806
+ "aria-label": p,
807
+ onClick: () => I(q(F, 1))
808
+ })
809
+ ]
810
+ }), /* @__PURE__ */ x("table", {
811
+ role: "grid",
812
+ "aria-labelledby": $,
813
+ className: "hds-date-grid",
814
+ onKeyDown: ge,
815
+ children: [/* @__PURE__ */ b("thead", { children: /* @__PURE__ */ b("tr", { children: Q.map((e) => /* @__PURE__ */ b("th", {
816
+ scope: "col",
817
+ abbr: e.long,
818
+ children: e.short
819
+ }, e.long)) }) }), /* @__PURE__ */ b("tbody", { children: le(F, l).map((e) => /* @__PURE__ */ b("tr", { children: e.map((e) => {
820
+ let t = U(e), n = ue(t, i, a);
821
+ return /* @__PURE__ */ b("td", {
822
+ role: "gridcell",
823
+ "aria-selected": t === A,
824
+ children: /* @__PURE__ */ b("button", {
825
+ type: "button",
826
+ tabIndex: t === ye ? 0 : -1,
827
+ "aria-label": ve.format(e),
828
+ "aria-current": t === be ? "date" : void 0,
829
+ "aria-disabled": !n || void 0,
830
+ className: C("hds-date-day", e.getMonth() !== F.getMonth() && "hds-date-day--outside", t === A && "hds-date-day--selected"),
831
+ onClick: () => me(e),
832
+ children: e.getDate()
833
+ })
834
+ }, t);
835
+ }) }, U(e[0]))) })]
836
+ })]
837
+ }), document.body) : null
838
+ ]
839
+ });
840
+ }
841
+ //#endregion
842
+ //#region src/components/Checkbox/Checkbox.tsx
843
+ var fe = l(function({ label: e, hint: t, id: n, className: r, ...i }, a) {
844
+ let o = V(n);
598
845
  return /* @__PURE__ */ x("label", {
599
846
  className: C("hds-checkbox", r),
600
847
  htmlFor: o.id,
@@ -609,7 +856,7 @@ var G = l(function({ label: e, hint: t, error: n, numeric: r = !1, id: i, classN
609
856
  "aria-describedby": t ? o.hint : i["aria-describedby"]
610
857
  }), /* @__PURE__ */ b("span", {
611
858
  className: "hds-checkbox-box",
612
- children: /* @__PURE__ */ b(D, { name: "check" })
859
+ children: /* @__PURE__ */ b(E, { name: "check" })
613
860
  })]
614
861
  }), /* @__PURE__ */ x("span", {
615
862
  className: "hds-checkbox-text",
@@ -623,7 +870,7 @@ var G = l(function({ label: e, hint: t, error: n, numeric: r = !1, id: i, classN
623
870
  });
624
871
  //#endregion
625
872
  //#region src/components/Card/Card.tsx
626
- function J({ as: e = "article", eyebrow: t, title: n, media: r, footer: i, interactive: a = !1, className: o, children: s, ...c }) {
873
+ function pe({ as: e = "article", eyebrow: t, title: n, media: r, footer: i, interactive: a = !1, className: o, children: s, ...c }) {
627
874
  return /* @__PURE__ */ x(e, {
628
875
  ...c,
629
876
  className: C("hds-card", a && "hds-card--interactive", o),
@@ -659,14 +906,14 @@ function J({ as: e = "article", eyebrow: t, title: n, media: r, footer: i, inter
659
906
  }
660
907
  //#endregion
661
908
  //#region src/components/Badge/Badge.tsx
662
- var ae = {
909
+ var Y = {
663
910
  accent: "info",
664
911
  success: "circle-check",
665
912
  warning: "triangle-alert",
666
913
  danger: "circle-x"
667
914
  };
668
- function oe({ tone: e = "neutral", icon: t, children: n, className: r }) {
669
- let i = ae[e], a = t === !1 ? null : t ?? (i ? /* @__PURE__ */ b(D, { name: i }) : null);
915
+ function me({ tone: e = "neutral", icon: t, children: n, className: r }) {
916
+ let i = Y[e], a = t === !1 ? null : t ?? (i ? /* @__PURE__ */ b(E, { name: i }) : null);
670
917
  return /* @__PURE__ */ x("span", {
671
918
  className: C("hds-badge", `hds-badge--${e}`, r),
672
919
  children: [a, n]
@@ -674,12 +921,12 @@ function oe({ tone: e = "neutral", icon: t, children: n, className: r }) {
674
921
  }
675
922
  //#endregion
676
923
  //#region src/components/Table/Table.tsx
677
- function Y(e) {
924
+ function he(e) {
678
925
  return e.numeric ? "hds-cell--numeric" : e.align === "center" ? "hds-cell--center" : void 0;
679
926
  }
680
- function se({ columns: e, rows: t, rowKey: n = "id", caption: r, hideCaption: i = !1, empty: a = "Nada para mostrar.", maxHeight: o, className: s }) {
927
+ function ge({ columns: e, rows: t, rowKey: n = "id", caption: r, hideCaption: i = !1, empty: a = "Nada para mostrar.", maxHeight: o, glass: s = !1, className: c }) {
681
928
  return /* @__PURE__ */ b("div", {
682
- className: C("hds-table-wrap", "hds-scroll", s),
929
+ className: C("hds-table-wrap", "hds-scroll", s && "hds-glass hds-table-wrap--glass", c),
683
930
  role: "region",
684
931
  "aria-label": r,
685
932
  tabIndex: 0,
@@ -693,11 +940,11 @@ function se({ columns: e, rows: t, rowKey: n = "id", caption: r, hideCaption: i
693
940
  }) : null,
694
941
  /* @__PURE__ */ b("thead", { children: /* @__PURE__ */ b("tr", { children: e.map((e) => /* @__PURE__ */ b("th", {
695
942
  scope: "col",
696
- className: Y(e),
943
+ className: he(e),
697
944
  children: e.header
698
945
  }, e.key)) }) }),
699
946
  /* @__PURE__ */ b("tbody", { children: t.length ? t.map((t, r) => /* @__PURE__ */ b("tr", { children: e.map((e) => /* @__PURE__ */ b("td", {
700
- className: Y(e),
947
+ className: he(e),
701
948
  children: e.render ? e.render(t) : t[e.key]
702
949
  }, e.key)) }, String(t[n] ?? r))) : /* @__PURE__ */ b("tr", { children: /* @__PURE__ */ b("td", {
703
950
  colSpan: e.length || 1,
@@ -710,19 +957,19 @@ function se({ columns: e, rows: t, rowKey: n = "id", caption: r, hideCaption: i
710
957
  }
711
958
  //#endregion
712
959
  //#region src/appearance/useAppearance.ts
713
- var X = !1, Z = {
960
+ var _e = !1, X = {
714
961
  theme: "dark",
715
962
  transparency: "full"
716
- }, Q = Z;
717
- function ce() {
963
+ }, Z = X;
964
+ function ve() {
718
965
  let e = a();
719
- return (e.theme !== Q.theme || e.transparency !== Q.transparency) && (Q = e), Q;
966
+ return (e.theme !== Z.theme || e.transparency !== Z.transparency) && (Z = e), Z;
720
967
  }
721
- function $() {
968
+ function Q() {
722
969
  f(() => {
723
- X || (X = !0, document.documentElement.hasAttribute("data-theme") || r());
970
+ _e || (_e = !0, document.documentElement.hasAttribute("data-theme") || r());
724
971
  }, []);
725
- let e = v(o, ce, () => Z);
972
+ let e = v(o, ve, () => X);
726
973
  return {
727
974
  ...e,
728
975
  setTheme: t,
@@ -733,25 +980,25 @@ function $() {
733
980
  }
734
981
  //#endregion
735
982
  //#region src/components/AppearanceToggles/AppearanceToggles.tsx
736
- function le({ lightLabel: e = "Mudar para o tema claro", darkLabel: t = "Mudar para o tema escuro", variant: n = "ghost", ...r }) {
737
- let { theme: i, toggleTheme: a } = $(), o = i === "dark" ? e : t;
738
- return /* @__PURE__ */ b(O, {
983
+ function ye({ lightLabel: e = "Mudar para o tema claro", darkLabel: t = "Mudar para o tema escuro", variant: n = "ghost", ...r }) {
984
+ let { theme: i, toggleTheme: a } = Q(), o = i === "dark" ? e : t;
985
+ return /* @__PURE__ */ b(D, {
739
986
  ...r,
740
987
  variant: n,
741
988
  iconOnly: !0,
742
- icon: /* @__PURE__ */ b(D, { name: i === "dark" ? "sun" : "moon" }),
989
+ icon: /* @__PURE__ */ b(E, { name: i === "dark" ? "sun" : "moon" }),
743
990
  "aria-label": o,
744
991
  title: o,
745
992
  onClick: a
746
993
  });
747
994
  }
748
- function ue({ label: e = "Reduzir transparência", variant: t = "ghost", ...n }) {
749
- let { transparency: r, toggleTransparency: i } = $();
750
- return /* @__PURE__ */ b(O, {
995
+ function be({ label: e = "Reduzir transparência", variant: t = "ghost", ...n }) {
996
+ let { transparency: r, toggleTransparency: i } = Q();
997
+ return /* @__PURE__ */ b(D, {
751
998
  ...n,
752
999
  variant: t,
753
1000
  iconOnly: !0,
754
- icon: /* @__PURE__ */ b(D, { name: "blend" }),
1001
+ icon: /* @__PURE__ */ b(E, { name: "blend" }),
755
1002
  "aria-label": e,
756
1003
  "aria-pressed": r === "reduced",
757
1004
  title: e,
@@ -760,7 +1007,7 @@ function ue({ label: e = "Reduzir transparência", variant: t = "ghost", ...n })
760
1007
  }
761
1008
  //#endregion
762
1009
  //#region src/components/Container/Container.tsx
763
- function de({ as: e = "section", withSidebar: t = !1, className: n, ...r }) {
1010
+ function $({ as: e = "section", withSidebar: t = !1, className: n, ...r }) {
764
1011
  return /* @__PURE__ */ b(e, {
765
1012
  ...r,
766
1013
  className: C("hds-container", t && "hds-container--with-sidebar", n)
@@ -768,7 +1015,7 @@ function de({ as: e = "section", withSidebar: t = !1, className: n, ...r }) {
768
1015
  }
769
1016
  //#endregion
770
1017
  //#region src/components/SectionTitle/SectionTitle.tsx
771
- function fe({ children: e, index: t, as: n = "h2", id: r, className: i }) {
1018
+ function xe({ children: e, index: t, as: n = "h2", id: r, className: i }) {
772
1019
  return /* @__PURE__ */ x(n, {
773
1020
  id: r,
774
1021
  className: C("hds-section-title", i),
@@ -781,7 +1028,7 @@ function fe({ children: e, index: t, as: n = "h2", id: r, className: i }) {
781
1028
  }
782
1029
  //#endregion
783
1030
  //#region src/components/Separator/Separator.tsx
784
- function pe({ orientation: e = "horizontal", decorative: t = !1, className: n }) {
1031
+ function Se({ orientation: e = "horizontal", decorative: t = !1, className: n }) {
785
1032
  return /* @__PURE__ */ b("div", {
786
1033
  role: t ? "none" : "separator",
787
1034
  "aria-orientation": t ? void 0 : e,
@@ -790,7 +1037,7 @@ function pe({ orientation: e = "horizontal", decorative: t = !1, className: n })
790
1037
  }
791
1038
  //#endregion
792
1039
  //#region src/components/ScrollArea/ScrollArea.tsx
793
- function me({ label: e, maxHeight: t, className: n, style: r, ...i }) {
1040
+ function Ce({ label: e, maxHeight: t, className: n, style: r, ...i }) {
794
1041
  return /* @__PURE__ */ b("div", {
795
1042
  ...i,
796
1043
  role: "region",
@@ -805,11 +1052,11 @@ function me({ label: e, maxHeight: t, className: n, style: r, ...i }) {
805
1052
  }
806
1053
  //#endregion
807
1054
  //#region src/components/Loading/Loading.tsx
808
- function he({ size: e = "md", label: t = "Carregando…", showLabel: n = !1, className: r }) {
1055
+ function we({ size: e = "md", label: t = "Carregando…", showLabel: n = !1, className: r }) {
809
1056
  return /* @__PURE__ */ x("span", {
810
1057
  role: "status",
811
1058
  className: C("hds-loading", `hds-loading--${e}`, r),
812
- children: [/* @__PURE__ */ b(D, { name: "loader" }), /* @__PURE__ */ b("span", {
1059
+ children: [/* @__PURE__ */ b(E, { name: "loader" }), /* @__PURE__ */ b("span", {
813
1060
  className: n ? void 0 : "hds-visually-hidden",
814
1061
  children: t
815
1062
  })]
@@ -817,7 +1064,7 @@ function he({ size: e = "md", label: t = "Carregando…", showLabel: n = !1, cla
817
1064
  }
818
1065
  //#endregion
819
1066
  //#region src/components/GlowAvatar/GlowAvatar.tsx
820
- function ge({ src: e, alt: t, size: n = 96, className: r }) {
1067
+ function Te({ src: e, alt: t, size: n = 96, className: r }) {
821
1068
  return /* @__PURE__ */ x("span", {
822
1069
  className: C("hds-avatar", r),
823
1070
  style: {
@@ -837,6 +1084,6 @@ function ge({ src: e, alt: t, size: n = 96, className: r }) {
837
1084
  });
838
1085
  }
839
1086
  //#endregion
840
- export { s as APPEARANCE_STORAGE_KEYS, oe as Badge, O as Button, J as Card, q as Checkbox, de as Container, re as Dialog, F as FloatingButton, w as GlassPanel, ge as GlowAvatar, G as Input, he as Loading, P as Menu, te as NavBar, me as ScrollArea, fe as SectionTitle, j as SegmentedControl, K as Select, pe as Separator, ne as Sidebar, se as Table, le as ThemeToggle, R as Toast, B as ToastProvider, ue as TransparencyToggle, r as applyStoredAppearance, e as enableGlassRefraction, a as getAppearance, n as readStoredAppearance, t as setTheme, i as setTransparency, o as subscribeToAppearance, $ as useAppearance, V as useToast };
1087
+ export { s as APPEARANCE_STORAGE_KEYS, me as Badge, D as Button, pe as Card, fe as Checkbox, $ as Container, J as DateInput, P as Dialog, M as FloatingButton, w as GlassPanel, Te as GlowAvatar, oe as Input, we as Loading, j as Menu, k as NavBar, Ce as ScrollArea, xe as SectionTitle, A as SegmentedControl, se as Select, Se as Separator, ne as Sidebar, ge as Table, ye as ThemeToggle, L as Toast, z as ToastProvider, be as TransparencyToggle, r as applyStoredAppearance, e as enableGlassRefraction, a as getAppearance, n as readStoredAppearance, t as setTheme, i as setTransparency, o as subscribeToAppearance, Q as useAppearance, B as useToast };
841
1088
 
842
1089
  //# sourceMappingURL=index.js.map