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