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