@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
@@ -1,1271 +0,0 @@
1
- import { computed as o, ref as T, onMounted as Ee, onUnmounted as Oe, watch as z, defineComponent as w, nextTick as be, toRef as Q, useSlots as Te, useAttrs as Ae } from "vue";
2
- import { B as W } from "./typography.J1v_SPG3.js";
3
- import { B as Ie } from "./loading-indicator.z8COalOc.js";
4
- import { B as Le } from "./empty-state.mtXfb1BB.js";
5
- import { u as ee } from "./i18n.BQkEbtPM.js";
6
- import { d as ke } from "./debounce.DUTu11PS.js";
7
- import "./index.Cl4_42j5.js";
8
- import { B as De } from "./chip.OV0EWIP3.js";
9
- import { C as q, N as Re } from "./minus-small.DJacLGTw.js";
10
- import { C as Be } from "./checkmark-small.DVDtD4HQ.js";
11
- import { n as N } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
12
- import { C as $e } from "./chevron-down.eYtgv5ly.js";
13
- import { C as Ne } from "./chevron-up.d8cwIlA_.js";
14
- import { B as $, a as te } from "./keyboard-navigation.pB8weElW.js";
15
- import { d as Me, e as re } from "./button-actions._OIvTdKt.js";
16
- /* empty css */
17
- import { o as we } from "./resize.Bqks3WUm.js";
18
- import "../assets/use-cached-selected-values.css";
19
- const fe = (l, e, s, t) => {
20
- const i = o(
21
- () => {
22
- var f, A;
23
- return !!((f = l.value) != null && f.length) && ((A = l.value) == null ? void 0 : A.length) === e.value.length;
24
- }
25
- ), n = o(() => {
26
- var f;
27
- return l.value == null || l.value.length === 0 ? !1 : ((f = l.value) == null ? void 0 : f.length) !== e.value.length;
28
- });
29
- return {
30
- isAllSelected: i,
31
- isIndeterminate: n,
32
- toggleSelectAll: (f) => {
33
- f ? s() : t();
34
- }
35
- };
36
- };
37
- function Ge(l, { disabled: e, itemHeight: s, overscan: t = 5, prefixHeight: i }) {
38
- const n = T(null), d = T([]), f = T(0), A = T(0), u = T(0);
39
- let r;
40
- const h = o(() => {
41
- const O = typeof s == "number" ? l.value.length * s : l.value.reduce((x, S, p) => x + s(p), 0), L = typeof s == "number" ? f.value * s : l.value.slice(0, f.value).reduce((x, S, p) => x + s(p), 0);
42
- return {
43
- style: {
44
- marginTop: `${L}px`,
45
- height: `${O - L}px`
46
- }
47
- };
48
- }), b = () => {
49
- const O = (i == null ? void 0 : i.value) ?? 0, L = Math.max(n.value.scrollTop - O, 0);
50
- if (typeof s == "number")
51
- return Math.floor(L / s);
52
- let x = 0, S = 0;
53
- for (let p = 0; p < l.value.length; p += 1) {
54
- const m = s(p);
55
- if (x += m, x >= L) {
56
- S = p;
57
- break;
58
- }
59
- }
60
- return S;
61
- }, g = () => {
62
- if (u.value = n.value.clientHeight, typeof s == "number")
63
- return Math.ceil(u.value / s);
64
- const O = f.value ?? 0;
65
- let L = 0, x = 0;
66
- for (let S = O; S < l.value.length; S += 1) {
67
- const p = s(S);
68
- if (L += p, x = S, L > u.value)
69
- break;
70
- }
71
- return x - O;
72
- }, E = () => {
73
- if (n.value) {
74
- const O = g();
75
- f.value = b(), A.value = Math.min(f.value + O + t, l.value.length), d.value = l.value.slice(f.value, A.value);
76
- }
77
- }, B = () => {
78
- E();
79
- };
80
- e || (Ee(() => {
81
- n.value && (u.value = n.value.clientHeight, r = we(n.value, ({ clientHeight: O }) => {
82
- u.value = O, E();
83
- }), E());
84
- }), Oe(() => {
85
- r == null || r.disconnect();
86
- }), z(
87
- () => l.value,
88
- () => {
89
- E();
90
- }
91
- ));
92
- const I = {
93
- ref: n,
94
- style: { overflowY: "auto" }
95
- };
96
- return e ? {
97
- containerRef: n,
98
- containerProps: I,
99
- // eslint-disable-next-line @typescript-eslint/no-empty-function
100
- onScroll: () => {
101
- },
102
- list: l
103
- } : {
104
- containerRef: n,
105
- containerProps: I,
106
- onScroll: B,
107
- list: d,
108
- wrapperProps: h
109
- };
110
- }
111
- var a = /* @__PURE__ */ ((l) => (l.SELECT = "select", l.SHOW_MORE = "show-more", l.ESCAPE = "escape-pressed", l.CLICK = "click", l.ENTER = "enter-pressed", l.SPACE = "space-pressed", l.TAB = "tab-pressed", l.CLOSE_DROPDOWN = "close-dropdown", l))(a || {}), U = /* @__PURE__ */ ((l) => (l.AUTOMATIC = "automatic", l.BUTTON = "button", l.NONE = "none", l))(U || {});
112
- const Pe = 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 Fe = function() {
128
- var e = this, s = e._self._c;
129
- return e._self._setupProxy, s("div", { staticClass: "b-listbox-single-select-category" }, [s("bento-typography", { staticClass: "b-listbox-single-select-category__label-text", attrs: { variant: "caption", el: "span" } }, [e._v(" " + e._s(e.categoryLabel) + " ")]), s("div", [e._t("default")], 2)], 1);
130
- }, Ye = [], Ue = /* @__PURE__ */ N(
131
- Pe,
132
- Fe,
133
- Ye,
134
- !1,
135
- null,
136
- "4aa8cc6e"
137
- );
138
- const ze = Ue.exports, We = 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(l, { emit: e }) {
152
- const s = o(() => ({
153
- "b-listbox-option--disabled": l.disabled,
154
- "b-listbox-option--selected": l.selected
155
- }));
156
- return {
157
- // Enums
158
- BentoKeyboardNavigationKeyDownEvent: $,
159
- BentoListboxEvent: a,
160
- // Values
161
- conditionalClasses: s,
162
- // Events
163
- onClick: (n) => {
164
- e(a.CLICK, n);
165
- },
166
- onOptionSelected: (n, d) => {
167
- e(n, d);
168
- }
169
- };
170
- }
171
- });
172
- var Ke = function() {
173
- var e = this, s = e._self._c;
174
- return e._self._setupProxy, s("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
- }, Ve = [], qe = /* @__PURE__ */ N(
182
- We,
183
- Ke,
184
- Ve,
185
- !1,
186
- null,
187
- "a1e9ebff"
188
- );
189
- const j = qe.exports;
190
- let ue = 0;
191
- const je = {
192
- beforeCreate() {
193
- this.uuid = ue.toString(), ue += 1;
194
- }
195
- };
196
- var He = function() {
197
- var e = this, s = e._self._c;
198
- return s("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"] ? s("title", [e._v(e._s(e.$attrs["svg-title"]))]) : e._e(), s("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
- }, Xe = [], Je = /* @__PURE__ */ N(
200
- je,
201
- He,
202
- Xe,
203
- !1,
204
- null,
205
- null
206
- );
207
- const Ze = Je.exports, Qe = w({
208
- name: "bento-listbox-single-select-option",
209
- components: {
210
- BentoListboxOption: j,
211
- BentoTypography: W,
212
- CheckmarkIcon: Ze
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(l, { emit: e }) {
234
- const s = (d) => {
235
- l.disabled || e(d, l.option);
236
- }, t = o(() => l.disabled ? !0 : null), i = o(() => l.selected ? !0 : null), n = o(() => l.disabled ? -1 : 0);
237
- return {
238
- // Values
239
- ariaDisabled: t,
240
- ariaSelected: i,
241
- tabIndex: n,
242
- // Enums
243
- BentoListboxEvent: a,
244
- // Events
245
- onOptionSelected: s
246
- };
247
- }
248
- });
249
- var et = function() {
250
- var e = this, s = e._self._c;
251
- return e._self._setupProxy, s("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 [s("span", { staticClass: "b-listbox-single-select-option__text" }, [s("bento-typography", { attrs: { el: "span" } }, [e._v(e._s(e.option.label))]), e.option.description ? s("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), s("span", { staticClass: "b-listbox-single-select-option__check-icon" }, [s("checkmark-icon", { directives: [{ name: "show", rawName: "v-show", value: e.selected, expression: "selected" }], attrs: { "svg-title": "selected" } })], 1)], 2);
262
- }, tt = [], st = /* @__PURE__ */ N(
263
- Qe,
264
- et,
265
- tt,
266
- !1,
267
- null,
268
- "5a5ff36a"
269
- );
270
- const lt = st.exports, ve = ({ items: l }, e) => {
271
- const s = o(() => l.value.length - 1), t = T(0), i = (b) => {
272
- switch (b) {
273
- case "increase":
274
- t.value += 1;
275
- break;
276
- case "decrease":
277
- t.value -= 1;
278
- break;
279
- }
280
- }, n = ({ edgeCaseItem: b }, g) => {
281
- t.value !== b && (i(g), e(t.value));
282
- }, d = (b) => {
283
- h(b), n(
284
- {
285
- edgeCaseItem: s.value
286
- },
287
- "increase"
288
- /* INCREASE */
289
- );
290
- }, f = (b) => {
291
- h(b), n(
292
- {
293
- edgeCaseItem: 0
294
- },
295
- "decrease"
296
- /* DECREASE */
297
- );
298
- }, A = () => {
299
- t.value = 0, e(t.value);
300
- }, u = () => {
301
- t.value = s.value, e(t.value);
302
- }, r = (b) => {
303
- t.value = b;
304
- }, h = (b) => {
305
- var g;
306
- (g = b == null ? void 0 : b.detail) == null || g.preventDefault();
307
- };
308
- return {
309
- moveToFirstElement: A,
310
- moveToLastElement: u,
311
- moveToNextElement: d,
312
- moveToPreviousElement: f,
313
- setListboxFocusedIndex: r,
314
- preventDefault: h,
315
- focusedIndex: t
316
- };
317
- }, nt = w({
318
- name: "bento-listbox-single-select",
319
- components: {
320
- BentoListboxSingleSelectCategory: ze,
321
- BentoListboxSingleSelectOption: lt
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(l, { emit: e, expose: s, slots: t, attrs: i }) {
366
- const n = T(null), d = T([]), f = o(() => {
367
- var p;
368
- return !!((p = l.selectedValue) != null && p.length) && l.selectedValue.at(0);
369
- }), A = o(
370
- () => {
371
- var p, m, k, D;
372
- return {
373
- "aria-label": (p = i["aria-label"]) == null ? void 0 : p.toString(),
374
- "aria-busy": (m = i["aria-busy"]) == null ? void 0 : m.toString(),
375
- "aria-atomic": (k = i["aria-atomic"]) == null ? void 0 : k.toString(),
376
- "aria-live": (D = i["aria-live"]) == null ? void 0 : D.toString()
377
- };
378
- }
379
- ), u = o(() => !!l.items.some(({ items: p }) => !!p)), r = (p) => (m) => {
380
- e(p, [m]);
381
- }, h = async () => {
382
- await be(), n.value && (b.value = Array.from(n.value.querySelectorAll('[role="option"]')));
383
- }, b = T([]), g = (p) => {
384
- var m;
385
- (m = b.value[p]) == null || m.focus();
386
- }, {
387
- moveToNextElement: E,
388
- moveToPreviousElement: B,
389
- moveToFirstElement: I,
390
- moveToLastElement: O,
391
- setListboxFocusedIndex: L
392
- } = ve(
393
- {
394
- items: b
395
- },
396
- g
397
- );
398
- z(
399
- () => l.items,
400
- () => {
401
- h();
402
- },
403
- { immediate: !0 }
404
- );
405
- const x = {
406
- [$.ARROW_UP]: B,
407
- [$.ARROW_DOWN]: E,
408
- [$.HOME]: I,
409
- [$.END]: O
410
- }, S = {
411
- [a.SELECT]: r(a.SELECT),
412
- [a.SPACE]: r(a.SPACE),
413
- [a.TAB]: r(a.TAB),
414
- [a.ENTER]: r(a.ENTER)
415
- };
416
- return s({
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: d,
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: L
427
- }), {
428
- // Enums
429
- BentoListboxEvent: a,
430
- // Values
431
- listboxRef: n,
432
- listboxItemRef: d,
433
- selectedItem: f,
434
- slots: t,
435
- ariaAttributes: A,
436
- // Computed
437
- hasCategories: u,
438
- // Methods
439
- onOptionSelected: r,
440
- // Keyboard navigation
441
- listboxListeners: x,
442
- listboxOptionListeners: S
443
- };
444
- }
445
- });
446
- var it = function() {
447
- var e = this, s = e._self._c;
448
- return e._self._setupProxy, s("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 s("bento-listbox-single-select-category", { key: t.value, attrs: { "category-label": t.label, role: "group" } }, e._l(t.items, function(i) {
450
- return s("bento-listbox-single-select-option", e._g({ key: i.value, ref: "listboxItemRef", refInFor: !0, attrs: { role: "option", option: i, disabled: e.isOptionDisabled ? e.isOptionDisabled(i) : null, selected: i.value === e.selectedItem.value }, scopedSlots: e._u([e._l(e.slots, function(n, d) {
451
- return { key: d, fn: function(f) {
452
- return [e._t(d, null, null, f)];
453
- } };
454
- })], null, !0) }, e.listboxOptionListeners));
455
- }), 1);
456
- }) : e._l(e.items, function(t) {
457
- return s("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(i, n) {
458
- return { key: n, fn: function(d) {
459
- return [e._t(n, null, null, d)];
460
- } };
461
- })], null, !0) }, e.listboxOptionListeners));
462
- })], 2);
463
- }, ot = [], at = /* @__PURE__ */ N(
464
- nt,
465
- it,
466
- ot,
467
- !1,
468
- null,
469
- null
470
- );
471
- const ct = at.exports, rt = {}, ut = /* @__PURE__ */ w({
472
- ...rt,
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(l) {
480
- const e = l, s = o(() => ({
481
- [`b-checkbox-input--${q.DISABLED}`]: e.disabled
482
- })), t = o(() => ({
483
- [`b-checkbox-input__outline--${q.UNCHECKED}`]: !e.checked && !e.indeterminate,
484
- [`b-checkbox-input__outline--${q.CHECKED}`]: e.checked && !e.indeterminate,
485
- [`b-checkbox-input__outline--${q.INDETERMINATE}`]: e.indeterminate
486
- }));
487
- return { __sfc: !0, props: e, conditionalClasses: s, outlineConditionalClasses: t, CheckmarkSmallIcon: Be, MinusSmallIcon: Re };
488
- }
489
- });
490
- var dt = function() {
491
- var e = this, s = e._self._c, t = e._self._setupProxy;
492
- return s("div", { staticClass: "b-checkbox-input", class: t.conditionalClasses, attrs: { role: "presentation" } }, [e.indeterminate ? s(t.MinusSmallIcon, { staticClass: "b-checkbox-input__icon", attrs: { "svg-title": "", "aria-hidden": "true" } }) : e.checked ? s(t.CheckmarkSmallIcon, { staticClass: "b-checkbox-input__icon", attrs: { "svg-title": "", "aria-hidden": "true" } }) : e._e(), s("div", { staticClass: "b-checkbox-input__outline", class: t.outlineConditionalClasses })], 1);
493
- }, bt = [], ft = /* @__PURE__ */ N(
494
- ut,
495
- dt,
496
- bt,
497
- !1,
498
- null,
499
- "5dc60f05"
500
- );
501
- const se = ft.exports;
502
- var _e = /* @__PURE__ */ ((l) => (l.DISABLED = "disabled", l.STATIC_CATEGORY = "static-category", l))(_e || {}), Y = /* @__PURE__ */ ((l) => (l.SELECT_CATEGORY = "select-category", l.UNSELECT_CATEGORY = "unselect-category", l.TOGGLE_CATEGORY_VISIBILITY = "toggle-category-visibility", l))(Y || {});
503
- const vt = {
504
- "en-US": {
505
- categoryClosed: "{category} closed",
506
- categoryOpened: "{category} opened"
507
- }
508
- }, _t = w({
509
- i18n: { messages: vt },
510
- name: "bento-listbox-multi-select-category",
511
- components: {
512
- BentoTypography: W,
513
- BentoListboxOption: j,
514
- ChevronDownIcon: $e,
515
- ChevronUpIcon: Ne,
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(l, { emit: e }) {
567
- const s = T(!1), { t } = ee(), i = (m) => l.isOptionDisabled ? l.isOptionDisabled(m) : !1, n = o(
568
- () => l.category.items.every((m) => i(m))
569
- ), d = Q(l, "staticCategories"), f = o(() => s.value || l.staticCategories), A = o(() => ({
570
- [`b-listbox-multi-select-category--${_e.DISABLED}`]: n.value
571
- })), u = (m) => {
572
- m.preventDefault(), s.value = !s.value, e(Y.TOGGLE_CATEGORY_VISIBILITY);
573
- }, r = (m) => {
574
- var P;
575
- const k = i(m), D = ((P = l.selectedItemsList) == null ? void 0 : P.includes(m.value)) || !1;
576
- return { isDisabled: k, isPreSelected: D };
577
- }, h = o(
578
- () => l.category.items.filter((m) => {
579
- const { isDisabled: k, isPreSelected: D } = r(m);
580
- return k && D || !k;
581
- })
582
- ), b = o(
583
- () => {
584
- var m;
585
- return (m = h.value) == null ? void 0 : m.filter(
586
- ({ value: k }) => {
587
- var D;
588
- return (D = l.selectedItemsList) == null ? void 0 : D.includes(k);
589
- }
590
- );
591
- }
592
- ), g = o(() => {
593
- const m = s.value ? "categoryOpened" : "categoryClosed";
594
- return t(m, { category: l.category.label });
595
- }), E = () => {
596
- e(Y.SELECT_CATEGORY);
597
- }, B = () => {
598
- e(Y.UNSELECT_CATEGORY);
599
- }, { isAllSelected: I, isIndeterminate: O, toggleSelectAll: L } = fe(
600
- b,
601
- h,
602
- E,
603
- B
604
- ), x = o(() => O.value ? "mixed" : `${I.value}`), S = T(I.value), p = () => {
605
- S.value = !S.value, L(S.value);
606
- };
607
- return z(I, () => {
608
- S.value = I.value;
609
- }), {
610
- // Values
611
- chevronTitle: g,
612
- conditionalClass: A,
613
- hasAllPropsDisabled: n,
614
- isOpen: s,
615
- isAllSelected: I,
616
- isIndeterminate: O,
617
- isStaticCategory: d,
618
- // Computed
619
- showItemChildren: f,
620
- ariaCheckedComputed: x,
621
- // Methods
622
- handleSelectAll: p,
623
- toggleOpen: u,
624
- toggleSelectAll: L
625
- };
626
- }
627
- });
628
- var mt = function() {
629
- var e = this, s = e._self._c;
630
- return e._self._setupProxy, s("div", [e.isStaticCategory ? s("div", { staticClass: "b-listbox-multi-select-category b-listbox-multi-select-category--static-category" }, [s("span", { staticClass: "b-listbox-multi-select-category__label" }, [s("bento-typography", { staticClass: "b-listbox-multi-select-category__label-text", attrs: { el: "span", variant: "caption" } }, [e._v(" " + e._s(e.category.label) + " ")])], 1)]) : s("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
- } } }, [s("listbox-decorative-checkbox", { attrs: { indeterminate: e.isIndeterminate, disabled: e.hasAllPropsDisabled, checked: e.isAllSelected } }), s("span", { staticClass: "b-listbox-multi-select-category__label" }, [s("bento-typography", { staticClass: "b-listbox-multi-select-category__label-text", attrs: { el: "span" } }, [e._v(" " + e._s(e.category.label) + " ")]), s("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 ? s("chevron-up-icon", { attrs: { "svg-title": e.chevronTitle } }) : s("chevron-down-icon", { attrs: { "svg-title": e.chevronTitle } })], 1)], 1)], 1), s("div", { directives: [{ name: "show", rawName: "v-show", value: e.showItemChildren, expression: "showItemChildren" }] }, [e._t("default")], 2)], 1);
635
- }, pt = [], gt = /* @__PURE__ */ N(
636
- _t,
637
- mt,
638
- pt,
639
- !1,
640
- null,
641
- "a2ed984e"
642
- );
643
- const yt = gt.exports;
644
- var M = /* @__PURE__ */ ((l) => (l.SELECT_CATEGORY = "select-category", l.TOGGLE_CHECKBOX_SELECTION = "toggle-checkbox-selection", l.UNSELECT_CATEGORY = "unselect-category", l.TOGGLE_CATEGORY_VISIBILITY = "toggle-category-visibility", l))(M || {});
645
- const ht = w({
646
- name: "listbox-multi-select-options",
647
- components: {
648
- BentoListboxOption: j,
649
- BentoTypography: W,
650
- ListboxMultiSelectCategory: yt,
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(l, { emit: e }) {
719
- const s = (u) => {
720
- l.isOptionDisabled(u) || e(M.TOGGLE_CHECKBOX_SELECTION, u);
721
- }, t = (u) => !!u.items, i = (u) => {
722
- const r = l.isMultiLevel && l.searching;
723
- return u.description && (!l.isMultiLevel || r);
724
- }, n = (u) => u.items ? !!u.items.find((r) => l.selectedItemsList.includes(r.value)) : l.selectedItemsList.includes(u.value), d = (u) => {
725
- if (t(u)) {
726
- const r = n(u) ? M.UNSELECT_CATEGORY : M.SELECT_CATEGORY;
727
- e(r, u);
728
- } else
729
- s(u);
730
- };
731
- return {
732
- // Values
733
- conditionalClasses: o(() => ({
734
- "b-listbox-multi-select-options__static-category-option": l.staticCategories,
735
- "b-listbox-multi-select-options__category-option": l.categoryItems
736
- })),
737
- // Methods
738
- isOptionSelected: n,
739
- shouldShowDescription: i,
740
- toggleCheckboxSelection: s,
741
- toggleSearchOption: d,
742
- computedTabindex: (u) => u + 1 === l.focusedIndex ? 0 : -1,
743
- // Enums
744
- BentoListboxEvent: a,
745
- ListboxMultiSelectOptionsEvent: M
746
- };
747
- }
748
- });
749
- var Ct = function() {
750
- var e = this, s = e._self._c;
751
- return e._self._setupProxy, s("div", e._l(e.items, function(t, i) {
752
- return s("div", { key: `selected-${t.value}` }, [e.searching && e.isMultiLevel ? [s("bento-listbox-option", { staticClass: "b-listbox-multi-select-options", class: e.conditionalClasses, attrs: { disabled: e.isOptionDisabled ? e.isOptionDisabled(t) : null, tabindex: e.computedTabindex(i), "aria-checked": `${e.isOptionSelected(t)}`, "aria-disabled": e.isOptionDisabled ? e.isOptionDisabled(t) : null }, on: { click: function(n) {
753
- return e.toggleSearchOption(t);
754
- }, "enter-pressed": function(n) {
755
- return e.toggleSearchOption(t);
756
- }, "space-pressed": function(n) {
757
- return n.preventDefault(), e.toggleSearchOption(t);
758
- } } }, [s("listbox-decorative-checkbox", { attrs: { disabled: e.isOptionDisabled ? e.isOptionDisabled(t) : null, checked: e.isOptionSelected(t) } }), e._t("default", function() {
759
- return [s("span", { staticClass: "b-listbox-multi-select__option-text" }, [s("bento-typography", { attrs: { el: "span" } }, [e._v(e._s(t.label))]), e.shouldShowDescription(t) ? s("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 ? [s("listbox-multi-select-category", { attrs: { category: t, "static-categories": e.staticCategories, "is-option-disabled": e.isOptionDisabled, "selected-items-list": e.selectedItemsList, tabindex: e.computedTabindex(i) }, on: { "select-category": function(n) {
761
- return e.$emit(e.ListboxMultiSelectOptionsEvent.SELECT_CATEGORY, t);
762
- }, "unselect-category": function(n) {
763
- return e.$emit(e.ListboxMultiSelectOptionsEvent.UNSELECT_CATEGORY, t);
764
- }, "toggle-category-visibility": function(n) {
765
- return e.$emit(e.ListboxMultiSelectOptionsEvent.TOGGLE_CATEGORY_VISIBILITY);
766
- } } }, [s("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": (n) => e.toggleCheckboxSelection(n) } })], 1)] : s("bento-listbox-option", { staticClass: "b-listbox-multi-select-options", class: e.conditionalClasses, attrs: { disabled: e.isOptionDisabled ? e.isOptionDisabled(t) : null, tabindex: e.computedTabindex(i), "aria-checked": `${e.isOptionSelected(t)}`, "aria-disabled": e.isOptionDisabled ? e.isOptionDisabled(t) : null }, on: { click: function(n) {
767
- return e.toggleCheckboxSelection(t);
768
- }, "enter-pressed": function(n) {
769
- return e.toggleCheckboxSelection(t);
770
- }, "space-pressed": function(n) {
771
- return n.preventDefault(), e.toggleCheckboxSelection(t);
772
- } } }, [s("listbox-decorative-checkbox", { attrs: { disabled: e.isOptionDisabled ? e.isOptionDisabled(t) : null, checked: e.isOptionSelected(t) } }), e._t("default", function() {
773
- return [s("span", { staticClass: "b-listbox-multi-select__option-text" }, [s("bento-typography", { attrs: { el: "span" } }, [e._v(e._s(t.label))]), e.shouldShowDescription(t) ? s("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
- }, xt = [], St = /* @__PURE__ */ N(
777
- ht,
778
- Ct,
779
- xt,
780
- !1,
781
- null,
782
- "e4488ed3"
783
- );
784
- const Et = St.exports, Ot = (l) => {
785
- const e = o(() => {
786
- var t;
787
- return !!((t = l.value) != null && t.find(({ items: i }) => !!i));
788
- }), s = o(() => {
789
- var t;
790
- return e.value ? (t = l.value) == null ? void 0 : t.reduce((i, n) => (n.items ? i.push(...n.items.flat()) : i.push(n), i), []) : l.value;
791
- });
792
- return {
793
- isMultiLevelSelect: e,
794
- flattenedItemsList: s
795
- };
796
- }, Tt = {
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
- }, At = { i18n: { messages: Tt } }, It = /* @__PURE__ */ w({
804
- ...At,
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(l, { emit: e }) {
817
- const s = l, { t } = ee(), i = Te(), n = Ae(), d = o(
818
- () => {
819
- var c, v, _, C;
820
- return {
821
- "aria-label": (c = n["aria-label"]) == null ? void 0 : c.toString(),
822
- "aria-busy": (v = n["aria-busy"]) == null ? void 0 : v.toString(),
823
- "aria-atomic": (_ = n["aria-atomic"]) == null ? void 0 : _.toString(),
824
- "aria-live": (C = n["aria-live"]) == null ? void 0 : C.toString()
825
- };
826
- }
827
- ), f = T(null), A = T(null), u = T(null), r = T(null), h = o(() => s.selectedValues.map(({ value: c }) => c)), { isMultiLevelSelect: b, flattenedItemsList: g } = Ot(Q(s, "items")), E = (c) => {
828
- var C;
829
- const v = s.isOptionDisabled(c), _ = ((C = h.value) == null ? void 0 : C.includes(c.value)) || !1;
830
- return { isDisabled: v, isPreSelected: _ };
831
- }, B = o(() => {
832
- if (s.searching && b)
833
- return s.items;
834
- const c = g.value.filter((v) => {
835
- const { isDisabled: _, isPreSelected: C } = E(v);
836
- return _ && C || !_;
837
- });
838
- return s.selectedValues.forEach((v) => {
839
- c.find((_) => _.value === v.value) || c.push(v);
840
- }), c;
841
- }), I = o(
842
- () => {
843
- var c;
844
- return (c = B.value) == null ? void 0 : c.filter((v) => {
845
- var _;
846
- return v.items && b.value && s.searching ? v.items.filter(
847
- (y) => (s.selectedValues ?? []).includes(y.value)
848
- ).length === v.items.length : (_ = h.value) == null ? void 0 : _.includes(v.value);
849
- });
850
- }
851
- ), O = () => b.value && !s.searching ? g.value.length : s.items.length, L = o(() => {
852
- var C;
853
- const c = B.value.length, v = O(), _ = ((C = I.value) == null ? void 0 : C.length) || 0;
854
- return _ === 0 ? t("selectAll", { total: c }) : _ === v ? t("allSelected", { total: v }) : _ <= v ? t("numberOfTotalSelected", { number: _, total: v }) : t("numbersSelected", { number: _ });
855
- }), x = (c) => {
856
- const v = (C) => {
857
- const { isDisabled: y, isPreSelected: G } = E(C);
858
- return y && G || !y;
859
- }, _ = c.filter(v).filter((C) => !h.value.includes(C.value));
860
- e("select", [...s.selectedValues, ..._]);
861
- }, S = (c) => {
862
- const v = (y) => {
863
- const { isDisabled: G, isPreSelected: Se } = E(y);
864
- return !(G && Se);
865
- }, _ = c.filter(v).map(({ value: y }) => y), C = s.selectedValues.filter((y) => !(_ != null && _.includes(y.value)));
866
- e("select", C);
867
- }, p = () => {
868
- x(g.value);
869
- }, m = () => {
870
- S(g.value);
871
- }, { isAllSelected: k, isIndeterminate: D, toggleSelectAll: P } = fe(
872
- I,
873
- B,
874
- p,
875
- m
876
- ), H = o(() => D.value ? "mixed" : `${k.value}`), F = T(k.value), X = () => {
877
- F.value = !F.value, P(F.value);
878
- };
879
- z(k, () => {
880
- F.value = k.value;
881
- });
882
- const R = (c) => {
883
- x(c.items);
884
- }, K = (c) => {
885
- S(c.items);
886
- }, me = (c, v) => {
887
- let _ = !1;
888
- const C = s.selectedValues.filter(({ value: y }) => v.value === y ? (_ = !0, !1) : !0);
889
- _ || C.push(v), e(c, C);
890
- }, pe = o(() => {
891
- if (!b.value)
892
- return s.selectedValues;
893
- const c = (y) => h.value.includes(y.value), v = (y) => !s.staticCategories && y.every((G) => c(G));
894
- return s.items.flatMap(
895
- (y) => y.items && !v(y.items) ? y.items : y
896
- ).filter((y) => y.items ? !0 : c(y));
897
- }), ge = o(() => {
898
- var _, C, y, G;
899
- const c = ["automatic", "button"].includes(s.lazyLoadType), v = ((_ = s.selectedValues) == null ? void 0 : _.length) > 0 && ((C = I.value) == null ? void 0 : C.length) !== ((y = g.value) == null ? void 0 : y.length);
900
- return c && s.hasMoreItems ? !!((G = s.selectedValues) != null && G.length) : v;
901
- }), ye = o(() => ["automatic", "button"].includes(s.lazyLoadType) ? !s.hasMoreItems : !0), V = T([]), le = async () => {
902
- await be(), f.value && (V.value = Array.from(
903
- f.value.querySelectorAll('[role="option"]')
904
- ).filter((c) => c.checkVisibility()));
905
- }, ne = (c) => {
906
- var v;
907
- (v = V.value[c]) == null || v.focus();
908
- }, {
909
- moveToNextElement: ie,
910
- moveToPreviousElement: oe,
911
- moveToFirstElement: ae,
912
- moveToLastElement: ce,
913
- preventDefault: J,
914
- focusedIndex: he
915
- } = ve(
916
- {
917
- items: V
918
- },
919
- ne
920
- ), Ce = {
921
- [$.ARROW_UP]: (c) => oe(c),
922
- [$.ARROW_DOWN]: (c) => ie(c),
923
- [$.HOME]: ae,
924
- [$.END]: ce
925
- }, xe = {
926
- [$.ARROW_UP]: J,
927
- [$.ARROW_DOWN]: J
928
- };
929
- return z(
930
- () => s.items,
931
- () => {
932
- le();
933
- },
934
- { immediate: !0 }
935
- ), { __sfc: !0, props: s, emit: e, t, slots: i, attrs: n, ariaAttributes: d, listboxRef: f, selectAllListboxItemsRef: A, selectedListboxItemsRef: u, listboxItemsRef: r, selectedItemsList: h, isMultiLevelSelect: b, flattenedItemsList: g, optionStates: E, enabledItems: B, visibleSelectedList: I, calculateTotalItems: O, selectAllCheckboxText: L, selectAll: x, unselectAll: S, selectAllItems: p, unselectAllItems: m, isAllSelected: k, isIndeterminate: D, toggleSelectAll: P, ariaCheckedComputed: H, isSelectAllOn: F, handleSelectAll: X, selectAllCategory: R, unselectAllCategory: K, toggleCheckboxSelection: me, selectedOptions: pe, showSelectedItems: ge, showSelectAllCheckbox: ye, visibleDomOptions: V, updateVisibleDomOptions: le, focusItem: ne, moveToNextElement: ie, moveToPreviousElement: oe, moveToFirstElement: ae, moveToLastElement: ce, preventDefault: J, focusedIndex: he, listboxListeners: Ce, chipsSectionListeners: xe, ListboxDecorativeCheckbox: se, BentoTypography: W, BentoChip: De, BentoListboxOption: j, ListboxMultiSelectOptions: Et, vBentoKeyboardNavigationDirective: te, BentoListboxEvent: a };
936
- }
937
- });
938
- var Lt = function() {
939
- var e = this, s = e._self._c, t = e._self._setupProxy;
940
- return s("div", { ref: "listboxRef", staticClass: "b-listbox-multi-select" }, [t.showSelectedItems ? s("div", [s("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(i) {
941
- return s("li", { key: i.value }, [s(t.BentoChip, { ref: "selectedListboxItemsRef", refInFor: !0, attrs: { disabled: e.isOptionDisabled(i), label: i.label, condensed: "" }, on: { click: function(n) {
942
- i.items ? t.unselectAllCategory(i) : t.toggleCheckboxSelection("select", i);
943
- } } })], 1);
944
- }), 0), s("hr", { staticClass: "b-listbox-multi-select__divider", attrs: { "aria-hidden": "true" } })]) : e._e(), s("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 ? s(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(i) {
945
- return i.preventDefault(), t.handleSelectAll.apply(null, arguments);
946
- } } }, [s(t.ListboxDecorativeCheckbox, { attrs: { checked: t.isAllSelected, indeterminate: t.isIndeterminate } }), s(t.BentoTypography, { attrs: { el: "span" } }, [e._v(" " + e._s(t.selectAllCheckboxText) + " ")])], 1) : e._e(), t.showSelectAllCheckbox ? s("hr", { staticClass: "b-listbox-multi-select__divider", attrs: { "aria-hidden": "true" } }) : e._e(), s(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(i) {
947
- return t.toggleCheckboxSelection("select", i);
948
- }, "select-category": t.selectAllCategory, "unselect-category": t.unselectAllCategory, "toggle-category-visibility": t.updateVisibleDomOptions, "space-pressed": function(i) {
949
- return t.toggleCheckboxSelection(t.BentoListboxEvent.SPACE, i);
950
- }, "tab-pressed": function(i) {
951
- return t.toggleCheckboxSelection(t.BentoListboxEvent.TAB, i);
952
- }, "enter-pressed": function(i) {
953
- return t.toggleCheckboxSelection(t.BentoListboxEvent.ENTER, i);
954
- } }, scopedSlots: e._u([e._l(t.slots, function(i, n) {
955
- return { key: n, fn: function(d) {
956
- return [e._t(n, null, null, d)];
957
- } };
958
- })], null, !0) })], 1)]);
959
- }, kt = [], Dt = /* @__PURE__ */ N(
960
- It,
961
- Lt,
962
- kt,
963
- !1,
964
- null,
965
- "0e1dbda5"
966
- );
967
- const de = Dt.exports, Rt = {
968
- "en-US": {
969
- loading: "Loading",
970
- showMore: "Show more"
971
- },
972
- "ja-JP": {
973
- loading: "読み込み中",
974
- showMore: "表示内容を増やす"
975
- },
976
- "pt-BR": {
977
- loading: "Carregando",
978
- showMore: "Mostrar mais"
979
- }
980
- }, Bt = 36, $t = w({
981
- name: "bento-listbox",
982
- components: {
983
- BentoEmptyState: Le,
984
- BentoListboxSingleSelect: ct,
985
- BentoListboxMultiSelect: de,
986
- BentoTypography: W,
987
- BentoLoadingIndicator: Ie,
988
- BentoLoadingButton: Me
989
- },
990
- directives: { BentoKeyboardNavigationDirective: te },
991
- i18n: { messages: Rt },
992
- props: {
993
- /**
994
- * Defines a string value that labels an interactive element.
995
- */
996
- ariaLabel: { type: String, default: null },
997
- /**
998
- * Empty state props that will be used with the inner empty state component to be displayed when no search results are found.
999
- */
1000
- emptyState: {
1001
- type: Object,
1002
- default: void 0
1003
- },
1004
- /**
1005
- * Indicates whether there are more items to load
1006
- */
1007
- hasMoreItems: { type: Boolean, default: !1 },
1008
- /**
1009
- * Identifies the listbox whose contents are controlled by the the combobox on which the aria-controls attribute is set.
1010
- */
1011
- id: { type: String, required: !0 },
1012
- /**
1013
- * Function that allows the options to be disabled
1014
- *
1015
- * @type {BentoListboxIsOptionDisabled}
1016
- * @param {BentoListboxOptionItem} option - Listbox option object
1017
- * @param {string} option.label - Option's label text
1018
- * @param {string|number} option.value - Option's value
1019
- * @param {unknown} option.data - Option's extra data to be passed to the default slot
1020
- */
1021
- isOptionDisabled: {
1022
- type: Function,
1023
- default: () => {
1024
- }
1025
- },
1026
- /**
1027
- * The option elements to populate the listbox with.
1028
- * It must be an array of {@see BentoListboxOptionItem }
1029
- * * @property {string} value.label - Text to be displayed in the option
1030
- * * @property {string,number} value.value - Value of the option
1031
- */
1032
- items: {
1033
- type: Array,
1034
- required: !0
1035
- },
1036
- /**
1037
- * Indicates if new options are lazy loading.
1038
- */
1039
- loading: { type: Boolean, default: !1 },
1040
- /**
1041
- * The type of `Lazy Load`.
1042
- * Type "automatic" will enable infinite scrolling
1043
- * Type "button" will enable lazy loading with "Show more" button
1044
- */
1045
- lazyLoadType: {
1046
- type: String,
1047
- default: U.NONE,
1048
- validator: (l) => Object.values(U).includes(l)
1049
- },
1050
- /**
1051
- * Indicates the listbox is loading filtered items.
1052
- */
1053
- componentLoading: { type: Boolean, default: !1 },
1054
- /**
1055
- * If enabled, the user will be able to select multiple items.
1056
- */
1057
- multiple: { type: Boolean, default: !1 },
1058
- /**
1059
- * If enabled, dropdown will display non-selectable, static categories
1060
- */
1061
- staticCategories: { type: Boolean, default: !1 },
1062
- /**
1063
- * Messaged displayed when no items are listed in the listbox
1064
- */
1065
- noResultsMessage: { type: String, required: !0 },
1066
- /**
1067
- * Flag that indicates that an external search it's being made
1068
- * to filter out the items inside the the multi-select listbox
1069
- *
1070
- * If enabled, hides the "Select all" checkbox in "multiple" mode.
1071
- */
1072
- searching: de.props.searching,
1073
- /**
1074
- * The `input` value.
1075
- * Providing an empty string or empty array will select no options.
1076
- * Set to an empty string `''` if you don't want any of the available options to be selected for single select
1077
- */
1078
- selectedValue: {
1079
- type: Array,
1080
- default: () => []
1081
- },
1082
- /**
1083
- * Enables virtual scrolling if set to true or by providing an object with itemHeight function.
1084
- * The itemHeight function is used to calculate the height of rendered item given it's index.
1085
- */
1086
- virtualScroll: {
1087
- type: [Boolean, Object],
1088
- default: !1
1089
- }
1090
- },
1091
- emits: [
1092
- a.SELECT,
1093
- a.SPACE,
1094
- a.SHOW_MORE,
1095
- a.ENTER,
1096
- a.ESCAPE,
1097
- a.TAB
1098
- ],
1099
- setup(l, { emit: e, slots: s }) {
1100
- const t = T([]), i = Q(l, "items"), { t: n } = ee(), d = o(() => l.lazyLoadType !== U.AUTOMATIC), f = o(() => l.lazyLoadType === U.AUTOMATIC), A = () => {
1101
- var R;
1102
- return typeof (l == null ? void 0 : l.virtualScroll) == "object" && ((R = l == null ? void 0 : l.virtualScroll) != null && R.itemHeight) ? l.virtualScroll.itemHeight : Bt;
1103
- }, {
1104
- containerRef: u,
1105
- containerProps: r,
1106
- onScroll: h,
1107
- list: b,
1108
- wrapperProps: g
1109
- } = Ge(i, {
1110
- itemHeight: A(),
1111
- // Disable virtual scrolling if not enabled or if lazy loading is enabled or if multi-select
1112
- disabled: (l == null ? void 0 : l.multiple) || (l == null ? void 0 : l.virtualScroll) === !1 || (l == null ? void 0 : l.lazyLoadType) !== "none"
1113
- }), E = o(
1114
- () => l.componentLoading !== void 0 || d.value ? "true" : void 0
1115
- ), B = o(
1116
- () => d.value && l.loading || l.componentLoading ? "true" : "false"
1117
- ), I = o(
1118
- () => d.value || l.componentLoading !== void 0 ? "polite" : void 0
1119
- ), O = o(
1120
- () => ({
1121
- "aria-label": l.ariaLabel,
1122
- "aria-busy": B.value,
1123
- "aria-atomic": E.value,
1124
- "aria-live": I.value
1125
- })
1126
- ), L = o(
1127
- () => l.componentLoading ? {
1128
- ...O.value,
1129
- role: "alert"
1130
- } : {}
1131
- ), x = (R) => (K) => {
1132
- e(R, K);
1133
- }, S = () => {
1134
- e(a.SHOW_MORE);
1135
- }, p = ke(() => {
1136
- const R = u.value;
1137
- if (!R)
1138
- return;
1139
- const K = Math.round(R.scrollTop) + R.clientHeight >= R.scrollHeight;
1140
- l.hasMoreItems && K && !l.loading && S();
1141
- }), m = () => {
1142
- f.value ? p() : h();
1143
- }, k = o(() => {
1144
- var R;
1145
- return ((R = l.items) == null ? void 0 : R.length) === 0;
1146
- }), D = o(
1147
- () => l.lazyLoadType === U.BUTTON && l.hasMoreItems
1148
- ), P = o(
1149
- () => l.loading ? re.LOADING : re.START
1150
- ), H = o(() => l.loading ? n("loading") : n("showMore")), F = o(() => ({
1151
- ...l.emptyState,
1152
- variant: "condensed"
1153
- })), X = {
1154
- [a.SELECT]: x(a.SELECT),
1155
- [a.SPACE]: x(a.SPACE),
1156
- [a.TAB]: x(a.TAB),
1157
- [a.ENTER]: x(a.ENTER)
1158
- };
1159
- return {
1160
- // Refs
1161
- listboxRef: u,
1162
- listboxItemRef: t,
1163
- // a11y
1164
- ariaAttributes: O,
1165
- listboxContainerAttributes: L,
1166
- // Values
1167
- containerProps: r,
1168
- isSearchResultEmpty: k,
1169
- limitedEmptyStateProps: F,
1170
- loadingButtonState: P,
1171
- slots: s,
1172
- shouldDisplayShowMoreButton: D,
1173
- showMoreButtonText: H,
1174
- virtualisedItems: b,
1175
- wrapperProps: g,
1176
- // Enums
1177
- BentoKeyboardNavigationKeyDownEvent: $,
1178
- BentoListboxEvent: a,
1179
- // Methods
1180
- onListboxContainerScroll: m,
1181
- onOptionSelected: x,
1182
- emitShowMore: S,
1183
- listboxListeners: X
1184
- };
1185
- }
1186
- });
1187
- var Nt = function() {
1188
- var t;
1189
- var e = this, s = e._self._c;
1190
- return e._self._setupProxy, s("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), [s("div", e._b({}, "div", e.wrapperProps, !1), [e.componentLoading ? s("div", { staticClass: "b-listbox__loading-filtered-items" }, [s("bento-loading-indicator")], 1) : e.isSearchResultEmpty ? s("div", { staticClass: "b-listbox__empty-search-message" }, [e.emptyState ? s("bento-empty-state", e._b({}, "bento-empty-state", e.limitedEmptyStateProps, !1)) : s("bento-typography", { attrs: { el: "span" } }, [e._v(e._s(e.noResultsMessage))])], 1) : [e.multiple ? [s("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(i, n) {
1191
- return { key: n, fn: function(d) {
1192
- return [e._t(n, null, null, d)];
1193
- } };
1194
- })], null, !0) }, "bento-listbox-multi-select", e.ariaAttributes, !1), e.listboxListeners))] : [s("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(i, n) {
1195
- return { key: n, fn: function(d) {
1196
- return [e._t(n, null, null, d)];
1197
- } };
1198
- })], null, !0) }, "bento-listbox-single-select", e.ariaAttributes, !1), e.listboxListeners))], e.shouldDisplayShowMoreButton ? s("div", { staticClass: "b-listbox__lazy-load" }, [s("bento-loading-button", { attrs: { state: e.loadingButtonState, variant: "secondary" }, on: { "!click": function(i) {
1199
- return e.emitShowMore.apply(null, arguments);
1200
- } } }, [e._v(" " + e._s(e.showMoreButtonText) + " ")])], 1) : e.loading ? s("div", { staticClass: "b-listbox__lazy-load" }, [s("bento-loading-indicator")], 1) : e._e()]], 2)]);
1201
- }, Mt = [], wt = /* @__PURE__ */ N(
1202
- $t,
1203
- Nt,
1204
- Mt,
1205
- !1,
1206
- null,
1207
- "46b000a2"
1208
- );
1209
- const ss = wt.exports, Z = (l, e) => {
1210
- for (const s of l) {
1211
- if (s.value === e)
1212
- return s;
1213
- if (s.items) {
1214
- const t = Z(s.items, e);
1215
- if (t)
1216
- return t;
1217
- }
1218
- }
1219
- return null;
1220
- }, Gt = (l) => typeof l == "object" && l !== null && "value" in l && "label" in l, ls = (l, e, s, t) => {
1221
- const i = T([]), n = T(), d = (r) => {
1222
- s.value ? n.value = r.map(({ value: h }) => h) : n.value = r.length > 0 ? r[0].value : null;
1223
- }, f = (r) => {
1224
- s.value ? n.value = r.map(({ value: h, label: b }) => ({ value: h, label: b })) : n.value = r.length > 0 ? { value: r[0].value, label: r[0].label } : null;
1225
- }, A = (r) => {
1226
- i.value = r, t != null && t.value ? f(r) : d(r);
1227
- }, u = () => {
1228
- i.value = [], n.value = null;
1229
- };
1230
- return z(
1231
- () => e.value,
1232
- () => {
1233
- if (!e.value && e.value !== 0) {
1234
- u();
1235
- return;
1236
- }
1237
- const r = !Array.isArray(e.value), h = [...i.value];
1238
- u();
1239
- const b = (g) => {
1240
- if (Gt(g))
1241
- i.value.push(g);
1242
- else {
1243
- let E = Z(l.value, g);
1244
- E || (E = Z(h, g)), E || (E = { value: g, label: g.toString() }), i.value.push(E);
1245
- }
1246
- };
1247
- if (r) {
1248
- const g = e.value;
1249
- b(g), t != null && t.value ? f(i.value) : d(i.value);
1250
- return;
1251
- }
1252
- e.value.forEach(b), t != null && t.value ? f(i.value) : d(i.value);
1253
- },
1254
- { immediate: !0 }
1255
- ), {
1256
- // Values
1257
- cachedSelectedListboxOptions: i,
1258
- cachedListboxSelectedValues: n,
1259
- // Methods
1260
- resetCache: u,
1261
- setCachedValues: A
1262
- };
1263
- };
1264
- export {
1265
- U as B,
1266
- a,
1267
- ss as b,
1268
- ls as c,
1269
- Ot as u
1270
- };
1271
- //# sourceMappingURL=use-cached-selected-values.C1CeSurp.js.map