@adyen/bento-vue2 1.64.0 → 1.65.0

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 (64) hide show
  1. package/dist/assets/accordion-item.css +1 -1
  2. package/dist/assets/action-bar.css +1 -1
  3. package/dist/assets/base-modal.css +1 -1
  4. package/dist/assets/card.css +1 -1
  5. package/dist/assets/data-grid.css +1 -1
  6. package/dist/assets/date-picker.css +1 -1
  7. package/dist/assets/dialog-page.css +1 -1
  8. package/dist/assets/dropdown.css +1 -1
  9. package/dist/assets/file-uploader.css +1 -1
  10. package/dist/assets/inspector.css +1 -1
  11. package/dist/assets/menu.css +1 -1
  12. package/dist/assets/modal-fullscreen.css +1 -1
  13. package/dist/assets/popover.css +1 -1
  14. package/dist/assets/sidepanel.css +1 -1
  15. package/dist/assets/use-cached-selected-values.css +1 -1
  16. package/dist/chunks/{code-snippet.C7eh-7Vy.js → code-snippet.W8Zp0zQP.js} +2 -2
  17. package/dist/chunks/{code-snippet.C7eh-7Vy.js.map → code-snippet.W8Zp0zQP.js.map} +1 -1
  18. package/dist/chunks/{data-grid.o64ltIur.js → data-grid.D4oeTUhn.js} +65 -59
  19. package/dist/chunks/{data-grid.o64ltIur.js.map → data-grid.D4oeTUhn.js.map} +1 -1
  20. package/dist/chunks/{date-picker.Ba-lHyXs.js → date-picker.k0g6anfy.js} +28 -28
  21. package/dist/chunks/{date-picker.Ba-lHyXs.js.map → date-picker.k0g6anfy.js.map} +1 -1
  22. package/dist/chunks/{date-range-picker.BER92nnT.js → date-range-picker.D9lyIoO-.js} +20 -20
  23. package/dist/chunks/{date-range-picker.BER92nnT.js.map → date-range-picker.D9lyIoO-.js.map} +1 -1
  24. package/dist/chunks/{dropdown-tag.uNZs7yVF.js → dropdown-tag.DKhxBV52.js} +2 -2
  25. package/dist/chunks/{dropdown-tag.uNZs7yVF.js.map → dropdown-tag.DKhxBV52.js.map} +1 -1
  26. package/dist/chunks/{dropdown.DZ1Ndonr.js → dropdown.DV7uhHNP.js} +250 -239
  27. package/dist/chunks/dropdown.DV7uhHNP.js.map +1 -0
  28. package/dist/chunks/{filter-bar.BMDvL9EW.js → filter-bar.BxDEplt3.js} +7 -7
  29. package/dist/chunks/{filter-bar.BMDvL9EW.js.map → filter-bar.BxDEplt3.js.map} +1 -1
  30. package/dist/chunks/{header-with-views.CEfKLlVv.js → header-with-views.Ds9mcwmp.js} +2 -2
  31. package/dist/chunks/{header-with-views.CEfKLlVv.js.map → header-with-views.Ds9mcwmp.js.map} +1 -1
  32. package/dist/chunks/{input-field-password.DI7W4ehj.js → input-field-password.Bloa-rqx.js} +3 -3
  33. package/dist/chunks/{input-field-password.DI7W4ehj.js.map → input-field-password.Bloa-rqx.js.map} +1 -1
  34. package/dist/chunks/{input-field-phone-number.BXbNxQeN.js → input-field-phone-number.B3qzZKuP.js} +3 -3
  35. package/dist/chunks/{input-field-phone-number.BXbNxQeN.js.map → input-field-phone-number.B3qzZKuP.js.map} +1 -1
  36. package/dist/chunks/{input-field.-Pgtuotm.js → input-field.B_3nZFYz.js} +2 -2
  37. package/dist/chunks/{input-field.-Pgtuotm.js.map → input-field.B_3nZFYz.js.map} +1 -1
  38. package/dist/chunks/{pagination.CoM4szsH.js → pagination.Cl7SzoId.js} +2 -2
  39. package/dist/chunks/{pagination.CoM4szsH.js.map → pagination.Cl7SzoId.js.map} +1 -1
  40. package/dist/chunks/{search-bar.BhQdvBh8.js → search-bar.CadVBoj0.js} +3 -3
  41. package/dist/chunks/{search-bar.BhQdvBh8.js.map → search-bar.CadVBoj0.js.map} +1 -1
  42. package/dist/chunks/{secondary-nav.CItGT9T3.js → secondary-nav.OwimHNCb.js} +2 -2
  43. package/dist/chunks/{secondary-nav.CItGT9T3.js.map → secondary-nav.OwimHNCb.js.map} +1 -1
  44. package/dist/chunks/use-cached-selected-values.DNOmzQVy.js +1280 -0
  45. package/dist/chunks/{use-cached-selected-values.C1CeSurp.js.map → use-cached-selected-values.DNOmzQVy.js.map} +1 -1
  46. package/dist/code-snippet.js +1 -1
  47. package/dist/data-grid.js +1 -1
  48. package/dist/date-picker.js +1 -1
  49. package/dist/date-range-picker.js +1 -1
  50. package/dist/dropdown.js +3 -3
  51. package/dist/filter-bar.js +1 -1
  52. package/dist/header-with-views.js +1 -1
  53. package/dist/index.js +15 -15
  54. package/dist/input-field-password.js +1 -1
  55. package/dist/input-field-phone-number.js +1 -1
  56. package/dist/input-field.js +1 -1
  57. package/dist/internal.js +1 -1
  58. package/dist/pagination.js +1 -1
  59. package/dist/search-bar.js +2 -2
  60. package/dist/secondary-nav.js +1 -1
  61. package/dist/web-types.json +1 -1
  62. package/package.json +7 -6
  63. package/dist/chunks/dropdown.DZ1Ndonr.js.map +0 -1
  64. package/dist/chunks/use-cached-selected-values.C1CeSurp.js +0 -1271
