@mattermost/compass-ui 0.1.0-alpha.24 → 0.1.0-alpha.25

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.
Files changed (54) hide show
  1. package/dist/components/admin-panel-footer/AdminPanelFooter.css +1 -1
  2. package/dist/components/admin-panel-footer/AdminPanelFooter.module.scss.cjs +1 -1
  3. package/dist/components/admin-panel-footer/AdminPanelFooter.module.scss.js +5 -5
  4. package/dist/components/combobox/Combobox.cjs +1 -1
  5. package/dist/components/combobox/Combobox.cjs.map +1 -1
  6. package/dist/components/combobox/Combobox.d.ts +3 -2
  7. package/dist/components/combobox/Combobox.d.ts.map +1 -1
  8. package/dist/components/combobox/Combobox.js +247 -241
  9. package/dist/components/combobox/Combobox.js.map +1 -1
  10. package/dist/components/dropdown/Dropdown.cjs +1 -1
  11. package/dist/components/dropdown/Dropdown.cjs.map +1 -1
  12. package/dist/components/dropdown/Dropdown.css +1 -1
  13. package/dist/components/dropdown/Dropdown.d.ts +2 -2
  14. package/dist/components/dropdown/Dropdown.d.ts.map +1 -1
  15. package/dist/components/dropdown/Dropdown.js +15 -15
  16. package/dist/components/dropdown/Dropdown.js.map +1 -1
  17. package/dist/components/dropdown/Dropdown.module.scss.cjs +1 -1
  18. package/dist/components/dropdown/Dropdown.module.scss.js +19 -18
  19. package/dist/components/dropdown/Dropdown.module.scss.js.map +1 -1
  20. package/dist/components/empty-state/EmptyState.css +1 -1
  21. package/dist/components/empty-state/EmptyState.module.scss.cjs +1 -1
  22. package/dist/components/empty-state/EmptyState.module.scss.js +7 -7
  23. package/dist/components/icon-button/IconButton.css +1 -1
  24. package/dist/components/icon-button/IconButton.module.scss.cjs +1 -1
  25. package/dist/components/icon-button/IconButton.module.scss.js +16 -16
  26. package/dist/components/modal-header/ModalHeader.cjs +1 -1
  27. package/dist/components/modal-header/ModalHeader.cjs.map +1 -1
  28. package/dist/components/modal-header/ModalHeader.css +1 -1
  29. package/dist/components/modal-header/ModalHeader.d.ts.map +1 -1
  30. package/dist/components/modal-header/ModalHeader.js +50 -46
  31. package/dist/components/modal-header/ModalHeader.js.map +1 -1
  32. package/dist/components/modal-header/ModalHeader.module.scss.cjs +1 -1
  33. package/dist/components/modal-header/ModalHeader.module.scss.js +18 -17
  34. package/dist/components/modal-header/ModalHeader.module.scss.js.map +1 -1
  35. package/dist/components/password-input/PasswordInput.cjs +1 -1
  36. package/dist/components/password-input/PasswordInput.cjs.map +1 -1
  37. package/dist/components/password-input/PasswordInput.d.ts +11 -3
  38. package/dist/components/password-input/PasswordInput.d.ts.map +1 -1
  39. package/dist/components/password-input/PasswordInput.js +68 -67
  40. package/dist/components/password-input/PasswordInput.js.map +1 -1
  41. package/dist/components/right-sidebar-header/RightSidebarHeader.cjs +1 -1
  42. package/dist/components/right-sidebar-header/RightSidebarHeader.cjs.map +1 -1
  43. package/dist/components/right-sidebar-header/RightSidebarHeader.css +1 -1
  44. package/dist/components/right-sidebar-header/RightSidebarHeader.d.ts +10 -3
  45. package/dist/components/right-sidebar-header/RightSidebarHeader.d.ts.map +1 -1
  46. package/dist/components/right-sidebar-header/RightSidebarHeader.js +88 -66
  47. package/dist/components/right-sidebar-header/RightSidebarHeader.js.map +1 -1
  48. package/dist/components/right-sidebar-header/RightSidebarHeader.module.scss.cjs +1 -1
  49. package/dist/components/right-sidebar-header/RightSidebarHeader.module.scss.js +13 -12
  50. package/dist/components/right-sidebar-header/RightSidebarHeader.module.scss.js.map +1 -1
  51. package/dist/components/tile-button/TileButton.css +1 -1
  52. package/dist/components/tile-button/TileButton.module.scss.cjs +1 -1
  53. package/dist/components/tile-button/TileButton.module.scss.js +6 -6
  54. package/package.json +3 -3
