@alea-design/ui 0.6.0 → 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/command/CommandPalette.js +63 -61
- package/dist/components/data/Data.d.ts +10 -6
- package/dist/components/data/Data.js +53 -53
- 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/media/Media.d.ts +5 -1
- package/dist/components/media/Media.js +113 -111
- package/dist/components/navigation/Navigation.d.ts +11 -7
- package/dist/components/navigation/Navigation.js +97 -97
- package/dist/components/navigation/Navigation2.d.ts +4 -2
- package/dist/components/navigation/Navigation2.js +219 -211
- package/dist/components/overlay/Overlay.d.ts +4 -0
- package/dist/components/overlay/Overlay.js +52 -52
- package/dist/components/page/PageParts.d.ts +8 -2
- package/dist/components/page/PageParts.js +95 -87
- 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 +4 -1
- package/dist/i18n/strings.js +8 -2
- 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
|
@@ -58,6 +58,8 @@ export interface DialogProps extends Omit<RACDialogProps, 'children'> {
|
|
|
58
58
|
}) => ReactNode);
|
|
59
59
|
/** Hides the X button. */
|
|
60
60
|
hideClose?: boolean;
|
|
61
|
+
/** Size of the title: md (24 px display, default) or sm (16 px, semibold). Same as on Modal. */
|
|
62
|
+
titleSize?: 'sm' | 'md';
|
|
61
63
|
}
|
|
62
64
|
/** The dialog content: title, text, body and footer. Put it inside DialogModal. */
|
|
63
65
|
export declare const Dialog: import("react").ForwardRefExoticComponent<DialogProps & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -98,6 +100,8 @@ export interface AlertDialogProps {
|
|
|
98
100
|
motion?: MotionProp;
|
|
99
101
|
/** What is behind it: blur (default) or dim (no backdrop-filter). */
|
|
100
102
|
backdrop?: 'blur' | 'dim';
|
|
103
|
+
/** Size of the title: md (24 px display, default) or sm (16 px, semibold), for long questions or large text. */
|
|
104
|
+
titleSize?: 'sm' | 'md';
|
|
101
105
|
/** Which control has focus when it opens: confirm (default), cancel (the safe choice for a destructive action) or content (the dialog itself, so a screen reader reads the title and text first; use it when the dialog has a required field). */
|
|
102
106
|
initialFocus?: 'confirm' | 'cancel' | 'content';
|
|
103
107
|
/** Extra class names for the dialog. */
|
|
@@ -1,78 +1,78 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as a, jsxs as
|
|
3
|
-
import { forwardRef as g, useId as
|
|
4
|
-
import { Dialog as T, Heading as b, ModalOverlay as
|
|
5
|
-
import { DialogTrigger as
|
|
6
|
-
import { X as
|
|
2
|
+
import { jsx as a, jsxs as u, Fragment as h } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as g, useId as L } from "react";
|
|
4
|
+
import { Dialog as T, Heading as b, ModalOverlay as O, Modal as R, Popover as S, OverlayArrow as x, Button as H, Tooltip as V, TooltipTrigger as X } from "react-aria-components";
|
|
5
|
+
import { DialogTrigger as pa } from "react-aria-components";
|
|
6
|
+
import { X as z } from "lucide-react";
|
|
7
7
|
import { withMotionStyle as f } from "@alea-design/motion";
|
|
8
|
-
import { cx as
|
|
9
|
-
import { Button as P, IconButton as
|
|
8
|
+
import { cx as B, withBase as v } from "../../utils/cx.js";
|
|
9
|
+
import { Button as P, IconButton as q } from "../button/Button.js";
|
|
10
10
|
import { useStrings as N } from "../../i18n/strings.js";
|
|
11
|
-
import { renamedValue as
|
|
12
|
-
import { surfaceAttrs as
|
|
13
|
-
import { useInitialFocus as
|
|
14
|
-
const
|
|
15
|
-
return /* @__PURE__ */
|
|
11
|
+
import { renamedValue as E } from "../../utils/vocabulary.js";
|
|
12
|
+
import { surfaceAttrs as M } from "../surface/Surface.js";
|
|
13
|
+
import { useInitialFocus as G } from "../../utils/initialFocus.js";
|
|
14
|
+
const ra = g(function({ children: e, showArrow: o, className: l, offset: r = 8, motion: i, style: t, size: n, surface: c, radius: p, ...s }, m) {
|
|
15
|
+
return /* @__PURE__ */ u(S, { ...s, ref: m, offset: o ? 12 : r, "data-size": n, ...M({ surface: c, radius: p }), className: v("alea-popover", l), style: f(t, i), children: [
|
|
16
16
|
o && /* @__PURE__ */ a(x, { className: "alea-arrow", children: /* @__PURE__ */ a("svg", { width: 12, height: 12, viewBox: "0 0 12 12", children: /* @__PURE__ */ a("path", { d: "M0 0 L6 6 L12 0" }) }) }),
|
|
17
17
|
e
|
|
18
18
|
] });
|
|
19
|
-
}),
|
|
20
|
-
const
|
|
21
|
-
return /* @__PURE__ */ a(T, { ...n, ref: c, className:
|
|
22
|
-
(e ||
|
|
19
|
+
}), ia = g(function({ title: e, description: o, footer: l, showClose: r, children: i, className: t, ...n }, c) {
|
|
20
|
+
const p = N();
|
|
21
|
+
return /* @__PURE__ */ a(T, { ...n, ref: c, className: B("alea-popover-dialog", t), children: (s) => /* @__PURE__ */ u(h, { children: [
|
|
22
|
+
(e || r) && /* @__PURE__ */ u("div", { className: "alea-popover-head", children: [
|
|
23
23
|
e && /* @__PURE__ */ a(b, { slot: "title", className: "alea-popover-title", children: e }),
|
|
24
|
-
|
|
24
|
+
r && /* @__PURE__ */ a(H, { className: "alea-popover-close alea-focus-ring", "aria-label": p.close, onPress: s.close, children: /* @__PURE__ */ a(z, { size: 16, "aria-hidden": "true" }) })
|
|
25
25
|
] }),
|
|
26
26
|
o && /* @__PURE__ */ a("p", { className: "alea-popover-desc", children: o }),
|
|
27
|
-
typeof
|
|
28
|
-
l && /* @__PURE__ */ a("div", { className: "alea-popover-footer", children: typeof l == "function" ? l(
|
|
27
|
+
typeof i == "function" ? i(s) : i,
|
|
28
|
+
l && /* @__PURE__ */ a("div", { className: "alea-popover-footer", children: typeof l == "function" ? l(s.close) : l })
|
|
29
29
|
] }) });
|
|
30
30
|
});
|
|
31
|
-
function
|
|
32
|
-
return /* @__PURE__ */
|
|
31
|
+
function ta({ children: d, title: e, shortcut: o, hideArrow: l, className: r, offset: i = 8, motion: t, style: n, ...c }) {
|
|
32
|
+
return /* @__PURE__ */ u(V, { ...c, offset: i, className: v("alea-tooltip", r), "data-rich": e ? !0 : void 0, style: f(n, t), children: [
|
|
33
33
|
!l && /* @__PURE__ */ a(x, { className: "alea-arrow alea-tooltip-arrow", children: /* @__PURE__ */ a("svg", { width: 8, height: 8, viewBox: "0 0 8 8", children: /* @__PURE__ */ a("path", { d: "M0 0 L4 4 L8 0" }) }) }),
|
|
34
34
|
e && /* @__PURE__ */ a("span", { className: "alea-tooltip-title", children: e }),
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
|
|
35
|
+
/* @__PURE__ */ u("span", { className: "alea-tooltip-text", children: [
|
|
36
|
+
d,
|
|
37
37
|
o && /* @__PURE__ */ a("kbd", { className: "alea-tooltip-kbd", children: o })
|
|
38
38
|
] })
|
|
39
39
|
] });
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
return /* @__PURE__ */ a(
|
|
41
|
+
function sa({ delay: d = 600, closeDelay: e = 200, ...o }) {
|
|
42
|
+
return /* @__PURE__ */ a(X, { ...o, delay: d, closeDelay: e });
|
|
43
43
|
}
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
return /* @__PURE__ */ a(T, { ...
|
|
47
|
-
(e || !
|
|
48
|
-
e && /* @__PURE__ */ a(b, { slot: "title", className: "alea-dialog-title", children: e }),
|
|
49
|
-
!
|
|
44
|
+
const J = g(function({ title: e, description: o, children: l, footer: r, hideClose: i, titleSize: t = "md", className: n, ...c }, p) {
|
|
45
|
+
const s = N();
|
|
46
|
+
return /* @__PURE__ */ a(T, { ...c, ref: p, className: B("alea-dialog", n), children: ({ close: m }) => /* @__PURE__ */ u(h, { children: [
|
|
47
|
+
(e || !i) && /* @__PURE__ */ u("div", { className: "alea-dialog-head", children: [
|
|
48
|
+
e && /* @__PURE__ */ a(b, { slot: "title", className: "alea-dialog-title", "data-size": t === "sm" ? "sm" : void 0, children: e }),
|
|
49
|
+
!i && /* @__PURE__ */ a(q, { "aria-label": s.close, size: "sm", variant: "ghost", onPress: m, className: "alea-dialog-x", children: /* @__PURE__ */ a(z, {}) })
|
|
50
50
|
] }),
|
|
51
51
|
o && /* @__PURE__ */ a("p", { className: "alea-dialog-description", children: o }),
|
|
52
|
-
l && /* @__PURE__ */ a("div", { className: "alea-dialog-body", children: typeof l == "function" ? l({ close:
|
|
53
|
-
|
|
52
|
+
l && /* @__PURE__ */ a("div", { className: "alea-dialog-body", children: typeof l == "function" ? l({ close: m }) : l }),
|
|
53
|
+
r && /* @__PURE__ */ a("div", { className: "alea-dialog-footer", children: typeof r == "function" ? r({ close: m }) : r })
|
|
54
54
|
] }) });
|
|
55
55
|
});
|
|
56
|
-
function
|
|
57
|
-
const
|
|
58
|
-
return /* @__PURE__ */ a(
|
|
56
|
+
function K({ children: d, size: e = "md", fullscreenBelow: o, className: l, isDismissable: r = !0, motion: i, backdrop: t, initialFocus: n, surface: c, radius: p, ...s }) {
|
|
57
|
+
const m = G(n);
|
|
58
|
+
return /* @__PURE__ */ a(O, { ...s, isDismissable: r, className: v("alea-modal-overlay", l), "data-backdrop": t, "data-fullscreen-below": o, children: /* @__PURE__ */ a(R, { ref: m, className: "alea-modal", "data-size": e, "data-fullscreen-below": o, ...M({ surface: c, radius: p }), style: f(void 0, i), children: d }) });
|
|
59
59
|
}
|
|
60
|
-
const
|
|
61
|
-
const y =
|
|
62
|
-
return
|
|
63
|
-
/* @__PURE__ */ a(P, { variant: "ghost", autoFocus: l === "cancel", onPress: w, children:
|
|
64
|
-
/* @__PURE__ */ a(P, { variant:
|
|
65
|
-
await (
|
|
66
|
-
}, children:
|
|
67
|
-
] }), children:
|
|
60
|
+
const na = g(function({ motion: e, backdrop: o, initialFocus: l = "confirm", titleSize: r, title: i, children: t, confirmLabel: n, cancelLabel: c, tone: p, onConfirm: s, isOpen: m, defaultOpen: $, onOpenChange: A, className: I, style: k }, F) {
|
|
61
|
+
const y = L(), j = E("AlertDialog", "tone", p, { default: "neutral" }) ?? "neutral", D = N();
|
|
62
|
+
return n ?? (n = D.confirm), c ?? (c = D.cancel), /* @__PURE__ */ a(K, { isOpen: m, defaultOpen: $, onOpenChange: A, isDismissable: !1, size: "sm", motion: e, backdrop: o, children: /* @__PURE__ */ a(J, { ref: F, className: I, style: k, role: "alertdialog", "aria-describedby": t ? y : void 0, title: i, titleSize: r, hideClose: !0, footer: ({ close: w }) => /* @__PURE__ */ u(h, { children: [
|
|
63
|
+
/* @__PURE__ */ a(P, { variant: "ghost", autoFocus: l === "cancel", onPress: w, children: c }),
|
|
64
|
+
/* @__PURE__ */ a(P, { variant: j === "danger" ? "danger" : "primary", autoFocus: l === "confirm", onPress: async () => {
|
|
65
|
+
await (s == null ? void 0 : s()), w();
|
|
66
|
+
}, children: n })
|
|
67
|
+
] }), children: t ? /* @__PURE__ */ a("div", { id: y, style: { display: "contents" }, children: t }) : null }) });
|
|
68
68
|
});
|
|
69
69
|
export {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
70
|
+
na as AlertDialog,
|
|
71
|
+
J as Dialog,
|
|
72
|
+
K as DialogModal,
|
|
73
|
+
pa as DialogTrigger,
|
|
74
|
+
ra as Popover,
|
|
75
|
+
ia as PopoverDialog,
|
|
76
|
+
ta as Tooltip,
|
|
77
|
+
sa as TooltipTrigger
|
|
78
78
|
};
|
|
@@ -9,6 +9,8 @@ export interface PageAction {
|
|
|
9
9
|
href?: string;
|
|
10
10
|
isDisabled?: boolean;
|
|
11
11
|
tone?: 'default' | 'danger';
|
|
12
|
+
/** PageHeader: keep this action inside the More menu even when there is room for it as a button (a destructive one, for example). */
|
|
13
|
+
menuOnly?: boolean;
|
|
12
14
|
}
|
|
13
15
|
export interface PageHeaderProps {
|
|
14
16
|
/** The page title (an h1 by default). */
|
|
@@ -32,6 +34,8 @@ export interface PageHeaderProps {
|
|
|
32
34
|
actions?: ReactNode;
|
|
33
35
|
/** More actions: shown as buttons from 768 px up, folded into a More menu on phones. */
|
|
34
36
|
secondaryActions?: PageAction[];
|
|
37
|
+
/** How many secondary actions show as buttons before the rest move into a More menu (0 puts them all in the menu). Default: all of them. Actions with `menuOnly` always go to the menu. */
|
|
38
|
+
maxVisibleActions?: number;
|
|
35
39
|
/** Tabs or a segmented control under the header. */
|
|
36
40
|
tabs?: ReactNode;
|
|
37
41
|
/** Heading level. Default 1. */
|
|
@@ -40,11 +44,13 @@ export interface PageHeaderProps {
|
|
|
40
44
|
sticky?: boolean;
|
|
41
45
|
/** Tighter spacing and a smaller title, for dense apps. */
|
|
42
46
|
compact?: boolean;
|
|
47
|
+
/** Keeps the title for screen readers and the document outline but does not draw it, for a page whose title is already shown elsewhere (the app bar, a tab). The rest of the header stays. */
|
|
48
|
+
hideTitle?: boolean;
|
|
43
49
|
/** Extra class names. */
|
|
44
50
|
className?: string;
|
|
45
51
|
}
|
|
46
|
-
/** The top of a page: breadcrumbs or back, title, subtitle, meta, actions and tabs. Secondary actions fold into a menu on phones
|
|
47
|
-
export declare function PageHeader({ title, subtitle, back, backLabel, breadcrumbs, media, meta, actions, secondaryActions, tabs, headingLevel, sticky, compact, className }: PageHeaderProps): import("react").JSX.Element;
|
|
52
|
+
/** The top of a page: breadcrumbs or back, title, subtitle, meta, actions and tabs. Secondary actions fold into a menu on phones, or past `maxVisibleActions`. */
|
|
53
|
+
export declare function PageHeader({ title, subtitle, back, backLabel, breadcrumbs, media, meta, actions, secondaryActions, maxVisibleActions, tabs, headingLevel, sticky, compact, hideTitle, className }: PageHeaderProps): import("react").JSX.Element;
|
|
48
54
|
export interface SaveBarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
49
55
|
/** Show it while there are unsaved changes. */
|
|
50
56
|
isVisible: boolean;
|
|
@@ -1,109 +1,117 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useRef as L, useState as
|
|
4
|
-
import { Info as
|
|
5
|
-
import { cx as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { Breadcrumbs as
|
|
8
|
-
import { DropdownMenu as
|
|
9
|
-
import { useStrings as
|
|
10
|
-
import { inertProps as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as L, useState as E, useEffect as I, createElement as $, forwardRef as O } from "react";
|
|
4
|
+
import { Info as F, ArrowLeft as A, MoreHorizontal as q } from "lucide-react";
|
|
5
|
+
import { cx as w } from "../../utils/cx.js";
|
|
6
|
+
import { Button as M, IconButton as x } from "../button/Button.js";
|
|
7
|
+
import { Breadcrumbs as G, Breadcrumb as J } from "../navigation/Navigation.js";
|
|
8
|
+
import { DropdownMenu as Q, MenuItem as U } from "../menu/Menu.js";
|
|
9
|
+
import { useStrings as R } from "../../i18n/strings.js";
|
|
10
|
+
import { inertProps as X } from "../../utils/inert.js";
|
|
11
|
+
import { useMeasured as Y, remPx as Z } from "../../utils/measure.js";
|
|
12
|
+
function H({ actions: t, label: a }) {
|
|
13
|
+
return /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
14
|
+
Q,
|
|
15
|
+
{
|
|
16
|
+
"aria-label": a,
|
|
17
|
+
placement: "bottom end",
|
|
18
|
+
trigger: /* @__PURE__ */ e(x, { "aria-label": a, size: "sm", children: /* @__PURE__ */ e(q, {}) }),
|
|
19
|
+
menuProps: { onAction: (n) => {
|
|
20
|
+
var i, l;
|
|
21
|
+
return (l = (i = t.find((h) => h.id === n)) == null ? void 0 : i.onAction) == null ? void 0 : l.call(i);
|
|
22
|
+
} },
|
|
23
|
+
children: t.map((n) => /* @__PURE__ */ e(U, { id: n.id, icon: n.icon, href: n.href, isDisabled: n.isDisabled, tone: n.tone, children: n.label }, String(n.id)))
|
|
24
|
+
}
|
|
25
|
+
) });
|
|
26
|
+
}
|
|
27
|
+
const V = 45, ee = (t) => t.clientWidth > 0 && t.clientWidth < V * Z();
|
|
28
|
+
function he({ title: t, subtitle: a, back: n, backLabel: i, breadcrumbs: l, media: h, meta: v, actions: g, secondaryActions: o, maxVisibleActions: m, tabs: f, headingLevel: u = 1, sticky: s, compact: p, hideTitle: b, className: y }) {
|
|
29
|
+
const d = R(), P = L(null), [T, C] = E(!1);
|
|
30
|
+
I(() => {
|
|
31
|
+
const r = P.current;
|
|
32
|
+
if (!s || !r || typeof IntersectionObserver > "u") return;
|
|
33
|
+
const N = document.createElement("div");
|
|
34
|
+
r.before(N);
|
|
35
|
+
const k = new IntersectionObserver(([_]) => C(!_.isIntersecting));
|
|
36
|
+
return k.observe(N), () => {
|
|
37
|
+
k.disconnect(), N.remove();
|
|
21
38
|
};
|
|
22
39
|
}, [s]);
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
] }) : null;
|
|
39
|
-
return /* @__PURE__ */ o("header", { ref: b, className: B("alea-page-header", h), "data-sticky": s || void 0, "data-stuck": w || void 0, "data-compact": m || void 0, children: [
|
|
40
|
-
l != null && l.length ? /* @__PURE__ */ e("nav", { "aria-label": p.breadcrumb, children: /* @__PURE__ */ e(K, { className: "alea-page-header-crumbs", children: l.map((a, t) => /* @__PURE__ */ e(O, { href: t === l.length - 1 ? void 0 : a.href, children: a.label }, t)) }) }) : null,
|
|
41
|
-
/* @__PURE__ */ o("div", { className: "alea-page-header-main", children: [
|
|
42
|
-
i && (typeof i == "string" ? /* @__PURE__ */ e(D, { "aria-label": c ?? p.back, variant: "ghost", size: "sm", href: i, className: "alea-page-header-back", children: /* @__PURE__ */ e(S, {}) }) : /* @__PURE__ */ e(D, { "aria-label": c ?? p.back, variant: "ghost", size: "sm", onPress: i, className: "alea-page-header-back", children: /* @__PURE__ */ e(S, {}) })),
|
|
43
|
-
v && /* @__PURE__ */ e("span", { className: "alea-page-header-media", children: v }),
|
|
44
|
-
/* @__PURE__ */ o("div", { className: "alea-page-header-titles", children: [
|
|
45
|
-
/* @__PURE__ */ o("div", { className: "alea-page-header-title-row", children: [
|
|
46
|
-
M(`h${N}`, { className: "alea-page-header-title" }, u),
|
|
47
|
-
f && /* @__PURE__ */ e("div", { className: "alea-page-header-meta", children: f })
|
|
40
|
+
const S = Y(P, ee, !1), W = Math.max(0, m ?? 1 / 0), z = [], B = [];
|
|
41
|
+
for (const r of o ?? []) (!r.menuOnly && z.length < W ? z : B).push(r);
|
|
42
|
+
const D = !!(o != null && o.length), j = D && !S ? /* @__PURE__ */ c("div", { className: "alea-page-header-secondary", children: [
|
|
43
|
+
z.map((r) => /* @__PURE__ */ e(M, { variant: "ghost", size: "sm", iconStart: r.icon, href: r.href, onPress: r.onAction, isDisabled: r.isDisabled, tone: r.tone === "danger" ? "danger" : void 0, children: r.label }, String(r.id))),
|
|
44
|
+
B.length > 0 && /* @__PURE__ */ e(H, { actions: B, label: d.moreActions })
|
|
45
|
+
] }) : null, K = D && S ? /* @__PURE__ */ e(H, { actions: o, label: d.moreActions }) : null;
|
|
46
|
+
return /* @__PURE__ */ c("header", { ref: P, className: w("alea-page-header", y), "data-sticky": s || void 0, "data-stuck": T || void 0, "data-compact": p || void 0, children: [
|
|
47
|
+
l != null && l.length ? /* @__PURE__ */ e("nav", { "aria-label": d.breadcrumb, children: /* @__PURE__ */ e(G, { className: "alea-page-header-crumbs", children: l.map((r, N) => /* @__PURE__ */ e(J, { href: N === l.length - 1 ? void 0 : r.href, children: r.label }, N)) }) }) : null,
|
|
48
|
+
/* @__PURE__ */ c("div", { className: "alea-page-header-main", children: [
|
|
49
|
+
n && (typeof n == "string" ? /* @__PURE__ */ e(x, { "aria-label": i ?? d.back, variant: "ghost", size: "sm", href: n, className: "alea-page-header-back", children: /* @__PURE__ */ e(A, {}) }) : /* @__PURE__ */ e(x, { "aria-label": i ?? d.back, variant: "ghost", size: "sm", onPress: n, className: "alea-page-header-back", children: /* @__PURE__ */ e(A, {}) })),
|
|
50
|
+
h && /* @__PURE__ */ e("span", { className: "alea-page-header-media", children: h }),
|
|
51
|
+
/* @__PURE__ */ c("div", { className: "alea-page-header-titles", children: [
|
|
52
|
+
/* @__PURE__ */ c("div", { className: "alea-page-header-title-row", children: [
|
|
53
|
+
$(`h${u}`, { className: w("alea-page-header-title", b && "alea-visually-hidden") }, t),
|
|
54
|
+
v && /* @__PURE__ */ e("div", { className: "alea-page-header-meta", children: v })
|
|
48
55
|
] }),
|
|
49
|
-
|
|
56
|
+
a && /* @__PURE__ */ e("p", { className: "alea-page-header-subtitle", children: a })
|
|
50
57
|
] }),
|
|
51
|
-
(g ||
|
|
52
|
-
|
|
53
|
-
g
|
|
58
|
+
(g || D) && /* @__PURE__ */ c("div", { className: "alea-page-header-actions", children: [
|
|
59
|
+
j,
|
|
60
|
+
g,
|
|
61
|
+
K
|
|
54
62
|
] })
|
|
55
63
|
] }),
|
|
56
|
-
|
|
64
|
+
f && /* @__PURE__ */ e("div", { className: "alea-page-header-tabs", children: f })
|
|
57
65
|
] });
|
|
58
66
|
}
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
return
|
|
62
|
-
if (!
|
|
63
|
-
const
|
|
64
|
-
(
|
|
67
|
+
const me = O(function({ isVisible: a, message: n, onSave: i, onDiscard: l, isSaving: h, saveLabel: v, discardLabel: g, position: o = "top", saveShortcut: m = !0, className: f, ...u }, s) {
|
|
68
|
+
const p = R(), b = L(i);
|
|
69
|
+
return b.current = i, I(() => {
|
|
70
|
+
if (!a || !m) return;
|
|
71
|
+
const y = (d) => {
|
|
72
|
+
(d.metaKey || d.ctrlKey) && d.key.toLowerCase() === "s" && (d.preventDefault(), b.current());
|
|
65
73
|
};
|
|
66
|
-
return window.addEventListener("keydown",
|
|
67
|
-
}, [
|
|
68
|
-
/* @__PURE__ */ e("p", { className: "alea-savebar-message", "aria-live": "polite", children:
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
l && /* @__PURE__ */ e(
|
|
71
|
-
/* @__PURE__ */ e(
|
|
74
|
+
return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
|
|
75
|
+
}, [a, m]), /* @__PURE__ */ c("div", { ref: s, ...u, className: w("alea-savebar", f), "data-visible": a || void 0, "data-position": o, role: "region", "aria-label": u["aria-label"] ?? p.unsavedChanges, "aria-hidden": !a || void 0, ...X(!a), children: [
|
|
76
|
+
/* @__PURE__ */ e("p", { className: "alea-savebar-message", "aria-live": "polite", children: a ? n ?? p.unsavedChanges : "" }),
|
|
77
|
+
/* @__PURE__ */ c("div", { className: "alea-savebar-actions", children: [
|
|
78
|
+
l && /* @__PURE__ */ e(M, { variant: "ghost", size: "sm", onPress: l, isDisabled: h, children: g ?? p.discard }),
|
|
79
|
+
/* @__PURE__ */ e(M, { size: "sm", variant: "secondary", onPress: i, isLoading: h, shortcut: m ? "⌘S" : void 0, children: v ?? p.save })
|
|
72
80
|
] })
|
|
73
81
|
] });
|
|
74
|
-
}),
|
|
75
|
-
const g =
|
|
76
|
-
if (
|
|
77
|
-
if (
|
|
78
|
-
|
|
82
|
+
}), ue = O(function({ isLoading: a, value: n, "aria-label": i, className: l, ...h }, v) {
|
|
83
|
+
const g = R(), [o, m] = E(a), [f, u] = E(!1);
|
|
84
|
+
if (I(() => {
|
|
85
|
+
if (a) {
|
|
86
|
+
m(!0), u(!1);
|
|
79
87
|
return;
|
|
80
88
|
}
|
|
81
|
-
if (!
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
|
|
89
|
+
if (!o) return;
|
|
90
|
+
u(!0);
|
|
91
|
+
const p = setTimeout(() => {
|
|
92
|
+
m(!1), u(!1);
|
|
85
93
|
}, 500);
|
|
86
|
-
return () => clearTimeout(
|
|
87
|
-
}, [
|
|
88
|
-
const
|
|
89
|
-
return /* @__PURE__ */ e("div", { ref:
|
|
94
|
+
return () => clearTimeout(p);
|
|
95
|
+
}, [a]), !o) return null;
|
|
96
|
+
const s = f ? 100 : n;
|
|
97
|
+
return /* @__PURE__ */ e("div", { ref: v, ...h, className: w("alea-top-loading", l), role: "progressbar", "aria-label": i ?? g.loading, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": s, "data-done": f || void 0, "data-indeterminate": s == null || void 0, children: /* @__PURE__ */ e("span", { className: "alea-top-loading-bar", style: s != null ? { width: `${s}%` } : void 0 }) });
|
|
90
98
|
});
|
|
91
|
-
function
|
|
92
|
-
return /* @__PURE__ */
|
|
93
|
-
/* @__PURE__ */ e(
|
|
94
|
-
/* @__PURE__ */ e("span", { children:
|
|
99
|
+
function pe({ children: t, className: a }) {
|
|
100
|
+
return /* @__PURE__ */ c("p", { className: w("alea-footer-help", a), children: [
|
|
101
|
+
/* @__PURE__ */ e(F, { size: 16, "aria-hidden": "true" }),
|
|
102
|
+
/* @__PURE__ */ e("span", { children: t })
|
|
95
103
|
] });
|
|
96
104
|
}
|
|
97
|
-
function
|
|
98
|
-
return /* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */ e("div", { className: "alea-page-actions-secondary", children:
|
|
100
|
-
/* @__PURE__ */ e("div", { className: "alea-page-actions-primary", children:
|
|
105
|
+
function fe({ primary: t, secondary: a, className: n }) {
|
|
106
|
+
return /* @__PURE__ */ c("div", { className: w("alea-page-actions", n), children: [
|
|
107
|
+
/* @__PURE__ */ e("div", { className: "alea-page-actions-secondary", children: a }),
|
|
108
|
+
/* @__PURE__ */ e("div", { className: "alea-page-actions-primary", children: t })
|
|
101
109
|
] });
|
|
102
110
|
}
|
|
103
111
|
export {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
112
|
+
pe as FooterHelp,
|
|
113
|
+
fe as PageActions,
|
|
114
|
+
he as PageHeader,
|
|
115
|
+
me as SaveBar,
|
|
116
|
+
ue as TopLoadingBar
|
|
109
117
|
};
|
|
@@ -24,11 +24,13 @@ export interface AppShellProps {
|
|
|
24
24
|
target?: string;
|
|
25
25
|
label?: ReactNode;
|
|
26
26
|
};
|
|
27
|
+
/** A bar along the bottom of the screen, usually a BottomNavigation on phones (render it only where it applies). It sticks to the bottom edge and takes its own space under the content, so the end of the page is never hidden behind it, at any text size. A fixed BottomNavigation is laid out in flow here; no extra spacing is needed. */
|
|
28
|
+
bottomBar?: ReactNode;
|
|
27
29
|
/** Extra class names for the root element. */
|
|
28
30
|
className?: string;
|
|
29
31
|
}
|
|
30
32
|
/** The app frame: sticky header, sidebar, scrollable content and a skip link. */
|
|
31
|
-
export declare function AppShell({ brand, headerEnd, sidebar, children, sidebarWidth, collapseBelow, mainAs, layout, contentSize, skipLink, className }: AppShellProps): import("react").JSX.Element;
|
|
33
|
+
export declare function AppShell({ brand, headerEnd, sidebar, children, sidebarWidth, collapseBelow, mainAs, layout, contentSize, skipLink, bottomBar, className }: AppShellProps): import("react").JSX.Element;
|
|
32
34
|
export interface SidebarNavProps {
|
|
33
35
|
children: ReactNode;
|
|
34
36
|
/** Name of the navigation. Default "Sidebar". */
|
|
@@ -1,56 +1,57 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as t, jsx as a, Fragment as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { Link as
|
|
5
|
-
import { Menu as
|
|
6
|
-
import { cx as u, withBase as
|
|
7
|
-
import { useMediaQuery as
|
|
8
|
-
import { IconButton as
|
|
9
|
-
import { Drawer as
|
|
10
|
-
import { Dialog as
|
|
11
|
-
import { useStrings as
|
|
12
|
-
import { SkipLink as
|
|
13
|
-
function
|
|
14
|
-
const
|
|
15
|
-
e && /* @__PURE__ */ a(
|
|
2
|
+
import { jsxs as t, jsx as a, Fragment as y } from "react/jsx-runtime";
|
|
3
|
+
import { useState as M, forwardRef as O } from "react";
|
|
4
|
+
import { Link as j } from "react-aria-components";
|
|
5
|
+
import { Menu as D } from "lucide-react";
|
|
6
|
+
import { cx as u, withBase as G } from "../../utils/cx.js";
|
|
7
|
+
import { useMediaQuery as I } from "../layout/Responsive.js";
|
|
8
|
+
import { IconButton as $ } from "../button/Button.js";
|
|
9
|
+
import { Drawer as A } from "../overlay/Drawer.js";
|
|
10
|
+
import { Dialog as F } from "../overlay/Overlay.js";
|
|
11
|
+
import { useStrings as g } from "../../i18n/strings.js";
|
|
12
|
+
import { SkipLink as P } from "../more/More.js";
|
|
13
|
+
function X({ brand: s, headerEnd: l, sidebar: e, children: r, sidebarWidth: d = 248, collapseBelow: n = 900, mainAs: c = "main", layout: o = "header", contentSize: m, skipLink: i, bottomBar: p, className: b }) {
|
|
14
|
+
const f = g(), x = c, [S, h] = M(!1), C = I(`(max-width: ${n - 0.02}px)`), v = /* @__PURE__ */ t("header", { className: "alea-shell-header", children: [
|
|
15
|
+
e && /* @__PURE__ */ a($, { "aria-label": f.openNavigation, className: "alea-shell-menu", onPress: () => h(!0), children: /* @__PURE__ */ a(D, {}) }),
|
|
16
16
|
s && /* @__PURE__ */ a("div", { className: "alea-shell-brand", children: s }),
|
|
17
17
|
l && /* @__PURE__ */ a("div", { className: "alea-shell-end", children: l })
|
|
18
|
-
] }),
|
|
19
|
-
return /* @__PURE__ */ t("div", { className: u("alea-shell",
|
|
20
|
-
i !== !1 && /* @__PURE__ */ a(
|
|
21
|
-
o === "header" &&
|
|
18
|
+
] }), N = /* @__PURE__ */ a(x, { id: "alea-main", className: "alea-shell-main", tabIndex: -1, children: m && m !== "full" ? /* @__PURE__ */ a("div", { className: "alea-shell-content", "data-size": m, children: r }) : r });
|
|
19
|
+
return /* @__PURE__ */ t("div", { className: u("alea-shell", b), style: { "--alea-shell-sidebar": `${d}px` }, "data-layout": o, "data-collapse": n, "data-collapsed": C || void 0, "data-custom-collapse": n !== 900 || void 0, children: [
|
|
20
|
+
i !== !1 && /* @__PURE__ */ a(P, { target: (i == null ? void 0 : i.target) ?? "alea-main", children: i == null ? void 0 : i.label }),
|
|
21
|
+
o === "header" && v,
|
|
22
22
|
/* @__PURE__ */ t("div", { className: "alea-shell-body", children: [
|
|
23
23
|
e && /* @__PURE__ */ a("aside", { className: "alea-shell-sidebar", children: e }),
|
|
24
24
|
o === "sidebar" ? /* @__PURE__ */ t("div", { className: "alea-shell-panel", children: [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
] }) :
|
|
25
|
+
v,
|
|
26
|
+
N
|
|
27
|
+
] }) : N
|
|
28
28
|
] }),
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
p && /* @__PURE__ */ a("div", { className: "alea-shell-bottom", children: p }),
|
|
30
|
+
e && /* @__PURE__ */ a(A, { isOpen: S, onOpenChange: h, placement: "start", size: 300, children: /* @__PURE__ */ a(F, { "aria-label": f.navigation, hideClose: !0, className: "alea-shell-drawer", children: () => /* @__PURE__ */ a("div", { onClickCapture: (w) => {
|
|
31
|
+
w.target.closest("a") && h(!1);
|
|
31
32
|
}, children: e }) }) })
|
|
32
33
|
] });
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
-
const r =
|
|
35
|
+
function Y({ children: s, className: l, "aria-label": e }) {
|
|
36
|
+
const r = g();
|
|
36
37
|
return e ?? (e = r.mainNav), /* @__PURE__ */ a("nav", { "aria-label": e, className: u("alea-sidenav", l), children: s });
|
|
37
38
|
}
|
|
38
|
-
const
|
|
39
|
+
const Z = O(function({ title: l, children: e, className: r, ...d }, n) {
|
|
39
40
|
return /* @__PURE__ */ t("div", { ref: n, ...d, className: u("alea-sidenav-group", r), children: [
|
|
40
41
|
l && /* @__PURE__ */ a("p", { className: "alea-sidenav-title", children: l }),
|
|
41
42
|
/* @__PURE__ */ a("ul", { children: e })
|
|
42
43
|
] });
|
|
43
44
|
});
|
|
44
|
-
function
|
|
45
|
-
return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
|
|
45
|
+
function _({ isCurrent: s, icon: l, end: e, children: r, className: d, ...n }) {
|
|
46
|
+
return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(j, { ...n, "aria-current": s ? "page" : void 0, className: G("alea-sidenav-link alea-focus-ring", d), children: (c) => /* @__PURE__ */ t(y, { children: [
|
|
46
47
|
l && /* @__PURE__ */ a("span", { className: "alea-sidenav-icon", "aria-hidden": "true", children: l }),
|
|
47
48
|
/* @__PURE__ */ a("span", { className: "alea-sidenav-label", children: typeof r == "function" ? r(c) : r }),
|
|
48
49
|
e && /* @__PURE__ */ a("span", { className: "alea-sidenav-end", children: e })
|
|
49
50
|
] }) }) });
|
|
50
51
|
}
|
|
51
52
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
X as AppShell,
|
|
54
|
+
Z as SidebarGroup,
|
|
55
|
+
_ as SidebarLink,
|
|
56
|
+
Y as SidebarNav
|
|
56
57
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type TableProps as RACTableProps, type TableHeaderProps, type ColumnProps as RACColumnProps, type TableBodyProps, type TableFooterProps as RACTableFooterProps, type RowProps, type CellProps } from 'react-aria-components';
|
|
3
3
|
import { type SurfaceProps } from '../surface/Surface.js';
|
|
4
|
+
import type { RowMotion } from '@alea-design/motion';
|
|
4
5
|
export interface TableProps extends RACTableProps, SurfaceProps {
|
|
5
6
|
/** Header stays visible while the body scrolls (needs a height on the container). */
|
|
6
7
|
stickyHeader?: boolean;
|
|
@@ -18,6 +19,8 @@ export interface TableProps extends RACTableProps, SurfaceProps {
|
|
|
18
19
|
stackHideEmpty?: boolean;
|
|
19
20
|
/** With a TableFooter, keeps the footer (the totals row) visible while the body scrolls. Needs a height on the container (maxHeight), like stickyHeader. */
|
|
20
21
|
stickyFooter?: boolean;
|
|
22
|
+
/** Keeps every cell and header on one line, so a column is as wide as its longest value and the table scrolls sideways when it does not fit (a ledger of references, dates and amounts). Default: text wraps inside its cell. */
|
|
23
|
+
noWrap?: boolean;
|
|
21
24
|
/** Names the table's scroll area when the table is wider than its container (a narrow screen). The area then becomes a labelled region that takes focus, so the keyboard can scroll it sideways. Nothing changes while the table fits. */
|
|
22
25
|
scrollLabel?: string;
|
|
23
26
|
/** Renders only the rows on screen, for thousands of rows: fixed row height in px (needs maxHeight). */
|
|
@@ -26,7 +29,7 @@ export interface TableProps extends RACTableProps, SurfaceProps {
|
|
|
26
29
|
headingHeight?: number;
|
|
27
30
|
};
|
|
28
31
|
}
|
|
29
|
-
export declare function Table({ stickyHeader, density: densityRaw, maxHeight, resizable, variant, stackBelow, stackHideEmpty, stickyFooter, scrollLabel, virtualized, surface, radius, className, ...props }: TableProps): import("react").JSX.Element;
|
|
32
|
+
export declare function Table({ stickyHeader, density: densityRaw, maxHeight, resizable, variant, stackBelow, stackHideEmpty, stickyFooter, scrollLabel, noWrap, virtualized, surface, radius, className, ...props }: TableProps): import("react").JSX.Element;
|
|
30
33
|
/** The header row. Adds the select-all checkbox when the table selects multiple rows. */
|
|
31
34
|
export declare function TableHeader<T extends object>({ columns, children, className, ...props }: TableHeaderProps<T>): import("react").JSX.Element;
|
|
32
35
|
export interface ColumnProps extends RACColumnProps {
|
|
@@ -37,8 +40,8 @@ export interface ColumnProps extends RACColumnProps {
|
|
|
37
40
|
/** A column header; allowsSorting shows the sort arrow and makes it pressable. */
|
|
38
41
|
export declare function Column({ children, align, className, ...props }: ColumnProps): import("react").JSX.Element;
|
|
39
42
|
export interface AnimatedTableBodyProps<T extends object> extends TableBodyProps<T> {
|
|
40
|
-
/** Rows added to `items` rise in (staggered), and rows removed dissolve before they leave. Needs items with an id and a render function as children. The removed row is disabled while it leaves. Off by default; reduced motion keeps only the fades. */
|
|
41
|
-
animateRows?:
|
|
43
|
+
/** Rows added to `items` rise in (staggered), and rows removed dissolve before they leave. Needs items with an id and a render function as children. The removed row is disabled while it leaves. Off by default; reduced motion keeps only the fades. Pass an object to decide when: `max` rows above which nothing animates, `resetOn` values (search, filter, page) whose change is not news, `enter` and `leave` to animate only one of the two. */
|
|
44
|
+
animateRows?: RowMotion;
|
|
42
45
|
}
|
|
43
46
|
/** The rows. renderEmptyState shows when there are none. */
|
|
44
47
|
export declare function TableBody<T extends object>({ className, animateRows, items: itemsIn, children: childrenIn, dependencies: depsIn, ...props }: AnimatedTableBodyProps<T>): import("react").JSX.Element;
|