@alea-design/ui 0.10.10 → 0.10.11
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/combobox/ComboBox.d.ts +3 -1
- package/dist/components/combobox/ComboBox.js +68 -65
- package/dist/components/more/More.d.ts +5 -1
- package/dist/components/more/More.js +108 -105
- package/dist/components/overlay/Overlay.d.ts +6 -0
- package/dist/components/overlay/Overlay.js +79 -64
- package/dist/components/select/Select.d.ts +3 -1
- package/dist/components/select/Select.js +104 -103
- package/dist/components/select/recent.d.ts +9 -0
- package/dist/components/select/recent.js +17 -0
- package/dist/css/groups.json +4 -3
- package/dist/css/more.css +1 -1
- package/dist/css/overlay.css +1 -1
- package/dist/css/select.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
|
@@ -40,13 +40,15 @@ export interface ComboBoxProps<T extends object = SelectOption> extends Omit<RAC
|
|
|
40
40
|
isLoading?: boolean;
|
|
41
41
|
/** Content under the list inside the popover, like "Create “…”". */
|
|
42
42
|
footer?: ReactNode;
|
|
43
|
+
/** Ids of the options used last (at most 5), shown first under a "Recent" heading, then the rest without repeating them. Typing filters both. Needs the options as items or defaultItems; it is not used together with virtualized. */
|
|
44
|
+
recent?: Array<string | number>;
|
|
43
45
|
/** Renders only the visible options: pass the row height (40). */
|
|
44
46
|
virtualized?: number;
|
|
45
47
|
/** How the popup enters and leaves: a preset (fade, scale, pop, slide-down, blur...), false for none, or options. */
|
|
46
48
|
motion?: MotionProp;
|
|
47
49
|
}
|
|
48
50
|
/** Type to filter a list and pick one. Pass defaultItems to filter as people type, or items to filter yourself (async search). allowsCustomValue keeps free text. */
|
|
49
|
-
export declare function ComboBox<T extends object = SelectOption>({ motion, label, description, errorMessage, warningMessage, showOptional, placeholder, children, emptyText, size, variant, labelPosition, prefix, isClearable, highlightMatch, matchStyle, isLoading, footer, virtualized, className, ...props }: ComboBoxProps<T>): import("react").JSX.Element;
|
|
51
|
+
export declare function ComboBox<T extends object = SelectOption>({ motion, label, description, errorMessage, warningMessage, showOptional, placeholder, children, emptyText, size, variant, labelPosition, prefix, isClearable, highlightMatch, matchStyle, isLoading, footer, virtualized, className, recent, ...props }: ComboBoxProps<T>): import("react").JSX.Element;
|
|
50
52
|
export interface TagFieldProps {
|
|
51
53
|
/** The visible label. */
|
|
52
54
|
label?: ReactNode;
|
|
@@ -1,112 +1,115 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as u, jsx as t } from "react/jsx-runtime";
|
|
3
3
|
import { useState as q, useMemo as K, useContext as R } from "react";
|
|
4
|
-
import { useFilter as T, ComboBox as P, Input as
|
|
5
|
-
import { ChevronDown as
|
|
4
|
+
import { useFilter as T, ComboBox as P, Input as z, Button as G, Virtualizer as A, ListLayout as E, ComboBoxStateContext as L, ListBox as X } from "react-aria-components";
|
|
5
|
+
import { ChevronDown as $, X as j } from "lucide-react";
|
|
6
6
|
import { withBase as J, cx as Q } from "../../utils/cx.js";
|
|
7
7
|
import { Label as U, Description as W, FieldError as Y } from "../field/Field.js";
|
|
8
8
|
import { FieldSpinner as Z, loadingAttrs as _ } from "../field/FieldLoading.js";
|
|
9
9
|
import { responsiveAttrs as k } from "../../utils/responsive.js";
|
|
10
10
|
import { Popover as ee } from "../overlay/Overlay.js";
|
|
11
11
|
import { SelectItem as te } from "../select/Select.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
import { recentGroups as ae } from "../select/recent.js";
|
|
13
|
+
import { useStrings as F } from "../../i18n/strings.js";
|
|
14
|
+
import { OptionMatchContext as le } from "./Highlight.js";
|
|
15
|
+
function ie({ style: s, children: n }) {
|
|
16
|
+
const o = R(L), m = o && !(o.selectedItem && o.inputValue === o.selectedItem.textValue) ? o.inputValue : "", c = K(() => ({ query: m, style: s ?? "tint", match: "phrase" }), [m, s]);
|
|
17
|
+
return /* @__PURE__ */ t(le.Provider, { value: c, children: n });
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
-
const
|
|
20
|
-
return !
|
|
21
|
-
|
|
22
|
-
}, children: /* @__PURE__ */ t(
|
|
19
|
+
function ne() {
|
|
20
|
+
const s = F(), n = R(L);
|
|
21
|
+
return !n || !n.inputValue && n.selectedKey == null ? null : /* @__PURE__ */ t(G, { slot: null, className: "alea-input-clear alea-focus-ring", "aria-label": s.clear, onPress: () => {
|
|
22
|
+
n.setSelectedKey(null), n.setInputValue("");
|
|
23
|
+
}, children: /* @__PURE__ */ t(j, { size: 14 }) });
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
const { contains:
|
|
28
|
-
|
|
25
|
+
function oe({ motion: s, label: n, description: o, errorMessage: m, warningMessage: c, showOptional: v, placeholder: N, children: h, emptyText: p, size: V, variant: S = "outline", labelPosition: b = "top", prefix: w, isClearable: B, highlightMatch: f, matchStyle: O, isLoading: g, footer: l, virtualized: r, className: C, recent: D, ...i }) {
|
|
26
|
+
const d = F();
|
|
27
|
+
p ?? (p = d.noMatches);
|
|
28
|
+
const { contains: I } = T({ sensitivity: "base" }), y = (a) => typeof h == "function" ? h(a) : /* @__PURE__ */ t(te, { id: a.id, textValue: a.textValue ?? (typeof a.label == "string" ? a.label : String(a.id)), description: a.description, icon: a.icon, isDisabled: a.isDisabled, children: a.label }, a.id), x = r ? null : ae(i.items ?? i.defaultItems, D, d.recentGroup, d.otherGroup, y);
|
|
29
|
+
x && (delete i.items, delete i.defaultItems);
|
|
30
|
+
const e = /* @__PURE__ */ t(X, { className: "alea-listbox", renderEmptyState: () => /* @__PURE__ */ t("p", { className: "alea-listbox-empty", children: g ? d.loading : p }), children: x ?? h ?? y });
|
|
31
|
+
return /* @__PURE__ */ u(
|
|
29
32
|
P,
|
|
30
33
|
{
|
|
31
|
-
defaultFilter:
|
|
34
|
+
defaultFilter: I,
|
|
32
35
|
menuTrigger: "input",
|
|
33
36
|
allowsEmptyCollection: !0,
|
|
34
|
-
...
|
|
37
|
+
...i,
|
|
35
38
|
className: J("alea-field alea-combobox", C),
|
|
36
39
|
...k("size", V, "md"),
|
|
37
40
|
"data-variant": S !== "outline" ? S : void 0,
|
|
38
|
-
"data-label-position":
|
|
39
|
-
"data-warning":
|
|
40
|
-
..._(
|
|
41
|
+
"data-label-position": b !== "top" ? b : void 0,
|
|
42
|
+
"data-warning": c ? !0 : void 0,
|
|
43
|
+
..._(g),
|
|
41
44
|
children: [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
v && !
|
|
45
|
+
n && /* @__PURE__ */ u(U, { children: [
|
|
46
|
+
n,
|
|
47
|
+
i.isRequired && /* @__PURE__ */ t("span", { className: "alea-label-required", "aria-hidden": "true", children: " *" }),
|
|
48
|
+
v && !i.isRequired && /* @__PURE__ */ u("span", { className: "alea-label-optional", children: [
|
|
46
49
|
" (",
|
|
47
|
-
|
|
50
|
+
d.optional,
|
|
48
51
|
")"
|
|
49
52
|
] })
|
|
50
53
|
] }),
|
|
51
|
-
/* @__PURE__ */
|
|
54
|
+
/* @__PURE__ */ u("div", { className: "alea-input-wrap", children: [
|
|
52
55
|
w && /* @__PURE__ */ t("span", { className: "alea-input-affix", "data-side": "start", "aria-hidden": "true", children: w }),
|
|
53
|
-
/* @__PURE__ */ t(
|
|
54
|
-
|
|
55
|
-
B && !
|
|
56
|
-
/* @__PURE__ */ t(
|
|
56
|
+
/* @__PURE__ */ t(z, { className: "alea-input", placeholder: N, "aria-busy": g || void 0 }),
|
|
57
|
+
g && /* @__PURE__ */ t(Z, {}),
|
|
58
|
+
B && !i.isDisabled && !i.isReadOnly && /* @__PURE__ */ t(ne, {}),
|
|
59
|
+
/* @__PURE__ */ t(G, { className: "alea-input-clear alea-focus-ring", "aria-label": d.showSuggestions, children: /* @__PURE__ */ t($, { size: 16 }) })
|
|
57
60
|
] }),
|
|
58
|
-
(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
(o || c) && /* @__PURE__ */ u(W, { children: [
|
|
62
|
+
o,
|
|
63
|
+
c && /* @__PURE__ */ t("span", { className: "alea-field-warning", children: c })
|
|
61
64
|
] }),
|
|
62
|
-
/* @__PURE__ */ t(Y, { children:
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
/* @__PURE__ */ t(Y, { children: m }),
|
|
66
|
+
/* @__PURE__ */ u(ee, { className: "alea-popover alea-select-popover", motion: s, children: [
|
|
67
|
+
f ? /* @__PURE__ */ t(ie, { style: O, children: r ? /* @__PURE__ */ t(A, { layout: E, layoutOptions: { rowHeight: r }, children: e }) : e }) : r ? /* @__PURE__ */ t(A, { layout: E, layoutOptions: { rowHeight: r }, children: e }) : e,
|
|
68
|
+
l && /* @__PURE__ */ t("div", { className: "alea-select-footer", children: l })
|
|
66
69
|
] })
|
|
67
70
|
]
|
|
68
71
|
}
|
|
69
72
|
);
|
|
70
73
|
}
|
|
71
|
-
function
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
const [
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
e == null ||
|
|
74
|
+
function xe({ label: s, description: n, items: o, value: m, defaultValue: c = [], onChange: v, placeholder: N, allowsCustomValue: h, max: p, isLoading: V, highlightMatch: S, isDisabled: b, className: w, style: B }) {
|
|
75
|
+
const f = F();
|
|
76
|
+
N ?? (N = f.typeToAdd);
|
|
77
|
+
const [O, g] = q(c), l = m ?? O, [r, C] = q(""), { contains: D } = T({ sensitivity: "base" }), i = (e) => {
|
|
78
|
+
m === void 0 && g(e), v == null || v(e);
|
|
79
|
+
}, d = K(() => new Map(o.map((e) => [e.id, e])), [o]), I = o.filter((e) => !l.includes(e.id)), y = p !== void 0 && l.length >= p, x = (e) => {
|
|
80
|
+
e == null || l.includes(e) || y || (i([...l, e]), C(""));
|
|
78
81
|
};
|
|
79
|
-
return /* @__PURE__ */
|
|
82
|
+
return /* @__PURE__ */ u("div", { className: Q("alea-field alea-tagfield", w), style: B, "data-disabled": b || void 0, children: [
|
|
80
83
|
/* @__PURE__ */ t(
|
|
81
|
-
|
|
84
|
+
oe,
|
|
82
85
|
{
|
|
83
|
-
label:
|
|
86
|
+
label: s,
|
|
84
87
|
isLoading: V,
|
|
85
88
|
highlightMatch: S,
|
|
86
|
-
description:
|
|
87
|
-
items:
|
|
88
|
-
inputValue:
|
|
89
|
+
description: n ?? (p ? f.nOfTotal(l.length, p) : void 0),
|
|
90
|
+
items: I.filter((e) => D(e.textValue ?? (typeof e.label == "string" ? e.label : String(e.id)), r)),
|
|
91
|
+
inputValue: r,
|
|
89
92
|
onInputChange: C,
|
|
90
93
|
selectedKey: null,
|
|
91
|
-
onSelectionChange:
|
|
92
|
-
allowsCustomValue:
|
|
93
|
-
isDisabled:
|
|
94
|
-
placeholder:
|
|
94
|
+
onSelectionChange: x,
|
|
95
|
+
allowsCustomValue: h,
|
|
96
|
+
isDisabled: b || y,
|
|
97
|
+
placeholder: y ? f.limitReached : N,
|
|
95
98
|
onKeyDown: (e) => {
|
|
96
|
-
e.key === "Enter" &&
|
|
99
|
+
e.key === "Enter" && h && r.trim() && !e.target.getAttribute("aria-activedescendant") && !I.some((a) => String(a.label).toLowerCase() === r.trim().toLowerCase()) && x(r.trim()), e.key === "Backspace" && !r && l.length && i(l.slice(0, -1));
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
102
|
),
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
return /* @__PURE__ */
|
|
103
|
-
|
|
104
|
-
!
|
|
103
|
+
l.length > 0 && /* @__PURE__ */ t("ul", { className: "alea-tagfield-tags", "aria-label": f.selected, children: l.map((e) => {
|
|
104
|
+
const a = d.get(e), H = a && typeof a.label == "string" ? a.label : String(e);
|
|
105
|
+
return /* @__PURE__ */ u("li", { className: "alea-tag", "data-allows-removing": "true", children: [
|
|
106
|
+
a ? a.label : String(e),
|
|
107
|
+
!b && /* @__PURE__ */ t("button", { type: "button", className: "alea-tag-remove alea-focus-ring", "aria-label": f.removeItem(String(H)), onClick: () => i(l.filter((M) => M !== e)), children: /* @__PURE__ */ t(j, { size: 12 }) })
|
|
105
108
|
] }, String(e));
|
|
106
109
|
}) })
|
|
107
110
|
] });
|
|
108
111
|
}
|
|
109
112
|
export {
|
|
110
|
-
|
|
111
|
-
|
|
113
|
+
oe as ComboBox,
|
|
114
|
+
xe as TagField
|
|
112
115
|
};
|
|
@@ -174,9 +174,13 @@ export interface BannerProps {
|
|
|
174
174
|
'aria-label'?: string;
|
|
175
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
176
|
role?: 'region' | 'status' | 'alert';
|
|
177
|
+
/** restored: the note "Draft restored" that sits above a form: info tone, a compact bar, announced politely, with a Discard button when onDiscard is given. The tone, size and role it sets can still be overridden. */
|
|
178
|
+
variant?: 'restored';
|
|
179
|
+
/** With variant restored: called by the Discard button, which also closes the banner. */
|
|
180
|
+
onDiscard?: () => void;
|
|
177
181
|
/** A banner does not print: it is about the screen (a status, a sync, news). Set data-print="show" on the one that must reach the paper, such as a legal notice. */
|
|
178
182
|
'data-print'?: 'show';
|
|
179
183
|
className?: string;
|
|
180
184
|
}
|
|
181
185
|
/** A site-wide announcement bar above the header: launches, sales, outages. */
|
|
182
|
-
export declare function Banner({ children, tone, size, action, onDismiss, className, 'aria-label': label, role, 'data-print': print }: BannerProps): import("react").JSX.Element | null;
|
|
186
|
+
export declare function Banner({ children, tone, size, action, onDismiss, className, 'aria-label': label, role, variant, onDiscard, 'data-print': print }: BannerProps): import("react").JSX.Element | null;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { useState as
|
|
2
|
+
import { jsx as a, jsxs as u, Fragment as T } from "react/jsx-runtime";
|
|
3
|
+
import { useState as x, useRef as D, useEffect as z, useId as j, forwardRef as P } from "react";
|
|
4
4
|
import { Disclosure as A, Button as I, DisclosurePanel as K } from "react-aria-components";
|
|
5
|
-
import { X as
|
|
5
|
+
import { X as q, ChevronDown as O, Pencil as F, Check as M } from "lucide-react";
|
|
6
6
|
import { cx as m } from "../../utils/cx.js";
|
|
7
7
|
import { formatDecimal as H } from "../../utils/decimal.js";
|
|
8
8
|
import { Spinner as L } from "../feedback/Spinner.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
import { Button as R } from "../button/Button.js";
|
|
10
|
+
import { useStrings as C } from "../../i18n/strings.js";
|
|
11
|
+
import { inertProps as V } from "../../utils/inert.js";
|
|
12
|
+
const ta = P(function({ target: n = "main", children: t, className: s, ...c }, i) {
|
|
13
|
+
const o = C();
|
|
14
|
+
return t ?? (t = o.skipToContent), /* @__PURE__ */ a("a", { ref: i, href: `#${n}`, ...c, className: m("alea-skip-link", s), children: t });
|
|
15
|
+
}), la = P(function({ children: n, as: t = "span", className: s, ...c }, i) {
|
|
16
|
+
return /* @__PURE__ */ a(t, { ref: i, ...c, className: m("alea-visually-hidden", s), children: n });
|
|
16
17
|
});
|
|
17
|
-
function
|
|
18
|
-
return /* @__PURE__ */ u(A, { isExpanded:
|
|
18
|
+
function na({ title: e, children: n, isExpanded: t, defaultExpanded: s, onExpandedChange: c, className: i }) {
|
|
19
|
+
return /* @__PURE__ */ u(A, { isExpanded: t, defaultExpanded: s, onExpandedChange: c, className: m("alea-collapsible", i), children: [
|
|
19
20
|
/* @__PURE__ */ u(I, { slot: "trigger", className: "alea-collapsible-trigger alea-focus-ring", children: [
|
|
20
21
|
/* @__PURE__ */ a(O, { size: 16, "aria-hidden": "true", className: "alea-collapsible-chevron" }),
|
|
21
22
|
e
|
|
@@ -23,161 +24,163 @@ function la({ title: e, children: n, isExpanded: l, defaultExpanded: s, onExpand
|
|
|
23
24
|
/* @__PURE__ */ a(K, { className: "alea-collapsible-panel", children: /* @__PURE__ */ a("div", { className: "alea-collapsible-content", children: n }) })
|
|
24
25
|
] });
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
const p =
|
|
27
|
+
function sa({ value: e, defaultValue: n = "", onSave: t, label: s, placeholder: c = "Empty", multiline: i, className: o }) {
|
|
28
|
+
const p = C(), [b, h] = x(n), l = e ?? b, [r, f] = x(!1), [g, N] = x(l), [w, y] = x(!1), $ = D(null), v = D(null);
|
|
28
29
|
z(() => {
|
|
29
|
-
var d,
|
|
30
|
-
|
|
31
|
-
}, [
|
|
32
|
-
const
|
|
33
|
-
if ((
|
|
34
|
-
|
|
30
|
+
var d, B;
|
|
31
|
+
r && ((d = $.current) == null || d.focus(), (B = $.current) == null || B.select());
|
|
32
|
+
}, [r]);
|
|
33
|
+
const k = () => {
|
|
34
|
+
if ((t == null ? void 0 : t(g)) === !1) {
|
|
35
|
+
y(!0);
|
|
35
36
|
return;
|
|
36
37
|
}
|
|
37
|
-
e === void 0 && h(
|
|
38
|
+
e === void 0 && h(g), f(!1), y(!1), requestAnimationFrame(() => {
|
|
38
39
|
var d;
|
|
39
|
-
return (d =
|
|
40
|
+
return (d = v.current) == null ? void 0 : d.focus();
|
|
40
41
|
});
|
|
41
42
|
}, S = () => {
|
|
42
|
-
|
|
43
|
+
f(!1), y(!1), requestAnimationFrame(() => {
|
|
43
44
|
var d;
|
|
44
|
-
return (d =
|
|
45
|
+
return (d = v.current) == null ? void 0 : d.focus();
|
|
45
46
|
});
|
|
46
47
|
};
|
|
47
|
-
if (!
|
|
48
|
-
return /* @__PURE__ */ u("button", { ref:
|
|
49
|
-
|
|
48
|
+
if (!r)
|
|
49
|
+
return /* @__PURE__ */ u("button", { ref: v, type: "button", className: m("alea-editable alea-focus-ring", o), "data-empty": !l || void 0, "aria-label": `${s}: ${l || c}. Edit`, onClick: () => {
|
|
50
|
+
N(l), f(!0);
|
|
50
51
|
}, children: [
|
|
51
|
-
/* @__PURE__ */ a("span", { className: "alea-editable-text", children:
|
|
52
|
+
/* @__PURE__ */ a("span", { className: "alea-editable-text", children: l || c }),
|
|
52
53
|
/* @__PURE__ */ a(F, { size: 14, "aria-hidden": "true", className: "alea-editable-icon" })
|
|
53
54
|
] });
|
|
54
|
-
const E =
|
|
55
|
+
const E = i ? "textarea" : "input";
|
|
55
56
|
return /* @__PURE__ */ u("span", { className: m("alea-editable-edit", o), children: [
|
|
56
57
|
/* @__PURE__ */ a(
|
|
57
58
|
E,
|
|
58
59
|
{
|
|
59
|
-
ref:
|
|
60
|
-
className:
|
|
60
|
+
ref: $,
|
|
61
|
+
className: i ? "alea-textarea" : "alea-input alea-editable-input",
|
|
61
62
|
"aria-label": s,
|
|
62
|
-
"aria-invalid":
|
|
63
|
-
value:
|
|
64
|
-
rows:
|
|
63
|
+
"aria-invalid": w || void 0,
|
|
64
|
+
value: g,
|
|
65
|
+
rows: i ? 3 : void 0,
|
|
65
66
|
onChange: (d) => {
|
|
66
|
-
|
|
67
|
+
N(d.target.value), y(!1);
|
|
67
68
|
},
|
|
68
69
|
onKeyDown: (d) => {
|
|
69
|
-
d.key === "Escape" && (d.preventDefault(), S()), d.key === "Enter" && (!
|
|
70
|
+
d.key === "Escape" && (d.preventDefault(), S()), d.key === "Enter" && (!i || d.metaKey || d.ctrlKey) && (d.preventDefault(), k());
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
),
|
|
73
|
-
/* @__PURE__ */ a("button", { type: "button", className: "alea-editable-btn alea-focus-ring", "aria-label": p.save, onClick:
|
|
74
|
-
/* @__PURE__ */ a("button", { type: "button", className: "alea-editable-btn alea-focus-ring", "aria-label": p.cancel, onClick: S, children: /* @__PURE__ */ a(
|
|
74
|
+
/* @__PURE__ */ a("button", { type: "button", className: "alea-editable-btn alea-focus-ring", "aria-label": p.save, onClick: k, children: /* @__PURE__ */ a(M, { size: 14 }) }),
|
|
75
|
+
/* @__PURE__ */ a("button", { type: "button", className: "alea-editable-btn alea-focus-ring", "aria-label": p.cancel, onClick: S, children: /* @__PURE__ */ a(q, { size: 14 }) })
|
|
75
76
|
] });
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
-
return /* @__PURE__ */ a(T, { children: H(e,
|
|
78
|
+
function ra({ value: e, format: n, locale: t }) {
|
|
79
|
+
return /* @__PURE__ */ a(T, { children: H(e, t, n) });
|
|
79
80
|
}
|
|
80
|
-
const
|
|
81
|
-
function
|
|
82
|
-
const
|
|
81
|
+
const X = (e) => String(e).padStart(2, "0");
|
|
82
|
+
function ia({ to: e, label: n, onEnd: t, showDays: s, className: c }) {
|
|
83
|
+
const i = C(), o = typeof e == "number" ? e : e.getTime(), [p, b] = x(() => Date.now()), h = D(!1);
|
|
83
84
|
z(() => {
|
|
84
|
-
const
|
|
85
|
-
return () => clearInterval(
|
|
85
|
+
const v = setInterval(() => b(Date.now()), 1e3);
|
|
86
|
+
return () => clearInterval(v);
|
|
86
87
|
}, []);
|
|
87
|
-
const
|
|
88
|
+
const l = Math.max(0, o - p);
|
|
88
89
|
z(() => {
|
|
89
|
-
|
|
90
|
-
}, [
|
|
91
|
-
const
|
|
90
|
+
l === 0 && !h.current && (h.current = !0, t == null || t());
|
|
91
|
+
}, [l, t]);
|
|
92
|
+
const r = Math.floor(l / 864e5), f = Math.floor(l / 36e5) % 24, g = Math.floor(l / 6e4) % 60, N = Math.floor(l / 1e3) % 60, w = s ?? r > 0, y = [...w ? [[r, "d"]] : [], [w ? f : f + r * 24, "h"], [g, "m"], [N, "s"]], $ = `${w ? `${r} days, ` : ""}${w ? f : f + r * 24} hours, ${g} minutes`;
|
|
92
93
|
return /* @__PURE__ */ u("div", { className: m("alea-stat alea-countdown", c), children: [
|
|
93
94
|
/* @__PURE__ */ a("span", { className: "alea-stat-label", children: n }),
|
|
94
|
-
/* @__PURE__ */ a("span", { className: "alea-stat-value alea-countdown-value", "aria-hidden": "true", children:
|
|
95
|
-
/* @__PURE__ */ a("b", { children:
|
|
96
|
-
/* @__PURE__ */ a("small", { children:
|
|
97
|
-
] },
|
|
98
|
-
/* @__PURE__ */ a("span", { className: "alea-visually-hidden", "aria-live": "polite", children:
|
|
95
|
+
/* @__PURE__ */ a("span", { className: "alea-stat-value alea-countdown-value", "aria-hidden": "true", children: y.map(([v, k]) => /* @__PURE__ */ u("span", { children: [
|
|
96
|
+
/* @__PURE__ */ a("b", { children: k === "d" ? v : X(v) }),
|
|
97
|
+
/* @__PURE__ */ a("small", { children: k })
|
|
98
|
+
] }, k)) }),
|
|
99
|
+
/* @__PURE__ */ a("span", { className: "alea-visually-hidden", "aria-live": "polite", children: l === 0 ? i.ended : $ })
|
|
99
100
|
] });
|
|
100
101
|
}
|
|
101
|
-
function
|
|
102
|
+
function ca({ tone: e = "neutral", children: n, pulse: t, className: s }) {
|
|
102
103
|
return /* @__PURE__ */ u("span", { className: m("alea-status", s), "data-tone": e, children: [
|
|
103
|
-
/* @__PURE__ */ a("span", { className: "alea-status-dot", "data-pulse":
|
|
104
|
+
/* @__PURE__ */ a("span", { className: "alea-status-dot", "data-pulse": t || void 0, "aria-hidden": "true" }),
|
|
104
105
|
n
|
|
105
106
|
] });
|
|
106
107
|
}
|
|
107
|
-
function
|
|
108
|
-
const p = /* @__PURE__ */ a("span", { className: "alea-swatch", "data-shape": s, role: "img", "aria-label": n, style: { width:
|
|
109
|
-
return c ? /* @__PURE__ */ u("span", { className: m("alea-swatch-wrap",
|
|
108
|
+
function oa({ color: e, label: n, size: t = 28, shape: s = "circle", showValue: c, className: i, style: o }) {
|
|
109
|
+
const p = /* @__PURE__ */ a("span", { className: "alea-swatch", "data-shape": s, role: "img", "aria-label": n, style: { width: t, height: t, "--alea-swatch": e, ...o } });
|
|
110
|
+
return c ? /* @__PURE__ */ u("span", { className: m("alea-swatch-wrap", i), "data-labeled": !0, children: [
|
|
110
111
|
p,
|
|
111
112
|
/* @__PURE__ */ a("span", { className: "alea-swatch-name", "aria-hidden": "true", children: n }),
|
|
112
113
|
/* @__PURE__ */ a("code", { className: "alea-swatch-value", children: e })
|
|
113
|
-
] }) : /* @__PURE__ */ a("span", { className: m("alea-swatch-wrap",
|
|
114
|
+
] }) : /* @__PURE__ */ a("span", { className: m("alea-swatch-wrap", i), children: p });
|
|
114
115
|
}
|
|
115
|
-
function
|
|
116
|
-
const
|
|
117
|
-
return
|
|
118
|
-
/* @__PURE__ */ a("div", { className: "alea-loading-content", ...
|
|
119
|
-
e && /* @__PURE__ */ a("div", { className: "alea-loading-overlay", "data-blur": s || void 0, children: /* @__PURE__ */ a(L, { size: "md", "aria-label":
|
|
116
|
+
function da({ isLoading: e, children: n, label: t, blur: s = !0, className: c }) {
|
|
117
|
+
const i = C();
|
|
118
|
+
return t ?? (t = i.loading), /* @__PURE__ */ u("div", { className: m("alea-loading", c), "aria-busy": e || void 0, children: [
|
|
119
|
+
/* @__PURE__ */ a("div", { className: "alea-loading-content", ...V(e), children: n }),
|
|
120
|
+
e && /* @__PURE__ */ a("div", { className: "alea-loading-overlay", "data-blur": s || void 0, children: /* @__PURE__ */ a(L, { size: "md", "aria-label": t }) })
|
|
120
121
|
] });
|
|
121
122
|
}
|
|
122
|
-
function
|
|
123
|
-
const o = j(), p = n ?? e.reduce((
|
|
124
|
-
return /* @__PURE__ */ u("div", { className: m("alea-progress-seg",
|
|
123
|
+
function ua({ segments: e, total: n, label: t, valueFormat: s = (o) => String(o), showLegend: c = !0, className: i }) {
|
|
124
|
+
const o = j(), p = n ?? e.reduce((l, r) => l + r.value, 0), b = (l, r) => l.color || `var(--alea-chart-${r % 8 + 1})`, h = e.reduce((l, r) => l + r.value, 0);
|
|
125
|
+
return /* @__PURE__ */ u("div", { className: m("alea-progress-seg", i), children: [
|
|
125
126
|
/* @__PURE__ */ u("div", { className: "alea-progress-seg-head", children: [
|
|
126
|
-
/* @__PURE__ */ a("span", { id: o, className: "alea-label", children:
|
|
127
|
+
/* @__PURE__ */ a("span", { id: o, className: "alea-label", children: t }),
|
|
127
128
|
/* @__PURE__ */ u("span", { className: "alea-progress-seg-total", children: [
|
|
128
129
|
s(h),
|
|
129
130
|
" of ",
|
|
130
131
|
s(p)
|
|
131
132
|
] })
|
|
132
133
|
] }),
|
|
133
|
-
/* @__PURE__ */ a("div", { className: "alea-progress-seg-bar", role: "meter", "aria-labelledby": o, "aria-valuemin": 0, "aria-valuemax": p, "aria-valuenow": h, "aria-valuetext": e.map((
|
|
134
|
-
c && /* @__PURE__ */ a("ul", { className: "alea-progress-seg-legend", "aria-hidden": "true", children: e.map((
|
|
135
|
-
/* @__PURE__ */ a("span", { style: { background:
|
|
136
|
-
|
|
137
|
-
/* @__PURE__ */ a("b", { children: s(
|
|
138
|
-
] },
|
|
134
|
+
/* @__PURE__ */ a("div", { className: "alea-progress-seg-bar", role: "meter", "aria-labelledby": o, "aria-valuemin": 0, "aria-valuemax": p, "aria-valuenow": h, "aria-valuetext": e.map((l) => `${l.label} ${s(l.value)}`).join(", "), children: e.map((l, r) => /* @__PURE__ */ a("span", { className: "alea-progress-seg-part", style: { width: `${l.value / (p || 1) * 100}%`, background: b(l, r), animationDelay: `${r * 60}ms` } }, l.label)) }),
|
|
135
|
+
c && /* @__PURE__ */ a("ul", { className: "alea-progress-seg-legend", "aria-hidden": "true", children: e.map((l, r) => /* @__PURE__ */ u("li", { children: [
|
|
136
|
+
/* @__PURE__ */ a("span", { style: { background: b(l, r) } }),
|
|
137
|
+
l.label,
|
|
138
|
+
/* @__PURE__ */ a("b", { children: s(l.value) })
|
|
139
|
+
] }, l.label)) })
|
|
139
140
|
] });
|
|
140
141
|
}
|
|
141
|
-
function
|
|
142
|
+
function ma({ children: e, cite: n, source: t, className: s }) {
|
|
142
143
|
return /* @__PURE__ */ u("figure", { className: m("alea-blockquote", s), children: [
|
|
143
|
-
/* @__PURE__ */ a("blockquote", { cite:
|
|
144
|
+
/* @__PURE__ */ a("blockquote", { cite: t, children: e }),
|
|
144
145
|
n && /* @__PURE__ */ a("figcaption", { children: n })
|
|
145
146
|
] });
|
|
146
147
|
}
|
|
147
|
-
function
|
|
148
|
-
return /* @__PURE__ */ a(n === "number" ? "ol" : "ul", { className: m("alea-text-list", s), "data-marker": n, "data-spacing":
|
|
149
|
-
n === "check" && /* @__PURE__ */ a(
|
|
150
|
-
/* @__PURE__ */ a("span", { children:
|
|
148
|
+
function pa({ items: e, marker: n = "bullet", spacing: t = "md", className: s }) {
|
|
149
|
+
return /* @__PURE__ */ a(n === "number" ? "ol" : "ul", { className: m("alea-text-list", s), "data-marker": n, "data-spacing": t, children: e.map((i, o) => /* @__PURE__ */ u("li", { children: [
|
|
150
|
+
n === "check" && /* @__PURE__ */ a(M, { size: 16, "aria-hidden": "true", className: "alea-text-list-check" }),
|
|
151
|
+
/* @__PURE__ */ a("span", { children: i })
|
|
151
152
|
] }, o)) });
|
|
152
153
|
}
|
|
153
|
-
function
|
|
154
|
-
return /* @__PURE__ */ a("div", { className: m("alea-prose alea-markdown",
|
|
154
|
+
function ha({ children: e, size: n = "base", className: t }) {
|
|
155
|
+
return /* @__PURE__ */ a("div", { className: m("alea-prose alea-markdown", t), "data-size": n, children: e });
|
|
155
156
|
}
|
|
156
|
-
function
|
|
157
|
-
const
|
|
158
|
-
o ?? (o =
|
|
159
|
-
const [
|
|
160
|
-
return
|
|
157
|
+
function fa({ children: e, tone: n, size: t, action: s, onDismiss: c, className: i, "aria-label": o, role: p, variant: b, onDiscard: h, "data-print": l }) {
|
|
158
|
+
const r = C();
|
|
159
|
+
o ?? (o = r.announcement);
|
|
160
|
+
const [f, g] = x(!0), N = b === "restored";
|
|
161
|
+
return n ?? (n = N ? "info" : "accent"), t ?? (t = N ? "sm" : "md"), p ?? (p = N ? "status" : "region"), N && h && !s && (s = /* @__PURE__ */ a(R, { size: "sm", variant: "ghost", onPress: () => {
|
|
162
|
+
g(!1), h();
|
|
163
|
+
}, children: r.discard })), f ? /* @__PURE__ */ u("div", { className: m("alea-banner", i), "data-tone": n, "data-size": t === "sm" ? t : void 0, "data-dismissible": c ? !0 : void 0, "data-print": l, "data-variant": b, role: p, "aria-label": o, children: [
|
|
161
164
|
/* @__PURE__ */ a("div", { className: "alea-banner-text", children: e }),
|
|
162
165
|
s && /* @__PURE__ */ a("span", { className: "alea-banner-action", children: s }),
|
|
163
|
-
c && /* @__PURE__ */ a("button", { type: "button", className: "alea-banner-close alea-focus-ring", "aria-label":
|
|
164
|
-
|
|
165
|
-
}, children: /* @__PURE__ */ a(
|
|
166
|
+
c && /* @__PURE__ */ a("button", { type: "button", className: "alea-banner-close alea-focus-ring", "aria-label": r.dismissAnnouncement, onClick: () => {
|
|
167
|
+
g(!1), c();
|
|
168
|
+
}, children: /* @__PURE__ */ a(q, { size: 16 }) })
|
|
166
169
|
] }) : null;
|
|
167
170
|
}
|
|
168
171
|
export {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
172
|
+
fa as Banner,
|
|
173
|
+
ma as Blockquote,
|
|
174
|
+
na as Collapsible,
|
|
175
|
+
oa as ColorSwatch,
|
|
176
|
+
ia as Countdown,
|
|
177
|
+
sa as Editable,
|
|
178
|
+
ra as FormattedNumber,
|
|
179
|
+
pa as List,
|
|
180
|
+
da as LoadingOverlay,
|
|
181
|
+
ua as ProgressSegments,
|
|
182
|
+
ha as Prose,
|
|
183
|
+
ta as SkipLink,
|
|
184
|
+
ca as Status,
|
|
185
|
+
la as VisuallyHidden
|
|
183
186
|
};
|
|
@@ -56,6 +56,12 @@ export interface DialogProps extends Omit<RACDialogProps, 'children'> {
|
|
|
56
56
|
footer?: ReactNode | ((opts: {
|
|
57
57
|
close: () => void;
|
|
58
58
|
}) => ReactNode);
|
|
59
|
+
/** A second primary action next to the footer buttons ("Save and new"). Ctrl+Enter (Command+Enter on a Mac) runs it from anywhere in the dialog, and the shortcut is written under the buttons. */
|
|
60
|
+
secondaryAction?: {
|
|
61
|
+
label: ReactNode;
|
|
62
|
+
onPress: () => void;
|
|
63
|
+
isDisabled?: boolean;
|
|
64
|
+
};
|
|
59
65
|
/** Hides the X button. */
|
|
60
66
|
hideClose?: boolean;
|
|
61
67
|
/** Size of the title: md (24 px display, default) or sm (16 px, semibold). Same as on Modal. */
|