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