@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.
Files changed (103) hide show
  1. package/dist/components/button/Button.d.ts +3 -1
  2. package/dist/components/button/Button.js +64 -63
  3. package/dist/components/card/Card.d.ts +6 -2
  4. package/dist/components/card/Card.js +20 -20
  5. package/dist/components/combobox/Autocomplete.d.ts +4 -0
  6. package/dist/components/combobox/Autocomplete.js +89 -87
  7. package/dist/components/command/CommandPalette.d.ts +10 -0
  8. package/dist/components/command/CommandPalette.js +82 -56
  9. package/dist/components/data/Data.d.ts +11 -7
  10. package/dist/components/data/Data.js +65 -55
  11. package/dist/components/date/Date.d.ts +16 -2
  12. package/dist/components/date/Date.js +80 -69
  13. package/dist/components/display/Display.d.ts +3 -1
  14. package/dist/components/display/Display.js +27 -27
  15. package/dist/components/display/Display2.d.ts +2 -2
  16. package/dist/components/display/Display2.js +28 -27
  17. package/dist/components/feedback/Feedback.d.ts +3 -1
  18. package/dist/components/feedback/Feedback.js +102 -102
  19. package/dist/components/feedback/PageSkeleton.d.ts +19 -0
  20. package/dist/components/feedback/PageSkeleton.js +58 -0
  21. package/dist/components/field/Field.d.ts +3 -1
  22. package/dist/components/field/Field.js +82 -82
  23. package/dist/components/filter/FilterBar.d.ts +5 -2
  24. package/dist/components/filter/FilterBar.js +97 -66
  25. package/dist/components/form/Form.d.ts +8 -2
  26. package/dist/components/form/Form.js +53 -40
  27. package/dist/components/icon/icon-names.d.ts +2 -2
  28. package/dist/components/icon/icon-names.js +4 -2
  29. package/dist/components/list/List.d.ts +6 -2
  30. package/dist/components/list/List.js +65 -62
  31. package/dist/components/list/Lists2.d.ts +4 -0
  32. package/dist/components/list/Lists2.js +35 -35
  33. package/dist/components/media/Media.d.ts +5 -1
  34. package/dist/components/media/Media.js +115 -113
  35. package/dist/components/more/More.d.ts +2 -2
  36. package/dist/components/more/More.js +46 -45
  37. package/dist/components/navigation/Navigation.d.ts +11 -5
  38. package/dist/components/navigation/Navigation.js +97 -80
  39. package/dist/components/navigation/Navigation2.d.ts +9 -3
  40. package/dist/components/navigation/Navigation2.js +208 -194
  41. package/dist/components/notification/NotificationCenter.js +70 -70
  42. package/dist/components/overlay/Drawer.d.ts +6 -1
  43. package/dist/components/overlay/Drawer.js +27 -25
  44. package/dist/components/overlay/Modal.d.ts +5 -0
  45. package/dist/components/overlay/Modal.js +16 -15
  46. package/dist/components/overlay/Overlay.d.ts +14 -1
  47. package/dist/components/overlay/Overlay.js +52 -50
  48. package/dist/components/overlay/Sheet.d.ts +2 -0
  49. package/dist/components/overlay/Sheet.js +30 -30
  50. package/dist/components/page/PageParts.d.ts +6 -2
  51. package/dist/components/page/PageParts.js +92 -84
  52. package/dist/components/select/Select.js +75 -70
  53. package/dist/components/settings/Settings.d.ts +29 -0
  54. package/dist/components/settings/Settings.js +31 -0
  55. package/dist/components/shell/AccountMenu.d.ts +20 -0
  56. package/dist/components/shell/AccountMenu.js +32 -0
  57. package/dist/components/shell/AppShell.d.ts +9 -2
  58. package/dist/components/shell/AppShell.js +37 -37
  59. package/dist/components/shell/AppSidebar.d.ts +9 -3
  60. package/dist/components/shell/AppSidebar.js +45 -39
  61. package/dist/components/table/Table.d.ts +18 -4
  62. package/dist/components/table/Table.js +70 -46
  63. package/dist/components/tabs/Tabs.js +105 -94
  64. package/dist/components/theme/Theme.d.ts +7 -4
  65. package/dist/components/theme/Theme.js +127 -130
  66. package/dist/components/upload/Upload.js +62 -54
  67. package/dist/css/base.css +1 -1
  68. package/dist/css/button.css +1 -1
  69. package/dist/css/card.css +1 -1
  70. package/dist/css/command.css +1 -1
  71. package/dist/css/data.css +1 -1
  72. package/dist/css/date.css +1 -1
  73. package/dist/css/display.css +1 -1
  74. package/dist/css/feedback.css +1 -1
  75. package/dist/css/field.css +1 -1
  76. package/dist/css/form.css +1 -1
  77. package/dist/css/groups.json +37 -21
  78. package/dist/css/list.css +1 -1
  79. package/dist/css/menu.css +1 -1
  80. package/dist/css/navigation.css +1 -1
  81. package/dist/css/notification.css +1 -1
  82. package/dist/css/overlay.css +1 -1
  83. package/dist/css/page.css +1 -1
  84. package/dist/css/select.css +1 -1
  85. package/dist/css/settings.css +1 -0
  86. package/dist/css/shell.css +1 -1
  87. package/dist/css/table.css +1 -1
  88. package/dist/css/tabs.css +1 -1
  89. package/dist/css/upload.css +1 -1
  90. package/dist/i18n/strings.d.ts +9 -0
  91. package/dist/i18n/strings.js +18 -0
  92. package/dist/index.d.ts +4 -0
  93. package/dist/index.js +318 -306
  94. package/dist/styles.css +1 -1
  95. package/dist/utils/animateRows.d.ts +11 -0
  96. package/dist/utils/animateRows.js +23 -0
  97. package/dist/utils/decimal.d.ts +12 -0
  98. package/dist/utils/decimal.js +48 -0
  99. package/dist/utils/initialFocus.d.ts +6 -0
  100. package/dist/utils/initialFocus.js +24 -0
  101. package/dist/utils/refs.d.ts +2 -0
  102. package/dist/utils/refs.js +14 -6
  103. package/package.json +3 -3
