@alea-design/ui 0.10.9 → 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/button/Button.js +25 -24
- 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
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { jsx as e, jsxs as h, Fragment as W } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef as C, useRef as E, useEffect as A, useState as X } from "react";
|
|
4
4
|
import { useRipple as ee } from "@alea-design/motion";
|
|
5
|
-
import { Link as ne, Button as te, composeRenderProps as ae, ToggleButtonGroup as oe, ToggleButton as J, SelectionIndicator as
|
|
5
|
+
import { Link as ne, Button as te, composeRenderProps as ae, ToggleButtonGroup as oe, ToggleButton as J, SelectionIndicator as re } from "react-aria-components";
|
|
6
6
|
import { withBase as w } from "../../utils/cx.js";
|
|
7
|
-
import { useMergedRef as
|
|
7
|
+
import { useMergedRef as le } from "../../utils/refs.js";
|
|
8
8
|
import { Spinner as Y } from "../feedback/Spinner.js";
|
|
9
9
|
import { useStrings as Q } from "../../i18n/strings.js";
|
|
10
10
|
import { responsiveAttrs as q } from "../../utils/responsive.js";
|
|
@@ -12,20 +12,21 @@ import { TooltipTrigger as ie, Tooltip as se } from "../overlay/Overlay.js";
|
|
|
12
12
|
import { buttonIcon as $ } from "../icon/icon-contexts.js";
|
|
13
13
|
import { celebrate as ce } from "../celebrate/Celebrate.js";
|
|
14
14
|
function G() {
|
|
15
|
-
|
|
16
|
-
(
|
|
15
|
+
if (!(typeof document > "u"))
|
|
16
|
+
for (const r of document.querySelectorAll('[data-live-announcer] [role="img"][aria-labelledby]'))
|
|
17
|
+
(r.getAttribute("aria-labelledby") ?? "").split(/\s+/).filter(Boolean).some((a) => document.getElementById(a)) || r.remove();
|
|
17
18
|
}
|
|
18
19
|
function de() {
|
|
19
20
|
A(() => () => {
|
|
20
21
|
typeof document > "u" || (setTimeout(G, 0), setTimeout(G, 150));
|
|
21
22
|
}, []);
|
|
22
23
|
}
|
|
23
|
-
const Z = C(function({ variant: t = "primary", tone: a, size: i, shape: u, iconStart: s, iconEnd:
|
|
24
|
+
const Z = C(function({ variant: t = "primary", tone: a, size: i, shape: u, iconStart: s, iconEnd: l, isLoading: m, loadingLabel: n, loadingPosition: c = "center", fullWidth: R, justify: B, wrap: T, shortcut: f, href: b, target: k, rel: S, isSuccess: g, successLabel: p, ripple: v, className: z, children: y, ...j }, _) {
|
|
24
25
|
const x = Q();
|
|
25
26
|
p ?? (p = x.done);
|
|
26
27
|
const D = E(null);
|
|
27
28
|
de();
|
|
28
|
-
const M =
|
|
29
|
+
const M = le(_, D), { onPointerDown: P } = ee();
|
|
29
30
|
A(() => {
|
|
30
31
|
const o = D.current;
|
|
31
32
|
if (!v || !o) return;
|
|
@@ -40,7 +41,7 @@ const Z = C(function({ variant: t = "primary", tone: a, size: i, shape: u, iconS
|
|
|
40
41
|
] }) : /* @__PURE__ */ h("span", { className: "alea-button-content", "data-hidden": d && !N || void 0, children: [
|
|
41
42
|
N && c !== "end" ? F : s && /* @__PURE__ */ e("span", { className: "alea-button-icon", "aria-hidden": "true", ...$(t, a), children: s }),
|
|
42
43
|
(N && n != null ? n : o) != null && o !== !1 && /* @__PURE__ */ e("span", { className: "alea-button-label", children: N && n != null ? n : o }),
|
|
43
|
-
N && c === "end" ? F :
|
|
44
|
+
N && c === "end" ? F : l && /* @__PURE__ */ e("span", { className: "alea-button-icon", "aria-hidden": "true", ...$(t, a), children: l }),
|
|
44
45
|
f && /* @__PURE__ */ e("kbd", { className: "alea-button-kbd", "aria-hidden": "true", children: f })
|
|
45
46
|
] })
|
|
46
47
|
] }), O = {
|
|
@@ -79,14 +80,14 @@ const Z = C(function({ variant: t = "primary", tone: a, size: i, shape: u, iconS
|
|
|
79
80
|
);
|
|
80
81
|
}
|
|
81
82
|
return /* @__PURE__ */ e(te, { ...j, ...O, ref: M, isPending: m, className: w("alea-button alea-focus-ring", z), children: ae(y, (o, { isPending: d }) => K(o, d)) });
|
|
82
|
-
}), Te = C(function({ shape: t = "circle", variant: a = "ghost", tooltip: i, children: u, className: s, ...
|
|
83
|
-
const n = /* @__PURE__ */ e(Z, { ...
|
|
83
|
+
}), Te = C(function({ shape: t = "circle", variant: a = "ghost", tooltip: i, children: u, className: s, ...l }, m) {
|
|
84
|
+
const n = /* @__PURE__ */ e(Z, { ...l, ref: m, variant: a, "data-icon-shape": t, "data-icon-only": !0, className: w("alea-icon-button", s), children: /* @__PURE__ */ e("span", { className: "alea-button-icon", "aria-hidden": "true", ...$(a, l.tone), children: u }) });
|
|
84
85
|
return i ? /* @__PURE__ */ h(ie, { delay: 400, children: [
|
|
85
86
|
n,
|
|
86
|
-
/* @__PURE__ */ e(se, { children:
|
|
87
|
+
/* @__PURE__ */ e(se, { children: l["aria-label"] })
|
|
87
88
|
] }) : n;
|
|
88
89
|
});
|
|
89
|
-
function ke({ items:
|
|
90
|
+
function ke({ items: r, value: t, defaultValue: a, onChange: i, size: u = "md", wrap: s, className: l, ...m }) {
|
|
90
91
|
return /* @__PURE__ */ e(
|
|
91
92
|
oe,
|
|
92
93
|
{
|
|
@@ -94,41 +95,41 @@ function ke({ items: l, value: t, defaultValue: a, onChange: i, size: u = "md",
|
|
|
94
95
|
selectionMode: "single",
|
|
95
96
|
disallowEmptySelection: !0,
|
|
96
97
|
selectedKeys: t !== void 0 ? [t] : void 0,
|
|
97
|
-
defaultSelectedKeys: a !== void 0 ? [a] : t === void 0 &&
|
|
98
|
+
defaultSelectedKeys: a !== void 0 ? [a] : t === void 0 && r[0] ? [r[0].id] : void 0,
|
|
98
99
|
onSelectionChange: (n) => {
|
|
99
100
|
const c = [...n][0];
|
|
100
101
|
c !== void 0 && (i == null || i(c));
|
|
101
102
|
},
|
|
102
103
|
"data-size": u,
|
|
103
104
|
"data-wrap": s || void 0,
|
|
104
|
-
className: w("alea-segmented",
|
|
105
|
-
children:
|
|
105
|
+
className: w("alea-segmented", l),
|
|
106
|
+
children: r.map((n) => /* @__PURE__ */ h(J, { id: n.id, isDisabled: n.isDisabled, className: "alea-segmented-item alea-focus-ring", children: [
|
|
106
107
|
/* @__PURE__ */ e("span", { className: "alea-segmented-label", children: n.label }),
|
|
107
|
-
/* @__PURE__ */ e(
|
|
108
|
+
/* @__PURE__ */ e(re, { className: "alea-sel-indicator" })
|
|
108
109
|
] }, String(n.id)))
|
|
109
110
|
}
|
|
110
111
|
);
|
|
111
112
|
}
|
|
112
|
-
function Se({ size:
|
|
113
|
-
return /* @__PURE__ */ e(J, { ...a, "data-size":
|
|
113
|
+
function Se({ size: r = "md", className: t, ...a }) {
|
|
114
|
+
return /* @__PURE__ */ e(J, { ...a, "data-size": r, className: w("alea-toggle-button alea-focus-ring", t) });
|
|
114
115
|
}
|
|
115
|
-
function U(
|
|
116
|
+
function U(r) {
|
|
116
117
|
try {
|
|
117
|
-
typeof navigator < "u" && typeof navigator.vibrate == "function" && navigator.vibrate(
|
|
118
|
+
typeof navigator < "u" && typeof navigator.vibrate == "function" && navigator.vibrate(r);
|
|
118
119
|
} catch {
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
|
-
function Ae({ onConfirm:
|
|
122
|
+
function Ae({ onConfirm: r, duration: t = 1200, hint: a, holdingLabel: i, confirmedMessage: u, haptic: s, celebrate: l, variant: m = "danger", className: n, children: c, ...R }) {
|
|
122
123
|
const B = Q();
|
|
123
124
|
a ?? (a = B.pressAndHold), u ?? (u = B.holdConfirmed);
|
|
124
|
-
const T = i === void 0 ? B.keepHolding : i, [f, b] = X(!1), [k, S] = X(""), g = E(null), p = E(`alea-hold-${Math.random().toString(36).slice(2, 8)}`).current, v = E(
|
|
125
|
-
v.current =
|
|
125
|
+
const T = i === void 0 ? B.keepHolding : i, [f, b] = X(!1), [k, S] = X(""), g = E(null), p = E(`alea-hold-${Math.random().toString(36).slice(2, 8)}`).current, v = E(r);
|
|
126
|
+
v.current = r, A(() => {
|
|
126
127
|
if (!f) return;
|
|
127
128
|
const y = window.setTimeout(() => {
|
|
128
|
-
b(!1), s && U([30, 40, 30]),
|
|
129
|
+
b(!1), s && U([30, 40, 30]), l && g.current && ce(g.current), S(u), v.current();
|
|
129
130
|
}, t);
|
|
130
131
|
return () => window.clearTimeout(y);
|
|
131
|
-
}, [f, t, s,
|
|
132
|
+
}, [f, t, s, l, u]), A(() => {
|
|
132
133
|
if (!k) return;
|
|
133
134
|
const y = window.setTimeout(() => S(""), 3e3);
|
|
134
135
|
return () => window.clearTimeout(y);
|
|
@@ -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;
|