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