@adyen/bento-vue3 1.95.0 → 1.96.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 +77 -0
- package/dist/assets/accordion-item.css +1 -1
- package/dist/assets/action-bar.css +1 -1
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/button-actions.css +1 -1
- package/dist/assets/card.css +1 -1
- package/dist/assets/data-grid.css +1 -1
- package/dist/assets/date-picker.css +1 -1
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/draggable-handle.css +1 -1
- package/dist/assets/dropdown.css +1 -1
- package/dist/assets/field-label.css +1 -1
- package/dist/assets/file-uploader.css +1 -1
- package/dist/assets/filter-bar.css +1 -1
- package/dist/assets/input-field-password.css +1 -1
- package/dist/assets/inspector.css +1 -1
- package/dist/assets/modal-fullscreen.css +1 -1
- package/dist/assets/navigation-menu-group.css +1 -1
- package/dist/assets/secondary-nav.css +1 -1
- package/dist/assets/sidepanel.css +1 -1
- package/dist/checkbox.js +2 -2
- package/dist/chunks/{calendar.74nP7Nu6.js → calendar.iQyNwQBL.js} +64 -58
- package/dist/chunks/calendar.iQyNwQBL.js.map +1 -0
- package/dist/chunks/{checkbox-group.BWx4wn0F.js → checkbox-group.BcDIXL27.js} +2 -2
- package/dist/chunks/{checkbox-group.BWx4wn0F.js.map → checkbox-group.BcDIXL27.js.map} +1 -1
- package/dist/chunks/{checkbox.DwfrmbwI.js → checkbox.LTRqb-pE.js} +18 -18
- package/dist/chunks/{checkbox.DwfrmbwI.js.map → checkbox.LTRqb-pE.js.map} +1 -1
- package/dist/chunks/{code-snippet.B9QFjFXf.js → code-snippet.DHzB-8JJ.js} +2 -2
- package/dist/chunks/{code-snippet.B9QFjFXf.js.map → code-snippet.DHzB-8JJ.js.map} +1 -1
- package/dist/chunks/{dashboard-section.C4plNql-.js → dashboard-section.Da6ZFGtm.js} +2 -2
- package/dist/chunks/{dashboard-section.C4plNql-.js.map → dashboard-section.Da6ZFGtm.js.map} +1 -1
- package/dist/chunks/{data-grid-template.Bwxo0AII.js → data-grid-template.-MuGcJp1.js} +2 -2
- package/dist/chunks/{data-grid-template.Bwxo0AII.js.map → data-grid-template.-MuGcJp1.js.map} +1 -1
- package/dist/chunks/{data-grid.Bx3Xy1tb.js → data-grid.CNIXkdCJ.js} +8 -8
- package/dist/chunks/{data-grid.Bx3Xy1tb.js.map → data-grid.CNIXkdCJ.js.map} +1 -1
- package/dist/chunks/{date-picker.89J8PGKn.js → date-picker.DyImOUH4.js} +61 -61
- package/dist/chunks/date-picker.DyImOUH4.js.map +1 -0
- package/dist/chunks/{date-range-picker.iaXigXuW.js → date-range-picker.BigC6wm2.js} +67 -67
- package/dist/chunks/{date-range-picker.iaXigXuW.js.map → date-range-picker.BigC6wm2.js.map} +1 -1
- package/dist/chunks/draggable-handle.C1dudqKz.js +1649 -0
- package/dist/chunks/{draggable-handle.CKuHzAzS.js.map → draggable-handle.C1dudqKz.js.map} +1 -1
- package/dist/chunks/{dropdown-tag.DNWUbf7x.js → dropdown-tag.C1ei1SyR.js} +2 -2
- package/dist/chunks/{dropdown-tag.DNWUbf7x.js.map → dropdown-tag.C1ei1SyR.js.map} +1 -1
- package/dist/chunks/{dropdown.CK8cdMyV.js → dropdown.C5um1anU.js} +292 -278
- package/dist/chunks/dropdown.C5um1anU.js.map +1 -0
- package/dist/chunks/{filter-bar.CqbdRCQD.js → filter-bar.CvZnM3hM.js} +279 -276
- package/dist/chunks/{filter-bar.CqbdRCQD.js.map → filter-bar.CvZnM3hM.js.map} +1 -1
- package/dist/chunks/{header-with-views.CB8M1Udi.js → header-with-views.ubPTyW9A.js} +4 -4
- package/dist/chunks/{header-with-views.CB8M1Udi.js.map → header-with-views.ubPTyW9A.js.map} +1 -1
- package/dist/chunks/{input-field-password.DJKloBB3.js → input-field-password.CZ-NTpZF.js} +5 -3
- package/dist/chunks/input-field-password.CZ-NTpZF.js.map +1 -0
- package/dist/chunks/{input-field-phone-number.C3fQypln.js → input-field-phone-number.DOHk6gSp.js} +2 -2
- package/dist/chunks/{input-field-phone-number.C3fQypln.js.map → input-field-phone-number.DOHk6gSp.js.map} +1 -1
- package/dist/chunks/{input-field.HgrRdDec.js → input-field.DBlTGgAD.js} +2 -2
- package/dist/chunks/{input-field.HgrRdDec.js.map → input-field.DBlTGgAD.js.map} +1 -1
- package/dist/chunks/{input-time.DxCYIHSf.js → input-time.CHIjCO74.js} +3 -3
- package/dist/chunks/{input-time.DxCYIHSf.js.map → input-time.CHIjCO74.js.map} +1 -1
- package/dist/chunks/{pagination.vqSlDmeK.js → pagination.DbpHH_53.js} +2 -2
- package/dist/chunks/{pagination.vqSlDmeK.js.map → pagination.DbpHH_53.js.map} +1 -1
- package/dist/chunks/{rich-text-editor.u_fKHVgZ.js → rich-text-editor.u-V4fNWK.js} +2 -2
- package/dist/chunks/{rich-text-editor.u_fKHVgZ.js.map → rich-text-editor.u-V4fNWK.js.map} +1 -1
- package/dist/chunks/{search-bar.CgSUD89l.js → search-bar.TKgi1KLs.js} +3 -3
- package/dist/chunks/{search-bar.CgSUD89l.js.map → search-bar.TKgi1KLs.js.map} +1 -1
- package/dist/chunks/secondary-nav.0OsJiAWI.js +315 -0
- package/dist/chunks/{secondary-nav.BqqNrHZE.js.map → secondary-nav.0OsJiAWI.js.map} +1 -1
- package/dist/chunks/{selection-card-group.C2Av3uyz.js → selection-card-group.C59ZIrVm.js} +9 -9
- package/dist/chunks/{selection-card-group.C2Av3uyz.js.map → selection-card-group.C59ZIrVm.js.map} +1 -1
- package/dist/chunks/{tab.DWoYKpTv.js → tab.ByjWuWQz.js} +107 -98
- package/dist/chunks/{tab.DWoYKpTv.js.map → tab.ByjWuWQz.js.map} +1 -1
- package/dist/chunks/{use-cached-selected-values.CtWNiy-e.js → use-cached-selected-values.DOw5IKdU.js} +2 -2
- package/dist/chunks/{use-cached-selected-values.CtWNiy-e.js.map → use-cached-selected-values.DOw5IKdU.js.map} +1 -1
- package/dist/chunks/{use-date-input-formatter.BshboCF9.js → use-date-input-formatter.x285YiSd.js} +2 -2
- package/dist/chunks/{use-date-input-formatter.BshboCF9.js.map → use-date-input-formatter.x285YiSd.js.map} +1 -1
- package/dist/code-snippet.js +1 -1
- package/dist/dashboard-template.js +1 -1
- package/dist/data-grid-template.js +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/date-picker.js +2 -2
- package/dist/date-range-picker.js +2 -2
- package/dist/date-time-picker.js +4 -4
- package/dist/draggable.js +1 -1
- package/dist/dropdown.js +3 -3
- package/dist/filter-bar.js +1 -1
- package/dist/header-with-views.js +1 -1
- package/dist/index.js +25 -25
- 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/input-time.js +1 -1
- package/dist/internal.js +2 -2
- package/dist/pagination.js +1 -1
- package/dist/rich-text-editor.js +1 -1
- package/dist/search-bar.js +2 -2
- package/dist/secondary-nav.js +1 -1
- package/dist/selection-card.js +1 -1
- package/dist/tabs.js +1 -1
- package/dist/web-types.json +1 -1
- package/package.json +3 -3
- package/dist/chunks/calendar.74nP7Nu6.js.map +0 -1
- package/dist/chunks/date-picker.89J8PGKn.js.map +0 -1
- package/dist/chunks/draggable-handle.CKuHzAzS.js +0 -1639
- package/dist/chunks/dropdown.CK8cdMyV.js.map +0 -1
- package/dist/chunks/input-field-password.DJKloBB3.js.map +0 -1
- package/dist/chunks/secondary-nav.BqqNrHZE.js +0 -306
package/dist/chunks/{selection-card-group.C2Av3uyz.js.map → selection-card-group.C59ZIrVm.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection-card-group.C2Av3uyz.js","sources":["../../../vue2/src/components/selection-card/selection-card.types.ts","../../../vue2/src/components/selection-card/selection-card.keys.ts","../../../vue2/src/components/selection-card/selection-card.vue","../../../vue2/src/components/selection-card/components/selection-card-group/selection-card-group.vue"],"sourcesContent":["import { type RadioInputValue } from '@/components/internal/radio-input';\nimport { type BentoCheckboxType } from '../checkbox/checkbox.types';\nimport { type VueNodeElement } from '@/types/elements';\n\nexport enum BentoSelectionCardState {\n DISABLED = 'disabled',\n READONLY = 'readonly',\n ERROR = 'error',\n}\n\nexport type BentoSelectionCardValue = string | number;\n\nexport type BentoSelectionCardModelValue = BentoCheckboxType | RadioInputValue;\n\nexport interface BentoSelectionCardItem {\n content?: string | object;\n description?: string;\n disabled?: boolean;\n dynamicContent?: string | object;\n fullyClickable?: boolean;\n hasError?: boolean;\n icon?: VueNodeElement;\n readonly?: boolean;\n subtitle?: string;\n title: string;\n value: BentoSelectionCardValue;\n}\n","export const SELECTION_CARD_RADIO_INPUT_INJECTION_KEY = Symbol('selection card radio input injection key');\n","<template>\n <div class=\"b-selection-card\" :class=\"conditionalClasses\" @click=\"handleCardClick\">\n <div class=\"b-selection-card__container\" :class=\"containerConditionalClasses\">\n <div class=\"b-selection-card__checkbox-container\" :class=\"checkboxContainerConditionalClasses\">\n <div class=\"b-selection-card__checkbox-container-text\" :class=\"checkboxContainerTextConditionalClasses\">\n <div v-if=\"hasSlot('icon')\" class=\"b-selection-card__icon\" role=\"presentation\" aria-hidden=\"true\">\n <slot name=\"icon\" />\n </div>\n <label :for=\"inputId\" class=\"b-selection-card__text\" @click.stop.prevent=\"handleCardClick\">\n <bento-typography\n v-if=\"subtitle\"\n class=\"b-selection-card__description\"\n el=\"span\"\n variant=\"caption\"\n >\n {{ subtitle }}\n </bento-typography>\n <bento-typography el=\"span\" variant=\"title\">{{ title }}</bento-typography>\n <bento-typography\n v-if=\"description\"\n id=\"descriptionId\"\n class=\"b-selection-card__description\"\n el=\"span\"\n variant=\"body\"\n >\n {{ description }}\n </bento-typography>\n </label>\n </div>\n <radio-input\n v-if=\"isRadioInput\"\n :id=\"inputId\"\n ref=\"inputRef\"\n :aria-label=\"ariaLabel\"\n :aria-describedby=\"description ? descriptionId : undefined\"\n :disabled=\"disabled\"\n :has-error=\"hasError\"\n :aria-readonly=\"readonly ?? undefined\"\n :value=\"value\"\n :readonly=\"readonly\"\n :model-value=\"computedRadioInputModelValue\"\n />\n <checkbox-input\n v-else\n :id=\"inputId\"\n ref=\"inputRef\"\n :aria-label=\"ariaLabel\"\n :aria-describedby=\"description ? descriptionId : undefined\"\n :disabled=\"disabled\"\n :has-error=\"hasError\"\n :aria-readonly=\"readonly ?? undefined\"\n :value=\"value\"\n :readonly=\"readonly\"\n :model-value=\"computedCheckboxInputModelValue\"\n />\n </div>\n <bento-typography\n v-if=\"hasSlot('content')\"\n ref=\"slotRef\"\n el=\"div\"\n class=\"b-selection-card__slot\"\n :class=\"slotConditionalClasses\"\n >\n <slot name=\"content\" />\n </bento-typography>\n <bento-typography\n v-if=\"hasSlot('dynamicContent') && isChecked\"\n ref=\"dynamicSlotRef\"\n el=\"div\"\n class=\"b-selection-card__slot\"\n :class=\"slotConditionalClasses\"\n >\n <slot name=\"dynamicContent\" />\n </bento-typography>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoTypography } from '@/components/typography';\n import { type BentoCheckboxType, type BentoMultiCheckboxType, CheckboxInput } from '../internal/checkbox-input';\n import { RadioInput, type RadioInputValue } from '../internal/radio-input';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { generateUid } from '@/core/utils/ts';\n import { computed, type ComputedRef, inject, type PropType, type Ref, ref, useSlots } from 'vue';\n import { useHasSlot } from '@/composables';\n import type { BentoSelectionCardModelValue, BentoSelectionCardValue } from './selection-card.types';\n import { BentoSelectionCardState } from './selection-card.types';\n import { SELECTION_CARD_RADIO_INPUT_INJECTION_KEY } from './selection-card.keys';\n\n const props = defineProps({\n /**\n * The description of the selection card\n */\n description: {\n type: String,\n default: undefined,\n },\n\n /**\n * Disables the selection card\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Makes the entire selection card clickable. Clicking over interactive elements inside the card with this prop enabled will not be possible.\n */\n fullyClickable: { type: Boolean, default: false },\n\n /**\n * Shows the selection card in error state\n */\n hasError: { type: Boolean, default: false },\n\n /**\n * This property should not be used directly.\n * It will be used by v-model directive on selection card component.\n *\n * When handling a single input, use a string or a number.\n *\n * When handling multiple inputs, use an array of keys.\n * These keys exist as a set \"value\" prop for each input.\n */\n modelValue: {\n type: [Boolean, String, Array] as PropType<BentoSelectionCardModelValue>,\n default: null,\n },\n\n /**\n * Sets the selection card to readonly\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * The subtitle of the selection card\n */\n subtitle: {\n type: String,\n default: undefined,\n },\n\n /**\n * The title of the selection card\n */\n title: {\n type: String,\n required: true,\n },\n\n /**\n * Indicates the value of the input that will be returned when it's checked.\n */\n value: {\n type: [String, Number] as PropType<BentoSelectionCardValue>,\n required: true,\n },\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the selection card is clicked. Enables Vue2 \"v-model\"\n */\n (e: 'input', value: BentoSelectionCardValue);\n /**\n * Emitted when the selection card is clicked. Enables Vue3 \"v-model\"\n */\n (e: 'update:model-value', value: BentoSelectionCardValue);\n }>();\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n\n const inputId = generateUid('selection-card-input-id');\n const descriptionId = generateUid('selection-card-description');\n\n const computedRadioInputModelValue: ComputedRef<RadioInputValue> = computed(\n () => props.modelValue as RadioInputValue\n );\n const computedCheckboxInputModelValue: ComputedRef<BentoCheckboxType> = computed(\n () => props.modelValue as BentoCheckboxType\n );\n\n const conditionalClasses = computed(() => ({\n 'b-selection-card--checked': isChecked.value,\n 'b-selection-card--fully-clickable': props.fullyClickable,\n }));\n\n const containerConditionalClasses = computed(() => ({\n [`b-selection-card--${BentoSelectionCardState.DISABLED}`]: props.disabled,\n [`b-selection-card--${BentoSelectionCardState.ERROR}`]: props.hasError,\n [`b-selection-card--${BentoSelectionCardState.READONLY}`]: props.readonly,\n 'b-selection-card--center-aligned': isTitleOnly.value,\n }));\n\n const checkboxContainerConditionalClasses = computed(() => ({\n 'b-selection-card__checkbox-container--center-aligned': isTitleOnly.value,\n }));\n\n const checkboxContainerTextConditionalClasses = computed(() => ({\n 'b-selection-card__checkbox-container-text--center-aligned': isTitleOnly.value,\n }));\n\n const slotConditionalClasses = computed(() => ({\n 'b-selection-card__slot--with-icon': hasSlot('icon'),\n }));\n\n const ariaLabel = useAriaLabel({\n ariaLabel: props.title,\n label: props.value as string,\n });\n\n const isCheckboxGroup = computed(() => Array.isArray(props.modelValue));\n\n const isChecked: ComputedRef<boolean> = computed(() => {\n if (isRadioInput.value) {\n return props.value === props.modelValue;\n }\n if (!isCheckboxGroup.value) {\n return props.modelValue as boolean;\n }\n\n return (props.modelValue as BentoMultiCheckboxType).some(item => item === props.value);\n });\n\n const isRadioInput: Ref<boolean> = inject(SELECTION_CARD_RADIO_INPUT_INJECTION_KEY, ref(false));\n\n const isTitleOnly = computed(() => !props.subtitle && !props.description);\n\n const inputRef = ref<InstanceType<typeof RadioInput> | InstanceType<typeof CheckboxInput>>(null);\n const slotRef = ref(null);\n const dynamicSlotRef = ref(null);\n\n // Handle click on the whole card area\n const handleCardClick = (event: Event) => {\n if (inputRef.value.$refs.inputRef === event.target) {\n const newValue = toggleInput();\n onChange(newValue);\n return;\n }\n\n // Do nothing if disabled or readonly\n if (props.disabled && props.readonly) {\n return;\n }\n\n // If it's not fully clickable prevent selecting the card if the click\n // originated in a slot\n if (!props.fullyClickable) {\n // Check if the click originated from the slot - in that case, do nothng\n if (slotRef.value && slotRef.value?.$el?.contains(event.target)) {\n return;\n }\n // Check if the click originated from the dynamic slot - in that case, do nothng\n if (dynamicSlotRef.value && dynamicSlotRef.value?.$el?.contains(event.target)) {\n return;\n }\n // Check if the click originated from the input - in that case do nothing, as the input will emit the event already\n if (inputRef.value && inputRef.value?.$el?.contains(event.target as Node)) {\n return;\n }\n }\n\n // If the click originated outside of these two areas, emit the change event\n const newValue = toggleInput();\n\n onChange(newValue);\n };\n\n const toggleInput = (): BentoSelectionCardModelValue => {\n const currentValue: boolean = (inputRef.value?.$refs.inputRef as HTMLInputElement).checked;\n\n if (isCheckboxGroup.value) {\n const newCheckedList = [...(props.modelValue as BentoMultiCheckboxType)];\n const index = newCheckedList.indexOf(props.value);\n\n if (index === -1) {\n newCheckedList.push(props.value);\n } else {\n newCheckedList.splice(index, 1);\n }\n return newCheckedList;\n }\n\n if (isRadioInput.value) {\n return props.value;\n }\n return currentValue;\n };\n\n const onChange = newValue => {\n if (!props.disabled && !props.readonly) {\n emit('update:model-value', newValue);\n emit('input', newValue);\n }\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * Selection card component. If used standalone, only the checkbox variant can be used. If the checkbox variant is needed, please use the bento-selection-card-group component.\n *\n * @example\n * import { BentoSelectionCard } from '@adyen/bento-vue2';\n * import EmoticonHappyIcon from '@adyen/ui-assets-icons-16/vue/emoticon-happy';\n *\n * export default {\n * components: { BentoSelectionCard, EmoticonHappyIcon },\n * template: `\n * <bento-selection-card title=\"Card title\" :model-value.sync=\"yourModelValue\">\n * <template #icon>\n * <emoticon-happy-icon />\n * </template>\n * </bento-selection-card>\n * `\n * }\n */\n export default {\n name: 'bento-selection-card',\n };\n</script>\n<style lang=\"scss\" scoped src=\"./selection-card.scss\" />\n","<template>\n <controls-group\n ref=\"containerRef\"\n :aria-describedby=\"shouldShowGroupError ? errorMessageId : null\"\n :aria-required=\"required\"\n :label=\"label\"\n :hide-label=\"hideLabel\"\n :description=\"description\"\n :disabled=\"disabled\"\n :tooltip-text=\"tooltipText\"\n :readonly=\"readonly\"\n :required=\"required\"\n :optional=\"optional\"\n class=\"b-selection-card-group\"\n component-name=\"selection-card-group\"\n >\n <div\n v-if=\"!itemsPerRow || layout === 'vertical'\"\n class=\"b-selection-card-group__items\"\n :class=\"conditionalItemsClasses\"\n >\n <bento-selection-card\n v-for=\"item in items\"\n :key=\"`selection-card-${item.value}`\"\n class=\"b-selection-card-group__item\"\n v-bind=\"item\"\n :model-value=\"inputValue\"\n :readonly=\"readonly || item.readonly\"\n :has-error=\"shouldShowGroupError\"\n :disabled=\"disabled || item.disabled\"\n @update:model-value=\"onInput\"\n >\n <template v-if=\"hasSlot('icon') && item.icon\" #icon>\n <slot name=\"icon\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('content') && item.content\" #content>\n <slot name=\"content\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('dynamicContent') && item.dynamicContent\" #dynamicContent>\n <slot name=\"dynamicContent\" v-bind=\"item\"></slot>\n </template>\n </bento-selection-card>\n </div>\n <template v-else>\n <div :key=\"`selection-card-group-layout-breakpoint-${currentBreakpoint}`\">\n <grid-layout\n v-for=\"(row, rowIndex) in computedRows\"\n :key=\"`selection-card-group-row-${rowIndex}-cols-${computedItemsPerRow}`\"\n class=\"b-selection-card-group__items--wrap\"\n :column-width=\"computedColumnWidth\"\n >\n <template v-for=\"(item, columnIndex) in row\" #[`col-${Number(columnIndex)+1}`]>\n <bento-selection-card\n :key=\"`selection-card-${item.value}`\"\n class=\"b-selection-card-group__item b-selection-card-group__item--full-height\"\n v-bind=\"item\"\n :model-value=\"inputValue\"\n :readonly=\"readonly || item.readonly\"\n :has-error=\"shouldShowGroupError\"\n :disabled=\"disabled || item.disabled\"\n @update:model-value=\"onInput\"\n >\n <template v-if=\"hasSlot('icon') && item.icon\" #icon>\n <slot name=\"icon\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('content') && item.content\" #content>\n <slot name=\"content\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('dynamicContent') && item.dynamicContent\" #dynamicContent>\n <slot name=\"dynamicContent\" v-bind=\"item\"></slot>\n </template>\n </bento-selection-card>\n </template>\n </grid-layout>\n </div>\n </template>\n <error-message\n v-if=\"shouldShowGroupError\"\n :id=\"errorMessageId\"\n :error-message=\"errorMessage\"\n class=\"b-selection-card-group__error-message\"\n />\n </controls-group>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, onMounted, provide, ref, useSlots, watch } from 'vue';\n import { useElementSize } from '@vueuse/core';\n import { BMediaQueryMMax, BMediaQuerySMax } from '@adyen/bento-design-tokens/dist/js/bento/es6';\n import { type BentoSelectionCardGroupEmits, type BentoSelectionCardGroupProps } from './selection-card-group.types';\n import BentoSelectionCard from '../../selection-card.vue';\n import { ControlsGroup, ErrorMessage, GridLayout } from '../../../internal';\n import { SELECTION_CARD_RADIO_INPUT_INJECTION_KEY } from '../../selection-card.keys';\n import { generateUid } from '@/core/utils/ts';\n import { useFormFieldEmits } from '@/utils/ts/form-field/form-field';\n\n const props = withDefaults(defineProps<BentoSelectionCardGroupProps>(), {\n description: null,\n disabled: false,\n errorMessage: null,\n formId: null,\n hideLabel: null,\n label: null,\n layout: 'vertical',\n itemsPerRow: undefined,\n modelValue: null,\n optional: false,\n required: false,\n tooltipText: null,\n readonly: false,\n variant: 'checkbox',\n });\n\n const emit = defineEmits<BentoSelectionCardGroupEmits>();\n\n const { emitValue } = useFormFieldEmits(emit);\n\n const slots = useSlots();\n // Slots logic\n // Temporary, use-has-slots composable doesn't currently work for vue3 named scoped slots\n // We do the same in bento-checkbox-group\n const hasSlot = name => !!slots[name];\n\n const conditionalItemsClasses = computed(() => ({\n 'b-selection-card-group__items--horizontal': props.layout === 'horizontal',\n }));\n\n const inputValue = ref(props.modelValue);\n watch(\n () => props.modelValue,\n () => {\n inputValue.value = props.modelValue;\n }\n );\n\n // Error message logic\n const errorMessageId = generateUid('error');\n const shouldShowGroupError = computed(() => !props.disabled && !props.readonly && !!props.errorMessage);\n\n // itemsPerRow logic\n const containerRef = ref<HTMLElement | null>(null);\n const { width } = useElementSize(containerRef);\n\n const smallBreakpoint = computed(() => BMediaQuerySMax.split('px')[0]);\n const mediumBreakpoint = computed(() => BMediaQueryMMax.split('px')[0]);\n\n const currentBreakpoint = computed(() => {\n if (width.value < smallBreakpoint.value) {\n return 'small';\n }\n if (width.value >= smallBreakpoint.value && width.value < mediumBreakpoint.value) {\n return 'medium';\n }\n return 'large';\n });\n\n const computedItemsPerRow = computed(() => {\n return (props.itemsPerRow?.[currentBreakpoint?.value] as number) || props.items.length;\n });\n\n const computedRows = computed(() => {\n if (!props.itemsPerRow) {\n return [];\n }\n const rows = [];\n for (let i = 0; i < props.items.length; i += computedItemsPerRow?.value) {\n rows.push(props.items.slice(i, i + computedItemsPerRow?.value));\n }\n return rows;\n });\n\n // We need to compute the column width on 12 because we're using a 12-column system for out grid-layout logic\n const itemColumnWidth = computed(() => 12 / computedItemsPerRow?.value);\n\n /**\n * Filling the columnWidth array with the same parameters per item to pass\n * to the `grid-layout` layout so the each card can have\n * the same width according to the screen size.\n */\n const computedColumnWidth = computed(() => {\n return computedItemsPerRow?.value\n ? new Array(computedItemsPerRow?.value).fill({\n // Instead of passing the actual screen sizes values, passing the same values per each screen size and recomputing it makes sure visually the change is smoother and not laggy\n small: itemColumnWidth.value,\n medium: itemColumnWidth.value,\n large: itemColumnWidth.value,\n })\n : [];\n });\n\n const onInput = value => {\n inputValue.value = value;\n emitValue(value);\n };\n\n const isRadioVariant = computed(() => props.variant === 'radio');\n\n provide(SELECTION_CARD_RADIO_INPUT_INJECTION_KEY, isRadioVariant);\n\n onMounted(() => {\n if (props.itemsPerRow) {\n Object.values(props.itemsPerRow).forEach(el => {\n if (el && (el < 2 || el > 6)) {\n throw new Error(\n 'itemsPerRow values must have a value between 2 and 6 items per row. Read the documentation for more information.'\n );\n }\n });\n }\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * Group of bento-selection-cards.\n *\n * @example\n * import { BentoSelectionCardGroup } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoSelectionCardGroup },\n * template: `\n * <bento-selection-card-group\n * :items=\"[\n * {\n * title: 'Card 1',\n * value: 'card-1',\n * content: 'Slot content 1',\n * icon: RetailIcon,\n * },\n * {\n * title: 'Card 2',\n * value: 'card-2',\n * content: 'Slot content 2',\n * icon: LeafIcon,\n * },\n * ]\"\n * >\n * <template #icon=\"{ icon }\">\n * <component :is=\"icon\"/>\n * </template>\n * <template #content=\"{ content }\">\n * <div>{{ content }}</div>\n * </template>\n * </bento-selection-card-group>\n * `,\n * }\n */\n export default {\n model: { prop: 'modelValue' },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./selection-card-group.scss\" />\n"],"names":["BentoSelectionCardState","BentoSelectionCardState2","SELECTION_CARD_RADIO_INPUT_INJECTION_KEY","__default__$1","props","__props","emit","__emit","slots","useSlots","hasSlot","useHasSlot","inputId","generateUid","descriptionId","computedRadioInputModelValue","computed","computedCheckboxInputModelValue","conditionalClasses","isChecked","containerConditionalClasses","isTitleOnly","checkboxContainerConditionalClasses","checkboxContainerTextConditionalClasses","slotConditionalClasses","ariaLabel","useAriaLabel","isCheckboxGroup","isRadioInput","item","inject","ref","inputRef","slotRef","dynamicSlotRef","handleCardClick","event","newValue2","toggleInput","onChange","newValue","currentValue","newCheckedList","index","__default__","emitValue","useFormFieldEmits","name","conditionalItemsClasses","inputValue","watch","errorMessageId","shouldShowGroupError","containerRef","width","useElementSize","smallBreakpoint","BMediaQuerySMax","mediumBreakpoint","BMediaQueryMMax","currentBreakpoint","computedItemsPerRow","computedRows","rows","i","itemColumnWidth","computedColumnWidth","onInput","value","isRadioVariant","provide","onMounted","el"],"mappings":";;;;;;;;;;;;;;;AAIO,IAAAA,IAAA,kBAAAC,OACHA,EAAA,WAAA,YACAA,EAAA,WAAA,YACAA,EAAA,QAAA,SAHQA,IAAAD,KAAA,CAAA,CAAA;ACJL,MAAAE,IAAA,uBAAA,0CAAA;;;;;iBC4THC,KAAA;AAAA,EAAe,MAAA;AAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AApOA,UAAAC,IAAAC,GAoEAC,IAAAC,GAWAC,IAAAC,EAAA,GACAC,IAAAC,GAAAH,CAAA,GAEAI,IAAAC,EAAA,yBAAA,GACAC,IAAAD,EAAA,4BAAA,GAEAE,IAAAC;AAAA,MAAmE,MAAAZ,EAAA;AAAA,IACnD,GAEhBa,IAAAD;AAAA,MAAwE,MAAAZ,EAAA;AAAA,IACxD,GAGhBc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,MAAAnB,EAAA,QAAAmB,GACAvB,EAAAuB,CAAA;AAAA,IAAe,GAGnBC,IAAArD,EAAA,MAAAZ,EAAA,YAAA,OAAA;AAEA,WAAAkE,GAAApE,GAAAmE,CAAA,GAEAE,GAAA,MAAA;AACI,MAAAnE,EAAA,eACI,OAAA,OAAAA,EAAA,WAAA,EAAA,QAAA,CAAAoE,MAAA;AACI,YAAAA,MAAAA,IAAA,KAAAA,IAAA;AACI,gBAAA,IAAA;AAAA,YAAU;AAAA,UACN;AAAA,MAER,CAAA;AAAA,IAER,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"selection-card-group.C59ZIrVm.js","sources":["../../../vue2/src/components/selection-card/selection-card.types.ts","../../../vue2/src/components/selection-card/selection-card.keys.ts","../../../vue2/src/components/selection-card/selection-card.vue","../../../vue2/src/components/selection-card/components/selection-card-group/selection-card-group.vue"],"sourcesContent":["import { type RadioInputValue } from '@/components/internal/radio-input';\nimport { type BentoCheckboxType } from '../checkbox/checkbox.types';\nimport { type VueNodeElement } from '@/types/elements';\n\nexport enum BentoSelectionCardState {\n DISABLED = 'disabled',\n READONLY = 'readonly',\n ERROR = 'error',\n}\n\nexport type BentoSelectionCardValue = string | number;\n\nexport type BentoSelectionCardModelValue = BentoCheckboxType | RadioInputValue;\n\nexport interface BentoSelectionCardItem {\n content?: string | object;\n description?: string;\n disabled?: boolean;\n dynamicContent?: string | object;\n fullyClickable?: boolean;\n hasError?: boolean;\n icon?: VueNodeElement;\n readonly?: boolean;\n subtitle?: string;\n title: string;\n value: BentoSelectionCardValue;\n}\n","export const SELECTION_CARD_RADIO_INPUT_INJECTION_KEY = Symbol('selection card radio input injection key');\n","<template>\n <div class=\"b-selection-card\" :class=\"conditionalClasses\" @click=\"handleCardClick\">\n <div class=\"b-selection-card__container\" :class=\"containerConditionalClasses\">\n <div class=\"b-selection-card__checkbox-container\" :class=\"checkboxContainerConditionalClasses\">\n <div class=\"b-selection-card__checkbox-container-text\" :class=\"checkboxContainerTextConditionalClasses\">\n <div v-if=\"hasSlot('icon')\" class=\"b-selection-card__icon\" role=\"presentation\" aria-hidden=\"true\">\n <slot name=\"icon\" />\n </div>\n <label :for=\"inputId\" class=\"b-selection-card__text\" @click.stop.prevent=\"handleCardClick\">\n <bento-typography\n v-if=\"subtitle\"\n class=\"b-selection-card__description\"\n el=\"span\"\n variant=\"caption\"\n >\n {{ subtitle }}\n </bento-typography>\n <bento-typography el=\"span\" variant=\"title\">{{ title }}</bento-typography>\n <bento-typography\n v-if=\"description\"\n id=\"descriptionId\"\n class=\"b-selection-card__description\"\n el=\"span\"\n variant=\"body\"\n >\n {{ description }}\n </bento-typography>\n </label>\n </div>\n <radio-input\n v-if=\"isRadioInput\"\n :id=\"inputId\"\n ref=\"inputRef\"\n :aria-label=\"ariaLabel\"\n :aria-describedby=\"description ? descriptionId : undefined\"\n :disabled=\"disabled\"\n :has-error=\"hasError\"\n :aria-readonly=\"readonly ?? undefined\"\n :value=\"value\"\n :readonly=\"readonly\"\n :model-value=\"computedRadioInputModelValue\"\n />\n <checkbox-input\n v-else\n :id=\"inputId\"\n ref=\"inputRef\"\n :aria-label=\"ariaLabel\"\n :aria-describedby=\"description ? descriptionId : undefined\"\n :disabled=\"disabled\"\n :has-error=\"hasError\"\n :aria-readonly=\"readonly ?? undefined\"\n :value=\"value\"\n :readonly=\"readonly\"\n :model-value=\"computedCheckboxInputModelValue\"\n />\n </div>\n <bento-typography\n v-if=\"hasSlot('content')\"\n ref=\"slotRef\"\n el=\"div\"\n class=\"b-selection-card__slot\"\n :class=\"slotConditionalClasses\"\n >\n <slot name=\"content\" />\n </bento-typography>\n <bento-typography\n v-if=\"hasSlot('dynamicContent') && isChecked\"\n ref=\"dynamicSlotRef\"\n el=\"div\"\n class=\"b-selection-card__slot\"\n :class=\"slotConditionalClasses\"\n >\n <slot name=\"dynamicContent\" />\n </bento-typography>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoTypography } from '@/components/typography';\n import { type BentoCheckboxType, type BentoMultiCheckboxType, CheckboxInput } from '../internal/checkbox-input';\n import { RadioInput, type RadioInputValue } from '../internal/radio-input';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { generateUid } from '@/core/utils/ts';\n import { computed, type ComputedRef, inject, type PropType, type Ref, ref, useSlots } from 'vue';\n import { useHasSlot } from '@/composables';\n import type { BentoSelectionCardModelValue, BentoSelectionCardValue } from './selection-card.types';\n import { BentoSelectionCardState } from './selection-card.types';\n import { SELECTION_CARD_RADIO_INPUT_INJECTION_KEY } from './selection-card.keys';\n\n const props = defineProps({\n /**\n * The description of the selection card\n */\n description: {\n type: String,\n default: undefined,\n },\n\n /**\n * Disables the selection card\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Makes the entire selection card clickable. Clicking over interactive elements inside the card with this prop enabled will not be possible.\n */\n fullyClickable: { type: Boolean, default: false },\n\n /**\n * Shows the selection card in error state\n */\n hasError: { type: Boolean, default: false },\n\n /**\n * This property should not be used directly.\n * It will be used by v-model directive on selection card component.\n *\n * When handling a single input, use a string or a number.\n *\n * When handling multiple inputs, use an array of keys.\n * These keys exist as a set \"value\" prop for each input.\n */\n modelValue: {\n type: [Boolean, String, Array] as PropType<BentoSelectionCardModelValue>,\n default: null,\n },\n\n /**\n * Sets the selection card to readonly\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * The subtitle of the selection card\n */\n subtitle: {\n type: String,\n default: undefined,\n },\n\n /**\n * The title of the selection card\n */\n title: {\n type: String,\n required: true,\n },\n\n /**\n * Indicates the value of the input that will be returned when it's checked.\n */\n value: {\n type: [String, Number] as PropType<BentoSelectionCardValue>,\n required: true,\n },\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the selection card is clicked. Enables Vue2 \"v-model\"\n */\n (e: 'input', value: BentoSelectionCardValue);\n /**\n * Emitted when the selection card is clicked. Enables Vue3 \"v-model\"\n */\n (e: 'update:model-value', value: BentoSelectionCardValue);\n }>();\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n\n const inputId = generateUid('selection-card-input-id');\n const descriptionId = generateUid('selection-card-description');\n\n const computedRadioInputModelValue: ComputedRef<RadioInputValue> = computed(\n () => props.modelValue as RadioInputValue\n );\n const computedCheckboxInputModelValue: ComputedRef<BentoCheckboxType> = computed(\n () => props.modelValue as BentoCheckboxType\n );\n\n const conditionalClasses = computed(() => ({\n 'b-selection-card--checked': isChecked.value,\n 'b-selection-card--fully-clickable': props.fullyClickable,\n }));\n\n const containerConditionalClasses = computed(() => ({\n [`b-selection-card--${BentoSelectionCardState.DISABLED}`]: props.disabled,\n [`b-selection-card--${BentoSelectionCardState.ERROR}`]: props.hasError,\n [`b-selection-card--${BentoSelectionCardState.READONLY}`]: props.readonly,\n 'b-selection-card--center-aligned': isTitleOnly.value,\n }));\n\n const checkboxContainerConditionalClasses = computed(() => ({\n 'b-selection-card__checkbox-container--center-aligned': isTitleOnly.value,\n }));\n\n const checkboxContainerTextConditionalClasses = computed(() => ({\n 'b-selection-card__checkbox-container-text--center-aligned': isTitleOnly.value,\n }));\n\n const slotConditionalClasses = computed(() => ({\n 'b-selection-card__slot--with-icon': hasSlot('icon'),\n }));\n\n const ariaLabel = useAriaLabel({\n ariaLabel: props.title,\n label: props.value as string,\n });\n\n const isCheckboxGroup = computed(() => Array.isArray(props.modelValue));\n\n const isChecked: ComputedRef<boolean> = computed(() => {\n if (isRadioInput.value) {\n return props.value === props.modelValue;\n }\n if (!isCheckboxGroup.value) {\n return props.modelValue as boolean;\n }\n\n return (props.modelValue as BentoMultiCheckboxType).some(item => item === props.value);\n });\n\n const isRadioInput: Ref<boolean> = inject(SELECTION_CARD_RADIO_INPUT_INJECTION_KEY, ref(false));\n\n const isTitleOnly = computed(() => !props.subtitle && !props.description);\n\n const inputRef = ref<InstanceType<typeof RadioInput> | InstanceType<typeof CheckboxInput>>(null);\n const slotRef = ref(null);\n const dynamicSlotRef = ref(null);\n\n // Handle click on the whole card area\n const handleCardClick = (event: Event) => {\n if (inputRef.value.$refs.inputRef === event.target) {\n const newValue = toggleInput();\n onChange(newValue);\n return;\n }\n\n // Do nothing if disabled or readonly\n if (props.disabled && props.readonly) {\n return;\n }\n\n // If it's not fully clickable prevent selecting the card if the click\n // originated in a slot\n if (!props.fullyClickable) {\n // Check if the click originated from the slot - in that case, do nothng\n if (slotRef.value && slotRef.value?.$el?.contains(event.target)) {\n return;\n }\n // Check if the click originated from the dynamic slot - in that case, do nothng\n if (dynamicSlotRef.value && dynamicSlotRef.value?.$el?.contains(event.target)) {\n return;\n }\n // Check if the click originated from the input - in that case do nothing, as the input will emit the event already\n if (inputRef.value && inputRef.value?.$el?.contains(event.target as Node)) {\n return;\n }\n }\n\n // If the click originated outside of these two areas, emit the change event\n const newValue = toggleInput();\n\n onChange(newValue);\n };\n\n const toggleInput = (): BentoSelectionCardModelValue => {\n const currentValue: boolean = (inputRef.value?.$refs.inputRef as HTMLInputElement).checked;\n\n if (isCheckboxGroup.value) {\n const newCheckedList = [...(props.modelValue as BentoMultiCheckboxType)];\n const index = newCheckedList.indexOf(props.value);\n\n if (index === -1) {\n newCheckedList.push(props.value);\n } else {\n newCheckedList.splice(index, 1);\n }\n return newCheckedList;\n }\n\n if (isRadioInput.value) {\n return props.value;\n }\n return currentValue;\n };\n\n const onChange = newValue => {\n if (!props.disabled && !props.readonly) {\n emit('update:model-value', newValue);\n emit('input', newValue);\n }\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * Selection card component. If used standalone, only the checkbox variant can be used. If the checkbox variant is needed, please use the bento-selection-card-group component.\n *\n * @example\n * import { BentoSelectionCard } from '@adyen/bento-vue2';\n * import EmoticonHappyIcon from '@adyen/ui-assets-icons-16/vue/emoticon-happy';\n *\n * export default {\n * components: { BentoSelectionCard, EmoticonHappyIcon },\n * template: `\n * <bento-selection-card title=\"Card title\" :model-value.sync=\"yourModelValue\">\n * <template #icon>\n * <emoticon-happy-icon />\n * </template>\n * </bento-selection-card>\n * `\n * }\n */\n export default {\n name: 'bento-selection-card',\n };\n</script>\n<style lang=\"scss\" scoped src=\"./selection-card.scss\" />\n","<template>\n <controls-group\n ref=\"containerRef\"\n :aria-describedby=\"shouldShowGroupError ? errorMessageId : null\"\n :aria-required=\"required\"\n :label=\"label\"\n :hide-label=\"hideLabel\"\n :description=\"description\"\n :disabled=\"disabled\"\n :tooltip-text=\"tooltipText\"\n :readonly=\"readonly\"\n :required=\"required\"\n :optional=\"optional\"\n class=\"b-selection-card-group\"\n component-name=\"selection-card-group\"\n >\n <div\n v-if=\"!itemsPerRow || layout === 'vertical'\"\n class=\"b-selection-card-group__items\"\n :class=\"conditionalItemsClasses\"\n >\n <bento-selection-card\n v-for=\"item in items\"\n :key=\"`selection-card-${item.value}`\"\n class=\"b-selection-card-group__item\"\n v-bind=\"item\"\n :model-value=\"inputValue\"\n :readonly=\"readonly || item.readonly\"\n :has-error=\"shouldShowGroupError\"\n :disabled=\"disabled || item.disabled\"\n @update:model-value=\"onInput\"\n >\n <template v-if=\"hasSlot('icon') && item.icon\" #icon>\n <slot name=\"icon\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('content') && item.content\" #content>\n <slot name=\"content\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('dynamicContent') && item.dynamicContent\" #dynamicContent>\n <slot name=\"dynamicContent\" v-bind=\"item\"></slot>\n </template>\n </bento-selection-card>\n </div>\n <template v-else>\n <div :key=\"`selection-card-group-layout-breakpoint-${currentBreakpoint}`\">\n <grid-layout\n v-for=\"(row, rowIndex) in computedRows\"\n :key=\"`selection-card-group-row-${rowIndex}-cols-${computedItemsPerRow}`\"\n class=\"b-selection-card-group__items--wrap\"\n :column-width=\"computedColumnWidth\"\n >\n <template v-for=\"(item, columnIndex) in row\" #[`col-${Number(columnIndex)+1}`]>\n <bento-selection-card\n :key=\"`selection-card-${item.value}`\"\n class=\"b-selection-card-group__item b-selection-card-group__item--full-height\"\n v-bind=\"item\"\n :model-value=\"inputValue\"\n :readonly=\"readonly || item.readonly\"\n :has-error=\"shouldShowGroupError\"\n :disabled=\"disabled || item.disabled\"\n @update:model-value=\"onInput\"\n >\n <template v-if=\"hasSlot('icon') && item.icon\" #icon>\n <slot name=\"icon\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('content') && item.content\" #content>\n <slot name=\"content\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('dynamicContent') && item.dynamicContent\" #dynamicContent>\n <slot name=\"dynamicContent\" v-bind=\"item\"></slot>\n </template>\n </bento-selection-card>\n </template>\n </grid-layout>\n </div>\n </template>\n <error-message\n v-if=\"shouldShowGroupError\"\n :id=\"errorMessageId\"\n :error-message=\"errorMessage\"\n class=\"b-selection-card-group__error-message\"\n />\n </controls-group>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, onMounted, provide, ref, useSlots, watch } from 'vue';\n import { useElementSize } from '@vueuse/core';\n import { BMediaQueryMMax, BMediaQuerySMax } from '@adyen/bento-design-tokens/dist/js/bento/es6';\n import { type BentoSelectionCardGroupEmits, type BentoSelectionCardGroupProps } from './selection-card-group.types';\n import BentoSelectionCard from '../../selection-card.vue';\n import { ControlsGroup, ErrorMessage, GridLayout } from '../../../internal';\n import { SELECTION_CARD_RADIO_INPUT_INJECTION_KEY } from '../../selection-card.keys';\n import { generateUid } from '@/core/utils/ts';\n import { useFormFieldEmits } from '@/utils/ts/form-field/form-field';\n\n const props = withDefaults(defineProps<BentoSelectionCardGroupProps>(), {\n description: null,\n disabled: false,\n errorMessage: null,\n formId: null,\n hideLabel: null,\n label: null,\n layout: 'vertical',\n itemsPerRow: undefined,\n modelValue: null,\n optional: false,\n required: false,\n tooltipText: null,\n readonly: false,\n variant: 'checkbox',\n });\n\n const emit = defineEmits<BentoSelectionCardGroupEmits>();\n\n const { emitValue } = useFormFieldEmits(emit);\n\n const slots = useSlots();\n // Slots logic\n // Temporary, use-has-slots composable doesn't currently work for vue3 named scoped slots\n // We do the same in bento-checkbox-group\n const hasSlot = name => !!slots[name];\n\n const conditionalItemsClasses = computed(() => ({\n 'b-selection-card-group__items--horizontal': props.layout === 'horizontal',\n }));\n\n const inputValue = ref(props.modelValue);\n watch(\n () => props.modelValue,\n () => {\n inputValue.value = props.modelValue;\n }\n );\n\n // Error message logic\n const errorMessageId = generateUid('error');\n const shouldShowGroupError = computed(() => !props.disabled && !props.readonly && !!props.errorMessage);\n\n // itemsPerRow logic\n const containerRef = ref<HTMLElement | null>(null);\n const { width } = useElementSize(containerRef);\n\n const smallBreakpoint = computed(() => BMediaQuerySMax.split('px')[0]);\n const mediumBreakpoint = computed(() => BMediaQueryMMax.split('px')[0]);\n\n const currentBreakpoint = computed(() => {\n if (width.value < smallBreakpoint.value) {\n return 'small';\n }\n if (width.value >= smallBreakpoint.value && width.value < mediumBreakpoint.value) {\n return 'medium';\n }\n return 'large';\n });\n\n const computedItemsPerRow = computed(() => {\n return (props.itemsPerRow?.[currentBreakpoint?.value] as number) || props.items.length;\n });\n\n const computedRows = computed(() => {\n if (!props.itemsPerRow) {\n return [];\n }\n const rows = [];\n for (let i = 0; i < props.items.length; i += computedItemsPerRow?.value) {\n rows.push(props.items.slice(i, i + computedItemsPerRow?.value));\n }\n return rows;\n });\n\n // We need to compute the column width on 12 because we're using a 12-column system for out grid-layout logic\n const itemColumnWidth = computed(() => 12 / computedItemsPerRow?.value);\n\n /**\n * Filling the columnWidth array with the same parameters per item to pass\n * to the `grid-layout` layout so the each card can have\n * the same width according to the screen size.\n */\n const computedColumnWidth = computed(() => {\n return computedItemsPerRow?.value\n ? new Array(computedItemsPerRow?.value).fill({\n // Instead of passing the actual screen sizes values, passing the same values per each screen size and recomputing it makes sure visually the change is smoother and not laggy\n small: itemColumnWidth.value,\n medium: itemColumnWidth.value,\n large: itemColumnWidth.value,\n })\n : [];\n });\n\n const onInput = value => {\n inputValue.value = value;\n emitValue(value);\n };\n\n const isRadioVariant = computed(() => props.variant === 'radio');\n\n provide(SELECTION_CARD_RADIO_INPUT_INJECTION_KEY, isRadioVariant);\n\n onMounted(() => {\n if (props.itemsPerRow) {\n Object.values(props.itemsPerRow).forEach(el => {\n if (el && (el < 2 || el > 6)) {\n throw new Error(\n 'itemsPerRow values must have a value between 2 and 6 items per row. Read the documentation for more information.'\n );\n }\n });\n }\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * Group of bento-selection-cards.\n *\n * @example\n * import { BentoSelectionCardGroup } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoSelectionCardGroup },\n * template: `\n * <bento-selection-card-group\n * :items=\"[\n * {\n * title: 'Card 1',\n * value: 'card-1',\n * content: 'Slot content 1',\n * icon: RetailIcon,\n * },\n * {\n * title: 'Card 2',\n * value: 'card-2',\n * content: 'Slot content 2',\n * icon: LeafIcon,\n * },\n * ]\"\n * >\n * <template #icon=\"{ icon }\">\n * <component :is=\"icon\"/>\n * </template>\n * <template #content=\"{ content }\">\n * <div>{{ content }}</div>\n * </template>\n * </bento-selection-card-group>\n * `,\n * }\n */\n export default {\n model: { prop: 'modelValue' },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./selection-card-group.scss\" />\n"],"names":["BentoSelectionCardState","BentoSelectionCardState2","SELECTION_CARD_RADIO_INPUT_INJECTION_KEY","__default__$1","props","__props","emit","__emit","slots","useSlots","hasSlot","useHasSlot","inputId","generateUid","descriptionId","computedRadioInputModelValue","computed","computedCheckboxInputModelValue","conditionalClasses","isChecked","containerConditionalClasses","isTitleOnly","checkboxContainerConditionalClasses","checkboxContainerTextConditionalClasses","slotConditionalClasses","ariaLabel","useAriaLabel","isCheckboxGroup","isRadioInput","item","inject","ref","inputRef","slotRef","dynamicSlotRef","handleCardClick","event","newValue2","toggleInput","onChange","newValue","currentValue","newCheckedList","index","__default__","emitValue","useFormFieldEmits","name","conditionalItemsClasses","inputValue","watch","errorMessageId","shouldShowGroupError","containerRef","width","useElementSize","smallBreakpoint","BMediaQuerySMax","mediumBreakpoint","BMediaQueryMMax","currentBreakpoint","computedItemsPerRow","computedRows","rows","i","itemColumnWidth","computedColumnWidth","onInput","value","isRadioVariant","provide","onMounted","el"],"mappings":";;;;;;;;;;;;;;;AAIO,IAAAA,IAAA,kBAAAC,OACHA,EAAA,WAAA,YACAA,EAAA,WAAA,YACAA,EAAA,QAAA,SAHQA,IAAAD,KAAA,CAAA,CAAA;ACJL,MAAAE,IAAA,uBAAA,0CAAA;;;;;iBC4THC,KAAA;AAAA,EAAe,MAAA;AAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AApOA,UAAAC,IAAAC,GAoEAC,IAAAC,GAWAC,IAAAC,EAAA,GACAC,IAAAC,GAAAH,CAAA,GAEAI,IAAAC,EAAA,yBAAA,GACAC,IAAAD,EAAA,4BAAA,GAEAE,IAAAC;AAAA,MAAmE,MAAAZ,EAAA;AAAA,IACnD,GAEhBa,IAAAD;AAAA,MAAwE,MAAAZ,EAAA;AAAA,IACxD,GAGhBc,IAAAF,EAAA,OAAA;AAAA,MAA2C,6BAAAG,EAAA;AAAA,MACA,qCAAAf,EAAA;AAAA,IACI,EAAA,GAG/CgB,IAAAJ,EAAA,OAAA;AAAA,MAAoD,CAAA,qBAAAhB,EAAA,QAAA,EAAA,GAAAI,EAAA;AAAA,MACiB,CAAA,qBAAAJ,EAAA,KAAA,EAAA,GAAAI,EAAA;AAAA,MACH,CAAA,qBAAAJ,EAAA,QAAA,EAAA,GAAAI,EAAA;AAAA,MACG,oCAAAiB,EAAA;AAAA,IACjB,EAAA,GAGpDC,IAAAN,EAAA,OAAA;AAAA,MAA4D,wDAAAK,EAAA;AAAA,IACY,EAAA,GAGxEE,IAAAP,EAAA,OAAA;AAAA,MAAgE,6DAAAK,EAAA;AAAA,IACa,EAAA,GAG7EG,IAAAR,EAAA,OAAA;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
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as G, ref as m, provide as D, watch as P, nextTick as V, computed as E, unref as p, onUnmounted as J, resolveComponent as N, openBlock as f, createElementBlock as w, createElementVNode as T, normalizeStyle as ne, normalizeClass as K, createVNode as x, withCtx as g, Fragment as oe, renderList as se, withDirectives as F, withKeys as ie, createTextVNode as W, toDisplayString as A, createBlock as Y, createCommentVNode as R, vShow as L, renderSlot as U, toRefs as le, inject as j } from "vue";
|
|
2
2
|
import { B as ce } from "./typography.B3J6_tYk.js";
|
|
3
3
|
import { B as de } from "./tag.Uu-6AQys.js";
|
|
4
4
|
import { C as be } from "./cross-circle-fill.BWCKKn0E.js";
|
|
5
5
|
import { u as ue } from "./index.B875RXHM.js";
|
|
6
6
|
import { g as _e } from "./generate-uid.DBWe4g6T.js";
|
|
7
|
-
import { T as
|
|
7
|
+
import { T as M, a as q, E as pe } from "./tabs.keys.B4qGhjp2.js";
|
|
8
8
|
import { F as fe } from "./fixed-scroller.yVsaQzy5.js";
|
|
9
|
-
import { _ as
|
|
9
|
+
import { _ as H } from "./_plugin-vue_export-helper.CHgC5LLL.js";
|
|
10
10
|
import "../assets/tab.css";
|
|
11
|
-
const Q = (e,
|
|
12
|
-
const
|
|
13
|
-
return t.disabled || t.hidden ? Q(
|
|
14
|
-
}, Z = (e,
|
|
15
|
-
const
|
|
16
|
-
return t.disabled || t.hidden ? Z(
|
|
17
|
-
},
|
|
18
|
-
"
|
|
11
|
+
const Q = (e, n) => {
|
|
12
|
+
const i = e === 0 ? n.length - 1 : e - 1, t = n[i];
|
|
13
|
+
return t.disabled || t.hidden ? Q(i, n) : i;
|
|
14
|
+
}, Z = (e, n) => {
|
|
15
|
+
const i = e === n.length - 1 ? 0 : e + 1, t = n[i];
|
|
16
|
+
return t.disabled || t.hidden ? Z(i, n) : i;
|
|
17
|
+
}, z = {
|
|
18
|
+
"de-DE": { errorCount: "Fehler | Fehler" },
|
|
19
|
+
"en-GB": { errorCount: "error | errors" },
|
|
20
|
+
"en-US": { errorCount: "error | errors" },
|
|
21
|
+
"es-ES": { errorCount: "error | errores" },
|
|
22
|
+
"es-MX": { errorCount: "error | errores" },
|
|
23
|
+
"fr-FR": { errorCount: "erreur | erreurs" },
|
|
24
|
+
"it-IT": { errorCount: "errore | errori" },
|
|
25
|
+
"ja-JP": { errorCount: "エラー | エラー" },
|
|
26
|
+
"pt-BR": { errorCount: "erro | erros" },
|
|
27
|
+
"zh-CN": { errorCount: "错误 | 错误" }
|
|
19
28
|
};
|
|
20
|
-
var
|
|
21
|
-
const ve =
|
|
22
|
-
i18n: { messages:
|
|
29
|
+
var X = /* @__PURE__ */ ((e) => (e.ACTIVE_TAB_INDEX = "update:active-tab-index", e))(X || {});
|
|
30
|
+
const ve = G({
|
|
31
|
+
i18n: { messages: z },
|
|
23
32
|
components: {
|
|
24
33
|
BentoTag: de,
|
|
25
34
|
BentoTypography: ce,
|
|
@@ -42,79 +51,79 @@ const ve = z({
|
|
|
42
51
|
*/
|
|
43
52
|
stickyOptions: { type: Object, default: null }
|
|
44
53
|
},
|
|
45
|
-
emits: [
|
|
46
|
-
setup(e, { emit:
|
|
47
|
-
const { tc:
|
|
54
|
+
emits: [X.ACTIVE_TAB_INDEX],
|
|
55
|
+
setup(e, { emit: n }) {
|
|
56
|
+
const { tc: i } = ue({ messages: z }), t = m([]), y = m(null), h = m(), l = m(""), d = m(!1);
|
|
48
57
|
let b;
|
|
49
|
-
D(
|
|
50
|
-
const I = (
|
|
51
|
-
t.value = t.value?.filter(({ id: o }) => o !==
|
|
58
|
+
D(M, l);
|
|
59
|
+
const I = (r) => () => {
|
|
60
|
+
t.value = t.value?.filter(({ id: o }) => o !== r);
|
|
52
61
|
};
|
|
53
|
-
D(
|
|
54
|
-
title:
|
|
62
|
+
D(q, ({
|
|
63
|
+
title: r,
|
|
55
64
|
disabled: o,
|
|
56
|
-
errorCounter:
|
|
57
|
-
withNotificationIndicator:
|
|
65
|
+
errorCounter: s,
|
|
66
|
+
withNotificationIndicator: C,
|
|
58
67
|
counter: te,
|
|
59
68
|
hidden: ae,
|
|
60
|
-
setElementRef:
|
|
69
|
+
setElementRef: re
|
|
61
70
|
}) => {
|
|
62
|
-
const
|
|
71
|
+
const $ = _e("b-tab");
|
|
63
72
|
return t.value.push({
|
|
64
73
|
counter: te,
|
|
65
74
|
disabled: o,
|
|
66
|
-
errorCounter:
|
|
75
|
+
errorCounter: s,
|
|
67
76
|
hidden: ae,
|
|
68
|
-
id:
|
|
69
|
-
title:
|
|
70
|
-
withNotificationIndicator:
|
|
71
|
-
setElementRef:
|
|
72
|
-
}), { id:
|
|
77
|
+
id: $,
|
|
78
|
+
title: r,
|
|
79
|
+
withNotificationIndicator: C,
|
|
80
|
+
setElementRef: re
|
|
81
|
+
}), { id: $, unregisterTab: I($) };
|
|
73
82
|
});
|
|
74
|
-
const u = (
|
|
75
|
-
if (
|
|
76
|
-
const o = t.value.find((
|
|
77
|
-
let
|
|
78
|
-
|
|
83
|
+
const u = (r) => {
|
|
84
|
+
if (r.code === "ArrowLeft" || r.code === "ArrowRight") {
|
|
85
|
+
const o = t.value.find((C) => document.activeElement.id === C.id);
|
|
86
|
+
let s = t.value.indexOf(o);
|
|
87
|
+
r.code === "ArrowLeft" ? s = Q(s, t.value) : r.code === "ArrowRight" && (s = Z(s, t.value)), y.value.children[s].focus();
|
|
79
88
|
}
|
|
80
89
|
};
|
|
81
|
-
|
|
90
|
+
P(
|
|
82
91
|
[() => e.activeTabIndex, t],
|
|
83
|
-
([
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
l.value =
|
|
92
|
+
([r, o]) => {
|
|
93
|
+
V(() => {
|
|
94
|
+
const s = o[r];
|
|
95
|
+
l.value = s && !s.disabled ? s.id : t.value.find(({ disabled: C }) => !C)?.id;
|
|
87
96
|
});
|
|
88
97
|
},
|
|
89
98
|
{ immediate: !0 }
|
|
90
99
|
);
|
|
91
|
-
const c = (
|
|
92
|
-
l.value =
|
|
93
|
-
const o = t.value.findIndex(({ id:
|
|
94
|
-
|
|
95
|
-
}, v = (
|
|
100
|
+
const c = (r) => {
|
|
101
|
+
l.value = r;
|
|
102
|
+
const o = t.value.findIndex(({ id: s }) => s === l.value);
|
|
103
|
+
n(X.ACTIVE_TAB_INDEX, o);
|
|
104
|
+
}, v = (r) => r ? "disabled" : !1, a = E(() => e.stickyOptions?.top ? p(e.stickyOptions.top) : 0), B = E(() => e.sticky && a.value > 0 ? !0 : d.value), k = () => {
|
|
96
105
|
b && (b.disconnect(), b = null), d.value = !1;
|
|
97
|
-
},
|
|
106
|
+
}, O = (r) => {
|
|
98
107
|
e.sticky && a.value === 0 && (b = new IntersectionObserver(
|
|
99
108
|
([o]) => {
|
|
100
109
|
d.value = o.intersectionRatio < 1;
|
|
101
110
|
},
|
|
102
111
|
{ threshold: [1] }
|
|
103
|
-
), b.observe(
|
|
112
|
+
), b.observe(r));
|
|
104
113
|
};
|
|
105
|
-
|
|
114
|
+
P(
|
|
106
115
|
[() => e.sticky, h, a],
|
|
107
|
-
([
|
|
108
|
-
|
|
116
|
+
([r, o]) => {
|
|
117
|
+
k(), r && o && V(() => O(o));
|
|
109
118
|
},
|
|
110
119
|
{ immediate: !0 }
|
|
111
|
-
),
|
|
112
|
-
|
|
120
|
+
), J(() => {
|
|
121
|
+
k();
|
|
113
122
|
});
|
|
114
|
-
const
|
|
123
|
+
const S = E(() => ({
|
|
115
124
|
"b-tabs__tab-list-wrapper--sticky": e.sticky,
|
|
116
|
-
"b-tabs__tab-list-wrapper--pinned":
|
|
117
|
-
})), ee =
|
|
125
|
+
"b-tabs__tab-list-wrapper--pinned": B.value
|
|
126
|
+
})), ee = E(
|
|
118
127
|
() => (
|
|
119
128
|
// This helps us detect when the tabs are pinned without calculations on the tabs positions because it makes the tabs intersect by 1 pixel with the element on top of it, which is getting aught by the intersection observer.
|
|
120
129
|
// Followed this example: https://css-tricks.com/how-to-detect-when-a-sticky-element-gets-pinned/
|
|
@@ -124,12 +133,12 @@ const ve = z({
|
|
|
124
133
|
)
|
|
125
134
|
);
|
|
126
135
|
return {
|
|
127
|
-
tc:
|
|
136
|
+
tc: i,
|
|
128
137
|
tabs: t,
|
|
129
138
|
tablist: y,
|
|
130
139
|
tablistwrapper: h,
|
|
131
140
|
activeTabId: l,
|
|
132
|
-
tablistWrapperConditionalClasses:
|
|
141
|
+
tablistWrapperConditionalClasses: S,
|
|
133
142
|
tablistWrapperStyles: ee,
|
|
134
143
|
onKeydownTabsNavigation: u,
|
|
135
144
|
handleTabChange: c,
|
|
@@ -140,42 +149,42 @@ const ve = z({
|
|
|
140
149
|
key: 2,
|
|
141
150
|
class: "b-tabs__tab-notification-dot",
|
|
142
151
|
"aria-hidden": "true"
|
|
143
|
-
},
|
|
152
|
+
}, Ce = {
|
|
144
153
|
class: "b-tabs__tab-underline",
|
|
145
154
|
"aria-hidden": "true"
|
|
146
155
|
};
|
|
147
|
-
function
|
|
156
|
+
function ge(e, n, i, t, y, h) {
|
|
148
157
|
const l = N("bento-typography"), d = N("cross-circle-fill-icon"), b = N("bento-tag"), I = N("fixed-scroller");
|
|
149
|
-
return f(),
|
|
158
|
+
return f(), w("div", Te, [
|
|
150
159
|
T("div", {
|
|
151
160
|
ref: "tablistwrapper",
|
|
152
161
|
class: K(["b-tabs__tab-list-wrapper", e.tablistWrapperConditionalClasses]),
|
|
153
|
-
style:
|
|
162
|
+
style: ne(e.tablistWrapperStyles)
|
|
154
163
|
}, [
|
|
155
164
|
x(I, {
|
|
156
165
|
condensed: "",
|
|
157
166
|
"extra-padding-top": 2
|
|
158
167
|
}, {
|
|
159
|
-
default:
|
|
168
|
+
default: g(() => [
|
|
160
169
|
T("div", {
|
|
161
170
|
ref: "tablist",
|
|
162
171
|
class: "b-tabs__tab-list",
|
|
163
172
|
role: "tablist",
|
|
164
|
-
onKeydown:
|
|
173
|
+
onKeydown: n[0] || (n[0] = (..._) => e.onKeydownTabsNavigation && e.onKeydownTabsNavigation(..._))
|
|
165
174
|
}, [
|
|
166
|
-
(f(!0),
|
|
175
|
+
(f(!0), w(oe, null, se(e.tabs, ({
|
|
167
176
|
counter: _,
|
|
168
177
|
disabled: u,
|
|
169
178
|
errorCounter: c,
|
|
170
179
|
hidden: v,
|
|
171
180
|
id: a,
|
|
172
|
-
title:
|
|
173
|
-
withNotificationIndicator:
|
|
174
|
-
setElementRef:
|
|
175
|
-
}) => F((f(),
|
|
181
|
+
title: B,
|
|
182
|
+
withNotificationIndicator: k,
|
|
183
|
+
setElementRef: O
|
|
184
|
+
}) => F((f(), w("button", {
|
|
176
185
|
id: a,
|
|
177
186
|
ref_for: !0,
|
|
178
|
-
ref:
|
|
187
|
+
ref: O,
|
|
179
188
|
key: a,
|
|
180
189
|
role: "tab",
|
|
181
190
|
type: "button",
|
|
@@ -188,8 +197,8 @@ function Ee(e, s, r, t, y, h) {
|
|
|
188
197
|
"aria-selected": e.activeTabId === a ? "true" : "false",
|
|
189
198
|
tabindex: e.activeTabId === a && !u.value ? null : -1,
|
|
190
199
|
disabled: e.isDisabled(u),
|
|
191
|
-
onClick: (
|
|
192
|
-
onKeydown:
|
|
200
|
+
onClick: (S) => e.handleTabChange(a),
|
|
201
|
+
onKeydown: ie((S) => e.handleTabChange(a), ["enter", "space"])
|
|
193
202
|
}, [
|
|
194
203
|
T("span", ye, [
|
|
195
204
|
x(l, {
|
|
@@ -198,12 +207,12 @@ function Ee(e, s, r, t, y, h) {
|
|
|
198
207
|
variant: "body",
|
|
199
208
|
stronger: ""
|
|
200
209
|
}, {
|
|
201
|
-
default:
|
|
202
|
-
|
|
210
|
+
default: g(() => [
|
|
211
|
+
W(A(B), 1)
|
|
203
212
|
]),
|
|
204
213
|
_: 2
|
|
205
214
|
}, 1024),
|
|
206
|
-
_ != null ? (f(),
|
|
215
|
+
_ != null ? (f(), Y(l, {
|
|
207
216
|
key: 0,
|
|
208
217
|
class: K(["b-tabs__tab-counter", {
|
|
209
218
|
"b-tabs__tab-counter--active": e.activeTabId === a
|
|
@@ -212,28 +221,28 @@ function Ee(e, s, r, t, y, h) {
|
|
|
212
221
|
variant: "body",
|
|
213
222
|
stronger: ""
|
|
214
223
|
}, {
|
|
215
|
-
default:
|
|
216
|
-
|
|
224
|
+
default: g(() => [
|
|
225
|
+
W(A(_), 1)
|
|
217
226
|
]),
|
|
218
227
|
_: 2
|
|
219
|
-
}, 1032, ["class"])) :
|
|
220
|
-
c != null ? (f(),
|
|
228
|
+
}, 1032, ["class"])) : R("", !0),
|
|
229
|
+
c != null ? (f(), Y(b, {
|
|
221
230
|
key: 1,
|
|
222
231
|
class: "b-tabs__tab-error-counter",
|
|
223
232
|
variant: "red"
|
|
224
233
|
}, {
|
|
225
|
-
icon:
|
|
234
|
+
icon: g(() => [
|
|
226
235
|
x(d, { "aria-hidden": "true" })
|
|
227
236
|
]),
|
|
228
|
-
default:
|
|
237
|
+
default: g(() => [
|
|
229
238
|
T("span", null, A(c), 1),
|
|
230
239
|
T("span", he, A(e.tc("errorCount", c)), 1)
|
|
231
240
|
]),
|
|
232
241
|
_: 2
|
|
233
|
-
}, 1024)) :
|
|
234
|
-
|
|
242
|
+
}, 1024)) : R("", !0),
|
|
243
|
+
k ? (f(), w("span", Ie)) : R("", !0)
|
|
235
244
|
]),
|
|
236
|
-
F(T("span",
|
|
245
|
+
F(T("span", Ce, null, 512), [
|
|
237
246
|
[L, e.activeTabId === a]
|
|
238
247
|
])
|
|
239
248
|
], 42, me)), [
|
|
@@ -244,13 +253,13 @@ function Ee(e, s, r, t, y, h) {
|
|
|
244
253
|
_: 1
|
|
245
254
|
})
|
|
246
255
|
], 6),
|
|
247
|
-
|
|
256
|
+
U(e.$slots, "default", {}, void 0, !0)
|
|
248
257
|
]);
|
|
249
258
|
}
|
|
250
|
-
const De = /* @__PURE__ */
|
|
259
|
+
const De = /* @__PURE__ */ H(ve, [["render", ge], ["__scopeId", "data-v-bbb2d8f5"]]), Ee = ["id", "aria-labelledby"], we = {
|
|
251
260
|
name: "bento-tab"
|
|
252
|
-
},
|
|
253
|
-
...
|
|
261
|
+
}, Be = /* @__PURE__ */ G({
|
|
262
|
+
...we,
|
|
254
263
|
props: {
|
|
255
264
|
counter: { default: null },
|
|
256
265
|
disabled: { type: Boolean, default: !1 },
|
|
@@ -261,33 +270,33 @@ const De = /* @__PURE__ */ M(ve, [["render", Ee], ["__scopeId", "data-v-bbb2d8f5
|
|
|
261
270
|
setElementRef: { type: Function, default: void 0 }
|
|
262
271
|
},
|
|
263
272
|
setup(e) {
|
|
264
|
-
const
|
|
273
|
+
const n = e, { counter: i, disabled: t, errorCounter: y, hidden: h, withNotificationIndicator: l } = le(n), d = m();
|
|
265
274
|
D(pe, (a) => {
|
|
266
275
|
d.value = a;
|
|
267
276
|
});
|
|
268
|
-
const I =
|
|
269
|
-
counter:
|
|
277
|
+
const I = E(() => d.value ?? n.title), _ = j(q), u = j(M), { id: c, unregisterTab: v } = _({
|
|
278
|
+
counter: i,
|
|
270
279
|
disabled: t,
|
|
271
280
|
errorCounter: y,
|
|
272
281
|
hidden: h,
|
|
273
282
|
title: I,
|
|
274
283
|
withNotificationIndicator: l,
|
|
275
|
-
setElementRef:
|
|
284
|
+
setElementRef: n.setElementRef
|
|
276
285
|
});
|
|
277
|
-
return
|
|
286
|
+
return J(() => v()), (a, B) => F((f(), w("div", {
|
|
278
287
|
id: `${p(c)}-tabpanel`,
|
|
279
288
|
class: "b-tab",
|
|
280
289
|
role: "tabpanel",
|
|
281
290
|
"aria-labelledby": p(c)
|
|
282
291
|
}, [
|
|
283
|
-
p(u) === p(c) ?
|
|
284
|
-
], 8,
|
|
292
|
+
p(u) === p(c) ? U(a.$slots, "default", { key: 0 }, void 0, !0) : R("", !0)
|
|
293
|
+
], 8, Ee)), [
|
|
285
294
|
[L, p(u) === p(c)]
|
|
286
295
|
]);
|
|
287
296
|
}
|
|
288
|
-
}), Fe = /* @__PURE__ */
|
|
297
|
+
}), Fe = /* @__PURE__ */ H(Be, [["__scopeId", "data-v-cf7fa0f8"]]);
|
|
289
298
|
export {
|
|
290
299
|
Fe as B,
|
|
291
300
|
De as a
|
|
292
301
|
};
|
|
293
|
-
//# sourceMappingURL=tab.
|
|
302
|
+
//# sourceMappingURL=tab.ByjWuWQz.js.map
|