@alea-design/ui 0.5.1 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/button/Button.d.ts +3 -1
- package/dist/components/button/Button.js +64 -63
- package/dist/components/card/Card.d.ts +6 -2
- package/dist/components/card/Card.js +20 -20
- package/dist/components/combobox/Autocomplete.d.ts +4 -0
- package/dist/components/combobox/Autocomplete.js +89 -87
- package/dist/components/command/CommandPalette.d.ts +10 -0
- package/dist/components/command/CommandPalette.js +82 -56
- package/dist/components/data/Data.d.ts +11 -7
- package/dist/components/data/Data.js +65 -55
- package/dist/components/date/Date.d.ts +16 -2
- package/dist/components/date/Date.js +80 -69
- package/dist/components/display/Display.d.ts +3 -1
- package/dist/components/display/Display.js +27 -27
- package/dist/components/display/Display2.d.ts +2 -2
- package/dist/components/display/Display2.js +28 -27
- package/dist/components/feedback/Feedback.d.ts +3 -1
- package/dist/components/feedback/Feedback.js +102 -102
- package/dist/components/feedback/PageSkeleton.d.ts +19 -0
- package/dist/components/feedback/PageSkeleton.js +58 -0
- package/dist/components/field/Field.d.ts +3 -1
- package/dist/components/field/Field.js +82 -82
- package/dist/components/filter/FilterBar.d.ts +5 -2
- package/dist/components/filter/FilterBar.js +97 -66
- package/dist/components/form/Form.d.ts +8 -2
- package/dist/components/form/Form.js +53 -40
- package/dist/components/icon/icon-names.d.ts +2 -2
- package/dist/components/icon/icon-names.js +4 -2
- package/dist/components/list/List.d.ts +6 -2
- package/dist/components/list/List.js +65 -62
- package/dist/components/list/Lists2.d.ts +4 -0
- package/dist/components/list/Lists2.js +35 -35
- package/dist/components/media/Media.d.ts +5 -1
- package/dist/components/media/Media.js +115 -113
- package/dist/components/more/More.d.ts +2 -2
- package/dist/components/more/More.js +46 -45
- package/dist/components/navigation/Navigation.d.ts +11 -5
- package/dist/components/navigation/Navigation.js +97 -80
- package/dist/components/navigation/Navigation2.d.ts +9 -3
- package/dist/components/navigation/Navigation2.js +208 -194
- package/dist/components/notification/NotificationCenter.js +70 -70
- package/dist/components/overlay/Drawer.d.ts +6 -1
- package/dist/components/overlay/Drawer.js +27 -25
- package/dist/components/overlay/Modal.d.ts +5 -0
- package/dist/components/overlay/Modal.js +16 -15
- package/dist/components/overlay/Overlay.d.ts +14 -1
- package/dist/components/overlay/Overlay.js +52 -50
- package/dist/components/overlay/Sheet.d.ts +2 -0
- package/dist/components/overlay/Sheet.js +30 -30
- package/dist/components/page/PageParts.d.ts +6 -2
- package/dist/components/page/PageParts.js +92 -84
- package/dist/components/select/Select.js +75 -70
- package/dist/components/settings/Settings.d.ts +29 -0
- package/dist/components/settings/Settings.js +31 -0
- package/dist/components/shell/AccountMenu.d.ts +20 -0
- package/dist/components/shell/AccountMenu.js +32 -0
- package/dist/components/shell/AppShell.d.ts +9 -2
- package/dist/components/shell/AppShell.js +37 -37
- package/dist/components/shell/AppSidebar.d.ts +9 -3
- package/dist/components/shell/AppSidebar.js +45 -39
- package/dist/components/table/Table.d.ts +18 -4
- package/dist/components/table/Table.js +70 -46
- package/dist/components/tabs/Tabs.js +105 -94
- package/dist/components/theme/Theme.d.ts +7 -4
- package/dist/components/theme/Theme.js +127 -130
- package/dist/components/upload/Upload.js +62 -54
- package/dist/css/base.css +1 -1
- package/dist/css/button.css +1 -1
- package/dist/css/card.css +1 -1
- package/dist/css/command.css +1 -1
- package/dist/css/data.css +1 -1
- package/dist/css/date.css +1 -1
- package/dist/css/display.css +1 -1
- package/dist/css/feedback.css +1 -1
- package/dist/css/field.css +1 -1
- package/dist/css/form.css +1 -1
- package/dist/css/groups.json +37 -21
- package/dist/css/list.css +1 -1
- package/dist/css/menu.css +1 -1
- package/dist/css/navigation.css +1 -1
- package/dist/css/notification.css +1 -1
- package/dist/css/overlay.css +1 -1
- package/dist/css/page.css +1 -1
- package/dist/css/select.css +1 -1
- package/dist/css/settings.css +1 -0
- package/dist/css/shell.css +1 -1
- package/dist/css/table.css +1 -1
- package/dist/css/tabs.css +1 -1
- package/dist/css/upload.css +1 -1
- package/dist/i18n/strings.d.ts +9 -0
- package/dist/i18n/strings.js +18 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +318 -306
- package/dist/styles.css +1 -1
- package/dist/utils/animateRows.d.ts +11 -0
- package/dist/utils/animateRows.js +23 -0
- package/dist/utils/decimal.d.ts +12 -0
- package/dist/utils/decimal.js +48 -0
- package/dist/utils/initialFocus.d.ts +6 -0
- package/dist/utils/initialFocus.js +24 -0
- package/dist/utils/refs.d.ts +2 -0
- package/dist/utils/refs.js +14 -6
- package/package.json +3 -3
|
@@ -1,62 +1,68 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as a, jsxs as l, Fragment as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { Link as
|
|
5
|
-
import { ChevronRight as
|
|
6
|
-
import { withBase as
|
|
7
|
-
import { navIcon as
|
|
8
|
-
import { DropdownMenu as
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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":
|
|
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
|
|
19
|
-
const
|
|
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(
|
|
24
|
+
n && /* @__PURE__ */ a(W, { className: "alea-ws-chevron", "aria-hidden": "true" })
|
|
23
25
|
] });
|
|
24
|
-
return /* @__PURE__ */ l("div", { ref:
|
|
26
|
+
return /* @__PURE__ */ l("div", { ref: v, ...p, className: h("alea-ws", t), children: [
|
|
25
27
|
n ? /* @__PURE__ */ a(
|
|
26
|
-
|
|
28
|
+
D,
|
|
27
29
|
{
|
|
28
|
-
"aria-label":
|
|
30
|
+
"aria-label": o ?? (typeof e == "string" ? `${e}, workspace menu` : "Workspace menu"),
|
|
29
31
|
placement: "bottom start",
|
|
30
|
-
menuProps: r ? { onAction: (
|
|
31
|
-
trigger: /* @__PURE__ */ a(
|
|
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:
|
|
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
|
-
}),
|
|
38
|
-
const [
|
|
39
|
-
return /* @__PURE__ */ l("div", { ref: v, ...
|
|
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":
|
|
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(
|
|
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:
|
|
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
|
|
51
|
-
|
|
52
|
-
e && /* @__PURE__ */ a("span", { className: "alea-navitem-icon", "aria-hidden": "true", ...
|
|
53
|
-
/* @__PURE__ */ a("span", { className: "alea-navitem-label", children: typeof n == "function" ? 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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
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 }:
|
|
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
|
|
3
|
-
import { useContext as
|
|
4
|
-
import { Cell as
|
|
5
|
-
import { ArrowUp as
|
|
6
|
-
import { surfaceAttrs as
|
|
7
|
-
import { withBase as
|
|
8
|
-
import { DragHandle as
|
|
9
|
-
import { useStrings as
|
|
10
|
-
import { renamedValue as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
|
|
30
|
-
/* @__PURE__ */
|
|
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
|
|
34
|
-
return
|
|
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
|
-
|
|
37
|
-
|
|
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
|
|
40
|
-
const { selectionBehavior:
|
|
41
|
-
return /* @__PURE__ */ h(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
/* @__PURE__ */
|
|
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
|
|
48
|
-
const { align:
|
|
49
|
-
return /* @__PURE__ */
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
};
|
|
@@ -1,115 +1,126 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { Tab as
|
|
5
|
-
import { X as
|
|
6
|
-
import { withBase as
|
|
7
|
-
import { tabIcon as
|
|
8
|
-
import { useScrollEdges as
|
|
9
|
-
import { useStrings as
|
|
10
|
-
function ie({ variant:
|
|
11
|
-
const
|
|
12
|
-
return
|
|
13
|
-
const o =
|
|
2
|
+
import { jsx as a, jsxs as k, Fragment as $ } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as y, useEffect as E, useState as K, useId as W, useLayoutEffect as H } from "react";
|
|
4
|
+
import { Tab as U, SelectionIndicator as X, TabList as G, Link as J, TabPanel as Q, Tabs as V } from "react-aria-components";
|
|
5
|
+
import { X as Y, ChevronLeft as j, ChevronRight as B } from "lucide-react";
|
|
6
|
+
import { withBase as A } from "../../utils/cx.js";
|
|
7
|
+
import { tabIcon as Z } from "../icon/icon-contexts.js";
|
|
8
|
+
import { useScrollEdges as C } from "../../utils/scrollEdges.js";
|
|
9
|
+
import { useStrings as F } from "../../i18n/strings.js";
|
|
10
|
+
function ie({ variant: m = "underline", size: i, fitted: c, justify: v, className: l, ...h }) {
|
|
11
|
+
const d = y(null);
|
|
12
|
+
return H(() => {
|
|
13
|
+
const o = d.current;
|
|
14
14
|
if (!o) return;
|
|
15
|
-
const
|
|
16
|
-
document.getElementById(
|
|
15
|
+
const u = () => o.querySelectorAll('[role="tab"][aria-controls]').forEach((n) => {
|
|
16
|
+
document.getElementById(n.getAttribute("aria-controls")) || n.removeAttribute("aria-controls");
|
|
17
17
|
});
|
|
18
|
-
if (
|
|
19
|
-
const
|
|
20
|
-
return
|
|
21
|
-
}, []), /* @__PURE__ */
|
|
18
|
+
if (u(), typeof MutationObserver > "u") return;
|
|
19
|
+
const e = new MutationObserver(u);
|
|
20
|
+
return e.observe(o, { subtree: !0, childList: !0, attributes: !0, attributeFilter: ["aria-controls"] }), () => e.disconnect();
|
|
21
|
+
}, []), /* @__PURE__ */ a(V, { ...h, ref: d, "data-variant": m, "data-size": i, "data-fitted": c || void 0, "data-justify": v, className: A("alea-tabs", l) });
|
|
22
22
|
}
|
|
23
|
-
function le({ className:
|
|
24
|
-
const
|
|
25
|
-
return
|
|
26
|
-
var
|
|
27
|
-
const
|
|
28
|
-
if (!
|
|
29
|
-
const
|
|
30
|
-
|
|
23
|
+
function le({ className: m, extra: i, onReorder: c, ...v }) {
|
|
24
|
+
const l = F(), h = y(null), { edges: d, scroll: o } = C(h, ".alea-tab-list"), [u, e] = K(""), n = W(), b = y(c);
|
|
25
|
+
return b.current = c, E(() => {
|
|
26
|
+
var P;
|
|
27
|
+
const r = (P = h.current) == null ? void 0 : P.querySelector(".alea-tab-list");
|
|
28
|
+
if (!r || !c) return;
|
|
29
|
+
const g = () => Array.from(r.querySelectorAll('[role="tab"]')), S = () => g().forEach((t) => {
|
|
30
|
+
t.setAttribute("draggable", "true"), t.setAttribute("aria-describedby", n), t.setAttribute("aria-keyshortcuts", "Alt+Shift+ArrowLeft Alt+Shift+ArrowRight");
|
|
31
31
|
});
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
const
|
|
32
|
+
S();
|
|
33
|
+
const x = new MutationObserver(S);
|
|
34
|
+
x.observe(r, { childList: !0 });
|
|
35
|
+
const w = () => r.getAttribute("aria-orientation") === "vertical", T = (t, s) => {
|
|
36
36
|
var N;
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
var
|
|
40
|
-
return (
|
|
37
|
+
const L = g(), p = t.dataset.key;
|
|
38
|
+
s = Math.max(0, Math.min(L.length - 1, s)), s !== L.indexOf(t) && ((N = b.current) == null || N.call(b, p, s), e(l.movedTo(t.textContent ?? p, s + 1, L.length)), requestAnimationFrame(() => {
|
|
39
|
+
var M;
|
|
40
|
+
return (M = r.querySelector(`[data-key="${CSS.escape(p)}"]`)) == null ? void 0 : M.focus();
|
|
41
41
|
}));
|
|
42
|
-
},
|
|
43
|
-
const
|
|
44
|
-
if (!
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
const N = getComputedStyle(
|
|
49
|
-
T(
|
|
42
|
+
}, D = (t) => {
|
|
43
|
+
const s = t.target.closest('[role="tab"]');
|
|
44
|
+
if (!s || !t.altKey || !t.shiftKey) return;
|
|
45
|
+
const L = w() ? "ArrowUp" : "ArrowLeft", p = w() ? "ArrowDown" : "ArrowRight";
|
|
46
|
+
if (t.key !== L && t.key !== p) return;
|
|
47
|
+
t.preventDefault(), t.stopPropagation();
|
|
48
|
+
const N = getComputedStyle(r).direction === "rtl" && !w();
|
|
49
|
+
T(s, g().indexOf(s) + (t.key === p !== N ? 1 : -1));
|
|
50
50
|
};
|
|
51
|
-
let
|
|
52
|
-
const
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
},
|
|
61
|
-
|
|
51
|
+
let f = null;
|
|
52
|
+
const I = (t) => {
|
|
53
|
+
var s;
|
|
54
|
+
f = t.target.closest('[role="tab"]'), f && ((s = t.dataTransfer) == null || s.setData("text/plain", f.dataset.key ?? ""), f.dataset.dragging = "true");
|
|
55
|
+
}, q = (t) => {
|
|
56
|
+
f && t.preventDefault();
|
|
57
|
+
}, z = (t) => {
|
|
58
|
+
const s = t.target.closest('[role="tab"]');
|
|
59
|
+
f && s && s !== f && (t.preventDefault(), T(f, g().indexOf(s)));
|
|
60
|
+
}, O = () => {
|
|
61
|
+
f && delete f.dataset.dragging, f = null;
|
|
62
62
|
};
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
return r.addEventListener("keydown", D, !0), r.addEventListener("dragstart", I), r.addEventListener("dragover", q), r.addEventListener("drop", z), r.addEventListener("dragend", O), () => {
|
|
64
|
+
x.disconnect(), r.removeEventListener("keydown", D, !0), r.removeEventListener("dragstart", I), r.removeEventListener("dragover", q), r.removeEventListener("drop", z), r.removeEventListener("dragend", O), g().forEach((t) => {
|
|
65
|
+
t.removeAttribute("draggable"), t.removeAttribute("aria-describedby"), t.removeAttribute("aria-keyshortcuts");
|
|
66
66
|
});
|
|
67
67
|
};
|
|
68
|
-
}, [!!
|
|
69
|
-
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
/* @__PURE__ */
|
|
68
|
+
}, [!!c, n]), /* @__PURE__ */ k("div", { ref: h, className: "alea-tab-bar", "data-overflow-start": d.start || void 0, "data-overflow-end": d.end || void 0, "data-reorderable": c ? !0 : void 0, children: [
|
|
69
|
+
d.start && /* @__PURE__ */ a("button", { type: "button", tabIndex: -1, "aria-hidden": "true", className: "alea-tab-scroll", "data-side": "start", onClick: () => o(-1), children: /* @__PURE__ */ a(j, { size: 16 }) }),
|
|
70
|
+
/* @__PURE__ */ a(G, { ...v, "aria-label": v["aria-label"], className: A("alea-tab-list", m) }),
|
|
71
|
+
d.end && /* @__PURE__ */ a("button", { type: "button", tabIndex: -1, "aria-hidden": "true", className: "alea-tab-scroll", "data-side": "end", onClick: () => o(1), children: /* @__PURE__ */ a(B, { size: 16 }) }),
|
|
72
|
+
i && /* @__PURE__ */ a("div", { className: "alea-tab-extra", children: i }),
|
|
73
|
+
c && /* @__PURE__ */ k($, { children: [
|
|
74
|
+
/* @__PURE__ */ a("span", { id: n, hidden: !0, children: l.reorderHint }),
|
|
75
|
+
/* @__PURE__ */ a("span", { className: "alea-visually-hidden", role: "status", children: u })
|
|
76
76
|
] })
|
|
77
77
|
] });
|
|
78
78
|
}
|
|
79
|
-
function oe({ className:
|
|
80
|
-
const
|
|
81
|
-
return
|
|
82
|
-
const
|
|
83
|
-
if (!
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
var
|
|
87
|
-
(
|
|
79
|
+
function oe({ className: m, children: i, icon: c, badge: v, onClose: l, ...h }) {
|
|
80
|
+
const d = F(), o = y(null), u = y(l);
|
|
81
|
+
return u.current = l, E(() => {
|
|
82
|
+
const e = o.current;
|
|
83
|
+
if (!e || !l) return;
|
|
84
|
+
e.setAttribute("aria-keyshortcuts", "Delete");
|
|
85
|
+
const n = (b) => {
|
|
86
|
+
var r;
|
|
87
|
+
(b.key === "Delete" || b.key === "Backspace") && (b.preventDefault(), (r = u.current) == null || r.call(u));
|
|
88
88
|
};
|
|
89
|
-
return
|
|
90
|
-
}, [!!
|
|
91
|
-
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}, children: /* @__PURE__ */
|
|
97
|
-
/* @__PURE__ */
|
|
89
|
+
return e.addEventListener("keydown", n), () => e.removeEventListener("keydown", n);
|
|
90
|
+
}, [!!l]), /* @__PURE__ */ a(U, { ...h, ref: o, className: A("alea-tab alea-focus-ring", m), "data-closable": l ? !0 : void 0, children: (e) => /* @__PURE__ */ k($, { children: [
|
|
91
|
+
c && /* @__PURE__ */ a("span", { className: "alea-tab-icon", "aria-hidden": "true", ...Z(e.isSelected), children: c }),
|
|
92
|
+
/* @__PURE__ */ a("span", { className: "alea-tab-label", children: typeof i == "function" ? i(e) : i }),
|
|
93
|
+
v != null && /* @__PURE__ */ a("span", { className: "alea-tab-badge", children: v }),
|
|
94
|
+
l && /* @__PURE__ */ a("span", { className: "alea-tab-close", "aria-hidden": "true", title: d.close, onPointerDown: (n) => n.stopPropagation(), onClick: (n) => {
|
|
95
|
+
n.stopPropagation(), l();
|
|
96
|
+
}, children: /* @__PURE__ */ a(Y, { size: 12 }) }),
|
|
97
|
+
/* @__PURE__ */ a(X, { className: "alea-sel-indicator" })
|
|
98
98
|
] }) });
|
|
99
99
|
}
|
|
100
|
-
function ce({ className:
|
|
101
|
-
return
|
|
100
|
+
function ce({ className: m, ...i }) {
|
|
101
|
+
return i.children == null || i.children === !1 ? null : /* @__PURE__ */ a(Q, { ...i, className: A("alea-tab-panel alea-focus-ring", m) });
|
|
102
102
|
}
|
|
103
|
-
function de({ items:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
103
|
+
function de({ items: m, current: i, variant: c = "underline", size: v, className: l, "aria-label": h }) {
|
|
104
|
+
const d = y(null), { edges: o, scroll: u } = C(d, ".alea-tab-list");
|
|
105
|
+
return E(() => {
|
|
106
|
+
var g;
|
|
107
|
+
const e = (g = d.current) == null ? void 0 : g.querySelector(".alea-tab-list"), n = e == null ? void 0 : e.querySelector('[aria-current="page"]');
|
|
108
|
+
if (!e || !n) return;
|
|
109
|
+
const b = n.offsetLeft - e.offsetLeft, r = b + n.offsetWidth;
|
|
110
|
+
r > e.scrollLeft + e.clientWidth ? e.scrollLeft = r - e.clientWidth + 8 : b < e.scrollLeft && (e.scrollLeft = Math.max(0, b - 8));
|
|
111
|
+
}, [i]), /* @__PURE__ */ a("nav", { "aria-label": h, className: ["alea-tabs alea-tab-nav", l].filter(Boolean).join(" "), "data-variant": c, "data-size": v, children: /* @__PURE__ */ k("div", { ref: d, className: "alea-tab-bar", "data-overflow-start": o.start || void 0, "data-overflow-end": o.end || void 0, children: [
|
|
112
|
+
o.start && /* @__PURE__ */ a("button", { type: "button", tabIndex: -1, "aria-hidden": "true", className: "alea-tab-scroll", "data-side": "start", onClick: () => u(-1), children: /* @__PURE__ */ a(j, { size: 16 }) }),
|
|
113
|
+
/* @__PURE__ */ a("div", { className: "alea-tab-list", children: m.map((e) => {
|
|
114
|
+
const n = e.id === i;
|
|
115
|
+
return /* @__PURE__ */ k(J, { href: e.href, "aria-current": n ? "page" : void 0, "data-selected": n || void 0, className: "alea-tab alea-focus-ring", children: [
|
|
116
|
+
e.icon && /* @__PURE__ */ a("span", { className: "alea-tab-icon", "aria-hidden": "true", children: e.icon }),
|
|
117
|
+
/* @__PURE__ */ a("span", { className: "alea-tab-label", children: e.label }),
|
|
118
|
+
e.badge != null && /* @__PURE__ */ a("span", { className: "alea-tab-badge", children: e.badge }),
|
|
119
|
+
n && /* @__PURE__ */ a("span", { className: "alea-sel-indicator" })
|
|
120
|
+
] }, e.id);
|
|
121
|
+
}) }),
|
|
122
|
+
o.end && /* @__PURE__ */ a("button", { type: "button", tabIndex: -1, "aria-hidden": "true", className: "alea-tab-scroll", "data-side": "end", onClick: () => u(1), children: /* @__PURE__ */ a(B, { size: 16 }) })
|
|
123
|
+
] }) });
|
|
113
124
|
}
|
|
114
125
|
export {
|
|
115
126
|
oe as Tab,
|
|
@@ -8,13 +8,16 @@ export interface BrandTheme {
|
|
|
8
8
|
accent?: string;
|
|
9
9
|
/** Text on solid accent surfaces. Default the kit's (near black). */
|
|
10
10
|
accentOn?: string;
|
|
11
|
+
/** Focus ring color (any CSS color). Default: the strong accent, which is darker than the accent in Light and lighter in Dark, so a light brand color still gives a ring of at least 3:1 on the page. Set it only when you have checked your own pair. */
|
|
12
|
+
focus?: string;
|
|
11
13
|
/** Multiplies every radius: 0 square, 0.5 tight, 1 the Alea default, 1.4 rounder. */
|
|
12
14
|
radius?: number;
|
|
13
|
-
/** compact (controls
|
|
15
|
+
/** compact (controls 4 px shorter, the Compact space scale with base 2 px, and control padding that stays wide: horizontal at or above vertical; 44 px controls on a touch pointer) or comfy (default). Same as the density prop of ThemeProvider. 'comfortable' is a deprecated alias of 'comfy'. */
|
|
14
16
|
density?: 'comfy' | 'compact' | /** @deprecated Use comfy. */ 'comfortable';
|
|
15
|
-
/** Font stacks: body (
|
|
17
|
+
/** Font stacks, a runtime override of the font.family tokens: body (--alea-font-family-body: all text and every control), heading (--alea-font-family-display: titles; display is the same thing), mono (--alea-font-family-mono: code, left alone unless set). Load the font files yourself. */
|
|
16
18
|
fonts?: {
|
|
17
19
|
body?: string;
|
|
20
|
+
heading?: string; /** Same as heading. If both are set, heading wins. */
|
|
18
21
|
display?: string;
|
|
19
22
|
mono?: string;
|
|
20
23
|
};
|
|
@@ -48,8 +51,8 @@ export interface ThemeProviderProps {
|
|
|
48
51
|
className?: string;
|
|
49
52
|
/** Brand changes: accent color, radius, density, fonts. */
|
|
50
53
|
brand?: BrandTheme;
|
|
51
|
-
/** Space density: "comfy" (default, base 4 px; "comfortable" is a deprecated alias) or "compact" (base 2 px: every space token halves, odd results rounded up to even). Sets data-density on the root or the wrapper
|
|
52
|
-
density?: 'comfy' | 'compact' | /** @deprecated Use comfy. */ 'comfortable';
|
|
54
|
+
/** Space density: "comfy" (default, base 4 px; "comfortable" is a deprecated alias) or "compact" (base 2 px: every space token halves, odd results rounded up to even). Sets data-density on the root or the wrapper: the control heights go down 4 px, the control padding stays wide (never narrower than the vertical air) and a touch pointer keeps every control at 44 px or more. */
|
|
55
|
+
density?: 'comfy' | 'compact' | /** Comfy spacing with every control at least 44 px tall and a 44 px hit area on small targets (checks, breadcrumb links, the side navigation), whatever the pointer: for apps used on phones and tablets. */ 'touch' | /** @deprecated Use comfy. */ 'comfortable';
|
|
53
56
|
/** Your router's navigate function (React Router's useNavigate(), Next's router.push): links in the kit then navigate without a reload. */
|
|
54
57
|
navigate?: (path: string, options?: any) => void;
|
|
55
58
|
/** Your router's useHref, for routers with a base path. */
|