@alea-design/ui 0.6.1 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/button/Button.d.ts +3 -1
- package/dist/components/button/Button.js +58 -57
- package/dist/components/button/Groups.js +41 -41
- package/dist/components/data/Data.d.ts +6 -4
- package/dist/components/data/Data.js +49 -49
- package/dist/components/date/Date.d.ts +3 -1
- package/dist/components/date/Date.js +74 -74
- package/dist/components/form/Form.d.ts +3 -1
- package/dist/components/form/Form.js +44 -52
- package/dist/components/form/validity.d.ts +22 -0
- package/dist/components/form/validity.js +38 -0
- package/dist/components/list/List.d.ts +3 -2
- package/dist/components/more/More.d.ts +3 -1
- package/dist/components/more/More.js +46 -46
- package/dist/components/navigation/Navigation.d.ts +4 -4
- package/dist/components/navigation/Navigation.js +94 -94
- package/dist/components/navigation/Navigation2.d.ts +3 -1
- package/dist/components/navigation/Navigation2.js +218 -210
- package/dist/components/page/PageParts.d.ts +6 -2
- package/dist/components/page/PageParts.js +85 -85
- package/dist/components/shell/AppShell.d.ts +3 -1
- package/dist/components/shell/AppShell.js +33 -32
- package/dist/components/table/Table.d.ts +8 -3
- package/dist/components/table/Table.js +58 -57
- package/dist/components/theme/Theme.d.ts +5 -1
- package/dist/components/theme/Theme.js +63 -63
- package/dist/css/base.css +1 -1
- package/dist/css/button.css +1 -1
- package/dist/css/data.css +1 -1
- package/dist/css/date.css +1 -1
- package/dist/css/display.css +1 -1
- package/dist/css/feedback.css +1 -1
- package/dist/css/groups.json +13 -13
- package/dist/css/more.css +1 -1
- package/dist/css/navigation.css +1 -1
- package/dist/css/page.css +1 -1
- package/dist/css/shell.css +1 -1
- package/dist/css/table.css +1 -1
- package/dist/css/tabs.css +1 -1
- package/dist/css/typography.css +1 -1
- package/dist/i18n/strings.d.ts +1 -0
- package/dist/i18n/strings.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +279 -275
- package/dist/styles.css +1 -1
- package/dist/utils/animateRows.d.ts +3 -2
- package/dist/utils/animateRows.js +15 -15
- package/dist/utils/measure.d.ts +12 -0
- package/dist/utils/measure.js +20 -0
- package/dist/utils/scrollEdges.d.ts +1 -1
- package/dist/utils/scrollEdges.js +23 -22
- package/package.json +3 -3
|
@@ -1,294 +1,295 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { Link as
|
|
5
|
-
import { withMotionStyle as
|
|
6
|
-
import { ChevronDown as
|
|
7
|
-
import { cx as
|
|
2
|
+
import { jsxs as E, jsx as a, Fragment as B } from "react/jsx-runtime";
|
|
3
|
+
import { useState as O, useRef as $, forwardRef as Y, useId as I, useEffect as R } from "react";
|
|
4
|
+
import { Link as q, Popover as K, Menu as W } from "react-aria-components";
|
|
5
|
+
import { withMotionStyle as H } from "@alea-design/motion";
|
|
6
|
+
import { ChevronDown as j, MoreHorizontal as G } from "lucide-react";
|
|
7
|
+
import { cx as C } from "../../utils/cx.js";
|
|
8
8
|
import { useMergedRef as U } from "../../utils/refs.js";
|
|
9
|
-
import {
|
|
9
|
+
import { useMeasured as V } from "../../utils/measure.js";
|
|
10
|
+
import { MenuSeparator as J, MenuItem as Q } from "../menu/Menu.js";
|
|
10
11
|
import { useStrings as T } from "../../i18n/strings.js";
|
|
11
|
-
import { Drawer as
|
|
12
|
-
const
|
|
13
|
-
function
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const [
|
|
17
|
-
const
|
|
18
|
-
|
|
12
|
+
import { Drawer as Z, DrawerContent as _ } from "../overlay/Drawer.js";
|
|
13
|
+
const P = (i) => i.map((l, t) => "separator" in l ? /* @__PURE__ */ a(J, {}, `s${t}`) : /* @__PURE__ */ a(Q, { id: l.id, icon: l.icon, shortcut: l.shortcut, description: l.description, tone: l.tone, isDisabled: l.isDisabled, children: l.label }, String(l.id)));
|
|
14
|
+
function ve({ motion: i, children: l, items: t, onAction: p, className: k, areaLabel: y, "aria-label": x }) {
|
|
15
|
+
const b = T();
|
|
16
|
+
x ?? (x = b.contextMenu);
|
|
17
|
+
const [h, N] = O(null), f = $(null), w = $(null), r = $(void 0), n = (e, c) => {
|
|
18
|
+
const D = f.current.getBoundingClientRect();
|
|
19
|
+
N({ x: e - D.left, y: c - D.top });
|
|
19
20
|
};
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
+
return /* @__PURE__ */ E(
|
|
21
22
|
"div",
|
|
22
23
|
{
|
|
23
24
|
ref: f,
|
|
24
|
-
className:
|
|
25
|
+
className: C("alea-context-area", k),
|
|
25
26
|
tabIndex: 0,
|
|
26
27
|
role: "group",
|
|
27
|
-
"aria-label": `${
|
|
28
|
+
"aria-label": `${y}, menu with Shift+F10`,
|
|
28
29
|
onContextMenu: (e) => {
|
|
29
30
|
e.preventDefault(), n(e.clientX, e.clientY);
|
|
30
31
|
},
|
|
31
32
|
onKeyDown: (e) => {
|
|
32
33
|
if (e.shiftKey && e.key === "F10" || e.key === "ContextMenu") {
|
|
33
34
|
e.preventDefault();
|
|
34
|
-
const
|
|
35
|
-
n(
|
|
35
|
+
const c = f.current.getBoundingClientRect();
|
|
36
|
+
n(c.left + 16, c.top + 16);
|
|
36
37
|
}
|
|
37
38
|
},
|
|
38
39
|
onTouchStart: (e) => {
|
|
39
|
-
const
|
|
40
|
-
r.current = window.setTimeout(() => n(
|
|
40
|
+
const c = e.touches[0];
|
|
41
|
+
r.current = window.setTimeout(() => n(c.clientX, c.clientY), 550);
|
|
41
42
|
},
|
|
42
43
|
onTouchEnd: () => clearTimeout(r.current),
|
|
43
44
|
onTouchMove: () => clearTimeout(r.current),
|
|
44
45
|
children: [
|
|
45
|
-
|
|
46
|
-
/* @__PURE__ */ a("span", { ref:
|
|
47
|
-
/* @__PURE__ */ a(
|
|
48
|
-
var
|
|
49
|
-
e || (
|
|
50
|
-
}, placement: "bottom start", offset: 2, className: "alea-popover alea-menu-popover", style:
|
|
51
|
-
var
|
|
52
|
-
p == null || p(e),
|
|
53
|
-
}, children:
|
|
46
|
+
l,
|
|
47
|
+
/* @__PURE__ */ a("span", { ref: w, className: "alea-context-anchor", style: { left: (h == null ? void 0 : h.x) ?? 0, top: (h == null ? void 0 : h.y) ?? 0 }, "aria-hidden": "true" }),
|
|
48
|
+
/* @__PURE__ */ a(K, { triggerRef: w, isOpen: !!h, onOpenChange: (e) => {
|
|
49
|
+
var c;
|
|
50
|
+
e || (N(null), (c = f.current) == null || c.focus());
|
|
51
|
+
}, placement: "bottom start", offset: 2, className: "alea-popover alea-menu-popover", style: H(void 0, i), children: /* @__PURE__ */ a(W, { "aria-label": x, autoFocus: "first", className: "alea-menu", onAction: (e) => {
|
|
52
|
+
var c;
|
|
53
|
+
p == null || p(e), N(null), (c = f.current) == null || c.focus();
|
|
54
|
+
}, children: P(t) }) })
|
|
54
55
|
]
|
|
55
56
|
}
|
|
56
57
|
);
|
|
57
58
|
}
|
|
58
|
-
function
|
|
59
|
-
const [
|
|
60
|
-
var
|
|
61
|
-
const e = (r +
|
|
62
|
-
|
|
63
|
-
},
|
|
59
|
+
function he({ motion: i, menus: l, onAction: t, className: p, "aria-label": k }) {
|
|
60
|
+
const [y, x] = O(0), [b, h] = O(null), N = $([]), f = (r, n) => {
|
|
61
|
+
var c;
|
|
62
|
+
const e = (r + l.length) % l.length;
|
|
63
|
+
x(e), (c = N.current[e]) == null || c.focus(), h(n ? e : null);
|
|
64
|
+
}, w = (r, n) => {
|
|
64
65
|
const e = r.key;
|
|
65
66
|
if (e === "ArrowRight") f(n + 1, !1);
|
|
66
67
|
else if (e === "ArrowLeft") f(n - 1, !1);
|
|
67
68
|
else if (e === "Home") f(0, !1);
|
|
68
|
-
else if (e === "End") f(
|
|
69
|
-
else if (e === "ArrowDown" || e === "Enter" || e === " ")
|
|
69
|
+
else if (e === "End") f(l.length - 1, !1);
|
|
70
|
+
else if (e === "ArrowDown" || e === "Enter" || e === " ") h(n);
|
|
70
71
|
else return;
|
|
71
72
|
r.preventDefault();
|
|
72
73
|
};
|
|
73
|
-
return /* @__PURE__ */ a("div", { role: "menubar", "aria-label":
|
|
74
|
+
return /* @__PURE__ */ a("div", { role: "menubar", "aria-label": k, className: C("alea-menubar", p), children: l.map((r, n) => /* @__PURE__ */ E("span", { className: "alea-menubar-slot", children: [
|
|
74
75
|
/* @__PURE__ */ a(
|
|
75
76
|
"button",
|
|
76
77
|
{
|
|
77
78
|
ref: (e) => {
|
|
78
|
-
|
|
79
|
+
N.current[n] = e;
|
|
79
80
|
},
|
|
80
81
|
type: "button",
|
|
81
82
|
role: "menuitem",
|
|
82
83
|
"aria-haspopup": "menu",
|
|
83
|
-
"aria-expanded":
|
|
84
|
-
tabIndex:
|
|
84
|
+
"aria-expanded": b === n,
|
|
85
|
+
tabIndex: y === n ? 0 : -1,
|
|
85
86
|
className: "alea-menubar-item alea-focus-ring",
|
|
86
87
|
onClick: () => {
|
|
87
|
-
|
|
88
|
+
x(n), h(b === n ? null : n);
|
|
88
89
|
},
|
|
89
90
|
onMouseEnter: () => {
|
|
90
|
-
|
|
91
|
+
b != null && b !== n && (x(n), h(n));
|
|
91
92
|
},
|
|
92
|
-
onKeyDown: (e) =>
|
|
93
|
+
onKeyDown: (e) => w(e, n),
|
|
93
94
|
children: r.label
|
|
94
95
|
}
|
|
95
96
|
),
|
|
96
|
-
/* @__PURE__ */ a(
|
|
97
|
-
var
|
|
98
|
-
e || (
|
|
99
|
-
}, style:
|
|
97
|
+
/* @__PURE__ */ a(K, { triggerRef: { current: N.current[n] }, isOpen: b === n, onOpenChange: (e) => {
|
|
98
|
+
var c;
|
|
99
|
+
e || (h(null), (c = N.current[n]) == null || c.focus());
|
|
100
|
+
}, style: H(void 0, i), placement: "bottom start", offset: 4, className: "alea-popover alea-menu-popover", children: /* @__PURE__ */ a("div", { onKeyDown: (e) => {
|
|
100
101
|
e.key === "ArrowRight" && (e.preventDefault(), f(n + 1, !0)), e.key === "ArrowLeft" && (e.preventDefault(), f(n - 1, !0));
|
|
101
|
-
}, children: /* @__PURE__ */ a(
|
|
102
|
-
var
|
|
103
|
-
t == null || t(r.id, e),
|
|
104
|
-
}, children:
|
|
102
|
+
}, children: /* @__PURE__ */ a(W, { "aria-label": r.label, autoFocus: "first", className: "alea-menu", onAction: (e) => {
|
|
103
|
+
var c;
|
|
104
|
+
t == null || t(r.id, e), h(null), (c = N.current[n]) == null || c.focus();
|
|
105
|
+
}, children: P(r.items) }) }) })
|
|
105
106
|
] }, r.id)) });
|
|
106
107
|
}
|
|
107
|
-
const
|
|
108
|
-
const [f,
|
|
109
|
-
clearTimeout(e.current), e.current = window.setTimeout(() =>
|
|
108
|
+
const pe = Y(function({ motion: l, trigger: t, children: p, openDelay: k = 500, closeDelay: y = 200, placement: x = "bottom", className: b, style: h }, N) {
|
|
109
|
+
const [f, w] = O(!1), r = $(null), n = U(N, r), e = $(void 0), c = I(), D = (o, s) => {
|
|
110
|
+
clearTimeout(e.current), e.current = window.setTimeout(() => w(o), s);
|
|
110
111
|
};
|
|
111
112
|
return R(() => () => clearTimeout(e.current), []), R(() => {
|
|
112
113
|
if (!f) return;
|
|
113
|
-
const
|
|
114
|
-
|
|
114
|
+
const o = (s) => {
|
|
115
|
+
s.key === "Escape" && w(!1);
|
|
115
116
|
};
|
|
116
|
-
return document.addEventListener("keydown",
|
|
117
|
-
}, [f]), /* @__PURE__ */
|
|
117
|
+
return document.addEventListener("keydown", o), () => document.removeEventListener("keydown", o);
|
|
118
|
+
}, [f]), /* @__PURE__ */ E(B, { children: [
|
|
118
119
|
/* @__PURE__ */ a(
|
|
119
120
|
"span",
|
|
120
121
|
{
|
|
121
122
|
ref: n,
|
|
122
|
-
style:
|
|
123
|
-
className:
|
|
124
|
-
"aria-describedby": f ?
|
|
125
|
-
onMouseEnter: () =>
|
|
126
|
-
onMouseLeave: () =>
|
|
127
|
-
onFocus: () =>
|
|
128
|
-
onBlur: () =>
|
|
123
|
+
style: h,
|
|
124
|
+
className: C("alea-hovercard-trigger", b),
|
|
125
|
+
"aria-describedby": f ? c : void 0,
|
|
126
|
+
onMouseEnter: () => D(!0, k),
|
|
127
|
+
onMouseLeave: () => D(!1, y),
|
|
128
|
+
onFocus: () => D(!0, k),
|
|
129
|
+
onBlur: () => D(!1, y),
|
|
129
130
|
children: t
|
|
130
131
|
}
|
|
131
132
|
),
|
|
132
|
-
/* @__PURE__ */ a(
|
|
133
|
+
/* @__PURE__ */ a(K, { triggerRef: r, isOpen: f, onOpenChange: w, isNonModal: !0, placement: x, offset: 8, className: "alea-popover alea-hovercard", style: H(void 0, l), children: /* @__PURE__ */ a("div", { id: c, role: "tooltip", onMouseEnter: () => clearTimeout(e.current), onMouseLeave: () => D(!1, y), children: p }) })
|
|
133
134
|
] });
|
|
134
|
-
}),
|
|
135
|
-
function
|
|
136
|
-
const
|
|
137
|
-
const
|
|
138
|
-
|
|
135
|
+
}), L = (i) => "items" in i, z = (i) => "href" in i, F = (i, l) => !!l && i.items.some((t) => z(t) ? t.href === l : L(t) ? F(t, l) : !1);
|
|
136
|
+
function ee({ items: i, current: l, collapsed: t, railLabels: p, accordion: k, size: y = "md", onNavigate: x, className: b, label: h }) {
|
|
137
|
+
const N = I(), f = $(null), [w, r] = O(() => {
|
|
138
|
+
const o = /* @__PURE__ */ new Set(), s = (g, u) => g.forEach((M) => {
|
|
139
|
+
L(M) && F(M, l) && (o.add(`${u}/${M.label}`), s(M.items, `${u}/${M.label}`));
|
|
139
140
|
});
|
|
140
|
-
return t ||
|
|
141
|
+
return t || s(i, ""), o;
|
|
141
142
|
});
|
|
142
143
|
R(() => {
|
|
143
144
|
t && r(/* @__PURE__ */ new Set());
|
|
144
145
|
}, [t]), R(() => {
|
|
145
|
-
if (!t || !
|
|
146
|
-
const
|
|
147
|
-
var
|
|
148
|
-
(
|
|
146
|
+
if (!t || !w.size) return;
|
|
147
|
+
const o = (s) => {
|
|
148
|
+
var g;
|
|
149
|
+
(g = f.current) != null && g.contains(s.target) || r(/* @__PURE__ */ new Set());
|
|
149
150
|
};
|
|
150
|
-
return document.addEventListener("pointerdown",
|
|
151
|
-
}, [t,
|
|
152
|
-
const n = (
|
|
153
|
-
const
|
|
154
|
-
return
|
|
155
|
-
(
|
|
156
|
-
}),
|
|
157
|
-
|
|
158
|
-
}),
|
|
151
|
+
return document.addEventListener("pointerdown", o), () => document.removeEventListener("pointerdown", o);
|
|
152
|
+
}, [t, w]);
|
|
153
|
+
const n = (o) => r((s) => {
|
|
154
|
+
const g = new Set(s);
|
|
155
|
+
return g.has(o) ? ([...g].forEach((u) => {
|
|
156
|
+
(u === o || u.startsWith(o + "/")) && g.delete(u);
|
|
157
|
+
}), g) : ((k || t) && [...g].forEach((u) => {
|
|
158
|
+
o.startsWith(u + "/") || g.delete(u);
|
|
159
|
+
}), g.add(o), g);
|
|
159
160
|
}), e = () => {
|
|
160
|
-
var
|
|
161
|
-
return Array.from(((
|
|
162
|
-
},
|
|
163
|
-
var
|
|
164
|
-
const
|
|
165
|
-
var
|
|
166
|
-
|
|
161
|
+
var o;
|
|
162
|
+
return Array.from(((o = f.current) == null ? void 0 : o.querySelectorAll(".alea-vnav-item")) || []).filter((s) => !s.closest(".alea-vnav-sub:not([data-open])") && !s.hasAttribute("aria-disabled"));
|
|
163
|
+
}, c = (o) => {
|
|
164
|
+
var M, d, v;
|
|
165
|
+
const s = e(), g = s.indexOf(document.activeElement), u = (m) => {
|
|
166
|
+
var S;
|
|
167
|
+
o.preventDefault(), (S = s[(m + s.length) % s.length]) == null || S.focus();
|
|
167
168
|
};
|
|
168
|
-
if (
|
|
169
|
-
else if (
|
|
170
|
-
else if (
|
|
171
|
-
else if (
|
|
172
|
-
else if (
|
|
173
|
-
const
|
|
174
|
-
if (
|
|
175
|
-
|
|
176
|
-
else if (
|
|
177
|
-
if (
|
|
178
|
-
|
|
169
|
+
if (o.key === "ArrowDown") u(g + 1);
|
|
170
|
+
else if (o.key === "ArrowUp") u(g - 1);
|
|
171
|
+
else if (o.key === "Home") u(0);
|
|
172
|
+
else if (o.key === "End") u(s.length - 1);
|
|
173
|
+
else if (o.key === "ArrowRight" || o.key === "ArrowLeft") {
|
|
174
|
+
const m = document.activeElement, S = m == null ? void 0 : m.dataset.path;
|
|
175
|
+
if (o.key === "ArrowRight" && S && m.getAttribute("aria-expanded") === "false")
|
|
176
|
+
o.preventDefault(), n(S);
|
|
177
|
+
else if (o.key === "ArrowLeft")
|
|
178
|
+
if (S && m.getAttribute("aria-expanded") === "true")
|
|
179
|
+
o.preventDefault(), n(S);
|
|
179
180
|
else {
|
|
180
|
-
const
|
|
181
|
-
|
|
181
|
+
const A = (M = m.closest(".alea-vnav-sub")) == null ? void 0 : M.previousElementSibling;
|
|
182
|
+
A && (o.preventDefault(), A.focus());
|
|
182
183
|
}
|
|
183
|
-
} else if (
|
|
184
|
-
const
|
|
185
|
-
(
|
|
184
|
+
} else if (o.key === "Escape" && t && w.size) {
|
|
185
|
+
const m = [...w][0];
|
|
186
|
+
(v = (d = f.current) == null ? void 0 : d.querySelector(`[data-path="${CSS.escape(m)}"]`)) == null || v.focus(), r(/* @__PURE__ */ new Set());
|
|
186
187
|
}
|
|
187
|
-
},
|
|
188
|
-
if ("divider" in
|
|
189
|
-
if ("section" in
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
/* @__PURE__ */ a("span", { className: "alea-vnav-label", children:
|
|
193
|
-
|
|
188
|
+
}, D = (o, s, g) => /* @__PURE__ */ a("ul", { className: "alea-vnav-list", "data-level": s, children: o.map((u, M) => {
|
|
189
|
+
if ("divider" in u) return /* @__PURE__ */ a("li", { "aria-hidden": "true", className: "alea-vnav-divider" }, `d${M}`);
|
|
190
|
+
if ("section" in u) return /* @__PURE__ */ a("li", { className: "alea-vnav-section", children: /* @__PURE__ */ a("span", { children: u.section }) }, `s${M}`);
|
|
191
|
+
const d = (m, S, A, X) => /* @__PURE__ */ E(B, { children: [
|
|
192
|
+
m ? /* @__PURE__ */ a("span", { className: "alea-vnav-icon", "aria-hidden": "true", children: m }) : s === 0 && t ? /* @__PURE__ */ a("span", { className: "alea-vnav-icon alea-vnav-initial", "aria-hidden": "true", children: S.slice(0, 1) }) : null,
|
|
193
|
+
/* @__PURE__ */ a("span", { className: "alea-vnav-label", children: S }),
|
|
194
|
+
A != null && /* @__PURE__ */ a("span", { className: "alea-vnav-badge", children: A }),
|
|
194
195
|
X
|
|
195
196
|
] });
|
|
196
|
-
if (
|
|
197
|
-
const
|
|
198
|
-
return /* @__PURE__ */
|
|
197
|
+
if (L(u)) {
|
|
198
|
+
const m = `${g}/${u.label}`, S = w.has(m), A = `${N}${m.replace(/[^a-z0-9]/gi, "-")}`;
|
|
199
|
+
return /* @__PURE__ */ E("li", { className: "alea-vnav-li", children: [
|
|
199
200
|
/* @__PURE__ */ a(
|
|
200
201
|
"button",
|
|
201
202
|
{
|
|
202
203
|
type: "button",
|
|
203
204
|
className: "alea-vnav-item alea-focus-ring",
|
|
204
|
-
"data-path":
|
|
205
|
-
"aria-expanded":
|
|
206
|
-
"aria-controls":
|
|
207
|
-
"data-current":
|
|
208
|
-
"data-tip": t &&
|
|
209
|
-
style: { "--lvl":
|
|
210
|
-
onClick: () => n(
|
|
211
|
-
children:
|
|
205
|
+
"data-path": m,
|
|
206
|
+
"aria-expanded": S,
|
|
207
|
+
"aria-controls": A,
|
|
208
|
+
"data-current": F(u, l) || void 0,
|
|
209
|
+
"data-tip": t && s === 0 ? u.label : void 0,
|
|
210
|
+
style: { "--lvl": s },
|
|
211
|
+
onClick: () => n(m),
|
|
212
|
+
children: d(u.icon, u.label, u.badge, /* @__PURE__ */ a(j, { size: 14, "aria-hidden": "true", className: "alea-vnav-chevron" }))
|
|
212
213
|
}
|
|
213
214
|
),
|
|
214
|
-
/* @__PURE__ */ a("div", { id:
|
|
215
|
-
t &&
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
/* @__PURE__ */ a("div", { id: A, className: "alea-vnav-sub", "data-open": S || void 0, "data-flyout": t && s === 0 ? !0 : void 0, children: /* @__PURE__ */ E("div", { className: "alea-vnav-sub-inner", children: [
|
|
216
|
+
t && s === 0 && /* @__PURE__ */ a("p", { className: "alea-vnav-flyout-title", children: u.label }),
|
|
217
|
+
D(u.items, t && s === 0 ? 0 : s + 1, m),
|
|
218
|
+
u.footer && /* @__PURE__ */ a("div", { className: "alea-vnav-footer", children: u.footer })
|
|
218
219
|
] }) })
|
|
219
|
-
] },
|
|
220
|
+
] }, m);
|
|
220
221
|
}
|
|
221
|
-
const
|
|
222
|
+
const v = u;
|
|
222
223
|
return /* @__PURE__ */ a("li", { className: "alea-vnav-li", children: /* @__PURE__ */ a(
|
|
223
224
|
"a",
|
|
224
225
|
{
|
|
225
|
-
href:
|
|
226
|
+
href: v.isDisabled ? void 0 : v.href,
|
|
226
227
|
className: "alea-vnav-item alea-focus-ring",
|
|
227
|
-
"aria-current":
|
|
228
|
-
"aria-disabled":
|
|
229
|
-
tabIndex:
|
|
230
|
-
"data-tip": t &&
|
|
231
|
-
style: { "--lvl":
|
|
232
|
-
onClick: (
|
|
233
|
-
if (
|
|
234
|
-
|
|
228
|
+
"aria-current": v.href === l ? "page" : void 0,
|
|
229
|
+
"aria-disabled": v.isDisabled || void 0,
|
|
230
|
+
tabIndex: v.isDisabled ? -1 : void 0,
|
|
231
|
+
"data-tip": t && s === 0 ? v.label : void 0,
|
|
232
|
+
style: { "--lvl": s },
|
|
233
|
+
onClick: (m) => {
|
|
234
|
+
if (v.isDisabled) {
|
|
235
|
+
m.preventDefault();
|
|
235
236
|
return;
|
|
236
237
|
}
|
|
237
|
-
|
|
238
|
+
x == null || x(v.href, m), t && r(/* @__PURE__ */ new Set());
|
|
238
239
|
},
|
|
239
|
-
children:
|
|
240
|
+
children: d(v.icon, v.label, v.badge)
|
|
240
241
|
}
|
|
241
|
-
) }, `${
|
|
242
|
+
) }, `${g}/${v.href}`);
|
|
242
243
|
}) });
|
|
243
244
|
return /* @__PURE__ */ a(
|
|
244
245
|
"nav",
|
|
245
246
|
{
|
|
246
247
|
ref: f,
|
|
247
|
-
"aria-label":
|
|
248
|
-
className:
|
|
248
|
+
"aria-label": h,
|
|
249
|
+
className: C("alea-vnav", b),
|
|
249
250
|
"data-collapsed": t || void 0,
|
|
250
251
|
"data-rail-labels": t && p ? !0 : void 0,
|
|
251
|
-
"data-size":
|
|
252
|
-
onKeyDown:
|
|
253
|
-
onBlur: (
|
|
254
|
-
var
|
|
255
|
-
t && !((
|
|
252
|
+
"data-size": y !== "md" ? y : void 0,
|
|
253
|
+
onKeyDown: c,
|
|
254
|
+
onBlur: (o) => {
|
|
255
|
+
var s;
|
|
256
|
+
t && !((s = f.current) != null && s.contains(o.relatedTarget)) && r(/* @__PURE__ */ new Set());
|
|
256
257
|
},
|
|
257
|
-
children:
|
|
258
|
+
children: D(i, 0, "")
|
|
258
259
|
}
|
|
259
260
|
);
|
|
260
261
|
}
|
|
261
|
-
function
|
|
262
|
-
const
|
|
263
|
-
return
|
|
262
|
+
function be(i) {
|
|
263
|
+
const l = T();
|
|
264
|
+
return i.orientation === "vertical" ? /* @__PURE__ */ a(ee, { ...i, label: i["aria-label"] ?? l.mainNav }) : /* @__PURE__ */ a(ae, { ...i });
|
|
264
265
|
}
|
|
265
|
-
function
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
const
|
|
266
|
+
function ae({ items: i, current: l, className: t, onNavigate: p, "aria-label": k }) {
|
|
267
|
+
const y = T();
|
|
268
|
+
k ?? (k = y.mainNav);
|
|
269
|
+
const x = i.filter((r) => z(r) || L(r)), [b, h] = O(null), N = $(null), f = $([]), w = I();
|
|
269
270
|
return R(() => {
|
|
270
|
-
if (
|
|
271
|
+
if (b == null) return;
|
|
271
272
|
const r = (n) => {
|
|
272
273
|
var e;
|
|
273
|
-
(e =
|
|
274
|
+
(e = N.current) != null && e.contains(n.target) || h(null);
|
|
274
275
|
};
|
|
275
276
|
return document.addEventListener("pointerdown", r), () => document.removeEventListener("pointerdown", r);
|
|
276
|
-
}, [
|
|
277
|
+
}, [b]), /* @__PURE__ */ a(
|
|
277
278
|
"nav",
|
|
278
279
|
{
|
|
279
|
-
ref:
|
|
280
|
-
"aria-label":
|
|
281
|
-
className:
|
|
280
|
+
ref: N,
|
|
281
|
+
"aria-label": k,
|
|
282
|
+
className: C("alea-navmenu", t),
|
|
282
283
|
onKeyDown: (r) => {
|
|
283
284
|
var n;
|
|
284
|
-
r.key === "Escape" &&
|
|
285
|
+
r.key === "Escape" && b != null && ((n = f.current[b]) == null || n.focus(), h(null));
|
|
285
286
|
},
|
|
286
287
|
onBlur: (r) => {
|
|
287
288
|
var n;
|
|
288
|
-
(n =
|
|
289
|
+
(n = N.current) != null && n.contains(r.relatedTarget) || h(null);
|
|
289
290
|
},
|
|
290
|
-
children: /* @__PURE__ */ a("ul", { className: "alea-navmenu-list", children:
|
|
291
|
-
/* @__PURE__ */
|
|
291
|
+
children: /* @__PURE__ */ a("ul", { className: "alea-navmenu-list", children: x.map((r, n) => /* @__PURE__ */ a("li", { className: "alea-navmenu-li", children: "items" in r ? /* @__PURE__ */ E(B, { children: [
|
|
292
|
+
/* @__PURE__ */ E(
|
|
292
293
|
"button",
|
|
293
294
|
{
|
|
294
295
|
ref: (e) => {
|
|
@@ -296,74 +297,81 @@ function ee({ items: d, current: i, className: t, onNavigate: p, "aria-label": x
|
|
|
296
297
|
},
|
|
297
298
|
type: "button",
|
|
298
299
|
className: "alea-navmenu-item alea-focus-ring",
|
|
299
|
-
"aria-expanded":
|
|
300
|
-
"aria-controls": `${
|
|
301
|
-
onClick: () =>
|
|
302
|
-
"data-current":
|
|
300
|
+
"aria-expanded": b === n,
|
|
301
|
+
"aria-controls": `${w}-${n}`,
|
|
302
|
+
onClick: () => h(b === n ? null : n),
|
|
303
|
+
"data-current": F(r, l) || void 0,
|
|
303
304
|
children: [
|
|
304
305
|
r.label,
|
|
305
|
-
/* @__PURE__ */ a(
|
|
306
|
+
/* @__PURE__ */ a(j, { size: 14, "aria-hidden": "true", className: "alea-navmenu-chevron" })
|
|
306
307
|
]
|
|
307
308
|
}
|
|
308
309
|
),
|
|
309
|
-
/* @__PURE__ */
|
|
310
|
-
/* @__PURE__ */ a("ul", { className: "alea-navmenu-links", "data-cols": r.items.length > 3 ? 2 : 1, children: r.items.filter(
|
|
310
|
+
/* @__PURE__ */ E("div", { id: `${w}-${n}`, className: "alea-navmenu-panel", hidden: b !== n, children: [
|
|
311
|
+
/* @__PURE__ */ a("ul", { className: "alea-navmenu-links", "data-cols": r.items.length > 3 ? 2 : 1, children: r.items.filter(z).map((e) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ E("a", { href: e.href, className: "alea-navmenu-link alea-focus-ring", "aria-current": e.href === l ? "page" : void 0, onClick: (c) => p == null ? void 0 : p(e.href, c), children: [
|
|
311
312
|
e.icon && /* @__PURE__ */ a("span", { className: "alea-navmenu-icon", "aria-hidden": "true", children: e.icon }),
|
|
312
|
-
/* @__PURE__ */
|
|
313
|
+
/* @__PURE__ */ E("span", { children: [
|
|
313
314
|
/* @__PURE__ */ a("span", { className: "alea-navmenu-title", children: e.label }),
|
|
314
315
|
e.description && /* @__PURE__ */ a("span", { className: "alea-navmenu-desc", children: e.description })
|
|
315
316
|
] })
|
|
316
317
|
] }) }, e.href)) }),
|
|
317
318
|
r.footer && /* @__PURE__ */ a("div", { className: "alea-navmenu-footer", children: r.footer })
|
|
318
319
|
] })
|
|
319
|
-
] }) : /* @__PURE__ */ a("a", { href: r.href, className: "alea-navmenu-item alea-focus-ring", "aria-current": r.href ===
|
|
320
|
+
] }) : /* @__PURE__ */ a("a", { href: r.href, className: "alea-navmenu-item alea-focus-ring", "aria-current": r.href === l ? "page" : void 0, onClick: (e) => p == null ? void 0 : p(r.href, e), children: r.label }) }, r.label)) })
|
|
320
321
|
}
|
|
321
322
|
);
|
|
322
323
|
}
|
|
323
|
-
function
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
324
|
+
function ne(i) {
|
|
325
|
+
const l = i.querySelector(":scope > ul > li > .alea-bottomnav-item");
|
|
326
|
+
if (!l) return !0;
|
|
327
|
+
const t = getComputedStyle(l), p = l.clientWidth - (parseFloat(t.paddingInlineStart) || 0) - (parseFloat(t.paddingInlineEnd) || 0);
|
|
328
|
+
return p > 0 ? Array.from(i.querySelectorAll(":scope > ul .alea-bottomnav-label")).every((k) => k.scrollWidth <= p) : !0;
|
|
329
|
+
}
|
|
330
|
+
function ge({ items: i, value: l, onChange: t, fixed: p = !0, maxItems: k, moreLabel: y, moreIcon: x, labels: b = "always", className: h, "aria-label": N }) {
|
|
331
|
+
const f = T();
|
|
332
|
+
N ?? (N = f.mainNav), y ?? (y = f.more);
|
|
333
|
+
const [w, r] = O(!1), n = $(null), e = V(n, (d) => b !== "auto" || ne(d), !0, [b, y, i.map((d) => d.label).join(`
|
|
334
|
+
`)]), c = k === void 0 ? 1 / 0 : Math.max(2, Math.floor(k)), D = i.length > c, o = D ? i.slice(0, c - 1) : i, s = D ? i.slice(c - 1) : [], g = s.reduce((d, v) => d + (v.badge || 0), 0), u = s.some((d) => d.id === l), M = (d) => /* @__PURE__ */ E(B, { children: [
|
|
335
|
+
/* @__PURE__ */ E("span", { className: "alea-bottomnav-icon", "aria-hidden": "true", children: [
|
|
336
|
+
d.icon,
|
|
337
|
+
d.badge ? /* @__PURE__ */ a("span", { className: "alea-bottomnav-badge", children: d.badge > 99 ? "99+" : d.badge }) : null
|
|
330
338
|
] }),
|
|
331
|
-
/* @__PURE__ */ a("span", { className: "alea-bottomnav-label", children:
|
|
332
|
-
|
|
339
|
+
/* @__PURE__ */ a("span", { className: "alea-bottomnav-label", children: d.label }),
|
|
340
|
+
d.badge ? /* @__PURE__ */ E("span", { className: "alea-visually-hidden", children: [
|
|
333
341
|
", ",
|
|
334
|
-
|
|
342
|
+
d.badge,
|
|
335
343
|
" new"
|
|
336
344
|
] }) : null
|
|
337
345
|
] });
|
|
338
|
-
return /* @__PURE__ */
|
|
339
|
-
/* @__PURE__ */
|
|
340
|
-
|
|
341
|
-
const
|
|
342
|
-
return /* @__PURE__ */ a("li", { children:
|
|
346
|
+
return /* @__PURE__ */ E("nav", { ref: n, "aria-label": N, className: C("alea-bottomnav", h), "data-fixed": p || void 0, "data-labels": e ? void 0 : "icons", children: [
|
|
347
|
+
/* @__PURE__ */ E("ul", { children: [
|
|
348
|
+
o.map((d) => {
|
|
349
|
+
const v = M(d), m = d.id === l;
|
|
350
|
+
return /* @__PURE__ */ a("li", { children: d.href ? /* @__PURE__ */ a(q, { href: d.href, className: "alea-bottomnav-item alea-focus-ring", "aria-current": m ? "page" : void 0, onPress: () => t == null ? void 0 : t(d.id), children: v }) : /* @__PURE__ */ a("button", { type: "button", className: "alea-bottomnav-item alea-focus-ring", "aria-current": m ? "page" : void 0, onClick: () => t == null ? void 0 : t(d.id), children: v }) }, d.id);
|
|
343
351
|
}),
|
|
344
|
-
|
|
352
|
+
D && /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a("button", { type: "button", className: "alea-bottomnav-item alea-focus-ring", "aria-haspopup": "dialog", "aria-expanded": w, "aria-current": u ? "page" : void 0, onClick: () => r(!0), children: M({ label: y, icon: x ?? /* @__PURE__ */ a(G, {}), badge: g || void 0 }) }) })
|
|
345
353
|
] }),
|
|
346
|
-
|
|
347
|
-
const
|
|
348
|
-
t == null || t(
|
|
354
|
+
D && /* @__PURE__ */ a(Z, { isOpen: w, onOpenChange: r, placement: "bottom", children: /* @__PURE__ */ a(_, { title: y, children: ({ close: d }) => /* @__PURE__ */ a("ul", { className: "alea-bottomnav-more", children: s.map((v) => {
|
|
355
|
+
const m = v.id === l, S = () => {
|
|
356
|
+
t == null || t(v.id), d();
|
|
349
357
|
};
|
|
350
|
-
return /* @__PURE__ */ a("li", { children:
|
|
358
|
+
return /* @__PURE__ */ a("li", { children: v.href ? /* @__PURE__ */ a(q, { href: v.href, className: "alea-bottomnav-more-item alea-focus-ring", "aria-current": m ? "page" : void 0, onPress: S, children: M(v) }) : /* @__PURE__ */ a("button", { type: "button", className: "alea-bottomnav-more-item alea-focus-ring", "aria-current": m ? "page" : void 0, onClick: S, children: M(v) }) }, v.id);
|
|
351
359
|
}) }) }) })
|
|
352
360
|
] });
|
|
353
361
|
}
|
|
354
|
-
function
|
|
355
|
-
const
|
|
356
|
-
return
|
|
362
|
+
function ye({ isOpen: i, onChange: l, size: t = "md", className: p, "aria-controls": k, "aria-label": y }) {
|
|
363
|
+
const x = T();
|
|
364
|
+
return y ?? (y = x.menu), /* @__PURE__ */ E("button", { type: "button", className: C("alea-burger alea-focus-ring", p), "data-size": t, "data-open": i || void 0, "aria-expanded": i, "aria-controls": k, "aria-label": y, onClick: () => l(!i), children: [
|
|
357
365
|
/* @__PURE__ */ a("span", { "aria-hidden": "true" }),
|
|
358
366
|
/* @__PURE__ */ a("span", { "aria-hidden": "true" }),
|
|
359
367
|
/* @__PURE__ */ a("span", { "aria-hidden": "true" })
|
|
360
368
|
] });
|
|
361
369
|
}
|
|
362
370
|
export {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
371
|
+
ge as BottomNavigation,
|
|
372
|
+
ye as Burger,
|
|
373
|
+
ve as ContextMenu,
|
|
374
|
+
pe as HoverCard,
|
|
375
|
+
he as Menubar,
|
|
376
|
+
be as NavigationMenu
|
|
369
377
|
};
|