@mattermost/compass-ui 0.1.0-alpha.14 → 0.1.0-alpha.16

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