@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as h, jsx as e, Fragment as B } from "react/jsx-runtime";
|
|
3
|
-
import { useRef as H, useState as
|
|
3
|
+
import { useRef as H, useState as x, useId as U, useCallback as X, useEffect as L, forwardRef as F, useMemo as O, useLayoutEffect as _ } from "react";
|
|
4
4
|
import { Pause as G, Play as J, ChevronLeft as K, ChevronRight as Y, ImageOff as V, ZoomOut as ee, ZoomIn as ae, X as te } from "lucide-react";
|
|
5
5
|
import { cx as z } from "../../utils/cx.js";
|
|
6
6
|
import { IconButton as P, Button as S } from "../button/Button.js";
|
|
@@ -26,19 +26,19 @@ function ve({ items: f, pending: r, mode: s = "start", reverse: d, size: b, clas
|
|
|
26
26
|
] });
|
|
27
27
|
}
|
|
28
28
|
function pe({ children: f, "aria-label": r, autoplay: s, perView: d = 1, showDots: b = !0, className: k }) {
|
|
29
|
-
const u = R(), t = H(null), [i,
|
|
29
|
+
const u = R(), t = H(null), [i, p] = x(0), [g, v] = x(!!s), [y, o] = x(!1), N = f.length, m = Math.max(1, Math.ceil(N - d + 1)), n = U(), l = X((c) => {
|
|
30
30
|
var E;
|
|
31
31
|
const a = t.current;
|
|
32
32
|
if (!a) return;
|
|
33
|
-
const w = (c + m) % m,
|
|
34
|
-
typeof a.scrollTo == "function" ? a.scrollTo({ left: M, behavior: $ ? "auto" : "smooth" }) : a.scrollLeft = M,
|
|
33
|
+
const w = (c + m) % m, C = a.children[w], I = getComputedStyle(a).direction === "rtl", M = C ? a.scrollLeft + (I ? 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") || "");
|
|
34
|
+
typeof a.scrollTo == "function" ? a.scrollTo({ left: M, behavior: $ ? "auto" : "smooth" }) : a.scrollLeft = M, p(w);
|
|
35
35
|
}, [m]);
|
|
36
36
|
return L(() => {
|
|
37
37
|
const c = t.current;
|
|
38
38
|
if (!c) return;
|
|
39
39
|
const a = () => {
|
|
40
40
|
const w = c.clientWidth / d;
|
|
41
|
-
|
|
41
|
+
p(Math.min(m - 1, Math.round(Math.abs(c.scrollLeft) / Math.max(1, w))));
|
|
42
42
|
};
|
|
43
43
|
return c.addEventListener("scroll", a, { passive: !0 }), () => c.removeEventListener("scroll", a);
|
|
44
44
|
}, [d, m]), L(() => {
|
|
@@ -58,7 +58,7 @@ function pe({ children: f, "aria-label": r, autoplay: s, perView: d = 1, showDot
|
|
|
58
58
|
onBlurCapture: () => o(!1),
|
|
59
59
|
children: [
|
|
60
60
|
/* @__PURE__ */ h("div", { className: "alea-carousel-controls", children: [
|
|
61
|
-
s && /* @__PURE__ */ e(P, { size: "sm", "aria-label": g ? u.stopSlides : u.playSlides, onPress: () =>
|
|
61
|
+
s && /* @__PURE__ */ e(P, { size: "sm", "aria-label": g ? u.stopSlides : u.playSlides, onPress: () => v((c) => !c), children: g ? /* @__PURE__ */ e(G, {}) : /* @__PURE__ */ e(J, {}) }),
|
|
62
62
|
/* @__PURE__ */ e(P, { size: "sm", "aria-label": u.previousSlide, "aria-controls": `${n}-track`, onPress: () => l(i - 1), children: /* @__PURE__ */ e(K, {}) }),
|
|
63
63
|
/* @__PURE__ */ e(P, { size: "sm", "aria-label": u.nextSlide, "aria-controls": `${n}-track`, onPress: () => l(i + 1), children: /* @__PURE__ */ e(Y, {}) })
|
|
64
64
|
] }),
|
|
@@ -68,8 +68,8 @@ function pe({ children: f, "aria-label": r, autoplay: s, perView: d = 1, showDot
|
|
|
68
68
|
}
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
|
-
function be({ src: f, alt: r, width: s, height: d, preview: b = !0, fallback: k, fit: u = "cover", radius: t = "md", srcSet: i, sizes:
|
|
72
|
-
const n = R(), [l, c] =
|
|
71
|
+
function be({ src: f, alt: r, width: s, height: d, preview: b = !0, fallback: k, fit: u = "cover", radius: t = "md", srcSet: i, sizes: p, ratio: g, priority: v, placeholder: y, loadingEffect: o = "shimmer", isLoading: N, className: m }) {
|
|
72
|
+
const n = R(), [l, c] = x("loading"), [a, w] = x(!1), [C, I] = x(1), M = o === "matrix", $ = !!N || l === "loading", E = N ? "loading" : l, Q = f ? /* @__PURE__ */ e("img", { src: f, srcSet: i, sizes: p, alt: r, loading: v ? "eager" : "lazy", decoding: v ? "sync" : "async", fetchPriority: v ? "high" : void 0, onLoad: () => c("ok"), onError: () => c("error"), style: { objectFit: u } }) : null, T = y ? /^(data:|https?:|\/)/.test(y) ? { backgroundImage: `url(${y})`, backgroundSize: "cover" } : { background: y } : null, A = /* @__PURE__ */ h("span", { className: z("alea-image", m), "data-state": E, "data-effect": M ? "matrix" : void 0, "aria-busy": $ || void 0, "data-radius": t, "data-placeholder": T ? !0 : void 0, style: { width: s, height: d, aspectRatio: g ? String(g) : void 0, ...l === "loading" && T ? T : {} }, children: [
|
|
73
73
|
M && l !== "error" && /* @__PURE__ */ e(le, {}),
|
|
74
74
|
M && /* @__PURE__ */ e("span", { role: "status", className: "alea-visually-hidden", children: $ ? n.loading : "" }),
|
|
75
75
|
l === "error" ? k ?? /* @__PURE__ */ h("span", { className: "alea-image-fallback", children: [
|
|
@@ -83,15 +83,15 @@ function be({ src: f, alt: r, width: s, height: d, preview: b = !0, fallback: k,
|
|
|
83
83
|
}, "aria-label": n.viewLarger(r || n.image.toLowerCase()), style: { width: s, height: d }, children: A }),
|
|
84
84
|
/* @__PURE__ */ e(W, { isOpen: a, onOpenChange: w, size: "full", className: "alea-image-overlay", children: /* @__PURE__ */ e(j, { "aria-label": r || n.imagePreview, hideClose: !0, className: "alea-image-dialog", children: ({ close: Z }) => /* @__PURE__ */ h(B, { children: [
|
|
85
85
|
/* @__PURE__ */ h("div", { className: "alea-image-tools", children: [
|
|
86
|
-
/* @__PURE__ */ e(P, { "aria-label": n.zoomOut, variant: "secondary", isDisabled:
|
|
86
|
+
/* @__PURE__ */ e(P, { "aria-label": n.zoomOut, variant: "secondary", isDisabled: C <= 0.5, onPress: () => I((q) => Math.max(0.5, q - 0.25)), children: /* @__PURE__ */ e(ee, {}) }),
|
|
87
87
|
/* @__PURE__ */ h("span", { className: "alea-image-zoom", "aria-live": "polite", children: [
|
|
88
|
-
Math.round(
|
|
88
|
+
Math.round(C * 100),
|
|
89
89
|
"%"
|
|
90
90
|
] }),
|
|
91
|
-
/* @__PURE__ */ e(P, { "aria-label": n.zoomIn, variant: "secondary", isDisabled:
|
|
91
|
+
/* @__PURE__ */ e(P, { "aria-label": n.zoomIn, variant: "secondary", isDisabled: C >= 3, onPress: () => I((q) => Math.min(3, q + 0.25)), children: /* @__PURE__ */ e(ae, {}) }),
|
|
92
92
|
/* @__PURE__ */ e(P, { "aria-label": n.close, variant: "secondary", onPress: Z, children: /* @__PURE__ */ e(te, {}) })
|
|
93
93
|
] }),
|
|
94
|
-
/* @__PURE__ */ e("div", { className: "alea-image-stage", children: /* @__PURE__ */ e("img", { src: f, alt: r, style: { transform: `scale(${
|
|
94
|
+
/* @__PURE__ */ e("div", { className: "alea-image-stage", children: /* @__PURE__ */ e("img", { src: f, alt: r, style: { transform: `scale(${C})` } }) })
|
|
95
95
|
] }) }) })
|
|
96
96
|
] });
|
|
97
97
|
}
|
|
@@ -102,8 +102,8 @@ function se() {
|
|
|
102
102
|
return r.stringToBytes = r.stringToBytesFuncs["UTF-8"], D = r;
|
|
103
103
|
}));
|
|
104
104
|
}
|
|
105
|
-
const Ne = F(function({ value: r, size: s = 160, level: d = "M", logo: b, label: k, color: u = "#111011", background: t = "#ffffff", className: i, style:
|
|
106
|
-
const y = R(), [o, N] =
|
|
105
|
+
const Ne = F(function({ value: r, size: s = 160, level: d = "M", logo: b, label: k, color: u = "#111011", background: t = "#ffffff", className: i, style: p, ...g }, v) {
|
|
106
|
+
const y = R(), [o, N] = x(D ? { qrcode: D } : null);
|
|
107
107
|
L(() => {
|
|
108
108
|
if (o) return;
|
|
109
109
|
let n = !0;
|
|
@@ -123,7 +123,7 @@ const Ne = F(function({ value: r, size: s = 160, level: d = "M", logo: b, label:
|
|
|
123
123
|
for (let a = 0; a < l; a++) for (let w = 0; w < l; w++) n.isDark(a, w) && (c += `M${w + 4} ${a + 4}h1v1h-1z`);
|
|
124
124
|
return { d: c, n: l + 8 };
|
|
125
125
|
}, [o, r, d]);
|
|
126
|
-
return /* @__PURE__ */ h("span", { ref:
|
|
126
|
+
return /* @__PURE__ */ h("span", { ref: v, ...g, className: z("alea-qr", i), style: { width: s, height: s, ...p }, role: "img", "aria-label": k ?? g["aria-label"] ?? y.qrCode(r), children: [
|
|
127
127
|
m && /* @__PURE__ */ h("svg", { viewBox: `0 0 ${m.n} ${m.n}`, width: s, height: s, shapeRendering: "crispEdges", "aria-hidden": "true", children: [
|
|
128
128
|
/* @__PURE__ */ e("rect", { width: m.n, height: m.n, fill: t, rx: m.n * 0.06 }),
|
|
129
129
|
/* @__PURE__ */ e("path", { d: m.d, fill: u })
|
|
@@ -133,8 +133,8 @@ const Ne = F(function({ value: r, size: s = 160, level: d = "M", logo: b, label:
|
|
|
133
133
|
});
|
|
134
134
|
function ye({ children: f, text: r, rotate: s = -22, gap: d = 120, opacity: b = 0.08, className: k }) {
|
|
135
135
|
const u = O(() => {
|
|
136
|
-
const t = d + r.length * 7.5, i = d,
|
|
137
|
-
return `url("data:image/svg+xml,${encodeURIComponent(
|
|
136
|
+
const t = d + r.length * 7.5, i = d, p = `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${i}"><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} ${t / 2} ${i / 2})">${r.replace(/[<&>"]/g, (g) => ({ "<": "<", "&": "&", ">": ">", '"': """ })[g])}</text></svg>`;
|
|
137
|
+
return `url("data:image/svg+xml,${encodeURIComponent(p)}")`;
|
|
138
138
|
}, [r, s, d]);
|
|
139
139
|
return /* @__PURE__ */ h("div", { className: z("alea-watermark", k), children: [
|
|
140
140
|
f,
|
|
@@ -142,7 +142,7 @@ function ye({ children: f, text: r, rotate: s = -22, gap: d = 120, opacity: b =
|
|
|
142
142
|
] });
|
|
143
143
|
}
|
|
144
144
|
const we = F(function({ steps: r, isOpen: s, onOpenChange: d, onFinish: b, className: k, style: u }, t) {
|
|
145
|
-
const i = R(), [
|
|
145
|
+
const i = R(), [p, g] = x(0), [v, y] = x(null), o = r[p];
|
|
146
146
|
if (L(() => {
|
|
147
147
|
s && g(0);
|
|
148
148
|
}, [s]), _(() => {
|
|
@@ -159,21 +159,21 @@ const we = F(function({ steps: r, isOpen: s, onOpenChange: d, onFinish: b, class
|
|
|
159
159
|
return window.addEventListener("resize", l), window.addEventListener("scroll", l, !0), () => {
|
|
160
160
|
clearTimeout(c), window.removeEventListener("resize", l), window.removeEventListener("scroll", l, !0);
|
|
161
161
|
};
|
|
162
|
-
}, [s,
|
|
163
|
-
const N = 8, m =
|
|
164
|
-
return /* @__PURE__ */ e(W, { isOpen: s, onOpenChange: d, isDismissable: !1, className: "alea-tour-overlay", children: /* @__PURE__ */ e(j, { ref: t, style: u, "aria-label": typeof o.title == "string" ? o.title : i.stepN(
|
|
165
|
-
|
|
166
|
-
/* @__PURE__ */ h("div", { className: "alea-tour-card", style: m, children: [
|
|
167
|
-
/* @__PURE__ */ e("p", { className: "alea-tour-count", children: i.stepNOfTotal(
|
|
162
|
+
}, [s, p, o]), !o) return null;
|
|
163
|
+
const N = 8, m = 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%" };
|
|
164
|
+
return /* @__PURE__ */ e(W, { isOpen: s, onOpenChange: d, isDismissable: !1, className: "alea-tour-overlay", children: /* @__PURE__ */ e(j, { ref: t, style: u, "aria-label": typeof o.title == "string" ? o.title : i.stepN(p + 1), hideClose: !0, className: z("alea-tour", k), children: ({ close: n }) => /* @__PURE__ */ h(B, { children: [
|
|
165
|
+
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 } }),
|
|
166
|
+
/* @__PURE__ */ h("div", { className: "alea-tour-card", style: m, "data-centered": v ? void 0 : "", children: [
|
|
167
|
+
/* @__PURE__ */ e("p", { className: "alea-tour-count", children: i.stepNOfTotal(p + 1, r.length) }),
|
|
168
168
|
/* @__PURE__ */ e("h2", { className: "alea-tour-title", children: o.title }),
|
|
169
169
|
o.content && /* @__PURE__ */ e("div", { className: "alea-tour-text", children: o.content }),
|
|
170
170
|
/* @__PURE__ */ h("div", { className: "alea-tour-actions", children: [
|
|
171
171
|
/* @__PURE__ */ e(S, { size: "sm", variant: "ghost", onPress: n, children: i.skip }),
|
|
172
172
|
/* @__PURE__ */ e("span", { className: "alea-tour-spacer" }),
|
|
173
|
-
|
|
173
|
+
p > 0 && /* @__PURE__ */ e(S, { size: "sm", variant: "ghost", onPress: () => g((l) => l - 1), children: i.back }),
|
|
174
174
|
/* @__PURE__ */ e(S, { size: "sm", autoFocus: !0, onPress: () => {
|
|
175
|
-
|
|
176
|
-
}, children:
|
|
175
|
+
p < r.length - 1 ? g((l) => l + 1) : (b == null || b(), n());
|
|
176
|
+
}, children: p < r.length - 1 ? i.next : i.done })
|
|
177
177
|
] })
|
|
178
178
|
] })
|
|
179
179
|
] }) }) });
|
|
@@ -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
|
};
|
|
@@ -55,8 +55,8 @@ export interface Step {
|
|
|
55
55
|
id: Key;
|
|
56
56
|
title: ReactNode;
|
|
57
57
|
description?: ReactNode;
|
|
58
|
-
/** Overrides the status from current: error (something to fix) or
|
|
59
|
-
status?: 'error' | 'warning';
|
|
58
|
+
/** 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). */
|
|
59
|
+
status?: 'error' | 'warning' | 'skipped';
|
|
60
60
|
/** An icon instead of the number (with variant="icons"). */
|
|
61
61
|
icon?: ReactNode;
|
|
62
62
|
/** Marks the step as optional. */
|
|
@@ -75,8 +75,10 @@ export interface StepsProps {
|
|
|
75
75
|
'aria-label'?: string;
|
|
76
76
|
/** Extra class names for the root element. */
|
|
77
77
|
className?: string;
|
|
78
|
-
/** Horizontal steps turn vertical on phones (below 640 px). Default true. */
|
|
79
|
-
responsive?: boolean;
|
|
78
|
+
/** 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. */
|
|
79
|
+
responsive?: boolean | 'scroll';
|
|
80
|
+
/** 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. */
|
|
81
|
+
showStatus?: boolean;
|
|
80
82
|
/** sm (24 px markers) or md (32 px, default). */
|
|
81
83
|
size?: 'sm' | 'md';
|
|
82
84
|
/** numbers (default), dots (small markers, for compact flows) or icons (each step's icon). */
|
|
@@ -85,4 +87,4 @@ export interface StepsProps {
|
|
|
85
87
|
labelPlacement?: 'end' | 'below';
|
|
86
88
|
}
|
|
87
89
|
/** 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;
|
|
90
|
+
export declare function Steps({ steps, current, orientation, responsive, showStatus, onStepPress, size, variant, labelPlacement, className, 'aria-label': label }: StepsProps): import("react").JSX.Element;
|
|
@@ -1,59 +1,62 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as a, jsxs as c, Fragment as
|
|
3
|
-
import { Children as
|
|
4
|
-
import { Breadcrumb as
|
|
5
|
-
import { ChevronsLeft as
|
|
6
|
-
import { DropdownMenu as
|
|
7
|
-
import { withBase as
|
|
8
|
-
import { useStrings as
|
|
9
|
-
function
|
|
10
|
-
const
|
|
11
|
-
let
|
|
12
|
-
if (n && typeof
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/* @__PURE__ */ a(
|
|
19
|
-
...
|
|
2
|
+
import { jsx as a, jsxs as c, Fragment as z } from "react/jsx-runtime";
|
|
3
|
+
import { Children as $, isValidElement as D, useMemo as E, useRef as O, useState as j, useEffect as L } from "react";
|
|
4
|
+
import { Breadcrumb as w, Link as P, Button as W, Breadcrumbs as T } from "react-aria-components";
|
|
5
|
+
import { ChevronsLeft as _, ChevronLeft as q, ChevronRight as A, ChevronsRight as K, X as V, Minus as X, Check as F } from "lucide-react";
|
|
6
|
+
import { DropdownMenu as G, MenuItem as H } from "../menu/Menu.js";
|
|
7
|
+
import { withBase as Q, cx as B } from "../../utils/cx.js";
|
|
8
|
+
import { useStrings as R } from "../../i18n/strings.js";
|
|
9
|
+
function na({ separator: e, maxItems: n, size: p, className: t, children: o, ...h }) {
|
|
10
|
+
const m = R();
|
|
11
|
+
let s = o;
|
|
12
|
+
if (n && typeof o != "function") {
|
|
13
|
+
const f = $.toArray(o).filter(D);
|
|
14
|
+
if (f.length > n && n >= 2) {
|
|
15
|
+
const v = f.slice(1, f.length - (n - 1));
|
|
16
|
+
s = [
|
|
17
|
+
f[0],
|
|
18
|
+
/* @__PURE__ */ a(w, { className: "alea-crumb", children: /* @__PURE__ */ a(G, { "aria-label": m.showMore, trigger: /* @__PURE__ */ a(W, { className: "alea-crumb-link alea-crumb-more alea-focus-ring", "aria-label": m.showMore, children: "…" }), children: v.map((b, d) => /* @__PURE__ */ a(H, { id: `c${d}`, href: b.props.href, children: b.props.children }, d)) }) }, "__more"),
|
|
19
|
+
...f.slice(f.length - (n - 1))
|
|
20
20
|
];
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
return /* @__PURE__ */ a(
|
|
23
|
+
return /* @__PURE__ */ a(T, { ...h, className: B("alea-breadcrumbs", t), "data-size": p, "data-separator": e ? void 0 : "chevron", style: { "--alea-crumb-sep": typeof e == "string" ? `"${e}"` : void 0, ...h.style }, children: s });
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
return /* @__PURE__ */ a(
|
|
25
|
+
function ra({ href: e, icon: n, children: p, className: t, ...o }) {
|
|
26
|
+
return /* @__PURE__ */ a(w, { ...o, className: Q("alea-crumb", t), children: e ? /* @__PURE__ */ c(P, { href: e, className: "alea-crumb-link alea-focus-ring", children: [
|
|
27
27
|
n && /* @__PURE__ */ a("span", { className: "alea-crumb-icon", "aria-hidden": "true", children: n }),
|
|
28
|
-
|
|
28
|
+
p
|
|
29
|
+
] }) : /* @__PURE__ */ c("span", { className: "alea-crumb-link", "data-current": !0, "aria-current": "page", children: [
|
|
30
|
+
n && /* @__PURE__ */ a("span", { className: "alea-crumb-icon", "aria-hidden": "true", children: n }),
|
|
31
|
+
p
|
|
29
32
|
] }) });
|
|
30
33
|
}
|
|
31
|
-
function
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
for (let
|
|
35
|
-
return
|
|
34
|
+
function U(e, n, p) {
|
|
35
|
+
const t = [], o = Math.max(2, e - p), h = Math.min(n - 1, e + p);
|
|
36
|
+
t.push(1), o > 2 && t.push("gap");
|
|
37
|
+
for (let m = o; m <= h; m++) t.push(m);
|
|
38
|
+
return h < n - 1 && t.push("gap"), n > 1 && t.push(n), t;
|
|
36
39
|
}
|
|
37
|
-
function
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
/* @__PURE__ */ a("button", { type: "button", className: "alea-page alea-focus-ring", "aria-label":
|
|
43
|
-
|
|
44
|
-
/* @__PURE__ */ a("button", { type: "button", className: "alea-page alea-focus-ring", "aria-label":
|
|
45
|
-
|
|
40
|
+
function la({ page: e, total: n, onChange: p, siblings: t = 1, appearance: o = "pages", size: h, showFirstLast: m, pageSize: s, pageSizeOptions: f = [10, 25, 50, 100], onPageSizeChange: v, totalItems: b, showJumper: d, className: C, "aria-label": y }) {
|
|
41
|
+
const u = R();
|
|
42
|
+
y ?? (y = u.pagination);
|
|
43
|
+
const x = E(() => U(e, Math.max(1, n), t), [e, n, t]), N = (r) => p(Math.min(Math.max(1, r), n)), l = s ? (e - 1) * s + 1 : 0, g = s && b != null ? Math.min(b, e * s) : 0, i = b != null && s || v || d, k = /* @__PURE__ */ c("nav", { "aria-label": y, className: B("alea-pagination", !i && C), "data-size": h, children: [
|
|
44
|
+
m && /* @__PURE__ */ a("button", { type: "button", className: "alea-page alea-focus-ring", "data-far": !0, "aria-label": u.firstPage, disabled: e <= 1, onClick: () => N(1), children: /* @__PURE__ */ a(_, { size: 16, "aria-hidden": "true" }) }),
|
|
45
|
+
/* @__PURE__ */ a("button", { type: "button", className: "alea-page alea-focus-ring", "aria-label": u.previousPage, disabled: e <= 1, onClick: () => N(e - 1), children: /* @__PURE__ */ a(q, { size: 16, "aria-hidden": "true" }) }),
|
|
46
|
+
o === "compact" ? /* @__PURE__ */ a("span", { className: "alea-page-status", "aria-live": "polite", children: u.nOfTotal(e, n) }) : /* @__PURE__ */ a("ul", { children: x.map((r, M) => r === "gap" ? /* @__PURE__ */ a("li", { className: "alea-page-gap", "aria-hidden": "true", children: "…" }, `g${M}`) : /* @__PURE__ */ a("li", { "data-far": x.length > 5 && Math.abs(r - e) > 1 || void 0, children: /* @__PURE__ */ a("button", { type: "button", className: "alea-page alea-focus-ring", "aria-current": r === e ? "page" : void 0, "aria-label": u.pageN(r), onClick: () => N(r), children: r }) }, r)) }),
|
|
47
|
+
/* @__PURE__ */ a("button", { type: "button", className: "alea-page alea-focus-ring", "aria-label": u.nextPage, disabled: e >= n, onClick: () => N(e + 1), children: /* @__PURE__ */ a(A, { size: 16, "aria-hidden": "true" }) }),
|
|
48
|
+
m && /* @__PURE__ */ a("button", { type: "button", className: "alea-page alea-focus-ring", "data-far": !0, "aria-label": u.lastPage, disabled: e >= n, onClick: () => N(n), children: /* @__PURE__ */ a(K, { size: 16, "aria-hidden": "true" }) })
|
|
46
49
|
] });
|
|
47
|
-
return
|
|
48
|
-
|
|
50
|
+
return i ? /* @__PURE__ */ c("div", { className: B("alea-pagination-bar", C), "data-size": h, children: [
|
|
51
|
+
b != null && s ? /* @__PURE__ */ a("span", { className: "alea-pagination-total", "aria-live": "polite", children: u.itemRange(l, g, b) }) : /* @__PURE__ */ a("span", {}),
|
|
49
52
|
/* @__PURE__ */ c("div", { className: "alea-pagination-controls", children: [
|
|
50
|
-
|
|
51
|
-
/* @__PURE__ */ a("span", { children:
|
|
52
|
-
/* @__PURE__ */ a("select", { className: "alea-cal-select alea-focus-ring", value:
|
|
53
|
+
v && s && /* @__PURE__ */ c("label", { className: "alea-pagination-size", children: [
|
|
54
|
+
/* @__PURE__ */ a("span", { children: u.perPage }),
|
|
55
|
+
/* @__PURE__ */ a("select", { className: "alea-cal-select alea-focus-ring", value: s, onChange: (r) => v(Number(r.target.value)), children: f.map((r) => /* @__PURE__ */ a("option", { value: r, children: r }, r)) })
|
|
53
56
|
] }),
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/* @__PURE__ */ a("span", { children:
|
|
57
|
+
k,
|
|
58
|
+
d && /* @__PURE__ */ c("label", { className: "alea-pagination-jump", children: [
|
|
59
|
+
/* @__PURE__ */ a("span", { children: u.goToPage }),
|
|
57
60
|
/* @__PURE__ */ a(
|
|
58
61
|
"input",
|
|
59
62
|
{
|
|
@@ -63,59 +66,73 @@ function aa({ page: e, total: n, onChange: h, siblings: l = 1, appearance: u = "
|
|
|
63
66
|
min: 1,
|
|
64
67
|
max: n,
|
|
65
68
|
placeholder: String(e),
|
|
66
|
-
onKeyDown: (
|
|
67
|
-
if (
|
|
68
|
-
const
|
|
69
|
-
|
|
69
|
+
onKeyDown: (r) => {
|
|
70
|
+
if (r.key === "Enter") {
|
|
71
|
+
const M = Number(r.target.value);
|
|
72
|
+
M && (N(M), r.target.value = "");
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
76
|
)
|
|
74
77
|
] })
|
|
75
78
|
] })
|
|
76
|
-
] }) :
|
|
79
|
+
] }) : k;
|
|
77
80
|
}
|
|
78
|
-
function
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
return
|
|
83
|
-
const
|
|
84
|
-
|
|
81
|
+
function ia({ steps: e, current: n, orientation: p = "horizontal", responsive: t = !0, showStatus: o, onStepPress: h, size: m, variant: s = "numbers", labelPlacement: f, className: v, "aria-label": b }) {
|
|
82
|
+
const d = R();
|
|
83
|
+
b ?? (b = d.progress);
|
|
84
|
+
const C = Math.max(0, e.findIndex((l) => l.id === n)), y = t === "scroll" && p === "horizontal", u = O(null), [x, N] = j(!1);
|
|
85
|
+
return L(() => {
|
|
86
|
+
const l = u.current;
|
|
87
|
+
if (!y || !l) return;
|
|
88
|
+
const g = () => N(l.scrollWidth > l.clientWidth + 1);
|
|
89
|
+
g();
|
|
90
|
+
const i = l.querySelector('[aria-current="step"]');
|
|
91
|
+
if (i) {
|
|
92
|
+
const r = l.getBoundingClientRect(), M = i.getBoundingClientRect();
|
|
93
|
+
l.scrollLeft += M.left + M.width / 2 - (r.left + r.width / 2);
|
|
94
|
+
}
|
|
95
|
+
if (typeof ResizeObserver > "u") return;
|
|
96
|
+
const k = new ResizeObserver(g);
|
|
97
|
+
return k.observe(l), () => k.disconnect();
|
|
98
|
+
}, [y, C, e.length]), /* @__PURE__ */ a("ol", { ref: u, tabIndex: y && x ? 0 : void 0, "aria-label": b, className: B("alea-steps", v), "data-orientation": p, "data-responsive": y ? "scroll" : t ? "true" : void 0, "data-size": m, "data-variant": s !== "numbers" ? s : void 0, "data-label-placement": f !== "end" ? f : void 0, children: e.map((l, g) => {
|
|
99
|
+
const i = l.status ?? (g < C ? "done" : g === C ? "current" : "upcoming"), k = i === "error" ? /* @__PURE__ */ a(V, { size: 14 }) : i === "skipped" ? /* @__PURE__ */ a(X, { size: 14 }) : i === "warning" ? "!" : i === "done" ? /* @__PURE__ */ a(F, { size: 14 }) : s === "dots" ? null : s === "icons" && l.icon ? l.icon : g + 1, r = /* @__PURE__ */ c(z, { children: [
|
|
100
|
+
/* @__PURE__ */ a("span", { className: "alea-step-dot", "aria-hidden": "true", children: k }),
|
|
85
101
|
/* @__PURE__ */ c("span", { className: "alea-step-text", children: [
|
|
86
102
|
/* @__PURE__ */ c("span", { className: "alea-step-title", children: [
|
|
87
|
-
|
|
88
|
-
|
|
103
|
+
l.title,
|
|
104
|
+
l.isOptional && /* @__PURE__ */ c("span", { className: "alea-step-optional", children: [
|
|
89
105
|
" (",
|
|
90
|
-
|
|
106
|
+
d.optional,
|
|
91
107
|
")"
|
|
92
108
|
] })
|
|
93
109
|
] }),
|
|
94
|
-
|
|
95
|
-
|
|
110
|
+
l.description && /* @__PURE__ */ a("span", { className: "alea-step-desc", children: l.description }),
|
|
111
|
+
o && /* @__PURE__ */ a("span", { className: "alea-step-status", children: d.stepStatus[i] }),
|
|
112
|
+
!o && (i === "error" || i === "warning" || i === "skipped") && /* @__PURE__ */ c("span", { className: "alea-visually-hidden", children: [
|
|
96
113
|
" ",
|
|
97
|
-
|
|
114
|
+
i === "error" ? d.stepError : i === "warning" ? d.stepWarning : d.stepSkipped
|
|
98
115
|
] })
|
|
99
116
|
] })
|
|
100
117
|
] });
|
|
101
|
-
return /* @__PURE__ */ a("li", { className: "alea-step", "data-status":
|
|
102
|
-
|
|
103
|
-
/* @__PURE__ */ c("span", { className: "alea-visually-hidden", children: [
|
|
118
|
+
return /* @__PURE__ */ a("li", { className: "alea-step", "data-status": i, "aria-current": i === "current" ? "step" : void 0, children: h && i === "done" ? /* @__PURE__ */ c("button", { type: "button", className: "alea-step-button alea-focus-ring", onClick: () => h(l.id), children: [
|
|
119
|
+
r,
|
|
120
|
+
!o && /* @__PURE__ */ c("span", { className: "alea-visually-hidden", children: [
|
|
104
121
|
" ",
|
|
105
|
-
|
|
122
|
+
d.stepDoneBack
|
|
106
123
|
] })
|
|
107
124
|
] }) : /* @__PURE__ */ c("div", { className: "alea-step-button", children: [
|
|
108
|
-
|
|
109
|
-
|
|
125
|
+
r,
|
|
126
|
+
i === "done" && !o && /* @__PURE__ */ c("span", { className: "alea-visually-hidden", children: [
|
|
110
127
|
" ",
|
|
111
|
-
|
|
128
|
+
d.stepDone
|
|
112
129
|
] })
|
|
113
|
-
] }) },
|
|
130
|
+
] }) }, l.id != null ? String(l.id) : g);
|
|
114
131
|
}) });
|
|
115
132
|
}
|
|
116
133
|
export {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
134
|
+
ra as Breadcrumb,
|
|
135
|
+
na as Breadcrumbs,
|
|
136
|
+
la as Pagination,
|
|
137
|
+
ia as Steps
|
|
121
138
|
};
|