@alea-design/ui 0.3.1 → 0.4.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.
@@ -58,9 +58,15 @@ export interface TextFieldProps extends Omit<RACTextFieldProps, 'children'>, Fie
58
58
  showCount?: boolean;
59
59
  /** Shows a spinner at the end of the text, for a value being checked or looked up. It takes no room, the field stays editable, and screen readers hear it as busy. */
60
60
  isLoading?: boolean;
61
+ /** For type date, time, number and similar: the lowest value allowed (a yyyy-mm-dd date, an hh:mm time, a number). */
62
+ min?: string | number;
63
+ /** For type date, time, number and similar: the highest value allowed. */
64
+ max?: string | number;
65
+ /** For type number, date and time: the step between values (seconds for time). */
66
+ step?: string | number;
61
67
  }
62
68
  /** A single-line text input: label (top or side), help, warning and error, prefix and suffix, addons, a clear button, a character count, four variants and five sizes. */
63
- export declare function TextField({ label, description, errorMessage, warningMessage, showOptional, size, variant, labelPosition, placeholder, prefix, suffix, addonStart, addonEnd, isClearable, showCount, isLoading, className, value, defaultValue, onChange, ...props }: TextFieldProps): import("react").JSX.Element;
69
+ export declare function TextField({ label, description, errorMessage, warningMessage, showOptional, size, variant, labelPosition, placeholder, prefix, suffix, addonStart, addonEnd, isClearable, showCount, isLoading, min, max, step, className, value, defaultValue, onChange, ...props }: TextFieldProps): import("react").JSX.Element;
64
70
  export interface TextAreaProps extends Omit<RACTextFieldProps, 'children'>, FieldBits {
65
71
  /** An example of what to type. */
66
72
  placeholder?: string;
@@ -1,33 +1,33 @@
1
1
  "use client";
2
- import { jsx as e, jsxs as r, Fragment as P } from "react/jsx-runtime";
3
- import { useState as j, useRef as O } from "react";
4
- import { Text as U, FieldError as X, Group as Z, Label as H, NumberField as J, Button as g, Input as C, SearchField as K, TextField as G, TextArea as Q } from "react-aria-components";
5
- import { Minus as W, Plus as Y, ChevronUp as _, ChevronDown as M, EyeOff as ee, Eye as ae, Search as le, X as L } from "lucide-react";
6
- import { cx as S, withBase as $ } from "../../utils/cx.js";
2
+ import { jsx as e, jsxs as r, Fragment as j } from "react/jsx-runtime";
3
+ import { useState as O, useRef as Z } from "react";
4
+ import { Text as J, FieldError as K, Group as G, Label as Q, NumberField as W, Button as F, Input as k, SearchField as Y, TextField as L, TextArea as _ } from "react-aria-components";
5
+ import { Minus as M, Plus as ee, ChevronUp as ae, ChevronDown as le, EyeOff as ie, Eye as se, Search as te, X as U } from "lucide-react";
6
+ import { cx as $, withBase as A } from "../../utils/cx.js";
7
7
  import { useStrings as y } from "../../i18n/strings.js";
8
- import { useControlled as k } from "../../utils/controlled.js";
9
- import { responsiveAttrs as ie } from "../../utils/responsive.js";
10
- import { Spinner as se } from "../feedback/Spinner.js";
11
- import { FieldSpinner as B, loadingAttrs as te } from "./FieldLoading.js";
12
- function re({ className: a, ...l }) {
13
- return /* @__PURE__ */ e(H, { ...l, className: S("alea-label", a) });
8
+ import { useControlled as B } from "../../utils/controlled.js";
9
+ import { responsiveAttrs as re } from "../../utils/responsive.js";
10
+ import { Spinner as ne } from "../feedback/Spinner.js";
11
+ import { FieldSpinner as D, loadingAttrs as ce } from "./FieldLoading.js";
12
+ function de({ className: a, ...l }) {
13
+ return /* @__PURE__ */ e(Q, { ...l, className: $("alea-label", a) });
14
14
  }
15
- function ne({ className: a, ...l }) {
16
- return /* @__PURE__ */ e(U, { ...l, slot: "description", className: S("alea-description", a) });
15
+ function ue({ className: a, ...l }) {
16
+ return /* @__PURE__ */ e(J, { ...l, slot: "description", className: $("alea-description", a) });
17
17
  }
18
- function ce({ className: a, ...l }) {
19
- return /* @__PURE__ */ e(X, { ...l, className: S("alea-field-error", a) });
18
+ function oe({ className: a, ...l }) {
19
+ return /* @__PURE__ */ e(K, { ...l, className: $("alea-field-error", a) });
20
20
  }
21
- const A = (a, l, s, i, d) => ({
22
- ...ie("size", a, "md"),
21
+ const R = (a, l, s, i, d) => ({
22
+ ...re("size", a, "md"),
23
23
  "data-variant": l !== "outline" ? l : void 0,
24
24
  "data-label-position": s !== "top" ? s : void 0,
25
25
  "data-warning": i ? !0 : void 0,
26
- ...te(d)
26
+ ...ce(d)
27
27
  });
28
- function R({ label: a, showOptional: l, isRequired: s }) {
28
+ function q({ label: a, showOptional: l, isRequired: s }) {
29
29
  const i = y();
30
- return a ? /* @__PURE__ */ r(re, { children: [
30
+ return a ? /* @__PURE__ */ r(de, { children: [
31
31
  a,
32
32
  s && /* @__PURE__ */ e("span", { className: "alea-label-required", "aria-hidden": "true", children: " *" }),
33
33
  l && !s && /* @__PURE__ */ r("span", { className: "alea-label-optional", children: [
@@ -37,46 +37,46 @@ function R({ label: a, showOptional: l, isRequired: s }) {
37
37
  ] })
38
38
  ] }) : null;
39
39
  }
40
- function q({ description: a, errorMessage: l, warningMessage: s, count: i }) {
40
+ function E({ description: a, errorMessage: l, warningMessage: s, count: i }) {
41
41
  const d = y(), n = (i == null ? void 0 : i.max) != null ? i.max - i.n : void 0;
42
- return /* @__PURE__ */ r(P, { children: [
43
- (a || s) && /* @__PURE__ */ r(ne, { children: [
42
+ return /* @__PURE__ */ r(j, { children: [
43
+ (a || s) && /* @__PURE__ */ r(ue, { children: [
44
44
  a,
45
45
  s && /* @__PURE__ */ e("span", { className: "alea-field-warning", children: s })
46
46
  ] }),
47
- /* @__PURE__ */ e(ce, { children: l }),
47
+ /* @__PURE__ */ e(oe, { children: l }),
48
48
  i && /* @__PURE__ */ r("span", { className: "alea-field-count", "data-over": n != null && n < 0 ? !0 : void 0, children: [
49
49
  /* @__PURE__ */ e("span", { "aria-hidden": "true", children: i.max != null ? `${i.n} / ${i.max}` : i.n }),
50
50
  /* @__PURE__ */ e("span", { className: "alea-visually-hidden", "aria-live": "polite", children: n != null && n <= 10 ? n < 0 ? d.overLimit(-n) : d.charactersLeft(n) : "" })
51
51
  ] })
52
52
  ] });
53
53
  }
54
- function de({ label: a, description: l, errorMessage: s, warningMessage: i, showOptional: d, size: n, variant: v = "outline", labelPosition: x = "top", placeholder: u, prefix: t, suffix: c, addonStart: m, addonEnd: p, isClearable: o, showCount: h, isLoading: f, className: b, value: w, defaultValue: z, onChange: N, ...F }) {
55
- const E = y(), [T, D] = k(w, z ?? "", N), V = O(null);
56
- return /* @__PURE__ */ r(G, { ...F, value: T, onChange: D, className: $("alea-field", b), ...A(n, v, x, i, f), children: [
57
- /* @__PURE__ */ e(R, { label: a, showOptional: d, isRequired: F.isRequired }),
54
+ function me({ label: a, description: l, errorMessage: s, warningMessage: i, showOptional: d, size: n, variant: v = "outline", labelPosition: x = "top", placeholder: u, prefix: t, suffix: c, addonStart: m, addonEnd: p, isClearable: o, showCount: h, isLoading: f, min: b, max: g, step: z, className: N, value: S, defaultValue: T, onChange: X, ...w }) {
55
+ const H = y(), [C, V] = B(S, T ?? "", X), I = Z(null);
56
+ return /* @__PURE__ */ r(L, { ...w, value: C, onChange: V, className: A("alea-field", N), ...R(n, v, x, i, f), children: [
57
+ /* @__PURE__ */ e(q, { label: a, showOptional: d, isRequired: w.isRequired }),
58
58
  /* @__PURE__ */ r("div", { className: "alea-input-wrap", children: [
59
59
  m && /* @__PURE__ */ e("span", { className: "alea-input-addon", "data-side": "start", children: m }),
60
60
  t && /* @__PURE__ */ e("span", { className: "alea-input-affix", "data-side": "start", children: t }),
61
- /* @__PURE__ */ e(C, { ref: V, className: "alea-input", placeholder: u, "aria-busy": f || void 0 }),
62
- f && /* @__PURE__ */ e(B, {}),
63
- o && T && !F.isDisabled && !F.isReadOnly && /* @__PURE__ */ e(g, { className: "alea-input-clear alea-focus-ring", "aria-label": E.clear, onPress: () => {
64
- var I;
65
- D(""), (I = V.current) == null || I.focus();
66
- }, children: /* @__PURE__ */ e(L, { size: 14 }) }),
61
+ /* @__PURE__ */ e(k, { ref: I, className: "alea-input", placeholder: u, min: b, max: g, step: z, "aria-busy": f || void 0 }),
62
+ f && /* @__PURE__ */ e(D, {}),
63
+ o && C && !w.isDisabled && !w.isReadOnly && /* @__PURE__ */ e(F, { className: "alea-input-clear alea-focus-ring", "aria-label": H.clear, onPress: () => {
64
+ var P;
65
+ V(""), (P = I.current) == null || P.focus();
66
+ }, children: /* @__PURE__ */ e(U, { size: 14 }) }),
67
67
  c && /* @__PURE__ */ e("span", { className: "alea-input-affix", "data-side": "end", children: c }),
68
68
  p && /* @__PURE__ */ e("span", { className: "alea-input-addon", "data-side": "end", children: p })
69
69
  ] }),
70
- /* @__PURE__ */ e(q, { description: l, errorMessage: s, warningMessage: i, count: h ? { n: T.length, max: F.maxLength } : void 0 })
70
+ /* @__PURE__ */ e(E, { description: l, errorMessage: s, warningMessage: i, count: h ? { n: C.length, max: w.maxLength } : void 0 })
71
71
  ] });
72
72
  }
73
- function Fe({ label: a, description: l, errorMessage: s, warningMessage: i, showOptional: d, size: n, variant: v = "outline", labelPosition: x = "top", placeholder: u, rows: t = 4, autoGrow: c, maxRows: m = 12, resize: p = "vertical", showCount: o, isLoading: h, className: f, value: b, defaultValue: w, onChange: z, ...N }) {
74
- const [F, E] = k(b, w ?? "", z);
75
- return /* @__PURE__ */ r(G, { ...N, value: F, onChange: E, className: $("alea-field", f), ...A(n, v, x, i, h), children: [
76
- /* @__PURE__ */ e(R, { label: a, showOptional: d, isRequired: N.isRequired }),
73
+ function ye({ label: a, description: l, errorMessage: s, warningMessage: i, showOptional: d, size: n, variant: v = "outline", labelPosition: x = "top", placeholder: u, rows: t = 4, autoGrow: c, maxRows: m = 12, resize: p = "vertical", showCount: o, isLoading: h, className: f, value: b, defaultValue: g, onChange: z, ...N }) {
74
+ const [S, T] = B(b, g ?? "", z);
75
+ return /* @__PURE__ */ r(L, { ...N, value: S, onChange: T, className: A("alea-field", f), ...R(n, v, x, i, h), children: [
76
+ /* @__PURE__ */ e(q, { label: a, showOptional: d, isRequired: N.isRequired }),
77
77
  /* @__PURE__ */ r("div", { className: "alea-input-wrap alea-textarea-wrap", children: [
78
78
  /* @__PURE__ */ e(
79
- Q,
79
+ _,
80
80
  {
81
81
  className: "alea-input alea-textarea",
82
82
  placeholder: u,
@@ -86,44 +86,44 @@ function Fe({ label: a, description: l, errorMessage: s, warningMessage: i, show
86
86
  style: { resize: c ? "none" : p, ...c ? { fieldSizing: "content", minBlockSize: `calc(${t} * 1.5em + var(--alea-space-6))`, maxBlockSize: `calc(${m} * 1.5em + var(--alea-space-6))` } : {} }
87
87
  }
88
88
  ),
89
- h && /* @__PURE__ */ e(B, {})
89
+ h && /* @__PURE__ */ e(D, {})
90
90
  ] }),
91
- /* @__PURE__ */ e(q, { description: l, errorMessage: s, warningMessage: i, count: o ? { n: F.length, max: N.maxLength } : void 0 })
91
+ /* @__PURE__ */ e(E, { description: l, errorMessage: s, warningMessage: i, count: o ? { n: S.length, max: N.maxLength } : void 0 })
92
92
  ] });
93
93
  }
94
- function ge({ label: a, description: l, errorMessage: s, warningMessage: i, showOptional: d, size: n, variant: v = "outline", labelPosition: x = "top", placeholder: u, isLoading: t, shortcut: c, className: m, onClear: p, ...o }) {
94
+ function Se({ label: a, description: l, errorMessage: s, warningMessage: i, showOptional: d, size: n, variant: v = "outline", labelPosition: x = "top", placeholder: u, isLoading: t, shortcut: c, className: m, onClear: p, ...o }) {
95
95
  const h = y();
96
96
  u ?? (u = h.search);
97
- const f = O(""), [b, w] = j(null);
98
- return /* @__PURE__ */ r(K, { ...o, onClear: () => {
99
- f.current.trim() && w({ id: Date.now(), words: f.current.split(/(\s+)/) }), f.current = "", p == null || p();
100
- }, className: $("alea-field alea-search-field", m), ...A(n, v, x, i, t), children: [
101
- /* @__PURE__ */ e(R, { label: a, showOptional: d, isRequired: o.isRequired }),
97
+ const f = Z(""), [b, g] = O(null);
98
+ return /* @__PURE__ */ r(Y, { ...o, onClear: () => {
99
+ f.current.trim() && g({ id: Date.now(), words: f.current.split(/(\s+)/) }), f.current = "", p == null || p();
100
+ }, className: A("alea-field alea-search-field", m), ...R(n, v, x, i, t), children: [
101
+ /* @__PURE__ */ e(q, { label: a, showOptional: d, isRequired: o.isRequired }),
102
102
  /* @__PURE__ */ r("div", { className: "alea-input-wrap", children: [
103
- /* @__PURE__ */ e("span", { className: "alea-input-affix", "data-side": "start", "aria-hidden": t ? void 0 : !0, children: t ? /* @__PURE__ */ e(se, { size: "sm", "aria-label": h.searching }) : /* @__PURE__ */ e(le, { size: 16 }) }),
104
- /* @__PURE__ */ e(C, { className: "alea-input", placeholder: u, "aria-busy": t || void 0, onInput: (z) => {
103
+ /* @__PURE__ */ e("span", { className: "alea-input-affix", "data-side": "start", "aria-hidden": t ? void 0 : !0, children: t ? /* @__PURE__ */ e(ne, { size: "sm", "aria-label": h.searching }) : /* @__PURE__ */ e(te, { size: 16 }) }),
104
+ /* @__PURE__ */ e(k, { className: "alea-input", placeholder: u, "aria-busy": t || void 0, onInput: (z) => {
105
105
  f.current = z.target.value;
106
106
  } }),
107
107
  b && /* @__PURE__ */ e("span", { className: "alea-input-ghost", "aria-hidden": "true", onAnimationEnd: (z) => {
108
108
  var N;
109
- ((N = z.target.parentElement) == null ? void 0 : N.lastElementChild) === z.target && w(null);
109
+ ((N = z.target.parentElement) == null ? void 0 : N.lastElementChild) === z.target && g(null);
110
110
  }, children: b.words.map((z, N) => /* @__PURE__ */ e("span", { style: { "--alea-i": N }, children: z }, N)) }, b.id),
111
111
  c && /* @__PURE__ */ e("kbd", { className: "alea-input-kbd", "aria-hidden": "true", children: c }),
112
- /* @__PURE__ */ e(g, { className: "alea-input-clear alea-focus-ring", "aria-label": h.clearSearch, children: /* @__PURE__ */ e(L, { size: 14 }) })
112
+ /* @__PURE__ */ e(F, { className: "alea-input-clear alea-focus-ring", "aria-label": h.clearSearch, children: /* @__PURE__ */ e(U, { size: 14 }) })
113
113
  ] }),
114
- /* @__PURE__ */ e(q, { description: l, errorMessage: s, warningMessage: i })
114
+ /* @__PURE__ */ e(E, { description: l, errorMessage: s, warningMessage: i })
115
115
  ] });
116
116
  }
117
- function ue(a) {
117
+ function pe(a) {
118
118
  let l = 0;
119
119
  return a.length >= 8 && l++, a.length >= 12 && l++, /[a-z]/.test(a) && /[A-Z]/.test(a) && l++, /\d/.test(a) && l++, /[^A-Za-z0-9]/.test(a) && l++, l <= 1 ? 0 : l === 2 ? 1 : l === 3 ? 2 : 3;
120
120
  }
121
- function we({ label: a, showStrength: l, strength: s = ue, value: i, defaultValue: d, onChange: n, description: v, ...x }) {
121
+ function $e({ label: a, showStrength: l, strength: s = pe, value: i, defaultValue: d, onChange: n, description: v, ...x }) {
122
122
  const u = y();
123
123
  a ?? (a = u.password);
124
- const [t, c] = j(!1), [m, p] = k(i, d ?? "", n), o = m ? s(m) : -1;
124
+ const [t, c] = O(!1), [m, p] = B(i, d ?? "", n), o = m ? s(m) : -1;
125
125
  return /* @__PURE__ */ e(
126
- de,
126
+ me,
127
127
  {
128
128
  ...x,
129
129
  label: a,
@@ -131,7 +131,7 @@ function we({ label: a, showStrength: l, strength: s = ue, value: i, defaultValu
131
131
  onChange: p,
132
132
  type: t ? "text" : "password",
133
133
  autoComplete: x.autoComplete || "current-password",
134
- description: l && o >= 0 ? /* @__PURE__ */ r(P, { children: [
134
+ description: l && o >= 0 ? /* @__PURE__ */ r(j, { children: [
135
135
  v,
136
136
  /* @__PURE__ */ r("span", { className: "alea-strength", "data-score": o, children: [
137
137
  /* @__PURE__ */ r("span", { className: "alea-strength-bars", "aria-hidden": "true", children: [
@@ -147,41 +147,41 @@ function we({ label: a, showStrength: l, strength: s = ue, value: i, defaultValu
147
147
  ] })
148
148
  ] })
149
149
  ] }) : v,
150
- suffix: /* @__PURE__ */ e(g, { className: "alea-input-clear alea-focus-ring", "aria-label": t ? u.hidePassword : u.showPassword, "aria-pressed": t, onPress: () => c((h) => !h), children: t ? /* @__PURE__ */ e(ee, { size: 16 }) : /* @__PURE__ */ e(ae, { size: 16 }) })
150
+ suffix: /* @__PURE__ */ e(F, { className: "alea-input-clear alea-focus-ring", "aria-label": t ? u.hidePassword : u.showPassword, "aria-pressed": t, onPress: () => c((h) => !h), children: t ? /* @__PURE__ */ e(ie, { size: 16 }) : /* @__PURE__ */ e(se, { size: 16 }) })
151
151
  }
152
152
  );
153
153
  }
154
- function ye({ label: a, description: l, errorMessage: s, warningMessage: i, showOptional: d, size: n, variant: v = "outline", labelPosition: x = "top", placeholder: u, showStepper: t = !0, stepperPosition: c = "sides", prefix: m, suffix: p, isLoading: o, className: h, ...f }) {
154
+ function Ae({ label: a, description: l, errorMessage: s, warningMessage: i, showOptional: d, size: n, variant: v = "outline", labelPosition: x = "top", placeholder: u, showStepper: t = !0, stepperPosition: c = "sides", prefix: m, suffix: p, isLoading: o, className: h, ...f }) {
155
155
  const b = t && c === "sides";
156
- return /* @__PURE__ */ r(J, { ...f, className: $("alea-field", h), ...A(n, v, x, i, o), children: [
157
- /* @__PURE__ */ e(R, { label: a, showOptional: d, isRequired: f.isRequired }),
158
- /* @__PURE__ */ r(Z, { className: "alea-input-wrap alea-number", "data-stepper": t ? c : void 0, children: [
159
- b && /* @__PURE__ */ e(g, { slot: "decrement", className: "alea-stepper alea-focus-ring", children: /* @__PURE__ */ e(W, { size: 14 }) }),
156
+ return /* @__PURE__ */ r(W, { ...f, className: A("alea-field", h), ...R(n, v, x, i, o), children: [
157
+ /* @__PURE__ */ e(q, { label: a, showOptional: d, isRequired: f.isRequired }),
158
+ /* @__PURE__ */ r(G, { className: "alea-input-wrap alea-number", "data-stepper": t ? c : void 0, children: [
159
+ b && /* @__PURE__ */ e(F, { slot: "decrement", className: "alea-stepper alea-focus-ring", children: /* @__PURE__ */ e(M, { size: 14 }) }),
160
160
  m && /* @__PURE__ */ e("span", { className: "alea-input-affix", "data-side": "start", children: m }),
161
- /* @__PURE__ */ e(C, { className: "alea-input", placeholder: u, "aria-busy": o || void 0 }),
162
- o && /* @__PURE__ */ e(B, {}),
161
+ /* @__PURE__ */ e(k, { className: "alea-input", placeholder: u, "aria-busy": o || void 0 }),
162
+ o && /* @__PURE__ */ e(D, {}),
163
163
  p && /* @__PURE__ */ e("span", { className: "alea-input-affix", "data-side": "end", children: p }),
164
- b && /* @__PURE__ */ e(g, { slot: "increment", className: "alea-stepper alea-focus-ring", children: /* @__PURE__ */ e(Y, { size: 14 }) }),
164
+ b && /* @__PURE__ */ e(F, { slot: "increment", className: "alea-stepper alea-focus-ring", children: /* @__PURE__ */ e(ee, { size: 14 }) }),
165
165
  t && c === "end" && /* @__PURE__ */ r("span", { className: "alea-stepper-col", children: [
166
- /* @__PURE__ */ e(g, { slot: "increment", className: "alea-stepper-mini alea-focus-ring", children: /* @__PURE__ */ e(_, { size: 14 }) }),
167
- /* @__PURE__ */ e(g, { slot: "decrement", className: "alea-stepper-mini alea-focus-ring", children: /* @__PURE__ */ e(M, { size: 14 }) })
166
+ /* @__PURE__ */ e(F, { slot: "increment", className: "alea-stepper-mini alea-focus-ring", children: /* @__PURE__ */ e(ae, { size: 14 }) }),
167
+ /* @__PURE__ */ e(F, { slot: "decrement", className: "alea-stepper-mini alea-focus-ring", children: /* @__PURE__ */ e(le, { size: 14 }) })
168
168
  ] })
169
169
  ] }),
170
- /* @__PURE__ */ e(q, { description: l, errorMessage: s, warningMessage: i })
170
+ /* @__PURE__ */ e(E, { description: l, errorMessage: s, warningMessage: i })
171
171
  ] });
172
172
  }
173
- function Se({ children: a, className: l, ...s }) {
174
- return /* @__PURE__ */ e(Z, { ...s, className: S("alea-input-group", l), children: a });
173
+ function Re({ children: a, className: l, ...s }) {
174
+ return /* @__PURE__ */ e(G, { ...s, className: $("alea-input-group", l), children: a });
175
175
  }
176
176
  export {
177
- ne as Description,
178
- ce as FieldError,
179
- Se as InputGroup,
180
- re as Label,
181
- ye as NumberField,
182
- we as PasswordField,
183
- ge as SearchField,
184
- Fe as TextArea,
185
- de as TextField,
186
- ue as passwordScore
177
+ ue as Description,
178
+ oe as FieldError,
179
+ Re as InputGroup,
180
+ de as Label,
181
+ Ae as NumberField,
182
+ $e as PasswordField,
183
+ Se as SearchField,
184
+ ye as TextArea,
185
+ me as TextField,
186
+ pe as passwordScore
187
187
  };
@@ -11,6 +11,10 @@ export interface TimelineItem {
11
11
  dot?: ReactNode;
12
12
  /** Marks the item happening now: its dot pulses. */
13
13
  isActive?: boolean;
14
+ /** Makes the title a link to this address. */
15
+ href?: string;
16
+ /** Makes the title a button that calls this (for opening a record without leaving the page). Ignored when href is set. */
17
+ onPress?: () => void;
14
18
  }
15
19
  export interface TimelineProps {
16
20
  /** The entries: id, title, optional time, dateTime, description, tone, icon. */
@@ -1,55 +1,55 @@
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 C, useId as U, useCallback as X, useEffect as P, forwardRef as F, useMemo as O, useLayoutEffect as _ } from "react";
3
+ import { useRef as H, useState as C, 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
- import { cx as I } from "../../utils/cx.js";
6
- import { IconButton as z, Button as S } from "../button/Button.js";
5
+ import { cx as z } from "../../utils/cx.js";
6
+ import { IconButton as P, Button as S } from "../button/Button.js";
7
7
  import { DialogModal as W, Dialog as j } from "../overlay/Overlay.js";
8
8
  import { useStrings as R } from "../../i18n/strings.js";
9
- import { DotField as re } from "../../utils/DotField.js";
10
- import { inertProps as le } from "../../utils/inert.js";
11
- function ve({ items: f, pending: r, mode: s = "start", reverse: d, size: b, className: x }) {
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
12
  const u = d ? [...f].reverse() : f;
13
- return /* @__PURE__ */ h("ol", { className: I("alea-timeline", x), "data-mode": s !== "start" ? s : void 0, "data-size": b, children: [
14
- u.map((n) => /* @__PURE__ */ h("li", { className: "alea-tl-item", "data-tone": n.tone || "neutral", "data-active": n.isActive || void 0, children: [
15
- /* @__PURE__ */ e("span", { className: "alea-tl-dot", "aria-hidden": "true", children: n.dot }),
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: [
15
+ /* @__PURE__ */ e("span", { className: "alea-tl-dot", "aria-hidden": "true", children: t.dot }),
16
16
  /* @__PURE__ */ h("div", { className: "alea-tl-body", children: [
17
- n.time && (n.dateTime ? /* @__PURE__ */ e("time", { className: "alea-tl-time", dateTime: n.dateTime, children: n.time }) : /* @__PURE__ */ e("span", { className: "alea-tl-time", children: n.time })),
18
- /* @__PURE__ */ e("p", { className: "alea-tl-title", children: n.title }),
19
- n.description && /* @__PURE__ */ e("div", { className: "alea-tl-desc", children: n.description })
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 })),
18
+ 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 }),
19
+ t.description && /* @__PURE__ */ e("div", { className: "alea-tl-desc", children: t.description })
20
20
  ] })
21
- ] }, n.id)),
21
+ ] }, t.id)),
22
22
  r && /* @__PURE__ */ h("li", { className: "alea-tl-item", "data-pending": !0, children: [
23
23
  /* @__PURE__ */ e("span", { className: "alea-tl-dot", "aria-hidden": "true" }),
24
24
  /* @__PURE__ */ e("div", { className: "alea-tl-body", children: /* @__PURE__ */ e("p", { className: "alea-tl-title alea-tl-pending", children: r }) })
25
25
  ] })
26
26
  ] });
27
27
  }
28
- function pe({ children: f, "aria-label": r, autoplay: s, perView: d = 1, showDots: b = !0, className: x }) {
29
- const u = R(), n = H(null), [i, v] = C(0), [g, p] = C(!!s), [y, o] = C(!1), N = f.length, m = Math.max(1, Math.ceil(N - d + 1)), l = U(), t = X((c) => {
30
- var L;
31
- const a = n.current;
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, v] = C(0), [g, p] = C(!!s), [y, o] = C(!1), N = f.length, m = Math.max(1, Math.ceil(N - d + 1)), n = U(), l = X((c) => {
30
+ var E;
31
+ const a = t.current;
32
32
  if (!a) return;
33
- const w = (c + m) % m, k = a.children[w], $ = getComputedStyle(a).direction === "rtl", M = k ? a.scrollLeft + ($ ? k.getBoundingClientRect().right - a.getBoundingClientRect().right : k.getBoundingClientRect().left - a.getBoundingClientRect().left) : 0, E = ((L = window.matchMedia) == null ? void 0 : L.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: E ? "auto" : "smooth" }) : a.scrollLeft = M, v(w);
33
+ const w = (c + m) % m, x = a.children[w], I = getComputedStyle(a).direction === "rtl", M = x ? a.scrollLeft + (I ? x.getBoundingClientRect().right - a.getBoundingClientRect().right : x.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, v(w);
35
35
  }, [m]);
36
- return P(() => {
37
- const c = n.current;
36
+ return L(() => {
37
+ const c = t.current;
38
38
  if (!c) return;
39
39
  const a = () => {
40
40
  const w = c.clientWidth / d;
41
41
  v(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
- }, [d, m]), P(() => {
44
+ }, [d, m]), L(() => {
45
45
  var a;
46
46
  if (!s || !g || y || typeof window < "u" && ((a = window.matchMedia) != null && a.call(window, "(prefers-reduced-motion: reduce)").matches)) return;
47
- const c = setInterval(() => t(i + 1), s);
47
+ const c = setInterval(() => l(i + 1), s);
48
48
  return () => clearInterval(c);
49
- }, [s, g, y, i, t]), /* @__PURE__ */ h(
49
+ }, [s, g, y, i, l]), /* @__PURE__ */ h(
50
50
  "section",
51
51
  {
52
- className: I("alea-carousel", x),
52
+ className: z("alea-carousel", k),
53
53
  "aria-roledescription": "carousel",
54
54
  "aria-label": r,
55
55
  onMouseEnter: () => o(!0),
@@ -58,40 +58,40 @@ 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(z, { size: "sm", "aria-label": g ? u.stopSlides : u.playSlides, onPress: () => p((c) => !c), children: g ? /* @__PURE__ */ e(G, {}) : /* @__PURE__ */ e(J, {}) }),
62
- /* @__PURE__ */ e(z, { size: "sm", "aria-label": u.previousSlide, "aria-controls": `${l}-track`, onPress: () => t(i - 1), children: /* @__PURE__ */ e(K, {}) }),
63
- /* @__PURE__ */ e(z, { size: "sm", "aria-label": u.nextSlide, "aria-controls": `${l}-track`, onPress: () => t(i + 1), children: /* @__PURE__ */ e(Y, {}) })
61
+ s && /* @__PURE__ */ e(P, { size: "sm", "aria-label": g ? u.stopSlides : u.playSlides, onPress: () => p((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, {}) })
64
64
  ] }),
65
- /* @__PURE__ */ e("div", { ref: n, id: `${l}-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, ...le(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: () => t(a) }, a)) })
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
67
  ]
68
68
  }
69
69
  );
70
70
  }
71
- function be({ src: f, alt: r, width: s, height: d, preview: b = !0, fallback: x, fit: u = "cover", radius: n = "md", srcSet: i, sizes: v, ratio: g, priority: p, placeholder: y, loadingEffect: o = "shimmer", isLoading: N, className: m }) {
72
- const l = R(), [t, c] = C("loading"), [a, w] = C(!1), [k, $] = C(1), M = o === "matrix", E = !!N || t === "loading", L = N ? "loading" : t, Q = f ? /* @__PURE__ */ e("img", { src: f, srcSet: i, sizes: v, alt: r, loading: p ? "eager" : "lazy", decoding: p ? "sync" : "async", fetchPriority: p ? "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: I("alea-image", m), "data-state": L, "data-effect": M ? "matrix" : void 0, "aria-busy": E || void 0, "data-radius": n, "data-placeholder": T ? !0 : void 0, style: { width: s, height: d, aspectRatio: g ? String(g) : void 0, ...t === "loading" && T ? T : {} }, children: [
73
- M && t !== "error" && /* @__PURE__ */ e(re, {}),
74
- M && /* @__PURE__ */ e("span", { role: "status", className: "alea-visually-hidden", children: E ? l.loading : "" }),
75
- t === "error" ? x ?? /* @__PURE__ */ h("span", { className: "alea-image-fallback", children: [
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: v, ratio: g, priority: p, placeholder: y, loadingEffect: o = "shimmer", isLoading: N, className: m }) {
72
+ const n = R(), [l, c] = C("loading"), [a, w] = C(!1), [x, I] = C(1), M = o === "matrix", $ = !!N || l === "loading", E = N ? "loading" : l, Q = f ? /* @__PURE__ */ e("img", { src: f, srcSet: i, sizes: v, alt: r, loading: p ? "eager" : "lazy", decoding: p ? "sync" : "async", fetchPriority: p ? "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, {}),
74
+ 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
76
  /* @__PURE__ */ e(V, { size: 22, "aria-hidden": "true" }),
77
- /* @__PURE__ */ e("span", { children: l.imageFailed(r || "") })
77
+ /* @__PURE__ */ e("span", { children: n.imageFailed(r || "") })
78
78
  ] }) : Q
79
79
  ] });
80
- return !b || t === "error" || N || !f ? A : /* @__PURE__ */ h(B, { children: [
80
+ return !b || l === "error" || N || !f ? A : /* @__PURE__ */ h(B, { children: [
81
81
  /* @__PURE__ */ e("button", { type: "button", className: "alea-image-button alea-focus-ring", onClick: () => {
82
- $(1), w(!0);
83
- }, "aria-label": l.viewLarger(r || l.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 || l.imagePreview, hideClose: !0, className: "alea-image-dialog", children: ({ close: Z }) => /* @__PURE__ */ h(B, { children: [
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
85
  /* @__PURE__ */ h("div", { className: "alea-image-tools", children: [
86
- /* @__PURE__ */ e(z, { "aria-label": l.zoomOut, variant: "secondary", isDisabled: k <= 0.5, onPress: () => $((q) => Math.max(0.5, q - 0.25)), children: /* @__PURE__ */ e(ee, {}) }),
86
+ /* @__PURE__ */ e(P, { "aria-label": n.zoomOut, variant: "secondary", isDisabled: x <= 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(k * 100),
88
+ Math.round(x * 100),
89
89
  "%"
90
90
  ] }),
91
- /* @__PURE__ */ e(z, { "aria-label": l.zoomIn, variant: "secondary", isDisabled: k >= 3, onPress: () => $((q) => Math.min(3, q + 0.25)), children: /* @__PURE__ */ e(ae, {}) }),
92
- /* @__PURE__ */ e(z, { "aria-label": l.close, variant: "secondary", onPress: Z, children: /* @__PURE__ */ e(te, {}) })
91
+ /* @__PURE__ */ e(P, { "aria-label": n.zoomIn, variant: "secondary", isDisabled: x >= 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
93
  ] }),
94
- /* @__PURE__ */ e("div", { className: "alea-image-stage", children: /* @__PURE__ */ e("img", { src: f, alt: r, style: { transform: `scale(${k})` } }) })
94
+ /* @__PURE__ */ e("div", { className: "alea-image-stage", children: /* @__PURE__ */ e("img", { src: f, alt: r, style: { transform: `scale(${x})` } }) })
95
95
  ] }) }) })
96
96
  ] });
97
97
  }
@@ -102,77 +102,77 @@ 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: x, color: u = "#111011", background: n = "#ffffff", className: i, style: v, ...g }, p) {
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: v, ...g }, p) {
106
106
  const y = R(), [o, N] = C(D ? { qrcode: D } : null);
107
- P(() => {
107
+ L(() => {
108
108
  if (o) return;
109
- let l = !0;
110
- return se().then((t) => {
111
- l && N({ qrcode: t });
109
+ let n = !0;
110
+ return se().then((l) => {
111
+ n && N({ qrcode: l });
112
112
  }, () => {
113
113
  }), () => {
114
- l = !1;
114
+ n = !1;
115
115
  };
116
116
  }, [o]);
117
117
  const m = O(() => {
118
118
  if (!o) return null;
119
- const l = o.qrcode(0, d);
120
- l.addData(r), l.make();
121
- const t = l.getModuleCount();
119
+ const n = o.qrcode(0, d);
120
+ n.addData(r), n.make();
121
+ const l = n.getModuleCount();
122
122
  let c = "";
123
- for (let a = 0; a < t; a++) for (let w = 0; w < t; w++) l.isDark(a, w) && (c += `M${w + 4} ${a + 4}h1v1h-1z`);
124
- return { d: c, n: t + 8 };
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
125
  }, [o, r, d]);
126
- return /* @__PURE__ */ h("span", { ref: p, ...g, className: I("alea-qr", i), style: { width: s, height: s, ...v }, role: "img", "aria-label": x ?? g["aria-label"] ?? y.qrCode(r), children: [
126
+ return /* @__PURE__ */ h("span", { ref: p, ...g, className: z("alea-qr", i), style: { width: s, height: s, ...v }, 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
- /* @__PURE__ */ e("rect", { width: m.n, height: m.n, fill: n, rx: m.n * 0.06 }),
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 })
130
130
  ] }),
131
- b && m && /* @__PURE__ */ e("span", { className: "alea-qr-logo", "aria-hidden": "true", style: { background: n }, children: b })
131
+ b && m && /* @__PURE__ */ e("span", { className: "alea-qr-logo", "aria-hidden": "true", style: { background: t }, children: b })
132
132
  ] });
133
133
  });
134
- function ye({ children: f, text: r, rotate: s = -22, gap: d = 120, opacity: b = 0.08, className: x }) {
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 n = d + r.length * 7.5, i = d, v = `<svg xmlns="http://www.w3.org/2000/svg" width="${n}" 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} ${n / 2} ${i / 2})">${r.replace(/[<&>"]/g, (g) => ({ "<": "&lt;", "&": "&amp;", ">": "&gt;", '"': "&quot;" })[g])}</text></svg>`;
136
+ const t = d + r.length * 7.5, i = d, v = `<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
137
  return `url("data:image/svg+xml,${encodeURIComponent(v)}")`;
138
138
  }, [r, s, d]);
139
- return /* @__PURE__ */ h("div", { className: I("alea-watermark", x), children: [
139
+ return /* @__PURE__ */ h("div", { className: z("alea-watermark", k), children: [
140
140
  f,
141
141
  /* @__PURE__ */ e("span", { className: "alea-watermark-layer", "aria-hidden": "true", style: { WebkitMaskImage: u, maskImage: u, opacity: b } })
142
142
  ] });
143
143
  }
144
- const we = F(function({ steps: r, isOpen: s, onOpenChange: d, onFinish: b, className: x, style: u }, n) {
144
+ const we = F(function({ steps: r, isOpen: s, onOpenChange: d, onFinish: b, className: k, style: u }, t) {
145
145
  const i = R(), [v, g] = C(0), [p, y] = C(null), o = r[v];
146
- if (P(() => {
146
+ if (L(() => {
147
147
  s && g(0);
148
148
  }, [s]), _(() => {
149
149
  if (!s || !o) return;
150
- const l = typeof o.target == "string" ? document.querySelector(o.target) : o.target || null;
151
- if (!l) {
150
+ const n = typeof o.target == "string" ? document.querySelector(o.target) : o.target || null;
151
+ if (!n) {
152
152
  y(null);
153
153
  return;
154
154
  }
155
- l.scrollIntoView({ block: "center", behavior: "smooth" });
156
- const t = () => y(l.getBoundingClientRect());
157
- t();
158
- const c = setTimeout(t, 350);
159
- return window.addEventListener("resize", t), window.addEventListener("scroll", t, !0), () => {
160
- clearTimeout(c), window.removeEventListener("resize", t), window.removeEventListener("scroll", t, !0);
155
+ n.scrollIntoView({ block: "center", behavior: "smooth" });
156
+ const l = () => y(n.getBoundingClientRect());
157
+ l();
158
+ const c = setTimeout(l, 350);
159
+ return window.addEventListener("resize", l), window.addEventListener("scroll", l, !0), () => {
160
+ clearTimeout(c), window.removeEventListener("resize", l), window.removeEventListener("scroll", l, !0);
161
161
  };
162
162
  }, [s, v, o]), !o) return null;
163
163
  const N = 8, m = p ? { top: Math.min(window.innerHeight - 220, p.bottom + N + 12), left: Math.max(16, Math.min(window.innerWidth - 336, p.left)) } : { top: "50%", left: "50%", transform: "translate(-50%, -50%)" };
164
- return /* @__PURE__ */ e(W, { isOpen: s, onOpenChange: d, isDismissable: !1, className: "alea-tour-overlay", children: /* @__PURE__ */ e(j, { ref: n, style: u, "aria-label": typeof o.title == "string" ? o.title : i.stepN(v + 1), hideClose: !0, className: I("alea-tour", x), children: ({ close: l }) => /* @__PURE__ */ h(B, { children: [
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(v + 1), hideClose: !0, className: z("alea-tour", k), children: ({ close: n }) => /* @__PURE__ */ h(B, { children: [
165
165
  p && /* @__PURE__ */ e("span", { className: "alea-tour-spot", "aria-hidden": "true", style: { top: p.top - N, left: p.left - N, width: p.width + N * 2, height: p.height + N * 2 } }),
166
166
  /* @__PURE__ */ h("div", { className: "alea-tour-card", style: m, children: [
167
167
  /* @__PURE__ */ e("p", { className: "alea-tour-count", children: i.stepNOfTotal(v + 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
- /* @__PURE__ */ e(S, { size: "sm", variant: "ghost", onPress: l, children: i.skip }),
171
+ /* @__PURE__ */ e(S, { size: "sm", variant: "ghost", onPress: n, children: i.skip }),
172
172
  /* @__PURE__ */ e("span", { className: "alea-tour-spacer" }),
173
- v > 0 && /* @__PURE__ */ e(S, { size: "sm", variant: "ghost", onPress: () => g((t) => t - 1), children: i.back }),
173
+ v > 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
- v < r.length - 1 ? g((t) => t + 1) : (b == null || b(), l());
175
+ v < r.length - 1 ? g((l) => l + 1) : (b == null || b(), n());
176
176
  }, children: v < r.length - 1 ? i.next : i.done })
177
177
  ] })
178
178
  ] })
@@ -193,7 +193,7 @@
193
193
  ]
194
194
  },
195
195
  "media": {
196
- "bytes": 9737,
196
+ "bytes": 10052,
197
197
  "requires": [
198
198
  "base",
199
199
  "button",