@alea-design/ui 0.6.1 → 0.7.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 +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/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 +3 -1
- package/dist/components/page/PageParts.js +86 -86
- package/dist/components/shell/AppShell.d.ts +3 -1
- package/dist/components/shell/AppShell.js +33 -32
- package/dist/components/table/Table.d.ts +6 -3
- package/dist/components/table/Table.js +45 -45
- 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/feedback.css +1 -1
- package/dist/css/groups.json +11 -11
- 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/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/package.json +3 -3
|
@@ -1,62 +1,62 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as e, jsxs 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 u =
|
|
12
|
-
if (
|
|
13
|
-
const p =
|
|
14
|
-
if (p.length >
|
|
15
|
-
const N = p.slice(1, p.length - (
|
|
2
|
+
import { jsx as e, jsxs as t, Fragment as O } from "react/jsx-runtime";
|
|
3
|
+
import { Children as j, isValidElement as P, useMemo as W, useRef as T, useState as _, useEffect as q } from "react";
|
|
4
|
+
import { Breadcrumb as E, Link as A, Button as K, Breadcrumbs as V } from "react-aria-components";
|
|
5
|
+
import { ChevronsLeft as X, ChevronLeft as F, ChevronRight as G, ChevronsRight as H, X as Q, Ban as U, Minus as Y, Check as Z } from "lucide-react";
|
|
6
|
+
import { DropdownMenu as J, MenuItem as S } from "../menu/Menu.js";
|
|
7
|
+
import { withBase as I, cx as R } from "../../utils/cx.js";
|
|
8
|
+
import { useStrings as $ } from "../../i18n/strings.js";
|
|
9
|
+
function ta({ separator: n, maxItems: r, size: d, className: i, children: s, ...l }) {
|
|
10
|
+
const h = $();
|
|
11
|
+
let u = s;
|
|
12
|
+
if (r && typeof s != "function") {
|
|
13
|
+
const p = j.toArray(s).filter(P);
|
|
14
|
+
if (p.length > r && r >= 2) {
|
|
15
|
+
const N = p.slice(1, p.length - (r - 1));
|
|
16
16
|
u = [
|
|
17
17
|
p[0],
|
|
18
|
-
/* @__PURE__ */ e(
|
|
19
|
-
...p.slice(p.length - (
|
|
18
|
+
/* @__PURE__ */ e(E, { className: "alea-crumb", children: /* @__PURE__ */ e(J, { "aria-label": h.showMore, trigger: /* @__PURE__ */ e(K, { className: "alea-crumb-link alea-crumb-more alea-focus-ring", "aria-label": h.showMore, children: "…" }), children: N.map((g, v) => /* @__PURE__ */ e(S, { id: `c${v}`, href: g.props.href, children: g.props.children }, v)) }) }, "__more"),
|
|
19
|
+
...p.slice(p.length - (r - 1))
|
|
20
20
|
];
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
return /* @__PURE__ */ e(
|
|
23
|
+
return /* @__PURE__ */ e(V, { ...l, className: R("alea-breadcrumbs", i), "data-size": d, "data-separator": n ? void 0 : "chevron", style: { "--alea-crumb-sep": typeof n == "string" ? `"${n}"` : void 0, ...l.style }, children: u });
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
return /* @__PURE__ */ e(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
] }) : /* @__PURE__ */
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
function sa({ href: n, icon: r, children: d, className: i, ...s }) {
|
|
26
|
+
return /* @__PURE__ */ e(E, { ...s, className: I("alea-crumb", i), children: n ? /* @__PURE__ */ t(A, { href: n, className: "alea-crumb-link alea-focus-ring", children: [
|
|
27
|
+
r && /* @__PURE__ */ e("span", { className: "alea-crumb-icon", "aria-hidden": "true", children: r }),
|
|
28
|
+
d
|
|
29
|
+
] }) : /* @__PURE__ */ t("span", { className: "alea-crumb-link", "data-current": !0, "aria-current": "page", children: [
|
|
30
|
+
r && /* @__PURE__ */ e("span", { className: "alea-crumb-icon", "aria-hidden": "true", children: r }),
|
|
31
|
+
d
|
|
32
32
|
] }) });
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
for (let
|
|
38
|
-
return
|
|
34
|
+
function L(n, r, d) {
|
|
35
|
+
const i = [], s = Math.max(2, n - d), l = Math.min(r - 1, n + d);
|
|
36
|
+
i.push(1), s > 2 && i.push("gap");
|
|
37
|
+
for (let h = s; h <= l; h++) i.push(h);
|
|
38
|
+
return l < r - 1 && i.push("gap"), r > 1 && i.push(r), i;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
const
|
|
42
|
-
k ?? (k =
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
/* @__PURE__ */ e("button", { type: "button", className: "alea-page alea-focus-ring", "aria-label":
|
|
46
|
-
|
|
47
|
-
/* @__PURE__ */ e("button", { type: "button", className: "alea-page alea-focus-ring", "aria-label":
|
|
48
|
-
|
|
40
|
+
function oa({ page: n, total: r, onChange: d, siblings: i = 1, appearance: s = "pages", size: l, showFirstLast: h, pageSize: u, pageSizeOptions: p = [10, 25, 50, 100], onPageSizeChange: N, totalItems: g, showJumper: v, className: m, "aria-label": k }) {
|
|
41
|
+
const o = $();
|
|
42
|
+
k ?? (k = o.pagination);
|
|
43
|
+
const M = W(() => L(n, Math.max(1, r), i), [n, r, i]), b = (a) => d(Math.min(Math.max(1, a), r)), C = u ? (n - 1) * u + 1 : 0, B = u && g != null ? Math.min(g, n * u) : 0, x = g != null && u || N || v, w = /* @__PURE__ */ t("nav", { "aria-label": k, className: R("alea-pagination", !x && m), "data-size": l, children: [
|
|
44
|
+
h && /* @__PURE__ */ e("button", { type: "button", className: "alea-page alea-focus-ring", "data-far": !0, "aria-label": o.firstPage, disabled: n <= 1, onClick: () => b(1), children: /* @__PURE__ */ e(X, { size: 16, "aria-hidden": "true" }) }),
|
|
45
|
+
/* @__PURE__ */ e("button", { type: "button", className: "alea-page alea-focus-ring", "aria-label": o.previousPage, disabled: n <= 1, onClick: () => b(n - 1), children: /* @__PURE__ */ e(F, { size: 16, "aria-hidden": "true" }) }),
|
|
46
|
+
s === "compact" ? /* @__PURE__ */ e("span", { className: "alea-page-status", "aria-live": "polite", children: o.nOfTotal(n, r) }) : /* @__PURE__ */ e("ul", { children: M.map((a, f) => a === "gap" ? /* @__PURE__ */ e("li", { className: "alea-page-gap", "aria-hidden": "true", children: "…" }, `g${f}`) : /* @__PURE__ */ e("li", { "data-far": M.length > 5 && Math.abs(a - n) > 1 || void 0, children: /* @__PURE__ */ e("button", { type: "button", className: "alea-page alea-focus-ring", "aria-current": a === n ? "page" : void 0, "aria-label": o.pageN(a), onClick: () => b(a), children: a }) }, a)) }),
|
|
47
|
+
/* @__PURE__ */ e("button", { type: "button", className: "alea-page alea-focus-ring", "aria-label": o.nextPage, disabled: n >= r, onClick: () => b(n + 1), children: /* @__PURE__ */ e(G, { size: 16, "aria-hidden": "true" }) }),
|
|
48
|
+
h && /* @__PURE__ */ e("button", { type: "button", className: "alea-page alea-focus-ring", "data-far": !0, "aria-label": o.lastPage, disabled: n >= r, onClick: () => b(r), children: /* @__PURE__ */ e(H, { size: 16, "aria-hidden": "true" }) })
|
|
49
49
|
] });
|
|
50
|
-
return
|
|
51
|
-
g != null && u ? /* @__PURE__ */ e("span", { className: "alea-pagination-total", "aria-live": "polite", children:
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
N && u && /* @__PURE__ */
|
|
54
|
-
/* @__PURE__ */ e("span", { children:
|
|
55
|
-
/* @__PURE__ */ e("select", { className: "alea-cal-select alea-focus-ring", value: u, onChange: (
|
|
50
|
+
return x ? /* @__PURE__ */ t("div", { className: R("alea-pagination-bar", m), "data-size": l, children: [
|
|
51
|
+
g != null && u ? /* @__PURE__ */ e("span", { className: "alea-pagination-total", "aria-live": "polite", children: o.itemRange(C, B, g) }) : /* @__PURE__ */ e("span", {}),
|
|
52
|
+
/* @__PURE__ */ t("div", { className: "alea-pagination-controls", children: [
|
|
53
|
+
N && u && /* @__PURE__ */ t("label", { className: "alea-pagination-size", children: [
|
|
54
|
+
/* @__PURE__ */ e("span", { children: o.perPage }),
|
|
55
|
+
/* @__PURE__ */ e("select", { className: "alea-cal-select alea-focus-ring", value: u, onChange: (a) => N(Number(a.target.value)), children: p.map((a) => /* @__PURE__ */ e("option", { value: a, children: a }, a)) })
|
|
56
56
|
] }),
|
|
57
|
-
|
|
58
|
-
v && /* @__PURE__ */
|
|
59
|
-
/* @__PURE__ */ e("span", { children:
|
|
57
|
+
w,
|
|
58
|
+
v && /* @__PURE__ */ t("label", { className: "alea-pagination-jump", children: [
|
|
59
|
+
/* @__PURE__ */ e("span", { children: o.goToPage }),
|
|
60
60
|
/* @__PURE__ */ e(
|
|
61
61
|
"input",
|
|
62
62
|
{
|
|
@@ -64,75 +64,75 @@ function se({ page: a, total: i, onChange: h, siblings: t = 1, appearance: o = "
|
|
|
64
64
|
type: "number",
|
|
65
65
|
inputMode: "numeric",
|
|
66
66
|
min: 1,
|
|
67
|
-
max:
|
|
68
|
-
placeholder: String(
|
|
69
|
-
onKeyDown: (
|
|
70
|
-
if (
|
|
71
|
-
const
|
|
72
|
-
|
|
67
|
+
max: r,
|
|
68
|
+
placeholder: String(n),
|
|
69
|
+
onKeyDown: (a) => {
|
|
70
|
+
if (a.key === "Enter") {
|
|
71
|
+
const f = Number(a.target.value);
|
|
72
|
+
f && (b(f), a.target.value = "");
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
)
|
|
77
77
|
] })
|
|
78
78
|
] })
|
|
79
|
-
] }) :
|
|
79
|
+
] }) : w;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
const
|
|
83
|
-
v ?? (v =
|
|
84
|
-
const k = Math.max(0,
|
|
85
|
-
return
|
|
86
|
-
const
|
|
87
|
-
if (!
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
if (
|
|
92
|
-
const
|
|
93
|
-
|
|
81
|
+
function da({ steps: n, current: r, orientation: d = "horizontal", responsive: i = !0, showStatus: s, stateLabels: l, onStepPress: h, size: u, variant: p = "numbers", labelPlacement: N, className: g, "aria-label": v }) {
|
|
82
|
+
const m = $();
|
|
83
|
+
v ?? (v = m.progress);
|
|
84
|
+
const k = Math.max(0, n.findIndex((a) => a.id === r)), o = i === "scroll" && d === "horizontal", M = i === "wrap" && d === "horizontal", b = { error: m.stepError, warning: m.stepWarning, skipped: m.stepSkipped, cancelled: m.stepCancelled }, C = (a) => b[a] && ((l == null ? void 0 : l[a]) ?? b[a]), B = T(null), [x, w] = _(!1);
|
|
85
|
+
return q(() => {
|
|
86
|
+
const a = B.current;
|
|
87
|
+
if (!o || !a) return;
|
|
88
|
+
const f = () => w(a.scrollWidth > a.clientWidth + 1);
|
|
89
|
+
f();
|
|
90
|
+
const c = a.querySelector('[aria-current="step"]');
|
|
91
|
+
if (c) {
|
|
92
|
+
const y = a.getBoundingClientRect(), D = c.getBoundingClientRect();
|
|
93
|
+
a.scrollLeft += D.left + D.width / 2 - (y.left + y.width / 2);
|
|
94
94
|
}
|
|
95
95
|
if (typeof ResizeObserver > "u") return;
|
|
96
|
-
const
|
|
97
|
-
return
|
|
98
|
-
}, [
|
|
99
|
-
const
|
|
100
|
-
/* @__PURE__ */ e("span", { className: "alea-step-dot", "aria-hidden": "true", children:
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
|
|
104
|
-
|
|
96
|
+
const z = new ResizeObserver(f);
|
|
97
|
+
return z.observe(a), () => z.disconnect();
|
|
98
|
+
}, [o, k, n.length]), /* @__PURE__ */ e("ol", { ref: B, tabIndex: o && x ? 0 : void 0, "aria-label": v, className: R("alea-steps", g), "data-orientation": d, "data-responsive": o ? "scroll" : M ? "wrap" : i === !0 ? "true" : void 0, "data-size": u, "data-variant": p !== "numbers" ? p : void 0, "data-label-placement": N !== "end" ? N : void 0, children: n.map((a, f) => {
|
|
99
|
+
const c = a.status ?? (f < k ? "done" : f === k ? "current" : "upcoming"), z = c === "error" ? /* @__PURE__ */ e(Q, { size: 14 }) : c === "cancelled" ? /* @__PURE__ */ e(U, { size: 14 }) : c === "skipped" ? /* @__PURE__ */ e(Y, { size: 14 }) : c === "warning" ? "!" : c === "done" ? /* @__PURE__ */ e(Z, { size: 14 }) : p === "dots" ? null : p === "icons" && a.icon ? a.icon : f + 1, y = /* @__PURE__ */ t(O, { children: [
|
|
100
|
+
/* @__PURE__ */ e("span", { className: "alea-step-dot", "aria-hidden": "true", children: z }),
|
|
101
|
+
/* @__PURE__ */ t("span", { className: "alea-step-text", children: [
|
|
102
|
+
/* @__PURE__ */ t("span", { className: "alea-step-title", children: [
|
|
103
|
+
a.title,
|
|
104
|
+
a.isOptional && /* @__PURE__ */ t("span", { className: "alea-step-optional", children: [
|
|
105
105
|
" (",
|
|
106
|
-
|
|
106
|
+
m.optional,
|
|
107
107
|
")"
|
|
108
108
|
] })
|
|
109
109
|
] }),
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
!
|
|
110
|
+
a.description && /* @__PURE__ */ e("span", { className: "alea-step-desc", children: a.description }),
|
|
111
|
+
s && /* @__PURE__ */ e("span", { className: "alea-step-status", children: (l == null ? void 0 : l[c]) ?? m.stepStatus[c] }),
|
|
112
|
+
!s && C(c) && /* @__PURE__ */ t("span", { className: "alea-visually-hidden", children: [
|
|
113
113
|
" ",
|
|
114
|
-
|
|
114
|
+
C(c)
|
|
115
115
|
] })
|
|
116
116
|
] })
|
|
117
117
|
] });
|
|
118
|
-
return /* @__PURE__ */ e("li", { className: "alea-step", "data-status":
|
|
119
|
-
|
|
120
|
-
!
|
|
118
|
+
return /* @__PURE__ */ e("li", { className: "alea-step", "data-status": c, "aria-current": c === "current" ? "step" : void 0, children: h && c === "done" ? /* @__PURE__ */ t("button", { type: "button", className: "alea-step-button alea-focus-ring", onClick: () => h(a.id), children: [
|
|
119
|
+
y,
|
|
120
|
+
!s && /* @__PURE__ */ t("span", { className: "alea-visually-hidden", children: [
|
|
121
121
|
" ",
|
|
122
|
-
|
|
122
|
+
m.stepDoneBack
|
|
123
123
|
] })
|
|
124
|
-
] }) : /* @__PURE__ */
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
] }) : /* @__PURE__ */ t("div", { className: "alea-step-button", children: [
|
|
125
|
+
y,
|
|
126
|
+
c === "done" && !s && /* @__PURE__ */ t("span", { className: "alea-visually-hidden", children: [
|
|
127
127
|
" ",
|
|
128
|
-
(
|
|
128
|
+
(l == null ? void 0 : l.done) ?? m.stepDone
|
|
129
129
|
] })
|
|
130
|
-
] }) },
|
|
130
|
+
] }) }, a.id != null ? String(a.id) : f);
|
|
131
131
|
}) });
|
|
132
132
|
}
|
|
133
133
|
export {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
sa as Breadcrumb,
|
|
135
|
+
ta as Breadcrumbs,
|
|
136
|
+
oa as Pagination,
|
|
137
|
+
da as Steps
|
|
138
138
|
};
|
|
@@ -139,11 +139,13 @@ export interface BottomNavigationProps {
|
|
|
139
139
|
moreLabel?: string;
|
|
140
140
|
/** Icon of the More button. Default three dots. */
|
|
141
141
|
moreIcon?: ReactNode;
|
|
142
|
+
/** always (default) shows each label under its icon, truncated with an ellipsis when it is too long for its column. auto shows them while every label fits and, when one does not (large text on a narrow screen), drops all of them at once and keeps the icons: the labels stay as the accessible names, every item stays 44 px tall and the More button stays on screen. */
|
|
143
|
+
labels?: 'always' | 'auto';
|
|
142
144
|
/** Extra class names for the root element. */
|
|
143
145
|
className?: string;
|
|
144
146
|
}
|
|
145
147
|
/** 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;
|
|
148
|
+
export declare function BottomNavigation({ items, value, onChange, fixed, maxItems, moreLabel, moreIcon, labels, className, 'aria-label': label }: BottomNavigationProps): import("react").JSX.Element;
|
|
147
149
|
export interface BurgerProps {
|
|
148
150
|
/** Whether the menu it controls is open. */
|
|
149
151
|
isOpen: boolean;
|