@@ -0,0 +1,1280 @@
1
+ import { computed as o, ref as A, onMounted as Te, onUnmounted as Ae, watch as z, defineComponent as w, nextTick as fe, toRef as Q, useSlots as Ie, useAttrs as Le } from "vue";
2
+ import { B as W } from "./typography.J1v_SPG3.js";
3
+ import { B as ke } from "./loading-indicator.z8COalOc.js";
4
+ import { B as De } from "./empty-state.mtXfb1BB.js";
5
+ import { u as ee } from "./i18n.BQkEbtPM.js";
6
+ import { d as Re } from "./debounce.DUTu11PS.js";
7
+ import "./index.Cl4_42j5.js";
8
+ import { B as Be } from "./chip.OV0EWIP3.js";
9
+ import { C as j, N as $e } from "./minus-small.DJacLGTw.js";
10
+ import { C as Ne } from "./checkmark-small.DVDtD4HQ.js";
11
+ import { n as N } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
12
+ import { C as Me } from "./chevron-down.eYtgv5ly.js";
13
+ import { C as we } from "./chevron-up.d8cwIlA_.js";
14
+ import { B as $, a as te } from "./keyboard-navigation.pB8weElW.js";
15
+ import { d as Ge, e as ue } from "./button-actions._OIvTdKt.js";
16
+ /* empty css */
17
+ import { o as Pe } from "./resize.Bqks3WUm.js";
18
+ import "../assets/use-cached-selected-values.css";
19
+ const ve = (s, e, l, t) => {
20
+ const n = o(
21
+ () => {
22
+ var v, O;
23
+ return !!((v = s.value) != null && v.length) && ((O = s.value) == null ? void 0 : O.length) === e.value.length;
24
+ }
25
+ ), i = o(() => {
26
+ var v;
27
+ return s.value == null || s.value.length === 0 ? !1 : ((v = s.value) == null ? void 0 : v.length) !== e.value.length;
28
+ });
29
+ return {
30
+ isAllSelected: n,
31
+ isIndeterminate: i,
32
+ toggleSelectAll: (v) => {
33
+ v ? l() : t();
34
+ }
35
+ };
36
+ };
37
+ function Fe(s, { disabled: e, itemHeight: l, overscan: t = 5, prefixHeight: n }) {
38
+ const i = A(null), c = A([]), v = A(0), O = A(0), d = A(0);
39
+ let u;
40
+ const T = o(() => {
41
+ const C = typeof l == "number" ? s.value.length * l : s.value.reduce((E, S, m) => E + l(m), 0), I = typeof l == "number" ? v.value * l : s.value.slice(0, v.value).reduce((E, S, m) => E + l(m), 0);
42
+ return {
43
+ style: {
44
+ marginTop: `${I}px`,
45
+ height: `${C - I}px`
46
+ }
47
+ };
48
+ }), b = () => {
49
+ const C = (n == null ? void 0 : n.value) ?? 0, I = Math.max(i.value.scrollTop - C, 0);
50
+ if (typeof l == "number")
51
+ return Math.floor(I / l);
52
+ let E = 0, S = 0;
53
+ for (let m = 0; m < s.value.length; m += 1) {
54
+ const p = l(m);
55
+ if (E += p, E >= I) {
56
+ S = m;
57
+ break;
58
+ }
59
+ }
60
+ return S;
61
+ }, g = () => {
62
+ if (d.value = i.value.clientHeight, typeof l == "number")
63
+ return Math.ceil(d.value / l);
64
+ const C = v.value ?? 0;
65
+ let I = 0, E = 0;
66
+ for (let S = C; S < s.value.length; S += 1) {
67
+ const m = l(S);
68
+ if (I += m, E = S, I > d.value)
69
+ break;
70
+ }
71
+ return E - C;
72
+ }, h = () => {
73
+ if (i.value) {
74
+ const C = g();
75
+ v.value = b(), O.value = Math.min(v.value + C + t, s.value.length), c.value = s.value.slice(v.value, O.value);
76
+ }
77
+ }, B = () => {
78
+ h();
79
+ };
80
+ e || (Te(() => {
81
+ i.value && (d.value = i.value.clientHeight, u = Pe(i.value, ({ clientHeight: C }) => {
82
+ d.value = C, h();
83
+ }), h());
84
+ }), Ae(() => {
85
+ u == null || u.disconnect();
86
+ }), z(
87
+ () => s.value,
88
+ () => {
89
+ h();
90
+ }
91
+ ));
92
+ const L = {
93
+ ref: i,
94
+ style: { overflowY: "auto" }
95
+ };
96
+ return e ? {
97
+ containerRef: i,
98
+ containerProps: L,
99
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
100
+ onScroll: () => {
101
+ },
102
+ list: s
103
+ } : {
104
+ containerRef: i,
105
+ containerProps: L,
106
+ onScroll: B,
107
+ list: c,
108
+ wrapperProps: T
109
+ };
110
+ }
111
+ var a = /* @__PURE__ */ ((s) => (s.SELECT = "select", s.SHOW_MORE = "show-more", s.ESCAPE = "escape-pressed", s.CLICK = "click", s.ENTER = "enter-pressed", s.SPACE = "space-pressed", s.TAB = "tab-pressed", s.CLOSE_DROPDOWN = "close-dropdown", s))(a || {}), U = /* @__PURE__ */ ((s) => (s.AUTOMATIC = "automatic", s.BUTTON = "button", s.NONE = "none", s))(U || {});
112
+ const Ye = w({
113
+ name: "bento-listbox-static-category",
114
+ components: {
115
+ BentoTypography: W
116
+ },
117
+ props: {
118
+ /**
119
+ * Category label text
120
+ */
121
+ categoryLabel: {
122
+ type: String,
123
+ required: !0
124
+ }
125
+ }
126
+ });
127
+ var Ue = function() {
128
+ var e = this, l = e._self._c;
129
+ return e._self._setupProxy, l("div", { staticClass: "b-listbox-single-select-category" }, [l("bento-typography", { staticClass: "b-listbox-single-select-category__label-text", attrs: { variant: "caption", el: "span" } }, [e._v(" " + e._s(e.categoryLabel) + " ")]), l("div", [e._t("default")], 2)], 1);
130
+ }, ze = [], We = /* @__PURE__ */ N(
131
+ Ye,
132
+ Ue,
133
+ ze,
134
+ !1,
135
+ null,
136
+ "4aa8cc6e"
137
+ );
138
+ const Ke = We.exports, Ve = w({
139
+ name: "bento-listbox-option",
140
+ props: {
141
+ /**
142
+ * Setting this property to true will disable the option.
143
+ */
144
+ disabled: { type: Boolean, default: !1 },
145
+ /**
146
+ * Indicates if the value is selected. Only one element can be selected at a time.
147
+ */
148
+ selected: { type: Boolean, default: !1 }
149
+ },
150
+ emits: [a.CLICK, a.ENTER, a.SPACE, a.TAB],
151
+ setup(s, { emit: e }) {
152
+ const l = o(() => ({
153
+ "b-listbox-option--disabled": s.disabled,
154
+ "b-listbox-option--selected": s.selected
155
+ }));
156
+ return {
157
+ // Enums
158
+ BentoKeyboardNavigationKeyDownEvent: $,
159
+ BentoListboxEvent: a,
160
+ // Values
161
+ conditionalClasses: l,
162
+ // Events
163
+ onClick: (i) => {
164
+ e(a.CLICK, i);
165
+ },
166
+ onOptionSelected: (i, c) => {
167
+ e(i, c);
168
+ }
169
+ };
170
+ }
171
+ });
172
+ var qe = function() {
173
+ var e = this, l = e._self._c;
174
+ return e._self._setupProxy, l("div", e._b({ staticClass: "b-listbox-option", class: e.conditionalClasses, attrs: { role: "option" }, on: { click: e.onClick, keydown: [function(t) {
175
+ return !t.type.indexOf("key") && e._k(t.keyCode, "enter", 13, t.key, "Enter") ? null : e.onOptionSelected(e.BentoListboxEvent.ENTER, t);
176
+ }, function(t) {
177
+ return !t.type.indexOf("key") && e._k(t.keyCode, "space", 32, t.key, [" ", "Spacebar"]) ? null : e.onOptionSelected(e.BentoListboxEvent.SPACE, t);
178
+ }, function(t) {
179
+ return !t.type.indexOf("key") && e._k(t.keyCode, "tab", 9, t.key, "Tab") ? null : e.onOptionSelected(e.BentoListboxEvent.TAB, t);
180
+ }] } }, "div", e.$attrs, !1), [e._t("default")], 2);
181
+ }, je = [], He = /* @__PURE__ */ N(
182
+ Ve,
183
+ qe,
184
+ je,
185
+ !1,
186
+ null,
187
+ "a1e9ebff"
188
+ );
189
+ const H = He.exports;
190
+ let de = 0;
191
+ const Xe = {
192
+ beforeCreate() {
193
+ this.uuid = de.toString(), de += 1;
194
+ }
195
+ };
196
+ var Je = function() {
197
+ var e = this, l = e._self._c;
198
+ return l("svg", e._b({ staticClass: "ui-assets-icons-16", attrs: { role: "img", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "none" } }, "svg", e.$attrs, !1), [e.$attrs["svg-title"] ? l("title", [e._v(e._s(e.$attrs["svg-title"]))]) : e._e(), l("path", { attrs: { fill: "#001222", d: "M15.0608 4.00011L14.0001 2.93945L6.00011 10.9395L2.00011 6.93945L0.939453 8.00011L6.00011 13.0608L15.0608 4.00011Z" } })]);
199
+ }, Ze = [], Qe = /* @__PURE__ */ N(
200
+ Xe,
201
+ Je,
202
+ Ze,
203
+ !1,
204
+ null,
205
+ null
206
+ );
207
+ const et = Qe.exports, tt = w({
208
+ name: "bento-listbox-single-select-option",
209
+ components: {
210
+ BentoListboxOption: H,
211
+ BentoTypography: W,
212
+ CheckmarkIcon: et
213
+ },
214
+ props: {
215
+ /**
216
+ * Setting this property to true will disable the option.
217
+ */
218
+ disabled: { type: Boolean, default: !1 },
219
+ /**
220
+ * The option item that contains all the option item's data.
221
+ * @type {BentoListboxOptionItem}
222
+ */
223
+ option: {
224
+ type: Object,
225
+ required: !0
226
+ },
227
+ /**
228
+ * Indicates if the value is selected. Only one element can be selected at a time.
229
+ */
230
+ selected: { type: Boolean, default: !1 }
231
+ },
232
+ emits: [a.ENTER, a.SELECT, a.SPACE, a.TAB],
233
+ setup(s, { emit: e }) {
234
+ const l = (c) => {
235
+ s.disabled || e(c, s.option);
236
+ }, t = o(() => s.disabled ? !0 : null), n = o(() => s.selected ? !0 : null), i = o(() => s.disabled ? -1 : 0);
237
+ return {
238
+ // Values
239
+ ariaDisabled: t,
240
+ ariaSelected: n,
241
+ tabIndex: i,
242
+ // Enums
243
+ BentoListboxEvent: a,
244
+ // Events
245
+ onOptionSelected: l
246
+ };
247
+ }
248
+ });
249
+ var st = function() {
250
+ var e = this, l = e._self._c;
251
+ return e._self._setupProxy, l("bento-listbox-option", { staticClass: "b-listbox-single-select-option", attrs: { disabled: e.disabled, selected: e.selected, "aria-selected": e.ariaSelected, "aria-disabled": e.ariaDisabled, tabindex: e.tabIndex }, on: { click: function(t) {
252
+ return e.onOptionSelected(e.BentoListboxEvent.SELECT);
253
+ }, "enter-pressed": function(t) {
254
+ return e.onOptionSelected(e.BentoListboxEvent.ENTER);
255
+ }, "space-pressed": function(t) {
256
+ return t.preventDefault(), e.onOptionSelected(e.BentoListboxEvent.SPACE);
257
+ }, "tab-pressed": function(t) {
258
+ return e.onOptionSelected(e.BentoListboxEvent.TAB);
259
+ } } }, [e._t("default", function() {
260
+ return [l("span", { staticClass: "b-listbox-single-select-option__text" }, [l("bento-typography", { attrs: { el: "span" } }, [e._v(e._s(e.option.label))]), e.option.description ? l("bento-typography", { staticClass: "b-listbox-single-select-option__description", attrs: { el: "span" } }, [e._v(" " + e._s(e.option.description) + " ")]) : e._e()], 1)];
261
+ }, null, e.option), l("span", { staticClass: "b-listbox-single-select-option__check-icon" }, [l("checkmark-icon", { directives: [{ name: "show", rawName: "v-show", value: e.selected, expression: "selected" }], attrs: { "svg-title": "selected" } })], 1)], 2);
262
+ }, lt = [], nt = /* @__PURE__ */ N(
263
+ tt,
264
+ st,
265
+ lt,
266
+ !1,
267
+ null,
268
+ "5a5ff36a"
269
+ );
270
+ const it = nt.exports, _e = ({ items: s }, e) => {
271
+ const l = o(() => s.value.length - 1), t = A(0), n = (b) => {
272
+ switch (b) {
273
+ case "increase":
274
+ t.value += 1;
275
+ break;
276
+ case "decrease":
277
+ t.value -= 1;
278
+ break;
279
+ }
280
+ }, i = ({ edgeCaseItem: b }, g) => {
281
+ t.value !== b && (n(g), e(t.value));
282
+ }, c = (b) => {
283
+ T(b), i(
284
+ {
285
+ edgeCaseItem: l.value
286
+ },
287
+ "increase"
288
+ /* INCREASE */
289
+ );
290
+ }, v = (b) => {
291
+ T(b), i(
292
+ {
293
+ edgeCaseItem: 0
294
+ },
295
+ "decrease"
296
+ /* DECREASE */
297
+ );
298
+ }, O = () => {
299
+ t.value = 0, e(t.value);
300
+ }, d = () => {
301
+ t.value = l.value, e(t.value);
302
+ }, u = (b) => {
303
+ t.value = b;
304
+ }, T = (b) => {
305
+ var g;
306
+ (g = b == null ? void 0 : b.detail) == null || g.preventDefault();
307
+ };
308
+ return {
309
+ moveToFirstElement: O,
310
+ moveToLastElement: d,
311
+ moveToNextElement: c,
312
+ moveToPreviousElement: v,
313
+ setListboxFocusedIndex: u,
314
+ preventDefault: T,
315
+ focusedIndex: t
316
+ };
317
+ }, ot = w({
318
+ name: "bento-listbox-single-select",
319
+ components: {
320
+ BentoListboxSingleSelectCategory: Ke,
321
+ BentoListboxSingleSelectOption: it
322
+ },
323
+ directives: { BentoKeyboardNavigationDirective: te },
324
+ inheritAttrs: !1,
325
+ props: {
326
+ /**
327
+ * Function that allows the options to be disabled
328
+ *
329
+ * @type {BentoListboxIsOptionDisabled}
330
+ * @param {BentoListboxOptionItem} option - listbox option object
331
+ * @param {string} option.label - Option's label text
332
+ * @param {string|number} option.value - Option's value
333
+ * @param {unknown} option.data - Option's extra data to be passed to the default slot
334
+ */
335
+ isOptionDisabled: {
336
+ type: Function,
337
+ default: () => !1
338
+ },
339
+ /**
340
+ * The option elements to populate the listbox with.
341
+ * It must be an array of {@see BentoListboxOptionItem }.
342
+ *
343
+ * @property {string} value.label - Text to be displayed in the option
344
+ * @property {string,number} value.value - Value of the option
345
+ */
346
+ items: {
347
+ type: Array,
348
+ required: !0
349
+ },
350
+ /**
351
+ * The `input` value.
352
+ * Providing an empty string will select no options.
353
+ * Set to an empty string `''` if you don't want any of the available options to be selected
354
+ */
355
+ selectedValue: {
356
+ type: Array,
357
+ default: void 0
358
+ },
359
+ /**
360
+ * If enabled, dropdown will display non-selectable, static categories
361
+ */
362
+ staticCategories: { type: Boolean, default: !1 }
363
+ },
364
+ emits: [a.SELECT, a.ENTER, a.SPACE, a.TAB],
365
+ setup(s, { emit: e, expose: l, slots: t, attrs: n }) {
366
+ const i = A(null), c = A([]), v = o(() => {
367
+ var m;
368
+ return !!((m = s.selectedValue) != null && m.length) && s.selectedValue.at(0);
369
+ }), O = o(
370
+ () => {
371
+ var m, p, D, k;
372
+ return {
373
+ "aria-label": (m = n["aria-label"]) == null ? void 0 : m.toString(),
374
+ "aria-busy": (p = n["aria-busy"]) == null ? void 0 : p.toString(),
375
+ "aria-atomic": (D = n["aria-atomic"]) == null ? void 0 : D.toString(),
376
+ "aria-live": (k = n["aria-live"]) == null ? void 0 : k.toString()
377
+ };
378
+ }
379
+ ), d = o(() => !!s.items.some(({ items: m }) => !!m)), u = (m) => (p) => {
380
+ e(m, [p]);
381
+ }, T = async () => {
382
+ await fe(), i.value && (b.value = Array.from(i.value.querySelectorAll('[role="option"]')));
383
+ }, b = A([]), g = (m) => {
384
+ var p;
385
+ (p = b.value[m]) == null || p.focus();
386
+ }, {
387
+ moveToNextElement: h,
388
+ moveToPreviousElement: B,
389
+ moveToFirstElement: L,
390
+ moveToLastElement: C,
391
+ setListboxFocusedIndex: I
392
+ } = _e(
393
+ {
394
+ items: b
395
+ },
396
+ g
397
+ );
398
+ z(
399
+ () => s.items,
400
+ () => {
401
+ T();
402
+ },
403
+ { immediate: !0 }
404
+ );
405
+ const E = {
406
+ [$.ARROW_UP]: B,
407
+ [$.ARROW_DOWN]: h,
408
+ [$.HOME]: L,
409
+ [$.END]: C
410
+ }, S = {
411
+ [a.SELECT]: u(a.SELECT),
412
+ [a.SPACE]: u(a.SPACE),
413
+ [a.TAB]: u(a.TAB),
414
+ [a.ENTER]: u(a.ENTER)
415
+ };
416
+ return l({
417
+ /**
418
+ * Reference for a single listbox item.
419
+ * Required for keyboard navigation in dropdown as $children is removed in vue@3
420
+ */
421
+ listboxItemRef: c,
422
+ /**
423
+ * Method to set the index of the item to be focused on
424
+ * Used for focus management to be kept in-sync with parent e.g. dropdowns
425
+ */
426
+ setListboxFocusedIndex: I
427
+ }), {
428
+ // Enums
429
+ BentoListboxEvent: a,
430
+ // Values
431
+ listboxRef: i,
432
+ listboxItemRef: c,
433
+ selectedItem: v,
434
+ slots: t,
435
+ ariaAttributes: O,
436
+ // Computed
437
+ hasCategories: d,
438
+ // Methods
439
+ onOptionSelected: u,
440
+ // Keyboard navigation
441
+ listboxListeners: E,
442
+ listboxOptionListeners: S
443
+ };
444
+ }
445
+ });
446
+ var at = function() {
447
+ var e = this, l = e._self._c;
448
+ return e._self._setupProxy, l("div", e._g(e._b({ directives: [{ name: "bento-keyboard-navigation-directive", rawName: "v-bento-keyboard-navigation-directive" }], ref: "listboxRef", attrs: { role: "listbox" } }, "div", e.ariaAttributes, !1), e.listboxListeners), [e.hasCategories && e.staticCategories ? e._l(e.items, function(t) {
449
+ return l("bento-listbox-single-select-category", { key: t.value, attrs: { "category-label": t.label, role: "group" } }, e._l(t.items, function(n) {
450
+ return l("bento-listbox-single-select-option", e._g({ key: n.value, ref: "listboxItemRef", refInFor: !0, attrs: { role: "option", option: n, disabled: e.isOptionDisabled ? e.isOptionDisabled(n) : null, selected: n.value === e.selectedItem.value }, scopedSlots: e._u([e._l(e.slots, function(i, c) {
451
+ return { key: c, fn: function(v) {
452
+ return [e._t(c, null, null, v)];
453
+ } };
454
+ })], null, !0) }, e.listboxOptionListeners));
455
+ }), 1);
456
+ }) : e._l(e.items, function(t) {
457
+ return l("bento-listbox-single-select-option", e._g({ key: t.value, ref: "listboxItemRef", refInFor: !0, attrs: { role: "option", option: t, disabled: e.isOptionDisabled ? e.isOptionDisabled(t) : null, selected: t.value === e.selectedItem.value }, scopedSlots: e._u([e._l(e.slots, function(n, i) {
458
+ return { key: i, fn: function(c) {
459
+ return [e._t(i, null, null, c)];
460
+ } };
461
+ })], null, !0) }, e.listboxOptionListeners));
462
+ })], 2);
463
+ }, ct = [], rt = /* @__PURE__ */ N(
464
+ ot,
465
+ at,
466
+ ct,
467
+ !1,
468
+ null,
469
+ null
470
+ );
471
+ const ut = rt.exports, dt = {}, bt = /* @__PURE__ */ w({
472
+ ...dt,
473
+ __name: "listbox-decorative-checkbox",
474
+ props: {
475
+ disabled: { type: Boolean, default: !1 },
476
+ indeterminate: { type: Boolean, default: !1 },
477
+ checked: { type: Boolean, default: !1 }
478
+ },
479
+ setup(s) {
480
+ const e = s, l = o(() => ({
481
+ [`b-checkbox-input--${j.DISABLED}`]: e.disabled
482
+ })), t = o(() => ({
483
+ [`b-checkbox-input__outline--${j.UNCHECKED}`]: !e.checked && !e.indeterminate,
484
+ [`b-checkbox-input__outline--${j.CHECKED}`]: e.checked && !e.indeterminate,
485
+ [`b-checkbox-input__outline--${j.INDETERMINATE}`]: e.indeterminate
486
+ }));
487
+ return { __sfc: !0, props: e, conditionalClasses: l, outlineConditionalClasses: t, CheckmarkSmallIcon: Ne, MinusSmallIcon: $e };
488
+ }
489
+ });
490
+ var ft = function() {
491
+ var e = this, l = e._self._c, t = e._self._setupProxy;
492
+ return l("div", { staticClass: "b-checkbox-input", class: t.conditionalClasses, attrs: { role: "presentation" } }, [e.indeterminate ? l(t.MinusSmallIcon, { staticClass: "b-checkbox-input__icon", attrs: { "svg-title": "", "aria-hidden": "true" } }) : e.checked ? l(t.CheckmarkSmallIcon, { staticClass: "b-checkbox-input__icon", attrs: { "svg-title": "", "aria-hidden": "true" } }) : e._e(), l("div", { staticClass: "b-checkbox-input__outline", class: t.outlineConditionalClasses })], 1);
493
+ }, vt = [], _t = /* @__PURE__ */ N(
494
+ bt,
495
+ ft,
496
+ vt,
497
+ !1,
498
+ null,
499
+ "5dc60f05"
500
+ );
501
+ const se = _t.exports;
502
+ var me = /* @__PURE__ */ ((s) => (s.DISABLED = "disabled", s.STATIC_CATEGORY = "static-category", s))(me || {}), Y = /* @__PURE__ */ ((s) => (s.SELECT_CATEGORY = "select-category", s.UNSELECT_CATEGORY = "unselect-category", s.TOGGLE_CATEGORY_VISIBILITY = "toggle-category-visibility", s))(Y || {});
503
+ const mt = {
504
+ "en-US": {
505
+ categoryClosed: "{category} closed",
506
+ categoryOpened: "{category} opened"
507
+ }
508
+ }, pt = w({
509
+ i18n: { messages: mt },
510
+ name: "bento-listbox-multi-select-category",
511
+ components: {
512
+ BentoTypography: W,
513
+ BentoListboxOption: H,
514
+ ChevronDownIcon: Me,
515
+ ChevronUpIcon: we,
516
+ ListboxDecorativeCheckbox: se
517
+ },
518
+ props: {
519
+ /**
520
+ * The option elements to populate the listbox with.
521
+ * It must be an array of {@see BentoListboxOptionItem }.
522
+ *
523
+ * @property {string} value.label - Text to be displayed in the option
524
+ * @property {string,number} value.value - Value of the option
525
+ * @property {BentoListboxOptionItem} value.items - Category items list
526
+ */
527
+ category: {
528
+ type: Object,
529
+ required: !0
530
+ },
531
+ /**
532
+ * Function that allows the options to be disabled
533
+ *
534
+ * @type {BentoListboxIsOptionDisabled}
535
+ * @param {BentoListboxOptionItem} option - listbox option object
536
+ * @param {string} option.label - Option's label text
537
+ * @param {string|number} option.value - Option's value
538
+ * @param {unknown} option.data - Option's extra data to be passed to the default slot
539
+ */
540
+ isOptionDisabled: {
541
+ type: [Function],
542
+ default: () => !1
543
+ },
544
+ /**
545
+ * The `input` value.
546
+ * Providing an empty array will select no options.
547
+ */
548
+ selectedItemsList: {
549
+ type: Array,
550
+ default: () => []
551
+ },
552
+ /**
553
+ * If enabled, dropdown will display non-selectable, static categories
554
+ */
555
+ staticCategories: { type: Boolean, default: !1 },
556
+ /**
557
+ * Category's tabindex
558
+ */
559
+ tabindex: { type: Number, default: -1 }
560
+ },
561
+ emits: [
562
+ Y.SELECT_CATEGORY,
563
+ Y.UNSELECT_CATEGORY,
564
+ Y.TOGGLE_CATEGORY_VISIBILITY
565
+ ],
566
+ setup(s, { emit: e }) {
567
+ const l = A(!1), { t } = ee(), n = (p) => s.isOptionDisabled ? s.isOptionDisabled(p) : !1, i = o(
568
+ () => s.category.items.every((p) => n(p))
569
+ ), c = Q(s, "staticCategories"), v = o(() => l.value || s.staticCategories), O = o(() => ({
570
+ [`b-listbox-multi-select-category--${me.DISABLED}`]: i.value
571
+ })), d = (p) => {
572
+ p.preventDefault(), l.value = !l.value, e(Y.TOGGLE_CATEGORY_VISIBILITY);
573
+ }, u = (p) => {
574
+ var P;
575
+ const D = n(p), k = ((P = s.selectedItemsList) == null ? void 0 : P.includes(p.value)) || !1;
576
+ return { isDisabled: D, isPreSelected: k };
577
+ }, T = o(
578
+ () => s.category.items.filter((p) => {
579
+ const { isDisabled: D, isPreSelected: k } = u(p);
580
+ return D && k || !D;
581
+ })
582
+ ), b = o(
583
+ () => {
584
+ var p;
585
+ return (p = T.value) == null ? void 0 : p.filter(
586
+ ({ value: D }) => {
587
+ var k;
588
+ return (k = s.selectedItemsList) == null ? void 0 : k.includes(D);
589
+ }
590
+ );
591
+ }
592
+ ), g = o(() => {
593
+ const p = l.value ? "categoryOpened" : "categoryClosed";
594
+ return t(p, { category: s.category.label });
595
+ }), h = () => {
596
+ e(Y.SELECT_CATEGORY);
597
+ }, B = () => {
598
+ e(Y.UNSELECT_CATEGORY);
599
+ }, { isAllSelected: L, isIndeterminate: C, toggleSelectAll: I } = ve(
600
+ b,
601
+ T,
602
+ h,
603
+ B
604
+ ), E = o(() => C.value ? "mixed" : `${L.value}`), S = A(L.value), m = () => {
605
+ S.value = !S.value, I(S.value);
606
+ };
607
+ return z(L, () => {
608
+ S.value = L.value;
609
+ }), {
610
+ // Values
611
+ chevronTitle: g,
612
+ conditionalClass: O,
613
+ hasAllPropsDisabled: i,
614
+ isOpen: l,
615
+ isAllSelected: L,
616
+ isIndeterminate: C,
617
+ isStaticCategory: c,
618
+ // Computed
619
+ showItemChildren: v,
620
+ ariaCheckedComputed: E,
621
+ // Methods
622
+ handleSelectAll: m,
623
+ toggleOpen: d,
624
+ toggleSelectAll: I
625
+ };
626
+ }
627
+ });
628
+ var gt = function() {
629
+ var e = this, l = e._self._c;
630
+ return e._self._setupProxy, l("div", [e.isStaticCategory ? l("div", { staticClass: "b-listbox-multi-select-category b-listbox-multi-select-category--static-category" }, [l("span", { staticClass: "b-listbox-multi-select-category__label" }, [l("bento-typography", { staticClass: "b-listbox-multi-select-category__label-text", attrs: { el: "span", variant: "caption" } }, [e._v(" " + e._s(e.category.label) + " ")])], 1)]) : l("bento-listbox-option", { staticClass: "b-listbox-multi-select-category__option", class: e.conditionalClass, attrs: { tabindex: e.tabindex, "aria-checked": e.ariaCheckedComputed, "aria-disabled": e.hasAllPropsDisabled }, on: { click: e.handleSelectAll, "enter-pressed": e.handleSelectAll, "space-pressed": function(t) {
631
+ return t.preventDefault(), e.handleSelectAll.apply(null, arguments);
632
+ } } }, [l("listbox-decorative-checkbox", { attrs: { indeterminate: e.isIndeterminate, disabled: e.hasAllPropsDisabled, checked: e.isAllSelected } }), l("span", { staticClass: "b-listbox-multi-select-category__label" }, [l("bento-typography", { staticClass: "b-listbox-multi-select-category__label-text", attrs: { el: "span" } }, [e._v(" " + e._s(e.category.label) + " ")]), l("div", { staticClass: "b-listbox-multi-select-category__label-chevron", attrs: { "data-testid": "toggle-listbox" }, on: { "!click": function(t) {
633
+ return t.stopPropagation(), e.toggleOpen.apply(null, arguments);
634
+ } } }, [e.isOpen ? l("chevron-up-icon", { attrs: { "svg-title": e.chevronTitle } }) : l("chevron-down-icon", { attrs: { "svg-title": e.chevronTitle } })], 1)], 1)], 1), l("div", { directives: [{ name: "show", rawName: "v-show", value: e.showItemChildren, expression: "showItemChildren" }] }, [e._t("default")], 2)], 1);
635
+ }, yt = [], ht = /* @__PURE__ */ N(
636
+ pt,
637
+ gt,
638
+ yt,
639
+ !1,
640
+ null,
641
+ "a2ed984e"
642
+ );
643
+ const xt = ht.exports;
644
+ var M = /* @__PURE__ */ ((s) => (s.SELECT_CATEGORY = "select-category", s.TOGGLE_CHECKBOX_SELECTION = "toggle-checkbox-selection", s.UNSELECT_CATEGORY = "unselect-category", s.TOGGLE_CATEGORY_VISIBILITY = "toggle-category-visibility", s))(M || {});
645
+ const Ct = w({
646
+ name: "listbox-multi-select-options",
647
+ components: {
648
+ BentoListboxOption: H,
649
+ BentoTypography: W,
650
+ ListboxMultiSelectCategory: xt,
651
+ ListboxDecorativeCheckbox: se
652
+ },
653
+ props: {
654
+ /**
655
+ * Indicates if the items listed are inside a category
656
+ * so they can be padded to right by one level in recursion.
657
+ * Items of categories are automatically defined as "categoryItems"
658
+ */
659
+ categoryItems: { type: Boolean, default: !1 },
660
+ /**
661
+ * Current focused option index
662
+ */
663
+ focusedIndex: { type: Number, default: 0 },
664
+ /**
665
+ * Function that allows the options to be disabled
666
+ *
667
+ * @type {BentoListboxIsOptionDisabled}
668
+ * @param {BentoListboxOptionItem} option - listbox option object
669
+ * @param {string} option.label - Option's label text
670
+ * @param {string|number} option.value - Option's value
671
+ * @param {unknown} option.data - Option's extra data to be passed to the default slot
672
+ */
673
+ isOptionDisabled: {
674
+ type: Function,
675
+ default: () => !1
676
+ },
677
+ /**
678
+ * The option elements to populate the listbox with.
679
+ * It must be an array of {@see BentoListboxOptionItem }.
680
+ *
681
+ * @property {string} value.label - Text to be displayed in the option
682
+ * @property {string,number} value.value - Value of the option
683
+ */
684
+ items: {
685
+ type: Array,
686
+ required: !0
687
+ },
688
+ /**
689
+ * Indicates if the elements options are inside a multi-level category
690
+ */
691
+ isMultiLevel: { type: Boolean, default: !1 },
692
+ /**
693
+ * Flag that indicates that an external search it's being made
694
+ * to filter out the items inside the the multi-select listbox
695
+ *
696
+ * If enabled, hides the "Select all" checkbox in "multiple" mode.
697
+ */
698
+ searching: { type: Boolean, default: !1 },
699
+ /**
700
+ * List of selected items.
701
+ * Providing an empty array will select no options.
702
+ */
703
+ selectedItemsList: {
704
+ type: Array,
705
+ default: () => []
706
+ },
707
+ /**
708
+ * If enabled, dropdown will display non-selectable, static categories
709
+ */
710
+ staticCategories: { type: Boolean, default: !1 }
711
+ },
712
+ emits: [
713
+ M.TOGGLE_CHECKBOX_SELECTION,
714
+ M.SELECT_CATEGORY,
715
+ M.UNSELECT_CATEGORY,
716
+ M.TOGGLE_CATEGORY_VISIBILITY
717
+ ],
718
+ setup(s, { emit: e }) {
719
+ const l = (d) => {
720
+ s.isOptionDisabled(d) || e(M.TOGGLE_CHECKBOX_SELECTION, d);
721
+ }, t = (d) => !!d.items, n = (d) => {
722
+ const u = s.isMultiLevel && s.searching;
723
+ return d.description && (!s.isMultiLevel || u);
724
+ }, i = (d) => d.items ? !!d.items.find((u) => s.selectedItemsList.includes(u.value)) : s.selectedItemsList.includes(d.value), c = (d) => {
725
+ if (t(d)) {
726
+ const u = i(d) ? M.UNSELECT_CATEGORY : M.SELECT_CATEGORY;
727
+ e(u, d);
728
+ } else
729
+ l(d);
730
+ };
731
+ return {
732
+ // Values
733
+ conditionalClasses: o(() => ({
734
+ "b-listbox-multi-select-options__static-category-option": s.staticCategories,
735
+ "b-listbox-multi-select-options__category-option": s.categoryItems
736
+ })),
737
+ // Methods
738
+ isOptionSelected: i,
739
+ shouldShowDescription: n,
740
+ toggleCheckboxSelection: l,
741
+ toggleSearchOption: c,
742
+ computedTabindex: (d) => d + 1 === s.focusedIndex ? 0 : -1,
743
+ // Enums
744
+ BentoListboxEvent: a,
745
+ ListboxMultiSelectOptionsEvent: M
746
+ };
747
+ }
748
+ });
749
+ var St = function() {
750
+ var e = this, l = e._self._c;
751
+ return e._self._setupProxy, l("div", e._l(e.items, function(t, n) {
752
+ return l("div", { key: `selected-${t.value}` }, [e.searching && e.isMultiLevel ? [l("bento-listbox-option", { staticClass: "b-listbox-multi-select-options", class: e.conditionalClasses, attrs: { disabled: e.isOptionDisabled ? e.isOptionDisabled(t) : null, tabindex: e.computedTabindex(n), "aria-checked": `${e.isOptionSelected(t)}`, "aria-disabled": e.isOptionDisabled ? e.isOptionDisabled(t) : null }, on: { click: function(i) {
753
+ return e.toggleSearchOption(t);
754
+ }, "enter-pressed": function(i) {
755
+ return e.toggleSearchOption(t);
756
+ }, "space-pressed": function(i) {
757
+ return i.preventDefault(), e.toggleSearchOption(t);
758
+ } } }, [l("listbox-decorative-checkbox", { attrs: { disabled: e.isOptionDisabled ? e.isOptionDisabled(t) : null, checked: e.isOptionSelected(t) } }), e._t("default", function() {
759
+ return [l("span", { staticClass: "b-listbox-multi-select__option-text" }, [l("bento-typography", { attrs: { el: "span" } }, [e._v(e._s(t.label))]), e.shouldShowDescription(t) ? l("bento-typography", { staticClass: "b-listbox-multi-select__option-description", attrs: { el: "span" } }, [e._v(" " + e._s(t.description) + " ")]) : e._e()], 1)];
760
+ }, null, t)], 2)] : [t.items ? [l("listbox-multi-select-category", { attrs: { category: t, "static-categories": e.staticCategories, "is-option-disabled": e.isOptionDisabled, "selected-items-list": e.selectedItemsList, tabindex: e.computedTabindex(n) }, on: { "select-category": function(i) {
761
+ return e.$emit(e.ListboxMultiSelectOptionsEvent.SELECT_CATEGORY, t);
762
+ }, "unselect-category": function(i) {
763
+ return e.$emit(e.ListboxMultiSelectOptionsEvent.UNSELECT_CATEGORY, t);
764
+ }, "toggle-category-visibility": function(i) {
765
+ return e.$emit(e.ListboxMultiSelectOptionsEvent.TOGGLE_CATEGORY_VISIBILITY);
766
+ } } }, [l("listbox-multi-select-options", { attrs: { "category-items": "", items: t.items, "is-option-disabled": e.isOptionDisabled, "focused-index": e.focusedIndex, "is-multi-level": e.isMultiLevel, "static-categories": e.staticCategories, "selected-items-list": e.selectedItemsList, searching: e.searching }, on: { "toggle-checkbox-selection": (i) => e.toggleCheckboxSelection(i) } })], 1)] : l("bento-listbox-option", { staticClass: "b-listbox-multi-select-options", class: e.conditionalClasses, attrs: { disabled: e.isOptionDisabled ? e.isOptionDisabled(t) : null, tabindex: e.computedTabindex(n), "aria-checked": `${e.isOptionSelected(t)}`, "aria-disabled": e.isOptionDisabled ? e.isOptionDisabled(t) : null }, on: { click: function(i) {
767
+ return e.toggleCheckboxSelection(t);
768
+ }, "enter-pressed": function(i) {
769
+ return e.toggleCheckboxSelection(t);
770
+ }, "space-pressed": function(i) {
771
+ return i.preventDefault(), e.toggleCheckboxSelection(t);
772
+ } } }, [l("listbox-decorative-checkbox", { attrs: { disabled: e.isOptionDisabled ? e.isOptionDisabled(t) : null, checked: e.isOptionSelected(t) } }), e._t("default", function() {
773
+ return [l("span", { staticClass: "b-listbox-multi-select__option-text" }, [l("bento-typography", { attrs: { el: "span" } }, [e._v(e._s(t.label))]), e.shouldShowDescription(t) ? l("bento-typography", { staticClass: "b-listbox-multi-select__option-description", attrs: { el: "span" } }, [e._v(" " + e._s(t.description) + " ")]) : e._e()], 1)];
774
+ }, null, t)], 2)]], 2);
775
+ }), 0);
776
+ }, Et = [], Ot = /* @__PURE__ */ N(
777
+ Ct,
778
+ St,
779
+ Et,
780
+ !1,
781
+ null,
782
+ "e4488ed3"
783
+ );
784
+ const Tt = Ot.exports, At = (s) => {
785
+ const e = o(() => {
786
+ var t;
787
+ return !!((t = s.value) != null && t.find(({ items: n }) => !!n));
788
+ }), l = o(() => {
789
+ var t;
790
+ return e.value ? (t = s.value) == null ? void 0 : t.reduce((n, i) => (i.items ? n.push(...i.items.flat()) : n.push(i), n), []) : s.value;
791
+ });
792
+ return {
793
+ isMultiLevelSelect: e,
794
+ flattenedItemsList: l
795
+ };
796
+ }, It = {
797
+ "en-US": {
798
+ allSelected: "All selected ({total})",
799
+ numberOfTotalSelected: "{number} of {total} selected",
800
+ numbersSelected: "{number} selected",
801
+ selectAll: "Select all ({total})"
802
+ }
803
+ }, Lt = { i18n: { messages: It } }, kt = /* @__PURE__ */ w({
804
+ ...Lt,
805
+ __name: "listbox-multi-select",
806
+ props: {
807
+ hasMoreItems: { type: Boolean, default: !1 },
808
+ isOptionDisabled: { default: () => () => !1 },
809
+ items: null,
810
+ lazyLoadType: { default: "none" },
811
+ searching: { type: Boolean, default: !1 },
812
+ selectedValues: null,
813
+ staticCategories: { type: Boolean, default: !1 }
814
+ },
815
+ emits: ["select"],
816
+ setup(s, { expose: e, emit: l }) {
817
+ const t = s, { t: n } = ee(), i = Ie(), c = Le(), v = o(
818
+ () => {
819
+ var r, f, _, x;
820
+ return {
821
+ "aria-label": (r = c["aria-label"]) == null ? void 0 : r.toString(),
822
+ "aria-busy": (f = c["aria-busy"]) == null ? void 0 : f.toString(),
823
+ "aria-atomic": (_ = c["aria-atomic"]) == null ? void 0 : _.toString(),
824
+ "aria-live": (x = c["aria-live"]) == null ? void 0 : x.toString()
825
+ };
826
+ }
827
+ ), O = A(null), d = A(null), u = A(null), T = A(null), b = o(() => t.selectedValues.map(({ value: r }) => r)), { isMultiLevelSelect: g, flattenedItemsList: h } = At(Q(t, "items")), B = (r) => {
828
+ var x;
829
+ const f = t.isOptionDisabled(r), _ = ((x = b.value) == null ? void 0 : x.includes(r.value)) || !1;
830
+ return { isDisabled: f, isPreSelected: _ };
831
+ }, L = o(() => {
832
+ if (t.searching && g)
833
+ return t.items;
834
+ const r = h.value.filter((f) => {
835
+ const { isDisabled: _, isPreSelected: x } = B(f);
836
+ return _ && x || !_;
837
+ });
838
+ return t.selectedValues.forEach((f) => {
839
+ r.find((_) => _.value === f.value) || r.push(f);
840
+ }), r;
841
+ }), C = o(
842
+ () => {
843
+ var r;
844
+ return (r = L.value) == null ? void 0 : r.filter((f) => {
845
+ var _;
846
+ return f.items && g.value && t.searching ? f.items.filter(
847
+ (y) => (t.selectedValues ?? []).includes(y.value)
848
+ ).length === f.items.length : (_ = b.value) == null ? void 0 : _.includes(f.value);
849
+ });
850
+ }
851
+ ), I = () => g.value && !t.searching ? h.value.length : t.items.length, E = o(() => {
852
+ var x;
853
+ const r = L.value.length, f = I(), _ = ((x = C.value) == null ? void 0 : x.length) || 0;
854
+ return _ === 0 ? n("selectAll", { total: r }) : _ === f ? n("allSelected", { total: f }) : _ <= f ? n("numberOfTotalSelected", { number: _, total: f }) : n("numbersSelected", { number: _ });
855
+ }), S = (r) => {
856
+ const f = (x) => {
857
+ const { isDisabled: y, isPreSelected: G } = B(x);
858
+ return y && G || !y;
859
+ }, _ = r.filter(f).filter((x) => !b.value.includes(x.value));
860
+ l("select", [...t.selectedValues, ..._]);
861
+ }, m = (r) => {
862
+ const f = (y) => {
863
+ const { isDisabled: G, isPreSelected: Oe } = B(y);
864
+ return !(G && Oe);
865
+ }, _ = r.filter(f).map(({ value: y }) => y), x = t.selectedValues.filter((y) => !(_ != null && _.includes(y.value)));
866
+ l("select", x);
867
+ }, p = () => {
868
+ S(h.value);
869
+ }, D = () => {
870
+ m(h.value);
871
+ }, { isAllSelected: k, isIndeterminate: P, toggleSelectAll: V } = ve(
872
+ C,
873
+ L,
874
+ p,
875
+ D
876
+ ), X = o(() => P.value ? "mixed" : `${k.value}`), F = A(k.value), R = () => {
877
+ F.value = !F.value, V(F.value);
878
+ };
879
+ z(k, () => {
880
+ F.value = k.value;
881
+ });
882
+ const K = (r) => {
883
+ S(r.items);
884
+ }, pe = (r) => {
885
+ m(r.items);
886
+ }, ge = (r, f) => {
887
+ let _ = !1;
888
+ const x = t.selectedValues.filter(({ value: y }) => f.value === y ? (_ = !0, !1) : !0);
889
+ _ || x.push(f), l(r, x);
890
+ }, ye = o(() => {
891
+ if (!g.value)
892
+ return t.selectedValues;
893
+ const r = (y) => b.value.includes(y.value), f = (y) => !t.staticCategories && y.every((G) => r(G));
894
+ return t.items.flatMap(
895
+ (y) => y.items && !f(y.items) ? y.items : y
896
+ ).filter((y) => y.items ? !0 : r(y));
897
+ }), he = o(() => {
898
+ var _, x, y, G;
899
+ const r = ["automatic", "button"].includes(t.lazyLoadType), f = ((_ = t.selectedValues) == null ? void 0 : _.length) > 0 && ((x = C.value) == null ? void 0 : x.length) !== ((y = h.value) == null ? void 0 : y.length);
900
+ return r && t.hasMoreItems ? !!((G = t.selectedValues) != null && G.length) : f;
901
+ }), xe = o(() => ["automatic", "button"].includes(t.lazyLoadType) ? !t.hasMoreItems : !0), q = A([]), le = async () => {
902
+ await fe(), O.value && (q.value = Array.from(
903
+ O.value.querySelectorAll('[role="option"]')
904
+ ).filter((r) => r.checkVisibility()));
905
+ }, ne = (r) => {
906
+ var f;
907
+ (f = q.value[r]) == null || f.focus();
908
+ }, {
909
+ moveToNextElement: ie,
910
+ moveToPreviousElement: oe,
911
+ moveToFirstElement: ae,
912
+ moveToLastElement: ce,
913
+ preventDefault: J,
914
+ focusedIndex: Ce,
915
+ setListboxFocusedIndex: re
916
+ } = _e(
917
+ {
918
+ items: q
919
+ },
920
+ ne
921
+ ), Se = {
922
+ [$.ARROW_UP]: (r) => oe(r),
923
+ [$.ARROW_DOWN]: (r) => ie(r),
924
+ [$.HOME]: ae,
925
+ [$.END]: ce
926
+ };
927
+ e({
928
+ /**
929
+ * Method to set the index of the item to be focused on
930
+ * Used for focus management to be kept in-sync with parent e.g. dropdowns
931
+ */
932
+ setListboxFocusedIndex: re
933
+ });
934
+ const Ee = {
935
+ [$.ARROW_UP]: J,
936
+ [$.ARROW_DOWN]: J
937
+ };
938
+ return z(
939
+ () => t.items,
940
+ () => {
941
+ le();
942
+ },
943
+ { immediate: !0 }
944
+ ), { __sfc: !0, props: t, emit: l, t: n, slots: i, attrs: c, ariaAttributes: v, listboxRef: O, selectAllListboxItemsRef: d, selectedListboxItemsRef: u, listboxItemsRef: T, selectedItemsList: b, isMultiLevelSelect: g, flattenedItemsList: h, optionStates: B, enabledItems: L, visibleSelectedList: C, calculateTotalItems: I, selectAllCheckboxText: E, selectAll: S, unselectAll: m, selectAllItems: p, unselectAllItems: D, isAllSelected: k, isIndeterminate: P, toggleSelectAll: V, ariaCheckedComputed: X, isSelectAllOn: F, handleSelectAll: R, selectAllCategory: K, unselectAllCategory: pe, toggleCheckboxSelection: ge, selectedOptions: ye, showSelectedItems: he, showSelectAllCheckbox: xe, visibleDomOptions: q, updateVisibleDomOptions: le, focusItem: ne, moveToNextElement: ie, moveToPreviousElement: oe, moveToFirstElement: ae, moveToLastElement: ce, preventDefault: J, focusedIndex: Ce, setListboxFocusedIndex: re, listboxListeners: Se, chipsSectionListeners: Ee, ListboxDecorativeCheckbox: se, BentoTypography: W, BentoChip: Be, BentoListboxOption: H, ListboxMultiSelectOptions: Tt, vBentoKeyboardNavigationDirective: te, BentoListboxEvent: a };
945
+ }
946
+ });
947
+ var Dt = function() {
948
+ var e = this, l = e._self._c, t = e._self._setupProxy;
949
+ return l("div", { ref: "listboxRef", staticClass: "b-listbox-multi-select" }, [t.showSelectedItems ? l("div", [l("ul", e._g({ directives: [{ name: "bento-keyboard-navigation-directive", rawName: "v-bento-keyboard-navigation-directive" }], staticClass: "b-listbox-multi-select__chips" }, t.chipsSectionListeners), e._l(t.selectedOptions, function(n) {
950
+ return l("li", { key: n.value }, [l(t.BentoChip, { ref: "selectedListboxItemsRef", refInFor: !0, attrs: { disabled: e.isOptionDisabled(n), label: n.label, condensed: "" }, on: { click: function(i) {
951
+ n.items ? t.unselectAllCategory(n) : t.toggleCheckboxSelection("select", n);
952
+ } } })], 1);
953
+ }), 0), l("hr", { staticClass: "b-listbox-multi-select__divider", attrs: { "aria-hidden": "true" } })]) : e._e(), l("div", e._g(e._b({ directives: [{ name: "bento-keyboard-navigation-directive", rawName: "v-bento-keyboard-navigation-directive" }], attrs: { role: "listbox" } }, "div", t.ariaAttributes, !1), t.listboxListeners), [t.showSelectAllCheckbox ? l(t.BentoListboxOption, { ref: "selectAllListboxItemsRef", staticClass: "b-listbox-multi-select__option", attrs: { tabindex: t.focusedIndex === 0 ? 0 : -1, "aria-checked": t.ariaCheckedComputed }, on: { click: t.handleSelectAll, "enter-pressed": t.handleSelectAll, "space-pressed": function(n) {
954
+ return n.preventDefault(), t.handleSelectAll.apply(null, arguments);
955
+ } } }, [l(t.ListboxDecorativeCheckbox, { attrs: { checked: t.isAllSelected, indeterminate: t.isIndeterminate } }), l(t.BentoTypography, { attrs: { el: "span" } }, [e._v(" " + e._s(t.selectAllCheckboxText) + " ")])], 1) : e._e(), t.showSelectAllCheckbox ? l("hr", { staticClass: "b-listbox-multi-select__divider", attrs: { "aria-hidden": "true" } }) : e._e(), l(t.ListboxMultiSelectOptions, { ref: "listboxItemsRef", attrs: { items: e.items, "is-option-disabled": e.isOptionDisabled, "is-multi-level": t.isMultiLevelSelect, "static-categories": e.staticCategories, searching: e.searching, "selected-items-list": t.selectedItemsList, "focused-index": t.focusedIndex }, on: { "toggle-checkbox-selection": function(n) {
956
+ return t.toggleCheckboxSelection("select", n);
957
+ }, "select-category": t.selectAllCategory, "unselect-category": t.unselectAllCategory, "toggle-category-visibility": t.updateVisibleDomOptions, "space-pressed": function(n) {
958
+ return t.toggleCheckboxSelection(t.BentoListboxEvent.SPACE, n);
959
+ }, "tab-pressed": function(n) {
960
+ return t.toggleCheckboxSelection(t.BentoListboxEvent.TAB, n);
961
+ }, "enter-pressed": function(n) {
962
+ return t.toggleCheckboxSelection(t.BentoListboxEvent.ENTER, n);
963
+ } }, scopedSlots: e._u([e._l(t.slots, function(n, i) {
964
+ return { key: i, fn: function(c) {
965
+ return [e._t(i, null, null, c)];
966
+ } };
967
+ })], null, !0) })], 1)]);
968
+ }, Rt = [], Bt = /* @__PURE__ */ N(
969
+ kt,
970
+ Dt,
971
+ Rt,
972
+ !1,
973
+ null,
974
+ "d866c0f0"
975
+ );
976
+ const be = Bt.exports, $t = {
977
+ "en-US": {
978
+ loading: "Loading",
979
+ showMore: "Show more"
980
+ },
981
+ "ja-JP": {
982
+ loading: "読み込み中",
983
+ showMore: "表示内容を増やす"
984
+ },
985
+ "pt-BR": {
986
+ loading: "Carregando",
987
+ showMore: "Mostrar mais"
988
+ }
989
+ }, Nt = 36, Mt = w({
990
+ name: "bento-listbox",
991
+ components: {
992
+ BentoEmptyState: De,
993
+ BentoListboxSingleSelect: ut,
994
+ BentoListboxMultiSelect: be,
995
+ BentoTypography: W,
996
+ BentoLoadingIndicator: ke,
997
+ BentoLoadingButton: Ge
998
+ },
999
+ directives: { BentoKeyboardNavigationDirective: te },
1000
+ i18n: { messages: $t },
1001
+ props: {
1002
+ /**
1003
+ * Defines a string value that labels an interactive element.
1004
+ */
1005
+ ariaLabel: { type: String, default: null },
1006
+ /**
1007
+ * Empty state props that will be used with the inner empty state component to be displayed when no search results are found.
1008
+ */
1009
+ emptyState: {
1010
+ type: Object,
1011
+ default: void 0
1012
+ },
1013
+ /**
1014
+ * Indicates whether there are more items to load
1015
+ */
1016
+ hasMoreItems: { type: Boolean, default: !1 },
1017
+ /**
1018
+ * Identifies the listbox whose contents are controlled by the the combobox on which the aria-controls attribute is set.
1019
+ */
1020
+ id: { type: String, required: !0 },
1021
+ /**
1022
+ * Function that allows the options to be disabled
1023
+ *
1024
+ * @type {BentoListboxIsOptionDisabled}
1025
+ * @param {BentoListboxOptionItem} option - Listbox option object
1026
+ * @param {string} option.label - Option's label text
1027
+ * @param {string|number} option.value - Option's value
1028
+ * @param {unknown} option.data - Option's extra data to be passed to the default slot
1029
+ */
1030
+ isOptionDisabled: {
1031
+ type: Function,
1032
+ default: () => {
1033
+ }
1034
+ },
1035
+ /**
1036
+ * The option elements to populate the listbox with.
1037
+ * It must be an array of {@see BentoListboxOptionItem }
1038
+ * * @property {string} value.label - Text to be displayed in the option
1039
+ * * @property {string,number} value.value - Value of the option
1040
+ */
1041
+ items: {
1042
+ type: Array,
1043
+ required: !0
1044
+ },
1045
+ /**
1046
+ * Indicates if new options are lazy loading.
1047
+ */
1048
+ loading: { type: Boolean, default: !1 },
1049
+ /**
1050
+ * The type of `Lazy Load`.
1051
+ * Type "automatic" will enable infinite scrolling
1052
+ * Type "button" will enable lazy loading with "Show more" button
1053
+ */
1054
+ lazyLoadType: {
1055
+ type: String,
1056
+ default: U.NONE,
1057
+ validator: (s) => Object.values(U).includes(s)
1058
+ },
1059
+ /**
1060
+ * Indicates the listbox is loading filtered items.
1061
+ */
1062
+ componentLoading: { type: Boolean, default: !1 },
1063
+ /**
1064
+ * If enabled, the user will be able to select multiple items.
1065
+ */
1066
+ multiple: { type: Boolean, default: !1 },
1067
+ /**
1068
+ * If enabled, dropdown will display non-selectable, static categories
1069
+ */
1070
+ staticCategories: { type: Boolean, default: !1 },
1071
+ /**
1072
+ * Messaged displayed when no items are listed in the listbox
1073
+ */
1074
+ noResultsMessage: { type: String, required: !0 },
1075
+ /**
1076
+ * Flag that indicates that an external search it's being made
1077
+ * to filter out the items inside the the multi-select listbox
1078
+ *
1079
+ * If enabled, hides the "Select all" checkbox in "multiple" mode.
1080
+ */
1081
+ searching: be.props.searching,
1082
+ /**
1083
+ * The `input` value.
1084
+ * Providing an empty string or empty array will select no options.
1085
+ * Set to an empty string `''` if you don't want any of the available options to be selected for single select
1086
+ */
1087
+ selectedValue: {
1088
+ type: Array,
1089
+ default: () => []
1090
+ },
1091
+ /**
1092
+ * Enables virtual scrolling if set to true or by providing an object with itemHeight function.
1093
+ * The itemHeight function is used to calculate the height of rendered item given it's index.
1094
+ */
1095
+ virtualScroll: {
1096
+ type: [Boolean, Object],
1097
+ default: !1
1098
+ }
1099
+ },
1100
+ emits: [
1101
+ a.SELECT,
1102
+ a.SPACE,
1103
+ a.SHOW_MORE,
1104
+ a.ENTER,
1105
+ a.ESCAPE,
1106
+ a.TAB
1107
+ ],
1108
+ setup(s, { emit: e, slots: l }) {
1109
+ const t = A([]), n = Q(s, "items"), { t: i } = ee(), c = o(() => s.lazyLoadType !== U.AUTOMATIC), v = o(() => s.lazyLoadType === U.AUTOMATIC), O = () => {
1110
+ var R;
1111
+ return typeof (s == null ? void 0 : s.virtualScroll) == "object" && ((R = s == null ? void 0 : s.virtualScroll) != null && R.itemHeight) ? s.virtualScroll.itemHeight : Nt;
1112
+ }, {
1113
+ containerRef: d,
1114
+ containerProps: u,
1115
+ onScroll: T,
1116
+ list: b,
1117
+ wrapperProps: g
1118
+ } = Fe(n, {
1119
+ itemHeight: O(),
1120
+ // Disable virtual scrolling if not enabled or if lazy loading is enabled or if multi-select
1121
+ disabled: (s == null ? void 0 : s.multiple) || (s == null ? void 0 : s.virtualScroll) === !1 || (s == null ? void 0 : s.lazyLoadType) !== "none"
1122
+ }), h = o(
1123
+ () => s.componentLoading !== void 0 || c.value ? "true" : void 0
1124
+ ), B = o(
1125
+ () => c.value && s.loading || s.componentLoading ? "true" : "false"
1126
+ ), L = o(
1127
+ () => c.value || s.componentLoading !== void 0 ? "polite" : void 0
1128
+ ), C = o(
1129
+ () => ({
1130
+ "aria-label": s.ariaLabel,
1131
+ "aria-busy": B.value,
1132
+ "aria-atomic": h.value,
1133
+ "aria-live": L.value
1134
+ })
1135
+ ), I = o(
1136
+ () => s.componentLoading ? {
1137
+ ...C.value,
1138
+ role: "alert"
1139
+ } : {}
1140
+ ), E = (R) => (K) => {
1141
+ e(R, K);
1142
+ }, S = () => {
1143
+ e(a.SHOW_MORE);
1144
+ }, m = Re(() => {
1145
+ const R = d.value;
1146
+ if (!R)
1147
+ return;
1148
+ const K = Math.round(R.scrollTop) + R.clientHeight >= R.scrollHeight;
1149
+ s.hasMoreItems && K && !s.loading && S();
1150
+ }), p = () => {
1151
+ v.value ? m() : T();
1152
+ }, D = o(() => {
1153
+ var R;
1154
+ return ((R = s.items) == null ? void 0 : R.length) === 0;
1155
+ }), k = o(
1156
+ () => s.lazyLoadType === U.BUTTON && s.hasMoreItems
1157
+ ), P = o(
1158
+ () => s.loading ? ue.LOADING : ue.START
1159
+ ), V = o(() => s.loading ? i("loading") : i("showMore")), X = o(() => ({
1160
+ ...s.emptyState,
1161
+ variant: "condensed"
1162
+ })), F = {
1163
+ [a.SELECT]: E(a.SELECT),
1164
+ [a.SPACE]: E(a.SPACE),
1165
+ [a.TAB]: E(a.TAB),
1166
+ [a.ENTER]: E(a.ENTER)
1167
+ };
1168
+ return {
1169
+ // Refs
1170
+ listboxRef: d,
1171
+ listboxItemRef: t,
1172
+ // a11y
1173
+ ariaAttributes: C,
1174
+ listboxContainerAttributes: I,
1175
+ // Values
1176
+ containerProps: u,
1177
+ isSearchResultEmpty: D,
1178
+ limitedEmptyStateProps: X,
1179
+ loadingButtonState: P,
1180
+ slots: l,
1181
+ shouldDisplayShowMoreButton: k,
1182
+ showMoreButtonText: V,
1183
+ virtualisedItems: b,
1184
+ wrapperProps: g,
1185
+ // Enums
1186
+ BentoKeyboardNavigationKeyDownEvent: $,
1187
+ BentoListboxEvent: a,
1188
+ // Methods
1189
+ onListboxContainerScroll: p,
1190
+ onOptionSelected: E,
1191
+ emitShowMore: S,
1192
+ listboxListeners: F
1193
+ };
1194
+ }
1195
+ });
1196
+ var wt = function() {
1197
+ var t;
1198
+ var e = this, l = e._self._c;
1199
+ return e._self._setupProxy, l("div", e._b({ directives: [{ name: "bento-keyboard-navigation-directive", rawName: "v-bento-keyboard-navigation-directive" }], ref: "listboxRef", staticClass: "b-listbox", style: (t = e.containerProps) == null ? void 0 : t.style, attrs: { id: e.id, tabindex: "-1", "data-testid": "listbox-container" }, on: { scroll: e.onListboxContainerScroll } }, "div", e.listboxContainerAttributes, !1), [l("div", e._b({}, "div", e.wrapperProps, !1), [e.componentLoading ? l("div", { staticClass: "b-listbox__loading-filtered-items" }, [l("bento-loading-indicator")], 1) : e.isSearchResultEmpty ? l("div", { staticClass: "b-listbox__empty-search-message" }, [e.emptyState ? l("bento-empty-state", e._b({}, "bento-empty-state", e.limitedEmptyStateProps, !1)) : l("bento-typography", { attrs: { el: "span" } }, [e._v(e._s(e.noResultsMessage))])], 1) : [e.multiple ? [l("bento-listbox-multi-select", e._g(e._b({ ref: "listboxItemRef", attrs: { "has-more-items": e.hasMoreItems, items: e.items, "lazy-load-type": e.lazyLoadType, "static-categories": e.staticCategories, "selected-values": e.selectedValue, searching: e.searching, "is-option-disabled": e.isOptionDisabled }, scopedSlots: e._u([e._l(e.slots, function(n, i) {
1200
+ return { key: i, fn: function(c) {
1201
+ return [e._t(i, null, null, c)];
1202
+ } };
1203
+ })], null, !0) }, "bento-listbox-multi-select", e.ariaAttributes, !1), e.listboxListeners))] : [l("bento-listbox-single-select", e._g(e._b({ ref: "listboxItemRef", attrs: { items: e.virtualisedItems, "selected-value": e.selectedValue, "static-categories": e.staticCategories, "is-option-disabled": e.isOptionDisabled }, scopedSlots: e._u([e._l(e.slots, function(n, i) {
1204
+ return { key: i, fn: function(c) {
1205
+ return [e._t(i, null, null, c)];
1206
+ } };
1207
+ })], null, !0) }, "bento-listbox-single-select", e.ariaAttributes, !1), e.listboxListeners))], e.shouldDisplayShowMoreButton ? l("div", { staticClass: "b-listbox__lazy-load" }, [l("bento-loading-button", { attrs: { state: e.loadingButtonState, variant: "secondary" }, on: { "!click": function(n) {
1208
+ return e.emitShowMore.apply(null, arguments);
1209
+ } } }, [e._v(" " + e._s(e.showMoreButtonText) + " ")])], 1) : e.loading ? l("div", { staticClass: "b-listbox__lazy-load" }, [l("bento-loading-indicator")], 1) : e._e()]], 2)]);
1210
+ }, Gt = [], Pt = /* @__PURE__ */ N(
1211
+ Mt,
1212
+ wt,
1213
+ Gt,
1214
+ !1,
1215
+ null,
1216
+ "46b000a2"
1217
+ );
1218
+ const ns = Pt.exports, Z = (s, e) => {
1219
+ for (const l of s) {
1220
+ if (l.value === e)
1221
+ return l;
1222
+ if (l.items) {
1223
+ const t = Z(l.items, e);
1224
+ if (t)
1225
+ return t;
1226
+ }
1227
+ }
1228
+ return null;
1229
+ }, Ft = (s) => typeof s == "object" && s !== null && "value" in s && "label" in s, is = (s, e, l, t) => {
1230
+ const n = A([]), i = A(), c = (u) => {
1231
+ l.value ? i.value = u.map(({ value: T }) => T) : i.value = u.length > 0 ? u[0].value : null;
1232
+ }, v = (u) => {
1233
+ l.value ? i.value = u.map(({ value: T, label: b }) => ({ value: T, label: b })) : i.value = u.length > 0 ? { value: u[0].value, label: u[0].label } : null;
1234
+ }, O = (u) => {
1235
+ n.value = u, t != null && t.value ? v(u) : c(u);
1236
+ }, d = () => {
1237
+ n.value = [], i.value = null;
1238
+ };
1239
+ return z(
1240
+ () => e.value,
1241
+ () => {
1242
+ if (!e.value && e.value !== 0) {
1243
+ d();
1244
+ return;
1245
+ }
1246
+ const u = !Array.isArray(e.value), T = [...n.value];
1247
+ d();
1248
+ const b = (g) => {
1249
+ if (Ft(g))
1250
+ n.value.push(g);
1251
+ else {
1252
+ let h = Z(s.value, g);
1253
+ h || (h = Z(T, g)), h || (h = { value: g, label: g.toString() }), n.value.push(h);
1254
+ }
1255
+ };
1256
+ if (u) {
1257
+ const g = e.value;
1258
+ b(g), t != null && t.value ? v(n.value) : c(n.value);
1259
+ return;
1260
+ }
1261
+ e.value.forEach(b), t != null && t.value ? v(n.value) : c(n.value);
1262
+ },
1263
+ { immediate: !0 }
1264
+ ), {
1265
+ // Values
1266
+ cachedSelectedListboxOptions: n,
1267
+ cachedListboxSelectedValues: i,
1268
+ // Methods
1269
+ resetCache: d,
1270
+ setCachedValues: O
1271
+ };
1272
+ };
1273
+ export {
1274
+ U as B,
1275
+ a,
1276
+ ns as b,
1277
+ is as c,
1278
+ At as u
1279
+ };
1280
+ //# sourceMappingURL=use-cached-selected-values.DNOmzQVy.js.map