@adyen/bento-vue3 1.9.0 → 1.10.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 (246) hide show
  1. package/dist/@types/packages/vue2/src/components/button/button.vue.d.ts +23 -2455
  2. package/dist/@types/packages/vue2/src/components/button/components/button-actions/button-actions.types.d.ts +2 -0
  3. package/dist/@types/packages/vue2/src/components/button/components/loading-button/loading-button.vue.d.ts +3 -3
  4. package/dist/@types/packages/vue2/src/components/checkbox/checkbox.vue.d.ts +2 -0
  5. package/dist/@types/packages/vue2/src/components/checkbox/components/checkbox-group/checkbox-group.vue.d.ts +2 -0
  6. package/dist/@types/packages/vue2/src/components/data-grid/components/data-grid-cell-actions/data-grid-cell-actions.types.d.ts +14 -0
  7. package/dist/@types/packages/vue2/src/components/data-grid/components/data-grid-cell-actions/data-grid-cell-actions.vue.d.ts +33 -0
  8. package/dist/@types/packages/vue2/src/components/data-grid/components/data-grid-columns/data-grid-columns-types.d.ts +1 -0
  9. package/dist/@types/packages/vue2/src/components/data-grid/components/data-grid-columns/data-grid-columns.vue.d.ts +21 -4
  10. package/dist/@types/packages/vue2/src/components/data-grid/components/index.d.ts +1 -0
  11. package/dist/@types/packages/vue2/src/components/data-grid/composables/useCalculateColumnWidth/useCalculateColumnWidth.d.ts +1 -0
  12. package/dist/@types/packages/vue2/src/components/data-grid/composables/useColumnReorderer/useColumnReorderer.d.ts +54 -0
  13. package/dist/@types/packages/vue2/src/components/data-grid/composables/useConfigSettings/useConfigSettings.d.ts +81 -0
  14. package/dist/@types/packages/vue2/src/components/data-grid/composables/useSelector.d.ts +1 -1
  15. package/dist/@types/packages/vue2/src/components/data-grid/data-grid.types.d.ts +5 -2
  16. package/dist/@types/packages/vue2/src/components/data-grid/data-grid.vue.d.ts +15 -5
  17. package/dist/@types/packages/vue2/src/components/divider/divider.keys.d.ts +1 -0
  18. package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-base-textbox/dropdown-base-textbox.types.d.ts +1 -1
  19. package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-base-textbox/dropdown-base-textbox.vue.d.ts +3 -3
  20. package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-default-textbox/dropdown-default-textbox.vue.d.ts +3 -3
  21. package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-options-container/dropdown-options-container.vue.d.ts +15 -6
  22. package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-small-textbox/dropdown-small-textbox.vue.d.ts +3 -3
  23. package/dist/@types/packages/vue2/src/components/dropdown/composables/useDisplayValue.types.d.ts +1 -0
  24. package/dist/@types/packages/vue2/src/components/dropdown/dropdown.vue.d.ts +11 -1
  25. package/dist/@types/packages/vue2/src/components/empty-state/empty-state.types.d.ts +1 -0
  26. package/dist/@types/packages/vue2/src/components/empty-state/empty-state.vue.d.ts +3 -3
  27. package/dist/@types/packages/vue2/src/components/filter-bar/components/all-filters-modal/all-filters-modal.vue.d.ts +84 -12
  28. package/dist/@types/packages/vue2/src/components/filter-bar/filter-bar.types.d.ts +3 -1
  29. package/dist/@types/packages/vue2/src/components/internal/controls-group/controls-group.vue.d.ts +8 -0
  30. package/dist/@types/packages/vue2/src/components/internal/copy/copy.types.d.ts +8 -0
  31. package/dist/@types/packages/vue2/src/components/internal/copy/copy.vue.d.ts +20 -0
  32. package/dist/@types/packages/vue2/src/components/internal/copy/index.d.ts +1 -0
  33. package/dist/@types/packages/vue2/src/components/internal/listbox/components/listbox-multi-select/components/listbox-multi-select-options/components/listbox-multi-select-category/listbox-multi-select-category.types.d.ts +2 -1
  34. package/dist/@types/packages/vue2/src/components/internal/listbox/components/listbox-multi-select/components/listbox-multi-select-options/components/listbox-multi-select-category/listbox-multi-select-category.vue.d.ts +51 -0
  35. package/dist/@types/packages/vue2/src/components/internal/listbox/components/listbox-multi-select/components/listbox-multi-select-options/listbox-multi-select-options.vue.d.ts +10 -0
  36. package/dist/@types/packages/vue2/src/components/internal/listbox/components/listbox-multi-select/listbox-multi-select.vue.d.ts +9 -0
  37. package/dist/@types/packages/vue2/src/components/internal/listbox/components/listbox-single-select/components/listbox-single-select-category/index.d.ts +1 -0
  38. package/dist/@types/packages/vue2/src/components/internal/listbox/components/listbox-single-select/components/listbox-single-select-category/listbox-single-select-category.vue.d.ts +12 -0
  39. package/dist/@types/packages/vue2/src/components/internal/listbox/components/listbox-single-select/listbox-single-select.vue.d.ts +10 -0
  40. package/dist/@types/packages/vue2/src/components/internal/listbox/composables/use-multi-level-items/use-multi-level-items.d.ts +6 -0
  41. package/dist/@types/packages/vue2/src/components/internal/listbox/index.d.ts +1 -0
  42. package/dist/@types/packages/vue2/src/components/internal/listbox/listbox.vue.d.ts +11 -2
  43. package/dist/@types/packages/vue2/src/components/menu/components/menu-item/menu-item.types.d.ts +1 -0
  44. package/dist/@types/packages/vue2/src/components/menu/components/menu-item/menu-item.vue.d.ts +1 -1
  45. package/dist/@types/packages/vue2/src/components/menu/components/sub-menu-item-list/sub-menu-item-list.vue.d.ts +2 -0
  46. package/dist/@types/packages/vue2/src/components/menu/menu.vue.d.ts +1 -0
  47. package/dist/@types/packages/vue2/src/components/modal/components/base-modal/base-modal.vue.d.ts +1 -1
  48. package/dist/@types/packages/vue2/src/components/modal/components/modal-dialog/modal-dialog.vue.d.ts +316 -3
  49. package/dist/@types/packages/vue2/src/components/popover/popover.vue.d.ts +1 -1
  50. package/dist/@types/packages/vue2/src/components/radio-group/radio-group.vue.d.ts +1 -0
  51. package/dist/@types/packages/vue2/src/components/structured-list/components/structered-list-item/structured-list-item.vue.d.ts +3 -4
  52. package/dist/@types/packages/vue2/src/components/structured-list/structured-list.types.d.ts +2 -0
  53. package/dist/@types/packages/vue2/src/components/structured-list/structured-list.vue.d.ts +15 -2
  54. package/dist/@types/packages/vue2/src/components/timeline/components/timeline-item/timeline-item.vue.d.ts +15 -10
  55. package/dist/@types/packages/vue2/src/components/timeline/timeline.types.d.ts +9 -0
  56. package/dist/@types/packages/vue2/src/types/elements.d.ts +2 -1
  57. package/dist/accordion.js +2 -2
  58. package/dist/action-bar.js +5 -5
  59. package/dist/alert.js +24 -24
  60. package/dist/alert.js.map +1 -1
  61. package/dist/assets/base-modal.css +1 -1
  62. package/dist/assets/button.css +1 -1
  63. package/dist/assets/checkbox.css +1 -1
  64. package/dist/assets/controls-group.css +1 -1
  65. package/dist/assets/copy.css +1 -1
  66. package/dist/assets/dropdown-default-textbox.css +1 -1
  67. package/dist/assets/dropdown.css +1 -1
  68. package/dist/assets/index.css +1 -1
  69. package/dist/assets/index10.css +1 -1
  70. package/dist/assets/index11.css +1 -1
  71. package/dist/assets/index12.css +1 -1
  72. package/dist/assets/index13.css +1 -1
  73. package/dist/assets/index14.css +1 -1
  74. package/dist/assets/index16.css +1 -1
  75. package/dist/assets/index17.css +1 -1
  76. package/dist/assets/index18.css +1 -1
  77. package/dist/assets/index19.css +1 -1
  78. package/dist/assets/index2.css +1 -1
  79. package/dist/assets/index20.css +1 -1
  80. package/dist/assets/index21.css +1 -1
  81. package/dist/assets/index22.css +1 -1
  82. package/dist/assets/index23.css +1 -1
  83. package/dist/assets/index24.css +1 -1
  84. package/dist/assets/index25.css +1 -1
  85. package/dist/assets/index26.css +1 -1
  86. package/dist/assets/index27.css +1 -1
  87. package/dist/assets/index28.css +1 -1
  88. package/dist/assets/index29.css +1 -1
  89. package/dist/assets/index3.css +1 -1
  90. package/dist/assets/index30.css +1 -1
  91. package/dist/assets/index31.css +1 -1
  92. package/dist/assets/index32.css +1 -1
  93. package/dist/assets/index33.css +1 -1
  94. package/dist/assets/index34.css +1 -1
  95. package/dist/assets/index35.css +1 -1
  96. package/dist/assets/index36.css +1 -1
  97. package/dist/assets/index37.css +1 -1
  98. package/dist/assets/index38.css +1 -1
  99. package/dist/assets/index39.css +1 -1
  100. package/dist/assets/index40.css +1 -1
  101. package/dist/assets/index41.css +1 -1
  102. package/dist/assets/index42.css +1 -1
  103. package/dist/assets/index43.css +1 -1
  104. package/dist/assets/index44.css +1 -1
  105. package/dist/assets/index45.css +1 -1
  106. package/dist/assets/index46.css +1 -1
  107. package/dist/assets/index5.css +1 -1
  108. package/dist/assets/index6.css +1 -1
  109. package/dist/assets/index7.css +1 -1
  110. package/dist/assets/index8.css +1 -1
  111. package/dist/assets/index9.css +1 -1
  112. package/dist/assets/listbox.css +1 -1
  113. package/dist/assets/loading-button.css +1 -1
  114. package/dist/avatar-image.js +1 -1
  115. package/dist/badge.js +1 -1
  116. package/dist/button.js +56 -45
  117. package/dist/button.js.map +1 -1
  118. package/dist/card.js +1 -1
  119. package/dist/checkbox.js +72 -53
  120. package/dist/checkbox.js.map +1 -1
  121. package/dist/chunks/{base-button.aa085dfa.js → base-button.dfc0e32e.js} +2 -2
  122. package/dist/chunks/{base-button.aa085dfa.js.map → base-button.dfc0e32e.js.map} +1 -1
  123. package/dist/chunks/{base-modal.a629cb32.js → base-modal.8b323292.js} +86 -86
  124. package/dist/chunks/base-modal.8b323292.js.map +1 -0
  125. package/dist/chunks/{button-actions-with-menu.f6dfb14d.js → button-actions-with-menu.044fe230.js} +3 -3
  126. package/dist/chunks/{button-actions-with-menu.f6dfb14d.js.map → button-actions-with-menu.044fe230.js.map} +1 -1
  127. package/dist/chunks/button.6ca5cd14.js +118 -0
  128. package/dist/chunks/button.6ca5cd14.js.map +1 -0
  129. package/dist/chunks/{calendar.fa7712e8.js → calendar.b3c15dcd.js} +4 -4
  130. package/dist/chunks/{calendar.fa7712e8.js.map → calendar.b3c15dcd.js.map} +1 -1
  131. package/dist/chunks/checkbox.979b1aa4.js +278 -0
  132. package/dist/chunks/checkbox.979b1aa4.js.map +1 -0
  133. package/dist/chunks/{controls-group.d6543674.js → controls-group.2f6cbb21.js} +21 -17
  134. package/dist/chunks/controls-group.2f6cbb21.js.map +1 -0
  135. package/dist/chunks/copy.0fed8f42.js +145 -0
  136. package/dist/chunks/copy.0fed8f42.js.map +1 -0
  137. package/dist/chunks/{dropdown-default-textbox.4108b289.js → dropdown-default-textbox.839fe6f7.js} +25 -25
  138. package/dist/chunks/dropdown-default-textbox.839fe6f7.js.map +1 -0
  139. package/dist/chunks/{dropdown.63de9aac.js → dropdown.014ae3e3.js} +370 -331
  140. package/dist/chunks/dropdown.014ae3e3.js.map +1 -0
  141. package/dist/chunks/{field-label.3c19a29a.js → field-label.085966f6.js} +5 -5
  142. package/dist/chunks/{field-label.3c19a29a.js.map → field-label.085966f6.js.map} +1 -1
  143. package/dist/chunks/{fixed-scroller.bced60dd.js → fixed-scroller.96019461.js} +2 -2
  144. package/dist/chunks/{fixed-scroller.bced60dd.js.map → fixed-scroller.96019461.js.map} +1 -1
  145. package/dist/chunks/{footer-actions.cefaf1e2.js → footer-actions.52d5a453.js} +3 -3
  146. package/dist/chunks/{footer-actions.cefaf1e2.js.map → footer-actions.52d5a453.js.map} +1 -1
  147. package/dist/chunks/{index.75f3672e.js → index.10c545e2.js} +2 -2
  148. package/dist/chunks/{index.75f3672e.js.map → index.10c545e2.js.map} +1 -1
  149. package/dist/chunks/{index.4d2a13e1.js → index.4e3fb264.js} +2 -2
  150. package/dist/chunks/{index.4d2a13e1.js.map → index.4e3fb264.js.map} +1 -1
  151. package/dist/chunks/{index.89dfe209.js → index.5596079e.js} +2 -2
  152. package/dist/chunks/{index.89dfe209.js.map → index.5596079e.js.map} +1 -1
  153. package/dist/chunks/index.785d9829.js +21 -0
  154. package/dist/chunks/index.785d9829.js.map +1 -0
  155. package/dist/chunks/{index.85832db5.js → index.791fdd7d.js} +3 -3
  156. package/dist/chunks/{index.85832db5.js.map → index.791fdd7d.js.map} +1 -1
  157. package/dist/chunks/{index.0ee895e0.js → index.934e5485.js} +2 -2
  158. package/dist/chunks/{index.0ee895e0.js.map → index.934e5485.js.map} +1 -1
  159. package/dist/chunks/index.9424976e.js +622 -0
  160. package/dist/chunks/index.9424976e.js.map +1 -0
  161. package/dist/chunks/index.99d2c4e5.js +168 -0
  162. package/dist/chunks/index.99d2c4e5.js.map +1 -0
  163. package/dist/chunks/{index.98174339.js → index.a875e4b3.js} +5 -5
  164. package/dist/chunks/{index.98174339.js.map → index.a875e4b3.js.map} +1 -1
  165. package/dist/chunks/{index.c6fecf1c.js → index.fd70b861.js} +28 -28
  166. package/dist/chunks/{index.c6fecf1c.js.map → index.fd70b861.js.map} +1 -1
  167. package/dist/chunks/{listbox-option-tag.b1eb32bd.js → listbox-option-tag.854fcb0d.js} +3 -3
  168. package/dist/chunks/{listbox-option-tag.b1eb32bd.js.map → listbox-option-tag.854fcb0d.js.map} +1 -1
  169. package/dist/chunks/listbox.963589af.js +1419 -0
  170. package/dist/chunks/listbox.963589af.js.map +1 -0
  171. package/dist/chunks/{loading-button.4b88e24d.js → loading-button.09fa0115.js} +19 -19
  172. package/dist/chunks/{loading-button.4b88e24d.js.map → loading-button.09fa0115.js.map} +1 -1
  173. package/dist/chunks/{tooltip.27c32d36.js → tooltip.65868eae.js} +15 -15
  174. package/dist/chunks/tooltip.65868eae.js.map +1 -0
  175. package/dist/chunks/use-has-slot.4d98bf29.js.map +1 -1
  176. package/dist/code-snippet.js +7 -7
  177. package/dist/code-snippet.js.map +1 -1
  178. package/dist/country.js +2 -2
  179. package/dist/currency.js +1 -1
  180. package/dist/data-grid.js +1287 -983
  181. package/dist/data-grid.js.map +1 -1
  182. package/dist/date-picker.js +20 -20
  183. package/dist/date-picker.js.map +1 -1
  184. package/dist/date-range-picker.js +2 -2
  185. package/dist/date.js +1 -1
  186. package/dist/divider.js +2 -10
  187. package/dist/divider.js.map +1 -1
  188. package/dist/dropdown.js +3 -3
  189. package/dist/empty-state.js +23 -23
  190. package/dist/empty-state.js.map +1 -1
  191. package/dist/filter-bar.js +553 -541
  192. package/dist/filter-bar.js.map +1 -1
  193. package/dist/focus-trap.js +1 -1
  194. package/dist/form-layout.js +2 -2
  195. package/dist/header.js +3 -3
  196. package/dist/index.js +73 -72
  197. package/dist/info-icon.js +3 -3
  198. package/dist/input-field.js +4 -4
  199. package/dist/internal.js +17 -15
  200. package/dist/link.js +2 -2
  201. package/dist/loading-indicator.js +1 -1
  202. package/dist/menu.js +1 -1
  203. package/dist/modal.js +67 -64
  204. package/dist/modal.js.map +1 -1
  205. package/dist/pagination.js +4 -4
  206. package/dist/payment-method.js +2 -2
  207. package/dist/popover.js +1 -1
  208. package/dist/popper-container.js +1 -1
  209. package/dist/radio-group.js +69 -67
  210. package/dist/radio-group.js.map +1 -1
  211. package/dist/search-bar.js +8 -8
  212. package/dist/segmented-control.js +3 -3
  213. package/dist/sidepanel.js +5 -5
  214. package/dist/status.js +2 -2
  215. package/dist/stepper.js +3 -3
  216. package/dist/structured-list.js +1 -1
  217. package/dist/summary-grid.js +3 -3
  218. package/dist/tabs.js +3 -3
  219. package/dist/tag.js +3 -3
  220. package/dist/textarea.js +173 -161
  221. package/dist/textarea.js.map +1 -1
  222. package/dist/timeline.js +244 -237
  223. package/dist/timeline.js.map +1 -1
  224. package/dist/toast.js +3 -3
  225. package/dist/toggle.js +2 -2
  226. package/dist/tutorial.js +5 -5
  227. package/dist/typography.js +1 -1
  228. package/dist/web-types.json +1 -1
  229. package/package.json +2 -2
  230. package/dist/chunks/base-modal.a629cb32.js.map +0 -1
  231. package/dist/chunks/button.82ed953e.js +0 -148
  232. package/dist/chunks/button.82ed953e.js.map +0 -1
  233. package/dist/chunks/checkbox.731dc0ab.js +0 -264
  234. package/dist/chunks/checkbox.731dc0ab.js.map +0 -1
  235. package/dist/chunks/controls-group.d6543674.js.map +0 -1
  236. package/dist/chunks/copy.330d594e.js +0 -126
  237. package/dist/chunks/copy.330d594e.js.map +0 -1
  238. package/dist/chunks/dropdown-default-textbox.4108b289.js.map +0 -1
  239. package/dist/chunks/dropdown.63de9aac.js.map +0 -1
  240. package/dist/chunks/index.73ed22a7.js +0 -594
  241. package/dist/chunks/index.73ed22a7.js.map +0 -1
  242. package/dist/chunks/index.edcaf766.js +0 -150
  243. package/dist/chunks/index.edcaf766.js.map +0 -1
  244. package/dist/chunks/listbox.ac43f8ab.js +0 -1309
  245. package/dist/chunks/listbox.ac43f8ab.js.map +0 -1
  246. package/dist/chunks/tooltip.27c32d36.js.map +0 -1
