@alea-design/ui 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/button/Button.d.ts +13 -2
- package/dist/components/button/Button.js +126 -104
- package/dist/components/celebrate/Celebrate.d.ts +31 -0
- package/dist/components/celebrate/Celebrate.js +50 -0
- package/dist/components/display/Display.d.ts +7 -2
- package/dist/components/display/Display.js +64 -63
- package/dist/components/feedback/Feedback.js +23 -23
- package/dist/components/field/Field.d.ts +15 -2
- package/dist/components/field/Field.js +165 -134
- package/dist/components/more/More.d.ts +3 -1
- package/dist/components/more/More.js +53 -53
- package/dist/components/notification/NotificationCenter.js +15 -15
- package/dist/components/picker/Picker.d.ts +5 -1
- package/dist/components/picker/Picker.js +212 -209
- package/dist/components/print/PrintSheet.d.ts +18 -0
- package/dist/components/print/PrintSheet.js +14 -0
- package/dist/components/shell/AccountFooter.d.ts +31 -0
- package/dist/components/shell/AccountFooter.js +43 -0
- package/dist/components/shell/AppShell.js +18 -18
- package/dist/components/shell/AppSidebar.js +31 -31
- package/dist/components/shell/sidebar-context.d.ts +5 -0
- package/dist/components/shell/sidebar-context.js +6 -0
- package/dist/css/base.css +1 -1
- package/dist/css/button.css +1 -1
- package/dist/css/celebrate.css +1 -0
- package/dist/css/choice.css +1 -1
- package/dist/css/data.css +1 -1
- package/dist/css/display.css +1 -1
- package/dist/css/feedback.css +1 -1
- package/dist/css/field.css +1 -1
- package/dist/css/groups.json +31 -11
- package/dist/css/menu.css +1 -1
- package/dist/css/more.css +1 -1
- package/dist/css/picker.css +1 -1
- package/dist/css/print.css +1 -0
- package/dist/css/shell.css +1 -1
- package/dist/i18n/strings.d.ts +17 -0
- package/dist/i18n/strings.js +41 -7
- package/dist/index.d.ts +4 -0
- package/dist/index.js +276 -267
- package/dist/styles.css +1 -1
- package/dist/utils/announcer.d.ts +21 -0
- package/dist/utils/announcer.js +30 -0
- package/package.json +3 -3
|
@@ -14,9 +14,9 @@ import { DotField as J } from "../../utils/DotField.js";
|
|
|
14
14
|
import { SkeletonBlueprint as K } from "../../utils/Blueprint.js";
|
|
15
15
|
import { inertProps as Q } from "../../utils/inert.js";
|
|
16
16
|
import { renamed as Y } from "../../utils/vocabulary.js";
|
|
17
|
-
function ga({ label: e, showValue: r, size:
|
|
17
|
+
function ga({ label: e, showValue: r, size: m = "md", tone: f, striped: l, valuePosition: n = "top", description: h, className: c, ...i }) {
|
|
18
18
|
const o = r ?? (!!e || n === "end");
|
|
19
|
-
return /* @__PURE__ */ a($, { ...i, className: C("alea-progress", c), "data-size":
|
|
19
|
+
return /* @__PURE__ */ a($, { ...i, className: C("alea-progress", c), "data-size": m, "data-tone": f, "data-striped": l || void 0, "data-value-position": n !== "top" ? n : void 0, children: ({ percentage: g, valueText: u, isIndeterminate: v }) => /* @__PURE__ */ y(M, { children: [
|
|
20
20
|
(e || o && n === "top") && /* @__PURE__ */ y("div", { className: "alea-progress-head", children: [
|
|
21
21
|
e && /* @__PURE__ */ a(E, { className: "alea-label", children: e }),
|
|
22
22
|
o && n === "top" && !v && /* @__PURE__ */ a("span", { className: "alea-progress-value", children: u })
|
|
@@ -28,8 +28,8 @@ function ga({ label: e, showValue: r, size: p = "md", tone: f, striped: l, value
|
|
|
28
28
|
h && /* @__PURE__ */ a("span", { className: "alea-description", children: h })
|
|
29
29
|
] }) });
|
|
30
30
|
}
|
|
31
|
-
function va({ size: e = "md", showValue: r, tone:
|
|
32
|
-
return /* @__PURE__ */ a($, { ...h, className: C("alea-progress-circle", n), "data-size": e, "data-tone":
|
|
31
|
+
function va({ size: e = "md", showValue: r, tone: m, thickness: f = 5, children: l, className: n, ...h }) {
|
|
32
|
+
return /* @__PURE__ */ a($, { ...h, className: C("alea-progress-circle", n), "data-size": e, "data-tone": m, children: ({ percentage: c = 0, valueText: i, isIndeterminate: o }) => {
|
|
33
33
|
const g = 24 - f / 2 - 1, u = 2 * Math.PI * g;
|
|
34
34
|
return /* @__PURE__ */ y(M, { children: [
|
|
35
35
|
/* @__PURE__ */ y("svg", { viewBox: "0 0 48 48", "aria-hidden": "true", "data-indeterminate": o || void 0, children: [
|
|
@@ -40,9 +40,9 @@ function va({ size: e = "md", showValue: r, tone: p, thickness: f = 5, children:
|
|
|
40
40
|
] });
|
|
41
41
|
} });
|
|
42
42
|
}
|
|
43
|
-
function Na({ label: e, showValue: r = !0, tone:
|
|
43
|
+
function Na({ label: e, showValue: r = !0, tone: m = "accent", className: f, ...l }) {
|
|
44
44
|
return /* @__PURE__ */ a(O, { ...l, className: C("alea-progress alea-meter", f), children: ({ percentage: n, valueText: h }) => {
|
|
45
|
-
const c =
|
|
45
|
+
const c = m === "auto" ? n > 90 ? "danger" : n > 70 ? "warning" : "success" : m;
|
|
46
46
|
return /* @__PURE__ */ y(M, { children: [
|
|
47
47
|
(e || r) && /* @__PURE__ */ y("div", { className: "alea-progress-head", children: [
|
|
48
48
|
e && /* @__PURE__ */ a(E, { className: "alea-label", children: e }),
|
|
@@ -52,9 +52,9 @@ function Na({ label: e, showValue: r = !0, tone: p = "accent", className: f, ...
|
|
|
52
52
|
] });
|
|
53
53
|
} });
|
|
54
54
|
}
|
|
55
|
-
function xa({ shape: e = "text", width: r, height:
|
|
55
|
+
function xa({ shape: e = "text", width: r, height: m, lines: f = 1, isLoaded: l, animation: n, rows: h, cols: c, children: i, className: o, style: g, ...u }) {
|
|
56
56
|
const v = T();
|
|
57
|
-
if (n === "blueprint") return /* @__PURE__ */ a(K, { ...u, shape: e, width: r, height:
|
|
57
|
+
if (n === "blueprint") return /* @__PURE__ */ a(K, { ...u, shape: e, width: r, height: m, rows: h, isLoaded: l, className: o, style: g, children: i });
|
|
58
58
|
if (n === "matrix") {
|
|
59
59
|
const N = i != null && i !== !1, { "aria-label": x, ...b } = u, t = h != null || c != null;
|
|
60
60
|
return /* @__PURE__ */ y(
|
|
@@ -67,7 +67,7 @@ function xa({ shape: e = "text", width: r, height: p, lines: f = 1, isLoaded: l,
|
|
|
67
67
|
"data-content": N || void 0,
|
|
68
68
|
"data-sized": t || void 0,
|
|
69
69
|
"aria-busy": !l,
|
|
70
|
-
style: { width: r, ...N ? { minHeight:
|
|
70
|
+
style: { width: r, ...N ? { minHeight: m } : { height: m ?? (e === "circle" ? r : void 0) }, ...c != null ? { "--alea-dots-cols": c } : null, ...h != null ? { "--alea-dots-rows": h } : null, ...g },
|
|
71
71
|
children: [
|
|
72
72
|
/* @__PURE__ */ a(J, { rows: h, cols: c }),
|
|
73
73
|
N && /* @__PURE__ */ a("span", { className: "alea-skeleton-matrix-content", ...Q(!l), children: i }),
|
|
@@ -76,39 +76,39 @@ function xa({ shape: e = "text", width: r, height: p, lines: f = 1, isLoaded: l,
|
|
|
76
76
|
}
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
|
-
return l ? /* @__PURE__ */ a("span", { className: "alea-skeleton-reveal", children: i }) : e === "text" && f > 1 ? /* @__PURE__ */ a("span", { className: w("alea-skeleton-lines", o), "aria-hidden": "true", children: Array.from({ length: f }, (N, x) => /* @__PURE__ */ a("span", { className: "alea-skeleton", "data-shape": "text", "data-animation": n, style: { width: x === f - 1 ? "60%" : r } }, x)) }) : /* @__PURE__ */ a("span", { ...u, "aria-hidden": "true", className: w("alea-skeleton", o), "data-shape": e, "data-animation": n, style: { width: r, height:
|
|
79
|
+
return l ? /* @__PURE__ */ a("span", { className: "alea-skeleton-reveal", children: i }) : e === "text" && f > 1 ? /* @__PURE__ */ a("span", { className: w("alea-skeleton-lines", o), "aria-hidden": "true", children: Array.from({ length: f }, (N, x) => /* @__PURE__ */ a("span", { className: "alea-skeleton", "data-shape": "text", "data-animation": n, style: { width: x === f - 1 ? "60%" : r } }, x)) }) : /* @__PURE__ */ a("span", { ...u, "aria-hidden": "true", className: w("alea-skeleton", o), "data-shape": e, "data-animation": n, style: { width: r, height: m ?? (e === "circle" ? r : void 0), ...g } });
|
|
80
80
|
}
|
|
81
|
-
const L = { neutral: A, accent: A, info: A, success: H, warning: W, danger: V }, ya = D(function({ tone: r = "info", title:
|
|
81
|
+
const L = { neutral: A, accent: A, info: A, success: H, warning: W, danger: V }, ya = D(function({ tone: r = "info", title: m, children: f, actions: l, onDismiss: n, live: h, hideIcon: c, icon: i, appearance: o, variant: g, size: u, className: v, ...N }, x) {
|
|
82
82
|
const b = T(), t = Y("Alert", "variant", g, "appearance", o) ?? "soft", s = L[r];
|
|
83
83
|
return /* @__PURE__ */ y("div", { ref: x, ...N, className: w("alea-alert", v), "data-tone": r, "data-variant": t !== "soft" ? t : void 0, "data-size": u, role: h ? r === "danger" ? "alert" : "status" : N.role, children: [
|
|
84
84
|
!c && (i ? /* @__PURE__ */ a("span", { className: "alea-alert-icon", "aria-hidden": "true", ...z(r, t === "solid"), children: i }) : /* @__PURE__ */ a(s, { className: "alea-alert-icon", size: u === "sm" ? 16 : 20, "aria-hidden": "true", ...z(r, t === "solid") })),
|
|
85
85
|
/* @__PURE__ */ y("div", { className: "alea-alert-body", children: [
|
|
86
|
-
|
|
86
|
+
m && /* @__PURE__ */ a("p", { className: "alea-alert-title", children: m }),
|
|
87
87
|
f && /* @__PURE__ */ a("div", { className: "alea-alert-text", children: f })
|
|
88
88
|
] }),
|
|
89
89
|
l && /* @__PURE__ */ a("div", { className: "alea-alert-actions", children: l }),
|
|
90
90
|
n && /* @__PURE__ */ a(X, { "aria-label": b.dismiss, size: "sm", variant: "ghost", onPress: n, className: "alea-alert-x", children: /* @__PURE__ */ a(I, {}) })
|
|
91
91
|
] });
|
|
92
92
|
}), Z = 600, _ = R(null);
|
|
93
|
-
function ba({ children: e, placement: r = "bottom-end", motion:
|
|
93
|
+
function ba({ children: e, placement: r = "bottom-end", motion: m, stacked: f, offset: l, surface: n, radius: h }) {
|
|
94
94
|
const c = T(), [i, o] = S([]), g = B(1), u = k((t) => o((s) => s.filter((d) => d.id !== t)), []), v = k((t) => {
|
|
95
95
|
o((s) => s.map((d) => d.id === t ? { ...d, exiting: !0 } : d)), setTimeout(() => u(t), Z);
|
|
96
96
|
}, [u]), N = k((t) => {
|
|
97
97
|
const s = g.current++;
|
|
98
98
|
return o((d) => [...d.slice(-4), { ...t, id: s }]), s;
|
|
99
|
-
}, []), x = k((t, s) => o((d) => d.map((
|
|
99
|
+
}, []), x = k((t, s) => o((d) => d.map((p) => p.id === t ? { ...p, ...s, version: (p.version ?? 0) + 1 } : p)), []), b = k((t, s) => {
|
|
100
100
|
const d = N({ title: s.loading, isLoading: !0, tone: "neutral" });
|
|
101
101
|
return t.then(
|
|
102
|
-
(
|
|
103
|
-
(
|
|
102
|
+
(p) => x(d, { title: typeof s.success == "function" ? s.success(p) : s.success, tone: "success", isLoading: !1 }),
|
|
103
|
+
(p) => x(d, { title: typeof s.error == "function" ? s.error(p) : s.error, tone: "danger", isLoading: !1 })
|
|
104
104
|
), t;
|
|
105
105
|
}, [N, x]);
|
|
106
106
|
return /* @__PURE__ */ y(_.Provider, { value: { show: N, close: v, update: x, promise: b }, children: [
|
|
107
107
|
e,
|
|
108
|
-
/* @__PURE__ */ a("section", { className: "alea-toast-region", hidden: i.length === 0, "data-placement": r, "data-stacked": f || void 0, style: l === void 0 ? void 0 : { "--alea-toast-offset": typeof l == "number" ? `${l / 16}rem` : l }, "aria-label": c.notifications, tabIndex: -1, children: /* @__PURE__ */ a("div", { className: "alea-toast-list", children: i.map((t) => /* @__PURE__ */ a(aa, { item: t, motion:
|
|
108
|
+
/* @__PURE__ */ a("section", { className: "alea-toast-region", "data-react-aria-top-layer": "true", hidden: i.length === 0, "data-placement": r, "data-stacked": f || void 0, style: l === void 0 ? void 0 : { "--alea-toast-offset": typeof l == "number" ? `${l / 16}rem` : l }, "aria-label": c.notifications, tabIndex: -1, children: /* @__PURE__ */ a("div", { className: "alea-toast-list", children: i.map((t) => /* @__PURE__ */ a(aa, { item: t, motion: m, surface: n, radius: h, onClose: () => v(t.id), onExited: () => u(t.id) }, t.id)) }) })
|
|
109
109
|
] });
|
|
110
110
|
}
|
|
111
|
-
function aa({ item: e, onClose: r, onExited:
|
|
111
|
+
function aa({ item: e, onClose: r, onExited: m, motion: f, surface: l, radius: n }) {
|
|
112
112
|
const h = T(), c = e.tone || "neutral", i = e.isLoading ? 0 : e.timeout ?? (c === "danger" ? 0 : 5e3), [o, g] = S(!1);
|
|
113
113
|
j(() => {
|
|
114
114
|
if (!i || o) return;
|
|
@@ -123,13 +123,13 @@ function aa({ item: e, onClose: r, onExited: p, motion: f, surface: l, radius: n
|
|
|
123
123
|
if (!s || s.id !== t.pointerId) return;
|
|
124
124
|
const d = t.clientX - s.x;
|
|
125
125
|
if (Math.abs(d) < 4) return;
|
|
126
|
-
const
|
|
127
|
-
|
|
126
|
+
const p = t.currentTarget;
|
|
127
|
+
p.setAttribute("data-swiping", ""), (P = p.setPointerCapture) == null || P.call(p, t.pointerId), p.style.setProperty("--alea-swipe-x", `${d}px`), p.style.setProperty("--alea-swipe-n", String(d / 160));
|
|
128
128
|
}, b = (t) => {
|
|
129
129
|
const s = v.current;
|
|
130
130
|
if (v.current = null, !s) return;
|
|
131
|
-
const d = t.currentTarget,
|
|
132
|
-
d.removeAttribute("data-swiping"), Math.abs(
|
|
131
|
+
const d = t.currentTarget, p = t.clientX - s.x, P = Math.abs(p) / Math.max(1, performance.now() - s.t) > 0.6;
|
|
132
|
+
d.removeAttribute("data-swiping"), Math.abs(p) > 80 || P && Math.abs(p) > 24 ? r() : (d.style.removeProperty("--alea-swipe-x"), d.style.removeProperty("--alea-swipe-n"));
|
|
133
133
|
};
|
|
134
134
|
return /* @__PURE__ */ y(
|
|
135
135
|
"div",
|
|
@@ -144,7 +144,7 @@ function aa({ item: e, onClose: r, onExited: p, motion: f, surface: l, radius: n
|
|
|
144
144
|
"aria-busy": e.isLoading || void 0,
|
|
145
145
|
style: { ...G(f), "--alea-toast-ms": `${i}ms` },
|
|
146
146
|
onAnimationEnd: (t) => {
|
|
147
|
-
e.exiting && t.target === t.currentTarget &&
|
|
147
|
+
e.exiting && t.target === t.currentTarget && m();
|
|
148
148
|
},
|
|
149
149
|
onPointerDown: N,
|
|
150
150
|
onPointerMove: x,
|
|
@@ -95,7 +95,20 @@ export interface SearchFieldProps extends Omit<RACSearchFieldProps, 'children'>,
|
|
|
95
95
|
}
|
|
96
96
|
/** A search box with a clear button; Escape clears it too. */
|
|
97
97
|
export declare function SearchField({ label, description, errorMessage, warningMessage, showOptional, size, variant, labelPosition, placeholder, isLoading, shortcut, className, onClear, ...props }: SearchFieldProps): import("react").JSX.Element;
|
|
98
|
+
/** One rule of a password policy shown under a PasswordField. */
|
|
99
|
+
export interface PasswordRequirement {
|
|
100
|
+
/** A stable name for the rule. */
|
|
101
|
+
id: string;
|
|
102
|
+
/** What the rule asks for ("At least 12 characters"). */
|
|
103
|
+
label: ReactNode;
|
|
104
|
+
/** Checks the rule against what is typed. */
|
|
105
|
+
test?: (value: string) => boolean;
|
|
106
|
+
/** Your own answer, for a rule the field cannot check by itself (one that needs the server, or the account email). It wins over `test`. */
|
|
107
|
+
met?: boolean;
|
|
108
|
+
}
|
|
98
109
|
export interface PasswordFieldProps extends Omit<TextFieldProps, 'type' | 'suffix' | 'isClearable'> {
|
|
110
|
+
/** The rules of your password policy, listed under the field with a mark for each one that is met (the mark is an icon and a hidden word, never only a color). Screen readers hear what changed after a short pause in typing, not every keystroke. */
|
|
111
|
+
requirements?: PasswordRequirement[];
|
|
99
112
|
/** Shows a four step strength meter under the field (length, case, digits and symbols). */
|
|
100
113
|
showStrength?: boolean;
|
|
101
114
|
/** Your own score from 0 (weak) to 3 (strong), from your own password checker. */
|
|
@@ -103,8 +116,8 @@ export interface PasswordFieldProps extends Omit<TextFieldProps, 'type' | 'suffi
|
|
|
103
116
|
}
|
|
104
117
|
/** A rough strength score: length, mixed case, digits and symbols. */
|
|
105
118
|
export declare function passwordScore(v: string): 0 | 1 | 2 | 3;
|
|
106
|
-
/** A password input with a show/hide button and an optional
|
|
107
|
-
export declare function PasswordField({ label, showStrength, strength, value, defaultValue, onChange, description, ...props }: PasswordFieldProps): import("react").JSX.Element;
|
|
119
|
+
/** A password input with a show/hide button, an optional strength meter and an optional list of the rules it has to meet. */
|
|
120
|
+
export declare function PasswordField({ label, showStrength, strength, requirements, value, defaultValue, onChange, description, ...props }: PasswordFieldProps): import("react").JSX.Element;
|
|
108
121
|
export interface NumberFieldProps extends Omit<RACNumberFieldProps, 'children'>, FieldBits {
|
|
109
122
|
/** Placeholder text. */
|
|
110
123
|
placeholder?: string;
|
|
@@ -1,187 +1,218 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as e, jsxs as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { Text as
|
|
5
|
-
import { Minus as
|
|
6
|
-
import { cx as
|
|
7
|
-
import { useStrings as
|
|
8
|
-
import { useControlled as
|
|
9
|
-
import { responsiveAttrs as
|
|
10
|
-
import { Spinner as
|
|
11
|
-
import { FieldSpinner as
|
|
12
|
-
function
|
|
13
|
-
return /* @__PURE__ */ e(
|
|
2
|
+
import { jsx as e, jsxs as d, Fragment as B } from "react/jsx-runtime";
|
|
3
|
+
import { useState as j, useRef as R, useEffect as X } from "react";
|
|
4
|
+
import { Text as H, FieldError as J, Group as U, Label as K, NumberField as Q, Button as F, Input as D, SearchField as W, TextField as Z, TextArea as Y } from "react-aria-components";
|
|
5
|
+
import { Minus as ee, Plus as ae, ChevronUp as le, ChevronDown as te, EyeOff as ie, Eye as ne, Search as se, X as _, Check as re, Circle as ce } from "lucide-react";
|
|
6
|
+
import { cx as S, withBase as w } from "../../utils/cx.js";
|
|
7
|
+
import { useStrings as y } from "../../i18n/strings.js";
|
|
8
|
+
import { useControlled as V } from "../../utils/controlled.js";
|
|
9
|
+
import { responsiveAttrs as de } from "../../utils/responsive.js";
|
|
10
|
+
import { Spinner as oe } from "../feedback/Spinner.js";
|
|
11
|
+
import { FieldSpinner as I, loadingAttrs as ue } from "./FieldLoading.js";
|
|
12
|
+
function me({ className: a, ...t }) {
|
|
13
|
+
return /* @__PURE__ */ e(K, { ...t, className: S("alea-label", a) });
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
return /* @__PURE__ */ e(
|
|
15
|
+
function pe({ className: a, ...t }) {
|
|
16
|
+
return /* @__PURE__ */ e(H, { ...t, slot: "description", className: S("alea-description", a) });
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return /* @__PURE__ */ e(
|
|
18
|
+
function he({ className: a, ...t }) {
|
|
19
|
+
return /* @__PURE__ */ e(J, { ...t, className: S("alea-field-error", a) });
|
|
20
20
|
}
|
|
21
|
-
const
|
|
22
|
-
...
|
|
23
|
-
"data-variant":
|
|
24
|
-
"data-label-position":
|
|
25
|
-
"data-warning":
|
|
26
|
-
...
|
|
21
|
+
const A = (a, t, n, l, c) => ({
|
|
22
|
+
...de("size", a, "md"),
|
|
23
|
+
"data-variant": t !== "outline" ? t : void 0,
|
|
24
|
+
"data-label-position": n !== "top" ? n : void 0,
|
|
25
|
+
"data-warning": l ? !0 : void 0,
|
|
26
|
+
...ue(c)
|
|
27
27
|
});
|
|
28
|
-
function
|
|
29
|
-
const
|
|
30
|
-
return a ? /* @__PURE__ */
|
|
28
|
+
function C({ label: a, showOptional: t, isRequired: n }) {
|
|
29
|
+
const l = y();
|
|
30
|
+
return a ? /* @__PURE__ */ d(me, { children: [
|
|
31
31
|
a,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
n && /* @__PURE__ */ e("span", { className: "alea-label-required", "aria-hidden": "true", children: " *" }),
|
|
33
|
+
t && !n && /* @__PURE__ */ d("span", { className: "alea-label-optional", children: [
|
|
34
34
|
" (",
|
|
35
|
-
|
|
35
|
+
l.optional,
|
|
36
36
|
")"
|
|
37
37
|
] })
|
|
38
38
|
] }) : null;
|
|
39
39
|
}
|
|
40
|
-
function E({ description: a, errorMessage:
|
|
41
|
-
const
|
|
42
|
-
return /* @__PURE__ */
|
|
43
|
-
(a ||
|
|
40
|
+
function E({ description: a, errorMessage: t, warningMessage: n, count: l }) {
|
|
41
|
+
const c = y(), o = (l == null ? void 0 : l.max) != null ? l.max - l.n : void 0;
|
|
42
|
+
return /* @__PURE__ */ d(B, { children: [
|
|
43
|
+
(a || n) && /* @__PURE__ */ d(pe, { children: [
|
|
44
44
|
a,
|
|
45
|
-
|
|
45
|
+
n && /* @__PURE__ */ e("span", { className: "alea-field-warning", children: n })
|
|
46
46
|
] }),
|
|
47
|
-
/* @__PURE__ */ e(
|
|
48
|
-
|
|
49
|
-
/* @__PURE__ */ e("span", { "aria-hidden": "true", children:
|
|
50
|
-
/* @__PURE__ */ e("span", { className: "alea-visually-hidden", "aria-live": "polite", children:
|
|
47
|
+
/* @__PURE__ */ e(he, { children: t }),
|
|
48
|
+
l && /* @__PURE__ */ d("span", { className: "alea-field-count", "data-over": o != null && o < 0 ? !0 : void 0, children: [
|
|
49
|
+
/* @__PURE__ */ e("span", { "aria-hidden": "true", children: l.max != null ? `${l.n} / ${l.max}` : l.n }),
|
|
50
|
+
/* @__PURE__ */ e("span", { className: "alea-visually-hidden", "aria-live": "polite", children: o != null && o <= 10 ? o < 0 ? c.overLimit(-o) : c.charactersLeft(o) : "" })
|
|
51
51
|
] })
|
|
52
52
|
] });
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
const
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */ e(
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/* @__PURE__ */ e(
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
function fe({ label: a, description: t, errorMessage: n, warningMessage: l, showOptional: c, size: o, variant: f = "outline", labelPosition: v = "top", placeholder: N, prefix: i, suffix: s, addonStart: p, addonEnd: h, isClearable: m, showCount: r, isLoading: u, min: x, max: z, step: g, className: b, value: q, defaultValue: T, onChange: G, ...$ }) {
|
|
55
|
+
const L = y(), [k, M] = V(q, T ?? "", G), O = R(null);
|
|
56
|
+
return /* @__PURE__ */ d(Z, { ...$, value: k, onChange: M, className: w("alea-field", b), ...A(o, f, v, l, u), children: [
|
|
57
|
+
/* @__PURE__ */ e(C, { label: a, showOptional: c, isRequired: $.isRequired }),
|
|
58
|
+
/* @__PURE__ */ d("div", { className: "alea-input-wrap", children: [
|
|
59
|
+
p && /* @__PURE__ */ e("span", { className: "alea-input-addon", "data-side": "start", children: p }),
|
|
60
|
+
i && /* @__PURE__ */ e("span", { className: "alea-input-affix", "data-side": "start", children: i }),
|
|
61
|
+
/* @__PURE__ */ e(D, { ref: O, className: "alea-input", placeholder: N, min: x, max: z, step: g, "aria-busy": u || void 0 }),
|
|
62
|
+
u && /* @__PURE__ */ e(I, {}),
|
|
63
|
+
m && k && !$.isDisabled && !$.isReadOnly && /* @__PURE__ */ e(F, { className: "alea-input-clear alea-focus-ring", "aria-label": L.clear, onPress: () => {
|
|
64
64
|
var P;
|
|
65
|
-
|
|
66
|
-
}, children: /* @__PURE__ */ e(
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
M(""), (P = O.current) == null || P.focus();
|
|
66
|
+
}, children: /* @__PURE__ */ e(_, { size: 14 }) }),
|
|
67
|
+
s && /* @__PURE__ */ e("span", { className: "alea-input-affix", "data-side": "end", children: s }),
|
|
68
|
+
h && /* @__PURE__ */ e("span", { className: "alea-input-addon", "data-side": "end", children: h })
|
|
69
69
|
] }),
|
|
70
|
-
/* @__PURE__ */ e(E, { description:
|
|
70
|
+
/* @__PURE__ */ e(E, { description: t, errorMessage: n, warningMessage: l, count: r ? { n: k.length, max: $.maxLength } : void 0 })
|
|
71
71
|
] });
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
const [
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
-
/* @__PURE__ */ e(
|
|
77
|
-
/* @__PURE__ */
|
|
73
|
+
function Ae({ label: a, description: t, errorMessage: n, warningMessage: l, showOptional: c, size: o, variant: f = "outline", labelPosition: v = "top", placeholder: N, rows: i = 4, autoGrow: s, maxRows: p = 12, resize: h = "vertical", showCount: m, isLoading: r, className: u, value: x, defaultValue: z, onChange: g, ...b }) {
|
|
74
|
+
const [q, T] = V(x, z ?? "", g);
|
|
75
|
+
return /* @__PURE__ */ d(Z, { ...b, value: q, onChange: T, className: w("alea-field", u), ...A(o, f, v, l, r), children: [
|
|
76
|
+
/* @__PURE__ */ e(C, { label: a, showOptional: c, isRequired: b.isRequired }),
|
|
77
|
+
/* @__PURE__ */ d("div", { className: "alea-input-wrap alea-textarea-wrap", children: [
|
|
78
78
|
/* @__PURE__ */ e(
|
|
79
|
-
|
|
79
|
+
Y,
|
|
80
80
|
{
|
|
81
81
|
className: "alea-input alea-textarea",
|
|
82
|
-
placeholder:
|
|
83
|
-
rows:
|
|
84
|
-
"aria-busy":
|
|
85
|
-
"data-autogrow":
|
|
86
|
-
style: { resize:
|
|
82
|
+
placeholder: N,
|
|
83
|
+
rows: i,
|
|
84
|
+
"aria-busy": r || void 0,
|
|
85
|
+
"data-autogrow": s || void 0,
|
|
86
|
+
style: { resize: s ? "none" : h, ...s ? { fieldSizing: "content", minBlockSize: `calc(${i} * 1.5em + var(--alea-space-6))`, maxBlockSize: `calc(${p} * 1.5em + var(--alea-space-6))` } : {} }
|
|
87
87
|
}
|
|
88
88
|
),
|
|
89
|
-
|
|
89
|
+
r && /* @__PURE__ */ e(I, {})
|
|
90
90
|
] }),
|
|
91
|
-
/* @__PURE__ */ e(E, { description:
|
|
91
|
+
/* @__PURE__ */ e(E, { description: t, errorMessage: n, warningMessage: l, count: m ? { n: q.length, max: b.maxLength } : void 0 })
|
|
92
92
|
] });
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
return /* @__PURE__ */
|
|
99
|
-
|
|
100
|
-
}, className:
|
|
101
|
-
/* @__PURE__ */ e(
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
/* @__PURE__ */ e("span", { className: "alea-input-affix", "data-side": "start", "aria-hidden":
|
|
104
|
-
/* @__PURE__ */ e(
|
|
105
|
-
|
|
94
|
+
function Ce({ label: a, description: t, errorMessage: n, warningMessage: l, showOptional: c, size: o, variant: f = "outline", labelPosition: v = "top", placeholder: N, isLoading: i, shortcut: s, className: p, onClear: h, ...m }) {
|
|
95
|
+
const r = y();
|
|
96
|
+
N ?? (N = r.search);
|
|
97
|
+
const u = R(""), [x, z] = j(null);
|
|
98
|
+
return /* @__PURE__ */ d(W, { ...m, onClear: () => {
|
|
99
|
+
u.current.trim() && z({ id: Date.now(), words: u.current.split(/(\s+)/) }), u.current = "", h == null || h();
|
|
100
|
+
}, className: w("alea-field alea-search-field", p), ...A(o, f, v, l, i), children: [
|
|
101
|
+
/* @__PURE__ */ e(C, { label: a, showOptional: c, isRequired: m.isRequired }),
|
|
102
|
+
/* @__PURE__ */ d("div", { className: "alea-input-wrap", children: [
|
|
103
|
+
/* @__PURE__ */ e("span", { className: "alea-input-affix", "data-side": "start", "aria-hidden": i ? void 0 : !0, children: i ? /* @__PURE__ */ e(oe, { size: "sm", "aria-label": r.searching }) : /* @__PURE__ */ e(se, { size: 16 }) }),
|
|
104
|
+
/* @__PURE__ */ e(D, { className: "alea-input", placeholder: N, "aria-busy": i || void 0, onInput: (g) => {
|
|
105
|
+
u.current = g.target.value;
|
|
106
106
|
} }),
|
|
107
|
-
|
|
108
|
-
var
|
|
109
|
-
((
|
|
110
|
-
}, children:
|
|
111
|
-
|
|
112
|
-
/* @__PURE__ */ e(
|
|
107
|
+
x && /* @__PURE__ */ e("span", { className: "alea-input-ghost", "aria-hidden": "true", onAnimationEnd: (g) => {
|
|
108
|
+
var b;
|
|
109
|
+
((b = g.target.parentElement) == null ? void 0 : b.lastElementChild) === g.target && z(null);
|
|
110
|
+
}, children: x.words.map((g, b) => /* @__PURE__ */ e("span", { style: { "--alea-i": b }, children: g }, b)) }, x.id),
|
|
111
|
+
s && /* @__PURE__ */ e("kbd", { className: "alea-input-kbd", "aria-hidden": "true", children: s }),
|
|
112
|
+
/* @__PURE__ */ e(F, { className: "alea-input-clear alea-focus-ring", "aria-label": r.clearSearch, children: /* @__PURE__ */ e(_, { size: 14 }) })
|
|
113
113
|
] }),
|
|
114
|
-
/* @__PURE__ */ e(E, { description:
|
|
114
|
+
/* @__PURE__ */ e(E, { description: t, errorMessage: n, warningMessage: l })
|
|
115
115
|
] });
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
let
|
|
119
|
-
return a.length >= 8 &&
|
|
117
|
+
function Ne(a) {
|
|
118
|
+
let t = 0;
|
|
119
|
+
return a.length >= 8 && t++, a.length >= 12 && t++, /[a-z]/.test(a) && /[A-Z]/.test(a) && t++, /\d/.test(a) && t++, /[^A-Za-z0-9]/.test(a) && t++, t <= 1 ? 0 : t === 2 ? 1 : t === 3 ? 2 : 3;
|
|
120
120
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
const ve = 800;
|
|
122
|
+
function xe({ items: a, value: t }) {
|
|
123
|
+
const n = y(), l = a.map((i) => {
|
|
124
|
+
var s;
|
|
125
|
+
return i.met ?? ((s = i.test) == null ? void 0 : s.call(i, t)) ?? !1;
|
|
126
|
+
}), c = l.map(Number).join(""), o = R(null), f = R(c), [v, N] = j("");
|
|
127
|
+
return X(() => {
|
|
128
|
+
if (c === f.current) return;
|
|
129
|
+
const i = setTimeout(() => {
|
|
130
|
+
const s = f.current;
|
|
131
|
+
f.current = c;
|
|
132
|
+
const p = a.flatMap((m, r) => c[r] !== s[r] ? [r] : []), h = (m) => {
|
|
133
|
+
var r, u;
|
|
134
|
+
return ((u = (r = o.current) == null ? void 0 : r.querySelector(`[data-req="${m}"] .alea-requirement-text`)) == null ? void 0 : u.textContent) ?? "";
|
|
135
|
+
};
|
|
136
|
+
N(p.length <= 2 ? p.map((m) => `${h(m)}: ${c[m] === "1" ? n.requirementMet : n.requirementNotMet}`).join(". ") : n.requirementsMetCount(l.filter(Boolean).length, a.length));
|
|
137
|
+
}, ve);
|
|
138
|
+
return () => clearTimeout(i);
|
|
139
|
+
}, [c]), /* @__PURE__ */ d(B, { children: [
|
|
140
|
+
/* @__PURE__ */ e("span", { ref: o, className: "alea-requirements", role: "list", "aria-label": n.passwordRequirements, children: a.map((i, s) => /* @__PURE__ */ d("span", { role: "listitem", className: "alea-requirement", "data-req": s, "data-met": l[s] || void 0, children: [
|
|
141
|
+
l[s] ? /* @__PURE__ */ e(re, { size: 16, "aria-hidden": "true" }) : /* @__PURE__ */ e(ce, { size: 16, "aria-hidden": "true" }),
|
|
142
|
+
/* @__PURE__ */ e("span", { className: "alea-requirement-text", children: i.label }),
|
|
143
|
+
/* @__PURE__ */ d("span", { className: "alea-visually-hidden", children: [
|
|
144
|
+
": ",
|
|
145
|
+
l[s] ? n.requirementMet : n.requirementNotMet
|
|
146
|
+
] })
|
|
147
|
+
] }, i.id)) }),
|
|
148
|
+
/* @__PURE__ */ e("span", { className: "alea-visually-hidden", role: "status", "aria-live": "polite", children: v })
|
|
149
|
+
] });
|
|
150
|
+
}
|
|
151
|
+
function Ee({ label: a, showStrength: t, strength: n = Ne, requirements: l, value: c, defaultValue: o, onChange: f, description: v, ...N }) {
|
|
152
|
+
const i = y(), s = a !== void 0;
|
|
153
|
+
a ?? (a = i.password);
|
|
154
|
+
const [p, h] = j(!1), [m, r] = V(c, o ?? "", f), u = m ? n(m) : -1;
|
|
125
155
|
return /* @__PURE__ */ e(
|
|
126
|
-
|
|
156
|
+
fe,
|
|
127
157
|
{
|
|
128
|
-
...
|
|
158
|
+
...N,
|
|
129
159
|
label: a,
|
|
130
|
-
value:
|
|
131
|
-
onChange:
|
|
132
|
-
type:
|
|
133
|
-
autoComplete:
|
|
134
|
-
description:
|
|
135
|
-
|
|
136
|
-
/* @__PURE__ */
|
|
137
|
-
/* @__PURE__ */
|
|
160
|
+
value: m,
|
|
161
|
+
onChange: r,
|
|
162
|
+
type: p ? "text" : "password",
|
|
163
|
+
autoComplete: N.autoComplete || "current-password",
|
|
164
|
+
description: t && u >= 0 || l != null && l.length ? /* @__PURE__ */ d(B, { children: [
|
|
165
|
+
v,
|
|
166
|
+
t && u >= 0 && /* @__PURE__ */ d("span", { className: "alea-strength", "data-score": u, children: [
|
|
167
|
+
/* @__PURE__ */ d("span", { className: "alea-strength-bars", "aria-hidden": "true", children: [
|
|
138
168
|
/* @__PURE__ */ e("i", {}),
|
|
139
169
|
/* @__PURE__ */ e("i", {}),
|
|
140
170
|
/* @__PURE__ */ e("i", {}),
|
|
141
171
|
/* @__PURE__ */ e("i", {})
|
|
142
172
|
] }),
|
|
143
|
-
/* @__PURE__ */
|
|
144
|
-
|
|
173
|
+
/* @__PURE__ */ d("span", { "aria-live": "polite", children: [
|
|
174
|
+
i.passwordStrength,
|
|
145
175
|
": ",
|
|
146
|
-
|
|
176
|
+
i.strengthLevels[u]
|
|
147
177
|
] })
|
|
148
|
-
] })
|
|
149
|
-
|
|
150
|
-
|
|
178
|
+
] }),
|
|
179
|
+
l != null && l.length ? /* @__PURE__ */ e(xe, { items: l, value: m }) : null
|
|
180
|
+
] }) : v,
|
|
181
|
+
suffix: /* @__PURE__ */ e(F, { className: "alea-input-clear alea-focus-ring", "aria-label": (p ? i.hidePassword : i.showPassword) + (s && typeof a == "string" ? ` (${a})` : ""), "aria-pressed": p, onPress: () => h((x) => !x), children: p ? /* @__PURE__ */ e(ie, { size: 16 }) : /* @__PURE__ */ e(ne, { size: 16 }) })
|
|
151
182
|
}
|
|
152
183
|
);
|
|
153
184
|
}
|
|
154
|
-
function
|
|
155
|
-
const
|
|
156
|
-
return /* @__PURE__ */
|
|
157
|
-
/* @__PURE__ */ e(
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
/* @__PURE__ */ e(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
/* @__PURE__ */ e(
|
|
167
|
-
/* @__PURE__ */ e(
|
|
185
|
+
function Te({ label: a, description: t, errorMessage: n, warningMessage: l, showOptional: c, size: o, variant: f = "outline", labelPosition: v = "top", placeholder: N, showStepper: i = !0, stepperPosition: s = "sides", prefix: p, suffix: h, align: m, isLoading: r, className: u, ...x }) {
|
|
186
|
+
const z = i && s === "sides";
|
|
187
|
+
return /* @__PURE__ */ d(Q, { ...x, className: w("alea-field", u), ...A(o, f, v, l, r), children: [
|
|
188
|
+
/* @__PURE__ */ e(C, { label: a, showOptional: c, isRequired: x.isRequired }),
|
|
189
|
+
/* @__PURE__ */ d(U, { className: "alea-input-wrap alea-number", "data-stepper": i ? s : void 0, "data-align": m, children: [
|
|
190
|
+
z && /* @__PURE__ */ e(F, { slot: "decrement", className: "alea-stepper alea-focus-ring", children: /* @__PURE__ */ e(ee, { size: 14 }) }),
|
|
191
|
+
p && /* @__PURE__ */ e("span", { className: "alea-input-affix", "data-side": "start", children: p }),
|
|
192
|
+
/* @__PURE__ */ e(D, { className: "alea-input", placeholder: N, "aria-busy": r || void 0 }),
|
|
193
|
+
r && /* @__PURE__ */ e(I, {}),
|
|
194
|
+
h && /* @__PURE__ */ e("span", { className: "alea-input-affix", "data-side": "end", children: h }),
|
|
195
|
+
z && /* @__PURE__ */ e(F, { slot: "increment", className: "alea-stepper alea-focus-ring", children: /* @__PURE__ */ e(ae, { size: 14 }) }),
|
|
196
|
+
i && s === "end" && /* @__PURE__ */ d("span", { className: "alea-stepper-col", children: [
|
|
197
|
+
/* @__PURE__ */ e(F, { slot: "increment", className: "alea-stepper-mini alea-focus-ring", children: /* @__PURE__ */ e(le, { size: 14 }) }),
|
|
198
|
+
/* @__PURE__ */ e(F, { slot: "decrement", className: "alea-stepper-mini alea-focus-ring", children: /* @__PURE__ */ e(te, { size: 14 }) })
|
|
168
199
|
] })
|
|
169
200
|
] }),
|
|
170
|
-
/* @__PURE__ */ e(E, { description:
|
|
201
|
+
/* @__PURE__ */ e(E, { description: t, errorMessage: n, warningMessage: l })
|
|
171
202
|
] });
|
|
172
203
|
}
|
|
173
|
-
function
|
|
174
|
-
return /* @__PURE__ */ e(
|
|
204
|
+
function ke({ children: a, className: t, ...n }) {
|
|
205
|
+
return /* @__PURE__ */ e(U, { ...n, className: S("alea-input-group", t), children: a });
|
|
175
206
|
}
|
|
176
207
|
export {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
208
|
+
pe as Description,
|
|
209
|
+
he as FieldError,
|
|
210
|
+
ke as InputGroup,
|
|
211
|
+
me as Label,
|
|
212
|
+
Te as NumberField,
|
|
213
|
+
Ee as PasswordField,
|
|
214
|
+
Ce as SearchField,
|
|
215
|
+
Ae as TextArea,
|
|
216
|
+
fe as TextField,
|
|
217
|
+
Ne as passwordScore
|
|
187
218
|
};
|
|
@@ -172,7 +172,9 @@ export interface BannerProps {
|
|
|
172
172
|
onDismiss?: () => void;
|
|
173
173
|
/** Name of the region. Default "Announcement"; give each banner its own when there are several. */
|
|
174
174
|
'aria-label'?: string;
|
|
175
|
+
/** region (default, a landmark that is not announced), status (announced politely when it appears or changes: a note about something that just happened) or alert (announced at once: only for what needs action now). */
|
|
176
|
+
role?: 'region' | 'status' | 'alert';
|
|
175
177
|
className?: string;
|
|
176
178
|
}
|
|
177
179
|
/** A site-wide announcement bar above the header: launches, sales, outages. */
|
|
178
|
-
export declare function Banner({ children, tone, size, action, onDismiss, className, 'aria-label': label }: BannerProps): import("react").JSX.Element | null;
|
|
180
|
+
export declare function Banner({ children, tone, size, action, onDismiss, className, 'aria-label': label, role }: BannerProps): import("react").JSX.Element | null;
|