@hemerson/design-system 0.2.0 → 0.3.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/README.md +31 -2
- package/dist/appearance/appearance.d.ts +23 -0
- package/dist/appearance/index.d.ts +2 -0
- package/dist/appearance/useAppearance.d.ts +13 -0
- package/dist/appearance-J15aUjQp.js +57 -0
- package/dist/appearance-J15aUjQp.js.map +1 -0
- package/dist/appearance.js +1 -0
- package/dist/components/AppearanceToggles/AppearanceToggles.d.ts +17 -0
- package/dist/components/Dialog/Dialog.d.ts +3 -1
- package/dist/components/Toast/Toast.d.ts +7 -3
- package/dist/components/Toast/ToastProvider.d.ts +29 -0
- package/dist/components/Toast/ToastView.d.ts +14 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +434 -272
- package/dist/index.js.map +1 -1
- package/dist/internal/Icon.d.ts +31 -8
- package/dist/styles.css +18 -6
- package/package.json +5 -1
package/dist/index.js
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
import { t as e } from "./enableGlassRefraction-CgDeg-2E.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { a as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./appearance-J15aUjQp.js";
|
|
3
|
+
import { createContext as c, forwardRef as l, useCallback as u, useContext as d, useEffect as f, useId as p, useLayoutEffect as m, useMemo as h, useRef as g, useState as _, useSyncExternalStore as v } from "react";
|
|
4
|
+
import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
5
|
+
import { createPortal as S } from "react-dom";
|
|
5
6
|
//#region src/internal/cx.ts
|
|
6
|
-
function
|
|
7
|
+
function C(...e) {
|
|
7
8
|
return e.filter(Boolean).join(" ");
|
|
8
9
|
}
|
|
9
10
|
//#endregion
|
|
10
11
|
//#region src/components/GlassPanel/GlassPanel.tsx
|
|
11
|
-
var
|
|
12
|
-
return /* @__PURE__ */
|
|
12
|
+
var w = l(function({ as: e = "div", tone: t = "regular", className: n, ...r }, i) {
|
|
13
|
+
return /* @__PURE__ */ b(e, {
|
|
13
14
|
...r,
|
|
14
15
|
ref: i,
|
|
15
|
-
className:
|
|
16
|
+
className: C("hds-glass", t !== "regular" && `hds-glass--${t}`, n)
|
|
16
17
|
});
|
|
17
|
-
}),
|
|
18
|
+
}), T = {
|
|
19
|
+
cx: 12,
|
|
20
|
+
cy: 12,
|
|
21
|
+
r: 10
|
|
22
|
+
}, E = {
|
|
18
23
|
check: ["M20 6 9 17l-5-5"],
|
|
19
24
|
x: ["M18 6 6 18", "m6 6 12 12"],
|
|
20
25
|
"chevron-down": ["m6 9 6 6 6-6"],
|
|
21
|
-
"circle-check": [
|
|
26
|
+
"circle-check": [T, "m9 12 2 2 4-4"],
|
|
22
27
|
"circle-x": [
|
|
23
|
-
|
|
28
|
+
T,
|
|
24
29
|
"m15 9-6 6",
|
|
25
30
|
"m9 9 6 6"
|
|
26
31
|
],
|
|
@@ -30,15 +35,41 @@ var f = t(function({ as: e = "div", tone: t = "regular", className: n, ...r }, i
|
|
|
30
35
|
"M12 17h.01"
|
|
31
36
|
],
|
|
32
37
|
info: [
|
|
33
|
-
|
|
38
|
+
T,
|
|
34
39
|
"M12 16v-4",
|
|
35
40
|
"M12 8h.01"
|
|
36
41
|
],
|
|
37
|
-
loader: ["M21 12a9 9 0 1 1-6.219-8.56"]
|
|
42
|
+
loader: ["M21 12a9 9 0 1 1-6.219-8.56"],
|
|
43
|
+
sun: [
|
|
44
|
+
{
|
|
45
|
+
cx: 12,
|
|
46
|
+
cy: 12,
|
|
47
|
+
r: 4
|
|
48
|
+
},
|
|
49
|
+
"M12 2v2",
|
|
50
|
+
"M12 20v2",
|
|
51
|
+
"m4.93 4.93 1.41 1.41",
|
|
52
|
+
"m17.66 17.66 1.41 1.41",
|
|
53
|
+
"M2 12h2",
|
|
54
|
+
"M20 12h2",
|
|
55
|
+
"m6.34 17.66-1.41 1.41",
|
|
56
|
+
"m19.07 4.93-1.41 1.41"
|
|
57
|
+
],
|
|
58
|
+
moon: ["M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"],
|
|
59
|
+
blend: [{
|
|
60
|
+
cx: 9,
|
|
61
|
+
cy: 9,
|
|
62
|
+
r: 7
|
|
63
|
+
}, {
|
|
64
|
+
cx: 15,
|
|
65
|
+
cy: 15,
|
|
66
|
+
r: 7
|
|
67
|
+
}]
|
|
38
68
|
};
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
|
|
69
|
+
function D({ name: e, className: t }) {
|
|
70
|
+
let n = E[e];
|
|
71
|
+
return /* @__PURE__ */ b("svg", {
|
|
72
|
+
className: C("hds-icon", t),
|
|
42
73
|
viewBox: "0 0 24 24",
|
|
43
74
|
fill: "none",
|
|
44
75
|
stroke: "currentColor",
|
|
@@ -47,69 +78,69 @@ function m({ name: e, className: t }) {
|
|
|
47
78
|
strokeLinejoin: "round",
|
|
48
79
|
"aria-hidden": "true",
|
|
49
80
|
focusable: "false",
|
|
50
|
-
children:
|
|
51
|
-
cx:
|
|
52
|
-
cy:
|
|
53
|
-
r:
|
|
54
|
-
},
|
|
81
|
+
children: n.map((e, t) => typeof e == "string" ? /* @__PURE__ */ b("path", { d: e }, t) : /* @__PURE__ */ b("circle", {
|
|
82
|
+
cx: e.cx,
|
|
83
|
+
cy: e.cy,
|
|
84
|
+
r: e.r
|
|
85
|
+
}, t))
|
|
55
86
|
});
|
|
56
87
|
}
|
|
57
88
|
//#endregion
|
|
58
89
|
//#region src/components/Button/Button.tsx
|
|
59
|
-
var
|
|
60
|
-
return r && !
|
|
61
|
-
...
|
|
62
|
-
ref:
|
|
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) {
|
|
91
|
+
return r && !l["aria-label"] && !l["aria-labelledby"] && console.warn("Button: an icon-only button needs an aria-label."), /* @__PURE__ */ x("button", {
|
|
92
|
+
...l,
|
|
93
|
+
ref: u,
|
|
63
94
|
type: o,
|
|
64
95
|
disabled: a || i,
|
|
65
96
|
"aria-busy": i || void 0,
|
|
66
|
-
className:
|
|
67
|
-
children: [i ? /* @__PURE__ */
|
|
97
|
+
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, {
|
|
68
99
|
name: "loader",
|
|
69
100
|
className: "hds-spin"
|
|
70
|
-
}) : n, r ? null :
|
|
101
|
+
}) : n, r ? null : c]
|
|
71
102
|
});
|
|
72
103
|
});
|
|
73
104
|
//#endregion
|
|
74
105
|
//#region src/components/NavBar/NavBar.tsx
|
|
75
|
-
function
|
|
76
|
-
return /* @__PURE__ */
|
|
106
|
+
function ee({ active: e = !1, className: t, ...n }) {
|
|
107
|
+
return /* @__PURE__ */ b("a", {
|
|
77
108
|
...n,
|
|
78
109
|
"aria-current": e ? "page" : void 0,
|
|
79
|
-
className:
|
|
110
|
+
className: C("hds-navbar-link", t)
|
|
80
111
|
});
|
|
81
112
|
}
|
|
82
|
-
function
|
|
83
|
-
return /* @__PURE__ */
|
|
113
|
+
function k({ title: e, actions: t, navLabel: n = "Principal", className: r, children: i, ...a }) {
|
|
114
|
+
return /* @__PURE__ */ x(w, {
|
|
84
115
|
...a,
|
|
85
116
|
as: "header",
|
|
86
|
-
className:
|
|
117
|
+
className: C("hds-navbar", r),
|
|
87
118
|
children: [
|
|
88
|
-
e ? /* @__PURE__ */
|
|
119
|
+
e ? /* @__PURE__ */ b("p", {
|
|
89
120
|
className: "hds-navbar-title",
|
|
90
121
|
children: e
|
|
91
122
|
}) : null,
|
|
92
|
-
i ? /* @__PURE__ */
|
|
123
|
+
i ? /* @__PURE__ */ b("nav", {
|
|
93
124
|
className: "hds-navbar-nav",
|
|
94
125
|
"aria-label": n,
|
|
95
126
|
children: i
|
|
96
127
|
}) : null,
|
|
97
|
-
t ? /* @__PURE__ */
|
|
128
|
+
t ? /* @__PURE__ */ b("div", {
|
|
98
129
|
className: "hds-navbar-actions",
|
|
99
130
|
children: t
|
|
100
131
|
}) : null
|
|
101
132
|
]
|
|
102
133
|
});
|
|
103
134
|
}
|
|
104
|
-
var
|
|
135
|
+
var te = Object.assign(k, { Link: ee });
|
|
105
136
|
//#endregion
|
|
106
137
|
//#region src/components/Sidebar/Sidebar.tsx
|
|
107
|
-
function
|
|
108
|
-
return /* @__PURE__ */
|
|
138
|
+
function ne({ items: e, footer: t, floating: n = !1, label: r = "Navegação", className: i }) {
|
|
139
|
+
return /* @__PURE__ */ x(w, {
|
|
109
140
|
as: "nav",
|
|
110
141
|
"aria-label": r,
|
|
111
|
-
className:
|
|
112
|
-
children: [/* @__PURE__ */
|
|
142
|
+
className: C("hds-sidebar", n && "hds-sidebar--floating", i),
|
|
143
|
+
children: [/* @__PURE__ */ b("ul", {
|
|
113
144
|
className: "hds-sidebar-items",
|
|
114
145
|
children: e.map((e) => {
|
|
115
146
|
let t = {
|
|
@@ -118,19 +149,19 @@ function y({ items: e, footer: t, floating: n = !1, label: r = "Navegação", cl
|
|
|
118
149
|
"aria-current": e.active ? "page" : void 0,
|
|
119
150
|
className: "hds-sidebar-item"
|
|
120
151
|
};
|
|
121
|
-
return /* @__PURE__ */
|
|
152
|
+
return /* @__PURE__ */ b("li", { children: e.href ? /* @__PURE__ */ b("a", {
|
|
122
153
|
...t,
|
|
123
154
|
href: e.href,
|
|
124
155
|
onClick: e.onClick,
|
|
125
156
|
children: e.icon
|
|
126
|
-
}) : /* @__PURE__ */
|
|
157
|
+
}) : /* @__PURE__ */ b("button", {
|
|
127
158
|
...t,
|
|
128
159
|
type: "button",
|
|
129
160
|
onClick: e.onClick,
|
|
130
161
|
children: e.icon
|
|
131
162
|
}) }, e.label);
|
|
132
163
|
})
|
|
133
|
-
}), t ? /* @__PURE__ */
|
|
164
|
+
}), t ? /* @__PURE__ */ b("div", {
|
|
134
165
|
className: "hds-sidebar-footer",
|
|
135
166
|
children: t
|
|
136
167
|
}) : null]
|
|
@@ -138,46 +169,46 @@ function y({ items: e, footer: t, floating: n = !1, label: r = "Navegação", cl
|
|
|
138
169
|
}
|
|
139
170
|
//#endregion
|
|
140
171
|
//#region src/components/SegmentedControl/SegmentedControl.tsx
|
|
141
|
-
var
|
|
172
|
+
var A = {
|
|
142
173
|
ArrowRight: 1,
|
|
143
174
|
ArrowDown: 1,
|
|
144
175
|
ArrowLeft: -1,
|
|
145
176
|
ArrowUp: -1
|
|
146
177
|
};
|
|
147
|
-
function
|
|
148
|
-
let [
|
|
149
|
-
|
|
178
|
+
function j({ options: e, value: t, defaultValue: n, onChange: r, label: i, className: a }) {
|
|
179
|
+
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
|
+
m(() => {
|
|
150
181
|
function e() {
|
|
151
|
-
let e =
|
|
152
|
-
e &&
|
|
182
|
+
let e = l.current[d];
|
|
183
|
+
e && u.current && (u.current.style.width = `${e.offsetWidth}px`, u.current.style.transform = `translateX(${e.offsetLeft - 4}px)`, u.current.style.opacity = "1");
|
|
153
184
|
}
|
|
154
185
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
155
|
-
}, [
|
|
156
|
-
function
|
|
157
|
-
t === void 0 &&
|
|
186
|
+
}, [d, e.length]);
|
|
187
|
+
function f(e) {
|
|
188
|
+
t === void 0 && s(e), r?.(e);
|
|
158
189
|
}
|
|
159
|
-
function
|
|
160
|
-
let n =
|
|
190
|
+
function p(t) {
|
|
191
|
+
let n = A[t.key];
|
|
161
192
|
if (!n) return;
|
|
162
193
|
t.preventDefault();
|
|
163
|
-
let r = (
|
|
164
|
-
|
|
194
|
+
let r = (d + n + e.length) % e.length;
|
|
195
|
+
f(e[r].value), l.current[r]?.focus();
|
|
165
196
|
}
|
|
166
|
-
return /* @__PURE__ */
|
|
197
|
+
return /* @__PURE__ */ x(w, {
|
|
167
198
|
role: "radiogroup",
|
|
168
|
-
"aria-label":
|
|
169
|
-
className:
|
|
170
|
-
onKeyDown:
|
|
171
|
-
children: [/* @__PURE__ */
|
|
172
|
-
ref:
|
|
199
|
+
"aria-label": i,
|
|
200
|
+
className: C("hds-segmented", a),
|
|
201
|
+
onKeyDown: p,
|
|
202
|
+
children: [/* @__PURE__ */ b("span", {
|
|
203
|
+
ref: u,
|
|
173
204
|
className: "hds-segmented-thumb",
|
|
174
205
|
"aria-hidden": "true",
|
|
175
206
|
style: { opacity: 0 }
|
|
176
207
|
}), e.map((e, t) => {
|
|
177
|
-
let n = t ===
|
|
178
|
-
return /* @__PURE__ */
|
|
208
|
+
let n = t === d;
|
|
209
|
+
return /* @__PURE__ */ x("button", {
|
|
179
210
|
ref: (e) => {
|
|
180
|
-
|
|
211
|
+
l.current[t] = e;
|
|
181
212
|
},
|
|
182
213
|
type: "button",
|
|
183
214
|
role: "radio",
|
|
@@ -185,7 +216,7 @@ function x({ options: e, value: t, defaultValue: n, onChange: r, label: s, class
|
|
|
185
216
|
"aria-label": e.ariaLabel,
|
|
186
217
|
tabIndex: n ? 0 : -1,
|
|
187
218
|
className: "hds-segmented-option",
|
|
188
|
-
onClick: () =>
|
|
219
|
+
onClick: () => f(e.value),
|
|
189
220
|
children: [e.icon, e.label]
|
|
190
221
|
}, String(e.value));
|
|
191
222
|
})]
|
|
@@ -193,89 +224,102 @@ function x({ options: e, value: t, defaultValue: n, onChange: r, label: s, class
|
|
|
193
224
|
}
|
|
194
225
|
//#endregion
|
|
195
226
|
//#region src/components/Menu/Menu.tsx
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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));
|
|
230
|
+
t.style.top = `${Math.round(u)}px`, t.style.left = `${Math.round(f)}px`, t.dataset.side = c || !l ? "bottom" : "top";
|
|
231
|
+
}
|
|
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();
|
|
200
236
|
}
|
|
201
|
-
|
|
202
|
-
if (!
|
|
203
|
-
|
|
237
|
+
m(() => {
|
|
238
|
+
if (!s || !l.current || !u.current) return;
|
|
239
|
+
let e = () => {
|
|
240
|
+
l.current && u.current && N(l.current, u.current, i);
|
|
241
|
+
};
|
|
242
|
+
return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
243
|
+
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
244
|
+
};
|
|
245
|
+
}, [s, i]), f(() => {
|
|
246
|
+
if (!s) return;
|
|
247
|
+
h()[0]?.focus();
|
|
204
248
|
function e(e) {
|
|
205
|
-
|
|
249
|
+
let t = e.target;
|
|
250
|
+
l.current?.contains(t) || u.current?.contains(t) || c(!1);
|
|
206
251
|
}
|
|
207
252
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
208
|
-
}, [
|
|
209
|
-
function
|
|
210
|
-
let t =
|
|
211
|
-
e.key === "Escape"
|
|
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());
|
|
212
257
|
}
|
|
213
|
-
return /* @__PURE__ */
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
variant: p,
|
|
258
|
+
return /* @__PURE__ */ x("div", {
|
|
259
|
+
className: C("hds-menu", o),
|
|
260
|
+
children: [/* @__PURE__ */ b(O, {
|
|
261
|
+
ref: l,
|
|
262
|
+
variant: a,
|
|
219
263
|
icon: t,
|
|
220
|
-
iconOnly:
|
|
221
|
-
"aria-label":
|
|
264
|
+
iconOnly: n,
|
|
265
|
+
"aria-label": n ? e : void 0,
|
|
222
266
|
"aria-haspopup": "menu",
|
|
223
|
-
"aria-expanded":
|
|
224
|
-
"aria-controls":
|
|
225
|
-
onClick: () =>
|
|
267
|
+
"aria-expanded": s,
|
|
268
|
+
"aria-controls": s ? d : void 0,
|
|
269
|
+
onClick: () => c(!s),
|
|
226
270
|
children: e
|
|
227
|
-
}),
|
|
228
|
-
ref:
|
|
229
|
-
id:
|
|
271
|
+
}), s ? S(/* @__PURE__ */ b(w, {
|
|
272
|
+
ref: u,
|
|
273
|
+
id: d,
|
|
230
274
|
role: "menu",
|
|
231
275
|
"aria-label": e,
|
|
232
|
-
className:
|
|
233
|
-
onKeyDown:
|
|
234
|
-
children:
|
|
276
|
+
className: "hds-menu-panel",
|
|
277
|
+
onKeyDown: y,
|
|
278
|
+
children: r.map((e, t) => e.separator ? /* @__PURE__ */ b("div", {
|
|
235
279
|
role: "separator",
|
|
236
280
|
className: "hds-menu-separator"
|
|
237
|
-
}, `separator-${t}`) : /* @__PURE__ */
|
|
281
|
+
}, `separator-${t}`) : /* @__PURE__ */ x("button", {
|
|
238
282
|
type: "button",
|
|
239
283
|
role: "menuitem",
|
|
240
284
|
tabIndex: -1,
|
|
241
|
-
className:
|
|
285
|
+
className: C("hds-menu-item", e.danger && "hds-menu-item--danger"),
|
|
242
286
|
onClick: () => {
|
|
243
|
-
|
|
287
|
+
v(!0), e.onSelect?.();
|
|
244
288
|
},
|
|
245
289
|
children: [e.icon, e.label]
|
|
246
290
|
}, e.label))
|
|
247
|
-
}) : null]
|
|
291
|
+
}), document.body) : null]
|
|
248
292
|
});
|
|
249
293
|
}
|
|
250
294
|
//#endregion
|
|
251
295
|
//#region src/components/FloatingButton/FloatingButton.tsx
|
|
252
|
-
var
|
|
253
|
-
return /* @__PURE__ */
|
|
296
|
+
var F = l(function({ label: e, position: t = "bottom-right", type: n = "button", className: r, ...i }, a) {
|
|
297
|
+
return /* @__PURE__ */ b("button", {
|
|
254
298
|
...i,
|
|
255
299
|
ref: a,
|
|
256
300
|
type: n,
|
|
257
301
|
"aria-label": e,
|
|
258
302
|
title: e,
|
|
259
|
-
className:
|
|
303
|
+
className: C("hds-glass", "hds-fab", `hds-fab--${t}`, r)
|
|
260
304
|
});
|
|
261
|
-
}),
|
|
262
|
-
function
|
|
263
|
-
let
|
|
264
|
-
return
|
|
265
|
-
|
|
266
|
-
}, [t]),
|
|
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 }) {
|
|
307
|
+
let u = g(null), d = p(), m = p(), h = g(t);
|
|
308
|
+
return f(() => {
|
|
309
|
+
h.current = t;
|
|
310
|
+
}, [t]), f(() => {
|
|
267
311
|
if (!e) return;
|
|
268
312
|
let t = document.activeElement, n = document.body.style.overflow;
|
|
269
313
|
document.body.style.overflow = "hidden";
|
|
270
|
-
let r =
|
|
271
|
-
(
|
|
314
|
+
let r = u.current?.querySelectorAll(I) ?? [];
|
|
315
|
+
(s === "panel" || r.length === 0 ? u.current : r[0])?.focus();
|
|
272
316
|
function i(e) {
|
|
273
317
|
if (e.key === "Escape") {
|
|
274
|
-
e.preventDefault(),
|
|
318
|
+
e.preventDefault(), h.current();
|
|
275
319
|
return;
|
|
276
320
|
}
|
|
277
|
-
if (e.key !== "Tab" || !
|
|
278
|
-
let t = Array.from(
|
|
321
|
+
if (e.key !== "Tab" || !u.current) return;
|
|
322
|
+
let t = Array.from(u.current.querySelectorAll(I));
|
|
279
323
|
if (t.length === 0) return;
|
|
280
324
|
let n = t[0], r = t[t.length - 1];
|
|
281
325
|
e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus());
|
|
@@ -283,113 +327,181 @@ function T({ open: e, onClose: t, title: i, description: o, children: s, footer:
|
|
|
283
327
|
return document.addEventListener("keydown", i), () => {
|
|
284
328
|
document.removeEventListener("keydown", i), document.body.style.overflow = n, t?.focus();
|
|
285
329
|
};
|
|
286
|
-
}, [e,
|
|
330
|
+
}, [e, s]), e ? S(/* @__PURE__ */ b("div", {
|
|
287
331
|
className: "hds-scrim",
|
|
288
332
|
onMouseDown: (e) => {
|
|
289
333
|
e.target === e.currentTarget && t();
|
|
290
334
|
},
|
|
291
|
-
children: /* @__PURE__ */
|
|
292
|
-
ref:
|
|
335
|
+
children: /* @__PURE__ */ x(w, {
|
|
336
|
+
ref: u,
|
|
293
337
|
tone: "thick",
|
|
294
338
|
role: "dialog",
|
|
295
339
|
"aria-modal": "true",
|
|
296
|
-
"aria-labelledby":
|
|
297
|
-
"aria-describedby":
|
|
340
|
+
"aria-labelledby": d,
|
|
341
|
+
"aria-describedby": r ? m : void 0,
|
|
298
342
|
tabIndex: -1,
|
|
299
|
-
className:
|
|
343
|
+
className: C("hds-dialog", c !== "md" && `hds-dialog--${c}`, l),
|
|
300
344
|
children: [
|
|
301
|
-
/* @__PURE__ */
|
|
345
|
+
/* @__PURE__ */ x("div", {
|
|
302
346
|
className: "hds-dialog-header",
|
|
303
|
-
children: [/* @__PURE__ */
|
|
304
|
-
id:
|
|
347
|
+
children: [/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("h2", {
|
|
348
|
+
id: d,
|
|
305
349
|
className: "hds-dialog-title",
|
|
306
|
-
children:
|
|
307
|
-
}),
|
|
308
|
-
id:
|
|
350
|
+
children: n
|
|
351
|
+
}), r ? /* @__PURE__ */ b("p", {
|
|
352
|
+
id: m,
|
|
309
353
|
className: "hds-dialog-description",
|
|
310
|
-
children:
|
|
311
|
-
}) : null] }), /* @__PURE__ */
|
|
354
|
+
children: r
|
|
355
|
+
}) : null] }), /* @__PURE__ */ b(O, {
|
|
312
356
|
variant: "ghost",
|
|
313
357
|
size: "sm",
|
|
314
358
|
iconOnly: !0,
|
|
315
|
-
icon: /* @__PURE__ */
|
|
316
|
-
"aria-label":
|
|
359
|
+
icon: /* @__PURE__ */ b(D, { name: "x" }),
|
|
360
|
+
"aria-label": o,
|
|
317
361
|
onClick: t
|
|
318
362
|
})]
|
|
319
363
|
}),
|
|
320
|
-
|
|
321
|
-
|
|
364
|
+
i,
|
|
365
|
+
a ? /* @__PURE__ */ b("div", {
|
|
322
366
|
className: "hds-dialog-footer",
|
|
323
|
-
children:
|
|
367
|
+
children: a
|
|
324
368
|
}) : null
|
|
325
369
|
]
|
|
326
370
|
})
|
|
327
371
|
}), document.body) : null;
|
|
328
372
|
}
|
|
329
373
|
//#endregion
|
|
330
|
-
//#region src/components/Toast/
|
|
331
|
-
var
|
|
374
|
+
//#region src/components/Toast/ToastView.tsx
|
|
375
|
+
var ie = {
|
|
332
376
|
neutral: "info",
|
|
333
377
|
success: "circle-check",
|
|
334
378
|
warning: "triangle-alert",
|
|
335
379
|
danger: "circle-x"
|
|
336
380
|
};
|
|
337
|
-
function
|
|
338
|
-
let [
|
|
339
|
-
return
|
|
340
|
-
|
|
341
|
-
}, [
|
|
342
|
-
if (!
|
|
343
|
-
let
|
|
344
|
-
return () => window.clearTimeout(
|
|
345
|
-
}, [
|
|
346
|
-
e,
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
381
|
+
function L({ tone: e, title: t, description: n, duration: r, onClose: i, closeLabel: a, className: o }) {
|
|
382
|
+
let [s, c] = _(!1), l = g(i);
|
|
383
|
+
return f(() => {
|
|
384
|
+
l.current = i;
|
|
385
|
+
}, [i]), f(() => {
|
|
386
|
+
if (!r || s) return;
|
|
387
|
+
let e = window.setTimeout(() => l.current?.(), r);
|
|
388
|
+
return () => window.clearTimeout(e);
|
|
389
|
+
}, [r, s]), /* @__PURE__ */ x(w, {
|
|
390
|
+
role: e === "danger" ? "alert" : "status",
|
|
391
|
+
className: C("hds-toast", `hds-toast--${e}`, o),
|
|
392
|
+
onMouseEnter: () => c(!0),
|
|
393
|
+
onMouseLeave: () => c(!1),
|
|
394
|
+
onFocus: () => c(!0),
|
|
395
|
+
onBlur: () => c(!1),
|
|
396
|
+
children: [
|
|
397
|
+
/* @__PURE__ */ b(D, { name: ie[e] }),
|
|
398
|
+
/* @__PURE__ */ x("div", {
|
|
399
|
+
className: "hds-toast-body",
|
|
400
|
+
children: [/* @__PURE__ */ b("p", {
|
|
401
|
+
className: "hds-toast-title",
|
|
402
|
+
children: t
|
|
403
|
+
}), n ? /* @__PURE__ */ b("p", {
|
|
404
|
+
className: "hds-toast-description",
|
|
405
|
+
children: n
|
|
406
|
+
}) : null]
|
|
407
|
+
}),
|
|
408
|
+
i ? /* @__PURE__ */ b(O, {
|
|
409
|
+
variant: "ghost",
|
|
410
|
+
size: "sm",
|
|
411
|
+
iconOnly: !0,
|
|
412
|
+
icon: /* @__PURE__ */ b(D, { name: "x" }),
|
|
413
|
+
"aria-label": a,
|
|
414
|
+
onClick: i
|
|
415
|
+
}) : null
|
|
416
|
+
]
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
//#endregion
|
|
420
|
+
//#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 }) {
|
|
422
|
+
return e ? S(/* @__PURE__ */ b("div", {
|
|
350
423
|
className: "hds-toast-region",
|
|
351
|
-
children: /* @__PURE__ */
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
/* @__PURE__ */ c(m, { name: E[r] }),
|
|
360
|
-
/* @__PURE__ */ l("div", {
|
|
361
|
-
className: "hds-toast-body",
|
|
362
|
-
children: [/* @__PURE__ */ c("p", {
|
|
363
|
-
className: "hds-toast-title",
|
|
364
|
-
children: i
|
|
365
|
-
}), s ? /* @__PURE__ */ c("p", {
|
|
366
|
-
className: "hds-toast-description",
|
|
367
|
-
children: s
|
|
368
|
-
}) : null]
|
|
369
|
-
}),
|
|
370
|
-
t ? /* @__PURE__ */ c(h, {
|
|
371
|
-
variant: "ghost",
|
|
372
|
-
size: "sm",
|
|
373
|
-
iconOnly: !0,
|
|
374
|
-
icon: /* @__PURE__ */ c(m, { name: "x" }),
|
|
375
|
-
"aria-label": g,
|
|
376
|
-
onClick: t
|
|
377
|
-
}) : null
|
|
378
|
-
]
|
|
424
|
+
children: /* @__PURE__ */ b(L, {
|
|
425
|
+
tone: n,
|
|
426
|
+
title: r,
|
|
427
|
+
description: i,
|
|
428
|
+
duration: a,
|
|
429
|
+
onClose: t,
|
|
430
|
+
closeLabel: o,
|
|
431
|
+
className: s
|
|
379
432
|
})
|
|
380
433
|
}), document.body) : null;
|
|
381
434
|
}
|
|
382
435
|
//#endregion
|
|
436
|
+
//#region src/components/Toast/ToastProvider.tsx
|
|
437
|
+
var z = c(null);
|
|
438
|
+
function B({ children: e, max: t = 3, closeLabel: n = "Fechar aviso" }) {
|
|
439
|
+
let [r, i] = _([]), a = g(0), o = u((e) => {
|
|
440
|
+
i((t) => t.filter((t) => t.id !== e));
|
|
441
|
+
}, []), s = u(({ title: e, description: n, tone: r = "neutral", duration: o = 5e3 }) => {
|
|
442
|
+
let s = `hds-toast-${++a.current}`;
|
|
443
|
+
return i((i) => [...i, {
|
|
444
|
+
id: s,
|
|
445
|
+
title: e,
|
|
446
|
+
description: n,
|
|
447
|
+
tone: r,
|
|
448
|
+
duration: o
|
|
449
|
+
}].slice(-t)), s;
|
|
450
|
+
}, [t]), c = h(() => ({
|
|
451
|
+
show: s,
|
|
452
|
+
dismiss: o,
|
|
453
|
+
success: (e, t) => s({
|
|
454
|
+
title: e,
|
|
455
|
+
description: t,
|
|
456
|
+
tone: "success"
|
|
457
|
+
}),
|
|
458
|
+
error: (e, t) => s({
|
|
459
|
+
title: e,
|
|
460
|
+
description: t,
|
|
461
|
+
tone: "danger"
|
|
462
|
+
}),
|
|
463
|
+
warning: (e, t) => s({
|
|
464
|
+
title: e,
|
|
465
|
+
description: t,
|
|
466
|
+
tone: "warning"
|
|
467
|
+
}),
|
|
468
|
+
info: (e, t) => s({
|
|
469
|
+
title: e,
|
|
470
|
+
description: t,
|
|
471
|
+
tone: "neutral"
|
|
472
|
+
})
|
|
473
|
+
}), [s, o]);
|
|
474
|
+
return /* @__PURE__ */ x(z.Provider, {
|
|
475
|
+
value: c,
|
|
476
|
+
children: [e, r.length ? S(/* @__PURE__ */ b("div", {
|
|
477
|
+
className: "hds-toast-region",
|
|
478
|
+
children: r.map((e) => /* @__PURE__ */ b(L, {
|
|
479
|
+
tone: e.tone,
|
|
480
|
+
title: e.title,
|
|
481
|
+
description: e.description,
|
|
482
|
+
duration: e.duration,
|
|
483
|
+
closeLabel: n,
|
|
484
|
+
onClose: () => o(e.id)
|
|
485
|
+
}, e.id))
|
|
486
|
+
}), document.body) : null]
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
function V() {
|
|
490
|
+
let e = d(z);
|
|
491
|
+
if (!e) throw Error("useToast must be used inside a ToastProvider.");
|
|
492
|
+
return e;
|
|
493
|
+
}
|
|
494
|
+
//#endregion
|
|
383
495
|
//#region src/internal/field.tsx
|
|
384
|
-
function
|
|
385
|
-
let t =
|
|
496
|
+
function H(e) {
|
|
497
|
+
let t = p(), n = e ?? t;
|
|
386
498
|
return {
|
|
387
499
|
id: n,
|
|
388
500
|
hint: `${n}-hint`,
|
|
389
501
|
error: `${n}-error`
|
|
390
502
|
};
|
|
391
503
|
}
|
|
392
|
-
function
|
|
504
|
+
function U(e, t) {
|
|
393
505
|
let n = [
|
|
394
506
|
e.hint && t.hint,
|
|
395
507
|
e.error && t.error,
|
|
@@ -397,111 +509,111 @@ function k(e, t) {
|
|
|
397
509
|
].filter(Boolean);
|
|
398
510
|
return n.length ? n.join(" ") : void 0;
|
|
399
511
|
}
|
|
400
|
-
function
|
|
401
|
-
return /* @__PURE__ */
|
|
512
|
+
function W({ hint: e, error: t, ids: n }) {
|
|
513
|
+
return /* @__PURE__ */ x(y, { children: [e ? /* @__PURE__ */ b("p", {
|
|
402
514
|
id: n.hint,
|
|
403
515
|
className: "hds-hint",
|
|
404
516
|
children: e
|
|
405
|
-
}) : null, t ? /* @__PURE__ */
|
|
517
|
+
}) : null, t ? /* @__PURE__ */ x("p", {
|
|
406
518
|
id: n.error,
|
|
407
519
|
className: "hds-error",
|
|
408
|
-
children: [/* @__PURE__ */
|
|
520
|
+
children: [/* @__PURE__ */ b(D, { name: "circle-x" }), t]
|
|
409
521
|
}) : null] });
|
|
410
522
|
}
|
|
411
523
|
//#endregion
|
|
412
524
|
//#region src/components/Input/Input.tsx
|
|
413
|
-
var
|
|
414
|
-
let
|
|
415
|
-
return /* @__PURE__ */
|
|
416
|
-
className:
|
|
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);
|
|
527
|
+
return /* @__PURE__ */ x("div", {
|
|
528
|
+
className: C("hds-field", a),
|
|
417
529
|
children: [
|
|
418
|
-
/* @__PURE__ */
|
|
530
|
+
/* @__PURE__ */ b("label", {
|
|
419
531
|
className: "hds-label",
|
|
420
|
-
htmlFor:
|
|
532
|
+
htmlFor: c.id,
|
|
421
533
|
children: e
|
|
422
534
|
}),
|
|
423
|
-
/* @__PURE__ */
|
|
535
|
+
/* @__PURE__ */ b("input", {
|
|
424
536
|
inputMode: r ? "decimal" : void 0,
|
|
425
537
|
...o,
|
|
426
538
|
ref: s,
|
|
427
|
-
id:
|
|
539
|
+
id: c.id,
|
|
428
540
|
"aria-invalid": n ? !0 : void 0,
|
|
429
|
-
"aria-describedby":
|
|
541
|
+
"aria-describedby": U({
|
|
430
542
|
hint: t,
|
|
431
543
|
error: n,
|
|
432
544
|
"aria-describedby": o["aria-describedby"]
|
|
433
|
-
},
|
|
434
|
-
className:
|
|
545
|
+
}, c),
|
|
546
|
+
className: C("hds-input", r && "hds-input--numeric")
|
|
435
547
|
}),
|
|
436
|
-
/* @__PURE__ */
|
|
548
|
+
/* @__PURE__ */ b(W, {
|
|
437
549
|
hint: t,
|
|
438
550
|
error: n,
|
|
439
|
-
ids:
|
|
551
|
+
ids: c
|
|
440
552
|
})
|
|
441
553
|
]
|
|
442
554
|
});
|
|
443
|
-
}),
|
|
444
|
-
let
|
|
445
|
-
return /* @__PURE__ */
|
|
446
|
-
className:
|
|
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);
|
|
557
|
+
return /* @__PURE__ */ x("div", {
|
|
558
|
+
className: C("hds-field", o),
|
|
447
559
|
children: [
|
|
448
|
-
/* @__PURE__ */
|
|
560
|
+
/* @__PURE__ */ b("label", {
|
|
449
561
|
className: "hds-label",
|
|
450
|
-
htmlFor:
|
|
562
|
+
htmlFor: l.id,
|
|
451
563
|
children: e
|
|
452
564
|
}),
|
|
453
|
-
/* @__PURE__ */
|
|
565
|
+
/* @__PURE__ */ x("div", {
|
|
454
566
|
className: "hds-select-wrap",
|
|
455
|
-
children: [/* @__PURE__ */
|
|
567
|
+
children: [/* @__PURE__ */ x("select", {
|
|
456
568
|
...s,
|
|
457
|
-
ref:
|
|
458
|
-
id:
|
|
569
|
+
ref: c,
|
|
570
|
+
id: l.id,
|
|
459
571
|
"aria-invalid": i ? !0 : void 0,
|
|
460
|
-
"aria-describedby":
|
|
572
|
+
"aria-describedby": U({
|
|
461
573
|
hint: r,
|
|
462
574
|
error: i,
|
|
463
575
|
"aria-describedby": s["aria-describedby"]
|
|
464
|
-
},
|
|
576
|
+
}, l),
|
|
465
577
|
className: "hds-select",
|
|
466
|
-
children: [n ? /* @__PURE__ */
|
|
578
|
+
children: [n ? /* @__PURE__ */ b("option", {
|
|
467
579
|
value: "",
|
|
468
580
|
disabled: !0,
|
|
469
581
|
children: n
|
|
470
|
-
}) : null, t.map((e) => /* @__PURE__ */
|
|
582
|
+
}) : null, t.map((e) => /* @__PURE__ */ b("option", {
|
|
471
583
|
value: e.value,
|
|
472
584
|
disabled: e.disabled,
|
|
473
585
|
children: e.label
|
|
474
586
|
}, e.value))]
|
|
475
|
-
}), /* @__PURE__ */
|
|
587
|
+
}), /* @__PURE__ */ b(D, { name: "chevron-down" })]
|
|
476
588
|
}),
|
|
477
|
-
/* @__PURE__ */
|
|
589
|
+
/* @__PURE__ */ b(W, {
|
|
478
590
|
hint: r,
|
|
479
591
|
error: i,
|
|
480
|
-
ids:
|
|
592
|
+
ids: l
|
|
481
593
|
})
|
|
482
594
|
]
|
|
483
595
|
});
|
|
484
|
-
}),
|
|
485
|
-
let o =
|
|
486
|
-
return /* @__PURE__ */
|
|
487
|
-
className:
|
|
596
|
+
}), q = l(function({ label: e, hint: t, id: n, className: r, ...i }, a) {
|
|
597
|
+
let o = H(n);
|
|
598
|
+
return /* @__PURE__ */ x("label", {
|
|
599
|
+
className: C("hds-checkbox", r),
|
|
488
600
|
htmlFor: o.id,
|
|
489
|
-
children: [/* @__PURE__ */
|
|
601
|
+
children: [/* @__PURE__ */ x("span", {
|
|
490
602
|
className: "hds-checkbox-control",
|
|
491
|
-
children: [/* @__PURE__ */
|
|
603
|
+
children: [/* @__PURE__ */ b("input", {
|
|
492
604
|
...i,
|
|
493
605
|
ref: a,
|
|
494
606
|
id: o.id,
|
|
495
607
|
type: "checkbox",
|
|
496
608
|
className: "hds-checkbox-input",
|
|
497
609
|
"aria-describedby": t ? o.hint : i["aria-describedby"]
|
|
498
|
-
}), /* @__PURE__ */
|
|
610
|
+
}), /* @__PURE__ */ b("span", {
|
|
499
611
|
className: "hds-checkbox-box",
|
|
500
|
-
children: /* @__PURE__ */
|
|
612
|
+
children: /* @__PURE__ */ b(D, { name: "check" })
|
|
501
613
|
})]
|
|
502
|
-
}), /* @__PURE__ */
|
|
614
|
+
}), /* @__PURE__ */ x("span", {
|
|
503
615
|
className: "hds-checkbox-text",
|
|
504
|
-
children: [e, t ? /* @__PURE__ */
|
|
616
|
+
children: [e, t ? /* @__PURE__ */ b("span", {
|
|
505
617
|
id: o.hint,
|
|
506
618
|
className: "hds-hint",
|
|
507
619
|
children: t
|
|
@@ -511,34 +623,34 @@ var j = t(function({ label: e, hint: t, error: n, numeric: r = !1, id: i, classN
|
|
|
511
623
|
});
|
|
512
624
|
//#endregion
|
|
513
625
|
//#region src/components/Card/Card.tsx
|
|
514
|
-
function
|
|
515
|
-
return /* @__PURE__ */
|
|
516
|
-
...
|
|
517
|
-
className:
|
|
626
|
+
function J({ as: e = "article", eyebrow: t, title: n, media: r, footer: i, interactive: a = !1, className: o, children: s, ...c }) {
|
|
627
|
+
return /* @__PURE__ */ x(e, {
|
|
628
|
+
...c,
|
|
629
|
+
className: C("hds-card", a && "hds-card--interactive", o),
|
|
518
630
|
children: [
|
|
519
|
-
r ? /* @__PURE__ */
|
|
631
|
+
r ? /* @__PURE__ */ b("img", {
|
|
520
632
|
className: "hds-card-media",
|
|
521
633
|
src: r.src,
|
|
522
634
|
alt: r.alt ?? ""
|
|
523
635
|
}) : null,
|
|
524
|
-
/* @__PURE__ */
|
|
636
|
+
/* @__PURE__ */ x("div", {
|
|
525
637
|
className: "hds-card-body",
|
|
526
638
|
children: [
|
|
527
|
-
t ? /* @__PURE__ */
|
|
639
|
+
t ? /* @__PURE__ */ b("p", {
|
|
528
640
|
className: "hds-card-eyebrow",
|
|
529
641
|
children: t
|
|
530
642
|
}) : null,
|
|
531
|
-
n ? /* @__PURE__ */
|
|
643
|
+
n ? /* @__PURE__ */ b("h3", {
|
|
532
644
|
className: "hds-card-title",
|
|
533
645
|
children: n
|
|
534
646
|
}) : null,
|
|
535
|
-
s ? /* @__PURE__ */
|
|
647
|
+
s ? /* @__PURE__ */ b("div", {
|
|
536
648
|
className: "hds-card-text",
|
|
537
649
|
children: s
|
|
538
650
|
}) : null
|
|
539
651
|
]
|
|
540
652
|
}),
|
|
541
|
-
i ? /* @__PURE__ */
|
|
653
|
+
i ? /* @__PURE__ */ b("div", {
|
|
542
654
|
className: "hds-card-footer",
|
|
543
655
|
children: i
|
|
544
656
|
}) : null
|
|
@@ -547,47 +659,47 @@ function P({ as: e = "article", eyebrow: t, title: n, media: r, footer: i, inter
|
|
|
547
659
|
}
|
|
548
660
|
//#endregion
|
|
549
661
|
//#region src/components/Badge/Badge.tsx
|
|
550
|
-
var
|
|
662
|
+
var ae = {
|
|
551
663
|
accent: "info",
|
|
552
664
|
success: "circle-check",
|
|
553
665
|
warning: "triangle-alert",
|
|
554
666
|
danger: "circle-x"
|
|
555
667
|
};
|
|
556
|
-
function
|
|
557
|
-
let i =
|
|
558
|
-
return /* @__PURE__ */
|
|
559
|
-
className:
|
|
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);
|
|
670
|
+
return /* @__PURE__ */ x("span", {
|
|
671
|
+
className: C("hds-badge", `hds-badge--${e}`, r),
|
|
560
672
|
children: [a, n]
|
|
561
673
|
});
|
|
562
674
|
}
|
|
563
675
|
//#endregion
|
|
564
676
|
//#region src/components/Table/Table.tsx
|
|
565
|
-
function
|
|
677
|
+
function Y(e) {
|
|
566
678
|
return e.numeric ? "hds-cell--numeric" : e.align === "center" ? "hds-cell--center" : void 0;
|
|
567
679
|
}
|
|
568
|
-
function
|
|
569
|
-
return /* @__PURE__ */
|
|
570
|
-
className:
|
|
680
|
+
function se({ columns: e, rows: t, rowKey: n = "id", caption: r, hideCaption: i = !1, empty: a = "Nada para mostrar.", maxHeight: o, className: s }) {
|
|
681
|
+
return /* @__PURE__ */ b("div", {
|
|
682
|
+
className: C("hds-table-wrap", "hds-scroll", s),
|
|
571
683
|
role: "region",
|
|
572
684
|
"aria-label": r,
|
|
573
685
|
tabIndex: 0,
|
|
574
686
|
style: o === void 0 ? void 0 : { maxHeight: o },
|
|
575
|
-
children: /* @__PURE__ */
|
|
687
|
+
children: /* @__PURE__ */ x("table", {
|
|
576
688
|
className: "hds-table",
|
|
577
689
|
children: [
|
|
578
|
-
r ? /* @__PURE__ */
|
|
690
|
+
r ? /* @__PURE__ */ b("caption", {
|
|
579
691
|
className: i ? "hds-visually-hidden" : void 0,
|
|
580
692
|
children: r
|
|
581
693
|
}) : null,
|
|
582
|
-
/* @__PURE__ */
|
|
694
|
+
/* @__PURE__ */ b("thead", { children: /* @__PURE__ */ b("tr", { children: e.map((e) => /* @__PURE__ */ b("th", {
|
|
583
695
|
scope: "col",
|
|
584
|
-
className:
|
|
696
|
+
className: Y(e),
|
|
585
697
|
children: e.header
|
|
586
698
|
}, e.key)) }) }),
|
|
587
|
-
/* @__PURE__ */
|
|
588
|
-
className:
|
|
699
|
+
/* @__PURE__ */ b("tbody", { children: t.length ? t.map((t, r) => /* @__PURE__ */ b("tr", { children: e.map((e) => /* @__PURE__ */ b("td", {
|
|
700
|
+
className: Y(e),
|
|
589
701
|
children: e.render ? e.render(t) : t[e.key]
|
|
590
|
-
}, e.key)) }, String(t[n] ?? r))) : /* @__PURE__ */
|
|
702
|
+
}, e.key)) }, String(t[n] ?? r))) : /* @__PURE__ */ b("tr", { children: /* @__PURE__ */ b("td", {
|
|
591
703
|
colSpan: e.length || 1,
|
|
592
704
|
className: "hds-table-empty",
|
|
593
705
|
children: a
|
|
@@ -597,20 +709,70 @@ function R({ columns: e, rows: t, rowKey: n = "id", caption: r, hideCaption: i =
|
|
|
597
709
|
});
|
|
598
710
|
}
|
|
599
711
|
//#endregion
|
|
712
|
+
//#region src/appearance/useAppearance.ts
|
|
713
|
+
var X = !1, Z = {
|
|
714
|
+
theme: "dark",
|
|
715
|
+
transparency: "full"
|
|
716
|
+
}, Q = Z;
|
|
717
|
+
function ce() {
|
|
718
|
+
let e = a();
|
|
719
|
+
return (e.theme !== Q.theme || e.transparency !== Q.transparency) && (Q = e), Q;
|
|
720
|
+
}
|
|
721
|
+
function $() {
|
|
722
|
+
f(() => {
|
|
723
|
+
X || (X = !0, document.documentElement.hasAttribute("data-theme") || r());
|
|
724
|
+
}, []);
|
|
725
|
+
let e = v(o, ce, () => Z);
|
|
726
|
+
return {
|
|
727
|
+
...e,
|
|
728
|
+
setTheme: t,
|
|
729
|
+
setTransparency: i,
|
|
730
|
+
toggleTheme: () => t(e.theme === "dark" ? "light" : "dark"),
|
|
731
|
+
toggleTransparency: () => i(e.transparency === "full" ? "reduced" : "full")
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
//#endregion
|
|
735
|
+
//#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, {
|
|
739
|
+
...r,
|
|
740
|
+
variant: n,
|
|
741
|
+
iconOnly: !0,
|
|
742
|
+
icon: /* @__PURE__ */ b(D, { name: i === "dark" ? "sun" : "moon" }),
|
|
743
|
+
"aria-label": o,
|
|
744
|
+
title: o,
|
|
745
|
+
onClick: a
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
function ue({ label: e = "Reduzir transparência", variant: t = "ghost", ...n }) {
|
|
749
|
+
let { transparency: r, toggleTransparency: i } = $();
|
|
750
|
+
return /* @__PURE__ */ b(O, {
|
|
751
|
+
...n,
|
|
752
|
+
variant: t,
|
|
753
|
+
iconOnly: !0,
|
|
754
|
+
icon: /* @__PURE__ */ b(D, { name: "blend" }),
|
|
755
|
+
"aria-label": e,
|
|
756
|
+
"aria-pressed": r === "reduced",
|
|
757
|
+
title: e,
|
|
758
|
+
onClick: i
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
//#endregion
|
|
600
762
|
//#region src/components/Container/Container.tsx
|
|
601
|
-
function
|
|
602
|
-
return /* @__PURE__ */
|
|
763
|
+
function de({ as: e = "section", withSidebar: t = !1, className: n, ...r }) {
|
|
764
|
+
return /* @__PURE__ */ b(e, {
|
|
603
765
|
...r,
|
|
604
|
-
className:
|
|
766
|
+
className: C("hds-container", t && "hds-container--with-sidebar", n)
|
|
605
767
|
});
|
|
606
768
|
}
|
|
607
769
|
//#endregion
|
|
608
770
|
//#region src/components/SectionTitle/SectionTitle.tsx
|
|
609
|
-
function
|
|
610
|
-
return /* @__PURE__ */
|
|
771
|
+
function fe({ children: e, index: t, as: n = "h2", id: r, className: i }) {
|
|
772
|
+
return /* @__PURE__ */ x(n, {
|
|
611
773
|
id: r,
|
|
612
|
-
className:
|
|
613
|
-
children: [t === void 0 ? null : /* @__PURE__ */
|
|
774
|
+
className: C("hds-section-title", i),
|
|
775
|
+
children: [t === void 0 ? null : /* @__PURE__ */ b("span", {
|
|
614
776
|
className: "hds-section-index",
|
|
615
777
|
"aria-hidden": "true",
|
|
616
778
|
children: String(t).padStart(2, "0")
|
|
@@ -619,22 +781,22 @@ function B({ children: e, index: t, as: n = "h2", id: r, className: i }) {
|
|
|
619
781
|
}
|
|
620
782
|
//#endregion
|
|
621
783
|
//#region src/components/Separator/Separator.tsx
|
|
622
|
-
function
|
|
623
|
-
return /* @__PURE__ */
|
|
784
|
+
function pe({ orientation: e = "horizontal", decorative: t = !1, className: n }) {
|
|
785
|
+
return /* @__PURE__ */ b("div", {
|
|
624
786
|
role: t ? "none" : "separator",
|
|
625
787
|
"aria-orientation": t ? void 0 : e,
|
|
626
|
-
className:
|
|
788
|
+
className: C("hds-separator", `hds-separator--${e}`, n)
|
|
627
789
|
});
|
|
628
790
|
}
|
|
629
791
|
//#endregion
|
|
630
792
|
//#region src/components/ScrollArea/ScrollArea.tsx
|
|
631
|
-
function
|
|
632
|
-
return /* @__PURE__ */
|
|
793
|
+
function me({ label: e, maxHeight: t, className: n, style: r, ...i }) {
|
|
794
|
+
return /* @__PURE__ */ b("div", {
|
|
633
795
|
...i,
|
|
634
796
|
role: "region",
|
|
635
797
|
"aria-label": e,
|
|
636
798
|
tabIndex: 0,
|
|
637
|
-
className:
|
|
799
|
+
className: C("hds-scroll", n),
|
|
638
800
|
style: {
|
|
639
801
|
maxHeight: t,
|
|
640
802
|
...r
|
|
@@ -643,11 +805,11 @@ function H({ label: e, maxHeight: t, className: n, style: r, ...i }) {
|
|
|
643
805
|
}
|
|
644
806
|
//#endregion
|
|
645
807
|
//#region src/components/Loading/Loading.tsx
|
|
646
|
-
function
|
|
647
|
-
return /* @__PURE__ */
|
|
808
|
+
function he({ size: e = "md", label: t = "Carregando…", showLabel: n = !1, className: r }) {
|
|
809
|
+
return /* @__PURE__ */ x("span", {
|
|
648
810
|
role: "status",
|
|
649
|
-
className:
|
|
650
|
-
children: [/* @__PURE__ */
|
|
811
|
+
className: C("hds-loading", `hds-loading--${e}`, r),
|
|
812
|
+
children: [/* @__PURE__ */ b(D, { name: "loader" }), /* @__PURE__ */ b("span", {
|
|
651
813
|
className: n ? void 0 : "hds-visually-hidden",
|
|
652
814
|
children: t
|
|
653
815
|
})]
|
|
@@ -655,17 +817,17 @@ function U({ size: e = "md", label: t = "Carregando…", showLabel: n = !1, clas
|
|
|
655
817
|
}
|
|
656
818
|
//#endregion
|
|
657
819
|
//#region src/components/GlowAvatar/GlowAvatar.tsx
|
|
658
|
-
function
|
|
659
|
-
return /* @__PURE__ */
|
|
660
|
-
className:
|
|
820
|
+
function ge({ src: e, alt: t, size: n = 96, className: r }) {
|
|
821
|
+
return /* @__PURE__ */ x("span", {
|
|
822
|
+
className: C("hds-avatar", r),
|
|
661
823
|
style: {
|
|
662
824
|
width: n,
|
|
663
825
|
height: n
|
|
664
826
|
},
|
|
665
|
-
children: [/* @__PURE__ */
|
|
827
|
+
children: [/* @__PURE__ */ b("span", {
|
|
666
828
|
className: "hds-avatar-glow",
|
|
667
829
|
"aria-hidden": "true"
|
|
668
|
-
}), /* @__PURE__ */
|
|
830
|
+
}), /* @__PURE__ */ b("img", {
|
|
669
831
|
className: "hds-avatar-image",
|
|
670
832
|
src: e,
|
|
671
833
|
alt: t,
|
|
@@ -675,6 +837,6 @@ function W({ src: e, alt: t, size: n = 96, className: r }) {
|
|
|
675
837
|
});
|
|
676
838
|
}
|
|
677
839
|
//#endregion
|
|
678
|
-
export {
|
|
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 };
|
|
679
841
|
|
|
680
842
|
//# sourceMappingURL=index.js.map
|