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