@televet/kibble-ui 4.0.0-beta.48 → 4.0.0-beta.49

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