@@ -1,55 +1,55 @@
1
- import { jsxs as M, jsx as a } from "react/jsx-runtime";
2
- import { forwardRef as Mr, useId as Ir, useRef as O, useCallback as d, useState as I, useMemo as V, useEffect as de } from "react";
3
- import __Vr from "@mattermost/compass-icons/components/chevron-down.js";const Vr=__Vr&&__Vr.default?__Vr.default:__Vr;
4
- import __Rr from "@mattermost/compass-icons/components/close-circle.js";const Rr=__Rr&&__Rr.default?__Rr.default:__Rr;
5
- import __Sr from "@mattermost/compass-icons/components/plus.js";const Sr=__Sr&&__Sr.default?__Sr.default:__Sr;
6
- import Er from "../chip/Chip.js";
7
- import Tr from "../chip/ChipGroup.js";
8
- import me, { IconSlotContext as Lr } from "../icon/Icon.js";
1
+ import { jsxs as M, jsx as l } from "react/jsx-runtime";
2
+ import { forwardRef as wr, useId as Mr, useRef as O, useCallback as d, useState as I, useMemo as V, useEffect as de } from "react";
3
+ import __Ir from "@mattermost/compass-icons/components/chevron-down.js";const Ir=__Ir&&__Ir.default?__Ir.default:__Ir;
4
+ import __Vr from "@mattermost/compass-icons/components/close-circle.js";const Vr=__Vr&&__Vr.default?__Vr.default:__Vr;
5
+ import __Er from "@mattermost/compass-icons/components/plus.js";const Er=__Er&&__Er.default?__Er.default:__Er;
6
+ import Rr from "../chip/Chip.js";
7
+ import Sr from "../chip/ChipGroup.js";
8
+ import me, { IconSlotContext as Tr } from "../icon/Icon.js";
9
9
  import Te from "../menu-item/MenuItem.js";
10
- import Fr, { PopoverMenuScroll as zr } from "../popover-menu/PopoverMenu.js";
11
- import Cr from "../spinner/Spinner.js";
12
- import Hr from "../team-avatar/TeamAvatar.js";
13
- import $r from "../user-avatar/UserAvatar.js";
14
- import { useAnchoredPopupPortal as Or } from "../../hooks/use-anchored-popup-portal.js";
15
- import { useOutsideClose as jr } from "../../hooks/use-outside-close.js";
16
- import { usePopoverTransition as Ur } from "../../hooks/use-popover-transition.js";
17
- import { mergeMenuItemProps as qr } from "../../utils/menuItemProps.js";
18
- import { mergeClassNames as Gr } from "../../utils/props.js";
19
- import { toKebab as Qr } from "../../utils/string.js";
10
+ import Lr, { PopoverMenuScroll as Fr } from "../popover-menu/PopoverMenu.js";
11
+ import zr from "../spinner/Spinner.js";
12
+ import Cr from "../team-avatar/TeamAvatar.js";
13
+ import Hr from "../user-avatar/UserAvatar.js";
14
+ import { useAnchoredPopupPortal as $r } from "../../hooks/use-anchored-popup-portal.js";
15
+ import { useOutsideClose as Or } from "../../hooks/use-outside-close.js";
16
+ import { usePopoverTransition as jr } from "../../hooks/use-popover-transition.js";
17
+ import { mergeMenuItemProps as Ur } from "../../utils/menuItemProps.js";
18
+ import { mergeClassNames as qr } from "../../utils/props.js";
19
+ import { toKebab as Gr } from "../../utils/string.js";
20
20
  import o from "./Combobox.module.scss.js";
