@televet/kibble-ui 5.0.2-beta.menu.6 → 5.0.2-beta.menu.8

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 (69) hide show
  1. package/dist/chunks/{avatarGroup.component-BtMv6hWl.js → avatarGroup.component-CBvvdf0q.js} +2 -2
  2. package/dist/chunks/{avatarGroup.component-BtMv6hWl.js.map → avatarGroup.component-CBvvdf0q.js.map} +1 -1
  3. package/dist/chunks/{avatarGroup.component-B8TVZvFj.js → avatarGroup.component-COjOeEzP.js} +2 -2
  4. package/dist/chunks/{avatarGroup.component-B8TVZvFj.js.map → avatarGroup.component-COjOeEzP.js.map} +1 -1
  5. package/dist/chunks/{buttonGroup.component-BsvuFO8J.js → buttonGroup.component-o5tkiXFo.js} +2 -2
  6. package/dist/chunks/{buttonGroup.component-BsvuFO8J.js.map → buttonGroup.component-o5tkiXFo.js.map} +1 -1
  7. package/dist/chunks/{buttonGroup.component-DEaBDzIa.js → buttonGroup.component-w2gD_tRa.js} +2 -2
  8. package/dist/chunks/{buttonGroup.component-DEaBDzIa.js.map → buttonGroup.component-w2gD_tRa.js.map} +1 -1
  9. package/dist/chunks/{calendar.component-biqw1Dvi.js → calendar.component-CGJ5x-Qv.js} +2 -2
  10. package/dist/chunks/{calendar.component-biqw1Dvi.js.map → calendar.component-CGJ5x-Qv.js.map} +1 -1
  11. package/dist/chunks/{calendar.component-CKwY0qD7.js → calendar.component-D4xLm7HX.js} +2 -2
  12. package/dist/chunks/{calendar.component-CKwY0qD7.js.map → calendar.component-D4xLm7HX.js.map} +1 -1
  13. package/dist/chunks/{conversationCard.component-CtqjuJ23.js → conversationCard.component-apjIrjQm.js} +2 -2
  14. package/dist/chunks/{conversationCard.component-CtqjuJ23.js.map → conversationCard.component-apjIrjQm.js.map} +1 -1
  15. package/dist/chunks/{conversationCard.component-BNtsyxWI.js → conversationCard.component-iKr4a8HY.js} +2 -2
  16. package/dist/chunks/{conversationCard.component-BNtsyxWI.js.map → conversationCard.component-iKr4a8HY.js.map} +1 -1
  17. package/dist/chunks/{datePicker.component-GqXczD5i.js → datePicker.component-Akxu5prm.js} +2 -2
  18. package/dist/chunks/{datePicker.component-GqXczD5i.js.map → datePicker.component-Akxu5prm.js.map} +1 -1
  19. package/dist/chunks/{datePicker.component-Zw6oktPN.js → datePicker.component-Dge05iNR.js} +2 -2
  20. package/dist/chunks/{datePicker.component-Zw6oktPN.js.map → datePicker.component-Dge05iNR.js.map} +1 -1
  21. package/dist/chunks/{datePicker.provider-CMBqTY-y.js → datePicker.provider-C0ZPlS_w.js} +2 -2
  22. package/dist/chunks/{datePicker.provider-CMBqTY-y.js.map → datePicker.provider-C0ZPlS_w.js.map} +1 -1
  23. package/dist/chunks/{datePicker.provider-0NYqU17z.js → datePicker.provider-DRLTY1WB.js} +2 -2
  24. package/dist/chunks/{datePicker.provider-0NYqU17z.js.map → datePicker.provider-DRLTY1WB.js.map} +1 -1
  25. package/dist/chunks/{dateTimePicker.component-YQ2T3Rwt.js → dateTimePicker.component-B4PptH6R.js} +2 -2
  26. package/dist/chunks/{dateTimePicker.component-YQ2T3Rwt.js.map → dateTimePicker.component-B4PptH6R.js.map} +1 -1
  27. package/dist/chunks/{dateTimePicker.component-P2E3fvYb.js → dateTimePicker.component-DwxiI40o.js} +2 -2
  28. package/dist/chunks/{dateTimePicker.component-P2E3fvYb.js.map → dateTimePicker.component-DwxiI40o.js.map} +1 -1
  29. package/dist/chunks/menu.component-BIFydd_a.js +708 -0
  30. package/dist/chunks/menu.component-BIFydd_a.js.map +1 -0
  31. package/dist/chunks/menu.component-Di98aPH0.js +2 -0
  32. package/dist/chunks/menu.component-Di98aPH0.js.map +1 -0
  33. package/dist/chunks/{radioGroup.types-DESgrVjt.js → radioGroup.types-Dy1foOMp.js} +2 -2
  34. package/dist/chunks/{radioGroup.types-DESgrVjt.js.map → radioGroup.types-Dy1foOMp.js.map} +1 -1
  35. package/dist/chunks/{radioGroup.types-D4W2Gkw7.js → radioGroup.types-pv_55Qu5.js} +2 -2
  36. package/dist/chunks/{radioGroup.types-D4W2Gkw7.js.map → radioGroup.types-pv_55Qu5.js.map} +1 -1
  37. package/dist/chunks/{tagBlock.component-CdLWIWut.js → tagBlock.component-B_9Y9Mrj.js} +2 -2
  38. package/dist/chunks/{tagBlock.component-CdLWIWut.js.map → tagBlock.component-B_9Y9Mrj.js.map} +1 -1
  39. package/dist/chunks/{tagBlock.component-pMRnarH1.js → tagBlock.component-CEjuZKgL.js} +2 -2
  40. package/dist/chunks/{tagBlock.component-pMRnarH1.js.map → tagBlock.component-CEjuZKgL.js.map} +1 -1
  41. package/dist/cjs/components/AvatarGroup/index.cjs +1 -1
  42. package/dist/cjs/components/ButtonGroup/index.cjs +1 -1
  43. package/dist/cjs/components/Calendar/index.cjs +1 -1
  44. package/dist/cjs/components/ConversationCard/index.cjs +1 -1
  45. package/dist/cjs/components/DatePicker/index.cjs +1 -1
  46. package/dist/cjs/components/DateTimePicker/index.cjs +1 -1
  47. package/dist/cjs/components/Menu/index.cjs +1 -1
  48. package/dist/cjs/components/RadioGroup/index.cjs +1 -1
  49. package/dist/cjs/components/TagBlock/index.cjs +1 -1
  50. package/dist/cjs/components/index.cjs +1 -1
  51. package/dist/cjs/index.cjs +1 -1
  52. package/dist/esm/components/AvatarGroup/index.js +1 -1
  53. package/dist/esm/components/ButtonGroup/index.js +1 -1
  54. package/dist/esm/components/Calendar/index.js +1 -1
  55. package/dist/esm/components/ConversationCard/index.js +1 -1
  56. package/dist/esm/components/DatePicker/index.js +2 -2
  57. package/dist/esm/components/DateTimePicker/index.js +1 -1
  58. package/dist/esm/components/Menu/index.js +1 -1
  59. package/dist/esm/components/RadioGroup/index.js +1 -1
  60. package/dist/esm/components/TagBlock/index.js +1 -1
  61. package/dist/esm/components/index.js +10 -10
  62. package/dist/esm/index.js +10 -10
  63. package/dist/types/components/Menu/components/MenuItem/menuItem.component.d.ts +1 -3
  64. package/dist/types/components/Menu/menu.component.d.ts +1 -2
  65. package/package.json +1 -1
  66. package/dist/chunks/menu.component-Cdgw5Ad_.js +0 -714
  67. package/dist/chunks/menu.component-Cdgw5Ad_.js.map +0 -1
  68. package/dist/chunks/menu.component-DcRZ3_PR.js +0 -2
  69. package/dist/chunks/menu.component-DcRZ3_PR.js.map +0 -1
