@adyen/bento-vue2 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.6y92U6AF.js → checkbox-group.DVX0GFm9.js} +4 -4
- package/dist/chunks/{checkbox-group.6y92U6AF.js.map → checkbox-group.DVX0GFm9.js.map} +1 -1
- package/dist/chunks/{checkbox.C9nJVvMq.js → checkbox.nHrvoKfp.js} +3 -3
- package/dist/chunks/{checkbox.C9nJVvMq.js.map → checkbox.nHrvoKfp.js.map} +1 -1
- package/dist/chunks/{code-snippet.CBU8Tlbs.js → code-snippet.C7eh-7Vy.js} +3 -3
- package/dist/chunks/{code-snippet.CBU8Tlbs.js.map → code-snippet.C7eh-7Vy.js.map} +1 -1
- package/dist/chunks/{controls-group.Dpe3TqAz.js → controls-group.BWAmz7Tg.js} +2 -2
- package/dist/chunks/{controls-group.Dpe3TqAz.js.map → controls-group.BWAmz7Tg.js.map} +1 -1
- package/dist/chunks/{copy.Co1MMqtM.js → copy.CXeLbvUP.js} +2 -2
- package/dist/chunks/{copy.Co1MMqtM.js.map → copy.CXeLbvUP.js.map} +1 -1
- package/dist/chunks/{dashed-underline.DD24UDCz.js → dashed-underline.CEaAmjDa.js} +2 -2
- package/dist/chunks/{dashed-underline.DD24UDCz.js.map → dashed-underline.CEaAmjDa.js.map} +1 -1
- package/dist/chunks/{data-grid.Cep-0zsO.js → data-grid.o64ltIur.js} +1105 -1076
- package/dist/chunks/data-grid.o64ltIur.js.map +1 -0
- package/dist/chunks/{date-picker.D65ieFdN.js → date-picker.Ba-lHyXs.js} +29 -29
- package/dist/chunks/{date-picker.D65ieFdN.js.map → date-picker.Ba-lHyXs.js.map} +1 -1
- package/dist/chunks/{date-range-picker.CNB28UaM.js → date-range-picker.BER92nnT.js} +21 -21
- package/dist/chunks/{date-range-picker.CNB28UaM.js.map → date-range-picker.BER92nnT.js.map} +1 -1
- package/dist/chunks/{dropdown-tag.DmVsDrL_.js → dropdown-tag.uNZs7yVF.js} +3 -3
- package/dist/chunks/{dropdown-tag.DmVsDrL_.js.map → dropdown-tag.uNZs7yVF.js.map} +1 -1
- package/dist/chunks/{dropdown.B_PWXFtT.js → dropdown.DZ1Ndonr.js} +211 -210
- package/dist/chunks/dropdown.DZ1Ndonr.js.map +1 -0
- package/dist/chunks/{error-message.BeExHHgv.js → error-message.1Em7Lis3.js} +2 -2
- package/dist/chunks/{error-message.BeExHHgv.js.map → error-message.1Em7Lis3.js.map} +1 -1
- package/dist/chunks/{file-uploader.RYWR99Nq.js → file-uploader.DyjdNLOa.js} +3 -3
- package/dist/chunks/{file-uploader.RYWR99Nq.js.map → file-uploader.DyjdNLOa.js.map} +1 -1
- package/dist/chunks/{filter-bar.DjUN3PeJ.js → filter-bar.BMDvL9EW.js} +10 -10
- package/dist/chunks/{filter-bar.DjUN3PeJ.js.map → filter-bar.BMDvL9EW.js.map} +1 -1
- package/dist/chunks/{header-with-views.Csgl4PSQ.js → header-with-views.CEfKLlVv.js} +4 -4
- package/dist/chunks/{header-with-views.Csgl4PSQ.js.map → header-with-views.CEfKLlVv.js.map} +1 -1
- package/dist/chunks/{info-icon.G8lKgclf.js → info-icon.B9aTl1nU.js} +2 -2
- package/dist/chunks/{info-icon.G8lKgclf.js.map → info-icon.B9aTl1nU.js.map} +1 -1
- package/dist/chunks/{input-field-password.CY3eRVpe.js → input-field-password.DI7W4ehj.js} +110 -109
- package/dist/chunks/input-field-password.DI7W4ehj.js.map +1 -0
- package/dist/chunks/{input-field-phone-number.CN5qZ0VL.js → input-field-phone-number.BXbNxQeN.js} +3 -3
- package/dist/chunks/{input-field-phone-number.CN5qZ0VL.js.map → input-field-phone-number.BXbNxQeN.js.map} +1 -1
- package/dist/chunks/{input-field.DKhsSYF8.js → input-field.-Pgtuotm.js} +3 -3
- package/dist/chunks/{input-field.DKhsSYF8.js.map → input-field.-Pgtuotm.js.map} +1 -1
- package/dist/chunks/{listbox-option-tag.DFmB_TuD.js → listbox-option-tag.D0Cql_R3.js} +2 -2
- package/dist/chunks/{listbox-option-tag.DFmB_TuD.js.map → listbox-option-tag.D0Cql_R3.js.map} +1 -1
- package/dist/chunks/{pagination.DvP8FqiW.js → pagination.CoM4szsH.js} +2 -2
- package/dist/chunks/{pagination.DvP8FqiW.js.map → pagination.CoM4szsH.js.map} +1 -1
- package/dist/chunks/{radio-group.CRDMTTyM.js → radio-group.CtPG_iiI.js} +4 -4
- package/dist/chunks/{radio-group.CRDMTTyM.js.map → radio-group.CtPG_iiI.js.map} +1 -1
- package/dist/chunks/{rich-text-editor.aSOSl4Rz.js → rich-text-editor.CLxVaskq.js} +4 -4
- package/dist/chunks/{rich-text-editor.aSOSl4Rz.js.map → rich-text-editor.CLxVaskq.js.map} +1 -1
- package/dist/chunks/{search-bar.Sh4A8UId.js → search-bar.BhQdvBh8.js} +3 -3
- package/dist/chunks/{search-bar.Sh4A8UId.js.map → search-bar.BhQdvBh8.js.map} +1 -1
- package/dist/chunks/{secondary-nav.BFtGx_IN.js → secondary-nav.CItGT9T3.js} +2 -2
- package/dist/chunks/{secondary-nav.BFtGx_IN.js.map → secondary-nav.CItGT9T3.js.map} +1 -1
- package/dist/chunks/{segmented-control.B-uxKqMN.js → segmented-control.DHZEfmT-.js} +2 -2
- package/dist/chunks/{segmented-control.B-uxKqMN.js.map → segmented-control.DHZEfmT-.js.map} +1 -1
- package/dist/chunks/{selection-card-group.CrWy35QU.js → selection-card-group.CoqBRUT8.js} +3 -3
- package/dist/chunks/{selection-card-group.CrWy35QU.js.map → selection-card-group.CoqBRUT8.js.map} +1 -1
- package/dist/chunks/{structured-list-item.DKEwF8n7.js → structured-list-item.tox2Kcb6.js} +4 -4
- package/dist/chunks/{structured-list-item.DKEwF8n7.js.map → structured-list-item.tox2Kcb6.js.map} +1 -1
- package/dist/chunks/{summary-grid.types.BgFtV5Qh.js → summary-grid.types.CkUIw703.js} +5 -5
- package/dist/chunks/{summary-grid.types.BgFtV5Qh.js.map → summary-grid.types.CkUIw703.js.map} +1 -1
- package/dist/chunks/{tag.BaSi2GVV.js → tag.CGkclKVL.js} +2 -2
- package/dist/chunks/{tag.BaSi2GVV.js.map → tag.CGkclKVL.js.map} +1 -1
- package/dist/chunks/{textarea.D7M7Jerq.js → textarea.BPeDUAPL.js} +2 -2
- package/dist/chunks/{textarea.D7M7Jerq.js.map → textarea.BPeDUAPL.js.map} +1 -1
- package/dist/chunks/{timeline-item.njO0X8KL.js → timeline-item.CS9ZDOsm.js} +4 -4
- package/dist/chunks/{timeline-item.njO0X8KL.js.map → timeline-item.CS9ZDOsm.js.map} +1 -1
- package/dist/chunks/{tooltip.DyZIyMZN.js → tooltip.wQsyAwkC.js} +15 -15
- package/dist/chunks/tooltip.wQsyAwkC.js.map +1 -0
- package/dist/chunks/use-cached-selected-values.C1CeSurp.js +1271 -0
- package/dist/chunks/use-cached-selected-values.C1CeSurp.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 +9 -1
- package/package.json +6 -6
- package/dist/chunks/data-grid.Cep-0zsO.js.map +0 -1
- package/dist/chunks/dropdown.B_PWXFtT.js.map +0 -1
- package/dist/chunks/input-field-password.CY3eRVpe.js.map +0 -1
- package/dist/chunks/tooltip.DyZIyMZN.js.map +0 -1
- package/dist/chunks/use-cached-selected-values.CDBmVxYM.js +0 -1225
- package/dist/chunks/use-cached-selected-values.CDBmVxYM.js.map +0 -1
|
@@ -1,1225 +0,0 @@
|
|
|
1
|
-
import { computed as i, ref as T, onMounted as Ce, onUnmounted as xe, watch as j, defineComponent as M, toRef as G, useSlots as Se } from "vue";
|
|
2
|
-
import { B as Y } from "./typography.J1v_SPG3.js";
|
|
3
|
-
import { B as Ee } from "./loading-indicator.z8COalOc.js";
|
|
4
|
-
import { B as Oe } from "./empty-state.mtXfb1BB.js";
|
|
5
|
-
import { u as Z } from "./i18n.BQkEbtPM.js";
|
|
6
|
-
import { d as Te } from "./debounce.DUTu11PS.js";
|
|
7
|
-
import "./index.Cl4_42j5.js";
|
|
8
|
-
import { B as Ae } from "./chip.OV0EWIP3.js";
|
|
9
|
-
import { C as q, N as Le } from "./minus-small.DJacLGTw.js";
|
|
10
|
-
import { C as Ie } from "./checkmark-small.DVDtD4HQ.js";
|
|
11
|
-
import { n as N } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
12
|
-
import { C as ke } from "./chevron-down.eYtgv5ly.js";
|
|
13
|
-
import { C as Re } from "./chevron-up.d8cwIlA_.js";
|
|
14
|
-
import { B, a as Q } from "./keyboard-navigation.pB8weElW.js";
|
|
15
|
-
import { d as De, e as ce } from "./button-actions._OIvTdKt.js";
|
|
16
|
-
/* empty css */
|
|
17
|
-
import { o as Be } from "./resize.Bqks3WUm.js";
|
|
18
|
-
import "../assets/use-cached-selected-values.css";
|
|
19
|
-
const de = (l, e, t, s) => {
|
|
20
|
-
const o = i(
|
|
21
|
-
() => {
|
|
22
|
-
var v, S;
|
|
23
|
-
return !!((v = l.value) != null && v.length) && ((S = l.value) == null ? void 0 : S.length) === e.value.length;
|
|
24
|
-
}
|
|
25
|
-
), n = i(() => {
|
|
26
|
-
var v;
|
|
27
|
-
return l.value == null || l.value.length === 0 ? !1 : ((v = l.value) == null ? void 0 : v.length) !== e.value.length;
|
|
28
|
-
});
|
|
29
|
-
return {
|
|
30
|
-
isAllSelected: o,
|
|
31
|
-
isIndeterminate: n,
|
|
32
|
-
toggleSelectAll: (v) => {
|
|
33
|
-
v ? t() : s();
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
function $e(l, { disabled: e, itemHeight: t, overscan: s = 5, prefixHeight: o }) {
|
|
38
|
-
const n = T(null), d = T([]), v = T(0), S = T(0), c = T(0);
|
|
39
|
-
let r;
|
|
40
|
-
const h = i(() => {
|
|
41
|
-
const f = typeof t == "number" ? l.value.length * t : l.value.reduce((A, L, y) => A + t(y), 0), C = typeof t == "number" ? v.value * t : l.value.slice(0, v.value).reduce((A, L, y) => A + t(y), 0);
|
|
42
|
-
return {
|
|
43
|
-
style: {
|
|
44
|
-
marginTop: `${C}px`,
|
|
45
|
-
height: `${f - C}px`
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
}), O = () => {
|
|
49
|
-
const f = (o == null ? void 0 : o.value) ?? 0, C = Math.max(n.value.scrollTop - f, 0);
|
|
50
|
-
if (typeof t == "number")
|
|
51
|
-
return Math.floor(C / t);
|
|
52
|
-
let A = 0, L = 0;
|
|
53
|
-
for (let y = 0; y < l.value.length; y += 1) {
|
|
54
|
-
const w = t(y);
|
|
55
|
-
if (A += w, A >= C) {
|
|
56
|
-
L = y;
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return L;
|
|
61
|
-
}, g = () => {
|
|
62
|
-
if (c.value = n.value.clientHeight, typeof t == "number")
|
|
63
|
-
return Math.ceil(c.value / t);
|
|
64
|
-
const f = v.value ?? 0;
|
|
65
|
-
let C = 0, A = 0;
|
|
66
|
-
for (let L = f; L < l.value.length; L += 1) {
|
|
67
|
-
const y = t(L);
|
|
68
|
-
if (C += y, A = L, C > c.value)
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
return A - f;
|
|
72
|
-
}, u = () => {
|
|
73
|
-
if (n.value) {
|
|
74
|
-
const f = g();
|
|
75
|
-
v.value = O(), S.value = Math.min(v.value + f + s, l.value.length), d.value = l.value.slice(v.value, S.value);
|
|
76
|
-
}
|
|
77
|
-
}, I = () => {
|
|
78
|
-
u();
|
|
79
|
-
};
|
|
80
|
-
e || (Ce(() => {
|
|
81
|
-
n.value && (c.value = n.value.clientHeight, r = Be(n.value, ({ clientHeight: f }) => {
|
|
82
|
-
c.value = f, u();
|
|
83
|
-
}), u());
|
|
84
|
-
}), xe(() => {
|
|
85
|
-
r == null || r.disconnect();
|
|
86
|
-
}), j(
|
|
87
|
-
() => l.value,
|
|
88
|
-
() => {
|
|
89
|
-
u();
|
|
90
|
-
}
|
|
91
|
-
));
|
|
92
|
-
const D = {
|
|
93
|
-
ref: n,
|
|
94
|
-
style: { overflowY: "auto" }
|
|
95
|
-
};
|
|
96
|
-
return e ? {
|
|
97
|
-
containerRef: n,
|
|
98
|
-
containerProps: D,
|
|
99
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
100
|
-
onScroll: () => {
|
|
101
|
-
},
|
|
102
|
-
list: l
|
|
103
|
-
} : {
|
|
104
|
-
containerRef: n,
|
|
105
|
-
containerProps: D,
|
|
106
|
-
onScroll: I,
|
|
107
|
-
list: d,
|
|
108
|
-
wrapperProps: h
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
var a = /* @__PURE__ */ ((l) => (l.SELECT = "select", l.SHOW_MORE = "show-more", l.ESCAPE = "escape-pressed", l.CLICK = "click", l.ENTER = "enter-pressed", l.SPACE = "space-pressed", l.TAB = "tab-pressed", l.CLOSE_DROPDOWN = "close-dropdown", l))(a || {}), z = /* @__PURE__ */ ((l) => (l.AUTOMATIC = "automatic", l.BUTTON = "button", l.NONE = "none", l))(z || {});
|
|
112
|
-
const Ne = M({
|
|
113
|
-
name: "bento-listbox-static-category",
|
|
114
|
-
components: {
|
|
115
|
-
BentoTypography: Y
|
|
116
|
-
},
|
|
117
|
-
props: {
|
|
118
|
-
/**
|
|
119
|
-
* Category label text
|
|
120
|
-
*/
|
|
121
|
-
categoryLabel: {
|
|
122
|
-
type: String,
|
|
123
|
-
required: !0
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
var Me = function() {
|
|
128
|
-
var e = this, t = e._self._c;
|
|
129
|
-
return e._self._setupProxy, t("div", { staticClass: "b-listbox-single-select-category" }, [t("bento-typography", { staticClass: "b-listbox-single-select-category__label-text", attrs: { variant: "caption", el: "span" } }, [e._v(" " + e._s(e.categoryLabel) + " ")]), t("div", [e._t("default")], 2)], 1);
|
|
130
|
-
}, we = [], Pe = /* @__PURE__ */ N(
|
|
131
|
-
Ne,
|
|
132
|
-
Me,
|
|
133
|
-
we,
|
|
134
|
-
!1,
|
|
135
|
-
null,
|
|
136
|
-
"4aa8cc6e"
|
|
137
|
-
);
|
|
138
|
-
const Fe = Pe.exports, Ge = M({
|
|
139
|
-
name: "bento-listbox-option",
|
|
140
|
-
props: {
|
|
141
|
-
/**
|
|
142
|
-
* Setting this property to true will disable the option.
|
|
143
|
-
*/
|
|
144
|
-
disabled: { type: Boolean, default: !1 },
|
|
145
|
-
/**
|
|
146
|
-
* Indicates if the value is selected. Only one element can be selected at a time.
|
|
147
|
-
*/
|
|
148
|
-
selected: { type: Boolean, default: !1 }
|
|
149
|
-
},
|
|
150
|
-
emits: [a.CLICK, a.ENTER, a.SPACE, a.TAB],
|
|
151
|
-
setup(l, { emit: e }) {
|
|
152
|
-
const t = i(() => ({
|
|
153
|
-
"b-listbox-option--disabled": l.disabled,
|
|
154
|
-
"b-listbox-option--selected": l.selected
|
|
155
|
-
}));
|
|
156
|
-
return {
|
|
157
|
-
// Enums
|
|
158
|
-
BentoKeyboardNavigationKeyDownEvent: B,
|
|
159
|
-
BentoListboxEvent: a,
|
|
160
|
-
// Values
|
|
161
|
-
conditionalClasses: t,
|
|
162
|
-
// Events
|
|
163
|
-
onClick: (n) => {
|
|
164
|
-
e(a.CLICK, n);
|
|
165
|
-
},
|
|
166
|
-
onOptionSelected: (n, d) => {
|
|
167
|
-
e(n, d);
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
var Ue = function() {
|
|
173
|
-
var e = this, t = e._self._c;
|
|
174
|
-
return e._self._setupProxy, t("div", e._b({ staticClass: "b-listbox-option", class: e.conditionalClasses, attrs: { role: "option" }, on: { click: e.onClick, keydown: [function(s) {
|
|
175
|
-
return !s.type.indexOf("key") && e._k(s.keyCode, "enter", 13, s.key, "Enter") ? null : e.onOptionSelected(e.BentoListboxEvent.ENTER, s);
|
|
176
|
-
}, function(s) {
|
|
177
|
-
return !s.type.indexOf("key") && e._k(s.keyCode, "space", 32, s.key, [" ", "Spacebar"]) ? null : e.onOptionSelected(e.BentoListboxEvent.SPACE, s);
|
|
178
|
-
}, function(s) {
|
|
179
|
-
return !s.type.indexOf("key") && e._k(s.keyCode, "tab", 9, s.key, "Tab") ? null : e.onOptionSelected(e.BentoListboxEvent.TAB, s);
|
|
180
|
-
}] } }, "div", e.$attrs, !1), [e._t("default")], 2);
|
|
181
|
-
}, ze = [], Ye = /* @__PURE__ */ N(
|
|
182
|
-
Ge,
|
|
183
|
-
Ue,
|
|
184
|
-
ze,
|
|
185
|
-
!1,
|
|
186
|
-
null,
|
|
187
|
-
"a1e9ebff"
|
|
188
|
-
);
|
|
189
|
-
const H = Ye.exports;
|
|
190
|
-
let re = 0;
|
|
191
|
-
const We = {
|
|
192
|
-
beforeCreate() {
|
|
193
|
-
this.uuid = re.toString(), re += 1;
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
var Ke = function() {
|
|
197
|
-
var e = this, t = e._self._c;
|
|
198
|
-
return t("svg", e._b({ staticClass: "ui-assets-icons-16", attrs: { role: "img", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "none" } }, "svg", e.$attrs, !1), [e.$attrs["svg-title"] ? t("title", [e._v(e._s(e.$attrs["svg-title"]))]) : e._e(), t("path", { attrs: { fill: "#001222", d: "M15.0608 4.00011L14.0001 2.93945L6.00011 10.9395L2.00011 6.93945L0.939453 8.00011L6.00011 13.0608L15.0608 4.00011Z" } })]);
|
|
199
|
-
}, qe = [], je = /* @__PURE__ */ N(
|
|
200
|
-
We,
|
|
201
|
-
Ke,
|
|
202
|
-
qe,
|
|
203
|
-
!1,
|
|
204
|
-
null,
|
|
205
|
-
null
|
|
206
|
-
);
|
|
207
|
-
const He = je.exports, Ve = M({
|
|
208
|
-
name: "bento-listbox-single-select-option",
|
|
209
|
-
components: {
|
|
210
|
-
BentoListboxOption: H,
|
|
211
|
-
BentoTypography: Y,
|
|
212
|
-
CheckmarkIcon: He
|
|
213
|
-
},
|
|
214
|
-
props: {
|
|
215
|
-
/**
|
|
216
|
-
* Setting this property to true will disable the option.
|
|
217
|
-
*/
|
|
218
|
-
disabled: { type: Boolean, default: !1 },
|
|
219
|
-
/**
|
|
220
|
-
* The option item that contains all the option item's data.
|
|
221
|
-
* @type {BentoListboxOptionItem}
|
|
222
|
-
*/
|
|
223
|
-
option: {
|
|
224
|
-
type: Object,
|
|
225
|
-
required: !0
|
|
226
|
-
},
|
|
227
|
-
/**
|
|
228
|
-
* Indicates if the value is selected. Only one element can be selected at a time.
|
|
229
|
-
*/
|
|
230
|
-
selected: { type: Boolean, default: !1 }
|
|
231
|
-
},
|
|
232
|
-
emits: [a.ENTER, a.SELECT, a.SPACE, a.TAB],
|
|
233
|
-
setup(l, { emit: e }) {
|
|
234
|
-
const t = (d) => {
|
|
235
|
-
l.disabled || e(d, l.option);
|
|
236
|
-
}, s = i(() => l.disabled ? !0 : null), o = i(() => l.selected ? !0 : null), n = i(() => l.disabled ? -1 : 0);
|
|
237
|
-
return {
|
|
238
|
-
// Values
|
|
239
|
-
ariaDisabled: s,
|
|
240
|
-
ariaSelected: o,
|
|
241
|
-
tabIndex: n,
|
|
242
|
-
// Enums
|
|
243
|
-
BentoListboxEvent: a,
|
|
244
|
-
// Events
|
|
245
|
-
onOptionSelected: t
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
var Xe = function() {
|
|
250
|
-
var e = this, t = e._self._c;
|
|
251
|
-
return e._self._setupProxy, t("bento-listbox-option", { staticClass: "b-listbox-single-select-option", attrs: { disabled: e.disabled, selected: e.selected, "aria-selected": e.ariaSelected, "aria-disabled": e.ariaDisabled, tabindex: e.tabIndex }, on: { click: function(s) {
|
|
252
|
-
return e.onOptionSelected(e.BentoListboxEvent.SELECT);
|
|
253
|
-
}, "enter-pressed": function(s) {
|
|
254
|
-
return e.onOptionSelected(e.BentoListboxEvent.ENTER);
|
|
255
|
-
}, "space-pressed": function(s) {
|
|
256
|
-
return s.preventDefault(), e.onOptionSelected(e.BentoListboxEvent.SPACE);
|
|
257
|
-
}, "tab-pressed": function(s) {
|
|
258
|
-
return e.onOptionSelected(e.BentoListboxEvent.TAB);
|
|
259
|
-
} } }, [e._t("default", function() {
|
|
260
|
-
return [t("span", { staticClass: "b-listbox-single-select-option__text" }, [t("bento-typography", { attrs: { el: "span" } }, [e._v(e._s(e.option.label))]), e.option.description ? t("bento-typography", { staticClass: "b-listbox-single-select-option__description", attrs: { el: "span" } }, [e._v(" " + e._s(e.option.description) + " ")]) : e._e()], 1)];
|
|
261
|
-
}, null, e.option), t("span", { staticClass: "b-listbox-single-select-option__check-icon" }, [t("checkmark-icon", { directives: [{ name: "show", rawName: "v-show", value: e.selected, expression: "selected" }], attrs: { "svg-title": "selected" } })], 1)], 2);
|
|
262
|
-
}, Je = [], Ze = /* @__PURE__ */ N(
|
|
263
|
-
Ve,
|
|
264
|
-
Xe,
|
|
265
|
-
Je,
|
|
266
|
-
!1,
|
|
267
|
-
null,
|
|
268
|
-
"5a5ff36a"
|
|
269
|
-
);
|
|
270
|
-
const Qe = Ze.exports, fe = ({ items: l, hasStaticCategories: e }, t) => {
|
|
271
|
-
const s = i(
|
|
272
|
-
() => e.value ? l.value.flatMap((u) => u.items) : l.value
|
|
273
|
-
), o = i(() => s.value.length - 1), n = T(0), d = (u) => {
|
|
274
|
-
switch (u) {
|
|
275
|
-
case "increase":
|
|
276
|
-
n.value += 1;
|
|
277
|
-
break;
|
|
278
|
-
case "decrease":
|
|
279
|
-
n.value -= 1;
|
|
280
|
-
break;
|
|
281
|
-
}
|
|
282
|
-
}, v = ({ edgeCaseItem: u }, I) => {
|
|
283
|
-
n.value !== u && (d(I), t(n.value));
|
|
284
|
-
}, S = (u) => {
|
|
285
|
-
g(u), v(
|
|
286
|
-
{
|
|
287
|
-
edgeCaseItem: o.value
|
|
288
|
-
},
|
|
289
|
-
"increase"
|
|
290
|
-
/* INCREASE */
|
|
291
|
-
);
|
|
292
|
-
}, c = (u) => {
|
|
293
|
-
g(u), v(
|
|
294
|
-
{
|
|
295
|
-
edgeCaseItem: 0
|
|
296
|
-
},
|
|
297
|
-
"decrease"
|
|
298
|
-
/* DECREASE */
|
|
299
|
-
);
|
|
300
|
-
}, r = () => {
|
|
301
|
-
n.value = 0, t(n.value);
|
|
302
|
-
}, h = () => {
|
|
303
|
-
n.value = o.value, t(n.value);
|
|
304
|
-
}, O = (u) => {
|
|
305
|
-
n.value = u;
|
|
306
|
-
}, g = (u) => {
|
|
307
|
-
var I;
|
|
308
|
-
(I = u == null ? void 0 : u.detail) == null || I.preventDefault();
|
|
309
|
-
};
|
|
310
|
-
return {
|
|
311
|
-
moveToFirstElement: r,
|
|
312
|
-
moveToLastElement: h,
|
|
313
|
-
moveToNextElement: S,
|
|
314
|
-
moveToPreviousElement: c,
|
|
315
|
-
setListboxFocusedIndex: O,
|
|
316
|
-
preventDefault: g,
|
|
317
|
-
focusedIndex: n
|
|
318
|
-
};
|
|
319
|
-
}, et = M({
|
|
320
|
-
name: "bento-listbox-single-select",
|
|
321
|
-
components: {
|
|
322
|
-
BentoListboxSingleSelectCategory: Fe,
|
|
323
|
-
BentoListboxSingleSelectOption: Qe
|
|
324
|
-
},
|
|
325
|
-
directives: { BentoKeyboardNavigationDirective: Q },
|
|
326
|
-
inheritAttrs: !1,
|
|
327
|
-
props: {
|
|
328
|
-
/**
|
|
329
|
-
* Function that allows the options to be disabled
|
|
330
|
-
*
|
|
331
|
-
* @type {BentoListboxIsOptionDisabled}
|
|
332
|
-
* @param {BentoListboxOptionItem} option - listbox option object
|
|
333
|
-
* @param {string} option.label - Option's label text
|
|
334
|
-
* @param {string|number} option.value - Option's value
|
|
335
|
-
* @param {unknown} option.data - Option's extra data to be passed to the default slot
|
|
336
|
-
*/
|
|
337
|
-
isOptionDisabled: {
|
|
338
|
-
type: Function,
|
|
339
|
-
default: () => !1
|
|
340
|
-
},
|
|
341
|
-
/**
|
|
342
|
-
* The option elements to populate the listbox with.
|
|
343
|
-
* It must be an array of {@see BentoListboxOptionItem }.
|
|
344
|
-
*
|
|
345
|
-
* @property {string} value.label - Text to be displayed in the option
|
|
346
|
-
* @property {string,number} value.value - Value of the option
|
|
347
|
-
*/
|
|
348
|
-
items: {
|
|
349
|
-
type: Array,
|
|
350
|
-
required: !0
|
|
351
|
-
},
|
|
352
|
-
/**
|
|
353
|
-
* The `input` value.
|
|
354
|
-
* Providing an empty string will select no options.
|
|
355
|
-
* Set to an empty string `''` if you don't want any of the available options to be selected
|
|
356
|
-
*/
|
|
357
|
-
selectedValue: {
|
|
358
|
-
type: Array,
|
|
359
|
-
default: void 0
|
|
360
|
-
},
|
|
361
|
-
/**
|
|
362
|
-
* If enabled, dropdown will display non-selectable, static categories
|
|
363
|
-
*/
|
|
364
|
-
staticCategories: { type: Boolean, default: !1 }
|
|
365
|
-
},
|
|
366
|
-
emits: [a.SELECT, a.ENTER, a.SPACE, a.TAB],
|
|
367
|
-
setup(l, { emit: e, expose: t, slots: s }) {
|
|
368
|
-
const o = T(null), n = T([]), d = i(() => {
|
|
369
|
-
var f;
|
|
370
|
-
return !!((f = l.selectedValue) != null && f.length) && l.selectedValue.at(0);
|
|
371
|
-
}), v = i(() => !!l.items.some(({ items: f }) => !!f)), S = (f) => (C) => {
|
|
372
|
-
e(f, [C]);
|
|
373
|
-
}, c = (f) => {
|
|
374
|
-
var C;
|
|
375
|
-
(C = o.value.querySelectorAll('[role="option"]')[f]) == null || C.focus();
|
|
376
|
-
}, {
|
|
377
|
-
moveToNextElement: r,
|
|
378
|
-
moveToPreviousElement: h,
|
|
379
|
-
moveToFirstElement: O,
|
|
380
|
-
moveToLastElement: g,
|
|
381
|
-
setListboxFocusedIndex: u
|
|
382
|
-
} = fe(
|
|
383
|
-
{
|
|
384
|
-
items: G(l, "items"),
|
|
385
|
-
hasStaticCategories: G(l, "staticCategories")
|
|
386
|
-
},
|
|
387
|
-
c
|
|
388
|
-
), I = {
|
|
389
|
-
[B.ARROW_UP]: h,
|
|
390
|
-
[B.ARROW_DOWN]: r,
|
|
391
|
-
[B.HOME]: O,
|
|
392
|
-
[B.END]: g
|
|
393
|
-
}, D = {
|
|
394
|
-
[a.SELECT]: S(a.SELECT),
|
|
395
|
-
[a.SPACE]: S(a.SPACE),
|
|
396
|
-
[a.TAB]: S(a.TAB),
|
|
397
|
-
[a.ENTER]: S(a.ENTER)
|
|
398
|
-
};
|
|
399
|
-
return t({
|
|
400
|
-
/**
|
|
401
|
-
* Reference for a single listbox item.
|
|
402
|
-
* Required for keyboard navigation in dropdown as $children is removed in vue@3
|
|
403
|
-
*/
|
|
404
|
-
listboxItemRef: n,
|
|
405
|
-
/**
|
|
406
|
-
* Method to set the index of the item to be focused on
|
|
407
|
-
* Used for focus management to be kept in-sync with parent e.g. dropdowns
|
|
408
|
-
*/
|
|
409
|
-
setListboxFocusedIndex: u
|
|
410
|
-
}), {
|
|
411
|
-
// Enums
|
|
412
|
-
BentoListboxEvent: a,
|
|
413
|
-
// Values
|
|
414
|
-
listboxRef: o,
|
|
415
|
-
listboxItemRef: n,
|
|
416
|
-
selectedItem: d,
|
|
417
|
-
slots: s,
|
|
418
|
-
// Computed
|
|
419
|
-
hasCategories: v,
|
|
420
|
-
// Methods
|
|
421
|
-
onOptionSelected: S,
|
|
422
|
-
// Keyboard navigation
|
|
423
|
-
listboxListeners: I,
|
|
424
|
-
listboxOptionListeners: D
|
|
425
|
-
};
|
|
426
|
-
}
|
|
427
|
-
});
|
|
428
|
-
var tt = function() {
|
|
429
|
-
var e = this, t = e._self._c;
|
|
430
|
-
return e._self._setupProxy, t("div", e._g({ directives: [{ name: "bento-keyboard-navigation-directive", rawName: "v-bento-keyboard-navigation-directive" }], ref: "listboxRef" }, e.listboxListeners), [e.hasCategories && e.staticCategories ? e._l(e.items, function(s) {
|
|
431
|
-
return t("bento-listbox-single-select-category", { key: s.value, attrs: { "category-label": s.label, role: "group" } }, e._l(s.items, function(o) {
|
|
432
|
-
return t("bento-listbox-single-select-option", e._g({ key: o.value, ref: "listboxItemRef", refInFor: !0, attrs: { role: "option", option: o, disabled: e.isOptionDisabled ? e.isOptionDisabled(o) : null, selected: o.value === e.selectedItem.value }, scopedSlots: e._u([e._l(e.slots, function(n, d) {
|
|
433
|
-
return { key: d, fn: function(v) {
|
|
434
|
-
return [e._t(d, null, null, v)];
|
|
435
|
-
} };
|
|
436
|
-
})], null, !0) }, e.listboxOptionListeners));
|
|
437
|
-
}), 1);
|
|
438
|
-
}) : e._l(e.items, function(s) {
|
|
439
|
-
return t("bento-listbox-single-select-option", e._g({ key: s.value, ref: "listboxItemRef", refInFor: !0, attrs: { role: "option", option: s, disabled: e.isOptionDisabled ? e.isOptionDisabled(s) : null, selected: s.value === e.selectedItem.value }, scopedSlots: e._u([e._l(e.slots, function(o, n) {
|
|
440
|
-
return { key: n, fn: function(d) {
|
|
441
|
-
return [e._t(n, null, null, d)];
|
|
442
|
-
} };
|
|
443
|
-
})], null, !0) }, e.listboxOptionListeners));
|
|
444
|
-
})], 2);
|
|
445
|
-
}, st = [], lt = /* @__PURE__ */ N(
|
|
446
|
-
et,
|
|
447
|
-
tt,
|
|
448
|
-
st,
|
|
449
|
-
!1,
|
|
450
|
-
null,
|
|
451
|
-
null
|
|
452
|
-
);
|
|
453
|
-
const nt = lt.exports, ot = {}, it = /* @__PURE__ */ M({
|
|
454
|
-
...ot,
|
|
455
|
-
__name: "listbox-decorative-checkbox",
|
|
456
|
-
props: {
|
|
457
|
-
disabled: { type: Boolean, default: !1 },
|
|
458
|
-
indeterminate: { type: Boolean, default: !1 },
|
|
459
|
-
checked: { type: Boolean, default: !1 }
|
|
460
|
-
},
|
|
461
|
-
setup(l) {
|
|
462
|
-
const e = l, t = i(() => ({
|
|
463
|
-
[`b-checkbox-input--${q.DISABLED}`]: e.disabled
|
|
464
|
-
})), s = i(() => ({
|
|
465
|
-
[`b-checkbox-input__outline--${q.UNCHECKED}`]: !e.checked && !e.indeterminate,
|
|
466
|
-
[`b-checkbox-input__outline--${q.CHECKED}`]: e.checked && !e.indeterminate,
|
|
467
|
-
[`b-checkbox-input__outline--${q.INDETERMINATE}`]: e.indeterminate
|
|
468
|
-
}));
|
|
469
|
-
return { __sfc: !0, props: e, conditionalClasses: t, outlineConditionalClasses: s, CheckmarkSmallIcon: Ie, MinusSmallIcon: Le };
|
|
470
|
-
}
|
|
471
|
-
});
|
|
472
|
-
var at = function() {
|
|
473
|
-
var e = this, t = e._self._c, s = e._self._setupProxy;
|
|
474
|
-
return t("div", { staticClass: "b-checkbox-input", class: s.conditionalClasses, attrs: { role: "presentation" } }, [e.indeterminate ? t(s.MinusSmallIcon, { staticClass: "b-checkbox-input__icon", attrs: { "svg-title": "", "aria-hidden": "true" } }) : e.checked ? t(s.CheckmarkSmallIcon, { staticClass: "b-checkbox-input__icon", attrs: { "svg-title": "", "aria-hidden": "true" } }) : e._e(), t("div", { staticClass: "b-checkbox-input__outline", class: s.outlineConditionalClasses })], 1);
|
|
475
|
-
}, ct = [], rt = /* @__PURE__ */ N(
|
|
476
|
-
it,
|
|
477
|
-
at,
|
|
478
|
-
ct,
|
|
479
|
-
!1,
|
|
480
|
-
null,
|
|
481
|
-
"5dc60f05"
|
|
482
|
-
);
|
|
483
|
-
const ee = rt.exports;
|
|
484
|
-
var X = /* @__PURE__ */ ((l) => (l.DISABLED = "disabled", l.STATIC_CATEGORY = "static-category", l))(X || {}), K = /* @__PURE__ */ ((l) => (l.SELECT_CATEGORY = "select-category", l.UNSELECT_CATEGORY = "unselect-category", l))(K || {});
|
|
485
|
-
const ut = {
|
|
486
|
-
"en-US": {
|
|
487
|
-
categoryClosed: "{category} closed",
|
|
488
|
-
categoryOpened: "{category} opened"
|
|
489
|
-
}
|
|
490
|
-
}, dt = M({
|
|
491
|
-
i18n: { messages: ut },
|
|
492
|
-
name: "bento-listbox-multi-select-category",
|
|
493
|
-
components: {
|
|
494
|
-
BentoTypography: Y,
|
|
495
|
-
BentoListboxOption: H,
|
|
496
|
-
ChevronDownIcon: ke,
|
|
497
|
-
ChevronUpIcon: Re,
|
|
498
|
-
ListboxDecorativeCheckbox: ee
|
|
499
|
-
},
|
|
500
|
-
props: {
|
|
501
|
-
/**
|
|
502
|
-
* The option elements to populate the listbox with.
|
|
503
|
-
* It must be an array of {@see BentoListboxOptionItem }.
|
|
504
|
-
*
|
|
505
|
-
* @property {string} value.label - Text to be displayed in the option
|
|
506
|
-
* @property {string,number} value.value - Value of the option
|
|
507
|
-
* @property {BentoListboxOptionItem} value.items - Category items list
|
|
508
|
-
*/
|
|
509
|
-
category: {
|
|
510
|
-
type: Object,
|
|
511
|
-
required: !0
|
|
512
|
-
},
|
|
513
|
-
/**
|
|
514
|
-
* Function that allows the options to be disabled
|
|
515
|
-
*
|
|
516
|
-
* @type {BentoListboxIsOptionDisabled}
|
|
517
|
-
* @param {BentoListboxOptionItem} option - listbox option object
|
|
518
|
-
* @param {string} option.label - Option's label text
|
|
519
|
-
* @param {string|number} option.value - Option's value
|
|
520
|
-
* @param {unknown} option.data - Option's extra data to be passed to the default slot
|
|
521
|
-
*/
|
|
522
|
-
isOptionDisabled: {
|
|
523
|
-
type: [Function],
|
|
524
|
-
default: () => !1
|
|
525
|
-
},
|
|
526
|
-
/**
|
|
527
|
-
* The `input` value.
|
|
528
|
-
* Providing an empty array will select no options.
|
|
529
|
-
*/
|
|
530
|
-
selectedItemsList: {
|
|
531
|
-
type: Array,
|
|
532
|
-
default: () => []
|
|
533
|
-
},
|
|
534
|
-
/**
|
|
535
|
-
* If enabled, dropdown will display non-selectable, static categories
|
|
536
|
-
*/
|
|
537
|
-
staticCategories: { type: Boolean, default: !1 },
|
|
538
|
-
/**
|
|
539
|
-
* Category's tabindex
|
|
540
|
-
*/
|
|
541
|
-
tabindex: { type: Number, default: -1 }
|
|
542
|
-
},
|
|
543
|
-
emits: [K.SELECT_CATEGORY, K.UNSELECT_CATEGORY],
|
|
544
|
-
setup(l, { emit: e }) {
|
|
545
|
-
const t = T(!1), { t: s } = Z(), o = (E) => l.isOptionDisabled ? l.isOptionDisabled(E) : !1, n = i(
|
|
546
|
-
() => l.category.items.every((E) => o(E))
|
|
547
|
-
), d = G(l, "staticCategories"), v = i(() => t.value || l.staticCategories), S = i(() => ({
|
|
548
|
-
[`b-listbox-multi-select-category--${X.DISABLED}`]: n.value,
|
|
549
|
-
[`b-listbox-multi-select-category--${X.STATIC_CATEGORY}`]: l.staticCategories
|
|
550
|
-
})), c = (E) => {
|
|
551
|
-
E.preventDefault(), t.value = !t.value;
|
|
552
|
-
}, r = (E) => {
|
|
553
|
-
var U;
|
|
554
|
-
const $ = o(E), k = ((U = l.selectedItemsList) == null ? void 0 : U.includes(E.value)) || !1;
|
|
555
|
-
return { isDisabled: $, isPreSelected: k };
|
|
556
|
-
}, h = i(
|
|
557
|
-
() => l.category.items.filter((E) => {
|
|
558
|
-
const { isDisabled: $, isPreSelected: k } = r(E);
|
|
559
|
-
return $ && k || !$;
|
|
560
|
-
})
|
|
561
|
-
), O = i(
|
|
562
|
-
() => {
|
|
563
|
-
var E;
|
|
564
|
-
return (E = h.value) == null ? void 0 : E.filter(
|
|
565
|
-
({ value: $ }) => {
|
|
566
|
-
var k;
|
|
567
|
-
return (k = l.selectedItemsList) == null ? void 0 : k.includes($);
|
|
568
|
-
}
|
|
569
|
-
);
|
|
570
|
-
}
|
|
571
|
-
), g = i(() => {
|
|
572
|
-
const E = t.value ? "categoryOpened" : "categoryClosed";
|
|
573
|
-
return s(E, { category: l.category.label });
|
|
574
|
-
}), u = i(
|
|
575
|
-
() => ({
|
|
576
|
-
el: "span",
|
|
577
|
-
variant: l.staticCategories ? "caption" : "body"
|
|
578
|
-
})
|
|
579
|
-
), I = () => {
|
|
580
|
-
e(K.SELECT_CATEGORY);
|
|
581
|
-
}, D = () => {
|
|
582
|
-
e(K.UNSELECT_CATEGORY);
|
|
583
|
-
}, { isAllSelected: f, isIndeterminate: C, toggleSelectAll: A } = de(
|
|
584
|
-
O,
|
|
585
|
-
h,
|
|
586
|
-
I,
|
|
587
|
-
D
|
|
588
|
-
), L = i(() => C.value ? "mixed" : `${f.value}`), y = T(f.value), w = () => {
|
|
589
|
-
y.value = !y.value, A(y.value);
|
|
590
|
-
};
|
|
591
|
-
return j(f, () => {
|
|
592
|
-
y.value = f.value;
|
|
593
|
-
}), {
|
|
594
|
-
// Values
|
|
595
|
-
chevronTitle: g,
|
|
596
|
-
conditionalClass: S,
|
|
597
|
-
hasAllPropsDisabled: n,
|
|
598
|
-
isOpen: t,
|
|
599
|
-
isAllSelected: f,
|
|
600
|
-
isIndeterminate: C,
|
|
601
|
-
isStaticCategory: d,
|
|
602
|
-
// Computed
|
|
603
|
-
showItemChildren: v,
|
|
604
|
-
categoryLabelProps: u,
|
|
605
|
-
ariaCheckedComputed: L,
|
|
606
|
-
// Methods
|
|
607
|
-
handleSelectAll: w,
|
|
608
|
-
toggleOpen: c,
|
|
609
|
-
toggleSelectAll: A
|
|
610
|
-
};
|
|
611
|
-
}
|
|
612
|
-
});
|
|
613
|
-
var ft = function() {
|
|
614
|
-
var e = this, t = e._self._c;
|
|
615
|
-
return e._self._setupProxy, t("div", [t("bento-listbox-option", { staticClass: "b-listbox-multi-select-category__option", class: e.conditionalClass, attrs: { tabindex: e.tabindex, "aria-checked": e.ariaCheckedComputed, "aria-disabled": e.hasAllPropsDisabled }, on: { click: e.handleSelectAll, "enter-pressed": e.handleSelectAll, "space-pressed": function(s) {
|
|
616
|
-
return s.preventDefault(), e.handleSelectAll.apply(null, arguments);
|
|
617
|
-
} } }, [e.isStaticCategory ? e._e() : t("listbox-decorative-checkbox", { attrs: { indeterminate: e.isIndeterminate, disabled: e.hasAllPropsDisabled, checked: e.isAllSelected } }), t("span", { staticClass: "b-listbox-multi-select-category__label" }, [t("bento-typography", e._b({ staticClass: "b-listbox-multi-select-category__label-text" }, "bento-typography", e.categoryLabelProps, !1), [e._v(" " + e._s(e.category.label) + " ")]), e.isStaticCategory ? e._e() : t("div", { staticClass: "b-listbox-multi-select-category__label-chevron", attrs: { "data-testid": "toggle-listbox" }, on: { "!click": function(s) {
|
|
618
|
-
return s.stopPropagation(), e.toggleOpen.apply(null, arguments);
|
|
619
|
-
} } }, [e.isOpen ? t("chevron-up-icon", { attrs: { "svg-title": e.chevronTitle } }) : t("chevron-down-icon", { attrs: { "svg-title": e.chevronTitle } })], 1)], 1)], 1), t("div", { directives: [{ name: "show", rawName: "v-show", value: e.showItemChildren, expression: "showItemChildren" }] }, [e._t("default")], 2)], 1);
|
|
620
|
-
}, bt = [], vt = /* @__PURE__ */ N(
|
|
621
|
-
dt,
|
|
622
|
-
ft,
|
|
623
|
-
bt,
|
|
624
|
-
!1,
|
|
625
|
-
null,
|
|
626
|
-
"8586f887"
|
|
627
|
-
);
|
|
628
|
-
const mt = vt.exports;
|
|
629
|
-
var F = /* @__PURE__ */ ((l) => (l.SELECT_CATEGORY = "select-category", l.TOGGLE_CHECKBOX_SELECTION = "toggle-checkbox-selection", l.UNSELECT_CATEGORY = "unselect-category", l))(F || {});
|
|
630
|
-
const _t = M({
|
|
631
|
-
name: "listbox-multi-select-options",
|
|
632
|
-
components: {
|
|
633
|
-
BentoListboxOption: H,
|
|
634
|
-
BentoTypography: Y,
|
|
635
|
-
ListboxMultiSelectCategory: mt,
|
|
636
|
-
ListboxDecorativeCheckbox: ee
|
|
637
|
-
},
|
|
638
|
-
props: {
|
|
639
|
-
/**
|
|
640
|
-
* Indicates if the items listed are inside a category
|
|
641
|
-
* so they can be padded to right by one level in recursion.
|
|
642
|
-
* Items of categories are automatically defined as "categoryItems"
|
|
643
|
-
*/
|
|
644
|
-
categoryItems: { type: Boolean, default: !1 },
|
|
645
|
-
/**
|
|
646
|
-
* Current focused option index
|
|
647
|
-
*/
|
|
648
|
-
focusedIndex: { type: Number, default: 0 },
|
|
649
|
-
/**
|
|
650
|
-
* Function that allows the options to be disabled
|
|
651
|
-
*
|
|
652
|
-
* @type {BentoListboxIsOptionDisabled}
|
|
653
|
-
* @param {BentoListboxOptionItem} option - listbox option object
|
|
654
|
-
* @param {string} option.label - Option's label text
|
|
655
|
-
* @param {string|number} option.value - Option's value
|
|
656
|
-
* @param {unknown} option.data - Option's extra data to be passed to the default slot
|
|
657
|
-
*/
|
|
658
|
-
isOptionDisabled: {
|
|
659
|
-
type: Function,
|
|
660
|
-
default: () => !1
|
|
661
|
-
},
|
|
662
|
-
/**
|
|
663
|
-
* The option elements to populate the listbox with.
|
|
664
|
-
* It must be an array of {@see BentoListboxOptionItem }.
|
|
665
|
-
*
|
|
666
|
-
* @property {string} value.label - Text to be displayed in the option
|
|
667
|
-
* @property {string,number} value.value - Value of the option
|
|
668
|
-
*/
|
|
669
|
-
items: {
|
|
670
|
-
type: Array,
|
|
671
|
-
required: !0
|
|
672
|
-
},
|
|
673
|
-
/**
|
|
674
|
-
* Indicates if the elements options are inside a multi-level category
|
|
675
|
-
*/
|
|
676
|
-
isMultiLevel: { type: Boolean, default: !1 },
|
|
677
|
-
/**
|
|
678
|
-
* Flag that indicates that an external search it's being made
|
|
679
|
-
* to filter out the items inside the the multi-select listbox
|
|
680
|
-
*
|
|
681
|
-
* If enabled, hides the "Select all" checkbox in "multiple" mode.
|
|
682
|
-
*/
|
|
683
|
-
searching: { type: Boolean, default: !1 },
|
|
684
|
-
/**
|
|
685
|
-
* List of selected items.
|
|
686
|
-
* Providing an empty array will select no options.
|
|
687
|
-
*/
|
|
688
|
-
selectedItemsList: {
|
|
689
|
-
type: Array,
|
|
690
|
-
default: () => []
|
|
691
|
-
},
|
|
692
|
-
/**
|
|
693
|
-
* If enabled, dropdown will display non-selectable, static categories
|
|
694
|
-
*/
|
|
695
|
-
staticCategories: { type: Boolean, default: !1 }
|
|
696
|
-
},
|
|
697
|
-
emits: [
|
|
698
|
-
F.TOGGLE_CHECKBOX_SELECTION,
|
|
699
|
-
F.SELECT_CATEGORY,
|
|
700
|
-
F.UNSELECT_CATEGORY
|
|
701
|
-
],
|
|
702
|
-
setup(l, { emit: e }) {
|
|
703
|
-
const t = (c) => {
|
|
704
|
-
l.isOptionDisabled(c) || e(F.TOGGLE_CHECKBOX_SELECTION, c);
|
|
705
|
-
}, s = (c) => !!c.items, o = (c) => {
|
|
706
|
-
const r = l.isMultiLevel && l.searching;
|
|
707
|
-
return c.description && (!l.isMultiLevel || r);
|
|
708
|
-
}, n = (c) => c.items ? !!c.items.find((r) => l.selectedItemsList.includes(r.value)) : l.selectedItemsList.includes(c.value), d = (c) => {
|
|
709
|
-
if (s(c)) {
|
|
710
|
-
const r = n(c) ? F.UNSELECT_CATEGORY : F.SELECT_CATEGORY;
|
|
711
|
-
e(r, c);
|
|
712
|
-
} else
|
|
713
|
-
t(c);
|
|
714
|
-
};
|
|
715
|
-
return {
|
|
716
|
-
// Values
|
|
717
|
-
conditionalClasses: i(() => ({
|
|
718
|
-
"b-listbox-multi-select-options__static-category-option": l.staticCategories,
|
|
719
|
-
"b-listbox-multi-select-options__category-option": l.categoryItems
|
|
720
|
-
})),
|
|
721
|
-
// Methods
|
|
722
|
-
isOptionSelected: n,
|
|
723
|
-
shouldShowDescription: o,
|
|
724
|
-
toggleCheckboxSelection: t,
|
|
725
|
-
toggleSearchOption: d,
|
|
726
|
-
computedTabindex: (c) => c + 1 === l.focusedIndex ? 0 : -1,
|
|
727
|
-
// Enums
|
|
728
|
-
BentoListboxEvent: a,
|
|
729
|
-
ListboxMultiSelectOptionsEvent: F
|
|
730
|
-
};
|
|
731
|
-
}
|
|
732
|
-
});
|
|
733
|
-
var pt = function() {
|
|
734
|
-
var e = this, t = e._self._c;
|
|
735
|
-
return e._self._setupProxy, t("div", e._l(e.items, function(s, o) {
|
|
736
|
-
return t("div", { key: `selected-${s.value}` }, [e.searching && e.isMultiLevel ? [t("bento-listbox-option", { staticClass: "b-listbox-multi-select-options", class: e.conditionalClasses, attrs: { disabled: e.isOptionDisabled ? e.isOptionDisabled(s) : null, tabindex: e.computedTabindex(o), "aria-checked": `${e.isOptionSelected(s)}`, "aria-disabled": e.isOptionDisabled ? e.isOptionDisabled(s) : null }, on: { click: function(n) {
|
|
737
|
-
return e.toggleSearchOption(s);
|
|
738
|
-
}, "enter-pressed": function(n) {
|
|
739
|
-
return e.toggleSearchOption(s);
|
|
740
|
-
}, "space-pressed": function(n) {
|
|
741
|
-
return n.preventDefault(), e.toggleSearchOption(s);
|
|
742
|
-
} } }, [t("listbox-decorative-checkbox", { attrs: { disabled: e.isOptionDisabled ? e.isOptionDisabled(s) : null, checked: e.isOptionSelected(s) } }), e._t("default", function() {
|
|
743
|
-
return [t("span", { staticClass: "b-listbox-multi-select__option-text" }, [t("bento-typography", { attrs: { el: "span" } }, [e._v(e._s(s.label))]), e.shouldShowDescription(s) ? t("bento-typography", { staticClass: "b-listbox-multi-select__option-description", attrs: { el: "span" } }, [e._v(" " + e._s(s.description) + " ")]) : e._e()], 1)];
|
|
744
|
-
}, null, s)], 2)] : [s.items ? [t("listbox-multi-select-category", { attrs: { category: s, "static-categories": e.staticCategories, "is-option-disabled": e.isOptionDisabled, "selected-items-list": e.selectedItemsList, tabindex: e.computedTabindex(o) }, on: { "select-category": function(n) {
|
|
745
|
-
return e.$emit(e.ListboxMultiSelectOptionsEvent.SELECT_CATEGORY, s);
|
|
746
|
-
}, "unselect-category": function(n) {
|
|
747
|
-
return e.$emit(e.ListboxMultiSelectOptionsEvent.UNSELECT_CATEGORY, s);
|
|
748
|
-
} } }, [t("listbox-multi-select-options", { attrs: { "category-items": "", items: s.items, "is-option-disabled": e.isOptionDisabled, "focused-index": e.focusedIndex, "is-multi-level": e.isMultiLevel, "static-categories": e.staticCategories, "selected-items-list": e.selectedItemsList, searching: e.searching }, on: { "toggle-checkbox-selection": (n) => e.toggleCheckboxSelection(n) } })], 1)] : t("bento-listbox-option", { staticClass: "b-listbox-multi-select-options", class: e.conditionalClasses, attrs: { disabled: e.isOptionDisabled ? e.isOptionDisabled(s) : null, tabindex: e.computedTabindex(o), "aria-checked": `${e.isOptionSelected(s)}`, "aria-disabled": e.isOptionDisabled ? e.isOptionDisabled(s) : null }, on: { click: function(n) {
|
|
749
|
-
return e.toggleCheckboxSelection(s);
|
|
750
|
-
}, "enter-pressed": function(n) {
|
|
751
|
-
return e.toggleCheckboxSelection(s);
|
|
752
|
-
}, "space-pressed": function(n) {
|
|
753
|
-
return n.preventDefault(), e.toggleCheckboxSelection(s);
|
|
754
|
-
} } }, [t("listbox-decorative-checkbox", { attrs: { disabled: e.isOptionDisabled ? e.isOptionDisabled(s) : null, checked: e.isOptionSelected(s) } }), e._t("default", function() {
|
|
755
|
-
return [t("span", { staticClass: "b-listbox-multi-select__option-text" }, [t("bento-typography", { attrs: { el: "span" } }, [e._v(e._s(s.label))]), e.shouldShowDescription(s) ? t("bento-typography", { staticClass: "b-listbox-multi-select__option-description", attrs: { el: "span" } }, [e._v(" " + e._s(s.description) + " ")]) : e._e()], 1)];
|
|
756
|
-
}, null, s)], 2)]], 2);
|
|
757
|
-
}), 0);
|
|
758
|
-
}, gt = [], yt = /* @__PURE__ */ N(
|
|
759
|
-
_t,
|
|
760
|
-
pt,
|
|
761
|
-
gt,
|
|
762
|
-
!1,
|
|
763
|
-
null,
|
|
764
|
-
"0f830765"
|
|
765
|
-
);
|
|
766
|
-
const ht = yt.exports, Ct = (l) => {
|
|
767
|
-
const e = i(() => {
|
|
768
|
-
var s;
|
|
769
|
-
return !!((s = l.value) != null && s.find(({ items: o }) => !!o));
|
|
770
|
-
}), t = i(() => {
|
|
771
|
-
var s;
|
|
772
|
-
return e.value ? (s = l.value) == null ? void 0 : s.reduce((o, n) => (n.items ? o.push(...n.items.flat()) : o.push(n), o), []) : l.value;
|
|
773
|
-
});
|
|
774
|
-
return {
|
|
775
|
-
isMultiLevelSelect: e,
|
|
776
|
-
flattenedItemsList: t
|
|
777
|
-
};
|
|
778
|
-
}, xt = {
|
|
779
|
-
"en-US": {
|
|
780
|
-
allSelected: "All selected ({total})",
|
|
781
|
-
numberOfTotalSelected: "{number} of {total} selected",
|
|
782
|
-
numbersSelected: "{number} selected",
|
|
783
|
-
selectAll: "Select all ({total})"
|
|
784
|
-
}
|
|
785
|
-
}, St = { i18n: { messages: xt } }, Et = /* @__PURE__ */ M({
|
|
786
|
-
...St,
|
|
787
|
-
__name: "listbox-multi-select",
|
|
788
|
-
props: {
|
|
789
|
-
hasMoreItems: { type: Boolean, default: !1 },
|
|
790
|
-
isOptionDisabled: { default: () => () => !1 },
|
|
791
|
-
items: null,
|
|
792
|
-
lazyLoadType: { default: "none" },
|
|
793
|
-
searching: { type: Boolean, default: !1 },
|
|
794
|
-
selectedValues: null,
|
|
795
|
-
staticCategories: { type: Boolean, default: !1 }
|
|
796
|
-
},
|
|
797
|
-
emits: ["select"],
|
|
798
|
-
setup(l, { emit: e }) {
|
|
799
|
-
const t = l, { t: s } = Z(), o = Se(), n = T(null), d = T(null), v = T(null), S = T(null), c = i(() => t.selectedValues.map(({ value: b }) => b)), { isMultiLevelSelect: r, flattenedItemsList: h } = Ct(G(t, "items")), O = (b) => {
|
|
800
|
-
var x;
|
|
801
|
-
const _ = t.isOptionDisabled(b), m = ((x = c.value) == null ? void 0 : x.includes(b.value)) || !1;
|
|
802
|
-
return { isDisabled: _, isPreSelected: m };
|
|
803
|
-
}, g = i(() => {
|
|
804
|
-
if (t.searching && r)
|
|
805
|
-
return t.items;
|
|
806
|
-
const b = h.value.filter((_) => {
|
|
807
|
-
const { isDisabled: m, isPreSelected: x } = O(_);
|
|
808
|
-
return m && x || !m;
|
|
809
|
-
});
|
|
810
|
-
return t.selectedValues.forEach((_) => {
|
|
811
|
-
b.find((m) => m.value === _.value) || b.push(_);
|
|
812
|
-
}), b;
|
|
813
|
-
}), u = i(
|
|
814
|
-
() => {
|
|
815
|
-
var b;
|
|
816
|
-
return (b = g.value) == null ? void 0 : b.filter((_) => {
|
|
817
|
-
var m;
|
|
818
|
-
return _.items && r.value && t.searching ? _.items.filter(
|
|
819
|
-
(p) => (t.selectedValues ?? []).includes(p.value)
|
|
820
|
-
).length === _.items.length : (m = c.value) == null ? void 0 : m.includes(_.value);
|
|
821
|
-
});
|
|
822
|
-
}
|
|
823
|
-
), I = () => r.value && !t.searching ? h.value.length : t.items.length, D = i(() => {
|
|
824
|
-
var x;
|
|
825
|
-
const b = g.value.length, _ = I(), m = ((x = u.value) == null ? void 0 : x.length) || 0;
|
|
826
|
-
return m === 0 ? s("selectAll", { total: b }) : m === _ ? s("allSelected", { total: _ }) : m <= _ ? s("numberOfTotalSelected", { number: m, total: _ }) : s("numbersSelected", { number: m });
|
|
827
|
-
}), f = (b) => {
|
|
828
|
-
const _ = (x) => {
|
|
829
|
-
const { isDisabled: p, isPreSelected: P } = O(x);
|
|
830
|
-
return p && P || !p;
|
|
831
|
-
}, m = b.filter(_).filter((x) => !c.value.includes(x.value));
|
|
832
|
-
e("select", [...t.selectedValues, ...m]);
|
|
833
|
-
}, C = (b) => {
|
|
834
|
-
const _ = (p) => {
|
|
835
|
-
const { isDisabled: P, isPreSelected: he } = O(p);
|
|
836
|
-
return !(P && he);
|
|
837
|
-
}, m = b.filter(_).map(({ value: p }) => p), x = t.selectedValues.filter((p) => !(m != null && m.includes(p.value)));
|
|
838
|
-
e("select", x);
|
|
839
|
-
}, A = () => {
|
|
840
|
-
f(h.value);
|
|
841
|
-
}, L = () => {
|
|
842
|
-
C(h.value);
|
|
843
|
-
}, { isAllSelected: y, isIndeterminate: w, toggleSelectAll: E } = de(
|
|
844
|
-
u,
|
|
845
|
-
g,
|
|
846
|
-
A,
|
|
847
|
-
L
|
|
848
|
-
), $ = i(() => w.value ? "mixed" : `${y.value}`), k = T(y.value), U = () => {
|
|
849
|
-
k.value = !k.value, E(k.value);
|
|
850
|
-
};
|
|
851
|
-
j(y, () => {
|
|
852
|
-
k.value = y.value;
|
|
853
|
-
});
|
|
854
|
-
const R = (b) => {
|
|
855
|
-
f(b.items);
|
|
856
|
-
}, W = (b) => {
|
|
857
|
-
C(b.items);
|
|
858
|
-
}, be = (b, _) => {
|
|
859
|
-
let m = !1;
|
|
860
|
-
const x = t.selectedValues.filter(({ value: p }) => _.value === p ? (m = !0, !1) : !0);
|
|
861
|
-
m || x.push(_), e(b, x);
|
|
862
|
-
}, ve = i(() => {
|
|
863
|
-
if (!r.value)
|
|
864
|
-
return t.selectedValues;
|
|
865
|
-
const b = (p) => c.value.includes(p.value), _ = (p) => !t.staticCategories && p.every((P) => b(P));
|
|
866
|
-
return t.items.flatMap(
|
|
867
|
-
(p) => p.items && !_(p.items) ? p.items : p
|
|
868
|
-
).filter((p) => p.items ? !0 : b(p));
|
|
869
|
-
}), me = i(() => {
|
|
870
|
-
var m, x, p, P;
|
|
871
|
-
const b = ["automatic", "button"].includes(t.lazyLoadType), _ = ((m = t.selectedValues) == null ? void 0 : m.length) > 0 && ((x = u.value) == null ? void 0 : x.length) !== ((p = h.value) == null ? void 0 : p.length);
|
|
872
|
-
return b && t.hasMoreItems ? !!((P = t.selectedValues) != null && P.length) : _;
|
|
873
|
-
}), _e = i(() => ["automatic", "button"].includes(t.lazyLoadType) ? !t.hasMoreItems : !0), te = i(() => ({ label: D, value: y })), se = i(() => [te, ...G(t, "items").value]), le = (b) => {
|
|
874
|
-
var m;
|
|
875
|
-
(m = Array.from(
|
|
876
|
-
n.value.querySelectorAll('[role="option"]')
|
|
877
|
-
).filter((x) => x.checkVisibility())[b]) == null || m.focus();
|
|
878
|
-
}, {
|
|
879
|
-
moveToNextElement: ne,
|
|
880
|
-
moveToPreviousElement: oe,
|
|
881
|
-
moveToFirstElement: ie,
|
|
882
|
-
moveToLastElement: ae,
|
|
883
|
-
preventDefault: V,
|
|
884
|
-
focusedIndex: pe
|
|
885
|
-
} = fe(
|
|
886
|
-
{
|
|
887
|
-
items: T(se),
|
|
888
|
-
hasStaticCategories: G(t, "staticCategories")
|
|
889
|
-
},
|
|
890
|
-
le
|
|
891
|
-
), ge = {
|
|
892
|
-
[B.ARROW_UP]: (b) => oe(b),
|
|
893
|
-
[B.ARROW_DOWN]: (b) => ne(b),
|
|
894
|
-
[B.HOME]: ie,
|
|
895
|
-
[B.END]: ae
|
|
896
|
-
}, ye = {
|
|
897
|
-
[B.ARROW_UP]: V,
|
|
898
|
-
[B.ARROW_DOWN]: V
|
|
899
|
-
};
|
|
900
|
-
return { __sfc: !0, props: t, emit: e, t: s, slots: o, listboxRef: n, selectAllListboxItemsRef: d, selectedListboxItemsRef: v, listboxItemsRef: S, selectedItemsList: c, isMultiLevelSelect: r, flattenedItemsList: h, optionStates: O, enabledItems: g, visibleSelectedList: u, calculateTotalItems: I, selectAllCheckboxText: D, selectAll: f, unselectAll: C, selectAllItems: A, unselectAllItems: L, isAllSelected: y, isIndeterminate: w, toggleSelectAll: E, ariaCheckedComputed: $, isSelectAllOn: k, handleSelectAll: U, selectAllCategory: R, unselectAllCategory: W, toggleCheckboxSelection: be, selectedOptions: ve, showSelectedItems: me, showSelectAllCheckbox: _e, computedselectAllItemRefs: te, computedItems: se, focusItem: le, moveToNextElement: ne, moveToPreviousElement: oe, moveToFirstElement: ie, moveToLastElement: ae, preventDefault: V, focusedIndex: pe, listboxListeners: ge, chipsSectionListeners: ye, ListboxDecorativeCheckbox: ee, BentoTypography: Y, BentoChip: Ae, BentoListboxOption: H, ListboxMultiSelectOptions: ht, vBentoKeyboardNavigationDirective: Q, BentoListboxEvent: a };
|
|
901
|
-
}
|
|
902
|
-
});
|
|
903
|
-
var Ot = function() {
|
|
904
|
-
var e = this, t = e._self._c, s = e._self._setupProxy;
|
|
905
|
-
return t("div", { ref: "listboxRef", staticClass: "b-listbox-multi-select" }, [s.showSelectedItems ? t("div", [t("ul", e._g({ directives: [{ name: "bento-keyboard-navigation-directive", rawName: "v-bento-keyboard-navigation-directive" }], staticClass: "b-listbox-multi-select__chips" }, s.chipsSectionListeners), e._l(s.selectedOptions, function(o) {
|
|
906
|
-
return t("li", { key: o.value }, [t(s.BentoChip, { ref: "selectedListboxItemsRef", refInFor: !0, attrs: { disabled: e.isOptionDisabled(o), label: o.label, condensed: "" }, on: { click: function(n) {
|
|
907
|
-
o.items ? s.unselectAllCategory(o) : s.toggleCheckboxSelection("select", o);
|
|
908
|
-
} } })], 1);
|
|
909
|
-
}), 0), t("hr", { staticClass: "b-listbox-multi-select__divider" })]) : e._e(), t("div", e._g({ directives: [{ name: "bento-keyboard-navigation-directive", rawName: "v-bento-keyboard-navigation-directive" }] }, s.listboxListeners), [s.showSelectAllCheckbox ? t(s.BentoListboxOption, { ref: "selectAllListboxItemsRef", staticClass: "b-listbox-multi-select__option", attrs: { tabindex: s.focusedIndex === 0 ? 0 : -1, "aria-checked": s.ariaCheckedComputed }, on: { click: s.handleSelectAll, "enter-pressed": s.handleSelectAll, "space-pressed": function(o) {
|
|
910
|
-
return o.preventDefault(), s.handleSelectAll.apply(null, arguments);
|
|
911
|
-
} } }, [t(s.ListboxDecorativeCheckbox, { attrs: { checked: s.isAllSelected, indeterminate: s.isIndeterminate } }), t(s.BentoTypography, { attrs: { el: "span" } }, [e._v(" " + e._s(s.selectAllCheckboxText) + " ")])], 1) : e._e(), s.showSelectAllCheckbox ? t("hr", { staticClass: "b-listbox-multi-select__divider" }) : e._e(), t(s.ListboxMultiSelectOptions, { ref: "listboxItemsRef", attrs: { items: e.items, "is-option-disabled": e.isOptionDisabled, "is-multi-level": s.isMultiLevelSelect, "static-categories": e.staticCategories, searching: e.searching, "selected-items-list": s.selectedItemsList, "focused-index": s.focusedIndex }, on: { "toggle-checkbox-selection": function(o) {
|
|
912
|
-
return s.toggleCheckboxSelection("select", o);
|
|
913
|
-
}, "select-category": s.selectAllCategory, "unselect-category": s.unselectAllCategory, "space-pressed": function(o) {
|
|
914
|
-
return s.toggleCheckboxSelection(s.BentoListboxEvent.SPACE, o);
|
|
915
|
-
}, "tab-pressed": function(o) {
|
|
916
|
-
return s.toggleCheckboxSelection(s.BentoListboxEvent.TAB, o);
|
|
917
|
-
}, "enter-pressed": function(o) {
|
|
918
|
-
return s.toggleCheckboxSelection(s.BentoListboxEvent.ENTER, o);
|
|
919
|
-
} }, scopedSlots: e._u([e._l(s.slots, function(o, n) {
|
|
920
|
-
return { key: n, fn: function(d) {
|
|
921
|
-
return [e._t(n, null, null, d)];
|
|
922
|
-
} };
|
|
923
|
-
})], null, !0) })], 1)]);
|
|
924
|
-
}, Tt = [], At = /* @__PURE__ */ N(
|
|
925
|
-
Et,
|
|
926
|
-
Ot,
|
|
927
|
-
Tt,
|
|
928
|
-
!1,
|
|
929
|
-
null,
|
|
930
|
-
"9645b94f"
|
|
931
|
-
);
|
|
932
|
-
const ue = At.exports, Lt = {
|
|
933
|
-
"en-US": {
|
|
934
|
-
loading: "Loading",
|
|
935
|
-
showMore: "Show more"
|
|
936
|
-
},
|
|
937
|
-
"ja-JP": {
|
|
938
|
-
loading: "読み込み中",
|
|
939
|
-
showMore: "表示内容を増やす"
|
|
940
|
-
},
|
|
941
|
-
"pt-BR": {
|
|
942
|
-
loading: "Carregando",
|
|
943
|
-
showMore: "Mostrar mais"
|
|
944
|
-
}
|
|
945
|
-
}, It = 36, kt = M({
|
|
946
|
-
name: "bento-listbox",
|
|
947
|
-
components: {
|
|
948
|
-
BentoEmptyState: Oe,
|
|
949
|
-
BentoListboxSingleSelect: nt,
|
|
950
|
-
BentoListboxMultiSelect: ue,
|
|
951
|
-
BentoTypography: Y,
|
|
952
|
-
BentoLoadingIndicator: Ee,
|
|
953
|
-
BentoLoadingButton: De
|
|
954
|
-
},
|
|
955
|
-
directives: { BentoKeyboardNavigationDirective: Q },
|
|
956
|
-
i18n: { messages: Lt },
|
|
957
|
-
props: {
|
|
958
|
-
/**
|
|
959
|
-
* Defines a string value that labels an interactive element.
|
|
960
|
-
*/
|
|
961
|
-
ariaLabel: { type: String, default: null },
|
|
962
|
-
/**
|
|
963
|
-
* Empty state props that will be used with the inner empty state component to be displayed when no search results are found.
|
|
964
|
-
*/
|
|
965
|
-
emptyState: {
|
|
966
|
-
type: Object,
|
|
967
|
-
default: void 0
|
|
968
|
-
},
|
|
969
|
-
/**
|
|
970
|
-
* Indicates whether there are more items to load
|
|
971
|
-
*/
|
|
972
|
-
hasMoreItems: { type: Boolean, default: !1 },
|
|
973
|
-
/**
|
|
974
|
-
* Identifies the listbox whose contents are controlled by the the combobox on which the aria-controls attribute is set.
|
|
975
|
-
*/
|
|
976
|
-
id: { type: String, required: !0 },
|
|
977
|
-
/**
|
|
978
|
-
* Function that allows the options to be disabled
|
|
979
|
-
*
|
|
980
|
-
* @type {BentoListboxIsOptionDisabled}
|
|
981
|
-
* @param {BentoListboxOptionItem} option - Listbox option object
|
|
982
|
-
* @param {string} option.label - Option's label text
|
|
983
|
-
* @param {string|number} option.value - Option's value
|
|
984
|
-
* @param {unknown} option.data - Option's extra data to be passed to the default slot
|
|
985
|
-
*/
|
|
986
|
-
isOptionDisabled: {
|
|
987
|
-
type: Function,
|
|
988
|
-
default: () => {
|
|
989
|
-
}
|
|
990
|
-
},
|
|
991
|
-
/**
|
|
992
|
-
* The option elements to populate the listbox with.
|
|
993
|
-
* It must be an array of {@see BentoListboxOptionItem }
|
|
994
|
-
* * @property {string} value.label - Text to be displayed in the option
|
|
995
|
-
* * @property {string,number} value.value - Value of the option
|
|
996
|
-
*/
|
|
997
|
-
items: {
|
|
998
|
-
type: Array,
|
|
999
|
-
required: !0
|
|
1000
|
-
},
|
|
1001
|
-
/**
|
|
1002
|
-
* Indicates if new options are lazy loading.
|
|
1003
|
-
*/
|
|
1004
|
-
loading: { type: Boolean, default: !1 },
|
|
1005
|
-
/**
|
|
1006
|
-
* The type of `Lazy Load`.
|
|
1007
|
-
* Type "automatic" will enable infinite scrolling
|
|
1008
|
-
* Type "button" will enable lazy loading with "Show more" button
|
|
1009
|
-
*/
|
|
1010
|
-
lazyLoadType: {
|
|
1011
|
-
type: String,
|
|
1012
|
-
default: z.NONE,
|
|
1013
|
-
validator: (l) => Object.values(z).includes(l)
|
|
1014
|
-
},
|
|
1015
|
-
/**
|
|
1016
|
-
* Indicates the listbox is loading filtered items.
|
|
1017
|
-
*/
|
|
1018
|
-
componentLoading: { type: Boolean, default: !1 },
|
|
1019
|
-
/**
|
|
1020
|
-
* If enabled, the user will be able to select multiple items.
|
|
1021
|
-
*/
|
|
1022
|
-
multiple: { type: Boolean, default: !1 },
|
|
1023
|
-
/**
|
|
1024
|
-
* If enabled, dropdown will display non-selectable, static categories
|
|
1025
|
-
*/
|
|
1026
|
-
staticCategories: { type: Boolean, default: !1 },
|
|
1027
|
-
/**
|
|
1028
|
-
* Messaged displayed when no items are listed in the listbox
|
|
1029
|
-
*/
|
|
1030
|
-
noResultsMessage: { type: String, required: !0 },
|
|
1031
|
-
/**
|
|
1032
|
-
* Flag that indicates that an external search it's being made
|
|
1033
|
-
* to filter out the items inside the the multi-select listbox
|
|
1034
|
-
*
|
|
1035
|
-
* If enabled, hides the "Select all" checkbox in "multiple" mode.
|
|
1036
|
-
*/
|
|
1037
|
-
searching: ue.props.searching,
|
|
1038
|
-
/**
|
|
1039
|
-
* The `input` value.
|
|
1040
|
-
* Providing an empty string or empty array will select no options.
|
|
1041
|
-
* Set to an empty string `''` if you don't want any of the available options to be selected for single select
|
|
1042
|
-
*/
|
|
1043
|
-
selectedValue: {
|
|
1044
|
-
type: Array,
|
|
1045
|
-
default: () => []
|
|
1046
|
-
},
|
|
1047
|
-
/**
|
|
1048
|
-
* Enables virtual scrolling if set to true or by providing an object with itemHeight function.
|
|
1049
|
-
* The itemHeight function is used to calculate the height of rendered item given it's index.
|
|
1050
|
-
*/
|
|
1051
|
-
virtualScroll: {
|
|
1052
|
-
type: [Boolean, Object],
|
|
1053
|
-
default: !1
|
|
1054
|
-
}
|
|
1055
|
-
},
|
|
1056
|
-
emits: [
|
|
1057
|
-
a.SELECT,
|
|
1058
|
-
a.SPACE,
|
|
1059
|
-
a.SHOW_MORE,
|
|
1060
|
-
a.ENTER,
|
|
1061
|
-
a.ESCAPE,
|
|
1062
|
-
a.TAB
|
|
1063
|
-
],
|
|
1064
|
-
setup(l, { emit: e, slots: t }) {
|
|
1065
|
-
const s = T([]), o = G(l, "items"), { t: n } = Z(), d = i(() => l.lazyLoadType !== z.AUTOMATIC), v = i(() => l.lazyLoadType === z.AUTOMATIC), S = () => {
|
|
1066
|
-
var R;
|
|
1067
|
-
return typeof (l == null ? void 0 : l.virtualScroll) == "object" && ((R = l == null ? void 0 : l.virtualScroll) != null && R.itemHeight) ? l.virtualScroll.itemHeight : It;
|
|
1068
|
-
}, {
|
|
1069
|
-
containerRef: c,
|
|
1070
|
-
containerProps: r,
|
|
1071
|
-
onScroll: h,
|
|
1072
|
-
list: O,
|
|
1073
|
-
wrapperProps: g
|
|
1074
|
-
} = $e(o, {
|
|
1075
|
-
itemHeight: S(),
|
|
1076
|
-
// Disable virtual scrolling if not enabled or if lazy loading is enabled or if multi-select
|
|
1077
|
-
disabled: (l == null ? void 0 : l.multiple) || (l == null ? void 0 : l.virtualScroll) === !1 || (l == null ? void 0 : l.lazyLoadType) !== "none"
|
|
1078
|
-
}), u = i(
|
|
1079
|
-
() => l.componentLoading !== void 0 || d.value ? "true" : void 0
|
|
1080
|
-
), I = i(
|
|
1081
|
-
() => d.value && l.loading || l.componentLoading ? "true" : "false"
|
|
1082
|
-
), D = i(
|
|
1083
|
-
() => d.value || l.componentLoading !== void 0 ? "polite" : void 0
|
|
1084
|
-
), f = (R) => (W) => {
|
|
1085
|
-
e(R, W);
|
|
1086
|
-
}, C = () => {
|
|
1087
|
-
e(a.SHOW_MORE);
|
|
1088
|
-
}, A = Te(() => {
|
|
1089
|
-
const R = c.value;
|
|
1090
|
-
if (!R)
|
|
1091
|
-
return;
|
|
1092
|
-
const W = Math.round(R.scrollTop) + R.clientHeight >= R.scrollHeight;
|
|
1093
|
-
l.hasMoreItems && W && !l.loading && C();
|
|
1094
|
-
}), L = () => {
|
|
1095
|
-
v.value ? A() : h();
|
|
1096
|
-
}, y = i(() => {
|
|
1097
|
-
var R;
|
|
1098
|
-
return ((R = l.items) == null ? void 0 : R.length) === 0;
|
|
1099
|
-
}), w = i(
|
|
1100
|
-
() => l.lazyLoadType === z.BUTTON && l.hasMoreItems
|
|
1101
|
-
), E = i(
|
|
1102
|
-
() => l.loading ? ce.LOADING : ce.START
|
|
1103
|
-
), $ = i(() => l.loading ? n("loading") : n("showMore")), k = i(() => ({
|
|
1104
|
-
...l.emptyState,
|
|
1105
|
-
variant: "condensed"
|
|
1106
|
-
})), U = {
|
|
1107
|
-
[a.SELECT]: f(a.SELECT),
|
|
1108
|
-
[a.SPACE]: f(a.SPACE),
|
|
1109
|
-
[a.TAB]: f(a.TAB),
|
|
1110
|
-
[a.ENTER]: f(a.ENTER)
|
|
1111
|
-
};
|
|
1112
|
-
return {
|
|
1113
|
-
// Refs
|
|
1114
|
-
listboxRef: c,
|
|
1115
|
-
listboxItemRef: s,
|
|
1116
|
-
// a11y
|
|
1117
|
-
ariaAtomic: u,
|
|
1118
|
-
ariaBusy: I,
|
|
1119
|
-
ariaLive: D,
|
|
1120
|
-
// Values
|
|
1121
|
-
containerProps: r,
|
|
1122
|
-
isSearchResultEmpty: y,
|
|
1123
|
-
limitedEmptyStateProps: k,
|
|
1124
|
-
loadingButtonState: E,
|
|
1125
|
-
slots: t,
|
|
1126
|
-
shouldDisplayShowMoreButton: w,
|
|
1127
|
-
showMoreButtonText: $,
|
|
1128
|
-
virtualisedItems: O,
|
|
1129
|
-
wrapperProps: g,
|
|
1130
|
-
// Enums
|
|
1131
|
-
BentoKeyboardNavigationKeyDownEvent: B,
|
|
1132
|
-
BentoListboxEvent: a,
|
|
1133
|
-
// Methods
|
|
1134
|
-
onListboxContainerScroll: L,
|
|
1135
|
-
onOptionSelected: f,
|
|
1136
|
-
emitShowMore: C,
|
|
1137
|
-
listboxListeners: U
|
|
1138
|
-
};
|
|
1139
|
-
}
|
|
1140
|
-
});
|
|
1141
|
-
var Rt = function() {
|
|
1142
|
-
var s;
|
|
1143
|
-
var e = this, t = e._self._c;
|
|
1144
|
-
return e._self._setupProxy, t("div", { directives: [{ name: "bento-keyboard-navigation-directive", rawName: "v-bento-keyboard-navigation-directive" }], ref: "listboxRef", staticClass: "b-listbox", style: (s = e.containerProps) == null ? void 0 : s.style, attrs: { id: e.id, role: "listbox", tabindex: "-1", "aria-busy": e.ariaBusy, "aria-atomic": e.ariaAtomic, "aria-label": e.ariaLabel, "aria-live": e.ariaLive }, on: { scroll: e.onListboxContainerScroll } }, [t("div", e._b({}, "div", e.wrapperProps, !1), [e.componentLoading ? t("div", { staticClass: "b-listbox__loading-filtered-items" }, [t("bento-loading-indicator")], 1) : e.isSearchResultEmpty ? t("div", { staticClass: "b-listbox__empty-search-message" }, [e.emptyState ? t("bento-empty-state", e._b({}, "bento-empty-state", e.limitedEmptyStateProps, !1)) : t("bento-typography", { attrs: { el: "span" } }, [e._v(e._s(e.noResultsMessage))])], 1) : [e.multiple ? [t("bento-listbox-multi-select", e._g({ ref: "listboxItemRef", attrs: { "has-more-items": e.hasMoreItems, items: e.items, "lazy-load-type": e.lazyLoadType, "static-categories": e.staticCategories, "selected-values": e.selectedValue, searching: e.searching, "is-option-disabled": e.isOptionDisabled }, scopedSlots: e._u([e._l(e.slots, function(o, n) {
|
|
1145
|
-
return { key: n, fn: function(d) {
|
|
1146
|
-
return [e._t(n, null, null, d)];
|
|
1147
|
-
} };
|
|
1148
|
-
})], null, !0) }, e.listboxListeners))] : [t("bento-listbox-single-select", e._g({ ref: "listboxItemRef", attrs: { items: e.virtualisedItems, "selected-value": e.selectedValue, "static-categories": e.staticCategories, "is-option-disabled": e.isOptionDisabled }, scopedSlots: e._u([e._l(e.slots, function(o, n) {
|
|
1149
|
-
return { key: n, fn: function(d) {
|
|
1150
|
-
return [e._t(n, null, null, d)];
|
|
1151
|
-
} };
|
|
1152
|
-
})], null, !0) }, e.listboxListeners))], e.shouldDisplayShowMoreButton ? t("div", { staticClass: "b-listbox__lazy-load" }, [t("bento-loading-button", { attrs: { state: e.loadingButtonState, variant: "secondary" }, on: { "!click": function(o) {
|
|
1153
|
-
return e.emitShowMore.apply(null, arguments);
|
|
1154
|
-
} } }, [e._v(" " + e._s(e.showMoreButtonText) + " ")])], 1) : e.loading ? t("div", { staticClass: "b-listbox__lazy-load" }, [t("bento-loading-indicator")], 1) : e._e()]], 2)]);
|
|
1155
|
-
}, Dt = [], Bt = /* @__PURE__ */ N(
|
|
1156
|
-
kt,
|
|
1157
|
-
Rt,
|
|
1158
|
-
Dt,
|
|
1159
|
-
!1,
|
|
1160
|
-
null,
|
|
1161
|
-
"37a9ab16"
|
|
1162
|
-
);
|
|
1163
|
-
const Zt = Bt.exports, J = (l, e) => {
|
|
1164
|
-
for (const t of l) {
|
|
1165
|
-
if (t.value === e)
|
|
1166
|
-
return t;
|
|
1167
|
-
if (t.items) {
|
|
1168
|
-
const s = J(t.items, e);
|
|
1169
|
-
if (s)
|
|
1170
|
-
return s;
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
return null;
|
|
1174
|
-
}, $t = (l) => typeof l == "object" && l !== null && "value" in l && "label" in l, Qt = (l, e, t, s) => {
|
|
1175
|
-
const o = T([]), n = T(), d = (r) => {
|
|
1176
|
-
t.value ? n.value = r.map(({ value: h }) => h) : n.value = r.length > 0 ? r[0].value : null;
|
|
1177
|
-
}, v = (r) => {
|
|
1178
|
-
t.value ? n.value = r.map(({ value: h, label: O }) => ({ value: h, label: O })) : n.value = r.length > 0 ? { value: r[0].value, label: r[0].label } : null;
|
|
1179
|
-
}, S = (r) => {
|
|
1180
|
-
o.value = r, s != null && s.value ? v(r) : d(r);
|
|
1181
|
-
}, c = () => {
|
|
1182
|
-
o.value = [], n.value = null;
|
|
1183
|
-
};
|
|
1184
|
-
return j(
|
|
1185
|
-
() => e.value,
|
|
1186
|
-
() => {
|
|
1187
|
-
if (!e.value && e.value !== 0) {
|
|
1188
|
-
c();
|
|
1189
|
-
return;
|
|
1190
|
-
}
|
|
1191
|
-
const r = !Array.isArray(e.value), h = [...o.value];
|
|
1192
|
-
c();
|
|
1193
|
-
const O = (g) => {
|
|
1194
|
-
if ($t(g))
|
|
1195
|
-
o.value.push(g);
|
|
1196
|
-
else {
|
|
1197
|
-
let u = J(l.value, g);
|
|
1198
|
-
u || (u = J(h, g)), u || (u = { value: g, label: g.toString() }), o.value.push(u);
|
|
1199
|
-
}
|
|
1200
|
-
};
|
|
1201
|
-
if (r) {
|
|
1202
|
-
const g = e.value;
|
|
1203
|
-
O(g), s != null && s.value ? v(o.value) : d(o.value);
|
|
1204
|
-
return;
|
|
1205
|
-
}
|
|
1206
|
-
e.value.forEach(O), s != null && s.value ? v(o.value) : d(o.value);
|
|
1207
|
-
},
|
|
1208
|
-
{ immediate: !0 }
|
|
1209
|
-
), {
|
|
1210
|
-
// Values
|
|
1211
|
-
cachedSelectedListboxOptions: o,
|
|
1212
|
-
cachedListboxSelectedValues: n,
|
|
1213
|
-
// Methods
|
|
1214
|
-
resetCache: c,
|
|
1215
|
-
setCachedValues: S
|
|
1216
|
-
};
|
|
1217
|
-
};
|
|
1218
|
-
export {
|
|
1219
|
-
z as B,
|
|
1220
|
-
a,
|
|
1221
|
-
Zt as b,
|
|
1222
|
-
Qt as c,
|
|
1223
|
-
Ct as u
|
|
1224
|
-
};
|
|
1225
|
-
//# sourceMappingURL=use-cached-selected-values.CDBmVxYM.js.map
|