21
- const Le = 280, Xr = {
21
+ const Le = 280, Kr = {
22
22
  small: "small",
23
23
  medium: "medium",
24
24
  large: "large"
25
- }, Zr = {
25
+ }, Qr = {
26
26
  small: "12",
27
27
  medium: "16",
28
28
  large: "16"
29
29
  };
30
- function Pr(n) {
30
+ function Xr(n) {
31
31
  return typeof n == "string" ? `${n} selections` : "Selected";
32
32
  }
33
- function Wr(n) {
33
+ function Zr(n) {
34
34
  return `Create "${n}"`;
35
35
  }
36
36
  function W(n) {
37
37
  return n.kind === "option" && n.option.disabled === !0;
38
38
  }
39
- function Yr(n, b) {
40
- return b ? n.label.toLowerCase().includes(b.toLowerCase()) : !0;
39
+ function Wr(n, v) {
40
+ return v ? n.label.toLowerCase().includes(v.toLowerCase()) : !0;
41
41
  }
42
- function Jr(n) {
42
+ function Yr(n) {
43
43
  return n == null ? null : Array.isArray(n) ? n[0] ?? null : n === "" ? null : n;
44
44
  }
45
- function Kr(n) {
45
+ function Jr(n) {
46
46
  return n == null ? [] : Array.isArray(n) ? n : n === "" ? [] : [n];
47
47
  }
48
- function Br(n) {
48
+ function Pr(n) {
49
49
  if (n.leadingVisual != null) return n.leadingVisual;
50
50
  if (n.leadingAvatar != null)
51
- return /* @__PURE__ */ a(
52
- $r,
51
+ return /* @__PURE__ */ l(
52
+ Hr,
53
53
  {
54
54
  src: n.leadingAvatar.src,
55
55
  alt: n.leadingAvatar.alt,
@@ -57,8 +57,8 @@ function Br(n) {
57
57
  }
58
58
  );
59
59
  if (n.leadingTeamAvatar != null)
60
- return /* @__PURE__ */ a(
61
- Hr,
60
+ return /* @__PURE__ */ l(
61
+ Cr,
62
62
  {
63
63
  src: n.leadingTeamAvatar.src,
64
64
  initials: n.leadingTeamAvatar.initials ?? (n.leadingTeamAvatar.src ? void 0 : Array.from(n.label).slice(0, 2).join("")),
@@ -68,8 +68,8 @@ function Br(n) {
68
68
  }
69
69
  );
70
70
  }
71
- const yn = Mr(function({
72
- options: b,
71
+ const yn = wr(function({
72
+ options: v,
73
73
  menuItemProps: Fe,
74
74
  multiple: t = !1,
75
75
  value: be,
@@ -78,199 +78,199 @@ const yn = Mr(function({
78
78
  inputValue: Y,
79
79
  defaultInputValue: ze = "",
80
80
  onInputChange: u,
81
- label: w,
81
+ label: N,
82
82
  placeholder: Ce,
83
83
  leadingIcon: J,
84
- size: K = "medium",
84
+ size: P = "medium",
85
85
  invalid: he = !1,
86
- disabled: g = !1,
86
+ disabled: _ = !1,
87
87
  filter: U = !0,
88
88
  emptyMessage: He = "No results",
89
89
  loading: xe = !1,
90
90
  loadingMessage: $e = "Loading…",
91
91
  selectedOptions: k,
92
- creatable: R = !1,
92
+ creatable: E = !1,
93
93
  onCreateOption: B,
94
- formatCreateLabel: Oe = Wr,
94
+ formatCreateLabel: Oe = Zr,
95
95
  clearable: je = !1,
96
96
  openOnFocus: Ue = !1,
97
97
  clearLabel: qe = "Clear",
98
- clearButtonProps: p,
98
+ clearButtonProps: m,
99
99
  selectionsLabel: Ge,
100
- listboxLabel: Qe = "Options",
101
- className: Xe = "",
102
- id: Ze,
103
- "aria-label": _e,
104
- "aria-describedby": Pe,
100
+ listboxLabel: Ke = "Options",
101
+ className: Qe = "",
102
+ id: Xe,
103
+ "aria-label": ge,
104
+ "aria-describedby": Ze,
105
105
  required: We = !1,
106
106
  onFocus: ee,
107
107
  onBlur: re,
108
108
  onKeyDown: ne,
109
109
  portalContainer: Ye = null,
110
110
  zIndex: Je,
111
- ...Ke
112
- }, S) {
113
- const Be = Ir(), te = Ze ?? Be, E = `${te}-listbox`, le = O(null), ge = O(null), N = O(null), er = d(
111
+ ...Pe
112
+ }, R) {
113
+ const Be = Mr(), te = Xe ?? Be, S = `${te}-listbox`, ae = O(null), _e = O(null), D = O(null), er = d(
114
114
  (e) => {
115
- N.current = e, typeof S == "function" ? S(e) : S && (S.current = e);
115
+ D.current = e, typeof R == "function" ? R(e) : R && (R.current = e);
116
116
  },
117
- [S]
118
- ), ae = be !== void 0, [rr, nr] = I(() => ve !== void 0 ? ve : t ? [] : null), oe = ae ? be : rr, v = t ? null : Jr(oe), s = V(
119
- () => t ? Kr(oe) : [],
117
+ [R]
118
+ ), le = be !== void 0, [rr, nr] = I(() => ve !== void 0 ? ve : t ? [] : null), oe = le ? be : rr, h = t ? null : Yr(oe), i = V(
119
+ () => t ? Jr(oe) : [],
120
120
  [t, oe]
121
- ), m = Y !== void 0, [se, T] = I(ze), [c, pe] = I(!1), [tr, ye] = I(!1), [h, y] = I(-1), q = O(!1), L = O(null), Ae = d(
121
+ ), b = Y !== void 0, [ie, T] = I(ze), [c, ye] = I(!1), [tr, pe] = I(!1), [x, y] = I(-1), q = O(!1), L = O(null), Ae = d(
122
122
  (e) => {
123
- e !== h && (q.current = !0, y(e));
123
+ e !== x && (q.current = !0, y(e));
124
124
  },
125
- [h]
126
- ), [G, F] = I(null), Q = d(
127
- (e) => b.find((r) => r.value === e) ?? (k == null ? void 0 : k.find((r) => r.value === e)) ?? (R ? { value: e, label: e } : void 0),
128
- [b, k, R]
129
- ), X = V(
130
- () => v == null ? void 0 : Q(v),
131
- [Q, v]
132
- ), ie = m ? Y : t ? se : G !== null ? G : (X == null ? void 0 : X.label) ?? se, ce = m ? Y : t ? se : G !== null ? G : "", z = d(
125
+ [x]
126
+ ), [G, F] = I(null), K = d(
127
+ (e) => v.find((r) => r.value === e) ?? (k == null ? void 0 : k.find((r) => r.value === e)) ?? (E ? { value: e, label: e } : void 0),
128
+ [v, k, E]
129
+ ), Q = V(
130
+ () => h == null ? void 0 : K(h),
131
+ [K, h]
132
+ ), se = b ? Y : t ? ie : G !== null ? G : (Q == null ? void 0 : Q.label) ?? ie, ce = b ? Y : t ? ie : G !== null ? G : "", z = d(
133
133
  (e) => {
134
- m || (T(e), t || F(e)), u == null || u(e);
134
+ b || (T(e), t || F(e)), u == null || u(e);
135
135
  },
136
- [m, t, u]
137
- ), x = d(
136
+ [b, t, u]
137
+ ), g = d(
138
138
  (e) => {
139
- ae || nr(e), j == null || j(e);
139
+ le || nr(e), j == null || j(e);
140
140
  },
141
- [ae, j]
141
+ [le, j]
142
142
  ), ke = V(() => {
143
- if (U === !1) return b;
144
- const e = typeof U == "function" ? U : Yr;
145
- return b.filter((r) => e(r, ce));
146
- }, [b, U, ce]), C = R ? ce.trim() : "", Ne = V(() => {
143
+ if (U === !1) return v;
144
+ const e = typeof U == "function" ? U : Wr;
145
+ return v.filter((r) => e(r, ce));
146
+ }, [v, U, ce]), C = E ? ce.trim() : "", De = V(() => {
147
147
  if (C === "") return !1;
148
- const e = C.toLowerCase(), r = (f) => f.toLowerCase() === e;
149
- return [...b, ...k ?? []].some((f) => r(f.label) || r(f.value)) ? !1 : !(t ? s : v != null ? [v] : []).some(r);
148
+ const e = C.toLowerCase(), r = (A) => A.toLowerCase() === e;
149
+ return [...v, ...k ?? []].some((A) => r(A.label) || r(A.value)) ? !1 : !(t ? i : h != null ? [h] : []).some(r);
150
150
  }, [
151
151
  C,
152
- b,
152
+ v,
153
153
  k,
154
154
  t,
155
- s,
156
- v
157
- ]), i = V(
155
+ i,
156
+ h
157
+ ]), s = V(
158
158
  () => [
159
159
  ...ke.map((e) => ({ kind: "option", option: e })),
160
- ...Ne ? [{ kind: "create", inputValue: C }] : []
160
+ ...De ? [{ kind: "create", inputValue: C }] : []
161
161
  ],
162
- [ke, Ne, C]
163
- ), D = d(
164
- (e) => e.kind === "option" ? `${E}-option-${e.option.value}` : `${E}-create`,
165
- [E]
166
- ), { mounted: we, visible: lr } = Ur(c), {
167
- placement: ar,
162
+ [ke, De, C]
163
+ ), w = d(
164
+ (e) => e.kind === "option" ? `${S}-option-${e.option.value}` : `${S}-create`,
165
+ [S]
166
+ ), { mounted: Ne, visible: ar } = jr(c), {
167
+ placement: lr,
168
168
  maxHeight: or,
169
- style: sr,
170
- portalRef: De,
171
- renderPortal: ir
172
- } = Or(ge, we, {
169
+ style: ir,
170
+ portalRef: we,
171
+ renderPortal: sr
172
+ } = $r(_e, Ne, {
173
173
  preferredHeight: Le,
174
174
  maxHeightCap: Le,
175
175
  portalContainer: Ye,
176
176
  zIndex: Je
177
- }), A = d(() => {
178
- pe(!1), y(-1), !t && !m && (F(null), T(""));
179
- }, [t, m]), H = d(() => {
180
- g || pe(!0);
181
- }, [g]);
182
- jr(le, c, A, De), de(() => {
177
+ }), p = d(() => {
178
+ ye(!1), y(-1), !t && !b && (F(null), T(""));
179
+ }, [t, b]), H = d(() => {
180
+ _ || ye(!0);
181
+ }, [_]);
182
+ Or(ae, c, p, we), de(() => {
183
183
  c && y((e) => {
184
- if (i.length === 0) return -1;
185
- if (e >= 0 && e < i.length) return e;
186
- const r = i.findIndex(
187
- (l) => l.kind === "option" && (t ? s.includes(l.option.value) : l.option.value === v)
184
+ if (s.length === 0) return -1;
185
+ if (e >= 0 && e < s.length) return e;
186
+ const r = s.findIndex(
187
+ (a) => a.kind === "option" && (t ? i.includes(a.option.value) : a.option.value === h)
188
188
  );
189
189
  return r >= 0 ? r : 0;
190
190
  });
191
- }, [c, i, t, s, v]);
191
+ }, [c, s, t, i, h]);
192
192
  const cr = d(
193
- (e) => t ? s.includes(e) : v === e,
194
- [t, s, v]
193
+ (e) => t ? i.includes(e) : h === e,
194
+ [t, i, h]
195
195
  ), ue = d(
196
196
  (e) => {
197
197
  var r;
198
198
  if (!e.disabled) {
199
199
  if (t) {
200
- const l = s.includes(e.value) ? s.filter((_) => _ !== e.value) : [...s, e.value];
201
- x(l), z(""), A(), (r = N.current) == null || r.focus();
200
+ const a = i.includes(e.value) ? i.filter((f) => f !== e.value) : [...i, e.value];
201
+ g(a), z(""), p(), (r = D.current) == null || r.focus();
202
202
  return;
203
203
  }
204
- x(e.value), m ? u == null || u(e.label) : (T(""), F(null)), A();
204
+ g(e.value), b ? u == null || u(e.label) : (T(""), F(null)), p();
205
205
  }
206
206
  },
207
207
  [
208
208
  t,
209
- s,
210
- x,
209
+ i,
210
+ g,
211
211
  z,
212
- m,
212
+ b,
213
213
  u,
214
- A
214
+ p
215
215
  ]
216
216
  ), fe = d(
217
217
  (e) => {
218
218
  var r;
219
- if (B ? B(e) : x(t ? [...s, e] : e), t) {
220
- z(""), A(), (r = N.current) == null || r.focus();
219
+ if (B ? B(e) : g(t ? [...i, e] : e), t) {
220
+ z(""), p(), (r = D.current) == null || r.focus();
221
221
  return;
222
222
  }
223
- m ? u == null || u(e) : (T(""), F(null)), A();
223
+ b ? u == null || u(e) : (T(""), F(null)), p();
224
224
  },
225
225
  [
226
226
  B,
227
227
  t,
228
- s,
229
- x,
228
+ i,
229
+ g,
230
230
  z,
231
- m,
231
+ b,
232
232
  u,
233
- A
233
+ p
234
234
  ]
235
235
  ), ur = d(
236
236
  (e) => {
237
237
  e.kind === "create" ? fe(e.inputValue) : ue(e.option);
238
238
  },
239
239
  [fe, ue]
240
- ), fr = d(() => {
240
+ ), Me = d(() => {
241
241
  var e;
242
- x(null), m ? u == null || u("") : (T(""), F(null)), (e = N.current) == null || e.focus();
243
- }, [x, m, u]), Me = d(
242
+ g(null), b ? u == null || u("") : (T(""), F(null)), (e = D.current) == null || e.focus();
243
+ }, [g, b, u]), Ie = d(
244
244
  (e) => {
245
- t && x(s.filter((r) => r !== e));
245
+ t && g(i.filter((r) => r !== e));
246
246
  },
247
- [t, s, x]
248
- ), Ie = d(
247
+ [t, i, g]
248
+ ), Ve = d(
249
249
  (e) => {
250
250
  q.current = !1;
251
- const r = i.map((l, _) => ({ row: l, i: _ })).filter(({ row: l }) => !W(l));
251
+ const r = s.map((a, f) => ({ row: a, i: f })).filter(({ row: a }) => !W(a));
252
252
  if (r.length === 0) {
253
253
  y(-1);
254
254
  return;
255
255
  }
256
- y((l) => {
257
- const _ = r.findIndex(({ i: P }) => P === l), f = _ < 0 ? e > 0 ? 0 : r.length - 1 : (_ + e + r.length) % r.length;
258
- return r[f].i;
256
+ y((a) => {
257
+ const f = r.findIndex(({ i: Z }) => Z === a), A = f < 0 ? e > 0 ? 0 : r.length - 1 : (f + e + r.length) % r.length;
258
+ return r[A].i;
259
259
  });
260
260
  },
261
- [i]
261
+ [s]
262
262
  );
263
263
  de(() => {
264
- var r, l;
265
- if (!c || h < 0) return;
264
+ var r, a;
265
+ if (!c || x < 0) return;
266
266
  if (q.current) {
267
267
  q.current = !1;
268
268
  return;
269
269
  }
270
- const e = i[h];
271
- e && ((l = (r = document.getElementById(D(e))) == null ? void 0 : r.scrollIntoView) == null || l.call(r, { block: "nearest" }));
272
- }, [c, h, i, D]);
273
- const dr = (e) => {
270
+ const e = s[x];
271
+ e && ((a = (r = document.getElementById(w(e))) == null ? void 0 : r.scrollIntoView) == null || a.call(r, { block: "nearest" }));
272
+ }, [c, x, s, w]);
273
+ const fr = (e) => {
274
274
  $();
275
275
  const r = e.target.value;
276
276
  z(r), c || H(), y(0);
@@ -278,27 +278,27 @@ const yn = Mr(function({
278
278
  L.current !== null && (cancelAnimationFrame(L.current), L.current = null);
279
279
  };
280
280
  de(() => $, []);
281
- const mr = () => {
282
- ye(!0), Ue && H(), !t && !m && X && ($(), L.current = requestAnimationFrame(() => {
281
+ const dr = () => {
282
+ pe(!0), Ue && H(), !t && !b && Q && ($(), L.current = requestAnimationFrame(() => {
283
283
  var e;
284
- L.current = null, (e = N.current) == null || e.select();
284
+ L.current = null, (e = D.current) == null || e.select();
285
285
  }));
286
- }, Ve = (e) => {
287
- var l;
286
+ }, Ee = (e) => {
287
+ var a;
288
288
  const r = e.relatedTarget;
289
- r && ((l = le.current) != null && l.contains(r)) || ($(), ye(!1));
290
- }, br = (e) => {
291
- if (!g)
289
+ r && ((a = ae.current) != null && a.contains(r)) || ($(), pe(!1));
290
+ }, mr = (e) => {
291
+ if (!_)
292
292
  switch ($(), e.key) {
293
293
  case "ArrowDown":
294
- e.preventDefault(), c ? Ie(1) : H();
294
+ e.preventDefault(), c ? Ve(1) : H();
295
295
  break;
296
296
  case "ArrowUp":
297
297
  if (e.preventDefault(), c)
298
- Ie(-1);
298
+ Ve(-1);
299
299
  else {
300
- for (let r = i.length - 1; r >= 0; r--)
301
- if (!W(i[r])) {
300
+ for (let r = s.length - 1; r >= 0; r--)
301
+ if (!W(s[r])) {
302
302
  y(r);
303
303
  break;
304
304
  }
@@ -306,99 +306,103 @@ const yn = Mr(function({
306
306
  }
307
307
  break;
308
308
  case "Home":
309
- c && i.length > 0 && (e.preventDefault(), y(
309
+ c && s.length > 0 && (e.preventDefault(), y(
310
310
  Math.max(
311
311
  0,
312
- i.findIndex((r) => !W(r))
312
+ s.findIndex((r) => !W(r))
313
313
  )
314
314
  ));
315
315
  break;
316
316
  case "End":
317
- if (c && i.length > 0) {
317
+ if (c && s.length > 0) {
318
318
  e.preventDefault();
319
- for (let r = i.length - 1; r >= 0; r--)
320
- if (!W(i[r])) {
319
+ for (let r = s.length - 1; r >= 0; r--)
320
+ if (!W(s[r])) {
321
321
  y(r);
322
322
  break;
323
323
  }
324
324
  }
325
325
  break;
326
326
  case "Enter":
327
- c && h >= 0 && i[h] && (e.preventDefault(), ur(i[h]));
327
+ c && x >= 0 && s[x] && (e.preventDefault(), e.stopPropagation(), ur(s[x]));
328
328
  break;
329
329
  case "Escape":
330
- c && (e.preventDefault(), A());
330
+ c && (e.preventDefault(), e.stopPropagation(), p());
331
331
  break;
332
332
  case "Backspace":
333
- t && ie === "" && s.length > 0 && (e.preventDefault(), Me(s[s.length - 1]));
333
+ t && se === "" && i.length > 0 && (e.preventDefault(), Ie(i[i.length - 1]));
334
334
  break;
335
335
  case "Tab":
336
- A();
336
+ p();
337
337
  break;
338
338
  }
339
+ }, br = (e) => {
340
+ dr(), ee == null || ee(e);
339
341
  }, vr = (e) => {
340
- mr(), ee == null || ee(e);
342
+ Ee(e), re == null || re(e);
341
343
  }, hr = (e) => {
342
- Ve(e), re == null || re(e);
344
+ mr(e), ne == null || ne(e);
343
345
  }, xr = (e) => {
344
- br(e), ne == null || ne(e);
345
- }, _r = (e) => {
346
346
  var r;
347
- g || e.target.closest("[data-chip], [data-combobox-clear]") || (e.target !== N.current && (e.preventDefault(), (r = N.current) == null || r.focus()), c || H());
348
- }, Re = t ? s.length > 0 : v != null && v !== "", gr = ie.length > 0, pr = je && !t && Re && !g, yr = tr || c || Re || gr, Se = h >= 0 ? i[h] : void 0, Ar = Se != null ? D(Se) : void 0, Z = V(() => {
347
+ _ || e.target.closest("[data-chip], [data-combobox-clear]") || (e.target !== D.current && (e.preventDefault(), (r = D.current) == null || r.focus()), c || H());
348
+ }, gr = (e) => {
349
+ e.target.closest(
350
+ 'input, textarea, select, [contenteditable="true"]'
351
+ ) || e.preventDefault();
352
+ }, Re = t ? i.length > 0 : h != null && h !== "", _r = se.length > 0, yr = je && !t && Re && !_, pr = tr || c || Re || _r, Se = x >= 0 ? s[x] : void 0, Ar = Se != null ? w(Se) : void 0, X = V(() => {
349
353
  if (!t) return [];
350
354
  if (k == null) {
351
- const e = b.filter((l) => s.includes(l.value));
352
- if (!R) return e;
353
- const r = new Set(e.map((l) => l.value));
355
+ const e = v.filter((a) => i.includes(a.value));
356
+ if (!E) return e;
357
+ const r = new Set(e.map((a) => a.value));
354
358
  return [
355
359
  ...e,
356
- ...s.filter((l) => !r.has(l)).map((l) => ({ value: l, label: l }))
360
+ ...i.filter((a) => !r.has(a)).map((a) => ({ value: a, label: a }))
357
361
  ];
358
362
  }
359
- return s.map(Q).filter((e) => e != null);
363
+ return i.map(K).filter((e) => e != null);
360
364
  }, [
361
365
  t,
362
366
  k,
363
- b,
364
- s,
365
- R,
366
- Q
367
- ]), kr = o[`combobox--size-${Qr(K)}`], Nr = t && Z.length > 0, wr = [
367
+ v,
368
+ i,
369
+ E,
370
+ K
371
+ ]), kr = o[`combobox--size-${Gr(P)}`], Dr = t && X.length > 0, Nr = [
368
372
  o.combobox,
369
373
  kr,
370
374
  he ? o["combobox--invalid"] : "",
371
- w != null && yr ? o["combobox--label-floated"] : "",
375
+ N != null && pr ? o["combobox--label-floated"] : "",
372
376
  J != null ? o["combobox--has-leading-icon"] : "",
373
- Nr ? o["combobox--has-chips"] : "",
377
+ Dr ? o["combobox--has-chips"] : "",
374
378
  c ? o["combobox--open"] : "",
375
- g ? o["combobox--disabled"] : "",
376
- Xe
379
+ _ ? o["combobox--disabled"] : "",
380
+ Qe
377
381
  ].filter(Boolean).join(" ");
378
- return /* @__PURE__ */ M("div", { className: wr, ref: le, children: [
379
- /* @__PURE__ */ M("div", { className: o.combobox__wrapper, ref: ge, children: [
380
- w != null && /* @__PURE__ */ a("label", { className: o.combobox__label, htmlFor: te, children: w }),
382
+ return /* @__PURE__ */ M("div", { className: Nr, ref: ae, children: [
383
+ /* @__PURE__ */ M("div", { className: o.combobox__wrapper, ref: _e, children: [
384
+ N != null && /* @__PURE__ */ l("label", { className: o.combobox__label, htmlFor: te, children: N }),
381
385
  /* @__PURE__ */ M(
382
386
  "div",
383
387
  {
384
388
  className: o.combobox__inner,
385
- onMouseDown: _r,
389
+ onMouseDown: xr,
386
390
  children: [
387
- J != null && /* @__PURE__ */ a("span", { className: o["combobox__leading-icon"], "aria-hidden": !0, children: /* @__PURE__ */ a(Lr.Provider, { value: { size: "16" }, children: J }) }),
391
+ J != null && /* @__PURE__ */ l("span", { className: o["combobox__leading-icon"], "aria-hidden": !0, children: /* @__PURE__ */ l(Tr.Provider, { value: { size: "16" }, children: J }) }),
388
392
  /* @__PURE__ */ M("div", { className: o.combobox__value, children: [
389
- t && Z.length > 0 && /* @__PURE__ */ a(
390
- Tr,
393
+ t && X.length > 0 && /* @__PURE__ */ l(
394
+ Sr,
391
395
  {
392
- "aria-label": Ge ?? Pr(w),
393
- disabled: g,
394
- children: Z.map((e) => /* @__PURE__ */ a(
395
- Er,
396
+ "aria-label": Ge ?? Xr(N),
397
+ disabled: _,
398
+ children: X.map((e) => /* @__PURE__ */ l(
399
+ Rr,
396
400
  {
397
- size: Xr[K],
401
+ size: Kr[P],
398
402
  leadingAvatar: e.leadingAvatar,
399
403
  leadingIcon: e.leadingAvatar == null ? e.leadingVisual : void 0,
400
- onRemove: g ? void 0 : (r) => {
401
- r.stopPropagation(), Me(e.value);
404
+ onRemove: _ ? void 0 : (r) => {
405
+ r.stopPropagation(), Ie(e.value);
402
406
  },
403
407
  children: e.label
404
408
  },
@@ -406,10 +410,10 @@ const yn = Mr(function({
406
410
  ))
407
411
  }
408
412
  ),
409
- /* @__PURE__ */ a(
413
+ /* @__PURE__ */ l(
410
414
  "input",
411
415
  {
412
- ...Ke,
416
+ ...Pe,
413
417
  ref: er,
414
418
  id: te,
415
419
  className: o.combobox__control,
@@ -417,120 +421,122 @@ const yn = Mr(function({
417
421
  role: "combobox",
418
422
  autoComplete: "off",
419
423
  spellCheck: !1,
420
- disabled: g,
421
- placeholder: t && Z.length > 0 ? void 0 : Ce,
422
- value: ie,
423
- "aria-label": _e,
424
- "aria-describedby": Pe || void 0,
424
+ disabled: _,
425
+ placeholder: t && X.length > 0 ? void 0 : Ce,
426
+ value: se,
427
+ "aria-label": ge,
428
+ "aria-describedby": Ze || void 0,
425
429
  "aria-required": We ? !0 : void 0,
426
430
  "aria-invalid": he ? !0 : void 0,
427
431
  "aria-expanded": c,
428
- "aria-controls": E,
432
+ "aria-controls": S,
429
433
  "aria-autocomplete": "list",
430
434
  "aria-activedescendant": Ar,
431
435
  "aria-busy": xe || void 0,
432
- onChange: dr,
433
- onFocus: vr,
434
- onBlur: hr,
435
- onKeyDown: xr
436
+ onChange: fr,
437
+ onFocus: br,
438
+ onBlur: vr,
439
+ onKeyDown: hr
436
440
  }
437
441
  )
438
442
  ] }),
439
- pr && /* @__PURE__ */ a(
443
+ yr && /* @__PURE__ */ l(
440
444
  "button",
441
445
  {
442
- ...p,
446
+ ...m,
443
447
  type: "button",
444
- className: Gr(
448
+ className: qr(
445
449
  o.combobox__clear,
446
- p == null ? void 0 : p.className
450
+ m == null ? void 0 : m.className
447
451
  ),
448
452
  "aria-label": qe,
449
453
  "data-combobox-clear": "",
450
- onClick: fr,
454
+ onClick: Me,
455
+ onKeyDown: (e) => {
456
+ var r;
457
+ e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), Me()), (r = m == null ? void 0 : m.onKeyDown) == null || r.call(m, e);
458
+ },
451
459
  onBlur: (e) => {
452
460
  var r;
453
- (r = p == null ? void 0 : p.onBlur) == null || r.call(p, e), Ve(e);
461
+ (r = m == null ? void 0 : m.onBlur) == null || r.call(m, e), Ee(e);
454
462
  },
455
- children: /* @__PURE__ */ a(me, { size: Zr[K], glyph: /* @__PURE__ */ a(Rr, {}) })
463
+ children: /* @__PURE__ */ l(me, { size: Qr[P], glyph: /* @__PURE__ */ l(Vr, {}) })
456
464
  }
457
465
  ),
458
- /* @__PURE__ */ a("span", { className: o["combobox__trailing-icon"], "aria-hidden": !0, children: /* @__PURE__ */ a(me, { size: "12", glyph: /* @__PURE__ */ a(Vr, {}) }) })
466
+ /* @__PURE__ */ l("span", { className: o["combobox__trailing-icon"], "aria-hidden": !0, children: /* @__PURE__ */ l(me, { size: "12", glyph: /* @__PURE__ */ l(Ir, {}) }) })
459
467
  ]
460
468
  }
461
469
  )
462
470
  ] }),
463
- we && ir(
464
- /* @__PURE__ */ a(
471
+ Ne && sr(
472
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions -- keeps focus on the input for presses anywhere in the menu
473
+ /* @__PURE__ */ l(
465
474
  "div",
466
475
  {
467
- ref: De,
476
+ ref: we,
468
477
  className: [
469
478
  o.combobox__popup,
470
- ar === "above" ? o["combobox__popup--above"] : "",
471
- lr ? o["combobox__popup--visible"] : ""
479
+ lr === "above" ? o["combobox__popup--above"] : "",
480
+ ar ? o["combobox__popup--visible"] : ""
472
481
  ].filter(Boolean).join(" "),
473
- style: sr,
474
- children: /* @__PURE__ */ a(Fr, { className: o.combobox__menu, children: /* @__PURE__ */ M(zr, { maxHeight: or, children: [
475
- i.length > 0 && /* @__PURE__ */ a(
482
+ style: ir,
483
+ onMouseDown: gr,
484
+ children: /* @__PURE__ */ l(Lr, { className: o.combobox__menu, children: /* @__PURE__ */ M(Fr, { maxHeight: or, children: [
485
+ s.length > 0 && /* @__PURE__ */ l(
476
486
  "ul",
477
487
  {
478
- id: E,
488
+ id: S,
479
489
  className: o.combobox__list,
480
490
  role: "listbox",
481
491
  "aria-multiselectable": t || void 0,
482
- "aria-label": typeof w == "string" ? w : _e ?? Qe,
483
- children: i.map((e, r) => {
484
- const l = r === h, _ = (Dr) => {
485
- Dr.preventDefault();
486
- };
492
+ "aria-label": typeof N == "string" ? N : ge ?? Ke,
493
+ children: s.map((e, r) => {
494
+ const a = r === x;
487
495
  if (e.kind === "create")
488
- return /* @__PURE__ */ a(
496
+ return /* @__PURE__ */ l(
489
497
  "li",
490
498
  {
491
499
  className: o.combobox__option,
492
500
  role: "presentation",
493
- children: /* @__PURE__ */ a(
501
+ children: /* @__PURE__ */ l(
494
502
  Te,
495
503
  {
496
- id: D(e),
504
+ id: w(e),
497
505
  role: "option",
498
506
  label: Oe(e.inputValue),
499
- leadingVisual: /* @__PURE__ */ a(me, { glyph: /* @__PURE__ */ a(Sr, {}) }),
500
- active: l,
507
+ leadingVisual: /* @__PURE__ */ l(me, { glyph: /* @__PURE__ */ l(Er, {}) }),
508
+ active: a,
501
509
  "aria-selected": !1,
502
- onMouseDown: _,
503
510
  onMouseEnter: () => Ae(r),
504
511
  onClick: () => fe(e.inputValue)
505
512
  }
506
513
  )
507
514
  },
508
- D(e)
515
+ w(e)
509
516
  );
510
- const { option: f } = e, P = cr(f.value), Ee = Br(f);
511
- return /* @__PURE__ */ a(
517
+ const { option: f } = e, A = cr(f.value), Z = Pr(f);
518
+ return /* @__PURE__ */ l(
512
519
  "li",
513
520
  {
514
521
  className: o.combobox__option,
515
522
  role: "presentation",
516
- children: /* @__PURE__ */ a(
523
+ children: /* @__PURE__ */ l(
517
524
  Te,
518
525
  {
519
- ...qr(
526
+ ...Ur(
520
527
  Fe,
521
528
  f.menuItemProps
522
529
  ),
523
- id: D(e),
530
+ id: w(e),
524
531
  role: "option",
525
532
  label: f.label,
526
533
  secondaryLabel: f.secondaryLabel,
527
- leadingElement: Ee != null,
528
- leadingVisual: Ee,
529
- trailingElement: P,
530
- active: l,
534
+ leadingElement: Z != null,
535
+ leadingVisual: Z,
536
+ trailingElement: A,
537
+ active: a,
531
538
  disabled: f.disabled,
532
- "aria-selected": P,
533
- onMouseDown: _,
539
+ "aria-selected": A,
534
540
  onMouseEnter: () => Ae(r),
535
541
  onClick: () => ue(f)
536
542
  }
@@ -542,9 +548,9 @@ const yn = Mr(function({
542
548
  }
543
549
  ),
544
550
  xe ? /* @__PURE__ */ M("div", { className: o.combobox__loading, role: "status", children: [
545
- /* @__PURE__ */ a(Cr, { size: "16", "aria-hidden": !0 }),
546
- /* @__PURE__ */ a("span", { children: $e })
547
- ] }) : i.length === 0 && /* @__PURE__ */ a("p", { className: o.combobox__empty, children: He })
551
+ /* @__PURE__ */ l(zr, { size: "16", "aria-hidden": !0 }),
552
+ /* @__PURE__ */ l("span", { children: $e })
553
+ ] }) : s.length === 0 && /* @__PURE__ */ l("p", { className: o.combobox__empty, children: He })
548
554
  ] }) })
549
555
  }
550
556
  )