@alea-design/ui 0.5.1 → 0.6.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 +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 +82 -56
- package/dist/components/data/Data.d.ts +11 -7
- package/dist/components/data/Data.js +65 -55
- 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.d.ts +5 -1
- package/dist/components/media/Media.js +115 -113
- package/dist/components/more/More.d.ts +2 -2
- package/dist/components/more/More.js +46 -45
- package/dist/components/navigation/Navigation.d.ts +11 -5
- package/dist/components/navigation/Navigation.js +97 -80
- package/dist/components/navigation/Navigation2.d.ts +9 -3
- package/dist/components/navigation/Navigation2.js +208 -194
- 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 +14 -1
- package/dist/components/overlay/Overlay.js +52 -50
- package/dist/components/overlay/Sheet.d.ts +2 -0
- package/dist/components/overlay/Sheet.js +30 -30
- package/dist/components/page/PageParts.d.ts +6 -2
- package/dist/components/page/PageParts.js +92 -84
- 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/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/field.css +1 -1
- package/dist/css/form.css +1 -1
- package/dist/css/groups.json +37 -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 +9 -0
- package/dist/i18n/strings.js +18 -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
|
@@ -1,121 +1,138 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { Children as
|
|
4
|
-
import { Breadcrumb as
|
|
5
|
-
import { ChevronsLeft as
|
|
6
|
-
import { DropdownMenu as
|
|
7
|
-
import { withBase as
|
|
8
|
-
import { useStrings as
|
|
9
|
-
function
|
|
10
|
-
const
|
|
11
|
-
let
|
|
12
|
-
if (
|
|
13
|
-
const p =
|
|
14
|
-
if (p.length >
|
|
15
|
-
const
|
|
16
|
-
|
|
2
|
+
import { jsx as e, jsxs as s, Fragment as E } from "react/jsx-runtime";
|
|
3
|
+
import { Children as O, isValidElement as j, useMemo as P, useRef as W, useState as T, useEffect as _ } from "react";
|
|
4
|
+
import { Breadcrumb as D, Link as q, Button as A, Breadcrumbs as K } from "react-aria-components";
|
|
5
|
+
import { ChevronsLeft as V, ChevronLeft as X, ChevronRight as F, ChevronsRight as G, X as H, Ban as Q, Minus as U, Check as Y } from "lucide-react";
|
|
6
|
+
import { DropdownMenu as Z, MenuItem as J } from "../menu/Menu.js";
|
|
7
|
+
import { withBase as S, cx as R } from "../../utils/cx.js";
|
|
8
|
+
import { useStrings as w } from "../../i18n/strings.js";
|
|
9
|
+
function ce({ separator: a, maxItems: i, size: h, className: t, children: o, ...c }) {
|
|
10
|
+
const m = w();
|
|
11
|
+
let u = o;
|
|
12
|
+
if (i && typeof o != "function") {
|
|
13
|
+
const p = O.toArray(o).filter(j);
|
|
14
|
+
if (p.length > i && i >= 2) {
|
|
15
|
+
const N = p.slice(1, p.length - (i - 1));
|
|
16
|
+
u = [
|
|
17
17
|
p[0],
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
...p.slice(p.length - (
|
|
18
|
+
/* @__PURE__ */ e(D, { className: "alea-crumb", children: /* @__PURE__ */ e(Z, { "aria-label": m.showMore, trigger: /* @__PURE__ */ e(A, { className: "alea-crumb-link alea-crumb-more alea-focus-ring", "aria-label": m.showMore, children: "…" }), children: N.map((g, v) => /* @__PURE__ */ e(J, { id: `c${v}`, href: g.props.href, children: g.props.children }, v)) }) }, "__more"),
|
|
19
|
+
...p.slice(p.length - (i - 1))
|
|
20
20
|
];
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
return /* @__PURE__ */
|
|
23
|
+
return /* @__PURE__ */ e(K, { ...c, className: R("alea-breadcrumbs", t), "data-size": h, "data-separator": a ? void 0 : "chevron", style: { "--alea-crumb-sep": typeof a == "string" ? `"${a}"` : void 0, ...c.style }, children: u });
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
|
|
25
|
+
function te({ href: a, icon: i, children: h, className: t, ...o }) {
|
|
26
|
+
return /* @__PURE__ */ e(D, { ...o, className: S("alea-crumb", t), children: a ? /* @__PURE__ */ s(q, { href: a, className: "alea-crumb-link alea-focus-ring", children: [
|
|
27
|
+
i && /* @__PURE__ */ e("span", { className: "alea-crumb-icon", "aria-hidden": "true", children: i }),
|
|
28
|
+
h
|
|
29
|
+
] }) : /* @__PURE__ */ s("span", { className: "alea-crumb-link", "data-current": !0, "aria-current": "page", children: [
|
|
30
|
+
i && /* @__PURE__ */ e("span", { className: "alea-crumb-icon", "aria-hidden": "true", children: i }),
|
|
28
31
|
h
|
|
29
32
|
] }) });
|
|
30
33
|
}
|
|
31
|
-
function
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
for (let
|
|
35
|
-
return
|
|
34
|
+
function I(a, i, h) {
|
|
35
|
+
const t = [], o = Math.max(2, a - h), c = Math.min(i - 1, a + h);
|
|
36
|
+
t.push(1), o > 2 && t.push("gap");
|
|
37
|
+
for (let m = o; m <= c; m++) t.push(m);
|
|
38
|
+
return c < i - 1 && t.push("gap"), i > 1 && t.push(i), t;
|
|
36
39
|
}
|
|
37
|
-
function
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
|
|
40
|
+
function se({ page: a, total: i, onChange: h, siblings: t = 1, appearance: o = "pages", size: c, showFirstLast: m, pageSize: u, pageSizeOptions: p = [10, 25, 50, 100], onPageSizeChange: N, totalItems: g, showJumper: v, className: f, "aria-label": k }) {
|
|
41
|
+
const d = w();
|
|
42
|
+
k ?? (k = d.pagination);
|
|
43
|
+
const y = P(() => I(a, Math.max(1, i), t), [a, i, t]), b = (r) => h(Math.min(Math.max(1, r), i)), C = u ? (a - 1) * u + 1 : 0, z = u && g != null ? Math.min(g, a * u) : 0, B = g != null && u || N || v, n = /* @__PURE__ */ s("nav", { "aria-label": k, className: R("alea-pagination", !B && f), "data-size": c, children: [
|
|
44
|
+
m && /* @__PURE__ */ e("button", { type: "button", className: "alea-page alea-focus-ring", "data-far": !0, "aria-label": d.firstPage, disabled: a <= 1, onClick: () => b(1), children: /* @__PURE__ */ e(V, { size: 16, "aria-hidden": "true" }) }),
|
|
45
|
+
/* @__PURE__ */ e("button", { type: "button", className: "alea-page alea-focus-ring", "aria-label": d.previousPage, disabled: a <= 1, onClick: () => b(a - 1), children: /* @__PURE__ */ e(X, { size: 16, "aria-hidden": "true" }) }),
|
|
46
|
+
o === "compact" ? /* @__PURE__ */ e("span", { className: "alea-page-status", "aria-live": "polite", children: d.nOfTotal(a, i) }) : /* @__PURE__ */ e("ul", { children: y.map((r, l) => r === "gap" ? /* @__PURE__ */ e("li", { className: "alea-page-gap", "aria-hidden": "true", children: "…" }, `g${l}`) : /* @__PURE__ */ e("li", { "data-far": y.length > 5 && Math.abs(r - a) > 1 || void 0, children: /* @__PURE__ */ e("button", { type: "button", className: "alea-page alea-focus-ring", "aria-current": r === a ? "page" : void 0, "aria-label": d.pageN(r), onClick: () => b(r), children: r }) }, r)) }),
|
|
47
|
+
/* @__PURE__ */ e("button", { type: "button", className: "alea-page alea-focus-ring", "aria-label": d.nextPage, disabled: a >= i, onClick: () => b(a + 1), children: /* @__PURE__ */ e(F, { size: 16, "aria-hidden": "true" }) }),
|
|
48
|
+
m && /* @__PURE__ */ e("button", { type: "button", className: "alea-page alea-focus-ring", "data-far": !0, "aria-label": d.lastPage, disabled: a >= i, onClick: () => b(i), children: /* @__PURE__ */ e(G, { size: 16, "aria-hidden": "true" }) })
|
|
46
49
|
] });
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
/* @__PURE__ */
|
|
50
|
+
return B ? /* @__PURE__ */ s("div", { className: R("alea-pagination-bar", f), "data-size": c, children: [
|
|
51
|
+
g != null && u ? /* @__PURE__ */ e("span", { className: "alea-pagination-total", "aria-live": "polite", children: d.itemRange(C, z, g) }) : /* @__PURE__ */ e("span", {}),
|
|
52
|
+
/* @__PURE__ */ s("div", { className: "alea-pagination-controls", children: [
|
|
53
|
+
N && u && /* @__PURE__ */ s("label", { className: "alea-pagination-size", children: [
|
|
54
|
+
/* @__PURE__ */ e("span", { children: d.perPage }),
|
|
55
|
+
/* @__PURE__ */ e("select", { className: "alea-cal-select alea-focus-ring", value: u, onChange: (r) => N(Number(r.target.value)), children: p.map((r) => /* @__PURE__ */ e("option", { value: r, children: r }, r)) })
|
|
53
56
|
] }),
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
57
|
+
n,
|
|
58
|
+
v && /* @__PURE__ */ s("label", { className: "alea-pagination-jump", children: [
|
|
59
|
+
/* @__PURE__ */ e("span", { children: d.goToPage }),
|
|
60
|
+
/* @__PURE__ */ e(
|
|
58
61
|
"input",
|
|
59
62
|
{
|
|
60
63
|
className: "alea-pagination-input alea-focus-ring",
|
|
61
64
|
type: "number",
|
|
62
65
|
inputMode: "numeric",
|
|
63
66
|
min: 1,
|
|
64
|
-
max:
|
|
65
|
-
placeholder: String(
|
|
66
|
-
onKeyDown: (
|
|
67
|
-
if (
|
|
68
|
-
const
|
|
69
|
-
|
|
67
|
+
max: i,
|
|
68
|
+
placeholder: String(a),
|
|
69
|
+
onKeyDown: (r) => {
|
|
70
|
+
if (r.key === "Enter") {
|
|
71
|
+
const l = Number(r.target.value);
|
|
72
|
+
l && (b(l), r.target.value = "");
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
76
|
)
|
|
74
77
|
] })
|
|
75
78
|
] })
|
|
76
|
-
] }) :
|
|
79
|
+
] }) : n;
|
|
77
80
|
}
|
|
78
|
-
function
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
return
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
function oe({ steps: a, current: i, orientation: h = "horizontal", responsive: t = !0, showStatus: o, stateLabels: c, onStepPress: m, size: u, variant: p = "numbers", labelPlacement: N, className: g, "aria-label": v }) {
|
|
82
|
+
const f = w();
|
|
83
|
+
v ?? (v = f.progress);
|
|
84
|
+
const k = Math.max(0, a.findIndex((n) => n.id === i)), d = t === "scroll" && h === "horizontal", y = { error: f.stepError, warning: f.stepWarning, skipped: f.stepSkipped, cancelled: f.stepCancelled }, b = (n) => y[n] && ((c == null ? void 0 : c[n]) ?? y[n]), C = W(null), [z, B] = T(!1);
|
|
85
|
+
return _(() => {
|
|
86
|
+
const n = C.current;
|
|
87
|
+
if (!d || !n) return;
|
|
88
|
+
const r = () => B(n.scrollWidth > n.clientWidth + 1);
|
|
89
|
+
r();
|
|
90
|
+
const l = n.querySelector('[aria-current="step"]');
|
|
91
|
+
if (l) {
|
|
92
|
+
const M = n.getBoundingClientRect(), $ = l.getBoundingClientRect();
|
|
93
|
+
n.scrollLeft += $.left + $.width / 2 - (M.left + M.width / 2);
|
|
94
|
+
}
|
|
95
|
+
if (typeof ResizeObserver > "u") return;
|
|
96
|
+
const x = new ResizeObserver(r);
|
|
97
|
+
return x.observe(n), () => x.disconnect();
|
|
98
|
+
}, [d, k, a.length]), /* @__PURE__ */ e("ol", { ref: C, tabIndex: d && z ? 0 : void 0, "aria-label": v, className: R("alea-steps", g), "data-orientation": h, "data-responsive": d ? "scroll" : t ? "true" : void 0, "data-size": u, "data-variant": p !== "numbers" ? p : void 0, "data-label-placement": N !== "end" ? N : void 0, children: a.map((n, r) => {
|
|
99
|
+
const l = n.status ?? (r < k ? "done" : r === k ? "current" : "upcoming"), x = l === "error" ? /* @__PURE__ */ e(H, { size: 14 }) : l === "cancelled" ? /* @__PURE__ */ e(Q, { size: 14 }) : l === "skipped" ? /* @__PURE__ */ e(U, { size: 14 }) : l === "warning" ? "!" : l === "done" ? /* @__PURE__ */ e(Y, { size: 14 }) : p === "dots" ? null : p === "icons" && n.icon ? n.icon : r + 1, M = /* @__PURE__ */ s(E, { children: [
|
|
100
|
+
/* @__PURE__ */ e("span", { className: "alea-step-dot", "aria-hidden": "true", children: x }),
|
|
101
|
+
/* @__PURE__ */ s("span", { className: "alea-step-text", children: [
|
|
102
|
+
/* @__PURE__ */ s("span", { className: "alea-step-title", children: [
|
|
103
|
+
n.title,
|
|
104
|
+
n.isOptional && /* @__PURE__ */ s("span", { className: "alea-step-optional", children: [
|
|
89
105
|
" (",
|
|
90
|
-
|
|
106
|
+
f.optional,
|
|
91
107
|
")"
|
|
92
108
|
] })
|
|
93
109
|
] }),
|
|
94
|
-
|
|
95
|
-
|
|
110
|
+
n.description && /* @__PURE__ */ e("span", { className: "alea-step-desc", children: n.description }),
|
|
111
|
+
o && /* @__PURE__ */ e("span", { className: "alea-step-status", children: (c == null ? void 0 : c[l]) ?? f.stepStatus[l] }),
|
|
112
|
+
!o && b(l) && /* @__PURE__ */ s("span", { className: "alea-visually-hidden", children: [
|
|
96
113
|
" ",
|
|
97
|
-
|
|
114
|
+
b(l)
|
|
98
115
|
] })
|
|
99
116
|
] })
|
|
100
117
|
] });
|
|
101
|
-
return /* @__PURE__ */
|
|
102
|
-
|
|
103
|
-
/* @__PURE__ */
|
|
118
|
+
return /* @__PURE__ */ e("li", { className: "alea-step", "data-status": l, "aria-current": l === "current" ? "step" : void 0, children: m && l === "done" ? /* @__PURE__ */ s("button", { type: "button", className: "alea-step-button alea-focus-ring", onClick: () => m(n.id), children: [
|
|
119
|
+
M,
|
|
120
|
+
!o && /* @__PURE__ */ s("span", { className: "alea-visually-hidden", children: [
|
|
104
121
|
" ",
|
|
105
|
-
|
|
122
|
+
f.stepDoneBack
|
|
106
123
|
] })
|
|
107
|
-
] }) : /* @__PURE__ */
|
|
108
|
-
|
|
109
|
-
|
|
124
|
+
] }) : /* @__PURE__ */ s("div", { className: "alea-step-button", children: [
|
|
125
|
+
M,
|
|
126
|
+
l === "done" && !o && /* @__PURE__ */ s("span", { className: "alea-visually-hidden", children: [
|
|
110
127
|
" ",
|
|
111
|
-
|
|
128
|
+
(c == null ? void 0 : c.done) ?? f.stepDone
|
|
112
129
|
] })
|
|
113
|
-
] }) },
|
|
130
|
+
] }) }, n.id != null ? String(n.id) : r);
|
|
114
131
|
}) });
|
|
115
132
|
}
|
|
116
133
|
export {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
134
|
+
te as Breadcrumb,
|
|
135
|
+
ce as Breadcrumbs,
|
|
136
|
+
se as Pagination,
|
|
137
|
+
oe as Steps
|
|
121
138
|
};
|
|
@@ -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 (
|
|
122
|
+
/** Three to five destinations: id, label, icon, and an href (a link that navigates through the ThemeProvider navigate, like Link, with no page reload) or none (a button, 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;
|