@@ -0,0 +1,708 @@
1
+ import { j as e } from "./jsx-runtime-C5mzlN2N.js";
2
+ import st, { forwardRef as h, useEffect as B, useId as Y, useRef as le, useCallback as j, useState as L, useMemo as D } from "react";
3
+ import { B as T } from "./index-9BerxEcw.js";
4
+ import { B as Z } from "./button.component-BO6oee_V.js";
5
+ import { I as he } from "./icon.component-PV_nHBId.js";
6
+ import { W as ee } from "./text.component-CdTyTFds.js";
7
+ import { T as ge } from "./tooltip.component-C_NS-AoH.js";
8
+ import { F as z } from "./flex-CX-8gE9T.js";
9
+ import { W as ct } from "./textInput.component-BC0Hi8R_.js";
10
+ import { S as at } from "./spinner.component-B3dkvoO9.js";
11
+ import { u as it } from "./usePortalContentRef-DO_jc4W9.js";
12
+ import { u as te, s as fe, c as Me, d as Pe, P as ut } from "./index-C9UYIjEB.js";
13
+ import { c as lt } from "./create-slot-recipe-context-D_FXDJGp.js";
14
+ import { d as dt } from "./icons-CoSqruIn.js";
15
+ import { a as _, d as g, b as O, e as pt, u as mt, f as xt, g as ht, n as gt } from "./use-locale-context-Bw4Gg9Z0.js";
16
+ import { m as ft, c as Mt } from "./index-CbVKVxMW.js";
17
+ import { a6 as p } from "./index-fHSGm2nC.js";
18
+ import { W as Pt } from "./checkbox.component-DE35wBj-.js";
19
+ const [ve, m] = _({
20
+ name: "MenuContext",
21
+ hookName: "useMenuContext",
22
+ providerName: "<MenuProvider />",
23
+ strict: !1
24
+ }), je = h((o, n) => {
25
+ const t = m(), s = p(t.getArrowProps(), o);
26
+ return /* @__PURE__ */ e.jsx(g.div, { ...s, ref: n });
27
+ });
28
+ je.displayName = "MenuArrow";
29
+ const Ce = h((o, n) => {
30
+ const t = m(), s = p(t.getArrowTipProps(), o);
31
+ return /* @__PURE__ */ e.jsx(g.div, { ...s, ref: n });
32
+ });
33
+ Ce.displayName = "MenuArrowTip";
34
+ const [ne, Zt] = _({
35
+ name: "MenuItemContext",
36
+ hookName: "useMenuItemContext",
37
+ providerName: "<MenuItemProvider />"
38
+ }), [oe, Ie] = _({
39
+ name: "MenuItemPropsContext",
40
+ hookName: "useMenuItemPropsContext",
41
+ providerName: "<MenuItemPropsProvider />"
42
+ }), be = h((o, n) => {
43
+ const [t, s] = O()(o, [
44
+ "checked",
45
+ "closeOnSelect",
46
+ "disabled",
47
+ "onCheckedChange",
48
+ "value",
49
+ "valueText"
50
+ ]), c = {
51
+ ...t,
52
+ type: "checkbox"
53
+ }, u = m(), a = p(u.getOptionItemProps(c), s), i = u.getOptionItemState(c);
54
+ return /* @__PURE__ */ e.jsx(oe, { value: c, children: /* @__PURE__ */ e.jsx(ne, { value: i, children: /* @__PURE__ */ e.jsx(g.div, { ...a, ref: n }) }) });
55
+ });
56
+ be.displayName = "MenuCheckboxItem";
57
+ const ke = h((o, n) => {
58
+ const t = m(), s = te(), c = p(t.getContentProps(), s.getPresenceProps(), o);
59
+ return s.unmounted ? null : /* @__PURE__ */ e.jsx(g.div, { ...c, ref: pt(s.ref, n) });
60
+ });
61
+ ke.displayName = "MenuContent";
62
+ const Se = h((o, n) => {
63
+ const t = m(), s = p(t.getContextTriggerProps(), o);
64
+ return /* @__PURE__ */ e.jsx(g.button, { ...s, ref: n });
65
+ });
66
+ Se.displayName = "MenuContextTrigger";
67
+ const we = h((o, n) => {
68
+ const t = m(), s = p(t.getIndicatorProps(), o);
69
+ return /* @__PURE__ */ e.jsx(g.div, { ...s, ref: n });
70
+ });
71
+ we.displayName = "MenuIndicator";
72
+ const Ne = h((o, n) => {
73
+ const [t, s] = O()(o, [
74
+ "closeOnSelect",
75
+ "disabled",
76
+ "value",
77
+ "valueText",
78
+ "onSelect"
79
+ ]), c = m(), u = p(c.getItemProps(t), s), a = c.getItemState(t);
80
+ return B(() => c.addItemListener({ id: a.id, onSelect: t.onSelect }), [a.id, t.onSelect]), /* @__PURE__ */ e.jsx(oe, { value: t, children: /* @__PURE__ */ e.jsx(ne, { value: a, children: /* @__PURE__ */ e.jsx(g.div, { ...u, ref: n }) }) });
81
+ });
82
+ Ne.displayName = "MenuItem";
83
+ const [ye, Ae] = _({
84
+ name: "MenuItemGroupContext",
85
+ hookName: "useMenuItemGroupContext",
86
+ providerName: "<MenuItemGroupProvider />"
87
+ }), Te = h((o, n) => {
88
+ const [t, s] = O()(o, ["id"]), c = m(), a = { id: Y(), ...t }, i = p(c.getItemGroupProps(a), s);
89
+ return /* @__PURE__ */ e.jsx(ye, { value: a, children: /* @__PURE__ */ e.jsx(g.div, { ...i, ref: n }) });
90
+ });
91
+ Te.displayName = "MenuItemGroup";
92
+ const Ge = h((o, n) => {
93
+ const t = m(), s = Ae(), c = p(t.getItemGroupLabelProps({ htmlFor: s.id }), o);
94
+ return /* @__PURE__ */ e.jsx(g.div, { ...c, ref: n });
95
+ });
96
+ Ge.displayName = "MenuItemGroupLabel";
97
+ const _e = h((o, n) => {
98
+ const t = m(), s = Ie(), c = p(t.getItemIndicatorProps(s), o);
99
+ return /* @__PURE__ */ e.jsx(g.div, { ...c, ref: n });
100
+ });
101
+ _e.displayName = "MenuItemIndicator";
102
+ const Oe = h((o, n) => {
103
+ const t = m(), s = Ie(), c = p(t.getItemTextProps(s), o);
104
+ return /* @__PURE__ */ e.jsx(g.div, { ...c, ref: n });
105
+ });
106
+ Oe.displayName = "MenuItemText";
107
+ const $e = h((o, n) => {
108
+ const t = m(), s = p(t.getPositionerProps(), o);
109
+ return te().unmounted ? null : /* @__PURE__ */ e.jsx(g.div, { ...s, ref: n });
110
+ });
111
+ $e.displayName = "MenuPositioner";
112
+ const Re = h((o, n) => {
113
+ const [t, s] = O()(o, [
114
+ "closeOnSelect",
115
+ "disabled",
116
+ "value",
117
+ "valueText"
118
+ ]), c = m(), u = Ae(), a = {
119
+ ...t,
120
+ checked: u.value === t.value,
121
+ type: "radio",
122
+ onCheckedChange: () => u.onValueChange?.({ value: t.value })
123
+ }, i = p(c.getOptionItemProps(a), s), f = c.getOptionItemState(a);
124
+ return /* @__PURE__ */ e.jsx(oe, { value: a, children: /* @__PURE__ */ e.jsx(ne, { value: f, children: /* @__PURE__ */ e.jsx(g.div, { ...i, ref: n }) }) });
125
+ });
126
+ Re.displayName = "MenuRadioItem";
127
+ const Le = h((o, n) => {
128
+ const [t, s] = O()(o, [
129
+ "id",
130
+ "onValueChange",
131
+ "value"
132
+ ]), c = m(), a = { id: Y(), ...t }, i = p(c.getItemGroupProps({ id: a.id }), s);
133
+ return /* @__PURE__ */ e.jsx(ye, { value: a, children: /* @__PURE__ */ e.jsx(g.div, { ...i, ref: n }) });
134
+ });
135
+ Le.displayName = "MenuRadioItemGroup";
136
+ const Be = (o) => {
137
+ const n = le(o), t = le(!1);
138
+ B(() => {
139
+ n.current = o;
140
+ }), B(() => {
141
+ t.current !== !0 && (t.current = !0, n.current());
142
+ }, []);
143
+ }, vt = (o) => {
144
+ const n = Y(), { getRootNode: t } = mt(), { dir: s } = xt(), c = {
145
+ id: n,
146
+ dir: s,
147
+ getRootNode: t,
148
+ ...o
149
+ }, u = ht(ft, c);
150
+ return { api: Mt(u, gt), service: u };
151
+ }, [ze, Fe] = _({
152
+ name: "MenuMachineContext",
153
+ hookName: "useMenuMachineContext",
154
+ providerName: "<MenuMachineProvider />",
155
+ strict: !1
156
+ }), [We, jt] = _({
157
+ name: "MenuMachineContext",
158
+ hookName: "useMenuMachineContext",
159
+ providerName: "<MenuMachineProvider />",
160
+ strict: !1
161
+ }), Ct = (o) => {
162
+ const [n, t] = fe(o), [s, c] = O()(t, [
163
+ "anchorPoint",
164
+ "aria-label",
165
+ "closeOnSelect",
166
+ "composite",
167
+ "defaultHighlightedValue",
168
+ "defaultOpen",
169
+ "highlightedValue",
170
+ "id",
171
+ "ids",
172
+ "loopFocus",
173
+ "navigate",
174
+ "onEscapeKeyDown",
175
+ "onFocusOutside",
176
+ "onHighlightChange",
177
+ "onInteractOutside",
178
+ "onOpenChange",
179
+ "onPointerDownOutside",
180
+ "onSelect",
181
+ "open",
182
+ "positioning",
183
+ "typeahead"
184
+ ]), u = m(), a = Fe(), { api: i, service: f } = vt(s), N = Me(p({ present: i.open }, n));
185
+ Be(() => {
186
+ a && u && (u.setChild(f), i.setParent(a));
187
+ });
188
+ const y = j(() => u?.getTriggerItemProps(i), [i, u]);
189
+ return /* @__PURE__ */ e.jsx(We, { value: y, children: /* @__PURE__ */ e.jsx(ze, { value: f, children: /* @__PURE__ */ e.jsx(ve, { value: i, children: /* @__PURE__ */ e.jsx(Pe, { value: N, ...c }) }) }) });
190
+ }, It = (o) => {
191
+ const n = m(), t = Fe(), [s, { value: c, children: u }] = fe(o), { api: a, service: i } = c, f = Me(p({ present: a.open }, s));
192
+ Be(() => {
193
+ t && n && (n.setChild(i), a.setParent(t));
194
+ });
195
+ const N = j(() => n?.getTriggerItemProps(a), [a, n]);
196
+ return /* @__PURE__ */ e.jsx(We, { value: N, children: /* @__PURE__ */ e.jsx(ze, { value: i, children: /* @__PURE__ */ e.jsx(ve, { value: a, children: /* @__PURE__ */ e.jsx(Pe, { value: f, children: u }) }) }) });
197
+ }, Ee = h((o, n) => {
198
+ const t = m(), s = p(t.getSeparatorProps(), o);
199
+ return /* @__PURE__ */ e.jsx(g.hr, { ...s, ref: n });
200
+ });
201
+ Ee.displayName = "MenuSeparator";
202
+ const De = h((o, n) => {
203
+ const t = m(), s = te(), c = p(
204
+ {
205
+ ...t.getTriggerProps(),
206
+ "aria-controls": s.unmounted ? void 0 : t.getTriggerProps()["aria-controls"]
207
+ },
208
+ o
209
+ );
210
+ return /* @__PURE__ */ e.jsx(g.button, { ...c, ref: n });
211
+ });
212
+ De.displayName = "MenuTrigger";
213
+ const Ve = h((o, n) => {
214
+ const t = jt(), s = p(t?.() ?? {}, o);
215
+ return /* @__PURE__ */ e.jsx(g.div, { ...s, ref: n });
216
+ });
217
+ Ve.displayName = "MenuTriggerItem";
218
+ const {
219
+ withRootProvider: He,
220
+ withContext: x
221
+ } = lt({ key: "menu" });
222
+ He(
223
+ It
224
+ );
225
+ const bt = He(Ct, {
226
+ defaultProps: { lazyMount: !0, unmountOnExit: !0 }
227
+ }), kt = x(
228
+ De,
229
+ "trigger",
230
+ { forwardAsChild: !0 }
231
+ );
232
+ x(Se, "contextTrigger", { forwardAsChild: !0 });
233
+ const St = x(
234
+ $e,
235
+ "positioner",
236
+ { forwardAsChild: !0 }
237
+ );
238
+ x(
239
+ Ee,
240
+ "separator",
241
+ { forwardAsChild: !0 }
242
+ );
243
+ const wt = x(
244
+ ke,
245
+ "content",
246
+ { forwardAsChild: !0 }
247
+ ), Nt = x(
248
+ Ce,
249
+ "arrowTip",
250
+ { forwardAsChild: !0 }
251
+ );
252
+ x(
253
+ je,
254
+ "arrow",
255
+ { forwardAsChild: !0, defaultProps: { children: /* @__PURE__ */ e.jsx(Nt, {}) } }
256
+ );
257
+ x(
258
+ we,
259
+ "indicator",
260
+ { forwardAsChild: !0 }
261
+ );
262
+ const yt = x(
263
+ Te,
264
+ "itemGroup",
265
+ { forwardAsChild: !0 }
266
+ ), At = x(Ge, "itemGroupLabel", { forwardAsChild: !0 }), de = x(
267
+ Ne,
268
+ "item",
269
+ { forwardAsChild: !0 }
270
+ ), Tt = x(Ve, "item", { forwardAsChild: !0 });
271
+ x(
272
+ Oe,
273
+ "itemText",
274
+ { forwardAsChild: !0 }
275
+ );
276
+ x(
277
+ "kbd",
278
+ "itemCommand"
279
+ );
280
+ x(_e, "itemIndicator", {
281
+ forwardAsChild: !0,
282
+ defaultProps: { children: /* @__PURE__ */ e.jsx(dt, { boxSize: "4" }) }
283
+ });
284
+ x(be, "item", { forwardAsChild: !0 });
285
+ x(Le, "itemGroup", { forwardAsChild: !0 });
286
+ x(
287
+ Re,
288
+ "item",
289
+ { forwardAsChild: !0 }
290
+ );
291
+ const Ke = ({
292
+ hideCaret: o = !1,
293
+ size: n = "md",
294
+ text: t,
295
+ textProps: s,
296
+ variant: c,
297
+ onClick: u,
298
+ ["data-testid"]: a = "kibble-menu-button",
299
+ ...i
300
+ }) => /* @__PURE__ */ e.jsxs(
301
+ Z,
302
+ {
303
+ className: "Menu__Button",
304
+ "data-testid": a,
305
+ size: n,
306
+ variant: c,
307
+ ...i,
308
+ ...!t && o && { paddingInline: 0, paddingBlock: 0 },
309
+ onClick: (f) => {
310
+ f.stopPropagation(), u?.(f);
311
+ },
312
+ children: [
313
+ t && /* @__PURE__ */ e.jsx(
314
+ ee,
315
+ {
316
+ className: "Menu__ButtonText",
317
+ "data-testid": `${a}-text`,
318
+ fontWeight: "semibold",
319
+ size: n,
320
+ color: c ? "inherit" : s?.color || "text.contrast",
321
+ truncated: !0,
322
+ ...s,
323
+ children: t
324
+ }
325
+ ),
326
+ !o && /* @__PURE__ */ e.jsx(z, { className: "Menu__ButtonCaret", "data-testid": `${a}-caret`, children: /* @__PURE__ */ e.jsx(he, { name: "chevronDown", size: n === "lg" ? "sm" : "xs" }) })
327
+ ]
328
+ }
329
+ ), Gt = ({ tooltipProps: o, isMenuOpen: n, ...t }) => {
330
+ const [s, c] = L(!1), u = j(() => {
331
+ n || c(!0);
332
+ }, [n]), a = j(() => {
333
+ n || c(!1);
334
+ }, [n]);
335
+ return B(() => {
336
+ n && c(!1);
337
+ }, [n]), /* @__PURE__ */ e.jsx(ge, { label: t.text || "", open: s && !n, ...o, children: /* @__PURE__ */ e.jsx(
338
+ T,
339
+ {
340
+ onClick: (i) => {
341
+ i.preventDefault(), i.stopPropagation(), c(!1);
342
+ },
343
+ onMouseEnter: u,
344
+ onMouseLeave: a,
345
+ children: /* @__PURE__ */ e.jsx(Ke, { ...t })
346
+ }
347
+ ) });
348
+ }, _t = ({
349
+ label: o,
350
+ leftElement: n,
351
+ onSelect: t,
352
+ shouldTruncateText: s,
353
+ type: c = "default",
354
+ variant: u,
355
+ ["data-testid"]: a = "kibble-menu-item",
356
+ ...i
357
+ }) => {
358
+ const [f, N] = L(!1), y = j(() => {
359
+ t && t(i.value);
360
+ }, [t, i.value]);
361
+ if (c === "submenu") {
362
+ const {
363
+ valueText: S,
364
+ listProps: C,
365
+ positionerProps: M,
366
+ portalled: A = !0,
367
+ open: k,
368
+ lazyMount: I = !0,
369
+ unmountOnExit: V = !0
370
+ } = i;
371
+ return /* @__PURE__ */ e.jsx(
372
+ Ot,
373
+ {
374
+ lazyMount: I,
375
+ unmountOnExit: V,
376
+ submenuTrigger: /* @__PURE__ */ e.jsxs(
377
+ Tt,
378
+ {
379
+ className: "Menu__Item--Submenu",
380
+ "data-testid": `${a}-submenu`,
381
+ justifyContent: "space-between",
382
+ "aria-valuetext": S,
383
+ position: "relative",
384
+ onClick: () => {
385
+ k !== void 0 && t ? t(i.value) : N(!f);
386
+ },
387
+ children: [
388
+ /* @__PURE__ */ e.jsx(
389
+ X,
390
+ {
391
+ label: o,
392
+ leftElement: n,
393
+ shouldTruncateText: s,
394
+ variant: u
395
+ }
396
+ ),
397
+ /* @__PURE__ */ e.jsx(he, { name: "chevronRight", size: "sm" })
398
+ ]
399
+ }
400
+ ),
401
+ portalled: A,
402
+ open: k !== void 0 ? k : f,
403
+ listProps: C,
404
+ positionerProps: M
405
+ }
406
+ );
407
+ }
408
+ if (c === "checkbox") {
409
+ const { checked: S, value: C, disabled: M, tooltipLabel: A, ...k } = i;
410
+ return /* @__PURE__ */ e.jsxs(
411
+ de,
412
+ {
413
+ className: "Menu__Item--Checkbox",
414
+ "data-testid": `${a}-checkbox`,
415
+ value: C,
416
+ closeOnSelect: !1,
417
+ onSelect: M ? void 0 : y,
418
+ gap: 3,
419
+ disabled: M,
420
+ ...k,
421
+ children: [
422
+ /* @__PURE__ */ e.jsx(Pt, { checked: !!S, disabled: M, size: "md", fullWidth: !1 }),
423
+ /* @__PURE__ */ e.jsx(
424
+ X,
425
+ {
426
+ label: o,
427
+ leftElement: n,
428
+ shouldTruncateText: s,
429
+ variant: u,
430
+ tooltipLabel: A
431
+ }
432
+ )
433
+ ]
434
+ }
435
+ );
436
+ }
437
+ if (c === "default") {
438
+ const { selected: S = !1, disabled: C, value: M, tooltipLabel: A, ...k } = i;
439
+ return /* @__PURE__ */ e.jsx(
440
+ de,
441
+ {
442
+ className: "Menu__Item--Default",
443
+ "data-testid": `${a}-default`,
444
+ value: M,
445
+ onSelect: C ? void 0 : y,
446
+ disabled: C,
447
+ ...S && { bgColor: "background.secondaryAlpha.hover" },
448
+ ...k,
449
+ children: /* @__PURE__ */ e.jsx(
450
+ X,
451
+ {
452
+ label: o,
453
+ leftElement: n,
454
+ shouldTruncateText: s,
455
+ variant: S ? "info" : u,
456
+ tooltipLabel: A
457
+ }
458
+ )
459
+ }
460
+ );
461
+ }
462
+ return /* @__PURE__ */ e.jsx(e.Fragment, {});
463
+ }, X = ({
464
+ label: o,
465
+ leftElement: n,
466
+ shouldTruncateText: t,
467
+ variant: s,
468
+ tooltipLabel: c
469
+ }) => {
470
+ const u = /* @__PURE__ */ e.jsxs(z, { className: "Menu__ItemLabel", alignItems: "center", gap: 3, children: [
471
+ n,
472
+ typeof o == "string" ? /* @__PURE__ */ e.jsx(ee, { size: "sm", truncated: t, variant: s, children: o }) : o
473
+ ] });
474
+ return c ? /* @__PURE__ */ e.jsx(ge, { label: c, children: u }) : u;
475
+ }, pe = ({
476
+ groupName: o,
477
+ hasSelectedItems: n = !1,
478
+ onToggle: t,
479
+ ["data-testid"]: s = "kibble-menu-toggle-buttons"
480
+ }) => {
481
+ const c = !!o;
482
+ return /* @__PURE__ */ e.jsx(T, { className: "Menu__ToggleButtons", "data-testid": s, ...c && { textAlign: "right", w: "50%" }, children: c ? /* @__PURE__ */ e.jsx(e.Fragment, { children: n ? /* @__PURE__ */ e.jsx(xe, { hasSelectedItems: n, groupName: o, onToggle: t }) : /* @__PURE__ */ e.jsx(me, { groupName: o, onToggle: t }) }) : /* @__PURE__ */ e.jsxs(z, { justifyContent: "space-between", children: [
483
+ /* @__PURE__ */ e.jsx(me, { groupName: o, onToggle: t }),
484
+ /* @__PURE__ */ e.jsx(xe, { hasSelectedItems: n, groupName: o, onToggle: t })
485
+ ] }) });
486
+ }, me = ({ groupName: o, onToggle: n }) => /* @__PURE__ */ e.jsx(Z, { variant: "ghost", size: "xs", onClick: () => n({ groupName: o, clear: !1 }), children: "Select All" }), xe = ({ hasSelectedItems: o, groupName: n, onToggle: t }) => /* @__PURE__ */ e.jsx(
487
+ Z,
488
+ {
489
+ variant: "ghostNeutral",
490
+ iconName: "arrowCircle",
491
+ size: "xs",
492
+ disabled: !o,
493
+ onClick: () => t({ groupName: n, clear: !0 }),
494
+ children: "Clear All"
495
+ }
496
+ ), Ot = ({
497
+ buttonProps: o,
498
+ listProps: n,
499
+ positionerProps: t,
500
+ portalled: s = !1,
501
+ submenuTrigger: c,
502
+ lazyMount: u = !0,
503
+ onOpenChange: a,
504
+ ["data-testid"]: i = "kibble-menu",
505
+ ...f
506
+ }) => {
507
+ const { contentRef: N } = it(), {
508
+ canSelectAll: y,
509
+ canSelectGroups: S,
510
+ emptyState: C = "No results found",
511
+ groupSortOrder: M,
512
+ loading: A,
513
+ maxH: k = "480px",
514
+ menuItems: I = [],
515
+ minW: V = "240px",
516
+ onSearch: w,
517
+ onSelect: H,
518
+ onSelectAll: re,
519
+ searchable: K,
520
+ searchPlaceholder: qe = "Search...",
521
+ shouldTruncateText: Je,
522
+ ...se
523
+ } = n || {}, [Qe, Ue] = L(!1), [q, J] = L(""), [F, Q] = L(I), ce = D(() => {
524
+ const r = {};
525
+ return F?.forEach((l) => {
526
+ const d = l.groupLabel || "default", P = l.type === "checkbox" ? "checkbox" : "default";
527
+ r[d] || (r[d] = {}), r[d][P] || (r[d][P] = []), r[d][P].push(l);
528
+ }), r;
529
+ }, [F]), ae = D(() => {
530
+ const r = Object.entries(ce);
531
+ return !M || M.length === 0 ? r : r.sort(([l], [d]) => {
532
+ const P = M.indexOf(l), v = M.indexOf(d);
533
+ return P !== -1 && v !== -1 ? P - v : P !== -1 ? -1 : v !== -1 ? 1 : 0;
534
+ });
535
+ }, [ce, M]), $ = D(() => I?.filter((r) => r.type === "checkbox") || [], [I]), U = j(
536
+ (r) => $.some((l) => l.value === r && l.checked),
537
+ [$]
538
+ ), b = D(() => $.filter((r) => r.checked), [$]), ie = j(
539
+ ({ groupName: r, clear: l }) => {
540
+ let d;
541
+ const P = F.filter((v) => v.type === "checkbox" && !v.disabled);
542
+ if (r) {
543
+ const v = P.filter((W) => W.groupLabel === r);
544
+ d = l ? b.filter((W) => W.groupLabel !== r) : (
545
+ // Otherwise, add the items in the group to the selected items
546
+ [.../* @__PURE__ */ new Set([...b, ...v])]
547
+ );
548
+ } else
549
+ d = l ? [] : P.map((v) => ({ ...v, checked: !0 }));
550
+ re?.({ allSelectedItems: d });
551
+ },
552
+ [re, F, b]
553
+ ), Xe = j(
554
+ (r) => {
555
+ if (r.type === "checkbox") {
556
+ const l = U(r.value) ? b.filter((d) => d.value !== r.value) : [...b, r];
557
+ if (r.onSelect) {
558
+ r.onSelect(r.value);
559
+ return;
560
+ }
561
+ H?.({ item: r, allSelectedItems: l });
562
+ return;
563
+ }
564
+ if (r.onSelect) {
565
+ r.onSelect(r.value);
566
+ return;
567
+ }
568
+ H?.({ item: r, allSelectedItems: [r] });
569
+ },
570
+ [H, U, b]
571
+ ), ue = j((r, l) => r === "" || !r ? l : l.filter((d) => !!(typeof d.label == "string" ? d.label : d.valueText)?.toLowerCase().includes(r.toLowerCase())), []), Ye = j(
572
+ (r) => {
573
+ const l = r.target.value;
574
+ J(l), w && w(r);
575
+ },
576
+ [w]
577
+ ), Ze = j(() => {
578
+ J(""), w && w({
579
+ target: { value: "" }
580
+ });
581
+ }, [w]), et = j(
582
+ (r) => {
583
+ Ue(r), r || (J(""), Q(I)), a && a({ open: r, allSelectedItems: b });
584
+ },
585
+ [I, a, b]
586
+ );
587
+ return B(() => {
588
+ Q(w ? I : ue(q, I));
589
+ }, [q, w, ue, I]), /* @__PURE__ */ e.jsxs(
590
+ bt,
591
+ {
592
+ lazyMount: u,
593
+ unmountOnExit: u,
594
+ onOpenChange: (r) => {
595
+ et(r.open);
596
+ },
597
+ ...f,
598
+ children: [
599
+ c || /* @__PURE__ */ e.jsx(kt, { asChild: !0, className: "Menu__Trigger", "data-testid": `${i}-trigger`, children: o?.showTooltip ? /* @__PURE__ */ e.jsx(Gt, { isMenuOpen: Qe, ...o }) : /* @__PURE__ */ e.jsx(Ke, { ...o }) }),
600
+ /* @__PURE__ */ e.jsx(ut, { disabled: !s, container: N || void 0, children: /* @__PURE__ */ e.jsx(St, { className: "Menu", "data-testid": i, ...t, children: /* @__PURE__ */ e.jsxs(
601
+ wt,
602
+ {
603
+ className: "Menu__Content",
604
+ "data-testid": `${i}-content`,
605
+ maxH: k,
606
+ minW: V,
607
+ ...se,
608
+ ...K && { pt: "0" },
609
+ onClick: (r) => {
610
+ r.stopPropagation(), se?.onClick?.(r);
611
+ },
612
+ children: [
613
+ K && /* @__PURE__ */ e.jsx(
614
+ T,
615
+ {
616
+ className: "Menu__SearchBarContainer",
617
+ "data-testid": `${i}-search-bar-container`,
618
+ px: 3,
619
+ py: 2,
620
+ position: "sticky",
621
+ top: 0,
622
+ bg: "background",
623
+ zIndex: "docked",
624
+ children: /* @__PURE__ */ e.jsx(
625
+ ct,
626
+ {
627
+ className: "Menu__SearchBar",
628
+ "data-testid": `${i}-search-bar`,
629
+ placeholder: qe,
630
+ onChange: Ye,
631
+ size: "sm",
632
+ value: q,
633
+ clearable: !0,
634
+ onClear: Ze,
635
+ onKeyDown: (r) => {
636
+ r.code === "Space" && r.stopPropagation();
637
+ }
638
+ }
639
+ )
640
+ }
641
+ ),
642
+ y && /* @__PURE__ */ e.jsx(
643
+ T,
644
+ {
645
+ className: "Menu__CheckboxGroupHeader",
646
+ "data-testid": `${i}-checkbox-group-header`,
647
+ px: 3,
648
+ mt: K ? 1 : 2,
649
+ children: y && !!$.length && /* @__PURE__ */ e.jsx(
650
+ pe,
651
+ {
652
+ onToggle: ie,
653
+ hasSelectedItems: !!b.length
654
+ }
655
+ )
656
+ }
657
+ ),
658
+ A && /* @__PURE__ */ e.jsx(z, { justifyContent: "center", py: 5, children: /* @__PURE__ */ e.jsx(at, { fullScreen: !0 }) }),
659
+ /* @__PURE__ */ e.jsx(T, { className: "Menu__List", "data-testid": `${i}-list`, children: ae.length ? /* @__PURE__ */ e.jsx(e.Fragment, { children: ae.map(([r, l]) => {
660
+ const d = r === "default", P = Object.keys(l), v = d ? st.Fragment : yt, tt = l.checkbox?.map((R) => R.value)?.some(
661
+ (R) => b.some((E) => E.value === R && E.checked)
662
+ );
663
+ return /* @__PURE__ */ e.jsxs(v, { children: [
664
+ !d && /* @__PURE__ */ e.jsx(At, { children: /* @__PURE__ */ e.jsxs(z, { alignItems: "center", justifyContent: "space-between", children: [
665
+ r,
666
+ S && P.includes("checkbox") && /* @__PURE__ */ e.jsx(
667
+ pe,
668
+ {
669
+ groupName: r,
670
+ onToggle: ie,
671
+ hasSelectedItems: tt
672
+ }
673
+ )
674
+ ] }) }),
675
+ Object.entries(l).map(
676
+ ([R, E]) => E.map((G, nt) => {
677
+ const { groupLabel: ot, ...rt } = G;
678
+ return /* @__PURE__ */ e.jsx(
679
+ _t,
680
+ {
681
+ shouldTruncateText: Je,
682
+ ...G.type === "checkbox" && {
683
+ checked: U(G.value)
684
+ },
685
+ "data-testid": `${i}-item-${G.label}`,
686
+ onSelect: () => Xe(G),
687
+ ...G.type === "submenu" && {
688
+ positionerProps: t
689
+ },
690
+ ...rt
691
+ },
692
+ `menu-item-${ot}-${R}-${nt}`
693
+ );
694
+ })
695
+ )
696
+ ] }, r);
697
+ }) }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(T, { p: 3, children: typeof C == "string" ? /* @__PURE__ */ e.jsx(T, { textAlign: "center", children: /* @__PURE__ */ e.jsx(ee, { size: "sm", variant: "subtle", "data-testid": `${i}-empty-state`, children: C }) }) : C }) }) })
698
+ ]
699
+ }
700
+ ) }) })
701
+ ]
702
+ }
703
+ );
704
+ };
705
+ export {
706
+ Ot as M
707
+ };
708
+ //# sourceMappingURL=menu.component-BIFydd_a.js.map