@adyen/bento-vue3 1.67.0 → 1.68.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 +1956 -2181
- package/dist/action-bar.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-actions.css +1 -1
- package/dist/assets/card.css +1 -1
- package/dist/assets/checkbox.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-meta.css +1 -0
- package/dist/assets/header-with-views.css +1 -1
- package/dist/assets/header.css +1 -1
- package/dist/assets/input-field-phone-number.css +1 -1
- package/dist/assets/input-field.css +1 -1
- package/dist/assets/inspector.css +1 -1
- package/dist/assets/menu.css +1 -1
- package/dist/assets/modal-fullscreen.css +1 -1
- package/dist/assets/popover.css +1 -1
- package/dist/assets/sidepanel.css +1 -1
- package/dist/assets/summary-grid.css +1 -1
- package/dist/assets/textarea.css +1 -1
- package/dist/assets/use-cached-selected-values.css +1 -1
- package/dist/button.js +1 -1
- package/dist/card.js +1 -1
- package/dist/checkbox.js +2 -2
- package/dist/chunks/{action-bar.ComuZPet.js → action-bar.C93kgr7l.js} +4 -4
- package/dist/chunks/{action-bar.ComuZPet.js.map → action-bar.C93kgr7l.js.map} +1 -1
- package/dist/chunks/{base-modal.DzJrvis_.js → base-modal.C3_r3rmc.js} +120 -183
- package/dist/chunks/base-modal.C3_r3rmc.js.map +1 -0
- package/dist/chunks/{button-actions-with-menu.B0nWCTwZ.js → button-actions-with-menu.DUccmaB2.js} +3 -3
- package/dist/chunks/{button-actions-with-menu.B0nWCTwZ.js.map → button-actions-with-menu.DUccmaB2.js.map} +1 -1
- package/dist/chunks/{button-actions.BwpznQ6c.js → button-actions.CZdO9YOk.js} +7 -7
- package/dist/chunks/button-actions.CZdO9YOk.js.map +1 -0
- package/dist/chunks/{card.JBOvn2BO.js → card.CS34Mi_G.js} +2 -2
- package/dist/chunks/{card.JBOvn2BO.js.map → card.CS34Mi_G.js.map} +1 -1
- package/dist/chunks/{checkbox-group.Dc5Olq0c.js → checkbox-group.JRo6xNpe.js} +2 -2
- package/dist/chunks/{checkbox-group.Dc5Olq0c.js.map → checkbox-group.JRo6xNpe.js.map} +1 -1
- package/dist/chunks/{checkbox.fkPJvdUo.js → checkbox.DGrG3GN1.js} +70 -67
- package/dist/chunks/checkbox.DGrG3GN1.js.map +1 -0
- package/dist/chunks/{code-snippet.vrlSqi9k.js → code-snippet.aucmPbLw.js} +3 -3
- package/dist/chunks/{code-snippet.vrlSqi9k.js.map → code-snippet.aucmPbLw.js.map} +1 -1
- package/dist/chunks/{country.BhAcCmRx.js → country.Q95voxeL.js} +2 -2
- package/dist/chunks/{country.BhAcCmRx.js.map → country.Q95voxeL.js.map} +1 -1
- package/dist/chunks/{dashboard-section.Bg0dfNs-.js → dashboard-section.CUcq2ahu.js} +2 -2
- package/dist/chunks/{dashboard-section.Bg0dfNs-.js.map → dashboard-section.CUcq2ahu.js.map} +1 -1
- package/dist/chunks/{dashed-underline.DgE-UB-x.js → dashed-underline.DkzQkpaf.js} +2 -2
- package/dist/chunks/{dashed-underline.DgE-UB-x.js.map → dashed-underline.DkzQkpaf.js.map} +1 -1
- package/dist/chunks/{data-grid-template.Df7j2oxe.js → data-grid-template.CDsV2GFG.js} +2 -2
- package/dist/chunks/{data-grid-template.Df7j2oxe.js.map → data-grid-template.CDsV2GFG.js.map} +1 -1
- package/dist/chunks/data-grid.BJHcfrTG.js +3861 -0
- package/dist/chunks/data-grid.BJHcfrTG.js.map +1 -0
- package/dist/chunks/{date-picker.CZ6zU-NJ.js → date-picker.DgpMAGYp.js} +15 -15
- package/dist/chunks/{date-picker.CZ6zU-NJ.js.map → date-picker.DgpMAGYp.js.map} +1 -1
- package/dist/chunks/{date-range-picker.Dw4R9bIs.js → date-range-picker.Bxa_f6Q0.js} +24 -24
- package/dist/chunks/{date-range-picker.Dw4R9bIs.js.map → date-range-picker.Bxa_f6Q0.js.map} +1 -1
- package/dist/chunks/dropdown-default-textbox.Ce5D3ipi.js.map +1 -1
- package/dist/chunks/dropdown-tag.AV8Pi1SS.js +230 -0
- package/dist/chunks/dropdown-tag.AV8Pi1SS.js.map +1 -0
- package/dist/chunks/dropdown.CJBk1euy.js +814 -0
- package/dist/chunks/dropdown.CJBk1euy.js.map +1 -0
- package/dist/chunks/es6.n1ewaW31.js.map +1 -1
- package/dist/chunks/{filter-bar.XonJn7ao.js → filter-bar.6D-9UEng.js} +848 -833
- package/dist/chunks/filter-bar.6D-9UEng.js.map +1 -0
- package/dist/chunks/{footer-actions.CdJLLWNR.js → footer-actions.Bje-DDqw.js} +2 -2
- package/dist/chunks/{footer-actions.CdJLLWNR.js.map → footer-actions.Bje-DDqw.js.map} +1 -1
- package/dist/chunks/header-meta.Yt43-cUI.js +234 -0
- package/dist/chunks/header-meta.Yt43-cUI.js.map +1 -0
- package/dist/chunks/{header-with-views.CHbH1_1V.js → header-with-views.DbBUHvvE.js} +697 -678
- package/dist/chunks/header-with-views.DbBUHvvE.js.map +1 -0
- package/dist/chunks/header.wiq0wlgm.js +141 -0
- package/dist/chunks/header.wiq0wlgm.js.map +1 -0
- package/dist/chunks/{input-field-password.DWZAf1Oh.js → input-field-password.Cr3A_4n0.js} +4 -4
- package/dist/chunks/{input-field-password.DWZAf1Oh.js.map → input-field-password.Cr3A_4n0.js.map} +1 -1
- package/dist/chunks/{input-field-phone-number.CbpRItYf.js → input-field-phone-number.DZp5IzU3.js} +548 -532
- package/dist/chunks/{input-field-phone-number.CbpRItYf.js.map → input-field-phone-number.DZp5IzU3.js.map} +1 -1
- package/dist/chunks/{input-field.DExw_Cow.js → input-field.CmV2d_Zc.js} +30 -29
- package/dist/chunks/input-field.CmV2d_Zc.js.map +1 -0
- package/dist/chunks/{menu.CeLJ1gIz.js → menu.C-3obPGl.js} +182 -180
- package/dist/chunks/{menu.CeLJ1gIz.js.map → menu.C-3obPGl.js.map} +1 -1
- package/dist/chunks/{modal-fullscreen.CZnLS-fQ.js → modal-fullscreen.DBTnoSX9.js} +90 -77
- package/dist/chunks/modal-fullscreen.DBTnoSX9.js.map +1 -0
- package/dist/chunks/{modal.vue_vue_type_script_setup_true_lang.CP7dV1Yy.js → modal.vue_vue_type_script_setup_true_lang.Cd-mQUJ8.js} +10 -10
- package/dist/chunks/{modal.vue_vue_type_script_setup_true_lang.CP7dV1Yy.js.map → modal.vue_vue_type_script_setup_true_lang.Cd-mQUJ8.js.map} +1 -1
- package/dist/chunks/{pagination.DL9LmFMJ.js → pagination.DLYrWpKr.js} +2 -2
- package/dist/chunks/{pagination.DL9LmFMJ.js.map → pagination.DLYrWpKr.js.map} +1 -1
- package/dist/chunks/popover.DYgCCUCJ.js +200 -0
- package/dist/chunks/popover.DYgCCUCJ.js.map +1 -0
- package/dist/chunks/popover.types.V8old-GW.js +6 -0
- package/dist/chunks/popover.types.V8old-GW.js.map +1 -0
- package/dist/chunks/{rich-text-editor.Dl9PsYbk.js → rich-text-editor.Dx78coVL.js} +2 -2
- package/dist/chunks/{rich-text-editor.Dl9PsYbk.js.map → rich-text-editor.Dx78coVL.js.map} +1 -1
- package/dist/chunks/{search-bar.a-jzP1UA.js → search-bar.CpQ_MEVj.js} +3 -3
- package/dist/chunks/{search-bar.a-jzP1UA.js.map → search-bar.CpQ_MEVj.js.map} +1 -1
- package/dist/chunks/{secondary-nav.UrmIAVGD.js → secondary-nav.RTBLEukC.js} +2 -2
- package/dist/chunks/{secondary-nav.UrmIAVGD.js.map → secondary-nav.RTBLEukC.js.map} +1 -1
- package/dist/chunks/{sidepanel.BuNmgmpj.js → sidepanel.DPN__L3Q.js} +2 -2
- package/dist/chunks/{sidepanel.BuNmgmpj.js.map → sidepanel.DPN__L3Q.js.map} +1 -1
- package/dist/chunks/{summary-grid.types.CoSCUI1V.js → summary-grid.types.CjbbSZBJ.js} +4 -4
- package/dist/chunks/summary-grid.types.CjbbSZBJ.js.map +1 -0
- package/dist/chunks/{textarea.DXSe9MHH.js → textarea.BBhN67-I.js} +41 -40
- package/dist/chunks/textarea.BBhN67-I.js.map +1 -0
- package/dist/chunks/{timeline-item.BRHwCA1F.js → timeline-item.CuCII37W.js} +3 -3
- package/dist/chunks/{timeline-item.BRHwCA1F.js.map → timeline-item.CuCII37W.js.map} +1 -1
- package/dist/chunks/{tutorial.vue_vue_type_script_setup_true_lang.CAf69UYO.js → tutorial.vue_vue_type_script_setup_true_lang.nYHtTHqy.js} +28 -27
- package/dist/chunks/{tutorial.vue_vue_type_script_setup_true_lang.CAf69UYO.js.map → tutorial.vue_vue_type_script_setup_true_lang.nYHtTHqy.js.map} +1 -1
- package/dist/chunks/{use-cached-selected-values.D7dOPJSO.js → use-cached-selected-values.Dyoz6cUK.js} +579 -563
- package/dist/chunks/use-cached-selected-values.Dyoz6cUK.js.map +1 -0
- package/dist/chunks/{use-country-items.4kZgVg_l.js → use-country-items.Duh4bMqW.js} +2 -2
- package/dist/chunks/{use-country-items.4kZgVg_l.js.map → use-country-items.Duh4bMqW.js.map} +1 -1
- package/dist/chunks/{use-country-phon-code.DVgE19zT.js → use-country-phon-code.BOaJ9PDl.js} +507 -498
- package/dist/chunks/{use-country-phon-code.DVgE19zT.js.map → use-country-phon-code.BOaJ9PDl.js.map} +1 -1
- package/dist/code-snippet.js +1 -1
- package/dist/country.js +2 -2
- 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 +1 -1
- package/dist/date-range-picker.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/header.js +1 -1
- package/dist/index.js +156 -155
- package/dist/index.js.map +1 -1
- package/dist/input-field-password.js +1 -1
- package/dist/input-field-phone-number.js +1 -1
- package/dist/input-field.js +1 -1
- package/dist/internal.js +15 -14
- package/dist/menu.js +1 -1
- package/dist/modal-fullscreen.js +1 -1
- package/dist/modal.js +11 -11
- package/dist/pagination.js +1 -1
- package/dist/popover.js +3 -2
- package/dist/popover.js.map +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/styles/bento-dark.css +10 -2
- package/dist/styles/bento-light.css +10 -2
- package/dist/styles/bento.css +10 -2
- package/dist/styles/legacy.css +10 -2
- package/dist/styles/styleguide.css +10 -2
- package/dist/summary-grid.js +1 -1
- package/dist/textarea.js +1 -1
- package/dist/timeline.js +1 -1
- package/dist/tutorial.js +1 -1
- package/dist/web-types.json +1 -1
- package/package.json +24 -7
- package/dist/assets/info-icon-with-popover.css +0 -1
- package/dist/chunks/base-modal.DzJrvis_.js.map +0 -1
- package/dist/chunks/button-actions.BwpznQ6c.js.map +0 -1
- package/dist/chunks/checkbox.fkPJvdUo.js.map +0 -1
- package/dist/chunks/data-grid.rDZadZwc.js +0 -3781
- package/dist/chunks/data-grid.rDZadZwc.js.map +0 -1
- package/dist/chunks/dropdown-tag.BlHovDol.js +0 -202
- package/dist/chunks/dropdown-tag.BlHovDol.js.map +0 -1
- package/dist/chunks/dropdown.B5ZaFDn_.js +0 -957
- package/dist/chunks/dropdown.B5ZaFDn_.js.map +0 -1
- package/dist/chunks/filter-bar.XonJn7ao.js.map +0 -1
- package/dist/chunks/header-with-views.CHbH1_1V.js.map +0 -1
- package/dist/chunks/header.CJJWPB5Z.js +0 -254
- package/dist/chunks/header.CJJWPB5Z.js.map +0 -1
- package/dist/chunks/info-icon-with-popover.DVH46dPy.js +0 -97
- package/dist/chunks/info-icon-with-popover.DVH46dPy.js.map +0 -1
- package/dist/chunks/input-field.DExw_Cow.js.map +0 -1
- package/dist/chunks/modal-fullscreen.CZnLS-fQ.js.map +0 -1
- package/dist/chunks/popover.VI3TrUkL.js +0 -350
- package/dist/chunks/popover.VI3TrUkL.js.map +0 -1
- package/dist/chunks/summary-grid.types.CoSCUI1V.js.map +0 -1
- package/dist/chunks/textarea.DXSe9MHH.js.map +0 -1
- package/dist/chunks/use-cached-selected-values.D7dOPJSO.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-actions-with-menu.
|
|
1
|
+
{"version":3,"file":"button-actions-with-menu.DUccmaB2.js","sources":["../../../vue2/src/components/internal/button-actions-with-menu/composables/use-responsive-actions.ts","../../../vue2/src/components/internal/button-actions-with-menu/button-actions-with-menu.vue"],"sourcesContent":["import { useWindowSize } from '@vueuse/core';\nimport { nextTick, Ref, ref, watch } from 'vue';\n\ninterface UseResponsiveActionsProps {\n breakpoint?: number;\n container: Ref<HTMLElement>;\n defaultActionsCount: number;\n offset?: Ref<HTMLElement>;\n}\n\nexport const useResponsiveActions = (props: UseResponsiveActionsProps) => {\n const { breakpoint, container, defaultActionsCount, offset } = props;\n\n const { width: windowWidth } = useWindowSize();\n\n const displayedActionsCount = ref<number>(defaultActionsCount);\n\n const AVERAGE_BUTTON_WIDTH = 150; // button size + gap\n\n const showActions = async () => {\n await nextTick();\n\n const availableSpace = container.value.clientWidth;\n const totalActionWidth =\n AVERAGE_BUTTON_WIDTH * displayedActionsCount.value +\n (offset?.value?.offsetWidth ?? 0) +\n AVERAGE_BUTTON_WIDTH;\n\n // Only add actions if there's enough space and we haven't reached max\n if (availableSpace >= totalActionWidth && displayedActionsCount.value < defaultActionsCount) {\n displayedActionsCount.value += 1;\n\n showActions(); // keep trying to show more\n }\n };\n\n const hideActions = async () => {\n await nextTick();\n\n const availableSpace = container.value.clientWidth;\n const totalActionWidth = AVERAGE_BUTTON_WIDTH * displayedActionsCount.value + (offset?.value?.offsetWidth ?? 0);\n\n // Hide actions if they overflow the container\n if (availableSpace < totalActionWidth && displayedActionsCount.value > 0) {\n displayedActionsCount.value -= 1;\n\n hideActions(); // keep hiding until it fits\n }\n };\n\n watch([windowWidth, container], async ([newWidth, containerEl], [oldWidth]) => {\n if (!containerEl || !defaultActionsCount || newWidth > breakpoint) {\n return;\n }\n\n await nextTick();\n\n const isIncreasing = newWidth > oldWidth;\n\n if (isIncreasing) {\n showActions();\n } else {\n hideActions();\n }\n });\n\n return {\n displayedActionsCount,\n };\n};\n","<template>\n <div class=\"b-button-actions-with-menu\">\n <div\n ref=\"buttonActionsWithMenu\"\n role=\"group\"\n class=\"b-button-actions-with-menu__container-wrapper\"\n :class=\"conditionalClasses\"\n >\n <bento-button-actions :actions=\"computedActions\" :inverse=\"inverse\" :layout=\"actionsLayout\" />\n <bento-menu\n v-if=\"computedMenuActions.length\"\n ref=\"menu\"\n :data=\"computedMenuActions\"\n :menu-position=\"menuPosition\"\n />\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoButtonActions } from '@/components/button';\n import { BentoMenuItem } from '@/components/menu/components/menu-item/menu-item.types';\n import { MENU_INVERSE_INJECTION_KEY } from '@/components/menu/menu.keys';\n import BentoMenu from '@/components/menu/menu.vue';\n import { computed, provide, ref, toRef } from 'vue';\n import { BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY } from './button-actions-with-menu.keys';\n import { ButtonActionsWithMenuProps } from './button-actions-with-menu.types';\n import { useResponsiveActions } from './composables/use-responsive-actions';\n\n const props = withDefaults(defineProps<ButtonActionsWithMenuProps>(), {\n actionsLayout: 'buttons-end',\n disableResponsiveBehavior: false,\n displayedActions: undefined,\n inverse: false,\n hideDisplayedActionsBreakpoint: 0,\n menuPosition: 'bottom-start',\n });\n\n const inverseRef = toRef(props, 'inverse');\n const buttonActionsWithMenu = ref<HTMLDivElement>(null);\n const menu = ref(null);\n const stackButtons = ref(false);\n\n const computedActions = computed(() => {\n const displayedActionsLimit = props.hideDisplayedActionsBreakpoint\n ? displayedActionsCount.value\n : props.displayedActions;\n\n return props.actions.slice(0, displayedActionsLimit);\n });\n const computedMenuRef = computed(() => menu?.value?.$el);\n\n const { displayedActionsCount } = useResponsiveActions({\n breakpoint: props.hideDisplayedActionsBreakpoint,\n container: buttonActionsWithMenu,\n defaultActionsCount: props.displayedActions,\n offset: computedMenuRef,\n });\n\n provide(MENU_INVERSE_INJECTION_KEY, inverseRef);\n\n if (!props.disableResponsiveBehavior) {\n provide(BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY, { buttonActionsWithMenu, menu, stackButtons });\n }\n\n const conditionalClasses = computed(() => ({\n [`b-button-actions-with-menu__container-wrapper--buttons-end`]: props.actionsLayout === 'buttons-end',\n [`b-button-actions-with-menu__container-wrapper--buttons-start`]: props.actionsLayout === 'buttons-start',\n [`b-button-actions-with-menu__container-wrapper--stacked-buttons`]: stackButtons.value,\n }));\n\n const computedMenuActions = computed(() =>\n displayedActionsCount.value !== undefined && displayedActionsCount.value < props.actions.length\n ? (props.actions.slice(displayedActionsCount.value, props.actions.length).map(el => ({\n text: el.title,\n handler: el.event,\n icon: el.icon,\n critical: el.critical,\n disabled: el.disabled,\n })) as BentoMenuItem[])\n : []\n );\n</script>\n\n<script lang=\"ts\">\n /**\n * An internal button actions component with the option to display some of the actions in a menu.\n *\n * @example\n * <button-actions-with-menu\n * :actions=\"[\n * {\n * title: 'Primary',\n * event: () => { ... },\n * icon: FourPeopleIcon,\n * link: {\n * variant: 'default',\n * external: true,\n * to: 'https://www.adyen.com/'\n * },\n * },\n * {\n * title: 'Secondary',\n * event: () => { ... }\n * disabled: true,\n * variant: BentoButtonVariant.PRIMARY,\n * critical: true\n * }]\"\n * :displayedActions=\"2\"\n * />\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./button-actions-with-menu.scss\" />\n"],"names":["useResponsiveActions","props","breakpoint","container","defaultActionsCount","offset","windowWidth","useWindowSize","displayedActionsCount","ref","AVERAGE_BUTTON_WIDTH","showActions","nextTick","availableSpace","totalActionWidth","_a","hideActions","watch","newWidth","containerEl","oldWidth","__default__","__props","inverseRef","toRef","buttonActionsWithMenu","menu","stackButtons","computedActions","computed","displayedActionsLimit","computedMenuRef","provide","MENU_INVERSE_INJECTION_KEY","BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY","conditionalClasses","computedMenuActions","el"],"mappings":";;;;;;AAUa,MAAAA,IAAA,CAAAC,MAAA;AACT,QAAA,EAAA,YAAAC,GAAA,WAAAC,GAAA,qBAAAC,GAAA,QAAAC,EAAA,IAAAJ,GAEA,EAAA,OAAAK,EAAA,IAAAC,EAAA,GAEAC,IAAAC,EAAAL,CAAA,GAEAM,IAAA,KAEAC,IAAA,YAAA;;AACI,UAAAC,EAAA;AAEA,UAAAC,IAAAV,EAAA,MAAA,aACAW,IAAAJ,IAAAF,EAAA,WAAAO,IAAAV,KAAA,gBAAAA,EAAA,UAAA,gBAAAU,EAAA,gBAAA,KAAAL;AAMA,IAAAG,KAAAC,KAAAN,EAAA,QAAAJ,MACII,EAAA,SAAA,GAEAG,EAAA;AAAA,EACJ,GAGJK,IAAA,YAAA;;AACI,UAAAJ,EAAA;AAEA,UAAAC,IAAAV,EAAA,MAAA,aACAW,IAAAJ,IAAAF,EAAA,WAAAO,IAAAV,KAAA,gBAAAA,EAAA,UAAA,gBAAAU,EAAA,gBAAA;AAGA,IAAAF,IAAAC,KAAAN,EAAA,QAAA,MACIA,EAAA,SAAA,GAEAQ,EAAA;AAAA,EACJ;AAGJ,SAAAC,EAAA,CAAAX,GAAAH,CAAA,GAAA,OAAA,CAAAe,GAAAC,CAAA,GAAA,CAAAC,CAAA,MAAA;AACI,QAAA,CAAAD,KAAA,CAAAf,KAAAc,IAAAhB;AACI;AAGJ,UAAAU,EAAA,GAEAM,IAAAE,IAGIT,EAAA,IAEAK,EAAA;AAAA,EACJ,CAAA,GAGJ;AAAA,IAAO,uBAAAR;AAAA,EACH;AAER,gDC0CIa,IAAA,CAAA;;;;;;;;;;;;;AAlFA,UAAApB,IAAAqB,GASAC,IAAAC,E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eClass as R, createSlots as U, withCtx as y, renderSlot as N, unref as m, createElementVNode as W, createCommentVNode as j, ref as C, inject as x, watch as H, nextTick as z, onMounted as J, onUnmounted as K, createElementBlock as S, Fragment as Y, renderList as Q, mergeProps as
|
|
1
|
+
import { defineComponent as O, useSlots as P, computed as g, createBlock as v, openBlock as i, withModifiers as V, normalizeClass as R, createSlots as U, withCtx as y, renderSlot as N, unref as m, createElementVNode as W, createCommentVNode as j, ref as C, inject as x, watch as H, nextTick as z, onMounted as J, onUnmounted as K, createElementBlock as S, Fragment as Y, renderList as Q, mergeProps as b, toHandlers as A, createTextVNode as h, toDisplayString as B, resolveDynamicComponent as E } from "vue";
|
|
2
2
|
import { B as p } from "./button.AB0SOQMn.js";
|
|
3
3
|
import { o as q } from "./resize.Bqks3WUm.js";
|
|
4
4
|
import { f as X } from "./es6.n1ewaW31.js";
|
|
@@ -199,7 +199,7 @@ const w = {
|
|
|
199
199
|
ref: c,
|
|
200
200
|
class: "b-button-actions__button-wrapper"
|
|
201
201
|
}, [
|
|
202
|
-
t.state ? (i(), v(m(ce),
|
|
202
|
+
t.state ? (i(), v(m(ce), b({
|
|
203
203
|
key: 0,
|
|
204
204
|
condensed: t.condensed,
|
|
205
205
|
critical: t.critical,
|
|
@@ -207,12 +207,12 @@ const w = {
|
|
|
207
207
|
inverse: a.inverse,
|
|
208
208
|
state: t.state,
|
|
209
209
|
variant: t.variant || d(k)
|
|
210
|
-
},
|
|
210
|
+
}, A(f(t))), {
|
|
211
211
|
default: y(() => [
|
|
212
212
|
h(B(t.title), 1)
|
|
213
213
|
]),
|
|
214
214
|
_: 2
|
|
215
|
-
}, 1040, ["condensed", "critical", "disabled", "inverse", "state", "variant"])) : (i(), v(p,
|
|
215
|
+
}, 1040, ["condensed", "critical", "disabled", "inverse", "state", "variant"])) : (i(), v(p, b({
|
|
216
216
|
key: 1,
|
|
217
217
|
condensed: t.condensed,
|
|
218
218
|
critical: t.critical,
|
|
@@ -220,7 +220,7 @@ const w = {
|
|
|
220
220
|
inverse: a.inverse,
|
|
221
221
|
link: t.link,
|
|
222
222
|
variant: t.variant || d(k)
|
|
223
|
-
},
|
|
223
|
+
}, A(f(t))), U({ _: 2 }, [
|
|
224
224
|
t.icon || t.iconLeft ? {
|
|
225
225
|
name: "iconLeft",
|
|
226
226
|
fn: y(() => [
|
|
@@ -251,7 +251,7 @@ const w = {
|
|
|
251
251
|
], 2)
|
|
252
252
|
], 512));
|
|
253
253
|
}
|
|
254
|
-
}), Ne = /* @__PURE__ */ $(fe, [["__scopeId", "data-v-
|
|
254
|
+
}), Ne = /* @__PURE__ */ $(fe, [["__scopeId", "data-v-b2a2cd1b"]]);
|
|
255
255
|
export {
|
|
256
256
|
Ne as B,
|
|
257
257
|
D as a,
|
|
@@ -261,4 +261,4 @@ export {
|
|
|
261
261
|
s as e,
|
|
262
262
|
re as f
|
|
263
263
|
};
|
|
264
|
-
//# sourceMappingURL=button-actions.
|
|
264
|
+
//# sourceMappingURL=button-actions.CZdO9YOk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-actions.CZdO9YOk.js","sources":["../../../vue2/src/components/button/components/button-actions/button-actions.types.ts","../../../core/src/components/loading-button/loading-button.types.ts","../../../vue2/src/components/button/components/loading-button/loading-button.vue","../../../vue2/src/components/internal/button-actions-with-menu/button-actions-with-menu.keys.ts","../../../vue2/src/components/button/components/button-actions/composables/use-stack-buttons/use-stack-buttons.ts","../../../vue2/src/components/button/components/button-actions/button-actions.vue"],"sourcesContent":["import type { BentoButtonProps } from '@adyen/bento-core/src/components/button/button.types';\nimport type { BentoLoadingButtonState } from '@adyen/bento-core/src/components/loading-button/loading-button.types';\nimport type { VueNodeElement } from '@/types';\n\nexport interface BentoButtonActionObject extends BentoButtonProps {\n title: string;\n event?: (event: Event) => void;\n icon?: VueNodeElement;\n iconLeft?: VueNodeElement;\n iconRight?: VueNodeElement;\n state?: BentoLoadingButtonState | `${BentoLoadingButtonState}`;\n iconOnly?: boolean;\n}\n\nexport type BentoButtonActionsList = Array<BentoButtonActionObject>;\n\nexport enum BentoButtonActionsLayoutBasic {\n BUTTONS_END = 'buttons-end',\n FILL_CONTAINER = 'fill-container',\n SPACE_BETWEEN = 'space-between',\n VERTICAL_STACK = 'vertical-stack',\n}\nexport enum BentoButtonActionsLayoutExtended {\n BUTTONS_START = 'buttons-start',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport const BentoButtonActionsLayout = { ...BentoButtonActionsLayoutBasic, ...BentoButtonActionsLayoutExtended };\nexport type BentoButtonActionsLayout = BentoButtonActionsLayoutBasic | BentoButtonActionsLayoutExtended;\n\nexport interface BentoButtonActionsProps {\n /**\n * List of actions that will be used to render the buttons.\n * First element in the list will be rendered as \"primary\".\n * All elements after the first will be rendered as \"secondary\".\n *\n * Each object in the list should have a `title`, an `event` and\n * (optional) a Vue `icon` from the library `@adyen/ui-assets-icons-16`.\n *\n * `title`: Button's text.\n *\n * `event`: Event triggered when clicking the Button.\n *\n * `icon` (optional): Vue Icon from the library `@adyen/ui-assets-icons-16`.\n *\n * @see BentoButton for a list of all the other props supported by each button action.\n *\n * ```\n * [{\n * title: 'Primary',\n * event: () => { ... },\n * icon: FourPeopleIcon,\n * link: {\n * variant: 'default',\n * external: true,\n * to: 'https://www.adyen.com/'\n * },\n * }, {\n * title: 'Secondary',\n * event: () => { ... }\n * disabled: true,\n * variant: 'secondary',\n * critical: true\n * }]\n * ```\n */\n actions: BentoButtonActionsList;\n\n /**\n * Sets the Button Actions to color scheme inverse\n */\n inverse?: boolean;\n\n /**\n * Defines the layout in which the button actions is presented.\n * It can be one of:\n *\n * @values BUTTONS_START\n * @values BUTTONS_END\n * @values FILL_CONTAINER\n * @values SPACE_BETWEEN\n * @values VERTICAL_STACK\n */\n layout?: BentoButtonActionsLayout | `${BentoButtonActionsLayout}`;\n}\n","export enum BentoLoadingButtonState {\n START = 'start',\n LOADING = 'loading',\n SUCCESS = 'success',\n FAIL = 'fail',\n}\n\nexport type BentoLoadingButtonIconState = Partial<{ [key in BentoLoadingButtonState]: string }>;\n","<template>\n <bento-button\n :critical=\"isCritical\"\n :variant=\"variant\"\n :condensed=\"condensed\"\n :disabled=\"disabled\"\n :inverse=\"inverse\"\n class=\"b-loading-button\"\n :class=\"conditionalClasses\"\n @click.capture.stop=\"onClick\"\n >\n <slot></slot>\n\n <template v-if=\"state === 'start' && hasSlot('iconLeft')\" #iconLeft>\n <slot name=\"iconLeft\"></slot>\n </template>\n <template v-else-if=\"state !== 'start'\" #iconLeft>\n <span class=\"b-loading-button__icon\" data-testid=\"loading-button-rotating-icon\">\n <cross v-if=\"state === 'fail'\" :svg-title=\"t('failed')\" />\n <checkmark v-else-if=\"state === 'success'\" :svg-title=\"t('succeded')\" />\n <!-- TODO: Replace with new loading-indicator component -->\n <bento-loading-indicator v-else-if=\"state === 'loading'\" small :inverse=\"isInverseLoadingIndicator\" />\n </span>\n </template>\n </bento-button>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, PropType, useSlots } from 'vue';\n import { BentoLoadingButtonState } from '@/core/components/loading-button/loading-button.types';\n import { BentoLoadingIndicator } from '@/components/loading-indicator';\n import BentoButton from '@/components/button/button.vue';\n import Cross from '@adyen/ui-assets-icons-16/vue/cross-circle-fill';\n import Checkmark from '@adyen/ui-assets-icons-16/vue/checkmark-circle-fill';\n import { useHasSlot } from '@/composables/use-has-slot/use-has-slot';\n\n import { useI18n } from '@/utils/ts/i18n';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n /**\n * Reduces sizing of button\n */\n condensed: {\n type: BentoButton.props.condensed.type,\n default: false,\n },\n\n /**\n * Displays loading-button as critical\n */\n critical: {\n type: BentoButton.props.critical.type,\n default: false,\n },\n\n /**\n * Disables button functonality\n */\n disabled: {\n type: BentoButton.props.disabled.type,\n default: false,\n },\n\n /**\n * Sets color set to inverse\n */\n inverse: {\n type: Boolean,\n default: false,\n },\n\n /**\n * State of the button.\n * @values start, loading, success, fail\n */\n state: {\n type: String as PropType<BentoLoadingButtonState | `${BentoLoadingButtonState}`>,\n default: BentoLoadingButtonState.START,\n validator: (value: BentoLoadingButtonState) => Object.values(BentoLoadingButtonState).includes(value),\n },\n\n /**\n * Types of flavour of Button\n */\n variant: {\n type: BentoButton.props.variant.type,\n default: 'primary',\n validator: BentoButton.props.variant.validator,\n },\n });\n\n const emit = defineEmits<{\n /**\n * Click event handler\n */\n (e: 'click', event: MouseEvent): void;\n }>();\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const conditionalClasses = computed(() => ({\n [`b-loading-button--${props.variant}-${BentoLoadingButtonState.LOADING}`]:\n props.state === BentoLoadingButtonState.LOADING && !props.disabled,\n 'b-loading-button--loading': props.state === BentoLoadingButtonState.LOADING && !props.disabled,\n [`b-loading-button--${props.variant}-${BentoLoadingButtonState.SUCCESS}`]:\n props.state === BentoLoadingButtonState.SUCCESS,\n [`b-loading-button--inverse`]: props.inverse,\n }));\n\n const isInverseLoadingIndicator = computed(\n () => (props.variant === 'primary' && !props.inverse) || (props.variant !== 'primary' && props.inverse)\n );\n const isCritical = computed(\n () =>\n (props.critical && props.state === BentoLoadingButtonState.START) ||\n props.state === BentoLoadingButtonState.FAIL\n );\n\n const onClick = (e: MouseEvent) => {\n // Prevent Vue3 from triggering event twice\n e.stopPropagation();\n\n if (props.state !== BentoLoadingButtonState.LOADING) {\n emit('click', e);\n }\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * Loading Button component is used for cases where pressing a button starts an event that requires a loading state, e.g. when you have any sort of asynchronous action and are waiting for a response\n *\n * @example\n * import { BentoLoadingButton } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoLoadingButton },\n * template: `\n * <bento-loading-button state=\"loading\" variant=\"secondary\">\n * Loading\n * </bento-loading button>\n * `\n * }\n */\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"@/core/components/loading-button/loading-button.scss\" />\n","export const BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY = Symbol(\n 'button actions with menu container injection key'\n);\n","import { computed, inject, nextTick, onMounted, onUnmounted, ref, Ref, watch } from 'vue';\nimport { observeSizeOfElement } from '@/utils/ts/resize';\nimport { BButtonActionsButtonsEndColumnGap } from '@adyen/bento-design-tokens/dist/js/bento/es6';\nimport { BentoButtonActionsList } from '../../button-actions.types';\nimport { BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY } from '@/internal/button-actions-with-menu/button-actions-with-menu.keys';\n\nconst CONTAINER_QUERY = 242;\nconst BUTTONS_GAP = parseInt(BButtonActionsButtonsEndColumnGap, 10);\n\n/**\n * Calculates the width of the container and the buttons and decides if the buttons should be stacked or not\n *\n * @param buttonActions Reference to the container element\n * @param buttons Reference array of button elements\n * @param actions Button actions actions prop\n */\nexport const useStackButtons = (\n buttonActions: Ref<HTMLDivElement>,\n buttons: Ref<HTMLDivElement[]>,\n actions: BentoButtonActionsList\n) => {\n const originalButtonsWidth = ref(0);\n let containerObserver: ResizeObserver | null = null;\n\n const { buttonActionsWithMenu, menu, stackButtons } = inject(BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY, {\n buttonActionsWithMenu: ref(null),\n menu: ref(null),\n stackButtons: ref(false),\n });\n\n const container = computed(() => buttonActionsWithMenu.value ?? buttonActions.value);\n\n const computedButtons = computed(() => (menu.value ? [...buttons.value, menu.value.$el] : buttons.value));\n\n const areButtonsWiderThanContainer = (updateOriginalButtonsWidth?: boolean) => {\n const buttonsWidth = computedButtons.value?.reduce(\n (acc, button) => acc + button.clientWidth + BUTTONS_GAP,\n -BUTTONS_GAP - 1 // to remove the extra spacing, as if there's 3 buttons, only two will have a gap in between\n );\n\n const containersWidth = container.value.clientWidth;\n\n if (updateOriginalButtonsWidth) {\n originalButtonsWidth.value = containersWidth >= CONTAINER_QUERY && !stackButtons.value ? buttonsWidth : 0;\n }\n return originalButtonsWidth.value > containersWidth;\n };\n\n watch(\n () => actions,\n () => {\n nextTick(() => {\n stackButtons.value = areButtonsWiderThanContainer(true);\n });\n },\n { deep: true }\n );\n\n onMounted(() => {\n containerObserver = observeSizeOfElement(container.value, () => {\n stackButtons.value = areButtonsWiderThanContainer(originalButtonsWidth.value === 0);\n });\n });\n\n onUnmounted(() => {\n containerObserver?.disconnect();\n });\n\n return stackButtons;\n};\n","<template>\n <div ref=\"buttonActions\" class=\"b-button-actions\">\n <div class=\"b-button-actions__container-wrapper\" :class=\"conditionalClasses\" role=\"group\">\n <div\n v-for=\"(button, index) in reversedActionsList\"\n :key=\"index\"\n ref=\"buttons\"\n class=\"b-button-actions__button-wrapper\"\n >\n <bento-loading-button\n v-if=\"button.state\"\n :condensed=\"button.condensed\"\n :critical=\"button.critical\"\n :disabled=\"button.disabled\"\n :inverse=\"inverse\"\n :state=\"button.state\"\n :variant=\"button.variant || generateButtonVariantByIndex(index)\"\n v-on=\"generateButtonEvents(button)\"\n >\n {{ button.title }}\n </bento-loading-button>\n <bento-button\n v-else\n :condensed=\"button.condensed\"\n :critical=\"button.critical\"\n :disabled=\"button.disabled\"\n :inverse=\"inverse\"\n :link=\"button.link\"\n :variant=\"button.variant || generateButtonVariantByIndex(index)\"\n v-on=\"generateButtonEvents(button)\"\n >\n <template v-if=\"button.icon || button.iconLeft\" #iconLeft>\n <component :is=\"button.icon || button.iconLeft\" :svg-title=\"button.title\"></component>\n </template>\n <template v-if=\"!isIconOnly(button)\" #default>\n {{ button.title }}\n </template>\n <template v-if=\"button.iconRight\" #iconRight>\n <component :is=\"button.iconRight\" :svg-title=\"button.title\"></component>\n </template>\n </bento-button>\n </div>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, ref } from 'vue';\n import BentoButton from '../../button.vue';\n import { BentoButtonActionObject, BentoButtonActionsLayout } from './button-actions.types';\n import type { BentoButtonActionsProps } from './button-actions.types';\n import { BentoLoadingButton } from '../loading-button';\n import { useStackButtons } from './composables/use-stack-buttons/use-stack-buttons';\n\n const props = withDefaults(defineProps<BentoButtonActionsProps>(), {\n inverse: false,\n layout: BentoButtonActionsLayout.BUTTONS_END,\n });\n\n const buttonActions = ref<HTMLDivElement>(null);\n const buttons = ref<HTMLDivElement[]>(null);\n const stackButtons = useStackButtons(buttonActions, buttons, props.actions);\n\n const reversedActionsList = computed(() => props.actions.slice().reverse());\n const generateButtonVariantByIndex = actionIndex => {\n const lastActionIndex = props.actions.length - 1;\n return actionIndex === lastActionIndex ? 'primary' : 'secondary';\n };\n\n const conditionalClasses = computed(() => ({\n [`b-button-actions--${props.layout}`]: true,\n [`b-button-actions--stacked-buttons`]: stackButtons.value,\n }));\n\n const generateButtonEvents = (button: BentoButtonActionObject) =>\n button?.event !== undefined\n ? {\n click: button.event,\n }\n : {};\n\n const isIconOnly = (button: BentoButtonActionObject) =>\n button.iconOnly && (button.iconLeft || button.iconRight || button.icon);\n</script>\n\n<script lang=\"ts\">\n /**\n * ButtonActions component manages a set of actions a user can choose from by displaying a group of buttons.\n *\n * @example\n * import { BentoButtonActions } from '@adyen/bento-vue2';\n * import MachineLearningIcon from '@adyen/ui-assets-icons-16/vue/machine-learning';\n *\n * const clickedAction = () => { //your action here }\n *\n * <template>\n * <bento-button-actions\n * :actions=\"[{\n * title: 'Primary',\n * event: clickedAction,\n * icon: MachineLearningIcon,\n * }, {\n * title: 'Secondary',\n * event: clickedAction,\n * }, {\n * title: 'Tertiary',\n * event: clickedAction,\n * }]\"\n * />\n * </template>\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"@/core/components/button-actions/button-actions.scss\" />\n"],"names":["BentoButtonActionsLayoutBasic","BentoButtonActionsLayoutBasic2","BentoButtonActionsLayoutExtended","BentoButtonActionsLayoutExtended2","BentoButtonActionsLayout","BentoLoadingButtonState","BentoLoadingButtonState2","__default__$1","messages","props","__props","emit","__emit","slots","useSlots","hasSlot","useHasSlot","t","useI18n","conditionalClasses","computed","isInverseLoadingIndicator","isCritical","onClick","e","BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY","CONTAINER_QUERY","BUTTONS_GAP","BButtonActionsButtonsEndColumnGap","useStackButtons","buttonActions","buttons","actions","originalButtonsWidth","ref","containerObserver","buttonActionsWithMenu","menu","stackButtons","inject","container","computedButtons","areButtonsWiderThanContainer","updateOriginalButtonsWidth","buttonsWidth","_a","acc","button","containersWidth","watch","nextTick","onMounted","observeSizeOfElement","onUnmounted","__default__","reversedActionsList","generateButtonVariantByIndex","actionIndex","lastActionIndex","generateButtonEvents","isIconOnly"],"mappings":";;;;;;;;;;;AAgBY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,cAAA,eACAA,EAAA,iBAAA,kBACAA,EAAA,gBAAA,iBACAA,EAAA,iBAAA,kBAJQA,IAAAD,KAAA,CAAA,CAAA,GAMAE,IAAA,kBAAAC,OACRA,EAAA,gBAAA,iBADQA,IAAAD,KAAA,CAAA,CAAA;AAOL,MAAAE,KAAA,EAAA,GAAAJ,GAAA,GAAAE,EAAA;AC7BK,IAAAG,IAAA,kBAAAC,OACRA,EAAA,QAAA,SACAA,EAAA,UAAA,WACAA,EAAA,UAAA,WACAA,EAAA,OAAA,QAJQA,IAAAD,KAAA,CAAA,CAAA;;;;;;;;;;;;;;;GCsJRE,KAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA9GA,UAAAC,IAAAC,GAqDAC,IAAAC,GAOAC,IAAAC,EAAA,GACAC,IAAAC,GAAAH,CAAA,GACA,EAAA,GAAAI,EAAA,IAAAC,GAAA,EAAA,UAAAV,EAAA,CAAA,GAEAW,IAAAC,EAAA,OAAA;AAAA,MAA2C,CAAA,qBAAAX,EAAA,OAAA,IAAAJ,EAAA,OAAA,EAAA,GAAAI,EAAA,UAAAJ,EAAA,WAAA,CAAAI,EAAA;AAAA,MAEu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AAA,aAAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -7,7 +7,7 @@ import { u as oe } from "./use-has-slot.B7eQSabc.js";
|
|
|
7
7
|
import { g as ne } from "./generate-uid.NJ8tVoha.js";
|
|
8
8
|
import { u as le } from "./i18n.B6g5VX0q.js";
|
|
9
9
|
import { o as de } from "./resize.Bqks3WUm.js";
|
|
10
|
-
import { c as se, B as re } from "./button-actions.
|
|
10
|
+
import { c as se, B as re } from "./button-actions.CZdO9YOk.js";
|
|
11
11
|
import { _ as ie } from "./_plugin-vue_export-helper.CHgC5LLL.js";
|
|
12
12
|
import "../assets/card.css";
|
|
13
13
|
var D = /* @__PURE__ */ ((s) => (s.PRIMARY = "primary", s.SECONDARY = "secondary", s))(D || {}), p = /* @__PURE__ */ ((s) => (s.DEFAULT = "default", s.SMALL = "small", s))(p || {});
|
|
@@ -224,4 +224,4 @@ export {
|
|
|
224
224
|
p as a,
|
|
225
225
|
Te as c
|
|
226
226
|
};
|
|
227
|
-
//# sourceMappingURL=card.
|
|
227
|
+
//# sourceMappingURL=card.CS34Mi_G.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.JBOvn2BO.js","sources":["../../../vue2/src/components/card/card.types.ts","../../../vue2/src/components/card/card.vue"],"sourcesContent":["/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCardBackground {\n PRIMARY = 'primary',\n SECONDARY = 'secondary',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCardTitleSize {\n DEFAULT = 'default',\n SMALL = 'small',\n}\n","<template>\n <div\n class=\"b-card\"\n :class=\"cardConditionalClasses\"\n :tabindex=\"tabIndex\"\n data-testid=\"card\"\n @click=\"onClick\"\n @keydown.enter=\"onKeyDown\"\n @keydown.space=\"onKeyDown\"\n >\n <div v-if=\"hasSlot('image')\" class=\"b-card__image\">\n <slot name=\"image\"></slot>\n </div>\n <div\n v-if=\"showHeader\"\n class=\"b-card__header\"\n :class=\"cardHeaderConditionalClasses\"\n :tabindex=\"headerTabIndex\"\n :aria-controls=\"expandable ? cardId : null\"\n :aria-expanded=\"expandable ? `${showContent}` : null\"\n :role=\"expandable ? 'button' : null\"\n @click=\"toggleExpansion\"\n @keypress.enter=\"toggleExpansion\"\n @keypress.space=\"toggleExpansion\"\n >\n <div class=\"b-card__header-wrapper\">\n <div v-if=\"showTitleWrapper\" class=\"b-card__header-slot-wrapper\">\n <div class=\"b-card__title-wrapper\" :class=\"cardTitleWrapperConditionalClasses\">\n <div v-if=\"expandable\" class=\"b-card__toggle\" :class=\"cardToggleConditionalClasses\">\n <chevron-up-icon v-if=\"showContent\" :svg-title=\"t('hideContent')\" aria-hidden=\"true\" />\n <chevron-down-icon v-else :svg-title=\"t('showContent')\" aria-hidden=\"true\" />\n </div>\n <bento-typography v-if=\"hasSlot('default')\" class=\"b-card__title\" v-bind=\"typography\">\n <slot />\n </bento-typography>\n </div>\n\n <template v-if=\"hasSlot('header')\">\n <slot name=\"header\"></slot>\n </template>\n </div>\n\n <bento-typography v-if=\"hasSlot('description')\" class=\"b-card__description\" el=\"div\" variant=\"body\">\n <slot name=\"description\" />\n </bento-typography>\n </div>\n </div>\n\n <Transition name=\"b-card__animation\">\n <div v-if=\"showCardBody\" class=\"b-card__wrapper\" :style=\"contentMaxHeight\">\n <div\n :id=\"expandable ? cardId : null\"\n ref=\"contentDiv\"\n class=\"b-card__body\"\n :class=\"cardBodyConditionalClasses\"\n >\n <div v-if=\"hasSlot('content')\" class=\"b-card__content\" :class=\"cardContentConditionalClasses\">\n <slot name=\"content\" />\n </div>\n\n <div v-if=\"actions\" class=\"b-card__actions\" :class=\"cardActionsConditionalClasses\">\n <bento-button-actions :actions=\"actions\" :layout=\"actionsLayout\"></bento-button-actions>\n </div>\n </div>\n </div>\n </Transition>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, ref, useSlots, watch } from 'vue';\n\n // Components\n import { BentoTypography } from '@/components/typography';\n import { BentoButtonActions, BentoButtonActionsLayout, BentoButtonActionsList } from '@/components/button';\n import { BentoCardBackground, BentoCardTitleSize } from '@/components/card/card.types';\n import ChevronDownIcon from '@adyen/ui-assets-icons-16/vue/chevron-down';\n import ChevronUpIcon from '@adyen/ui-assets-icons-16/vue/chevron-up';\n\n // Composables\n import { useExpandableContentHeight } from '@/composables/use-expandable-content-height/use-expandable-content-height';\n\n // Utils\n import { useHasSlot } from '@/composables';\n import { generateUid } from '@/core/utils/ts';\n import { useI18n } from '@/utils/ts/i18n';\n import { observeSizeOfElement } from '@/utils/ts/resize';\n\n import messages from './messages.json';\n import { deprecate } from '@/utils/ts/deprecate';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n\n const props = withDefaults(\n defineProps<{\n /**\n * List of actions that will be used to render the buttons.\n * First element in the list will be rendered as \"primary\".\n * All elements after the first will be rendered as \"secondary\".\n *\n * Each object in the list should have a `title`, an `event` and\n * (optional) a Vue `icon` from the library `@adyen/ui-assets-icons-16`.\n *\n * `title`: Button's text.\n *\n * `event`: Event triggered when clicking the Button.\n *\n * `icon`: Vue Icon from the library `@adyen/ui-assets-icons-16`.\n *\n * ```\n * [{\n * title: 'Primary',\n * event: () => { ... },\n * icon: FourPeopleIcon\n * }, {\n * title: 'Secondary',\n * event: () => { ... }\n * }]\n * ```\n */\n actions?: BentoButtonActionsList;\n\n /**\n * Defines the layout in which the button actions is presented.\n * It can be one of:\n *\n * @values BUTTONS_START\n * @values BUTTONS_END\n * @values FILL_CONTAINER\n * @values SPACE_BETWEEN\n * @values VERTICAL_STACK\n */\n actionsLayout?: BentoButtonActionsLayout | `${BentoButtonActionsLayout}`;\n\n /**\n * Defines the color of card background\n */\n background?: BentoCardBackground | `${BentoCardBackground}`;\n\n /**\n * Makes the whole card clickable\n */\n clickable?: boolean;\n\n /**\n * Sets the expandable card in a closed state\n */\n closed?: boolean;\n\n /**\n * Disables the expandable card\n */\n disabled?: boolean;\n\n /**\n * The whole content of the card will be expandable in accordion manner\n */\n expandable?: boolean;\n\n /**\n * Defines the title size of the card header\n */\n titleSize?: BentoCardTitleSize | `${BentoCardTitleSize}`;\n }>(),\n {\n actions: null,\n actionsLayout: BentoButtonActionsLayout.BUTTONS_END,\n background: BentoCardBackground.PRIMARY,\n clickable: false,\n closed: false,\n disabled: false,\n expandable: false,\n titleSize: BentoCardTitleSize.DEFAULT,\n }\n );\n\n const emit = defineEmits<{\n (e: 'click');\n (e: 'expanded', isExpanded: boolean);\n }>();\n\n const contentDiv = ref<HTMLDivElement>(null);\n\n const cardId = generateUid('card');\n const showContent = ref(!props.closed);\n watch(\n () => props.closed,\n value => {\n showContent.value = !value;\n }\n );\n const showHeader = computed(() => hasSlot('default') || hasSlot('description') || hasSlot('header'));\n const showTitleWrapper = computed(() => hasSlot('default') || hasSlot('header'));\n const showCardBody = computed(\n () =>\n (hasSlot('content') || props.actions?.length) &&\n (!props.expandable || (props.expandable && showContent.value))\n );\n const tabIndex = computed(() => (props.clickable && !props.disabled ? 0 : -1));\n const headerTabIndex = computed(() => (props.expandable && !props.disabled ? 0 : -1));\n\n const cardConditionalClasses = computed(() => ({\n [`b-card--${props.background}`]: props.background,\n 'b-card--clickable': props.clickable,\n 'b-card--expandable': props.expandable,\n 'b-card--disabled': (props.clickable || props.expandable) && props.disabled,\n }));\n\n const cardHeaderConditionalClasses = computed(() => ({\n 'b-card__header--expandable': props.expandable,\n 'b-card__header--without-body': !props.expandable && !showCardBody.value,\n }));\n\n const cardToggleConditionalClasses = computed(() => ({\n 'b-card__toggle--small-text': props.titleSize === BentoCardTitleSize.SMALL,\n }));\n\n const cardBodyConditionalClasses = computed(() => ({\n 'b-card__body--expandable': props.expandable && hasSlot('content'),\n 'b-card__body--without-header': !props.expandable && !showHeader.value,\n }));\n\n const cardContentConditionalClasses = computed(() => ({\n 'b-card__content--without-header': !props.expandable && !showHeader.value,\n 'b-card__content--expandable': props.expandable,\n }));\n\n const cardActionsConditionalClasses = computed(() => {\n const isNotExpandableWithoutContent = !props.expandable && props.actions && !hasSlot('content');\n\n return {\n 'b-card__actions--without-content': isNotExpandableWithoutContent,\n 'b-card__actions--without-content-and-with-header': isNotExpandableWithoutContent && showHeader.value,\n };\n });\n\n const cardTitleWrapperConditionalClasses = computed(() => ({\n 'b-card__title-wrapper--truncated': hasSlot('header'),\n }));\n\n const typography = computed(\n () =>\n ({\n el: 'div',\n variant: props.titleSize === BentoCardTitleSize.DEFAULT ? 'title' : 'body',\n strongest: props.titleSize === BentoCardTitleSize.SMALL,\n wide: props.titleSize === BentoCardTitleSize.SMALL,\n }) as InstanceType<typeof BentoTypography>['$props']\n );\n\n // Toggle open and close logic and animation\n const { updateContentHeight, contentHeight } = useExpandableContentHeight(contentDiv, showContent);\n\n const contentMaxHeight = computed(() =>\n props.expandable && contentHeight.value ? { 'max-height': contentHeight.value } : {}\n );\n\n watch(\n () => contentDiv.value,\n () => {\n let observer: ResizeObserver | null = null;\n if (!observer && contentDiv.value) {\n observer = observeSizeOfElement(contentDiv.value, () => {\n if (contentDiv.value) {\n updateContentHeight();\n }\n });\n }\n }\n );\n\n const toggleExpansion = () => {\n if (!props.disabled && props.expandable) {\n showContent.value = !showContent.value;\n emit('expanded', showContent.value);\n updateContentHeight();\n }\n };\n\n const onClick = () => {\n if (!props.disabled) {\n emit('click');\n\n if (!props.clickable) {\n deprecate(\n 'BentoCard \"@click\" property',\n `Use the BentoCard \"@click\" with the \"clickable\" property to enable accessible styles.`,\n '2.0.0'\n );\n }\n }\n };\n\n const onKeyDown = () => {\n if (props.clickable && !props.disabled) {\n emit('click');\n }\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * A card is a flexible and composable container.\n * Use cards to represent a single object or to visually group certain content, like legal information within company settings.\n *\n * @example\n * import { BentoCard } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoCard },\n * template: `\n * <bento-card>\n * Title of the Card\n * </bento-card>\n * `\n * };\n */\n export default {\n i18n: { messages },\n name: 'bento-card',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"@/core/components/card/card.scss\" />\n"],"names":["BentoCardBackground","BentoCardBackground2","BentoCardTitleSize","BentoCardTitleSize2","__default__","messages","t","useI18n","slots","useSlots","hasSlot","useHasSlot","props","__props","emit","__emit","contentDiv","ref","cardId","generateUid","showContent","watch","value","showHeader","computed","showTitleWrapper","showCardBody","_a","tabIndex","headerTabIndex","cardConditionalClasses","cardHeaderConditionalClasses","cardToggleConditionalClasses","cardBodyConditionalClasses","cardContentConditionalClasses","cardActionsConditionalClasses","isNotExpandableWithoutContent","cardTitleWrapperConditionalClasses","typography","updateContentHeight","contentHeight","useExpandableContentHeight","contentMaxHeight","observer","observeSizeOfElement","toggleExpansion","onClick","deprecate","onKeyDown"],"mappings":";;;;;;;;;;;;AAGY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,UAAA,WACAA,EAAA,YAAA,aAFQA,IAAAD,KAAA,CAAA,CAAA,GAQAE,IAAA,kBAAAC,OACRA,EAAA,UAAA,WACAA,EAAA,QAAA,SAFQA,IAAAD,KAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;gBCuTRE,KAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAAA,EACM,MAAA;AAErB;;;;;;;;;;;;;;AAxOA,UAAA,EAAA,GAAAC,EAAA,IAAAC,GAAA,EAAA,UAAAF,EAAA,CAAA,GAEAG,IAAAC,EAAA,GACAC,IAAAC,GAAAH,CAAA,GAEAI,IAAAC,GAmFAC,IAAAC,GAKAC,IAAAC,EAAA,IAAA,GAEAC,IAAAC,GAAA,MAAA,GACAC,IAAAH,EAAA,CAAAL,EAAA,MAAA;AACA,IAAAS;AAAA,MAAA,MAAAT,EAAA;AAAA,MACgB,CAAAU,MAAA;AAER,QAAAF,E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A;AAAA,IACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"card.CS34Mi_G.js","sources":["../../../vue2/src/components/card/card.types.ts","../../../vue2/src/components/card/card.vue"],"sourcesContent":["/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCardBackground {\n PRIMARY = 'primary',\n SECONDARY = 'secondary',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCardTitleSize {\n DEFAULT = 'default',\n SMALL = 'small',\n}\n","<template>\n <div\n class=\"b-card\"\n :class=\"cardConditionalClasses\"\n :tabindex=\"tabIndex\"\n data-testid=\"card\"\n @click=\"onClick\"\n @keydown.enter=\"onKeyDown\"\n @keydown.space=\"onKeyDown\"\n >\n <div v-if=\"hasSlot('image')\" class=\"b-card__image\">\n <slot name=\"image\"></slot>\n </div>\n <div\n v-if=\"showHeader\"\n class=\"b-card__header\"\n :class=\"cardHeaderConditionalClasses\"\n :tabindex=\"headerTabIndex\"\n :aria-controls=\"expandable ? cardId : null\"\n :aria-expanded=\"expandable ? `${showContent}` : null\"\n :role=\"expandable ? 'button' : null\"\n @click=\"toggleExpansion\"\n @keypress.enter=\"toggleExpansion\"\n @keypress.space=\"toggleExpansion\"\n >\n <div class=\"b-card__header-wrapper\">\n <div v-if=\"showTitleWrapper\" class=\"b-card__header-slot-wrapper\">\n <div class=\"b-card__title-wrapper\" :class=\"cardTitleWrapperConditionalClasses\">\n <div v-if=\"expandable\" class=\"b-card__toggle\" :class=\"cardToggleConditionalClasses\">\n <chevron-up-icon v-if=\"showContent\" :svg-title=\"t('hideContent')\" aria-hidden=\"true\" />\n <chevron-down-icon v-else :svg-title=\"t('showContent')\" aria-hidden=\"true\" />\n </div>\n <bento-typography v-if=\"hasSlot('default')\" class=\"b-card__title\" v-bind=\"typography\">\n <slot />\n </bento-typography>\n </div>\n\n <template v-if=\"hasSlot('header')\">\n <slot name=\"header\"></slot>\n </template>\n </div>\n\n <bento-typography v-if=\"hasSlot('description')\" class=\"b-card__description\" el=\"div\" variant=\"body\">\n <slot name=\"description\" />\n </bento-typography>\n </div>\n </div>\n\n <Transition name=\"b-card__animation\">\n <div v-if=\"showCardBody\" class=\"b-card__wrapper\" :style=\"contentMaxHeight\">\n <div\n :id=\"expandable ? cardId : null\"\n ref=\"contentDiv\"\n class=\"b-card__body\"\n :class=\"cardBodyConditionalClasses\"\n >\n <div v-if=\"hasSlot('content')\" class=\"b-card__content\" :class=\"cardContentConditionalClasses\">\n <slot name=\"content\" />\n </div>\n\n <div v-if=\"actions\" class=\"b-card__actions\" :class=\"cardActionsConditionalClasses\">\n <bento-button-actions :actions=\"actions\" :layout=\"actionsLayout\"></bento-button-actions>\n </div>\n </div>\n </div>\n </Transition>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, ref, useSlots, watch } from 'vue';\n\n // Components\n import { BentoTypography } from '@/components/typography';\n import { BentoButtonActions, BentoButtonActionsLayout, BentoButtonActionsList } from '@/components/button';\n import { BentoCardBackground, BentoCardTitleSize } from '@/components/card/card.types';\n import ChevronDownIcon from '@adyen/ui-assets-icons-16/vue/chevron-down';\n import ChevronUpIcon from '@adyen/ui-assets-icons-16/vue/chevron-up';\n\n // Composables\n import { useExpandableContentHeight } from '@/composables/use-expandable-content-height/use-expandable-content-height';\n\n // Utils\n import { useHasSlot } from '@/composables';\n import { generateUid } from '@/core/utils/ts';\n import { useI18n } from '@/utils/ts/i18n';\n import { observeSizeOfElement } from '@/utils/ts/resize';\n\n import messages from './messages.json';\n import { deprecate } from '@/utils/ts/deprecate';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n\n const props = withDefaults(\n defineProps<{\n /**\n * List of actions that will be used to render the buttons.\n * First element in the list will be rendered as \"primary\".\n * All elements after the first will be rendered as \"secondary\".\n *\n * Each object in the list should have a `title`, an `event` and\n * (optional) a Vue `icon` from the library `@adyen/ui-assets-icons-16`.\n *\n * `title`: Button's text.\n *\n * `event`: Event triggered when clicking the Button.\n *\n * `icon`: Vue Icon from the library `@adyen/ui-assets-icons-16`.\n *\n * ```\n * [{\n * title: 'Primary',\n * event: () => { ... },\n * icon: FourPeopleIcon\n * }, {\n * title: 'Secondary',\n * event: () => { ... }\n * }]\n * ```\n */\n actions?: BentoButtonActionsList;\n\n /**\n * Defines the layout in which the button actions is presented.\n * It can be one of:\n *\n * @values BUTTONS_START\n * @values BUTTONS_END\n * @values FILL_CONTAINER\n * @values SPACE_BETWEEN\n * @values VERTICAL_STACK\n */\n actionsLayout?: BentoButtonActionsLayout | `${BentoButtonActionsLayout}`;\n\n /**\n * Defines the color of card background\n */\n background?: BentoCardBackground | `${BentoCardBackground}`;\n\n /**\n * Makes the whole card clickable\n */\n clickable?: boolean;\n\n /**\n * Sets the expandable card in a closed state\n */\n closed?: boolean;\n\n /**\n * Disables the expandable card\n */\n disabled?: boolean;\n\n /**\n * The whole content of the card will be expandable in accordion manner\n */\n expandable?: boolean;\n\n /**\n * Defines the title size of the card header\n */\n titleSize?: BentoCardTitleSize | `${BentoCardTitleSize}`;\n }>(),\n {\n actions: null,\n actionsLayout: BentoButtonActionsLayout.BUTTONS_END,\n background: BentoCardBackground.PRIMARY,\n clickable: false,\n closed: false,\n disabled: false,\n expandable: false,\n titleSize: BentoCardTitleSize.DEFAULT,\n }\n );\n\n const emit = defineEmits<{\n (e: 'click');\n (e: 'expanded', isExpanded: boolean);\n }>();\n\n const contentDiv = ref<HTMLDivElement>(null);\n\n const cardId = generateUid('card');\n const showContent = ref(!props.closed);\n watch(\n () => props.closed,\n value => {\n showContent.value = !value;\n }\n );\n const showHeader = computed(() => hasSlot('default') || hasSlot('description') || hasSlot('header'));\n const showTitleWrapper = computed(() => hasSlot('default') || hasSlot('header'));\n const showCardBody = computed(\n () =>\n (hasSlot('content') || props.actions?.length) &&\n (!props.expandable || (props.expandable && showContent.value))\n );\n const tabIndex = computed(() => (props.clickable && !props.disabled ? 0 : -1));\n const headerTabIndex = computed(() => (props.expandable && !props.disabled ? 0 : -1));\n\n const cardConditionalClasses = computed(() => ({\n [`b-card--${props.background}`]: props.background,\n 'b-card--clickable': props.clickable,\n 'b-card--expandable': props.expandable,\n 'b-card--disabled': (props.clickable || props.expandable) && props.disabled,\n }));\n\n const cardHeaderConditionalClasses = computed(() => ({\n 'b-card__header--expandable': props.expandable,\n 'b-card__header--without-body': !props.expandable && !showCardBody.value,\n }));\n\n const cardToggleConditionalClasses = computed(() => ({\n 'b-card__toggle--small-text': props.titleSize === BentoCardTitleSize.SMALL,\n }));\n\n const cardBodyConditionalClasses = computed(() => ({\n 'b-card__body--expandable': props.expandable && hasSlot('content'),\n 'b-card__body--without-header': !props.expandable && !showHeader.value,\n }));\n\n const cardContentConditionalClasses = computed(() => ({\n 'b-card__content--without-header': !props.expandable && !showHeader.value,\n 'b-card__content--expandable': props.expandable,\n }));\n\n const cardActionsConditionalClasses = computed(() => {\n const isNotExpandableWithoutContent = !props.expandable && props.actions && !hasSlot('content');\n\n return {\n 'b-card__actions--without-content': isNotExpandableWithoutContent,\n 'b-card__actions--without-content-and-with-header': isNotExpandableWithoutContent && showHeader.value,\n };\n });\n\n const cardTitleWrapperConditionalClasses = computed(() => ({\n 'b-card__title-wrapper--truncated': hasSlot('header'),\n }));\n\n const typography = computed(\n () =>\n ({\n el: 'div',\n variant: props.titleSize === BentoCardTitleSize.DEFAULT ? 'title' : 'body',\n strongest: props.titleSize === BentoCardTitleSize.SMALL,\n wide: props.titleSize === BentoCardTitleSize.SMALL,\n }) as InstanceType<typeof BentoTypography>['$props']\n );\n\n // Toggle open and close logic and animation\n const { updateContentHeight, contentHeight } = useExpandableContentHeight(contentDiv, showContent);\n\n const contentMaxHeight = computed(() =>\n props.expandable && contentHeight.value ? { 'max-height': contentHeight.value } : {}\n );\n\n watch(\n () => contentDiv.value,\n () => {\n let observer: ResizeObserver | null = null;\n if (!observer && contentDiv.value) {\n observer = observeSizeOfElement(contentDiv.value, () => {\n if (contentDiv.value) {\n updateContentHeight();\n }\n });\n }\n }\n );\n\n const toggleExpansion = () => {\n if (!props.disabled && props.expandable) {\n showContent.value = !showContent.value;\n emit('expanded', showContent.value);\n updateContentHeight();\n }\n };\n\n const onClick = () => {\n if (!props.disabled) {\n emit('click');\n\n if (!props.clickable) {\n deprecate(\n 'BentoCard \"@click\" property',\n `Use the BentoCard \"@click\" with the \"clickable\" property to enable accessible styles.`,\n '2.0.0'\n );\n }\n }\n };\n\n const onKeyDown = () => {\n if (props.clickable && !props.disabled) {\n emit('click');\n }\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * A card is a flexible and composable container.\n * Use cards to represent a single object or to visually group certain content, like legal information within company settings.\n *\n * @example\n * import { BentoCard } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoCard },\n * template: `\n * <bento-card>\n * Title of the Card\n * </bento-card>\n * `\n * };\n */\n export default {\n i18n: { messages },\n name: 'bento-card',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"@/core/components/card/card.scss\" />\n"],"names":["BentoCardBackground","BentoCardBackground2","BentoCardTitleSize","BentoCardTitleSize2","__default__","messages","t","useI18n","slots","useSlots","hasSlot","useHasSlot","props","__props","emit","__emit","contentDiv","ref","cardId","generateUid","showContent","watch","value","showHeader","computed","showTitleWrapper","showCardBody","_a","tabIndex","headerTabIndex","cardConditionalClasses","cardHeaderConditionalClasses","cardToggleConditionalClasses","cardBodyConditionalClasses","cardContentConditionalClasses","cardActionsConditionalClasses","isNotExpandableWithoutContent","cardTitleWrapperConditionalClasses","typography","updateContentHeight","contentHeight","useExpandableContentHeight","contentMaxHeight","observer","observeSizeOfElement","toggleExpansion","onClick","deprecate","onKeyDown"],"mappings":";;;;;;;;;;;;AAGY,I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AAA,CAAA;AAAA,IAC8D;AAGvF,IAAAnB;AAAA,MAAA,MAAAL,EAAA;AAAA,MACqB,MAAA;AAEb,YAAA2B,IAAA;AACA,QAAA,CAAAA,KAAA3B,EAAA,UACI2B,IAAAC,GAAA5B,EAAA,OAAA,MAAA;AACI,UAAAA,EAAA,SACIuB,EAAA;AAAA,QACJ,CAAA;AAAA,MAER;AAAA,IACJ;AAGJ,UAAAM,IAAA,MAAA;AACI,MAAA,CAAAjC,EAAA,YAAAA,EAAA,eACIQ,EAAA,QAAA,CAAAA,EAAA,OACAN,EAAA,YAAAM,EAAA,KAAA,GACAmB,EAAA;AAAA,IACJ,GAGJO,IAAA,MAAA;AACI,MAAAlC,EAAA,aACIE,EAAA,OAAA,GAEAF,EAAA,aACImC;AAAA,QAAA;AAAA,QACI;AAAA,QACA;AAAA,MACA;AAAA,IAGZ,GAGJC,IAAA,MAAA;AACI,MAAApC,EAAA,aAAA,CAAAA,EAAA,YACIE,EAAA,OAAA;AAAA,IACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as B, toRef as I, computed as l, watch as y, ref as T, resolveComponent as m, createElementBlock as v, openBlock as n, createVNode as N, createBlock as E, createCommentVNode as V, normalizeClass as w, withCtx as s, Fragment as O, renderList as A, createSlots as G, createTextVNode as k, toDisplayString as S, renderSlot as L, mergeProps as _ } from "vue";
|
|
2
|
-
import { a as d, B as U } from "./checkbox.
|
|
2
|
+
import { a as d, B as U } from "./checkbox.DGrG3GN1.js";
|
|
3
3
|
import { g as P } from "./generate-uid.NJ8tVoha.js";
|
|
4
4
|
import { d as R } from "./typography.DN5eC5ch.js";
|
|
5
5
|
import { u as q } from "./use-form-layout-loading.D3lALhtC.js";
|
|
@@ -189,4 +189,4 @@ export {
|
|
|
189
189
|
i as B,
|
|
190
190
|
ee as c
|
|
191
191
|
};
|
|
192
|
-
//# sourceMappingURL=checkbox-group.
|
|
192
|
+
//# sourceMappingURL=checkbox-group.JRo6xNpe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-group.Dc5Olq0c.js","sources":["../../../core/src/components/checkbox-group/checkbox-group.types.ts","../../../vue2/src/components/checkbox/components/checkbox-group/checkbox-group.vue"],"sourcesContent":["import type { BentoCheckboxTag } from '@/core/components/checkbox/checkbox.types';\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCheckboxGroupVariant {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n}\n\ninterface BentoCheckboxGroupItem {\n value: string | number;\n label: string;\n description?: string;\n disabled?: boolean;\n hasError?: boolean;\n errorMessage?: string;\n readonly?: boolean;\n tag?: BentoCheckboxTag;\n}\n\nexport type BentoCheckboxGroupItems = Array<BentoCheckboxGroupItem>;\n","<template>\n <div class=\"b-checkbox-group\">\n <controls-group\n class=\"b-checkbox-group__checkboxes\"\n :aria-describedby=\"shouldShowGroupErrorMessage ? errorId : ''\"\n :component-name=\"COMPONENT_NAME\"\n :class=\"conditionalClasses\"\n :description=\"description\"\n :disabled=\"disabled\"\n :form=\"formId\"\n :hide-label=\"hideLabel\"\n :label=\"label\"\n :optional=\"optional\"\n :required=\"required\"\n :tooltip-text=\"tooltipText\"\n >\n <bento-checkbox\n v-for=\"item in items\"\n :key=\"item.value\"\n :model-value=\"inputValue\"\n :value=\"item.value\"\n :disabled=\"disabled || item.disabled\"\n :has-error=\"shouldShowGroupError || item.hasError\"\n :error-message=\"shouldShowGroupError ? null : item.errorMessage\"\n :readonly=\"isReadOnly || item.readonly\"\n :tag=\"item.tag\"\n @update:model-value=\"onInput\"\n >\n <template #default>{{ item.label }}</template>\n <template v-if=\"item.description\" #description>{{ item.description }}</template>\n <template v-if=\"hasContentSlot('content')\" #content>\n <slot name=\"content\" v-bind=\"item\"></slot>\n </template>\n </bento-checkbox>\n </controls-group>\n <error-message\n v-if=\"shouldShowGroupErrorMessage\"\n :id=\"errorId\"\n :error-message=\"errorMessage\"\n class=\"b-checkbox-group__error-message\"\n />\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType, ref, toRef, watch } from 'vue';\n import { ControlsGroup } from '@/components/internal/controls-group';\n import { ErrorMessage } from '@/components/internal/error-message';\n import {\n BentoCheckboxGroupItems,\n BentoCheckboxGroupVariant,\n } from '@/core/components/checkbox-group/checkbox-group.types';\n import BentoCheckbox from '@/components/checkbox/checkbox.vue';\n import { BentoCheckboxEvent } from '@/core/components/checkbox/checkbox.types';\n import { generateUid } from '@/core/utils/ts';\n import { deprecate } from '@/utils/ts/deprecate';\n import { useFormLayoutFieldLoading } from '@/composables/use-form-layout-loading/use-form-layout-loading';\n\n /**\n * The name of the component to be used in the Vue devtools and console warnings.\n */\n const COMPONENT_NAME = 'bento-checkbox-group';\n\n /**\n * A checkbox group component should be used whenever it is necessary to group a set of checkboxes that are related together\n * This component conforms to the official WAI-ARIA guidelines for grouping controls: https://www.w3.org/WAI/tutorials/forms/grouping/\n *\n * import { BentoCheckboxGroup } from '@adyen/bento-vue2/';\n *\n * export default {\n * components: { BentoCheckboxGroup },\n * template: `\n * <bento-checkbox-group\n * label=\"Your group label\"\n * :items=\"[\n * { value: 1, label: 'Your label' },\n * { value: 2, label: 'Another label', description: 'Your sub label' },\n * ]\"\n * />\n * `\n * };\n */\n export default defineComponent({\n name: COMPONENT_NAME,\n components: { BentoCheckbox, ControlsGroup, ErrorMessage },\n model: { prop: 'modelValue' },\n props: {\n /**\n * Descriptive supporting text visbile underneath the label.\n */\n description: { type: String, default: null },\n\n /**\n * If set to true, renders all checkboxes in the group in a disabled state.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Renders all checkboxes in an error state with an error message.\n */\n errorMessage: { type: String, default: null },\n\n /**\n * The form id the checkbox group is associated with. Defaults to null, as a checkbox group can also be used standalone.\n */\n formId: { type: String, default: null },\n\n /**\n * If set to true, renders all checkboxes in the group in an error state.\n *\n * @deprecated Use \"errorMessage\" prop instead\n */\n hasError: { type: Boolean, default: false },\n\n /**\n * Shows/hides the group label.\n */\n hideLabel: { type: Boolean, default: null },\n\n /**\n * The checkbox group's items.\n */\n items: { type: Array as PropType<BentoCheckboxGroupItems>, required: true },\n\n /**\n * The name associated with the group. Required for accessibility purposes.\n */\n label: { type: String, required: true },\n\n /**\n * Determines the initially selected value of the group. Corresponds to the BentoCheckboxButtonItem's value.\n * Defaults to no value selected.\n */\n modelValue: { type: Array<number | string | null>, default: () => [] },\n\n /**\n * Indicates the field is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * If set to true, renders all checkboxes in the group in a readonly state.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Indicates the field is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Tooltip message.\n */\n tooltipText: { type: String, default: null },\n\n /**\n * The checkbox group's layout. It can be vertical or horizontal. Defaults to vertical.\n */\n variant: {\n type: String as PropType<BentoCheckboxGroupVariant | `${BentoCheckboxGroupVariant}`>,\n default: BentoCheckboxGroupVariant.VERTICAL,\n validator: (value: BentoCheckboxGroupVariant) =>\n Object.values(BentoCheckboxGroupVariant).includes(value),\n },\n },\n emits: [BentoCheckboxEvent.UPDATE, BentoCheckboxEvent.INPUT],\n setup(props, { emit, slots }) {\n const errorId = generateUid('error');\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n const shouldShowGroupError = computed(\n () => !props.disabled && !isReadOnly.value && (!!props.errorMessage || props.hasError)\n );\n const shouldShowGroupErrorMessage = computed(\n () => !props.disabled && !isReadOnly.value && !!props.errorMessage\n );\n\n const conditionalClasses = computed(() => ({\n 'b-checkbox-group__checkboxes--horizontal': props.variant === BentoCheckboxGroupVariant.HORIZONTAL,\n }));\n\n // Slots logic\n // Temporary, use-has-slots composable doesn't currently work for\n // vue3 named scoped slots\n const hasContentSlot = name => !!slots[name];\n const shouldShowSlotsError = computed(() => hasContentSlot('content') && props.variant !== 'vertical');\n\n watch(\n shouldShowSlotsError,\n newValue => {\n if (newValue) {\n throw new Error('The content slot is only available for the vertical checkbox group layout');\n }\n },\n { immediate: true }\n );\n\n const inputValue = ref(props.modelValue);\n watch(\n () => props.modelValue,\n () => {\n inputValue.value = props.modelValue;\n }\n );\n\n const onInput = value => {\n inputValue.value = value;\n emit(BentoCheckboxEvent.UPDATE, value);\n emit(BentoCheckboxEvent.INPUT, value);\n };\n\n if (props.hasError) {\n deprecate(\n 'BentoCheckboxGroup \"hasError\" property',\n `Use the BentoCheckboxGroup \"errorMessage\" property instead to indicate that there is a modifier error.\n Having the field as \"undefined\" will hide/remove the error.\n <bento-checkbox-group errorMessage=\"Error message text\" />`,\n '2.0.0'\n );\n }\n\n return {\n // Values\n COMPONENT_NAME,\n errorId,\n isReadOnly,\n shouldShowGroupError,\n shouldShowGroupErrorMessage,\n conditionalClasses,\n inputValue,\n hasContentSlot,\n\n // Methods\n onInput,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"@/core/components/checkbox-group/checkbox-group.scss\" />\n"],"names":["BentoCheckboxGroupVariant","BentoCheckboxGroupVariant2","COMPONENT_NAME","_sfc_main","defineComponent","BentoCheckbox","ControlsGroup","ErrorMessage","value","BentoCheckboxEvent","props","emit","slots","errorId","generateUid","isReadOnly","useFormLayoutFieldLoading","toRef","shouldShowGroupError","computed","shouldShowGroupErrorMessage","conditionalClasses","hasContentSlot","name","shouldShowSlotsError","watch","newValue","inputValue","ref","onInput","deprecate","openBlock","createElementBlock","_hoisted_1","_ctx","hideLabel","label","optional","required","Fragment","renderList","item","createBlock","_component_bento_checkbox","disabled","createSlots","withCtx","createTextVNode","toDisplayString","renderSlot","mergeProps","_component_error_message","createCommentVNode"],"mappings":";;;;;;;;;AAKY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,aAAA,cACAA,EAAA,WAAA,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AAA;AAAA,UA7BhCA,EAAA,cAAA;AAAA,YAAA,MAAA;AAAA,YAAA,IAAAK,EAAA,MAAA;AAAA,cAAAC,EAAAC,EAAAP,EAAA,WAAA,GAAA,CAAA;AAAA,YAAA,CAAA;AAAA,YAAA,KAAA;AAAA,UAAA,IAAA;AAAA;YA+BoB,MAAA;AAAA,YAAA,IAAAK,EAAA,MAAA;AAAA,cA/BpBG,EAAAf,EAAA,QAAA,WAAAgB,EAAA,EAAA,SAAA,GAAA,GAAAT,CAAA,GAAA,QAAA,EAAA;AAAA,YAAA,CAAA;AAAA,YAAA,KAAA;AAAA,UAAA,IAAA;AAAA,gIAAA,GAAA,GAAA;AAAA,MAAA,CAAA;AAAA,MAoCkBrB,GAAAA;AAAAA,IAAAA,GAAAA,GAAAA,CAAAA,oBAAAA,kBAAAA,SAAAA,eAAAA,YAAAA,QAAAA,cAAAA,SAAAA,YAAAA,YAAAA,cAAAA,CAAAA;AAAAA,IAIRc,EAAA,+BAAAH,EAAA,GAAAW,EAAAS,GAAA;AAAA,MAHc,KAAA;AAAA,MACX,IAAAjB,EAAA;AAAA,MACK,iBAAAA,EAAA;AAAA,MAvClB,OAAA;AAAA,IAAA,GAAA,MAAA,GAAA,CAAA,MAAA,eAAA,CAAA,KAAAkB,EAAA,IAAA,EAAA;AAAA;;;"}
|
|
1
|
+
{"version":3,"file":"checkbox-group.JRo6xNpe.js","sources":["../../../core/src/components/checkbox-group/checkbox-group.types.ts","../../../vue2/src/components/checkbox/components/checkbox-group/checkbox-group.vue"],"sourcesContent":["import type { BentoCheckboxTag } from '@/core/components/checkbox/checkbox.types';\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoCheckboxGroupVariant {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n}\n\ninterface BentoCheckboxGroupItem {\n value: string | number;\n label: string;\n description?: string;\n disabled?: boolean;\n hasError?: boolean;\n errorMessage?: string;\n readonly?: boolean;\n tag?: BentoCheckboxTag;\n}\n\nexport type BentoCheckboxGroupItems = Array<BentoCheckboxGroupItem>;\n","<template>\n <div class=\"b-checkbox-group\">\n <controls-group\n class=\"b-checkbox-group__checkboxes\"\n :aria-describedby=\"shouldShowGroupErrorMessage ? errorId : ''\"\n :component-name=\"COMPONENT_NAME\"\n :class=\"conditionalClasses\"\n :description=\"description\"\n :disabled=\"disabled\"\n :form=\"formId\"\n :hide-label=\"hideLabel\"\n :label=\"label\"\n :optional=\"optional\"\n :required=\"required\"\n :tooltip-text=\"tooltipText\"\n >\n <bento-checkbox\n v-for=\"item in items\"\n :key=\"item.value\"\n :model-value=\"inputValue\"\n :value=\"item.value\"\n :disabled=\"disabled || item.disabled\"\n :has-error=\"shouldShowGroupError || item.hasError\"\n :error-message=\"shouldShowGroupError ? null : item.errorMessage\"\n :readonly=\"isReadOnly || item.readonly\"\n :tag=\"item.tag\"\n @update:model-value=\"onInput\"\n >\n <template #default>{{ item.label }}</template>\n <template v-if=\"item.description\" #description>{{ item.description }}</template>\n <template v-if=\"hasContentSlot('content')\" #content>\n <slot name=\"content\" v-bind=\"item\"></slot>\n </template>\n </bento-checkbox>\n </controls-group>\n <error-message\n v-if=\"shouldShowGroupErrorMessage\"\n :id=\"errorId\"\n :error-message=\"errorMessage\"\n class=\"b-checkbox-group__error-message\"\n />\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType, ref, toRef, watch } from 'vue';\n import { ControlsGroup } from '@/components/internal/controls-group';\n import { ErrorMessage } from '@/components/internal/error-message';\n import {\n BentoCheckboxGroupItems,\n BentoCheckboxGroupVariant,\n } from '@/core/components/checkbox-group/checkbox-group.types';\n import BentoCheckbox from '@/components/checkbox/checkbox.vue';\n import { BentoCheckboxEvent } from '@/core/components/checkbox/checkbox.types';\n import { generateUid } from '@/core/utils/ts';\n import { deprecate } from '@/utils/ts/deprecate';\n import { useFormLayoutFieldLoading } from '@/composables/use-form-layout-loading/use-form-layout-loading';\n\n /**\n * The name of the component to be used in the Vue devtools and console warnings.\n */\n const COMPONENT_NAME = 'bento-checkbox-group';\n\n /**\n * A checkbox group component should be used whenever it is necessary to group a set of checkboxes that are related together\n * This component conforms to the official WAI-ARIA guidelines for grouping controls: https://www.w3.org/WAI/tutorials/forms/grouping/\n *\n * import { BentoCheckboxGroup } from '@adyen/bento-vue2/';\n *\n * export default {\n * components: { BentoCheckboxGroup },\n * template: `\n * <bento-checkbox-group\n * label=\"Your group label\"\n * :items=\"[\n * { value: 1, label: 'Your label' },\n * { value: 2, label: 'Another label', description: 'Your sub label' },\n * ]\"\n * />\n * `\n * };\n */\n export default defineComponent({\n name: COMPONENT_NAME,\n components: { BentoCheckbox, ControlsGroup, ErrorMessage },\n model: { prop: 'modelValue' },\n props: {\n /**\n * Descriptive supporting text visbile underneath the label.\n */\n description: { type: String, default: null },\n\n /**\n * If set to true, renders all checkboxes in the group in a disabled state.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Renders all checkboxes in an error state with an error message.\n */\n errorMessage: { type: String, default: null },\n\n /**\n * The form id the checkbox group is associated with. Defaults to null, as a checkbox group can also be used standalone.\n */\n formId: { type: String, default: null },\n\n /**\n * If set to true, renders all checkboxes in the group in an error state.\n *\n * @deprecated Use \"errorMessage\" prop instead\n */\n hasError: { type: Boolean, default: false },\n\n /**\n * Shows/hides the group label.\n */\n hideLabel: { type: Boolean, default: null },\n\n /**\n * The checkbox group's items.\n */\n items: { type: Array as PropType<BentoCheckboxGroupItems>, required: true },\n\n /**\n * The name associated with the group. Required for accessibility purposes.\n */\n label: { type: String, required: true },\n\n /**\n * Determines the initially selected value of the group. Corresponds to the BentoCheckboxButtonItem's value.\n * Defaults to no value selected.\n */\n modelValue: { type: Array<number | string | null>, default: () => [] },\n\n /**\n * Indicates the field is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * If set to true, renders all checkboxes in the group in a readonly state.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Indicates the field is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Tooltip message.\n */\n tooltipText: { type: String, default: null },\n\n /**\n * The checkbox group's layout. It can be vertical or horizontal. Defaults to vertical.\n */\n variant: {\n type: String as PropType<BentoCheckboxGroupVariant | `${BentoCheckboxGroupVariant}`>,\n default: BentoCheckboxGroupVariant.VERTICAL,\n validator: (value: BentoCheckboxGroupVariant) =>\n Object.values(BentoCheckboxGroupVariant).includes(value),\n },\n },\n emits: [BentoCheckboxEvent.UPDATE, BentoCheckboxEvent.INPUT],\n setup(props, { emit, slots }) {\n const errorId = generateUid('error');\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n const shouldShowGroupError = computed(\n () => !props.disabled && !isReadOnly.value && (!!props.errorMessage || props.hasError)\n );\n const shouldShowGroupErrorMessage = computed(\n () => !props.disabled && !isReadOnly.value && !!props.errorMessage\n );\n\n const conditionalClasses = computed(() => ({\n 'b-checkbox-group__checkboxes--horizontal': props.variant === BentoCheckboxGroupVariant.HORIZONTAL,\n }));\n\n // Slots logic\n // Temporary, use-has-slots composable doesn't currently work for\n // vue3 named scoped slots\n const hasContentSlot = name => !!slots[name];\n const shouldShowSlotsError = computed(() => hasContentSlot('content') && props.variant !== 'vertical');\n\n watch(\n shouldShowSlotsError,\n newValue => {\n if (newValue) {\n throw new Error('The content slot is only available for the vertical checkbox group layout');\n }\n },\n { immediate: true }\n );\n\n const inputValue = ref(props.modelValue);\n watch(\n () => props.modelValue,\n () => {\n inputValue.value = props.modelValue;\n }\n );\n\n const onInput = value => {\n inputValue.value = value;\n emit(BentoCheckboxEvent.UPDATE, value);\n emit(BentoCheckboxEvent.INPUT, value);\n };\n\n if (props.hasError) {\n deprecate(\n 'BentoCheckboxGroup \"hasError\" property',\n `Use the BentoCheckboxGroup \"errorMessage\" property instead to indicate that there is a modifier error.\n Having the field as \"undefined\" will hide/remove the error.\n <bento-checkbox-group errorMessage=\"Error message text\" />`,\n '2.0.0'\n );\n }\n\n return {\n // Values\n COMPONENT_NAME,\n errorId,\n isReadOnly,\n shouldShowGroupError,\n shouldShowGroupErrorMessage,\n conditionalClasses,\n inputValue,\n hasContentSlot,\n\n // Methods\n onInput,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"@/core/components/checkbox-group/checkbox-group.scss\" />\n"],"names":["BentoCheckboxGroupVariant","BentoCheckboxGroupVariant2","COMPONENT_NAME","_sfc_main","defineComponent","BentoCheckbox","ControlsGroup","ErrorMessage","value","BentoCheckboxEvent","props","emit","slots","errorId","generateUid","isReadOnly","useFormLayoutFieldLoading","toRef","shouldShowGroupError","computed","shouldShowGroupErrorMessage","conditionalClasses","hasContentSlot","name","shouldShowSlotsError","watch","newValue","inputValue","ref","onInput","deprecate","openBlock","createElementBlock","_hoisted_1","_ctx","hideLabel","label","optional","required","Fragment","renderList","item","createBlock","_component_bento_checkbox","disabled","createSlots","withCtx","createTextVNode","toDisplayString","renderSlot","mergeProps","_component_error_message","createCommentVNode"],"mappings":";;;;;;;;;AAKY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,aAAA,cACAA,EAAA,WAAA,YAFQA,IAAAD,KAAA,CAAA,CAAA;ACwDR,MAAAE,IAAA,wBAqBAC,IAAAC,EAAA;AAAA,EAA+B,MAAAF;AAAA,EACrB,YAAA,EAAA,eAAAG,GAAA,eAAAC,GAAA,cAAAC,EAAA;AAAA,EACmD,OAAA,EAAA,MAAA,aAAA;AAAA,EAC7B,OAAA;AAAA;AAAA;AAAA;AAAA,IACrB,aAAA,EAAA,MAAA,QAAA,SAAA,KAAA;AAAA;AAAA;AAAA;AAAA,IAIwC,UAAA,EAAA,MAAA,SAAA,SAAA,GAAA;AAAA;AAAA;AAAA;AAAA,IAKD,cAAA,EAAA,MAAA,QAAA,SAAA,KAAA;AAAA;AAAA;AAAA;AAAA,IAKE,QAAA,EAAA,MAAA,QAAA,SAAA,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKN,UAAA,EAAA,MAAA,SAAA,SAAA,GAAA;AAAA;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AAA,cAAAA,CAAAA;AAAAA,IAIRc,EAAA,+BAAAH,EAAA,GAAAW,EAAAS,GAAA;AAAA,MAHc,KAAA;AAAA,MACX,IAAAjB,EAAA;AAAA,MACK,iBAAAA,EAAA;AAAA,MAvClB,OAAA;AAAA,IAAA,GAAA,MAAA,GAAA,CAAA,MAAA,eAAA,CAAA,KAAAkB,EAAA,IAAA,EAAA;AAAA;;;"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { B as
|
|
3
|
-
import { C as
|
|
1
|
+
import { defineComponent as Z, toRefs as D, computed as a, ref as U, onMounted as G, useAttrs as x, resolveComponent as f, createElementBlock as q, openBlock as t, mergeProps as B, createVNode as ee, createCommentVNode as n, createBlock as s, withCtx as d, createElementVNode as ae, renderSlot as E, createTextVNode as L, toDisplayString as M } from "vue";
|
|
2
|
+
import { B as oe } from "./typography.DN5eC5ch.js";
|
|
3
|
+
import { C as re } from "./checkbox-input.DFkwZ4GM.js";
|
|
4
4
|
import { C as N } from "./minus-small.DYIyF5XW.js";
|
|
5
5
|
import { u as te } from "./use-default-slot-validator.O02rzsob.js";
|
|
6
|
-
import { u as
|
|
6
|
+
import { u as le } from "./use-has-slot.B7eQSabc.js";
|
|
7
7
|
import { g as P } from "./generate-uid.NJ8tVoha.js";
|
|
8
8
|
import { g as _ } from "./get-slot-text.DQlZEsId.js";
|
|
9
|
-
import { u as
|
|
10
|
-
import { u as
|
|
11
|
-
import { B as
|
|
12
|
-
import { E as
|
|
13
|
-
import { _ as
|
|
9
|
+
import { u as ne } from "./i18n.B6g5VX0q.js";
|
|
10
|
+
import { u as se } from "./aria-label.CaUURpnB.js";
|
|
11
|
+
import { B as de } from "./tag.D3in0-Bp.js";
|
|
12
|
+
import { E as ie } from "./error-message.DHMHq9bR.js";
|
|
13
|
+
import { _ as ue } from "./_plugin-vue_export-helper.CHgC5LLL.js";
|
|
14
14
|
import "../assets/checkbox.css";
|
|
15
15
|
var i = /* @__PURE__ */ ((e) => (e.UPDATE = "update:model-value", e.INPUT = "input", e))(i || {});
|
|
16
16
|
const w = {
|
|
@@ -29,14 +29,14 @@ const w = {
|
|
|
29
29
|
optional: "opcional",
|
|
30
30
|
required: "obrigatório"
|
|
31
31
|
}
|
|
32
|
-
},
|
|
32
|
+
}, ce = Z({
|
|
33
33
|
name: "bento-checkbox",
|
|
34
34
|
i18n: { messages: w },
|
|
35
35
|
components: {
|
|
36
|
-
BentoTag:
|
|
37
|
-
BentoTypography:
|
|
38
|
-
CheckboxInput:
|
|
39
|
-
ErrorMessage:
|
|
36
|
+
BentoTag: de,
|
|
37
|
+
BentoTypography: oe,
|
|
38
|
+
CheckboxInput: re,
|
|
39
|
+
ErrorMessage: ie
|
|
40
40
|
},
|
|
41
41
|
inheritAttrs: !1,
|
|
42
42
|
model: { prop: "modelValue" },
|
|
@@ -104,69 +104,72 @@ const w = {
|
|
|
104
104
|
value: { type: [String, Number], default: null }
|
|
105
105
|
},
|
|
106
106
|
emits: [i.UPDATE, i.INPUT],
|
|
107
|
-
setup(e, { attrs:
|
|
108
|
-
const { t: y } =
|
|
109
|
-
te("bento-checkbox",
|
|
110
|
-
const
|
|
107
|
+
setup(e, { attrs: $, emit: h, slots: l }) {
|
|
108
|
+
const { t: y } = ne({ messages: w }), g = P("description"), u = P("error"), r = le(l), { disabled: c, indeterminate: v, modelValue: k, readonly: H, value: R } = D(e), V = _(l)("default"), C = _(l)("description");
|
|
109
|
+
te("bento-checkbox", l.default, l.description);
|
|
110
|
+
const p = a(() => Array.isArray(k.value)), S = a(() => p.value ? k.value.some((o) => o === R.value) : k.value), b = a(() => v.value), j = a(
|
|
111
111
|
() => !e.disabled && !e.readonly && (e.hasError || !!e.errorMessage)
|
|
112
|
-
), I = a(() => !e.disabled && !e.readonly && !!e.errorMessage), m = a(() =>
|
|
113
|
-
() => (m == null ? void 0 : m.value) && (
|
|
112
|
+
), I = a(() => !e.disabled && !e.readonly && !!e.errorMessage), m = a(() => r("content")), A = a(() => (b == null ? void 0 : b.value) || (S == null ? void 0 : S.value)), F = a(
|
|
113
|
+
() => (m == null ? void 0 : m.value) && (p == null ? void 0 : p.value) && (A == null ? void 0 : A.value)
|
|
114
114
|
), J = a(
|
|
115
|
-
() => `${I.value ? u : ""} ${
|
|
116
|
-
), O = U(
|
|
117
|
-
|
|
115
|
+
() => `${I.value ? u : ""} ${V && C ? g : ""}`.trim() || null
|
|
116
|
+
), O = U($["aria-label"]), { ariaLabel: Y } = D(e), T = U();
|
|
117
|
+
G(() => {
|
|
118
118
|
T.value = y("checkbox");
|
|
119
119
|
});
|
|
120
120
|
const z = a(
|
|
121
|
-
() =>
|
|
121
|
+
() => se({
|
|
122
122
|
ariaLabel: O.value,
|
|
123
123
|
// TODO: take this line away when the aria-label props is removed
|
|
124
124
|
label: Y,
|
|
125
|
-
defaultFallback:
|
|
125
|
+
defaultFallback: r("default") ? _(l)("default") : T.value
|
|
126
126
|
}).value
|
|
127
|
-
), K = a(() => {
|
|
128
|
-
const { style:
|
|
127
|
+
), K = (o) => o == null ? void 0 : o["aria-hidden"], Q = a(() => {
|
|
128
|
+
const { style: o, class: X } = x();
|
|
129
129
|
return {
|
|
130
|
-
class:
|
|
131
|
-
style:
|
|
130
|
+
class: X,
|
|
131
|
+
style: o
|
|
132
132
|
};
|
|
133
|
-
}),
|
|
133
|
+
}), W = a(() => ({
|
|
134
134
|
[`b-checkbox--${N.DISABLED}`]: c.value,
|
|
135
|
-
[`b-checkbox--${N.READONLY}`]:
|
|
135
|
+
[`b-checkbox--${N.READONLY}`]: H.value
|
|
136
136
|
}));
|
|
137
137
|
return {
|
|
138
138
|
// Values
|
|
139
|
-
descriptionId:
|
|
139
|
+
descriptionId: g,
|
|
140
140
|
errorId: u,
|
|
141
141
|
ariaDescribedBy: J,
|
|
142
142
|
computedAriaLabel: z,
|
|
143
|
-
conditionalClass:
|
|
144
|
-
defaultSlotValue:
|
|
143
|
+
conditionalClass: W,
|
|
144
|
+
defaultSlotValue: V,
|
|
145
145
|
descriptionSlotValue: C,
|
|
146
|
-
isIndeterminate:
|
|
147
|
-
shouldShowError:
|
|
146
|
+
isIndeterminate: b,
|
|
147
|
+
shouldShowError: j,
|
|
148
148
|
shouldShowErrorMessage: I,
|
|
149
|
-
contentSlotAvailable:
|
|
149
|
+
contentSlotAvailable: F,
|
|
150
150
|
hasContentSlot: m,
|
|
151
|
-
styleAttrs:
|
|
151
|
+
styleAttrs: Q,
|
|
152
152
|
// Methods
|
|
153
|
-
hasSlot:
|
|
154
|
-
onChange: (
|
|
155
|
-
c.value || (h(i.UPDATE,
|
|
153
|
+
hasSlot: r,
|
|
154
|
+
onChange: (o) => {
|
|
155
|
+
c.value || (h(i.UPDATE, o), h(i.INPUT, o));
|
|
156
156
|
},
|
|
157
|
+
getAriaHidden: K,
|
|
157
158
|
t: y
|
|
158
159
|
};
|
|
159
160
|
}
|
|
160
|
-
}),
|
|
161
|
+
}), pe = ["aria-hidden"], be = {
|
|
161
162
|
key: 0,
|
|
162
163
|
class: "b-checkbox__text"
|
|
163
164
|
};
|
|
164
|
-
function
|
|
165
|
-
const u = f("checkbox-input"),
|
|
166
|
-
return t(), q("label",
|
|
165
|
+
function me(e, $, h, l, y, g) {
|
|
166
|
+
const u = f("checkbox-input"), r = f("bento-typography"), c = f("bento-tag"), v = f("error-message");
|
|
167
|
+
return t(), q("label", B({
|
|
167
168
|
class: ["b-checkbox", e.conditionalClass]
|
|
168
|
-
}, e.styleAttrs
|
|
169
|
-
|
|
169
|
+
}, e.styleAttrs, {
|
|
170
|
+
"aria-hidden": e.getAriaHidden(e.$attrs)
|
|
171
|
+
}), [
|
|
172
|
+
ee(u, B(e.$attrs, {
|
|
170
173
|
ref: "input",
|
|
171
174
|
"aria-label": e.computedAriaLabel,
|
|
172
175
|
"aria-describedby": e.ariaDescribedBy,
|
|
@@ -178,18 +181,18 @@ function be(e, V, h, r, y, v) {
|
|
|
178
181
|
readonly: e.readonly,
|
|
179
182
|
"onUpdate:modelValue": e.onChange
|
|
180
183
|
}), null, 16, ["aria-label", "aria-describedby", "disabled", "has-error", "indeterminate", "value", "model-value", "readonly", "onUpdate:modelValue"]),
|
|
181
|
-
e.hasSlot("default") || e.shouldShowErrorMessage ? (t(), q("span",
|
|
182
|
-
e.hasSlot("default") ? (t(),
|
|
184
|
+
e.hasSlot("default") || e.shouldShowErrorMessage ? (t(), q("span", be, [
|
|
185
|
+
e.hasSlot("default") ? (t(), s(r, {
|
|
183
186
|
key: 0,
|
|
184
187
|
class: "b-checkbox__label",
|
|
185
188
|
el: "span",
|
|
186
189
|
variant: "body"
|
|
187
190
|
}, {
|
|
188
191
|
default: d(() => [
|
|
189
|
-
|
|
192
|
+
ae("span", null, [
|
|
190
193
|
E(e.$slots, "default", {}, void 0, !0)
|
|
191
194
|
]),
|
|
192
|
-
e.optional ? (t(),
|
|
195
|
+
e.optional ? (t(), s(r, {
|
|
193
196
|
key: 0,
|
|
194
197
|
class: "b-checkbox__label-requirement",
|
|
195
198
|
el: "span"
|
|
@@ -198,7 +201,7 @@ function be(e, V, h, r, y, v) {
|
|
|
198
201
|
L("(" + M(e.t("optional")) + ")", 1)
|
|
199
202
|
]),
|
|
200
203
|
_: 1
|
|
201
|
-
})) : e.required ? (t(),
|
|
204
|
+
})) : e.required ? (t(), s(r, {
|
|
202
205
|
key: 1,
|
|
203
206
|
class: "b-checkbox__label-requirement",
|
|
204
207
|
el: "span"
|
|
@@ -207,15 +210,15 @@ function be(e, V, h, r, y, v) {
|
|
|
207
210
|
L("(" + M(e.t("required")) + ")", 1)
|
|
208
211
|
]),
|
|
209
212
|
_: 1
|
|
210
|
-
})) :
|
|
211
|
-
e.tag ? (t(),
|
|
213
|
+
})) : n("", !0),
|
|
214
|
+
e.tag ? (t(), s(c, B({
|
|
212
215
|
key: 2,
|
|
213
216
|
class: "b-checkbox__label-tag"
|
|
214
|
-
}, e.tag), null, 16)) :
|
|
217
|
+
}, e.tag), null, 16)) : n("", !0)
|
|
215
218
|
]),
|
|
216
219
|
_: 3
|
|
217
|
-
})) :
|
|
218
|
-
e.hasSlot("default") && e.hasSlot("description") ? (t(),
|
|
220
|
+
})) : n("", !0),
|
|
221
|
+
e.hasSlot("default") && e.hasSlot("description") ? (t(), s(r, {
|
|
219
222
|
key: 1,
|
|
220
223
|
id: e.descriptionId,
|
|
221
224
|
class: "b-checkbox__description",
|
|
@@ -226,13 +229,13 @@ function be(e, V, h, r, y, v) {
|
|
|
226
229
|
E(e.$slots, "description", {}, void 0, !0)
|
|
227
230
|
]),
|
|
228
231
|
_: 3
|
|
229
|
-
}, 8, ["id"])) :
|
|
230
|
-
e.shouldShowErrorMessage ? (t(),
|
|
232
|
+
}, 8, ["id"])) : n("", !0),
|
|
233
|
+
e.shouldShowErrorMessage ? (t(), s(v, {
|
|
231
234
|
key: 2,
|
|
232
235
|
id: e.errorId,
|
|
233
236
|
"error-message": e.errorMessage
|
|
234
|
-
}, null, 8, ["id", "error-message"])) :
|
|
235
|
-
e.contentSlotAvailable ? (t(),
|
|
237
|
+
}, null, 8, ["id", "error-message"])) : n("", !0),
|
|
238
|
+
e.contentSlotAvailable ? (t(), s(r, {
|
|
236
239
|
key: 3,
|
|
237
240
|
class: "b-checkbox__content",
|
|
238
241
|
el: "span",
|
|
@@ -242,13 +245,13 @@ function be(e, V, h, r, y, v) {
|
|
|
242
245
|
E(e.$slots, "content", {}, void 0, !0)
|
|
243
246
|
]),
|
|
244
247
|
_: 3
|
|
245
|
-
})) :
|
|
246
|
-
])) :
|
|
247
|
-
], 16);
|
|
248
|
+
})) : n("", !0)
|
|
249
|
+
])) : n("", !0)
|
|
250
|
+
], 16, pe);
|
|
248
251
|
}
|
|
249
|
-
const
|
|
252
|
+
const Ie = /* @__PURE__ */ ue(ce, [["render", me], ["__scopeId", "data-v-0189caf9"]]);
|
|
250
253
|
export {
|
|
251
|
-
|
|
254
|
+
Ie as B,
|
|
252
255
|
i as a
|
|
253
256
|
};
|
|
254
|
-
//# sourceMappingURL=checkbox.
|
|
257
|
+
//# sourceMappingURL=checkbox.DGrG3GN1.js.map
|