@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,76 +1,78 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as a, jsxs as
|
|
3
|
-
import { forwardRef as g } from "react";
|
|
4
|
-
import { Dialog as
|
|
5
|
-
import { DialogTrigger as
|
|
6
|
-
import { X as
|
|
7
|
-
import { withMotionStyle as
|
|
8
|
-
import { cx as B, withBase as
|
|
9
|
-
import { Button 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
|
+
import { withMotionStyle as f } from "@alea-design/motion";
|
|
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
|
|
11
|
+
import { renamedValue as E } from "../../utils/vocabulary.js";
|
|
12
12
|
import { surfaceAttrs as M } from "../surface/Surface.js";
|
|
13
|
-
|
|
14
|
-
|
|
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: [
|
|
15
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" }) }) }),
|
|
16
17
|
e
|
|
17
18
|
] });
|
|
18
|
-
}),
|
|
19
|
-
const
|
|
20
|
-
return /* @__PURE__ */ a(
|
|
21
|
-
(e || r) && /* @__PURE__ */
|
|
22
|
-
e && /* @__PURE__ */ a(
|
|
23
|
-
r && /* @__PURE__ */ a(
|
|
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
|
+
e && /* @__PURE__ */ a(b, { slot: "title", className: "alea-popover-title", children: e }),
|
|
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" }) })
|
|
24
25
|
] }),
|
|
25
26
|
o && /* @__PURE__ */ a("p", { className: "alea-popover-desc", children: o }),
|
|
26
|
-
typeof i == "function" ? i(
|
|
27
|
-
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 })
|
|
28
29
|
] }) });
|
|
29
30
|
});
|
|
30
|
-
function
|
|
31
|
-
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: [
|
|
32
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" }) }) }),
|
|
33
34
|
e && /* @__PURE__ */ a("span", { className: "alea-tooltip-title", children: e }),
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
+
/* @__PURE__ */ u("span", { className: "alea-tooltip-text", children: [
|
|
35
36
|
d,
|
|
36
37
|
o && /* @__PURE__ */ a("kbd", { className: "alea-tooltip-kbd", children: o })
|
|
37
38
|
] })
|
|
38
39
|
] });
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
-
return /* @__PURE__ */ a(
|
|
41
|
+
function sa({ delay: d = 600, closeDelay: e = 200, ...o }) {
|
|
42
|
+
return /* @__PURE__ */ a(X, { ...o, delay: d, closeDelay: e });
|
|
42
43
|
}
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
return /* @__PURE__ */ a(
|
|
46
|
-
(e || !i) && /* @__PURE__ */
|
|
47
|
-
e && /* @__PURE__ */ a(
|
|
48
|
-
!i && /* @__PURE__ */ a(
|
|
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, {}) })
|
|
49
50
|
] }),
|
|
50
51
|
o && /* @__PURE__ */ a("p", { className: "alea-dialog-description", children: o }),
|
|
51
|
-
l && /* @__PURE__ */ a("div", { className: "alea-dialog-body", children: typeof l == "function" ? l({ close:
|
|
52
|
-
r && /* @__PURE__ */ a("div", { className: "alea-dialog-footer", children: typeof r == "function" ? r({ close:
|
|
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 })
|
|
53
54
|
] }) });
|
|
54
55
|
});
|
|
55
|
-
function
|
|
56
|
-
|
|
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 }) });
|
|
57
59
|
}
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
return
|
|
61
|
-
/* @__PURE__ */ a(
|
|
62
|
-
/* @__PURE__ */ a(
|
|
63
|
-
await (
|
|
64
|
-
}, children:
|
|
65
|
-
] }), 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 }) });
|
|
66
68
|
});
|
|
67
69
|
export {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
|
76
78
|
};
|
|
@@ -13,6 +13,8 @@ export interface SheetProps {
|
|
|
13
13
|
description?: ReactNode;
|
|
14
14
|
/** Content pinned at the bottom: actions. */
|
|
15
15
|
footer?: ReactNode;
|
|
16
|
+
/** What is behind it: blur (a light blur on the dark layer, default) or dim (only the dark layer, no backdrop-filter). */
|
|
17
|
+
backdrop?: 'blur' | 'dim';
|
|
16
18
|
/** Hides the drag handle (it shows for bottom and top sheets). */
|
|
17
19
|
hideHandle?: boolean;
|
|
18
20
|
/** Name for screen readers when there is no title. */
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as l, jsx as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { SheetTrigger as f, SheetOverlay as
|
|
2
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as u, useContext as y } from "react";
|
|
4
|
+
import { SheetTrigger as f, SheetOverlay as A, SheetBackdrop as T, Sheet as k, SheetContent as C, Heading as j, OverlayTriggerStateContext as B, Button as p } from "react-aria-components";
|
|
5
5
|
import { useStrings as S } from "../../i18n/strings.js";
|
|
6
6
|
import { cx as g } from "../../utils/cx.js";
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
return /* @__PURE__ */ l(
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
/* @__PURE__ */
|
|
12
|
-
|
|
13
|
-
(
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
const D = u(function({ position: s = "bottom", snapPoints: c, preventDismissal: t, backdrop: a, title: n, description: o, footer: r, hideHandle: h, children: d, className: m, style: N, "aria-label": b }, v) {
|
|
8
|
+
const x = !h && (s === "bottom" || s === "top");
|
|
9
|
+
return /* @__PURE__ */ l(A, { position: s, snapPoints: c, preventDismissal: t, className: "alea-sheet-overlay", "data-position": s, "data-backdrop": a, children: [
|
|
10
|
+
/* @__PURE__ */ e(T, { className: "alea-sheet-backdrop" }),
|
|
11
|
+
/* @__PURE__ */ e(k, { ref: v, className: g("alea-sheet", m), style: N, "data-position": s, children: /* @__PURE__ */ l(C, { className: "alea-sheet-content", "aria-label": n ? void 0 : b, children: [
|
|
12
|
+
x && /* @__PURE__ */ e("span", { className: "alea-sheet-handle", "aria-hidden": "true" }),
|
|
13
|
+
(n || o) && /* @__PURE__ */ l("header", { className: "alea-sheet-head", children: [
|
|
14
|
+
n && /* @__PURE__ */ e(j, { slot: "title", className: "alea-sheet-title", children: n }),
|
|
15
|
+
o && /* @__PURE__ */ e("p", { className: "alea-sheet-desc", children: o })
|
|
16
16
|
] }),
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
|
|
17
|
+
/* @__PURE__ */ e("div", { className: "alea-sheet-body", children: d }),
|
|
18
|
+
r && /* @__PURE__ */ e("footer", { className: "alea-sheet-foot", children: r })
|
|
19
19
|
] }) })
|
|
20
20
|
] });
|
|
21
21
|
});
|
|
22
|
-
function
|
|
23
|
-
return /* @__PURE__ */
|
|
22
|
+
function R(i) {
|
|
23
|
+
return /* @__PURE__ */ e(f, { ...i });
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
const c = S(), t =
|
|
25
|
+
function O({ actions: i, cancelLabel: s }) {
|
|
26
|
+
const c = S(), t = y(B);
|
|
27
27
|
return /* @__PURE__ */ l("div", { className: "alea-action-sheet-body", children: [
|
|
28
|
-
/* @__PURE__ */
|
|
28
|
+
/* @__PURE__ */ e("ul", { className: "alea-action-sheet-list", children: i.map((a) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ l(p, { className: "alea-action-sheet-item alea-focus-ring", "data-tone": a.tone, isDisabled: a.isDisabled, onPress: () => {
|
|
29
29
|
var n;
|
|
30
|
-
t == null || t.close(), (n =
|
|
30
|
+
t == null || t.close(), (n = a.onAction) == null || n.call(a);
|
|
31
31
|
}, children: [
|
|
32
|
-
|
|
32
|
+
a.icon && /* @__PURE__ */ e("span", { className: "alea-action-sheet-icon", "aria-hidden": "true", children: a.icon }),
|
|
33
33
|
/* @__PURE__ */ l("span", { className: "alea-action-sheet-text", children: [
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
|
|
34
|
+
/* @__PURE__ */ e("span", { children: a.label }),
|
|
35
|
+
a.description && /* @__PURE__ */ e("span", { className: "alea-action-sheet-desc", children: a.description })
|
|
36
36
|
] })
|
|
37
|
-
] }) },
|
|
38
|
-
/* @__PURE__ */
|
|
37
|
+
] }) }, a.id)) }),
|
|
38
|
+
/* @__PURE__ */ e(p, { className: "alea-action-sheet-item alea-action-sheet-cancel alea-focus-ring", onPress: () => t == null ? void 0 : t.close(), children: s ?? c.cancel })
|
|
39
39
|
] });
|
|
40
40
|
}
|
|
41
|
-
const
|
|
41
|
+
const q = u(function({ trigger: s, title: c, description: t, actions: a, cancelLabel: n, isOpen: o, onOpenChange: r, className: h, style: d }, m) {
|
|
42
42
|
const N = S();
|
|
43
43
|
return /* @__PURE__ */ l(f, { isOpen: o, onOpenChange: r, children: [
|
|
44
44
|
s,
|
|
45
|
-
/* @__PURE__ */
|
|
45
|
+
/* @__PURE__ */ e(D, { ref: m, style: d, title: c, description: t, "aria-label": typeof c == "string" ? void 0 : N.options, className: g("alea-action-sheet", h), children: /* @__PURE__ */ e(O, { actions: a, cancelLabel: n }) })
|
|
46
46
|
] });
|
|
47
47
|
});
|
|
48
48
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
q as ActionSheet,
|
|
50
|
+
D as Sheet,
|
|
51
|
+
R as SheetTrigger
|
|
52
52
|
};
|
|
@@ -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. */
|
|
@@ -43,8 +47,8 @@ export interface PageHeaderProps {
|
|
|
43
47
|
/** Extra class names. */
|
|
44
48
|
className?: string;
|
|
45
49
|
}
|
|
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;
|
|
50
|
+
/** 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`. */
|
|
51
|
+
export declare function PageHeader({ title, subtitle, back, backLabel, breadcrumbs, media, meta, actions, secondaryActions, maxVisibleActions, tabs, headingLevel, sticky, compact, className }: PageHeaderProps): import("react").JSX.Element;
|
|
48
52
|
export interface SaveBarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
49
53
|
/** Show it while there are unsaved changes. */
|
|
50
54
|
isVisible: boolean;
|
|
@@ -1,109 +1,117 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useRef 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
|
-
function
|
|
12
|
-
|
|
2
|
+
import { jsxs as l, jsx as e, Fragment as F } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as T, useState as P, useEffect as x, createElement as K, forwardRef as C } from "react";
|
|
4
|
+
import { Info as R, ArrowLeft as S, MoreHorizontal as $ } from "lucide-react";
|
|
5
|
+
import { cx as b } from "../../utils/cx.js";
|
|
6
|
+
import { Button as D, IconButton as I } from "../button/Button.js";
|
|
7
|
+
import { Breadcrumbs as q, Breadcrumb as G } from "../navigation/Navigation.js";
|
|
8
|
+
import { DropdownMenu as J, MenuItem as Q } from "../menu/Menu.js";
|
|
9
|
+
import { useStrings as k } from "../../i18n/strings.js";
|
|
10
|
+
import { inertProps as U } from "../../utils/inert.js";
|
|
11
|
+
function L({ actions: o, label: a, className: i }) {
|
|
12
|
+
return /* @__PURE__ */ e("div", { className: i, children: /* @__PURE__ */ e(
|
|
13
|
+
J,
|
|
14
|
+
{
|
|
15
|
+
"aria-label": a,
|
|
16
|
+
placement: "bottom end",
|
|
17
|
+
trigger: /* @__PURE__ */ e(I, { "aria-label": a, size: "sm", children: /* @__PURE__ */ e($, {}) }),
|
|
18
|
+
menuProps: { onAction: (r) => {
|
|
19
|
+
var t, s;
|
|
20
|
+
return (s = (t = o.find((m) => m.id === r)) == null ? void 0 : t.onAction) == null ? void 0 : s.call(t);
|
|
21
|
+
} },
|
|
22
|
+
children: o.map((r) => /* @__PURE__ */ e(Q, { id: r.id, icon: r.icon, href: r.href, isDisabled: r.isDisabled, tone: r.tone, children: r.label }, String(r.id)))
|
|
23
|
+
}
|
|
24
|
+
) });
|
|
25
|
+
}
|
|
26
|
+
function ne({ title: o, subtitle: a, back: i, backLabel: r, breadcrumbs: t, media: s, meta: m, actions: N, secondaryActions: d, maxVisibleActions: h, tabs: v, headingLevel: p = 1, sticky: c, compact: u, className: y }) {
|
|
27
|
+
const f = k(), g = T(null), [H, O] = P(!1);
|
|
13
28
|
x(() => {
|
|
14
|
-
const
|
|
15
|
-
if (!
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
return
|
|
20
|
-
|
|
29
|
+
const n = g.current;
|
|
30
|
+
if (!c || !n || typeof IntersectionObserver > "u") return;
|
|
31
|
+
const w = document.createElement("div");
|
|
32
|
+
n.before(w);
|
|
33
|
+
const M = new IntersectionObserver(([A]) => O(!A.isIntersecting));
|
|
34
|
+
return M.observe(w), () => {
|
|
35
|
+
M.disconnect(), w.remove();
|
|
21
36
|
};
|
|
22
|
-
}, [
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
menuProps: { onAction: (a) => {
|
|
32
|
-
var t, z;
|
|
33
|
-
return (z = (t = n.find((P) => P.id === a)) == null ? void 0 : t.onAction) == null ? void 0 : z.call(t);
|
|
34
|
-
} },
|
|
35
|
-
children: n.map((a) => /* @__PURE__ */ e($, { id: a.id, icon: a.icon, href: a.href, isDisabled: a.isDisabled, tone: a.tone, children: a.label }, String(a.id)))
|
|
36
|
-
}
|
|
37
|
-
) })
|
|
37
|
+
}, [c]);
|
|
38
|
+
const j = Math.max(0, h ?? 1 / 0), z = [], B = [];
|
|
39
|
+
for (const n of d ?? []) (!n.menuOnly && z.length < j ? z : B).push(n);
|
|
40
|
+
const E = d != null && d.length ? /* @__PURE__ */ l(F, { children: [
|
|
41
|
+
/* @__PURE__ */ l("div", { className: "alea-page-header-secondary", children: [
|
|
42
|
+
z.map((n) => /* @__PURE__ */ e(D, { variant: "ghost", size: "sm", iconStart: n.icon, href: n.href, onPress: n.onAction, isDisabled: n.isDisabled, tone: n.tone === "danger" ? "danger" : void 0, children: n.label }, String(n.id))),
|
|
43
|
+
B.length > 0 && /* @__PURE__ */ e(L, { actions: B, label: f.moreActions })
|
|
44
|
+
] }),
|
|
45
|
+
/* @__PURE__ */ e(L, { actions: d, label: f.moreActions, className: "alea-page-header-more" })
|
|
38
46
|
] }) : null;
|
|
39
|
-
return /* @__PURE__ */
|
|
40
|
-
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
i && (typeof i == "string" ? /* @__PURE__ */ e(
|
|
43
|
-
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
return /* @__PURE__ */ l("header", { ref: g, className: b("alea-page-header", y), "data-sticky": c || void 0, "data-stuck": H || void 0, "data-compact": u || void 0, children: [
|
|
48
|
+
t != null && t.length ? /* @__PURE__ */ e("nav", { "aria-label": f.breadcrumb, children: /* @__PURE__ */ e(q, { className: "alea-page-header-crumbs", children: t.map((n, w) => /* @__PURE__ */ e(G, { href: w === t.length - 1 ? void 0 : n.href, children: n.label }, w)) }) }) : null,
|
|
49
|
+
/* @__PURE__ */ l("div", { className: "alea-page-header-main", children: [
|
|
50
|
+
i && (typeof i == "string" ? /* @__PURE__ */ e(I, { "aria-label": r ?? f.back, variant: "ghost", size: "sm", href: i, className: "alea-page-header-back", children: /* @__PURE__ */ e(S, {}) }) : /* @__PURE__ */ e(I, { "aria-label": r ?? f.back, variant: "ghost", size: "sm", onPress: i, className: "alea-page-header-back", children: /* @__PURE__ */ e(S, {}) })),
|
|
51
|
+
s && /* @__PURE__ */ e("span", { className: "alea-page-header-media", children: s }),
|
|
52
|
+
/* @__PURE__ */ l("div", { className: "alea-page-header-titles", children: [
|
|
53
|
+
/* @__PURE__ */ l("div", { className: "alea-page-header-title-row", children: [
|
|
54
|
+
K(`h${p}`, { className: "alea-page-header-title" }, o),
|
|
55
|
+
m && /* @__PURE__ */ e("div", { className: "alea-page-header-meta", children: m })
|
|
48
56
|
] }),
|
|
49
|
-
|
|
57
|
+
a && /* @__PURE__ */ e("p", { className: "alea-page-header-subtitle", children: a })
|
|
50
58
|
] }),
|
|
51
|
-
(
|
|
59
|
+
(N || E) && /* @__PURE__ */ l("div", { className: "alea-page-header-actions", children: [
|
|
52
60
|
E,
|
|
53
|
-
|
|
61
|
+
N
|
|
54
62
|
] })
|
|
55
63
|
] }),
|
|
56
|
-
|
|
64
|
+
v && /* @__PURE__ */ e("div", { className: "alea-page-header-tabs", children: v })
|
|
57
65
|
] });
|
|
58
66
|
}
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
return
|
|
62
|
-
if (!
|
|
63
|
-
const
|
|
64
|
-
(
|
|
67
|
+
const te = C(function({ isVisible: a, message: i, onSave: r, onDiscard: t, isSaving: s, saveLabel: m, discardLabel: N, position: d = "top", saveShortcut: h = !0, className: v, ...p }, c) {
|
|
68
|
+
const u = k(), y = T(r);
|
|
69
|
+
return y.current = r, x(() => {
|
|
70
|
+
if (!a || !h) return;
|
|
71
|
+
const f = (g) => {
|
|
72
|
+
(g.metaKey || g.ctrlKey) && g.key.toLowerCase() === "s" && (g.preventDefault(), y.current());
|
|
65
73
|
};
|
|
66
|
-
return window.addEventListener("keydown",
|
|
67
|
-
}, [
|
|
68
|
-
/* @__PURE__ */ e("p", { className: "alea-savebar-message", "aria-live": "polite", children:
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
|
|
71
|
-
/* @__PURE__ */ e(
|
|
74
|
+
return window.addEventListener("keydown", f), () => window.removeEventListener("keydown", f);
|
|
75
|
+
}, [a, h]), /* @__PURE__ */ l("div", { ref: c, ...p, className: b("alea-savebar", v), "data-visible": a || void 0, "data-position": d, role: "region", "aria-label": p["aria-label"] ?? u.unsavedChanges, "aria-hidden": !a || void 0, ...U(!a), children: [
|
|
76
|
+
/* @__PURE__ */ e("p", { className: "alea-savebar-message", "aria-live": "polite", children: a ? i ?? u.unsavedChanges : "" }),
|
|
77
|
+
/* @__PURE__ */ l("div", { className: "alea-savebar-actions", children: [
|
|
78
|
+
t && /* @__PURE__ */ e(D, { variant: "ghost", size: "sm", onPress: t, isDisabled: s, children: N ?? u.discard }),
|
|
79
|
+
/* @__PURE__ */ e(D, { size: "sm", variant: "secondary", onPress: r, isLoading: s, shortcut: h ? "⌘S" : void 0, children: m ?? u.save })
|
|
72
80
|
] })
|
|
73
81
|
] });
|
|
74
|
-
}),
|
|
75
|
-
const
|
|
82
|
+
}), ie = C(function({ isLoading: a, value: i, "aria-label": r, className: t, ...s }, m) {
|
|
83
|
+
const N = k(), [d, h] = P(a), [v, p] = P(!1);
|
|
76
84
|
if (x(() => {
|
|
77
|
-
if (
|
|
78
|
-
|
|
85
|
+
if (a) {
|
|
86
|
+
h(!0), p(!1);
|
|
79
87
|
return;
|
|
80
88
|
}
|
|
81
|
-
if (!
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
|
|
89
|
+
if (!d) return;
|
|
90
|
+
p(!0);
|
|
91
|
+
const u = setTimeout(() => {
|
|
92
|
+
h(!1), p(!1);
|
|
85
93
|
}, 500);
|
|
86
|
-
return () => clearTimeout(
|
|
87
|
-
}, [
|
|
88
|
-
const
|
|
89
|
-
return /* @__PURE__ */ e("div", { ref:
|
|
94
|
+
return () => clearTimeout(u);
|
|
95
|
+
}, [a]), !d) return null;
|
|
96
|
+
const c = v ? 100 : i;
|
|
97
|
+
return /* @__PURE__ */ e("div", { ref: m, ...s, className: b("alea-top-loading", t), role: "progressbar", "aria-label": r ?? N.loading, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": c, "data-done": v || void 0, "data-indeterminate": c == null || void 0, children: /* @__PURE__ */ e("span", { className: "alea-top-loading-bar", style: c != null ? { width: `${c}%` } : void 0 }) });
|
|
90
98
|
});
|
|
91
|
-
function
|
|
92
|
-
return /* @__PURE__ */
|
|
93
|
-
/* @__PURE__ */ e(
|
|
94
|
-
/* @__PURE__ */ e("span", { children:
|
|
99
|
+
function le({ children: o, className: a }) {
|
|
100
|
+
return /* @__PURE__ */ l("p", { className: b("alea-footer-help", a), children: [
|
|
101
|
+
/* @__PURE__ */ e(R, { size: 16, "aria-hidden": "true" }),
|
|
102
|
+
/* @__PURE__ */ e("span", { children: o })
|
|
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 oe({ primary: o, secondary: a, className: i }) {
|
|
106
|
+
return /* @__PURE__ */ l("div", { className: b("alea-page-actions", i), children: [
|
|
107
|
+
/* @__PURE__ */ e("div", { className: "alea-page-actions-secondary", children: a }),
|
|
108
|
+
/* @__PURE__ */ e("div", { className: "alea-page-actions-primary", children: o })
|
|
101
109
|
] });
|
|
102
110
|
}
|
|
103
111
|
export {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
112
|
+
le as FooterHelp,
|
|
113
|
+
oe as PageActions,
|
|
114
|
+
ne as PageHeader,
|
|
115
|
+
te as SaveBar,
|
|
116
|
+
ie as TopLoadingBar
|
|
109
117
|
};
|