@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.
- 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 +76 -52
- package/dist/components/data/Data.d.ts +6 -4
- package/dist/components/data/Data.js +66 -56
- 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.js +27 -27
- package/dist/components/more/More.d.ts +2 -2
- package/dist/components/more/More.js +46 -45
- package/dist/components/navigation/Navigation.d.ts +7 -5
- package/dist/components/navigation/Navigation.js +91 -74
- package/dist/components/navigation/Navigation2.d.ts +9 -3
- package/dist/components/navigation/Navigation2.js +209 -195
- 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 +10 -1
- package/dist/components/overlay/Overlay.js +54 -52
- package/dist/components/overlay/Sheet.d.ts +2 -0
- package/dist/components/overlay/Sheet.js +30 -30
- package/dist/components/page/PageParts.js +20 -20
- 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/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 +36 -20
- 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 +7 -0
- package/dist/i18n/strings.js +14 -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
|
@@ -7,11 +7,11 @@ import { useScrollEdges as L } from "../../utils/scrollEdges.js";
|
|
|
7
7
|
import { cx as g, withBase as A } from "../../utils/cx.js";
|
|
8
8
|
import { chipIcon as v } from "../icon/icon-contexts.js";
|
|
9
9
|
import { useStrings as b } from "../../i18n/strings.js";
|
|
10
|
-
function R({ tone: a = "neutral", appearance: e = "soft", dot: t, icon: l, size: n = "md", shape:
|
|
11
|
-
return /* @__PURE__ */ m("span", { ...
|
|
10
|
+
function R({ tone: a = "neutral", appearance: e = "soft", dot: t, icon: l, size: n = "md", shape: o, wrap: i, className: d, children: c, ...s }) {
|
|
11
|
+
return /* @__PURE__ */ m("span", { ...s, className: g("alea-badge", d), "data-tone": a, "data-appearance": e, "data-size": n, "data-shape": o, "data-wrap": i || void 0, children: [
|
|
12
12
|
t && /* @__PURE__ */ r("span", { className: "alea-badge-dot", "data-pulse": t === "pulse" || void 0, "aria-hidden": "true" }),
|
|
13
13
|
l && /* @__PURE__ */ r("span", { className: "alea-badge-icon", "aria-hidden": "true", ...v("badge", e, a), children: l }),
|
|
14
|
-
|
|
14
|
+
c
|
|
15
15
|
] });
|
|
16
16
|
}
|
|
17
17
|
const M = Object.fromEntries([
|
|
@@ -20,35 +20,35 @@ const M = Object.fromEntries([
|
|
|
20
20
|
...["failed", "error", "canceled", "cancelled", "refunded", "out of stock", "down", "blocked", "overdue", "rejected", "expired", "firing", "rolled back", "disconnected"].map((a) => [a, "danger"]),
|
|
21
21
|
...["open", "todo", "new", "running", "invited"].map((a) => [a, "info"])
|
|
22
22
|
]);
|
|
23
|
-
function J({ status: a, tones: e, tone: t, size: l = "sm", dot: n = !0, ...
|
|
23
|
+
function J({ status: a, tones: e, tone: t, size: l = "sm", dot: n = !0, ...o }) {
|
|
24
24
|
const i = a.trim().toLowerCase(), d = t ?? (e == null ? void 0 : e[i]) ?? M[i] ?? "neutral";
|
|
25
|
-
return /* @__PURE__ */ r(R, { ...
|
|
25
|
+
return /* @__PURE__ */ r(R, { ...o, size: l, dot: n, tone: d, children: a });
|
|
26
26
|
}
|
|
27
|
-
function K({ count: a, max: e = 99, label: t, tone: l = "accent", appearance: n = "solid", showZero:
|
|
27
|
+
function K({ count: a, max: e = 99, label: t, tone: l = "accent", appearance: n = "solid", showZero: o, dot: i, size: d, className: c, ...s }) {
|
|
28
28
|
const u = f(!0);
|
|
29
29
|
return h(() => {
|
|
30
30
|
u.current = !1;
|
|
31
|
-
}, []), a <= 0 && !
|
|
31
|
+
}, []), a <= 0 && !o ? null : /* @__PURE__ */ r("span", { ...s, className: g("alea-count", c), "data-tone": l, "data-appearance": n === "solid" ? void 0 : n, "data-dot": i || void 0, "data-size": d, role: t || i ? "img" : void 0, "aria-label": t || i ? `${a}${t ? ` ${t}` : ""}` : void 0, children: !i && /* @__PURE__ */ r("span", { className: u.current ? void 0 : "alea-badge-pop", "aria-hidden": t ? !0 : void 0, children: a > e ? `${e}+` : a }, a) });
|
|
32
32
|
}
|
|
33
33
|
const N = y({ current: !1 });
|
|
34
|
-
function Q({ label: a, items: e, children: t, renderEmptyState: l, overflow: n = "wrap", className:
|
|
35
|
-
const d = f(null),
|
|
36
|
-
h(() => (
|
|
37
|
-
|
|
34
|
+
function Q({ label: a, items: e, children: t, renderEmptyState: l, overflow: n = "wrap", className: o, ...i }) {
|
|
35
|
+
const d = f(null), c = f(!1);
|
|
36
|
+
h(() => (c.current = !0, () => {
|
|
37
|
+
c.current = !1;
|
|
38
38
|
}), []);
|
|
39
|
-
const { edges:
|
|
40
|
-
return /* @__PURE__ */ r(N.Provider, { value:
|
|
39
|
+
const { edges: s, scroll: u } = L(d, ".alea-tag-list", n === "scroll");
|
|
40
|
+
return /* @__PURE__ */ r(N.Provider, { value: c, children: /* @__PURE__ */ m(z, { ...i, ref: d, "data-overflow": n, "data-overflow-start": s.start || void 0, "data-overflow-end": s.end || void 0, className: g("alea-tag-group", o), children: [
|
|
41
41
|
a && /* @__PURE__ */ r(B, { className: "alea-label", children: a }),
|
|
42
42
|
/* @__PURE__ */ m("div", { className: "alea-tag-scroller", children: [
|
|
43
|
-
|
|
43
|
+
s.start && /* @__PURE__ */ r("button", { type: "button", tabIndex: -1, "aria-hidden": "true", className: "alea-tab-scroll", "data-side": "start", onClick: () => u(-1), children: /* @__PURE__ */ r(j, { size: 16 }) }),
|
|
44
44
|
/* @__PURE__ */ r(E, { items: e, renderEmptyState: l, className: "alea-tag-list", children: t }),
|
|
45
|
-
|
|
45
|
+
s.end && /* @__PURE__ */ r("button", { type: "button", tabIndex: -1, "aria-hidden": "true", className: "alea-tab-scroll", "data-side": "end", onClick: () => u(1), children: /* @__PURE__ */ r(I, { size: 16 }) })
|
|
46
46
|
] })
|
|
47
47
|
] }) });
|
|
48
48
|
}
|
|
49
|
-
function W({ tone: a = "neutral", appearance: e, size: t, icon: l, children: n, className:
|
|
50
|
-
const d = b(),
|
|
51
|
-
return /* @__PURE__ */ r(S, { ...i, textValue:
|
|
49
|
+
function W({ tone: a = "neutral", appearance: e, size: t, icon: l, children: n, className: o, ...i }) {
|
|
50
|
+
const d = b(), c = i.textValue ?? (typeof n == "string" ? n : void 0), s = C(N), u = f(s.current).current;
|
|
51
|
+
return /* @__PURE__ */ r(S, { ...i, textValue: c, "data-added": u || void 0, "data-tone": a, "data-appearance": e, "data-size": t, className: A("alea-tag alea-focus-ring", o), children: (p) => /* @__PURE__ */ m(T, { children: [
|
|
52
52
|
l && /* @__PURE__ */ r("span", { className: "alea-tag-icon", "aria-hidden": "true", ...v("tag", e, a, p.isSelected), children: l }),
|
|
53
53
|
typeof n == "function" ? n(p) : n,
|
|
54
54
|
p.allowsRemoving && /* @__PURE__ */ r($, { slot: "remove", className: "alea-tag-remove", "aria-label": d.remove, children: /* @__PURE__ */ r(G, { size: 12 }) })
|
|
@@ -59,21 +59,21 @@ function O(a) {
|
|
|
59
59
|
const e = a.trim().split(/\s+/).filter(Boolean);
|
|
60
60
|
return ((((t = e[0]) == null ? void 0 : t[0]) || "") + (e.length > 1 ? e[e.length - 1][0] : "")).toUpperCase() || "?";
|
|
61
61
|
}
|
|
62
|
-
function U({ src: a, name: e, size: t = "md", status: l, shape: n = "circle", fallback:
|
|
62
|
+
function U({ src: a, name: e, size: t = "md", status: l, shape: n = "circle", fallback: o, ring: i, count: d, className: c, style: s, ...u }) {
|
|
63
63
|
const [p, w] = k(!1), x = a && !p;
|
|
64
|
-
return /* @__PURE__ */ m("span", { ...u, className: g("alea-avatar",
|
|
65
|
-
x ? /* @__PURE__ */ r("img", { src: a, alt: "", onError: () => w(!0) }) :
|
|
64
|
+
return /* @__PURE__ */ m("span", { ...u, className: g("alea-avatar", c), "data-size": t, "data-shape": n, "data-ring": i === !0 ? "accent" : i || void 0, role: "img", "aria-label": e + (l ? ` (${l})` : "") + (d ? `, ${d}` : ""), style: s, children: [
|
|
65
|
+
x ? /* @__PURE__ */ r("img", { src: a, alt: "", onError: () => w(!0) }) : o ? /* @__PURE__ */ r("span", { className: "alea-avatar-fallback", "aria-hidden": "true", children: o }) : /* @__PURE__ */ r("span", { className: "alea-avatar-initials", "aria-hidden": "true", "data-initials": O(e) }),
|
|
66
66
|
l && /* @__PURE__ */ r("span", { className: "alea-avatar-status", "data-status": l, "aria-hidden": "true" }),
|
|
67
67
|
d ? /* @__PURE__ */ r("span", { className: "alea-avatar-count", "aria-hidden": "true", children: d > 99 ? "99+" : d }) : null
|
|
68
68
|
] });
|
|
69
69
|
}
|
|
70
|
-
function Y({ people: a, max: e = 4, size: t = "md", fan: l, spacing: n, className:
|
|
71
|
-
const d = b(),
|
|
72
|
-
return /* @__PURE__ */ m("div", { ...i, className: g("alea-avatar-group",
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
function Y({ people: a, max: e = 4, size: t = "md", fan: l, spacing: n, className: o, ...i }) {
|
|
71
|
+
const d = b(), c = a.slice(0, e), s = a.length - c.length;
|
|
72
|
+
return /* @__PURE__ */ m("div", { ...i, className: g("alea-avatar-group", o), "data-fan": l || void 0, "data-spacing": n, role: "group", "aria-label": d.people(a.length), children: [
|
|
73
|
+
c.map((u) => /* @__PURE__ */ r(U, { name: u.name, src: u.src, size: t }, u.name)),
|
|
74
|
+
s > 0 && /* @__PURE__ */ r("span", { className: "alea-avatar alea-avatar-more", "data-size": t, role: "img", "aria-label": d.andMore(s), children: /* @__PURE__ */ m("span", { "aria-hidden": "true", children: [
|
|
75
75
|
"+",
|
|
76
|
-
|
|
76
|
+
s
|
|
77
77
|
] }) })
|
|
78
78
|
] });
|
|
79
79
|
}
|
|
@@ -39,8 +39,8 @@ export interface PaymentCardProps {
|
|
|
39
39
|
/** A bank card as a picture: issuer, number ending, holder and expiry on a gradient. One image for screen readers ("Physical card for Ana, ending 4410"). */
|
|
40
40
|
export declare function PaymentCard({ holder, last4, kind, expiry, brand, frozen, tone, href, className }: PaymentCardProps): import("react").JSX.Element;
|
|
41
41
|
export interface AmountProps {
|
|
42
|
-
/** The amount: positive is money in, negative money out. */
|
|
43
|
-
value: number;
|
|
42
|
+
/** The amount: positive is money in, negative money out. A decimal string ("1234.50", "-0.07") is formatted exactly, without going through a float: use it for money that comes from a ledger. */
|
|
43
|
+
value: number | string;
|
|
44
44
|
/** ISO currency code. Default USD. */
|
|
45
45
|
currency?: string;
|
|
46
46
|
/** Show the in/out arrow before it. Default false. */
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as e, jsx as a, Fragment as
|
|
3
|
-
import { ArrowDownLeft as f, ArrowUpRight as
|
|
2
|
+
import { jsxs as e, jsx as a, Fragment as N } from "react/jsx-runtime";
|
|
3
|
+
import { ArrowDownLeft as f, ArrowUpRight as g, Snowflake as u } from "lucide-react";
|
|
4
4
|
import { cx as o } from "../../utils/cx.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import { formatDecimal as v, isDecimalString as b, isZeroDecimal as D, isNegativeDecimal as z } from "../../utils/decimal.js";
|
|
6
|
+
import { useLocale as w, Link as S } from "react-aria-components";
|
|
7
|
+
import { useStrings as x } from "../../i18n/strings.js";
|
|
8
|
+
import { renamed as A } from "../../utils/vocabulary.js";
|
|
9
|
+
function U({ icon: n, tone: s = "accent", appearance: c, variant: i, size: t = "md", shape: r = "square", className: l }) {
|
|
10
|
+
const d = A("IconTile", "variant", i, "appearance", c) ?? "soft";
|
|
11
|
+
return /* @__PURE__ */ a("span", { className: o("alea-icon-tile", l), "data-tone": s, "data-variant": d, "data-size": t, "data-shape": r, "aria-hidden": "true", children: n });
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
-
const h =
|
|
13
|
+
function Z({ holder: n, last4: s, kind: c, expiry: i, brand: t, frozen: r, tone: l = "accent", href: d, className: m }) {
|
|
14
|
+
const h = x(), y = h.paymentCard(c, n, s, !!r);
|
|
14
15
|
if (!d)
|
|
15
|
-
return /* @__PURE__ */ e("div", { className: o("alea-payment-card", m), "data-tone":
|
|
16
|
+
return /* @__PURE__ */ e("div", { className: o("alea-payment-card", m), "data-tone": l, "data-frozen": r || void 0, role: "img", "aria-label": y, children: [
|
|
16
17
|
/* @__PURE__ */ e("span", { className: "alea-payment-card-top", "aria-hidden": "true", children: [
|
|
17
|
-
/* @__PURE__ */ a("span", { className: "alea-payment-card-brand", children:
|
|
18
|
+
/* @__PURE__ */ a("span", { className: "alea-payment-card-brand", children: t }),
|
|
18
19
|
/* @__PURE__ */ a("span", { className: "alea-payment-card-kind", children: r ? /* @__PURE__ */ a(u, { size: 16 }) : c })
|
|
19
20
|
] }),
|
|
20
21
|
/* @__PURE__ */ e("span", { className: "alea-payment-card-number", "aria-hidden": "true", children: [
|
|
21
22
|
"•••• •••• •••• ",
|
|
22
|
-
|
|
23
|
+
s
|
|
23
24
|
] }),
|
|
24
25
|
/* @__PURE__ */ e("span", { className: "alea-payment-card-bottom", "aria-hidden": "true", children: [
|
|
25
26
|
/* @__PURE__ */ a("span", { children: n }),
|
|
26
|
-
|
|
27
|
+
i && /* @__PURE__ */ a("span", { children: i })
|
|
27
28
|
] })
|
|
28
29
|
] });
|
|
29
30
|
const p = h.paymentCardParts;
|
|
30
|
-
return /* @__PURE__ */ e(
|
|
31
|
+
return /* @__PURE__ */ e(S, { className: o("alea-payment-card alea-focus-ring", m), "data-tone": l, "data-frozen": r || void 0, href: d, children: [
|
|
31
32
|
/* @__PURE__ */ e("span", { className: "alea-payment-card-top", children: [
|
|
32
|
-
/* @__PURE__ */ a("span", { className: "alea-payment-card-brand", children:
|
|
33
|
+
/* @__PURE__ */ a("span", { className: "alea-payment-card-brand", children: t }),
|
|
33
34
|
/* @__PURE__ */ e("span", { className: "alea-payment-card-kind", children: [
|
|
34
|
-
r ? /* @__PURE__ */ e(
|
|
35
|
+
r ? /* @__PURE__ */ e(N, { children: [
|
|
35
36
|
/* @__PURE__ */ a(u, { size: 16, "aria-hidden": "true" }),
|
|
36
37
|
/* @__PURE__ */ a("span", { className: "alea-visually-hidden", children: p.frozen })
|
|
37
38
|
] }) : c,
|
|
@@ -47,29 +48,29 @@ function j({ holder: n, last4: l, kind: c, expiry: s, brand: i, frozen: r, tone:
|
|
|
47
48
|
p.ending,
|
|
48
49
|
" "
|
|
49
50
|
] }),
|
|
50
|
-
|
|
51
|
+
s
|
|
51
52
|
] }),
|
|
52
53
|
/* @__PURE__ */ e("span", { className: "alea-payment-card-bottom", children: [
|
|
53
54
|
/* @__PURE__ */ e("span", { children: [
|
|
54
55
|
/* @__PURE__ */ a("span", { className: "alea-visually-hidden", children: ", " }),
|
|
55
56
|
n
|
|
56
57
|
] }),
|
|
57
|
-
|
|
58
|
+
i && /* @__PURE__ */ e("span", { children: [
|
|
58
59
|
/* @__PURE__ */ a("span", { className: "alea-visually-hidden", children: ", " }),
|
|
59
|
-
|
|
60
|
+
i
|
|
60
61
|
] })
|
|
61
62
|
] })
|
|
62
63
|
] });
|
|
63
64
|
}
|
|
64
|
-
function
|
|
65
|
-
const { locale:
|
|
66
|
-
return /* @__PURE__ */ e("span", { className: o("alea-amount", r), "data-dir": m, "data-color":
|
|
67
|
-
c && m !== "zero" && /* @__PURE__ */ a("span", { className: "alea-amount-icon", "aria-hidden": "true", children: m === "in" ? /* @__PURE__ */ a(f, {}) : /* @__PURE__ */ a(
|
|
65
|
+
function q({ value: n, currency: s = "USD", icon: c, colorIn: i = !0, formatOptions: t, className: r }) {
|
|
66
|
+
const { locale: l } = w(), d = v(n, l, { style: "currency", currency: s, signDisplay: "exceptZero", ...t }), m = typeof n == "string" ? !b(n) || D(n) ? "zero" : z(n) ? "out" : "in" : n > 0 ? "in" : n < 0 ? "out" : "zero";
|
|
67
|
+
return /* @__PURE__ */ e("span", { className: o("alea-amount", r), "data-dir": m, "data-color": i || void 0, children: [
|
|
68
|
+
c && m !== "zero" && /* @__PURE__ */ a("span", { className: "alea-amount-icon", "aria-hidden": "true", children: m === "in" ? /* @__PURE__ */ a(f, {}) : /* @__PURE__ */ a(g, {}) }),
|
|
68
69
|
/* @__PURE__ */ a("span", { className: "alea-amount-value", children: d })
|
|
69
70
|
] });
|
|
70
71
|
}
|
|
71
72
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
q as Amount,
|
|
74
|
+
U as IconTile,
|
|
75
|
+
Z as PaymentCard
|
|
75
76
|
};
|
|
@@ -131,9 +131,11 @@ export interface ToastProviderProps extends SurfaceProps {
|
|
|
131
131
|
motion?: MotionProp;
|
|
132
132
|
/** Toasts pile up behind the newest and fan out on hover or focus (the stack pattern). */
|
|
133
133
|
stacked?: boolean;
|
|
134
|
+
/** Extra distance from the screen edge the toasts stack against, so they clear a bottom bar (BottomNavigation, a SaveBar) or a top bar: a number in px or any CSS length ("4rem", "calc(3.5rem + 1px)"). The device safe area (notch, home indicator) is always added on top of it. */
|
|
135
|
+
offset?: number | string;
|
|
134
136
|
}
|
|
135
137
|
/** Shows toasts anywhere below it; put it once near the root. */
|
|
136
|
-
export declare function ToastProvider({ children, placement, motion, stacked, surface, radius }: ToastProviderProps): import("react").JSX.Element;
|
|
138
|
+
export declare function ToastProvider({ children, placement, motion, stacked, offset, surface, radius }: ToastProviderProps): import("react").JSX.Element;
|
|
137
139
|
/** show({ title, tone, description, action, timeout }) and close(id). Needs a ToastProvider above. */
|
|
138
140
|
export declare function useToast(): ToastApi;
|
|
139
141
|
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as y, jsx as a, Fragment as M } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef as D, useState as S, useRef as B, useCallback as k, useContext as F, createContext as R, useEffect as j } from "react";
|
|
4
4
|
import { motionStyle as G } from "@alea-design/motion";
|
|
5
|
-
import { Meter as O, Label as E, ProgressBar as
|
|
6
|
-
import { CircleAlert as V, TriangleAlert as W, CircleCheck as H, Info as A, X } from "lucide-react";
|
|
5
|
+
import { Meter as O, Label as E, ProgressBar as $ } from "react-aria-components";
|
|
6
|
+
import { CircleAlert as V, TriangleAlert as W, CircleCheck as H, Info as A, X as I } from "lucide-react";
|
|
7
7
|
import { cx as w, withBase as C } from "../../utils/cx.js";
|
|
8
8
|
import { alertIcon as z } from "../icon/icon-contexts.js";
|
|
9
|
-
import { IconButton as
|
|
9
|
+
import { IconButton as X } from "../button/Button.js";
|
|
10
10
|
import { useStrings as T } from "../../i18n/strings.js";
|
|
11
11
|
import { surfaceAttrs as U } from "../surface/Surface.js";
|
|
12
12
|
import { Spinner as q } from "./Spinner.js";
|
|
@@ -14,157 +14,157 @@ import { DotField as J } from "../../utils/DotField.js";
|
|
|
14
14
|
import { SkeletonBlueprint as K } from "../../utils/Blueprint.js";
|
|
15
15
|
import { inertProps as Q } from "../../utils/inert.js";
|
|
16
16
|
import { renamed as Y } from "../../utils/vocabulary.js";
|
|
17
|
-
function
|
|
18
|
-
const
|
|
19
|
-
return /* @__PURE__ */ a(
|
|
20
|
-
(e ||
|
|
17
|
+
function ga({ label: e, showValue: r, size: p = "md", tone: f, striped: l, valuePosition: n = "top", description: h, className: c, ...i }) {
|
|
18
|
+
const o = r ?? (!!e || n === "end");
|
|
19
|
+
return /* @__PURE__ */ a($, { ...i, className: C("alea-progress", c), "data-size": p, "data-tone": f, "data-striped": l || void 0, "data-value-position": n !== "top" ? n : void 0, children: ({ percentage: g, valueText: u, isIndeterminate: v }) => /* @__PURE__ */ y(M, { children: [
|
|
20
|
+
(e || o && n === "top") && /* @__PURE__ */ y("div", { className: "alea-progress-head", children: [
|
|
21
21
|
e && /* @__PURE__ */ a(E, { className: "alea-label", children: e }),
|
|
22
|
-
|
|
22
|
+
o && n === "top" && !v && /* @__PURE__ */ a("span", { className: "alea-progress-value", children: u })
|
|
23
23
|
] }),
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */ a("div", { className: "alea-progress-track", children: /* @__PURE__ */ a("div", { className: "alea-progress-fill", "data-indeterminate":
|
|
26
|
-
|
|
24
|
+
/* @__PURE__ */ y("div", { className: "alea-progress-row", children: [
|
|
25
|
+
/* @__PURE__ */ a("div", { className: "alea-progress-track", children: /* @__PURE__ */ a("div", { className: "alea-progress-fill", "data-indeterminate": v || void 0, style: v ? void 0 : { width: `${g}%` } }) }),
|
|
26
|
+
o && n === "end" && !v && /* @__PURE__ */ a("span", { className: "alea-progress-value", children: u })
|
|
27
27
|
] }),
|
|
28
|
-
|
|
28
|
+
h && /* @__PURE__ */ a("span", { className: "alea-description", children: h })
|
|
29
29
|
] }) });
|
|
30
30
|
}
|
|
31
|
-
function va({ size: e = "md", showValue: r, tone: p, thickness:
|
|
32
|
-
return /* @__PURE__ */ a(
|
|
33
|
-
const
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
/* @__PURE__ */ a("circle", { cx: "24", cy: "24", r:
|
|
37
|
-
/* @__PURE__ */ a("circle", { cx: "24", cy: "24", r:
|
|
31
|
+
function va({ size: e = "md", showValue: r, tone: p, thickness: f = 5, children: l, className: n, ...h }) {
|
|
32
|
+
return /* @__PURE__ */ a($, { ...h, className: C("alea-progress-circle", n), "data-size": e, "data-tone": p, children: ({ percentage: c = 0, valueText: i, isIndeterminate: o }) => {
|
|
33
|
+
const g = 24 - f / 2 - 1, u = 2 * Math.PI * g;
|
|
34
|
+
return /* @__PURE__ */ y(M, { children: [
|
|
35
|
+
/* @__PURE__ */ y("svg", { viewBox: "0 0 48 48", "aria-hidden": "true", "data-indeterminate": o || void 0, children: [
|
|
36
|
+
/* @__PURE__ */ a("circle", { cx: "24", cy: "24", r: g, fill: "none", stroke: "var(--alea-surface-raised)", strokeWidth: f }),
|
|
37
|
+
/* @__PURE__ */ a("circle", { cx: "24", cy: "24", r: g, fill: "none", stroke: "var(--alea-progress-tone, var(--alea-accent))", strokeWidth: f, strokeLinecap: "round", strokeDasharray: u, strokeDashoffset: o ? u * 0.7 : u * (1 - c / 100), transform: "rotate(-90 24 24)", className: "alea-progress-circle-arc" })
|
|
38
38
|
] }),
|
|
39
|
-
|
|
39
|
+
l ? /* @__PURE__ */ a("span", { className: "alea-progress-circle-value", children: l }) : r && !o && /* @__PURE__ */ a("span", { className: "alea-progress-circle-value", children: i })
|
|
40
40
|
] });
|
|
41
41
|
} });
|
|
42
42
|
}
|
|
43
|
-
function Na({ label: e, showValue: r = !0, tone: p = "accent", className:
|
|
44
|
-
return /* @__PURE__ */ a(O, { ...
|
|
45
|
-
const c = p === "auto" ?
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
(e || r) && /* @__PURE__ */
|
|
43
|
+
function Na({ label: e, showValue: r = !0, tone: p = "accent", className: f, ...l }) {
|
|
44
|
+
return /* @__PURE__ */ a(O, { ...l, className: C("alea-progress alea-meter", f), children: ({ percentage: n, valueText: h }) => {
|
|
45
|
+
const c = p === "auto" ? n > 90 ? "danger" : n > 70 ? "warning" : "success" : p;
|
|
46
|
+
return /* @__PURE__ */ y(M, { children: [
|
|
47
|
+
(e || r) && /* @__PURE__ */ y("div", { className: "alea-progress-head", children: [
|
|
48
48
|
e && /* @__PURE__ */ a(E, { className: "alea-label", children: e }),
|
|
49
|
-
r && /* @__PURE__ */ a("span", { className: "alea-progress-value", children:
|
|
49
|
+
r && /* @__PURE__ */ a("span", { className: "alea-progress-value", children: h })
|
|
50
50
|
] }),
|
|
51
|
-
/* @__PURE__ */ a("div", { className: "alea-progress-track", children: /* @__PURE__ */ a("div", { className: "alea-progress-fill", "data-tone": c, style: { width: `${
|
|
51
|
+
/* @__PURE__ */ a("div", { className: "alea-progress-track", children: /* @__PURE__ */ a("div", { className: "alea-progress-fill", "data-tone": c, style: { width: `${n}%` } }) })
|
|
52
52
|
] });
|
|
53
53
|
} });
|
|
54
54
|
}
|
|
55
|
-
function xa({ shape: e = "text", width: r, height: p, lines:
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
58
|
-
if (
|
|
59
|
-
const N =
|
|
60
|
-
return /* @__PURE__ */
|
|
55
|
+
function xa({ shape: e = "text", width: r, height: p, lines: f = 1, isLoaded: l, animation: n, rows: h, cols: c, children: i, className: o, style: g, ...u }) {
|
|
56
|
+
const v = T();
|
|
57
|
+
if (n === "blueprint") return /* @__PURE__ */ a(K, { ...u, shape: e, width: r, height: p, rows: h, isLoaded: l, className: o, style: g, children: i });
|
|
58
|
+
if (n === "matrix") {
|
|
59
|
+
const N = i != null && i !== !1, { "aria-label": x, ...b } = u, t = h != null || c != null;
|
|
60
|
+
return /* @__PURE__ */ y(
|
|
61
61
|
"span",
|
|
62
62
|
{
|
|
63
|
-
...
|
|
64
|
-
className: w("alea-skeleton-matrix",
|
|
63
|
+
...b,
|
|
64
|
+
className: w("alea-skeleton-matrix", o),
|
|
65
65
|
"data-shape": e,
|
|
66
|
-
"data-state":
|
|
66
|
+
"data-state": l ? "loaded" : "loading",
|
|
67
67
|
"data-content": N || void 0,
|
|
68
68
|
"data-sized": t || void 0,
|
|
69
|
-
"aria-busy": !
|
|
70
|
-
style: { width: r, ...N ? { minHeight: p } : { height: p ?? (e === "circle" ? r : void 0) }, ...c != null ? { "--alea-dots-cols": c } : null, ...
|
|
69
|
+
"aria-busy": !l,
|
|
70
|
+
style: { width: r, ...N ? { minHeight: p } : { height: p ?? (e === "circle" ? r : void 0) }, ...c != null ? { "--alea-dots-cols": c } : null, ...h != null ? { "--alea-dots-rows": h } : null, ...g },
|
|
71
71
|
children: [
|
|
72
|
-
/* @__PURE__ */ a(J, { rows:
|
|
73
|
-
N && /* @__PURE__ */ a("span", { className: "alea-skeleton-matrix-content", ...Q(!
|
|
74
|
-
/* @__PURE__ */ a("span", { role: "status", className: "alea-visually-hidden", children:
|
|
72
|
+
/* @__PURE__ */ a(J, { rows: h, cols: c }),
|
|
73
|
+
N && /* @__PURE__ */ a("span", { className: "alea-skeleton-matrix-content", ...Q(!l), children: i }),
|
|
74
|
+
/* @__PURE__ */ a("span", { role: "status", className: "alea-visually-hidden", children: l ? "" : x ?? v.loading })
|
|
75
75
|
]
|
|
76
76
|
}
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
|
-
return
|
|
79
|
+
return l ? /* @__PURE__ */ a("span", { className: "alea-skeleton-reveal", children: i }) : e === "text" && f > 1 ? /* @__PURE__ */ a("span", { className: w("alea-skeleton-lines", o), "aria-hidden": "true", children: Array.from({ length: f }, (N, x) => /* @__PURE__ */ a("span", { className: "alea-skeleton", "data-shape": "text", "data-animation": n, style: { width: x === f - 1 ? "60%" : r } }, x)) }) : /* @__PURE__ */ a("span", { ...u, "aria-hidden": "true", className: w("alea-skeleton", o), "data-shape": e, "data-animation": n, style: { width: r, height: p ?? (e === "circle" ? r : void 0), ...g } });
|
|
80
80
|
}
|
|
81
|
-
const L = { neutral: A, accent: A, info: A, success: H, warning: W, danger: V }, ya = D(function({ tone: r = "info", title: p, children:
|
|
82
|
-
const
|
|
83
|
-
return /* @__PURE__ */
|
|
84
|
-
!c && (
|
|
85
|
-
/* @__PURE__ */
|
|
81
|
+
const L = { neutral: A, accent: A, info: A, success: H, warning: W, danger: V }, ya = D(function({ tone: r = "info", title: p, children: f, actions: l, onDismiss: n, live: h, hideIcon: c, icon: i, appearance: o, variant: g, size: u, className: v, ...N }, x) {
|
|
82
|
+
const b = T(), t = Y("Alert", "variant", g, "appearance", o) ?? "soft", s = L[r];
|
|
83
|
+
return /* @__PURE__ */ y("div", { ref: x, ...N, className: w("alea-alert", v), "data-tone": r, "data-variant": t !== "soft" ? t : void 0, "data-size": u, role: h ? r === "danger" ? "alert" : "status" : N.role, children: [
|
|
84
|
+
!c && (i ? /* @__PURE__ */ a("span", { className: "alea-alert-icon", "aria-hidden": "true", ...z(r, t === "solid"), children: i }) : /* @__PURE__ */ a(s, { className: "alea-alert-icon", size: u === "sm" ? 16 : 20, "aria-hidden": "true", ...z(r, t === "solid") })),
|
|
85
|
+
/* @__PURE__ */ y("div", { className: "alea-alert-body", children: [
|
|
86
86
|
p && /* @__PURE__ */ a("p", { className: "alea-alert-title", children: p }),
|
|
87
|
-
|
|
87
|
+
f && /* @__PURE__ */ a("div", { className: "alea-alert-text", children: f })
|
|
88
88
|
] }),
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
l && /* @__PURE__ */ a("div", { className: "alea-alert-actions", children: l }),
|
|
90
|
+
n && /* @__PURE__ */ a(X, { "aria-label": b.dismiss, size: "sm", variant: "ghost", onPress: n, className: "alea-alert-x", children: /* @__PURE__ */ a(I, {}) })
|
|
91
91
|
] });
|
|
92
92
|
}), Z = 600, _ = R(null);
|
|
93
|
-
function ba({ children: e, placement: r = "bottom-end", motion: p, stacked:
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
}, [u]),
|
|
97
|
-
const
|
|
98
|
-
return
|
|
99
|
-
}, []),
|
|
100
|
-
const
|
|
101
|
-
return
|
|
102
|
-
(
|
|
103
|
-
(
|
|
104
|
-
),
|
|
105
|
-
}, [
|
|
106
|
-
return /* @__PURE__ */
|
|
93
|
+
function ba({ children: e, placement: r = "bottom-end", motion: p, stacked: f, offset: l, surface: n, radius: h }) {
|
|
94
|
+
const c = T(), [i, o] = S([]), g = B(1), u = k((t) => o((s) => s.filter((d) => d.id !== t)), []), v = k((t) => {
|
|
95
|
+
o((s) => s.map((d) => d.id === t ? { ...d, exiting: !0 } : d)), setTimeout(() => u(t), Z);
|
|
96
|
+
}, [u]), N = k((t) => {
|
|
97
|
+
const s = g.current++;
|
|
98
|
+
return o((d) => [...d.slice(-4), { ...t, id: s }]), s;
|
|
99
|
+
}, []), x = k((t, s) => o((d) => d.map((m) => m.id === t ? { ...m, ...s, version: (m.version ?? 0) + 1 } : m)), []), b = k((t, s) => {
|
|
100
|
+
const d = N({ title: s.loading, isLoading: !0, tone: "neutral" });
|
|
101
|
+
return t.then(
|
|
102
|
+
(m) => x(d, { title: typeof s.success == "function" ? s.success(m) : s.success, tone: "success", isLoading: !1 }),
|
|
103
|
+
(m) => x(d, { title: typeof s.error == "function" ? s.error(m) : s.error, tone: "danger", isLoading: !1 })
|
|
104
|
+
), t;
|
|
105
|
+
}, [N, x]);
|
|
106
|
+
return /* @__PURE__ */ y(_.Provider, { value: { show: N, close: v, update: x, promise: b }, children: [
|
|
107
107
|
e,
|
|
108
|
-
/* @__PURE__ */ a("section", { className: "alea-toast-region", "data-placement": r, "data-stacked":
|
|
108
|
+
/* @__PURE__ */ a("section", { className: "alea-toast-region", hidden: i.length === 0, "data-placement": r, "data-stacked": f || void 0, style: l === void 0 ? void 0 : { "--alea-toast-offset": typeof l == "number" ? `${l / 16}rem` : l }, "aria-label": c.notifications, tabIndex: -1, children: /* @__PURE__ */ a("div", { className: "alea-toast-list", children: i.map((t) => /* @__PURE__ */ a(aa, { item: t, motion: p, surface: n, radius: h, onClose: () => v(t.id), onExited: () => u(t.id) }, t.id)) }) })
|
|
109
109
|
] });
|
|
110
110
|
}
|
|
111
|
-
function aa({ item: e, onClose: r, onExited: p, motion:
|
|
112
|
-
const
|
|
111
|
+
function aa({ item: e, onClose: r, onExited: p, motion: f, surface: l, radius: n }) {
|
|
112
|
+
const h = T(), c = e.tone || "neutral", i = e.isLoading ? 0 : e.timeout ?? (c === "danger" ? 0 : 5e3), [o, g] = S(!1);
|
|
113
113
|
j(() => {
|
|
114
|
-
if (!
|
|
115
|
-
const t = setTimeout(r,
|
|
114
|
+
if (!i || o) return;
|
|
115
|
+
const t = setTimeout(r, i);
|
|
116
116
|
return () => clearTimeout(t);
|
|
117
|
-
}, [
|
|
118
|
-
const
|
|
119
|
-
t.button !== 0 || t.target.closest("button, a") || (
|
|
120
|
-
},
|
|
117
|
+
}, [i, o, r, e.version]);
|
|
118
|
+
const u = L[c], v = B(null), N = (t) => {
|
|
119
|
+
t.button !== 0 || t.target.closest("button, a") || (v.current = { x: t.clientX, t: performance.now(), id: t.pointerId });
|
|
120
|
+
}, x = (t) => {
|
|
121
121
|
var P;
|
|
122
|
-
const
|
|
123
|
-
if (!
|
|
124
|
-
const
|
|
125
|
-
if (Math.abs(
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
const
|
|
130
|
-
if (
|
|
131
|
-
const
|
|
132
|
-
|
|
122
|
+
const s = v.current;
|
|
123
|
+
if (!s || s.id !== t.pointerId) return;
|
|
124
|
+
const d = t.clientX - s.x;
|
|
125
|
+
if (Math.abs(d) < 4) return;
|
|
126
|
+
const m = t.currentTarget;
|
|
127
|
+
m.setAttribute("data-swiping", ""), (P = m.setPointerCapture) == null || P.call(m, t.pointerId), m.style.setProperty("--alea-swipe-x", `${d}px`), m.style.setProperty("--alea-swipe-n", String(d / 160));
|
|
128
|
+
}, b = (t) => {
|
|
129
|
+
const s = v.current;
|
|
130
|
+
if (v.current = null, !s) return;
|
|
131
|
+
const d = t.currentTarget, m = t.clientX - s.x, P = Math.abs(m) / Math.max(1, performance.now() - s.t) > 0.6;
|
|
132
|
+
d.removeAttribute("data-swiping"), Math.abs(m) > 80 || P && Math.abs(m) > 24 ? r() : (d.style.removeProperty("--alea-swipe-x"), d.style.removeProperty("--alea-swipe-n"));
|
|
133
133
|
};
|
|
134
|
-
return /* @__PURE__ */
|
|
135
|
-
"
|
|
134
|
+
return /* @__PURE__ */ y(
|
|
135
|
+
"div",
|
|
136
136
|
{
|
|
137
137
|
className: "alea-toast",
|
|
138
|
-
...U({ surface:
|
|
138
|
+
...U({ surface: l, radius: n }),
|
|
139
139
|
"data-tone": c,
|
|
140
140
|
"data-exiting": e.exiting || void 0,
|
|
141
|
-
"data-paused":
|
|
141
|
+
"data-paused": o || void 0,
|
|
142
142
|
role: c === "danger" ? "alert" : "status",
|
|
143
143
|
"aria-atomic": "true",
|
|
144
144
|
"aria-busy": e.isLoading || void 0,
|
|
145
|
-
style: { ...G(
|
|
145
|
+
style: { ...G(f), "--alea-toast-ms": `${i}ms` },
|
|
146
146
|
onAnimationEnd: (t) => {
|
|
147
147
|
e.exiting && t.target === t.currentTarget && p();
|
|
148
148
|
},
|
|
149
149
|
onPointerDown: N,
|
|
150
|
-
onPointerMove:
|
|
151
|
-
onPointerUp:
|
|
152
|
-
onPointerCancel:
|
|
153
|
-
onMouseEnter: () =>
|
|
154
|
-
onMouseLeave: () =>
|
|
155
|
-
onFocus: () =>
|
|
156
|
-
onBlur: () =>
|
|
150
|
+
onPointerMove: x,
|
|
151
|
+
onPointerUp: b,
|
|
152
|
+
onPointerCancel: b,
|
|
153
|
+
onMouseEnter: () => g(!0),
|
|
154
|
+
onMouseLeave: () => g(!1),
|
|
155
|
+
onFocus: () => g(!0),
|
|
156
|
+
onBlur: () => g(!1),
|
|
157
157
|
children: [
|
|
158
|
-
e.isLoading ? /* @__PURE__ */ a("span", { className: "alea-alert-icon", children: /* @__PURE__ */ a(q, { size: "sm", "aria-label": "" }) }) : e.icon ? /* @__PURE__ */ a("span", { className: "alea-alert-icon", "aria-hidden": "true", children: e.icon }) : /* @__PURE__ */ a(
|
|
159
|
-
e.showProgress &&
|
|
160
|
-
/* @__PURE__ */
|
|
158
|
+
e.isLoading ? /* @__PURE__ */ a("span", { className: "alea-alert-icon", children: /* @__PURE__ */ a(q, { size: "sm", "aria-label": "" }) }) : e.icon ? /* @__PURE__ */ a("span", { className: "alea-alert-icon", "aria-hidden": "true", children: e.icon }) : /* @__PURE__ */ a(u, { className: "alea-alert-icon", size: 18, "aria-hidden": "true" }, c),
|
|
159
|
+
e.showProgress && i > 0 && /* @__PURE__ */ a("span", { className: "alea-toast-progress", "aria-hidden": "true" }, e.version),
|
|
160
|
+
/* @__PURE__ */ y("div", { className: "alea-alert-body", children: [
|
|
161
161
|
/* @__PURE__ */ a("p", { className: "alea-alert-title", children: e.title }),
|
|
162
162
|
e.description && /* @__PURE__ */ a("div", { className: "alea-alert-text", children: e.description })
|
|
163
163
|
] }),
|
|
164
164
|
e.action && /* @__PURE__ */ a("button", { type: "button", className: "alea-toast-action alea-focus-ring", onClick: () => {
|
|
165
165
|
e.action.onAction(), r();
|
|
166
166
|
}, children: e.action.label }),
|
|
167
|
-
/* @__PURE__ */ a(
|
|
167
|
+
/* @__PURE__ */ a(X, { "aria-label": h.closeNotification, size: "sm", variant: "ghost", onPress: r, className: "alea-alert-x", children: /* @__PURE__ */ a(I, {}) })
|
|
168
168
|
]
|
|
169
169
|
}
|
|
170
170
|
);
|
|
@@ -177,7 +177,7 @@ function ka() {
|
|
|
177
177
|
export {
|
|
178
178
|
ya as Alert,
|
|
179
179
|
Na as Meter,
|
|
180
|
-
|
|
180
|
+
ga as ProgressBar,
|
|
181
181
|
va as ProgressCircle,
|
|
182
182
|
xa as Skeleton,
|
|
183
183
|
ba as ToastProvider,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface PageSkeletonProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
3
|
+
/** The shape of the page it stands for: cards (a grid of cards), table (a header row and rows), list (rows with a round picture), detail (a title, a picture and text blocks) or form (labelled fields and a button). Default cards. */
|
|
4
|
+
variant?: 'cards' | 'table' | 'list' | 'detail' | 'form';
|
|
5
|
+
/** Shows a title and a line under it before the body. Default true. */
|
|
6
|
+
header?: boolean;
|
|
7
|
+
/** How many cards, rows or fields. Default 6 for cards, 5 for the rest. */
|
|
8
|
+
count?: number;
|
|
9
|
+
/** The loading animation of every part: shimmer (default), pulse or none. */
|
|
10
|
+
animation?: 'shimmer' | 'pulse' | 'none';
|
|
11
|
+
/** The accessible name of the loading region. Default "Loading". */
|
|
12
|
+
'aria-label'?: string;
|
|
13
|
+
/** Once true, the real page (children) takes its place with the reveal pattern (blur in), and the skeleton is gone. Leave it out when you use the skeleton as a Suspense fallback. */
|
|
14
|
+
isLoaded?: boolean;
|
|
15
|
+
/** The real page. */
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
/** A skeleton for a whole page, built from Skeleton parts: pick the layout closest to the page and use it as the fallback of a lazy route, or wrap the page with isLoaded so it reveals itself. Announces "Loading" once; the parts are hidden from screen readers. */
|
|
19
|
+
export declare function PageSkeleton({ variant, header, count, animation, 'aria-label': label, isLoaded, children, className, ...props }: PageSkeletonProps): import("react").JSX.Element;
|