@hemerson/design-system 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +91 -2
- package/dist/components/Badge/Badge.d.ts +14 -0
- package/dist/components/Button/Button.d.ts +17 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Card/Card.d.ts +19 -0
- package/dist/components/Checkbox/Checkbox.d.ts +8 -0
- package/dist/components/Container/Container.d.ts +9 -0
- package/dist/components/Dialog/Dialog.d.ts +18 -0
- package/dist/components/FloatingButton/FloatingButton.d.ts +9 -0
- package/dist/components/GlassPanel/GlassPanel.d.ts +13 -0
- package/dist/components/GlowAvatar/GlowAvatar.d.ts +10 -0
- package/dist/components/Input/Input.d.ts +12 -0
- package/dist/components/Loading/Loading.d.ts +11 -0
- package/dist/components/Menu/Menu.d.ts +25 -0
- package/dist/components/NavBar/NavBar.d.ts +20 -0
- package/dist/components/ScrollArea/ScrollArea.d.ts +8 -0
- package/dist/components/SectionTitle/SectionTitle.d.ts +12 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +21 -0
- package/dist/components/Select/Select.d.ts +16 -0
- package/dist/components/Separator/Separator.d.ts +8 -0
- package/dist/components/Sidebar/Sidebar.d.ts +21 -0
- package/dist/components/Table/Table.d.ts +26 -0
- package/dist/components/Toast/Toast.d.ts +16 -0
- package/dist/enableGlassRefraction-CgDeg-2E.js +88 -0
- package/dist/enableGlassRefraction-CgDeg-2E.js.map +1 -0
- package/dist/glass/enableGlassRefraction.d.ts +10 -0
- package/dist/glass/index.d.ts +1 -0
- package/dist/glass/lens.d.ts +15 -0
- package/dist/glass.js +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +680 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/Icon.d.ts +17 -0
- package/dist/internal/cx.d.ts +2 -0
- package/dist/internal/field.d.ts +16 -0
- package/dist/styles.css +1297 -0
- package/dist/tokens.css +190 -0
- package/dist/tokens.json +538 -0
- package/package.json +95 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,680 @@
|
|
|
1
|
+
import { t as e } from "./enableGlassRefraction-CgDeg-2E.js";
|
|
2
|
+
import { forwardRef as t, useEffect as n, useId as r, useLayoutEffect as i, useRef as a, useState as o } from "react";
|
|
3
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
4
|
+
import { createPortal as u } from "react-dom";
|
|
5
|
+
//#region src/internal/cx.ts
|
|
6
|
+
function d(...e) {
|
|
7
|
+
return e.filter(Boolean).join(" ");
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/components/GlassPanel/GlassPanel.tsx
|
|
11
|
+
var f = t(function({ as: e = "div", tone: t = "regular", className: n, ...r }, i) {
|
|
12
|
+
return /* @__PURE__ */ c(e, {
|
|
13
|
+
...r,
|
|
14
|
+
ref: i,
|
|
15
|
+
className: d("hds-glass", t !== "regular" && `hds-glass--${t}`, n)
|
|
16
|
+
});
|
|
17
|
+
}), p = {
|
|
18
|
+
check: ["M20 6 9 17l-5-5"],
|
|
19
|
+
x: ["M18 6 6 18", "m6 6 12 12"],
|
|
20
|
+
"chevron-down": ["m6 9 6 6 6-6"],
|
|
21
|
+
"circle-check": ["circle", "m9 12 2 2 4-4"],
|
|
22
|
+
"circle-x": [
|
|
23
|
+
"circle",
|
|
24
|
+
"m15 9-6 6",
|
|
25
|
+
"m9 9 6 6"
|
|
26
|
+
],
|
|
27
|
+
"triangle-alert": [
|
|
28
|
+
"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
|
|
29
|
+
"M12 9v4",
|
|
30
|
+
"M12 17h.01"
|
|
31
|
+
],
|
|
32
|
+
info: [
|
|
33
|
+
"circle",
|
|
34
|
+
"M12 16v-4",
|
|
35
|
+
"M12 8h.01"
|
|
36
|
+
],
|
|
37
|
+
loader: ["M21 12a9 9 0 1 1-6.219-8.56"]
|
|
38
|
+
};
|
|
39
|
+
function m({ name: e, className: t }) {
|
|
40
|
+
return /* @__PURE__ */ c("svg", {
|
|
41
|
+
className: d("hds-icon", t),
|
|
42
|
+
viewBox: "0 0 24 24",
|
|
43
|
+
fill: "none",
|
|
44
|
+
stroke: "currentColor",
|
|
45
|
+
strokeWidth: 2,
|
|
46
|
+
strokeLinecap: "round",
|
|
47
|
+
strokeLinejoin: "round",
|
|
48
|
+
"aria-hidden": "true",
|
|
49
|
+
focusable: "false",
|
|
50
|
+
children: p[e].map((e) => e === "circle" ? /* @__PURE__ */ c("circle", {
|
|
51
|
+
cx: 12,
|
|
52
|
+
cy: 12,
|
|
53
|
+
r: 10
|
|
54
|
+
}, e) : /* @__PURE__ */ c("path", { d: e }, e))
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/components/Button/Button.tsx
|
|
59
|
+
var h = t(function({ variant: e = "primary", size: t = "md", icon: n, iconOnly: r = !1, loading: i = !1, disabled: a, type: o = "button", className: s, children: u, ...f }, p) {
|
|
60
|
+
return r && !f["aria-label"] && !f["aria-labelledby"] && console.warn("Button: an icon-only button needs an aria-label."), /* @__PURE__ */ l("button", {
|
|
61
|
+
...f,
|
|
62
|
+
ref: p,
|
|
63
|
+
type: o,
|
|
64
|
+
disabled: a || i,
|
|
65
|
+
"aria-busy": i || void 0,
|
|
66
|
+
className: d("hds-btn", `hds-btn--${e}`, t !== "md" && `hds-btn--${t}`, r && "hds-btn--icon", e === "glass" && "hds-glass", s),
|
|
67
|
+
children: [i ? /* @__PURE__ */ c(m, {
|
|
68
|
+
name: "loader",
|
|
69
|
+
className: "hds-spin"
|
|
70
|
+
}) : n, r ? null : u]
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/components/NavBar/NavBar.tsx
|
|
75
|
+
function g({ active: e = !1, className: t, ...n }) {
|
|
76
|
+
return /* @__PURE__ */ c("a", {
|
|
77
|
+
...n,
|
|
78
|
+
"aria-current": e ? "page" : void 0,
|
|
79
|
+
className: d("hds-navbar-link", t)
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function _({ title: e, actions: t, navLabel: n = "Principal", className: r, children: i, ...a }) {
|
|
83
|
+
return /* @__PURE__ */ l(f, {
|
|
84
|
+
...a,
|
|
85
|
+
as: "header",
|
|
86
|
+
className: d("hds-navbar", r),
|
|
87
|
+
children: [
|
|
88
|
+
e ? /* @__PURE__ */ c("p", {
|
|
89
|
+
className: "hds-navbar-title",
|
|
90
|
+
children: e
|
|
91
|
+
}) : null,
|
|
92
|
+
i ? /* @__PURE__ */ c("nav", {
|
|
93
|
+
className: "hds-navbar-nav",
|
|
94
|
+
"aria-label": n,
|
|
95
|
+
children: i
|
|
96
|
+
}) : null,
|
|
97
|
+
t ? /* @__PURE__ */ c("div", {
|
|
98
|
+
className: "hds-navbar-actions",
|
|
99
|
+
children: t
|
|
100
|
+
}) : null
|
|
101
|
+
]
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
var v = Object.assign(_, { Link: g });
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/components/Sidebar/Sidebar.tsx
|
|
107
|
+
function y({ items: e, footer: t, floating: n = !1, label: r = "Navegação", className: i }) {
|
|
108
|
+
return /* @__PURE__ */ l(f, {
|
|
109
|
+
as: "nav",
|
|
110
|
+
"aria-label": r,
|
|
111
|
+
className: d("hds-sidebar", n && "hds-sidebar--floating", i),
|
|
112
|
+
children: [/* @__PURE__ */ c("ul", {
|
|
113
|
+
className: "hds-sidebar-items",
|
|
114
|
+
children: e.map((e) => {
|
|
115
|
+
let t = {
|
|
116
|
+
"aria-label": e.label,
|
|
117
|
+
title: e.label,
|
|
118
|
+
"aria-current": e.active ? "page" : void 0,
|
|
119
|
+
className: "hds-sidebar-item"
|
|
120
|
+
};
|
|
121
|
+
return /* @__PURE__ */ c("li", { children: e.href ? /* @__PURE__ */ c("a", {
|
|
122
|
+
...t,
|
|
123
|
+
href: e.href,
|
|
124
|
+
onClick: e.onClick,
|
|
125
|
+
children: e.icon
|
|
126
|
+
}) : /* @__PURE__ */ c("button", {
|
|
127
|
+
...t,
|
|
128
|
+
type: "button",
|
|
129
|
+
onClick: e.onClick,
|
|
130
|
+
children: e.icon
|
|
131
|
+
}) }, e.label);
|
|
132
|
+
})
|
|
133
|
+
}), t ? /* @__PURE__ */ c("div", {
|
|
134
|
+
className: "hds-sidebar-footer",
|
|
135
|
+
children: t
|
|
136
|
+
}) : null]
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/components/SegmentedControl/SegmentedControl.tsx
|
|
141
|
+
var b = {
|
|
142
|
+
ArrowRight: 1,
|
|
143
|
+
ArrowDown: 1,
|
|
144
|
+
ArrowLeft: -1,
|
|
145
|
+
ArrowUp: -1
|
|
146
|
+
};
|
|
147
|
+
function x({ options: e, value: t, defaultValue: n, onChange: r, label: s, className: u }) {
|
|
148
|
+
let [p, m] = o(n ?? e[0]?.value), h = t === void 0 ? p : t, g = a([]), _ = a(null), v = Math.max(0, e.findIndex((e) => e.value === h));
|
|
149
|
+
i(() => {
|
|
150
|
+
function e() {
|
|
151
|
+
let e = g.current[v];
|
|
152
|
+
e && _.current && (_.current.style.width = `${e.offsetWidth}px`, _.current.style.transform = `translateX(${e.offsetLeft - 4}px)`, _.current.style.opacity = "1");
|
|
153
|
+
}
|
|
154
|
+
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
155
|
+
}, [v, e.length]);
|
|
156
|
+
function y(e) {
|
|
157
|
+
t === void 0 && m(e), r?.(e);
|
|
158
|
+
}
|
|
159
|
+
function x(t) {
|
|
160
|
+
let n = b[t.key];
|
|
161
|
+
if (!n) return;
|
|
162
|
+
t.preventDefault();
|
|
163
|
+
let r = (v + n + e.length) % e.length;
|
|
164
|
+
y(e[r].value), g.current[r]?.focus();
|
|
165
|
+
}
|
|
166
|
+
return /* @__PURE__ */ l(f, {
|
|
167
|
+
role: "radiogroup",
|
|
168
|
+
"aria-label": s,
|
|
169
|
+
className: d("hds-segmented", u),
|
|
170
|
+
onKeyDown: x,
|
|
171
|
+
children: [/* @__PURE__ */ c("span", {
|
|
172
|
+
ref: _,
|
|
173
|
+
className: "hds-segmented-thumb",
|
|
174
|
+
"aria-hidden": "true",
|
|
175
|
+
style: { opacity: 0 }
|
|
176
|
+
}), e.map((e, t) => {
|
|
177
|
+
let n = t === v;
|
|
178
|
+
return /* @__PURE__ */ l("button", {
|
|
179
|
+
ref: (e) => {
|
|
180
|
+
g.current[t] = e;
|
|
181
|
+
},
|
|
182
|
+
type: "button",
|
|
183
|
+
role: "radio",
|
|
184
|
+
"aria-checked": n,
|
|
185
|
+
"aria-label": e.ariaLabel,
|
|
186
|
+
tabIndex: n ? 0 : -1,
|
|
187
|
+
className: "hds-segmented-option",
|
|
188
|
+
onClick: () => y(e.value),
|
|
189
|
+
children: [e.icon, e.label]
|
|
190
|
+
}, String(e.value));
|
|
191
|
+
})]
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/components/Menu/Menu.tsx
|
|
196
|
+
function S({ label: e, icon: t, iconOnly: i = !1, items: s, align: u = "end", triggerVariant: p = "glass", className: m }) {
|
|
197
|
+
let [g, _] = o(!1), v = a(null), y = a(null), b = a(null), x = r(), S = () => Array.from(b.current?.querySelectorAll("[role=\"menuitem\"]") ?? []);
|
|
198
|
+
function C(e) {
|
|
199
|
+
_(!1), e && y.current?.focus();
|
|
200
|
+
}
|
|
201
|
+
n(() => {
|
|
202
|
+
if (!g) return;
|
|
203
|
+
S()[0]?.focus();
|
|
204
|
+
function e(e) {
|
|
205
|
+
v.current && !v.current.contains(e.target) && _(!1);
|
|
206
|
+
}
|
|
207
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
208
|
+
}, [g]);
|
|
209
|
+
function w(e) {
|
|
210
|
+
let t = S(), n = t.indexOf(document.activeElement);
|
|
211
|
+
e.key === "Escape" ? (e.preventDefault(), C(!0)) : e.key === "Tab" ? C(!1) : 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
|
+
}
|
|
213
|
+
return /* @__PURE__ */ l("div", {
|
|
214
|
+
ref: v,
|
|
215
|
+
className: d("hds-menu", m),
|
|
216
|
+
children: [/* @__PURE__ */ c(h, {
|
|
217
|
+
ref: y,
|
|
218
|
+
variant: p,
|
|
219
|
+
icon: t,
|
|
220
|
+
iconOnly: i,
|
|
221
|
+
"aria-label": i ? e : void 0,
|
|
222
|
+
"aria-haspopup": "menu",
|
|
223
|
+
"aria-expanded": g,
|
|
224
|
+
"aria-controls": g ? x : void 0,
|
|
225
|
+
onClick: () => _(!g),
|
|
226
|
+
children: e
|
|
227
|
+
}), g ? /* @__PURE__ */ c(f, {
|
|
228
|
+
ref: b,
|
|
229
|
+
id: x,
|
|
230
|
+
role: "menu",
|
|
231
|
+
"aria-label": e,
|
|
232
|
+
className: d("hds-menu-panel", `hds-menu-panel--${u}`),
|
|
233
|
+
onKeyDown: w,
|
|
234
|
+
children: s.map((e, t) => e.separator ? /* @__PURE__ */ c("div", {
|
|
235
|
+
role: "separator",
|
|
236
|
+
className: "hds-menu-separator"
|
|
237
|
+
}, `separator-${t}`) : /* @__PURE__ */ l("button", {
|
|
238
|
+
type: "button",
|
|
239
|
+
role: "menuitem",
|
|
240
|
+
tabIndex: -1,
|
|
241
|
+
className: d("hds-menu-item", e.danger && "hds-menu-item--danger"),
|
|
242
|
+
onClick: () => {
|
|
243
|
+
C(!0), e.onSelect?.();
|
|
244
|
+
},
|
|
245
|
+
children: [e.icon, e.label]
|
|
246
|
+
}, e.label))
|
|
247
|
+
}) : null]
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
//#endregion
|
|
251
|
+
//#region src/components/FloatingButton/FloatingButton.tsx
|
|
252
|
+
var C = t(function({ label: e, position: t = "bottom-right", type: n = "button", className: r, ...i }, a) {
|
|
253
|
+
return /* @__PURE__ */ c("button", {
|
|
254
|
+
...i,
|
|
255
|
+
ref: a,
|
|
256
|
+
type: n,
|
|
257
|
+
"aria-label": e,
|
|
258
|
+
title: e,
|
|
259
|
+
className: d("hds-glass", "hds-fab", `hds-fab--${t}`, r)
|
|
260
|
+
});
|
|
261
|
+
}), w = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
|
|
262
|
+
function T({ open: e, onClose: t, title: i, description: o, children: s, footer: p, closeLabel: g = "Fechar", initialFocus: _ = "first", className: v }) {
|
|
263
|
+
let y = a(null), b = r(), x = r(), S = a(t);
|
|
264
|
+
return n(() => {
|
|
265
|
+
S.current = t;
|
|
266
|
+
}, [t]), n(() => {
|
|
267
|
+
if (!e) return;
|
|
268
|
+
let t = document.activeElement, n = document.body.style.overflow;
|
|
269
|
+
document.body.style.overflow = "hidden";
|
|
270
|
+
let r = y.current?.querySelectorAll(w) ?? [];
|
|
271
|
+
(_ === "panel" || r.length === 0 ? y.current : r[0])?.focus();
|
|
272
|
+
function i(e) {
|
|
273
|
+
if (e.key === "Escape") {
|
|
274
|
+
e.preventDefault(), S.current();
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
if (e.key !== "Tab" || !y.current) return;
|
|
278
|
+
let t = Array.from(y.current.querySelectorAll(w));
|
|
279
|
+
if (t.length === 0) return;
|
|
280
|
+
let n = t[0], r = t[t.length - 1];
|
|
281
|
+
e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus());
|
|
282
|
+
}
|
|
283
|
+
return document.addEventListener("keydown", i), () => {
|
|
284
|
+
document.removeEventListener("keydown", i), document.body.style.overflow = n, t?.focus();
|
|
285
|
+
};
|
|
286
|
+
}, [e, _]), e ? u(/* @__PURE__ */ c("div", {
|
|
287
|
+
className: "hds-scrim",
|
|
288
|
+
onMouseDown: (e) => {
|
|
289
|
+
e.target === e.currentTarget && t();
|
|
290
|
+
},
|
|
291
|
+
children: /* @__PURE__ */ l(f, {
|
|
292
|
+
ref: y,
|
|
293
|
+
tone: "thick",
|
|
294
|
+
role: "dialog",
|
|
295
|
+
"aria-modal": "true",
|
|
296
|
+
"aria-labelledby": b,
|
|
297
|
+
"aria-describedby": o ? x : void 0,
|
|
298
|
+
tabIndex: -1,
|
|
299
|
+
className: d("hds-dialog", v),
|
|
300
|
+
children: [
|
|
301
|
+
/* @__PURE__ */ l("div", {
|
|
302
|
+
className: "hds-dialog-header",
|
|
303
|
+
children: [/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("h2", {
|
|
304
|
+
id: b,
|
|
305
|
+
className: "hds-dialog-title",
|
|
306
|
+
children: i
|
|
307
|
+
}), o ? /* @__PURE__ */ c("p", {
|
|
308
|
+
id: x,
|
|
309
|
+
className: "hds-dialog-description",
|
|
310
|
+
children: o
|
|
311
|
+
}) : null] }), /* @__PURE__ */ c(h, {
|
|
312
|
+
variant: "ghost",
|
|
313
|
+
size: "sm",
|
|
314
|
+
iconOnly: !0,
|
|
315
|
+
icon: /* @__PURE__ */ c(m, { name: "x" }),
|
|
316
|
+
"aria-label": g,
|
|
317
|
+
onClick: t
|
|
318
|
+
})]
|
|
319
|
+
}),
|
|
320
|
+
s,
|
|
321
|
+
p ? /* @__PURE__ */ c("div", {
|
|
322
|
+
className: "hds-dialog-footer",
|
|
323
|
+
children: p
|
|
324
|
+
}) : null
|
|
325
|
+
]
|
|
326
|
+
})
|
|
327
|
+
}), document.body) : null;
|
|
328
|
+
}
|
|
329
|
+
//#endregion
|
|
330
|
+
//#region src/components/Toast/Toast.tsx
|
|
331
|
+
var E = {
|
|
332
|
+
neutral: "info",
|
|
333
|
+
success: "circle-check",
|
|
334
|
+
warning: "triangle-alert",
|
|
335
|
+
danger: "circle-x"
|
|
336
|
+
};
|
|
337
|
+
function D({ open: e, onClose: t, tone: r = "neutral", title: i, description: s, duration: p = 5e3, closeLabel: g = "Fechar aviso", className: _ }) {
|
|
338
|
+
let [v, y] = o(!1), b = a(t);
|
|
339
|
+
return n(() => {
|
|
340
|
+
b.current = t;
|
|
341
|
+
}, [t]), n(() => {
|
|
342
|
+
if (!e || !p || v) return;
|
|
343
|
+
let t = window.setTimeout(() => b.current?.(), p);
|
|
344
|
+
return () => window.clearTimeout(t);
|
|
345
|
+
}, [
|
|
346
|
+
e,
|
|
347
|
+
p,
|
|
348
|
+
v
|
|
349
|
+
]), e ? u(/* @__PURE__ */ c("div", {
|
|
350
|
+
className: "hds-toast-region",
|
|
351
|
+
children: /* @__PURE__ */ l(f, {
|
|
352
|
+
role: r === "danger" ? "alert" : "status",
|
|
353
|
+
className: d("hds-toast", `hds-toast--${r}`, _),
|
|
354
|
+
onMouseEnter: () => y(!0),
|
|
355
|
+
onMouseLeave: () => y(!1),
|
|
356
|
+
onFocus: () => y(!0),
|
|
357
|
+
onBlur: () => y(!1),
|
|
358
|
+
children: [
|
|
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
|
+
]
|
|
379
|
+
})
|
|
380
|
+
}), document.body) : null;
|
|
381
|
+
}
|
|
382
|
+
//#endregion
|
|
383
|
+
//#region src/internal/field.tsx
|
|
384
|
+
function O(e) {
|
|
385
|
+
let t = r(), n = e ?? t;
|
|
386
|
+
return {
|
|
387
|
+
id: n,
|
|
388
|
+
hint: `${n}-hint`,
|
|
389
|
+
error: `${n}-error`
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
function k(e, t) {
|
|
393
|
+
let n = [
|
|
394
|
+
e.hint && t.hint,
|
|
395
|
+
e.error && t.error,
|
|
396
|
+
e["aria-describedby"]
|
|
397
|
+
].filter(Boolean);
|
|
398
|
+
return n.length ? n.join(" ") : void 0;
|
|
399
|
+
}
|
|
400
|
+
function A({ hint: e, error: t, ids: n }) {
|
|
401
|
+
return /* @__PURE__ */ l(s, { children: [e ? /* @__PURE__ */ c("p", {
|
|
402
|
+
id: n.hint,
|
|
403
|
+
className: "hds-hint",
|
|
404
|
+
children: e
|
|
405
|
+
}) : null, t ? /* @__PURE__ */ l("p", {
|
|
406
|
+
id: n.error,
|
|
407
|
+
className: "hds-error",
|
|
408
|
+
children: [/* @__PURE__ */ c(m, { name: "circle-x" }), t]
|
|
409
|
+
}) : null] });
|
|
410
|
+
}
|
|
411
|
+
//#endregion
|
|
412
|
+
//#region src/components/Input/Input.tsx
|
|
413
|
+
var j = t(function({ label: e, hint: t, error: n, numeric: r = !1, id: i, className: a, ...o }, s) {
|
|
414
|
+
let u = O(i);
|
|
415
|
+
return /* @__PURE__ */ l("div", {
|
|
416
|
+
className: d("hds-field", a),
|
|
417
|
+
children: [
|
|
418
|
+
/* @__PURE__ */ c("label", {
|
|
419
|
+
className: "hds-label",
|
|
420
|
+
htmlFor: u.id,
|
|
421
|
+
children: e
|
|
422
|
+
}),
|
|
423
|
+
/* @__PURE__ */ c("input", {
|
|
424
|
+
inputMode: r ? "decimal" : void 0,
|
|
425
|
+
...o,
|
|
426
|
+
ref: s,
|
|
427
|
+
id: u.id,
|
|
428
|
+
"aria-invalid": n ? !0 : void 0,
|
|
429
|
+
"aria-describedby": k({
|
|
430
|
+
hint: t,
|
|
431
|
+
error: n,
|
|
432
|
+
"aria-describedby": o["aria-describedby"]
|
|
433
|
+
}, u),
|
|
434
|
+
className: d("hds-input", r && "hds-input--numeric")
|
|
435
|
+
}),
|
|
436
|
+
/* @__PURE__ */ c(A, {
|
|
437
|
+
hint: t,
|
|
438
|
+
error: n,
|
|
439
|
+
ids: u
|
|
440
|
+
})
|
|
441
|
+
]
|
|
442
|
+
});
|
|
443
|
+
}), M = t(function({ label: e, options: t, placeholder: n, hint: r, error: i, id: a, className: o, ...s }, u) {
|
|
444
|
+
let f = O(a);
|
|
445
|
+
return /* @__PURE__ */ l("div", {
|
|
446
|
+
className: d("hds-field", o),
|
|
447
|
+
children: [
|
|
448
|
+
/* @__PURE__ */ c("label", {
|
|
449
|
+
className: "hds-label",
|
|
450
|
+
htmlFor: f.id,
|
|
451
|
+
children: e
|
|
452
|
+
}),
|
|
453
|
+
/* @__PURE__ */ l("div", {
|
|
454
|
+
className: "hds-select-wrap",
|
|
455
|
+
children: [/* @__PURE__ */ l("select", {
|
|
456
|
+
...s,
|
|
457
|
+
ref: u,
|
|
458
|
+
id: f.id,
|
|
459
|
+
"aria-invalid": i ? !0 : void 0,
|
|
460
|
+
"aria-describedby": k({
|
|
461
|
+
hint: r,
|
|
462
|
+
error: i,
|
|
463
|
+
"aria-describedby": s["aria-describedby"]
|
|
464
|
+
}, f),
|
|
465
|
+
className: "hds-select",
|
|
466
|
+
children: [n ? /* @__PURE__ */ c("option", {
|
|
467
|
+
value: "",
|
|
468
|
+
disabled: !0,
|
|
469
|
+
children: n
|
|
470
|
+
}) : null, t.map((e) => /* @__PURE__ */ c("option", {
|
|
471
|
+
value: e.value,
|
|
472
|
+
disabled: e.disabled,
|
|
473
|
+
children: e.label
|
|
474
|
+
}, e.value))]
|
|
475
|
+
}), /* @__PURE__ */ c(m, { name: "chevron-down" })]
|
|
476
|
+
}),
|
|
477
|
+
/* @__PURE__ */ c(A, {
|
|
478
|
+
hint: r,
|
|
479
|
+
error: i,
|
|
480
|
+
ids: f
|
|
481
|
+
})
|
|
482
|
+
]
|
|
483
|
+
});
|
|
484
|
+
}), N = t(function({ label: e, hint: t, id: n, className: r, ...i }, a) {
|
|
485
|
+
let o = O(n);
|
|
486
|
+
return /* @__PURE__ */ l("label", {
|
|
487
|
+
className: d("hds-checkbox", r),
|
|
488
|
+
htmlFor: o.id,
|
|
489
|
+
children: [/* @__PURE__ */ l("span", {
|
|
490
|
+
className: "hds-checkbox-control",
|
|
491
|
+
children: [/* @__PURE__ */ c("input", {
|
|
492
|
+
...i,
|
|
493
|
+
ref: a,
|
|
494
|
+
id: o.id,
|
|
495
|
+
type: "checkbox",
|
|
496
|
+
className: "hds-checkbox-input",
|
|
497
|
+
"aria-describedby": t ? o.hint : i["aria-describedby"]
|
|
498
|
+
}), /* @__PURE__ */ c("span", {
|
|
499
|
+
className: "hds-checkbox-box",
|
|
500
|
+
children: /* @__PURE__ */ c(m, { name: "check" })
|
|
501
|
+
})]
|
|
502
|
+
}), /* @__PURE__ */ l("span", {
|
|
503
|
+
className: "hds-checkbox-text",
|
|
504
|
+
children: [e, t ? /* @__PURE__ */ c("span", {
|
|
505
|
+
id: o.hint,
|
|
506
|
+
className: "hds-hint",
|
|
507
|
+
children: t
|
|
508
|
+
}) : null]
|
|
509
|
+
})]
|
|
510
|
+
});
|
|
511
|
+
});
|
|
512
|
+
//#endregion
|
|
513
|
+
//#region src/components/Card/Card.tsx
|
|
514
|
+
function P({ as: e = "article", eyebrow: t, title: n, media: r, footer: i, interactive: a = !1, className: o, children: s, ...u }) {
|
|
515
|
+
return /* @__PURE__ */ l(e, {
|
|
516
|
+
...u,
|
|
517
|
+
className: d("hds-card", a && "hds-card--interactive", o),
|
|
518
|
+
children: [
|
|
519
|
+
r ? /* @__PURE__ */ c("img", {
|
|
520
|
+
className: "hds-card-media",
|
|
521
|
+
src: r.src,
|
|
522
|
+
alt: r.alt ?? ""
|
|
523
|
+
}) : null,
|
|
524
|
+
/* @__PURE__ */ l("div", {
|
|
525
|
+
className: "hds-card-body",
|
|
526
|
+
children: [
|
|
527
|
+
t ? /* @__PURE__ */ c("p", {
|
|
528
|
+
className: "hds-card-eyebrow",
|
|
529
|
+
children: t
|
|
530
|
+
}) : null,
|
|
531
|
+
n ? /* @__PURE__ */ c("h3", {
|
|
532
|
+
className: "hds-card-title",
|
|
533
|
+
children: n
|
|
534
|
+
}) : null,
|
|
535
|
+
s ? /* @__PURE__ */ c("div", {
|
|
536
|
+
className: "hds-card-text",
|
|
537
|
+
children: s
|
|
538
|
+
}) : null
|
|
539
|
+
]
|
|
540
|
+
}),
|
|
541
|
+
i ? /* @__PURE__ */ c("div", {
|
|
542
|
+
className: "hds-card-footer",
|
|
543
|
+
children: i
|
|
544
|
+
}) : null
|
|
545
|
+
]
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
//#endregion
|
|
549
|
+
//#region src/components/Badge/Badge.tsx
|
|
550
|
+
var F = {
|
|
551
|
+
accent: "info",
|
|
552
|
+
success: "circle-check",
|
|
553
|
+
warning: "triangle-alert",
|
|
554
|
+
danger: "circle-x"
|
|
555
|
+
};
|
|
556
|
+
function I({ tone: e = "neutral", icon: t, children: n, className: r }) {
|
|
557
|
+
let i = F[e], a = t === !1 ? null : t ?? (i ? /* @__PURE__ */ c(m, { name: i }) : null);
|
|
558
|
+
return /* @__PURE__ */ l("span", {
|
|
559
|
+
className: d("hds-badge", `hds-badge--${e}`, r),
|
|
560
|
+
children: [a, n]
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
//#endregion
|
|
564
|
+
//#region src/components/Table/Table.tsx
|
|
565
|
+
function L(e) {
|
|
566
|
+
return e.numeric ? "hds-cell--numeric" : e.align === "center" ? "hds-cell--center" : void 0;
|
|
567
|
+
}
|
|
568
|
+
function R({ columns: e, rows: t, rowKey: n = "id", caption: r, hideCaption: i = !1, empty: a = "Nada para mostrar.", maxHeight: o, className: s }) {
|
|
569
|
+
return /* @__PURE__ */ c("div", {
|
|
570
|
+
className: d("hds-table-wrap", "hds-scroll", s),
|
|
571
|
+
role: "region",
|
|
572
|
+
"aria-label": r,
|
|
573
|
+
tabIndex: 0,
|
|
574
|
+
style: o === void 0 ? void 0 : { maxHeight: o },
|
|
575
|
+
children: /* @__PURE__ */ l("table", {
|
|
576
|
+
className: "hds-table",
|
|
577
|
+
children: [
|
|
578
|
+
r ? /* @__PURE__ */ c("caption", {
|
|
579
|
+
className: i ? "hds-visually-hidden" : void 0,
|
|
580
|
+
children: r
|
|
581
|
+
}) : null,
|
|
582
|
+
/* @__PURE__ */ c("thead", { children: /* @__PURE__ */ c("tr", { children: e.map((e) => /* @__PURE__ */ c("th", {
|
|
583
|
+
scope: "col",
|
|
584
|
+
className: L(e),
|
|
585
|
+
children: e.header
|
|
586
|
+
}, e.key)) }) }),
|
|
587
|
+
/* @__PURE__ */ c("tbody", { children: t.length ? t.map((t, r) => /* @__PURE__ */ c("tr", { children: e.map((e) => /* @__PURE__ */ c("td", {
|
|
588
|
+
className: L(e),
|
|
589
|
+
children: e.render ? e.render(t) : t[e.key]
|
|
590
|
+
}, e.key)) }, String(t[n] ?? r))) : /* @__PURE__ */ c("tr", { children: /* @__PURE__ */ c("td", {
|
|
591
|
+
colSpan: e.length || 1,
|
|
592
|
+
className: "hds-table-empty",
|
|
593
|
+
children: a
|
|
594
|
+
}) }) })
|
|
595
|
+
]
|
|
596
|
+
})
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
//#endregion
|
|
600
|
+
//#region src/components/Container/Container.tsx
|
|
601
|
+
function z({ as: e = "section", withSidebar: t = !1, className: n, ...r }) {
|
|
602
|
+
return /* @__PURE__ */ c(e, {
|
|
603
|
+
...r,
|
|
604
|
+
className: d("hds-container", t && "hds-container--with-sidebar", n)
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
//#endregion
|
|
608
|
+
//#region src/components/SectionTitle/SectionTitle.tsx
|
|
609
|
+
function B({ children: e, index: t, as: n = "h2", id: r, className: i }) {
|
|
610
|
+
return /* @__PURE__ */ l(n, {
|
|
611
|
+
id: r,
|
|
612
|
+
className: d("hds-section-title", i),
|
|
613
|
+
children: [t === void 0 ? null : /* @__PURE__ */ c("span", {
|
|
614
|
+
className: "hds-section-index",
|
|
615
|
+
"aria-hidden": "true",
|
|
616
|
+
children: String(t).padStart(2, "0")
|
|
617
|
+
}), e]
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
//#endregion
|
|
621
|
+
//#region src/components/Separator/Separator.tsx
|
|
622
|
+
function V({ orientation: e = "horizontal", decorative: t = !1, className: n }) {
|
|
623
|
+
return /* @__PURE__ */ c("div", {
|
|
624
|
+
role: t ? "none" : "separator",
|
|
625
|
+
"aria-orientation": t ? void 0 : e,
|
|
626
|
+
className: d("hds-separator", `hds-separator--${e}`, n)
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
//#endregion
|
|
630
|
+
//#region src/components/ScrollArea/ScrollArea.tsx
|
|
631
|
+
function H({ label: e, maxHeight: t, className: n, style: r, ...i }) {
|
|
632
|
+
return /* @__PURE__ */ c("div", {
|
|
633
|
+
...i,
|
|
634
|
+
role: "region",
|
|
635
|
+
"aria-label": e,
|
|
636
|
+
tabIndex: 0,
|
|
637
|
+
className: d("hds-scroll", n),
|
|
638
|
+
style: {
|
|
639
|
+
maxHeight: t,
|
|
640
|
+
...r
|
|
641
|
+
}
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
//#endregion
|
|
645
|
+
//#region src/components/Loading/Loading.tsx
|
|
646
|
+
function U({ size: e = "md", label: t = "Carregando…", showLabel: n = !1, className: r }) {
|
|
647
|
+
return /* @__PURE__ */ l("span", {
|
|
648
|
+
role: "status",
|
|
649
|
+
className: d("hds-loading", `hds-loading--${e}`, r),
|
|
650
|
+
children: [/* @__PURE__ */ c(m, { name: "loader" }), /* @__PURE__ */ c("span", {
|
|
651
|
+
className: n ? void 0 : "hds-visually-hidden",
|
|
652
|
+
children: t
|
|
653
|
+
})]
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
//#endregion
|
|
657
|
+
//#region src/components/GlowAvatar/GlowAvatar.tsx
|
|
658
|
+
function W({ src: e, alt: t, size: n = 96, className: r }) {
|
|
659
|
+
return /* @__PURE__ */ l("span", {
|
|
660
|
+
className: d("hds-avatar", r),
|
|
661
|
+
style: {
|
|
662
|
+
width: n,
|
|
663
|
+
height: n
|
|
664
|
+
},
|
|
665
|
+
children: [/* @__PURE__ */ c("span", {
|
|
666
|
+
className: "hds-avatar-glow",
|
|
667
|
+
"aria-hidden": "true"
|
|
668
|
+
}), /* @__PURE__ */ c("img", {
|
|
669
|
+
className: "hds-avatar-image",
|
|
670
|
+
src: e,
|
|
671
|
+
alt: t,
|
|
672
|
+
width: n,
|
|
673
|
+
height: n
|
|
674
|
+
})]
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
//#endregion
|
|
678
|
+
export { I as Badge, h as Button, P as Card, N as Checkbox, z as Container, T as Dialog, C as FloatingButton, f as GlassPanel, W as GlowAvatar, j as Input, U as Loading, S as Menu, v as NavBar, H as ScrollArea, B as SectionTitle, x as SegmentedControl, M as Select, V as Separator, y as Sidebar, R as Table, D as Toast, e as enableGlassRefraction };
|
|
679
|
+
|
|
680
|
+
//# sourceMappingURL=index.js.map
|