@alea-design/ui 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) 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 +76 -52
  9. package/dist/components/data/Data.d.ts +6 -4
  10. package/dist/components/data/Data.js +66 -56
  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.js +27 -27
  34. package/dist/components/more/More.d.ts +2 -2
  35. package/dist/components/more/More.js +46 -45
  36. package/dist/components/navigation/Navigation.d.ts +7 -5
  37. package/dist/components/navigation/Navigation.js +91 -74
  38. package/dist/components/navigation/Navigation2.d.ts +9 -3
  39. package/dist/components/navigation/Navigation2.js +209 -195
  40. package/dist/components/notification/NotificationCenter.js +70 -70
  41. package/dist/components/overlay/Drawer.d.ts +6 -1
  42. package/dist/components/overlay/Drawer.js +27 -25
  43. package/dist/components/overlay/Modal.d.ts +5 -0
  44. package/dist/components/overlay/Modal.js +16 -15
  45. package/dist/components/overlay/Overlay.d.ts +10 -1
  46. package/dist/components/overlay/Overlay.js +54 -52
  47. package/dist/components/overlay/Sheet.d.ts +2 -0
  48. package/dist/components/overlay/Sheet.js +30 -30
  49. package/dist/components/page/PageParts.js +20 -20
  50. package/dist/components/select/Select.js +75 -70
  51. package/dist/components/settings/Settings.d.ts +29 -0
  52. package/dist/components/settings/Settings.js +31 -0
  53. package/dist/components/shell/AccountMenu.d.ts +20 -0
  54. package/dist/components/shell/AccountMenu.js +32 -0
  55. package/dist/components/shell/AppShell.d.ts +9 -2
  56. package/dist/components/shell/AppShell.js +37 -37
  57. package/dist/components/shell/AppSidebar.d.ts +9 -3
  58. package/dist/components/shell/AppSidebar.js +45 -39
  59. package/dist/components/table/Table.d.ts +18 -4
  60. package/dist/components/table/Table.js +70 -46
  61. package/dist/components/tabs/Tabs.js +105 -94
  62. package/dist/components/theme/Theme.d.ts +7 -4
  63. package/dist/components/theme/Theme.js +127 -130
  64. package/dist/components/upload/Upload.js +62 -54
  65. package/dist/css/base.css +1 -1
  66. package/dist/css/button.css +1 -1
  67. package/dist/css/card.css +1 -1
  68. package/dist/css/command.css +1 -1
  69. package/dist/css/date.css +1 -1
  70. package/dist/css/display.css +1 -1
  71. package/dist/css/feedback.css +1 -1
  72. package/dist/css/field.css +1 -1
  73. package/dist/css/form.css +1 -1
  74. package/dist/css/groups.json +36 -20
  75. package/dist/css/list.css +1 -1
  76. package/dist/css/menu.css +1 -1
  77. package/dist/css/navigation.css +1 -1
  78. package/dist/css/notification.css +1 -1
  79. package/dist/css/overlay.css +1 -1
  80. package/dist/css/page.css +1 -1
  81. package/dist/css/select.css +1 -1
  82. package/dist/css/settings.css +1 -0
  83. package/dist/css/shell.css +1 -1
  84. package/dist/css/table.css +1 -1
  85. package/dist/css/tabs.css +1 -1
  86. package/dist/css/upload.css +1 -1
  87. package/dist/i18n/strings.d.ts +7 -0
  88. package/dist/i18n/strings.js +14 -0
  89. package/dist/index.d.ts +4 -0
  90. package/dist/index.js +318 -306
  91. package/dist/styles.css +1 -1
  92. package/dist/utils/animateRows.d.ts +11 -0
  93. package/dist/utils/animateRows.js +23 -0
  94. package/dist/utils/decimal.d.ts +12 -0
  95. package/dist/utils/decimal.js +48 -0
  96. package/dist/utils/initialFocus.d.ts +6 -0
  97. package/dist/utils/initialFocus.js +24 -0
  98. package/dist/utils/refs.d.ts +2 -0
  99. package/dist/utils/refs.js +14 -6
  100. package/package.json +3 -3
@@ -1,56 +1,56 @@
1
1
  "use client";
