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

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-DkKPpSjz.js → avatarGroup.component-B8TVZvFj.js} +2 -2
  2. package/dist/chunks/{avatarGroup.component-DkKPpSjz.js.map → avatarGroup.component-B8TVZvFj.js.map} +1 -1
  3. package/dist/chunks/{avatarGroup.component-CTzKVekY.js → avatarGroup.component-BtMv6hWl.js} +2 -2
  4. package/dist/chunks/{avatarGroup.component-CTzKVekY.js.map → avatarGroup.component-BtMv6hWl.js.map} +1 -1
  5. package/dist/chunks/{buttonGroup.component-D5exJNjD.js → buttonGroup.component-BsvuFO8J.js} +2 -2
  6. package/dist/chunks/{buttonGroup.component-D5exJNjD.js.map → buttonGroup.component-BsvuFO8J.js.map} +1 -1
  7. package/dist/chunks/{buttonGroup.component-C7qKrojm.js → buttonGroup.component-DEaBDzIa.js} +2 -2
  8. package/dist/chunks/{buttonGroup.component-C7qKrojm.js.map → buttonGroup.component-DEaBDzIa.js.map} +1 -1
  9. package/dist/chunks/{calendar.component-CiZaNBUk.js → calendar.component-CKwY0qD7.js} +2 -2
  10. package/dist/chunks/{calendar.component-CiZaNBUk.js.map → calendar.component-CKwY0qD7.js.map} +1 -1
  11. package/dist/chunks/{calendar.component-D4YWcalj.js → calendar.component-biqw1Dvi.js} +2 -2
  12. package/dist/chunks/{calendar.component-D4YWcalj.js.map → calendar.component-biqw1Dvi.js.map} +1 -1
  13. package/dist/chunks/{conversationCard.component-C7XCNUme.js → conversationCard.component-BNtsyxWI.js} +2 -2
  14. package/dist/chunks/{conversationCard.component-C7XCNUme.js.map → conversationCard.component-BNtsyxWI.js.map} +1 -1
  15. package/dist/chunks/{conversationCard.component-Bey5HuaR.js → conversationCard.component-CtqjuJ23.js} +2 -2
  16. package/dist/chunks/{conversationCard.component-Bey5HuaR.js.map → conversationCard.component-CtqjuJ23.js.map} +1 -1
  17. package/dist/chunks/{datePicker.component-BVolIuLC.js → datePicker.component-GqXczD5i.js} +2 -2
  18. package/dist/chunks/{datePicker.component-BVolIuLC.js.map → datePicker.component-GqXczD5i.js.map} +1 -1
  19. package/dist/chunks/{datePicker.component-D1sEVtWA.js → datePicker.component-Zw6oktPN.js} +2 -2
  20. package/dist/chunks/{datePicker.component-D1sEVtWA.js.map → datePicker.component-Zw6oktPN.js.map} +1 -1
  21. package/dist/chunks/{datePicker.provider-CrxEuFVx.js → datePicker.provider-0NYqU17z.js} +2 -2
  22. package/dist/chunks/{datePicker.provider-CrxEuFVx.js.map → datePicker.provider-0NYqU17z.js.map} +1 -1
  23. package/dist/chunks/{datePicker.provider-D0UTCm7x.js → datePicker.provider-CMBqTY-y.js} +2 -2
  24. package/dist/chunks/{datePicker.provider-D0UTCm7x.js.map → datePicker.provider-CMBqTY-y.js.map} +1 -1
  25. package/dist/chunks/{dateTimePicker.component-C7yN5puI.js → dateTimePicker.component-P2E3fvYb.js} +2 -2
  26. package/dist/chunks/{dateTimePicker.component-C7yN5puI.js.map → dateTimePicker.component-P2E3fvYb.js.map} +1 -1
  27. package/dist/chunks/{dateTimePicker.component-D34ZBE5S.js → dateTimePicker.component-YQ2T3Rwt.js} +2 -2
  28. package/dist/chunks/{dateTimePicker.component-D34ZBE5S.js.map → dateTimePicker.component-YQ2T3Rwt.js.map} +1 -1
  29. package/dist/chunks/menu.component-Cdgw5Ad_.js +714 -0
  30. package/dist/chunks/menu.component-Cdgw5Ad_.js.map +1 -0
  31. package/dist/chunks/menu.component-DcRZ3_PR.js +2 -0
  32. package/dist/chunks/menu.component-DcRZ3_PR.js.map +1 -0
  33. package/dist/chunks/{radioGroup.types-C9sQfIhO.js → radioGroup.types-D4W2Gkw7.js} +2 -2
  34. package/dist/chunks/{radioGroup.types-C9sQfIhO.js.map → radioGroup.types-D4W2Gkw7.js.map} +1 -1
  35. package/dist/chunks/{radioGroup.types-31031yF0.js → radioGroup.types-DESgrVjt.js} +2 -2
  36. package/dist/chunks/{radioGroup.types-31031yF0.js.map → radioGroup.types-DESgrVjt.js.map} +1 -1
  37. package/dist/chunks/{tagBlock.component-6EiDFKRU.js → tagBlock.component-CdLWIWut.js} +2 -2
  38. package/dist/chunks/{tagBlock.component-6EiDFKRU.js.map → tagBlock.component-CdLWIWut.js.map} +1 -1
  39. package/dist/chunks/{tagBlock.component-Ctiv0q_l.js → tagBlock.component-pMRnarH1.js} +2 -2
  40. package/dist/chunks/{tagBlock.component-Ctiv0q_l.js.map → tagBlock.component-pMRnarH1.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 +3 -1
  64. package/dist/types/components/Menu/menu.component.d.ts +2 -1
  65. package/package.json +1 -1
  66. package/dist/chunks/menu.component-CUkHLGzY.js +0 -2
  67. package/dist/chunks/menu.component-CUkHLGzY.js.map +0 -1
  68. package/dist/chunks/menu.component-Di6p2OQm.js +0 -712
  69. package/dist/chunks/menu.component-Di6p2OQm.js.map +0 -1
@@ -1,712 +0,0 @@
1
- import { j as e } from "./jsx-runtime-C5mzlN2N.js";
2
- import st, { forwardRef as h, useEffect as _, useId as Y, useRef as de, useCallback as j, useState as B, 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 ge } from "./icon.component-PV_nHBId.js";
6
- import { W as ee } from "./text.component-CdTyTFds.js";
7
- import { T as fe } 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 Me, c as Pe, d as ve, 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 O, d as g, b as $, 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 [je, m] = O({
20
- name: "MenuContext",
21
- hookName: "useMenuContext",
22
- providerName: "<MenuProvider />",
23
- strict: !1
24
- }), Ce = h((o, n) => {
25
- const t = m(), s = p(t.getArrowProps(), o);
26
- return /* @__PURE__ */ e.jsx(g.div, { ...s, ref: n });
27
- });
28
- Ce.displayName = "MenuArrow";
29
- const Ie = h((o, n) => {
30
- const t = m(), s = p(t.getArrowTipProps(), o);
31
- return /* @__PURE__ */ e.jsx(g.div, { ...s, ref: n });
32
- });
33
- Ie.displayName = "MenuArrowTip";
34
- const [ne, Zt] = O({
35
- name: "MenuItemContext",
36
- hookName: "useMenuItemContext",
37
- providerName: "<MenuItemProvider />"
38
- }), [oe, be] = O({
39
- name: "MenuItemPropsContext",
40
- hookName: "useMenuItemPropsContext",
41
- providerName: "<MenuItemPropsProvider />"
42
- }), ke = h((o, n) => {
43
- const [t, s] = $()(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
- ke.displayName = "MenuCheckboxItem";
57
- const Se = 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
- Se.displayName = "MenuContent";
62
- const we = h((o, n) => {
63
- const t = m(), s = p(t.getContextTriggerProps(), o);
64
- return /* @__PURE__ */ e.jsx(g.button, { ...s, ref: n });
65
- });
66
- we.displayName = "MenuContextTrigger";
67
- const Ne = h((o, n) => {
68
- const t = m(), s = p(t.getIndicatorProps(), o);
69
- return /* @__PURE__ */ e.jsx(g.div, { ...s, ref: n });
70
- });
71
- Ne.displayName = "MenuIndicator";
72
- const ye = h((o, n) => {
73
- const [t, s] = $()(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 _(() => 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
- ye.displayName = "MenuItem";
83
- const [Ae, Te] = O({
84
- name: "MenuItemGroupContext",
85
- hookName: "useMenuItemGroupContext",
86
- providerName: "<MenuItemGroupProvider />"
87
- }), Ge = h((o, n) => {
88
- const [t, s] = $()(o, ["id"]), c = m(), a = { id: Y(), ...t }, i = p(c.getItemGroupProps(a), s);
89
- return /* @__PURE__ */ e.jsx(Ae, { value: a, children: /* @__PURE__ */ e.jsx(g.div, { ...i, ref: n }) });
90
- });
91
- Ge.displayName = "MenuItemGroup";
92
- const _e = h((o, n) => {
93
- const t = m(), s = Te(), c = p(t.getItemGroupLabelProps({ htmlFor: s.id }), o);
94
- return /* @__PURE__ */ e.jsx(g.div, { ...c, ref: n });
95
- });
96
- _e.displayName = "MenuItemGroupLabel";
97
- const Oe = h((o, n) => {
98
- const t = m(), s = be(), c = p(t.getItemIndicatorProps(s), o);
99
- return /* @__PURE__ */ e.jsx(g.div, { ...c, ref: n });
100
- });
101
- Oe.displayName = "MenuItemIndicator";
102
- const $e = h((o, n) => {
103
- const t = m(), s = be(), c = p(t.getItemTextProps(s), o);
104
- return /* @__PURE__ */ e.jsx(g.div, { ...c, ref: n });
105
- });
106
- $e.displayName = "MenuItemText";
107
- const Re = 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
- Re.displayName = "MenuPositioner";
112
- const Le = h((o, n) => {
113
- const [t, s] = $()(o, [
114
- "closeOnSelect",
115
- "disabled",
116
- "value",
117
- "valueText"
118
- ]), c = m(), u = Te(), 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
- Le.displayName = "MenuRadioItem";
127
- const Be = h((o, n) => {
128
- const [t, s] = $()(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(Ae, { value: a, children: /* @__PURE__ */ e.jsx(g.div, { ...i, ref: n }) });
134
- });
135
- Be.displayName = "MenuRadioItemGroup";
136
- const ze = (o) => {
137
- const n = de(o), t = de(!1);
138
- _(() => {
139
- n.current = o;
140
- }), _(() => {
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
- }, [Fe, We] = O({
152
- name: "MenuMachineContext",
153
- hookName: "useMenuMachineContext",
154
- providerName: "<MenuMachineProvider />",
155
- strict: !1
156
- }), [Ee, jt] = O({
157
- name: "MenuMachineContext",
158
- hookName: "useMenuMachineContext",
159
- providerName: "<MenuMachineProvider />",
160
- strict: !1
161
- }), Ct = (o) => {
162
- const [n, t] = Me(o), [s, c] = $()(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 = We(), { api: i, service: f } = vt(s), N = Pe(p({ present: i.open }, n));
185
- ze(() => {
186
- a && u && (u.setChild(f), i.setParent(a));
187
- });
188
- const y = j(() => u?.getTriggerItemProps(i), [i, u]);
189
- return /* @__PURE__ */ e.jsx(Ee, { value: y, children: /* @__PURE__ */ e.jsx(Fe, { value: f, children: /* @__PURE__ */ e.jsx(je, { value: i, children: /* @__PURE__ */ e.jsx(ve, { value: N, ...c }) }) }) });
190
- }, It = (o) => {
191
- const n = m(), t = We(), [s, { value: c, children: u }] = Me(o), { api: a, service: i } = c, f = Pe(p({ present: a.open }, s));
192
- ze(() => {
193
- t && n && (n.setChild(i), a.setParent(t));
194
- });
195
- const N = j(() => n?.getTriggerItemProps(a), [a, n]);
196
- return /* @__PURE__ */ e.jsx(Ee, { value: N, children: /* @__PURE__ */ e.jsx(Fe, { value: i, children: /* @__PURE__ */ e.jsx(je, { value: a, children: /* @__PURE__ */ e.jsx(ve, { value: f, children: u }) }) }) });
197
- }, De = h((o, n) => {
198
- const t = m(), s = p(t.getSeparatorProps(), o);
199
- return /* @__PURE__ */ e.jsx(g.hr, { ...s, ref: n });
200
- });
201
- De.displayName = "MenuSeparator";
202
- const Ve = 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
- Ve.displayName = "MenuTrigger";
213
- const He = h((o, n) => {
214
- const t = jt(), s = p(t?.() ?? {}, o);
215
- return /* @__PURE__ */ e.jsx(g.div, { ...s, ref: n });
216
- });
217
- He.displayName = "MenuTriggerItem";
218
- const {
219
- withRootProvider: Ke,
220
- withContext: x
221
- } = lt({ key: "menu" });
222
- Ke(
223
- It
224
- );
225
- const bt = Ke(Ct, {
226
- defaultProps: { lazyMount: !0, unmountOnExit: !0 }
227
- }), kt = x(
228
- Ve,
229
- "trigger",
230
- { forwardAsChild: !0 }
231
- );
232
- x(we, "contextTrigger", { forwardAsChild: !0 });
233
- const St = x(
234
- Re,
235
- "positioner",
236
- { forwardAsChild: !0 }
237
- );
238
- x(
239
- De,
240
- "separator",
241
- { forwardAsChild: !0 }
242
- );
243
- const wt = x(
244
- Se,
245
- "content",
246
- { forwardAsChild: !0 }
247
- ), Nt = x(
248
- Ie,
249
- "arrowTip",
250
- { forwardAsChild: !0 }
251
- );
252
- x(
253
- Ce,
254
- "arrow",
255
- { forwardAsChild: !0, defaultProps: { children: /* @__PURE__ */ e.jsx(Nt, {}) } }
256
- );
257
- x(
258
- Ne,
259
- "indicator",
260
- { forwardAsChild: !0 }
261
- );
262
- const yt = x(
263
- Ge,
264
- "itemGroup",
265
- { forwardAsChild: !0 }
266
- ), At = x(_e, "itemGroupLabel", { forwardAsChild: !0 }), pe = x(
267
- ye,
268
- "item",
269
- { forwardAsChild: !0 }
270
- ), Tt = x(He, "item", { forwardAsChild: !0 });
271
- x(
272
- $e,
273
- "itemText",
274
- { forwardAsChild: !0 }
275
- );
276
- x(
277
- "kbd",
278
- "itemCommand"
279
- );
280
- x(Oe, "itemIndicator", {
281
- forwardAsChild: !0,
282
- defaultProps: { children: /* @__PURE__ */ e.jsx(dt, { boxSize: "4" }) }
283
- });
284
- x(ke, "item", { forwardAsChild: !0 });
285
- x(Be, "itemGroup", { forwardAsChild: !0 });
286
- x(
287
- Le,
288
- "item",
289
- { forwardAsChild: !0 }
290
- );
291
- const qe = ({
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(ge, { name: "chevronDown", size: n === "lg" ? "sm" : "xs" }) })
327
- ]
328
- }
329
- ), Gt = ({ tooltipProps: o, isMenuOpen: n, ...t }) => {
330
- const [s, c] = B(!1), u = j(() => {
331
- n || c(!0);
332
- }, [n]), a = j(() => {
333
- n || c(!1);
334
- }, [n]);
335
- return _(() => {
336
- n && c(!1);
337
- }, [n]), /* @__PURE__ */ e.jsx(fe, { 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(qe, { ...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] = B(!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 console.log("positionerProps inside menu item", M), /* @__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(ge, { 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
- pe,
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
- pe,
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(fe, { label: c, children: u }) : u;
475
- }, me = ({
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(he, { hasSelectedItems: n, groupName: o, onToggle: t }) : /* @__PURE__ */ e.jsx(xe, { groupName: o, onToggle: t }) }) : /* @__PURE__ */ e.jsxs(z, { justifyContent: "space-between", children: [
483
- /* @__PURE__ */ e.jsx(xe, { groupName: o, onToggle: t }),
484
- /* @__PURE__ */ e.jsx(he, { hasSelectedItems: n, groupName: o, onToggle: t })
485
- ] }) });
486
- }, xe = ({ groupName: o, onToggle: n }) => /* @__PURE__ */ e.jsx(Z, { variant: "ghost", size: "xs", onClick: () => n({ groupName: o, clear: !1 }), children: "Select All" }), he = ({ 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: Je = "Search...",
521
- shouldTruncateText: Qe,
522
- ...se
523
- } = n || {}, [Ue, Xe] = B(!1), [q, J] = B(""), [F, Q] = B(I);
524
- _(() => {
525
- console.log("positionerProps at root menu level", t);
526
- }, [t]);
527
- const ce = D(() => {
528
- const r = {};
529
- return F?.forEach((l) => {
530
- const d = l.groupLabel || "default", P = l.type === "checkbox" ? "checkbox" : "default";
531
- r[d] || (r[d] = {}), r[d][P] || (r[d][P] = []), r[d][P].push(l);
532
- }), r;
533
- }, [F]), ae = D(() => {
534
- const r = Object.entries(ce);
535
- return !M || M.length === 0 ? r : r.sort(([l], [d]) => {
536
- const P = M.indexOf(l), v = M.indexOf(d);
537
- return P !== -1 && v !== -1 ? P - v : P !== -1 ? -1 : v !== -1 ? 1 : 0;
538
- });
539
- }, [ce, M]), R = D(() => I?.filter((r) => r.type === "checkbox") || [], [I]), U = j(
540
- (r) => R.some((l) => l.value === r && l.checked),
541
- [R]
542
- ), b = D(() => R.filter((r) => r.checked), [R]), ie = j(
543
- ({ groupName: r, clear: l }) => {
544
- let d;
545
- const P = F.filter((v) => v.type === "checkbox" && !v.disabled);
546
- if (r) {
547
- const v = P.filter((W) => W.groupLabel === r);
548
- d = l ? b.filter((W) => W.groupLabel !== r) : (
549
- // Otherwise, add the items in the group to the selected items
550
- [.../* @__PURE__ */ new Set([...b, ...v])]
551
- );
552
- } else
553
- d = l ? [] : P.map((v) => ({ ...v, checked: !0 }));
554
- re?.({ allSelectedItems: d });
555
- },
556
- [re, F, b]
557
- ), Ye = j(
558
- (r) => {
559
- if (r.type === "checkbox") {
560
- const l = U(r.value) ? b.filter((d) => d.value !== r.value) : [...b, r];
561
- if (r.onSelect) {
562
- r.onSelect(r.value);
563
- return;
564
- }
565
- H?.({ item: r, allSelectedItems: l });
566
- return;
567
- }
568
- if (r.onSelect) {
569
- r.onSelect(r.value);
570
- return;
571
- }
572
- H?.({ item: r, allSelectedItems: [r] });
573
- },
574
- [H, U, b]
575
- ), ue = j((r, l) => r === "" || !r ? l : l.filter((d) => !!(typeof d.label == "string" ? d.label : d.valueText)?.toLowerCase().includes(r.toLowerCase())), []), Ze = j(
576
- (r) => {
577
- const l = r.target.value;
578
- J(l), w && w(r);
579
- },
580
- [w]
581
- ), et = j(() => {
582
- J(""), w && w({
583
- target: { value: "" }
584
- });
585
- }, [w]), tt = j(
586
- (r) => {
587
- Xe(r), r || (J(""), Q(I)), a && a({ open: r, allSelectedItems: b });
588
- },
589
- [I, a, b]
590
- );
591
- return _(() => {
592
- Q(w ? I : ue(q, I));
593
- }, [q, w, ue, I]), /* @__PURE__ */ e.jsxs(
594
- bt,
595
- {
596
- lazyMount: u,
597
- unmountOnExit: u,
598
- onOpenChange: (r) => {
599
- tt(r.open);
600
- },
601
- ...f,
602
- children: [
603
- c || /* @__PURE__ */ e.jsx(kt, { asChild: !0, className: "Menu__Trigger", "data-testid": `${i}-trigger`, children: o?.showTooltip ? /* @__PURE__ */ e.jsx(Gt, { isMenuOpen: Ue, ...o }) : /* @__PURE__ */ e.jsx(qe, { ...o }) }),
604
- /* @__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(
605
- wt,
606
- {
607
- className: "Menu__Content",
608
- "data-testid": `${i}-content`,
609
- maxH: k,
610
- minW: V,
611
- ...se,
612
- ...K && { pt: "0" },
613
- onClick: (r) => {
614
- r.stopPropagation(), se?.onClick?.(r);
615
- },
616
- children: [
617
- K && /* @__PURE__ */ e.jsx(
618
- T,
619
- {
620
- className: "Menu__SearchBarContainer",
621
- "data-testid": `${i}-search-bar-container`,
622
- px: 3,
623
- py: 2,
624
- position: "sticky",
625
- top: 0,
626
- bg: "background",
627
- zIndex: "docked",
628
- children: /* @__PURE__ */ e.jsx(
629
- ct,
630
- {
631
- className: "Menu__SearchBar",
632
- "data-testid": `${i}-search-bar`,
633
- placeholder: Je,
634
- onChange: Ze,
635
- size: "sm",
636
- value: q,
637
- clearable: !0,
638
- onClear: et,
639
- onKeyDown: (r) => {
640
- r.code === "Space" && r.stopPropagation();
641
- }
642
- }
643
- )
644
- }
645
- ),
646
- y && /* @__PURE__ */ e.jsx(
647
- T,
648
- {
649
- className: "Menu__CheckboxGroupHeader",
650
- "data-testid": `${i}-checkbox-group-header`,
651
- px: 3,
652
- mt: K ? 1 : 2,
653
- children: y && !!R.length && /* @__PURE__ */ e.jsx(
654
- me,
655
- {
656
- onToggle: ie,
657
- hasSelectedItems: !!b.length
658
- }
659
- )
660
- }
661
- ),
662
- A && /* @__PURE__ */ e.jsx(z, { justifyContent: "center", py: 5, children: /* @__PURE__ */ e.jsx(at, { fullScreen: !0 }) }),
663
- /* @__PURE__ */ e.jsx(T, { className: "Menu__List", "data-testid": `${i}-list`, children: ae.length ? /* @__PURE__ */ e.jsx(e.Fragment, { children: ae.map(([r, l]) => {
664
- const d = r === "default", P = Object.keys(l), v = d ? st.Fragment : yt, nt = l.checkbox?.map((L) => L.value)?.some(
665
- (L) => b.some((E) => E.value === L && E.checked)
666
- );
667
- return /* @__PURE__ */ e.jsxs(v, { children: [
668
- !d && /* @__PURE__ */ e.jsx(At, { children: /* @__PURE__ */ e.jsxs(z, { alignItems: "center", justifyContent: "space-between", children: [
669
- r,
670
- S && P.includes("checkbox") && /* @__PURE__ */ e.jsx(
671
- me,
672
- {
673
- groupName: r,
674
- onToggle: ie,
675
- hasSelectedItems: nt
676
- }
677
- )
678
- ] }) }),
679
- Object.entries(l).map(
680
- ([L, E]) => E.map((G, ot) => {
681
- const { groupLabel: rt, ...le } = G;
682
- return console.log("item props", le), console.log("positionerProps inside menu item", t), /* @__PURE__ */ e.jsx(
683
- _t,
684
- {
685
- ...le,
686
- shouldTruncateText: Qe,
687
- ...G.type === "checkbox" && {
688
- checked: U(G.value)
689
- },
690
- "data-testid": `${i}-item-${G.label}`,
691
- onSelect: () => Ye(G),
692
- ...G.type === "submenu" && {
693
- positionerProps: t
694
- }
695
- },
696
- `menu-item-${rt}-${L}-${ot}`
697
- );
698
- })
699
- )
700
- ] }, r);
701
- }) }) : /* @__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 }) }) })
702
- ]
703
- }
704
- ) }) })
705
- ]
706
- }
707
- );
708
- };
709
- export {
710
- Ot as M
711
- };
712
- //# sourceMappingURL=menu.component-Di6p2OQm.js.map