@adyen/bento-vue3 1.65.0 → 1.66.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 (183) hide show
  1. package/dist/@types/index.d.ts +445 -232
  2. package/dist/action-bar.js +1 -1
  3. package/dist/assets/accordion-item.css +1 -1
  4. package/dist/assets/action-bar.css +1 -1
  5. package/dist/assets/base-modal.css +1 -1
  6. package/dist/assets/button-actions-with-menu.css +1 -1
  7. package/dist/assets/card.css +1 -1
  8. package/dist/assets/copy.css +1 -1
  9. package/dist/assets/data-grid-template.css +1 -1
  10. package/dist/assets/data-grid.css +1 -1
  11. package/dist/assets/date.css +1 -1
  12. package/dist/assets/dialog-page.css +1 -1
  13. package/dist/assets/dropdown.css +1 -1
  14. package/dist/assets/file-uploader.css +1 -1
  15. package/dist/assets/filter-bar.css +1 -1
  16. package/dist/assets/header.css +1 -1
  17. package/dist/assets/info-icon.css +1 -1
  18. package/dist/assets/input-field-password.css +1 -1
  19. package/dist/assets/inspector.css +1 -1
  20. package/dist/assets/menu.css +1 -1
  21. package/dist/assets/modal-fullscreen.css +1 -1
  22. package/dist/assets/pagination.css +1 -1
  23. package/dist/assets/popover.css +1 -1
  24. package/dist/assets/sidepanel.css +1 -1
  25. package/dist/assets/step.css +1 -1
  26. package/dist/assets/summary-grid.css +1 -1
  27. package/dist/assets/tab.css +1 -0
  28. package/dist/assets/textarea.css +1 -1
  29. package/dist/assets/use-cached-selected-values.css +1 -1
  30. package/dist/checkbox.js +2 -2
  31. package/dist/chunks/{action-bar.BAfqAQjP.js → action-bar.OzhLTUKc.js} +38 -38
  32. package/dist/chunks/action-bar.OzhLTUKc.js.map +1 -0
  33. package/dist/chunks/button-actions-with-menu.xZYmwO7S.js +91 -0
  34. package/dist/chunks/button-actions-with-menu.xZYmwO7S.js.map +1 -0
  35. package/dist/chunks/calendar._oPk_A1C.js +2209 -0
  36. package/dist/chunks/calendar._oPk_A1C.js.map +1 -0
  37. package/dist/chunks/{checkbox-group.BKsddn67.js → checkbox-group.Dc5Olq0c.js} +4 -4
  38. package/dist/chunks/{checkbox-group.BKsddn67.js.map → checkbox-group.Dc5Olq0c.js.map} +1 -1
  39. package/dist/chunks/{checkbox.C1y3Ad4Z.js → checkbox.fkPJvdUo.js} +2 -2
  40. package/dist/chunks/{checkbox.C1y3Ad4Z.js.map → checkbox.fkPJvdUo.js.map} +1 -1
  41. package/dist/chunks/{code-snippet.Bj5SAyT-.js → code-snippet.DPIhpuKa.js} +3 -3
  42. package/dist/chunks/{code-snippet.Bj5SAyT-.js.map → code-snippet.DPIhpuKa.js.map} +1 -1
  43. package/dist/chunks/{controls-group.DD1m4EKn.js → controls-group.CrzkSu0U.js} +2 -2
  44. package/dist/chunks/{controls-group.DD1m4EKn.js.map → controls-group.CrzkSu0U.js.map} +1 -1
  45. package/dist/chunks/copy.RUoQOydT.js +118 -0
  46. package/dist/chunks/copy.RUoQOydT.js.map +1 -0
  47. package/dist/chunks/{dashboard-section.C6FNJuEz.js → dashboard-section.BmtN9b0B.js} +3 -3
  48. package/dist/chunks/{dashboard-section.C6FNJuEz.js.map → dashboard-section.BmtN9b0B.js.map} +1 -1
  49. package/dist/chunks/data-grid-template.DAuqLhPI.js +144 -0
  50. package/dist/chunks/data-grid-template.DAuqLhPI.js.map +1 -0
  51. package/dist/chunks/{data-grid.DroQMKSc.js → data-grid.BrYCmbPR.js} +10 -10
  52. package/dist/chunks/{data-grid.DroQMKSc.js.map → data-grid.BrYCmbPR.js.map} +1 -1
  53. package/dist/chunks/{date-picker.BuX2J2OW.js → date-picker.Bk4FNLyR.js} +33 -34
  54. package/dist/chunks/{date-picker.BuX2J2OW.js.map → date-picker.Bk4FNLyR.js.map} +1 -1
  55. package/dist/chunks/{date-range-picker.C2x1_xoz.js → date-range-picker.-YsRuGmp.js} +36 -37
  56. package/dist/chunks/{date-range-picker.C2x1_xoz.js.map → date-range-picker.-YsRuGmp.js.map} +1 -1
  57. package/dist/chunks/date.DSjCnSgL.js +163 -0
  58. package/dist/chunks/date.DSjCnSgL.js.map +1 -0
  59. package/dist/chunks/{dropdown-tag.Dm-1VD3B.js → dropdown-tag.BUDNO3d0.js} +2 -2
  60. package/dist/chunks/{dropdown-tag.Dm-1VD3B.js.map → dropdown-tag.BUDNO3d0.js.map} +1 -1
  61. package/dist/chunks/{dropdown.Bj6DK-2v.js → dropdown.usAqDecC.js} +307 -312
  62. package/dist/chunks/{dropdown.Bj6DK-2v.js.map → dropdown.usAqDecC.js.map} +1 -1
  63. package/dist/chunks/{error-message.DZWphzoT.js → error-message.DHMHq9bR.js} +2 -2
  64. package/dist/chunks/{error-message.DZWphzoT.js.map → error-message.DHMHq9bR.js.map} +1 -1
  65. package/dist/chunks/es6.n1ewaW31.js.map +1 -1
  66. package/dist/chunks/{file-uploader.C8DwUCMp.js → file-uploader.B_EI2fAc.js} +523 -523
  67. package/dist/chunks/file-uploader.B_EI2fAc.js.map +1 -0
  68. package/dist/chunks/{filter-bar.BvInaVGL.js → filter-bar.BxfaFHTk.js} +1004 -989
  69. package/dist/chunks/{filter-bar.BvInaVGL.js.map → filter-bar.BxfaFHTk.js.map} +1 -1
  70. package/dist/chunks/{get-date-locale.BN8xEjY0.js → get-date-locale.CAyOIbcp.js} +288 -649
  71. package/dist/chunks/get-date-locale.CAyOIbcp.js.map +1 -0
  72. package/dist/chunks/{header-with-views.De0oVJXS.js → header-with-views.COrWDbtU.js} +16 -16
  73. package/dist/chunks/{header-with-views.De0oVJXS.js.map → header-with-views.COrWDbtU.js.map} +1 -1
  74. package/dist/chunks/{header.Ckjp7n9t.js → header.DAEUKoX5.js} +62 -61
  75. package/dist/chunks/{header.Ckjp7n9t.js.map → header.DAEUKoX5.js.map} +1 -1
  76. package/dist/chunks/index.BrH1t1iu.js +407 -0
  77. package/dist/chunks/index.BrH1t1iu.js.map +1 -0
  78. package/dist/chunks/info-icon.DprUQ9fj.js +36 -0
  79. package/dist/chunks/info-icon.DprUQ9fj.js.map +1 -0
  80. package/dist/chunks/input-field-password.XrXAnMpT.js +369 -0
  81. package/dist/chunks/input-field-password.XrXAnMpT.js.map +1 -0
  82. package/dist/chunks/{input-field-phone-number.DVliTkE3.js → input-field-phone-number.CNurVdiF.js} +3 -3
  83. package/dist/chunks/{input-field-phone-number.DVliTkE3.js.map → input-field-phone-number.CNurVdiF.js.map} +1 -1
  84. package/dist/chunks/{input-field.xUQT0LXI.js → input-field.EOIwm2tq.js} +3 -3
  85. package/dist/chunks/{input-field.xUQT0LXI.js.map → input-field.EOIwm2tq.js.map} +1 -1
  86. package/dist/chunks/{pagination.D6A7TX6J.js → pagination._rYMF2W_.js} +168 -168
  87. package/dist/chunks/pagination._rYMF2W_.js.map +1 -0
  88. package/dist/chunks/{radio-group.435rdgzm.js → radio-group.H9A5QcNu.js} +3 -3
  89. package/dist/chunks/{radio-group.435rdgzm.js.map → radio-group.H9A5QcNu.js.map} +1 -1
  90. package/dist/chunks/{rich-text-editor.BDLncrV5.js → rich-text-editor.RD8aCPTi.js} +3 -3
  91. package/dist/chunks/{rich-text-editor.BDLncrV5.js.map → rich-text-editor.RD8aCPTi.js.map} +1 -1
  92. package/dist/chunks/{search-bar.Cngs3uYZ.js → search-bar.i7BY4IGB.js} +3 -3
  93. package/dist/chunks/{search-bar.Cngs3uYZ.js.map → search-bar.i7BY4IGB.js.map} +1 -1
  94. package/dist/chunks/{secondary-nav.ByCa4wiA.js → secondary-nav.DkRQsIx7.js} +2 -2
  95. package/dist/chunks/{secondary-nav.ByCa4wiA.js.map → secondary-nav.DkRQsIx7.js.map} +1 -1
  96. package/dist/chunks/{selection-card-group.9wJy7FC2.js → selection-card-group.B4xpnd-z.js} +3 -3
  97. package/dist/chunks/{selection-card-group.9wJy7FC2.js.map → selection-card-group.B4xpnd-z.js.map} +1 -1
  98. package/dist/chunks/step.BtNhPZAf.js +268 -0
  99. package/dist/chunks/step.BtNhPZAf.js.map +1 -0
  100. package/dist/chunks/{structured-list-item.DQzxNb_M.js → structured-list-item.BQbEDKhg.js} +3 -3
  101. package/dist/chunks/{structured-list-item.DQzxNb_M.js.map → structured-list-item.BQbEDKhg.js.map} +1 -1
  102. package/dist/chunks/summary-grid.types.BTr6x5cg.js +490 -0
  103. package/dist/chunks/summary-grid.types.BTr6x5cg.js.map +1 -0
  104. package/dist/chunks/tab.CAt51ksU.js +252 -0
  105. package/dist/chunks/tab.CAt51ksU.js.map +1 -0
  106. package/dist/chunks/{tabs.keys.Bc2pSKRw.js → tabs.keys.Cb4Vw5Jh.js} +3 -3
  107. package/dist/chunks/{tabs.keys.Bc2pSKRw.js.map → tabs.keys.Cb4Vw5Jh.js.map} +1 -1
  108. package/dist/chunks/{textarea.CV1HjB0x.js → textarea.DXSe9MHH.js} +83 -80
  109. package/dist/chunks/textarea.DXSe9MHH.js.map +1 -0
  110. package/dist/chunks/{timeline-item.DUp8MmgZ.js → timeline-item.Coz_LRD3.js} +10 -11
  111. package/dist/chunks/timeline-item.Coz_LRD3.js.map +1 -0
  112. package/dist/chunks/use-cached-selected-values.rqtiP4Nd.js +1649 -0
  113. package/dist/chunks/use-cached-selected-values.rqtiP4Nd.js.map +1 -0
  114. package/dist/code-snippet.js +1 -1
  115. package/dist/dashboard-template.js +1 -1
  116. package/dist/data-grid-template.js +1 -1
  117. package/dist/data-grid.js +1 -1
  118. package/dist/date-picker.js +2 -2
  119. package/dist/date-range-picker.js +2 -2
  120. package/dist/date.js +1 -1
  121. package/dist/dropdown.js +3 -3
  122. package/dist/file-uploader.js +1 -1
  123. package/dist/filter-bar.js +1 -1
  124. package/dist/header-with-views.js +1 -1
  125. package/dist/header.js +1 -1
  126. package/dist/index.js +34 -34
  127. package/dist/info-icon.js +1 -1
  128. package/dist/input-field-password.js +1 -1
  129. package/dist/input-field-phone-number.js +1 -1
  130. package/dist/input-field.js +1 -1
  131. package/dist/internal.js +6 -6
  132. package/dist/pagination.js +1 -1
  133. package/dist/radio-group.js +1 -1
  134. package/dist/rich-text-editor.js +1 -1
  135. package/dist/search-bar.js +2 -2
  136. package/dist/secondary-nav.js +1 -1
  137. package/dist/selection-card.js +1 -1
  138. package/dist/stepper.js +1 -1
  139. package/dist/structured-list.js +1 -1
  140. package/dist/styles/bento-dark.css +1 -0
  141. package/dist/styles/bento-light.css +1 -0
  142. package/dist/styles/bento.css +1 -0
  143. package/dist/styles/legacy.css +1 -0
  144. package/dist/styles/styleguide.css +1 -0
  145. package/dist/summary-grid.js +1 -1
  146. package/dist/tabs.js +1 -1
  147. package/dist/textarea.js +1 -1
  148. package/dist/timeline.js +1 -1
  149. package/dist/web-types.json +1 -1
  150. package/package.json +5 -5
  151. package/dist/assets/tabs.css +0 -1
  152. package/dist/chunks/action-bar.BAfqAQjP.js.map +0 -1
  153. package/dist/chunks/button-actions-with-menu.D50ABuSV.js +0 -174
  154. package/dist/chunks/button-actions-with-menu.D50ABuSV.js.map +0 -1
  155. package/dist/chunks/calendar.CLpwW_-k.js +0 -1290
  156. package/dist/chunks/calendar.CLpwW_-k.js.map +0 -1
  157. package/dist/chunks/copy.DqckFHHS.js +0 -156
  158. package/dist/chunks/copy.DqckFHHS.js.map +0 -1
  159. package/dist/chunks/data-grid-template.DzIpssxc.js +0 -143
  160. package/dist/chunks/data-grid-template.DzIpssxc.js.map +0 -1
  161. package/dist/chunks/date.CKXySBQv.js +0 -995
  162. package/dist/chunks/date.CKXySBQv.js.map +0 -1
  163. package/dist/chunks/file-uploader.C8DwUCMp.js.map +0 -1
  164. package/dist/chunks/get-date-locale.BN8xEjY0.js.map +0 -1
  165. package/dist/chunks/index.BDuTpjD8.js +0 -40
  166. package/dist/chunks/index.BDuTpjD8.js.map +0 -1
  167. package/dist/chunks/index.DD7TppDb.js +0 -10
  168. package/dist/chunks/index.DD7TppDb.js.map +0 -1
  169. package/dist/chunks/info-icon.CpGwbhZQ.js +0 -45
  170. package/dist/chunks/info-icon.CpGwbhZQ.js.map +0 -1
  171. package/dist/chunks/input-field-password.CJOf1GlS.js +0 -369
  172. package/dist/chunks/input-field-password.CJOf1GlS.js.map +0 -1
  173. package/dist/chunks/pagination.D6A7TX6J.js.map +0 -1
  174. package/dist/chunks/step.CpSPMvdW.js +0 -264
  175. package/dist/chunks/step.CpSPMvdW.js.map +0 -1
  176. package/dist/chunks/summary-grid.types.BpS1z1-W.js +0 -466
  177. package/dist/chunks/summary-grid.types.BpS1z1-W.js.map +0 -1
  178. package/dist/chunks/tabs.Cq1fdzVh.js +0 -266
  179. package/dist/chunks/tabs.Cq1fdzVh.js.map +0 -1
  180. package/dist/chunks/textarea.CV1HjB0x.js.map +0 -1
  181. package/dist/chunks/timeline-item.DUp8MmgZ.js.map +0 -1
  182. package/dist/chunks/use-cached-selected-values.CEwKqYIe.js +0 -1600
  183. package/dist/chunks/use-cached-selected-values.CEwKqYIe.js.map +0 -1
