@hemerson/design-system 0.4.0 → 0.6.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,60 +230,68 @@ 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 }) {
233
- let [s, c] = _(!1), l = g(null), u = g(null), d = p(), h = () => Array.from(u.current?.querySelectorAll("[role=\"menuitem\"]") ?? []);
234
- function v(e) {
235
- c(!1), e && l.current?.focus();
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", header: o, className: s }) {
240
+ let [c, l] = _(!1), u = g(null), d = g(null), h = p(), v = () => Array.from(d.current?.querySelectorAll("[role=\"menuitem\"]") ?? []);
241
+ function T(e) {
242
+ l(!1), e && u.current?.focus();
236
243
  }
237
244
  m(() => {
238
- if (!s || !l.current || !u.current) return;
245
+ if (!c || !u.current || !d.current) return;
239
246
  let e = () => {
240
- l.current && u.current && N(l.current, u.current, i);
247
+ u.current && d.current && ie(u.current, d.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);
244
251
  };
245
- }, [s, i]), f(() => {
246
- if (!s) return;
247
- h()[0]?.focus();
252
+ }, [c, i]), f(() => {
253
+ if (!c) return;
254
+ v()[0]?.focus();
248
255
  function e(e) {
249
256
  let t = e.target;
250
- l.current?.contains(t) || u.current?.contains(t) || c(!1);
257
+ u.current?.contains(t) || d.current?.contains(t) || l(!1);
251
258
  }
252
259
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
253
- }, [s]);
254
- function y(e) {
255
- let t = h(), n = t.indexOf(document.activeElement);
256
- e.key === "Escape" || e.key === "Tab" ? (e.preventDefault(), v(!0)) : e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), t[(n + (e.key === "ArrowDown" ? 1 : -1) + t.length) % t.length]?.focus()) : (e.key === "Home" || e.key === "End") && (e.preventDefault(), (e.key === "Home" ? t[0] : t[t.length - 1])?.focus());
260
+ }, [c]);
261
+ function ee(e) {
262
+ let t = v(), n = t.indexOf(document.activeElement);
263
+ e.key === "Escape" || e.key === "Tab" ? (e.preventDefault(), T(!0)) : e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), t[(n + (e.key === "ArrowDown" ? 1 : -1) + t.length) % t.length]?.focus()) : (e.key === "Home" || e.key === "End") && (e.preventDefault(), (e.key === "Home" ? t[0] : t[t.length - 1])?.focus());
257
264
  }
