@mattermost/compass-ui 0.1.0-alpha.20 → 0.1.0-alpha.21

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