2
- import { jsxs as r, jsx as a, Fragment as S } from "react/jsx-runtime";
3
- import { useState as k, forwardRef as C } from "react";
4
- import { Link as w } from "react-aria-components";
5
- import { Menu as y } from "lucide-react";
6
- import { cx as m, withBase as L } from "../../utils/cx.js";
7
- import { useMediaQuery as M } from "../layout/Responsive.js";
8
- import { IconButton as O } from "../button/Button.js";
9
- import { Drawer as j } from "../overlay/Drawer.js";
10
- import { Dialog as D } from "../overlay/Overlay.js";
11
- import { useStrings as f } from "../../i18n/strings.js";
12
- import { SkipLink as G } from "../more/More.js";
13
- function J({ brand: s, headerEnd: l, sidebar: e, children: i, sidebarWidth: t = 248, collapseBelow: n = 900, mainAs: c = "main", layout: d = "header", className: v }) {
14
- const h = f(), N = c, [g, o] = k(!1), b = M(`(max-width: ${n - 0.02}px)`), p = /* @__PURE__ */ r("header", { className: "alea-shell-header", children: [
15
- e && /* @__PURE__ */ a(O, { "aria-label": h.openNavigation, className: "alea-shell-menu", onPress: () => o(!0), children: /* @__PURE__ */ a(y, {}) }),
2
+ import { jsxs as t, jsx as a, Fragment as w } from "react/jsx-runtime";
3
+ import { useState as y, forwardRef as M } from "react";
4
+ import { Link as O } from "react-aria-components";
5
+ import { Menu as j } from "lucide-react";
6
+ import { cx as u, withBase as D } from "../../utils/cx.js";
7
+ import { useMediaQuery as G } from "../layout/Responsive.js";
8
+ import { IconButton as I } from "../button/Button.js";
9
+ import { Drawer as $ } from "../overlay/Drawer.js";
10
+ import { Dialog as A } from "../overlay/Overlay.js";
11
+ import { useStrings as N } from "../../i18n/strings.js";
12
+ import { SkipLink as F } from "../more/More.js";
13
+ function V({ brand: s, headerEnd: l, sidebar: e, children: r, sidebarWidth: d = 248, collapseBelow: n = 900, mainAs: c = "main", layout: o = "header", contentSize: m, skipLink: i, className: g }) {
14
+ const p = N(), b = c, [x, h] = y(!1), S = G(`(max-width: ${n - 0.02}px)`), f = /* @__PURE__ */ t("header", { className: "alea-shell-header", children: [
15
+ e && /* @__PURE__ */ a(I, { "aria-label": p.openNavigation, className: "alea-shell-menu", onPress: () => h(!0), children: /* @__PURE__ */ a(j, {}) }),
16
16
  s && /* @__PURE__ */ a("div", { className: "alea-shell-brand", children: s }),
17
17
  l && /* @__PURE__ */ a("div", { className: "alea-shell-end", children: l })
18
- ] }), u = /* @__PURE__ */ a(N, { id: "alea-main", className: "alea-shell-main", tabIndex: -1, children: i });
19
- return /* @__PURE__ */ r("div", { className: m("alea-shell", v), style: { "--alea-shell-sidebar": `${t}px` }, "data-layout": d, "data-collapse": n, "data-collapsed": b || void 0, "data-custom-collapse": n !== 900 || void 0, children: [
20
- /* @__PURE__ */ a(G, { target: "alea-main" }),
21
- d === "header" && p,
22
- /* @__PURE__ */ r("div", { className: "alea-shell-body", children: [
18
+ ] }), v = /* @__PURE__ */ a(b, { id: "alea-main", className: "alea-shell-main", tabIndex: -1, children: m && m !== "full" ? /* @__PURE__ */ a("div", { className: "alea-shell-content", "data-size": m, children: r }) : r });
19
+ return /* @__PURE__ */ t("div", { className: u("alea-shell", g), style: { "--alea-shell-sidebar": `${d}px` }, "data-layout": o, "data-collapse": n, "data-collapsed": S || void 0, "data-custom-collapse": n !== 900 || void 0, children: [
20
+ i !== !1 && /* @__PURE__ */ a(F, { target: (i == null ? void 0 : i.target) ?? "alea-main", children: i == null ? void 0 : i.label }),
21
+ o === "header" && f,
22
+ /* @__PURE__ */ t("div", { className: "alea-shell-body", children: [
23
23
  e && /* @__PURE__ */ a("aside", { className: "alea-shell-sidebar", children: e }),
24
- d === "sidebar" ? /* @__PURE__ */ r("div", { className: "alea-shell-panel", children: [
25
- p,
26
- u
27
- ] }) : u
24
+ o === "sidebar" ? /* @__PURE__ */ t("div", { className: "alea-shell-panel", children: [
25
+ f,
26
+ v
27
+ ] }) : v
28
28
  ] }),
29
- e && /* @__PURE__ */ a(j, { isOpen: g, onOpenChange: o, placement: "start", size: 300, children: /* @__PURE__ */ a(D, { "aria-label": h.navigation, hideClose: !0, className: "alea-shell-drawer", children: () => /* @__PURE__ */ a("div", { onClickCapture: (x) => {
30
- x.target.closest("a") && o(!1);
29
+ e && /* @__PURE__ */ a($, { isOpen: x, onOpenChange: h, placement: "start", size: 300, children: /* @__PURE__ */ a(A, { "aria-label": p.navigation, hideClose: !0, className: "alea-shell-drawer", children: () => /* @__PURE__ */ a("div", { onClickCapture: (C) => {
30
+ C.target.closest("a") && h(!1);
31
31
  }, children: e }) }) })
32
32
  ] });
33
33
  }
34
- function K({ children: s, className: l, "aria-label": e }) {
35
- const i = f();
36
- return e ?? (e = i.mainNav), /* @__PURE__ */ a("nav", { "aria-label": e, className: m("alea-sidenav", l), children: s });
34
+ function W({ children: s, className: l, "aria-label": e }) {
35
+ const r = N();
36
+ return e ?? (e = r.mainNav), /* @__PURE__ */ a("nav", { "aria-label": e, className: u("alea-sidenav", l), children: s });
37
37
  }
38
- const T = C(function({ title: l, children: e, className: i, ...t }, n) {
39
- return /* @__PURE__ */ r("div", { ref: n, ...t, className: m("alea-sidenav-group", i), children: [
38
+ const X = M(function({ title: l, children: e, className: r, ...d }, n) {
39
+ return /* @__PURE__ */ t("div", { ref: n, ...d, className: u("alea-sidenav-group", r), children: [
40
40
  l && /* @__PURE__ */ a("p", { className: "alea-sidenav-title", children: l }),
41
41
  /* @__PURE__ */ a("ul", { children: e })
42
42
  ] });
43
43
  });
44
- function U({ isCurrent: s, icon: l, end: e, children: i, className: t, ...n }) {
45
- return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(w, { ...n, "aria-current": s ? "page" : void 0, className: L("alea-sidenav-link alea-focus-ring", t), children: (c) => /* @__PURE__ */ r(S, { children: [
44
+ function Y({ isCurrent: s, icon: l, end: e, children: r, className: d, ...n }) {
45
+ return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(O, { ...n, "aria-current": s ? "page" : void 0, className: D("alea-sidenav-link alea-focus-ring", d), children: (c) => /* @__PURE__ */ t(w, { children: [
46
46
  l && /* @__PURE__ */ a("span", { className: "alea-sidenav-icon", "aria-hidden": "true", children: l }),
47
- /* @__PURE__ */ a("span", { className: "alea-sidenav-label", children: typeof i == "function" ? i(c) : i }),
47
+ /* @__PURE__ */ a("span", { className: "alea-sidenav-label", children: typeof r == "function" ? r(c) : r }),
48
48
  e && /* @__PURE__ */ a("span", { className: "alea-sidenav-end", children: e })
49
49
  ] }) }) });
50
50
  }
51
51
  export {
52
- J as AppShell,
53
- T as SidebarGroup,
54
- U as SidebarLink,
55
- K as SidebarNav
52
+ V as AppShell,
53
+ X as SidebarGroup,
54
+ Y as SidebarLink,
55
+ W as SidebarNav
56
56
  };
@@ -9,10 +9,14 @@ export interface AppSidebarProps {
9
9
  footer?: ReactNode;
10
10
  /** Name of the navigation. Default "Sidebar". */
11
11
  'aria-label'?: string;
12
+ /** Icon-only mode: links show just their icon with the label in a tooltip, section titles hide and every section stays open. Give links an icon, the workspace switcher a logo, and set AppShell `sidebarWidth` to about 64 while collapsed. The labels stay available to screen readers. Default false. */
13
+ collapsed?: boolean;
14
+ /** md (default): 32 px links. touch: 44 px links for touch screens. */
15
+ size?: 'md' | 'touch';
12
16
  className?: string;
13
17
  }
14
- /** The side navigation of a web app: a workspace switcher on top, compact links, sections that fold. Pair it with AppShell layout="sidebar". */
15
- export declare function AppSidebar({ header, children, footer, className, 'aria-label': label }: AppSidebarProps): import("react").JSX.Element;
18
+ /** The side navigation of a web app: a workspace switcher on top, compact links, sections that fold. Pair it with AppShell layout="sidebar". Can collapse to icons and offers a 44 px touch size. */
19
+ export declare function AppSidebar({ header, children, footer, className, collapsed, size, 'aria-label': label }: AppSidebarProps): import("react").JSX.Element;
16
20
  export interface WorkspaceSwitcherProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
17
21
  /** The workspace or product name. */
18
22
  name: ReactNode;
@@ -40,8 +44,10 @@ export interface AppNavSectionProps extends Omit<HTMLAttributes<HTMLDivElement>,
40
44
  defaultExpanded?: boolean;
41
45
  /** Something on the right of the title: an add button. */
42
46
  action?: ReactNode;
47
+ /** default: a small muted title. eyebrow: small capitals with more weight, to tell the groups apart at a glance. */
48
+ appearance?: 'default' | 'eyebrow';
43
49
  }
44
- /** A group of links in the AppSidebar; with a title it folds. */
50
+ /** A group of links in the AppSidebar; with a title it folds, unless collapsible is false: then the title is a plain label. */
45
51
  export declare const AppNavSection: import("react").ForwardRefExoticComponent<AppNavSectionProps & import("react").RefAttributes<HTMLDivElement>>;
46
52
  export interface AppNavItemProps extends LinkProps {
47
53
  /** Marks the current page (aria-current). */
@@ -1,62 +1,68 @@
1
1
  "use client";
2
- import { jsx as a, jsxs as l, Fragment as h } from "react/jsx-runtime";
3
- import { forwardRef as N, useState as w, useId as b } from "react";
4
- import { Link as g, Button as k } from "react-aria-components";
5
- import { ChevronRight as S, ChevronDown as x } from "lucide-react";
6
- import { withBase as y, cx as u } from "../../utils/cx.js";
7
- import { navIcon as A } from "../icon/icon-contexts.js";
8
- import { DropdownMenu as I } from "../menu/Menu.js";
9
- import { useStrings as W } from "../../i18n/strings.js";
10
- function M({ header: c, children: e, footer: s, className: n, "aria-label": i }) {
11
- const r = W();
12
- return /* @__PURE__ */ l("div", { className: u("alea-appnav", n), children: [
2
+ import { jsx as a, jsxs as l, Fragment as g } from "react/jsx-runtime";
3
+ import { useContext as y, forwardRef as k, useState as S, useId as w, createContext as C } from "react";
4
+ import { Link as A, Button as I } from "react-aria-components";
5
+ import { ChevronRight as T, ChevronDown as W } from "lucide-react";
6
+ import { withBase as j, cx as h } from "../../utils/cx.js";
7
+ import { navIcon as B } from "../icon/icon-contexts.js";
8
+ import { DropdownMenu as D } from "../menu/Menu.js";
9
+ import { TooltipTrigger as P, Tooltip as R } from "../overlay/Overlay.js";
10
+ import { useStrings as $ } from "../../i18n/strings.js";
11
+ const f = C({ collapsed: !1, size: "md" });
12
+ function J({ header: c, children: e, footer: s, className: n, collapsed: i = !1, size: r = "md", "aria-label": o }) {
13
+ const t = $();
14
+ return /* @__PURE__ */ a(f.Provider, { value: { collapsed: i, size: r }, children: /* @__PURE__ */ l("div", { className: h("alea-appnav", n), "data-collapsed": i || void 0, "data-size": r === "touch" ? "touch" : void 0, children: [
13
15
  c && /* @__PURE__ */ a("div", { className: "alea-appnav-header", children: c }),
14
- /* @__PURE__ */ a("nav", { "aria-label": i ?? r.mainNav, className: "alea-appnav-body", children: e }),
16
+ /* @__PURE__ */ a("nav", { "aria-label": o ?? t.mainNav, className: "alea-appnav-body", children: e }),
15
17
  s && /* @__PURE__ */ a("div", { className: "alea-appnav-footer", children: s })
16
- ] });
18
+ ] }) });
17
19
  }
18
- const O = N(function({ name: e, logo: s, children: n, actions: i, onAction: r, "aria-label": t, className: m, ...v }, o) {
19
- const p = /* @__PURE__ */ l(h, { children: [
20
+ const K = k(function({ name: e, logo: s, children: n, actions: i, onAction: r, "aria-label": o, className: t, ...p }, v) {
21
+ const d = /* @__PURE__ */ l(g, { children: [
20
22
  s && /* @__PURE__ */ a("span", { className: "alea-ws-logo", "aria-hidden": "true", children: s }),
21
23
  /* @__PURE__ */ a("span", { className: "alea-ws-name", children: e }),
22
- n && /* @__PURE__ */ a(x, { className: "alea-ws-chevron", "aria-hidden": "true" })
24
+ n && /* @__PURE__ */ a(W, { className: "alea-ws-chevron", "aria-hidden": "true" })
23
25
  ] });
24
- return /* @__PURE__ */ l("div", { ref: o, ...v, className: u("alea-ws", m), children: [
26
+ return /* @__PURE__ */ l("div", { ref: v, ...p, className: h("alea-ws", t), children: [
25
27
  n ? /* @__PURE__ */ a(
26
- I,
28
+ D,
27
29
  {
28
- "aria-label": t ?? (typeof e == "string" ? `${e}, workspace menu` : "Workspace menu"),
30
+ "aria-label": o ?? (typeof e == "string" ? `${e}, workspace menu` : "Workspace menu"),
29
31
  placement: "bottom start",
30
- menuProps: r ? { onAction: (d) => r(d) } : void 0,
31
- trigger: /* @__PURE__ */ a(k, { className: "alea-ws-button alea-focus-ring", "aria-label": t ?? (typeof e == "string" ? `${e}, workspace menu` : void 0), children: p }),
32
+ menuProps: r ? { onAction: (u) => r(u) } : void 0,
33
+ trigger: /* @__PURE__ */ a(I, { className: "alea-ws-button alea-focus-ring", "aria-label": o ?? (typeof e == "string" ? `${e}, workspace menu` : void 0), children: d }),
32
34
  children: n
33
35
  }
34
- ) : /* @__PURE__ */ a("span", { className: "alea-ws-button", "data-static": !0, children: p }),
36
+ ) : /* @__PURE__ */ a("span", { className: "alea-ws-button", "data-static": !0, children: d }),
35
37
  i && /* @__PURE__ */ a("span", { className: "alea-ws-actions", children: i })
36
38
  ] });
37
- }), P = N(function({ title: e, children: s, collapsible: n = !!e, defaultExpanded: i = !0, action: r, className: t, ...m }, v) {
38
- const [o, p] = w(i), d = b();
39
- return /* @__PURE__ */ l("div", { ref: v, ...m, className: u("alea-navsec", t), "data-open": o || void 0, children: [
40
- e && /* @__PURE__ */ l("div", { className: "alea-navsec-head", children: [
41
- n ? /* @__PURE__ */ l("button", { type: "button", className: "alea-navsec-title alea-focus-ring", "aria-expanded": o, "aria-controls": d, onClick: () => p((f) => !f), children: [
39
+ }), Q = k(function({ title: e, children: s, collapsible: n = !!e, defaultExpanded: i = !0, action: r, appearance: o = "default", className: t, ...p }, v) {
40
+ const [d, u] = S(i), N = w(), b = w(), { collapsed: m } = y(f);
41
+ return /* @__PURE__ */ l("div", { ref: v, ...p, className: h("alea-navsec", t), "data-open": d || void 0, "data-appearance": o === "eyebrow" ? "eyebrow" : void 0, "data-titled": e ? !0 : void 0, children: [
42
+ e && !m && /* @__PURE__ */ l("div", { className: "alea-navsec-head", children: [
43
+ n ? /* @__PURE__ */ l("button", { type: "button", className: "alea-navsec-title alea-focus-ring", "aria-expanded": d, "aria-controls": N, onClick: () => u((x) => !x), children: [
42
44
  e,
43
- /* @__PURE__ */ a(S, { className: "alea-navsec-chevron", "aria-hidden": "true" })
44
- ] }) : /* @__PURE__ */ a("span", { className: "alea-navsec-title", children: e }),
45
+ /* @__PURE__ */ a(T, { className: "alea-navsec-chevron", "aria-hidden": "true" })
46
+ ] }) : /* @__PURE__ */ a("span", { id: b, className: "alea-navsec-title", children: e }),
45
47
  r && /* @__PURE__ */ a("span", { className: "alea-navsec-action", children: r })
46
48
  ] }),
47
- /* @__PURE__ */ a("ul", { id: d, className: "alea-navsec-list", hidden: n && !o, children: s })
49
+ /* @__PURE__ */ a("ul", { id: N, className: "alea-navsec-list", hidden: n && !d && !m, "aria-labelledby": e && !n && !m ? b : void 0, "aria-label": e && m && typeof e == "string" ? e : void 0, children: s })
48
50
  ] });
49
51
  });
50
- function q({ isCurrent: c, icon: e, end: s, children: n, className: i, ...r }) {
51
- return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(g, { ...r, "aria-current": c ? "page" : void 0, className: y("alea-navitem alea-focus-ring", i), children: (t) => /* @__PURE__ */ l(h, { children: [
52
- e && /* @__PURE__ */ a("span", { className: "alea-navitem-icon", "aria-hidden": "true", ...A(c), children: e }),
53
- /* @__PURE__ */ a("span", { className: "alea-navitem-label", children: typeof n == "function" ? n(t) : n }),
52
+ function U({ isCurrent: c, icon: e, end: s, children: n, className: i, ...r }) {
53
+ const { collapsed: o } = y(f), t = /* @__PURE__ */ a(A, { ...r, "aria-current": c ? "page" : void 0, className: j("alea-navitem alea-focus-ring", i), children: (p) => /* @__PURE__ */ l(g, { children: [
54
+ e && /* @__PURE__ */ a("span", { className: "alea-navitem-icon", "aria-hidden": "true", ...B(c), children: e }),
55
+ /* @__PURE__ */ a("span", { className: "alea-navitem-label", children: typeof n == "function" ? n(p) : n }),
54
56
  s != null && /* @__PURE__ */ a("span", { className: "alea-navitem-end", children: s })
55
- ] }) }) });
57
+ ] }) });
58
+ return o && e && typeof n != "function" ? /* @__PURE__ */ a("li", { children: /* @__PURE__ */ l(P, { children: [
59
+ t,
60
+ /* @__PURE__ */ a(R, { placement: "end", children: n })
61
+ ] }) }) : /* @__PURE__ */ a("li", { children: t });
56
62
  }
57
63
  export {
58
- q as AppNavItem,
59
- P as AppNavSection,
60
- M as AppSidebar,
61
- O as WorkspaceSwitcher
64
+ U as AppNavItem,
65
+ Q as AppNavSection,
66
+ J as AppSidebar,
67
+ K as WorkspaceSwitcher
62
68
  };
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from 'react';
2
- import { type TableProps as RACTableProps, type TableHeaderProps, type ColumnProps as RACColumnProps, type TableBodyProps, type RowProps, type CellProps } from 'react-aria-components';
2
+ import { type TableProps as RACTableProps, type TableHeaderProps, type ColumnProps as RACColumnProps, type TableBodyProps, type TableFooterProps as RACTableFooterProps, type RowProps, type CellProps } from 'react-aria-components';
3
3
  import { type SurfaceProps } from '../surface/Surface.js';
4
4
  export interface TableProps extends RACTableProps, SurfaceProps {
5
5
  /** Header stays visible while the body scrolls (needs a height on the container). */
@@ -14,14 +14,19 @@ export interface TableProps extends RACTableProps, SurfaceProps {
14
14
  variant?: 'default' | 'striped' | 'bordered';
15
15
  /** Below this breakpoint each row becomes a card, every cell with its column label (give Cell a label). */
16
16
  stackBelow?: 'sm' | 'md';
17
+ /** In the stacked card layout, hides cells with no content, so a card shows only the values it has (a label with nothing next to it is dropped). Does nothing in the table layout. */
18
+ stackHideEmpty?: boolean;
19
+ /** With a TableFooter, keeps the footer (the totals row) visible while the body scrolls. Needs a height on the container (maxHeight), like stickyHeader. */
20
+ stickyFooter?: boolean;
21
+ /** Names the table's scroll area when the table is wider than its container (a narrow screen). The area then becomes a labelled region that takes focus, so the keyboard can scroll it sideways. Nothing changes while the table fits. */
22
+ scrollLabel?: string;
17
23
  /** Renders only the rows on screen, for thousands of rows: fixed row height in px (needs maxHeight). */
18
24
  virtualized?: {
19
25
  rowHeight: number;
20
26
  headingHeight?: number;
21
27
  };
22
28
  }
23
- /** Data in rows and columns: sorting, row selection, sticky header, resizing, keyboard grid navigation. */
24
- export declare function Table({ stickyHeader, density: densityRaw, maxHeight, resizable, variant, stackBelow, virtualized, surface, radius, className, ...props }: TableProps): import("react").JSX.Element;
29
+ export declare function Table({ stickyHeader, density: densityRaw, maxHeight, resizable, variant, stackBelow, stackHideEmpty, stickyFooter, scrollLabel, virtualized, surface, radius, className, ...props }: TableProps): import("react").JSX.Element;
25
30
  /** The header row. Adds the select-all checkbox when the table selects multiple rows. */
26
31
  export declare function TableHeader<T extends object>({ columns, children, className, ...props }: TableHeaderProps<T>): import("react").JSX.Element;
27
32
  export interface ColumnProps extends RACColumnProps {
@@ -31,8 +36,17 @@ export interface ColumnProps extends RACColumnProps {
31
36
  }
32
37
  /** A column header; allowsSorting shows the sort arrow and makes it pressable. */
33
38
  export declare function Column({ children, align, className, ...props }: ColumnProps): import("react").JSX.Element;
39
+ export interface AnimatedTableBodyProps<T extends object> extends TableBodyProps<T> {
40
+ /** Rows added to `items` rise in (staggered), and rows removed dissolve before they leave. Needs items with an id and a render function as children. The removed row is disabled while it leaves. Off by default; reduced motion keeps only the fades. */
41
+ animateRows?: boolean;
42
+ }
34
43
  /** The rows. renderEmptyState shows when there are none. */
35
- export declare function TableBody<T extends object>({ className, ...props }: TableBodyProps<T>): import("react").JSX.Element;
44
+ export declare function TableBody<T extends object>({ className, animateRows, items: itemsIn, children: childrenIn, dependencies: depsIn, ...props }: AnimatedTableBodyProps<T>): import("react").JSX.Element;
45
+ export interface TableFooterProps extends Omit<RACTableFooterProps<object>, 'children'> {
46
+ children?: ReactNode;
47
+ }
48
+ /** The footer rows (a totals row), after TableBody. A real tfoot: its cells line up with the columns (use colSpan to span several). Put Rows and Cells inside, like in the body; a footer row is not selectable and shows no checkbox. */
49
+ export declare function TableFooter({ className, children, ...props }: TableFooterProps): import("react").JSX.Element;
36
50
  /** A row; with selection it starts with a checkbox. */
37
51
  export declare function Row<T extends object>({ id, columns, children, className, ...props }: RowProps<T>): import("react").JSX.Element;
38
52
  /** A cell. */
@@ -1,58 +1,82 @@
1
1
  "use client";
2
- import { jsx as e, jsxs as h } from "react/jsx-runtime";
3
- import { useContext as B } from "react";
4
- import { Cell as d, Column as m, useTableOptions as y, Row as R, Collection as N, Table as v, Virtualizer as H, TableLayout as $, ResizableTableContainer as z, TableBody as S, TableHeader as D, TableColumnResizeStateContext as M, ColumnResizer as j, Checkbox as A } from "react-aria-components";
5
- import { ArrowUp as O, Minus as P, Check as V } from "lucide-react";
6
- import { surfaceAttrs as g } from "../surface/Surface.js";
7
- import { withBase as c, cx as w } from "../../utils/cx.js";
8
- import { DragHandle as W } from "../list/List.js";
9
- import { useStrings as L } from "../../i18n/strings.js";
10
- import { renamedValue as U } from "../../utils/vocabulary.js";
11
- function C({ slot: a }) {
12
- return /* @__PURE__ */ e(A, { slot: a, className: "alea-check alea-table-check", children: ({ isIndeterminate: l }) => /* @__PURE__ */ e("span", { className: "alea-check-box", "aria-hidden": "true", children: l ? /* @__PURE__ */ e(P, { size: 14, strokeWidth: 3 }) : /* @__PURE__ */ e(V, { size: 14, strokeWidth: 3 }) }) });
13
- }
14
- function _({ stickyHeader: a, density: l = "comfy", maxHeight: t, resizable: n, variant: o = "default", stackBelow: r, virtualized: s, surface: i, radius: u, className: T, ...k }) {
15
- const x = U("Table", "density", l, { comfortable: "comfy" }) === "compact" ? "compact" : "comfy", b = /* @__PURE__ */ e(v, { ...k, className: c("alea-table", T), "data-density": x, "data-sticky": a || s ? !0 : void 0, "data-variant": o !== "default" ? o : void 0, "data-stack": r, "data-virtualized": s ? !0 : void 0 }), f = s ? /* @__PURE__ */ e(H, { layout: $, layoutOptions: { rowHeight: s.rowHeight, headingHeight: s.headingHeight ?? 44 }, children: b }) : b, p = t ? { maxHeight: t, ...s ? { height: t } : {} } : void 0;
16
- return n ? /* @__PURE__ */ e(z, { className: "alea-table-wrap", style: p, ...g({ surface: i, radius: u }), children: f }) : /* @__PURE__ */ e("div", { className: "alea-table-wrap", style: p, ...g({ surface: i, radius: u }), children: f });
17
- }
18
- function ee({ columns: a, children: l, className: t, ...n }) {
19
- const o = L(), { selectionBehavior: r, selectionMode: s, allowsDragging: i } = y();
20
- return /* @__PURE__ */ h(D, { ...n, className: w("alea-thead", t), children: [
21
- i && /* @__PURE__ */ e(m, { className: "alea-th alea-th-narrow", children: /* @__PURE__ */ e("span", { className: "alea-visually-hidden", children: o.dragToMove }) }),
22
- r === "toggle" && /* @__PURE__ */ e(m, { className: "alea-th alea-th-narrow", children: s === "multiple" && /* @__PURE__ */ e(C, { slot: "selection" }) }),
23
- /* @__PURE__ */ e(N, { items: a, children: l })
2
+ import { jsx as t, jsxs as h } from "react/jsx-runtime";
3
+ import { useContext as w, createContext as H, useRef as S, useEffect as D } from "react";
4
+ import { Cell as u, Column as b, useTableOptions as A, Row as F, Collection as x, Table as M, Virtualizer as O, TableLayout as W, ResizableTableContainer as E, TableBody as P, TableFooter as j, TableHeader as V, TableColumnResizeStateContext as L, ColumnResizer as U, Checkbox as q } from "react-aria-components";
5
+ import { ArrowUp as G, Minus as I, Check as J } from "lucide-react";
6
+ import { surfaceAttrs as T } from "../surface/Surface.js";
7
+ import { withBase as m, cx as f } from "../../utils/cx.js";
8
+ import { DragHandle as K } from "../list/List.js";
9
+ import { useStrings as Q } from "../../i18n/strings.js";
10
+ import { renamedValue as X } from "../../utils/vocabulary.js";
11
+ import { useAnimatedRows as Y } from "../../utils/animateRows.js";
12
+ function R({ slot: a }) {
13
+ return /* @__PURE__ */ t(q, { slot: a, className: "alea-check alea-table-check", children: ({ isIndeterminate: r }) => /* @__PURE__ */ t("span", { className: "alea-check-box", "aria-hidden": "true", children: r ? /* @__PURE__ */ t(I, { size: 14, strokeWidth: 3 }) : /* @__PURE__ */ t(J, { size: 14, strokeWidth: 3 }) }) });
14
+ }
15
+ function Z(a) {
16
+ const r = S(null);
17
+ return D(() => {
18
+ const e = r.current;
19
+ if (!a || !e) return;
20
+ const o = () => {
21
+ e.scrollWidth > e.clientWidth + 1 ? (e.setAttribute("role", "region"), e.setAttribute("aria-label", a), e.setAttribute("tabindex", "0")) : (e.removeAttribute("role"), e.removeAttribute("aria-label"), e.removeAttribute("tabindex"));
22
+ };
23
+ if (o(), typeof ResizeObserver > "u") return () => {
24
+ e.removeAttribute("role"), e.removeAttribute("aria-label"), e.removeAttribute("tabindex");
25
+ };
26
+ const l = new ResizeObserver(o);
27
+ return l.observe(e), e.firstElementChild && l.observe(e.firstElementChild), () => {
28
+ l.disconnect(), e.removeAttribute("role"), e.removeAttribute("aria-label"), e.removeAttribute("tabindex");
29
+ };
30
+ }, [a]), r;
31
+ }
32
+ function me({ stickyHeader: a, density: r = "comfy", maxHeight: e, resizable: o, variant: l = "default", stackBelow: n, stackHideEmpty: i, stickyFooter: d, scrollLabel: c, virtualized: s, surface: p, radius: v, className: z, ...$ }) {
33
+ const B = X("Table", "density", r, { comfortable: "comfy" }) === "compact" ? "compact" : "comfy", g = /* @__PURE__ */ t(M, { ...$, className: m("alea-table", z), "data-density": B, "data-sticky": a || s ? !0 : void 0, "data-variant": l !== "default" ? l : void 0, "data-stack": n, "data-stack-hide-empty": n && i ? !0 : void 0, "data-sticky-footer": d ? !0 : void 0, "data-virtualized": s ? !0 : void 0 }), y = s ? /* @__PURE__ */ t(O, { layout: W, layoutOptions: { rowHeight: s.rowHeight, headingHeight: s.headingHeight ?? 44 }, children: g }) : g, N = e ? { maxHeight: e, ...s ? { height: e } : {} } : void 0, C = Z(c);
34
+ return o ? /* @__PURE__ */ t(E, { ref: C, className: "alea-table-wrap", style: N, ...T({ surface: p, radius: v }), children: y }) : /* @__PURE__ */ t("div", { ref: C, className: "alea-table-wrap", style: N, ...T({ surface: p, radius: v }), children: y });
35
+ }
36
+ function ue({ columns: a, children: r, className: e, ...o }) {
37
+ const l = Q(), { selectionBehavior: n, selectionMode: i, allowsDragging: d } = A();
38
+ return /* @__PURE__ */ h(V, { ...o, className: f("alea-thead", e), children: [
39
+ d && /* @__PURE__ */ t(b, { className: "alea-th alea-th-narrow", children: /* @__PURE__ */ t("span", { className: "alea-visually-hidden", children: l.dragToMove }) }),
40
+ n === "toggle" && /* @__PURE__ */ t(b, { className: "alea-th alea-th-narrow", children: i === "multiple" && /* @__PURE__ */ t(R, { slot: "selection" }) }),
41
+ /* @__PURE__ */ t(x, { items: a, children: r })
24
42
  ] });
25
43
  }
26
- function ae({ children: a, align: l = "start", className: t, ...n }) {
27
- return /* @__PURE__ */ e(m, { ...n, className: c("alea-th", t), "data-align": l, children: ({ allowsSorting: o, sortDirection: r }) => /* @__PURE__ */ h("div", { className: "alea-th-inner", children: [
28
- /* @__PURE__ */ e("span", { className: "alea-th-label", children: a }),
29
- o && /* @__PURE__ */ e(O, { size: 14, "aria-hidden": "true", className: "alea-sort", "data-direction": r }),
30
- /* @__PURE__ */ e(q, {})
44
+ function be({ children: a, align: r = "start", className: e, ...o }) {
45
+ return /* @__PURE__ */ t(b, { ...o, className: m("alea-th", e), "data-align": r, children: ({ allowsSorting: l, sortDirection: n }) => /* @__PURE__ */ h("div", { className: "alea-th-inner", children: [
46
+ /* @__PURE__ */ t("span", { className: "alea-th-label", children: a }),
47
+ l && /* @__PURE__ */ t(G, { size: 14, "aria-hidden": "true", className: "alea-sort", "data-direction": n }),
48
+ /* @__PURE__ */ t(_, {})
31
49
  ] }) });
32
50
  }
33
- function q() {
34
- return B(M) ? /* @__PURE__ */ e(j, { className: "alea-col-resizer" }) : null;
51
+ function _() {
52
+ return w(L) ? /* @__PURE__ */ t(U, { className: "alea-col-resizer" }) : null;
53
+ }
54
+ function he({ className: a, animateRows: r, items: e, children: o, dependencies: l, ...n }) {
55
+ const i = Y(e, o, r);
56
+ return /* @__PURE__ */ t(P, { ...n, items: i.items, dependencies: i.dependencies ? [...l ?? [], ...i.dependencies] : l, className: f("alea-tbody", a), children: i.children });
35
57
  }
36
- function le({ className: a, ...l }) {
37
- return /* @__PURE__ */ e(S, { ...l, className: w("alea-tbody", a) });
58
+ const k = H(!1);
59
+ function fe({ className: a, children: r, ...e }) {
60
+ return /* @__PURE__ */ t(j, { ...e, className: f("alea-tfoot", a), children: /* @__PURE__ */ t(k.Provider, { value: !0, children: r }) });
38
61
  }
39
- function te({ id: a, columns: l, children: t, className: n, ...o }) {
40
- const { selectionBehavior: r, allowsDragging: s } = y();
41
- return /* @__PURE__ */ h(R, { id: a, ...o, className: c("alea-tr", n), children: [
42
- s && /* @__PURE__ */ e(d, { className: "alea-td alea-td-narrow", children: /* @__PURE__ */ e(W, {}) }),
43
- r === "toggle" && /* @__PURE__ */ e(d, { className: "alea-td alea-td-narrow", children: /* @__PURE__ */ e(C, { slot: "selection" }) }),
44
- /* @__PURE__ */ e(N, { items: l, dependencies: o.dependencies, children: t })
62
+ function pe({ id: a, columns: r, children: e, className: o, ...l }) {
63
+ const { selectionBehavior: n, allowsDragging: i, selectionMode: d } = A(), c = w(k);
64
+ return /* @__PURE__ */ h(F, { id: a, ...c && d !== "none" ? { isDisabled: !0 } : {}, ...l, className: m("alea-tr", o), "data-footer": c ? !0 : void 0, children: [
65
+ i && /* @__PURE__ */ t(u, { className: "alea-td alea-td-narrow", children: c ? null : /* @__PURE__ */ t(K, {}) }),
66
+ n === "toggle" && /* @__PURE__ */ t(u, { className: "alea-td alea-td-narrow", children: c ? null : /* @__PURE__ */ t(R, { slot: "selection" }) }),
67
+ /* @__PURE__ */ t(x, { items: r, dependencies: l.dependencies, children: e })
45
68
  ] });
46
69
  }
47
- function oe({ className: a, ...l }) {
48
- const { align: t, label: n, ...o } = l;
49
- return /* @__PURE__ */ e(d, { ...o, "data-align": t, "data-label": n, className: c("alea-td", a) });
70
+ function ve({ className: a, ...r }) {
71
+ const { align: e, label: o, ...l } = r;
72
+ return /* @__PURE__ */ t(u, { ...l, "data-align": e, "data-label": o, className: m("alea-td", a) });
50
73
  }
51
74
  export {
52
- oe as Cell,
53
- ae as Column,
54
- te as Row,
55
- _ as Table,
56
- le as TableBody,
57
- ee as TableHeader
75
+ ve as Cell,
76
+ be as Column,
77
+ pe as Row,
78
+ me as Table,
79
+ he as TableBody,
80
+ fe as TableFooter,
81
+ ue as TableHeader
58
82
  };