@alea-design/ui 0.6.0 → 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.
@@ -1,78 +1,78 @@
1
1
  "use client";
2
- import { jsx as a, jsxs as m, Fragment as h } from "react/jsx-runtime";
3
- import { forwardRef as g, useId as j } from "react";
4
- import { Dialog as T, Heading as b, ModalOverlay as L, Modal as O, Popover as R, OverlayArrow as x, Button as S, Tooltip as H, TooltipTrigger as V } from "react-aria-components";
5
- import { DialogTrigger as da } from "react-aria-components";
6
- import { X as B } from "lucide-react";
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 M, withBase as v } from "../../utils/cx.js";
9
- import { Button as P, IconButton as X } from "../button/Button.js";
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 q } from "../../utils/vocabulary.js";
12
- import { surfaceAttrs as z } from "../surface/Surface.js";
13
- import { useInitialFocus as E } from "../../utils/initialFocus.js";
14
- const la = g(function({ children: e, showArrow: o, className: l, offset: i = 8, motion: r, style: s, size: n, surface: c, radius: d, ...t }, u) {
15
- return /* @__PURE__ */ m(R, { ...t, ref: u, offset: o ? 12 : i, "data-size": n, ...z({ surface: c, radius: d }), className: v("alea-popover", l), style: f(s, r), children: [
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
- }), ra = g(function({ title: e, description: o, footer: l, showClose: i, children: r, className: s, ...n }, c) {
20
- const d = N();
21
- return /* @__PURE__ */ a(T, { ...n, ref: c, className: M("alea-popover-dialog", s), children: (t) => /* @__PURE__ */ m(h, { children: [
22
- (e || i) && /* @__PURE__ */ m("div", { className: "alea-popover-head", children: [
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
- i && /* @__PURE__ */ a(S, { className: "alea-popover-close alea-focus-ring", "aria-label": d.close, onPress: t.close, children: /* @__PURE__ */ a(B, { size: 16, "aria-hidden": "true" }) })
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 r == "function" ? r(t) : r,
28
- l && /* @__PURE__ */ a("div", { className: "alea-popover-footer", children: typeof l == "function" ? l(t.close) : 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 ia({ children: p, title: e, shortcut: o, hideArrow: l, className: i, offset: r = 8, motion: s, style: n, ...c }) {
32
- return /* @__PURE__ */ m(H, { ...c, offset: r, className: v("alea-tooltip", i), "data-rich": e ? !0 : void 0, style: f(n, s), children: [
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__ */ m("span", { className: "alea-tooltip-text", children: [
36
- p,
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 ta({ delay: p = 600, closeDelay: e = 200, ...o }) {
42
- return /* @__PURE__ */ a(V, { ...o, delay: p, closeDelay: e });
41
+ function sa({ delay: d = 600, closeDelay: e = 200, ...o }) {
42
+ return /* @__PURE__ */ a(X, { ...o, delay: d, closeDelay: e });
43
43
  }
44
- const G = g(function({ title: e, description: o, children: l, footer: i, hideClose: r, className: s, ...n }, c) {
45
- const d = N();
46
- return /* @__PURE__ */ a(T, { ...n, ref: c, className: M("alea-dialog", s), children: ({ close: t }) => /* @__PURE__ */ m(h, { children: [
47
- (e || !r) && /* @__PURE__ */ m("div", { className: "alea-dialog-head", children: [
48
- e && /* @__PURE__ */ a(b, { slot: "title", className: "alea-dialog-title", children: e }),
49
- !r && /* @__PURE__ */ a(X, { "aria-label": d.close, size: "sm", variant: "ghost", onPress: t, className: "alea-dialog-x", children: /* @__PURE__ */ a(B, {}) })
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: t }) : l }),
53
- i && /* @__PURE__ */ a("div", { className: "alea-dialog-footer", children: typeof i == "function" ? i({ close: t }) : i })
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 J({ children: p, size: e = "md", fullscreenBelow: o, className: l, isDismissable: i = !0, motion: r, backdrop: s, initialFocus: n, surface: c, radius: d, ...t }) {
57
- const u = E(n);
58
- return /* @__PURE__ */ a(L, { ...t, isDismissable: i, className: v("alea-modal-overlay", l), "data-backdrop": s, "data-fullscreen-below": o, children: /* @__PURE__ */ a(O, { ref: u, className: "alea-modal", "data-size": e, "data-fullscreen-below": o, ...z({ surface: c, radius: d }), style: f(void 0, r), children: p }) });
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 sa = g(function({ motion: e, backdrop: o, initialFocus: l = "confirm", title: i, children: r, confirmLabel: s, cancelLabel: n, tone: c, onConfirm: d, isOpen: t, defaultOpen: u, onOpenChange: $, className: A, style: I }, k) {
61
- const y = j(), F = q("AlertDialog", "tone", c, { default: "neutral" }) ?? "neutral", D = N();
62
- return s ?? (s = D.confirm), n ?? (n = D.cancel), /* @__PURE__ */ a(J, { isOpen: t, defaultOpen: u, onOpenChange: $, isDismissable: !1, size: "sm", motion: e, backdrop: o, children: /* @__PURE__ */ a(G, { ref: k, className: A, style: I, role: "alertdialog", "aria-describedby": r ? y : void 0, title: i, hideClose: !0, footer: ({ close: w }) => /* @__PURE__ */ m(h, { children: [
63
- /* @__PURE__ */ a(P, { variant: "ghost", autoFocus: l === "cancel", onPress: w, children: n }),
64
- /* @__PURE__ */ a(P, { variant: F === "danger" ? "danger" : "primary", autoFocus: l === "confirm", onPress: async () => {
65
- await (d == null ? void 0 : d()), w();
66
- }, children: s })
67
- ] }), children: r ? /* @__PURE__ */ a("div", { id: y, style: { display: "contents" }, children: r }) : null }) });
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
- sa as AlertDialog,
71
- G as Dialog,
72
- J as DialogModal,
73
- da as DialogTrigger,
74
- la as Popover,
75
- ra as PopoverDialog,
76
- ia as Tooltip,
77
- ta as TooltipTrigger
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. */
@@ -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 o, jsx as e, Fragment as H } from "react/jsx-runtime";
3
- import { useRef as L, useState as I, useEffect as x, createElement as M, forwardRef as T } from "react";
4
- import { Info as j, MoreHorizontal as F, ArrowLeft as S } from "lucide-react";
5
- import { cx as B } from "../../utils/cx.js";
6
- import { Button as k, IconButton as D } from "../button/Button.js";
7
- import { Breadcrumbs as K, Breadcrumb as O } from "../navigation/Navigation.js";
8
- import { DropdownMenu as R, MenuItem as $ } from "../menu/Menu.js";
9
- import { useStrings as y } from "../../i18n/strings.js";
10
- import { inertProps as q } from "../../utils/inert.js";
11
- function _({ title: u, subtitle: r, back: i, backLabel: c, breadcrumbs: l, media: v, meta: f, actions: g, secondaryActions: n, tabs: d, headingLevel: N = 1, sticky: s, compact: m, className: h }) {
12
- const p = y(), b = L(null), [w, C] = I(!1);
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 a = b.current;
15
- if (!s || !a || typeof IntersectionObserver > "u") return;
16
- const t = document.createElement("div");
17
- a.before(t);
18
- const z = new IntersectionObserver(([P]) => C(!P.isIntersecting));
19
- return z.observe(t), () => {
20
- z.disconnect(), t.remove();
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
- }, [s]);
23
- const E = n != null && n.length ? /* @__PURE__ */ o(H, { children: [
24
- /* @__PURE__ */ e("div", { className: "alea-page-header-secondary", children: n.map((a) => /* @__PURE__ */ e(k, { variant: "ghost", size: "sm", iconStart: a.icon, href: a.href, onPress: a.onAction, isDisabled: a.isDisabled, tone: a.tone === "danger" ? "danger" : void 0, children: a.label }, String(a.id))) }),
25
- /* @__PURE__ */ e("div", { className: "alea-page-header-more", children: /* @__PURE__ */ e(
26
- R,
27
- {
28
- "aria-label": p.moreActions,
29
- placement: "bottom end",
30
- trigger: /* @__PURE__ */ e(D, { "aria-label": p.moreActions, size: "sm", children: /* @__PURE__ */ e(F, {}) }),
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__ */ 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 })
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
- r && /* @__PURE__ */ e("p", { className: "alea-page-header-subtitle", children: r })
57
+ a && /* @__PURE__ */ e("p", { className: "alea-page-header-subtitle", children: a })
50
58
  ] }),
51
- (g || E) && /* @__PURE__ */ o("div", { className: "alea-page-header-actions", children: [
59
+ (N || E) && /* @__PURE__ */ l("div", { className: "alea-page-header-actions", children: [
52
60
  E,
53
- g
61
+ N
54
62
  ] })
55
63
  ] }),
56
- d && /* @__PURE__ */ e("div", { className: "alea-page-header-tabs", children: d })
64
+ v && /* @__PURE__ */ e("div", { className: "alea-page-header-tabs", children: v })
57
65
  ] });
58
66
  }
59
- const V = T(function({ isVisible: r, message: i, onSave: c, onDiscard: l, isSaving: v, saveLabel: f, discardLabel: g, position: n = "top", saveShortcut: d = !0, className: N, ...s }, m) {
60
- const h = y(), p = L(c);
61
- return p.current = c, x(() => {
62
- if (!r || !d) return;
63
- const b = (w) => {
64
- (w.metaKey || w.ctrlKey) && w.key.toLowerCase() === "s" && (w.preventDefault(), p.current());
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", b), () => window.removeEventListener("keydown", b);
67
- }, [r, d]), /* @__PURE__ */ o("div", { ref: m, ...s, className: B("alea-savebar", N), "data-visible": r || void 0, "data-position": n, role: "region", "aria-label": s["aria-label"] ?? h.unsavedChanges, "aria-hidden": !r || void 0, ...q(!r), children: [
68
- /* @__PURE__ */ e("p", { className: "alea-savebar-message", "aria-live": "polite", children: r ? i ?? h.unsavedChanges : "" }),
69
- /* @__PURE__ */ o("div", { className: "alea-savebar-actions", children: [
70
- l && /* @__PURE__ */ e(k, { variant: "ghost", size: "sm", onPress: l, isDisabled: v, children: g ?? h.discard }),
71
- /* @__PURE__ */ e(k, { size: "sm", variant: "secondary", onPress: c, isLoading: v, shortcut: d ? "⌘S" : void 0, children: f ?? h.save })
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
- }), ee = T(function({ isLoading: r, value: i, "aria-label": c, className: l, ...v }, f) {
75
- const g = y(), [n, d] = I(r), [N, s] = I(!1);
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 (r) {
78
- d(!0), s(!1);
85
+ if (a) {
86
+ h(!0), p(!1);
79
87
  return;
80
88
  }
81
- if (!n) return;
82
- s(!0);
83
- const h = setTimeout(() => {
84
- d(!1), s(!1);
89
+ if (!d) return;
90
+ p(!0);
91
+ const u = setTimeout(() => {
92
+ h(!1), p(!1);
85
93
  }, 500);
86
- return () => clearTimeout(h);
87
- }, [r]), !n) return null;
88
- const m = N ? 100 : i;
89
- return /* @__PURE__ */ e("div", { ref: f, ...v, className: B("alea-top-loading", l), role: "progressbar", "aria-label": c ?? g.loading, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": m, "data-done": N || void 0, "data-indeterminate": m == null || void 0, children: /* @__PURE__ */ e("span", { className: "alea-top-loading-bar", style: m != null ? { width: `${m}%` } : void 0 }) });
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 ae({ children: u, className: r }) {
92
- return /* @__PURE__ */ o("p", { className: B("alea-footer-help", r), children: [
93
- /* @__PURE__ */ e(j, { size: 16, "aria-hidden": "true" }),
94
- /* @__PURE__ */ e("span", { children: u })
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 re({ primary: u, secondary: r, className: i }) {
98
- return /* @__PURE__ */ o("div", { className: B("alea-page-actions", i), children: [
99
- /* @__PURE__ */ e("div", { className: "alea-page-actions-secondary", children: r }),
100
- /* @__PURE__ */ e("div", { className: "alea-page-actions-primary", children: u })
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
- ae as FooterHelp,
105
- re as PageActions,
106
- _ as PageHeader,
107
- V as SaveBar,
108
- ee as TopLoadingBar
112
+ le as FooterHelp,
113
+ oe as PageActions,
114
+ ne as PageHeader,
115
+ te as SaveBar,
116
+ ie as TopLoadingBar
109
117
  };