@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.
- package/dist/components/field/Field.d.ts +7 -1
- package/dist/components/field/Field.js +82 -82
- package/dist/components/media/Media.d.ts +4 -0
- package/dist/components/media/Media.js +76 -76
- package/dist/css/groups.json +1 -1
- package/dist/css/media.css +1 -1
- package/dist/i18n/strings.d.ts +2 -0
- package/dist/i18n/strings.js +4 -0
- package/dist/styles.css +1 -1
- package/package.json +3 -3
|
@@ -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
|
|
3
|
-
import { useState as
|
|
4
|
-
import { Text as
|
|
5
|
-
import { Minus as
|
|
6
|
-
import { cx as
|
|
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
|
|
9
|
-
import { responsiveAttrs as
|
|
10
|
-
import { Spinner as
|
|
11
|
-
import { FieldSpinner as
|
|
12
|
-
function
|
|
13
|
-
return /* @__PURE__ */ e(
|
|
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
|
|
16
|
-
return /* @__PURE__ */ e(
|
|
15
|
+
function ue({ className: a, ...l }) {
|
|
16
|
+
return /* @__PURE__ */ e(J, { ...l, slot: "description", className: $("alea-description", a) });
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return /* @__PURE__ */ e(
|
|
18
|
+
function oe({ className: a, ...l }) {
|
|
19
|
+
return /* @__PURE__ */ e(K, { ...l, className: $("alea-field-error", a) });
|
|
20
20
|
}
|
|
21
|
-
const
|
|
22
|
-
...
|
|
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
|
-
...
|
|
26
|
+
...ce(d)
|
|
27
27
|
});
|
|
28
|
-
function
|
|
28
|
+
function q({ label: a, showOptional: l, isRequired: s }) {
|
|
29
29
|
const i = y();
|
|
30
|
-
return a ? /* @__PURE__ */ r(
|
|
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
|
|
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(
|
|
43
|
-
(a || s) && /* @__PURE__ */ r(
|
|
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(
|
|
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
|
|
55
|
-
const
|
|
56
|
-
return /* @__PURE__ */ r(
|
|
57
|
-
/* @__PURE__ */ e(
|
|
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(
|
|
62
|
-
f && /* @__PURE__ */ e(
|
|
63
|
-
o &&
|
|
64
|
-
var
|
|
65
|
-
|
|
66
|
-
}, children: /* @__PURE__ */ e(
|
|
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(
|
|
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
|
|
74
|
-
const [
|
|
75
|
-
return /* @__PURE__ */ r(
|
|
76
|
-
/* @__PURE__ */ e(
|
|
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
|
-
|
|
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(
|
|
89
|
+
h && /* @__PURE__ */ e(D, {})
|
|
90
90
|
] }),
|
|
91
|
-
/* @__PURE__ */ e(
|
|
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
|
|
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 =
|
|
98
|
-
return /* @__PURE__ */ r(
|
|
99
|
-
f.current.trim() &&
|
|
100
|
-
}, className:
|
|
101
|
-
/* @__PURE__ */ e(
|
|
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(
|
|
104
|
-
/* @__PURE__ */ e(
|
|
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 &&
|
|
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(
|
|
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(
|
|
114
|
+
/* @__PURE__ */ e(E, { description: l, errorMessage: s, warningMessage: i })
|
|
115
115
|
] });
|
|
116
116
|
}
|
|
117
|
-
function
|
|
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
|
|
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] =
|
|
124
|
+
const [t, c] = O(!1), [m, p] = B(i, d ?? "", n), o = m ? s(m) : -1;
|
|
125
125
|
return /* @__PURE__ */ e(
|
|
126
|
-
|
|
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(
|
|
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(
|
|
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
|
|
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(
|
|
157
|
-
/* @__PURE__ */ e(
|
|
158
|
-
/* @__PURE__ */ r(
|
|
159
|
-
b && /* @__PURE__ */ e(
|
|
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(
|
|
162
|
-
o && /* @__PURE__ */ e(
|
|
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(
|
|
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(
|
|
167
|
-
/* @__PURE__ */ e(
|
|
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(
|
|
170
|
+
/* @__PURE__ */ e(E, { description: l, errorMessage: s, warningMessage: i })
|
|
171
171
|
] });
|
|
172
172
|
}
|
|
173
|
-
function
|
|
174
|
-
return /* @__PURE__ */ e(
|
|
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
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
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
|
|
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
|
|
6
|
-
import { IconButton as
|
|
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
|
|
10
|
-
import { inertProps as
|
|
11
|
-
function ve({ items: f, pending: r, mode: s = "start", reverse: d, size: b, className:
|
|
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:
|
|
14
|
-
u.map((
|
|
15
|
-
/* @__PURE__ */ e("span", { className: "alea-tl-dot", "aria-hidden": "true", children:
|
|
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
|
-
|
|
18
|
-
/* @__PURE__ */ e("p", { className: "alea-tl-title", children:
|
|
19
|
-
|
|
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
|
-
] },
|
|
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:
|
|
29
|
-
const u = R(),
|
|
30
|
-
var
|
|
31
|
-
const a =
|
|
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,
|
|
34
|
-
typeof a.scrollTo == "function" ? a.scrollTo({ left: M, behavior:
|
|
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
|
|
37
|
-
const c =
|
|
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]),
|
|
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(() =>
|
|
47
|
+
const c = setInterval(() => l(i + 1), s);
|
|
48
48
|
return () => clearInterval(c);
|
|
49
|
-
}, [s, g, y, i,
|
|
49
|
+
}, [s, g, y, i, l]), /* @__PURE__ */ h(
|
|
50
50
|
"section",
|
|
51
51
|
{
|
|
52
|
-
className:
|
|
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(
|
|
62
|
-
/* @__PURE__ */ e(
|
|
63
|
-
/* @__PURE__ */ e(
|
|
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:
|
|
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: () =>
|
|
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:
|
|
72
|
-
const
|
|
73
|
-
M &&
|
|
74
|
-
M && /* @__PURE__ */ e("span", { role: "status", className: "alea-visually-hidden", children:
|
|
75
|
-
|
|
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:
|
|
77
|
+
/* @__PURE__ */ e("span", { children: n.imageFailed(r || "") })
|
|
78
78
|
] }) : Q
|
|
79
79
|
] });
|
|
80
|
-
return !b ||
|
|
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
|
-
|
|
83
|
-
}, "aria-label":
|
|
84
|
-
/* @__PURE__ */ e(W, { isOpen: a, onOpenChange: w, size: "full", className: "alea-image-overlay", children: /* @__PURE__ */ e(j, { "aria-label": r ||
|
|
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(
|
|
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(
|
|
88
|
+
Math.round(x * 100),
|
|
89
89
|
"%"
|
|
90
90
|
] }),
|
|
91
|
-
/* @__PURE__ */ e(
|
|
92
|
-
/* @__PURE__ */ e(
|
|
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(${
|
|
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:
|
|
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
|
-
|
|
107
|
+
L(() => {
|
|
108
108
|
if (o) return;
|
|
109
|
-
let
|
|
110
|
-
return se().then((
|
|
111
|
-
|
|
109
|
+
let n = !0;
|
|
110
|
+
return se().then((l) => {
|
|
111
|
+
n && N({ qrcode: l });
|
|
112
112
|
}, () => {
|
|
113
113
|
}), () => {
|
|
114
|
-
|
|
114
|
+
n = !1;
|
|
115
115
|
};
|
|
116
116
|
}, [o]);
|
|
117
117
|
const m = O(() => {
|
|
118
118
|
if (!o) return null;
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
const
|
|
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 <
|
|
124
|
-
return { d: c, n:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
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) => ({ "<": "<", "&": "&", ">": ">", '"': """ })[g])}</text></svg>`;
|
|
137
137
|
return `url("data:image/svg+xml,${encodeURIComponent(v)}")`;
|
|
138
138
|
}, [r, s, d]);
|
|
139
|
-
return /* @__PURE__ */ h("div", { className:
|
|
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:
|
|
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 (
|
|
146
|
+
if (L(() => {
|
|
147
147
|
s && g(0);
|
|
148
148
|
}, [s]), _(() => {
|
|
149
149
|
if (!s || !o) return;
|
|
150
|
-
const
|
|
151
|
-
if (!
|
|
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
|
-
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
const c = setTimeout(
|
|
159
|
-
return window.addEventListener("resize",
|
|
160
|
-
clearTimeout(c), window.removeEventListener("resize",
|
|
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:
|
|
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:
|
|
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((
|
|
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((
|
|
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
|
] })
|