@adyen/bento-vue2 1.60.1 → 1.61.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 +114 -7
- package/dist/action-bar.js +1 -1
- package/dist/alert.js +1 -1
- package/dist/assets/accordion-item.css +1 -1
- package/dist/assets/action-bar.css +1 -1
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/button.css +1 -1
- package/dist/assets/card.css +1 -1
- package/dist/assets/dashed-underline.css +1 -1
- package/dist/assets/data-grid.css +1 -1
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/dropdown.css +1 -1
- package/dist/assets/file-uploader.css +1 -1
- package/dist/assets/filter-bar.css +1 -1
- package/dist/assets/header-with-views.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/radio-group.css +1 -1
- package/dist/assets/sidepanel.css +1 -1
- package/dist/button.js +3 -3
- package/dist/card.js +1 -1
- package/dist/chunks/{action-bar.CMqiD6vc.js → action-bar.Bgd_D2d9.js} +5 -5
- package/dist/chunks/{action-bar.CMqiD6vc.js.map → action-bar.Bgd_D2d9.js.map} +1 -1
- package/dist/chunks/{alert.Du9NfW-V.js → alert.C1QHvbmJ.js} +2 -2
- package/dist/chunks/{alert.Du9NfW-V.js.map → alert.C1QHvbmJ.js.map} +1 -1
- package/dist/chunks/{base-modal.xA_DhHx9.js → base-modal.BKjjZPZw.js} +4 -4
- package/dist/chunks/{base-modal.xA_DhHx9.js.map → base-modal.BKjjZPZw.js.map} +1 -1
- package/dist/chunks/{button-actions-with-menu.S7i4V-8E.js → button-actions-with-menu.YN379eYi.js} +4 -4
- package/dist/chunks/{button-actions-with-menu.S7i4V-8E.js.map → button-actions-with-menu.YN379eYi.js.map} +1 -1
- package/dist/chunks/{button-actions.BFtzsfNe.js → button-actions.CHZ2BT5_.js} +2 -2
- package/dist/chunks/{button-actions.BFtzsfNe.js.map → button-actions.CHZ2BT5_.js.map} +1 -1
- package/dist/chunks/{button.BuD-IsW5.js → button.CvgJ_0_Z.js} +21 -10
- package/dist/chunks/button.CvgJ_0_Z.js.map +1 -0
- package/dist/chunks/{calendar.DQiq_EoU.js → calendar.CjVkJzjc.js} +2 -2
- package/dist/chunks/{calendar.DQiq_EoU.js.map → calendar.CjVkJzjc.js.map} +1 -1
- package/dist/chunks/{card.Bk7Lz1GS.js → card.CcDdIUvd.js} +2 -2
- package/dist/chunks/{card.Bk7Lz1GS.js.map → card.CcDdIUvd.js.map} +1 -1
- package/dist/chunks/{code-snippet.BlYhf-Dt.js → code-snippet.gRALClm3.js} +5 -5
- package/dist/chunks/{code-snippet.BlYhf-Dt.js.map → code-snippet.gRALClm3.js.map} +1 -1
- package/dist/chunks/{copy.Bod4H2Dk.js → copy.qU5LvaNi.js} +2 -2
- package/dist/chunks/{copy.Bod4H2Dk.js.map → copy.qU5LvaNi.js.map} +1 -1
- package/dist/chunks/{dashboard-section.Dx6eYon4.js → dashboard-section.Bn5RJCPR.js} +3 -3
- package/dist/chunks/{dashboard-section.Dx6eYon4.js.map → dashboard-section.Bn5RJCPR.js.map} +1 -1
- package/dist/chunks/dashed-underline._q5UFPSC.js +78 -0
- package/dist/chunks/dashed-underline._q5UFPSC.js.map +1 -0
- package/dist/chunks/{data-grid-template.CVl3PU0v.js → data-grid-template.CrpwSZRE.js} +4 -4
- package/dist/chunks/{data-grid-template.CVl3PU0v.js.map → data-grid-template.CrpwSZRE.js.map} +1 -1
- package/dist/chunks/{data-grid.BZaXKTLk.js → data-grid.ZBzlPPcj.js} +351 -348
- package/dist/chunks/data-grid.ZBzlPPcj.js.map +1 -0
- package/dist/chunks/{date-picker.lrT6LXe-.js → date-picker.BOEKZKFp.js} +3 -3
- package/dist/chunks/{date-picker.lrT6LXe-.js.map → date-picker.BOEKZKFp.js.map} +1 -1
- package/dist/chunks/{date-range-picker.Djt5mYvh.js → date-range-picker.DMHCqAZA.js} +6 -6
- package/dist/chunks/{date-range-picker.Djt5mYvh.js.map → date-range-picker.DMHCqAZA.js.map} +1 -1
- package/dist/chunks/delight.CDBAFnwC.js +5 -0
- package/dist/chunks/delight.CDBAFnwC.js.map +1 -0
- package/dist/chunks/delight.xKDCvvaS.js +5 -0
- package/dist/chunks/delight.xKDCvvaS.js.map +1 -0
- package/dist/chunks/{dialog-page.C5r6tM57.js → dialog-page.CDV828kt.js} +2 -2
- package/dist/chunks/{dialog-page.C5r6tM57.js.map → dialog-page.CDV828kt.js.map} +1 -1
- package/dist/chunks/{dropdown-tag.CY3nZ50z.js → dropdown-tag.CaEPpy4R.js} +2 -2
- package/dist/chunks/{dropdown-tag.CY3nZ50z.js.map → dropdown-tag.CaEPpy4R.js.map} +1 -1
- package/dist/chunks/{dropdown.Cx-3TGBk.js → dropdown.3c5SsPV1.js} +89 -74
- package/dist/chunks/{dropdown.Cx-3TGBk.js.map → dropdown.3c5SsPV1.js.map} +1 -1
- package/dist/chunks/empty-state.DXDb-S58.js +151 -0
- package/dist/chunks/empty-state.DXDb-S58.js.map +1 -0
- package/dist/chunks/es6.n1ewaW31.js.map +1 -1
- package/dist/chunks/{file-uploader.E18P6eyS.js → file-uploader.ChDPu4V7.js} +3 -3
- package/dist/chunks/{file-uploader.E18P6eyS.js.map → file-uploader.ChDPu4V7.js.map} +1 -1
- package/dist/chunks/{filter-bar.D6IL1UDu.js → filter-bar.BVRAteKx.js} +545 -540
- package/dist/chunks/filter-bar.BVRAteKx.js.map +1 -0
- package/dist/chunks/{fixed-scroller.D0a6q8_i.js → fixed-scroller.DPiQh_o-.js} +2 -2
- package/dist/chunks/{fixed-scroller.D0a6q8_i.js.map → fixed-scroller.DPiQh_o-.js.map} +1 -1
- package/dist/chunks/{footer-actions.BgpSnSSn.js → footer-actions.B3pFu9GM.js} +3 -3
- package/dist/chunks/{footer-actions.BgpSnSSn.js.map → footer-actions.B3pFu9GM.js.map} +1 -1
- package/dist/chunks/{form-layout-title.DBCY18f8.js → form-layout-title.Ck5QqPkA.js} +2 -2
- package/dist/chunks/{form-layout-title.DBCY18f8.js.map → form-layout-title.Ck5QqPkA.js.map} +1 -1
- package/dist/chunks/{header-with-views.DAdbhhG9.js → header-with-views.BlEEUDWs.js} +486 -484
- package/dist/chunks/{header-with-views.DAdbhhG9.js.map → header-with-views.BlEEUDWs.js.map} +1 -1
- package/dist/chunks/{header.8SId1U5r.js → header.BfxNBVCD.js} +4 -4
- package/dist/chunks/{header.8SId1U5r.js.map → header.BfxNBVCD.js.map} +1 -1
- package/dist/chunks/{info-icon-with-popover.XZqkxPsB.js → info-icon-with-popover.B4Q8jmW7.js} +2 -2
- package/dist/chunks/{info-icon-with-popover.XZqkxPsB.js.map → info-icon-with-popover.B4Q8jmW7.js.map} +1 -1
- package/dist/chunks/{input-field-password.lK0Im1eg.js → input-field-password.Ciw4TWWq.js} +5 -5
- package/dist/chunks/{input-field-password.lK0Im1eg.js.map → input-field-password.Ciw4TWWq.js.map} +1 -1
- package/dist/chunks/{input-field-phone-number.BnjBqUKg.js → input-field-phone-number.CRx64sme.js} +3 -3
- package/dist/chunks/{input-field-phone-number.BnjBqUKg.js.map → input-field-phone-number.CRx64sme.js.map} +1 -1
- package/dist/chunks/{input-field.B8HxtNIv.js → input-field.DOnqD_Fx.js} +2 -2
- package/dist/chunks/{input-field.B8HxtNIv.js.map → input-field.DOnqD_Fx.js.map} +1 -1
- package/dist/chunks/{inspector.CegHqvEW.js → inspector.tn1wr5hV.js} +2 -2
- package/dist/chunks/{inspector.CegHqvEW.js.map → inspector.tn1wr5hV.js.map} +1 -1
- package/dist/chunks/{menu.CT0SIn4v.js → menu.B_DCBdeN.js} +3 -3
- package/dist/chunks/{menu.CT0SIn4v.js.map → menu.B_DCBdeN.js.map} +1 -1
- package/dist/chunks/{modal-fullscreen.tofT1h0P.js → modal-fullscreen.cBUMfJhU.js} +4 -4
- package/dist/chunks/{modal-fullscreen.tofT1h0P.js.map → modal-fullscreen.cBUMfJhU.js.map} +1 -1
- package/dist/chunks/{modal.CiYtGu6u.js → modal.DWkmyvRc.js} +5 -5
- package/dist/chunks/{modal.CiYtGu6u.js.map → modal.DWkmyvRc.js.map} +1 -1
- package/dist/chunks/{pagination.B-EP9Lkq.js → pagination.pzY_1Qqp.js} +3 -3
- package/dist/chunks/{pagination.B-EP9Lkq.js.map → pagination.pzY_1Qqp.js.map} +1 -1
- package/dist/chunks/{popover.COaHa4ES.js → popover.BN2VK6KG.js} +3 -3
- package/dist/chunks/{popover.COaHa4ES.js.map → popover.BN2VK6KG.js.map} +1 -1
- package/dist/chunks/{promo-banner.DJpA7Whg.js → promo-banner.Cua4uX1x.js} +2 -2
- package/dist/chunks/{promo-banner.DJpA7Whg.js.map → promo-banner.Cua4uX1x.js.map} +1 -1
- package/dist/chunks/{rich-text-editor.C4NdjtLA.js → rich-text-editor.BRlygI8q.js} +2 -2
- package/dist/chunks/{rich-text-editor.C4NdjtLA.js.map → rich-text-editor.BRlygI8q.js.map} +1 -1
- package/dist/chunks/{search-bar.B4u_IgiI.js → search-bar.C10szx9Q.js} +3 -3
- package/dist/chunks/{search-bar.B4u_IgiI.js.map → search-bar.C10szx9Q.js.map} +1 -1
- package/dist/chunks/{secondary-nav.EROJ_sJQ.js → secondary-nav.Bdxei6WP.js} +2 -2
- package/dist/chunks/{secondary-nav.EROJ_sJQ.js.map → secondary-nav.Bdxei6WP.js.map} +1 -1
- package/dist/chunks/{sidepanel.3EBWM8JV.js → sidepanel.X5Te2FiT.js} +4 -4
- package/dist/chunks/{sidepanel.3EBWM8JV.js.map → sidepanel.X5Te2FiT.js.map} +1 -1
- package/dist/chunks/{structured-list-item.rOTJM0uc.js → structured-list-item.n5vrbuW9.js} +3 -3
- package/dist/chunks/{structured-list-item.rOTJM0uc.js.map → structured-list-item.n5vrbuW9.js.map} +1 -1
- package/dist/chunks/{summary-grid.types.Bg1Y7i-F.js → summary-grid.types.D23lQ-e5.js} +3 -3
- package/dist/chunks/{summary-grid.types.Bg1Y7i-F.js.map → summary-grid.types.D23lQ-e5.js.map} +1 -1
- package/dist/chunks/{tabs.DX_Gq12z.js → tabs.DKehFLDL.js} +2 -2
- package/dist/chunks/{tabs.DX_Gq12z.js.map → tabs.DKehFLDL.js.map} +1 -1
- package/dist/chunks/{textarea.0PapD8Nl.js → textarea.D09495Nz.js} +2 -2
- package/dist/chunks/{textarea.0PapD8Nl.js.map → textarea.D09495Nz.js.map} +1 -1
- package/dist/chunks/{timeline-item.IFw76Qeh.js → timeline-item.DKPI-4iu.js} +5 -5
- package/dist/chunks/{timeline-item.IFw76Qeh.js.map → timeline-item.DKPI-4iu.js.map} +1 -1
- package/dist/chunks/{toast.B2u2W_TQ.js → toast.C_uVjJnK.js} +2 -2
- package/dist/chunks/{toast.B2u2W_TQ.js.map → toast.C_uVjJnK.js.map} +1 -1
- package/dist/chunks/{toggle-button.ChDbeBZ8.js → toggle-button.COEDg5Ym.js} +2 -2
- package/dist/chunks/{toggle-button.ChDbeBZ8.js.map → toggle-button.COEDg5Ym.js.map} +1 -1
- package/dist/chunks/{tutorial.suIRmXta.js → tutorial.DgmK5EEo.js} +4 -4
- package/dist/chunks/{tutorial.suIRmXta.js.map → tutorial.DgmK5EEo.js.map} +1 -1
- package/dist/chunks/{use-cached-selected-values.9OnD_j5F.js → use-cached-selected-values.C-umGJXi.js} +451 -445
- package/dist/chunks/use-cached-selected-values.C-umGJXi.js.map +1 -0
- package/dist/code-snippet.js +1 -1
- package/dist/dashboard-template.js +1 -1
- package/dist/dashed-underline.js +1 -1
- package/dist/data-grid-template.js +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/date-picker.js +2 -2
- package/dist/date-range-picker.js +2 -2
- package/dist/dropdown.js +3 -3
- package/dist/empty-state.js +1 -1
- package/dist/file-uploader.js +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/form-layout.js +1 -1
- package/dist/header-with-views.js +1 -1
- package/dist/header.js +1 -1
- package/dist/index.js +45 -45
- 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/inspector.js +1 -1
- package/dist/internal.js +8 -8
- package/dist/menu.js +1 -1
- package/dist/modal-fullscreen.js +1 -1
- package/dist/modal.js +2 -2
- package/dist/pagination.js +1 -1
- package/dist/popover.js +1 -1
- package/dist/promo-banner.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/sidepanel.js +1 -1
- package/dist/structured-list.js +1 -1
- package/dist/styles/bento-dark.css +1 -0
- package/dist/styles/bento-light.css +1 -0
- package/dist/styles/bento.css +1 -0
- package/dist/styles/legacy.css +1 -0
- package/dist/styles/styleguide.css +1 -0
- package/dist/summary-grid.js +1 -1
- package/dist/tabs.js +1 -1
- package/dist/textarea.js +1 -1
- package/dist/timeline.js +1 -1
- package/dist/toast.js +1 -1
- package/dist/tutorial.js +1 -1
- package/dist/web-types.json +20 -1
- package/package.json +5 -5
- package/dist/chunks/button.BuD-IsW5.js.map +0 -1
- package/dist/chunks/dashed-underline.CY5J4pZp.js +0 -65
- package/dist/chunks/dashed-underline.CY5J4pZp.js.map +0 -1
- package/dist/chunks/data-grid.BZaXKTLk.js.map +0 -1
- package/dist/chunks/empty-state.IvvHHQ35.js +0 -151
- package/dist/chunks/empty-state.IvvHHQ35.js.map +0 -1
- package/dist/chunks/filter-bar.D6IL1UDu.js.map +0 -1
- package/dist/chunks/use-cached-selected-values.9OnD_j5F.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-page.C5r6tM57.js","sources":["../../../ui-assets/icons-16/dist/vue/arrow-left.vue","../../src/components/internal/dialog-page/dialog-page.types.ts","../../src/components/internal/dialog-page/dialog-page.keys.ts","../../src/components/internal/dialog-page/dialog-page.vue"],"sourcesContent":["\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><path fill=\"#00112C\" d=\"M3.80655 7.25434L8.06077 3.00011L7.00011 1.93945L0.939453 8.00011L7.00011 14.0608L8.06077 13.0001L3.81499 8.75433L14.7508 8.74316L14.7492 7.24316L3.80655 7.25434Z\"/></svg>\n</template>\n<script>\n import '../css/main.css';\n\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n","import { Ref } from 'vue';\n\nexport enum BentoDialogPageAnimation {\n TRANSITION_LEVEL_DEEPER = 'b-dialog-page__animation--level-deeper',\n TRANSITION_LEVEL_UPPER = 'b-dialog-page__animation--level-upper',\n}\n\nexport interface BentoDialogPageConfigData {\n activePage: Ref<string>;\n animation: Ref<string>;\n isAnimationActive?: Ref<boolean>;\n isOpen: Ref<boolean>;\n pages: Ref<string[]>;\n previousPages: Ref<string[]>;\n updatePage: (page: string) => void;\n}\n\nexport type BentoDialogPageRegisterPage = (pageId: string) => { unregisterPage: () => void };\n","export const DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY = Symbol('dialog registerPage injection key');\nexport const DIALOG_PAGE_CONFIG_INJECTION_KEY = Symbol('dialog page config data injection key');\n","<template>\n <Transition :name=\"animation\" mode=\"out-in\" @after-leave=\"updateAnimation\" @leave=\"startAnimation\">\n <div v-if=\"isOpen && showPage\" class=\"b-dialog-page\">\n <div v-if=\"hasSlot('header')\" class=\"b-dialog-page__header\" :class=\"headerConditionalClasses\">\n <div\n v-if=\"showBackButton\"\n class=\"b-dialog-page__back-button\"\n :style=\"backButtonStyling\"\n data-testid=\"back-button\"\n >\n <bento-button variant=\"tertiary\" @click=\"goToPreviousPage(previousPage)\">\n <arrow-left-icon :svg-title=\"t('goToPreviousPage')\" />\n </bento-button>\n </div>\n <slot name=\"header\"></slot>\n </div>\n <div\n v-if=\"hasSlot('content')\"\n ref=\"contentElement\"\n class=\"b-dialog-page__content\"\n :tabindex=\"isScrollable ? 0 : null\"\n @scroll=\"onScroll\"\n >\n <slot name=\"content\" />\n </div>\n <div v-if=\"hasSlot('footer')\" class=\"b-dialog-page__footer\" :class=\"footerConditionalClasses\">\n <slot name=\"footer\" />\n </div>\n </div>\n </Transition>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, inject, nextTick, onUnmounted, PropType, ref, useSlots, watch } from 'vue';\n\n import { BentoButton } from '@/components/button';\n import ArrowLeftIcon from '@adyen/ui-assets-icons-16/vue/arrow-left';\n\n import { useHasSlot } from '@/composables/use-has-slot/use-has-slot';\n import { useI18n } from '@/utils/ts/i18n';\n import { isDevelopmentEnviroment } from '@/utils/ts/dev-environment';\n\n import {\n BentoDialogPageAnimation,\n BentoDialogPageConfigData,\n BentoDialogPageRegisterPage,\n } from './dialog-page.types';\n import type { CSSProperties } from 'vue/types/jsx.d.ts';\n\n import { DIALOG_PAGE_CONFIG_INJECTION_KEY, DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY } from './dialog-page.keys';\n\n import messages from './messages.json';\n import { useScroll } from '@vueuse/core';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n /**\n * Identifier of the page, used with activePage prop to handle navigation\n */\n pageId: {\n type: String,\n default: undefined,\n },\n\n /**\n * Show header and actions border\n */\n alwaysShowBorder: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Pass custom styling to the back button to position it correctly with the header slot\n */\n backButtonStyling: { type: Object as PropType<CSSProperties>, default: null },\n\n /**\n * ID of the page for the back button to navigate to. Only use it to overwrite the default back behavior\n * Used when the back button should not take the user to the natural previous page\n * Set to `null` to hide back button in the page\n */\n previousPage: {\n type: String,\n default: undefined,\n },\n });\n\n const emit = defineEmits([\"animationend\"]);\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n // Refs\n const contentElement = ref<HTMLDivElement>(null);\n const hasScroll = ref(false);\n\n const { arrivedState } = useScroll(contentElement);\n\n // Logic to choose which page is active/shown\n const showPage = computed(() => (activePage.value ? activePage.value === props.pageId : true));\n\n // Scrolling styling logic\n const headerConditionalClasses = computed(() => ({\n 'b-dialog-page__header--with-border': props.alwaysShowBorder || (hasScroll.value && !arrivedState.top),\n }));\n\n const footerConditionalClasses = computed(() => ({\n 'b-dialog-page__footer--with-border': props.alwaysShowBorder || (hasScroll.value && !arrivedState.bottom),\n }));\n\n const isScrollable = computed(() => !(arrivedState.bottom && arrivedState.top));\n\n const onScroll = () => {\n if (!contentElement.value) {\n return;\n }\n };\n\n const calculateScroll = async watchedValue => {\n if (!watchedValue) {\n return;\n }\n // Wait for content to be rendered to be able to calculate the height\n await nextTick();\n hasScroll.value = contentElement.value && contentElement.value.scrollHeight > contentElement.value.clientHeight;\n };\n\n const { activePage, animation, isAnimationActive, isOpen, pages, previousPages, updatePage } =\n inject<BentoDialogPageConfigData>(DIALOG_PAGE_CONFIG_INJECTION_KEY);\n\n watch(() => isOpen.value, calculateScroll, { immediate: true });\n watch(() => showPage.value, calculateScroll, { immediate: true });\n\n // Logic to determine whether the back button should be shown on the page\n const showBackButton = computed(() => {\n if (props.previousPage) {\n return true;\n }\n if (props.previousPage === null) {\n return false;\n }\n return hasPreviousPages.value && showPage.value;\n });\n\n // Animation\n const updateAnimation = () => {\n animation.value = BentoDialogPageAnimation.TRANSITION_LEVEL_DEEPER;\n if (isAnimationActive) {\n isAnimationActive.value = false;\n }\n\n emit('animationend');\n };\n\n const startAnimation = () => {\n if (isAnimationActive) {\n isAnimationActive.value = true;\n }\n };\n\n // Previous page logic\n const hasPreviousPages = computed(() => previousPages.value.length > 1);\n const lastPage = computed(() => previousPages.value[previousPages.value.length - 1]);\n const isActivePageValid = computed(() => pages.value.some(page => page === activePage.value));\n\n const goToPreviousPage = async (page: string) => {\n if (page) {\n const index = previousPages.value.indexOf(page);\n if (index !== -1) {\n previousPages.value = previousPages.value.slice(0, index + 1);\n } else {\n previousPages.value = [page];\n }\n } else {\n previousPages.value.pop();\n }\n\n animation.value = BentoDialogPageAnimation.TRANSITION_LEVEL_UPPER;\n await nextTick();\n updatePage(lastPage.value);\n };\n\n // Add new page to the previousPage array to keep track of user navigation\n watch(\n () => activePage.value,\n async () => {\n await nextTick();\n if (!isOpen.value) {\n return;\n }\n\n if (!!activePage.value && !isActivePageValid.value) {\n if (isDevelopmentEnviroment) {\n // eslint-disable-next-line no-console\n console.error(\n `The activePage passed \"${activePage.value}\" does not match the id of any of the pages`\n );\n return;\n }\n }\n\n if (activePage.value !== lastPage.value) {\n previousPages.value.push(activePage.value);\n }\n },\n { immediate: true }\n );\n\n // Register page to parent component and inject data from parent component\n const registerPage = inject<BentoDialogPageRegisterPage>(DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY);\n const { unregisterPage } = registerPage(props.pageId);\n\n // Unregister page on unmounting the page\n onUnmounted(() => unregisterPage());\n</script>\n\n<script lang=\"ts\">\n /**\n * DialogPage is an internal component used to render different pages of dialog components (Modal, ModalFullscreen and Sidepanel)\n *\n * @example\n * import { DialogPage } from '@/internal';\n *\n * export default {\n * components: { DialogPage },\n * template: `\n * <dialog-page pageId='step1' always-show-border>\n * <template #header>Header</template>\n * <template #content>Content</template>\n * <template #footer>Footer</template>\n * </dialog-page>\n * `\n * }\n */\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./dialog-page.scss\" />\n"],"names":["uuid","_sfc_main$1","BentoDialogPageAnimation","BentoDialogPageAnimation2","DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY","DIALOG_PAGE_CONFIG_INJECTION_KEY","__default__","messages","slots","useSlots","hasSlot","useHasSlot","t","useI18n","contentElement","ref","hasScroll","arrivedState","useScroll","showPage","computed","activePage","props","headerConditionalClasses","footerConditionalClasses","isScrollable","onScroll","calculateScroll","watchedValue","nextTick","animation","isAnimationActive","isOpen","pages","previousPages","updatePage","inject","watch","showBackButton","hasPreviousPages","updateAnimation","emit","startAnimation","lastPage","isActivePageValid","page","goToPreviousPage","index","isDevelopmentEnviroment","registerPage","unregisterPage","onUnmounted"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"dialog-page.CDV828kt.js","sources":["../../../ui-assets/icons-16/dist/vue/arrow-left.vue","../../src/components/internal/dialog-page/dialog-page.types.ts","../../src/components/internal/dialog-page/dialog-page.keys.ts","../../src/components/internal/dialog-page/dialog-page.vue"],"sourcesContent":["\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><path fill=\"#00112C\" d=\"M3.80655 7.25434L8.06077 3.00011L7.00011 1.93945L0.939453 8.00011L7.00011 14.0608L8.06077 13.0001L3.81499 8.75433L14.7508 8.74316L14.7492 7.24316L3.80655 7.25434Z\"/></svg>\n</template>\n<script>\n import '../css/main.css';\n\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\n</script>\n","import { Ref } from 'vue';\n\nexport enum BentoDialogPageAnimation {\n TRANSITION_LEVEL_DEEPER = 'b-dialog-page__animation--level-deeper',\n TRANSITION_LEVEL_UPPER = 'b-dialog-page__animation--level-upper',\n}\n\nexport interface BentoDialogPageConfigData {\n activePage: Ref<string>;\n animation: Ref<string>;\n isAnimationActive?: Ref<boolean>;\n isOpen: Ref<boolean>;\n pages: Ref<string[]>;\n previousPages: Ref<string[]>;\n updatePage: (page: string) => void;\n}\n\nexport type BentoDialogPageRegisterPage = (pageId: string) => { unregisterPage: () => void };\n","export const DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY = Symbol('dialog registerPage injection key');\nexport const DIALOG_PAGE_CONFIG_INJECTION_KEY = Symbol('dialog page config data injection key');\n","<template>\n <Transition :name=\"animation\" mode=\"out-in\" @after-leave=\"updateAnimation\" @leave=\"startAnimation\">\n <div v-if=\"isOpen && showPage\" class=\"b-dialog-page\">\n <div v-if=\"hasSlot('header')\" class=\"b-dialog-page__header\" :class=\"headerConditionalClasses\">\n <div\n v-if=\"showBackButton\"\n class=\"b-dialog-page__back-button\"\n :style=\"backButtonStyling\"\n data-testid=\"back-button\"\n >\n <bento-button variant=\"tertiary\" @click=\"goToPreviousPage(previousPage)\">\n <arrow-left-icon :svg-title=\"t('goToPreviousPage')\" />\n </bento-button>\n </div>\n <slot name=\"header\"></slot>\n </div>\n <div\n v-if=\"hasSlot('content')\"\n ref=\"contentElement\"\n class=\"b-dialog-page__content\"\n :tabindex=\"isScrollable ? 0 : null\"\n @scroll=\"onScroll\"\n >\n <slot name=\"content\" />\n </div>\n <div v-if=\"hasSlot('footer')\" class=\"b-dialog-page__footer\" :class=\"footerConditionalClasses\">\n <slot name=\"footer\" />\n </div>\n </div>\n </Transition>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, inject, nextTick, onUnmounted, PropType, ref, useSlots, watch } from 'vue';\n\n import { BentoButton } from '@/components/button';\n import ArrowLeftIcon from '@adyen/ui-assets-icons-16/vue/arrow-left';\n\n import { useHasSlot } from '@/composables/use-has-slot/use-has-slot';\n import { useI18n } from '@/utils/ts/i18n';\n import { isDevelopmentEnviroment } from '@/utils/ts/dev-environment';\n\n import {\n BentoDialogPageAnimation,\n BentoDialogPageConfigData,\n BentoDialogPageRegisterPage,\n } from './dialog-page.types';\n import type { CSSProperties } from 'vue/types/jsx.d.ts';\n\n import { DIALOG_PAGE_CONFIG_INJECTION_KEY, DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY } from './dialog-page.keys';\n\n import messages from './messages.json';\n import { useScroll } from '@vueuse/core';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n /**\n * Identifier of the page, used with activePage prop to handle navigation\n */\n pageId: {\n type: String,\n default: undefined,\n },\n\n /**\n * Show header and actions border\n */\n alwaysShowBorder: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Pass custom styling to the back button to position it correctly with the header slot\n */\n backButtonStyling: { type: Object as PropType<CSSProperties>, default: null },\n\n /**\n * ID of the page for the back button to navigate to. Only use it to overwrite the default back behavior\n * Used when the back button should not take the user to the natural previous page\n * Set to `null` to hide back button in the page\n */\n previousPage: {\n type: String,\n default: undefined,\n },\n });\n\n const emit = defineEmits([\"animationend\"]);\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n // Refs\n const contentElement = ref<HTMLDivElement>(null);\n const hasScroll = ref(false);\n\n const { arrivedState } = useScroll(contentElement);\n\n // Logic to choose which page is active/shown\n const showPage = computed(() => (activePage.value ? activePage.value === props.pageId : true));\n\n // Scrolling styling logic\n const headerConditionalClasses = computed(() => ({\n 'b-dialog-page__header--with-border': props.alwaysShowBorder || (hasScroll.value && !arrivedState.top),\n }));\n\n const footerConditionalClasses = computed(() => ({\n 'b-dialog-page__footer--with-border': props.alwaysShowBorder || (hasScroll.value && !arrivedState.bottom),\n }));\n\n const isScrollable = computed(() => !(arrivedState.bottom && arrivedState.top));\n\n const onScroll = () => {\n if (!contentElement.value) {\n return;\n }\n };\n\n const calculateScroll = async watchedValue => {\n if (!watchedValue) {\n return;\n }\n // Wait for content to be rendered to be able to calculate the height\n await nextTick();\n hasScroll.value = contentElement.value && contentElement.value.scrollHeight > contentElement.value.clientHeight;\n };\n\n const { activePage, animation, isAnimationActive, isOpen, pages, previousPages, updatePage } =\n inject<BentoDialogPageConfigData>(DIALOG_PAGE_CONFIG_INJECTION_KEY);\n\n watch(() => isOpen.value, calculateScroll, { immediate: true });\n watch(() => showPage.value, calculateScroll, { immediate: true });\n\n // Logic to determine whether the back button should be shown on the page\n const showBackButton = computed(() => {\n if (props.previousPage) {\n return true;\n }\n if (props.previousPage === null) {\n return false;\n }\n return hasPreviousPages.value && showPage.value;\n });\n\n // Animation\n const updateAnimation = () => {\n animation.value = BentoDialogPageAnimation.TRANSITION_LEVEL_DEEPER;\n if (isAnimationActive) {\n isAnimationActive.value = false;\n }\n\n emit('animationend');\n };\n\n const startAnimation = () => {\n if (isAnimationActive) {\n isAnimationActive.value = true;\n }\n };\n\n // Previous page logic\n const hasPreviousPages = computed(() => previousPages.value.length > 1);\n const lastPage = computed(() => previousPages.value[previousPages.value.length - 1]);\n const isActivePageValid = computed(() => pages.value.some(page => page === activePage.value));\n\n const goToPreviousPage = async (page: string) => {\n if (page) {\n const index = previousPages.value.indexOf(page);\n if (index !== -1) {\n previousPages.value = previousPages.value.slice(0, index + 1);\n } else {\n previousPages.value = [page];\n }\n } else {\n previousPages.value.pop();\n }\n\n animation.value = BentoDialogPageAnimation.TRANSITION_LEVEL_UPPER;\n await nextTick();\n updatePage(lastPage.value);\n };\n\n // Add new page to the previousPage array to keep track of user navigation\n watch(\n () => activePage.value,\n async () => {\n await nextTick();\n if (!isOpen.value) {\n return;\n }\n\n if (!!activePage.value && !isActivePageValid.value) {\n if (isDevelopmentEnviroment) {\n // eslint-disable-next-line no-console\n console.error(\n `The activePage passed \"${activePage.value}\" does not match the id of any of the pages`\n );\n return;\n }\n }\n\n if (activePage.value !== lastPage.value) {\n previousPages.value.push(activePage.value);\n }\n },\n { immediate: true }\n );\n\n // Register page to parent component and inject data from parent component\n const registerPage = inject<BentoDialogPageRegisterPage>(DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY);\n const { unregisterPage } = registerPage(props.pageId);\n\n // Unregister page on unmounting the page\n onUnmounted(() => unregisterPage());\n</script>\n\n<script lang=\"ts\">\n /**\n * DialogPage is an internal component used to render different pages of dialog components (Modal, ModalFullscreen and Sidepanel)\n *\n * @example\n * import { DialogPage } from '@/internal';\n *\n * export default {\n * components: { DialogPage },\n * template: `\n * <dialog-page pageId='step1' always-show-border>\n * <template #header>Header</template>\n * <template #content>Content</template>\n * <template #footer>Footer</template>\n * </dialog-page>\n * `\n * }\n */\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./dialog-page.scss\" />\n"],"names":["uuid","_sfc_main$1","BentoDialogPageAnimation","BentoDialogPageAnimation2","DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY","DIALOG_PAGE_CONFIG_INJECTION_KEY","__default__","messages","slots","useSlots","hasSlot","useHasSlot","t","useI18n","contentElement","ref","hasScroll","arrivedState","useScroll","showPage","computed","activePage","props","headerConditionalClasses","footerConditionalClasses","isScrollable","onScroll","calculateScroll","watchedValue","nextTick","animation","isAnimationActive","isOpen","pages","previousPages","updatePage","inject","watch","showBackButton","hasPreviousPages","updateAnimation","emit","startAnimation","lastPage","isActivePageValid","page","goToPreviousPage","index","isDevelopmentEnviroment","registerPage","unregisterPage","onUnmounted"],"mappings":"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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as a, computed as i, toRefs as m } from "vue";
|
|
2
2
|
import { B as v } from "./avatar.BgwjpLQO.js";
|
|
3
|
-
import { B as p } from "./dropdown.
|
|
3
|
+
import { B as p } from "./dropdown.3c5SsPV1.js";
|
|
4
4
|
import { n as c } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
5
5
|
import { d as y, B as b } from "./typography.J1v_SPG3.js";
|
|
6
6
|
import { u as w } from "./use-country-items.HFnjuDsG.js";
|
|
@@ -212,4 +212,4 @@ export {
|
|
|
212
212
|
nt as d,
|
|
213
213
|
st as e
|
|
214
214
|
};
|
|
215
|
-
//# sourceMappingURL=dropdown-tag.
|
|
215
|
+
//# sourceMappingURL=dropdown-tag.CaEPpy4R.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-tag.CY3nZ50z.js","sources":["../../src/components/dropdown/components/variants/dropdown-avatar/dropdown-avatar.vue","../../src/components/dropdown/components/variants/dropdown-country/dropdown-country.vue","../../src/components/dropdown/components/variants/dropdown-currency/dropdown-currency.vue","../../src/components/dropdown/components/variants/dropdown-payment-method/dropdown-payment-method.vue","../../src/components/dropdown/components/variants/dropdown-tag/dropdown-tag.vue"],"sourcesContent":["<template>\n <div>\n <bento-dropdown v-slot=\"{ label, data }\" v-bind=\"$props\" :items=\"dropdownItems\" @input=\"onInput\">\n <bento-avatar :username=\"label\" :src=\"data\" />\n </bento-dropdown>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, defineComponent, PropType } from 'vue';\n import { BentoListboxSelectedValue } from '@/types';\n import { BentoAvatarListboxOptions } from './dropdown-avatar.types';\n import { BentoAvatar } from '@/components/avatar';\n import BentoDropdown from '@/components/dropdown/dropdown.vue';\n\n const props = defineProps({\n ...BentoDropdown.props,\n /**\n * The option elements to populate the avatar dropdown with.\n * It must be an array of {@see BentoAvatarListboxOptions }\n * * @property {string} value.label - Text to be displayed in the option.\n * * @property {string,number} value.value - Value of the option.\n * * @property {string} value.src - Image source of the avatar image.\n */\n items: {\n type: Array as PropType<BentoAvatarListboxOptions>,\n default: () => [],\n },\n });\n\n const emit = defineEmits([\"input\"]);\n\n const onInput = (selectedValue: BentoListboxSelectedValue) => emit('input', selectedValue);\n\n const dropdownItems = computed(() => props.items.map(({ value, label, src }) => ({ value, label, data: src })));\n</script>\n\n<script lang=\"ts\">\n /**\n * A Avatar Dropdown showing a selectable list of countries.\n *\n * @example\n * import { BentoDropdownAvatar } from '@adyen/bento-vue2';\n * import type { BentoAvatarListboxOptions } from '@adyen/bento-vue2'\n *\n * export default {\n * components: { BentoDropdownAvatar },\n * template: `\n * <bento-dropdown-avatar\n * v-model=\"selectedValue\"\n * :disabled=\"false\"\n * :multiple=\"true\"\n * :isOptionsDisabled=\"option => option.value === 2\"\n * :items=\"options\"\n * />\n * `,\n * setup() {\n * const selectedValue = ref('user-id-1') // Default value\n * const options: BentoAvatarListboxOptions = [\n * { label: 'User 1', value: 'user-id-1' },\n * { label: 'User 2', value: 'user-id-2', src: 'image-source.jpeg' },\n * ];\n * return { options, selectedValue };\n * }\n * }\n */\n export default defineComponent({\n name: 'bento-dropdown-avatar',\n });\n</script>\n","<template>\n <div>\n <bento-dropdown v-slot=\"{ label }\" v-bind=\"$props\" :items=\"countryItems\" @input=\"onInput\">\n <bento-typography el=\"span\">{{ label }}</bento-typography>\n </bento-dropdown>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { defineComponent, PropType, toRefs } from 'vue';\n import { BentoCountryListboxOptions } from './dropdown-country.types';\n import { BentoListboxSelectedValue } from '@/types';\n import { BentoTypography } from '@/components/typography';\n import { useCountryItems } from './composables/use-country-items';\n import { deprecate } from '@/utils/ts/deprecate';\n import { BentoCountryVariant } from '@/components/country';\n import BentoDropdown from '@/components/dropdown/dropdown.vue';\n\n const props = defineProps({\n ...BentoDropdown.props,\n /**\n * The option elements to populate the country dropdown with.\n * It must be an array of {@see BentoCountryListboxOptions }\n * * @deprecated {string} value.label - Use BentoDropdown instead of custom labels\n * * @property {BentoCountryCode | string} value.value - Country code of the option\n */\n items: {\n type: Array as PropType<BentoCountryListboxOptions>,\n default: () => [],\n },\n\n /**\n * Which label variant to display.\n * @values iso, name, phone_code, capital\n */\n variant: {\n type: String as PropType<BentoCountryVariant | `${BentoCountryVariant}`>,\n default: BentoCountryVariant.CUSTOM,\n validator: (value: BentoCountryVariant) => Object.values(BentoCountryVariant).includes(value),\n },\n });\n\n const emit = defineEmits([\"input\"]);\n\n const onInput = (selectedValue: BentoListboxSelectedValue) => emit('input', selectedValue);\n\n const { variant, items } = toRefs(props);\n const countryItems = useCountryItems(variant, items);\n\n if (variant.value === 'custom' || items.value.some(item => item.label)) {\n deprecate(\n 'BentoDropdownCountry \"custom\" variant and \"items\" prop \"label\" key',\n 'Use any of the other BentoDropdownCountry variants instead OR use BentoDropdown component for custom labels',\n '2.0.0'\n );\n }\n</script>\n\n<script lang=\"ts\">\n /**\n * A Country Dropdown showing a selectable list of countries.\n *\n * @example\n * import { BentoDropdownCountry, BentoCountryCode } from '@adyen/bento-vue2';\n * import type { BentoCountryListboxOptions } from '@adyen/bento-vue2'\n *\n * export default {\n * components: { BentoDropdown },\n * template: `\n * <bento-dropdown-country\n * v-model=\"selectedValue\"\n * :disabled=\"false\"\n * :multiple=\"true\"\n * :isOptionsDisabled=\"option => option.value === 2\"\n * :items=\"options\"\n * />\n * `,\n * setup() {\n * const selectedValue = ref(BentoCountryCode.NL) // Default value\n * const options: BentoCountryListboxOptions = [\n * { label: 'Option 1', value: BentoCountryCode.NL },\n * { label: 'Option 2', value: BentoCountryCode.BE },\n * ];\n * return { options, selectedValue };\n * }\n * }\n */\n export default defineComponent({\n name: 'b-dropdown-country',\n });\n</script>\n","<template>\n <bento-dropdown v-slot=\"slotProps\" v-bind=\"$props\" @input=\"onInput\">\n <listbox-option-tag :option=\"slotProps\" />\n </bento-dropdown>\n</template>\n\n<script setup lang=\"ts\">\n import { defineComponent, PropType } from 'vue';\n import type { BentoCurrencyListboxOptions } from './dropdown-currency.types';\n import type { BentoListboxSelectedValue } from '@/types';\n import { ListboxOptionTag } from '@/internal';\n import BentoDropdown from '@/components/dropdown/dropdown.vue';\n\n defineProps({\n ...BentoDropdown.props,\n /**\n * The option elements to populate the country dropdown with.\n * It must be an array of {@see BentoCurrencyListboxOptions }\n * * @property {string} value.label - Text to be displayed in the option\n * * @property {BentoCurrencyISOCode} value.code - Currency ISO code of the option\n */\n items: {\n type: Array as PropType<BentoCurrencyListboxOptions>,\n default: () => [],\n },\n });\n\n const emit = defineEmits([\"input\"]);\n\n const onInput = (selectedValue: BentoListboxSelectedValue) => emit('input', selectedValue);\n</script>\n\n<script lang=\"ts\">\n /**\n * A Currency Dropdown showing a selectable list of currencies.\n *\n * @example\n * import { BentoDropdownCountry, BentoCountryCode } from '@adyen/bento-vue2';\n * import type { BentoCountryListboxOptions } from '@adyen/bento-vue2'\n *\n * export default {\n * components: { BentoDropdown },\n * template: `\n * <bento-dropdown-currency\n * v-model=\"selectedValue\"\n * :disabled=\"false\"\n * :multiple=\"true\"\n * :isOptionsDisabled=\"option => option.value === 2\"\n * :items=\"options\"\n * />\n * `,\n * setup() {\n * const selectedValue = ref(BentoCountryCode.NL) // Default value\n * const options: BentoCountryListboxOptions = [\n * { label: 'Option 1', value: BentoCountryCode.NL },\n * { label: 'Option 2', value: BentoCountryCode.BE },\n * ];\n * return { options, selectedValue };\n * }\n * }\n */\n export default defineComponent({\n name: 'b-dropdown-currency',\n });\n</script>\n","<template>\n <div>\n <bento-dropdown v-slot=\"{ value, label }\" v-bind=\"$props\" @input=\"onInput\">\n <bento-payment-method :type=\"value\" :label=\"label\" />\n </bento-dropdown>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { defineComponent, PropType } from 'vue';\n import { BentoPaymentMethodListboxOptions } from './dropdown-payment-method.types';\n import { BentoListboxSelectedValue } from '@/types';\n import { BentoPaymentMethod } from '@/components/payment-method';\n import BentoDropdown from '@/components/dropdown/dropdown.vue';\n\n defineProps({\n ...BentoDropdown.props,\n /**\n * The option elements to populate the payment method dropdown with.\n * It must be an array of {@see BentoPaymentMethodListboxOptions }\n * * @property {string} value.label - Text to be displayed in the option\n * * @property {string} value.value - Payment type code that translates to a payment icon name {@see https://adyen-ui-assets.netlify.app/?path=/story/packages-ui-assets-payment-method-icons--icons}\n */\n items: {\n type: Array as PropType<BentoPaymentMethodListboxOptions>,\n default: () => [],\n },\n });\n\n const emit = defineEmits([\"input\"]);\n\n const onInput = (selectedValue: BentoListboxSelectedValue) => emit('input', selectedValue);\n</script>\n\n<script lang=\"ts\">\n /**\n * A Payment method Dropdown showing a selectable list of countries.\n *\n * @example\n * import { BentoDropdownPaymentMethod } from '@adyen/bento-vue2';\n * import type { BentoPaymentMethodListboxOptions } from '@adyen/bento-vue2'\n *\n * export default {\n * components: { BentoDropdownPaymentMethod },\n * template: `\n * <bento-dropdown-payment-method\n * v-model=\"selectedValue\"\n * :disabled=\"false\"\n * :multiple=\"true\"\n * :isOptionsDisabled=\"option => option.value === 'Visa'\"\n * :items=\"options\"\n * />\n * `,\n * setup() {\n * const selectedValue = ref('ideal') // Default value\n * const options: BentoPaymentMethodListboxOptions = [\n * { label: 'Option 1', value: 'ideal' },\n * { label: 'Option 2', value: 'visa' },\n * ];\n * return { options, selectedValue };\n * }\n * }\n */\n export default defineComponent({\n name: 'bento-dropdown-payment-method',\n });\n</script>\n","<template>\n <bento-dropdown\n v-slot=\"{ label, data }\"\n v-bind=\"$props\"\n class=\"b-dropdown-tag\"\n :items=\"tagItems\"\n show-slot-content-in-multiple\n @input=\"onInput\"\n >\n <listbox-option-tag :option=\"{ value: label, data, label: '' }\" />\n </bento-dropdown>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, defineComponent, PropType } from 'vue';\n import type { BentoTagListboxOptions } from './dropdown-tag.types';\n import type { BentoListboxSelectedValue } from '../../../../../types';\n import { ListboxOptionTag } from '../../../../internal';\n import BentoDropdown from '../../../dropdown.vue';\n\n const props = defineProps({\n ...BentoDropdown.props,\n /**\n * The option elements to populate the tag dropdown with.\n * It must be an array of {@see BentoTagListboxOptions }\n * * @property {string} value.label - Text to be displayed in the option\n * * @property {string,number} value.value - Value of the option\n * * @property {string} value.variant - The BentTag variant shown for the option.\n */\n items: {\n type: Array as PropType<BentoTagListboxOptions>,\n default: () => [],\n },\n });\n\n const emit = defineEmits([\"input\"]);\n\n const onInput = (selectedValue: BentoListboxSelectedValue) => emit('input', selectedValue);\n\n const tagItems = computed(() => props.items?.map(({ label, value, variant }) => ({ label, value, data: variant })));\n</script>\n\n<script lang=\"ts\">\n /**\n * A Tag Dropdown showing a selectable list of tags.\n *\n * @example\n * import { BentoDropdownTag } from '@adyen/bento-vue2';\n * import type { BentoTagListboxOptions } from '@adyen/bento-vue2'\n *\n * export default {\n * components: { BentoDropdownTag },\n * template: `\n * <bento-dropdown-tag\n * v-model=\"selectedValue\"\n * :disabled=\"false\"\n * :items=\"options\"\n * />\n * `,\n * setup() {\n * const selectedValue = ref('unique-id-1') // Default value\n * const options: BentoTagListboxOptions = [\n * { label: 'Offline', value: 'unique-id-1', variant: 'red' },\n * { label: 'Online', value: 'unique-id-2', variant: 'green' },\n * ];\n * return { options, selectedValue };\n * }\n * }\n */\n export default defineComponent({\n name: 'bento-dropdown-tag',\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./dropdown-tag.scss\" />\n"],"names":["__default__$4","defineComponent","onInput","selectedValue","emit","dropdownItems","computed","props","value","label","src","__default__$3","variant","items","toRefs","countryItems","useCountryItems","item","deprecate","__default__$2","__default__$1","__default__","tagItems","_a"],"mappings":";;;;;;;;;;AAkEI,MAAAA,IAAAC,EAAA;AAAA,EAA+B,MAAA;AAE/B,CAAA;;;;;;;;;;;;;;;;;;iBApCAC,IAAA,CAAAC,MAAAC,EAAA,SAAAD,CAAA,GAEAE,IAAAC,EAAA,MAAAC,EAAA,MAAA,IAAA,CAAA,EAAA,OAAAC,GAAA,OAAAC,GAAA,KAAAC,EAAA,OAAA,EAAA,OAAAF,GAAA,OAAAC,GAAA,MAAAC,EAAA,EAAA,CAAA;;;;;;;;;;;;;;;;;sBCqDAC,IAAAV,EAAA;AAAA,EAA+B,MAAA;AAE/B,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;iBA7CAC,IAAA,CAAAC,MAAAC,EAAA,SAAAD,CAAA,GAEA,EAAA,SAAAS,GAAA,OAAAC,EAAA,IAAAC,EAAAP,CAAA,GACAQ,IAAAC,EAAAJ,GAAAC,CAAA;AAEA,YAAAD,EAAA,UAAA,YAAAC,EAAA,MAAA,KAAA,CAAAI,MAAAA,EAAA,KAAA,MACIC;AAAA,MAAA;AAAA,MACI;AAAA,MACA;AAAA,IACA;;;;;;;;;;;;;;;;sBCQRC,IAAAlB,EAAA;AAAA,EAA+B,MAAA;AAE/B,CAAA;;;;;;;;;;;;;;;;;0CAlCA,CAAAE,MAAAC,EAAA,SAAAD,CAAA;;;;;;;;;;;;;;;;sBCkCAiB,IAAAnB,EAAA;AAAA,EAA+B,MAAA;AAE/B,CAAA;;;;;;;;;;;;;;;;;0CAlCA,CAAAE,MAAAC,EAAA,SAAAD,CAAA;;;;;;;;;;;;;;;;sBCsCAkB,IAAApB,EAAA;AAAA,EAA+B,MAAA;AAE/B,CAAA;;;;;;;;;;;;;;;;;;iBAlCAC,IAAA,CAAAC,MAAAC,EAAA,SAAAD,CAAA,GAEAmB,IAAAhB,EAAA,MAAA;;AAAA,cAAAiB,IAAAhB,EAAA,UAAA,gBAAAgB,EAAA,IAAA,CAAA,EAAA,OAAAd,GAAA,OAAAD,GAAA,SAAAI,EAAA,OAAA,EAAA,OAAAH,GAAA,OAAAD,GAAA,MAAAI,EAAA;AAAA,KAAA;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"dropdown-tag.CaEPpy4R.js","sources":["../../src/components/dropdown/components/variants/dropdown-avatar/dropdown-avatar.vue","../../src/components/dropdown/components/variants/dropdown-country/dropdown-country.vue","../../src/components/dropdown/components/variants/dropdown-currency/dropdown-currency.vue","../../src/components/dropdown/components/variants/dropdown-payment-method/dropdown-payment-method.vue","../../src/components/dropdown/components/variants/dropdown-tag/dropdown-tag.vue"],"sourcesContent":["<template>\n <div>\n <bento-dropdown v-slot=\"{ label, data }\" v-bind=\"$props\" :items=\"dropdownItems\" @input=\"onInput\">\n <bento-avatar :username=\"label\" :src=\"data\" />\n </bento-dropdown>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, defineComponent, PropType } from 'vue';\n import { BentoListboxSelectedValue } from '@/types';\n import { BentoAvatarListboxOptions } from './dropdown-avatar.types';\n import { BentoAvatar } from '@/components/avatar';\n import BentoDropdown from '@/components/dropdown/dropdown.vue';\n\n const props = defineProps({\n ...BentoDropdown.props,\n /**\n * The option elements to populate the avatar dropdown with.\n * It must be an array of {@see BentoAvatarListboxOptions }\n * * @property {string} value.label - Text to be displayed in the option.\n * * @property {string,number} value.value - Value of the option.\n * * @property {string} value.src - Image source of the avatar image.\n */\n items: {\n type: Array as PropType<BentoAvatarListboxOptions>,\n default: () => [],\n },\n });\n\n const emit = defineEmits([\"input\"]);\n\n const onInput = (selectedValue: BentoListboxSelectedValue) => emit('input', selectedValue);\n\n const dropdownItems = computed(() => props.items.map(({ value, label, src }) => ({ value, label, data: src })));\n</script>\n\n<script lang=\"ts\">\n /**\n * A Avatar Dropdown showing a selectable list of countries.\n *\n * @example\n * import { BentoDropdownAvatar } from '@adyen/bento-vue2';\n * import type { BentoAvatarListboxOptions } from '@adyen/bento-vue2'\n *\n * export default {\n * components: { BentoDropdownAvatar },\n * template: `\n * <bento-dropdown-avatar\n * v-model=\"selectedValue\"\n * :disabled=\"false\"\n * :multiple=\"true\"\n * :isOptionsDisabled=\"option => option.value === 2\"\n * :items=\"options\"\n * />\n * `,\n * setup() {\n * const selectedValue = ref('user-id-1') // Default value\n * const options: BentoAvatarListboxOptions = [\n * { label: 'User 1', value: 'user-id-1' },\n * { label: 'User 2', value: 'user-id-2', src: 'image-source.jpeg' },\n * ];\n * return { options, selectedValue };\n * }\n * }\n */\n export default defineComponent({\n name: 'bento-dropdown-avatar',\n });\n</script>\n","<template>\n <div>\n <bento-dropdown v-slot=\"{ label }\" v-bind=\"$props\" :items=\"countryItems\" @input=\"onInput\">\n <bento-typography el=\"span\">{{ label }}</bento-typography>\n </bento-dropdown>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { defineComponent, PropType, toRefs } from 'vue';\n import { BentoCountryListboxOptions } from './dropdown-country.types';\n import { BentoListboxSelectedValue } from '@/types';\n import { BentoTypography } from '@/components/typography';\n import { useCountryItems } from './composables/use-country-items';\n import { deprecate } from '@/utils/ts/deprecate';\n import { BentoCountryVariant } from '@/components/country';\n import BentoDropdown from '@/components/dropdown/dropdown.vue';\n\n const props = defineProps({\n ...BentoDropdown.props,\n /**\n * The option elements to populate the country dropdown with.\n * It must be an array of {@see BentoCountryListboxOptions }\n * * @deprecated {string} value.label - Use BentoDropdown instead of custom labels\n * * @property {BentoCountryCode | string} value.value - Country code of the option\n */\n items: {\n type: Array as PropType<BentoCountryListboxOptions>,\n default: () => [],\n },\n\n /**\n * Which label variant to display.\n * @values iso, name, phone_code, capital\n */\n variant: {\n type: String as PropType<BentoCountryVariant | `${BentoCountryVariant}`>,\n default: BentoCountryVariant.CUSTOM,\n validator: (value: BentoCountryVariant) => Object.values(BentoCountryVariant).includes(value),\n },\n });\n\n const emit = defineEmits([\"input\"]);\n\n const onInput = (selectedValue: BentoListboxSelectedValue) => emit('input', selectedValue);\n\n const { variant, items } = toRefs(props);\n const countryItems = useCountryItems(variant, items);\n\n if (variant.value === 'custom' || items.value.some(item => item.label)) {\n deprecate(\n 'BentoDropdownCountry \"custom\" variant and \"items\" prop \"label\" key',\n 'Use any of the other BentoDropdownCountry variants instead OR use BentoDropdown component for custom labels',\n '2.0.0'\n );\n }\n</script>\n\n<script lang=\"ts\">\n /**\n * A Country Dropdown showing a selectable list of countries.\n *\n * @example\n * import { BentoDropdownCountry, BentoCountryCode } from '@adyen/bento-vue2';\n * import type { BentoCountryListboxOptions } from '@adyen/bento-vue2'\n *\n * export default {\n * components: { BentoDropdown },\n * template: `\n * <bento-dropdown-country\n * v-model=\"selectedValue\"\n * :disabled=\"false\"\n * :multiple=\"true\"\n * :isOptionsDisabled=\"option => option.value === 2\"\n * :items=\"options\"\n * />\n * `,\n * setup() {\n * const selectedValue = ref(BentoCountryCode.NL) // Default value\n * const options: BentoCountryListboxOptions = [\n * { label: 'Option 1', value: BentoCountryCode.NL },\n * { label: 'Option 2', value: BentoCountryCode.BE },\n * ];\n * return { options, selectedValue };\n * }\n * }\n */\n export default defineComponent({\n name: 'b-dropdown-country',\n });\n</script>\n","<template>\n <bento-dropdown v-slot=\"slotProps\" v-bind=\"$props\" @input=\"onInput\">\n <listbox-option-tag :option=\"slotProps\" />\n </bento-dropdown>\n</template>\n\n<script setup lang=\"ts\">\n import { defineComponent, PropType } from 'vue';\n import type { BentoCurrencyListboxOptions } from './dropdown-currency.types';\n import type { BentoListboxSelectedValue } from '@/types';\n import { ListboxOptionTag } from '@/internal';\n import BentoDropdown from '@/components/dropdown/dropdown.vue';\n\n defineProps({\n ...BentoDropdown.props,\n /**\n * The option elements to populate the country dropdown with.\n * It must be an array of {@see BentoCurrencyListboxOptions }\n * * @property {string} value.label - Text to be displayed in the option\n * * @property {BentoCurrencyISOCode} value.code - Currency ISO code of the option\n */\n items: {\n type: Array as PropType<BentoCurrencyListboxOptions>,\n default: () => [],\n },\n });\n\n const emit = defineEmits([\"input\"]);\n\n const onInput = (selectedValue: BentoListboxSelectedValue) => emit('input', selectedValue);\n</script>\n\n<script lang=\"ts\">\n /**\n * A Currency Dropdown showing a selectable list of currencies.\n *\n * @example\n * import { BentoDropdownCountry, BentoCountryCode } from '@adyen/bento-vue2';\n * import type { BentoCountryListboxOptions } from '@adyen/bento-vue2'\n *\n * export default {\n * components: { BentoDropdown },\n * template: `\n * <bento-dropdown-currency\n * v-model=\"selectedValue\"\n * :disabled=\"false\"\n * :multiple=\"true\"\n * :isOptionsDisabled=\"option => option.value === 2\"\n * :items=\"options\"\n * />\n * `,\n * setup() {\n * const selectedValue = ref(BentoCountryCode.NL) // Default value\n * const options: BentoCountryListboxOptions = [\n * { label: 'Option 1', value: BentoCountryCode.NL },\n * { label: 'Option 2', value: BentoCountryCode.BE },\n * ];\n * return { options, selectedValue };\n * }\n * }\n */\n export default defineComponent({\n name: 'b-dropdown-currency',\n });\n</script>\n","<template>\n <div>\n <bento-dropdown v-slot=\"{ value, label }\" v-bind=\"$props\" @input=\"onInput\">\n <bento-payment-method :type=\"value\" :label=\"label\" />\n </bento-dropdown>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { defineComponent, PropType } from 'vue';\n import { BentoPaymentMethodListboxOptions } from './dropdown-payment-method.types';\n import { BentoListboxSelectedValue } from '@/types';\n import { BentoPaymentMethod } from '@/components/payment-method';\n import BentoDropdown from '@/components/dropdown/dropdown.vue';\n\n defineProps({\n ...BentoDropdown.props,\n /**\n * The option elements to populate the payment method dropdown with.\n * It must be an array of {@see BentoPaymentMethodListboxOptions }\n * * @property {string} value.label - Text to be displayed in the option\n * * @property {string} value.value - Payment type code that translates to a payment icon name {@see https://adyen-ui-assets.netlify.app/?path=/story/packages-ui-assets-payment-method-icons--icons}\n */\n items: {\n type: Array as PropType<BentoPaymentMethodListboxOptions>,\n default: () => [],\n },\n });\n\n const emit = defineEmits([\"input\"]);\n\n const onInput = (selectedValue: BentoListboxSelectedValue) => emit('input', selectedValue);\n</script>\n\n<script lang=\"ts\">\n /**\n * A Payment method Dropdown showing a selectable list of countries.\n *\n * @example\n * import { BentoDropdownPaymentMethod } from '@adyen/bento-vue2';\n * import type { BentoPaymentMethodListboxOptions } from '@adyen/bento-vue2'\n *\n * export default {\n * components: { BentoDropdownPaymentMethod },\n * template: `\n * <bento-dropdown-payment-method\n * v-model=\"selectedValue\"\n * :disabled=\"false\"\n * :multiple=\"true\"\n * :isOptionsDisabled=\"option => option.value === 'Visa'\"\n * :items=\"options\"\n * />\n * `,\n * setup() {\n * const selectedValue = ref('ideal') // Default value\n * const options: BentoPaymentMethodListboxOptions = [\n * { label: 'Option 1', value: 'ideal' },\n * { label: 'Option 2', value: 'visa' },\n * ];\n * return { options, selectedValue };\n * }\n * }\n */\n export default defineComponent({\n name: 'bento-dropdown-payment-method',\n });\n</script>\n","<template>\n <bento-dropdown\n v-slot=\"{ label, data }\"\n v-bind=\"$props\"\n class=\"b-dropdown-tag\"\n :items=\"tagItems\"\n show-slot-content-in-multiple\n @input=\"onInput\"\n >\n <listbox-option-tag :option=\"{ value: label, data, label: '' }\" />\n </bento-dropdown>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, defineComponent, PropType } from 'vue';\n import type { BentoTagListboxOptions } from './dropdown-tag.types';\n import type { BentoListboxSelectedValue } from '../../../../../types';\n import { ListboxOptionTag } from '../../../../internal';\n import BentoDropdown from '../../../dropdown.vue';\n\n const props = defineProps({\n ...BentoDropdown.props,\n /**\n * The option elements to populate the tag dropdown with.\n * It must be an array of {@see BentoTagListboxOptions }\n * * @property {string} value.label - Text to be displayed in the option\n * * @property {string,number} value.value - Value of the option\n * * @property {string} value.variant - The BentTag variant shown for the option.\n */\n items: {\n type: Array as PropType<BentoTagListboxOptions>,\n default: () => [],\n },\n });\n\n const emit = defineEmits([\"input\"]);\n\n const onInput = (selectedValue: BentoListboxSelectedValue) => emit('input', selectedValue);\n\n const tagItems = computed(() => props.items?.map(({ label, value, variant }) => ({ label, value, data: variant })));\n</script>\n\n<script lang=\"ts\">\n /**\n * A Tag Dropdown showing a selectable list of tags.\n *\n * @example\n * import { BentoDropdownTag } from '@adyen/bento-vue2';\n * import type { BentoTagListboxOptions } from '@adyen/bento-vue2'\n *\n * export default {\n * components: { BentoDropdownTag },\n * template: `\n * <bento-dropdown-tag\n * v-model=\"selectedValue\"\n * :disabled=\"false\"\n * :items=\"options\"\n * />\n * `,\n * setup() {\n * const selectedValue = ref('unique-id-1') // Default value\n * const options: BentoTagListboxOptions = [\n * { label: 'Offline', value: 'unique-id-1', variant: 'red' },\n * { label: 'Online', value: 'unique-id-2', variant: 'green' },\n * ];\n * return { options, selectedValue };\n * }\n * }\n */\n export default defineComponent({\n name: 'bento-dropdown-tag',\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./dropdown-tag.scss\" />\n"],"names":["__default__$4","defineComponent","onInput","selectedValue","emit","dropdownItems","computed","props","value","label","src","__default__$3","variant","items","toRefs","countryItems","useCountryItems","item","deprecate","__default__$2","__default__$1","__default__","tagItems","_a"],"mappings":";;;;;;;;;;AAkEI,MAAAA,IAAAC,EAAA;AAAA,EAA+B,MAAA;AAE/B,CAAA;;;;;;;;;;;;;;;;;;iBApCAC,IAAA,CAAAC,MAAAC,EAAA,SAAAD,CAAA,GAEAE,IAAAC,EAAA,MAAAC,EAAA,MAAA,IAAA,CAAA,EAAA,OAAAC,GAAA,OAAAC,GAAA,KAAAC,EAAA,OAAA,EAAA,OAAAF,GAAA,OAAAC,GAAA,MAAAC,EAAA,EAAA,CAAA;;;;;;;;;;;;;;;;;sBCqDAC,IAAAV,EAAA;AAAA,EAA+B,MAAA;AAE/B,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;iBA7CAC,IAAA,CAAAC,MAAAC,EAAA,SAAAD,CAAA,GAEA,EAAA,SAAAS,GAAA,OAAAC,EAAA,IAAAC,EAAAP,CAAA,GACAQ,IAAAC,EAAAJ,GAAAC,CAAA;AAEA,YAAAD,EAAA,UAAA,YAAAC,EAAA,MAAA,KAAA,CAAAI,MAAAA,EAAA,KAAA,MACIC;AAAA,MAAA;AAAA,MACI;AAAA,MACA;AAAA,IACA;;;;;;;;;;;;;;;;sBCQRC,IAAAlB,EAAA;AAAA,EAA+B,MAAA;AAE/B,CAAA;;;;;;;;;;;;;;;;;0CAlCA,CAAAE,MAAAC,EAAA,SAAAD,CAAA;;;;;;;;;;;;;;;;sBCkCAiB,IAAAnB,EAAA;AAAA,EAA+B,MAAA;AAE/B,CAAA;;;;;;;;;;;;;;;;;0CAlCA,CAAAE,MAAAC,EAAA,SAAAD,CAAA;;;;;;;;;;;;;;;;sBCsCAkB,IAAApB,EAAA;AAAA,EAA+B,MAAA;AAE/B,CAAA;;;;;;;;;;;;;;;;;;iBAlCAC,IAAA,CAAAC,MAAAC,EAAA,SAAAD,CAAA,GAEAmB,IAAAhB,EAAA,MAAA;;AAAA,cAAAiB,IAAAhB,EAAA,UAAA,gBAAAgB,EAAA,IAAA,CAAA,EAAA,OAAAd,GAAA,OAAAD,GAAA,SAAAI,EAAA,OAAA,EAAA,OAAAH,GAAA,OAAAD,GAAA,MAAAI,EAAA;AAAA,KAAA;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref as C, watch as ue, computed as p, defineComponent as A, useSlots as pe, toRefs as fe, nextTick as L, useAttrs as Le, toRef as
|
|
1
|
+
import { ref as C, watch as ue, computed as p, defineComponent as A, useSlots as pe, toRefs as fe, nextTick as L, useAttrs as Le, toRef as S, inject as Oe } from "vue";
|
|
2
2
|
import { d as ie, B as Ee } from "./typography.J1v_SPG3.js";
|
|
3
3
|
import { a as U, b as M, c as De, B as P, D as Be } from "./dropdown-default-textbox.AUsF-RIc.js";
|
|
4
4
|
/* empty css */
|
|
@@ -9,12 +9,12 @@ import { u as Ie } from "./aria-label.CaUURpnB.js";
|
|
|
9
9
|
import { u as V } from "./i18n.BQkEbtPM.js";
|
|
10
10
|
import { u as Te } from "./use-form-layout-loading.D3lALhtC.js";
|
|
11
11
|
import { u as Ne } from "./use-has-slot.C9lQZ6nz.js";
|
|
12
|
-
import { a as u, b as H, B as J, c as Ae, u as Re } from "./use-cached-selected-values.
|
|
12
|
+
import { a as u, b as H, B as J, c as Ae, u as Re } from "./use-cached-selected-values.C-umGJXi.js";
|
|
13
13
|
import { B as D, a as $e } from "./keyboard-navigation.pB8weElW.js";
|
|
14
14
|
import { B as Me } from "./directive.Cbdox5VL.js";
|
|
15
15
|
import { F as Pe, E as ke } from "./error-message.BAE9B9-N.js";
|
|
16
16
|
import { P as re } from "./popper-container.DIFqmRsp.js";
|
|
17
|
-
import { B as Fe } from "./popover.
|
|
17
|
+
import { B as Fe } from "./popover.BN2VK6KG.js";
|
|
18
18
|
import "../assets/dropdown.css";
|
|
19
19
|
const Ke = {
|
|
20
20
|
"en-US": {
|
|
@@ -31,11 +31,11 @@ const Ke = {
|
|
|
31
31
|
cancel: "Cancelar"
|
|
32
32
|
}
|
|
33
33
|
}, ze = (a, t, o, e) => {
|
|
34
|
-
const n = C(a.value), { t:
|
|
34
|
+
const n = C(a.value), { t: s } = V();
|
|
35
35
|
ue(a, () => {
|
|
36
36
|
n.value = a.value;
|
|
37
37
|
});
|
|
38
|
-
const
|
|
38
|
+
const l = p(
|
|
39
39
|
() => JSON.stringify(n.value) === JSON.stringify(a.value)
|
|
40
40
|
), i = () => {
|
|
41
41
|
e(u.SELECT, n.value), e(u.CLOSE_DROPDOWN);
|
|
@@ -45,12 +45,12 @@ const Ke = {
|
|
|
45
45
|
o.value && t.value && (n.value = a.value);
|
|
46
46
|
}, r = p(() => [
|
|
47
47
|
{
|
|
48
|
-
title:
|
|
48
|
+
title: s("apply"),
|
|
49
49
|
event: i,
|
|
50
|
-
disabled:
|
|
50
|
+
disabled: l.value
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
|
-
title:
|
|
53
|
+
title: s("cancel"),
|
|
54
54
|
event: c
|
|
55
55
|
}
|
|
56
56
|
]), d = (y) => {
|
|
@@ -63,11 +63,11 @@ const Ke = {
|
|
|
63
63
|
d(y), e(u.SPACE);
|
|
64
64
|
}, O = () => {
|
|
65
65
|
c(), e(u.ESCAPE);
|
|
66
|
-
},
|
|
66
|
+
}, w = () => {
|
|
67
67
|
e(u.SHOW_MORE);
|
|
68
|
-
},
|
|
68
|
+
}, x = {
|
|
69
69
|
[u.SELECT]: d,
|
|
70
|
-
[u.SHOW_MORE]:
|
|
70
|
+
[u.SHOW_MORE]: w,
|
|
71
71
|
[u.TAB]: g,
|
|
72
72
|
[u.SPACE]: v,
|
|
73
73
|
[u.ENTER]: h
|
|
@@ -77,7 +77,7 @@ const Ke = {
|
|
|
77
77
|
actions: r,
|
|
78
78
|
internalSelectedValue: n,
|
|
79
79
|
// Methods
|
|
80
|
-
listeners:
|
|
80
|
+
listeners: x,
|
|
81
81
|
onEscapeKey: O,
|
|
82
82
|
onOutsideDropdownClick: m
|
|
83
83
|
};
|
|
@@ -196,11 +196,11 @@ const Ke = {
|
|
|
196
196
|
},
|
|
197
197
|
emits: [],
|
|
198
198
|
setup(a, { expose: t, emit: o }) {
|
|
199
|
-
const e = a, n = pe(), { selectedValue:
|
|
199
|
+
const e = a, n = pe(), { selectedValue: s, multiple: l } = fe(e), i = C(null), { t: c } = V(), m = p(() => e.open && !e.disabled), r = p(() => c("noOptionsMatchThisSearch")), d = p(() => ({
|
|
200
200
|
"b-dropdown-options-container--single": !(e != null && e.multiple)
|
|
201
201
|
})), g = p(() => ({
|
|
202
202
|
"b-dropdown-options-container__listbox--single": !(e != null && e.multiple)
|
|
203
|
-
})), { actions: h, internalSelectedValue: v, listeners: O, onEscapeKey:
|
|
203
|
+
})), { actions: h, internalSelectedValue: v, listeners: O, onEscapeKey: w, onOutsideDropdownClick: x } = ze(s, l, m, o), y = p(() => e != null && e.multiple ? Fe : re), I = p(() => {
|
|
204
204
|
var T;
|
|
205
205
|
const B = {
|
|
206
206
|
"min-width": `${(T = e == null ? void 0 : e.targetElement) == null ? void 0 : T.clientWidth}px`,
|
|
@@ -231,17 +231,17 @@ const Ke = {
|
|
|
231
231
|
};
|
|
232
232
|
});
|
|
233
233
|
return t({
|
|
234
|
-
onOutsideDropdownClick:
|
|
235
|
-
}), { __sfc: !0, slots: n, emit: o, props: e, selectedValue:
|
|
234
|
+
onOutsideDropdownClick: x
|
|
235
|
+
}), { __sfc: !0, slots: n, emit: o, props: e, selectedValue: s, multiple: l, dropdownOptionsListboxRef: i, t: c, isDropdownOpen: m, noResultsMessage: r, conditionalClasses: d, conditionalListboxClasses: g, actions: h, internalSelectedValue: v, listeners: O, onEscapeKey: w, onOutsideDropdownClick: x, popperContainerOrPopoverComponent: y, popperContainerOrPopoverProps: I, BentoListbox: H };
|
|
236
236
|
}
|
|
237
237
|
});
|
|
238
238
|
var Ue = function() {
|
|
239
239
|
var t = this, o = t._self._c, e = t._self._setupProxy;
|
|
240
240
|
return o(e.popperContainerOrPopoverComponent, t._b({ tag: "component", staticClass: "b-dropdown-options-container", class: e.conditionalClasses, attrs: { "aria-label": t.ariaLabel } }, "component", e.popperContainerOrPopoverProps, !1), [o("div", { on: { keydown: function(n) {
|
|
241
241
|
return !n.type.indexOf("key") && t._k(n.keyCode, "esc", 27, n.key, ["Esc", "Escape"]) ? null : e.onEscapeKey.apply(null, arguments);
|
|
242
|
-
} } }, [o(e.BentoListbox, t._g({ ref: "dropdownOptionsListboxRef", staticClass: "b-dropdown-options-container__listbox", class: e.conditionalListboxClasses, attrs: { id: t.id, "aria-label": t.ariaLabel, "component-loading": t.componentLoading, "empty-state": t.emptyState, "is-option-disabled": t.isOptionDisabled, items: t.items, "selected-value": e.internalSelectedValue, multiple: e.multiple, "static-categories": t.staticCategories, "no-results-message": e.noResultsMessage, searching: t.searching, loading: t.loading, "lazy-load-type": t.lazyLoadType, "has-more-items": t.hasMoreItems, "virtual-scroll": t.virtualScroll }, scopedSlots: t._u([t._l(e.slots, function(n,
|
|
243
|
-
return { key:
|
|
244
|
-
return [t._t(
|
|
242
|
+
} } }, [o(e.BentoListbox, t._g({ ref: "dropdownOptionsListboxRef", staticClass: "b-dropdown-options-container__listbox", class: e.conditionalListboxClasses, attrs: { id: t.id, "aria-label": t.ariaLabel, "component-loading": t.componentLoading, "empty-state": t.emptyState, "is-option-disabled": t.isOptionDisabled, items: t.items, "selected-value": e.internalSelectedValue, multiple: e.multiple, "static-categories": t.staticCategories, "no-results-message": e.noResultsMessage, searching: t.searching, loading: t.loading, "lazy-load-type": t.lazyLoadType, "has-more-items": t.hasMoreItems, "virtual-scroll": t.virtualScroll }, scopedSlots: t._u([t._l(e.slots, function(n, s) {
|
|
243
|
+
return { key: s, fn: function(l) {
|
|
244
|
+
return [t._t(s, null, null, l)];
|
|
245
245
|
} };
|
|
246
246
|
})], null, !0) }, e.listeners))], 1)]);
|
|
247
247
|
}, qe = [], He = /* @__PURE__ */ F(
|
|
@@ -291,7 +291,7 @@ var et = function() {
|
|
|
291
291
|
const nt = ot.exports, at = A({
|
|
292
292
|
name: "dropdown-small-textbox",
|
|
293
293
|
inheritAttrs: !1
|
|
294
|
-
}),
|
|
294
|
+
}), lt = /* @__PURE__ */ A({
|
|
295
295
|
...at,
|
|
296
296
|
props: {
|
|
297
297
|
/**
|
|
@@ -353,11 +353,11 @@ const nt = ot.exports, at = A({
|
|
|
353
353
|
},
|
|
354
354
|
emits: ["clear", "close", "input", "keydown", "open"],
|
|
355
355
|
setup(a, { expose: t, emit: o }) {
|
|
356
|
-
const e = a, n = C(null),
|
|
356
|
+
const e = a, n = C(null), s = p(() => ({
|
|
357
357
|
[`b-dropdown-small-textbox--${U.DISABLED}`]: e.disabled,
|
|
358
358
|
[`b-dropdown-small-textbox--${U.READONLY}`]: e.readonly,
|
|
359
359
|
[`b-dropdown-small-textbox--${U.OPENED}`]: e.open
|
|
360
|
-
})),
|
|
360
|
+
})), l = p(() => e.open && !e.disabled && !e.readonly), i = (v) => {
|
|
361
361
|
o("input", v);
|
|
362
362
|
}, c = (v) => {
|
|
363
363
|
o("keydown", v);
|
|
@@ -378,17 +378,17 @@ const nt = ot.exports, at = A({
|
|
|
378
378
|
};
|
|
379
379
|
return t({
|
|
380
380
|
focus: h
|
|
381
|
-
}), { __sfc: !0, emit: o, props: e, baseTextbox: n, conditionalClasses:
|
|
381
|
+
}), { __sfc: !0, emit: o, props: e, baseTextbox: n, conditionalClasses: s, isDropdownOpen: l, onInput: i, onKeyDown: c, openDropdown: m, closeDropdown: r, clearValue: d, listeners: g, focus: h, BentoDropdownSize: P, DropdownBaseTextbox: De, ChevronDownSmallIcon: Xe, ChevronUpSmallIcon: nt };
|
|
382
382
|
}
|
|
383
383
|
});
|
|
384
|
-
var
|
|
384
|
+
var st = function() {
|
|
385
385
|
var t = this, o = t._self._c, e = t._self._setupProxy;
|
|
386
386
|
return o("div", { staticClass: "b-dropdown-small-textbox", class: e.conditionalClasses }, [o(e.DropdownBaseTextbox, t._g(t._b({ ref: "baseTextbox", staticClass: "b-dropdown-small-textbox__textbox", attrs: { size: e.BentoDropdownSize.SMALL }, scopedSlots: t._u([{ key: "icon", fn: function() {
|
|
387
387
|
return [o("div", { staticClass: "b-dropdown-small-textbox__chevron" }, [o(e.ChevronUpSmallIcon, { directives: [{ name: "show", rawName: "v-show", value: e.isDropdownOpen, expression: "isDropdownOpen" }], attrs: { "svg-title": "opened" } }), o(e.ChevronDownSmallIcon, { directives: [{ name: "show", rawName: "v-show", value: !e.isDropdownOpen, expression: "!isDropdownOpen" }], attrs: { "svg-title": "closed" } })], 1)];
|
|
388
388
|
}, proxy: !0 }]) }, "dropdown-base-textbox", { ...t.$attrs, ...t.$props }, !1), e.listeners))], 1);
|
|
389
389
|
}, it = [], rt = /* @__PURE__ */ F(
|
|
390
|
-
st,
|
|
391
390
|
lt,
|
|
391
|
+
st,
|
|
392
392
|
it,
|
|
393
393
|
!1,
|
|
394
394
|
null,
|
|
@@ -397,19 +397,19 @@ var lt = function() {
|
|
|
397
397
|
const dt = rt.exports, ct = (a, t) => t.value.reduce((o, e) => {
|
|
398
398
|
if (e.items) {
|
|
399
399
|
const n = e.items.filter(
|
|
400
|
-
(
|
|
400
|
+
(l) => a.value.find((i) => i.value === l.value)
|
|
401
401
|
);
|
|
402
|
-
n.length === e.items.length ? o.push(e.displayValue ?? e.label) : n.forEach(({ label:
|
|
402
|
+
n.length === e.items.length ? o.push(e.displayValue ?? e.label) : n.forEach(({ label: l, displayValue: i }) => o.push(i ?? l));
|
|
403
403
|
}
|
|
404
404
|
return a.value.find((n) => n.value === e.value) && o.push(e.displayValue ?? e.label), o;
|
|
405
405
|
}, []).join(", "), ut = ({ items: a, placeholder: t, selectedValues: o, isMultiSelect: e }) => {
|
|
406
406
|
const n = p(
|
|
407
|
-
() => e.value && a.value.find((
|
|
407
|
+
() => e.value && a.value.find((l) => {
|
|
408
408
|
var i;
|
|
409
|
-
return (i =
|
|
409
|
+
return (i = l.items) == null ? void 0 : i.length;
|
|
410
410
|
})
|
|
411
411
|
);
|
|
412
|
-
return p(() => o.value.length ? n.value ? ct(o, a) : o.value.map(({ label:
|
|
412
|
+
return p(() => o.value.length ? n.value ? ct(o, a) : o.value.map(({ label: l, displayValue: i }) => i ?? l).join(", ") : t.value || null);
|
|
413
413
|
}, ve = (a) => {
|
|
414
414
|
var t;
|
|
415
415
|
(t = a.value.$children) == null || t[0].$refs.textbox.focus();
|
|
@@ -419,8 +419,8 @@ const dt = rt.exports, ct = (a, t) => t.value.reduce((o, e) => {
|
|
|
419
419
|
selectedValueIndex: o,
|
|
420
420
|
isDropdownOpen: e,
|
|
421
421
|
isDynamicFltering: n,
|
|
422
|
-
items:
|
|
423
|
-
isMultiple:
|
|
422
|
+
items: s,
|
|
423
|
+
isMultiple: l
|
|
424
424
|
}, i, c, m) => {
|
|
425
425
|
const r = async (f) => {
|
|
426
426
|
var b, E;
|
|
@@ -439,36 +439,36 @@ const dt = rt.exports, ct = (a, t) => t.value.reduce((o, e) => {
|
|
|
439
439
|
);
|
|
440
440
|
}, h = ({ detail: f }) => {
|
|
441
441
|
f.preventDefault(), e.value || c(), L(() => {
|
|
442
|
-
|
|
442
|
+
l ? d(0) : (g(o.value), r(o.value));
|
|
443
443
|
});
|
|
444
444
|
}, v = ({ detail: f }) => {
|
|
445
445
|
f.preventDefault(), e.value || c(), L(() => {
|
|
446
|
-
|
|
446
|
+
l ? d(0) : (g(o.value), r(o.value));
|
|
447
447
|
});
|
|
448
448
|
}, O = () => {
|
|
449
449
|
e.value || (c(), L(() => {
|
|
450
450
|
var f;
|
|
451
|
-
if (
|
|
451
|
+
if (l) {
|
|
452
452
|
const b = t.value.$refs.dropdownOptionsListboxRef.$refs.listboxItemRef.$children;
|
|
453
|
-
(f = b == null ? void 0 : b[b.length - 1].$el.querySelectorAll('[role="option"]')[
|
|
453
|
+
(f = b == null ? void 0 : b[b.length - 1].$el.querySelectorAll('[role="option"]')[s.length - 1]) == null || f.focus();
|
|
454
454
|
} else
|
|
455
|
-
g(
|
|
455
|
+
g(s.length - 1), r(s.length - 1);
|
|
456
456
|
}));
|
|
457
|
-
}, S = () => {
|
|
458
|
-
e.value && (m(), ve(a));
|
|
459
457
|
}, w = () => {
|
|
458
|
+
e.value && (m(), ve(a));
|
|
459
|
+
}, x = () => {
|
|
460
460
|
e.value && m();
|
|
461
461
|
}, y = () => {
|
|
462
462
|
e.value || c(), L(() => {
|
|
463
|
-
|
|
463
|
+
l ? d(0) : r(0);
|
|
464
464
|
});
|
|
465
465
|
}, I = ({ detail: f }) => {
|
|
466
466
|
f.preventDefault(), i(), e.value && L(() => {
|
|
467
|
-
|
|
467
|
+
l ? d(0) : (g(o.value), r(o.value));
|
|
468
468
|
});
|
|
469
469
|
}, B = ({ detail: f }) => {
|
|
470
470
|
f.preventDefault(), i(), e.value && L(() => {
|
|
471
|
-
|
|
471
|
+
l ? d(0) : (g(o.value), r(o.value));
|
|
472
472
|
});
|
|
473
473
|
};
|
|
474
474
|
return p(() => ({
|
|
@@ -477,9 +477,9 @@ const dt = rt.exports, ct = (a, t) => t.value.reduce((o, e) => {
|
|
|
477
477
|
[D.ARROW_DOWN]: h,
|
|
478
478
|
[D.ARROW_UP]: v,
|
|
479
479
|
[D.END]: O,
|
|
480
|
-
[D.ESCAPE]:
|
|
480
|
+
[D.ESCAPE]: w,
|
|
481
481
|
[D.HOME]: y,
|
|
482
|
-
[D.TAB]:
|
|
482
|
+
[D.TAB]: x
|
|
483
483
|
}));
|
|
484
484
|
}, ft = ({ inputContainerRef: a, isDropdownOpen: t }, o) => {
|
|
485
485
|
const e = () => {
|
|
@@ -495,14 +495,14 @@ const dt = rt.exports, ct = (a, t) => t.value.reduce((o, e) => {
|
|
|
495
495
|
};
|
|
496
496
|
};
|
|
497
497
|
function vt(a, t, o, e) {
|
|
498
|
-
const n = C(a),
|
|
498
|
+
const n = C(a), s = C(t), l = (c, m = []) => m.flatMap((r) => r.label.toLocaleLowerCase().includes(c) ? e != null && e.value && r.items ? [...l(c, r.items)] : [r, ...l(c, r.items)] : r.items ? [...l(c, r.items)] : []);
|
|
499
499
|
return ue(n, () => {
|
|
500
500
|
o !== void 0 && o(n.value);
|
|
501
501
|
}), p(() => {
|
|
502
502
|
if (!n.value || o !== void 0)
|
|
503
|
-
return
|
|
503
|
+
return s.value;
|
|
504
504
|
const c = n.value.toLocaleLowerCase();
|
|
505
|
-
return
|
|
505
|
+
return l(c, s.value);
|
|
506
506
|
});
|
|
507
507
|
}
|
|
508
508
|
const mt = {
|
|
@@ -675,7 +675,7 @@ const mt = {
|
|
|
675
675
|
* Set to an empty string `''` if you don't want any of the available options to be selected.
|
|
676
676
|
*/
|
|
677
677
|
value: {
|
|
678
|
-
type: [String, Number, Array],
|
|
678
|
+
type: [String, Number, Array, Object],
|
|
679
679
|
default: null
|
|
680
680
|
},
|
|
681
681
|
/**
|
|
@@ -685,15 +685,30 @@ const mt = {
|
|
|
685
685
|
virtualScroll: {
|
|
686
686
|
type: [Boolean, Object],
|
|
687
687
|
default: !1
|
|
688
|
-
}
|
|
688
|
+
},
|
|
689
|
+
/**
|
|
690
|
+
* Enables value/label value handling. When `true`, the component expects and emits value/label
|
|
691
|
+
* pair objects instead of primitive values.
|
|
692
|
+
*
|
|
693
|
+
* This affects both the `value` prop and the `input` event payload.
|
|
694
|
+
*
|
|
695
|
+
* - **Input (`value` prop):** Expects a `{ value: string | number, label: string }` object (or an array of them for multi-select).
|
|
696
|
+
* - **Output (`input` event):** Emits a `{ value: string | number, label: string }` object (or an array of them) upon selection.
|
|
697
|
+
*
|
|
698
|
+
* This is particularly useful when a selected item's label is not available in the `items` prop,
|
|
699
|
+
* allowing the component to display the correct label for values loaded from external sources.
|
|
700
|
+
* @default false
|
|
701
|
+
*/
|
|
702
|
+
enableValueLabelPair: { type: Boolean, default: !1 }
|
|
689
703
|
},
|
|
690
704
|
emits: ["input", "show-more"],
|
|
691
705
|
setup(a, { expose: t, emit: o }) {
|
|
692
|
-
var
|
|
693
|
-
const e = a, n = Le(),
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
706
|
+
var se;
|
|
707
|
+
const e = a, n = Le(), s = pe(), l = Ne(s), { t: i } = V(), c = C(null), m = C(null), r = C(null), d = C(!1), g = k("bento-dropdown-options-container"), h = k("dropdown-label"), v = k("dropdown-description"), O = k("dropdown-error"), { isReadOnly: w } = Te(S(e, "readonly")), { cachedSelectedListboxOptions: x, cachedListboxSelectedValues: y, setCachedValues: I } = Ae(
|
|
708
|
+
S(e, "items"),
|
|
709
|
+
S(e, "value"),
|
|
710
|
+
S(e, "multiple"),
|
|
711
|
+
S(e, "enableValueLabelPair")
|
|
697
712
|
), B = C(n["aria-label"]), { ariaLabel: T, label: f } = fe(e), b = Ie({
|
|
698
713
|
// TODO: take ariaLabel ref away when aria-label prop is removed
|
|
699
714
|
ariaLabel: T.value || B,
|
|
@@ -703,11 +718,11 @@ const mt = {
|
|
|
703
718
|
"b-dropdown--condensed": e.condensed
|
|
704
719
|
})), ye = p(() => ({
|
|
705
720
|
"b-dropdown__description--error": !!e.errorMessage
|
|
706
|
-
})), N = C(""), R =
|
|
721
|
+
})), N = C(""), R = S(e, "items"), Y = S(e, "staticCategories"), Z = vt(N, R, (se = e == null ? void 0 : e.search) == null ? void 0 : se.searchEvent, Y), j = p(() => e.dynamicFiltering && !!N.value), be = ut({
|
|
707
722
|
items: R,
|
|
708
|
-
placeholder:
|
|
709
|
-
isMultiSelect:
|
|
710
|
-
selectedValues:
|
|
723
|
+
placeholder: S(e, "placeholder"),
|
|
724
|
+
isMultiSelect: S(e, "multiple"),
|
|
725
|
+
selectedValues: x
|
|
711
726
|
}), _e = p(() => {
|
|
712
727
|
if (e != null && e.multiple && Array.isArray(e.value))
|
|
713
728
|
return e.items.filter(
|
|
@@ -732,11 +747,11 @@ const mt = {
|
|
|
732
747
|
}), he = p(
|
|
733
748
|
() => `${e.description ? v : ""} ${e.errorMessage ? O : ""}`.trim() || null
|
|
734
749
|
), ee = () => {
|
|
735
|
-
|
|
750
|
+
w.value || (d.value = !0);
|
|
736
751
|
}, z = () => {
|
|
737
752
|
d.value = !1;
|
|
738
753
|
}, te = () => {
|
|
739
|
-
|
|
754
|
+
w.value || (d.value = !d.value, j.value && (N.value = ""));
|
|
740
755
|
}, Ce = () => {
|
|
741
756
|
j.value && (N.value = ""), d.value && (d.value = !1, r.value.onOutsideDropdownClick());
|
|
742
757
|
}, oe = (_) => {
|
|
@@ -749,7 +764,7 @@ const mt = {
|
|
|
749
764
|
optionsContainerRef: r,
|
|
750
765
|
selectedValueIndex: Q,
|
|
751
766
|
isDropdownOpen: d,
|
|
752
|
-
isDynamicFltering:
|
|
767
|
+
isDynamicFltering: S(e, "dynamicFiltering"),
|
|
753
768
|
items: e.items,
|
|
754
769
|
isMultiple: e.multiple
|
|
755
770
|
},
|
|
@@ -775,26 +790,26 @@ const mt = {
|
|
|
775
790
|
<bento-dropdown errorMessage="Error message text" />`,
|
|
776
791
|
"2.0.0"
|
|
777
792
|
), e.size && ie('BentoDropdown "size" property', "Do not use. Only 'default' size should be used.", "2.0.0");
|
|
778
|
-
const
|
|
793
|
+
const le = () => {
|
|
779
794
|
c.value.focus();
|
|
780
795
|
};
|
|
781
796
|
return t({
|
|
782
|
-
focus:
|
|
783
|
-
}), { __sfc: !0, attrs: n, slots:
|
|
797
|
+
focus: le
|
|
798
|
+
}), { __sfc: !0, attrs: n, slots: s, hasSlot: l, props: e, emit: o, t: i, inputContainerRef: c, inputContainerRefWrapper: m, optionsContainerRef: r, isDropdownOpen: d, dropdownOptionsContainerId: g, labelId: h, descriptionId: v, errorId: O, isReadOnly: w, cachedSelectedListboxOptions: x, cachedListboxSelectedValues: y, setCachedValues: I, ariaLabelAttribute: B, ariaLabel: T, label: f, computedAriaLabel: b, isInputComponent: E, computedSize: K, conditionalClasses: me, descriptionConditionalClasses: ye, searchTerm: N, items: R, staticCategories: Y, filteredItems: Z, isSearching: j, displayValue: be, selectedValueItem: _e, selectedValueIndex: Q, isMultiLevelSelect: X, flattenedItemsList: G, additionalItemsSelected: ge, ariaDescribedBy: he, openDropdown: ee, closeDropdown: z, toggleDropdown: te, clickOutsideDropdown: Ce, onOptionSelected: oe, emitShowMoreEvent: ne, textboxKeyboardNavigationListeners: Se, listboxKeyboardNavigationListeners: ae, listboxListeners: we, focus: le, BentoDropdownOptionsContainer: Je, BentoTypography: Ee, ErrorMessage: ke, FieldLabel: Pe, vBentoClickOutsideDirective: Me, vBentoKeyboardNavigationDirective: $e };
|
|
784
799
|
}
|
|
785
800
|
});
|
|
786
801
|
var gt = function() {
|
|
787
802
|
var n;
|
|
788
803
|
var t = this, o = t._self._c, e = t._self._setupProxy;
|
|
789
|
-
return o("div", { directives: [{ name: "bento-click-outside-directive", rawName: "v-bento-click-outside-directive", value: e.clickOutsideDropdown, expression: "clickOutsideDropdown" }], staticClass: "b-dropdown", class: e.conditionalClasses }, [e.label ? o(e.FieldLabel, { attrs: { id: e.labelId, condensed: t.condensed, label: e.label, "tooltip-text": t.tooltipText, optional: t.optional, required: t.required } }) : t._e(), o("div", t._g({ directives: [{ name: "bento-keyboard-navigation-directive", rawName: "v-bento-keyboard-navigation-directive" }], ref: "inputContainerRefWrapper" }, e.textboxKeyboardNavigationListeners), [o(e.computedSize, { ref: "inputContainerRef", tag: "component", attrs: { condensed: t.condensed, value: e.searchTerm, "additional-items-selected": e.additionalItemsSelected, ariaControls: e.dropdownOptionsContainerId, ariaExpanded: e.isDropdownOpen, "aria-labelledby": e.label ? e.labelId : null, "aria-describedby": e.ariaDescribedBy, "aria-label": e.computedAriaLabel, "aria-readonly": e.isReadOnly, readonly: e.isReadOnly, disabled: t.disabled, "display-value": e.displayValue, "dynamic-filtering": t.dynamicFiltering, "is-invalid": !!t.errorMessage || t.error, multiple: t.multiple, open: e.isDropdownOpen, "selected-value-item": e.isInputComponent ? void 0 : e.selectedValueItem, "show-slot-content-in-multiple": t.showSlotContentInMultiple }, on: { input: function(
|
|
790
|
-
e.searchTerm =
|
|
791
|
-
}, open: e.toggleDropdown, close: e.toggleDropdown }, scopedSlots: t._u([t._l(e.slots, function(
|
|
792
|
-
return { key:
|
|
793
|
-
return [t._t(
|
|
804
|
+
return o("div", { directives: [{ name: "bento-click-outside-directive", rawName: "v-bento-click-outside-directive", value: e.clickOutsideDropdown, expression: "clickOutsideDropdown" }], staticClass: "b-dropdown", class: e.conditionalClasses }, [e.label ? o(e.FieldLabel, { attrs: { id: e.labelId, condensed: t.condensed, label: e.label, "tooltip-text": t.tooltipText, optional: t.optional, required: t.required } }) : t._e(), o("div", t._g({ directives: [{ name: "bento-keyboard-navigation-directive", rawName: "v-bento-keyboard-navigation-directive" }], ref: "inputContainerRefWrapper" }, e.textboxKeyboardNavigationListeners), [o(e.computedSize, { ref: "inputContainerRef", tag: "component", attrs: { condensed: t.condensed, value: e.searchTerm, "additional-items-selected": e.additionalItemsSelected, ariaControls: e.dropdownOptionsContainerId, ariaExpanded: e.isDropdownOpen, "aria-labelledby": e.label ? e.labelId : null, "aria-describedby": e.ariaDescribedBy, "aria-label": e.computedAriaLabel, "aria-readonly": e.isReadOnly, readonly: e.isReadOnly, disabled: t.disabled, "display-value": e.displayValue, "dynamic-filtering": t.dynamicFiltering, "is-invalid": !!t.errorMessage || t.error, multiple: t.multiple, open: e.isDropdownOpen, "selected-value-item": e.isInputComponent ? void 0 : e.selectedValueItem, "show-slot-content-in-multiple": t.showSlotContentInMultiple }, on: { input: function(s) {
|
|
805
|
+
e.searchTerm = s;
|
|
806
|
+
}, open: e.toggleDropdown, close: e.toggleDropdown }, scopedSlots: t._u([t._l(e.slots, function(s, l) {
|
|
807
|
+
return { key: l, fn: function(i) {
|
|
808
|
+
return [t._t(l, null, null, i)];
|
|
794
809
|
} };
|
|
795
|
-
})], null, !0) })], 1), e.inputContainerRef ? o(e.BentoDropdownOptionsContainer, t._g({ ref: "optionsContainerRef", attrs: { id: e.dropdownOptionsContainerId, "aria-label": e.computedAriaLabel, "component-loading": t.componentLoading, "empty-state": t.emptyState, "debounce-time": (n = t.search) == null ? void 0 : n.debounceTime, disabled: t.disabled, "is-option-disabled": t.isOptionDisabled, items: e.filteredItems, multiple: t.multiple, "static-categories": e.staticCategories, open: e.isDropdownOpen, "selected-value": e.cachedSelectedListboxOptions, searching: e.isSearching, "target-element": e.inputContainerRefWrapper, loading: t.loading, "has-more-items": t.hasMoreItems, "lazy-load-type": t.lazyLoadType, "virtual-scroll": t.virtualScroll }, scopedSlots: t._u([t._l(e.slots, function(
|
|
796
|
-
return { key:
|
|
797
|
-
return [t._t(
|
|
810
|
+
})], null, !0) })], 1), e.inputContainerRef ? o(e.BentoDropdownOptionsContainer, t._g({ ref: "optionsContainerRef", attrs: { id: e.dropdownOptionsContainerId, "aria-label": e.computedAriaLabel, "component-loading": t.componentLoading, "empty-state": t.emptyState, "debounce-time": (n = t.search) == null ? void 0 : n.debounceTime, disabled: t.disabled, "is-option-disabled": t.isOptionDisabled, items: e.filteredItems, multiple: t.multiple, "static-categories": e.staticCategories, open: e.isDropdownOpen, "selected-value": e.cachedSelectedListboxOptions, searching: e.isSearching, "target-element": e.inputContainerRefWrapper, loading: t.loading, "has-more-items": t.hasMoreItems, "lazy-load-type": t.lazyLoadType, "virtual-scroll": t.virtualScroll }, scopedSlots: t._u([t._l(e.slots, function(s, l) {
|
|
811
|
+
return { key: l, fn: function(i) {
|
|
812
|
+
return [t._t(l, null, null, i)];
|
|
798
813
|
} };
|
|
799
814
|
})], null, !0) }, e.listboxListeners)) : t._e(), t.errorMessage ? o(e.ErrorMessage, { staticClass: "b-dropdown__error-message", attrs: { id: e.errorId, "error-message": t.errorMessage } }) : t._e(), t.description || e.hasSlot("description") ? o(e.BentoTypography, { staticClass: "b-dropdown__description", class: e.descriptionConditionalClasses, attrs: { id: e.descriptionId, el: "span" } }, [t._t("description", function() {
|
|
800
815
|
return [t._v(" " + t._s(t.description) + " ")];
|
|
@@ -805,7 +820,7 @@ var gt = function() {
|
|
|
805
820
|
ht,
|
|
806
821
|
!1,
|
|
807
822
|
null,
|
|
808
|
-
"
|
|
823
|
+
"8b943a17"
|
|
809
824
|
);
|
|
810
825
|
const zt = Ct.exports;
|
|
811
826
|
export {
|
|
@@ -815,4 +830,4 @@ export {
|
|
|
815
830
|
Kt as b,
|
|
816
831
|
vt as u
|
|
817
832
|
};
|
|
818
|
-
//# sourceMappingURL=dropdown.
|
|
833
|
+
//# sourceMappingURL=dropdown.3c5SsPV1.js.map
|