@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.
@@ -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 le } from "react-aria-components";
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 re } from "../../utils/refs.js";
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
- for (const l of document.querySelectorAll('[data-live-announcer] [role="img"][aria-labelledby]'))
16
- (l.getAttribute("aria-labelledby") ?? "").split(/\s+/).filter(Boolean).some((a) => document.getElementById(a)) || l.remove();
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: r, 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
+ 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 = re(_, D), { onPointerDown: P } = ee();
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 : r && /* @__PURE__ */ e("span", { className: "alea-button-icon", "aria-hidden": "true", ...$(t, a), children: r }),
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, ...r }, m) {
83
- const n = /* @__PURE__ */ e(Z, { ...r, 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, r.tone), children: u }) });
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: r["aria-label"] })
87
+ /* @__PURE__ */ e(se, { children: l["aria-label"] })
87
88
  ] }) : n;
88
89
  });
89
- function ke({ items: l, value: t, defaultValue: a, onChange: i, size: u = "md", wrap: s, className: r, ...m }) {
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 && l[0] ? [l[0].id] : 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", r),
105
- children: l.map((n) => /* @__PURE__ */ h(J, { id: n.id, isDisabled: n.isDisabled, className: "alea-segmented-item alea-focus-ring", 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(le, { className: "alea-sel-indicator" })
108
+ /* @__PURE__ */ e(re, { className: "alea-sel-indicator" })
108
109
  ] }, String(n.id)))
109
110
  }
110
111
  );
111
112
  }