@@ -1,76 +1,78 @@
1
1
  "use client";
2
- import { jsx as a, jsxs as p, Fragment as u } from "react/jsx-runtime";
3
- import { forwardRef as g } from "react";
4
- import { Dialog as P, Heading as T, ModalOverlay as j, Modal as k, Popover as F, OverlayArrow as x, Button as L, Tooltip as O, TooltipTrigger as S } from "react-aria-components";
5
- import { DialogTrigger as ra } from "react-aria-components";
6
- import { X as b } from "lucide-react";
7
- import { withMotionStyle as v } from "@alea-design/motion";
8
- import { cx as B, withBase as f } from "../../utils/cx.js";
9
- import { Button as w, IconButton as H } from "../button/Button.js";
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 I } from "../../utils/vocabulary.js";
11
+ import { renamedValue as E } from "../../utils/vocabulary.js";
12
12
  import { surfaceAttrs as M } from "../surface/Surface.js";
13
- const Z = g(function({ children: e, showArrow: o, className: l, offset: r = 8, motion: i, style: s, size: t, surface: n, radius: m, ...c }, h) {
14
- return /* @__PURE__ */ p(F, { ...c, ref: h, offset: o ? 12 : r, "data-size": t, ...M({ surface: n, radius: m }), className: f("alea-popover", l), style: v(s, i), children: [
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
- }), _ = g(function({ title: e, description: o, footer: l, showClose: r, children: i, className: s, ...t }, n) {
19
- const m = N();
20
- return /* @__PURE__ */ a(P, { ...t, ref: n, className: B("alea-popover-dialog", s), children: (c) => /* @__PURE__ */ p(u, { children: [
21
- (e || r) && /* @__PURE__ */ p("div", { className: "alea-popover-head", children: [
22
- e && /* @__PURE__ */ a(T, { slot: "title", className: "alea-popover-title", children: e }),
23
- r && /* @__PURE__ */ a(L, { className: "alea-popover-close alea-focus-ring", "aria-label": m.close, onPress: c.close, children: /* @__PURE__ */ a(b, { size: 16, "aria-hidden": "true" }) })
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(c) : i,
27
- l && /* @__PURE__ */ a("div", { className: "alea-popover-footer", children: typeof l == "function" ? l(c.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 })
28
29
  ] }) });
29
30
  });
30
- function C({ children: d, title: e, shortcut: o, hideArrow: l, className: r, offset: i = 8, motion: s, style: t, ...n }) {
31
- return /* @__PURE__ */ p(O, { ...n, offset: i, className: f("alea-tooltip", r), "data-rich": e ? !0 : void 0, style: v(t, 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: [
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__ */ p("span", { className: "alea-tooltip-text", children: [
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 aa({ delay: d = 600, closeDelay: e = 200, ...o }) {
41
- return /* @__PURE__ */ a(S, { ...o, delay: d, closeDelay: e });
41
+ function sa({ delay: d = 600, closeDelay: e = 200, ...o }) {
42
+ return /* @__PURE__ */ a(X, { ...o, delay: d, closeDelay: e });
42
43
  }
43
- const R = g(function({ title: e, description: o, children: l, footer: r, hideClose: i, className: s, ...t }, n) {
44
- const m = N();
45
- return /* @__PURE__ */ a(P, { ...t, ref: n, className: B("alea-dialog", s), children: ({ close: c }) => /* @__PURE__ */ p(u, { children: [
46
- (e || !i) && /* @__PURE__ */ p("div", { className: "alea-dialog-head", children: [
47
- e && /* @__PURE__ */ a(T, { slot: "title", className: "alea-dialog-title", children: e }),
48
- !i && /* @__PURE__ */ a(H, { "aria-label": m.close, size: "sm", variant: "ghost", onPress: c, 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, {}) })
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: c }) : l }),
52
- r && /* @__PURE__ */ a("div", { className: "alea-dialog-footer", children: typeof r == "function" ? r({ close: c }) : r })
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 V({ children: d, size: e = "md", fullscreenBelow: o, className: l, isDismissable: r = !0, motion: i, surface: s, radius: t, ...n }) {
56
- return /* @__PURE__ */ a(j, { ...n, isDismissable: r, className: f("alea-modal-overlay", l), "data-fullscreen-below": o, children: /* @__PURE__ */ a(k, { className: "alea-modal", "data-size": e, "data-fullscreen-below": o, ...M({ surface: s, radius: t }), style: v(void 0, i), children: d }) });
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 ea = g(function({ motion: e, title: o, children: l, confirmLabel: r, cancelLabel: i, tone: s, onConfirm: t, isOpen: n, defaultOpen: m, onOpenChange: c, className: h, style: z }, $) {
59
- const A = I("AlertDialog", "tone", s, { default: "neutral" }) ?? "neutral", y = N();
60
- return r ?? (r = y.confirm), i ?? (i = y.cancel), /* @__PURE__ */ a(V, { isOpen: n, defaultOpen: m, onOpenChange: c, isDismissable: !1, size: "sm", motion: e, children: /* @__PURE__ */ a(R, { ref: $, className: h, style: z, role: "alertdialog", title: o, hideClose: !0, footer: ({ close: D }) => /* @__PURE__ */ p(u, { children: [
61
- /* @__PURE__ */ a(w, { variant: "ghost", onPress: D, children: i }),
62
- /* @__PURE__ */ a(w, { variant: A === "danger" ? "danger" : "primary", autoFocus: !0, onPress: async () => {
63
- await (t == null ? void 0 : t()), D();
64
- }, children: r })
65
- ] }), children: l }) });
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
- ea as AlertDialog,
69
- R as Dialog,
70
- V as DialogModal,
71
- ra as DialogTrigger,
72
- Z as Popover,
73
- _ as PopoverDialog,
74
- C as Tooltip,
75
- aa 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
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 a } from "react/jsx-runtime";
3
- import { forwardRef as p, useContext as x } from "react";
4
- import { SheetTrigger as f, SheetOverlay as y, SheetBackdrop as A, Sheet as T, SheetContent as C, Heading as j, OverlayTriggerStateContext as k, Button as u } from "react-aria-components";
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 B = p(function({ position: s = "bottom", snapPoints: c, preventDismissal: t, title: e, description: n, footer: o, hideHandle: r, children: h, className: d, style: m, "aria-label": N }, b) {
8
- const v = !r && (s === "bottom" || s === "top");
9
- return /* @__PURE__ */ l(y, { position: s, snapPoints: c, preventDismissal: t, className: "alea-sheet-overlay", "data-position": s, children: [
10
- /* @__PURE__ */ a(A, { className: "alea-sheet-backdrop" }),
11
- /* @__PURE__ */ a(T, { ref: b, className: g("alea-sheet", d), style: m, "data-position": s, children: /* @__PURE__ */ l(C, { className: "alea-sheet-content", "aria-label": e ? void 0 : N, children: [
12
- v && /* @__PURE__ */ a("span", { className: "alea-sheet-handle", "aria-hidden": "true" }),
13
- (e || n) && /* @__PURE__ */ l("header", { className: "alea-sheet-head", children: [
14
- e && /* @__PURE__ */ a(j, { slot: "title", className: "alea-sheet-title", children: e }),
15
- n && /* @__PURE__ */ a("p", { className: "alea-sheet-desc", children: n })
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__ */ a("div", { className: "alea-sheet-body", children: h }),
18
- o && /* @__PURE__ */ a("footer", { className: "alea-sheet-foot", children: o })
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 L(i) {
23
- return /* @__PURE__ */ a(f, { ...i });
22
+ function R(i) {
23
+ return /* @__PURE__ */ e(f, { ...i });
24
24
  }
25
- function D({ actions: i, cancelLabel: s }) {
26
- const c = S(), t = x(k);
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__ */ a("ul", { className: "alea-action-sheet-list", children: i.map((e) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ l(u, { className: "alea-action-sheet-item alea-focus-ring", "data-tone": e.tone, isDisabled: e.isDisabled, onPress: () => {
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 = e.onAction) == null || n.call(e);
30
+ t == null || t.close(), (n = a.onAction) == null || n.call(a);
31
31
  }, children: [
32
- e.icon && /* @__PURE__ */ a("span", { className: "alea-action-sheet-icon", "aria-hidden": "true", children: e.icon }),
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__ */ a("span", { children: e.label }),
35
- e.description && /* @__PURE__ */ a("span", { className: "alea-action-sheet-desc", children: e.description })
34
+ /* @__PURE__ */ e("span", { children: a.label }),
35
+ a.description && /* @__PURE__ */ e("span", { className: "alea-action-sheet-desc", children: a.description })
36
36
  ] })
37
- ] }) }, e.id)) }),
38
- /* @__PURE__ */ a(u, { className: "alea-action-sheet-item alea-action-sheet-cancel alea-focus-ring", onPress: () => t == null ? void 0 : t.close(), children: s ?? c.cancel })
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 R = p(function({ trigger: s, title: c, description: t, actions: e, cancelLabel: n, isOpen: o, onOpenChange: r, className: h, style: d }, m) {
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__ */ a(B, { 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__ */ a(D, { actions: e, cancelLabel: n }) })
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
- R as ActionSheet,
50
- B as Sheet,
51
- L as SheetTrigger
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 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: p, subtitle: r, back: i, backLabel: c, breadcrumbs: l, media: u, meta: f, actions: g, secondaryActions: n, tabs: d, headingLevel: N = 1, sticky: s, compact: m, className: h }) {
12
- const v = 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": v.moreActions,
29
- placement: "bottom end",
30
- trigger: /* @__PURE__ */ e(D, { "aria-label": v.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(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 ?? v.back, variant: "ghost", size: "sm", href: i, className: "alea-page-header-back", children: /* @__PURE__ */ e(S, {}) }) : /* @__PURE__ */ e(D, { "aria-label": c ?? v.back, variant: "ghost", size: "sm", onPress: i, className: "alea-page-header-back", children: /* @__PURE__ */ e(S, {}) })),
43
- u && /* @__PURE__ */ e("span", { className: "alea-page-header-media", children: u }),
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" }, p),
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: u, saveLabel: f, discardLabel: g, position: n = "top", saveShortcut: d = !0, className: N, ...s }, m) {
60
- const h = y(), v = L(c);
61
- return v.current = c, x(() => {
62
- if (!r || !d) return;
63
- const b = (w) => {
64
- (w.metaKey || w.ctrlKey) && w.key.toLowerCase() === "s" && (w.preventDefault(), v.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: u, children: g ?? h.discard }),
71
- /* @__PURE__ */ e(k, { size: "sm", variant: "secondary", onPress: c, isLoading: u, 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, ...u }, 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, ...u, 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: p, 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: p })
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: p, 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: p })
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
  };