@alea-design/ui 0.7.0 → 0.7.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/more/More.d.ts +3 -1
- package/dist/components/more/More.js +46 -46
- package/dist/components/page/PageParts.d.ts +4 -2
- package/dist/components/page/PageParts.js +74 -74
- package/dist/components/table/Table.d.ts +3 -1
- package/dist/components/table/Table.js +58 -57
- package/dist/css/base.css +1 -1
- package/dist/css/display.css +1 -1
- package/dist/css/groups.json +5 -5
- package/dist/css/more.css +1 -1
- package/dist/css/table.css +1 -1
- package/dist/css/tabs.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/utils/scrollEdges.d.ts +1 -1
- package/dist/utils/scrollEdges.js +23 -22
- package/package.json +3 -3
|
@@ -164,6 +164,8 @@ export interface BannerProps {
|
|
|
164
164
|
children: ReactNode;
|
|
165
165
|
/** accent (default, gradient), neutral, success, info, warning or danger. */
|
|
166
166
|
tone?: 'accent' | 'neutral' | 'success' | 'info' | 'warning' | 'danger';
|
|
167
|
+
/** md (default) or sm: a compact bar with smaller text and padding, for notes that sit above a page without pushing it down (an environment notice). */
|
|
168
|
+
size?: 'sm' | 'md';
|
|
167
169
|
/** A link or button after the message. */
|
|
168
170
|
action?: ReactNode;
|
|
169
171
|
/** Shows a close button; called when closed. */
|
|
@@ -173,4 +175,4 @@ export interface BannerProps {
|
|
|
173
175
|
className?: string;
|
|
174
176
|
}
|
|
175
177
|
/** A site-wide announcement bar above the header: launches, sales, outages. */
|
|
176
|
-
export declare function Banner({ children, tone, action, onDismiss, className, 'aria-label': label }: BannerProps): import("react").JSX.Element | null;
|
|
178
|
+
export declare function Banner({ children, tone, size, action, onDismiss, className, 'aria-label': label }: BannerProps): import("react").JSX.Element | null;
|
|
@@ -8,14 +8,14 @@ import { formatDecimal as H } from "../../utils/decimal.js";
|
|
|
8
8
|
import { Spinner as L } from "../feedback/Spinner.js";
|
|
9
9
|
import { useStrings as $ } from "../../i18n/strings.js";
|
|
10
10
|
import { inertProps as R } from "../../utils/inert.js";
|
|
11
|
-
const aa = M(function({ target: t = "main", children: l, className: s, ...
|
|
11
|
+
const aa = M(function({ target: t = "main", children: l, className: s, ...i }, r) {
|
|
12
12
|
const o = $();
|
|
13
|
-
return l ?? (l = o.skipToContent), /* @__PURE__ */ a("a", { ref: r, href: `#${t}`, ...
|
|
14
|
-
}), ea = M(function({ children: t, as: l = "span", className: s, ...
|
|
15
|
-
return /* @__PURE__ */ a(l, { ref: r, ...
|
|
13
|
+
return l ?? (l = o.skipToContent), /* @__PURE__ */ a("a", { ref: r, href: `#${t}`, ...i, className: m("alea-skip-link", s), children: l });
|
|
14
|
+
}), ea = M(function({ children: t, as: l = "span", className: s, ...i }, r) {
|
|
15
|
+
return /* @__PURE__ */ a(l, { ref: r, ...i, className: m("alea-visually-hidden", s), children: t });
|
|
16
16
|
});
|
|
17
|
-
function la({ title: e, children: t, isExpanded: l, defaultExpanded: s, onExpandedChange:
|
|
18
|
-
return /* @__PURE__ */ u(A, { isExpanded: l, defaultExpanded: s, onExpandedChange:
|
|
17
|
+
function la({ title: e, children: t, isExpanded: l, defaultExpanded: s, onExpandedChange: i, className: r }) {
|
|
18
|
+
return /* @__PURE__ */ u(A, { isExpanded: l, defaultExpanded: s, onExpandedChange: i, className: m("alea-collapsible", r), children: [
|
|
19
19
|
/* @__PURE__ */ u(I, { slot: "trigger", className: "alea-collapsible-trigger alea-focus-ring", children: [
|
|
20
20
|
/* @__PURE__ */ a(O, { size: 16, "aria-hidden": "true", className: "alea-collapsible-chevron" }),
|
|
21
21
|
e
|
|
@@ -23,32 +23,32 @@ function la({ title: e, children: t, isExpanded: l, defaultExpanded: s, onExpand
|
|
|
23
23
|
/* @__PURE__ */ a(K, { className: "alea-collapsible-panel", children: /* @__PURE__ */ a("div", { className: "alea-collapsible-content", children: t }) })
|
|
24
24
|
] });
|
|
25
25
|
}
|
|
26
|
-
function ta({ value: e, defaultValue: t = "", onSave: l, label: s, placeholder:
|
|
27
|
-
const p = $(), [
|
|
26
|
+
function ta({ value: e, defaultValue: t = "", onSave: l, label: s, placeholder: i = "Empty", multiline: r, className: o }) {
|
|
27
|
+
const p = $(), [f, h] = k(t), n = e ?? f, [c, b] = k(!1), [N, C] = k(n), [v, w] = k(!1), x = D(null), g = D(null);
|
|
28
28
|
z(() => {
|
|
29
29
|
var d, q;
|
|
30
|
-
|
|
31
|
-
}, [
|
|
30
|
+
c && ((d = x.current) == null || d.focus(), (q = x.current) == null || q.select());
|
|
31
|
+
}, [c]);
|
|
32
32
|
const y = () => {
|
|
33
33
|
if ((l == null ? void 0 : l(N)) === !1) {
|
|
34
34
|
w(!0);
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
e === void 0 &&
|
|
37
|
+
e === void 0 && h(N), b(!1), w(!1), requestAnimationFrame(() => {
|
|
38
38
|
var d;
|
|
39
|
-
return (d =
|
|
39
|
+
return (d = g.current) == null ? void 0 : d.focus();
|
|
40
40
|
});
|
|
41
41
|
}, S = () => {
|
|
42
|
-
|
|
42
|
+
b(!1), w(!1), requestAnimationFrame(() => {
|
|
43
43
|
var d;
|
|
44
|
-
return (d =
|
|
44
|
+
return (d = g.current) == null ? void 0 : d.focus();
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
|
-
if (!
|
|
48
|
-
return /* @__PURE__ */ u("button", { ref:
|
|
49
|
-
C(n),
|
|
47
|
+
if (!c)
|
|
48
|
+
return /* @__PURE__ */ u("button", { ref: g, type: "button", className: m("alea-editable alea-focus-ring", o), "data-empty": !n || void 0, "aria-label": `${s}: ${n || i}. Edit`, onClick: () => {
|
|
49
|
+
C(n), b(!0);
|
|
50
50
|
}, children: [
|
|
51
|
-
/* @__PURE__ */ a("span", { className: "alea-editable-text", children: n ||
|
|
51
|
+
/* @__PURE__ */ a("span", { className: "alea-editable-text", children: n || i }),
|
|
52
52
|
/* @__PURE__ */ a(F, { size: 14, "aria-hidden": "true", className: "alea-editable-icon" })
|
|
53
53
|
] });
|
|
54
54
|
const E = r ? "textarea" : "input";
|
|
@@ -78,21 +78,21 @@ function na({ value: e, format: t, locale: l }) {
|
|
|
78
78
|
return /* @__PURE__ */ a(T, { children: H(e, l, t) });
|
|
79
79
|
}
|
|
80
80
|
const V = (e) => String(e).padStart(2, "0");
|
|
81
|
-
function sa({ to: e, label: t, onEnd: l, showDays: s, className:
|
|
82
|
-
const r = $(), o = typeof e == "number" ? e : e.getTime(), [p,
|
|
81
|
+
function sa({ to: e, label: t, onEnd: l, showDays: s, className: i }) {
|
|
82
|
+
const r = $(), o = typeof e == "number" ? e : e.getTime(), [p, f] = k(() => Date.now()), h = D(!1);
|
|
83
83
|
z(() => {
|
|
84
|
-
const
|
|
85
|
-
return () => clearInterval(
|
|
84
|
+
const g = setInterval(() => f(Date.now()), 1e3);
|
|
85
|
+
return () => clearInterval(g);
|
|
86
86
|
}, []);
|
|
87
87
|
const n = Math.max(0, o - p);
|
|
88
88
|
z(() => {
|
|
89
|
-
n === 0 && !
|
|
89
|
+
n === 0 && !h.current && (h.current = !0, l == null || l());
|
|
90
90
|
}, [n, l]);
|
|
91
|
-
const
|
|
92
|
-
return /* @__PURE__ */ u("div", { className: m("alea-stat alea-countdown",
|
|
91
|
+
const c = Math.floor(n / 864e5), b = Math.floor(n / 36e5) % 24, N = Math.floor(n / 6e4) % 60, C = Math.floor(n / 1e3) % 60, v = s ?? c > 0, w = [...v ? [[c, "d"]] : [], [v ? b : b + c * 24, "h"], [N, "m"], [C, "s"]], x = `${v ? `${c} days, ` : ""}${v ? b : b + c * 24} hours, ${N} minutes`;
|
|
92
|
+
return /* @__PURE__ */ u("div", { className: m("alea-stat alea-countdown", i), children: [
|
|
93
93
|
/* @__PURE__ */ a("span", { className: "alea-stat-label", children: t }),
|
|
94
|
-
/* @__PURE__ */ a("span", { className: "alea-stat-value alea-countdown-value", "aria-hidden": "true", children: w.map(([
|
|
95
|
-
/* @__PURE__ */ a("b", { children: y === "d" ?
|
|
94
|
+
/* @__PURE__ */ a("span", { className: "alea-stat-value alea-countdown-value", "aria-hidden": "true", children: w.map(([g, y]) => /* @__PURE__ */ u("span", { children: [
|
|
95
|
+
/* @__PURE__ */ a("b", { children: y === "d" ? g : V(g) }),
|
|
96
96
|
/* @__PURE__ */ a("small", { children: y })
|
|
97
97
|
] }, y)) }),
|
|
98
98
|
/* @__PURE__ */ a("span", { className: "alea-visually-hidden", "aria-live": "polite", children: n === 0 ? r.ended : x })
|
|
@@ -104,35 +104,35 @@ function ra({ tone: e = "neutral", children: t, pulse: l, className: s }) {
|
|
|
104
104
|
t
|
|
105
105
|
] });
|
|
106
106
|
}
|
|
107
|
-
function ia({ color: e, label: t, size: l = 28, shape: s = "circle", showValue:
|
|
107
|
+
function ia({ color: e, label: t, size: l = 28, shape: s = "circle", showValue: i, className: r, style: o }) {
|
|
108
108
|
const p = /* @__PURE__ */ a("span", { className: "alea-swatch", "data-shape": s, role: "img", "aria-label": t, style: { width: l, height: l, "--alea-swatch": e, ...o } });
|
|
109
|
-
return
|
|
109
|
+
return i ? /* @__PURE__ */ u("span", { className: m("alea-swatch-wrap", r), "data-labeled": !0, children: [
|
|
110
110
|
p,
|
|
111
111
|
/* @__PURE__ */ a("span", { className: "alea-swatch-name", "aria-hidden": "true", children: t }),
|
|
112
112
|
/* @__PURE__ */ a("code", { className: "alea-swatch-value", children: e })
|
|
113
113
|
] }) : /* @__PURE__ */ a("span", { className: m("alea-swatch-wrap", r), children: p });
|
|
114
114
|
}
|
|
115
|
-
function ca({ isLoading: e, children: t, label: l, blur: s = !0, className:
|
|
115
|
+
function ca({ isLoading: e, children: t, label: l, blur: s = !0, className: i }) {
|
|
116
116
|
const r = $();
|
|
117
|
-
return l ?? (l = r.loading), /* @__PURE__ */ u("div", { className: m("alea-loading",
|
|
117
|
+
return l ?? (l = r.loading), /* @__PURE__ */ u("div", { className: m("alea-loading", i), "aria-busy": e || void 0, children: [
|
|
118
118
|
/* @__PURE__ */ a("div", { className: "alea-loading-content", ...R(e), children: t }),
|
|
119
119
|
e && /* @__PURE__ */ a("div", { className: "alea-loading-overlay", "data-blur": s || void 0, children: /* @__PURE__ */ a(L, { size: "md", "aria-label": l }) })
|
|
120
120
|
] });
|
|
121
121
|
}
|
|
122
|
-
function oa({ segments: e, total: t, label: l, valueFormat: s = (o) => String(o), showLegend:
|
|
123
|
-
const o = j(), p = t ?? e.reduce((n,
|
|
122
|
+
function oa({ segments: e, total: t, label: l, valueFormat: s = (o) => String(o), showLegend: i = !0, className: r }) {
|
|
123
|
+
const o = j(), p = t ?? e.reduce((n, c) => n + c.value, 0), f = (n, c) => n.color || `var(--alea-chart-${c % 8 + 1})`, h = e.reduce((n, c) => n + c.value, 0);
|
|
124
124
|
return /* @__PURE__ */ u("div", { className: m("alea-progress-seg", r), children: [
|
|
125
125
|
/* @__PURE__ */ u("div", { className: "alea-progress-seg-head", children: [
|
|
126
126
|
/* @__PURE__ */ a("span", { id: o, className: "alea-label", children: l }),
|
|
127
127
|
/* @__PURE__ */ u("span", { className: "alea-progress-seg-total", children: [
|
|
128
|
-
s(
|
|
128
|
+
s(h),
|
|
129
129
|
" of ",
|
|
130
130
|
s(p)
|
|
131
131
|
] })
|
|
132
132
|
] }),
|
|
133
|
-
/* @__PURE__ */ a("div", { className: "alea-progress-seg-bar", role: "meter", "aria-labelledby": o, "aria-valuemin": 0, "aria-valuemax": p, "aria-valuenow":
|
|
134
|
-
|
|
135
|
-
/* @__PURE__ */ a("span", { style: { background:
|
|
133
|
+
/* @__PURE__ */ a("div", { className: "alea-progress-seg-bar", role: "meter", "aria-labelledby": o, "aria-valuemin": 0, "aria-valuemax": p, "aria-valuenow": h, "aria-valuetext": e.map((n) => `${n.label} ${s(n.value)}`).join(", "), children: e.map((n, c) => /* @__PURE__ */ a("span", { className: "alea-progress-seg-part", style: { width: `${n.value / (p || 1) * 100}%`, background: f(n, c), animationDelay: `${c * 60}ms` } }, n.label)) }),
|
|
134
|
+
i && /* @__PURE__ */ a("ul", { className: "alea-progress-seg-legend", "aria-hidden": "true", children: e.map((n, c) => /* @__PURE__ */ u("li", { children: [
|
|
135
|
+
/* @__PURE__ */ a("span", { style: { background: f(n, c) } }),
|
|
136
136
|
n.label,
|
|
137
137
|
/* @__PURE__ */ a("b", { children: s(n.value) })
|
|
138
138
|
] }, n.label)) })
|
|
@@ -153,15 +153,15 @@ function ua({ items: e, marker: t = "bullet", spacing: l = "md", className: s })
|
|
|
153
153
|
function ma({ children: e, size: t = "base", className: l }) {
|
|
154
154
|
return /* @__PURE__ */ a("div", { className: m("alea-prose alea-markdown", l), "data-size": t, children: e });
|
|
155
155
|
}
|
|
156
|
-
function pa({ children: e, tone: t = "accent",
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
const [
|
|
160
|
-
return
|
|
161
|
-
/* @__PURE__ */ a("
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
h(!1),
|
|
156
|
+
function pa({ children: e, tone: t = "accent", size: l = "md", action: s, onDismiss: i, className: r, "aria-label": o }) {
|
|
157
|
+
const p = $();
|
|
158
|
+
o ?? (o = p.announcement);
|
|
159
|
+
const [f, h] = k(!0);
|
|
160
|
+
return f ? /* @__PURE__ */ u("div", { className: m("alea-banner", r), "data-tone": t, "data-size": l === "sm" ? l : void 0, "data-dismissible": i ? !0 : void 0, role: "region", "aria-label": o, children: [
|
|
161
|
+
/* @__PURE__ */ a("div", { className: "alea-banner-text", children: e }),
|
|
162
|
+
s && /* @__PURE__ */ a("span", { className: "alea-banner-action", children: s }),
|
|
163
|
+
i && /* @__PURE__ */ a("button", { type: "button", className: "alea-banner-close alea-focus-ring", "aria-label": p.dismissAnnouncement, onClick: () => {
|
|
164
|
+
h(!1), i();
|
|
165
165
|
}, children: /* @__PURE__ */ a(P, { size: 16 }) })
|
|
166
166
|
] }) : null;
|
|
167
167
|
}
|
|
@@ -8,7 +8,7 @@ export interface PageAction {
|
|
|
8
8
|
onAction?: () => void;
|
|
9
9
|
href?: string;
|
|
10
10
|
isDisabled?: boolean;
|
|
11
|
-
tone?: '
|
|
11
|
+
tone?: 'neutral' | 'danger' | /** @deprecated Use neutral. */ 'default';
|
|
12
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
13
|
menuOnly?: boolean;
|
|
14
14
|
}
|
|
@@ -36,6 +36,8 @@ export interface PageHeaderProps {
|
|
|
36
36
|
secondaryActions?: PageAction[];
|
|
37
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
38
|
maxVisibleActions?: number;
|
|
39
|
+
/** Writes "More actions" next to the dots of the More menu instead of showing the dots alone, for a header where a bare icon is not clear enough. */
|
|
40
|
+
showMoreLabel?: boolean;
|
|
39
41
|
/** Tabs or a segmented control under the header. */
|
|
40
42
|
tabs?: ReactNode;
|
|
41
43
|
/** Heading level. Default 1. */
|
|
@@ -50,7 +52,7 @@ export interface PageHeaderProps {
|
|
|
50
52
|
className?: string;
|
|
51
53
|
}
|
|
52
54
|
/** 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`. */
|
|
53
|
-
export declare function PageHeader({ title, subtitle, back, backLabel, breadcrumbs, media, meta, actions, secondaryActions, maxVisibleActions, tabs, headingLevel, sticky, compact, hideTitle, className }: PageHeaderProps): import("react").JSX.Element;
|
|
55
|
+
export declare function PageHeader({ title, subtitle, back, backLabel, breadcrumbs, media, meta, actions, secondaryActions, maxVisibleActions, showMoreLabel, tabs, headingLevel, sticky, compact, hideTitle, className }: PageHeaderProps): import("react").JSX.Element;
|
|
54
56
|
export interface SaveBarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
55
57
|
/** Show it while there are unsaved changes. */
|
|
56
58
|
isVisible: boolean;
|
|
@@ -1,117 +1,117 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { Info as
|
|
2
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as T, useState as I, useEffect as S, createElement as q, forwardRef as C } from "react";
|
|
4
|
+
import { Info as G, ArrowLeft as H, MoreHorizontal as L } from "lucide-react";
|
|
5
5
|
import { cx as w } from "../../utils/cx.js";
|
|
6
|
-
import { Button as
|
|
7
|
-
import { Breadcrumbs as
|
|
8
|
-
import { DropdownMenu as
|
|
6
|
+
import { Button as P, IconButton as M } from "../button/Button.js";
|
|
7
|
+
import { Breadcrumbs as J, Breadcrumb as Q } from "../navigation/Navigation.js";
|
|
8
|
+
import { DropdownMenu as U, MenuItem as X } from "../menu/Menu.js";
|
|
9
9
|
import { useStrings as R } from "../../i18n/strings.js";
|
|
10
|
-
import { inertProps as
|
|
11
|
-
import { useMeasured as
|
|
12
|
-
function
|
|
10
|
+
import { inertProps as Y } from "../../utils/inert.js";
|
|
11
|
+
import { useMeasured as Z, remPx as V } from "../../utils/measure.js";
|
|
12
|
+
function O({ actions: t, label: a, showLabel: i }) {
|
|
13
13
|
return /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
14
|
-
|
|
14
|
+
U,
|
|
15
15
|
{
|
|
16
16
|
"aria-label": a,
|
|
17
17
|
placement: "bottom end",
|
|
18
|
-
trigger: /* @__PURE__ */ e(
|
|
18
|
+
trigger: i ? /* @__PURE__ */ e(P, { variant: "ghost", size: "sm", iconStart: /* @__PURE__ */ e(L, {}), children: a }) : /* @__PURE__ */ e(M, { "aria-label": a, size: "sm", children: /* @__PURE__ */ e(L, {}) }),
|
|
19
19
|
menuProps: { onAction: (n) => {
|
|
20
|
-
var
|
|
21
|
-
return (
|
|
20
|
+
var l, h;
|
|
21
|
+
return (h = (l = t.find((u) => u.id === n)) == null ? void 0 : l.onAction) == null ? void 0 : h.call(l);
|
|
22
22
|
} },
|
|
23
|
-
children: t.map((n) => /* @__PURE__ */ e(
|
|
23
|
+
children: t.map((n) => /* @__PURE__ */ e(X, { id: n.id, icon: n.icon, href: n.href, isDisabled: n.isDisabled, tone: n.tone, children: n.label }, String(n.id)))
|
|
24
24
|
}
|
|
25
25
|
) });
|
|
26
26
|
}
|
|
27
|
-
const
|
|
28
|
-
function
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
const r =
|
|
27
|
+
const ee = 45, ae = (t) => t.clientWidth > 0 && t.clientWidth < ee * V();
|
|
28
|
+
function me({ title: t, subtitle: a, back: i, backLabel: c, breadcrumbs: n, media: l, meta: h, actions: u, secondaryActions: o, maxVisibleActions: p, showMoreLabel: v, tabs: m, headingLevel: f = 1, sticky: s, compact: y, hideTitle: z, className: g }) {
|
|
29
|
+
const b = R(), B = T(null), [W, j] = I(!1);
|
|
30
|
+
S(() => {
|
|
31
|
+
const r = B.current;
|
|
32
32
|
if (!s || !r || typeof IntersectionObserver > "u") return;
|
|
33
33
|
const N = document.createElement("div");
|
|
34
34
|
r.before(N);
|
|
35
|
-
const
|
|
36
|
-
return
|
|
37
|
-
|
|
35
|
+
const A = new IntersectionObserver(([F]) => j(!F.isIntersecting));
|
|
36
|
+
return A.observe(N), () => {
|
|
37
|
+
A.disconnect(), N.remove();
|
|
38
38
|
};
|
|
39
39
|
}, [s]);
|
|
40
|
-
const
|
|
41
|
-
for (const r of o ?? []) (!r.menuOnly &&
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
] }) : null,
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
|
|
54
|
-
|
|
40
|
+
const k = Z(B, ae, !1), K = Math.max(0, p ?? 1 / 0), D = [], E = [];
|
|
41
|
+
for (const r of o ?? []) (!r.menuOnly && D.length < K ? D : E).push(r);
|
|
42
|
+
const x = !!(o != null && o.length), _ = x && !k ? /* @__PURE__ */ d("div", { className: "alea-page-header-secondary", children: [
|
|
43
|
+
D.map((r) => /* @__PURE__ */ e(P, { variant: "ghost", size: "sm", iconStart: r.icon, href: r.href, onPress: r.onAction, isDisabled: r.isDisabled, tone: r.tone === "danger" ? "danger" : void 0, children: r.label }, String(r.id))),
|
|
44
|
+
E.length > 0 && /* @__PURE__ */ e(O, { actions: E, label: b.moreActions, showLabel: v })
|
|
45
|
+
] }) : null, $ = x && k ? /* @__PURE__ */ e(O, { actions: o, label: b.moreActions, showLabel: v }) : null;
|
|
46
|
+
return /* @__PURE__ */ d("header", { ref: B, className: w("alea-page-header", g), "data-sticky": s || void 0, "data-stuck": W || void 0, "data-compact": y || void 0, children: [
|
|
47
|
+
n != null && n.length ? /* @__PURE__ */ e("nav", { "aria-label": b.breadcrumb, children: /* @__PURE__ */ e(J, { className: "alea-page-header-crumbs", children: n.map((r, N) => /* @__PURE__ */ e(Q, { href: N === n.length - 1 ? void 0 : r.href, children: r.label }, N)) }) }) : null,
|
|
48
|
+
/* @__PURE__ */ d("div", { className: "alea-page-header-main", children: [
|
|
49
|
+
i && (typeof i == "string" ? /* @__PURE__ */ e(M, { "aria-label": c ?? b.back, variant: "ghost", size: "sm", href: i, className: "alea-page-header-back", children: /* @__PURE__ */ e(H, {}) }) : /* @__PURE__ */ e(M, { "aria-label": c ?? b.back, variant: "ghost", size: "sm", onPress: i, className: "alea-page-header-back", children: /* @__PURE__ */ e(H, {}) })),
|
|
50
|
+
l && /* @__PURE__ */ e("span", { className: "alea-page-header-media", children: l }),
|
|
51
|
+
/* @__PURE__ */ d("div", { className: "alea-page-header-titles", children: [
|
|
52
|
+
/* @__PURE__ */ d("div", { className: "alea-page-header-title-row", children: [
|
|
53
|
+
q(`h${f}`, { className: w("alea-page-header-title", z && "alea-visually-hidden") }, t),
|
|
54
|
+
h && /* @__PURE__ */ e("div", { className: "alea-page-header-meta", children: h })
|
|
55
55
|
] }),
|
|
56
56
|
a && /* @__PURE__ */ e("p", { className: "alea-page-header-subtitle", children: a })
|
|
57
57
|
] }),
|
|
58
|
-
(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
(u || x) && /* @__PURE__ */ d("div", { className: "alea-page-header-actions", children: [
|
|
59
|
+
_,
|
|
60
|
+
u,
|
|
61
|
+
$
|
|
62
62
|
] })
|
|
63
63
|
] }),
|
|
64
|
-
|
|
64
|
+
m && /* @__PURE__ */ e("div", { className: "alea-page-header-tabs", children: m })
|
|
65
65
|
] });
|
|
66
66
|
}
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
return
|
|
70
|
-
if (!a || !
|
|
71
|
-
const
|
|
72
|
-
(
|
|
67
|
+
const ue = C(function({ isVisible: a, message: i, onSave: c, onDiscard: n, isSaving: l, saveLabel: h, discardLabel: u, position: o = "top", saveShortcut: p = !0, className: v, ...m }, f) {
|
|
68
|
+
const s = R(), y = T(c);
|
|
69
|
+
return y.current = c, S(() => {
|
|
70
|
+
if (!a || !p) return;
|
|
71
|
+
const z = (g) => {
|
|
72
|
+
(g.metaKey || g.ctrlKey) && g.key.toLowerCase() === "s" && (g.preventDefault(), y.current());
|
|
73
73
|
};
|
|
74
|
-
return window.addEventListener("keydown",
|
|
75
|
-
}, [a,
|
|
76
|
-
/* @__PURE__ */ e("p", { className: "alea-savebar-message", "aria-live": "polite", children: a ?
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
|
|
79
|
-
/* @__PURE__ */ e(
|
|
74
|
+
return window.addEventListener("keydown", z), () => window.removeEventListener("keydown", z);
|
|
75
|
+
}, [a, p]), /* @__PURE__ */ d("div", { ref: f, ...m, className: w("alea-savebar", v), "data-visible": a || void 0, "data-position": o, role: "region", "aria-label": m["aria-label"] ?? s.unsavedChanges, "aria-hidden": !a || void 0, ...Y(!a), children: [
|
|
76
|
+
/* @__PURE__ */ e("p", { className: "alea-savebar-message", "aria-live": "polite", children: a ? i ?? s.unsavedChanges : "" }),
|
|
77
|
+
/* @__PURE__ */ d("div", { className: "alea-savebar-actions", children: [
|
|
78
|
+
n && /* @__PURE__ */ e(P, { variant: "ghost", size: "sm", onPress: n, isDisabled: l, children: u ?? s.discard }),
|
|
79
|
+
/* @__PURE__ */ e(P, { size: "sm", variant: "secondary", onPress: c, isLoading: l, shortcut: p ? "⌘S" : void 0, children: h ?? s.save })
|
|
80
80
|
] })
|
|
81
81
|
] });
|
|
82
|
-
}),
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
82
|
+
}), pe = C(function({ isLoading: a, value: i, "aria-label": c, className: n, ...l }, h) {
|
|
83
|
+
const u = R(), [o, p] = I(a), [v, m] = I(!1);
|
|
84
|
+
if (S(() => {
|
|
85
85
|
if (a) {
|
|
86
|
-
|
|
86
|
+
p(!0), m(!1);
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
if (!o) return;
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
90
|
+
m(!0);
|
|
91
|
+
const s = setTimeout(() => {
|
|
92
|
+
p(!1), m(!1);
|
|
93
93
|
}, 500);
|
|
94
|
-
return () => clearTimeout(
|
|
94
|
+
return () => clearTimeout(s);
|
|
95
95
|
}, [a]), !o) return null;
|
|
96
|
-
const
|
|
97
|
-
return /* @__PURE__ */ e("div", { ref:
|
|
96
|
+
const f = v ? 100 : i;
|
|
97
|
+
return /* @__PURE__ */ e("div", { ref: h, ...l, className: w("alea-top-loading", n), role: "progressbar", "aria-label": c ?? u.loading, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": f, "data-done": v || void 0, "data-indeterminate": f == null || void 0, children: /* @__PURE__ */ e("span", { className: "alea-top-loading-bar", style: f != null ? { width: `${f}%` } : void 0 }) });
|
|
98
98
|
});
|
|
99
|
-
function
|
|
100
|
-
return /* @__PURE__ */
|
|
101
|
-
/* @__PURE__ */ e(
|
|
99
|
+
function fe({ children: t, className: a }) {
|
|
100
|
+
return /* @__PURE__ */ d("p", { className: w("alea-footer-help", a), children: [
|
|
101
|
+
/* @__PURE__ */ e(G, { size: 16, "aria-hidden": "true" }),
|
|
102
102
|
/* @__PURE__ */ e("span", { children: t })
|
|
103
103
|
] });
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
return /* @__PURE__ */
|
|
105
|
+
function ve({ primary: t, secondary: a, className: i }) {
|
|
106
|
+
return /* @__PURE__ */ d("div", { className: w("alea-page-actions", i), children: [
|
|
107
107
|
/* @__PURE__ */ e("div", { className: "alea-page-actions-secondary", children: a }),
|
|
108
108
|
/* @__PURE__ */ e("div", { className: "alea-page-actions-primary", children: t })
|
|
109
109
|
] });
|
|
110
110
|
}
|
|
111
111
|
export {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
112
|
+
fe as FooterHelp,
|
|
113
|
+
ve as PageActions,
|
|
114
|
+
me as PageHeader,
|
|
115
|
+
ue as SaveBar,
|
|
116
|
+
pe as TopLoadingBar
|
|
117
117
|
};
|
|
@@ -23,13 +23,15 @@ export interface TableProps extends RACTableProps, SurfaceProps {
|
|
|
23
23
|
noWrap?: boolean;
|
|
24
24
|
/** 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. */
|
|
25
25
|
scrollLabel?: string;
|
|
26
|
+
/** Keeps the first column, the last one or both in view while the table scrolls sideways (a Total column that must not be cut off). A soft edge shadow shows on a pinned column only while content scrolls under it. With row selection the checkbox column is the first. */
|
|
27
|
+
stickyColumns?: 'start' | 'end' | 'both';
|
|
26
28
|
/** Renders only the rows on screen, for thousands of rows: fixed row height in px (needs maxHeight). */
|
|
27
29
|
virtualized?: {
|
|
28
30
|
rowHeight: number;
|
|
29
31
|
headingHeight?: number;
|
|
30
32
|
};
|
|
31
33
|
}
|
|
32
|
-
export declare function Table({ stickyHeader, density: densityRaw, maxHeight, resizable, variant, stackBelow, stackHideEmpty, stickyFooter, scrollLabel, noWrap, virtualized, surface, radius, className, ...props }: TableProps): import("react").JSX.Element;
|
|
34
|
+
export declare function Table({ stickyHeader, density: densityRaw, maxHeight, resizable, variant, stackBelow, stackHideEmpty, stickyFooter, stickyColumns, scrollLabel, noWrap, virtualized, surface, radius, className, ...props }: TableProps): import("react").JSX.Element;
|
|
33
35
|
/** The header row. Adds the select-all checkbox when the table selects multiple rows. */
|
|
34
36
|
export declare function TableHeader<T extends object>({ columns, children, className, ...props }: TableHeaderProps<T>): import("react").JSX.Element;
|
|
35
37
|
export interface ColumnProps extends RACColumnProps {
|
|
@@ -1,82 +1,83 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as t, jsxs 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
|
-
import { useAnimatedRows as
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
import { jsx as t, jsxs as f } from "react/jsx-runtime";
|
|
3
|
+
import { useContext as T, createContext as E, useRef as F, useEffect as M } from "react";
|
|
4
|
+
import { Cell as b, Column as h, useTableOptions as C, Row as O, Collection as A, Table as P, Virtualizer as W, TableLayout as j, ResizableTableContainer as V, TableBody as L, TableFooter as U, TableHeader as q, TableColumnResizeStateContext as G, ColumnResizer as I, Checkbox as J } from "react-aria-components";
|
|
5
|
+
import { ArrowUp as K, Minus as Q, Check as X } from "lucide-react";
|
|
6
|
+
import { surfaceAttrs as Y } from "../surface/Surface.js";
|
|
7
|
+
import { withBase as u, cx as p } from "../../utils/cx.js";
|
|
8
|
+
import { DragHandle as Z } from "../list/List.js";
|
|
9
|
+
import { useStrings as _ } from "../../i18n/strings.js";
|
|
10
|
+
import { renamedValue as ee } from "../../utils/vocabulary.js";
|
|
11
|
+
import { useAnimatedRows as te } from "../../utils/animateRows.js";
|
|
12
|
+
import { useScrollEdges as ae } from "../../utils/scrollEdges.js";
|
|
13
|
+
function x({ slot: a }) {
|
|
14
|
+
return /* @__PURE__ */ t(J, { 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(Q, { size: 14, strokeWidth: 3 }) : /* @__PURE__ */ t(X, { size: 14, strokeWidth: 3 }) }) });
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
-
const r =
|
|
17
|
-
return
|
|
16
|
+
function re(a) {
|
|
17
|
+
const r = F(null);
|
|
18
|
+
return M(() => {
|
|
18
19
|
const e = r.current;
|
|
19
20
|
if (!a || !e) return;
|
|
20
|
-
const
|
|
21
|
+
const l = () => {
|
|
21
22
|
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
|
};
|
|
23
|
-
if (
|
|
24
|
+
if (l(), typeof ResizeObserver > "u") return () => {
|
|
24
25
|
e.removeAttribute("role"), e.removeAttribute("aria-label"), e.removeAttribute("tabindex");
|
|
25
26
|
};
|
|
26
|
-
const
|
|
27
|
-
return
|
|
28
|
-
|
|
27
|
+
const o = new ResizeObserver(l);
|
|
28
|
+
return o.observe(e), e.firstElementChild && o.observe(e.firstElementChild), () => {
|
|
29
|
+
o.disconnect(), e.removeAttribute("role"), e.removeAttribute("aria-label"), e.removeAttribute("tabindex");
|
|
29
30
|
};
|
|
30
31
|
}, [a]), r;
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
-
const
|
|
34
|
-
return
|
|
33
|
+
function ve({ stickyHeader: a, density: r = "comfy", maxHeight: e, resizable: l, variant: o = "default", stackBelow: n, stackHideEmpty: s, stickyFooter: d, stickyColumns: i, scrollLabel: v, noWrap: k, virtualized: c, surface: z, radius: $, className: B, ...H }) {
|
|
34
|
+
const S = ee("Table", "density", r, { comfortable: "comfy" }) === "compact" ? "compact" : "comfy", g = /* @__PURE__ */ t(P, { ...H, className: u("alea-table", B), "data-density": S, "data-sticky": a || c ? !0 : void 0, "data-variant": o !== "default" ? o : void 0, "data-stack": n, "data-stack-hide-empty": n && s ? !0 : void 0, "data-sticky-footer": d ? !0 : void 0, "data-pin": i, "data-virtualized": c ? !0 : void 0, "data-nowrap": k || void 0 }), y = c ? /* @__PURE__ */ t(W, { layout: j, layoutOptions: { rowHeight: c.rowHeight, headingHeight: c.headingHeight ?? 44 }, children: g }) : g, D = e ? { maxHeight: e, ...c ? { height: e } : {} } : void 0, m = re(v), { edges: N } = ae(m, "", !!i), w = { className: "alea-table-wrap", style: D, "data-scrolled-start": N.start || void 0, "data-scrolled-end": N.end || void 0, ...Y({ surface: z, radius: $ }) };
|
|
35
|
+
return l ? /* @__PURE__ */ t(V, { ref: m, ...w, children: y }) : /* @__PURE__ */ t("div", { ref: m, ...w, children: y });
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
-
const
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
-
d && /* @__PURE__ */ t(
|
|
40
|
-
n === "toggle" && /* @__PURE__ */ t(
|
|
41
|
-
/* @__PURE__ */ t(
|
|
37
|
+
function ge({ columns: a, children: r, className: e, ...l }) {
|
|
38
|
+
const o = _(), { selectionBehavior: n, selectionMode: s, allowsDragging: d } = C();
|
|
39
|
+
return /* @__PURE__ */ f(q, { ...l, className: p("alea-thead", e), children: [
|
|
40
|
+
d && /* @__PURE__ */ t(h, { className: "alea-th alea-th-narrow", children: /* @__PURE__ */ t("span", { className: "alea-visually-hidden", children: o.dragToMove }) }),
|
|
41
|
+
n === "toggle" && /* @__PURE__ */ t(h, { className: "alea-th alea-th-narrow", children: s === "multiple" && /* @__PURE__ */ t(x, { slot: "selection" }) }),
|
|
42
|
+
/* @__PURE__ */ t(A, { items: a, children: r })
|
|
42
43
|
] });
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
-
return /* @__PURE__ */ t(
|
|
45
|
+
function ye({ children: a, align: r = "start", className: e, ...l }) {
|
|
46
|
+
return /* @__PURE__ */ t(h, { ...l, className: u("alea-th", e), "data-align": r, children: ({ allowsSorting: o, sortDirection: n }) => /* @__PURE__ */ f("div", { className: "alea-th-inner", children: [
|
|
46
47
|
/* @__PURE__ */ t("span", { className: "alea-th-label", children: a }),
|
|
47
|
-
|
|
48
|
-
/* @__PURE__ */ t(
|
|
48
|
+
o && /* @__PURE__ */ t(K, { size: 14, "aria-hidden": "true", className: "alea-sort", "data-direction": n }),
|
|
49
|
+
/* @__PURE__ */ t(oe, {})
|
|
49
50
|
] }) });
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
52
|
+
function oe() {
|
|
53
|
+
return T(G) ? /* @__PURE__ */ t(I, { className: "alea-col-resizer" }) : null;
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
-
const
|
|
56
|
-
return /* @__PURE__ */ t(
|
|
55
|
+
function Ne({ className: a, animateRows: r, items: e, children: l, dependencies: o, ...n }) {
|
|
56
|
+
const s = te(e, l, r);
|
|
57
|
+
return /* @__PURE__ */ t(L, { ...n, items: s.items, dependencies: s.dependencies ? [...o ?? [], ...s.dependencies] : o, className: p("alea-tbody", a), children: s.children });
|
|
57
58
|
}
|
|
58
|
-
const
|
|
59
|
-
function
|
|
60
|
-
return /* @__PURE__ */ t(
|
|
59
|
+
const R = E(!1);
|
|
60
|
+
function we({ className: a, children: r, ...e }) {
|
|
61
|
+
return /* @__PURE__ */ t(U, { ...e, className: p("alea-tfoot", a), children: /* @__PURE__ */ t(R.Provider, { value: !0, children: r }) });
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
-
const { selectionBehavior: n, allowsDragging:
|
|
64
|
-
return /* @__PURE__ */
|
|
65
|
-
|
|
66
|
-
n === "toggle" && /* @__PURE__ */ t(
|
|
67
|
-
/* @__PURE__ */ t(
|
|
63
|
+
function Te({ id: a, columns: r, children: e, className: l, ...o }) {
|
|
64
|
+
const { selectionBehavior: n, allowsDragging: s, selectionMode: d } = C(), i = T(R);
|
|
65
|
+
return /* @__PURE__ */ f(O, { id: a, ...i && d !== "none" ? { isDisabled: !0 } : {}, ...o, className: u("alea-tr", l), "data-footer": i ? !0 : void 0, children: [
|
|
66
|
+
s && /* @__PURE__ */ t(b, { className: "alea-td alea-td-narrow", children: i ? null : /* @__PURE__ */ t(Z, {}) }),
|
|
67
|
+
n === "toggle" && /* @__PURE__ */ t(b, { className: "alea-td alea-td-narrow", children: i ? null : /* @__PURE__ */ t(x, { slot: "selection" }) }),
|
|
68
|
+
/* @__PURE__ */ t(A, { items: r, dependencies: o.dependencies, children: e })
|
|
68
69
|
] });
|
|
69
70
|
}
|
|
70
|
-
function
|
|
71
|
-
const { align: e, label:
|
|
72
|
-
return /* @__PURE__ */ t(
|
|
71
|
+
function Ce({ className: a, ...r }) {
|
|
72
|
+
const { align: e, label: l, ...o } = r;
|
|
73
|
+
return /* @__PURE__ */ t(b, { ...o, "data-align": e, "data-label": l, className: u("alea-td", a) });
|
|
73
74
|
}
|
|
74
75
|
export {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
Ce as Cell,
|
|
77
|
+
ye as Column,
|
|
78
|
+
Te as Row,
|
|
79
|
+
ve as Table,
|
|
80
|
+
Ne as TableBody,
|
|
81
|
+
we as TableFooter,
|
|
82
|
+
ge as TableHeader
|
|
82
83
|
};
|