258
265
  return /* @__PURE__ */ x("div", {
259
- className: C("hds-menu", o),
260
- children: [/* @__PURE__ */ b(O, {
261
- ref: l,
266
+ className: C("hds-menu", s),
267
+ children: [/* @__PURE__ */ b(D, {
268
+ ref: u,
262
269
  variant: a,
263
270
  icon: t,
264
271
  iconOnly: n,
265
272
  "aria-label": n ? e : void 0,
266
273
  "aria-haspopup": "menu",
267
- "aria-expanded": s,
268
- "aria-controls": s ? d : void 0,
269
- onClick: () => c(!s),
274
+ "aria-expanded": c,
275
+ "aria-controls": c ? h : void 0,
276
+ onClick: () => l(!c),
270
277
  children: e
271
- }), s ? S(/* @__PURE__ */ b(w, {
272
- ref: u,
273
- id: d,
278
+ }), c ? S(/* @__PURE__ */ x(w, {
279
+ ref: d,
280
+ id: h,
274
281
  role: "menu",
275
282
  "aria-label": e,
283
+ "aria-describedby": o ? `${h}-header` : void 0,
276
284
  className: "hds-menu-panel",
277
- onKeyDown: y,
278
- children: r.map((e, t) => e.separator ? /* @__PURE__ */ b("div", {
285
+ onKeyDown: ee,
286
+ children: [o ? /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("div", {
287
+ id: `${h}-header`,
288
+ role: "none",
289
+ className: "hds-menu-header",
290
+ children: o
291
+ }), /* @__PURE__ */ b("div", {
292
+ role: "separator",
293
+ className: "hds-menu-separator"
294
+ })] }) : null, r.map((e, t) => e.separator ? /* @__PURE__ */ b("div", {
279
295
  role: "separator",
280
296
  className: "hds-menu-separator"
281
297
  }, `separator-${t}`) : /* @__PURE__ */ x("button", {
@@ -284,16 +300,16 @@ function P({ label: e, icon: t, iconOnly: n = !1, items: r, align: i = "end", tr
284
300
  tabIndex: -1,
285
301
  className: C("hds-menu-item", e.danger && "hds-menu-item--danger"),
286
302
  onClick: () => {
287
- v(!0), e.onSelect?.();
303
+ T(!0), e.onSelect?.();
288
304
  },
289
305
  children: [e.icon, e.label]
290
- }, e.label))
306
+ }, e.label))]
291
307
  }), document.body) : null]
292
308
  });
293
309
  }
294
310
  //#endregion
295
311
  //#region src/components/FloatingButton/FloatingButton.tsx
296
- var F = l(function({ label: e, position: t = "bottom-right", type: n = "button", className: r, ...i }, a) {
312
+ var M = l(function({ label: e, position: t = "bottom-right", type: n = "button", className: r, ...i }, a) {
297
313
  return /* @__PURE__ */ b("button", {
298
314
  ...i,
299
315
  ref: a,
@@ -302,8 +318,8 @@ var F = l(function({ label: e, position: t = "bottom-right", type: n = "button",
302
318
  title: e,
303
319
  className: C("hds-glass", "hds-fab", `hds-fab--${t}`, r)
304
320
  });
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 }) {
321
+ }), N = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
322
+ 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
323
  let u = g(null), d = p(), m = p(), h = g(t);
308
324
  return f(() => {
309
325
  h.current = t;
@@ -311,15 +327,16 @@ function re({ open: e, onClose: t, title: n, description: r, children: i, footer
311
327
  if (!e) return;
312
328
  let t = document.activeElement, n = document.body.style.overflow;
313
329
  document.body.style.overflow = "hidden";
314
- let r = u.current?.querySelectorAll(I) ?? [];
330
+ let r = u.current?.querySelectorAll(N) ?? [];
315
331
  (s === "panel" || r.length === 0 ? u.current : r[0])?.focus();
316
332
  function i(e) {
317
333
  if (e.key === "Escape") {
334
+ if (e.defaultPrevented) return;
318
335
  e.preventDefault(), h.current();
319
336
  return;
320
337
  }
321
338
  if (e.key !== "Tab" || !u.current) return;
322
- let t = Array.from(u.current.querySelectorAll(I));
339
+ let t = Array.from(u.current.querySelectorAll(N));
323
340
  if (t.length === 0) return;
324
341
  let n = t[0], r = t[t.length - 1];
325
342
  e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus());
@@ -352,11 +369,11 @@ function re({ open: e, onClose: t, title: n, description: r, children: i, footer
352
369
  id: m,
353
370
  className: "hds-dialog-description",
354
371
  children: r
355
- }) : null] }), /* @__PURE__ */ b(O, {
372
+ }) : null] }), /* @__PURE__ */ b(D, {
356
373
  variant: "ghost",
357
374
  size: "sm",
358
375
  iconOnly: !0,
359
- icon: /* @__PURE__ */ b(D, { name: "x" }),
376
+ icon: /* @__PURE__ */ b(E, { name: "x" }),
360
377
  "aria-label": o,
361
378
  onClick: t
362
379
  })]
@@ -372,13 +389,13 @@ function re({ open: e, onClose: t, title: n, description: r, children: i, footer
372
389
  }
373
390
  //#endregion
374
391
  //#region src/components/Toast/ToastView.tsx
375
- var ie = {
392
+ var F = {
376
393
  neutral: "info",
377
394
  success: "circle-check",
378
395
  warning: "triangle-alert",
379
396
  danger: "circle-x"
380
397
  };
381
- function L({ tone: e, title: t, description: n, duration: r, onClose: i, closeLabel: a, className: o }) {
398
+ function I({ tone: e, title: t, description: n, duration: r, onClose: i, closeLabel: a, className: o }) {
382
399
  let [s, c] = _(!1), l = g(i);
383
400
  return f(() => {
384
401
  l.current = i;
@@ -394,7 +411,7 @@ function L({ tone: e, title: t, description: n, duration: r, onClose: i, closeLa
394
411
  onFocus: () => c(!0),
395
412
  onBlur: () => c(!1),
396
413
  children: [
397
- /* @__PURE__ */ b(D, { name: ie[e] }),
414
+ /* @__PURE__ */ b(E, { name: F[e] }),
398
415
  /* @__PURE__ */ x("div", {
399
416
  className: "hds-toast-body",
400
417
  children: [/* @__PURE__ */ b("p", {
@@ -405,11 +422,11 @@ function L({ tone: e, title: t, description: n, duration: r, onClose: i, closeLa
405
422
  children: n
406
423
  }) : null]
407
424
  }),
408
- i ? /* @__PURE__ */ b(O, {
425
+ i ? /* @__PURE__ */ b(D, {
409
426
  variant: "ghost",
410
427
  size: "sm",
411
428
  iconOnly: !0,
412
- icon: /* @__PURE__ */ b(D, { name: "x" }),
429
+ icon: /* @__PURE__ */ b(E, { name: "x" }),
413
430
  "aria-label": a,
414
431
  onClick: i
415
432
  }) : null
@@ -418,10 +435,10 @@ function L({ tone: e, title: t, description: n, duration: r, onClose: i, closeLa
418
435
  }
419
436
  //#endregion
420
437
  //#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 }) {
438
+ function L({ open: e, onClose: t, tone: n = "neutral", title: r, description: i, duration: a = 5e3, closeLabel: o = "Fechar aviso", className: s }) {
422
439
  return e ? S(/* @__PURE__ */ b("div", {
423
440
  className: "hds-toast-region",
424
- children: /* @__PURE__ */ b(L, {
441
+ children: /* @__PURE__ */ b(I, {
425
442
  tone: n,
426
443
  title: r,
427
444
  description: i,
@@ -434,8 +451,8 @@ function R({ open: e, onClose: t, tone: n = "neutral", title: r, description: i,
434
451
  }
435
452
  //#endregion
436
453
  //#region src/components/Toast/ToastProvider.tsx
437
- var z = c(null);
438
- function B({ children: e, max: t = 3, closeLabel: n = "Fechar aviso" }) {
454
+ var R = c(null);
455
+ function z({ children: e, max: t = 3, closeLabel: n = "Fechar aviso" }) {
439
456
  let [r, i] = _([]), a = g(0), o = u((e) => {
440
457
  i((t) => t.filter((t) => t.id !== e));
441
458
  }, []), s = u(({ title: e, description: n, tone: r = "neutral", duration: o = 5e3 }) => {
@@ -471,11 +488,11 @@ function B({ children: e, max: t = 3, closeLabel: n = "Fechar aviso" }) {
471
488
  tone: "neutral"
472
489
  })
473
490
  }), [s, o]);
474
- return /* @__PURE__ */ x(z.Provider, {
491
+ return /* @__PURE__ */ x(R.Provider, {
475
492
  value: c,
476
493
  children: [e, r.length ? S(/* @__PURE__ */ b("div", {
477
494
  className: "hds-toast-region",
478
- children: r.map((e) => /* @__PURE__ */ b(L, {
495
+ children: r.map((e) => /* @__PURE__ */ b(I, {
479
496
  tone: e.tone,
480
497
  title: e.title,
481
498
  description: e.description,
@@ -486,14 +503,14 @@ function B({ children: e, max: t = 3, closeLabel: n = "Fechar aviso" }) {
486
503
  }), document.body) : null]
487
504
  });
488
505
  }
489
- function V() {
490
- let e = d(z);
506
+ function B() {
507
+ let e = d(R);
491
508
  if (!e) throw Error("useToast must be used inside a ToastProvider.");
492
509
  return e;
493
510
  }
494
511
  //#endregion
495
512
  //#region src/internal/field.tsx
496
- function H(e) {
513
+ function V(e) {
497
514
  let t = p(), n = e ?? t;
498
515
  return {
499
516
  id: n,
@@ -501,7 +518,7 @@ function H(e) {
501
518
  error: `${n}-error`
502
519
  };
503
520
  }
504
- function U(e, t) {
521
+ function H(e, t) {
505
522
  let n = [
506
523
  e.hint && t.hint,
507
524
  e.error && t.error,
@@ -509,7 +526,7 @@ function U(e, t) {
509
526
  ].filter(Boolean);
510
527
  return n.length ? n.join(" ") : void 0;
511
528
  }
512
- function W({ hint: e, error: t, ids: n }) {
529
+ function ae({ hint: e, error: t, ids: n }) {
513
530
  return /* @__PURE__ */ x(y, { children: [e ? /* @__PURE__ */ b("p", {
514
531
  id: n.hint,
515
532
  className: "hds-hint",
@@ -517,13 +534,13 @@ function W({ hint: e, error: t, ids: n }) {
517
534
  }) : null, t ? /* @__PURE__ */ x("p", {
518
535
  id: n.error,
519
536
  className: "hds-error",
520
- children: [/* @__PURE__ */ b(D, { name: "circle-x" }), t]
537
+ children: [/* @__PURE__ */ b(E, { name: "circle-x" }), t]
521
538
  }) : null] });
522
539
  }
523
540
  //#endregion
524
541
  //#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);
542
+ var oe = l(function({ label: e, hint: t, error: n, numeric: r = !1, id: i, className: a, ...o }, s) {
543
+ let c = V(i);
527
544
  return /* @__PURE__ */ x("div", {
528
545
  className: C("hds-field", a),
529
546
  children: [
@@ -538,22 +555,22 @@ var G = l(function({ label: e, hint: t, error: n, numeric: r = !1, id: i, classN
538
555
  ref: s,
539
556
  id: c.id,
540
557
  "aria-invalid": n ? !0 : void 0,
541
- "aria-describedby": U({
558
+ "aria-describedby": H({
542
559
  hint: t,
543
560
  error: n,
544
561
  "aria-describedby": o["aria-describedby"]
545
562
  }, c),
546
563
  className: C("hds-input", r && "hds-input--numeric")
547
564
  }),
548
- /* @__PURE__ */ b(W, {
565
+ /* @__PURE__ */ b(ae, {
549
566
  hint: t,
550
567
  error: n,
551
568
  ids: c
552
569
  })
553
570
  ]
554
571
  });
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);
572
+ }), se = l(function({ label: e, options: t, placeholder: n, hint: r, error: i, id: a, className: o, ...s }, c) {
573
+ let l = V(a);
557
574
  return /* @__PURE__ */ x("div", {
558
575
  className: C("hds-field", o),
559
576
  children: [
@@ -569,7 +586,7 @@ var G = l(function({ label: e, hint: t, error: n, numeric: r = !1, id: i, classN
569
586
  ref: c,
570
587
  id: l.id,
571
588
  "aria-invalid": i ? !0 : void 0,
572
- "aria-describedby": U({
589
+ "aria-describedby": H({
573
590
  hint: r,
574
591
  error: i,
575
592
  "aria-describedby": s["aria-describedby"]
@@ -584,17 +601,256 @@ var G = l(function({ label: e, hint: t, error: n, numeric: r = !1, id: i, classN
584
601
  disabled: e.disabled,
585
602
  children: e.label
586
603
  }, e.value))]
587
- }), /* @__PURE__ */ b(D, { name: "chevron-down" })]
604
+ }), /* @__PURE__ */ b(E, { name: "chevron-down" })]
588
605
  }),
589
- /* @__PURE__ */ b(W, {
606
+ /* @__PURE__ */ b(ae, {
590
607
  hint: r,
591
608
  error: i,
592
609
  ids: l
593
610
  })
594
611
  ]
595
612
  });
596
- }), q = l(function({ label: e, hint: t, id: n, className: r, ...i }, a) {
597
- let o = H(n);
613
+ });
614
+ //#endregion
615
+ //#region src/components/DateInput/dates.ts
616
+ function U(e) {
617
+ let t = (e) => String(e).padStart(2, "0");
618
+ return `${e.getFullYear()}-${t(e.getMonth() + 1)}-${t(e.getDate())}`;
619
+ }
620
+ function W(e) {
621
+ let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e ?? "");
622
+ if (!t) return null;
623
+ let n = new Date(Number(t[1]), Number(t[2]) - 1, Number(t[3]));
624
+ return U(n) === e ? n : null;
625
+ }
626
+ function G(e) {
627
+ let t = W(e);
628
+ if (!t) return "";
629
+ let n = (e) => String(e).padStart(2, "0");
630
+ return `${n(t.getDate())}/${n(t.getMonth() + 1)}/${t.getFullYear()}`;
631
+ }
632
+ function ce(e) {
633
+ let t = e.trim(), n = /^\d{8}$/.test(t) ? [
634
+ t.slice(0, 2),
635
+ t.slice(2, 4),
636
+ t.slice(4)
637
+ ] : /^(\d{1,2})[/.-](\d{1,2})[/.-](\d{4})$/.exec(t)?.slice(1);
638
+ if (!n) return null;
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 ? U(o) : null;
641
+ }
642
+ function K(e, t) {
643
+ return new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
644
+ }
645
+ function q(e, t) {
646
+ let n = new Date(e.getFullYear(), e.getMonth() + t, 1), r = new Date(n.getFullYear(), n.getMonth() + 1, 0).getDate();
647
+ return new Date(n.getFullYear(), n.getMonth(), Math.min(e.getDate(), r));
648
+ }
649
+ function le(e, t) {
650
+ let n = new Date(e.getFullYear(), e.getMonth(), 1), r = K(n, -((n.getDay() - t + 7) % 7));
651
+ return Array.from({ length: 6 }, (e, t) => Array.from({ length: 7 }, (e, n) => K(r, t * 7 + n)));
652
+ }
653
+ function ue(e, t, n) {
654
+ return (!t || e >= t) && (!n || e <= n);
655
+ }
656
+ //#endregion
657
+ //#region src/components/DateInput/DateInput.tsx
658
+ var de = () => U(/* @__PURE__ */ new Date());
659
+ 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 }) {
660
+ 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);
661
+ oe !== A && (se(A), M(G(A)));
662
+ function J(e) {
663
+ t === void 0 && re(e), e !== A && r?.(e);
664
+ }
665
+ function fe(e) {
666
+ if (M(e), e.trim() === "") {
667
+ J("");
668
+ return;
669
+ }
670
+ let t = ce(e);
671
+ t && ue(t, i, a) && J(t);
672
+ }
673
+ function pe() {
674
+ I(W(A) ?? W(de()) ?? /* @__PURE__ */ new Date()), B.current = !0, P(!0);
675
+ }
676
+ function Y(e) {
677
+ P(!1), e && R.current?.focus();
678
+ }
679
+ function me(e) {
680
+ let t = U(e);
681
+ ue(t, i, a) && (J(t), M(G(t)), Y(!0));
682
+ }
683
+ m(() => {
684
+ if (!N || !L.current || !z.current) return;
685
+ let e = () => {
686
+ L.current && z.current && ie(L.current, z.current, "start");
687
+ };
688
+ return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
689
+ window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
690
+ };
691
+ }, [N]), f(() => {
692
+ N && B.current && (B.current = !1, z.current?.querySelector("[tabindex=\"0\"]")?.focus());
693
+ }), f(() => {
694
+ if (!N) return;
695
+ function e(e) {
696
+ let t = e.target;
697
+ L.current?.contains(t) || z.current?.contains(t) || P(!1);
698
+ }
699
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
700
+ }, [N]);
701
+ function he(e) {
702
+ B.current = !0, I(e);
703
+ }
704
+ function ge(e) {
705
+ let t = {
706
+ ArrowLeft: () => K(F, -1),
707
+ ArrowRight: () => K(F, 1),
708
+ ArrowUp: () => K(F, -7),
709
+ ArrowDown: () => K(F, 7),
710
+ Home: () => K(F, -((F.getDay() - l + 7) % 7)),
711
+ End: () => K(F, 6 - (F.getDay() - l + 7) % 7),
712
+ PageUp: () => q(F, e.shiftKey ? -12 : -1),
713
+ PageDown: () => q(F, e.shiftKey ? 12 : 1)
714
+ }[e.key];
715
+ t && (e.preventDefault(), he(t()));
716
+ }
717
+ function _e(e) {
718
+ (e.key === "Escape" || e.key === "Tab") && (e.preventDefault(), Y(!0));
719
+ }
720
+ let X = new Intl.DateTimeFormat(c, {
721
+ month: "long",
722
+ year: "numeric"
723
+ }).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) => ({
724
+ short: new Intl.DateTimeFormat(c, { weekday: "narrow" }).format(e),
725
+ long: new Intl.DateTimeFormat(c, { weekday: "long" }).format(e)
726
+ })), ye = U(F), be = de(), $ = `${k.id}-calendar-title`;
727
+ return /* @__PURE__ */ x("div", {
728
+ className: C("hds-field", te),
729
+ children: [
730
+ /* @__PURE__ */ b("label", {
731
+ className: "hds-label",
732
+ htmlFor: k.id,
733
+ children: e
734
+ }),
735
+ /* @__PURE__ */ x("div", {
736
+ ref: L,
737
+ className: "hds-date-wrap",
738
+ children: [
739
+ /* @__PURE__ */ b("input", {
740
+ ...O,
741
+ id: k.id,
742
+ type: "text",
743
+ inputMode: "numeric",
744
+ autoComplete: "off",
745
+ placeholder: ee,
746
+ value: j,
747
+ disabled: y,
748
+ required: T,
749
+ "aria-invalid": s ? !0 : void 0,
750
+ "aria-describedby": H({
751
+ hint: o,
752
+ error: s,
753
+ "aria-describedby": O["aria-describedby"]
754
+ }, k),
755
+ className: "hds-input hds-input--numeric hds-date-input",
756
+ onChange: (e) => fe(e.target.value),
757
+ onBlur: (e) => {
758
+ O.onBlur?.(e), j.trim() !== "" && ce(j) !== A && M(G(A));
759
+ }
760
+ }),
761
+ /* @__PURE__ */ b(D, {
762
+ ref: R,
763
+ variant: "ghost",
764
+ size: "sm",
765
+ iconOnly: !0,
766
+ icon: /* @__PURE__ */ b(E, { name: "calendar" }),
767
+ "aria-label": u,
768
+ "aria-haspopup": "dialog",
769
+ "aria-expanded": N,
770
+ disabled: y,
771
+ className: "hds-date-button",
772
+ onClick: () => N ? Y(!1) : pe()
773
+ }),
774
+ h ? /* @__PURE__ */ b("input", {
775
+ type: "hidden",
776
+ name: h,
777
+ value: A
778
+ }) : null
779
+ ]
780
+ }),
781
+ /* @__PURE__ */ b(ae, {
782
+ hint: o,
783
+ error: s,
784
+ ids: k
785
+ }),
786
+ N ? S(/* @__PURE__ */ x(w, {
787
+ ref: z,
788
+ role: "dialog",
789
+ tone: "thick",
790
+ "aria-labelledby": $,
791
+ className: "hds-date-panel",
792
+ onKeyDown: _e,
793
+ children: [/* @__PURE__ */ x("div", {
794
+ className: "hds-date-header",
795
+ children: [
796
+ /* @__PURE__ */ b(D, {
797
+ variant: "ghost",
798
+ size: "sm",
799
+ iconOnly: !0,
800
+ icon: /* @__PURE__ */ b(E, { name: "chevron-left" }),
801
+ "aria-label": d,
802
+ onClick: () => I(q(F, -1))
803
+ }),
804
+ /* @__PURE__ */ b("h2", {
805
+ id: $,
806
+ className: "hds-date-title",
807
+ "aria-live": "polite",
808
+ children: Z
809
+ }),
810
+ /* @__PURE__ */ b(D, {
811
+ variant: "ghost",
812
+ size: "sm",
813
+ iconOnly: !0,
814
+ icon: /* @__PURE__ */ b(E, { name: "chevron-right" }),
815
+ "aria-label": p,
816
+ onClick: () => I(q(F, 1))
817
+ })
818
+ ]
819
+ }), /* @__PURE__ */ x("table", {
820
+ role: "grid",
821
+ "aria-labelledby": $,
822
+ className: "hds-date-grid",
823
+ onKeyDown: ge,
824
+ children: [/* @__PURE__ */ b("thead", { children: /* @__PURE__ */ b("tr", { children: Q.map((e) => /* @__PURE__ */ b("th", {
825
+ scope: "col",
826
+ abbr: e.long,
827
+ children: e.short
828
+ }, e.long)) }) }), /* @__PURE__ */ b("tbody", { children: le(F, l).map((e) => /* @__PURE__ */ b("tr", { children: e.map((e) => {
829
+ let t = U(e), n = ue(t, i, a);
830
+ return /* @__PURE__ */ b("td", {
831
+ role: "gridcell",
832
+ "aria-selected": t === A,
833
+ children: /* @__PURE__ */ b("button", {
834
+ type: "button",
835
+ tabIndex: t === ye ? 0 : -1,
836
+ "aria-label": ve.format(e),
837
+ "aria-current": t === be ? "date" : void 0,
838
+ "aria-disabled": !n || void 0,
839
+ className: C("hds-date-day", e.getMonth() !== F.getMonth() && "hds-date-day--outside", t === A && "hds-date-day--selected"),
840
+ onClick: () => me(e),
841
+ children: e.getDate()
842
+ })
843
+ }, t);
844
+ }) }, U(e[0]))) })]
845
+ })]
846
+ }), document.body) : null
847
+ ]
848
+ });
849
+ }
850
+ //#endregion
851
+ //#region src/components/Checkbox/Checkbox.tsx
852
+ var fe = l(function({ label: e, hint: t, id: n, className: r, ...i }, a) {
853
+ let o = V(n);
598
854
  return /* @__PURE__ */ x("label", {
599
855
  className: C("hds-checkbox", r),
600
856
  htmlFor: o.id,
@@ -609,7 +865,7 @@ var G = l(function({ label: e, hint: t, error: n, numeric: r = !1, id: i, classN
609
865
  "aria-describedby": t ? o.hint : i["aria-describedby"]
610
866
  }), /* @__PURE__ */ b("span", {
611
867
  className: "hds-checkbox-box",
612
- children: /* @__PURE__ */ b(D, { name: "check" })
868
+ children: /* @__PURE__ */ b(E, { name: "check" })
613
869
  })]
614
870
  }), /* @__PURE__ */ x("span", {
615
871
  className: "hds-checkbox-text",
@@ -623,7 +879,7 @@ var G = l(function({ label: e, hint: t, error: n, numeric: r = !1, id: i, classN
623
879
  });
624
880
  //#endregion
625
881
  //#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 }) {
882
+ function pe({ as: e = "article", eyebrow: t, title: n, media: r, footer: i, interactive: a = !1, className: o, children: s, ...c }) {
627
883
  return /* @__PURE__ */ x(e, {
628
884
  ...c,
629
885
  className: C("hds-card", a && "hds-card--interactive", o),
@@ -659,14 +915,14 @@ function J({ as: e = "article", eyebrow: t, title: n, media: r, footer: i, inter
659
915
  }
660
916
  //#endregion
661
917
  //#region src/components/Badge/Badge.tsx
662
- var ae = {
918
+ var Y = {
663
919
  accent: "info",
664
920
  success: "circle-check",
665
921
  warning: "triangle-alert",
666
922
  danger: "circle-x"
667
923
  };
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);
924
+ function me({ tone: e = "neutral", icon: t, children: n, className: r }) {
925
+ let i = Y[e], a = t === !1 ? null : t ?? (i ? /* @__PURE__ */ b(E, { name: i }) : null);
670
926
  return /* @__PURE__ */ x("span", {
671
927
  className: C("hds-badge", `hds-badge--${e}`, r),
672
928
  children: [a, n]
@@ -674,10 +930,10 @@ function oe({ tone: e = "neutral", icon: t, children: n, className: r }) {
674
930
  }
675
931
  //#endregion
676
932
  //#region src/components/Table/Table.tsx
677
- function Y(e) {
933
+ function he(e) {
678
934
  return e.numeric ? "hds-cell--numeric" : e.align === "center" ? "hds-cell--center" : void 0;
679
935
  }
680
- function se({ columns: e, rows: t, rowKey: n = "id", caption: r, hideCaption: i = !1, empty: a = "Nada para mostrar.", maxHeight: o, glass: s = !1, className: c }) {
936
+ 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
937
  return /* @__PURE__ */ b("div", {
682
938
  className: C("hds-table-wrap", "hds-scroll", s && "hds-glass hds-table-wrap--glass", c),
683
939
  role: "region",
@@ -693,11 +949,11 @@ function se({ columns: e, rows: t, rowKey: n = "id", caption: r, hideCaption: i
693
949
  }) : null,
694
950
  /* @__PURE__ */ b("thead", { children: /* @__PURE__ */ b("tr", { children: e.map((e) => /* @__PURE__ */ b("th", {
695
951
  scope: "col",
696
- className: Y(e),
952
+ className: he(e),
697
953
  children: e.header
698
954
  }, e.key)) }) }),
699
955
  /* @__PURE__ */ b("tbody", { children: t.length ? t.map((t, r) => /* @__PURE__ */ b("tr", { children: e.map((e) => /* @__PURE__ */ b("td", {
700
- className: Y(e),
956
+ className: he(e),
701
957
  children: e.render ? e.render(t) : t[e.key]
702
958
  }, e.key)) }, String(t[n] ?? r))) : /* @__PURE__ */ b("tr", { children: /* @__PURE__ */ b("td", {
703
959
  colSpan: e.length || 1,
@@ -710,19 +966,19 @@ function se({ columns: e, rows: t, rowKey: n = "id", caption: r, hideCaption: i
710
966
  }
711
967
  //#endregion
712
968
  //#region src/appearance/useAppearance.ts
713
- var X = !1, Z = {
969
+ var _e = !1, X = {
714
970
  theme: "dark",
715
971
  transparency: "full"
716
- }, Q = Z;
717
- function ce() {
972
+ }, Z = X;
973
+ function ve() {
718
974
  let e = a();
719
- return (e.theme !== Q.theme || e.transparency !== Q.transparency) && (Q = e), Q;
975
+ return (e.theme !== Z.theme || e.transparency !== Z.transparency) && (Z = e), Z;
720
976
  }
721
- function $() {
977
+ function Q() {
722
978
  f(() => {
723
- X || (X = !0, document.documentElement.hasAttribute("data-theme") || r());
979
+ _e || (_e = !0, document.documentElement.hasAttribute("data-theme") || r());
724
980
  }, []);
725
- let e = v(o, ce, () => Z);
981
+ let e = v(o, ve, () => X);
726
982
  return {
727
983
  ...e,
728
984
  setTheme: t,
@@ -733,25 +989,25 @@ function $() {
733
989
  }
734
990
  //#endregion
735
991
  //#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, {
992
+ function ye({ lightLabel: e = "Mudar para o tema claro", darkLabel: t = "Mudar para o tema escuro", variant: n = "ghost", ...r }) {
993
+ let { theme: i, toggleTheme: a } = Q(), o = i === "dark" ? e : t;
994
+ return /* @__PURE__ */ b(D, {
739
995
  ...r,
740
996
  variant: n,
741
997
  iconOnly: !0,
742
- icon: /* @__PURE__ */ b(D, { name: i === "dark" ? "sun" : "moon" }),
998
+ icon: /* @__PURE__ */ b(E, { name: i === "dark" ? "sun" : "moon" }),
743
999
  "aria-label": o,
744
1000
  title: o,
745
1001
  onClick: a
746
1002
  });
747
1003
  }
748
- function ue({ label: e = "Reduzir transparência", variant: t = "ghost", ...n }) {
749
- let { transparency: r, toggleTransparency: i } = $();
750
- return /* @__PURE__ */ b(O, {
1004
+ function be({ label: e = "Reduzir transparência", variant: t = "ghost", ...n }) {
1005
+ let { transparency: r, toggleTransparency: i } = Q();
1006
+ return /* @__PURE__ */ b(D, {
751
1007
  ...n,
752
1008
  variant: t,
753
1009
  iconOnly: !0,
754
- icon: /* @__PURE__ */ b(D, { name: "blend" }),
1010
+ icon: /* @__PURE__ */ b(E, { name: "blend" }),
755
1011
  "aria-label": e,
756
1012
  "aria-pressed": r === "reduced",
757
1013
  title: e,
@@ -760,7 +1016,7 @@ function ue({ label: e = "Reduzir transparência", variant: t = "ghost", ...n })
760
1016
  }
761
1017
  //#endregion
762
1018
  //#region src/components/Container/Container.tsx
763
- function de({ as: e = "section", withSidebar: t = !1, className: n, ...r }) {
1019
+ function $({ as: e = "section", withSidebar: t = !1, className: n, ...r }) {
764
1020
  return /* @__PURE__ */ b(e, {
765
1021
  ...r,
766
1022
  className: C("hds-container", t && "hds-container--with-sidebar", n)
@@ -768,7 +1024,7 @@ function de({ as: e = "section", withSidebar: t = !1, className: n, ...r }) {
768
1024
  }
769
1025
  //#endregion
770
1026
  //#region src/components/SectionTitle/SectionTitle.tsx
771
- function fe({ children: e, index: t, as: n = "h2", id: r, className: i }) {
1027
+ function xe({ children: e, index: t, as: n = "h2", id: r, className: i }) {
772
1028
  return /* @__PURE__ */ x(n, {
773
1029
  id: r,
774
1030
  className: C("hds-section-title", i),
@@ -781,7 +1037,7 @@ function fe({ children: e, index: t, as: n = "h2", id: r, className: i }) {
781
1037
  }
782
1038
  //#endregion
783
1039
  //#region src/components/Separator/Separator.tsx
784
- function pe({ orientation: e = "horizontal", decorative: t = !1, className: n }) {
1040
+ function Se({ orientation: e = "horizontal", decorative: t = !1, className: n }) {
785
1041
  return /* @__PURE__ */ b("div", {
786
1042
  role: t ? "none" : "separator",
787
1043
  "aria-orientation": t ? void 0 : e,
@@ -790,7 +1046,7 @@ function pe({ orientation: e = "horizontal", decorative: t = !1, className: n })
790
1046
  }
791
1047
  //#endregion
792
1048
  //#region src/components/ScrollArea/ScrollArea.tsx
793
- function me({ label: e, maxHeight: t, className: n, style: r, ...i }) {
1049
+ function Ce({ label: e, maxHeight: t, className: n, style: r, ...i }) {
794
1050
  return /* @__PURE__ */ b("div", {
795
1051
  ...i,
796
1052
  role: "region",
@@ -805,11 +1061,11 @@ function me({ label: e, maxHeight: t, className: n, style: r, ...i }) {
805
1061
  }
806
1062
  //#endregion
807
1063
  //#region src/components/Loading/Loading.tsx
808
- function he({ size: e = "md", label: t = "Carregando…", showLabel: n = !1, className: r }) {
1064
+ function we({ size: e = "md", label: t = "Carregando…", showLabel: n = !1, className: r }) {
809
1065
  return /* @__PURE__ */ x("span", {
810
1066
  role: "status",
811
1067
  className: C("hds-loading", `hds-loading--${e}`, r),
812
- children: [/* @__PURE__ */ b(D, { name: "loader" }), /* @__PURE__ */ b("span", {
1068
+ children: [/* @__PURE__ */ b(E, { name: "loader" }), /* @__PURE__ */ b("span", {
813
1069
  className: n ? void 0 : "hds-visually-hidden",
814
1070
  children: t
815
1071
  })]
@@ -817,7 +1073,7 @@ function he({ size: e = "md", label: t = "Carregando…", showLabel: n = !1, cla
817
1073
  }
818
1074
  //#endregion
819
1075
  //#region src/components/GlowAvatar/GlowAvatar.tsx
820
- function ge({ src: e, alt: t, size: n = 96, className: r }) {
1076
+ function Te({ src: e, alt: t, size: n = 96, className: r }) {
821
1077
  return /* @__PURE__ */ x("span", {
822
1078
  className: C("hds-avatar", r),
823
1079
  style: {
@@ -837,6 +1093,6 @@ function ge({ src: e, alt: t, size: n = 96, className: r }) {
837
1093
  });
838
1094
  }
839
1095
  //#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 };
1096
+ 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
1097
 
842
1098
  //# sourceMappingURL=index.js.map