@@ -0,0 +1,1419 @@
1
+ import { computed as u, ref as N, onMounted as Oe, onUnmounted as Ge, watch as Le, defineComponent as j, resolveComponent as C, openBlock as g, createElementBlock as A, createVNode as I, withCtx as _, createTextVNode as V, toDisplayString as G, createElementVNode as F, renderSlot as w, mergeProps as U, withKeys as me, createBlock as B, toHandlerKey as q, normalizeProps as Y, guardReactiveProps as x, createCommentVNode as J, withDirectives as se, vShow as pe, toRef as re, resolveDirective as fe, toHandlers as ee, Fragment as te, renderList as z, createSlots as le, normalizeClass as ve, pushScopeId as Ye, popScopeId as Fe } from "vue";
2
+ import { B as W, a as ye } from "./keyboard-navigation.ca47dfa8.js";
3
+ import { B as oe } from "./index.10c545e2.js";
4
+ import { BentoLoadingIndicator as Ke } from "../loading-indicator.js";
5
+ import { BentoEmptyState as ze } from "../empty-state.js";
6
+ import { u as Se } from "./i18n.6c402773.js";
7
+ import { d as We } from "./debounce.b5ef6acf.js";
8
+ import { _ as X } from "./_plugin-vue_export-helper.dad06003.js";
9
+ import { C as xe } from "./checkmark.eb3c7a06.js";
10
+ import { B as Ee } from "./checkbox.979b1aa4.js";
11
+ import { C as qe, a as He } from "./chevron-up.46afb34c.js";
12
+ import { B as je, a as Ce } from "./loading-button.09fa0115.js";
13
+ import { o as Xe } from "./resize.a041304d.js";
14
+ import "../assets/listbox.css";
15
+ const Ae = (e, t, r, b) => {
16
+ const i = u(
17
+ () => {
18
+ var l, d;
19
+ return !!((l = e.value) != null && l.length) && ((d = e.value) == null ? void 0 : d.length) === t.value.length;
20
+ }
21
+ ), n = u(() => {
22
+ var l;
23
+ return e.value == null || e.value.length === 0 ? !1 : ((l = e.value) == null ? void 0 : l.length) !== t.value.length;
24
+ });
25
+ return {
26
+ isAllSelected: i,
27
+ isIndeterminate: n,
28
+ toggleSelectAll: (l) => {
29
+ l ? r() : b();
30
+ }
31
+ };
32
+ };
33
+ function Je(e, { disabled: t, itemHeight: r, overscan: b = 5, prefixHeight: i }) {
34
+ const n = N(null), a = N([]), l = N(0), d = N(0), o = N(0);
35
+ let p;
36
+ const s = u(() => {
37
+ const T = typeof r == "number" ? e.value.length * r : e.value.reduce(($, S, O) => $ + r(O), 0), k = typeof r == "number" ? l.value * r : e.value.slice(0, l.value).reduce(($, S, O) => $ + r(O), 0);
38
+ return {
39
+ style: {
40
+ marginTop: `${k}px`,
41
+ height: `${T - k}px`
42
+ }
43
+ };
44
+ }), f = () => {
45
+ const T = (i == null ? void 0 : i.value) ?? 0, k = Math.max(n.value.scrollTop - T, 0);
46
+ if (typeof r == "number")
47
+ return Math.floor(k / r);
48
+ let $ = 0, S = 0;
49
+ for (let O = 0; O < e.value.length; O += 1) {
50
+ const M = r(O);
51
+ if ($ += M, $ >= k) {
52
+ S = O;
53
+ break;
54
+ }
55
+ }
56
+ return S;
57
+ }, m = () => {
58
+ if (o.value = n.value.clientHeight, typeof r == "number")
59
+ return Math.ceil(o.value / r);
60
+ const T = l.value ?? 0;
61
+ let k = 0, $ = 0;
62
+ for (let S = T; S < e.value.length; S += 1) {
63
+ const O = r(S);
64
+ if (k += O, $ = S, k > o.value)
65
+ break;
66
+ }
67
+ return $ - T;
68
+ }, h = () => {
69
+ if (n.value) {
70
+ const T = m();
71
+ l.value = f(), d.value = Math.min(l.value + T + b, e.value.length), a.value = e.value.slice(l.value, d.value);
72
+ }
73
+ }, R = () => {
74
+ h();
75
+ };
76
+ t || (Oe(() => {
77
+ n.value && (o.value = n.value.clientHeight, p = Xe(n.value, ({ clientHeight: T }) => {
78
+ o.value = T, h();
79
+ }), h());
80
+ }), Ge(() => {
81
+ p == null || p.disconnect();
82
+ }), Le(
83
+ () => e.value,
84
+ () => {
85
+ h();
86
+ }
87
+ ));
88
+ const P = {
89
+ ref: n,
90
+ style: { overflowY: "auto" }
91
+ };
92
+ return t ? {
93
+ containerRef: n,
94
+ containerProps: P,
95
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
96
+ onScroll: () => {
97
+ },
98
+ list: e
99
+ } : {
100
+ containerRef: n,
101
+ containerProps: P,
102
+ onScroll: R,
103
+ list: a,
104
+ wrapperProps: s
105
+ };
106
+ }
107
+ var c = /* @__PURE__ */ ((e) => (e.SELECT = "select", e.SHOW_MORE = "show-more", e.ESCAPE = "escape-pressed", e.CLICK = "click", e.ENTER = "enter-pressed", e.SPACE = "space-pressed", e.TAB = "tab-pressed", e.CLOSE_DROPDOWN = "close-dropdown", e))(c || {}), Z = /* @__PURE__ */ ((e) => (e.AUTOMATIC = "automatic", e.BUTTON = "button", e.NONE = "none", e))(Z || {});
108
+ const Qe = j({
109
+ name: "bento-listbox-static-category",
110
+ components: {
111
+ BentoTypography: oe
112
+ },
113
+ props: {
114
+ /**
115
+ * Category label text
116
+ */
117
+ categoryLabel: {
118
+ type: String,
119
+ required: !0
120
+ }
121
+ }
122
+ });
123
+ const Ze = { class: "b-listbox-single-select-category" };
124
+ function et(e, t, r, b, i, n) {
125
+ const a = C("bento-typography");
126
+ return g(), A("div", Ze, [
127
+ I(a, {
128
+ variant: "caption",
129
+ el: "span",
130
+ class: "b-listbox-single-select-category__label-text"
131
+ }, {
132
+ default: _(() => [
133
+ V(G(e.categoryLabel), 1)
134
+ ]),
135
+ _: 1
136
+ }),
137
+ F("div", null, [
138
+ w(e.$slots, "default", {}, void 0, !0)
139
+ ])
140
+ ]);
141
+ }
142
+ const tt = /* @__PURE__ */ X(Qe, [["render", et], ["__scopeId", "data-v-a90eff17"]]), st = j({
143
+ name: "bento-listbox-option",
144
+ props: {
145
+ /**
146
+ * Setting this property to true will disable the option.
147
+ */
148
+ disabled: { type: Boolean, default: !1 },
149
+ /**
150
+ * Indicates if the value is selected. Only one element can be selected at a time.
151
+ */
152
+ selected: { type: Boolean, default: !1 }
153
+ },
154
+ emits: [c.CLICK, c.ENTER, c.SPACE, c.TAB],
155
+ setup(e, { emit: t }) {
156
+ const r = u(() => ({
157
+ "b-listbox-option--disabled": e.disabled,
158
+ "b-listbox-option--selected": e.selected
159
+ }));
160
+ return {
161
+ // Enums
162
+ BentoKeyboardNavigationKeyDownEvent: W,
163
+ BentoListboxEvent: c,
164
+ // Values
165
+ conditionalClasses: r,
166
+ // Events
167
+ onClick: (n) => {
168
+ t(c.CLICK, n);
169
+ },
170
+ onOptionSelected: (n, a) => {
171
+ t(n, a);
172
+ }
173
+ };
174
+ }
175
+ });
176
+ function lt(e, t, r, b, i, n) {
177
+ return g(), A("label", U({
178
+ class: ["b-listbox-option", e.conditionalClasses],
179
+ role: "option"
180
+ }, e.$attrs, {
181
+ onClick: t[0] || (t[0] = (...a) => e.onClick && e.onClick(...a)),
182
+ onKeydown: [
183
+ t[1] || (t[1] = me((a) => e.onOptionSelected(e.BentoListboxEvent.ENTER, a), ["enter"])),
184
+ t[2] || (t[2] = me((a) => e.onOptionSelected(e.BentoListboxEvent.SPACE, a), ["space"])),
185
+ t[3] || (t[3] = me((a) => e.onOptionSelected(e.BentoListboxEvent.TAB, a), ["tab"]))
186
+ ]
187
+ }), [
188
+ w(e.$slots, "default", {}, void 0, !0)
189
+ ], 16);
190
+ }
191
+ const ce = /* @__PURE__ */ X(st, [["render", lt], ["__scopeId", "data-v-18a61f5d"]]), ot = j({
192
+ name: "bento-listbox-single-select-option",
193
+ components: {
194
+ BentoListboxOption: ce,
195
+ BentoTypography: oe,
196
+ CheckmarkIcon: xe
197
+ },
198
+ props: {
199
+ /**
200
+ * Setting this property to true will disable the option.
201
+ */
202
+ disabled: { type: Boolean, default: !1 },
203
+ /**
204
+ * The option item that contains all the option item's data.
205
+ * @type {BentoListboxOptionItem}
206
+ */
207
+ option: {
208
+ type: Object,
209
+ required: !0
210
+ },
211
+ /**
212
+ * Indicates if the value is selected. Only one element can be selected at a time.
213
+ */
214
+ selected: { type: Boolean, default: !1 }
215
+ },
216
+ emits: [c.ENTER, c.SELECT, c.SPACE, c.TAB],
217
+ setup(e, { emit: t }) {
218
+ const r = (a) => {
219
+ e.disabled || t(a, e.option.value);
220
+ }, b = u(() => e.disabled ? !0 : null), i = u(() => e.selected ? !0 : null), n = u(() => e.disabled ? -1 : 0);
221
+ return {
222
+ // Values
223
+ ariaDisabled: b,
224
+ ariaSelected: i,
225
+ tabIndex: n,
226
+ // Enums
227
+ BentoListboxEvent: c,
228
+ // Events
229
+ onOptionSelected: r
230
+ };
231
+ }
232
+ });
233
+ const nt = { class: "b-listbox-single-select-option__text" }, it = { class: "b-listbox-single-select-option__check-icon" };
234
+ function at(e, t, r, b, i, n) {
235
+ const a = C("bento-typography"), l = C("checkmark-icon"), d = C("bento-listbox-option");
236
+ return g(), B(d, U({
237
+ class: "b-listbox-single-select-option",
238
+ disabled: e.disabled,
239
+ selected: e.selected,
240
+ "aria-selected": e.ariaSelected,
241
+ "aria-disabled": e.ariaDisabled,
242
+ tabindex: e.tabIndex,
243
+ onClick: t[0] || (t[0] = (o) => e.onOptionSelected(e.BentoListboxEvent.SELECT))
244
+ }, {
245
+ [q(e.BentoListboxEvent.ENTER)]: t[1] || (t[1] = (o) => e.onOptionSelected(e.BentoListboxEvent.ENTER))
246
+ }, {
247
+ [q(e.BentoListboxEvent.SPACE)]: t[2] || (t[2] = (o) => e.onOptionSelected(e.BentoListboxEvent.SPACE))
248
+ }, {
249
+ [q(e.BentoListboxEvent.TAB)]: t[3] || (t[3] = (o) => e.onOptionSelected(e.BentoListboxEvent.TAB))
250
+ }), {
251
+ default: _(() => [
252
+ w(e.$slots, "default", Y(x(e.option)), () => [
253
+ F("span", nt, [
254
+ I(a, { el: "span" }, {
255
+ default: _(() => [
256
+ V(G(e.option.label), 1)
257
+ ]),
258
+ _: 1
259
+ }),
260
+ e.option.description ? (g(), B(a, {
261
+ key: 0,
262
+ class: "b-listbox-single-select-option__description",
263
+ el: "span"
264
+ }, {
265
+ default: _(() => [
266
+ V(G(e.option.description), 1)
267
+ ]),
268
+ _: 1
269
+ })) : J("", !0)
270
+ ])
271
+ ], !0),
272
+ F("span", it, [
273
+ se(I(l, { "svg-title": "selected" }, null, 512), [
274
+ [pe, e.selected]
275
+ ])
276
+ ])
277
+ ]),
278
+ _: 3
279
+ }, 16, ["disabled", "selected", "aria-selected", "aria-disabled", "tabindex"]);
280
+ }
281
+ const rt = /* @__PURE__ */ X(ot, [["render", at], ["__scopeId", "data-v-d112952c"]]), Ie = ({ items: e, isOptionDisabled: t }, r) => {
282
+ const b = u(() => e.value.length - 1), i = N(0);
283
+ Oe(() => {
284
+ t && (i.value = e.value.findIndex((m) => !t(m)));
285
+ });
286
+ const n = (m) => !t || !!t && t(e.value[m]), a = (m) => !t || !!t && !t(e.value[m]), l = (m) => {
287
+ switch (m) {
288
+ case "increase":
289
+ i.value += 1;
290
+ break;
291
+ case "decrease":
292
+ i.value -= 1;
293
+ break;
294
+ }
295
+ }, d = ({ edgeCaseItem: m, isItemBeforeEdgeCaseItem: h }, R, P) => {
296
+ i.value !== m && (h ? a(m) && l(P) : (l(P), n(i.value) && R()), r(i.value));
297
+ }, o = () => {
298
+ const m = i.value === b.value - 2;
299
+ d(
300
+ {
301
+ isItemBeforeEdgeCaseItem: m,
302
+ edgeCaseItem: b.value
303
+ },
304
+ o,
305
+ "increase"
306
+ /* INCREASE */
307
+ );
308
+ }, p = () => {
309
+ const m = i.value === 1;
310
+ d(
311
+ {
312
+ edgeCaseItem: 0,
313
+ isItemBeforeEdgeCaseItem: m
314
+ },
315
+ p,
316
+ "decrease"
317
+ /* DECREASE */
318
+ );
319
+ };
320
+ return {
321
+ moveToFirstElement: () => {
322
+ i.value = 0, n(i.value) ? o() : r(i.value);
323
+ },
324
+ moveToLastElement: () => {
325
+ i.value = b.value, n(i.value) ? p() : r(i.value);
326
+ },
327
+ moveToNextElement: o,
328
+ moveToPreviousElement: p
329
+ };
330
+ }, ct = j({
331
+ name: "bento-listbox-single-select",
332
+ components: {
333
+ BentoListboxSingleSelectCategory: tt,
334
+ BentoListboxSingleSelectOption: rt
335
+ },
336
+ directives: { BentoKeyboardNavigationDirective: ye },
337
+ inheritAttrs: !1,
338
+ props: {
339
+ /**
340
+ * Function that allows the options to be disabled
341
+ *
342
+ * @type {BentoListboxIsOptionDisabled}
343
+ * @param {BentoListboxOptionItem} option - listbox option object
344
+ * @param {string} option.label - Option's label text
345
+ * @param {string|number} option.value - Option's value
346
+ * @param {unknown} option.data - Option's extra data to be passed to the default slot
347
+ */
348
+ isOptionDisabled: {
349
+ type: Function,
350
+ default: () => !1
351
+ },
352
+ /**
353
+ * The option elements to populate the listbox with.
354
+ * It must be an array of {@see BentoListboxOptionItem }.
355
+ *
356
+ * @property {string} value.label - Text to be displayed in the option
357
+ * @property {string,number} value.value - Value of the option
358
+ */
359
+ items: {
360
+ type: Array,
361
+ required: !0
362
+ },
363
+ /**
364
+ * The `input` value.
365
+ * Providing an empty string will select no options.
366
+ * Set to an empty string `''` if you don't want any of the available options to be selected
367
+ */
368
+ selectedValue: {
369
+ type: [String, Number],
370
+ default: void 0
371
+ },
372
+ /**
373
+ * If enabled, dropdown will display non-selectable, static categories
374
+ */
375
+ staticCategories: { type: Boolean, default: !1 }
376
+ },
377
+ emits: [c.SELECT, c.ENTER, c.SPACE, c.TAB],
378
+ setup(e, { emit: t, slots: r }) {
379
+ const b = N([]), i = u(() => !!e.items.find(({ items: m }) => !!m)), n = (m) => (h) => {
380
+ t(m, h);
381
+ }, a = (m) => b.value[m].$el.focus(), { moveToNextElement: l, moveToPreviousElement: d, moveToFirstElement: o, moveToLastElement: p } = Ie(
382
+ {
383
+ items: re(e, "items"),
384
+ isOptionDisabled: e.isOptionDisabled
385
+ },
386
+ a
387
+ ), s = {
388
+ [W.ARROW_UP]: d,
389
+ [W.ARROW_DOWN]: l,
390
+ [W.HOME]: o,
391
+ [W.END]: p
392
+ }, f = {
393
+ [c.SELECT]: n(c.SELECT),
394
+ [c.SPACE]: n(c.SPACE),
395
+ [c.TAB]: n(c.TAB),
396
+ [c.ENTER]: n(c.ENTER)
397
+ };
398
+ return {
399
+ // Enums
400
+ BentoListboxEvent: c,
401
+ // Values
402
+ listboxItemRef: b,
403
+ slots: r,
404
+ // Computed
405
+ hasCategories: i,
406
+ // Methods
407
+ onOptionSelected: n,
408
+ // Keyboard navigation
409
+ listboxListeners: s,
410
+ listboxOptionListeners: f
411
+ };
412
+ }
413
+ });
414
+ function dt(e, t, r, b, i, n) {
415
+ const a = C("bento-listbox-single-select-option"), l = C("bento-listbox-single-select-category"), d = fe("bento-keyboard-navigation-directive");
416
+ return se((g(), A("div", ee(e.listboxListeners, !0), [
417
+ e.hasCategories && e.staticCategories ? (g(!0), A(te, { key: 0 }, z(e.items, (o) => (g(), B(l, {
418
+ key: o.value,
419
+ "category-label": o.label,
420
+ role: "group"
421
+ }, {
422
+ default: _(() => [
423
+ (g(!0), A(te, null, z(o.items, (p) => (g(), B(a, U({
424
+ key: p.value,
425
+ ref_for: !0,
426
+ ref: "listboxItemRef",
427
+ role: "option",
428
+ option: p,
429
+ disabled: e.isOptionDisabled ? e.isOptionDisabled(p) : null,
430
+ selected: p.value === e.selectedValue
431
+ }, ee(e.listboxOptionListeners)), le({ _: 2 }, [
432
+ z(e.slots, (s, f) => ({
433
+ name: f,
434
+ fn: _((m) => [
435
+ w(e.$slots, f, Y(x(m)))
436
+ ])
437
+ }))
438
+ ]), 1040, ["option", "disabled", "selected"]))), 128))
439
+ ]),
440
+ _: 2
441
+ }, 1032, ["category-label"]))), 128)) : (g(!0), A(te, { key: 1 }, z(e.items, (o) => (g(), B(a, U({
442
+ key: o.value,
443
+ ref_for: !0,
444
+ ref: "listboxItemRef",
445
+ role: "option",
446
+ option: o,
447
+ disabled: e.isOptionDisabled ? e.isOptionDisabled(o) : null,
448
+ selected: o.value === e.selectedValue
449
+ }, ee(e.listboxOptionListeners)), le({ _: 2 }, [
450
+ z(e.slots, (p, s) => ({
451
+ name: s,
452
+ fn: _((f) => [
453
+ w(e.$slots, s, Y(x(f)))
454
+ ])
455
+ }))
456
+ ]), 1040, ["option", "disabled", "selected"]))), 128))
457
+ ], 16)), [
458
+ [d]
459
+ ]);
460
+ }
461
+ const ut = /* @__PURE__ */ X(ct, [["render", dt]]);
462
+ var ge = /* @__PURE__ */ ((e) => (e.DISABLED = "disabled", e.STATIC_CATEGORY = "static-category", e))(ge || {}), ae = /* @__PURE__ */ ((e) => (e.SELECT_CATEGORY = "select-category", e.UNSELECT_CATEGORY = "unselect-category", e))(ae || {});
463
+ const bt = {
464
+ "en-US": {
465
+ categoryClosed: "{category} closed",
466
+ categoryOpened: "{category} opened"
467
+ }
468
+ }, mt = j({
469
+ i18n: { messages: bt },
470
+ name: "bento-listbox-multi-select-category",
471
+ components: {
472
+ BentoCheckbox: Ee,
473
+ BentoTypography: oe,
474
+ BentoListboxOption: ce,
475
+ ChevronDownIcon: qe,
476
+ ChevronUpIcon: He
477
+ },
478
+ props: {
479
+ /**
480
+ * The option elements to populate the listbox with.
481
+ * It must be an array of {@see BentoListboxOptionItem }.
482
+ *
483
+ * @property {string} value.label - Text to be displayed in the option
484
+ * @property {string,number} value.value - Value of the option
485
+ * @property {BentoListboxOptionItem} value.items - Category items list
486
+ */
487
+ category: {
488
+ type: Object,
489
+ required: !0
490
+ },
491
+ /**
492
+ * Function that allows the options to be disabled
493
+ *
494
+ * @type {BentoListboxIsOptionDisabled}
495
+ * @param {BentoListboxOptionItem} option - listbox option object
496
+ * @param {string} option.label - Option's label text
497
+ * @param {string|number} option.value - Option's value
498
+ * @param {unknown} option.data - Option's extra data to be passed to the default slot
499
+ */
500
+ isOptionDisabled: {
501
+ type: [Function],
502
+ default: () => !1
503
+ },
504
+ /**
505
+ * The `input` value.
506
+ * Providing an empty array will select no options.
507
+ */
508
+ selectedItemsList: {
509
+ type: Array,
510
+ default: () => []
511
+ },
512
+ /**
513
+ * If enabled, dropdown will display non-selectable, static categories
514
+ */
515
+ staticCategories: { type: Boolean, default: !1 }
516
+ },
517
+ emits: [ae.SELECT_CATEGORY, ae.UNSELECT_CATEGORY],
518
+ setup(e, { emit: t }) {
519
+ const r = N(!1), { t: b } = Se(), i = (S) => e.isOptionDisabled ? e.isOptionDisabled(S) : !1, n = u(
520
+ () => e.category.items.every((S) => i(S))
521
+ ), a = re(e, "staticCategories"), l = u(() => r.value || e.staticCategories), d = u(() => ({
522
+ [`b-listbox-multi-select-category--${ge.DISABLED}`]: n.value,
523
+ [`b-listbox-multi-select-category--${ge.STATIC_CATEGORY}`]: e.staticCategories
524
+ })), o = (S) => {
525
+ S.preventDefault(), r.value = !r.value;
526
+ }, p = (S) => {
527
+ var Q;
528
+ const O = i(S), M = ((Q = e.selectedItemsList) == null ? void 0 : Q.includes(S.value)) || !1;
529
+ return { isDisabled: O, isPreSelected: M };
530
+ }, s = u(
531
+ () => e.category.items.filter((S) => {
532
+ const { isDisabled: O, isPreSelected: M } = p(S);
533
+ return O && M || !O;
534
+ })
535
+ ), f = u(
536
+ () => {
537
+ var S;
538
+ return (S = s.value) == null ? void 0 : S.filter(
539
+ ({ value: O }) => {
540
+ var M;
541
+ return (M = e.selectedItemsList) == null ? void 0 : M.includes(O);
542
+ }
543
+ );
544
+ }
545
+ ), m = u(() => {
546
+ const S = r.value ? "categoryOpened" : "categoryClosed";
547
+ return b(S, { category: e.category.label });
548
+ }), h = u(
549
+ () => ({
550
+ el: "span",
551
+ variant: e.staticCategories ? "caption" : "body"
552
+ })
553
+ ), R = () => {
554
+ t(ae.SELECT_CATEGORY);
555
+ }, P = () => {
556
+ t(ae.UNSELECT_CATEGORY);
557
+ }, { isAllSelected: T, isIndeterminate: k, toggleSelectAll: $ } = Ae(
558
+ f,
559
+ s,
560
+ R,
561
+ P
562
+ );
563
+ return {
564
+ // Values
565
+ chevronTitle: m,
566
+ conditionalClass: d,
567
+ hasAllPropsDisabled: n,
568
+ isOpen: r,
569
+ isAllSelected: T,
570
+ isIndeterminate: k,
571
+ isStaticCategory: a,
572
+ // Computed
573
+ showItemChildren: l,
574
+ categoryLabelProps: h,
575
+ // Methods
576
+ toggleOpen: o,
577
+ toggleSelectAll: $
578
+ };
579
+ }
580
+ });
581
+ const vt = { class: "b-listbox-multi-select-category__label" };
582
+ function gt(e, t, r, b, i, n) {
583
+ const a = C("bento-checkbox"), l = C("bento-typography"), d = C("chevron-up-icon"), o = C("chevron-down-icon"), p = C("bento-listbox-option");
584
+ return g(), A("div", null, [
585
+ I(p, {
586
+ class: ve(["b-listbox-multi-select-category__option", e.conditionalClass])
587
+ }, {
588
+ default: _(() => [
589
+ e.isStaticCategory ? J("", !0) : (g(), B(a, {
590
+ key: 0,
591
+ "model-value": e.isAllSelected,
592
+ indeterminate: e.isIndeterminate,
593
+ disabled: e.hasAllPropsDisabled,
594
+ "aria-label": e.category.label,
595
+ value: e.category.value,
596
+ "onUpdate:modelValue": e.toggleSelectAll
597
+ }, null, 8, ["model-value", "indeterminate", "disabled", "aria-label", "value", "onUpdate:modelValue"])),
598
+ F("span", vt, [
599
+ I(l, U(e.categoryLabelProps, { class: "b-listbox-multi-select-category__label-text" }), {
600
+ default: _(() => [
601
+ V(G(e.category.label), 1)
602
+ ]),
603
+ _: 1
604
+ }, 16),
605
+ e.isStaticCategory ? J("", !0) : (g(), A("div", {
606
+ key: 0,
607
+ class: "b-listbox-multi-select-category__label-chevron",
608
+ "data-testid": "toggle-listbox",
609
+ onClickCapture: t[0] || (t[0] = (...s) => e.toggleOpen && e.toggleOpen(...s))
610
+ }, [
611
+ e.isOpen ? (g(), B(d, {
612
+ key: 0,
613
+ "svg-title": e.chevronTitle
614
+ }, null, 8, ["svg-title"])) : (g(), B(o, {
615
+ key: 1,
616
+ "svg-title": e.chevronTitle
617
+ }, null, 8, ["svg-title"]))
618
+ ], 32))
619
+ ])
620
+ ]),
621
+ _: 1
622
+ }, 8, ["class"]),
623
+ se(F("div", null, [
624
+ w(e.$slots, "default", {}, void 0, !0)
625
+ ], 512), [
626
+ [pe, e.showItemChildren]
627
+ ])
628
+ ]);
629
+ }
630
+ const pt = /* @__PURE__ */ X(mt, [["render", gt], ["__scopeId", "data-v-9a00de22"]]);
631
+ var H = /* @__PURE__ */ ((e) => (e.SELECT_CATEGORY = "select-category", e.TOGGLE_CHECKBOX_SELECTION = "toggle-checkbox-selection", e.UNSELECT_CATEGORY = "unselect-category", e))(H || {});
632
+ const ft = j({
633
+ name: "listbox-multi-select-options",
634
+ components: {
635
+ BentoCheckbox: Ee,
636
+ BentoListboxOption: ce,
637
+ BentoTypography: oe,
638
+ ListboxMultiSelectCategory: pt
639
+ },
640
+ props: {
641
+ /**
642
+ * Indicates if the items listed are inside a category
643
+ * so they can be padded to right by one level in recursion.
644
+ * Items of categories are automatically defined as "categoryItems"
645
+ */
646
+ categoryItems: { type: Boolean, default: !1 },
647
+ /**
648
+ * Function that allows the options to be disabled
649
+ *
650
+ * @type {BentoListboxIsOptionDisabled}
651
+ * @param {BentoListboxOptionItem} option - listbox option object
652
+ * @param {string} option.label - Option's label text
653
+ * @param {string|number} option.value - Option's value
654
+ * @param {unknown} option.data - Option's extra data to be passed to the default slot
655
+ */
656
+ isOptionDisabled: {
657
+ type: Function,
658
+ default: () => !1
659
+ },
660
+ /**
661
+ * The option elements to populate the listbox with.
662
+ * It must be an array of {@see BentoListboxOptionItem }.
663
+ *
664
+ * @property {string} value.label - Text to be displayed in the option
665
+ * @property {string,number} value.value - Value of the option
666
+ */
667
+ items: {
668
+ type: Array,
669
+ required: !0
670
+ },
671
+ /**
672
+ * Indicates if the elements options are inside a multi-level category
673
+ */
674
+ isMultiLevel: { type: Boolean, default: !1 },
675
+ /**
676
+ * Flag that indicates that an external search it's being made
677
+ * to filter out the items inside the the multi-select listbox
678
+ *
679
+ * If enabled, hides the "Select all" checkbox in "multiple" mode.
680
+ */
681
+ searching: { type: Boolean, default: !1 },
682
+ /**
683
+ * List of selected items.
684
+ * Providing an empty array will select no options.
685
+ */
686
+ selectedItemsList: {
687
+ type: Array,
688
+ default: () => []
689
+ },
690
+ /**
691
+ * If enabled, dropdown will display non-selectable, static categories
692
+ */
693
+ staticCategories: { type: Boolean, default: !1 }
694
+ },
695
+ emits: [
696
+ H.TOGGLE_CHECKBOX_SELECTION,
697
+ H.SELECT_CATEGORY,
698
+ H.UNSELECT_CATEGORY
699
+ ],
700
+ setup(e, { emit: t }) {
701
+ const r = (d) => {
702
+ t(H.TOGGLE_CHECKBOX_SELECTION, d);
703
+ }, b = (d) => !!d.items, i = (d) => {
704
+ const o = e.isMultiLevel && e.searching;
705
+ return d.description && (!e.isMultiLevel || o);
706
+ }, n = (d) => d.items ? !!d.items.find((o) => e.selectedItemsList.includes(o.value)) : e.selectedItemsList.includes(d.value), a = (d, o) => {
707
+ if (b(o))
708
+ return t(d ? H.SELECT_CATEGORY : H.UNSELECT_CATEGORY, o);
709
+ r(o.value);
710
+ };
711
+ return {
712
+ // Values
713
+ conditionalClasses: u(() => ({
714
+ "b-listbox-multi-select-options__static-category-option": e.staticCategories,
715
+ "b-listbox-multi-select-options__category-option": e.categoryItems
716
+ })),
717
+ // Methods
718
+ isCategory: b,
719
+ isOptionSelected: n,
720
+ shouldShowDescription: i,
721
+ toggleCheckboxSelection: r,
722
+ selectSearch: a,
723
+ // Enums
724
+ BentoListboxEvent: c,
725
+ ListboxMultiSelectOptionsEvent: H
726
+ };
727
+ }
728
+ });
729
+ const yt = { class: "b-listbox-multi-select__option-text" }, St = { class: "b-listbox-multi-select__option-text" };
730
+ function Et(e, t, r, b, i, n) {
731
+ const a = C("bento-checkbox"), l = C("bento-typography"), d = C("bento-listbox-option"), o = C("listbox-multi-select-options", !0), p = C("listbox-multi-select-category");
732
+ return g(), A("div", null, [
733
+ (g(!0), A(te, null, z(e.items, (s) => (g(), A("div", {
734
+ key: `selected-${s.value}`
735
+ }, [
736
+ e.searching && e.isMultiLevel ? (g(), B(d, {
737
+ key: 0,
738
+ class: ve(["b-listbox-multi-select-options", e.conditionalClasses]),
739
+ disabled: e.isOptionDisabled ? e.isOptionDisabled(s) : null
740
+ }, {
741
+ default: _(() => [
742
+ I(a, {
743
+ "model-value": e.isOptionSelected(s),
744
+ "aria-label": s.label,
745
+ disabled: e.isOptionDisabled ? e.isOptionDisabled(s) : null,
746
+ value: s.value,
747
+ "onUpdate:modelValue": (f) => e.selectSearch(f, s)
748
+ }, null, 8, ["model-value", "aria-label", "disabled", "value", "onUpdate:modelValue"]),
749
+ w(e.$slots, "default", Y(x(s)), () => [
750
+ F("span", yt, [
751
+ I(l, { el: "span" }, {
752
+ default: _(() => [
753
+ V(G(s.label), 1)
754
+ ]),
755
+ _: 2
756
+ }, 1024),
757
+ e.shouldShowDescription(s) ? (g(), B(l, {
758
+ key: 0,
759
+ class: "b-listbox-multi-select__option-description",
760
+ el: "span"
761
+ }, {
762
+ default: _(() => [
763
+ V(G(s.description), 1)
764
+ ]),
765
+ _: 2
766
+ }, 1024)) : J("", !0)
767
+ ])
768
+ ], !0)
769
+ ]),
770
+ _: 2
771
+ }, 1032, ["class", "disabled"])) : (g(), A(te, { key: 1 }, [
772
+ s.items ? (g(), B(p, {
773
+ key: 0,
774
+ category: s,
775
+ "static-categories": e.staticCategories,
776
+ "is-option-disabled": e.isOptionDisabled,
777
+ "selected-items-list": e.selectedItemsList,
778
+ onSelectCategory: (f) => e.$emit(e.ListboxMultiSelectOptionsEvent.SELECT_CATEGORY, s),
779
+ onUnselectCategory: (f) => e.$emit(e.ListboxMultiSelectOptionsEvent.UNSELECT_CATEGORY, s)
780
+ }, {
781
+ default: _(() => [
782
+ I(o, {
783
+ "category-items": "",
784
+ items: s.items,
785
+ "is-option-disabled": e.isOptionDisabled,
786
+ "is-multi-level": e.isMultiLevel,
787
+ "static-categories": e.staticCategories,
788
+ "selected-items-list": e.selectedItemsList,
789
+ searching: e.searching,
790
+ onToggleCheckboxSelection: t[0] || (t[0] = (f) => e.toggleCheckboxSelection(f))
791
+ }, null, 8, ["items", "is-option-disabled", "is-multi-level", "static-categories", "selected-items-list", "searching"])
792
+ ]),
793
+ _: 2
794
+ }, 1032, ["category", "static-categories", "is-option-disabled", "selected-items-list", "onSelectCategory", "onUnselectCategory"])) : (g(), B(d, {
795
+ key: 1,
796
+ class: ve(["b-listbox-multi-select-options", e.conditionalClasses]),
797
+ disabled: e.isOptionDisabled ? e.isOptionDisabled(s) : null
798
+ }, {
799
+ default: _(() => [
800
+ I(a, {
801
+ "model-value": e.selectedItemsList,
802
+ "aria-label": s.label,
803
+ disabled: e.isOptionDisabled ? e.isOptionDisabled(s) : null,
804
+ value: s.value,
805
+ "onUpdate:modelValue": (f) => e.toggleCheckboxSelection(s.value)
806
+ }, null, 8, ["model-value", "aria-label", "disabled", "value", "onUpdate:modelValue"]),
807
+ w(e.$slots, "default", Y(x(s)), () => [
808
+ F("span", St, [
809
+ I(l, { el: "span" }, {
810
+ default: _(() => [
811
+ V(G(s.label), 1)
812
+ ]),
813
+ _: 2
814
+ }, 1024),
815
+ e.shouldShowDescription(s) ? (g(), B(l, {
816
+ key: 0,
817
+ class: "b-listbox-multi-select__option-description",
818
+ el: "span"
819
+ }, {
820
+ default: _(() => [
821
+ V(G(s.description), 1)
822
+ ]),
823
+ _: 2
824
+ }, 1024)) : J("", !0)
825
+ ])
826
+ ], !0)
827
+ ]),
828
+ _: 2
829
+ }, 1032, ["class", "disabled"]))
830
+ ], 64))
831
+ ]))), 128))
832
+ ]);
833
+ }
834
+ const Ct = /* @__PURE__ */ X(ft, [["render", Et], ["__scopeId", "data-v-ade259b2"]]), _e = {
835
+ "en-US": {
836
+ allSelected: "All selected ({total})",
837
+ numberOfTotalSelected: "{number} of {total} selected",
838
+ selectAll: "Select all ({total})"
839
+ }
840
+ }, _t = (e) => {
841
+ const t = u(() => {
842
+ var b;
843
+ return !!((b = e.value) != null && b.find(({ items: i }) => !!i));
844
+ }), r = u(() => {
845
+ var b;
846
+ return t.value ? (b = e.value) == null ? void 0 : b.reduce((i, n) => (n.items ? i.push(...n.items.flat()) : i.push(n), i), []) : e.value;
847
+ });
848
+ return {
849
+ isMultiLevelSelect: t,
850
+ flattenedItemsList: r
851
+ };
852
+ }, ht = j({
853
+ i18n: { messages: _e },
854
+ name: "bento-listbox-multi-select",
855
+ components: {
856
+ BentoCheckbox: Ee,
857
+ BentoListboxOption: ce,
858
+ BentoTypography: oe,
859
+ ListboxMultiSelectOptions: Ct
860
+ },
861
+ directives: { BentoKeyboardNavigationDirective: ye },
862
+ props: {
863
+ /**
864
+ * Function that allows the options to be disabled
865
+ *
866
+ * @type {BentoListboxIsOptionDisabled}
867
+ * @param {BentoListboxOptionItem} option - listbox option object
868
+ * @param {string} option.label - Option's label text
869
+ * @param {string|number} option.value - Option's value
870
+ * @param {unknown} option.data - Option's extra data to be passed to the default slot
871
+ */
872
+ isOptionDisabled: {
873
+ type: Function,
874
+ default: () => !1
875
+ },
876
+ /**
877
+ * The option elements to populate the listbox with.
878
+ * It must be an array of {@see BentoListboxOptionItem }.
879
+ *
880
+ * @property {string} value.label - Text to be displayed in the option
881
+ * @property {string,number} value.value - Value of the option
882
+ */
883
+ items: {
884
+ type: Array,
885
+ required: !0
886
+ },
887
+ /**
888
+ * Flag that indicates that an external search it's being made
889
+ * to filter out the items inside the the multi-select listbox
890
+ *
891
+ * If enabled, hides the "Select all" checkbox in "multiple" mode.
892
+ */
893
+ searching: { type: Boolean, default: !1 },
894
+ /**
895
+ * The `input` value.
896
+ * Providing an empty array will select no options.
897
+ */
898
+ selectedValues: {
899
+ type: Array,
900
+ default: () => []
901
+ },
902
+ /**
903
+ * If enabled, dropdown will display non-selectable, static categories
904
+ */
905
+ staticCategories: { type: Boolean, default: !1 }
906
+ },
907
+ emits: [c.SELECT],
908
+ setup(e, { emit: t, slots: r }) {
909
+ const { t: b } = Se({ messages: _e }), i = N(null), n = N(null), a = N(null), l = N();
910
+ Le(
911
+ () => e.selectedValues,
912
+ () => {
913
+ l.value = [...e.selectedValues ?? []];
914
+ },
915
+ {
916
+ immediate: !0
917
+ }
918
+ );
919
+ const { isMultiLevelSelect: d, flattenedItemsList: o } = _t(re(e, "items")), p = (v) => {
920
+ var E;
921
+ const y = e.isOptionDisabled(v), L = ((E = l.value) == null ? void 0 : E.includes(v.value)) || !1;
922
+ return { isDisabled: y, isPreSelected: L };
923
+ }, s = u(
924
+ () => e.searching && d ? e.items : o.value.filter((v) => {
925
+ const { isDisabled: y, isPreSelected: L } = p(v);
926
+ return y && L || !y;
927
+ })
928
+ ), f = u(
929
+ () => {
930
+ var v;
931
+ return (v = s.value) == null ? void 0 : v.filter((y) => {
932
+ var L;
933
+ return y.items && d.value && e.searching ? y.items.filter(
934
+ (K) => (e.selectedValues ?? []).includes(
935
+ K.value
936
+ )
937
+ ).length === y.items.length : (L = l.value) == null ? void 0 : L.includes(y.value);
938
+ });
939
+ }
940
+ ), m = () => d.value && !e.searching ? o.value.length : e.items.length, h = u(() => {
941
+ var E;
942
+ const v = s.value.length, y = m(), L = ((E = f.value) == null ? void 0 : E.length) || 0;
943
+ return L === 0 ? b("selectAll", { total: v }) : L === y ? b("allSelected", { total: y }) : b("numberOfTotalSelected", { number: L, total: y });
944
+ }), R = (v) => {
945
+ const y = (E) => {
946
+ const { isDisabled: K, isPreSelected: be } = p(E);
947
+ return K && be || !K;
948
+ }, L = v.filter(y).filter((E) => !l.value.includes(E.value)).map(({ value: E }) => E);
949
+ l.value = [...l.value, ...L], t(c.SELECT, l.value);
950
+ }, P = (v) => {
951
+ const y = (E) => {
952
+ const { isDisabled: K, isPreSelected: be } = p(E);
953
+ return !(K && be);
954
+ }, L = v.filter(y).map(({ value: E }) => E);
955
+ l.value = l.value.filter((E) => !(L != null && L.includes(E))), t(c.SELECT, l.value);
956
+ }, T = () => {
957
+ R(o.value);
958
+ }, k = () => {
959
+ P(o.value);
960
+ }, { isAllSelected: $, isIndeterminate: S, toggleSelectAll: O } = Ae(
961
+ f,
962
+ s,
963
+ T,
964
+ k
965
+ ), M = (v) => {
966
+ R(v.items);
967
+ }, Q = (v) => {
968
+ P(v.items);
969
+ }, de = (v, y) => {
970
+ let L = !1;
971
+ l.value = l.value.filter((E) => y === E ? (L = !0, !1) : !0), L || l.value.push(y), t(v, l.value);
972
+ }, ne = u(() => {
973
+ const v = (E) => l.value.includes(E.value), y = (E) => !!E.find((K) => v(K));
974
+ return d.value && e.staticCategories ? e.items.flatMap(({ items: K }) => K.filter(v)) : e.items.filter((E) => E.items && y(E.items) ? !0 : v(E));
975
+ }), ue = u(() => {
976
+ var v;
977
+ return ((v = ne.value) == null ? void 0 : v.length) > 0;
978
+ }), D = u(
979
+ () => {
980
+ var v, y;
981
+ return ((v = f.value) == null ? void 0 : v.length) === ((y = o.value) == null ? void 0 : y.length);
982
+ }
983
+ ), ie = u(
984
+ () => i.value ? [i.value] : []
985
+ ), $e = u(
986
+ () => {
987
+ var v, y;
988
+ return (y = (v = n.value) == null ? void 0 : v.$children) != null && y.length ? n.value.$children : [];
989
+ }
990
+ ), ke = u(
991
+ () => {
992
+ var v, y;
993
+ return (y = (v = a.value) == null ? void 0 : v.$children) != null && y.length ? a.value.$children : [];
994
+ }
995
+ ), Re = u(() => ({ label: h, value: $ })), De = u(() => [
996
+ Re,
997
+ ...ne.value,
998
+ ...o.value
999
+ ]), Ne = (v) => {
1000
+ [
1001
+ ...ie.value,
1002
+ ...$e.value,
1003
+ ...ke.value
1004
+ ][v].$el.focus();
1005
+ }, { moveToNextElement: Pe, moveToPreviousElement: Me, moveToFirstElement: Ue, moveToLastElement: we } = Ie(
1006
+ {
1007
+ items: N(De),
1008
+ isOptionDisabled: e.isOptionDisabled
1009
+ },
1010
+ Ne
1011
+ ), Ve = {
1012
+ [W.ARROW_UP]: Me,
1013
+ [W.ARROW_DOWN]: Pe,
1014
+ [W.HOME]: Ue,
1015
+ [W.END]: we
1016
+ };
1017
+ return {
1018
+ // Refs
1019
+ selectAllListboxItemsRef: i,
1020
+ selectedListboxItemsRef: n,
1021
+ listboxItemsRef: a,
1022
+ // Values
1023
+ isAllSelected: $,
1024
+ isAllItemsIncludingDisabled: D,
1025
+ isAnOptionSelected: ue,
1026
+ isIndeterminate: S,
1027
+ isMultiLevelSelect: d,
1028
+ flattenedItemsList: o,
1029
+ selectedItemsList: l,
1030
+ selectAllCheckboxText: h,
1031
+ selectedOptions: ne,
1032
+ slots: r,
1033
+ // Enums
1034
+ BentoListboxEvent: c,
1035
+ // Methods
1036
+ selectAllCategory: M,
1037
+ toggleCheckboxSelection: de,
1038
+ toggleSelectAll: O,
1039
+ unselectAllCategory: Q,
1040
+ // Events
1041
+ listboxListeners: Ve
1042
+ };
1043
+ }
1044
+ });
1045
+ const Be = (e) => (Ye("data-v-1ba4ab3d"), e = e(), Fe(), e), Tt = { key: 0 }, Ot = /* @__PURE__ */ Be(() => /* @__PURE__ */ F("hr", { class: "b-listbox-multi-select__divider" }, null, -1)), Lt = /* @__PURE__ */ Be(() => /* @__PURE__ */ F("hr", { class: "b-listbox-multi-select__divider" }, null, -1));
1046
+ function At(e, t, r, b, i, n) {
1047
+ const a = C("bento-checkbox"), l = C("bento-typography"), d = C("bento-listbox-option"), o = C("listbox-multi-select-options"), p = fe("bento-keyboard-navigation-directive");
1048
+ return se((g(), A("div", U({ class: "b-listbox-multi-select" }, ee(e.listboxListeners, !0)), [
1049
+ I(d, {
1050
+ ref: "selectAllListboxItemsRef",
1051
+ class: "b-listbox-multi-select__option"
1052
+ }, {
1053
+ default: _(() => [
1054
+ I(a, {
1055
+ "aria-label": e.selectAllCheckboxText,
1056
+ "model-value": e.isAllSelected,
1057
+ indeterminate: e.isIndeterminate,
1058
+ "onUpdate:modelValue": e.toggleSelectAll
1059
+ }, null, 8, ["aria-label", "model-value", "indeterminate", "onUpdate:modelValue"]),
1060
+ I(l, { el: "span" }, {
1061
+ default: _(() => [
1062
+ V(G(e.selectAllCheckboxText), 1)
1063
+ ]),
1064
+ _: 1
1065
+ })
1066
+ ]),
1067
+ _: 1
1068
+ }, 512),
1069
+ e.isAnOptionSelected ? (g(), A("div", Tt, [
1070
+ Ot,
1071
+ I(o, U({
1072
+ ref: "selectedListboxItemsRef",
1073
+ items: e.selectedOptions,
1074
+ "is-option-disabled": e.isOptionDisabled,
1075
+ "is-multi-level": e.isMultiLevelSelect,
1076
+ "static-categories": e.staticCategories,
1077
+ searching: e.searching,
1078
+ "selected-items-list": e.selectedItemsList,
1079
+ onSelectCategory: e.selectAllCategory,
1080
+ onUnselectCategory: e.unselectAllCategory,
1081
+ onToggleCheckboxSelection: t[0] || (t[0] = (s) => e.toggleCheckboxSelection(e.BentoListboxEvent.SELECT, s))
1082
+ }, {
1083
+ [q(e.BentoListboxEvent.SPACE)]: t[1] || (t[1] = (s) => e.toggleCheckboxSelection(e.BentoListboxEvent.SPACE, s))
1084
+ }, {
1085
+ [q(e.BentoListboxEvent.TAB)]: t[2] || (t[2] = (s) => e.toggleCheckboxSelection(e.BentoListboxEvent.TAB, s))
1086
+ }, {
1087
+ [q(e.BentoListboxEvent.ENTER)]: t[3] || (t[3] = (s) => e.toggleCheckboxSelection(e.BentoListboxEvent.ENTER, s))
1088
+ }), le({ _: 2 }, [
1089
+ z(e.slots, (s, f) => ({
1090
+ name: f,
1091
+ fn: _((m) => [
1092
+ w(e.$slots, f, Y(x(m)), void 0, !0)
1093
+ ])
1094
+ }))
1095
+ ]), 1040, ["items", "is-option-disabled", "is-multi-level", "static-categories", "searching", "selected-items-list", "onSelectCategory", "onUnselectCategory"])
1096
+ ])) : J("", !0),
1097
+ se(F("div", null, [
1098
+ Lt,
1099
+ I(o, U({
1100
+ ref: "listboxItemsRef",
1101
+ items: e.items,
1102
+ "is-option-disabled": e.isOptionDisabled,
1103
+ "is-multi-level": e.isMultiLevelSelect,
1104
+ "static-categories": e.staticCategories,
1105
+ searching: e.searching,
1106
+ "selected-items-list": e.selectedItemsList,
1107
+ onToggleCheckboxSelection: t[4] || (t[4] = (s) => e.toggleCheckboxSelection(e.BentoListboxEvent.SELECT, s)),
1108
+ onSelectCategory: e.selectAllCategory,
1109
+ onUnselectCategory: e.unselectAllCategory
1110
+ }, {
1111
+ [q(e.BentoListboxEvent.SPACE)]: t[5] || (t[5] = (s) => e.toggleCheckboxSelection(e.BentoListboxEvent.SPACE, s))
1112
+ }, {
1113
+ [q(e.BentoListboxEvent.TAB)]: t[6] || (t[6] = (s) => e.toggleCheckboxSelection(e.BentoListboxEvent.TAB, s))
1114
+ }, {
1115
+ [q(e.BentoListboxEvent.ENTER)]: t[7] || (t[7] = (s) => e.toggleCheckboxSelection(e.BentoListboxEvent.ENTER, s))
1116
+ }), le({ _: 2 }, [
1117
+ z(e.slots, (s, f) => ({
1118
+ name: f,
1119
+ fn: _((m) => [
1120
+ w(e.$slots, f, Y(x(m)), void 0, !0)
1121
+ ])
1122
+ }))
1123
+ ]), 1040, ["items", "is-option-disabled", "is-multi-level", "static-categories", "searching", "selected-items-list", "onSelectCategory", "onUnselectCategory"])
1124
+ ], 512), [
1125
+ [pe, !e.isAllItemsIncludingDisabled]
1126
+ ])
1127
+ ], 16)), [
1128
+ [p]
1129
+ ]);
1130
+ }
1131
+ const he = /* @__PURE__ */ X(ht, [["render", At], ["__scopeId", "data-v-1ba4ab3d"]]), Te = {
1132
+ "en-US": {
1133
+ showMore: "Show more",
1134
+ loading: "Loading"
1135
+ }
1136
+ }, It = 36, Bt = j({
1137
+ name: "bento-listbox",
1138
+ components: {
1139
+ BentoEmptyState: ze,
1140
+ BentoListboxSingleSelect: ut,
1141
+ BentoListboxMultiSelect: he,
1142
+ BentoTypography: oe,
1143
+ BentoLoadingIndicator: Ke,
1144
+ BentoLoadingButton: je
1145
+ },
1146
+ directives: { BentoKeyboardNavigationDirective: ye },
1147
+ i18n: { messages: Te },
1148
+ props: {
1149
+ /**
1150
+ * Defines a string value that labels an interactive element.
1151
+ */
1152
+ ariaLabel: { type: String, default: null },
1153
+ /**
1154
+ * Empty state props that will be used with the inner empty state component to be displayed when no search results are found.
1155
+ */
1156
+ emptyState: {
1157
+ type: Object,
1158
+ default: void 0
1159
+ },
1160
+ /**
1161
+ * Indicates whether there are more items to load
1162
+ */
1163
+ hasMoreItems: { type: Boolean, default: !1 },
1164
+ /**
1165
+ * Identifies the listbox whose contents are controlled by the the combobox on which the aria-controls attribute is set.
1166
+ */
1167
+ id: { type: String, required: !0 },
1168
+ /**
1169
+ * Function that allows the options to be disabled
1170
+ *
1171
+ * @type {BentoListboxIsOptionDisabled}
1172
+ * @param {BentoListboxOptionItem} option - Listbox option object
1173
+ * @param {string} option.label - Option's label text
1174
+ * @param {string|number} option.value - Option's value
1175
+ * @param {unknown} option.data - Option's extra data to be passed to the default slot
1176
+ */
1177
+ isOptionDisabled: {
1178
+ type: Function,
1179
+ default: () => {
1180
+ }
1181
+ },
1182
+ /**
1183
+ * The option elements to populate the listbox with.
1184
+ * It must be an array of {@see BentoListboxOptionItem }
1185
+ * * @property {string} value.label - Text to be displayed in the option
1186
+ * * @property {string,number} value.value - Value of the option
1187
+ */
1188
+ items: {
1189
+ type: Array,
1190
+ required: !0
1191
+ },
1192
+ /**
1193
+ * Indicates if new options are loading.
1194
+ */
1195
+ loading: { type: Boolean, default: !1 },
1196
+ /**
1197
+ * The type of `Lazy Load`.
1198
+ * Type "automatic" will enable infinite scrolling
1199
+ * Type "button" will enable lazy loading with "Show more" button
1200
+ */
1201
+ lazyLoadType: {
1202
+ type: String,
1203
+ default: Z.NONE,
1204
+ validator: (e) => Object.values(Z).includes(e)
1205
+ },
1206
+ /**
1207
+ * If enabled, the user will be able to select multiple items.
1208
+ */
1209
+ multiple: { type: Boolean, default: !1 },
1210
+ /**
1211
+ * If enabled, dropdown will display non-selectable, static categories
1212
+ */
1213
+ staticCategories: { type: Boolean, default: !1 },
1214
+ /**
1215
+ * Messaged displayed when no items are listed in the listbox
1216
+ */
1217
+ noResultsMessage: { type: String, required: !0 },
1218
+ /**
1219
+ * Flag that indicates that an external search it's being made
1220
+ * to filter out the items inside the the multi-select listbox
1221
+ *
1222
+ * If enabled, hides the "Select all" checkbox in "multiple" mode.
1223
+ */
1224
+ searching: he.props.searching,
1225
+ /**
1226
+ * The `input` value.
1227
+ * Providing an empty string or empty array will select no options.
1228
+ * Set to an empty string `''` if you don't want any of the available options to be selected for single select
1229
+ */
1230
+ selectedValue: {
1231
+ type: [String, Number, Array],
1232
+ default: void 0
1233
+ },
1234
+ /**
1235
+ * Enables virtual scrolling if set to true or by providing an object with itemHeight function.
1236
+ * The itemHeight function is used to calculate the height of rendered item given it's index.
1237
+ */
1238
+ virtualScroll: {
1239
+ type: [Boolean, Object],
1240
+ default: !1
1241
+ }
1242
+ },
1243
+ emits: [
1244
+ c.SELECT,
1245
+ c.SPACE,
1246
+ c.SHOW_MORE,
1247
+ c.ENTER,
1248
+ c.ESCAPE,
1249
+ c.TAB
1250
+ ],
1251
+ setup(e, { emit: t, slots: r }) {
1252
+ const b = N([]), i = re(e, "items"), { t: n } = Se({ messages: Te }), a = u(() => e.lazyLoadType !== Z.AUTOMATIC), l = u(() => e.lazyLoadType === Z.AUTOMATIC), d = () => {
1253
+ var D;
1254
+ return typeof (e == null ? void 0 : e.virtualScroll) == "object" && ((D = e == null ? void 0 : e.virtualScroll) != null && D.itemHeight) ? e.virtualScroll.itemHeight : It;
1255
+ }, {
1256
+ containerRef: o,
1257
+ containerProps: p,
1258
+ onScroll: s,
1259
+ list: f,
1260
+ wrapperProps: m
1261
+ } = Je(i, {
1262
+ itemHeight: d(),
1263
+ // Disable virtual scrolling if not enabled or if lazy loading is enabled or if multi-select
1264
+ disabled: (e == null ? void 0 : e.multiple) || (e == null ? void 0 : e.virtualScroll) === !1 || (e == null ? void 0 : e.lazyLoadType) !== "none"
1265
+ }), h = u(
1266
+ () => a.value ? "true" : void 0
1267
+ ), R = u(
1268
+ () => a.value && e.loading ? "true" : "false"
1269
+ ), P = u(
1270
+ () => a.value ? "polite" : void 0
1271
+ ), T = (D) => (ie) => {
1272
+ t(D, ie);
1273
+ }, k = () => {
1274
+ t(c.SHOW_MORE);
1275
+ }, $ = We(() => {
1276
+ const D = o.value;
1277
+ if (!D)
1278
+ return;
1279
+ const ie = Math.round(D.scrollTop) + D.clientHeight >= D.scrollHeight;
1280
+ e.hasMoreItems && ie && !e.loading && k();
1281
+ }), S = () => {
1282
+ l.value ? $() : s();
1283
+ }, O = u(() => {
1284
+ var D;
1285
+ return e.searching && ((D = e.items) == null ? void 0 : D.length) === 0;
1286
+ }), M = u(
1287
+ () => e.lazyLoadType === Z.BUTTON && e.hasMoreItems
1288
+ ), Q = u(
1289
+ () => e.loading ? Ce.LOADING : Ce.START
1290
+ ), de = u(() => e.loading ? n("loading") : n("showMore")), ne = u(() => ({
1291
+ ...e.emptyState,
1292
+ variant: "condensed"
1293
+ })), ue = {
1294
+ [c.SELECT]: T(c.SELECT),
1295
+ [c.SPACE]: T(c.SPACE),
1296
+ [c.TAB]: T(c.TAB),
1297
+ [c.ENTER]: T(c.ENTER)
1298
+ };
1299
+ return {
1300
+ // Refs
1301
+ listboxRef: o,
1302
+ listboxItemRef: b,
1303
+ // a11y
1304
+ ariaAtomic: h,
1305
+ ariaBusy: R,
1306
+ ariaLive: P,
1307
+ // Values
1308
+ containerProps: p,
1309
+ isSearchResultEmpty: O,
1310
+ limitedEmptyStateProps: ne,
1311
+ loadingButtonState: Q,
1312
+ slots: r,
1313
+ shouldDisplayShowMoreButton: M,
1314
+ showMoreButtonText: de,
1315
+ virtualisedItems: f,
1316
+ wrapperProps: m,
1317
+ // Enums
1318
+ BentoKeyboardNavigationKeyDownEvent: W,
1319
+ BentoListboxEvent: c,
1320
+ // Methods
1321
+ onListboxContainerScroll: S,
1322
+ onOptionSelected: T,
1323
+ emitShowMore: k,
1324
+ listboxListeners: ue
1325
+ };
1326
+ }
1327
+ });
1328
+ const $t = ["id", "aria-busy", "aria-atomic", "aria-label", "aria-live"], kt = {
1329
+ key: 0,
1330
+ class: "b-listbox__empty-search-message"
1331
+ }, Rt = {
1332
+ key: 2,
1333
+ class: "b-listbox__lazy-load"
1334
+ }, Dt = {
1335
+ key: 3,
1336
+ class: "b-listbox__lazy-load"
1337
+ };
1338
+ function Nt(e, t, r, b, i, n) {
1339
+ const a = C("bento-empty-state"), l = C("bento-typography"), d = C("bento-listbox-multi-select"), o = C("bento-listbox-single-select"), p = C("bento-loading-button"), s = C("bento-loading-indicator"), f = fe("bento-keyboard-navigation-directive");
1340
+ return se((g(), A("div", U({ id: e.id }, e.containerProps, {
1341
+ class: "b-listbox",
1342
+ role: "listbox",
1343
+ tabindex: "-1",
1344
+ "aria-busy": e.ariaBusy,
1345
+ "aria-atomic": e.ariaAtomic,
1346
+ "aria-label": e.ariaLabel,
1347
+ "aria-live": e.ariaLive,
1348
+ onScroll: t[0] || (t[0] = (...m) => e.onListboxContainerScroll && e.onListboxContainerScroll(...m))
1349
+ }), [
1350
+ F("div", Y(x(e.wrapperProps)), [
1351
+ e.isSearchResultEmpty ? (g(), A("div", kt, [
1352
+ e.emptyState ? (g(), B(a, Y(U({ key: 0 }, e.limitedEmptyStateProps)), null, 16)) : (g(), B(l, {
1353
+ key: 1,
1354
+ el: "span"
1355
+ }, {
1356
+ default: _(() => [
1357
+ V(G(e.noResultsMessage), 1)
1358
+ ]),
1359
+ _: 1
1360
+ }))
1361
+ ])) : (g(), A(te, { key: 1 }, [
1362
+ e.multiple ? (g(), B(d, U({
1363
+ key: 0,
1364
+ ref: "listboxItemRef",
1365
+ items: e.items,
1366
+ "static-categories": e.staticCategories,
1367
+ "selected-values": e.selectedValue,
1368
+ searching: e.searching,
1369
+ "is-option-disabled": e.isOptionDisabled
1370
+ }, ee(e.listboxListeners)), le({ _: 2 }, [
1371
+ z(e.slots, (m, h) => ({
1372
+ name: h,
1373
+ fn: _((R) => [
1374
+ w(e.$slots, h, Y(x(R)), void 0, !0)
1375
+ ])
1376
+ }))
1377
+ ]), 1040, ["items", "static-categories", "selected-values", "searching", "is-option-disabled"])) : (g(), B(o, U({
1378
+ key: 1,
1379
+ ref: "listboxItemRef",
1380
+ items: e.virtualisedItems,
1381
+ "selected-value": e.selectedValue,
1382
+ "static-categories": e.staticCategories,
1383
+ "is-option-disabled": e.isOptionDisabled
1384
+ }, ee(e.listboxListeners)), le({ _: 2 }, [
1385
+ z(e.slots, (m, h) => ({
1386
+ name: h,
1387
+ fn: _((R) => [
1388
+ w(e.$slots, h, Y(x(R)), void 0, !0)
1389
+ ])
1390
+ }))
1391
+ ]), 1040, ["items", "selected-value", "static-categories", "is-option-disabled"])),
1392
+ e.shouldDisplayShowMoreButton ? (g(), A("div", Rt, [
1393
+ I(p, {
1394
+ state: e.loadingButtonState,
1395
+ variant: "secondary",
1396
+ onClickCapture: e.emitShowMore
1397
+ }, {
1398
+ default: _(() => [
1399
+ V(G(e.showMoreButtonText), 1)
1400
+ ]),
1401
+ _: 1
1402
+ }, 8, ["state", "onClickCapture"])
1403
+ ])) : e.loading ? (g(), A("div", Dt, [
1404
+ I(s)
1405
+ ])) : J("", !0)
1406
+ ], 64))
1407
+ ], 16)
1408
+ ], 16, $t)), [
1409
+ [f]
1410
+ ]);
1411
+ }
1412
+ const Ht = /* @__PURE__ */ X(Bt, [["render", Nt], ["__scopeId", "data-v-4110c0cb"]]);
1413
+ export {
1414
+ Ht as B,
1415
+ c as a,
1416
+ Z as b,
1417
+ _t as u
1418
+ };
1419
+ //# sourceMappingURL=listbox.963589af.js.map