@alea-design/ui 0.6.0 → 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.
@@ -1,153 +1,155 @@
1
1
  "use client";
2
- import { jsxs as h, jsx as e, Fragment as B } from "react/jsx-runtime";
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
- 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
- import { cx as z } from "../../utils/cx.js";
6
- import { IconButton as P, Button as S } from "../button/Button.js";
7
- import { DialogModal as W, Dialog as j } from "../overlay/Overlay.js";
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 le } from "../../utils/DotField.js";
10
- import { inertProps as re } from "../../utils/inert.js";
11
- function ve({ items: f, pending: r, mode: s = "start", reverse: d, size: b, className: k }) {
12
- const u = d ? [...f].reverse() : f;
13
- return /* @__PURE__ */ h("ol", { className: z("alea-timeline", k), "data-mode": s !== "start" ? s : void 0, "data-size": b, children: [
14
- u.map((t) => /* @__PURE__ */ h("li", { className: "alea-tl-item", "data-tone": t.tone || "neutral", "data-active": t.isActive || void 0, children: [
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__ */ h("div", { className: "alea-tl-body", children: [
17
- t.time && (t.dateTime ? /* @__PURE__ */ e("time", { className: "alea-tl-time", dateTime: t.dateTime, children: t.time }) : /* @__PURE__ */ e("span", { className: "alea-tl-time", children: t.time })),
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__ */ h("li", { className: "alea-tl-item", "data-pending": !0, children: [
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 pe({ children: f, "aria-label": r, autoplay: s, perView: d = 1, showDots: b = !0, className: k }) {
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
+ 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 = t.current;
33
+ const a = p.current;
32
34
  if (!a) return;
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
- }, [m]);
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 c = t.current;
38
- if (!c) return;
39
+ const d = p.current;
40
+ if (!d) return;
39
41
  const a = () => {
40
- const w = c.clientWidth / d;
41
- p(Math.min(m - 1, Math.round(Math.abs(c.scrollLeft) / Math.max(1, w))));
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 c.addEventListener("scroll", a, { passive: !0 }), () => c.removeEventListener("scroll", a);
44
- }, [d, m]), L(() => {
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 c = setInterval(() => l(i + 1), s);
48
- return () => clearInterval(c);
49
- }, [s, g, y, i, l]), /* @__PURE__ */ h(
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: z("alea-carousel", k),
54
+ className: I("alea-carousel", w),
53
55
  "aria-roledescription": "carousel",
54
56
  "aria-label": r,
55
- onMouseEnter: () => o(!0),
56
- onMouseLeave: () => o(!1),
57
- onFocusCapture: () => o(!0),
58
- onBlurCapture: () => o(!1),
57
+ onMouseEnter: () => i(!0),
58
+ onMouseLeave: () => i(!1),
59
+ onFocusCapture: () => i(!0),
60
+ onBlurCapture: () => i(!1),
59
61
  children: [
60
- /* @__PURE__ */ h("div", { className: "alea-carousel-controls", children: [
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
- /* @__PURE__ */ e(P, { size: "sm", "aria-label": u.previousSlide, "aria-controls": `${n}-track`, onPress: () => l(i - 1), children: /* @__PURE__ */ e(K, {}) }),
63
- /* @__PURE__ */ e(P, { size: "sm", "aria-label": u.nextSlide, "aria-controls": `${n}-track`, onPress: () => l(i + 1), children: /* @__PURE__ */ e(Y, {}) })
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: t, id: `${n}-track`, className: "alea-carousel-track alea-focus-ring", tabIndex: 0, "aria-label": u.slides, "aria-live": g && !y ? "off" : "polite", style: { "--alea-per-view": d }, children: f.map((c, a) => /* @__PURE__ */ e("div", { className: "alea-carousel-slide", role: "group", "aria-roledescription": "slide", "aria-label": u.nOfTotal(a + 1, N), "aria-hidden": a < i || a >= i + d ? !0 : void 0, ...re(a < i || a >= i + d), children: c }, a)) }),
66
- b && m > 1 && /* @__PURE__ */ e("div", { className: "alea-carousel-dots", role: "group", "aria-label": u.chooseSlide, children: Array.from({ length: m }, (c, a) => /* @__PURE__ */ e("button", { type: "button", className: "alea-carousel-dot alea-focus-ring", "aria-label": u.slideN(a + 1), "aria-current": a === i ? "true" : void 0, onClick: () => l(a) }, a)) })
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 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
- M && l !== "error" && /* @__PURE__ */ e(le, {}),
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" ? k ?? /* @__PURE__ */ h("span", { className: "alea-image-fallback", children: [
76
- /* @__PURE__ */ e(V, { size: 22, "aria-hidden": "true" }),
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
- ] }) : Q
80
+ ] }) : Z
79
81
  ] });
80
- return !b || l === "error" || N || !f ? A : /* @__PURE__ */ h(B, { children: [
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
- I(1), w(!0);
83
- }, "aria-label": n.viewLarger(r || n.image.toLowerCase()), style: { width: s, height: d }, children: A }),
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
- /* @__PURE__ */ h("div", { className: "alea-image-tools", children: [
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
- /* @__PURE__ */ h("span", { className: "alea-image-zoom", "aria-live": "polite", children: [
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: [
88
90
  Math.round(C * 100),
89
91
  "%"
90
92
  ] }),
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
- /* @__PURE__ */ e(P, { "aria-label": n.close, variant: "secondary", onPress: Z, children: /* @__PURE__ */ e(te, {}) })
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: f, alt: r, style: { transform: `scale(${C})` } }) })
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, ne = null;
99
- function se() {
100
- return ne ?? (ne = import("qrcode-generator").then((f) => {
101
- const r = f.default ?? f;
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 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
+ 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 (o) return;
110
+ if (i) return;
109
111
  let n = !0;
110
- return se().then((l) => {
112
+ return oe().then((l) => {
111
113
  n && N({ qrcode: l });
112
114
  }, () => {
113
115
  }), () => {
114
116
  n = !1;
115
117
  };
116
- }, [o]);
117
- const m = O(() => {
118
- if (!o) return null;
119
- const n = o.qrcode(0, d);
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 c = "";
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
- return { d: c, n: l + 8 };
125
- }, [o, r, d]);
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
- m && /* @__PURE__ */ h("svg", { viewBox: `0 0 ${m.n} ${m.n}`, width: s, height: s, shapeRendering: "crispEdges", "aria-hidden": "true", children: [
128
- /* @__PURE__ */ e("rect", { width: m.n, height: m.n, fill: t, rx: m.n * 0.06 }),
129
- /* @__PURE__ */ e("path", { d: m.d, fill: u })
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 && m && /* @__PURE__ */ e("span", { className: "alea-qr-logo", "aria-hidden": "true", style: { background: t }, children: 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 ye({ children: f, text: r, rotate: s = -22, gap: d = 120, opacity: b = 0.08, className: k }) {
135
- const u = O(() => {
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) => ({ "<": "&lt;", "&": "&amp;", ">": "&gt;", '"': "&quot;" })[g])}</text></svg>`;
137
- return `url("data:image/svg+xml,${encodeURIComponent(p)}")`;
138
- }, [r, s, d]);
139
- return /* @__PURE__ */ h("div", { className: z("alea-watermark", k), children: [
140
- f,
141
- /* @__PURE__ */ e("span", { className: "alea-watermark-layer", "aria-hidden": "true", style: { WebkitMaskImage: u, maskImage: u, opacity: b } })
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) => ({ "<": "&lt;", "&": "&amp;", ">": "&gt;", '"': "&quot;" })[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 we = F(function({ steps: r, isOpen: s, onOpenChange: d, onFinish: b, className: k, style: u }, t) {
145
- const i = R(), [p, g] = x(0), [v, y] = x(null), o = r[p];
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 || !o) return;
150
- const n = typeof o.target == "string" ? document.querySelector(o.target) : o.target || null;
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 c = setTimeout(l, 350);
160
+ const d = setTimeout(l, 350);
159
161
  return window.addEventListener("resize", l), window.addEventListener("scroll", l, !0), () => {
160
- clearTimeout(c), window.removeEventListener("resize", l), window.removeEventListener("scroll", l, !0);
162
+ clearTimeout(d), window.removeEventListener("resize", l), window.removeEventListener("scroll", l, !0);
161
163
  };
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: [
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: [
165
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 } }),
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
- /* @__PURE__ */ e("h2", { className: "alea-tour-title", children: o.title }),
169
- o.content && /* @__PURE__ */ e("div", { className: "alea-tour-text", children: o.content }),
170
- /* @__PURE__ */ h("div", { className: "alea-tour-actions", children: [
171
- /* @__PURE__ */ e(S, { size: "sm", variant: "ghost", onPress: n, children: i.skip }),
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
- p > 0 && /* @__PURE__ */ e(S, { size: "sm", variant: "ghost", onPress: () => g((l) => l - 1), children: i.back }),
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
- p < r.length - 1 ? g((l) => l + 1) : (b == null || b(), n());
176
- }, children: p < r.length - 1 ? i.next : i.done })
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
- pe as Carousel,
183
- be as Image,
184
- Ne as QRCode,
185
- ve as Timeline,
186
- we as Tour,
187
- ye as Watermark
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
  };
@@ -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), 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
+ /** 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. */
@@ -79,6 +81,8 @@ export interface StepsProps {
79
81
  responsive?: boolean | 'scroll';
80
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. */
81
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>>;
82
86
  /** sm (24 px markers) or md (32 px, default). */
83
87
  size?: 'sm' | 'md';
84
88
  /** numbers (default), dots (small markers, for compact flows) or icons (each step's icon). */
@@ -87,4 +91,4 @@ export interface StepsProps {
87
91
  labelPlacement?: 'end' | 'below';
88
92
  }
89
93
  /** Progress through a known sequence: done, current and upcoming steps. */
90
- export declare function Steps({ steps, current, orientation, responsive, showStatus, 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;