112
- function Se({ size: l = "md", className: t, ...a }) {
113
- return /* @__PURE__ */ e(J, { ...a, "data-size": l, className: w("alea-toggle-button alea-focus-ring", t) });
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(l) {
116
+ function U(r) {
116
117
  try {
117
- typeof navigator < "u" && typeof navigator.vibrate == "function" && navigator.vibrate(l);
118
+ typeof navigator < "u" && typeof navigator.vibrate == "function" && navigator.vibrate(r);
118
119
  } catch {
119
120
  }
120
121
  }
121
- function Ae({ onConfirm: l, duration: t = 1200, hint: a, holdingLabel: i, confirmedMessage: u, haptic: s, celebrate: r, variant: m = "danger", className: n, children: c, ...R }) {
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(l);
125
- v.current = l, A(() => {
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]), r && g.current && ce(g.current), S(u), v.current();
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, r, u]), A(() => {
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 d, jsx as t } from "react/jsx-runtime";
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 X, Button as L, Virtualizer as A, ListLayout as E, ComboBoxStateContext as j, ListBox as $ } from "react-aria-components";
5
- import { ChevronDown as G, X as z } from "lucide-react";
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 { useStrings as D } from "../../i18n/strings.js";
13
- import { OptionMatchContext as ae } from "./Highlight.js";
14
- function le({ style: r, children: i }) {
15
- const n = R(j), u = n && !(n.selectedItem && n.inputValue === n.selectedItem.textValue) ? n.inputValue : "", s = K(() => ({ query: u, style: r ?? "tint", match: "phrase" }), [u, r]);
16
- return /* @__PURE__ */ t(ae.Provider, { value: s, children: i });
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 ie() {
19
- const r = D(), i = R(j);
20
- return !i || !i.inputValue && i.selectedKey == null ? null : /* @__PURE__ */ t(L, { slot: null, className: "alea-input-clear alea-focus-ring", "aria-label": r.clear, onPress: () => {
21
- i.setSelectedKey(null), i.setInputValue("");
22
- }, children: /* @__PURE__ */ t(z, { size: 14 }) });
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 ne({ motion: r, label: i, description: n, errorMessage: u, warningMessage: s, showOptional: v, placeholder: x, children: N, emptyText: m, size: V, variant: S = "outline", labelPosition: g = "top", prefix: w, isClearable: B, highlightMatch: p, matchStyle: I, isLoading: y, footer: a, virtualized: o, className: C, ...f }) {
25
- const c = D();
26
- m ?? (m = c.noMatches);
27
- const { contains: O } = T({ sensitivity: "base" }), h = /* @__PURE__ */ t($, { className: "alea-listbox", renderEmptyState: () => /* @__PURE__ */ t("p", { className: "alea-listbox-empty", children: y ? c.loading : m }), children: N ?? ((l) => /* @__PURE__ */ t(te, { id: l.id, textValue: l.textValue ?? (typeof l.label == "string" ? l.label : String(l.id)), description: l.description, icon: l.icon, isDisabled: l.isDisabled, children: l.label })) });
28
- return /* @__PURE__ */ d(
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: O,
34
+ defaultFilter: I,
32
35
  menuTrigger: "input",
33
36
  allowsEmptyCollection: !0,
34
- ...f,
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": g !== "top" ? g : void 0,
39
- "data-warning": s ? !0 : void 0,
40
- ..._(y),
41
+ "data-label-position": b !== "top" ? b : void 0,
42
+ "data-warning": c ? !0 : void 0,
43
+ ..._(g),
41
44
  children: [
42
- i && /* @__PURE__ */ d(U, { children: [
43
- i,
44
- f.isRequired && /* @__PURE__ */ t("span", { className: "alea-label-required", "aria-hidden": "true", children: " *" }),
45
- v && !f.isRequired && /* @__PURE__ */ d("span", { className: "alea-label-optional", children: [
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
- c.optional,
50
+ d.optional,
48
51
  ")"
49
52
  ] })
50
53
  ] }),
51
- /* @__PURE__ */ d("div", { className: "alea-input-wrap", children: [
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(X, { className: "alea-input", placeholder: x, "aria-busy": y || void 0 }),
54
- y && /* @__PURE__ */ t(Z, {}),
55
- B && !f.isDisabled && !f.isReadOnly && /* @__PURE__ */ t(ie, {}),
56
- /* @__PURE__ */ t(L, { className: "alea-input-clear alea-focus-ring", "aria-label": c.showSuggestions, children: /* @__PURE__ */ t(G, { size: 16 }) })
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
- (n || s) && /* @__PURE__ */ d(W, { children: [
59
- n,
60
- s && /* @__PURE__ */ t("span", { className: "alea-field-warning", children: s })
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: u }),
63
- /* @__PURE__ */ d(ee, { className: "alea-popover alea-select-popover", motion: r, children: [
64
- p ? /* @__PURE__ */ t(le, { style: I, children: o ? /* @__PURE__ */ t(A, { layout: E, layoutOptions: { rowHeight: o }, children: h }) : h }) : o ? /* @__PURE__ */ t(A, { layout: E, layoutOptions: { rowHeight: o }, children: h }) : h,
65
- a && /* @__PURE__ */ t("div", { className: "alea-select-footer", children: a })
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 ye({ label: r, description: i, items: n, value: u, defaultValue: s = [], onChange: v, placeholder: x, allowsCustomValue: N, max: m, isLoading: V, highlightMatch: S, isDisabled: g, className: w, style: B }) {
72
- const p = D();
73
- x ?? (x = p.typeToAdd);
74
- const [I, y] = q(s), a = u ?? I, [o, C] = q(""), { contains: f } = T({ sensitivity: "base" }), c = (e) => {
75
- u === void 0 && y(e), v == null || v(e);
76
- }, O = K(() => new Map(n.map((e) => [e.id, e])), [n]), h = n.filter((e) => !a.includes(e.id)), l = m !== void 0 && a.length >= m, F = (e) => {
77
- e == null || a.includes(e) || l || (c([...a, e]), C(""));
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__ */ d("div", { className: Q("alea-field alea-tagfield", w), style: B, "data-disabled": g || void 0, children: [
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
- ne,
84
+ oe,
82
85
  {
83
- label: r,
86
+ label: s,
84
87
  isLoading: V,
85
88
  highlightMatch: S,
86
- description: i ?? (m ? p.nOfTotal(a.length, m) : void 0),
87
- items: h.filter((e) => f(e.textValue ?? (typeof e.label == "string" ? e.label : String(e.id)), o)),
88
- inputValue: o,
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: F,
92
- allowsCustomValue: N,
93
- isDisabled: g || l,
94
- placeholder: l ? p.limitReached : x,
94
+ onSelectionChange: x,
95
+ allowsCustomValue: h,
96
+ isDisabled: b || y,
97
+ placeholder: y ? f.limitReached : N,
95
98
  onKeyDown: (e) => {
96
- e.key === "Enter" && N && o.trim() && !e.target.getAttribute("aria-activedescendant") && !h.some((b) => String(b.label).toLowerCase() === o.trim().toLowerCase()) && F(o.trim()), e.key === "Backspace" && !o && a.length && c(a.slice(0, -1));
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
- a.length > 0 && /* @__PURE__ */ t("ul", { className: "alea-tagfield-tags", "aria-label": p.selected, children: a.map((e) => {
101
- const b = O.get(e), H = b && typeof b.label == "string" ? b.label : String(e);
102
- return /* @__PURE__ */ d("li", { className: "alea-tag", "data-allows-removing": "true", children: [
103
- b ? b.label : String(e),
104
- !g && /* @__PURE__ */ t("button", { type: "button", className: "alea-tag-remove alea-focus-ring", "aria-label": p.removeItem(String(H)), onClick: () => c(a.filter((M) => M !== e)), children: /* @__PURE__ */ t(z, { size: 12 }) })
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
- ne as ComboBox,
111
- ye as TagField
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;