@@ -1,1600 +0,0 @@
1
- import { computed as p, ref as B, onMounted as et, onUnmounted as tt, watch as ne, defineComponent as Z, resolveComponent as k, createElementBlock as O, openBlock as d, createVNode as x, createElementVNode as z, withCtx as I, createTextVNode as K, toDisplayString as F, renderSlot as W, mergeProps as w, withKeys as Ce, createCommentVNode as J, createBlock as R, withModifiers as ae, normalizeProps as ie, guardReactiveProps as ue, withDirectives as re, vShow as Pe, nextTick as Me, resolveDirective as xe, toHandlers as se, Fragment as le, renderList as H, createSlots as be, normalizeClass as me, unref as M, toRef as _e, useSlots as st, useAttrs as lt } from "vue";
2
- import { B as V, a as pe } from "./keyboard-navigation.CqgGzfZQ.js";
3
- import "./events.FNmSWp_P.js";
4
- import { B as ce } from "./typography.DN5eC5ch.js";
5
- import { B as ot } from "./loading-indicator.DEepb9Wl.js";
6
- import { B as it } from "./empty-state.D7llINgF.js";
7
- import { u as Oe } from "./i18n.B6g5VX0q.js";
8
- import { d as nt } from "./debounce.DUTu11PS.js";
9
- import { B as at } from "./chip.CneNX2_j.js";
10
- import { _ as j } from "./_plugin-vue_export-helper.CHgC5LLL.js";
11
- import { C as fe, N as rt } from "./minus-small.DYIyF5XW.js";
12
- import { C as ct } from "./checkmark-small.x-gmK2Dt.js";
13
- import { C as dt } from "./chevron-down.DCQ6ZLaq.js";
14
- import { C as ut } from "./chevron-up.kfuLRpZb.js";
15
- import { d as bt, e as De } from "./button-actions.D1pXI1AJ.js";
16
- /* empty css */
17
- import { o as mt } from "./resize.Bqks3WUm.js";
18
- import "../assets/use-cached-selected-values.css";
19
- const Ge = (e, t, n, s) => {
20
- const a = p(
21
- () => {
22
- var m, h;
23
- return !!((m = e.value) != null && m.length) && ((h = e.value) == null ? void 0 : h.length) === t.value.length;
24
- }
25
- ), i = p(() => {
26
- var m;
27
- return e.value == null || e.value.length === 0 ? !1 : ((m = e.value) == null ? void 0 : m.length) !== t.value.length;
28
- });
29
- return {
30
- isAllSelected: a,
31
- isIndeterminate: i,
32
- toggleSelectAll: (m) => {
33
- m ? n() : s();
34
- }
35
- };
36
- };
37
- function vt(e, { disabled: t, itemHeight: n, overscan: s = 5, prefixHeight: a }) {
38
- const i = B(null), c = B([]), m = B(0), h = B(0), l = B(0);
39
- let r;
40
- const o = p(() => {
41
- const A = typeof n == "number" ? e.value.length * n : e.value.reduce((L, $, C) => L + n(C), 0), P = typeof n == "number" ? m.value * n : e.value.slice(0, m.value).reduce((L, $, C) => L + n(C), 0);
42
- return {
43
- style: {
44
- marginTop: `${P}px`,
45
- height: `${A - P}px`
46
- }
47
- };
48
- }), y = () => {
49
- const A = (a == null ? void 0 : a.value) ?? 0, P = Math.max(i.value.scrollTop - A, 0);
50
- if (typeof n == "number")
51
- return Math.floor(P / n);
52
- let L = 0, $ = 0;
53
- for (let C = 0; C < e.value.length; C += 1) {
54
- const S = n(C);
55
- if (L += S, L >= P) {
56
- $ = C;
57
- break;
58
- }
59
- }
60
- return $;
61
- }, g = () => {
62
- if (l.value = i.value.clientHeight, typeof n == "number")
63
- return Math.ceil(l.value / n);
64
- const A = m.value ?? 0;
65
- let P = 0, L = 0;
66
- for (let $ = A; $ < e.value.length; $ += 1) {
67
- const C = n($);
68
- if (P += C, L = $, P > l.value)
69
- break;
70
- }
71
- return L - A;
72
- }, T = () => {
73
- if (i.value) {
74
- const A = g();
75
- m.value = y(), h.value = Math.min(m.value + A + s, e.value.length), c.value = e.value.slice(m.value, h.value);
76
- }
77
- }, N = () => {
78
- T();
79
- };
80
- t || (et(() => {
81
- i.value && (l.value = i.value.clientHeight, r = mt(i.value, ({ clientHeight: A }) => {
82
- l.value = A, T();
83
- }), T());
84
- }), tt(() => {
85
- r == null || r.disconnect();
86
- }), ne(
87
- () => e.value,
88
- () => {
89
- T();
90
- }
91
- ));
92
- const D = {
93
- ref: i,
94
- style: { overflowY: "auto" }
95
- };
96
- return t ? {
97
- containerRef: i,
98
- containerProps: D,
99
- // eslint-disable-next-line @typescript-eslint/no-empty-function
100
- onScroll: () => {
101
- },
102
- list: e
103
- } : {
104
- containerRef: i,
105
- containerProps: D,
106
- onScroll: N,
107
- list: c,
108
- wrapperProps: o
109
- };
110
- }
111
- var v = /* @__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))(v || {}), oe = /* @__PURE__ */ ((e) => (e.AUTOMATIC = "automatic", e.BUTTON = "button", e.NONE = "none", e))(oe || {});
112
- const ft = Z({
113
- name: "bento-listbox-static-category",
114
- components: {
115
- BentoTypography: ce
116
- },
117
- props: {
118
- /**
119
- * Category label text
120
- */
121
- categoryLabel: {
122
- type: String,
123
- required: !0
124
- }
125
- }
126
- }), pt = { class: "b-listbox-single-select-category" };
127
- function gt(e, t, n, s, a, i) {
128
- const c = k("bento-typography");
129
- return d(), O("div", pt, [
130
- x(c, {
131
- variant: "caption",
132
- el: "span",
133
- class: "b-listbox-single-select-category__label-text"
134
- }, {
135
- default: I(() => [
136
- K(F(e.categoryLabel), 1)
137
- ]),
138
- _: 1
139
- }),
140
- z("div", null, [
141
- W(e.$slots, "default", {}, void 0, !0)
142
- ])
143
- ]);
144
- }
145
- const yt = /* @__PURE__ */ j(ft, [["render", gt], ["__scopeId", "data-v-a90eff17"]]), St = Z({
146
- name: "bento-listbox-option",
147
- props: {
148
- /**
149
- * Setting this property to true will disable the option.
150
- */
151
- disabled: { type: Boolean, default: !1 },
152
- /**
153
- * Indicates if the value is selected. Only one element can be selected at a time.
154
- */
155
- selected: { type: Boolean, default: !1 }
156
- },
157
- emits: [v.CLICK, v.ENTER, v.SPACE, v.TAB],
158
- setup(e, { emit: t }) {
159
- const n = p(() => ({
160
- "b-listbox-option--disabled": e.disabled,
161
- "b-listbox-option--selected": e.selected
162
- }));
163
- return {
164
- // Enums
165
- BentoKeyboardNavigationKeyDownEvent: V,
166
- BentoListboxEvent: v,
167
- // Values
168
- conditionalClasses: n,
169
- // Events
170
- onClick: (i) => {
171
- t(v.CLICK, i);
172
- },
173
- onOptionSelected: (i, c) => {
174
- t(i, c);
175
- }
176
- };
177
- }
178
- });
179
- function ht(e, t, n, s, a, i) {
180
- return d(), O("div", w({
181
- class: ["b-listbox-option", e.conditionalClasses],
182
- role: "option"
183
- }, e.$attrs, {
184
- onClick: t[0] || (t[0] = (...c) => e.onClick && e.onClick(...c)),
185
- onKeydown: [
186
- t[1] || (t[1] = Ce((c) => e.onOptionSelected(e.BentoListboxEvent.ENTER, c), ["enter"])),
187
- t[2] || (t[2] = Ce((c) => e.onOptionSelected(e.BentoListboxEvent.SPACE, c), ["space"])),
188
- t[3] || (t[3] = Ce((c) => e.onOptionSelected(e.BentoListboxEvent.TAB, c), ["tab"]))
189
- ]
190
- }), [
191
- W(e.$slots, "default", {}, void 0, !0)
192
- ], 16);
193
- }
194
- const ge = /* @__PURE__ */ j(St, [["render", ht], ["__scopeId", "data-v-b7af43a6"]]);
195
- let Be = 0;
196
- const Ct = {
197
- beforeCreate() {
198
- this.uuid = Be.toString(), Be += 1;
199
- }
200
- }, Et = { key: 0 };
201
- function _t(e, t, n, s, a, i) {
202
- return d(), O("svg", w({ role: "img" }, e.$attrs, {
203
- class: "ui-assets-icons-16",
204
- xmlns: "http://www.w3.org/2000/svg",
205
- width: "16",
206
- height: "16",
207
- fill: "none"
208
- }), [
209
- e.$attrs["svg-title"] ? (d(), O("title", Et, F(e.$attrs["svg-title"]), 1)) : J("", !0),
210
- t[0] || (t[0] = z("path", {
211
- fill: "#001222",
212
- d: "M15.0608 4.00011L14.0001 2.93945L6.00011 10.9395L2.00011 6.93945L0.939453 8.00011L6.00011 13.0608L15.0608 4.00011Z"
213
- }, null, -1))
214
- ], 16);
215
- }
216
- const Ot = /* @__PURE__ */ j(Ct, [["render", _t]]), Tt = Z({
217
- name: "bento-listbox-single-select-option",
218
- components: {
219
- BentoListboxOption: ge,
220
- BentoTypography: ce,
221
- CheckmarkIcon: Ot
222
- },
223
- props: {
224
- /**
225
- * Setting this property to true will disable the option.
226
- */
227
- disabled: { type: Boolean, default: !1 },
228
- /**
229
- * The option item that contains all the option item's data.
230
- * @type {BentoListboxOptionItem}
231
- */
232
- option: {
233
- type: Object,
234
- required: !0
235
- },
236
- /**
237
- * Indicates if the value is selected. Only one element can be selected at a time.
238
- */
239
- selected: { type: Boolean, default: !1 }
240
- },
241
- emits: [v.ENTER, v.SELECT, v.SPACE, v.TAB],
242
- setup(e, { emit: t }) {
243
- const n = (c) => {
244
- e.disabled || t(c, e.option);
245
- }, s = p(() => e.disabled ? !0 : null), a = p(() => e.selected ? !0 : null), i = p(() => e.disabled ? -1 : 0);
246
- return {
247
- // Values
248
- ariaDisabled: s,
249
- ariaSelected: a,
250
- tabIndex: i,
251
- // Enums
252
- BentoListboxEvent: v,
253
- // Events
254
- onOptionSelected: n
255
- };
256
- }
257
- }), It = { class: "b-listbox-single-select-option__text" }, At = { class: "b-listbox-single-select-option__check-icon" };
258
- function kt(e, t, n, s, a, i) {
259
- const c = k("bento-typography"), m = k("checkmark-icon"), h = k("bento-listbox-option");
260
- return d(), R(h, {
261
- class: "b-listbox-single-select-option",
262
- disabled: e.disabled,
263
- selected: e.selected,
264
- "aria-selected": e.ariaSelected,
265
- "aria-disabled": e.ariaDisabled,
266
- tabindex: e.tabIndex,
267
- onClick: t[0] || (t[0] = (l) => e.onOptionSelected(e.BentoListboxEvent.SELECT)),
268
- onEnterPressed: t[1] || (t[1] = (l) => e.onOptionSelected(e.BentoListboxEvent.ENTER)),
269
- onSpacePressed: t[2] || (t[2] = ae((l) => e.onOptionSelected(e.BentoListboxEvent.SPACE), ["prevent"])),
270
- onTabPressed: t[3] || (t[3] = (l) => e.onOptionSelected(e.BentoListboxEvent.TAB))
271
- }, {
272
- default: I(() => [
273
- W(e.$slots, "default", ie(ue(e.option)), () => [
274
- z("span", It, [
275
- x(c, { el: "span" }, {
276
- default: I(() => [
277
- K(F(e.option.label), 1)
278
- ]),
279
- _: 1
280
- }),
281
- e.option.description ? (d(), R(c, {
282
- key: 0,
283
- class: "b-listbox-single-select-option__description",
284
- el: "span"
285
- }, {
286
- default: I(() => [
287
- K(F(e.option.description), 1)
288
- ]),
289
- _: 1
290
- })) : J("", !0)
291
- ])
292
- ], !0),
293
- z("span", At, [
294
- re(x(m, { "svg-title": "selected" }, null, 512), [
295
- [Pe, e.selected]
296
- ])
297
- ])
298
- ]),
299
- _: 3
300
- }, 8, ["disabled", "selected", "aria-selected", "aria-disabled", "tabindex"]);
301
- }
302
- const Lt = /* @__PURE__ */ j(Tt, [["render", kt], ["__scopeId", "data-v-226f4c84"]]), we = ({ items: e }, t) => {
303
- const n = p(() => e.value.length - 1), s = B(0), a = (y) => {
304
- switch (y) {
305
- case "increase":
306
- s.value += 1;
307
- break;
308
- case "decrease":
309
- s.value -= 1;
310
- break;
311
- }
312
- }, i = ({ edgeCaseItem: y }, g) => {
313
- s.value !== y && (a(g), t(s.value));
314
- }, c = (y) => {
315
- o(y), i(
316
- {
317
- edgeCaseItem: n.value
318
- },
319
- "increase"
320
- /* INCREASE */
321
- );
322
- }, m = (y) => {
323
- o(y), i(
324
- {
325
- edgeCaseItem: 0
326
- },
327
- "decrease"
328
- /* DECREASE */
329
- );
330
- }, h = () => {
331
- s.value = 0, t(s.value);
332
- }, l = () => {
333
- s.value = n.value, t(s.value);
334
- }, r = (y) => {
335
- s.value = y;
336
- }, o = (y) => {
337
- var g;
338
- (g = y == null ? void 0 : y.detail) == null || g.preventDefault();
339
- };
340
- return {
341
- moveToFirstElement: h,
342
- moveToLastElement: l,
343
- moveToNextElement: c,
344
- moveToPreviousElement: m,
345
- setListboxFocusedIndex: r,
346
- preventDefault: o,
347
- focusedIndex: s
348
- };
349
- }, $t = Z({
350
- name: "bento-listbox-single-select",
351
- components: {
352
- BentoListboxSingleSelectCategory: yt,
353
- BentoListboxSingleSelectOption: Lt
354
- },
355
- directives: { BentoKeyboardNavigationDirective: pe },
356
- inheritAttrs: !1,
357
- props: {
358
- /**
359
- * Function that allows the options to be disabled
360
- *
361
- * @type {BentoListboxIsOptionDisabled}
362
- * @param {BentoListboxOptionItem} option - listbox option object
363
- * @param {string} option.label - Option's label text
364
- * @param {string|number} option.value - Option's value
365
- * @param {unknown} option.data - Option's extra data to be passed to the default slot
366
- */
367
- isOptionDisabled: {
368
- type: Function,
369
- default: () => !1
370
- },
371
- /**
372
- * The option elements to populate the listbox with.
373
- * It must be an array of {@see BentoListboxOptionItem }.
374
- *
375
- * @property {string} value.label - Text to be displayed in the option
376
- * @property {string,number} value.value - Value of the option
377
- */
378
- items: {
379
- type: Array,
380
- required: !0
381
- },
382
- /**
383
- * The `input` value.
384
- * Providing an empty string will select no options.
385
- * Set to an empty string `''` if you don't want any of the available options to be selected
386
- */
387
- selectedValue: {
388
- type: Array,
389
- default: void 0
390
- },
391
- /**
392
- * If enabled, dropdown will display non-selectable, static categories
393
- */
394
- staticCategories: { type: Boolean, default: !1 }
395
- },
396
- emits: [v.SELECT, v.ENTER, v.SPACE, v.TAB],
397
- setup(e, { emit: t, expose: n, slots: s, attrs: a }) {
398
- const i = B(null), c = B([]), m = p(() => {
399
- var C;
400
- return !!((C = e.selectedValue) != null && C.length) && e.selectedValue.at(0);
401
- }), h = p(
402
- () => {
403
- var C, S, Y, U;
404
- return {
405
- "aria-label": (C = a["aria-label"]) == null ? void 0 : C.toString(),
406
- "aria-busy": (S = a["aria-busy"]) == null ? void 0 : S.toString(),
407
- "aria-atomic": (Y = a["aria-atomic"]) == null ? void 0 : Y.toString(),
408
- "aria-live": (U = a["aria-live"]) == null ? void 0 : U.toString()
409
- };
410
- }
411
- ), l = p(() => !!e.items.some(({ items: C }) => !!C)), r = (C) => (S) => {
412
- t(C, [S]);
413
- }, o = async () => {
414
- await Me(), i.value && (y.value = Array.from(i.value.querySelectorAll('[role="option"]')));
415
- }, y = B([]), g = (C) => {
416
- var S;
417
- (S = y.value[C]) == null || S.focus();
418
- }, {
419
- moveToNextElement: T,
420
- moveToPreviousElement: N,
421
- moveToFirstElement: D,
422
- moveToLastElement: A,
423
- setListboxFocusedIndex: P
424
- } = we(
425
- {
426
- items: y
427
- },
428
- g
429
- );
430
- ne(
431
- () => e.items,
432
- () => {
433
- o();
434
- },
435
- { immediate: !0 }
436
- );
437
- const L = {
438
- [V.ARROW_UP]: N,
439
- [V.ARROW_DOWN]: T,
440
- [V.HOME]: D,
441
- [V.END]: A
442
- }, $ = {
443
- [v.SELECT]: r(v.SELECT),
444
- [v.SPACE]: r(v.SPACE),
445
- [v.TAB]: r(v.TAB),
446
- [v.ENTER]: r(v.ENTER)
447
- };
448
- return n({
449
- /**
450
- * Reference for a single listbox item.
451
- * Required for keyboard navigation in dropdown as $children is removed in vue@3
452
- */
453
- listboxItemRef: c,
454
- /**
455
- * Method to set the index of the item to be focused on
456
- * Used for focus management to be kept in-sync with parent e.g. dropdowns
457
- */
458
- setListboxFocusedIndex: P
459
- }), {
460
- // Enums
461
- BentoListboxEvent: v,
462
- // Values
463
- listboxRef: i,
464
- listboxItemRef: c,
465
- selectedItem: m,
466
- slots: s,
467
- ariaAttributes: h,
468
- // Computed
469
- hasCategories: l,
470
- // Methods
471
- onOptionSelected: r,
472
- // Keyboard navigation
473
- listboxListeners: L,
474
- listboxOptionListeners: $
475
- };
476
- }
477
- });
478
- function Dt(e, t, n, s, a, i) {
479
- const c = k("bento-listbox-single-select-option"), m = k("bento-listbox-single-select-category"), h = xe("bento-keyboard-navigation-directive");
480
- return re((d(), O("div", w({ ref: "listboxRef" }, e.ariaAttributes, { role: "listbox" }, se(e.listboxListeners, !0)), [
481
- e.hasCategories && e.staticCategories ? (d(!0), O(le, { key: 0 }, H(e.items, (l) => (d(), R(m, {
482
- key: l.value,
483
- "category-label": l.label,
484
- role: "group"
485
- }, {
486
- default: I(() => [
487
- (d(!0), O(le, null, H(l.items, (r) => (d(), R(c, w({
488
- key: r.value,
489
- ref_for: !0,
490
- ref: "listboxItemRef",
491
- role: "option",
492
- option: r,
493
- disabled: e.isOptionDisabled ? e.isOptionDisabled(r) : null,
494
- selected: r.value === e.selectedItem.value
495
- }, se(e.listboxOptionListeners)), be({ _: 2 }, [
496
- H(e.slots, (o, y) => ({
497
- name: y,
498
- fn: I((g) => [
499
- W(e.$slots, y, w({ ref_for: !0 }, g))
500
- ])
501
- }))
502
- ]), 1040, ["option", "disabled", "selected"]))), 128))
503
- ]),
504
- _: 2
505
- }, 1032, ["category-label"]))), 128)) : (d(!0), O(le, { key: 1 }, H(e.items, (l) => (d(), R(c, w({
506
- key: l.value,
507
- ref_for: !0,
508
- ref: "listboxItemRef",
509
- role: "option",
510
- option: l,
511
- disabled: e.isOptionDisabled ? e.isOptionDisabled(l) : null,
512
- selected: l.value === e.selectedItem.value
513
- }, se(e.listboxOptionListeners)), be({ _: 2 }, [
514
- H(e.slots, (r, o) => ({
515
- name: o,
516
- fn: I((y) => [
517
- W(e.$slots, o, w({ ref_for: !0 }, y))
518
- ])
519
- }))
520
- ]), 1040, ["option", "disabled", "selected"]))), 128))
521
- ], 16)), [
522
- [h]
523
- ]);
524
- }
525
- const Bt = /* @__PURE__ */ j($t, [["render", Dt]]), Rt = {}, Nt = /* @__PURE__ */ Z({
526
- ...Rt,
527
- __name: "listbox-decorative-checkbox",
528
- props: {
529
- disabled: { type: Boolean, default: !1 },
530
- indeterminate: { type: Boolean, default: !1 },
531
- checked: { type: Boolean, default: !1 }
532
- },
533
- setup(e) {
534
- const t = e, n = p(() => ({
535
- [`b-checkbox-input--${fe.DISABLED}`]: t.disabled
536
- })), s = p(() => ({
537
- [`b-checkbox-input__outline--${fe.UNCHECKED}`]: !t.checked && !t.indeterminate,
538
- [`b-checkbox-input__outline--${fe.CHECKED}`]: t.checked && !t.indeterminate,
539
- [`b-checkbox-input__outline--${fe.INDETERMINATE}`]: t.indeterminate
540
- }));
541
- return (a, i) => (d(), O("div", {
542
- class: me(["b-checkbox-input", n.value]),
543
- role: "presentation"
544
- }, [
545
- a.indeterminate ? (d(), R(M(rt), {
546
- key: 0,
547
- class: "b-checkbox-input__icon",
548
- "svg-title": "",
549
- "aria-hidden": "true"
550
- })) : a.checked ? (d(), R(M(ct), {
551
- key: 1,
552
- class: "b-checkbox-input__icon",
553
- "svg-title": "",
554
- "aria-hidden": "true"
555
- })) : J("", !0),
556
- z("div", {
557
- class: me(["b-checkbox-input__outline", s.value])
558
- }, null, 2)
559
- ], 2));
560
- }
561
- }), Te = /* @__PURE__ */ j(Nt, [["__scopeId", "data-v-c604b68a"]]);
562
- var Ye = /* @__PURE__ */ ((e) => (e.DISABLED = "disabled", e.STATIC_CATEGORY = "static-category", e))(Ye || {}), te = /* @__PURE__ */ ((e) => (e.SELECT_CATEGORY = "select-category", e.UNSELECT_CATEGORY = "unselect-category", e.TOGGLE_CATEGORY_VISIBILITY = "toggle-category-visibility", e))(te || {});
563
- const Pt = {
564
- "en-US": {
565
- categoryClosed: "{category} closed",
566
- categoryOpened: "{category} opened"
567
- }
568
- }, Mt = Z({
569
- i18n: { messages: Pt },
570
- name: "bento-listbox-multi-select-category",
571
- components: {
572
- BentoTypography: ce,
573
- BentoListboxOption: ge,
574
- ChevronDownIcon: dt,
575
- ChevronUpIcon: ut,
576
- ListboxDecorativeCheckbox: Te
577
- },
578
- props: {
579
- /**
580
- * The option elements to populate the listbox with.
581
- * It must be an array of {@see BentoListboxOptionItem }.
582
- *
583
- * @property {string} value.label - Text to be displayed in the option
584
- * @property {string,number} value.value - Value of the option
585
- * @property {BentoListboxOptionItem} value.items - Category items list
586
- */
587
- category: {
588
- type: Object,
589
- required: !0
590
- },
591
- /**
592
- * Function that allows the options to be disabled
593
- *
594
- * @type {BentoListboxIsOptionDisabled}
595
- * @param {BentoListboxOptionItem} option - listbox option object
596
- * @param {string} option.label - Option's label text
597
- * @param {string|number} option.value - Option's value
598
- * @param {unknown} option.data - Option's extra data to be passed to the default slot
599
- */
600
- isOptionDisabled: {
601
- type: [Function],
602
- default: () => !1
603
- },
604
- /**
605
- * The `input` value.
606
- * Providing an empty array will select no options.
607
- */
608
- selectedItemsList: {
609
- type: Array,
610
- default: () => []
611
- },
612
- /**
613
- * If enabled, dropdown will display non-selectable, static categories
614
- */
615
- staticCategories: { type: Boolean, default: !1 },
616
- /**
617
- * Category's tabindex
618
- */
619
- tabindex: { type: Number, default: -1 }
620
- },
621
- emits: [
622
- te.SELECT_CATEGORY,
623
- te.UNSELECT_CATEGORY,
624
- te.TOGGLE_CATEGORY_VISIBILITY
625
- ],
626
- setup(e, { emit: t }) {
627
- const n = B(!1), { t: s } = Oe(), a = (S) => e.isOptionDisabled ? e.isOptionDisabled(S) : !1, i = p(
628
- () => e.category.items.every((S) => a(S))
629
- ), c = _e(e, "staticCategories"), m = p(() => n.value || e.staticCategories), h = p(() => ({
630
- [`b-listbox-multi-select-category--${Ye.DISABLED}`]: i.value
631
- })), l = (S) => {
632
- S.preventDefault(), n.value = !n.value, t(te.TOGGLE_CATEGORY_VISIBILITY);
633
- }, r = (S) => {
634
- var q;
635
- const Y = a(S), U = ((q = e.selectedItemsList) == null ? void 0 : q.includes(S.value)) || !1;
636
- return { isDisabled: Y, isPreSelected: U };
637
- }, o = p(
638
- () => e.category.items.filter((S) => {
639
- const { isDisabled: Y, isPreSelected: U } = r(S);
640
- return Y && U || !Y;
641
- })
642
- ), y = p(
643
- () => {
644
- var S;
645
- return (S = o.value) == null ? void 0 : S.filter(
646
- ({ value: Y }) => {
647
- var U;
648
- return (U = e.selectedItemsList) == null ? void 0 : U.includes(Y);
649
- }
650
- );
651
- }
652
- ), g = p(() => {
653
- const S = n.value ? "categoryOpened" : "categoryClosed";
654
- return s(S, { category: e.category.label });
655
- }), T = () => {
656
- t(te.SELECT_CATEGORY);
657
- }, N = () => {
658
- t(te.UNSELECT_CATEGORY);
659
- }, { isAllSelected: D, isIndeterminate: A, toggleSelectAll: P } = Ge(
660
- y,
661
- o,
662
- T,
663
- N
664
- ), L = p(() => A.value ? "mixed" : `${D.value}`), $ = B(D.value), C = () => {
665
- $.value = !$.value, P($.value);
666
- };
667
- return ne(D, () => {
668
- $.value = D.value;
669
- }), {
670
- // Values
671
- chevronTitle: g,
672
- conditionalClass: h,
673
- hasAllPropsDisabled: i,
674
- isOpen: n,
675
- isAllSelected: D,
676
- isIndeterminate: A,
677
- isStaticCategory: c,
678
- // Computed
679
- showItemChildren: m,
680
- ariaCheckedComputed: L,
681
- // Methods
682
- handleSelectAll: C,
683
- toggleOpen: l,
684
- toggleSelectAll: P
685
- };
686
- }
687
- }), xt = { class: "b-listbox-multi-select-category__label" }, Gt = {
688
- key: 1,
689
- class: "b-listbox-multi-select-category b-listbox-multi-select-category--static-category"
690
- }, wt = { class: "b-listbox-multi-select-category__label" };
691
- function Yt(e, t, n, s, a, i) {
692
- const c = k("listbox-decorative-checkbox"), m = k("bento-typography"), h = k("chevron-up-icon"), l = k("chevron-down-icon"), r = k("bento-listbox-option");
693
- return d(), O("div", null, [
694
- e.isStaticCategory ? (d(), O("div", Gt, [
695
- z("span", wt, [
696
- x(m, {
697
- el: "span",
698
- variant: "caption",
699
- class: "b-listbox-multi-select-category__label-text"
700
- }, {
701
- default: I(() => [
702
- K(F(e.category.label), 1)
703
- ]),
704
- _: 1
705
- })
706
- ])
707
- ])) : (d(), R(r, {
708
- key: 0,
709
- class: me(["b-listbox-multi-select-category__option", e.conditionalClass]),
710
- tabindex: e.tabindex,
711
- "aria-checked": e.ariaCheckedComputed,
712
- "aria-disabled": e.hasAllPropsDisabled,
713
- onClick: e.handleSelectAll,
714
- onEnterPressed: e.handleSelectAll,
715
- onSpacePressed: ae(e.handleSelectAll, ["prevent"])
716
- }, {
717
- default: I(() => [
718
- x(c, {
719
- indeterminate: e.isIndeterminate,
720
- disabled: e.hasAllPropsDisabled,
721
- checked: e.isAllSelected
722
- }, null, 8, ["indeterminate", "disabled", "checked"]),
723
- z("span", xt, [
724
- x(m, {
725
- el: "span",
726
- class: "b-listbox-multi-select-category__label-text"
727
- }, {
728
- default: I(() => [
729
- K(F(e.category.label), 1)
730
- ]),
731
- _: 1
732
- }),
733
- z("div", {
734
- class: "b-listbox-multi-select-category__label-chevron",
735
- "data-testid": "toggle-listbox",
736
- onClickCapture: t[0] || (t[0] = ae((...o) => e.toggleOpen && e.toggleOpen(...o), ["stop"]))
737
- }, [
738
- e.isOpen ? (d(), R(h, {
739
- key: 0,
740
- "svg-title": e.chevronTitle
741
- }, null, 8, ["svg-title"])) : (d(), R(l, {
742
- key: 1,
743
- "svg-title": e.chevronTitle
744
- }, null, 8, ["svg-title"]))
745
- ], 32)
746
- ])
747
- ]),
748
- _: 1
749
- }, 8, ["class", "tabindex", "aria-checked", "aria-disabled", "onClick", "onEnterPressed", "onSpacePressed"])),
750
- re(z("div", null, [
751
- W(e.$slots, "default", {}, void 0, !0)
752
- ], 512), [
753
- [Pe, e.showItemChildren]
754
- ])
755
- ]);
756
- }
757
- const Ut = /* @__PURE__ */ j(Mt, [["render", Yt], ["__scopeId", "data-v-40db801f"]]);
758
- var X = /* @__PURE__ */ ((e) => (e.SELECT_CATEGORY = "select-category", e.TOGGLE_CHECKBOX_SELECTION = "toggle-checkbox-selection", e.UNSELECT_CATEGORY = "unselect-category", e.TOGGLE_CATEGORY_VISIBILITY = "toggle-category-visibility", e))(X || {});
759
- const zt = Z({
760
- name: "listbox-multi-select-options",
761
- components: {
762
- BentoListboxOption: ge,
763
- BentoTypography: ce,
764
- ListboxMultiSelectCategory: Ut,
765
- ListboxDecorativeCheckbox: Te
766
- },
767
- props: {
768
- /**
769
- * Indicates if the items listed are inside a category
770
- * so they can be padded to right by one level in recursion.
771
- * Items of categories are automatically defined as "categoryItems"
772
- */
773
- categoryItems: { type: Boolean, default: !1 },
774
- /**
775
- * Current focused option index
776
- */
777
- focusedIndex: { type: Number, default: 0 },
778
- /**
779
- * Function that allows the options to be disabled
780
- *
781
- * @type {BentoListboxIsOptionDisabled}
782
- * @param {BentoListboxOptionItem} option - listbox option object
783
- * @param {string} option.label - Option's label text
784
- * @param {string|number} option.value - Option's value
785
- * @param {unknown} option.data - Option's extra data to be passed to the default slot
786
- */
787
- isOptionDisabled: {
788
- type: Function,
789
- default: () => !1
790
- },
791
- /**
792
- * The option elements to populate the listbox with.
793
- * It must be an array of {@see BentoListboxOptionItem }.
794
- *
795
- * @property {string} value.label - Text to be displayed in the option
796
- * @property {string,number} value.value - Value of the option
797
- */
798
- items: {
799
- type: Array,
800
- required: !0
801
- },
802
- /**
803
- * Indicates if the elements options are inside a multi-level category
804
- */
805
- isMultiLevel: { type: Boolean, default: !1 },
806
- /**
807
- * Flag that indicates that an external search it's being made
808
- * to filter out the items inside the the multi-select listbox
809
- *
810
- * If enabled, hides the "Select all" checkbox in "multiple" mode.
811
- */
812
- searching: { type: Boolean, default: !1 },
813
- /**
814
- * List of selected items.
815
- * Providing an empty array will select no options.
816
- */
817
- selectedItemsList: {
818
- type: Array,
819
- default: () => []
820
- },
821
- /**
822
- * If enabled, dropdown will display non-selectable, static categories
823
- */
824
- staticCategories: { type: Boolean, default: !1 }
825
- },
826
- emits: [
827
- X.TOGGLE_CHECKBOX_SELECTION,
828
- X.SELECT_CATEGORY,
829
- X.UNSELECT_CATEGORY,
830
- X.TOGGLE_CATEGORY_VISIBILITY
831
- ],
832
- setup(e, { emit: t }) {
833
- const n = (l) => {
834
- e.isOptionDisabled(l) || t(X.TOGGLE_CHECKBOX_SELECTION, l);
835
- }, s = (l) => !!l.items, a = (l) => {
836
- const r = e.isMultiLevel && e.searching;
837
- return l.description && (!e.isMultiLevel || r);
838
- }, i = (l) => l.items ? !!l.items.find((r) => e.selectedItemsList.includes(r.value)) : e.selectedItemsList.includes(l.value), c = (l) => {
839
- if (s(l)) {
840
- const r = i(l) ? X.UNSELECT_CATEGORY : X.SELECT_CATEGORY;
841
- t(r, l);
842
- } else
843
- n(l);
844
- };
845
- return {
846
- // Values
847
- conditionalClasses: p(() => ({
848
- "b-listbox-multi-select-options__static-category-option": e.staticCategories,
849
- "b-listbox-multi-select-options__category-option": e.categoryItems
850
- })),
851
- // Methods
852
- isOptionSelected: i,
853
- shouldShowDescription: a,
854
- toggleCheckboxSelection: n,
855
- toggleSearchOption: c,
856
- computedTabindex: (l) => l + 1 === e.focusedIndex ? 0 : -1,
857
- // Enums
858
- BentoListboxEvent: v,
859
- ListboxMultiSelectOptionsEvent: X
860
- };
861
- }
862
- }), Ft = { class: "b-listbox-multi-select__option-text" }, Vt = { class: "b-listbox-multi-select__option-text" };
863
- function Kt(e, t, n, s, a, i) {
864
- const c = k("listbox-decorative-checkbox"), m = k("bento-typography"), h = k("bento-listbox-option"), l = k("listbox-multi-select-options", !0), r = k("listbox-multi-select-category");
865
- return d(), O("div", null, [
866
- (d(!0), O(le, null, H(e.items, (o, y) => (d(), O("div", {
867
- key: `selected-${o.value}`
868
- }, [
869
- e.searching && e.isMultiLevel ? (d(), R(h, {
870
- key: 0,
871
- class: me(["b-listbox-multi-select-options", e.conditionalClasses]),
872
- disabled: e.isOptionDisabled ? e.isOptionDisabled(o) : null,
873
- tabindex: e.computedTabindex(y),
874
- "aria-checked": `${e.isOptionSelected(o)}`,
875
- "aria-disabled": e.isOptionDisabled ? e.isOptionDisabled(o) : null,
876
- onClick: (g) => e.toggleSearchOption(o),
877
- onEnterPressed: (g) => e.toggleSearchOption(o),
878
- onSpacePressed: ae((g) => e.toggleSearchOption(o), ["prevent"])
879
- }, {
880
- default: I(() => [
881
- x(c, {
882
- disabled: e.isOptionDisabled ? e.isOptionDisabled(o) : null,
883
- checked: e.isOptionSelected(o)
884
- }, null, 8, ["disabled", "checked"]),
885
- W(e.$slots, "default", w({ ref_for: !0 }, o), () => [
886
- z("span", Ft, [
887
- x(m, { el: "span" }, {
888
- default: I(() => [
889
- K(F(o.label), 1)
890
- ]),
891
- _: 2
892
- }, 1024),
893
- e.shouldShowDescription(o) ? (d(), R(m, {
894
- key: 0,
895
- class: "b-listbox-multi-select__option-description",
896
- el: "span"
897
- }, {
898
- default: I(() => [
899
- K(F(o.description), 1)
900
- ]),
901
- _: 2
902
- }, 1024)) : J("", !0)
903
- ])
904
- ], !0)
905
- ]),
906
- _: 2
907
- }, 1032, ["class", "disabled", "tabindex", "aria-checked", "aria-disabled", "onClick", "onEnterPressed", "onSpacePressed"])) : (d(), O(le, { key: 1 }, [
908
- o.items ? (d(), R(r, {
909
- key: 0,
910
- category: o,
911
- "static-categories": e.staticCategories,
912
- "is-option-disabled": e.isOptionDisabled,
913
- "selected-items-list": e.selectedItemsList,
914
- tabindex: e.computedTabindex(y),
915
- onSelectCategory: (g) => e.$emit(e.ListboxMultiSelectOptionsEvent.SELECT_CATEGORY, o),
916
- onUnselectCategory: (g) => e.$emit(e.ListboxMultiSelectOptionsEvent.UNSELECT_CATEGORY, o),
917
- onToggleCategoryVisibility: t[1] || (t[1] = (g) => e.$emit(e.ListboxMultiSelectOptionsEvent.TOGGLE_CATEGORY_VISIBILITY))
918
- }, {
919
- default: I(() => [
920
- x(l, {
921
- "category-items": "",
922
- items: o.items,
923
- "is-option-disabled": e.isOptionDisabled,
924
- "focused-index": e.focusedIndex,
925
- "is-multi-level": e.isMultiLevel,
926
- "static-categories": e.staticCategories,
927
- "selected-items-list": e.selectedItemsList,
928
- searching: e.searching,
929
- onToggleCheckboxSelection: t[0] || (t[0] = (g) => e.toggleCheckboxSelection(g))
930
- }, null, 8, ["items", "is-option-disabled", "focused-index", "is-multi-level", "static-categories", "selected-items-list", "searching"])
931
- ]),
932
- _: 2
933
- }, 1032, ["category", "static-categories", "is-option-disabled", "selected-items-list", "tabindex", "onSelectCategory", "onUnselectCategory"])) : (d(), R(h, {
934
- key: 1,
935
- class: me(["b-listbox-multi-select-options", e.conditionalClasses]),
936
- disabled: e.isOptionDisabled ? e.isOptionDisabled(o) : null,
937
- tabindex: e.computedTabindex(y),
938
- "aria-checked": `${e.isOptionSelected(o)}`,
939
- "aria-disabled": e.isOptionDisabled ? e.isOptionDisabled(o) : null,
940
- onClick: (g) => e.toggleCheckboxSelection(o),
941
- onEnterPressed: (g) => e.toggleCheckboxSelection(o),
942
- onSpacePressed: ae((g) => e.toggleCheckboxSelection(o), ["prevent"])
943
- }, {
944
- default: I(() => [
945
- x(c, {
946
- disabled: e.isOptionDisabled ? e.isOptionDisabled(o) : null,
947
- checked: e.isOptionSelected(o)
948
- }, null, 8, ["disabled", "checked"]),
949
- W(e.$slots, "default", w({ ref_for: !0 }, o), () => [
950
- z("span", Vt, [
951
- x(m, { el: "span" }, {
952
- default: I(() => [
953
- K(F(o.label), 1)
954
- ]),
955
- _: 2
956
- }, 1024),
957
- e.shouldShowDescription(o) ? (d(), R(m, {
958
- key: 0,
959
- class: "b-listbox-multi-select__option-description",
960
- el: "span"
961
- }, {
962
- default: I(() => [
963
- K(F(o.description), 1)
964
- ]),
965
- _: 2
966
- }, 1024)) : J("", !0)
967
- ])
968
- ], !0)
969
- ]),
970
- _: 2
971
- }, 1032, ["class", "disabled", "tabindex", "aria-checked", "aria-disabled", "onClick", "onEnterPressed", "onSpacePressed"]))
972
- ], 64))
973
- ]))), 128))
974
- ]);
975
- }
976
- const Wt = /* @__PURE__ */ j(zt, [["render", Kt], ["__scopeId", "data-v-e26ceb2d"]]), qt = (e) => {
977
- const t = p(() => {
978
- var s;
979
- return !!((s = e.value) != null && s.find(({ items: a }) => !!a));
980
- }), n = p(() => {
981
- var s;
982
- return t.value ? (s = e.value) == null ? void 0 : s.reduce((a, i) => (i.items ? a.push(...i.items.flat()) : a.push(i), a), []) : e.value;
983
- });
984
- return {
985
- isMultiLevelSelect: t,
986
- flattenedItemsList: n
987
- };
988
- }, Ue = {
989
- "en-US": {
990
- allSelected: "All selected ({total})",
991
- numberOfTotalSelected: "{number} of {total} selected",
992
- numbersSelected: "{number} selected",
993
- selectAll: "Select all ({total})"
994
- }
995
- }, Ht = { key: 0 }, jt = {
996
- key: 1,
997
- class: "b-listbox-multi-select__divider",
998
- "aria-hidden": "true"
999
- }, Xt = { i18n: { messages: Ue } }, Jt = /* @__PURE__ */ Z({
1000
- ...Xt,
1001
- __name: "listbox-multi-select",
1002
- props: {
1003
- hasMoreItems: { type: Boolean, default: !1 },
1004
- isOptionDisabled: { type: Function, default: () => !1 },
1005
- items: {},
1006
- lazyLoadType: { default: "none" },
1007
- searching: { type: Boolean, default: !1 },
1008
- selectedValues: {},
1009
- staticCategories: { type: Boolean, default: !1 }
1010
- },
1011
- emits: ["select"],
1012
- setup(e, { expose: t, emit: n }) {
1013
- const s = e, a = n, { t: i } = Oe({ messages: Ue }), c = st(), m = lt(), h = p(
1014
- () => {
1015
- var u, f, b, _;
1016
- return {
1017
- "aria-label": (u = m["aria-label"]) == null ? void 0 : u.toString(),
1018
- "aria-busy": (f = m["aria-busy"]) == null ? void 0 : f.toString(),
1019
- "aria-atomic": (b = m["aria-atomic"]) == null ? void 0 : b.toString(),
1020
- "aria-live": (_ = m["aria-live"]) == null ? void 0 : _.toString()
1021
- };
1022
- }
1023
- ), l = B(null), r = B(null), o = B(null), y = B(null), g = p(() => s.selectedValues.map(({ value: u }) => u)), { isMultiLevelSelect: T, flattenedItemsList: N } = qt(_e(s, "items")), D = (u) => {
1024
- var _;
1025
- const f = s.isOptionDisabled(u), b = ((_ = g.value) == null ? void 0 : _.includes(u.value)) || !1;
1026
- return { isDisabled: f, isPreSelected: b };
1027
- }, A = p(() => {
1028
- if (s.searching && T)
1029
- return s.items;
1030
- const u = N.value.filter((f) => {
1031
- const { isDisabled: b, isPreSelected: _ } = D(f);
1032
- return b && _ || !b;
1033
- });
1034
- return s.selectedValues.forEach((f) => {
1035
- u.find((b) => b.value === f.value) || u.push(f);
1036
- }), u;
1037
- }), P = p(
1038
- () => {
1039
- var u;
1040
- return (u = A.value) == null ? void 0 : u.filter((f) => {
1041
- var b;
1042
- return f.items && T.value && s.searching ? f.items.filter(
1043
- (E) => (s.selectedValues ?? []).includes(E.value)
1044
- ).length === f.items.length : (b = g.value) == null ? void 0 : b.includes(f.value);
1045
- });
1046
- }
1047
- ), L = () => T.value && !s.searching ? N.value.length : s.items.length, $ = p(() => {
1048
- var _;
1049
- const u = A.value.length, f = L(), b = ((_ = P.value) == null ? void 0 : _.length) || 0;
1050
- return b === 0 ? i("selectAll", { total: u }) : b === f ? i("allSelected", { total: f }) : b <= f ? i("numberOfTotalSelected", { number: b, total: f }) : i("numbersSelected", { number: b });
1051
- }), C = (u) => {
1052
- const f = (_) => {
1053
- const { isDisabled: E, isPreSelected: Q } = D(_);
1054
- return E && Q || !E;
1055
- }, b = u.filter(f).filter((_) => !g.value.includes(_.value));
1056
- a("select", [...s.selectedValues, ...b]);
1057
- }, S = (u) => {
1058
- const f = (E) => {
1059
- const { isDisabled: Q, isPreSelected: Qe } = D(E);
1060
- return !(Q && Qe);
1061
- }, b = u.filter(f).map(({ value: E }) => E), _ = s.selectedValues.filter((E) => !(b != null && b.includes(E.value)));
1062
- a("select", _);
1063
- }, Y = () => {
1064
- C(N.value);
1065
- }, U = () => {
1066
- S(N.value);
1067
- }, { isAllSelected: q, isIndeterminate: ve, toggleSelectAll: ye } = Ge(
1068
- P,
1069
- A,
1070
- Y,
1071
- U
1072
- ), Se = p(() => ve.value ? "mixed" : `${q.value}`), G = B(q.value), ee = () => {
1073
- G.value = !G.value, ye(G.value);
1074
- };
1075
- ne(q, () => {
1076
- G.value = q.value;
1077
- });
1078
- const ze = (u) => {
1079
- C(u.items);
1080
- }, Ie = (u) => {
1081
- S(u.items);
1082
- }, de = (u, f) => {
1083
- let b = !1;
1084
- const _ = s.selectedValues.filter(({ value: E }) => f.value === E ? (b = !0, !1) : !0);
1085
- b || _.push(f), a(u, _);
1086
- }, Fe = p(() => {
1087
- if (!T.value)
1088
- return s.selectedValues;
1089
- const u = (E) => g.value.includes(E.value), f = (E) => !s.staticCategories && E.every((Q) => u(Q));
1090
- return s.items.flatMap(
1091
- (E) => E.items && !f(E.items) ? E.items : E
1092
- ).filter((E) => E.items ? !0 : u(E));
1093
- }), Ve = p(() => {
1094
- var b, _, E, Q;
1095
- const u = ["automatic", "button"].includes(s.lazyLoadType), f = ((b = s.selectedValues) == null ? void 0 : b.length) > 0 && ((_ = P.value) == null ? void 0 : _.length) !== ((E = N.value) == null ? void 0 : E.length);
1096
- return u && s.hasMoreItems ? !!((Q = s.selectedValues) != null && Q.length) : f;
1097
- }), Ae = p(() => ["automatic", "button"].includes(s.lazyLoadType) ? !s.hasMoreItems : !0), he = B([]), ke = async () => {
1098
- await Me(), l.value && (he.value = Array.from(
1099
- l.value.querySelectorAll('[role="option"]')
1100
- ).filter((u) => u.checkVisibility()));
1101
- }, Ke = (u) => {
1102
- var f;
1103
- (f = he.value[u]) == null || f.focus();
1104
- }, {
1105
- moveToNextElement: We,
1106
- moveToPreviousElement: qe,
1107
- moveToFirstElement: He,
1108
- moveToLastElement: je,
1109
- preventDefault: Le,
1110
- focusedIndex: $e,
1111
- setListboxFocusedIndex: Xe
1112
- } = we(
1113
- {
1114
- items: he
1115
- },
1116
- Ke
1117
- ), Je = {
1118
- [V.ARROW_UP]: (u) => qe(u),
1119
- [V.ARROW_DOWN]: (u) => We(u),
1120
- [V.HOME]: He,
1121
- [V.END]: je
1122
- };
1123
- t({
1124
- /**
1125
- * Method to set the index of the item to be focused on
1126
- * Used for focus management to be kept in-sync with parent e.g. dropdowns
1127
- */
1128
- setListboxFocusedIndex: Xe
1129
- });
1130
- const Ze = {
1131
- [V.ARROW_UP]: Le,
1132
- [V.ARROW_DOWN]: Le
1133
- };
1134
- return ne(
1135
- () => s.items,
1136
- () => {
1137
- ke();
1138
- },
1139
- { immediate: !0 }
1140
- ), (u, f) => (d(), O("div", {
1141
- ref_key: "listboxRef",
1142
- ref: l,
1143
- class: "b-listbox-multi-select"
1144
- }, [
1145
- Ve.value ? (d(), O("div", Ht, [
1146
- re((d(), O("ul", w({ class: "b-listbox-multi-select__chips" }, se(Ze, !0)), [
1147
- (d(!0), O(le, null, H(Fe.value, (b) => (d(), O("li", {
1148
- key: b.value
1149
- }, [
1150
- x(M(at), {
1151
- ref_for: !0,
1152
- ref_key: "selectedListboxItemsRef",
1153
- ref: o,
1154
- disabled: u.isOptionDisabled(b),
1155
- label: b.label,
1156
- condensed: "",
1157
- onClick: (_) => b.items ? Ie(b) : de("select", b)
1158
- }, null, 8, ["disabled", "label", "onClick"])
1159
- ]))), 128))
1160
- ], 16)), [
1161
- [M(pe)]
1162
- ]),
1163
- f[4] || (f[4] = z("hr", {
1164
- class: "b-listbox-multi-select__divider",
1165
- "aria-hidden": "true"
1166
- }, null, -1))
1167
- ])) : J("", !0),
1168
- re((d(), O("div", w(h.value, { role: "listbox" }, se(Je, !0)), [
1169
- Ae.value ? (d(), R(M(ge), {
1170
- key: 0,
1171
- ref_key: "selectAllListboxItemsRef",
1172
- ref: r,
1173
- class: "b-listbox-multi-select__option",
1174
- tabindex: M($e) === 0 ? 0 : -1,
1175
- "aria-checked": Se.value,
1176
- onClick: ee,
1177
- onEnterPressed: ee,
1178
- onSpacePressed: ae(ee, ["prevent"])
1179
- }, {
1180
- default: I(() => [
1181
- x(M(Te), {
1182
- checked: M(q),
1183
- indeterminate: M(ve)
1184
- }, null, 8, ["checked", "indeterminate"]),
1185
- x(M(ce), { el: "span" }, {
1186
- default: I(() => [
1187
- K(F($.value), 1)
1188
- ]),
1189
- _: 1
1190
- })
1191
- ]),
1192
- _: 1
1193
- }, 8, ["tabindex", "aria-checked"])) : J("", !0),
1194
- Ae.value ? (d(), O("hr", jt)) : J("", !0),
1195
- x(M(Wt), {
1196
- ref_key: "listboxItemsRef",
1197
- ref: y,
1198
- items: u.items,
1199
- "is-option-disabled": u.isOptionDisabled,
1200
- "is-multi-level": M(T),
1201
- "static-categories": u.staticCategories,
1202
- searching: u.searching,
1203
- "selected-items-list": g.value,
1204
- "focused-index": M($e),
1205
- onToggleCheckboxSelection: f[0] || (f[0] = (b) => de("select", b)),
1206
- onSelectCategory: ze,
1207
- onUnselectCategory: Ie,
1208
- onToggleCategoryVisibility: ke,
1209
- onSpacePressed: f[1] || (f[1] = (b) => de(M(v).SPACE, b)),
1210
- onTabPressed: f[2] || (f[2] = (b) => de(M(v).TAB, b)),
1211
- onEnterPressed: f[3] || (f[3] = (b) => de(M(v).ENTER, b))
1212
- }, be({ _: 2 }, [
1213
- H(M(c), (b, _) => ({
1214
- name: _,
1215
- fn: I((E) => [
1216
- W(u.$slots, _, ie(ue(E)), void 0, !0)
1217
- ])
1218
- }))
1219
- ]), 1032, ["items", "is-option-disabled", "is-multi-level", "static-categories", "searching", "selected-items-list", "focused-index"])
1220
- ], 16)), [
1221
- [M(pe)]
1222
- ])
1223
- ], 512));
1224
- }
1225
- }), Re = /* @__PURE__ */ j(Jt, [["__scopeId", "data-v-2a854443"]]), Ne = {
1226
- "en-US": {
1227
- loading: "Loading",
1228
- showMore: "Show more"
1229
- },
1230
- "ja-JP": {
1231
- loading: "読み込み中",
1232
- showMore: "表示内容を増やす"
1233
- },
1234
- "pt-BR": {
1235
- loading: "Carregando",
1236
- showMore: "Mostrar mais"
1237
- }
1238
- }, Zt = 36, Qt = Z({
1239
- name: "bento-listbox",
1240
- components: {
1241
- BentoEmptyState: it,
1242
- BentoListboxSingleSelect: Bt,
1243
- BentoListboxMultiSelect: Re,
1244
- BentoTypography: ce,
1245
- BentoLoadingIndicator: ot,
1246
- BentoLoadingButton: bt
1247
- },
1248
- directives: { BentoKeyboardNavigationDirective: pe },
1249
- i18n: { messages: Ne },
1250
- props: {
1251
- /**
1252
- * Defines a string value that labels an interactive element.
1253
- */
1254
- ariaLabel: { type: String, default: null },
1255
- /**
1256
- * Empty state props that will be used with the inner empty state component to be displayed when no search results are found.
1257
- */
1258
- emptyState: {
1259
- type: Object,
1260
- default: void 0
1261
- },
1262
- /**
1263
- * Indicates whether there are more items to load
1264
- */
1265
- hasMoreItems: { type: Boolean, default: !1 },
1266
- /**
1267
- * Identifies the listbox whose contents are controlled by the the combobox on which the aria-controls attribute is set.
1268
- */
1269
- id: { type: String, required: !0 },
1270
- /**
1271
- * Function that allows the options to be disabled
1272
- *
1273
- * @type {BentoListboxIsOptionDisabled}
1274
- * @param {BentoListboxOptionItem} option - Listbox option object
1275
- * @param {string} option.label - Option's label text
1276
- * @param {string|number} option.value - Option's value
1277
- * @param {unknown} option.data - Option's extra data to be passed to the default slot
1278
- */
1279
- isOptionDisabled: {
1280
- type: Function,
1281
- default: () => {
1282
- }
1283
- },
1284
- /**
1285
- * The option elements to populate the listbox with.
1286
- * It must be an array of {@see BentoListboxOptionItem }
1287
- * * @property {string} value.label - Text to be displayed in the option
1288
- * * @property {string,number} value.value - Value of the option
1289
- */
1290
- items: {
1291
- type: Array,
1292
- required: !0
1293
- },
1294
- /**
1295
- * Indicates if new options are lazy loading.
1296
- */
1297
- loading: { type: Boolean, default: !1 },
1298
- /**
1299
- * The type of `Lazy Load`.
1300
- * Type "automatic" will enable infinite scrolling
1301
- * Type "button" will enable lazy loading with "Show more" button
1302
- */
1303
- lazyLoadType: {
1304
- type: String,
1305
- default: oe.NONE,
1306
- validator: (e) => Object.values(oe).includes(e)
1307
- },
1308
- /**
1309
- * Indicates the listbox is loading filtered items.
1310
- */
1311
- componentLoading: { type: Boolean, default: !1 },
1312
- /**
1313
- * If enabled, the user will be able to select multiple items.
1314
- */
1315
- multiple: { type: Boolean, default: !1 },
1316
- /**
1317
- * If enabled, dropdown will display non-selectable, static categories
1318
- */
1319
- staticCategories: { type: Boolean, default: !1 },
1320
- /**
1321
- * Messaged displayed when no items are listed in the listbox
1322
- */
1323
- noResultsMessage: { type: String, required: !0 },
1324
- /**
1325
- * Flag that indicates that an external search it's being made
1326
- * to filter out the items inside the the multi-select listbox
1327
- *
1328
- * If enabled, hides the "Select all" checkbox in "multiple" mode.
1329
- */
1330
- searching: Re.props.searching,
1331
- /**
1332
- * The `input` value.
1333
- * Providing an empty string or empty array will select no options.
1334
- * Set to an empty string `''` if you don't want any of the available options to be selected for single select
1335
- */
1336
- selectedValue: {
1337
- type: Array,
1338
- default: () => []
1339
- },
1340
- /**
1341
- * Enables virtual scrolling if set to true or by providing an object with itemHeight function.
1342
- * The itemHeight function is used to calculate the height of rendered item given it's index.
1343
- */
1344
- virtualScroll: {
1345
- type: [Boolean, Object],
1346
- default: !1
1347
- }
1348
- },
1349
- emits: [
1350
- v.SELECT,
1351
- v.SPACE,
1352
- v.SHOW_MORE,
1353
- v.ENTER,
1354
- v.ESCAPE,
1355
- v.TAB
1356
- ],
1357
- setup(e, { emit: t, slots: n }) {
1358
- const s = B([]), a = _e(e, "items"), { t: i } = Oe({ messages: Ne }), c = p(() => e.lazyLoadType !== oe.AUTOMATIC), m = p(() => e.lazyLoadType === oe.AUTOMATIC), h = () => {
1359
- var G;
1360
- return typeof (e == null ? void 0 : e.virtualScroll) == "object" && ((G = e == null ? void 0 : e.virtualScroll) != null && G.itemHeight) ? e.virtualScroll.itemHeight : Zt;
1361
- }, {
1362
- containerRef: l,
1363
- containerProps: r,
1364
- onScroll: o,
1365
- list: y,
1366
- wrapperProps: g
1367
- } = vt(a, {
1368
- itemHeight: h(),
1369
- // Disable virtual scrolling if not enabled or if lazy loading is enabled or if multi-select
1370
- disabled: (e == null ? void 0 : e.multiple) || (e == null ? void 0 : e.virtualScroll) === !1 || (e == null ? void 0 : e.lazyLoadType) !== "none"
1371
- }), T = p(
1372
- () => e.componentLoading !== void 0 || c.value ? "true" : void 0
1373
- ), N = p(
1374
- () => c.value && e.loading || e.componentLoading ? "true" : "false"
1375
- ), D = p(
1376
- () => c.value || e.componentLoading !== void 0 ? "polite" : void 0
1377
- ), A = p(
1378
- () => ({
1379
- "aria-label": e.ariaLabel,
1380
- "aria-busy": N.value,
1381
- "aria-atomic": T.value,
1382
- "aria-live": D.value
1383
- })
1384
- ), P = p(
1385
- () => e.componentLoading ? {
1386
- ...A.value,
1387
- role: "alert"
1388
- } : {}
1389
- ), L = (G) => (ee) => {
1390
- t(G, ee);
1391
- }, $ = () => {
1392
- t(v.SHOW_MORE);
1393
- }, C = nt(() => {
1394
- const G = l.value;
1395
- if (!G)
1396
- return;
1397
- const ee = Math.round(G.scrollTop) + G.clientHeight >= G.scrollHeight;
1398
- e.hasMoreItems && ee && !e.loading && $();
1399
- }), S = () => {
1400
- m.value ? C() : o();
1401
- }, Y = p(() => {
1402
- var G;
1403
- return ((G = e.items) == null ? void 0 : G.length) === 0;
1404
- }), U = p(
1405
- () => e.lazyLoadType === oe.BUTTON && e.hasMoreItems
1406
- ), q = p(
1407
- () => e.loading ? De.LOADING : De.START
1408
- ), ve = p(() => e.loading ? i("loading") : i("showMore")), ye = p(() => ({
1409
- ...e.emptyState,
1410
- variant: "condensed"
1411
- })), Se = {
1412
- [v.SELECT]: L(v.SELECT),
1413
- [v.SPACE]: L(v.SPACE),
1414
- [v.TAB]: L(v.TAB),
1415
- [v.ENTER]: L(v.ENTER)
1416
- };
1417
- return {
1418
- // Refs
1419
- listboxRef: l,
1420
- listboxItemRef: s,
1421
- // a11y
1422
- ariaAttributes: A,
1423
- listboxContainerAttributes: P,
1424
- // Values
1425
- containerProps: r,
1426
- isSearchResultEmpty: Y,
1427
- limitedEmptyStateProps: ye,
1428
- loadingButtonState: q,
1429
- slots: n,
1430
- shouldDisplayShowMoreButton: U,
1431
- showMoreButtonText: ve,
1432
- virtualisedItems: y,
1433
- wrapperProps: g,
1434
- // Enums
1435
- BentoKeyboardNavigationKeyDownEvent: V,
1436
- BentoListboxEvent: v,
1437
- // Methods
1438
- onListboxContainerScroll: S,
1439
- onOptionSelected: L,
1440
- emitShowMore: $,
1441
- listboxListeners: Se
1442
- };
1443
- }
1444
- }), es = ["id"], ts = {
1445
- key: 0,
1446
- class: "b-listbox__loading-filtered-items"
1447
- }, ss = {
1448
- key: 1,
1449
- class: "b-listbox__empty-search-message"
1450
- }, ls = {
1451
- key: 2,
1452
- class: "b-listbox__lazy-load"
1453
- }, os = {
1454
- key: 3,
1455
- class: "b-listbox__lazy-load"
1456
- };
1457
- function is(e, t, n, s, a, i) {
1458
- var g;
1459
- const c = k("bento-loading-indicator"), m = k("bento-empty-state"), h = k("bento-typography"), l = k("bento-listbox-multi-select"), r = k("bento-listbox-single-select"), o = k("bento-loading-button"), y = xe("bento-keyboard-navigation-directive");
1460
- return re((d(), O("div", w({
1461
- id: e.id,
1462
- ref: "listboxRef",
1463
- class: "b-listbox",
1464
- tabindex: "-1"
1465
- }, e.listboxContainerAttributes, {
1466
- style: (g = e.containerProps) == null ? void 0 : g.style,
1467
- "data-testid": "listbox-container",
1468
- onScroll: t[0] || (t[0] = (...T) => e.onListboxContainerScroll && e.onListboxContainerScroll(...T))
1469
- }), [
1470
- z("div", ie(ue(e.wrapperProps)), [
1471
- e.componentLoading ? (d(), O("div", ts, [
1472
- x(c)
1473
- ])) : e.isSearchResultEmpty ? (d(), O("div", ss, [
1474
- e.emptyState ? (d(), R(m, ie(w({ key: 0 }, e.limitedEmptyStateProps)), null, 16)) : (d(), R(h, {
1475
- key: 1,
1476
- el: "span"
1477
- }, {
1478
- default: I(() => [
1479
- K(F(e.noResultsMessage), 1)
1480
- ]),
1481
- _: 1
1482
- }))
1483
- ])) : (d(), O(le, { key: 2 }, [
1484
- e.multiple ? (d(), R(l, w({
1485
- key: 0,
1486
- ref: "listboxItemRef",
1487
- "has-more-items": e.hasMoreItems
1488
- }, e.ariaAttributes, {
1489
- items: e.items,
1490
- "lazy-load-type": e.lazyLoadType,
1491
- "static-categories": e.staticCategories,
1492
- "selected-values": e.selectedValue,
1493
- searching: e.searching,
1494
- "is-option-disabled": e.isOptionDisabled
1495
- }, se(e.listboxListeners)), be({ _: 2 }, [
1496
- H(e.slots, (T, N) => ({
1497
- name: N,
1498
- fn: I((D) => [
1499
- W(e.$slots, N, ie(ue(D)), void 0, !0)
1500
- ])
1501
- }))
1502
- ]), 1040, ["has-more-items", "items", "lazy-load-type", "static-categories", "selected-values", "searching", "is-option-disabled"])) : (d(), R(r, w({
1503
- key: 1,
1504
- ref: "listboxItemRef",
1505
- items: e.virtualisedItems
1506
- }, e.ariaAttributes, {
1507
- "selected-value": e.selectedValue,
1508
- "static-categories": e.staticCategories,
1509
- "is-option-disabled": e.isOptionDisabled
1510
- }, se(e.listboxListeners)), be({ _: 2 }, [
1511
- H(e.slots, (T, N) => ({
1512
- name: N,
1513
- fn: I((D) => [
1514
- W(e.$slots, N, ie(ue(D)), void 0, !0)
1515
- ])
1516
- }))
1517
- ]), 1040, ["items", "selected-value", "static-categories", "is-option-disabled"])),
1518
- e.shouldDisplayShowMoreButton ? (d(), O("div", ls, [
1519
- x(o, {
1520
- state: e.loadingButtonState,
1521
- variant: "secondary",
1522
- onClickCapture: e.emitShowMore
1523
- }, {
1524
- default: I(() => [
1525
- K(F(e.showMoreButtonText), 1)
1526
- ]),
1527
- _: 1
1528
- }, 8, ["state", "onClickCapture"])
1529
- ])) : e.loading ? (d(), O("div", os, [
1530
- x(c)
1531
- ])) : J("", !0)
1532
- ], 64))
1533
- ], 16)
1534
- ], 16, es)), [
1535
- [y]
1536
- ]);
1537
- }
1538
- const Os = /* @__PURE__ */ j(Qt, [["render", is], ["__scopeId", "data-v-c9aaa0e3"]]), Ee = (e, t) => {
1539
- for (const n of e) {
1540
- if (n.value === t)
1541
- return n;
1542
- if (n.items) {
1543
- const s = Ee(n.items, t);
1544
- if (s)
1545
- return s;
1546
- }
1547
- }
1548
- return null;
1549
- }, ns = (e) => typeof e == "object" && e !== null && "value" in e && "label" in e, Ts = (e, t, n, s) => {
1550
- const a = B([]), i = B(), c = (r) => {
1551
- n.value ? i.value = r.map(({ value: o }) => o) : i.value = r.length > 0 ? r[0].value : null;
1552
- }, m = (r) => {
1553
- n.value ? i.value = r.map(({ value: o, label: y }) => ({ value: o, label: y })) : i.value = r.length > 0 ? { value: r[0].value, label: r[0].label } : null;
1554
- }, h = (r) => {
1555
- a.value = r, s != null && s.value ? m(r) : c(r);
1556
- }, l = () => {
1557
- a.value = [], i.value = null;
1558
- };
1559
- return ne(
1560
- () => t.value,
1561
- () => {
1562
- if (!t.value && t.value !== 0) {
1563
- l();
1564
- return;
1565
- }
1566
- const r = !Array.isArray(t.value), o = [...a.value];
1567
- l();
1568
- const y = (g) => {
1569
- if (ns(g))
1570
- a.value.push(g);
1571
- else {
1572
- let T = Ee(e.value, g);
1573
- T || (T = Ee(o, g)), T || (T = { value: g, label: g.toString() }), a.value.push(T);
1574
- }
1575
- };
1576
- if (r) {
1577
- const g = t.value;
1578
- y(g), s != null && s.value ? m(a.value) : c(a.value);
1579
- return;
1580
- }
1581
- t.value.forEach(y), s != null && s.value ? m(a.value) : c(a.value);
1582
- },
1583
- { immediate: !0 }
1584
- ), {
1585
- // Values
1586
- cachedSelectedListboxOptions: a,
1587
- cachedListboxSelectedValues: i,
1588
- // Methods
1589
- resetCache: l,
1590
- setCachedValues: h
1591
- };
1592
- };
1593
- export {
1594
- oe as B,
1595
- v as a,
1596
- Os as b,
1597
- Ts as c,
1598
- qt as u
1599
- };
1600
- //# sourceMappingURL=use-cached-selected-values.CEwKqYIe.js.map