@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,153 +1,155 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { Pause as
|
|
5
|
-
import { cx as
|
|
6
|
-
import { IconButton as
|
|
7
|
-
import { DialogModal as
|
|
2
|
+
import { jsxs as f, jsx as e, Fragment as B } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as U, useState as x, useId as X, useCallback as _, useEffect as L, forwardRef as O, useMemo as W, useLayoutEffect as G } from "react";
|
|
4
|
+
import { Pause as J, Play as K, ChevronLeft as Y, ChevronRight as V, ImageOff as ee, ZoomOut as ae, ZoomIn as te, X as le } from "lucide-react";
|
|
5
|
+
import { cx as I } from "../../utils/cx.js";
|
|
6
|
+
import { IconButton as z, Button as S } from "../button/Button.js";
|
|
7
|
+
import { DialogModal as j, Dialog as Q } from "../overlay/Overlay.js";
|
|
8
8
|
import { useStrings as R } from "../../i18n/strings.js";
|
|
9
|
-
import { DotField as
|
|
10
|
-
import { inertProps as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
import { DotField as re } from "../../utils/DotField.js";
|
|
10
|
+
import { inertProps as ne } from "../../utils/inert.js";
|
|
11
|
+
const F = (c) => c.time && (c.dateTime ? /* @__PURE__ */ e("time", { className: "alea-tl-time", dateTime: c.dateTime, children: c.time }) : /* @__PURE__ */ e("span", { className: "alea-tl-time", children: c.time }));
|
|
12
|
+
function pe({ items: c, pending: r, mode: s = "start", reverse: m, size: b, timePlacement: w = "above", className: h, "aria-label": p }) {
|
|
13
|
+
const o = m ? [...c].reverse() : c;
|
|
14
|
+
return /* @__PURE__ */ f("ol", { "aria-label": p, className: I("alea-timeline", h), "data-mode": s !== "start" ? s : void 0, "data-size": b, children: [
|
|
15
|
+
o.map((t) => /* @__PURE__ */ f("li", { className: "alea-tl-item", "data-tone": t.tone || "neutral", "data-active": t.isActive || void 0, children: [
|
|
15
16
|
/* @__PURE__ */ e("span", { className: "alea-tl-dot", "aria-hidden": "true", children: t.dot }),
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
|
|
17
|
+
/* @__PURE__ */ f("div", { className: "alea-tl-body", children: [
|
|
18
|
+
w === "above" && F(t),
|
|
18
19
|
t.href ? /* @__PURE__ */ e("p", { className: "alea-tl-title", children: /* @__PURE__ */ e("a", { className: "alea-tl-link alea-focus-ring", href: t.href, children: t.title }) }) : t.onPress ? /* @__PURE__ */ e("p", { className: "alea-tl-title", children: /* @__PURE__ */ e("button", { type: "button", className: "alea-tl-link alea-focus-ring", onClick: t.onPress, children: t.title }) }) : /* @__PURE__ */ e("p", { className: "alea-tl-title", children: t.title }),
|
|
20
|
+
w === "below" && F(t),
|
|
19
21
|
t.description && /* @__PURE__ */ e("div", { className: "alea-tl-desc", children: t.description })
|
|
20
22
|
] })
|
|
21
23
|
] }, t.id)),
|
|
22
|
-
r && /* @__PURE__ */
|
|
24
|
+
r && /* @__PURE__ */ f("li", { className: "alea-tl-item", "data-pending": !0, children: [
|
|
23
25
|
/* @__PURE__ */ e("span", { className: "alea-tl-dot", "aria-hidden": "true" }),
|
|
24
26
|
/* @__PURE__ */ e("div", { className: "alea-tl-body", children: /* @__PURE__ */ e("p", { className: "alea-tl-title alea-tl-pending", children: r }) })
|
|
25
27
|
] })
|
|
26
28
|
] });
|
|
27
29
|
}
|
|
28
|
-
function
|
|
29
|
-
const
|
|
30
|
+
function be({ children: c, "aria-label": r, autoplay: s, perView: m = 1, showDots: b = !0, className: w }) {
|
|
31
|
+
const h = R(), p = U(null), [o, t] = x(0), [g, v] = x(!!s), [y, i] = x(!1), N = c.length, u = Math.max(1, Math.ceil(N - m + 1)), n = X(), l = _((d) => {
|
|
30
32
|
var E;
|
|
31
|
-
const a =
|
|
33
|
+
const a = p.current;
|
|
32
34
|
if (!a) return;
|
|
33
|
-
const
|
|
34
|
-
typeof a.scrollTo == "function" ? a.scrollTo({ left: M, behavior: $ ? "auto" : "smooth" }) : a.scrollLeft = M,
|
|
35
|
-
}, [
|
|
35
|
+
const k = (d + u) % u, C = a.children[k], P = getComputedStyle(a).direction === "rtl", M = C ? a.scrollLeft + (P ? C.getBoundingClientRect().right - a.getBoundingClientRect().right : C.getBoundingClientRect().left - a.getBoundingClientRect().left) : 0, $ = ((E = window.matchMedia) == null ? void 0 : E.call(window, "(prefers-reduced-motion: reduce)").matches) && document.documentElement.getAttribute("data-alea-reduced") !== "never" || ["off", "reduced"].includes(document.documentElement.getAttribute("data-alea-motion") || "");
|
|
36
|
+
typeof a.scrollTo == "function" ? a.scrollTo({ left: M, behavior: $ ? "auto" : "smooth" }) : a.scrollLeft = M, t(k);
|
|
37
|
+
}, [u]);
|
|
36
38
|
return L(() => {
|
|
37
|
-
const
|
|
38
|
-
if (!
|
|
39
|
+
const d = p.current;
|
|
40
|
+
if (!d) return;
|
|
39
41
|
const a = () => {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
+
const k = d.clientWidth / m;
|
|
43
|
+
t(Math.min(u - 1, Math.round(Math.abs(d.scrollLeft) / Math.max(1, k))));
|
|
42
44
|
};
|
|
43
|
-
return
|
|
44
|
-
}, [
|
|
45
|
+
return d.addEventListener("scroll", a, { passive: !0 }), () => d.removeEventListener("scroll", a);
|
|
46
|
+
}, [m, u]), L(() => {
|
|
45
47
|
var a;
|
|
46
48
|
if (!s || !g || y || typeof window < "u" && ((a = window.matchMedia) != null && a.call(window, "(prefers-reduced-motion: reduce)").matches)) return;
|
|
47
|
-
const
|
|
48
|
-
return () => clearInterval(
|
|
49
|
-
}, [s, g, y,
|
|
49
|
+
const d = setInterval(() => l(o + 1), s);
|
|
50
|
+
return () => clearInterval(d);
|
|
51
|
+
}, [s, g, y, o, l]), /* @__PURE__ */ f(
|
|
50
52
|
"section",
|
|
51
53
|
{
|
|
52
|
-
className:
|
|
54
|
+
className: I("alea-carousel", w),
|
|
53
55
|
"aria-roledescription": "carousel",
|
|
54
56
|
"aria-label": r,
|
|
55
|
-
onMouseEnter: () =>
|
|
56
|
-
onMouseLeave: () =>
|
|
57
|
-
onFocusCapture: () =>
|
|
58
|
-
onBlurCapture: () =>
|
|
57
|
+
onMouseEnter: () => i(!0),
|
|
58
|
+
onMouseLeave: () => i(!1),
|
|
59
|
+
onFocusCapture: () => i(!0),
|
|
60
|
+
onBlurCapture: () => i(!1),
|
|
59
61
|
children: [
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
s && /* @__PURE__ */ e(
|
|
62
|
-
/* @__PURE__ */ e(
|
|
63
|
-
/* @__PURE__ */ e(
|
|
62
|
+
/* @__PURE__ */ f("div", { className: "alea-carousel-controls", children: [
|
|
63
|
+
s && /* @__PURE__ */ e(z, { size: "sm", "aria-label": g ? h.stopSlides : h.playSlides, onPress: () => v((d) => !d), children: g ? /* @__PURE__ */ e(J, {}) : /* @__PURE__ */ e(K, {}) }),
|
|
64
|
+
/* @__PURE__ */ e(z, { size: "sm", "aria-label": h.previousSlide, "aria-controls": `${n}-track`, onPress: () => l(o - 1), children: /* @__PURE__ */ e(Y, {}) }),
|
|
65
|
+
/* @__PURE__ */ e(z, { size: "sm", "aria-label": h.nextSlide, "aria-controls": `${n}-track`, onPress: () => l(o + 1), children: /* @__PURE__ */ e(V, {}) })
|
|
64
66
|
] }),
|
|
65
|
-
/* @__PURE__ */ e("div", { ref:
|
|
66
|
-
b &&
|
|
67
|
+
/* @__PURE__ */ e("div", { ref: p, id: `${n}-track`, className: "alea-carousel-track alea-focus-ring", tabIndex: 0, "aria-label": h.slides, "aria-live": g && !y ? "off" : "polite", style: { "--alea-per-view": m }, children: c.map((d, a) => /* @__PURE__ */ e("div", { className: "alea-carousel-slide", role: "group", "aria-roledescription": "slide", "aria-label": h.nOfTotal(a + 1, N), "aria-hidden": a < o || a >= o + m ? !0 : void 0, ...ne(a < o || a >= o + m), children: d }, a)) }),
|
|
68
|
+
b && u > 1 && /* @__PURE__ */ e("div", { className: "alea-carousel-dots", role: "group", "aria-label": h.chooseSlide, children: Array.from({ length: u }, (d, a) => /* @__PURE__ */ e("button", { type: "button", className: "alea-carousel-dot alea-focus-ring", "aria-label": h.slideN(a + 1), "aria-current": a === o ? "true" : void 0, onClick: () => l(a) }, a)) })
|
|
67
69
|
]
|
|
68
70
|
}
|
|
69
71
|
);
|
|
70
72
|
}
|
|
71
|
-
function
|
|
72
|
-
const n = R(), [l,
|
|
73
|
-
M && l !== "error" && /* @__PURE__ */ e(
|
|
73
|
+
function Ne({ src: c, alt: r, width: s, height: m, preview: b = !0, fallback: w, fit: h = "cover", radius: p = "md", srcSet: o, sizes: t, ratio: g, priority: v, placeholder: y, loadingEffect: i = "shimmer", isLoading: N, className: u }) {
|
|
74
|
+
const n = R(), [l, d] = x("loading"), [a, k] = x(!1), [C, P] = x(1), M = i === "matrix", $ = !!N || l === "loading", E = N ? "loading" : l, Z = c ? /* @__PURE__ */ e("img", { src: c, srcSet: o, sizes: t, alt: r, loading: v ? "eager" : "lazy", decoding: v ? "sync" : "async", fetchPriority: v ? "high" : void 0, onLoad: () => d("ok"), onError: () => d("error"), style: { objectFit: h } }) : null, T = y ? /^(data:|https?:|\/)/.test(y) ? { backgroundImage: `url(${y})`, backgroundSize: "cover" } : { background: y } : null, A = /* @__PURE__ */ f("span", { className: I("alea-image", u), "data-state": E, "data-effect": M ? "matrix" : void 0, "aria-busy": $ || void 0, "data-radius": p, "data-placeholder": T ? !0 : void 0, style: { width: s, height: m, aspectRatio: g ? String(g) : void 0, ...l === "loading" && T ? T : {} }, children: [
|
|
75
|
+
M && l !== "error" && /* @__PURE__ */ e(re, {}),
|
|
74
76
|
M && /* @__PURE__ */ e("span", { role: "status", className: "alea-visually-hidden", children: $ ? n.loading : "" }),
|
|
75
|
-
l === "error" ?
|
|
76
|
-
/* @__PURE__ */ e(
|
|
77
|
+
l === "error" ? w ?? /* @__PURE__ */ f("span", { className: "alea-image-fallback", children: [
|
|
78
|
+
/* @__PURE__ */ e(ee, { size: 22, "aria-hidden": "true" }),
|
|
77
79
|
/* @__PURE__ */ e("span", { children: n.imageFailed(r || "") })
|
|
78
|
-
] }) :
|
|
80
|
+
] }) : Z
|
|
79
81
|
] });
|
|
80
|
-
return !b || l === "error" || N || !
|
|
82
|
+
return !b || l === "error" || N || !c ? A : /* @__PURE__ */ f(B, { children: [
|
|
81
83
|
/* @__PURE__ */ e("button", { type: "button", className: "alea-image-button alea-focus-ring", onClick: () => {
|
|
82
|
-
|
|
83
|
-
}, "aria-label": n.viewLarger(r || n.image.toLowerCase()), style: { width: s, height:
|
|
84
|
-
/* @__PURE__ */ e(
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
/* @__PURE__ */ e(
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
Math.round(
|
|
84
|
+
P(1), k(!0);
|
|
85
|
+
}, "aria-label": n.viewLarger(r || n.image.toLowerCase()), style: { width: s, height: m }, children: A }),
|
|
86
|
+
/* @__PURE__ */ e(j, { isOpen: a, onOpenChange: k, size: "full", className: "alea-image-overlay", children: /* @__PURE__ */ e(Q, { "aria-label": r || n.imagePreview, hideClose: !0, className: "alea-image-dialog", children: ({ close: H }) => /* @__PURE__ */ f(B, { children: [
|
|
87
|
+
/* @__PURE__ */ f("div", { className: "alea-image-tools", children: [
|
|
88
|
+
/* @__PURE__ */ e(z, { "aria-label": n.zoomOut, variant: "secondary", isDisabled: C <= 0.5, onPress: () => P((q) => Math.max(0.5, q - 0.25)), children: /* @__PURE__ */ e(ae, {}) }),
|
|
89
|
+
/* @__PURE__ */ f("span", { className: "alea-image-zoom", "aria-live": "polite", children: [
|
|
90
|
+
Math.round(C * 100),
|
|
89
91
|
"%"
|
|
90
92
|
] }),
|
|
91
|
-
/* @__PURE__ */ e(
|
|
92
|
-
/* @__PURE__ */ e(
|
|
93
|
+
/* @__PURE__ */ e(z, { "aria-label": n.zoomIn, variant: "secondary", isDisabled: C >= 3, onPress: () => P((q) => Math.min(3, q + 0.25)), children: /* @__PURE__ */ e(te, {}) }),
|
|
94
|
+
/* @__PURE__ */ e(z, { "aria-label": n.close, variant: "secondary", onPress: H, children: /* @__PURE__ */ e(le, {}) })
|
|
93
95
|
] }),
|
|
94
|
-
/* @__PURE__ */ e("div", { className: "alea-image-stage", children: /* @__PURE__ */ e("img", { src:
|
|
96
|
+
/* @__PURE__ */ e("div", { className: "alea-image-stage", children: /* @__PURE__ */ e("img", { src: c, alt: r, style: { transform: `scale(${C})` } }) })
|
|
95
97
|
] }) }) })
|
|
96
98
|
] });
|
|
97
99
|
}
|
|
98
|
-
let D = null,
|
|
99
|
-
function
|
|
100
|
-
return
|
|
101
|
-
const r =
|
|
100
|
+
let D = null, se = null;
|
|
101
|
+
function oe() {
|
|
102
|
+
return se ?? (se = import("qrcode-generator").then((c) => {
|
|
103
|
+
const r = c.default ?? c;
|
|
102
104
|
return r.stringToBytes = r.stringToBytesFuncs["UTF-8"], D = r;
|
|
103
105
|
}));
|
|
104
106
|
}
|
|
105
|
-
const
|
|
106
|
-
const y = R(), [
|
|
107
|
+
const ye = O(function({ value: r, size: s = 160, level: m = "M", logo: b, label: w, color: h = "#111011", background: p = "#ffffff", className: o, style: t, ...g }, v) {
|
|
108
|
+
const y = R(), [i, N] = x(D ? { qrcode: D } : null);
|
|
107
109
|
L(() => {
|
|
108
|
-
if (
|
|
110
|
+
if (i) return;
|
|
109
111
|
let n = !0;
|
|
110
|
-
return
|
|
112
|
+
return oe().then((l) => {
|
|
111
113
|
n && N({ qrcode: l });
|
|
112
114
|
}, () => {
|
|
113
115
|
}), () => {
|
|
114
116
|
n = !1;
|
|
115
117
|
};
|
|
116
|
-
}, [
|
|
117
|
-
const
|
|
118
|
-
if (!
|
|
119
|
-
const n =
|
|
118
|
+
}, [i]);
|
|
119
|
+
const u = W(() => {
|
|
120
|
+
if (!i) return null;
|
|
121
|
+
const n = i.qrcode(0, m);
|
|
120
122
|
n.addData(r), n.make();
|
|
121
123
|
const l = n.getModuleCount();
|
|
122
|
-
let
|
|
123
|
-
for (let a = 0; a < l; a++) for (let
|
|
124
|
-
return { d
|
|
125
|
-
}, [
|
|
126
|
-
return /* @__PURE__ */
|
|
127
|
-
|
|
128
|
-
/* @__PURE__ */ e("rect", { width:
|
|
129
|
-
/* @__PURE__ */ e("path", { d:
|
|
124
|
+
let d = "";
|
|
125
|
+
for (let a = 0; a < l; a++) for (let k = 0; k < l; k++) n.isDark(a, k) && (d += `M${k + 4} ${a + 4}h1v1h-1z`);
|
|
126
|
+
return { d, n: l + 8 };
|
|
127
|
+
}, [i, r, m]);
|
|
128
|
+
return /* @__PURE__ */ f("span", { ref: v, ...g, className: I("alea-qr", o), style: { width: s, height: s, ...t }, role: "img", "aria-label": w ?? g["aria-label"] ?? y.qrCode(r), children: [
|
|
129
|
+
u && /* @__PURE__ */ f("svg", { viewBox: `0 0 ${u.n} ${u.n}`, width: s, height: s, shapeRendering: "crispEdges", "aria-hidden": "true", children: [
|
|
130
|
+
/* @__PURE__ */ e("rect", { width: u.n, height: u.n, fill: p, rx: u.n * 0.06 }),
|
|
131
|
+
/* @__PURE__ */ e("path", { d: u.d, fill: h })
|
|
130
132
|
] }),
|
|
131
|
-
b &&
|
|
133
|
+
b && u && /* @__PURE__ */ e("span", { className: "alea-qr-logo", "aria-hidden": "true", style: { background: p }, children: b })
|
|
132
134
|
] });
|
|
133
135
|
});
|
|
134
|
-
function
|
|
135
|
-
const
|
|
136
|
-
const
|
|
137
|
-
return `url("data:image/svg+xml,${encodeURIComponent(
|
|
138
|
-
}, [r, s,
|
|
139
|
-
return /* @__PURE__ */
|
|
140
|
-
|
|
141
|
-
/* @__PURE__ */ e("span", { className: "alea-watermark-layer", "aria-hidden": "true", style: { WebkitMaskImage:
|
|
136
|
+
function we({ children: c, text: r, rotate: s = -22, gap: m = 120, opacity: b = 0.08, className: w }) {
|
|
137
|
+
const h = W(() => {
|
|
138
|
+
const p = m + r.length * 7.5, o = m, t = `<svg xmlns="http://www.w3.org/2000/svg" width="${p}" height="${o}"><text x="50%" y="50%" fill="currentColor" font-family="Inter, sans-serif" font-size="14" font-weight="600" text-anchor="middle" dominant-baseline="middle" transform="rotate(${s} ${p / 2} ${o / 2})">${r.replace(/[<&>"]/g, (g) => ({ "<": "<", "&": "&", ">": ">", '"': """ })[g])}</text></svg>`;
|
|
139
|
+
return `url("data:image/svg+xml,${encodeURIComponent(t)}")`;
|
|
140
|
+
}, [r, s, m]);
|
|
141
|
+
return /* @__PURE__ */ f("div", { className: I("alea-watermark", w), children: [
|
|
142
|
+
c,
|
|
143
|
+
/* @__PURE__ */ e("span", { className: "alea-watermark-layer", "aria-hidden": "true", style: { WebkitMaskImage: h, maskImage: h, opacity: b } })
|
|
142
144
|
] });
|
|
143
145
|
}
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
+
const ke = O(function({ steps: r, isOpen: s, onOpenChange: m, onFinish: b, className: w, style: h }, p) {
|
|
147
|
+
const o = R(), [t, g] = x(0), [v, y] = x(null), i = r[t];
|
|
146
148
|
if (L(() => {
|
|
147
149
|
s && g(0);
|
|
148
|
-
}, [s]),
|
|
149
|
-
if (!s || !
|
|
150
|
-
const n = typeof
|
|
150
|
+
}, [s]), G(() => {
|
|
151
|
+
if (!s || !i) return;
|
|
152
|
+
const n = typeof i.target == "string" ? document.querySelector(i.target) : i.target || null;
|
|
151
153
|
if (!n) {
|
|
152
154
|
y(null);
|
|
153
155
|
return;
|
|
@@ -155,34 +157,34 @@ const we = F(function({ steps: r, isOpen: s, onOpenChange: d, onFinish: b, class
|
|
|
155
157
|
n.scrollIntoView({ block: "center", behavior: "smooth" });
|
|
156
158
|
const l = () => y(n.getBoundingClientRect());
|
|
157
159
|
l();
|
|
158
|
-
const
|
|
160
|
+
const d = setTimeout(l, 350);
|
|
159
161
|
return window.addEventListener("resize", l), window.addEventListener("scroll", l, !0), () => {
|
|
160
|
-
clearTimeout(
|
|
162
|
+
clearTimeout(d), window.removeEventListener("resize", l), window.removeEventListener("scroll", l, !0);
|
|
161
163
|
};
|
|
162
|
-
}, [s,
|
|
163
|
-
const N = 8,
|
|
164
|
-
return /* @__PURE__ */ e(
|
|
165
|
-
|
|
166
|
-
/* @__PURE__ */
|
|
167
|
-
/* @__PURE__ */ e("p", { className: "alea-tour-count", children:
|
|
168
|
-
/* @__PURE__ */ e("h2", { className: "alea-tour-title", children:
|
|
169
|
-
|
|
170
|
-
/* @__PURE__ */
|
|
171
|
-
/* @__PURE__ */ e(S, { size: "sm", variant: "ghost", onPress: n, children:
|
|
164
|
+
}, [s, t, i]), !i) return null;
|
|
165
|
+
const N = 8, u = v ? { top: Math.min(window.innerHeight - 220, v.bottom + N + 12), left: Math.max(16, Math.min(window.innerWidth - 336, v.left)) } : { top: "50%", left: "50%", transform: "translate(-50%, -50%)", "--alea-pop-x": "-50%", "--alea-pop-y": "-50%" };
|
|
166
|
+
return /* @__PURE__ */ e(j, { isOpen: s, onOpenChange: m, isDismissable: !1, className: "alea-tour-overlay", children: /* @__PURE__ */ e(Q, { ref: p, style: h, "aria-label": typeof i.title == "string" ? i.title : o.stepN(t + 1), hideClose: !0, className: I("alea-tour", w), children: ({ close: n }) => /* @__PURE__ */ f(B, { children: [
|
|
167
|
+
v && /* @__PURE__ */ e("span", { className: "alea-tour-spot", "aria-hidden": "true", style: { top: v.top - N, left: v.left - N, width: v.width + N * 2, height: v.height + N * 2 } }),
|
|
168
|
+
/* @__PURE__ */ f("div", { className: "alea-tour-card", style: u, "data-centered": v ? void 0 : "", children: [
|
|
169
|
+
/* @__PURE__ */ e("p", { className: "alea-tour-count", children: o.stepNOfTotal(t + 1, r.length) }),
|
|
170
|
+
/* @__PURE__ */ e("h2", { className: "alea-tour-title", children: i.title }),
|
|
171
|
+
i.content && /* @__PURE__ */ e("div", { className: "alea-tour-text", children: i.content }),
|
|
172
|
+
/* @__PURE__ */ f("div", { className: "alea-tour-actions", children: [
|
|
173
|
+
/* @__PURE__ */ e(S, { size: "sm", variant: "ghost", onPress: n, children: o.skip }),
|
|
172
174
|
/* @__PURE__ */ e("span", { className: "alea-tour-spacer" }),
|
|
173
|
-
|
|
175
|
+
t > 0 && /* @__PURE__ */ e(S, { size: "sm", variant: "ghost", onPress: () => g((l) => l - 1), children: o.back }),
|
|
174
176
|
/* @__PURE__ */ e(S, { size: "sm", autoFocus: !0, onPress: () => {
|
|
175
|
-
|
|
176
|
-
}, children:
|
|
177
|
+
t < r.length - 1 ? g((l) => l + 1) : (b == null || b(), n());
|
|
178
|
+
}, children: t < r.length - 1 ? o.next : o.done })
|
|
177
179
|
] })
|
|
178
180
|
] })
|
|
179
181
|
] }) }) });
|
|
180
182
|
});
|
|
181
183
|
export {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
184
|
+
be as Carousel,
|
|
185
|
+
Ne as Image,
|
|
186
|
+
ye as QRCode,
|
|
187
|
+
pe as Timeline,
|
|
188
|
+
ke as Tour,
|
|
189
|
+
we as Watermark
|
|
188
190
|
};
|
|
@@ -48,8 +48,8 @@ export interface EditableProps {
|
|
|
48
48
|
/** Text that turns into a field when clicked: rename in place. Enter saves, Escape cancels. */
|
|
49
49
|
export declare function Editable({ value, defaultValue, onSave, label, placeholder, multiline, className }: EditableProps): import("react").JSX.Element;
|
|
50
50
|
export interface FormattedNumberProps {
|
|
51
|
-
/** The number to format. */
|
|
52
|
-
value: number;
|
|
51
|
+
/** The number to format. A decimal string ("1234567890123456.78") is formatted exactly, without going through a float. */
|
|
52
|
+
value: number | string;
|
|
53
53
|
/** Intl.NumberFormat options: { style: 'currency', currency: 'USD' }, { notation: 'compact' }, { style: 'percent' }. */
|
|
54
54
|
format?: Intl.NumberFormatOptions;
|
|
55
55
|
/** A BCP 47 locale. Default the browser's. */
|
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as u, jsx as a, Fragment as
|
|
3
|
-
import { useState as k, useRef as D, useEffect as z, useId as
|
|
4
|
-
import { Disclosure as
|
|
5
|
-
import { X as P, ChevronDown as
|
|
2
|
+
import { jsxs as u, jsx as a, Fragment as T } from "react/jsx-runtime";
|
|
3
|
+
import { useState as k, useRef as D, useEffect as z, useId as j, forwardRef as M } from "react";
|
|
4
|
+
import { Disclosure as A, Button as I, DisclosurePanel as K } from "react-aria-components";
|
|
5
|
+
import { X as P, ChevronDown as O, Pencil as F, Check as B } from "lucide-react";
|
|
6
6
|
import { cx as m } from "../../utils/cx.js";
|
|
7
|
-
import {
|
|
7
|
+
import { formatDecimal as H } from "../../utils/decimal.js";
|
|
8
|
+
import { Spinner as L } from "../feedback/Spinner.js";
|
|
8
9
|
import { useStrings as $ } from "../../i18n/strings.js";
|
|
9
|
-
import { inertProps as
|
|
10
|
-
const
|
|
10
|
+
import { inertProps as R } from "../../utils/inert.js";
|
|
11
|
+
const aa = M(function({ target: t = "main", children: l, className: s, ...c }, r) {
|
|
11
12
|
const o = $();
|
|
12
13
|
return l ?? (l = o.skipToContent), /* @__PURE__ */ a("a", { ref: r, href: `#${t}`, ...c, className: m("alea-skip-link", s), children: l });
|
|
13
|
-
}),
|
|
14
|
+
}), ea = M(function({ children: t, as: l = "span", className: s, ...c }, r) {
|
|
14
15
|
return /* @__PURE__ */ a(l, { ref: r, ...c, className: m("alea-visually-hidden", s), children: t });
|
|
15
16
|
});
|
|
16
|
-
function
|
|
17
|
-
return /* @__PURE__ */ u(
|
|
18
|
-
/* @__PURE__ */ u(
|
|
19
|
-
/* @__PURE__ */ a(
|
|
17
|
+
function la({ title: e, children: t, isExpanded: l, defaultExpanded: s, onExpandedChange: c, className: r }) {
|
|
18
|
+
return /* @__PURE__ */ u(A, { isExpanded: l, defaultExpanded: s, onExpandedChange: c, className: m("alea-collapsible", r), children: [
|
|
19
|
+
/* @__PURE__ */ u(I, { slot: "trigger", className: "alea-collapsible-trigger alea-focus-ring", children: [
|
|
20
|
+
/* @__PURE__ */ a(O, { size: 16, "aria-hidden": "true", className: "alea-collapsible-chevron" }),
|
|
20
21
|
e
|
|
21
22
|
] }),
|
|
22
|
-
/* @__PURE__ */ a(
|
|
23
|
+
/* @__PURE__ */ a(K, { className: "alea-collapsible-panel", children: /* @__PURE__ */ a("div", { className: "alea-collapsible-content", children: t }) })
|
|
23
24
|
] });
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
+
function ta({ value: e, defaultValue: t = "", onSave: l, label: s, placeholder: c = "Empty", multiline: r, className: o }) {
|
|
26
27
|
const p = $(), [h, g] = k(t), n = e ?? h, [i, f] = k(!1), [N, C] = k(n), [v, w] = k(!1), x = D(null), b = D(null);
|
|
27
28
|
z(() => {
|
|
28
29
|
var d, q;
|
|
@@ -48,7 +49,7 @@ function ea({ value: e, defaultValue: t = "", onSave: l, label: s, placeholder:
|
|
|
48
49
|
C(n), f(!0);
|
|
49
50
|
}, children: [
|
|
50
51
|
/* @__PURE__ */ a("span", { className: "alea-editable-text", children: n || c }),
|
|
51
|
-
/* @__PURE__ */ a(
|
|
52
|
+
/* @__PURE__ */ a(F, { size: 14, "aria-hidden": "true", className: "alea-editable-icon" })
|
|
52
53
|
] });
|
|
53
54
|
const E = r ? "textarea" : "input";
|
|
54
55
|
return /* @__PURE__ */ u("span", { className: m("alea-editable-edit", o), children: [
|
|
@@ -73,11 +74,11 @@ function ea({ value: e, defaultValue: t = "", onSave: l, label: s, placeholder:
|
|
|
73
74
|
/* @__PURE__ */ a("button", { type: "button", className: "alea-editable-btn alea-focus-ring", "aria-label": p.cancel, onClick: S, children: /* @__PURE__ */ a(P, { size: 14 }) })
|
|
74
75
|
] });
|
|
75
76
|
}
|
|
76
|
-
function
|
|
77
|
-
return /* @__PURE__ */ a(
|
|
77
|
+
function na({ value: e, format: t, locale: l }) {
|
|
78
|
+
return /* @__PURE__ */ a(T, { children: H(e, l, t) });
|
|
78
79
|
}
|
|
79
|
-
const
|
|
80
|
-
function
|
|
80
|
+
const V = (e) => String(e).padStart(2, "0");
|
|
81
|
+
function sa({ to: e, label: t, onEnd: l, showDays: s, className: c }) {
|
|
81
82
|
const r = $(), o = typeof e == "number" ? e : e.getTime(), [p, h] = k(() => Date.now()), g = D(!1);
|
|
82
83
|
z(() => {
|
|
83
84
|
const b = setInterval(() => h(Date.now()), 1e3);
|
|
@@ -91,19 +92,19 @@ function ta({ to: e, label: t, onEnd: l, showDays: s, className: c }) {
|
|
|
91
92
|
return /* @__PURE__ */ u("div", { className: m("alea-stat alea-countdown", c), children: [
|
|
92
93
|
/* @__PURE__ */ a("span", { className: "alea-stat-label", children: t }),
|
|
93
94
|
/* @__PURE__ */ a("span", { className: "alea-stat-value alea-countdown-value", "aria-hidden": "true", children: w.map(([b, y]) => /* @__PURE__ */ u("span", { children: [
|
|
94
|
-
/* @__PURE__ */ a("b", { children: y === "d" ? b :
|
|
95
|
+
/* @__PURE__ */ a("b", { children: y === "d" ? b : V(b) }),
|
|
95
96
|
/* @__PURE__ */ a("small", { children: y })
|
|
96
97
|
] }, y)) }),
|
|
97
98
|
/* @__PURE__ */ a("span", { className: "alea-visually-hidden", "aria-live": "polite", children: n === 0 ? r.ended : x })
|
|
98
99
|
] });
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
+
function ra({ tone: e = "neutral", children: t, pulse: l, className: s }) {
|
|
101
102
|
return /* @__PURE__ */ u("span", { className: m("alea-status", s), "data-tone": e, children: [
|
|
102
103
|
/* @__PURE__ */ a("span", { className: "alea-status-dot", "data-pulse": l || void 0, "aria-hidden": "true" }),
|
|
103
104
|
t
|
|
104
105
|
] });
|
|
105
106
|
}
|
|
106
|
-
function
|
|
107
|
+
function ia({ color: e, label: t, size: l = 28, shape: s = "circle", showValue: c, className: r, style: o }) {
|
|
107
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 } });
|
|
108
109
|
return c ? /* @__PURE__ */ u("span", { className: m("alea-swatch-wrap", r), "data-labeled": !0, children: [
|
|
109
110
|
p,
|
|
@@ -111,15 +112,15 @@ function sa({ color: e, label: t, size: l = 28, shape: s = "circle", showValue:
|
|
|
111
112
|
/* @__PURE__ */ a("code", { className: "alea-swatch-value", children: e })
|
|
112
113
|
] }) : /* @__PURE__ */ a("span", { className: m("alea-swatch-wrap", r), children: p });
|
|
113
114
|
}
|
|
114
|
-
function
|
|
115
|
+
function ca({ isLoading: e, children: t, label: l, blur: s = !0, className: c }) {
|
|
115
116
|
const r = $();
|
|
116
117
|
return l ?? (l = r.loading), /* @__PURE__ */ u("div", { className: m("alea-loading", c), "aria-busy": e || void 0, children: [
|
|
117
|
-
/* @__PURE__ */ a("div", { className: "alea-loading-content", ...
|
|
118
|
-
e && /* @__PURE__ */ a("div", { className: "alea-loading-overlay", "data-blur": s || void 0, children: /* @__PURE__ */ a(
|
|
118
|
+
/* @__PURE__ */ a("div", { className: "alea-loading-content", ...R(e), children: t }),
|
|
119
|
+
e && /* @__PURE__ */ a("div", { className: "alea-loading-overlay", "data-blur": s || void 0, children: /* @__PURE__ */ a(L, { size: "md", "aria-label": l }) })
|
|
119
120
|
] });
|
|
120
121
|
}
|
|
121
|
-
function
|
|
122
|
-
const o =
|
|
122
|
+
function oa({ segments: e, total: t, label: l, valueFormat: s = (o) => String(o), showLegend: c = !0, className: r }) {
|
|
123
|
+
const o = j(), p = t ?? e.reduce((n, i) => n + i.value, 0), h = (n, i) => n.color || `var(--alea-chart-${i % 8 + 1})`, g = e.reduce((n, i) => n + i.value, 0);
|
|
123
124
|
return /* @__PURE__ */ u("div", { className: m("alea-progress-seg", r), children: [
|
|
124
125
|
/* @__PURE__ */ u("div", { className: "alea-progress-seg-head", children: [
|
|
125
126
|
/* @__PURE__ */ a("span", { id: o, className: "alea-label", children: l }),
|
|
@@ -137,22 +138,22 @@ function ia({ segments: e, total: t, label: l, valueFormat: s = (o) => String(o)
|
|
|
137
138
|
] }, n.label)) })
|
|
138
139
|
] });
|
|
139
140
|
}
|
|
140
|
-
function
|
|
141
|
+
function da({ children: e, cite: t, source: l, className: s }) {
|
|
141
142
|
return /* @__PURE__ */ u("figure", { className: m("alea-blockquote", s), children: [
|
|
142
143
|
/* @__PURE__ */ a("blockquote", { cite: l, children: e }),
|
|
143
144
|
t && /* @__PURE__ */ a("figcaption", { children: t })
|
|
144
145
|
] });
|
|
145
146
|
}
|
|
146
|
-
function
|
|
147
|
+
function ua({ items: e, marker: t = "bullet", spacing: l = "md", className: s }) {
|
|
147
148
|
return /* @__PURE__ */ a(t === "number" ? "ol" : "ul", { className: m("alea-text-list", s), "data-marker": t, "data-spacing": l, children: e.map((r, o) => /* @__PURE__ */ u("li", { children: [
|
|
148
149
|
t === "check" && /* @__PURE__ */ a(B, { size: 16, "aria-hidden": "true", className: "alea-text-list-check" }),
|
|
149
150
|
/* @__PURE__ */ a("span", { children: r })
|
|
150
151
|
] }, o)) });
|
|
151
152
|
}
|
|
152
|
-
function
|
|
153
|
+
function ma({ children: e, size: t = "base", className: l }) {
|
|
153
154
|
return /* @__PURE__ */ a("div", { className: m("alea-prose alea-markdown", l), "data-size": t, children: e });
|
|
154
155
|
}
|
|
155
|
-
function
|
|
156
|
+
function pa({ children: e, tone: t = "accent", action: l, onDismiss: s, className: c, "aria-label": r }) {
|
|
156
157
|
const o = $();
|
|
157
158
|
r ?? (r = o.announcement);
|
|
158
159
|
const [p, h] = k(!0);
|
|
@@ -165,18 +166,18 @@ function ua({ children: e, tone: t = "accent", action: l, onDismiss: s, classNam
|
|
|
165
166
|
] }) : null;
|
|
166
167
|
}
|
|
167
168
|
export {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
169
|
+
pa as Banner,
|
|
170
|
+
da as Blockquote,
|
|
171
|
+
la as Collapsible,
|
|
172
|
+
ia as ColorSwatch,
|
|
173
|
+
sa as Countdown,
|
|
174
|
+
ta as Editable,
|
|
175
|
+
na as FormattedNumber,
|
|
176
|
+
ua as List,
|
|
177
|
+
ca as LoadingOverlay,
|
|
178
|
+
oa as ProgressSegments,
|
|
179
|
+
ma as Prose,
|
|
180
|
+
aa as SkipLink,
|
|
181
|
+
ra as Status,
|
|
182
|
+
ea as VisuallyHidden
|
|
182
183
|
};
|
|
@@ -51,12 +51,14 @@ export interface PaginationProps {
|
|
|
51
51
|
}
|
|
52
52
|
/** Move through pages of results. The current page is marked for screen readers. */
|
|
53
53
|
export declare function Pagination({ page, total, onChange, siblings, appearance, size, showFirstLast, pageSize, pageSizeOptions, onPageSizeChange, totalItems, showJumper, className, 'aria-label': label }: PaginationProps): import("react").JSX.Element;
|
|
54
|
+
/** Every state a step can show. `done`, `current` and `upcoming` come from `current`; the rest are set on the step. */
|
|
55
|
+
export type StepStatus = 'done' | 'current' | 'upcoming' | 'skipped' | 'cancelled' | 'error' | 'warning';
|
|
54
56
|
export interface Step {
|
|
55
57
|
id: Key;
|
|
56
58
|
title: ReactNode;
|
|
57
59
|
description?: ReactNode;
|
|
58
|
-
/** Overrides the status from current: error (something to fix) or
|
|
59
|
-
status?: 'error' | 'warning'
|
|
60
|
+
/** Overrides the status from current: error (something to fix), warning, or skipped (a step the person passed over on purpose; it shows a dash and counts as left behind), or cancelled (a step that will not happen: dotted and muted, with a ban mark). */
|
|
61
|
+
status?: Extract<StepStatus, 'error' | 'warning' | 'skipped' | 'cancelled'>;
|
|
60
62
|
/** An icon instead of the number (with variant="icons"). */
|
|
61
63
|
icon?: ReactNode;
|
|
62
64
|
/** Marks the step as optional. */
|
|
@@ -75,8 +77,12 @@ export interface StepsProps {
|
|
|
75
77
|
'aria-label'?: string;
|
|
76
78
|
/** Extra class names for the root element. */
|
|
77
79
|
className?: string;
|
|
78
|
-
/** Horizontal steps turn vertical on phones (below 640 px). Default true. */
|
|
79
|
-
responsive?: boolean;
|
|
80
|
+
/** Horizontal steps turn vertical on phones (below 640 px). Default true. Use 'scroll' to keep them horizontal on phones: the row scrolls sideways (focusable for the keyboard) and opens with the current step in view. */
|
|
81
|
+
responsive?: boolean | 'scroll';
|
|
82
|
+
/** Writes each step's status in words under its title (Done, In progress, Pending, Skipped, Has an error, Needs attention), so the color and icon are never the only signal. */
|
|
83
|
+
showStatus?: boolean;
|
|
84
|
+
/** Your own words for this list's states, for the visible status and the hidden one read by screen readers (for example `{ done: 'Completed', current: 'Current stage', cancelled: 'Cancelled here' }`). A state you leave out keeps its default. */
|
|
85
|
+
stateLabels?: Partial<Record<StepStatus, string>>;
|
|
80
86
|
/** sm (24 px markers) or md (32 px, default). */
|
|
81
87
|
size?: 'sm' | 'md';
|
|
82
88
|
/** numbers (default), dots (small markers, for compact flows) or icons (each step's icon). */
|
|
@@ -85,4 +91,4 @@ export interface StepsProps {
|
|
|
85
91
|
labelPlacement?: 'end' | 'below';
|
|
86
92
|
}
|
|
87
93
|
/** Progress through a known sequence: done, current and upcoming steps. */
|
|
88
|
-
export declare function Steps({ steps, current, orientation, responsive, onStepPress, size, variant, labelPlacement, className, 'aria-label': label }: StepsProps): import("react").JSX.Element;
|
|
94
|
+
export declare function Steps({ steps, current, orientation, responsive, showStatus, stateLabels, onStepPress, size, variant, labelPlacement, className, 'aria-label': label }: StepsProps): import("react").JSX.Element;
|