@adyen/bento-vue3 1.6.1 → 1.7.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/components.d.ts +2 -0
- package/dist/@types/packages/core/src/components/button/button.types.d.ts +3 -1
- package/dist/@types/packages/vue2/src/components/action-bar/action-bar.vue.d.ts +45 -0
- package/dist/@types/packages/vue2/src/components/action-bar/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/alert/alert.vue.d.ts +4 -4
- package/dist/@types/packages/vue2/src/components/avatar-image/avatar-image.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/button/button.vue.d.ts +229 -220
- package/dist/@types/packages/vue2/src/components/button/components/button-actions/button-actions.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/button/components/loading-button/loading-button.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/checkbox/checkbox.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/checkbox/components/checkbox-group/checkbox-group.vue.d.ts +5 -5
- package/dist/@types/packages/vue2/src/components/code-snippet/code-snippet.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/country/country.vue.d.ts +4 -3
- package/dist/@types/packages/vue2/src/components/data-grid/data-grid.vue.d.ts +44 -46
- package/dist/@types/packages/vue2/src/components/date/date.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/date-picker/date-picker.vue.d.ts +8 -2
- package/dist/@types/packages/vue2/src/components/date-range-picker/components/date-range-picker-calendar/date-range-picker-calendar.vue.d.ts +6 -0
- package/dist/@types/packages/vue2/src/components/date-range-picker/date-range-picker.vue.d.ts +8 -2
- package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-base-textbox/dropdown-base-textbox.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-default-textbox/dropdown-default-textbox.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-options-container/dropdown-options-container.vue.d.ts +46 -28
- package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-small-textbox/dropdown-small-textbox.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/dropdown/dropdown.types.d.ts +2 -0
- package/dist/@types/packages/vue2/src/components/dropdown/dropdown.vue.d.ts +22 -4
- package/dist/@types/packages/vue2/src/components/empty-state/empty-state.vue.d.ts +5 -2
- package/dist/@types/packages/vue2/src/components/filter-bar/components/all-filters-modal/all-filters-modal.vue.d.ts +802 -52
- package/dist/@types/packages/vue2/src/components/filter-bar/components/boolean-filter/boolean-filter.vue.d.ts +12 -5
- package/dist/@types/packages/vue2/src/components/filter-bar/components/filter-bar-button/filter-bar-button.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/filter-bar/filter-bar.types.d.ts +12 -2
- package/dist/@types/packages/vue2/src/components/filter-bar/filter-bar.vue.d.ts +10 -0
- package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-field-tip/form-layout-field-tip.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/header/header.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/info-icon/info-icon.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/input-field/input-field.vue.d.ts +2 -2
- package/dist/@types/packages/vue2/src/components/internal/button-actions-with-menu/button-actions-with-menu.vue.d.ts +21 -0
- package/dist/@types/packages/vue2/src/components/internal/calendar/calendar.vue.d.ts +6 -0
- package/dist/@types/packages/vue2/src/components/internal/calendar/components/calendar-month/calendar-month.vue.d.ts +19 -0
- package/dist/@types/packages/vue2/src/components/internal/controls-group/controls-group.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/internal/fixed-scroller/fixed-scroller.vue.d.ts +22 -1
- package/dist/@types/packages/vue2/src/components/internal/listbox/listbox.vue.d.ts +64 -7
- package/dist/@types/packages/vue2/src/components/internal/teleport/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/internal/teleport/teleport.vue.d.ts +50 -0
- package/dist/@types/packages/vue2/src/components/link/link.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/menu/menu.keys.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/menu/menu.vue.d.ts +15 -11
- package/dist/@types/packages/vue2/src/components/pagination/components/pagination-context/pagination-context.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/pagination/pagination.vue.d.ts +10 -1
- package/dist/@types/packages/vue2/src/components/payment-method/payment-method.vue.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/popover/popover.vue.d.ts +4 -4
- package/dist/@types/packages/vue2/src/components/popper-container/popper-container.vue.d.ts +5 -5
- package/dist/@types/packages/vue2/src/components/radio-group/radio-group.vue.d.ts +10 -5
- package/dist/@types/packages/vue2/src/components/segmented-control/components/segmented-control-button/segmented-control-button.vue.d.ts +21 -0
- package/dist/@types/packages/vue2/src/components/segmented-control/segmented-control.vue.d.ts +21 -5
- package/dist/@types/packages/vue2/src/components/stepper/stepper.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/structured-list/components/structered-list-item/structured-list-item.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/summary-grid/components/summary-grid-item/summary-grid-item.vue.d.ts +1 -2
- package/dist/@types/packages/vue2/src/components/summary-grid/components/summary-grid-item-amount/summary-grid-item-amount.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/summary-grid/summary-grid.keys.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/summary-grid/summary-grid.types.d.ts +3 -0
- package/dist/@types/packages/vue2/src/components/tabs/components/tab.types.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/tabs/components/tab.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/tabs/tabs.types.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/tabs/tabs.vue.d.ts +2 -0
- package/dist/@types/packages/vue2/src/components/textarea/textarea.vue.d.ts +5 -5
- package/dist/@types/packages/vue2/src/components/timeline/components/timeline-item/timeline-item.vue.d.ts +7 -4
- package/dist/@types/packages/vue2/src/components/timeline/timeline.types.d.ts +9 -2
- package/dist/@types/packages/vue2/src/components/tooltip/tooltip.vue.d.ts +15 -15
- package/dist/@types/packages/vue2/src/components/tutorial/components/tutorial-popover/components/tutorial-indicator/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/tutorial/components/tutorial-popover/components/tutorial-indicator/tutorial-indicator.vue.d.ts +12 -0
- package/dist/@types/packages/vue2/src/components/tutorial/components/tutorial-popover/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/tutorial/components/tutorial-popover/tutorial-popover.vue.d.ts +173 -0
- package/dist/@types/packages/vue2/src/components/tutorial/index.d.ts +2 -0
- package/dist/@types/packages/vue2/src/components/tutorial/tutorial.types.d.ts +13 -0
- package/dist/@types/packages/vue2/src/components/tutorial/tutorial.vue.d.ts +16 -0
- package/dist/@types/packages/vue2/src/composables/index.d.ts +5 -2
- package/dist/@types/packages/vue2/src/composables/use-click-outside/use-click-outside.d.ts +3 -0
- package/dist/@types/packages/vue2/src/composables/use-form-validate/index.d.ts +2 -0
- package/dist/@types/packages/vue2/src/composables/use-form-validate/use-form.d.ts +12 -0
- package/dist/@types/packages/vue2/src/composables/use-form-validate/use-form.types.d.ts +5 -0
- package/dist/@types/packages/vue2/src/composables/use-virtual-list/index.d.ts +2 -0
- package/dist/@types/packages/vue2/src/composables/use-virtual-list/use-virtual-list.d.ts +15 -0
- package/dist/@types/packages/vue2/src/composables/use-virtual-list/use-virtual-list.types.d.ts +20 -0
- package/dist/@types/packages/vue2/src/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/templates/data-grid-template/data-grid-template.vue.d.ts +4 -4
- package/dist/@types/packages/vue2/src/types/listbox.d.ts +12 -0
- package/dist/accordion.js +52 -43
- package/dist/accordion.js.map +1 -1
- package/dist/action-bar.js +210 -0
- package/dist/action-bar.js.map +1 -0
- package/dist/alert.js +3 -3
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/button-actions-with-menu.css +1 -0
- package/dist/assets/button.css +1 -1
- package/dist/assets/calendar.css +1 -1
- package/dist/assets/checkbox.css +1 -1
- package/dist/assets/checkmark.css +1 -0
- package/dist/assets/chevron-left.css +1 -0
- package/dist/assets/dropdown-default-textbox.css +1 -1
- package/dist/assets/dropdown.css +1 -1
- package/dist/assets/fixed-scroller.css +1 -0
- package/dist/assets/index.css +1 -1
- package/dist/assets/index10.css +1 -1
- package/dist/assets/index11.css +1 -1
- package/dist/assets/index12.css +1 -1
- package/dist/assets/index13.css +1 -1
- package/dist/assets/index14.css +1 -1
- package/dist/assets/index15.css +1 -1
- package/dist/assets/index16.css +1 -1
- package/dist/assets/index17.css +1 -1
- package/dist/assets/index18.css +1 -1
- package/dist/assets/index19.css +1 -1
- package/dist/assets/index2.css +1 -1
- package/dist/assets/index20.css +1 -1
- package/dist/assets/index21.css +1 -1
- package/dist/assets/index22.css +1 -1
- package/dist/assets/index23.css +1 -1
- package/dist/assets/index24.css +1 -1
- package/dist/assets/index25.css +1 -1
- package/dist/assets/index26.css +1 -1
- package/dist/assets/index27.css +1 -1
- package/dist/assets/index28.css +1 -1
- package/dist/assets/index29.css +1 -1
- package/dist/assets/index3.css +1 -1
- package/dist/assets/index30.css +1 -1
- package/dist/assets/index31.css +1 -1
- package/dist/assets/index32.css +1 -1
- package/dist/assets/index33.css +1 -1
- package/dist/assets/index34.css +1 -1
- package/dist/assets/index35.css +1 -1
- package/dist/assets/index36.css +1 -1
- package/dist/assets/index37.css +1 -1
- package/dist/assets/index38.css +1 -1
- package/dist/assets/index39.css +1 -1
- package/dist/assets/index40.css +1 -1
- package/dist/assets/index41.css +1 -1
- package/dist/assets/index42.css +1 -1
- package/dist/assets/index43.css +1 -1
- package/dist/assets/index44.css +1 -1
- package/dist/assets/index45.css +1 -1
- package/dist/assets/index46.css +1 -0
- package/dist/assets/index5.css +1 -1
- package/dist/assets/index6.css +1 -1
- package/dist/assets/index7.css +1 -1
- package/dist/assets/index8.css +1 -1
- package/dist/assets/index9.css +1 -1
- package/dist/assets/listbox.css +1 -1
- package/dist/assets/refresh.css +1 -0
- package/dist/avatar-image.js +1 -1
- package/dist/badge.js +1 -1
- package/dist/button.js +30 -22
- package/dist/button.js.map +1 -1
- package/dist/card.js +84 -84
- package/dist/card.js.map +1 -1
- package/dist/checkbox.js +6 -6
- package/dist/chunks/{base-button.4b5ab17e.js → base-button.7897a95e.js} +2 -2
- package/dist/chunks/{base-button.4b5ab17e.js.map → base-button.7897a95e.js.map} +1 -1
- package/dist/chunks/{base-modal.53a229ac.js → base-modal.0c85e7cb.js} +4 -4
- package/dist/chunks/{base-modal.53a229ac.js.map → base-modal.0c85e7cb.js.map} +1 -1
- package/dist/chunks/button-actions-with-menu.fa35390c.js +107 -0
- package/dist/chunks/button-actions-with-menu.fa35390c.js.map +1 -0
- package/dist/chunks/{button.975d0bb8.js → button.e5177388.js} +44 -36
- package/dist/chunks/button.e5177388.js.map +1 -0
- package/dist/chunks/{calendar.cc37ac1f.js → calendar.c83d4e99.js} +274 -250
- package/dist/chunks/calendar.c83d4e99.js.map +1 -0
- package/dist/chunks/{checkbox.67ceb148.js → checkbox.3cdbdd52.js} +7 -7
- package/dist/chunks/{checkbox.67ceb148.js.map → checkbox.3cdbdd52.js.map} +1 -1
- package/dist/chunks/checkmark.83e4f1e0.js +30 -0
- package/dist/chunks/checkmark.83e4f1e0.js.map +1 -0
- package/dist/chunks/{chevron-right.aef416c6.js → chevron-left.2fd6b083.js} +10 -10
- package/dist/chunks/chevron-left.2fd6b083.js.map +1 -0
- package/dist/chunks/{controls-group.7214dc7f.js → controls-group.38b436f6.js} +2 -2
- package/dist/chunks/{controls-group.7214dc7f.js.map → controls-group.38b436f6.js.map} +1 -1
- package/dist/chunks/{copy.7a73d1fd.js → copy.86236c8d.js} +4 -4
- package/dist/chunks/{copy.7a73d1fd.js.map → copy.86236c8d.js.map} +1 -1
- package/dist/chunks/{dropdown-default-textbox.0f878a8d.js → dropdown-default-textbox.0b38fac3.js} +4 -4
- package/dist/chunks/dropdown-default-textbox.0b38fac3.js.map +1 -0
- package/dist/chunks/{dropdown.7a104ce3.js → dropdown.afff433b.js} +144 -110
- package/dist/chunks/dropdown.afff433b.js.map +1 -0
- package/dist/chunks/{error-message.b91afffc.js → error-message.64e1964b.js} +2 -2
- package/dist/chunks/{error-message.b91afffc.js.map → error-message.64e1964b.js.map} +1 -1
- package/dist/chunks/fixed-scroller.e5aa7b00.js +148 -0
- package/dist/chunks/fixed-scroller.e5aa7b00.js.map +1 -0
- package/dist/chunks/{footer-actions.13f19a22.js → footer-actions.1ce44374.js} +3 -3
- package/dist/chunks/{footer-actions.13f19a22.js.map → footer-actions.1ce44374.js.map} +1 -1
- package/dist/chunks/{index.7f24db66.js → index.2bd3812b.js} +2 -2
- package/dist/chunks/{index.7f24db66.js.map → index.2bd3812b.js.map} +1 -1
- package/dist/chunks/{index.1dc4ebae.js → index.369b0e66.js} +112 -92
- package/dist/chunks/index.369b0e66.js.map +1 -0
- package/dist/chunks/{index.536bcb56.js → index.6a665ade.js} +3 -3
- package/dist/chunks/{index.536bcb56.js.map → index.6a665ade.js.map} +1 -1
- package/dist/chunks/{index.4c951e0d.js → index.77f35162.js} +6 -6
- package/dist/chunks/{index.4c951e0d.js.map → index.77f35162.js.map} +1 -1
- package/dist/chunks/index.bcc58fdd.js +1334 -0
- package/dist/chunks/index.bcc58fdd.js.map +1 -0
- package/dist/chunks/index.c207e9ab.js +602 -0
- package/dist/chunks/index.c207e9ab.js.map +1 -0
- package/dist/chunks/{index.6700224a.js → index.e579bc02.js} +2 -2
- package/dist/chunks/{index.6700224a.js.map → index.e579bc02.js.map} +1 -1
- package/dist/chunks/{index.d68847b0.js → index.fa7b44f1.js} +2 -2
- package/dist/chunks/{index.d68847b0.js.map → index.fa7b44f1.js.map} +1 -1
- package/dist/chunks/{listbox-option-tag.0f31ecb2.js → listbox-option-tag.809ec40e.js} +3 -3
- package/dist/chunks/{listbox-option-tag.0f31ecb2.js.map → listbox-option-tag.809ec40e.js.map} +1 -1
- package/dist/chunks/listbox.f6e5a11d.js +1306 -0
- package/dist/chunks/listbox.f6e5a11d.js.map +1 -0
- package/dist/chunks/{loading-button.6523a015.js → loading-button.746b7fa1.js} +2 -2
- package/dist/chunks/{loading-button.6523a015.js.map → loading-button.746b7fa1.js.map} +1 -1
- package/dist/chunks/refresh.c38c9eee.js +30 -0
- package/dist/chunks/refresh.c38c9eee.js.map +1 -0
- package/dist/chunks/summary-grid.keys.1d1028c2.js +5 -0
- package/dist/chunks/summary-grid.keys.1d1028c2.js.map +1 -0
- package/dist/chunks/{tooltip.b5391514.js → tooltip.f769eb14.js} +54 -51
- package/dist/chunks/{tooltip.b5391514.js.map → tooltip.f769eb14.js.map} +1 -1
- package/dist/code-snippet.js +6 -6
- package/dist/code-snippet.js.map +1 -1
- package/dist/country.js +553 -541
- package/dist/country.js.map +1 -1
- package/dist/currency.js +1 -1
- package/dist/data-grid.js +10 -10
- package/dist/data-grid.js.map +1 -1
- package/dist/date-picker.js +129 -118
- package/dist/date-picker.js.map +1 -1
- package/dist/date-range-picker.js +2 -2
- package/dist/date.js +1 -1
- package/dist/divider.js +1 -1
- package/dist/dropdown.js +4 -4
- package/dist/empty-state.js +44 -42
- package/dist/empty-state.js.map +1 -1
- package/dist/filter-bar.js +696 -683
- package/dist/filter-bar.js.map +1 -1
- package/dist/focus-trap.js +1 -1
- package/dist/form-layout.js +3 -3
- package/dist/header.js +121 -198
- package/dist/header.js.map +1 -1
- package/dist/image.js +4 -4
- package/dist/index.js +164 -158
- package/dist/index.js.map +1 -1
- package/dist/info-icon.js +8 -8
- package/dist/input-field.js +7 -7
- package/dist/internal.js +20 -144
- package/dist/internal.js.map +1 -1
- package/dist/link.js +2 -2
- package/dist/loading-indicator.js +1 -1
- package/dist/menu.js +3 -592
- package/dist/menu.js.map +1 -1
- package/dist/modal.js +3 -3
- package/dist/pagination.js +37 -21
- package/dist/pagination.js.map +1 -1
- package/dist/payment-method.js +50 -40
- package/dist/payment-method.js.map +1 -1
- package/dist/popover.js +16 -16
- package/dist/popper-container.js +6 -1276
- package/dist/popper-container.js.map +1 -1
- package/dist/radio-group.js +128 -97
- package/dist/radio-group.js.map +1 -1
- package/dist/search-bar.js +2 -2
- package/dist/segmented-control.js +130 -106
- package/dist/segmented-control.js.map +1 -1
- package/dist/sidepanel.js +94 -91
- package/dist/sidepanel.js.map +1 -1
- package/dist/status.js +2 -2
- package/dist/stepper.js +3 -3
- package/dist/structured-list.js +1 -1
- package/dist/summary-grid.js +146 -163
- package/dist/summary-grid.js.map +1 -1
- package/dist/tabs.js +128 -99
- package/dist/tabs.js.map +1 -1
- package/dist/tag.js +3 -3
- package/dist/textarea.js +4 -4
- package/dist/timeline.js +216 -203
- package/dist/timeline.js.map +1 -1
- package/dist/toast.js +3 -3
- package/dist/toggle.js +6 -6
- package/dist/tutorial.js +375 -0
- package/dist/tutorial.js.map +1 -0
- package/dist/typography.js +1 -1
- package/dist/web-types.json +1 -1
- package/package.json +5 -2
- package/dist/assets/chevron-right.css +0 -1
- package/dist/chunks/button.975d0bb8.js.map +0 -1
- package/dist/chunks/calendar.cc37ac1f.js.map +0 -1
- package/dist/chunks/chevron-right.aef416c6.js.map +0 -1
- package/dist/chunks/dropdown-default-textbox.0f878a8d.js.map +0 -1
- package/dist/chunks/dropdown.7a104ce3.js.map +0 -1
- package/dist/chunks/index.1dc4ebae.js.map +0 -1
- package/dist/chunks/listbox.0f25778d.js +0 -1213
- package/dist/chunks/listbox.0f25778d.js.map +0 -1
|
@@ -0,0 +1,1306 @@
|
|
|
1
|
+
import { computed as b, ref as R, onMounted as Te, onUnmounted as Ge, watch as he, defineComponent as H, openBlock as S, createElementBlock as B, mergeProps as U, withKeys as be, renderSlot as Y, resolveComponent as C, createBlock as D, toHandlerKey as F, withCtx as T, normalizeProps as w, guardReactiveProps as K, createElementVNode as M, createVNode as A, createTextVNode as V, toDisplayString as G, createCommentVNode as le, withDirectives as J, vShow as ve, toRef as Oe, resolveDirective as ge, toHandlers as se, Fragment as ie, renderList as q, createSlots as oe, normalizeClass as me, pushScopeId as xe, popScopeId as Ye } from "vue";
|
|
2
|
+
import { B as x, a as pe } from "./keyboard-navigation.ca47dfa8.js";
|
|
3
|
+
import { B as ne } from "./index.2bd3812b.js";
|
|
4
|
+
import { BentoLoadingIndicator as Fe } from "../loading-indicator.js";
|
|
5
|
+
import { BentoEmptyState as Ke } from "../empty-state.js";
|
|
6
|
+
import { u as fe } from "./i18n.6c402773.js";
|
|
7
|
+
import { d as ze } from "./debounce.b5ef6acf.js";
|
|
8
|
+
import { C as We } from "./checkmark.83e4f1e0.js";
|
|
9
|
+
import { _ as j } from "./_plugin-vue_export-helper.dad06003.js";
|
|
10
|
+
import { B as ye } from "./checkbox.3cdbdd52.js";
|
|
11
|
+
import { C as qe, a as He } from "./chevron-up.9bf21068.js";
|
|
12
|
+
import { B as je, a as Se } from "./loading-button.746b7fa1.js";
|
|
13
|
+
import { o as Xe } from "./resize.a041304d.js";
|
|
14
|
+
import "../assets/listbox.css";
|
|
15
|
+
const Le = (e, t, d, p) => {
|
|
16
|
+
const n = b(
|
|
17
|
+
() => {
|
|
18
|
+
var s, o;
|
|
19
|
+
return !!((s = e.value) != null && s.length) && ((o = e.value) == null ? void 0 : o.length) === t.value.length;
|
|
20
|
+
}
|
|
21
|
+
), u = b(() => {
|
|
22
|
+
var s;
|
|
23
|
+
return e.value == null || e.value.length === 0 ? !1 : ((s = e.value) == null ? void 0 : s.length) !== t.value.length;
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
isAllSelected: n,
|
|
27
|
+
isIndeterminate: u,
|
|
28
|
+
toggleSelectAll: (s) => {
|
|
29
|
+
s ? d() : p();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
function Je(e, { disabled: t, itemHeight: d, overscan: p = 5, prefixHeight: n }) {
|
|
34
|
+
const u = R(null), r = R([]), s = R(0), o = R(0), i = R(0);
|
|
35
|
+
let f;
|
|
36
|
+
const l = b(() => {
|
|
37
|
+
const v = typeof d == "number" ? e.value.length * d : e.value.reduce((_, I, k) => _ + d(k), 0), h = typeof d == "number" ? s.value * d : e.value.slice(0, s.value).reduce((_, I, k) => _ + d(k), 0);
|
|
38
|
+
return {
|
|
39
|
+
style: {
|
|
40
|
+
marginTop: `${h}px`,
|
|
41
|
+
height: `${v - h}px`
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}), y = () => {
|
|
45
|
+
const v = (n == null ? void 0 : n.value) ?? 0, h = Math.max(u.value.scrollTop - v, 0);
|
|
46
|
+
if (typeof d == "number")
|
|
47
|
+
return Math.floor(h / d);
|
|
48
|
+
let _ = 0, I = 0;
|
|
49
|
+
for (let k = 0; k < e.value.length; k += 1) {
|
|
50
|
+
const Q = d(k);
|
|
51
|
+
if (_ += Q, _ >= h) {
|
|
52
|
+
I = k;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return I;
|
|
57
|
+
}, g = () => {
|
|
58
|
+
if (i.value = u.value.clientHeight, typeof d == "number")
|
|
59
|
+
return Math.ceil(i.value / d);
|
|
60
|
+
const v = s.value ?? 0;
|
|
61
|
+
let h = 0, _ = 0;
|
|
62
|
+
for (let I = v; I < e.value.length; I += 1) {
|
|
63
|
+
const k = d(I);
|
|
64
|
+
if (h += k, _ = I, h > i.value)
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
return _ - v;
|
|
68
|
+
}, O = () => {
|
|
69
|
+
if (u.value) {
|
|
70
|
+
const v = g();
|
|
71
|
+
s.value = y(), o.value = Math.min(s.value + v + p, e.value.length), r.value = e.value.slice(s.value, o.value);
|
|
72
|
+
}
|
|
73
|
+
}, $ = () => {
|
|
74
|
+
O();
|
|
75
|
+
};
|
|
76
|
+
t || (Te(() => {
|
|
77
|
+
u.value && (i.value = u.value.clientHeight, f = Xe(u.value, ({ clientHeight: v }) => {
|
|
78
|
+
i.value = v, O();
|
|
79
|
+
}), O());
|
|
80
|
+
}), Ge(() => {
|
|
81
|
+
f == null || f.disconnect();
|
|
82
|
+
}), he(
|
|
83
|
+
() => e.value,
|
|
84
|
+
() => {
|
|
85
|
+
O();
|
|
86
|
+
}
|
|
87
|
+
));
|
|
88
|
+
const P = {
|
|
89
|
+
ref: u,
|
|
90
|
+
style: { overflowY: "auto" }
|
|
91
|
+
};
|
|
92
|
+
return t ? {
|
|
93
|
+
containerRef: u,
|
|
94
|
+
containerProps: P,
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
96
|
+
onScroll: () => {
|
|
97
|
+
},
|
|
98
|
+
list: e
|
|
99
|
+
} : {
|
|
100
|
+
containerRef: u,
|
|
101
|
+
containerProps: P,
|
|
102
|
+
onScroll: $,
|
|
103
|
+
list: r,
|
|
104
|
+
wrapperProps: l
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
var a = /* @__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))(a || {}), X = /* @__PURE__ */ ((e) => (e.AUTOMATIC = "automatic", e.BUTTON = "button", e.NONE = "none", e))(X || {});
|
|
108
|
+
const Qe = H({
|
|
109
|
+
name: "bento-listbox-option",
|
|
110
|
+
props: {
|
|
111
|
+
/**
|
|
112
|
+
* Setting this property to true will disable the option.
|
|
113
|
+
*/
|
|
114
|
+
disabled: { type: Boolean, default: !1 },
|
|
115
|
+
/**
|
|
116
|
+
* Indicates if the value is selected. Only one element can be selected at a time.
|
|
117
|
+
*/
|
|
118
|
+
selected: { type: Boolean, default: !1 }
|
|
119
|
+
},
|
|
120
|
+
emits: [a.CLICK, a.ENTER, a.SPACE, a.TAB],
|
|
121
|
+
setup(e, { emit: t }) {
|
|
122
|
+
const d = b(() => ({
|
|
123
|
+
"b-listbox-option--disabled": e.disabled,
|
|
124
|
+
"b-listbox-option--selected": e.selected
|
|
125
|
+
}));
|
|
126
|
+
return {
|
|
127
|
+
// Enums
|
|
128
|
+
BentoKeyboardNavigationKeyDownEvent: x,
|
|
129
|
+
BentoListboxEvent: a,
|
|
130
|
+
// Values
|
|
131
|
+
conditionalClasses: d,
|
|
132
|
+
// Events
|
|
133
|
+
onClick: (u) => {
|
|
134
|
+
t(a.CLICK, u);
|
|
135
|
+
},
|
|
136
|
+
onOptionSelected: (u, r) => {
|
|
137
|
+
t(u, r);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
function Ze(e, t, d, p, n, u) {
|
|
143
|
+
return S(), B("label", U({
|
|
144
|
+
class: ["b-listbox-option", e.conditionalClasses],
|
|
145
|
+
role: "option"
|
|
146
|
+
}, e.$attrs, {
|
|
147
|
+
onClick: t[0] || (t[0] = (...r) => e.onClick && e.onClick(...r)),
|
|
148
|
+
onKeydown: [
|
|
149
|
+
t[1] || (t[1] = be((r) => e.onOptionSelected(e.BentoListboxEvent.ENTER, r), ["enter"])),
|
|
150
|
+
t[2] || (t[2] = be((r) => e.onOptionSelected(e.BentoListboxEvent.SPACE, r), ["space"])),
|
|
151
|
+
t[3] || (t[3] = be((r) => e.onOptionSelected(e.BentoListboxEvent.TAB, r), ["tab"]))
|
|
152
|
+
]
|
|
153
|
+
}), [
|
|
154
|
+
Y(e.$slots, "default", {}, void 0, !0)
|
|
155
|
+
], 16);
|
|
156
|
+
}
|
|
157
|
+
const ae = /* @__PURE__ */ j(Qe, [["render", Ze], ["__scopeId", "data-v-18a61f5d"]]), et = H({
|
|
158
|
+
name: "bento-listbox-single-select-option",
|
|
159
|
+
components: {
|
|
160
|
+
BentoListboxOption: ae,
|
|
161
|
+
BentoTypography: ne,
|
|
162
|
+
CheckmarkIcon: We
|
|
163
|
+
},
|
|
164
|
+
props: {
|
|
165
|
+
/**
|
|
166
|
+
* Setting this property to true will disable the option.
|
|
167
|
+
*/
|
|
168
|
+
disabled: { type: Boolean, default: !1 },
|
|
169
|
+
/**
|
|
170
|
+
* The option item that contains all the option item's data.
|
|
171
|
+
* @type {BentoListboxOptionItem}
|
|
172
|
+
*/
|
|
173
|
+
option: {
|
|
174
|
+
type: Object,
|
|
175
|
+
required: !0
|
|
176
|
+
},
|
|
177
|
+
/**
|
|
178
|
+
* Indicates if the value is selected. Only one element can be selected at a time.
|
|
179
|
+
*/
|
|
180
|
+
selected: { type: Boolean, default: !1 }
|
|
181
|
+
},
|
|
182
|
+
emits: [a.ENTER, a.SELECT, a.SPACE, a.TAB],
|
|
183
|
+
setup(e, { emit: t }) {
|
|
184
|
+
const d = (r) => {
|
|
185
|
+
e.disabled || t(r, e.option.value);
|
|
186
|
+
}, p = b(() => e.disabled ? !0 : null), n = b(() => e.selected ? !0 : null), u = b(() => e.disabled ? -1 : 0);
|
|
187
|
+
return {
|
|
188
|
+
// Values
|
|
189
|
+
ariaDisabled: p,
|
|
190
|
+
ariaSelected: n,
|
|
191
|
+
tabIndex: u,
|
|
192
|
+
// Enums
|
|
193
|
+
BentoListboxEvent: a,
|
|
194
|
+
// Events
|
|
195
|
+
onOptionSelected: d
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
const tt = { class: "b-listbox-single-select-option__text" }, lt = { class: "b-listbox-single-select-option__check-icon" };
|
|
200
|
+
function st(e, t, d, p, n, u) {
|
|
201
|
+
const r = C("bento-typography"), s = C("checkmark-icon"), o = C("bento-listbox-option");
|
|
202
|
+
return S(), D(o, U({
|
|
203
|
+
class: "b-listbox-single-select-option",
|
|
204
|
+
disabled: e.disabled,
|
|
205
|
+
selected: e.selected,
|
|
206
|
+
"aria-selected": e.ariaSelected,
|
|
207
|
+
"aria-disabled": e.ariaDisabled,
|
|
208
|
+
tabindex: e.tabIndex,
|
|
209
|
+
onClick: t[0] || (t[0] = (i) => e.onOptionSelected(e.BentoListboxEvent.SELECT))
|
|
210
|
+
}, {
|
|
211
|
+
[F(e.BentoListboxEvent.ENTER)]: t[1] || (t[1] = (i) => e.onOptionSelected(e.BentoListboxEvent.ENTER))
|
|
212
|
+
}, {
|
|
213
|
+
[F(e.BentoListboxEvent.SPACE)]: t[2] || (t[2] = (i) => e.onOptionSelected(e.BentoListboxEvent.SPACE))
|
|
214
|
+
}, {
|
|
215
|
+
[F(e.BentoListboxEvent.TAB)]: t[3] || (t[3] = (i) => e.onOptionSelected(e.BentoListboxEvent.TAB))
|
|
216
|
+
}), {
|
|
217
|
+
default: T(() => [
|
|
218
|
+
Y(e.$slots, "default", w(K(e.option)), () => [
|
|
219
|
+
M("span", tt, [
|
|
220
|
+
A(r, { el: "span" }, {
|
|
221
|
+
default: T(() => [
|
|
222
|
+
V(G(e.option.label), 1)
|
|
223
|
+
]),
|
|
224
|
+
_: 1
|
|
225
|
+
}),
|
|
226
|
+
e.option.description ? (S(), D(r, {
|
|
227
|
+
key: 0,
|
|
228
|
+
class: "b-listbox-single-select-option__description",
|
|
229
|
+
el: "span"
|
|
230
|
+
}, {
|
|
231
|
+
default: T(() => [
|
|
232
|
+
V(G(e.option.description), 1)
|
|
233
|
+
]),
|
|
234
|
+
_: 1
|
|
235
|
+
})) : le("", !0)
|
|
236
|
+
])
|
|
237
|
+
], !0),
|
|
238
|
+
M("span", lt, [
|
|
239
|
+
J(A(s, { "svg-title": "selected" }, null, 512), [
|
|
240
|
+
[ve, e.selected]
|
|
241
|
+
])
|
|
242
|
+
])
|
|
243
|
+
]),
|
|
244
|
+
_: 3
|
|
245
|
+
}, 16, ["disabled", "selected", "aria-selected", "aria-disabled", "tabindex"]);
|
|
246
|
+
}
|
|
247
|
+
const ot = /* @__PURE__ */ j(et, [["render", st], ["__scopeId", "data-v-d112952c"]]), Ae = ({ items: e, isOptionDisabled: t }, d) => {
|
|
248
|
+
const p = b(() => e.value.length - 1), n = R(0);
|
|
249
|
+
Te(() => {
|
|
250
|
+
t && (n.value = e.value.findIndex((g) => !t(g)));
|
|
251
|
+
});
|
|
252
|
+
const u = (g) => !t || !!t && t(e.value[g]), r = (g) => !t || !!t && !t(e.value[g]), s = (g) => {
|
|
253
|
+
switch (g) {
|
|
254
|
+
case "increase":
|
|
255
|
+
n.value += 1;
|
|
256
|
+
break;
|
|
257
|
+
case "decrease":
|
|
258
|
+
n.value -= 1;
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
}, o = ({ edgeCaseItem: g, isItemBeforeEdgeCaseItem: O }, $, P) => {
|
|
262
|
+
n.value !== g && (O ? r(g) && s(P) : (s(P), u(n.value) && $()), d(n.value));
|
|
263
|
+
}, i = () => {
|
|
264
|
+
const g = n.value === p.value - 2;
|
|
265
|
+
o(
|
|
266
|
+
{
|
|
267
|
+
isItemBeforeEdgeCaseItem: g,
|
|
268
|
+
edgeCaseItem: p.value
|
|
269
|
+
},
|
|
270
|
+
i,
|
|
271
|
+
"increase"
|
|
272
|
+
/* INCREASE */
|
|
273
|
+
);
|
|
274
|
+
}, f = () => {
|
|
275
|
+
const g = n.value === 1;
|
|
276
|
+
o(
|
|
277
|
+
{
|
|
278
|
+
edgeCaseItem: 0,
|
|
279
|
+
isItemBeforeEdgeCaseItem: g
|
|
280
|
+
},
|
|
281
|
+
f,
|
|
282
|
+
"decrease"
|
|
283
|
+
/* DECREASE */
|
|
284
|
+
);
|
|
285
|
+
};
|
|
286
|
+
return {
|
|
287
|
+
moveToFirstElement: () => {
|
|
288
|
+
n.value = 0, u(n.value) ? i() : d(n.value);
|
|
289
|
+
},
|
|
290
|
+
moveToLastElement: () => {
|
|
291
|
+
n.value = p.value, u(n.value) ? f() : d(n.value);
|
|
292
|
+
},
|
|
293
|
+
moveToNextElement: i,
|
|
294
|
+
moveToPreviousElement: f
|
|
295
|
+
};
|
|
296
|
+
}, nt = H({
|
|
297
|
+
name: "bento-listbox-single-select",
|
|
298
|
+
components: {
|
|
299
|
+
BentoListboxSingleSelectOption: ot
|
|
300
|
+
},
|
|
301
|
+
directives: { BentoKeyboardNavigationDirective: pe },
|
|
302
|
+
inheritAttrs: !1,
|
|
303
|
+
props: {
|
|
304
|
+
/**
|
|
305
|
+
* Function that allows the options to be disabled
|
|
306
|
+
*
|
|
307
|
+
* @type {BentoListboxIsOptionDisabled}
|
|
308
|
+
* @param {BentoListboxOptionItem} option - listbox option object
|
|
309
|
+
* @param {string} option.label - Option's label text
|
|
310
|
+
* @param {string|number} option.value - Option's value
|
|
311
|
+
* @param {unknown} option.data - Option's extra data to be passed to the default slot
|
|
312
|
+
*/
|
|
313
|
+
isOptionDisabled: {
|
|
314
|
+
type: Function,
|
|
315
|
+
default: () => !1
|
|
316
|
+
},
|
|
317
|
+
/**
|
|
318
|
+
* The option elements to populate the listbox with.
|
|
319
|
+
* It must be an array of {@see BentoListboxOptionItem }.
|
|
320
|
+
*
|
|
321
|
+
* @property {string} value.label - Text to be displayed in the option
|
|
322
|
+
* @property {string,number} value.value - Value of the option
|
|
323
|
+
*/
|
|
324
|
+
items: {
|
|
325
|
+
type: Array,
|
|
326
|
+
required: !0
|
|
327
|
+
},
|
|
328
|
+
/**
|
|
329
|
+
* The `input` value.
|
|
330
|
+
* Providing an empty string will select no options.
|
|
331
|
+
* Set to an empty string `''` if you don't want any of the available options to be selected
|
|
332
|
+
*/
|
|
333
|
+
selectedValue: {
|
|
334
|
+
type: [String, Number],
|
|
335
|
+
default: void 0
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
emits: [a.SELECT, a.ENTER, a.SPACE, a.TAB],
|
|
339
|
+
setup(e, { emit: t, slots: d }) {
|
|
340
|
+
const p = R([]), n = (y) => (g) => {
|
|
341
|
+
t(y, g);
|
|
342
|
+
}, u = (y) => p.value[y].$el.focus(), { moveToNextElement: r, moveToPreviousElement: s, moveToFirstElement: o, moveToLastElement: i } = Ae(
|
|
343
|
+
{
|
|
344
|
+
items: Oe(e, "items"),
|
|
345
|
+
isOptionDisabled: e.isOptionDisabled
|
|
346
|
+
},
|
|
347
|
+
u
|
|
348
|
+
), f = {
|
|
349
|
+
[x.ARROW_UP]: s,
|
|
350
|
+
[x.ARROW_DOWN]: r,
|
|
351
|
+
[x.HOME]: o,
|
|
352
|
+
[x.END]: i
|
|
353
|
+
}, l = {
|
|
354
|
+
[a.SELECT]: n(a.SELECT),
|
|
355
|
+
[a.SPACE]: n(a.SPACE),
|
|
356
|
+
[a.TAB]: n(a.TAB),
|
|
357
|
+
[a.ENTER]: n(a.ENTER)
|
|
358
|
+
};
|
|
359
|
+
return {
|
|
360
|
+
// Enums
|
|
361
|
+
BentoListboxEvent: a,
|
|
362
|
+
// Values
|
|
363
|
+
listboxItemRef: p,
|
|
364
|
+
slots: d,
|
|
365
|
+
// Methods
|
|
366
|
+
onOptionSelected: n,
|
|
367
|
+
// Keyboard navigation
|
|
368
|
+
listboxListeners: f,
|
|
369
|
+
listboxOptionListeners: l
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
function it(e, t, d, p, n, u) {
|
|
374
|
+
const r = C("bento-listbox-single-select-option"), s = ge("bento-keyboard-navigation-directive");
|
|
375
|
+
return J((S(), B("div", se(e.listboxListeners, !0), [
|
|
376
|
+
(S(!0), B(ie, null, q(e.items, (o) => (S(), D(r, U({
|
|
377
|
+
key: o.value,
|
|
378
|
+
ref_for: !0,
|
|
379
|
+
ref: "listboxItemRef",
|
|
380
|
+
role: "option",
|
|
381
|
+
option: o,
|
|
382
|
+
disabled: e.isOptionDisabled ? e.isOptionDisabled(o) : null,
|
|
383
|
+
selected: o.value === e.selectedValue
|
|
384
|
+
}, se(e.listboxOptionListeners)), oe({ _: 2 }, [
|
|
385
|
+
q(e.slots, (i, f) => ({
|
|
386
|
+
name: f,
|
|
387
|
+
fn: T((l) => [
|
|
388
|
+
Y(e.$slots, f, w(K(l)))
|
|
389
|
+
])
|
|
390
|
+
}))
|
|
391
|
+
]), 1040, ["option", "disabled", "selected"]))), 128))
|
|
392
|
+
], 16)), [
|
|
393
|
+
[s]
|
|
394
|
+
]);
|
|
395
|
+
}
|
|
396
|
+
const at = /* @__PURE__ */ j(nt, [["render", it]]);
|
|
397
|
+
var Ie = /* @__PURE__ */ ((e) => (e.DISABLED = "disabled", e))(Ie || {}), te = /* @__PURE__ */ ((e) => (e.SELECT_CATEGORY = "select-category", e.UNSELECT_CATEGORY = "unselect-category", e))(te || {});
|
|
398
|
+
const rt = {
|
|
399
|
+
"en-US": {
|
|
400
|
+
categoryClosed: "{category} closed",
|
|
401
|
+
categoryOpened: "{category} opened"
|
|
402
|
+
}
|
|
403
|
+
}, ct = H({
|
|
404
|
+
i18n: { messages: rt },
|
|
405
|
+
name: "bento-listbox-multi-select-category",
|
|
406
|
+
components: {
|
|
407
|
+
BentoCheckbox: ye,
|
|
408
|
+
BentoTypography: ne,
|
|
409
|
+
BentoListboxOption: ae,
|
|
410
|
+
ChevronDownIcon: qe,
|
|
411
|
+
ChevronUpIcon: He
|
|
412
|
+
},
|
|
413
|
+
props: {
|
|
414
|
+
/**
|
|
415
|
+
* The option elements to populate the listbox with.
|
|
416
|
+
* It must be an array of {@see BentoListboxOptionItem }.
|
|
417
|
+
*
|
|
418
|
+
* @property {string} value.label - Text to be displayed in the option
|
|
419
|
+
* @property {string,number} value.value - Value of the option
|
|
420
|
+
* @property {BentoListboxOptionItem} value.items - Category items list
|
|
421
|
+
*/
|
|
422
|
+
category: {
|
|
423
|
+
type: Object,
|
|
424
|
+
required: !0
|
|
425
|
+
},
|
|
426
|
+
/**
|
|
427
|
+
* Function that allows the options to be disabled
|
|
428
|
+
*
|
|
429
|
+
* @type {BentoListboxIsOptionDisabled}
|
|
430
|
+
* @param {BentoListboxOptionItem} option - listbox option object
|
|
431
|
+
* @param {string} option.label - Option's label text
|
|
432
|
+
* @param {string|number} option.value - Option's value
|
|
433
|
+
* @param {unknown} option.data - Option's extra data to be passed to the default slot
|
|
434
|
+
*/
|
|
435
|
+
isOptionDisabled: {
|
|
436
|
+
type: [Function],
|
|
437
|
+
default: () => !1
|
|
438
|
+
},
|
|
439
|
+
/**
|
|
440
|
+
* The `input` value.
|
|
441
|
+
* Providing an empty array will select no options.
|
|
442
|
+
*/
|
|
443
|
+
selectedItemsList: {
|
|
444
|
+
type: Array,
|
|
445
|
+
default: () => []
|
|
446
|
+
}
|
|
447
|
+
},
|
|
448
|
+
emits: [te.SELECT_CATEGORY, te.UNSELECT_CATEGORY],
|
|
449
|
+
setup(e, { emit: t }) {
|
|
450
|
+
const d = R(!1), { t: p } = fe(), n = (v) => e.isOptionDisabled ? e.isOptionDisabled(v) : !1, u = b(
|
|
451
|
+
() => e.category.items.every((v) => n(v))
|
|
452
|
+
), r = b(() => ({
|
|
453
|
+
[`b-listbox-multi-select-category--${Ie.DISABLED}`]: u.value
|
|
454
|
+
})), s = (v) => {
|
|
455
|
+
v.preventDefault(), d.value = !d.value;
|
|
456
|
+
}, o = (v) => {
|
|
457
|
+
var I;
|
|
458
|
+
const h = n(v), _ = ((I = e.selectedItemsList) == null ? void 0 : I.includes(v.value)) || !1;
|
|
459
|
+
return { isDisabled: h, isPreSelected: _ };
|
|
460
|
+
}, i = b(
|
|
461
|
+
() => e.category.items.filter((v) => {
|
|
462
|
+
const { isDisabled: h, isPreSelected: _ } = o(v);
|
|
463
|
+
return h && _ || !h;
|
|
464
|
+
})
|
|
465
|
+
), f = b(
|
|
466
|
+
() => {
|
|
467
|
+
var v;
|
|
468
|
+
return (v = i.value) == null ? void 0 : v.filter(
|
|
469
|
+
({ value: h }) => {
|
|
470
|
+
var _;
|
|
471
|
+
return (_ = e.selectedItemsList) == null ? void 0 : _.includes(h);
|
|
472
|
+
}
|
|
473
|
+
);
|
|
474
|
+
}
|
|
475
|
+
), l = b(() => {
|
|
476
|
+
const v = d.value ? "categoryOpened" : "categoryClosed";
|
|
477
|
+
return p(v, { category: e.category.label });
|
|
478
|
+
}), y = () => {
|
|
479
|
+
t(te.SELECT_CATEGORY);
|
|
480
|
+
}, g = () => {
|
|
481
|
+
t(te.UNSELECT_CATEGORY);
|
|
482
|
+
}, { isAllSelected: O, isIndeterminate: $, toggleSelectAll: P } = Le(
|
|
483
|
+
f,
|
|
484
|
+
i,
|
|
485
|
+
y,
|
|
486
|
+
g
|
|
487
|
+
);
|
|
488
|
+
return {
|
|
489
|
+
// Values
|
|
490
|
+
chevronTitle: l,
|
|
491
|
+
conditionalClass: r,
|
|
492
|
+
hasAllPropsDisabled: u,
|
|
493
|
+
isOpen: d,
|
|
494
|
+
isAllSelected: O,
|
|
495
|
+
isIndeterminate: $,
|
|
496
|
+
// Methods
|
|
497
|
+
toggleOpen: s,
|
|
498
|
+
toggleSelectAll: P
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
const dt = { class: "b-listbox-multi-select-category__label" };
|
|
503
|
+
function ut(e, t, d, p, n, u) {
|
|
504
|
+
const r = C("bento-checkbox"), s = C("bento-typography"), o = C("chevron-up-icon"), i = C("chevron-down-icon"), f = C("bento-listbox-option");
|
|
505
|
+
return S(), B("div", null, [
|
|
506
|
+
A(f, {
|
|
507
|
+
class: me(["b-listbox-multi-select-category__option", e.conditionalClass])
|
|
508
|
+
}, {
|
|
509
|
+
default: T(() => [
|
|
510
|
+
A(r, {
|
|
511
|
+
"model-value": e.isAllSelected,
|
|
512
|
+
indeterminate: e.isIndeterminate,
|
|
513
|
+
disabled: e.hasAllPropsDisabled,
|
|
514
|
+
"aria-label": e.category.label,
|
|
515
|
+
value: e.category.value,
|
|
516
|
+
"onUpdate:modelValue": e.toggleSelectAll
|
|
517
|
+
}, null, 8, ["model-value", "indeterminate", "disabled", "aria-label", "value", "onUpdate:modelValue"]),
|
|
518
|
+
M("span", dt, [
|
|
519
|
+
A(s, {
|
|
520
|
+
el: "span",
|
|
521
|
+
class: "b-listbox-multi-select-category__label-text"
|
|
522
|
+
}, {
|
|
523
|
+
default: T(() => [
|
|
524
|
+
V(G(e.category.label), 1)
|
|
525
|
+
]),
|
|
526
|
+
_: 1
|
|
527
|
+
}),
|
|
528
|
+
M("div", {
|
|
529
|
+
class: "b-listbox-multi-select-category__label-chevron",
|
|
530
|
+
"data-testid": "toggle-listbox",
|
|
531
|
+
onClickCapture: t[0] || (t[0] = (...l) => e.toggleOpen && e.toggleOpen(...l))
|
|
532
|
+
}, [
|
|
533
|
+
e.isOpen ? (S(), D(o, {
|
|
534
|
+
key: 0,
|
|
535
|
+
"svg-title": e.chevronTitle
|
|
536
|
+
}, null, 8, ["svg-title"])) : (S(), D(i, {
|
|
537
|
+
key: 1,
|
|
538
|
+
"svg-title": e.chevronTitle
|
|
539
|
+
}, null, 8, ["svg-title"]))
|
|
540
|
+
], 32)
|
|
541
|
+
])
|
|
542
|
+
]),
|
|
543
|
+
_: 1
|
|
544
|
+
}, 8, ["class"]),
|
|
545
|
+
J(M("div", null, [
|
|
546
|
+
Y(e.$slots, "default", {}, void 0, !0)
|
|
547
|
+
], 512), [
|
|
548
|
+
[ve, e.isOpen]
|
|
549
|
+
])
|
|
550
|
+
]);
|
|
551
|
+
}
|
|
552
|
+
const bt = /* @__PURE__ */ j(ct, [["render", ut], ["__scopeId", "data-v-69a9679a"]]);
|
|
553
|
+
var W = /* @__PURE__ */ ((e) => (e.SELECT_CATEGORY = "select-category", e.TOGGLE_CHECKBOX_SELECTION = "toggle-checkbox-selection", e.UNSELECT_CATEGORY = "unselect-category", e))(W || {});
|
|
554
|
+
const mt = H({
|
|
555
|
+
name: "listbox-multi-select-options",
|
|
556
|
+
components: {
|
|
557
|
+
BentoCheckbox: ye,
|
|
558
|
+
BentoListboxOption: ae,
|
|
559
|
+
BentoTypography: ne,
|
|
560
|
+
ListboxMultiSelectCategory: bt
|
|
561
|
+
},
|
|
562
|
+
props: {
|
|
563
|
+
/**
|
|
564
|
+
* Indicates if the items listed are inside a category
|
|
565
|
+
* so they can be padded to right by one level in recursion.
|
|
566
|
+
* Items of categories are automatically defined as "categoryItems"
|
|
567
|
+
*/
|
|
568
|
+
categoryItems: { type: Boolean, default: !1 },
|
|
569
|
+
/**
|
|
570
|
+
* Function that allows the options to be disabled
|
|
571
|
+
*
|
|
572
|
+
* @type {BentoListboxIsOptionDisabled}
|
|
573
|
+
* @param {BentoListboxOptionItem} option - listbox option object
|
|
574
|
+
* @param {string} option.label - Option's label text
|
|
575
|
+
* @param {string|number} option.value - Option's value
|
|
576
|
+
* @param {unknown} option.data - Option's extra data to be passed to the default slot
|
|
577
|
+
*/
|
|
578
|
+
isOptionDisabled: {
|
|
579
|
+
type: Function,
|
|
580
|
+
default: () => !1
|
|
581
|
+
},
|
|
582
|
+
/**
|
|
583
|
+
* The option elements to populate the listbox with.
|
|
584
|
+
* It must be an array of {@see BentoListboxOptionItem }.
|
|
585
|
+
*
|
|
586
|
+
* @property {string} value.label - Text to be displayed in the option
|
|
587
|
+
* @property {string,number} value.value - Value of the option
|
|
588
|
+
*/
|
|
589
|
+
items: {
|
|
590
|
+
type: Array,
|
|
591
|
+
required: !0
|
|
592
|
+
},
|
|
593
|
+
/**
|
|
594
|
+
* Indicates if the elements options are inside a multi-level category
|
|
595
|
+
*/
|
|
596
|
+
isMultiLevel: { type: Boolean, default: !1 },
|
|
597
|
+
/**
|
|
598
|
+
* Flag that indicates that an external search it's being made
|
|
599
|
+
* to filter out the items inside the the multi-select listbox
|
|
600
|
+
*
|
|
601
|
+
* If enabled, hides the "Select all" checkbox in "multiple" mode.
|
|
602
|
+
*/
|
|
603
|
+
searching: { type: Boolean, default: !1 },
|
|
604
|
+
/**
|
|
605
|
+
* List of selected items.
|
|
606
|
+
* Providing an empty array will select no options.
|
|
607
|
+
*/
|
|
608
|
+
selectedItemsList: {
|
|
609
|
+
type: Array,
|
|
610
|
+
default: () => []
|
|
611
|
+
}
|
|
612
|
+
},
|
|
613
|
+
emits: [
|
|
614
|
+
W.TOGGLE_CHECKBOX_SELECTION,
|
|
615
|
+
W.SELECT_CATEGORY,
|
|
616
|
+
W.UNSELECT_CATEGORY
|
|
617
|
+
],
|
|
618
|
+
setup(e, { emit: t }) {
|
|
619
|
+
const d = (o) => {
|
|
620
|
+
t(W.TOGGLE_CHECKBOX_SELECTION, o);
|
|
621
|
+
}, p = (o) => !!o.items, n = (o) => {
|
|
622
|
+
const i = e.isMultiLevel && e.searching;
|
|
623
|
+
return o.description && (!e.isMultiLevel || i);
|
|
624
|
+
}, u = (o) => o.items ? !!o.items.find((i) => e.selectedItemsList.includes(i.value)) : e.selectedItemsList.includes(o.value), r = (o, i) => {
|
|
625
|
+
if (p(i))
|
|
626
|
+
return t(o ? W.SELECT_CATEGORY : W.UNSELECT_CATEGORY, i);
|
|
627
|
+
d(i.value);
|
|
628
|
+
};
|
|
629
|
+
return {
|
|
630
|
+
// Values
|
|
631
|
+
conditionalClasses: b(() => ({
|
|
632
|
+
"b-listbox-multi-select-options__category-option": e.categoryItems
|
|
633
|
+
})),
|
|
634
|
+
// Methods
|
|
635
|
+
isCategory: p,
|
|
636
|
+
isOptionSelected: u,
|
|
637
|
+
shouldShowDescription: n,
|
|
638
|
+
toggleCheckboxSelection: d,
|
|
639
|
+
selectSearch: r,
|
|
640
|
+
// Enums
|
|
641
|
+
BentoListboxEvent: a,
|
|
642
|
+
ListboxMultiSelectOptionsEvent: W
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
});
|
|
646
|
+
const vt = { class: "b-listbox-multi-select__option-text" }, gt = { class: "b-listbox-multi-select__option-text" };
|
|
647
|
+
function pt(e, t, d, p, n, u) {
|
|
648
|
+
const r = C("bento-checkbox"), s = C("bento-typography"), o = C("bento-listbox-option"), i = C("listbox-multi-select-options", !0), f = C("listbox-multi-select-category");
|
|
649
|
+
return S(), B("div", null, [
|
|
650
|
+
(S(!0), B(ie, null, q(e.items, (l) => (S(), B("div", {
|
|
651
|
+
key: `selected-${l.value}`
|
|
652
|
+
}, [
|
|
653
|
+
e.searching && e.isMultiLevel ? (S(), D(o, {
|
|
654
|
+
key: 0,
|
|
655
|
+
class: me(["b-listbox-multi-select-options", e.conditionalClasses]),
|
|
656
|
+
disabled: e.isOptionDisabled ? e.isOptionDisabled(l) : null
|
|
657
|
+
}, {
|
|
658
|
+
default: T(() => [
|
|
659
|
+
A(r, {
|
|
660
|
+
"model-value": e.isOptionSelected(l),
|
|
661
|
+
"aria-label": l.label,
|
|
662
|
+
disabled: e.isOptionDisabled ? e.isOptionDisabled(l) : null,
|
|
663
|
+
value: l.value,
|
|
664
|
+
"onUpdate:modelValue": (y) => e.selectSearch(y, l)
|
|
665
|
+
}, null, 8, ["model-value", "aria-label", "disabled", "value", "onUpdate:modelValue"]),
|
|
666
|
+
Y(e.$slots, "default", w(K(l)), () => [
|
|
667
|
+
M("span", vt, [
|
|
668
|
+
A(s, { el: "span" }, {
|
|
669
|
+
default: T(() => [
|
|
670
|
+
V(G(l.label), 1)
|
|
671
|
+
]),
|
|
672
|
+
_: 2
|
|
673
|
+
}, 1024),
|
|
674
|
+
e.shouldShowDescription(l) ? (S(), D(s, {
|
|
675
|
+
key: 0,
|
|
676
|
+
class: "b-listbox-multi-select__option-description",
|
|
677
|
+
el: "span"
|
|
678
|
+
}, {
|
|
679
|
+
default: T(() => [
|
|
680
|
+
V(G(l.description), 1)
|
|
681
|
+
]),
|
|
682
|
+
_: 2
|
|
683
|
+
}, 1024)) : le("", !0)
|
|
684
|
+
])
|
|
685
|
+
], !0)
|
|
686
|
+
]),
|
|
687
|
+
_: 2
|
|
688
|
+
}, 1032, ["class", "disabled"])) : (S(), B(ie, { key: 1 }, [
|
|
689
|
+
l.items ? (S(), D(f, {
|
|
690
|
+
key: 0,
|
|
691
|
+
category: l,
|
|
692
|
+
"is-option-disabled": e.isOptionDisabled,
|
|
693
|
+
"selected-items-list": e.selectedItemsList,
|
|
694
|
+
onSelectCategory: (y) => e.$emit(e.ListboxMultiSelectOptionsEvent.SELECT_CATEGORY, l),
|
|
695
|
+
onUnselectCategory: (y) => e.$emit(e.ListboxMultiSelectOptionsEvent.UNSELECT_CATEGORY, l)
|
|
696
|
+
}, {
|
|
697
|
+
default: T(() => [
|
|
698
|
+
A(i, {
|
|
699
|
+
"category-items": "",
|
|
700
|
+
items: l.items,
|
|
701
|
+
"is-option-disabled": e.isOptionDisabled,
|
|
702
|
+
"is-multi-level": e.isMultiLevel,
|
|
703
|
+
"selected-items-list": e.selectedItemsList,
|
|
704
|
+
searching: e.searching,
|
|
705
|
+
onToggleCheckboxSelection: t[0] || (t[0] = (y) => e.toggleCheckboxSelection(y))
|
|
706
|
+
}, null, 8, ["items", "is-option-disabled", "is-multi-level", "selected-items-list", "searching"])
|
|
707
|
+
]),
|
|
708
|
+
_: 2
|
|
709
|
+
}, 1032, ["category", "is-option-disabled", "selected-items-list", "onSelectCategory", "onUnselectCategory"])) : (S(), D(o, {
|
|
710
|
+
key: 1,
|
|
711
|
+
class: me(["b-listbox-multi-select-options", e.conditionalClasses]),
|
|
712
|
+
disabled: e.isOptionDisabled ? e.isOptionDisabled(l) : null
|
|
713
|
+
}, {
|
|
714
|
+
default: T(() => [
|
|
715
|
+
A(r, {
|
|
716
|
+
"model-value": e.selectedItemsList,
|
|
717
|
+
"aria-label": l.label,
|
|
718
|
+
disabled: e.isOptionDisabled ? e.isOptionDisabled(l) : null,
|
|
719
|
+
value: l.value,
|
|
720
|
+
"onUpdate:modelValue": (y) => e.toggleCheckboxSelection(l.value)
|
|
721
|
+
}, null, 8, ["model-value", "aria-label", "disabled", "value", "onUpdate:modelValue"]),
|
|
722
|
+
Y(e.$slots, "default", w(K(l)), () => [
|
|
723
|
+
M("span", gt, [
|
|
724
|
+
A(s, { el: "span" }, {
|
|
725
|
+
default: T(() => [
|
|
726
|
+
V(G(l.label), 1)
|
|
727
|
+
]),
|
|
728
|
+
_: 2
|
|
729
|
+
}, 1024),
|
|
730
|
+
e.shouldShowDescription(l) ? (S(), D(s, {
|
|
731
|
+
key: 0,
|
|
732
|
+
class: "b-listbox-multi-select__option-description",
|
|
733
|
+
el: "span"
|
|
734
|
+
}, {
|
|
735
|
+
default: T(() => [
|
|
736
|
+
V(G(l.description), 1)
|
|
737
|
+
]),
|
|
738
|
+
_: 2
|
|
739
|
+
}, 1024)) : le("", !0)
|
|
740
|
+
])
|
|
741
|
+
], !0)
|
|
742
|
+
]),
|
|
743
|
+
_: 2
|
|
744
|
+
}, 1032, ["class", "disabled"]))
|
|
745
|
+
], 64))
|
|
746
|
+
]))), 128))
|
|
747
|
+
]);
|
|
748
|
+
}
|
|
749
|
+
const ft = /* @__PURE__ */ j(mt, [["render", pt], ["__scopeId", "data-v-55a6d406"]]), Ee = {
|
|
750
|
+
"en-US": {
|
|
751
|
+
allSelected: "All selected ({total})",
|
|
752
|
+
numberOfTotalSelected: "{number} of {total} selected",
|
|
753
|
+
selectAll: "Select all ({total})"
|
|
754
|
+
}
|
|
755
|
+
}, yt = H({
|
|
756
|
+
i18n: { messages: Ee },
|
|
757
|
+
name: "bento-listbox-multi-select",
|
|
758
|
+
components: {
|
|
759
|
+
BentoCheckbox: ye,
|
|
760
|
+
BentoListboxOption: ae,
|
|
761
|
+
BentoTypography: ne,
|
|
762
|
+
ListboxMultiSelectOptions: ft
|
|
763
|
+
},
|
|
764
|
+
directives: { BentoKeyboardNavigationDirective: pe },
|
|
765
|
+
props: {
|
|
766
|
+
/**
|
|
767
|
+
* Function that allows the options to be disabled
|
|
768
|
+
*
|
|
769
|
+
* @type {BentoListboxIsOptionDisabled}
|
|
770
|
+
* @param {BentoListboxOptionItem} option - listbox option object
|
|
771
|
+
* @param {string} option.label - Option's label text
|
|
772
|
+
* @param {string|number} option.value - Option's value
|
|
773
|
+
* @param {unknown} option.data - Option's extra data to be passed to the default slot
|
|
774
|
+
*/
|
|
775
|
+
isOptionDisabled: {
|
|
776
|
+
type: Function,
|
|
777
|
+
default: () => !1
|
|
778
|
+
},
|
|
779
|
+
/**
|
|
780
|
+
* The option elements to populate the listbox with.
|
|
781
|
+
* It must be an array of {@see BentoListboxOptionItem }.
|
|
782
|
+
*
|
|
783
|
+
* @property {string} value.label - Text to be displayed in the option
|
|
784
|
+
* @property {string,number} value.value - Value of the option
|
|
785
|
+
*/
|
|
786
|
+
items: {
|
|
787
|
+
type: Array,
|
|
788
|
+
required: !0
|
|
789
|
+
},
|
|
790
|
+
/**
|
|
791
|
+
* Flag that indicates that an external search it's being made
|
|
792
|
+
* to filter out the items inside the the multi-select listbox
|
|
793
|
+
*
|
|
794
|
+
* If enabled, hides the "Select all" checkbox in "multiple" mode.
|
|
795
|
+
*/
|
|
796
|
+
searching: { type: Boolean, default: !1 },
|
|
797
|
+
/**
|
|
798
|
+
* The `input` value.
|
|
799
|
+
* Providing an empty array will select no options.
|
|
800
|
+
*/
|
|
801
|
+
selectedValues: {
|
|
802
|
+
type: Array,
|
|
803
|
+
default: () => []
|
|
804
|
+
}
|
|
805
|
+
},
|
|
806
|
+
emits: [a.SELECT],
|
|
807
|
+
setup(e, { emit: t, slots: d }) {
|
|
808
|
+
const { t: p } = fe({ messages: Ee }), n = R(null), u = R(null), r = R(null), s = R();
|
|
809
|
+
he(
|
|
810
|
+
() => e.selectedValues,
|
|
811
|
+
() => {
|
|
812
|
+
s.value = [...e.selectedValues ?? []];
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
immediate: !0
|
|
816
|
+
}
|
|
817
|
+
);
|
|
818
|
+
const o = b(() => !!e.items.find(({ items: c }) => !!c)), i = b(() => o.value ? e.items.reduce((c, m) => (m.items ? c.push(...m.items.flat()) : c.push(m), c), []) : e.items), f = (c) => {
|
|
819
|
+
var E;
|
|
820
|
+
const m = e.isOptionDisabled(c), L = ((E = s.value) == null ? void 0 : E.includes(c.value)) || !1;
|
|
821
|
+
return { isDisabled: m, isPreSelected: L };
|
|
822
|
+
}, l = b(
|
|
823
|
+
() => e.searching && o ? e.items : i.value.filter((c) => {
|
|
824
|
+
const { isDisabled: m, isPreSelected: L } = f(c);
|
|
825
|
+
return m && L || !m;
|
|
826
|
+
})
|
|
827
|
+
), y = b(
|
|
828
|
+
() => {
|
|
829
|
+
var c;
|
|
830
|
+
return (c = l.value) == null ? void 0 : c.filter((m) => {
|
|
831
|
+
var L;
|
|
832
|
+
return m.items && o.value && e.searching ? m.items.filter(
|
|
833
|
+
(z) => (e.selectedValues ?? []).includes(
|
|
834
|
+
z.value
|
|
835
|
+
)
|
|
836
|
+
).length === m.items.length : (L = s.value) == null ? void 0 : L.includes(m.value);
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
), g = () => o.value && !e.searching ? l.value.length : e.items.length, O = b(() => {
|
|
840
|
+
var L;
|
|
841
|
+
const c = g(), m = ((L = y.value) == null ? void 0 : L.length) || 0;
|
|
842
|
+
return m === 0 ? p("selectAll", { total: c }) : m === c ? p("allSelected", { total: c }) : p("numberOfTotalSelected", { number: m, total: c });
|
|
843
|
+
}), $ = (c) => {
|
|
844
|
+
const m = (E) => {
|
|
845
|
+
const { isDisabled: z, isPreSelected: ue } = f(E);
|
|
846
|
+
return z && ue || !z;
|
|
847
|
+
}, L = c.filter(m).filter((E) => !s.value.includes(E.value)).map(({ value: E }) => E);
|
|
848
|
+
s.value = [...s.value, ...L], t(a.SELECT, s.value);
|
|
849
|
+
}, P = (c) => {
|
|
850
|
+
const m = (E) => {
|
|
851
|
+
const { isDisabled: z, isPreSelected: ue } = f(E);
|
|
852
|
+
return !(z && ue);
|
|
853
|
+
}, L = c.filter(m).map(({ value: E }) => E);
|
|
854
|
+
s.value = s.value.filter((E) => !(L != null && L.includes(E))), t(a.SELECT, s.value);
|
|
855
|
+
}, v = () => {
|
|
856
|
+
$(i.value);
|
|
857
|
+
}, h = () => {
|
|
858
|
+
P(i.value);
|
|
859
|
+
}, { isAllSelected: _, isIndeterminate: I, toggleSelectAll: k } = Le(
|
|
860
|
+
y,
|
|
861
|
+
l,
|
|
862
|
+
v,
|
|
863
|
+
h
|
|
864
|
+
), Q = (c) => {
|
|
865
|
+
$(c.items);
|
|
866
|
+
}, re = (c) => {
|
|
867
|
+
P(c.items);
|
|
868
|
+
}, ce = (c, m) => {
|
|
869
|
+
let L = !1;
|
|
870
|
+
s.value = s.value.filter((E) => m === E ? (L = !0, !1) : !0), L || s.value.push(m), t(c, s.value);
|
|
871
|
+
}, Z = b(() => {
|
|
872
|
+
const c = (E) => s.value.includes(E.value), m = (E) => !!E.find((z) => c(z));
|
|
873
|
+
return e.items.filter((E) => E.items && m(E.items) ? !0 : c(E));
|
|
874
|
+
}), de = b(() => {
|
|
875
|
+
var c;
|
|
876
|
+
return ((c = Z.value) == null ? void 0 : c.length) > 0;
|
|
877
|
+
}), N = b(
|
|
878
|
+
() => {
|
|
879
|
+
var c, m;
|
|
880
|
+
return ((c = y.value) == null ? void 0 : c.length) === ((m = i.value) == null ? void 0 : m.length);
|
|
881
|
+
}
|
|
882
|
+
), ee = b(
|
|
883
|
+
() => n.value ? [n.value] : []
|
|
884
|
+
), $e = b(
|
|
885
|
+
() => {
|
|
886
|
+
var c, m;
|
|
887
|
+
return (m = (c = u.value) == null ? void 0 : c.$children) != null && m.length ? u.value.$children : [];
|
|
888
|
+
}
|
|
889
|
+
), ke = b(
|
|
890
|
+
() => {
|
|
891
|
+
var c, m;
|
|
892
|
+
return (m = (c = r.value) == null ? void 0 : c.$children) != null && m.length ? r.value.$children : [];
|
|
893
|
+
}
|
|
894
|
+
), Re = b(() => ({ label: O, value: _ })), De = b(() => [
|
|
895
|
+
Re,
|
|
896
|
+
...Z.value,
|
|
897
|
+
...i.value
|
|
898
|
+
]), Ne = (c) => {
|
|
899
|
+
[
|
|
900
|
+
...ee.value,
|
|
901
|
+
...$e.value,
|
|
902
|
+
...ke.value
|
|
903
|
+
][c].$el.focus();
|
|
904
|
+
}, { moveToNextElement: Pe, moveToPreviousElement: Me, moveToFirstElement: Ue, moveToLastElement: we } = Ae(
|
|
905
|
+
{
|
|
906
|
+
items: R(De),
|
|
907
|
+
isOptionDisabled: e.isOptionDisabled
|
|
908
|
+
},
|
|
909
|
+
Ne
|
|
910
|
+
), Ve = {
|
|
911
|
+
[x.ARROW_UP]: Me,
|
|
912
|
+
[x.ARROW_DOWN]: Pe,
|
|
913
|
+
[x.HOME]: Ue,
|
|
914
|
+
[x.END]: we
|
|
915
|
+
};
|
|
916
|
+
return {
|
|
917
|
+
// Refs
|
|
918
|
+
selectAllListboxItemsRef: n,
|
|
919
|
+
selectedListboxItemsRef: u,
|
|
920
|
+
listboxItemsRef: r,
|
|
921
|
+
// Values
|
|
922
|
+
isAllSelected: _,
|
|
923
|
+
isAllItemsIncludingDisabled: N,
|
|
924
|
+
isAnOptionSelected: de,
|
|
925
|
+
isIndeterminate: I,
|
|
926
|
+
isMultiLevelSelect: o,
|
|
927
|
+
flattenedItemsList: i,
|
|
928
|
+
selectedItemsList: s,
|
|
929
|
+
selectAllCheckboxText: O,
|
|
930
|
+
selectedOptions: Z,
|
|
931
|
+
slots: d,
|
|
932
|
+
// Enums
|
|
933
|
+
BentoListboxEvent: a,
|
|
934
|
+
// Methods
|
|
935
|
+
selectAllCategory: Q,
|
|
936
|
+
toggleCheckboxSelection: ce,
|
|
937
|
+
toggleSelectAll: k,
|
|
938
|
+
unselectAllCategory: re,
|
|
939
|
+
// Events
|
|
940
|
+
listboxListeners: Ve
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
});
|
|
944
|
+
const Be = (e) => (xe("data-v-8c62bb32"), e = e(), Ye(), e), St = { key: 0 }, Et = /* @__PURE__ */ Be(() => /* @__PURE__ */ M("hr", { class: "b-listbox-multi-select__divider" }, null, -1)), Ct = /* @__PURE__ */ Be(() => /* @__PURE__ */ M("hr", { class: "b-listbox-multi-select__divider" }, null, -1));
|
|
945
|
+
function _t(e, t, d, p, n, u) {
|
|
946
|
+
const r = C("bento-checkbox"), s = C("bento-typography"), o = C("bento-listbox-option"), i = C("listbox-multi-select-options"), f = ge("bento-keyboard-navigation-directive");
|
|
947
|
+
return J((S(), B("div", U({ class: "b-listbox-multi-select" }, se(e.listboxListeners, !0)), [
|
|
948
|
+
A(o, {
|
|
949
|
+
ref: "selectAllListboxItemsRef",
|
|
950
|
+
class: "b-listbox-multi-select__option"
|
|
951
|
+
}, {
|
|
952
|
+
default: T(() => [
|
|
953
|
+
A(r, {
|
|
954
|
+
"aria-label": e.selectAllCheckboxText,
|
|
955
|
+
"model-value": e.isAllSelected,
|
|
956
|
+
indeterminate: e.isIndeterminate,
|
|
957
|
+
"onUpdate:modelValue": e.toggleSelectAll
|
|
958
|
+
}, null, 8, ["aria-label", "model-value", "indeterminate", "onUpdate:modelValue"]),
|
|
959
|
+
A(s, { el: "span" }, {
|
|
960
|
+
default: T(() => [
|
|
961
|
+
V(G(e.selectAllCheckboxText), 1)
|
|
962
|
+
]),
|
|
963
|
+
_: 1
|
|
964
|
+
})
|
|
965
|
+
]),
|
|
966
|
+
_: 1
|
|
967
|
+
}, 512),
|
|
968
|
+
e.isAnOptionSelected ? (S(), B("div", St, [
|
|
969
|
+
Et,
|
|
970
|
+
A(i, U({
|
|
971
|
+
ref: "selectedListboxItemsRef",
|
|
972
|
+
items: e.selectedOptions,
|
|
973
|
+
"is-option-disabled": e.isOptionDisabled,
|
|
974
|
+
"is-multi-level": e.isMultiLevelSelect,
|
|
975
|
+
searching: e.searching,
|
|
976
|
+
"selected-items-list": e.selectedItemsList,
|
|
977
|
+
onSelectCategory: e.selectAllCategory,
|
|
978
|
+
onUnselectCategory: e.unselectAllCategory,
|
|
979
|
+
onToggleCheckboxSelection: t[0] || (t[0] = (l) => e.toggleCheckboxSelection(e.BentoListboxEvent.SELECT, l))
|
|
980
|
+
}, {
|
|
981
|
+
[F(e.BentoListboxEvent.SPACE)]: t[1] || (t[1] = (l) => e.toggleCheckboxSelection(e.BentoListboxEvent.SPACE, l))
|
|
982
|
+
}, {
|
|
983
|
+
[F(e.BentoListboxEvent.TAB)]: t[2] || (t[2] = (l) => e.toggleCheckboxSelection(e.BentoListboxEvent.TAB, l))
|
|
984
|
+
}, {
|
|
985
|
+
[F(e.BentoListboxEvent.ENTER)]: t[3] || (t[3] = (l) => e.toggleCheckboxSelection(e.BentoListboxEvent.ENTER, l))
|
|
986
|
+
}), oe({ _: 2 }, [
|
|
987
|
+
q(e.slots, (l, y) => ({
|
|
988
|
+
name: y,
|
|
989
|
+
fn: T((g) => [
|
|
990
|
+
Y(e.$slots, y, w(K(g)), void 0, !0)
|
|
991
|
+
])
|
|
992
|
+
}))
|
|
993
|
+
]), 1040, ["items", "is-option-disabled", "is-multi-level", "searching", "selected-items-list", "onSelectCategory", "onUnselectCategory"])
|
|
994
|
+
])) : le("", !0),
|
|
995
|
+
J(M("div", null, [
|
|
996
|
+
Ct,
|
|
997
|
+
A(i, U({
|
|
998
|
+
ref: "listboxItemsRef",
|
|
999
|
+
items: e.items,
|
|
1000
|
+
"is-option-disabled": e.isOptionDisabled,
|
|
1001
|
+
"is-multi-level": e.isMultiLevelSelect,
|
|
1002
|
+
searching: e.searching,
|
|
1003
|
+
"selected-items-list": e.selectedItemsList,
|
|
1004
|
+
onToggleCheckboxSelection: t[4] || (t[4] = (l) => e.toggleCheckboxSelection(e.BentoListboxEvent.SELECT, l)),
|
|
1005
|
+
onSelectCategory: e.selectAllCategory,
|
|
1006
|
+
onUnselectCategory: e.unselectAllCategory
|
|
1007
|
+
}, {
|
|
1008
|
+
[F(e.BentoListboxEvent.SPACE)]: t[5] || (t[5] = (l) => e.toggleCheckboxSelection(e.BentoListboxEvent.SPACE, l))
|
|
1009
|
+
}, {
|
|
1010
|
+
[F(e.BentoListboxEvent.TAB)]: t[6] || (t[6] = (l) => e.toggleCheckboxSelection(e.BentoListboxEvent.TAB, l))
|
|
1011
|
+
}, {
|
|
1012
|
+
[F(e.BentoListboxEvent.ENTER)]: t[7] || (t[7] = (l) => e.toggleCheckboxSelection(e.BentoListboxEvent.ENTER, l))
|
|
1013
|
+
}), oe({ _: 2 }, [
|
|
1014
|
+
q(e.slots, (l, y) => ({
|
|
1015
|
+
name: y,
|
|
1016
|
+
fn: T((g) => [
|
|
1017
|
+
Y(e.$slots, y, w(K(g)), void 0, !0)
|
|
1018
|
+
])
|
|
1019
|
+
}))
|
|
1020
|
+
]), 1040, ["items", "is-option-disabled", "is-multi-level", "searching", "selected-items-list", "onSelectCategory", "onUnselectCategory"])
|
|
1021
|
+
], 512), [
|
|
1022
|
+
[ve, !e.isAllItemsIncludingDisabled]
|
|
1023
|
+
])
|
|
1024
|
+
], 16)), [
|
|
1025
|
+
[f]
|
|
1026
|
+
]);
|
|
1027
|
+
}
|
|
1028
|
+
const Ce = /* @__PURE__ */ j(yt, [["render", _t], ["__scopeId", "data-v-8c62bb32"]]), _e = {
|
|
1029
|
+
"en-US": {
|
|
1030
|
+
showMore: "Show more",
|
|
1031
|
+
loading: "Loading"
|
|
1032
|
+
}
|
|
1033
|
+
}, Tt = 36, ht = H({
|
|
1034
|
+
name: "bento-listbox",
|
|
1035
|
+
components: {
|
|
1036
|
+
BentoEmptyState: Ke,
|
|
1037
|
+
BentoListboxSingleSelect: at,
|
|
1038
|
+
BentoListboxMultiSelect: Ce,
|
|
1039
|
+
BentoTypography: ne,
|
|
1040
|
+
BentoLoadingIndicator: Fe,
|
|
1041
|
+
BentoLoadingButton: je
|
|
1042
|
+
},
|
|
1043
|
+
directives: { BentoKeyboardNavigationDirective: pe },
|
|
1044
|
+
i18n: { messages: _e },
|
|
1045
|
+
props: {
|
|
1046
|
+
/**
|
|
1047
|
+
* Defines a string value that labels an interactive element.
|
|
1048
|
+
*/
|
|
1049
|
+
ariaLabel: { type: String, default: null },
|
|
1050
|
+
/**
|
|
1051
|
+
* Empty state props that will be used with the inner empty state component to be displayed when no search results are found.
|
|
1052
|
+
*/
|
|
1053
|
+
emptyState: {
|
|
1054
|
+
type: Object,
|
|
1055
|
+
default: void 0
|
|
1056
|
+
},
|
|
1057
|
+
/**
|
|
1058
|
+
* Indicates whether there are more items to load
|
|
1059
|
+
*/
|
|
1060
|
+
hasMoreItems: { type: Boolean, default: !1 },
|
|
1061
|
+
/**
|
|
1062
|
+
* Identifies the listbox whose contents are controlled by the the combobox on which the aria-controls attribute is set.
|
|
1063
|
+
*/
|
|
1064
|
+
id: { type: String, required: !0 },
|
|
1065
|
+
/**
|
|
1066
|
+
* Function that allows the options to be disabled
|
|
1067
|
+
*
|
|
1068
|
+
* @type {BentoListboxIsOptionDisabled}
|
|
1069
|
+
* @param {BentoListboxOptionItem} option - Listbox option object
|
|
1070
|
+
* @param {string} option.label - Option's label text
|
|
1071
|
+
* @param {string|number} option.value - Option's value
|
|
1072
|
+
* @param {unknown} option.data - Option's extra data to be passed to the default slot
|
|
1073
|
+
*/
|
|
1074
|
+
isOptionDisabled: {
|
|
1075
|
+
type: Function,
|
|
1076
|
+
default: () => {
|
|
1077
|
+
}
|
|
1078
|
+
},
|
|
1079
|
+
/**
|
|
1080
|
+
* The option elements to populate the listbox with.
|
|
1081
|
+
* It must be an array of {@see BentoListboxOptionItem }
|
|
1082
|
+
* * @property {string} value.label - Text to be displayed in the option
|
|
1083
|
+
* * @property {string,number} value.value - Value of the option
|
|
1084
|
+
*/
|
|
1085
|
+
items: {
|
|
1086
|
+
type: Array,
|
|
1087
|
+
required: !0
|
|
1088
|
+
},
|
|
1089
|
+
/**
|
|
1090
|
+
* Indicates if new options are loading.
|
|
1091
|
+
*/
|
|
1092
|
+
loading: { type: Boolean, default: !1 },
|
|
1093
|
+
/**
|
|
1094
|
+
* The type of `Lazy Load`.
|
|
1095
|
+
* Type "automatic" will enable infinite scrolling
|
|
1096
|
+
* Type "button" will enable lazy loading with "Show more" button
|
|
1097
|
+
*/
|
|
1098
|
+
lazyLoadType: {
|
|
1099
|
+
type: String,
|
|
1100
|
+
default: X.NONE,
|
|
1101
|
+
validator: (e) => Object.values(X).includes(e)
|
|
1102
|
+
},
|
|
1103
|
+
/**
|
|
1104
|
+
* If enabled, the user will be able to select multiple items.
|
|
1105
|
+
*/
|
|
1106
|
+
multiple: { type: Boolean, default: !1 },
|
|
1107
|
+
/**
|
|
1108
|
+
* Messaged displayed when no items are listed in the listbox
|
|
1109
|
+
*/
|
|
1110
|
+
noResultsMessage: { type: String, required: !0 },
|
|
1111
|
+
/**
|
|
1112
|
+
* Flag that indicates that an external search it's being made
|
|
1113
|
+
* to filter out the items inside the the multi-select listbox
|
|
1114
|
+
*
|
|
1115
|
+
* If enabled, hides the "Select all" checkbox in "multiple" mode.
|
|
1116
|
+
*/
|
|
1117
|
+
searching: Ce.props.searching,
|
|
1118
|
+
/**
|
|
1119
|
+
* The `input` value.
|
|
1120
|
+
* Providing an empty string or empty array will select no options.
|
|
1121
|
+
* Set to an empty string `''` if you don't want any of the available options to be selected for single select
|
|
1122
|
+
*/
|
|
1123
|
+
selectedValue: {
|
|
1124
|
+
type: [String, Number, Array],
|
|
1125
|
+
default: void 0
|
|
1126
|
+
},
|
|
1127
|
+
/**
|
|
1128
|
+
* Enables virtual scrolling if set to true or by providing an object with itemHeight function.
|
|
1129
|
+
* The itemHeight function is used to calculate the height of rendered item given it's index.
|
|
1130
|
+
*/
|
|
1131
|
+
virtualScroll: {
|
|
1132
|
+
type: [Boolean, Object],
|
|
1133
|
+
default: !1
|
|
1134
|
+
}
|
|
1135
|
+
},
|
|
1136
|
+
emits: [
|
|
1137
|
+
a.SELECT,
|
|
1138
|
+
a.SPACE,
|
|
1139
|
+
a.SHOW_MORE,
|
|
1140
|
+
a.ENTER,
|
|
1141
|
+
a.ESCAPE,
|
|
1142
|
+
a.TAB
|
|
1143
|
+
],
|
|
1144
|
+
setup(e, { emit: t, slots: d }) {
|
|
1145
|
+
const p = R([]), n = Oe(e, "items"), { t: u } = fe({ messages: _e }), r = b(() => e.lazyLoadType !== X.AUTOMATIC), s = b(() => e.lazyLoadType === X.AUTOMATIC), o = () => {
|
|
1146
|
+
var N;
|
|
1147
|
+
return typeof (e == null ? void 0 : e.virtualScroll) == "object" && ((N = e == null ? void 0 : e.virtualScroll) != null && N.itemHeight) ? e.virtualScroll.itemHeight : Tt;
|
|
1148
|
+
}, {
|
|
1149
|
+
containerRef: i,
|
|
1150
|
+
containerProps: f,
|
|
1151
|
+
onScroll: l,
|
|
1152
|
+
list: y,
|
|
1153
|
+
wrapperProps: g
|
|
1154
|
+
} = Je(n, {
|
|
1155
|
+
itemHeight: o(),
|
|
1156
|
+
// Disable virtual scrolling if not enabled or if lazy loading is enabled or if multi-select
|
|
1157
|
+
disabled: (e == null ? void 0 : e.multiple) || (e == null ? void 0 : e.virtualScroll) === !1 || (e == null ? void 0 : e.lazyLoadType) !== "none"
|
|
1158
|
+
}), O = b(
|
|
1159
|
+
() => r.value ? "true" : void 0
|
|
1160
|
+
), $ = b(
|
|
1161
|
+
() => r.value && e.loading ? "true" : "false"
|
|
1162
|
+
), P = b(
|
|
1163
|
+
() => r.value ? "polite" : void 0
|
|
1164
|
+
), v = (N) => (ee) => {
|
|
1165
|
+
t(N, ee);
|
|
1166
|
+
}, h = () => {
|
|
1167
|
+
t(a.SHOW_MORE);
|
|
1168
|
+
}, _ = ze(() => {
|
|
1169
|
+
const N = i.value, ee = N.scrollTop + N.clientHeight >= N.scrollHeight;
|
|
1170
|
+
e.hasMoreItems && ee && !e.loading && h();
|
|
1171
|
+
}), I = () => {
|
|
1172
|
+
s.value ? _() : l();
|
|
1173
|
+
}, k = b(() => {
|
|
1174
|
+
var N;
|
|
1175
|
+
return e.searching && ((N = e.items) == null ? void 0 : N.length) === 0;
|
|
1176
|
+
}), Q = b(
|
|
1177
|
+
() => e.lazyLoadType === X.BUTTON && e.hasMoreItems
|
|
1178
|
+
), re = b(
|
|
1179
|
+
() => e.loading ? Se.LOADING : Se.START
|
|
1180
|
+
), ce = b(() => e.loading ? u("loading") : u("showMore")), Z = b(() => ({
|
|
1181
|
+
...e.emptyState,
|
|
1182
|
+
variant: "condensed"
|
|
1183
|
+
})), de = {
|
|
1184
|
+
[a.SELECT]: v(a.SELECT),
|
|
1185
|
+
[a.SPACE]: v(a.SPACE),
|
|
1186
|
+
[a.TAB]: v(a.TAB),
|
|
1187
|
+
[a.ENTER]: v(a.ENTER)
|
|
1188
|
+
};
|
|
1189
|
+
return {
|
|
1190
|
+
// Refs
|
|
1191
|
+
listboxRef: i,
|
|
1192
|
+
listboxItemRef: p,
|
|
1193
|
+
// a11y
|
|
1194
|
+
ariaAtomic: O,
|
|
1195
|
+
ariaBusy: $,
|
|
1196
|
+
ariaLive: P,
|
|
1197
|
+
// Values
|
|
1198
|
+
containerProps: f,
|
|
1199
|
+
isSearchResultEmpty: k,
|
|
1200
|
+
limitedEmptyStateProps: Z,
|
|
1201
|
+
loadingButtonState: re,
|
|
1202
|
+
slots: d,
|
|
1203
|
+
shouldDisplayShowMoreButton: Q,
|
|
1204
|
+
showMoreButtonText: ce,
|
|
1205
|
+
virtualisedItems: y,
|
|
1206
|
+
wrapperProps: g,
|
|
1207
|
+
// Enums
|
|
1208
|
+
BentoKeyboardNavigationKeyDownEvent: x,
|
|
1209
|
+
BentoListboxEvent: a,
|
|
1210
|
+
// Methods
|
|
1211
|
+
onListboxContainerScroll: I,
|
|
1212
|
+
onOptionSelected: v,
|
|
1213
|
+
emitShowMore: h,
|
|
1214
|
+
listboxListeners: de
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
});
|
|
1218
|
+
const Ot = ["id", "aria-busy", "aria-atomic", "aria-label", "aria-live"], Lt = {
|
|
1219
|
+
key: 0,
|
|
1220
|
+
class: "b-listbox__empty-search-message"
|
|
1221
|
+
}, At = {
|
|
1222
|
+
key: 2,
|
|
1223
|
+
class: "b-listbox__lazy-load"
|
|
1224
|
+
}, It = {
|
|
1225
|
+
key: 3,
|
|
1226
|
+
class: "b-listbox__lazy-load"
|
|
1227
|
+
};
|
|
1228
|
+
function Bt(e, t, d, p, n, u) {
|
|
1229
|
+
const r = C("bento-empty-state"), s = C("bento-typography"), o = C("bento-listbox-multi-select"), i = C("bento-listbox-single-select"), f = C("bento-loading-button"), l = C("bento-loading-indicator"), y = ge("bento-keyboard-navigation-directive");
|
|
1230
|
+
return J((S(), B("div", U({ id: e.id }, e.containerProps, {
|
|
1231
|
+
class: "b-listbox",
|
|
1232
|
+
role: "listbox",
|
|
1233
|
+
tabindex: "-1",
|
|
1234
|
+
"aria-busy": e.ariaBusy,
|
|
1235
|
+
"aria-atomic": e.ariaAtomic,
|
|
1236
|
+
"aria-label": e.ariaLabel,
|
|
1237
|
+
"aria-live": e.ariaLive,
|
|
1238
|
+
onScroll: t[0] || (t[0] = (...g) => e.onListboxContainerScroll && e.onListboxContainerScroll(...g))
|
|
1239
|
+
}), [
|
|
1240
|
+
M("div", w(K(e.wrapperProps)), [
|
|
1241
|
+
e.isSearchResultEmpty ? (S(), B("div", Lt, [
|
|
1242
|
+
e.emptyState ? (S(), D(r, w(U({ key: 0 }, e.limitedEmptyStateProps)), null, 16)) : (S(), D(s, {
|
|
1243
|
+
key: 1,
|
|
1244
|
+
el: "span"
|
|
1245
|
+
}, {
|
|
1246
|
+
default: T(() => [
|
|
1247
|
+
V(G(e.noResultsMessage), 1)
|
|
1248
|
+
]),
|
|
1249
|
+
_: 1
|
|
1250
|
+
}))
|
|
1251
|
+
])) : (S(), B(ie, { key: 1 }, [
|
|
1252
|
+
e.multiple ? (S(), D(o, U({
|
|
1253
|
+
key: 0,
|
|
1254
|
+
ref: "listboxItemRef",
|
|
1255
|
+
items: e.items,
|
|
1256
|
+
"selected-values": e.selectedValue,
|
|
1257
|
+
searching: e.searching,
|
|
1258
|
+
"is-option-disabled": e.isOptionDisabled
|
|
1259
|
+
}, se(e.listboxListeners)), oe({ _: 2 }, [
|
|
1260
|
+
q(e.slots, (g, O) => ({
|
|
1261
|
+
name: O,
|
|
1262
|
+
fn: T(($) => [
|
|
1263
|
+
Y(e.$slots, O, w(K($)), void 0, !0)
|
|
1264
|
+
])
|
|
1265
|
+
}))
|
|
1266
|
+
]), 1040, ["items", "selected-values", "searching", "is-option-disabled"])) : (S(), D(i, U({
|
|
1267
|
+
key: 1,
|
|
1268
|
+
ref: "listboxItemRef",
|
|
1269
|
+
items: e.virtualisedItems,
|
|
1270
|
+
"selected-value": e.selectedValue,
|
|
1271
|
+
"is-option-disabled": e.isOptionDisabled
|
|
1272
|
+
}, se(e.listboxListeners)), oe({ _: 2 }, [
|
|
1273
|
+
q(e.slots, (g, O) => ({
|
|
1274
|
+
name: O,
|
|
1275
|
+
fn: T(($) => [
|
|
1276
|
+
Y(e.$slots, O, w(K($)), void 0, !0)
|
|
1277
|
+
])
|
|
1278
|
+
}))
|
|
1279
|
+
]), 1040, ["items", "selected-value", "is-option-disabled"])),
|
|
1280
|
+
e.shouldDisplayShowMoreButton ? (S(), B("div", At, [
|
|
1281
|
+
A(f, {
|
|
1282
|
+
state: e.loadingButtonState,
|
|
1283
|
+
variant: "secondary",
|
|
1284
|
+
onClickCapture: e.emitShowMore
|
|
1285
|
+
}, {
|
|
1286
|
+
default: T(() => [
|
|
1287
|
+
V(G(e.showMoreButtonText), 1)
|
|
1288
|
+
]),
|
|
1289
|
+
_: 1
|
|
1290
|
+
}, 8, ["state", "onClickCapture"])
|
|
1291
|
+
])) : e.loading ? (S(), B("div", It, [
|
|
1292
|
+
A(l)
|
|
1293
|
+
])) : le("", !0)
|
|
1294
|
+
], 64))
|
|
1295
|
+
], 16)
|
|
1296
|
+
], 16, Ot)), [
|
|
1297
|
+
[y]
|
|
1298
|
+
]);
|
|
1299
|
+
}
|
|
1300
|
+
const Ft = /* @__PURE__ */ j(ht, [["render", Bt], ["__scopeId", "data-v-fe2709d5"]]);
|
|
1301
|
+
export {
|
|
1302
|
+
Ft as B,
|
|
1303
|
+
a,
|
|
1304
|
+
X as b
|
|
1305
|
+
};
|
|
1306
|
+
//# sourceMappingURL=listbox.f6e5a11d.js.map
|