@adyen/bento-vue3 2.1.1 → 2.2.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/bento-translation-keys.generated.d.ts +10 -0
- package/dist/@types/index.d.ts +67 -10
- package/dist/action-bar.js +1 -1
- package/dist/ai-tag.js +1 -1
- package/dist/alert.js +1 -1
- package/dist/anchor-scroller.js +1 -1
- package/dist/assets/accordion-item.css +1 -1
- package/dist/assets/action-bar.css +1 -1
- package/dist/assets/alert.css +1 -1
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/button-actions.css +1 -1
- package/dist/assets/button.css +1 -1
- package/dist/assets/card.css +1 -1
- package/dist/assets/checkbox-input.css +1 -1
- package/dist/assets/dashboard-section.css +1 -1
- package/dist/assets/data-grid.css +1 -1
- package/dist/assets/date-filter.css +1 -0
- package/dist/assets/date-range-filter.css +1 -0
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/draggable-handle.css +1 -1
- package/dist/assets/dropdown.css +1 -1
- package/dist/assets/file-uploader.css +1 -1
- package/dist/assets/filter-bar.css +1 -1
- package/dist/assets/fixed-scroller.css +1 -1
- package/dist/assets/form-layout-title.css +1 -1
- package/dist/assets/grid-layout.css +1 -1
- package/dist/assets/input-field.css +1 -1
- package/dist/assets/input-with-dropdown-filter.css +1 -0
- package/dist/assets/inspector.css +1 -1
- package/dist/assets/modal-fullscreen.css +1 -1
- package/dist/assets/navigation-menu-group.css +1 -1
- package/dist/assets/pagination.css +1 -1
- package/dist/assets/secondary-nav.css +1 -1
- package/dist/assets/sidepanel.css +1 -1
- package/dist/assets/table-of-contents.css +1 -1
- package/dist/assets/textarea.css +1 -1
- package/dist/assets/timeline-item.css +1 -1
- package/dist/assets/toggle.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.C6XFuiE0.js → action-bar.BIidNGlt.js} +3 -3
- package/dist/chunks/{action-bar.C6XFuiE0.js.map → action-bar.BIidNGlt.js.map} +1 -1
- package/dist/chunks/{ai-tag.BLDTP7fs.js → ai-tag.B1YHMfAh.js} +2 -2
- package/dist/chunks/{ai-tag.BLDTP7fs.js.map → ai-tag.B1YHMfAh.js.map} +1 -1
- package/dist/chunks/{alert.BYmn1ewo.js → alert.PGzfyHZI.js} +80 -98
- package/dist/chunks/alert.PGzfyHZI.js.map +1 -0
- package/dist/chunks/{anchor-scroller.B35-JMuH.js → anchor-scroller.CSOg3htL.js} +2 -2
- package/dist/chunks/{anchor-scroller.B35-JMuH.js.map → anchor-scroller.CSOg3htL.js.map} +1 -1
- package/dist/chunks/{base-modal.CulokESn.js → base-modal.A52tojyk.js} +5 -5
- package/dist/chunks/{base-modal.CulokESn.js.map → base-modal.A52tojyk.js.map} +1 -1
- package/dist/chunks/{button-actions-with-menu.BsCmJeKU.js → button-actions-with-menu.DkPSfKO9.js} +2 -2
- package/dist/chunks/{button-actions-with-menu.BsCmJeKU.js.map → button-actions-with-menu.DkPSfKO9.js.map} +1 -1
- package/dist/chunks/{button-actions.DvuGEQxM.js → button-actions.BYoctIth.js} +2 -2
- package/dist/chunks/button-actions.BYoctIth.js.map +1 -0
- package/dist/chunks/{calendar.CycKx_P3.js → calendar.BhoyTBN1.js} +18 -18
- package/dist/chunks/{calendar.CycKx_P3.js.map → calendar.BhoyTBN1.js.map} +1 -1
- package/dist/chunks/{card.OErI_R47.js → card.DL3-xIH9.js} +3 -3
- package/dist/chunks/{card.OErI_R47.js.map → card.DL3-xIH9.js.map} +1 -1
- package/dist/chunks/{checkbox-group.Bcy98dh8.js → checkbox-group.993HE54c.js} +3 -3
- package/dist/chunks/{checkbox-group.Bcy98dh8.js.map → checkbox-group.993HE54c.js.map} +1 -1
- package/dist/chunks/{checkbox.BN7ttBqd.js → checkbox.DpT4DfSl.js} +14 -14
- package/dist/chunks/{checkbox.BN7ttBqd.js.map → checkbox.DpT4DfSl.js.map} +1 -1
- package/dist/chunks/{code-snippet.3u22Ij2R.js → code-snippet.8XinCILe.js} +4 -4
- package/dist/chunks/{code-snippet.3u22Ij2R.js.map → code-snippet.8XinCILe.js.map} +1 -1
- package/dist/chunks/{controls-group.CC3yZiTT.js → controls-group.BcbFbqr-.js} +2 -2
- package/dist/chunks/{controls-group.CC3yZiTT.js.map → controls-group.BcbFbqr-.js.map} +1 -1
- package/dist/chunks/{copy.YBeE8V9S.js → copy.DrHbwkFX.js} +3 -3
- package/dist/chunks/{copy.YBeE8V9S.js.map → copy.DrHbwkFX.js.map} +1 -1
- package/dist/chunks/{dashboard-section.CjC3fVU6.js → dashboard-section.CVDLs9xL.js} +4 -4
- package/dist/chunks/dashboard-section.CVDLs9xL.js.map +1 -0
- package/dist/chunks/{dashed-underline.DAtZOaad.js → dashed-underline.BH4vfrBh.js} +3 -3
- package/dist/chunks/{dashed-underline.DAtZOaad.js.map → dashed-underline.BH4vfrBh.js.map} +1 -1
- package/dist/chunks/{data-grid-template.bPjGSga2.js → data-grid-template.5keqokzt.js} +4 -4
- package/dist/chunks/{data-grid-template.bPjGSga2.js.map → data-grid-template.5keqokzt.js.map} +1 -1
- package/dist/chunks/{data-grid.DYNep9mz.js → data-grid.DP4VPyjR.js} +20 -20
- package/dist/chunks/{data-grid.DYNep9mz.js.map → data-grid.DP4VPyjR.js.map} +1 -1
- package/dist/chunks/date-filter.EysjbedJ.js +156 -0
- package/dist/chunks/date-filter.EysjbedJ.js.map +1 -0
- package/dist/chunks/{date-picker.DjLNf7fF.js → date-picker.CQ3eoDIo.js} +10 -10
- package/dist/chunks/{date-picker.DjLNf7fF.js.map → date-picker.CQ3eoDIo.js.map} +1 -1
- package/dist/chunks/date-range-filter.DwNzkqTo.js +949 -0
- package/dist/chunks/date-range-filter.DwNzkqTo.js.map +1 -0
- package/dist/chunks/{date-range-picker.CI5hBzgs.js → date-range-picker.BYGk8uh-.js} +60 -60
- package/dist/chunks/{date-range-picker.CI5hBzgs.js.map → date-range-picker.BYGk8uh-.js.map} +1 -1
- package/dist/chunks/{draggable-handle.CKkSJP0K.js → draggable-handle.D6rFbf1V.js} +2 -2
- package/dist/chunks/{draggable-handle.CKkSJP0K.js.map → draggable-handle.D6rFbf1V.js.map} +1 -1
- package/dist/chunks/{draggable.jzTSFcM7.js → draggable.DH-Wc8GI.js} +2 -2
- package/dist/chunks/{draggable.jzTSFcM7.js.map → draggable.DH-Wc8GI.js.map} +1 -1
- package/dist/chunks/{dropdown-tag.GOcJPx20.js → dropdown-tag.DQ_BcUK7.js} +3 -3
- package/dist/chunks/{dropdown-tag.GOcJPx20.js.map → dropdown-tag.DQ_BcUK7.js.map} +1 -1
- package/dist/chunks/{dropdown.BvrZG8Za.js → dropdown.BJ0cJ9Ea.js} +1471 -1384
- package/dist/chunks/dropdown.BJ0cJ9Ea.js.map +1 -0
- package/dist/chunks/{empty-state.BuK12EGe.js → empty-state.CECdMida.js} +2 -2
- package/dist/chunks/{empty-state.BuK12EGe.js.map → empty-state.CECdMida.js.map} +1 -1
- package/dist/chunks/{field-label.vrUwhoOg.js → field-label.Dm9I8IDI.js} +2 -2
- package/dist/chunks/{field-label.vrUwhoOg.js.map → field-label.Dm9I8IDI.js.map} +1 -1
- package/dist/chunks/{file-uploader.Cv8sm0Jd.js → file-uploader.B8c3MlBD.js} +7 -6
- package/dist/chunks/{file-uploader.Cv8sm0Jd.js.map → file-uploader.B8c3MlBD.js.map} +1 -1
- package/dist/chunks/filter-bar.BPPxuT_w.js +2552 -0
- package/dist/chunks/filter-bar.BPPxuT_w.js.map +1 -0
- package/dist/chunks/{fixed-scroller.C0nVzRBU.js → fixed-scroller.nECGGyOp.js} +15 -15
- package/dist/chunks/{fixed-scroller.C0nVzRBU.js.map → fixed-scroller.nECGGyOp.js.map} +1 -1
- package/dist/chunks/{focus-trap.Co-S6goa.js → focus-trap.BgyHTR_3.js} +1 -2
- package/dist/chunks/{focus-trap.Co-S6goa.js.map → focus-trap.BgyHTR_3.js.map} +1 -1
- package/dist/chunks/{footer-actions.BJif4sIk.js → footer-actions.B2dxp-b_.js} +2 -2
- package/dist/chunks/{footer-actions.BJif4sIk.js.map → footer-actions.B2dxp-b_.js.map} +1 -1
- package/dist/chunks/{form-layout-title.C7f1ByNh.js → form-layout-title.h-7dMAq7.js} +2 -2
- package/dist/chunks/{form-layout-title.C7f1ByNh.js.map → form-layout-title.h-7dMAq7.js.map} +1 -1
- package/dist/chunks/grid-layout.BuhsC4WZ.js +115 -0
- package/dist/chunks/grid-layout.BuhsC4WZ.js.map +1 -0
- package/dist/chunks/{header-with-views.LJ3oCsMN.js → header-with-views.Bux_-bM4.js} +308 -308
- package/dist/chunks/{header-with-views.LJ3oCsMN.js.map → header-with-views.Bux_-bM4.js.map} +1 -1
- package/dist/chunks/{header.E-KFjIG7.js → header.BEnZbxIA.js} +4 -4
- package/dist/chunks/{header.E-KFjIG7.js.map → header.BEnZbxIA.js.map} +1 -1
- package/dist/chunks/{info-icon-with-popover.DqnQnwMI.js → info-icon-with-popover.BRl6sC0B.js} +3 -3
- package/dist/chunks/{info-icon-with-popover.DqnQnwMI.js.map → info-icon-with-popover.BRl6sC0B.js.map} +1 -1
- package/dist/chunks/{info-icon.D_zu5SYT.js → info-icon.CcM7z-CY.js} +3 -3
- package/dist/chunks/{info-icon.D_zu5SYT.js.map → info-icon.CcM7z-CY.js.map} +1 -1
- package/dist/chunks/{input-field-password.CFBPscot.js → input-field-password.0W7vePC4.js} +4 -4
- package/dist/chunks/{input-field-password.CFBPscot.js.map → input-field-password.0W7vePC4.js.map} +1 -1
- package/dist/chunks/{input-field-phone-number.BNAKRBLr.js → input-field-phone-number.RblgK9OP.js} +2 -2
- package/dist/chunks/{input-field-phone-number.BNAKRBLr.js.map → input-field-phone-number.RblgK9OP.js.map} +1 -1
- package/dist/chunks/{input-field.BBSr4o-k.js → input-field.B-Nta-en.js} +3 -3
- package/dist/chunks/{input-field.BBSr4o-k.js.map → input-field.B-Nta-en.js.map} +1 -1
- package/dist/chunks/{input-time.Cdz9Jb-1.js → input-time.CMKTGRcV.js} +3 -3
- package/dist/chunks/{input-time.Cdz9Jb-1.js.map → input-time.CMKTGRcV.js.map} +1 -1
- package/dist/chunks/input-with-dropdown-filter.DXnJOBf6.js +100 -0
- package/dist/chunks/input-with-dropdown-filter.DXnJOBf6.js.map +1 -0
- package/dist/chunks/{inspector-page.DNsc0lK1.js → inspector-page.Bd39LxR2.js} +2 -2
- package/dist/chunks/{inspector-page.DNsc0lK1.js.map → inspector-page.Bd39LxR2.js.map} +1 -1
- package/dist/chunks/{inspector.BLAqbhmV.js → inspector.SmoWfjqp.js} +2 -2
- package/dist/chunks/{inspector.BLAqbhmV.js.map → inspector.SmoWfjqp.js.map} +1 -1
- package/dist/chunks/{list-item.RuGQ8Y4T.js → list-item.CoDag_QY.js} +3 -3
- package/dist/chunks/{list-item.RuGQ8Y4T.js.map → list-item.CoDag_QY.js.map} +1 -1
- package/dist/chunks/{listbox-option-tag.71rmQvG8.js → listbox-option-tag.Bhyu9LpW.js} +2 -2
- package/dist/chunks/{listbox-option-tag.71rmQvG8.js.map → listbox-option-tag.Bhyu9LpW.js.map} +1 -1
- package/dist/chunks/{modal-fullscreen.jXJnaueu.js → modal-fullscreen.D-ws4648.js} +3 -3
- package/dist/chunks/{modal-fullscreen.jXJnaueu.js.map → modal-fullscreen.D-ws4648.js.map} +1 -1
- package/dist/chunks/{modal.vue_vue_type_script_setup_true_lang.BwmYlzFm.js → modal.vue_vue_type_script_setup_true_lang.DkjMGIP8.js} +4 -4
- package/dist/chunks/{modal.vue_vue_type_script_setup_true_lang.BwmYlzFm.js.map → modal.vue_vue_type_script_setup_true_lang.DkjMGIP8.js.map} +1 -1
- package/dist/chunks/{navigation-menu-group.BnS0isK8.js → navigation-menu-group.BlkhBGX3.js} +2 -2
- package/dist/chunks/{navigation-menu-group.BnS0isK8.js.map → navigation-menu-group.BlkhBGX3.js.map} +1 -1
- package/dist/chunks/{pagination.DbGaudSO.js → pagination.CyqfmV_-.js} +4 -4
- package/dist/chunks/{pagination.DbGaudSO.js.map → pagination.CyqfmV_-.js.map} +1 -1
- package/dist/chunks/popover.types.CXIAfp1m.js +6 -0
- package/dist/chunks/{popover.types.dhllh3NP.js.map → popover.types.CXIAfp1m.js.map} +1 -1
- package/dist/chunks/{popper-container.Rfj8UdMD.js → popper-container.lfk_dyZi.js} +2 -2
- package/dist/chunks/{popper-container.Rfj8UdMD.js.map → popper-container.lfk_dyZi.js.map} +1 -1
- package/dist/chunks/promo-banner.3d1DHWas.js.map +1 -1
- package/dist/chunks/{radio-group.BTI_2U11.js → radio-group.DGwM-ijw.js} +3 -3
- package/dist/chunks/{radio-group.BTI_2U11.js.map → radio-group.DGwM-ijw.js.map} +1 -1
- package/dist/chunks/{rich-text-editor.CjbYg6ee.js → rich-text-editor.7qlWY3xz.js} +5 -5
- package/dist/chunks/{rich-text-editor.CjbYg6ee.js.map → rich-text-editor.7qlWY3xz.js.map} +1 -1
- package/dist/chunks/{search-bar.D8LwiALL.js → search-bar.BRMyMzkF.js} +3 -3
- package/dist/chunks/{search-bar.D8LwiALL.js.map → search-bar.BRMyMzkF.js.map} +1 -1
- package/dist/chunks/{secondary-nav.CWZFULKD.js → secondary-nav.BbBhe7QI.js} +3 -3
- package/dist/chunks/{secondary-nav.CWZFULKD.js.map → secondary-nav.BbBhe7QI.js.map} +1 -1
- package/dist/chunks/{segmented-control.CarI0i3p.js → segmented-control.BTILFbBW.js} +2 -2
- package/dist/chunks/{segmented-control.CarI0i3p.js.map → segmented-control.BTILFbBW.js.map} +1 -1
- package/dist/chunks/select-avatar-filter.DdOdBb0C.js +55 -0
- package/dist/chunks/select-avatar-filter.DdOdBb0C.js.map +1 -0
- package/dist/chunks/select-country-filter.D-zpTtKe.js +56 -0
- package/dist/chunks/select-country-filter.D-zpTtKe.js.map +1 -0
- package/dist/chunks/select-currency-filter.BitX4BCE.js +91 -0
- package/dist/chunks/select-currency-filter.BitX4BCE.js.map +1 -0
- package/dist/chunks/select-payment-method-filter.BiZuCZOa.js +55 -0
- package/dist/chunks/select-payment-method-filter.BiZuCZOa.js.map +1 -0
- package/dist/chunks/select-tag-filter.BUIIqK0l.js +63 -0
- package/dist/chunks/select-tag-filter.BUIIqK0l.js.map +1 -0
- package/dist/chunks/{selection-card-group.Covrf9mH.js → selection-card-group.mCAfzxrB.js} +11 -11
- package/dist/chunks/{selection-card-group.Covrf9mH.js.map → selection-card-group.mCAfzxrB.js.map} +1 -1
- package/dist/chunks/{sidepanel.CYWPV9dE.js → sidepanel.amz6_quV.js} +12 -12
- package/dist/chunks/sidepanel.amz6_quV.js.map +1 -0
- package/dist/chunks/{structured-list-item.C6SAUS9a.js → structured-list-item.Br6cAwZk.js} +4 -4
- package/dist/chunks/{structured-list-item.C6SAUS9a.js.map → structured-list-item.Br6cAwZk.js.map} +1 -1
- package/dist/chunks/{summary-grid.types.FTWeUNFh.js → summary-grid.types.DUEiCht4.js} +6 -6
- package/dist/chunks/{summary-grid.types.FTWeUNFh.js.map → summary-grid.types.DUEiCht4.js.map} +1 -1
- package/dist/chunks/{tab.CwXAsp9E.js → tab.Df1c3HPX.js} +3 -3
- package/dist/chunks/{tab.CwXAsp9E.js.map → tab.Df1c3HPX.js.map} +1 -1
- package/dist/chunks/{tag.BYxa556o.js → tag.Cg3joxK_.js} +2 -2
- package/dist/chunks/{tag.BYxa556o.js.map → tag.Cg3joxK_.js.map} +1 -1
- package/dist/chunks/{textarea.D4aMdmDx.js → textarea.ClWTwdJT.js} +2 -2
- package/dist/chunks/{textarea.D4aMdmDx.js.map → textarea.ClWTwdJT.js.map} +1 -1
- package/dist/chunks/{timeline-item.De8HCoYw.js → timeline-item.CdOFw-Jn.js} +144 -132
- package/dist/chunks/timeline-item.CdOFw-Jn.js.map +1 -0
- package/dist/chunks/{title-details.8cyCeaLf.js → title-details.Ccs_ltkI.js} +2 -2
- package/dist/chunks/{title-details.8cyCeaLf.js.map → title-details.Ccs_ltkI.js.map} +1 -1
- package/dist/chunks/{tooltip.0QqJo2sa.js → tooltip.B8LTTssT.js} +3 -3
- package/dist/chunks/{tooltip.0QqJo2sa.js.map → tooltip.B8LTTssT.js.map} +1 -1
- package/dist/chunks/{tutorial.vue_vue_type_script_setup_true_lang.Dn4toWHY.js → tutorial.vue_vue_type_script_setup_true_lang.CpzGxsmy.js} +4 -4
- package/dist/chunks/{tutorial.vue_vue_type_script_setup_true_lang.Dn4toWHY.js.map → tutorial.vue_vue_type_script_setup_true_lang.CpzGxsmy.js.map} +1 -1
- package/dist/chunks/typography.B6elnWpr.js.map +1 -1
- package/dist/chunks/{use-date-input-formatter.deZ3kB0L.js → use-date-input-formatter.COZBxMaZ.js} +2 -2
- package/dist/chunks/{use-date-input-formatter.deZ3kB0L.js.map → use-date-input-formatter.COZBxMaZ.js.map} +1 -1
- package/dist/chunks/warning-filled.Bzh3ib0x.js +25 -0
- package/dist/chunks/warning-filled.Bzh3ib0x.js.map +1 -0
- package/dist/code-snippet.js +1 -1
- package/dist/dashboard-template.js +1 -1
- package/dist/dashed-underline.js +1 -1
- package/dist/data-grid-template.js +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/date-picker.js +2 -2
- package/dist/date-range-picker.js +2 -2
- package/dist/date-time-picker.js +4 -4
- package/dist/draggable.js +2 -2
- package/dist/dropdown.js +2 -2
- package/dist/empty-state.js +1 -1
- package/dist/file-uploader.js +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/focus-trap.js +1 -1
- package/dist/form-layout.js +1 -1
- package/dist/header-with-views.js +1 -1
- package/dist/header.js +1 -1
- package/dist/index.js +257 -257
- package/dist/info-icon.js +1 -1
- package/dist/input-field-password.js +1 -1
- package/dist/input-field-phone-number.js +1 -1
- package/dist/input-field.js +1 -1
- package/dist/input-time.js +1 -1
- package/dist/inspector.js +2 -2
- package/dist/internal.js +13 -13
- package/dist/list.js +1 -1
- package/dist/menu.js +1 -1
- package/dist/modal-fullscreen.js +1 -1
- package/dist/modal.js +2 -2
- package/dist/navigation-menu.js +1 -1
- package/dist/pagination.js +1 -1
- package/dist/popover.js +2 -2
- package/dist/popper-container.js +1 -1
- package/dist/progress-bar.js +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/rich-text-editor.js +1 -1
- package/dist/search-bar.js +2 -2
- package/dist/secondary-nav.js +1 -1
- package/dist/segmented-control.js +1 -1
- package/dist/selection-card.js +1 -1
- package/dist/sidepanel.js +1 -1
- package/dist/structured-list.js +1 -1
- package/dist/summary-grid.js +1 -1
- package/dist/tabs.js +1 -1
- package/dist/tag.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 +4 -4
- package/dist/chunks/alert.BYmn1ewo.js.map +0 -1
- package/dist/chunks/button-actions.DvuGEQxM.js.map +0 -1
- package/dist/chunks/dashboard-section.CjC3fVU6.js.map +0 -1
- package/dist/chunks/dropdown.BvrZG8Za.js.map +0 -1
- package/dist/chunks/filter-bar.DrOXGxUc.js +0 -3974
- package/dist/chunks/filter-bar.DrOXGxUc.js.map +0 -1
- package/dist/chunks/grid-layout.CCWNscU_.js +0 -113
- package/dist/chunks/grid-layout.CCWNscU_.js.map +0 -1
- package/dist/chunks/popover.types.dhllh3NP.js +0 -6
- package/dist/chunks/sidepanel.CYWPV9dE.js.map +0 -1
- package/dist/chunks/timeline-item.De8HCoYw.js.map +0 -1
|
@@ -8,7 +8,7 @@ import { B as k } from "./typography.B6elnWpr.js";
|
|
|
8
8
|
import { _ as F } from "./refresh.DjN1EulV.js";
|
|
9
9
|
import { u as $ } from "./index.CGBfMQdv.js";
|
|
10
10
|
import { u as G } from "./use-dynamic-date-fns-locale._EtEeU3i.js";
|
|
11
|
-
import { a as J } from "./button-actions.
|
|
11
|
+
import { a as J } from "./button-actions.BYoctIth.js";
|
|
12
12
|
import { _ as P } from "./_plugin-vue_export-helper.CHgC5LLL.js";
|
|
13
13
|
import "../assets/title-details.css";
|
|
14
14
|
function q(s, o) {
|
|
@@ -141,4 +141,4 @@ const z = {
|
|
|
141
141
|
export {
|
|
142
142
|
ht as T
|
|
143
143
|
};
|
|
144
|
-
//# sourceMappingURL=title-details.
|
|
144
|
+
//# sourceMappingURL=title-details.Ccs_ltkI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"title-details.8cyCeaLf.js","sources":["../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInMilliseconds.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInSeconds.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/formatDistance.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/formatDistanceToNow.js","../../../vue2/src/components/internal/title-details/title-details.vue"],"sourcesContent":["import { toDate } from \"./toDate.js\";\n\n/**\n * @name differenceInMilliseconds\n * @category Millisecond Helpers\n * @summary Get the number of milliseconds between the given dates.\n *\n * @description\n * Get the number of milliseconds between the given dates.\n *\n * @param laterDate - The later date\n * @param earlierDate - The earlier date\n *\n * @returns The number of milliseconds\n *\n * @example\n * // How many milliseconds are between\n * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?\n * const result = differenceInMilliseconds(\n * new Date(2014, 6, 2, 12, 30, 21, 700),\n * new Date(2014, 6, 2, 12, 30, 20, 600)\n * )\n * //=> 1100\n */\nexport function differenceInMilliseconds(laterDate, earlierDate) {\n return +toDate(laterDate) - +toDate(earlierDate);\n}\n\n// Fallback for modularized imports:\nexport default differenceInMilliseconds;\n","import { getRoundingMethod } from \"./_lib/getRoundingMethod.js\";\nimport { differenceInMilliseconds } from \"./differenceInMilliseconds.js\";\n\n/**\n * The {@link differenceInSeconds} function options.\n */\n\n/**\n * @name differenceInSeconds\n * @category Second Helpers\n * @summary Get the number of seconds between the given dates.\n *\n * @description\n * Get the number of seconds between the given dates.\n *\n * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - An object with options.\n *\n * @returns The number of seconds\n *\n * @example\n * // How many seconds are between\n * // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?\n * const result = differenceInSeconds(\n * new Date(2014, 6, 2, 12, 30, 20, 0),\n * new Date(2014, 6, 2, 12, 30, 7, 999)\n * )\n * //=> 12\n */\nexport function differenceInSeconds(laterDate, earlierDate, options) {\n const diff = differenceInMilliseconds(laterDate, earlierDate) / 1000;\n return getRoundingMethod(options?.roundingMethod)(diff);\n}\n\n// Fallback for modularized imports:\nexport default differenceInSeconds;\n","import { defaultLocale } from \"./_lib/defaultLocale.js\";\nimport { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { getTimezoneOffsetInMilliseconds } from \"./_lib/getTimezoneOffsetInMilliseconds.js\";\nimport { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { compareAsc } from \"./compareAsc.js\";\nimport { minutesInDay, minutesInMonth } from \"./constants.js\";\nimport { differenceInMonths } from \"./differenceInMonths.js\";\nimport { differenceInSeconds } from \"./differenceInSeconds.js\";\n\n/**\n * The {@link formatDistance} function options.\n */\n\n/**\n * @name formatDistance\n * @category Common Helpers\n * @summary Return the distance between the given dates in words.\n *\n * @description\n * Return the distance between the given dates in words.\n *\n * | Distance between dates | Result |\n * |-------------------------------------------------------------------|---------------------|\n * | 0 ... 30 secs | less than a minute |\n * | 30 secs ... 1 min 30 secs | 1 minute |\n * | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |\n * | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |\n * | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |\n * | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |\n * | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |\n * | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |\n * | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |\n * | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |\n * | 1 yr ... 1 yr 3 months | about 1 year |\n * | 1 yr 3 months ... 1 yr 9 month s | over 1 year |\n * | 1 yr 9 months ... 2 yrs | almost 2 years |\n * | N yrs ... N yrs 3 months | about N years |\n * | N yrs 3 months ... N yrs 9 months | over N years |\n * | N yrs 9 months ... N+1 yrs | almost N+1 years |\n *\n * With `options.includeSeconds == true`:\n * | Distance between dates | Result |\n * |------------------------|----------------------|\n * | 0 secs ... 5 secs | less than 5 seconds |\n * | 5 secs ... 10 secs | less than 10 seconds |\n * | 10 secs ... 20 secs | less than 20 seconds |\n * | 20 secs ... 40 secs | half a minute |\n * | 40 secs ... 60 secs | less than a minute |\n * | 60 secs ... 90 secs | 1 minute |\n *\n * @param laterDate - The date\n * @param earlierDate - The date to compare with\n * @param options - An object with options\n *\n * @returns The distance in words\n *\n * @throws `date` must not be Invalid Date\n * @throws `baseDate` must not be Invalid Date\n * @throws `options.locale` must contain `formatDistance` property\n *\n * @example\n * // What is the distance between 2 July 2014 and 1 January 2015?\n * const result = formatDistance(new Date(2014, 6, 2), new Date(2015, 0, 1))\n * //=> '6 months'\n *\n * @example\n * // What is the distance between 1 January 2015 00:00:15\n * // and 1 January 2015 00:00:00, including seconds?\n * const result = formatDistance(\n * new Date(2015, 0, 1, 0, 0, 15),\n * new Date(2015, 0, 1, 0, 0, 0),\n * { includeSeconds: true }\n * )\n * //=> 'less than 20 seconds'\n *\n * @example\n * // What is the distance from 1 January 2016\n * // to 1 January 2015, with a suffix?\n * const result = formatDistance(new Date(2015, 0, 1), new Date(2016, 0, 1), {\n * addSuffix: true\n * })\n * //=> 'about 1 year ago'\n *\n * @example\n * // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = formatDistance(new Date(2016, 7, 1), new Date(2015, 0, 1), {\n * locale: eoLocale\n * })\n * //=> 'pli ol 1 jaro'\n */\nexport function formatDistance(laterDate, earlierDate, options) {\n const defaultOptions = getDefaultOptions();\n const locale = options?.locale ?? defaultOptions.locale ?? defaultLocale;\n const minutesInAlmostTwoDays = 2520;\n\n const comparison = compareAsc(laterDate, earlierDate);\n\n if (isNaN(comparison)) throw new RangeError(\"Invalid time value\");\n\n const localizeOptions = Object.assign({}, options, {\n addSuffix: options?.addSuffix,\n comparison: comparison,\n });\n\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n ...(comparison > 0 ? [earlierDate, laterDate] : [laterDate, earlierDate]),\n );\n\n const seconds = differenceInSeconds(earlierDate_, laterDate_);\n const offsetInSeconds =\n (getTimezoneOffsetInMilliseconds(earlierDate_) -\n getTimezoneOffsetInMilliseconds(laterDate_)) /\n 1000;\n const minutes = Math.round((seconds - offsetInSeconds) / 60);\n let months;\n\n // 0 up to 2 mins\n if (minutes < 2) {\n if (options?.includeSeconds) {\n if (seconds < 5) {\n return locale.formatDistance(\"lessThanXSeconds\", 5, localizeOptions);\n } else if (seconds < 10) {\n return locale.formatDistance(\"lessThanXSeconds\", 10, localizeOptions);\n } else if (seconds < 20) {\n return locale.formatDistance(\"lessThanXSeconds\", 20, localizeOptions);\n } else if (seconds < 40) {\n return locale.formatDistance(\"halfAMinute\", 0, localizeOptions);\n } else if (seconds < 60) {\n return locale.formatDistance(\"lessThanXMinutes\", 1, localizeOptions);\n } else {\n return locale.formatDistance(\"xMinutes\", 1, localizeOptions);\n }\n } else {\n if (minutes === 0) {\n return locale.formatDistance(\"lessThanXMinutes\", 1, localizeOptions);\n } else {\n return locale.formatDistance(\"xMinutes\", minutes, localizeOptions);\n }\n }\n\n // 2 mins up to 0.75 hrs\n } else if (minutes < 45) {\n return locale.formatDistance(\"xMinutes\", minutes, localizeOptions);\n\n // 0.75 hrs up to 1.5 hrs\n } else if (minutes < 90) {\n return locale.formatDistance(\"aboutXHours\", 1, localizeOptions);\n\n // 1.5 hrs up to 24 hrs\n } else if (minutes < minutesInDay) {\n const hours = Math.round(minutes / 60);\n return locale.formatDistance(\"aboutXHours\", hours, localizeOptions);\n\n // 1 day up to 1.75 days\n } else if (minutes < minutesInAlmostTwoDays) {\n return locale.formatDistance(\"xDays\", 1, localizeOptions);\n\n // 1.75 days up to 30 days\n } else if (minutes < minutesInMonth) {\n const days = Math.round(minutes / minutesInDay);\n return locale.formatDistance(\"xDays\", days, localizeOptions);\n\n // 1 month up to 2 months\n } else if (minutes < minutesInMonth * 2) {\n months = Math.round(minutes / minutesInMonth);\n return locale.formatDistance(\"aboutXMonths\", months, localizeOptions);\n }\n\n months = differenceInMonths(earlierDate_, laterDate_);\n\n // 2 months up to 12 months\n if (months < 12) {\n const nearestMonth = Math.round(minutes / minutesInMonth);\n return locale.formatDistance(\"xMonths\", nearestMonth, localizeOptions);\n\n // 1 year up to max Date\n } else {\n const monthsSinceStartOfYear = months % 12;\n const years = Math.trunc(months / 12);\n\n // N years up to 1 years 3 months\n if (monthsSinceStartOfYear < 3) {\n return locale.formatDistance(\"aboutXYears\", years, localizeOptions);\n\n // N years 3 months up to N years 9 months\n } else if (monthsSinceStartOfYear < 9) {\n return locale.formatDistance(\"overXYears\", years, localizeOptions);\n\n // N years 9 months up to N year 12 months\n } else {\n return locale.formatDistance(\"almostXYears\", years + 1, localizeOptions);\n }\n }\n}\n\n// Fallback for modularized imports:\nexport default formatDistance;\n","import { constructNow } from \"./constructNow.js\";\n\nimport { formatDistance } from \"./formatDistance.js\";\n\n/**\n * The {@link formatDistanceToNow} function options.\n */\n\n/**\n * @name formatDistanceToNow\n * @category Common Helpers\n * @summary Return the distance between the given date and now in words.\n * @pure false\n *\n * @description\n * Return the distance between the given date and now in words.\n *\n * | Distance to now | Result |\n * |-------------------------------------------------------------------|---------------------|\n * | 0 ... 30 secs | less than a minute |\n * | 30 secs ... 1 min 30 secs | 1 minute |\n * | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |\n * | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |\n * | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |\n * | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |\n * | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |\n * | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |\n * | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |\n * | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |\n * | 1 yr ... 1 yr 3 months | about 1 year |\n * | 1 yr 3 months ... 1 yr 9 month s | over 1 year |\n * | 1 yr 9 months ... 2 yrs | almost 2 years |\n * | N yrs ... N yrs 3 months | about N years |\n * | N yrs 3 months ... N yrs 9 months | over N years |\n * | N yrs 9 months ... N+1 yrs | almost N+1 years |\n *\n * With `options.includeSeconds == true`:\n * | Distance to now | Result |\n * |---------------------|----------------------|\n * | 0 secs ... 5 secs | less than 5 seconds |\n * | 5 secs ... 10 secs | less than 10 seconds |\n * | 10 secs ... 20 secs | less than 20 seconds |\n * | 20 secs ... 40 secs | half a minute |\n * | 40 secs ... 60 secs | less than a minute |\n * | 60 secs ... 90 secs | 1 minute |\n *\n * @param date - The given date\n * @param options - The object with options\n *\n * @returns The distance in words\n *\n * @throws `date` must not be Invalid Date\n * @throws `options.locale` must contain `formatDistance` property\n *\n * @example\n * // If today is 1 January 2015, what is the distance to 2 July 2014?\n * const result = formatDistanceToNow(\n * new Date(2014, 6, 2)\n * )\n * //=> '6 months'\n *\n * @example\n * // If now is 1 January 2015 00:00:00,\n * // what is the distance to 1 January 2015 00:00:15, including seconds?\n * const result = formatDistanceToNow(\n * new Date(2015, 0, 1, 0, 0, 15),\n * {includeSeconds: true}\n * )\n * //=> 'less than 20 seconds'\n *\n * @example\n * // If today is 1 January 2015,\n * // what is the distance to 1 January 2016, with a suffix?\n * const result = formatDistanceToNow(\n * new Date(2016, 0, 1),\n * {addSuffix: true}\n * )\n * //=> 'in about 1 year'\n *\n * @example\n * // If today is 1 January 2015,\n * // what is the distance to 1 August 2016 in Esperanto?\n * const eoLocale = require('date-fns/locale/eo')\n * const result = formatDistanceToNow(\n * new Date(2016, 7, 1),\n * {locale: eoLocale}\n * )\n * //=> 'pli ol 1 jaro'\n */\nexport function formatDistanceToNow(date, options) {\n return formatDistance(date, constructNow(date), options);\n}\n\n// Fallback for modularized imports:\nexport default formatDistanceToNow;\n","<template>\n <div class=\"b-title-details__container\">\n <bento-typography v-if=\"description || hasSlot('description')\" class=\"b-title-details__description\" el=\"div\">\n <slot name=\"description\">{{ description }}</slot>\n </bento-typography>\n <div v-if=\"lastUpdatedDate\" class=\"b-title-details__timestamp-section\">\n <bento-typography class=\"b-title-details__timestamp\" el=\"div\">\n <time :datetime=\"lastUpdatedDateTime\">{{ timestamp }}</time>\n </bento-typography>\n <bento-loading-button\n v-if=\"reloadButton\"\n variant=\"tertiary\"\n :state=\"reloadButton.state\"\n @click=\"reloadButton.event\"\n ><template #iconLeft><reload-icon aria-hidden=\"true\" /></template\n >{{ reloadButton.title }}</bento-loading-button\n >\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, useSlots } from 'vue';\n import { useDynamicDateFnsLocale, useHasSlot } from '@/composables';\n import { formatDistanceToNow } from 'date-fns/formatDistanceToNow';\n import { BentoTypography } from '@/components/typography';\n import { BentoLoadingButton } from '@/components/button';\n import ReloadIcon from '@adyen/ui-assets-icons-16/vue/refresh';\n import { useI18n } from '@/utils/ts/i18n';\n import type { TitleDetailsProps } from './title-details.types';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const { t, locale } = useI18n<{ message: MessageSchema }>({ messages });\n\n const props = withDefaults(defineProps<TitleDetailsProps>(), {\n description: null,\n lastUpdated: null,\n reloadButton: null,\n });\n\n const lastUpdatedDate = computed(() => {\n if (!props.lastUpdated) {\n return null;\n }\n\n const date = props.lastUpdated instanceof Date ? props.lastUpdated : new Date(props.lastUpdated);\n return Number.isNaN(date.getTime()) ? null : date;\n });\n\n const activeLocale = computed(() => (lastUpdatedDate.value ? locale.value : ''));\n const dateLocale = useDynamicDateFnsLocale(activeLocale);\n const lastUpdatedDateTime = computed(() => lastUpdatedDate.value?.toISOString());\n\n const timestamp = computed(() =>\n lastUpdatedDate.value\n ? t('lastUpdated', {\n date: formatDistanceToNow(lastUpdatedDate.value, {\n locale: dateLocale.value,\n addSuffix: true,\n }),\n })\n : null\n );\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n</script>\n\n<script lang=\"ts\">\n /**\n * An internal component for descriptions and last-updated metadata.\n *\n * @example\n * import { TitleDetails } from '@/internal';\n *\n * export default {\n * components: { TitleDetails },\n * template: `\n * <title-details description=\"content description\" :last-updated=\"new Date()\" />\n * `\n * }\n * @slot description - The description content. Overrides the `description` prop.\n * @property description - Text showed under the title.\n * @property lastUpdated - JavaScript \"Date\" object for when the content was last updated.\n * @property reloadButton - Reload button which shows next to the header's timestamp.\n */\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./title-details.scss\" />\n"],"names":["differenceInMilliseconds","laterDate","earlierDate","toDate","differenceInSeconds","options","diff","getRoundingMethod","formatDistance","defaultOptions","getDefaultOptions","locale","enUS","minutesInAlmostTwoDays","comparison","compareAsc","localizeOptions","laterDate_","earlierDate_","normalizeDates","seconds","offsetInSeconds","getTimezoneOffsetInMilliseconds","minutes","months","minutesInDay","hours","minutesInMonth","days","differenceInMonths","nearestMonth","monthsSinceStartOfYear","years","formatDistanceToNow","date","constructNow","__default__","messages","t","useI18n","props","__props","lastUpdatedDate","computed","activeLocale","dateLocale","useDynamicDateFnsLocale","lastUpdatedDateTime","timestamp","slots","useSlots","hasSlot","useHasSlot"],"mappings":";;;;;;;;;;;;;AAwBO,SAAAA,EAAAC,GAAAC,GAAA;AACP,SAAA,CAAAC,EAAAF,CAAA,IAAA,CAAAE,EAAAD,CAAA;AACA;ACIO,SAAAE,EAAAH,GAAAC,GAAAG,GAAA;AACP,QAAAC,IAA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uBAAA,OAAAA,EAAA,cAAA,IAAA,KAAAA,EAAA,WAAA;AACA,aAAA,OAAA,MAAAN,EAAA,QAAA,CAAA,IAAA,OAAAA;AAAA,IAA6C,CAAA,GAGjDU,IAAAD,EAAA,MAAAD,EAAA,QAAA/B,EAAA,QAAA,EAAA,GACAkC,IAAAC,EAAAF,CAAA,GACAG,IAAAJ,EAAA,MAAAD,EAAA,OAAA,YAAA,CAAA,GAEAM,IAAAL;AAAA,MAAkB,MAAAD,EAAA,QAAAJ,EAAA,eAAA;AAAA,QAES,MAAAL,EAAAS,EAAA,OAAA;AAAA,UACoC,QAAAG,EAAA;AAAA,UAC1B,WAAA;AAAA,QACR,CAAA;AAAA,MACd,CAAA,IAAA;AAAA,IAEL,GAGVI,IAAAC,EAAA,GACAC,IAAAC,EAAAH,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0,1,2,3]}
|
|
1
|
+
{"version":3,"file":"title-details.Ccs_ltkI.js","sources":["../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInMilliseconds.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/differenceInSeconds.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/formatDistance.js","../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/formatDistanceToNow.js","../../../vue2/src/components/internal/title-details/title-details.vue"],"sourcesContent":["import { toDate } from \"./toDate.js\";\n\n/**\n * @name differenceInMilliseconds\n * @category Millisecond Helpers\n * @summary Get the number of milliseconds between the given dates.\n *\n * @description\n * Get the number of milliseconds between the given dates.\n *\n * @param laterDate - The later date\n * @param earlierDate - The earlier date\n *\n * @returns The number of milliseconds\n *\n * @example\n * // How many milliseconds are between\n * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?\n * const result = differenceInMilliseconds(\n * new Date(2014, 6, 2, 12, 30, 21, 700),\n * new Date(2014, 6, 2, 12, 30, 20, 600)\n * )\n * //=> 1100\n */\nexport function differenceInMilliseconds(laterDate, earlierDate) {\n return +toDate(laterDate) - +toDate(earlierDate);\n}\n\n// Fallback for modularized imports:\nexport default differenceInMilliseconds;\n","import { getRoundingMethod } from \"./_lib/getRoundingMethod.js\";\nimport { differenceInMilliseconds } from \"./differenceInMilliseconds.js\";\n\n/**\n * The {@link differenceInSeconds} function options.\n */\n\n/**\n * @name differenceInSeconds\n * @category Second Helpers\n * @summary Get the number of seconds between the given dates.\n *\n * @description\n * Get the number of seconds between the given dates.\n *\n * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - An object with options.\n *\n * @returns The number of seconds\n *\n * @example\n * // How many seconds are between\n * // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?\n * const result = differenceInSeconds(\n * new Date(2014, 6, 2, 12, 30, 20, 0),\n * new Date(2014, 6, 2, 12, 30, 7, 999)\n * )\n * //=> 12\n */\nexport function differenceInSeconds(laterDate, earlierDate, options) {\n const diff = differenceInMilliseconds(laterDate, earlierDate) / 1000;\n return getRoundingMethod(options?.roundingMethod)(diff);\n}\n\n// Fallback for modularized imports:\nexport default differenceInSeconds;\n","import { defaultLocale } from \"./_lib/defaultLocale.js\";\nimport { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { getTimezoneOffsetInMilliseconds } from \"./_lib/getTimezoneOffsetInMilliseconds.js\";\nimport { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { compareAsc } from \"./compareAsc.js\";\nimport { minutesInDay, minutesInMonth } from \"./constants.js\";\nimport { differenceInMonths } from \"./differenceInMonths.js\";\nimport { differenceInSeconds } from \"./differenceInSeconds.js\";\n\n/**\n * The {@link formatDistance} function options.\n */\n\n/**\n * @name formatDistance\n * @category Common Helpers\n * @summary Return the distance between the given dates in words.\n *\n * @description\n * Return the distance between the given dates in words.\n *\n * | Distance between dates | Result |\n * |-------------------------------------------------------------------|---------------------|\n * | 0 ... 30 secs | less than a minute |\n * | 30 secs ... 1 min 30 secs | 1 minute |\n * | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |\n * | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |\n * | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |\n * | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |\n * | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |\n * | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |\n * | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |\n * | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |\n * | 1 yr ... 1 yr 3 months | about 1 year |\n * | 1 yr 3 months ... 1 yr 9 month s | over 1 year |\n * | 1 yr 9 months ... 2 yrs | almost 2 years |\n * | N yrs ... N yrs 3 months | about N years |\n * | N yrs 3 months ... N yrs 9 months | over N years |\n * | N yrs 9 months ... N+1 yrs | almost N+1 years |\n *\n * With `options.includeSeconds == true`:\n * | Distance between dates | Result |\n * |------------------------|----------------------|\n * | 0 secs ... 5 secs | less than 5 seconds |\n * | 5 secs ... 10 secs | less than 10 seconds |\n * | 10 secs ... 20 secs | less than 20 seconds |\n * | 20 secs ... 40 secs | half a minute |\n * | 40 secs ... 60 secs | less than a minute |\n * | 60 secs ... 90 secs | 1 minute |\n *\n * @param laterDate - The date\n * @param earlierDate - The date to compare with\n * @param options - An object with options\n *\n * @returns The distance in words\n *\n * @throws `date` must not be Invalid Date\n * @throws `baseDate` must not be Invalid Date\n * @throws `options.locale` must contain `formatDistance` property\n *\n * @example\n * // What is the distance between 2 July 2014 and 1 January 2015?\n * const result = formatDistance(new Date(2014, 6, 2), new Date(2015, 0, 1))\n * //=> '6 months'\n *\n * @example\n * // What is the distance between 1 January 2015 00:00:15\n * // and 1 January 2015 00:00:00, including seconds?\n * const result = formatDistance(\n * new Date(2015, 0, 1, 0, 0, 15),\n * new Date(2015, 0, 1, 0, 0, 0),\n * { includeSeconds: true }\n * )\n * //=> 'less than 20 seconds'\n *\n * @example\n * // What is the distance from 1 January 2016\n * // to 1 January 2015, with a suffix?\n * const result = formatDistance(new Date(2015, 0, 1), new Date(2016, 0, 1), {\n * addSuffix: true\n * })\n * //=> 'about 1 year ago'\n *\n * @example\n * // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = formatDistance(new Date(2016, 7, 1), new Date(2015, 0, 1), {\n * locale: eoLocale\n * })\n * //=> 'pli ol 1 jaro'\n */\nexport function formatDistance(laterDate, earlierDate, options) {\n const defaultOptions = getDefaultOptions();\n const locale = options?.locale ?? defaultOptions.locale ?? defaultLocale;\n const minutesInAlmostTwoDays = 2520;\n\n const comparison = compareAsc(laterDate, earlierDate);\n\n if (isNaN(comparison)) throw new RangeError(\"Invalid time value\");\n\n const localizeOptions = Object.assign({}, options, {\n addSuffix: options?.addSuffix,\n comparison: comparison,\n });\n\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n ...(comparison > 0 ? [earlierDate, laterDate] : [laterDate, earlierDate]),\n );\n\n const seconds = differenceInSeconds(earlierDate_, laterDate_);\n const offsetInSeconds =\n (getTimezoneOffsetInMilliseconds(earlierDate_) -\n getTimezoneOffsetInMilliseconds(laterDate_)) /\n 1000;\n const minutes = Math.round((seconds - offsetInSeconds) / 60);\n let months;\n\n // 0 up to 2 mins\n if (minutes < 2) {\n if (options?.includeSeconds) {\n if (seconds < 5) {\n return locale.formatDistance(\"lessThanXSeconds\", 5, localizeOptions);\n } else if (seconds < 10) {\n return locale.formatDistance(\"lessThanXSeconds\", 10, localizeOptions);\n } else if (seconds < 20) {\n return locale.formatDistance(\"lessThanXSeconds\", 20, localizeOptions);\n } else if (seconds < 40) {\n return locale.formatDistance(\"halfAMinute\", 0, localizeOptions);\n } else if (seconds < 60) {\n return locale.formatDistance(\"lessThanXMinutes\", 1, localizeOptions);\n } else {\n return locale.formatDistance(\"xMinutes\", 1, localizeOptions);\n }\n } else {\n if (minutes === 0) {\n return locale.formatDistance(\"lessThanXMinutes\", 1, localizeOptions);\n } else {\n return locale.formatDistance(\"xMinutes\", minutes, localizeOptions);\n }\n }\n\n // 2 mins up to 0.75 hrs\n } else if (minutes < 45) {\n return locale.formatDistance(\"xMinutes\", minutes, localizeOptions);\n\n // 0.75 hrs up to 1.5 hrs\n } else if (minutes < 90) {\n return locale.formatDistance(\"aboutXHours\", 1, localizeOptions);\n\n // 1.5 hrs up to 24 hrs\n } else if (minutes < minutesInDay) {\n const hours = Math.round(minutes / 60);\n return locale.formatDistance(\"aboutXHours\", hours, localizeOptions);\n\n // 1 day up to 1.75 days\n } else if (minutes < minutesInAlmostTwoDays) {\n return locale.formatDistance(\"xDays\", 1, localizeOptions);\n\n // 1.75 days up to 30 days\n } else if (minutes < minutesInMonth) {\n const days = Math.round(minutes / minutesInDay);\n return locale.formatDistance(\"xDays\", days, localizeOptions);\n\n // 1 month up to 2 months\n } else if (minutes < minutesInMonth * 2) {\n months = Math.round(minutes / minutesInMonth);\n return locale.formatDistance(\"aboutXMonths\", months, localizeOptions);\n }\n\n months = differenceInMonths(earlierDate_, laterDate_);\n\n // 2 months up to 12 months\n if (months < 12) {\n const nearestMonth = Math.round(minutes / minutesInMonth);\n return locale.formatDistance(\"xMonths\", nearestMonth, localizeOptions);\n\n // 1 year up to max Date\n } else {\n const monthsSinceStartOfYear = months % 12;\n const years = Math.trunc(months / 12);\n\n // N years up to 1 years 3 months\n if (monthsSinceStartOfYear < 3) {\n return locale.formatDistance(\"aboutXYears\", years, localizeOptions);\n\n // N years 3 months up to N years 9 months\n } else if (monthsSinceStartOfYear < 9) {\n return locale.formatDistance(\"overXYears\", years, localizeOptions);\n\n // N years 9 months up to N year 12 months\n } else {\n return locale.formatDistance(\"almostXYears\", years + 1, localizeOptions);\n }\n }\n}\n\n// Fallback for modularized imports:\nexport default formatDistance;\n","import { constructNow } from \"./constructNow.js\";\n\nimport { formatDistance } from \"./formatDistance.js\";\n\n/**\n * The {@link formatDistanceToNow} function options.\n */\n\n/**\n * @name formatDistanceToNow\n * @category Common Helpers\n * @summary Return the distance between the given date and now in words.\n * @pure false\n *\n * @description\n * Return the distance between the given date and now in words.\n *\n * | Distance to now | Result |\n * |-------------------------------------------------------------------|---------------------|\n * | 0 ... 30 secs | less than a minute |\n * | 30 secs ... 1 min 30 secs | 1 minute |\n * | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |\n * | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |\n * | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |\n * | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |\n * | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |\n * | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |\n * | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |\n * | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |\n * | 1 yr ... 1 yr 3 months | about 1 year |\n * | 1 yr 3 months ... 1 yr 9 month s | over 1 year |\n * | 1 yr 9 months ... 2 yrs | almost 2 years |\n * | N yrs ... N yrs 3 months | about N years |\n * | N yrs 3 months ... N yrs 9 months | over N years |\n * | N yrs 9 months ... N+1 yrs | almost N+1 years |\n *\n * With `options.includeSeconds == true`:\n * | Distance to now | Result |\n * |---------------------|----------------------|\n * | 0 secs ... 5 secs | less than 5 seconds |\n * | 5 secs ... 10 secs | less than 10 seconds |\n * | 10 secs ... 20 secs | less than 20 seconds |\n * | 20 secs ... 40 secs | half a minute |\n * | 40 secs ... 60 secs | less than a minute |\n * | 60 secs ... 90 secs | 1 minute |\n *\n * @param date - The given date\n * @param options - The object with options\n *\n * @returns The distance in words\n *\n * @throws `date` must not be Invalid Date\n * @throws `options.locale` must contain `formatDistance` property\n *\n * @example\n * // If today is 1 January 2015, what is the distance to 2 July 2014?\n * const result = formatDistanceToNow(\n * new Date(2014, 6, 2)\n * )\n * //=> '6 months'\n *\n * @example\n * // If now is 1 January 2015 00:00:00,\n * // what is the distance to 1 January 2015 00:00:15, including seconds?\n * const result = formatDistanceToNow(\n * new Date(2015, 0, 1, 0, 0, 15),\n * {includeSeconds: true}\n * )\n * //=> 'less than 20 seconds'\n *\n * @example\n * // If today is 1 January 2015,\n * // what is the distance to 1 January 2016, with a suffix?\n * const result = formatDistanceToNow(\n * new Date(2016, 0, 1),\n * {addSuffix: true}\n * )\n * //=> 'in about 1 year'\n *\n * @example\n * // If today is 1 January 2015,\n * // what is the distance to 1 August 2016 in Esperanto?\n * const eoLocale = require('date-fns/locale/eo')\n * const result = formatDistanceToNow(\n * new Date(2016, 7, 1),\n * {locale: eoLocale}\n * )\n * //=> 'pli ol 1 jaro'\n */\nexport function formatDistanceToNow(date, options) {\n return formatDistance(date, constructNow(date), options);\n}\n\n// Fallback for modularized imports:\nexport default formatDistanceToNow;\n","<template>\n <div class=\"b-title-details__container\">\n <bento-typography v-if=\"description || hasSlot('description')\" class=\"b-title-details__description\" el=\"div\">\n <slot name=\"description\">{{ description }}</slot>\n </bento-typography>\n <div v-if=\"lastUpdatedDate\" class=\"b-title-details__timestamp-section\">\n <bento-typography class=\"b-title-details__timestamp\" el=\"div\">\n <time :datetime=\"lastUpdatedDateTime\">{{ timestamp }}</time>\n </bento-typography>\n <bento-loading-button\n v-if=\"reloadButton\"\n variant=\"tertiary\"\n :state=\"reloadButton.state\"\n @click=\"reloadButton.event\"\n ><template #iconLeft><reload-icon aria-hidden=\"true\" /></template\n >{{ reloadButton.title }}</bento-loading-button\n >\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, useSlots } from 'vue';\n import { useDynamicDateFnsLocale, useHasSlot } from '@/composables';\n import { formatDistanceToNow } from 'date-fns/formatDistanceToNow';\n import { BentoTypography } from '@/components/typography';\n import { BentoLoadingButton } from '@/components/button';\n import ReloadIcon from '@adyen/ui-assets-icons-16/vue/refresh';\n import { useI18n } from '@/utils/ts/i18n';\n import type { TitleDetailsProps } from './title-details.types';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const { t, locale } = useI18n<{ message: MessageSchema }>({ messages });\n\n const props = withDefaults(defineProps<TitleDetailsProps>(), {\n description: null,\n lastUpdated: null,\n reloadButton: null,\n });\n\n const lastUpdatedDate = computed(() => {\n if (!props.lastUpdated) {\n return null;\n }\n\n const date = props.lastUpdated instanceof Date ? props.lastUpdated : new Date(props.lastUpdated);\n return Number.isNaN(date.getTime()) ? null : date;\n });\n\n const activeLocale = computed(() => (lastUpdatedDate.value ? locale.value : ''));\n const dateLocale = useDynamicDateFnsLocale(activeLocale);\n const lastUpdatedDateTime = computed(() => lastUpdatedDate.value?.toISOString());\n\n const timestamp = computed(() =>\n lastUpdatedDate.value\n ? t('lastUpdated', {\n date: formatDistanceToNow(lastUpdatedDate.value, {\n locale: dateLocale.value,\n addSuffix: true,\n }),\n })\n : null\n );\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n</script>\n\n<script lang=\"ts\">\n /**\n * An internal component for descriptions and last-updated metadata.\n *\n * @example\n * import { TitleDetails } from '@/internal';\n *\n * export default {\n * components: { TitleDetails },\n * template: `\n * <title-details description=\"content description\" :last-updated=\"new Date()\" />\n * `\n * }\n * @slot description - The description content. Overrides the `description` prop.\n * @property description - Text showed under the title.\n * @property lastUpdated - JavaScript \"Date\" object for when the content was last updated.\n * @property reloadButton - Reload button which shows next to the header's timestamp.\n */\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./title-details.scss\" />\n"],"names":["differenceInMilliseconds","laterDate","earlierDate","toDate","differenceInSeconds","options","diff","getRoundingMethod","formatDistance","defaultOptions","getDefaultOptions","locale","enUS","minutesInAlmostTwoDays","comparison","compareAsc","localizeOptions","laterDate_","earlierDate_","normalizeDates","seconds","offsetInSeconds","getTimezoneOffsetInMilliseconds","minutes","months","minutesInDay","hours","minutesInMonth","days","differenceInMonths","nearestMonth","monthsSinceStartOfYear","years","formatDistanceToNow","date","constructNow","__default__","messages","t","useI18n","props","__props","lastUpdatedDate","computed","activeLocale","dateLocale","useDynamicDateFnsLocale","lastUpdatedDateTime","timestamp","slots","useSlots","hasSlot","useHasSlot"],"mappings":";;;;;;;;;;;;;AAwBO,SAAAA,EAAAC,GAAAC,GAAA;AACP,SAAA,CAAAC,EAAAF,CAAA,IAAA,CAAAE,EAAAD,CAAA;AACA;ACIO,SAAAE,EAAAH,GAAAC,GAAAG,GAAA;AACP,QAAAC,IAAAN,EAAAC,GAAAC,CAAA,IAAA;AACA,SAAAK,EAAAF,GAAA,cAAA,EAAAC,CAAA;AACA;AC0DO,SAAAE,EAAAP,GAAAC,GAAAG,GAAA;AACP,QAAAI,IAAAC,EAAA,GACAC,IAAAN,GAAA,UAAAI,EAAA,UAAAG,GACAC,IAAA,MAEAC,IAAAC,EAAAd,GAAAC,CAAA;AAEA,MAAA,MAAAY,CAAA,EAAA,OAAA,IAAA,WAAA,oBAAA;AAEA,QAAAE,IAAA,OAAA,OAAA,CAAA,GAAAX,GAAA;AAAA,IACA,WAAAA,GAAA;AAAA,IACA,YAAAS;AAAA,EACA,CAAA,GAEA,CAAAG,GAAAC,CAAA,IAAAC;AAAA,IACAd,GAAA;AAAA,IACA,GAAAS,IAAA,IAAA,CAAAZ,GAAAD,CAAA,IAAA,CAAAA,GAAAC,CAAA;AAAA,EACA,GAEAkB,IAAAhB,EAAAc,GAAAD,CAAA,GACAI,KACAC,EAAAJ,CAAA,IACAI,EAAAL,CAAA,KACA,KACAM,IAAA,KAAA,OAAAH,IAAAC,KAAA,EAAA;AACA,MAAAG;AAGA,MAAAD,IAAA;AACA,WAAAlB,GAAA,iBACAe,IAAA,IACAT,EAAA,eAAA,oBAAA,GAAAK,CAAA,IACAI,IAAA,KACAT,EAAA,eAAA,o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AAA,gBAAAqB,IAAA,GAAAhB,CAAA;AAAA,EAEA;AACA;AC1GO,SAAAiB,EAAAC,GAAA7B,GAAA;AACP,SAAAG,EAAA0B,GAAAC,EAAAD,CAAA,GAAA7B,CAAA;AACA;;;;;;;;;;;;;;;;sBCHI+B,KAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAEf;;;;;;;;;AAxDA,UAAA,EAAA,GAAAC,GAAA,QAAA3B,EAAA,IAAA4B,EAAA,EAAA,UAAAF,EAAA,CAAA,GAEAG,IAAAC,GAMAC,IAAAC,EAAA,MAAA;AACI,UAAA,CAAAH,EAAA;AACI,eAAA;AAGJ,YAAAN,IAAAM,EAAA,uBAAA,OAAAA,EAAA,cAAA,IAAA,KAAAA,EAAA,WAAA;AACA,aAAA,OAAA,MAAAN,EAAA,QAAA,CAAA,IAAA,OAAAA;AAAA,IAA6C,CAAA,GAGjDU,IAAAD,EAAA,MAAAD,EAAA,QAAA/B,EAAA,QAAA,EAAA,GACAkC,IAAAC,EAAAF,CAAA,GACAG,IAAAJ,EAAA,MAAAD,EAAA,OAAA,YAAA,CAAA,GAEAM,IAAAL;AAAA,MAAkB,MAAAD,EAAA,QAAAJ,EAAA,eAAA;AAAA,QAES,MAAAL,EAAAS,EAAA,OAAA;AAAA,UACoC,QAAAG,EAAA;AAAA,UAC1B,WAAA;AAAA,QACR,CAAA;AAAA,MACd,CAAA,IAAA;AAAA,IAEL,GAGVI,IAAAC,EAAA,GACAC,IAAAC,EAAAH,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0,1,2,3]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defineComponent as y, computed as C, openBlock as R, createBlock as _, unref as p, normalizeClass as k, withCtx as g, createVNode as x, createTextVNode as F, toDisplayString as U, nextTick as H, createApp as W, h as $, reactive as q } from "vue";
|
|
2
2
|
import { l as r } from "./events.BQOQSSb7.js";
|
|
3
3
|
import { g as L } from "./generate-uid.DBWe4g6T.js";
|
|
4
|
-
import { c as P, P as G, a as j } from "./popper-container.
|
|
4
|
+
import { c as P, P as G, a as j } from "./popper-container.lfk_dyZi.js";
|
|
5
5
|
import { B as M } from "./typography.B6elnWpr.js";
|
|
6
6
|
import { _ as V } from "./_plugin-vue_export-helper.CHgC5LLL.js";
|
|
7
|
-
import { a as z } from "./focus-trap.
|
|
7
|
+
import { a as z } from "./focus-trap.BgyHTR_3.js";
|
|
8
8
|
import "../assets/tooltip.css";
|
|
9
9
|
const T = { ...P };
|
|
10
10
|
var Y = /* @__PURE__ */ ((t) => (t.HIDDEN = "hidden", t))(Y || {}), v = /* @__PURE__ */ ((t) => (t.ESCAPE = "Escape", t.ENTER = "Enter", t.ARROW_LEFT = "ArrowLeft", t.ARROW_UP = "ArrowUp", t.ARROW_RIGHT = "ArrowRight", t.ARROW_DOWN = "ArrowDown", t.PAGE_UP = "PageUp", t.PAGE_DOWN = "PageDown", t.END = "End", t.HOME = "Home", t.TAB = "Tab", t.F2 = "F2", t))(v || {});
|
|
@@ -198,4 +198,4 @@ export {
|
|
|
198
198
|
T as c,
|
|
199
199
|
Y as d
|
|
200
200
|
};
|
|
201
|
-
//# sourceMappingURL=tooltip.
|
|
201
|
+
//# sourceMappingURL=tooltip.B8LTTssT.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.0QqJo2sa.js","sources":["../../../vue2/src/directives/tooltip/tooltip.types.ts","../../../vue2/src/types/utils-events.ts","../../../vue2/src/components/internal/tooltip/tooltip.types.ts","../../../vue2/src/components/internal/tooltip/tooltip.vue","../../../vue2/src/directives/tooltip/tooltip.ts"],"sourcesContent":["import { PopperContainerPositionBasic } from '../../components/popper-container/popper-container.types';\n\nexport const BentoTooltipPosition = { ...PopperContainerPositionBasic };\nexport type BentoTooltipPosition = PopperContainerPositionBasic;\n\nexport enum BentoTooltipState {\n HIDDEN = 'hidden',\n}\n","import type { Vue } from 'vue-demi';\n\nexport interface ListenOptions {\n capture?: boolean;\n passive?: boolean;\n once?: boolean;\n self?: boolean;\n vm?: Vue;\n onCleanup?: () => void;\n}\n\nexport enum EventKey {\n ESCAPE = 'Escape',\n ENTER = 'Enter',\n ARROW_LEFT = 'ArrowLeft',\n ARROW_UP = 'ArrowUp',\n ARROW_RIGHT = 'ArrowRight',\n ARROW_DOWN = 'ArrowDown',\n PAGE_UP = 'PageUp',\n PAGE_DOWN = 'PageDown',\n END = 'End',\n HOME = 'Home',\n TAB = 'Tab',\n F2 = 'F2',\n}\n\n/**\n * @deprecated Since v3.0.0. Use `EventKey` instead.\n * @see EventKey\n */\nexport enum KeyCode {\n ESCAPE = 27,\n ENTER = 13,\n ARROW_LEFT = 37,\n ARROW_UP = 38,\n ARROW_RIGHT = 39,\n ARROW_DOWN = 40,\n PAGE_UP = 33,\n PAGE_DOWN = 34,\n END = 35,\n HOME = 36,\n}\n","import { PopperContainerPositionBasic } from '../../popper-container/popper-container.types';\n\nexport const BentoTooltipPosition = { ...PopperContainerPositionBasic };\nexport type BentoTooltipPosition = PopperContainerPositionBasic;\n\nexport enum BentoTooltipState {\n HIDDEN = 'hidden',\n}\n","<template>\n <popper-container\n :id=\"id\"\n :aria-role=\"PopperContainerAriaRole.TOOLTIP\"\n :arrow=\"{ classes: ['b-tooltip__arrow'] }\"\n :class=\"conditionalClasses\"\n :fallback-position=\"fallbackPosition\"\n :is-hidden=\"!isShown\"\n :offset=\"[0, 4]\"\n :position=\"position\"\n :target-element=\"targetElement\"\n :disabled-focus-trap=\"disabledFocusTrap\"\n class=\"b-tooltip\"\n >\n <bento-typography el=\"span\" variant=\"caption\">\n {{ content }}\n </bento-typography>\n </popper-container>\n</template>\n\n<script setup lang=\"ts\">\n import type {} from '@floating-ui/vue';\n import { computed, type PropType } from 'vue';\n import { BentoTooltipPosition, BentoTooltipState } from './tooltip.types';\n import { type FallbackPositionProp, PopperContainer, PopperContainerAriaRole } from '@/components/popper-container';\n import { BentoTypography } from '@/components/typography';\n import { type VueNodeElement } from '@/types/elements';\n\n const props = defineProps({\n /**\n * The tooltip's id. Necessary for accessibility purposes.\n */\n id: { type: String, default: null },\n /**\n * Tooltip's target reference to the DOM element or Vue component.\n * The tooltip will position itself relatively to target element, in the specified position.\n */\n targetElement: { type: [Element, Object] as PropType<VueNodeElement>, required: true },\n /**\n * Tooltip's position relative to the target element.\n * Possible values are: 'top', 'bottom', 'left' and 'right'.\n */\n position: {\n type: String as PropType<BentoTooltipPosition>,\n default: BentoTooltipPosition.TOP,\n validator: value => Object.values(BentoTooltipPosition).includes(value as BentoTooltipPosition),\n },\n /**\n * Tooltip's offset.\n * If specified, the tooltip will have an offset in pixels between it and the target element\n * in specified position.\n */\n offset: { type: Number, default: 0 },\n /**\n * Tooltip's text content.\n */\n content: { type: String, required: true },\n /**\n * Shows / Hides the Tooltip component\n */\n isShown: { type: Boolean, default: false },\n\n /**\n * Allows to configure to fallback position to the one specified, it could be 'auto' or ['right', 'top', ...].\n * Useful when not using auto as starting placement.\n * @see {@link https://floating-ui.com/docs/flip#fallbackplacements}\n */\n fallbackPosition: {\n type: [Array, String] as PropType<FallbackPositionProp>,\n default: () => ['top', 'bottom', 'right', 'left'],\n },\n\n /**\n * Disables focus-trap for tooltip.\n * Useful for maintaining focus on the target element.\n */\n disabledFocusTrap: { type: Boolean, default: false },\n });\n\n const conditionalClasses = computed(() => ({\n [`b-tooltip--${BentoTooltipState.HIDDEN}`]: !props.isShown,\n }));\n</script>\n\n<script lang=\"ts\">\n /**\n * Tooltip container, to be used internally to render the tooltip container where the text is shown.\n */\n export default {\n name: 'tooltip',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./tooltip.scss\" />\n","import { nextTick, reactive } from 'vue';\nimport { listen } from '@/utils/ts/events';\nimport { generateUid } from '@/utils/ts/generate-uid';\nimport { EventKey } from '@/types/utils-events';\nimport { BentoTooltipPosition } from './tooltip.types';\nimport { type BentoTooltipDirectiveBinding } from './tooltip.internal.types';\nimport { createApp, h, isVue2, isVue3, Vue2 } from 'vue-demi';\nimport Tooltip from '@/internal/tooltip/tooltip.vue';\nimport { getFocusableIn } from 'focus-lock';\n\ninterface TooltipInstance {\n target: HTMLElement;\n content: string;\n position: BentoTooltipPosition;\n removeListeners: Array<() => void>;\n}\n\n/**\n * Tooltip directive to render a tooltip on a given HTML element or component.\n *\n * @usage\n * import { BentoTooltipDirective, BentoTooltipPosition } from '@adyen/bento-vue2';\n *\n * export default {\n * directives: { BentoTooltipDirective },\n * template: `\n * <bento-button\n * v-bento-tooltip-directive:BentoTooltipPosition.BOTTOM=\"refToTextContent\"\n * >\n * Button text\n * </bento-button>\n * `,\n * }\n */\nconst tooltipInstances: Array<TooltipInstance> = [];\nconst ariaDescribedByAttr = 'aria-describedby';\nconst tooltipId = generateUid('tooltip');\n\nlet tooltipVNode;\n\n// Reusable Tooltip component instance.\nlet tooltip;\n// Global visibility state to prevent tooltips from showing after it being instructed to hide\nlet open = false;\n\nconst tooltipProps = reactive({\n targetElement: null,\n content: 'START_MESSAGE',\n id: tooltipId,\n position: undefined,\n isShown: false,\n});\n\n/**\n * Creates a new Tooltip component instance and inserts it into DOM.\n * @param {HTMLElement} el the target element for the Tooltip\n * @internal\n */\nconst createTooltip = (el: HTMLElement) => {\n // Only set tabindex on elements that are not natively focusable, don't already\n // have one, and don't contain a focusable descendant. Wrapper elements (e.g. a\n // menu div around a button) should not become tabbable themselves -- the child\n // button already provides keyboard access.\n const focusableChildren = getFocusableIn(el).filter(item => item.node !== el);\n if (el.tabIndex < 0 && focusableChildren.length === 0) {\n el.setAttribute('tabindex', '0');\n }\n\n if (isVue2) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore: Type error for Vue method in Vue 3 but this code only executes in vue 2 so ignoring.\n const TooltipComponent = Vue2.extend(Tooltip);\n tooltip = new TooltipComponent({ propsData: { targetElement: el, content: '', id: tooltipId } }).$mount();\n document.body.appendChild(tooltip.$el);\n } else {\n tooltipProps.targetElement = el;\n tooltip = createApp({\n components: { Tooltip },\n setup() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore: Type error for h method in Vue 2 but this code only executes in vue 3 so ignoring.\n return () => h(Tooltip, { ...tooltipProps }, '');\n },\n });\n tooltipVNode = document.createElement('div');\n tooltipVNode.id = 'tooltip-parent';\n document.body.appendChild(tooltipVNode);\n tooltip.mount('#tooltip-parent');\n }\n};\n\n/**\n * Removes Tooltip component instance from the DOM and destroys it.\n * @internal\n */\nconst destroyTooltip = () => {\n if (isVue2) {\n if (document.contains(tooltip.$el)) {\n document.body.removeChild(tooltip.$el);\n }\n tooltip.$destroy();\n } else {\n tooltip.unmount();\n if (document.contains(tooltipVNode)) {\n document.body.removeChild(tooltipVNode);\n }\n }\n\n tooltip = undefined;\n};\n\n/**\n * Returns tooltip position based on the specified argument.\n * By default returns 'top' if no argument is specified.\n * @param {BentoTooltipDirectiveBinding} binding Directive binding object.\n * @returns {string} Tooltip position.\n * @internal\n */\nconst getTooltipPosition = (binding: BentoTooltipDirectiveBinding): BentoTooltipPosition =>\n Object.values(BentoTooltipPosition).includes(binding.arg as BentoTooltipPosition)\n ? (binding.arg as BentoTooltipPosition)\n : BentoTooltipPosition.TOP;\n\n/**\n * Get the correct Tooltip instance for the given target element\n * @param {HTMLElement} el the target element for the Tooltip\n * @returns\n */\nconst getTooltipInstanceForTarget = (el: HTMLElement): TooltipInstance =>\n tooltipInstances.find(\n ctx =>\n // isEqualNode doesn't work correct for svg element, hence the second check here\n ctx.target.isEqualNode(el) && ctx.target === el\n );\n\n/**\n * On mouse enter event updates tooltip with correct content and position, and shows tooltip.\n * @param {?HTMLElement} el - Target element\n * @internal\n */\nconst showTooltip = (el?: HTMLElement) => {\n const tooltipInstance = getTooltipInstanceForTarget(el);\n\n // If tooltip content is empty – do not show the tooltip\n if (!tooltipInstance || !tooltipInstance.content || !el || !tooltip) {\n return;\n }\n\n if (el) {\n el.setAttribute(ariaDescribedByAttr, tooltipId);\n }\n\n // If the Tooltip is inside a dialog, move tooltip element inside of it\n // It gets restored to <body> when it gets hidden\n let isDialogOpen = false;\n document.querySelectorAll('dialog').forEach(node => {\n isDialogOpen = node?.open || isDialogOpen;\n });\n\n if (isDialogOpen) {\n if (isVue2) {\n el.after(tooltip.$el);\n // eslint-disable-next-line no-underscore-dangle\n } else if (tooltip?._instance?.vnode?.el) {\n // eslint-disable-next-line no-underscore-dangle\n el.after(tooltip?._instance?.vnode?.el);\n }\n isDialogOpen = false;\n }\n\n open = true;\n\n tooltip.content = tooltipInstance.content;\n tooltip.position = tooltipInstance.position;\n\n tooltipProps.content = tooltipInstance.content;\n tooltipProps.position = tooltipInstance.position;\n\n // Do calculations on a next tick, otherwise tooltip position calculations will be wrong\n nextTick(() => {\n // Do not open tooltip if it has been instructed to hide in process\n if (!open || !tooltip) {\n return;\n }\n tooltip.targetElement = el;\n tooltip.isShown = true;\n\n tooltipProps.targetElement = el;\n tooltipProps.isShown = true;\n });\n};\n\n/**\n * On mouse leave event hides the tooltip.\n * @internal\n */\nconst hideTooltip = (el?: HTMLElement) => {\n // Restore the tooltip element to body if it got move out of <body>\n if (tooltip?.$el?.parentElement?.tagName && tooltip.$el.parentElement.tagName !== 'BODY') {\n document.body.appendChild(tooltip.$el);\n }\n\n open = false;\n if (tooltip) {\n tooltip.isShown = false;\n }\n tooltipProps.isShown = false;\n if (el) {\n el.removeAttribute(ariaDescribedByAttr);\n }\n};\n\nconst tooltipBind = (el: HTMLElement, binding: BentoTooltipDirectiveBinding) => {\n // eslint-disable-next-line no-prototype-builtins\n if (!binding.hasOwnProperty('value') || binding.value) {\n // Create Tooltip component singleton instance\n if (tooltipInstances.length === 0) {\n createTooltip(el);\n }\n\n const show = () => showTooltip(el);\n const hide = () => hideTooltip(el);\n\n // Create and store context object, which has directive related handlers and content.\n const tooltipInstance: TooltipInstance = {\n target: el,\n content: binding.value,\n position: getTooltipPosition(binding),\n removeListeners: [\n listen(el, 'mouseenter', show),\n listen(el, 'mouseleave', hide),\n listen(el, 'focus', () => {\n if (el.matches(':focus-visible')) {\n show();\n }\n }),\n listen(el, 'blur', evt => {\n const focusEvent = <FocusEvent>evt;\n\n // when blurred and it transitions to the tooltip via screenreader, it should not close\n if ((focusEvent.relatedTarget as Element)?.getAttribute('role') !== 'tooltip') {\n hide();\n }\n }),\n listen(el, 'keydown', evt => {\n const keyboardEvent = <KeyboardEvent>evt;\n if (keyboardEvent.key === EventKey.ESCAPE) {\n hide();\n }\n }),\n ],\n };\n\n tooltipInstances.push(tooltipInstance);\n }\n};\n\nconst tooltipUpdate = (el: HTMLElement, binding: BentoTooltipDirectiveBinding) => {\n const tooltipInstance = getTooltipInstanceForTarget(el);\n if (tooltipInstance) {\n // Update tooltip content value if it is changed\n if (tooltipInstance?.content !== binding.value) {\n tooltipInstance.content = binding.value;\n // If tooltip is currently shown for current element – update tooltip's content value\n if (tooltip.isShown && tooltip.targetElement.isEqualNode(el)) {\n if (!tooltipInstance.content) {\n tooltip.isShown = false;\n } else {\n tooltip.content = binding.value;\n }\n\n // This forces the tooltip to refresh and update content in Vue3\n if (isVue3) {\n hideTooltip(el);\n showTooltip(el);\n }\n }\n }\n // Update tooltip position if it is changed\n if (tooltipInstance.position !== binding.arg) {\n const position = getTooltipPosition(binding);\n tooltipInstance.position = position;\n tooltip.position = position;\n }\n } else if (!tooltipInstance && binding.value) {\n // If I don't have a tooltip instance yet but the value passed was updated\n tooltipBind(el, binding);\n }\n};\n\nconst tooltipUnbind = (el: HTMLElement) => {\n const context = getTooltipInstanceForTarget(el);\n\n // Prevent unbinding/removing when there's nothing to unbind, leads to stack overflow errors\n if (!context) {\n return;\n }\n\n context.removeListeners.forEach(removeListener => {\n removeListener();\n });\n\n // If el is removed while tooltip is displayed, the tooltip doesnt hide as\n // there is no el to trigger mouseleave/blur.\n hideTooltip();\n\n tooltipInstances.splice(tooltipInstances.indexOf(context), 1);\n\n // If all the elements using the directive are removed, then no point having\n // the component on the page.\n if (tooltipInstances.length === 0) {\n destroyTooltip();\n }\n};\n\n/**\n * This directive allows you to bind a tooltip to an element.\n * Tooltip can be configured to be shown in one of four positions: 'top', 'left', 'right' and 'bottom'.\n *\n * @example\n * import { BentoTooltipDirective as BentoTooltip, BentoTooltipPosition } from '@adyen/bento-vue2';\n *\n * export default {\n * directives: { BentoTooltip },\n * methods: {\n * contentExpression() {\n * return 'tooltip content';\n * },\n * },\n * template: `<div>\n * <div v-bento-tooltip:left=\"refToTooltipContent\"></div>\n * <div v-bento-tooltip:[TooltipPosition.BOTTOM]=\"refToTooltipContent\"></div>\n *\n * <!-- If you don't specify the position then by default it's `TooltipPosition.TOP` -->\n * <div v-bento-tooltip=\"refToTooltipContent\"></div>\n *\n * <!-- Tooltip content can also be a data property or a method or a computed property as well -->\n * <div v-bento-tooltip=\"contentExpression()\"></div>\n * </div>`,\n * };\n */\nexport const BentoTooltipDirective = {\n // Vue 2 Directive hooks\n bind(el, binding) {\n tooltipBind(el, binding);\n },\n update(el, binding) {\n tooltipUpdate(el, binding);\n },\n unbind(el) {\n tooltipUnbind(el);\n },\n // Vue 3 Directive hooks\n beforeMount(el, binding) {\n tooltipBind(el, binding);\n },\n mounted(el, binding) {\n tooltipUpdate(el, binding);\n },\n updated(el, binding) {\n tooltipUpdate(el, binding);\n },\n unmounted(el) {\n tooltipUnbind(el);\n },\n};\n"],"names":["BentoTooltipPosition$1","PopperContainerPositionBasic","BentoTooltipState$1","BentoTooltipState2","EventKey","EventKey2","BentoTooltipPosition","BentoTooltipState","__default__","props","__props","conditionalClasses","computed","tooltipInstances","ariaDescribedByAttr","tooltipId","generateUid","tooltipVNode","tooltip","open","tooltipProps","reactive","createTooltip","el","focusableChildren","getFocusableIn","item","createApp","Tooltip","h","destroyTooltip","getTooltipPosition","binding","getTooltipInstanceForTarget","ctx","showTooltip","tooltipInstance","isDialogOpen","node","nextTick","hideTooltip","tooltipBind","show","hide","listen","evt","tooltipUpdate","position","tooltipUnbind","context","removeListener","BentoTooltipDirective"],"mappings":";;;;;;;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/directives/tooltip/tooltip.types.ts","../../../vue2/src/types/utils-events.ts","../../../vue2/src/components/internal/tooltip/tooltip.types.ts","../../../vue2/src/components/internal/tooltip/tooltip.vue","../../../vue2/src/directives/tooltip/tooltip.ts"],"sourcesContent":["import { PopperContainerPositionBasic } from '../../components/popper-container/popper-container.types';\n\nexport const BentoTooltipPosition = { ...PopperContainerPositionBasic };\nexport type BentoTooltipPosition = PopperContainerPositionBasic;\n\nexport enum BentoTooltipState {\n HIDDEN = 'hidden',\n}\n","import type { Vue } from 'vue-demi';\n\nexport interface ListenOptions {\n capture?: boolean;\n passive?: boolean;\n once?: boolean;\n self?: boolean;\n vm?: Vue;\n onCleanup?: () => void;\n}\n\nexport enum EventKey {\n ESCAPE = 'Escape',\n ENTER = 'Enter',\n ARROW_LEFT = 'ArrowLeft',\n ARROW_UP = 'ArrowUp',\n ARROW_RIGHT = 'ArrowRight',\n ARROW_DOWN = 'ArrowDown',\n PAGE_UP = 'PageUp',\n PAGE_DOWN = 'PageDown',\n END = 'End',\n HOME = 'Home',\n TAB = 'Tab',\n F2 = 'F2',\n}\n\n/**\n * @deprecated Since v3.0.0. Use `EventKey` instead.\n * @see EventKey\n */\nexport enum KeyCode {\n ESCAPE = 27,\n ENTER = 13,\n ARROW_LEFT = 37,\n ARROW_UP = 38,\n ARROW_RIGHT = 39,\n ARROW_DOWN = 40,\n PAGE_UP = 33,\n PAGE_DOWN = 34,\n END = 35,\n HOME = 36,\n}\n","import { PopperContainerPositionBasic } from '../../popper-container/popper-container.types';\n\nexport const BentoTooltipPosition = { ...PopperContainerPositionBasic };\nexport type BentoTooltipPosition = PopperContainerPositionBasic;\n\nexport enum BentoTooltipState {\n HIDDEN = 'hidden',\n}\n","<template>\n <popper-container\n :id=\"id\"\n :aria-role=\"PopperContainerAriaRole.TOOLTIP\"\n :arrow=\"{ classes: ['b-tooltip__arrow'] }\"\n :class=\"conditionalClasses\"\n :fallback-position=\"fallbackPosition\"\n :is-hidden=\"!isShown\"\n :offset=\"[0, 4]\"\n :position=\"position\"\n :target-element=\"targetElement\"\n :disabled-focus-trap=\"disabledFocusTrap\"\n class=\"b-tooltip\"\n >\n <bento-typography el=\"span\" variant=\"caption\">\n {{ content }}\n </bento-typography>\n </popper-container>\n</template>\n\n<script setup lang=\"ts\">\n import type {} from '@floating-ui/vue';\n import { computed, type PropType } from 'vue';\n import { BentoTooltipPosition, BentoTooltipState } from './tooltip.types';\n import { type FallbackPositionProp, PopperContainer, PopperContainerAriaRole } from '@/components/popper-container';\n import { BentoTypography } from '@/components/typography';\n import { type VueNodeElement } from '@/types/elements';\n\n const props = defineProps({\n /**\n * The tooltip's id. Necessary for accessibility purposes.\n */\n id: { type: String, default: null },\n /**\n * Tooltip's target reference to the DOM element or Vue component.\n * The tooltip will position itself relatively to target element, in the specified position.\n */\n targetElement: { type: [Element, Object] as PropType<VueNodeElement>, required: true },\n /**\n * Tooltip's position relative to the target element.\n * Possible values are: 'top', 'bottom', 'left' and 'right'.\n */\n position: {\n type: String as PropType<BentoTooltipPosition>,\n default: BentoTooltipPosition.TOP,\n validator: value => Object.values(BentoTooltipPosition).includes(value as BentoTooltipPosition),\n },\n /**\n * Tooltip's offset.\n * If specified, the tooltip will have an offset in pixels between it and the target element\n * in specified position.\n */\n offset: { type: Number, default: 0 },\n /**\n * Tooltip's text content.\n */\n content: { type: String, required: true },\n /**\n * Shows / Hides the Tooltip component\n */\n isShown: { type: Boolean, default: false },\n\n /**\n * Allows to configure to fallback position to the one specified, it could be 'auto' or ['right', 'top', ...].\n * Useful when not using auto as starting placement.\n * @see {@link https://floating-ui.com/docs/flip#fallbackplacements}\n */\n fallbackPosition: {\n type: [Array, String] as PropType<FallbackPositionProp>,\n default: () => ['top', 'bottom', 'right', 'left'],\n },\n\n /**\n * Disables focus-trap for tooltip.\n * Useful for maintaining focus on the target element.\n */\n disabledFocusTrap: { type: Boolean, default: false },\n });\n\n const conditionalClasses = computed(() => ({\n [`b-tooltip--${BentoTooltipState.HIDDEN}`]: !props.isShown,\n }));\n</script>\n\n<script lang=\"ts\">\n /**\n * Tooltip container, to be used internally to render the tooltip container where the text is shown.\n */\n export default {\n name: 'tooltip',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./tooltip.scss\" />\n","import { nextTick, reactive } from 'vue';\nimport { listen } from '@/utils/ts/events';\nimport { generateUid } from '@/utils/ts/generate-uid';\nimport { EventKey } from '@/types/utils-events';\nimport { BentoTooltipPosition } from './tooltip.types';\nimport { type BentoTooltipDirectiveBinding } from './tooltip.internal.types';\nimport { createApp, h, isVue2, isVue3, Vue2 } from 'vue-demi';\nimport Tooltip from '@/internal/tooltip/tooltip.vue';\nimport { getFocusableIn } from 'focus-lock';\n\ninterface TooltipInstance {\n target: HTMLElement;\n content: string;\n position: BentoTooltipPosition;\n removeListeners: Array<() => void>;\n}\n\n/**\n * Tooltip directive to render a tooltip on a given HTML element or component.\n *\n * @usage\n * import { BentoTooltipDirective, BentoTooltipPosition } from '@adyen/bento-vue2';\n *\n * export default {\n * directives: { BentoTooltipDirective },\n * template: `\n * <bento-button\n * v-bento-tooltip-directive:BentoTooltipPosition.BOTTOM=\"refToTextContent\"\n * >\n * Button text\n * </bento-button>\n * `,\n * }\n */\nconst tooltipInstances: Array<TooltipInstance> = [];\nconst ariaDescribedByAttr = 'aria-describedby';\nconst tooltipId = generateUid('tooltip');\n\nlet tooltipVNode;\n\n// Reusable Tooltip component instance.\nlet tooltip;\n// Global visibility state to prevent tooltips from showing after it being instructed to hide\nlet open = false;\n\nconst tooltipProps = reactive({\n targetElement: null,\n content: 'START_MESSAGE',\n id: tooltipId,\n position: undefined,\n isShown: false,\n});\n\n/**\n * Creates a new Tooltip component instance and inserts it into DOM.\n * @param {HTMLElement} el the target element for the Tooltip\n * @internal\n */\nconst createTooltip = (el: HTMLElement) => {\n // Only set tabindex on elements that are not natively focusable, don't already\n // have one, and don't contain a focusable descendant. Wrapper elements (e.g. a\n // menu div around a button) should not become tabbable themselves -- the child\n // button already provides keyboard access.\n const focusableChildren = getFocusableIn(el).filter(item => item.node !== el);\n if (el.tabIndex < 0 && focusableChildren.length === 0) {\n el.setAttribute('tabindex', '0');\n }\n\n if (isVue2) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore: Type error for Vue method in Vue 3 but this code only executes in vue 2 so ignoring.\n const TooltipComponent = Vue2.extend(Tooltip);\n tooltip = new TooltipComponent({ propsData: { targetElement: el, content: '', id: tooltipId } }).$mount();\n document.body.appendChild(tooltip.$el);\n } else {\n tooltipProps.targetElement = el;\n tooltip = createApp({\n components: { Tooltip },\n setup() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore: Type error for h method in Vue 2 but this code only executes in vue 3 so ignoring.\n return () => h(Tooltip, { ...tooltipProps }, '');\n },\n });\n tooltipVNode = document.createElement('div');\n tooltipVNode.id = 'tooltip-parent';\n document.body.appendChild(tooltipVNode);\n tooltip.mount('#tooltip-parent');\n }\n};\n\n/**\n * Removes Tooltip component instance from the DOM and destroys it.\n * @internal\n */\nconst destroyTooltip = () => {\n if (isVue2) {\n if (document.contains(tooltip.$el)) {\n document.body.removeChild(tooltip.$el);\n }\n tooltip.$destroy();\n } else {\n tooltip.unmount();\n if (document.contains(tooltipVNode)) {\n document.body.removeChild(tooltipVNode);\n }\n }\n\n tooltip = undefined;\n};\n\n/**\n * Returns tooltip position based on the specified argument.\n * By default returns 'top' if no argument is specified.\n * @param {BentoTooltipDirectiveBinding} binding Directive binding object.\n * @returns {string} Tooltip position.\n * @internal\n */\nconst getTooltipPosition = (binding: BentoTooltipDirectiveBinding): BentoTooltipPosition =>\n Object.values(BentoTooltipPosition).includes(binding.arg as BentoTooltipPosition)\n ? (binding.arg as BentoTooltipPosition)\n : BentoTooltipPosition.TOP;\n\n/**\n * Get the correct Tooltip instance for the given target element\n * @param {HTMLElement} el the target element for the Tooltip\n * @returns\n */\nconst getTooltipInstanceForTarget = (el: HTMLElement): TooltipInstance =>\n tooltipInstances.find(\n ctx =>\n // isEqualNode doesn't work correct for svg element, hence the second check here\n ctx.target.isEqualNode(el) && ctx.target === el\n );\n\n/**\n * On mouse enter event updates tooltip with correct content and position, and shows tooltip.\n * @param {?HTMLElement} el - Target element\n * @internal\n */\nconst showTooltip = (el?: HTMLElement) => {\n const tooltipInstance = getTooltipInstanceForTarget(el);\n\n // If tooltip content is empty – do not show the tooltip\n if (!tooltipInstance || !tooltipInstance.content || !el || !tooltip) {\n return;\n }\n\n if (el) {\n el.setAttribute(ariaDescribedByAttr, tooltipId);\n }\n\n // If the Tooltip is inside a dialog, move tooltip element inside of it\n // It gets restored to <body> when it gets hidden\n let isDialogOpen = false;\n document.querySelectorAll('dialog').forEach(node => {\n isDialogOpen = node?.open || isDialogOpen;\n });\n\n if (isDialogOpen) {\n if (isVue2) {\n el.after(tooltip.$el);\n // eslint-disable-next-line no-underscore-dangle\n } else if (tooltip?._instance?.vnode?.el) {\n // eslint-disable-next-line no-underscore-dangle\n el.after(tooltip?._instance?.vnode?.el);\n }\n isDialogOpen = false;\n }\n\n open = true;\n\n tooltip.content = tooltipInstance.content;\n tooltip.position = tooltipInstance.position;\n\n tooltipProps.content = tooltipInstance.content;\n tooltipProps.position = tooltipInstance.position;\n\n // Do calculations on a next tick, otherwise tooltip position calculations will be wrong\n nextTick(() => {\n // Do not open tooltip if it has been instructed to hide in process\n if (!open || !tooltip) {\n return;\n }\n tooltip.targetElement = el;\n tooltip.isShown = true;\n\n tooltipProps.targetElement = el;\n tooltipProps.isShown = true;\n });\n};\n\n/**\n * On mouse leave event hides the tooltip.\n * @internal\n */\nconst hideTooltip = (el?: HTMLElement) => {\n // Restore the tooltip element to body if it got move out of <body>\n if (tooltip?.$el?.parentElement?.tagName && tooltip.$el.parentElement.tagName !== 'BODY') {\n document.body.appendChild(tooltip.$el);\n }\n\n open = false;\n if (tooltip) {\n tooltip.isShown = false;\n }\n tooltipProps.isShown = false;\n if (el) {\n el.removeAttribute(ariaDescribedByAttr);\n }\n};\n\nconst tooltipBind = (el: HTMLElement, binding: BentoTooltipDirectiveBinding) => {\n // eslint-disable-next-line no-prototype-builtins\n if (!binding.hasOwnProperty('value') || binding.value) {\n // Create Tooltip component singleton instance\n if (tooltipInstances.length === 0) {\n createTooltip(el);\n }\n\n const show = () => showTooltip(el);\n const hide = () => hideTooltip(el);\n\n // Create and store context object, which has directive related handlers and content.\n const tooltipInstance: TooltipInstance = {\n target: el,\n content: binding.value,\n position: getTooltipPosition(binding),\n removeListeners: [\n listen(el, 'mouseenter', show),\n listen(el, 'mouseleave', hide),\n listen(el, 'focus', () => {\n if (el.matches(':focus-visible')) {\n show();\n }\n }),\n listen(el, 'blur', evt => {\n const focusEvent = <FocusEvent>evt;\n\n // when blurred and it transitions to the tooltip via screenreader, it should not close\n if ((focusEvent.relatedTarget as Element)?.getAttribute('role') !== 'tooltip') {\n hide();\n }\n }),\n listen(el, 'keydown', evt => {\n const keyboardEvent = <KeyboardEvent>evt;\n if (keyboardEvent.key === EventKey.ESCAPE) {\n hide();\n }\n }),\n ],\n };\n\n tooltipInstances.push(tooltipInstance);\n }\n};\n\nconst tooltipUpdate = (el: HTMLElement, binding: BentoTooltipDirectiveBinding) => {\n const tooltipInstance = getTooltipInstanceForTarget(el);\n if (tooltipInstance) {\n // Update tooltip content value if it is changed\n if (tooltipInstance?.content !== binding.value) {\n tooltipInstance.content = binding.value;\n // If tooltip is currently shown for current element – update tooltip's content value\n if (tooltip.isShown && tooltip.targetElement.isEqualNode(el)) {\n if (!tooltipInstance.content) {\n tooltip.isShown = false;\n } else {\n tooltip.content = binding.value;\n }\n\n // This forces the tooltip to refresh and update content in Vue3\n if (isVue3) {\n hideTooltip(el);\n showTooltip(el);\n }\n }\n }\n // Update tooltip position if it is changed\n if (tooltipInstance.position !== binding.arg) {\n const position = getTooltipPosition(binding);\n tooltipInstance.position = position;\n tooltip.position = position;\n }\n } else if (!tooltipInstance && binding.value) {\n // If I don't have a tooltip instance yet but the value passed was updated\n tooltipBind(el, binding);\n }\n};\n\nconst tooltipUnbind = (el: HTMLElement) => {\n const context = getTooltipInstanceForTarget(el);\n\n // Prevent unbinding/removing when there's nothing to unbind, leads to stack overflow errors\n if (!context) {\n return;\n }\n\n context.removeListeners.forEach(removeListener => {\n removeListener();\n });\n\n // If el is removed while tooltip is displayed, the tooltip doesnt hide as\n // there is no el to trigger mouseleave/blur.\n hideTooltip();\n\n tooltipInstances.splice(tooltipInstances.indexOf(context), 1);\n\n // If all the elements using the directive are removed, then no point having\n // the component on the page.\n if (tooltipInstances.length === 0) {\n destroyTooltip();\n }\n};\n\n/**\n * This directive allows you to bind a tooltip to an element.\n * Tooltip can be configured to be shown in one of four positions: 'top', 'left', 'right' and 'bottom'.\n *\n * @example\n * import { BentoTooltipDirective as BentoTooltip, BentoTooltipPosition } from '@adyen/bento-vue2';\n *\n * export default {\n * directives: { BentoTooltip },\n * methods: {\n * contentExpression() {\n * return 'tooltip content';\n * },\n * },\n * template: `<div>\n * <div v-bento-tooltip:left=\"refToTooltipContent\"></div>\n * <div v-bento-tooltip:[TooltipPosition.BOTTOM]=\"refToTooltipContent\"></div>\n *\n * <!-- If you don't specify the position then by default it's `TooltipPosition.TOP` -->\n * <div v-bento-tooltip=\"refToTooltipContent\"></div>\n *\n * <!-- Tooltip content can also be a data property or a method or a computed property as well -->\n * <div v-bento-tooltip=\"contentExpression()\"></div>\n * </div>`,\n * };\n */\nexport const BentoTooltipDirective = {\n // Vue 2 Directive hooks\n bind(el, binding) {\n tooltipBind(el, binding);\n },\n update(el, binding) {\n tooltipUpdate(el, binding);\n },\n unbind(el) {\n tooltipUnbind(el);\n },\n // Vue 3 Directive hooks\n beforeMount(el, binding) {\n tooltipBind(el, binding);\n },\n mounted(el, binding) {\n tooltipUpdate(el, binding);\n },\n updated(el, binding) {\n tooltipUpdate(el, binding);\n },\n unmounted(el) {\n tooltipUnbind(el);\n },\n};\n"],"names":["BentoTooltipPosition$1","PopperContainerPositionBasic","BentoTooltipState$1","BentoTooltipState2","EventKey","EventKey2","BentoTooltipPosition","BentoTooltipState","__default__","props","__props","conditionalClasses","computed","tooltipInstances","ariaDescribedByAttr","tooltipId","generateUid","tooltipVNode","tooltip","open","tooltipProps","reactive","createTooltip","el","focusableChildren","getFocusableIn","item","createApp","Tooltip","h","destroyTooltip","getTooltipPosition","binding","getTooltipInstanceForTarget","ctx","showTooltip","tooltipInstance","isDialogOpen","node","nextTick","hideTooltip","tooltipBind","show","hide","listen","evt","tooltipUpdate","position","tooltipUnbind","context","removeListener","BentoTooltipDirective"],"mappings":";;;;;;;;AAEO,MAAAA,IAAA,EAAA,GAAAC,EAAA;AAGA,IAAAC,IAAA,kBAAAC,OACHA,EAAA,SAAA,UADQA,IAAAD,KAAA,CAAA,CAAA,GCMLE,IAAA,kBAAAC,OACHA,EAAA,SAAA,UACAA,EAAA,QAAA,SACAA,EAAA,aAAA,aACAA,EAAA,WAAA,WACAA,EAAA,cAAA,cACAA,EAAA,aAAA,aACAA,EAAA,UAAA,UACAA,EAAA,YAAA,YACAA,EAAA,MAAA,OACAA,EAAA,OAAA,QACAA,EAAA,MAAA,OACAA,EAAA,KAAA,MAZQA,IAAAD,KAAA,CAAA,CAAA;ACTL,MAAAE,IAAA,EAAA,GAAAL,EAAA;AAGA,IAAAM,IAAA,kBAAAJ,OACHA,EAAA,SAAA,UADQA,IAAAI,KAAA,CAAA,CAAA;ACmFR,MAAAC,IAAA;AAAA,EAAe,MAAA;AAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA9DA,UAAAC,IAAAC,GAmDAC,IAAAC,EAAA,OAAA;AAAA,MAA2C,CAAA,cAAAL,EAAA,MAAA,EAAA,GAAA,CAAAE,EAAA;AAAA,IACY,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;kEC9C3DI,IAAA,CAAA,GACAC,IAAA,oBACAC,IAAAC,EAAA,SAAA;AAEA,IAAAC,GAGAC,GAEAC,IAAA;AAEA,MAAAC,IAAAC,EAAA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,IAAAS,EAAAlB,GAAAS,CAAA;AAAA,EAAuB;AAAA,EAC3B,QAAAT,GAAAS,GAAA;AAEI,IAAAc,EAAAvB,GAAAS,CAAA;AAAA,EAAyB;AAAA,EAC7B,QAAAT,GAAAS,GAAA;AAEI,IAAAc,EAAAvB,GAAAS,CAAA;AAAA,EAAyB;AAAA,EAC7B,UAAAT,GAAA;AAEI,IAAAyB,EAAAzB,CAAA;AAAA,EAAgB;AAExB;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { defineComponent as E, ref as I, openBlock as d, createBlock as x, unref as a, withCtx as v, createElementVNode as c, normalizeStyle as M, getCurrentInstance as D, createElementBlock as y, mergeProps as w, toDisplayString as $, createCommentVNode as k, computed as s, isRef as q, watch as B, nextTick as Z, createVNode as S, withKeys as H, createSlots as U, createTextVNode as R, renderSlot as W, Fragment as X, renderList as G } from "vue";
|
|
2
|
-
import { h as J, f as Q, B as Y } from "./button-actions.
|
|
3
|
-
import { B as F } from "./popover.types.
|
|
2
|
+
import { h as J, f as Q, B as Y } from "./button-actions.BYoctIth.js";
|
|
3
|
+
import { B as F } from "./popover.types.CXIAfp1m.js";
|
|
4
4
|
import { B as N } from "./typography.B6elnWpr.js";
|
|
5
5
|
import { _ as tt } from "./image.vue_vue_type_script_setup_true_lang.BMoSMeM-.js";
|
|
6
6
|
import { u as et } from "./index.CGBfMQdv.js";
|
|
7
7
|
import { _ as ot } from "./refresh.DjN1EulV.js";
|
|
8
8
|
/* empty css */
|
|
9
|
-
import { P as K, h as rt, o as it } from "./popper-container.
|
|
9
|
+
import { P as K, h as rt, o as it } from "./popper-container.lfk_dyZi.js";
|
|
10
10
|
import { _ as A } from "./_plugin-vue_export-helper.CHgC5LLL.js";
|
|
11
11
|
import "../assets/tutorial.css";
|
|
12
12
|
const O = 2, st = /* @__PURE__ */ E({
|
|
@@ -398,4 +398,4 @@ const O = 2, st = /* @__PURE__ */ E({
|
|
|
398
398
|
export {
|
|
399
399
|
Rt as _
|
|
400
400
|
};
|
|
401
|
-
//# sourceMappingURL=tutorial.vue_vue_type_script_setup_true_lang.
|
|
401
|
+
//# sourceMappingURL=tutorial.vue_vue_type_script_setup_true_lang.CpzGxsmy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tutorial.vue_vue_type_script_setup_true_lang.Dn4toWHY.js","sources":["../../../vue2/src/components/tutorial/components/tutorial-popover/components/tutorial-indicator/tutorial-indicator.vue","../../../ui-assets/icons-16/dist/vue/blocked.vue","../../../vue2/src/components/tutorial/components/tutorial-popover/tutorial-popover.vue","../../../vue2/src/components/tutorial/tutorial.vue"],"sourcesContent":["<template>\n <popper-container\n :target-element=\"targetElement\"\n :middleware=\"middleware\"\n position=\"top-start\"\n fixed-positioning\n disabled-focus-trap\n class=\"b-tutorial-indicator\"\n data-testid=\"tutorial-indicator\"\n >\n <div class=\"b-tutorial-indicator__highlight\" :style=\"computedStyles\"></div>\n </popper-container>\n</template>\n\n<script setup lang=\"ts\">\n import { ref } from 'vue';\n import { hide, type Middleware, offset } from '@floating-ui/vue';\n import { PopperContainer } from '@/components/popper-container';\n\n const BORDER_OFFSET = 2;\n\n defineProps({\n /**\n * Tutorial indicator's target element.\n * The indicator will position itself around the target element.\n */\n targetElement: {\n type: PopperContainer.props?.targetElement.type,\n required: true,\n },\n });\n\n const computedStyles = ref({\n width: '0',\n height: '0',\n borderRadius: '0',\n });\n\n function getBorderRadius(element: HTMLElement) {\n try {\n const radius = parseFloat(getComputedStyle(element).getPropertyValue('border-radius'));\n return Number.isNaN(radius) ? '' : `${radius + 2 * BORDER_OFFSET}px`;\n } catch {\n return '';\n }\n }\n\n const middleware = [\n hide(),\n offset({\n mainAxis: BORDER_OFFSET,\n alignmentAxis: -BORDER_OFFSET,\n }),\n {\n name: 'updateIndicatorSize',\n fn: ({ x, y, elements }) => {\n const target = elements.reference as HTMLElement;\n computedStyles.value.width = `${target.offsetWidth + 4 * BORDER_OFFSET}px`;\n computedStyles.value.height = `${target.offsetHeight + 4 * BORDER_OFFSET}px`;\n computedStyles.value.borderRadius = getBorderRadius(target);\n return { x, y };\n },\n } as Middleware,\n ];\n</script>\n\n<style lang=\"scss\" scoped src=\"./tutorial-indicator.scss\" />\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><g :clip-path=\"'url(#uia-ui-assets/icons-16-blocked__a' + uuid + ')'\"><path fill=\"#001222\" d=\"M9.51195 0.398918C8.00859 0.0998821 6.45033 0.253358 5.0342 0.839937C3.61808 1.42652 2.40769 2.41985 1.55611 3.69433C0.704529 4.96881 0.25 6.4672 0.25 8C0.25 10.0554 1.06652 12.0267 2.51992 13.4801C3.97333 14.9335 5.94457 15.75 8 15.75C9.53281 15.75 11.0312 15.2955 12.3057 14.4439C13.5801 13.5923 14.5735 12.3819 15.1601 10.9658C15.7466 9.54967 15.9001 7.99141 15.6011 6.48805C15.3021 4.9847 14.5639 3.60378 13.4801 2.51993C12.3962 1.43607 11.0153 0.697953 9.51195 0.398918ZM5.60823 2.22576C6.75027 1.75271 8.00693 1.62894 9.21931 1.8701C10.4317 2.11125 11.5453 2.70651 12.4194 3.58059C13.2935 4.45466 13.8887 5.56831 14.1299 6.78069C14.3711 7.99307 14.2473 9.24974 13.7742 10.3918C13.5555 10.9198 13.2667 11.4124 12.9177 11.8573L4.14271 3.0823C4.58761 2.73333 5.08018 2.44448 5.60823 2.22576ZM3.08208 4.14298L11.857 12.9179C11.7327 13.0154 11.6044 13.1085 11.4723 13.1967C10.4445 13.8834 9.23613 14.25 8 14.25C6.3424 14.25 4.75268 13.5915 3.58058 12.4194C2.40848 11.2473 1.75 9.65761 1.75 8C1.75 6.76387 2.11656 5.5555 2.80331 4.52769C2.89155 4.39564 2.98456 4.26733 3.08208 4.14298Z\"/></g><defs><clipPath :id=\"'uia-ui-assets/icons-16-blocked__a' + uuid\"><rect width=\"16\" height=\"16\" fill=\"#fff\"/></clipPath></defs></svg>\n</template>\n<script setup>\n import { getCurrentInstance } from 'vue';\n import '../css/main.css';\n\n const instance = getCurrentInstance();\n const uuid = String(instance?.uid ?? instance?.proxy?._uid);\n</script>\n","<template>\n <div v-if=\"active && targetElement\">\n <tutorial-indicator v-if=\"isIndicatorVisible && targetElement\" :target-element=\"targetElement\" />\n\n <bento-popover\n :target-element=\"targetElement\"\n :position=\"position\"\n :open=\"isPopoverOpen\"\n :aria-label=\"title\"\n fixed-positioning\n class=\"b-tutorial-popover\"\n @keydown.esc.native=\"emit('finish')\"\n >\n <template v-if=\"image\" #image>\n <bento-image v-bind=\"image\" aspect-ratio=\"landscape\" class=\"b-tutorial-popover__image\" />\n </template>\n\n <div aria-hidden=\"true\" class=\"b-tutorial-popover__ripple\"></div>\n\n <div class=\"b-tutorial-popover__header\">\n <bento-typography variant=\"title\" el=\"span\"> {{ title }} </bento-typography>\n\n <bento-typography v-if=\"showSteps\" el=\"span\" class=\"b-tutorial-popover__steps\">\n {{ t('stepsOfTotal', { step, totalSteps }) }}\n </bento-typography>\n </div>\n\n <bento-typography>\n <slot />\n </bento-typography>\n\n <div class=\"b-tutorial-popover__footer\">\n <bento-menu\n v-if=\"!isFirstStep\"\n :data=\"menuData\"\n class=\"b-tutorial-popover__menu\"\n data-testid=\"menu-button\"\n />\n <div class=\"b-tutorial-popover__actions\">\n <bento-button-actions :actions=\"computedActions\" layout=\"buttons-end\" />\n </div>\n </div>\n </bento-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, isRef, nextTick, type PropType, ref, type default as Vue, watch } from 'vue';\n import { BentoMenu } from '@/components/menu';\n import { BentoPopover, BentoPopoverPositions } from '@/components/popover';\n import { BentoTypography } from '@/components/typography';\n import { type BentoButtonActionObject, BentoButtonActions } from '@/components/button';\n import { BentoImage } from '@/components/image';\n import { TutorialIndicator } from './components/tutorial-indicator';\n import { useI18n } from '@/utils/ts/i18n';\n import type { BentoMenuItem } from '@/components/menu/components';\n import type { VueNodeElement } from '@/types/elements';\n import type { BentoTutorialScrollOptions, BentoTutorialStep } from '../../tutorial.types';\n import RefreshIcon from '@adyen/ui-assets-icons-16/vue/refresh';\n import BlockedIcon from '@adyen/ui-assets-icons-16/vue/blocked';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const DEFAULT_SCROLL_OPTIONS: BentoTutorialScrollOptions = { behavior: 'smooth' };\n\n const props = defineProps({\n /**\n * Optional configuration for the secondary action.\n * In tour tutorials, this is ignored for the introductory step.\n */\n action: {\n type: Object as PropType<BentoButtonActionObject>,\n default: null,\n },\n\n /**\n * Indicates whether this popover is the active step (and should be visible).\n */\n active: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Optional illustration to display at the top of the popover.\n */\n image: {\n type: Object as PropType<BentoTutorialStep['image']>,\n default: null,\n },\n\n /**\n * Popover's position relative to the target element.\n * Possible values are:\n * 'auto', 'auto-start', 'auto-end',\n * 'top', 'top-start', 'top-end'\n * 'right', 'right-start', 'right-end'\n * 'bottom', 'bottom-start', 'bottom-end'\n * 'left', 'left-start', 'left-end'\n */\n position: {\n type: String as PropType<`${BentoPopoverPositions}`>,\n default: BentoPopoverPositions.BOTTOM_START,\n validator: (value: BentoPopoverPositions) => Object.values(BentoPopoverPositions).includes(value),\n },\n\n /**\n * Options to control the scroll into view behavior.\n * Takes the same options as the `scrollIntoView` function\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView}\n */\n scrollOptions: {\n type: [Boolean, Object] as PropType<BentoTutorialScrollOptions>,\n default: null,\n },\n\n /**\n * Indicates whether this popover is a single tutorial or a tour.\n */\n single: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The tutorial step number.\n * In tour tutorials, `0` is the introductory step, and is displayed next\n * to the title.\n */\n step: {\n type: Number,\n default: null,\n },\n\n /**\n * Tutorial popover's target element.\n * The popover will position itself relatively to target element.\n */\n targetElement: {\n type: [Element, Object] as PropType<VueNodeElement>,\n required: true,\n },\n\n /**\n * The tutorial step title.\n */\n title: {\n type: String,\n required: true,\n },\n\n /**\n * Total count of steps.\n * In tour tutorials, this does not include the introductory step, and is\n * displayed next to the title.\n */\n totalSteps: {\n type: Number,\n default: null,\n },\n });\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const emit = defineEmits<{\n /**\n * Emitted when the user clicks the primary action in popovers during introductory or intermediate steps of tour tutorials\n */\n (e: 'next'): void;\n\n /**\n * Emitted when the user clicks the primary action in a single tutorial, the last step of a tour, or skips the tutorial\n */\n (e: 'finish'): void;\n\n /**\n * Emitted when the user selects the restart tour option\n */\n (e: 'restart'): void;\n }>();\n\n const ACTION_SKIP = computed<BentoButtonActionObject>(() => ({\n title: t('skipTour') as string,\n event: () => emit('finish'),\n }));\n\n const ACTION_START = computed<BentoButtonActionObject>(() => ({\n title: t('startTour') as string,\n event: () => emit('next'),\n }));\n\n const ACTION_NEXT = computed<BentoButtonActionObject>(() => ({\n title: t('next') as string,\n event: () => emit('next'),\n }));\n\n const ACTION_FINISH = computed<BentoButtonActionObject>(() => ({\n title: t('finish') as string,\n event: () => emit('finish'),\n }));\n\n const ACTION_OK = computed<BentoButtonActionObject>(() => ({\n title: t('ok') as string,\n event: () => emit('finish'),\n }));\n\n const isPopoverOpen = ref(false);\n const isIndicatorVisible = ref(false);\n\n const targetElement = computed(() => {\n if (isRef(props.targetElement)) {\n return ((props.targetElement.value as Vue)?.$el || props.targetElement.value) as HTMLElement;\n }\n return ((props.targetElement as Vue).$el || props.targetElement) as HTMLElement;\n });\n\n const isFirstStep = computed(() => props.step === 0);\n const isLastStep = computed(() => props.step === props.totalSteps);\n\n const showSteps = computed(() => !isFirstStep.value);\n\n const menuData = computed<Array<BentoMenuItem>>(() => [\n {\n text: t('restartTour'),\n handler: () => emit('restart'),\n icon: RefreshIcon,\n },\n ...(isLastStep.value\n ? []\n : [\n {\n text: t('skipTour'),\n handler: () => emit('finish'),\n icon: BlockedIcon,\n },\n ]),\n ]);\n\n const computedActions = computed(() => {\n let primaryAction: BentoButtonActionObject;\n if (isFirstStep.value) {\n primaryAction = props.single ? ACTION_OK.value : ACTION_START.value;\n } else if (isLastStep.value) {\n primaryAction = ACTION_FINISH.value;\n } else {\n primaryAction = ACTION_NEXT.value;\n }\n\n const actions = [primaryAction];\n if (isFirstStep.value && !props.single) {\n actions.push(ACTION_SKIP.value);\n } else if (props.action) {\n actions.push(props.action);\n }\n\n return actions;\n });\n\n watch(\n () => props.active,\n async isActive => {\n if (isActive && targetElement.value?.scrollIntoView) {\n targetElement.value?.scrollIntoView(\n props.scrollOptions != null ? props.scrollOptions : DEFAULT_SCROLL_OPTIONS\n );\n\n // Skip to next tick to preserve popover appear animation\n await nextTick();\n }\n\n isPopoverOpen.value = isActive;\n isIndicatorVisible.value = isActive;\n },\n { immediate: true }\n );\n</script>\n\n<script lang=\"ts\">\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./tutorial-popover.scss\" />\n","<template>\n <div class=\"b-tutorial\">\n <tutorial-popover\n v-for=\"(step, i) in steps\"\n v-bind=\"getPopoverProps(step, i)\"\n :key=\"step.title\"\n @finish=\"currentStep = -1\"\n @next=\"currentStep += 1\"\n @restart=\"currentStep = 0\"\n >\n {{ step.description }}\n </tutorial-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, type PropType, ref, watch } from 'vue';\n import { TutorialPopover } from './components/tutorial-popover';\n import type { BentoTutorialScrollOptions, BentoTutorialStep } from './tutorial.types';\n\n const props = defineProps({\n /**\n * The current step index. If provided, will start the tutorial in that step.\n */\n index: {\n type: Number,\n default: null,\n },\n\n /**\n * The steps configuration for the tutorial.\n *\n */\n steps: {\n type: Array as PropType<Array<BentoTutorialStep>>,\n required: true,\n validator: (value: Array<BentoTutorialStep>) => value.length > 0,\n },\n\n /**\n * Options to control the scroll into view behavior.\n * Takes the same options as the `scrollIntoView` function\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView}\n */\n scrollOptions: {\n type: [Boolean, Object] as PropType<BentoTutorialScrollOptions>,\n default: null,\n },\n });\n\n const emit = defineEmits<{\n /**\n * Fired every time the step index is changed. `-1` value means the tutorial is finished/skipped.\n */\n (e: 'update:index', value: number);\n }>();\n\n const currentStep = ref(props.index || 0);\n\n const totalSteps = computed(() => props.steps.length - 1);\n const isSingleTutorial = computed(() => totalSteps.value === 0);\n\n function getPopoverProps(step: BentoTutorialStep, index: number) {\n return {\n // Visual\n targetElement: step.target,\n image: step.image,\n title: step.title,\n step: index,\n totalSteps: totalSteps.value,\n action: step.action,\n scrollOptions: props.scrollOptions,\n\n // Config\n active: index === currentStep.value,\n single: isSingleTutorial.value,\n position: step.position,\n };\n }\n\n watch(currentStep, step => {\n emit('update:index', step);\n });\n\n watch(\n () => props.index,\n value => {\n if (value >= -1 && value <= totalSteps.value) {\n currentStep.value = value;\n }\n }\n );\n</script>\n\n<script lang=\"ts\">\n /**\n * The Tutorial is a temporary popover that should be used to educate users about\n * new or unfamiliar features or experiences.\n *\n * You can use single tutorial or chain them into a tour.\n *\n * Only use this component for new features/experiences that are not obvious and\n * self-explanatory on their own.\n *\n * @example\n * import { BentoTutorial } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoTutorial },\n * template: `\n * <bento-tutorial\n * :steps=\"[\n * {\n * target: targetElement1,\n * title: 'Tutorial intro title',\n * description: 'Intro body content',\n * image: { src: imageSource, alt: 'Alt text' }\n * },\n * {\n * target: targetElement1,\n * title: 'Tutorial intro title',\n * description: 'Intro body content',\n * action: { title: 'Action label', event: () => {} }\n * },\n * ]\"\n * />\n * `\n * }\n */\n export default {};\n</script>\n"],"names":["BORDER_OFFSET","computedStyles","ref","getBorderRadius","element","radius","middleware","hide","offset","x","y","elements","target","instance","getCurrentInstance","uuid","__default__$1","messages","DEFAULT_SCROLL_OPTIONS","props","__props","useI18n","emit","__emit","ACTION_SKIP","computed","ACTION_START","ACTION_NEXT","ACTION_FINISH","ACTION_OK","isPopoverOpen","isIndicatorVisible","targetElement","isRef","isFirstStep","isLastStep","showSteps","menuData","_sfc_main$4","_sfc_main$2","computedActions","primaryAction","actions","watch","isActive","nextTick","__default__","currentStep","totalSteps","isSingleTutorial","getPopoverProps","step","index","value"],"mappings":";;;;;;;;;;;AAmBI,MAAAA,IAAA;;;;;;;;;;;;;AAaA,UAAAC,IAAAC,EAAA;AAAA,MAA2B,OAAA;AAAA,MAChB,QAAA;AAAA,MACC,cAAA;AAAA,IACM,CAAA;AAGlB,aAAAC,EAAAC,GAAA;AACI,UAAA;AACI,cAAAC,IAAA,WAAA,iBAAAD,CAAA,EAAA,iBAAA,eAAA,CAAA;AACA,eAAA,OAAA,MAAAC,CAAA,IAAA,KAAA,GAAAA,IAAA,IAAAL,CAAA;AAAA,MAAgE,QAAA;AAEhE,eAAA;AAAA,MAAO;AAAA,IACX;AAGJ,UAAAM,IAAA;AAAA,MAAmBC,GAAA;AAAA,MACVC,GAAA;AAAA,QACE,UAAAR;AAAA,QACO,eAAA,CAAAA;AAAA,MACM,CAAA;AAAA,MACnB;AAAA,QACD,MAAA;AAAA,QACU,IAAA,CAAA,EAAA,GAAAS,GAAA,GAAAC,GAAA,UAAAC,EAAA,MAAA;AAEF,gBAAAC,IAAAD,EAAA;AACA,iBAAAV,EAAA,MAAA,QAAA,GAAAW,EAAA,cAAA,IAAAZ,CAAA,MACAC,EAAA,MAAA,SAAA,GAAAW,EAAA,eAAA,IAAAZ,CAAA,MACAC,EAAA,MAAA,eAAAE,EAAAS,CAAA,GACA,EAAA,GAAAH,GAAA,GAAAC,EAAA;AAAA,QAAc;AAAA,MAClB;AAAA,IACJ;;;;;;;;;;;;;;;;;;;;;;ACzDR,UAAAG,IAAAC,EAAA,GAIAC,IAAA,OAAAF,GAAA,OAAAA,GAAA,OAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAA,MAAAuB,EAAA,UAAA,CAAA;AAEA,aAAAE,EAAAC,GAAAC,GAAA;AACI,aAAA;AAAA;AAAA,QAAO,eAAAD,EAAA;AAAA,QAEiB,OAAAA,EAAA;AAAA,QACR,OAAAA,EAAA;AAAA,QACA,MAAAC;AAAA,QACN,YAAAJ,EAAA;AAAA,QACiB,QAAAG,EAAA;AAAA,QACV,eAAAhC,EAAA;AAAA;AAAA,QACQ,QAAAiC,MAAAL,EAAA;AAAA,QAGS,QAAAE,EAAA;AAAA,QACL,UAAAE,EAAA;AAAA,MACV;AAAA,IACnB;AAGJ,WAAAR,EAAAI,GAAA,CAAAI,MAAA;AACI,MAAA7B,EAAA,gBAAA6B,CAAA;AAAA,IAAyB,CAAA,GAG7BR;AAAA,MAAA,MAAAxB,EAAA;AAAA,MACgB,CAAAkC,MAAA;AAER,QAAAA,KAAA,MAAAA,KAAAL,EAAA,UACID,EAAA,QAAAM;AAAA,MACJ;AAAA,IACJ;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"tutorial.vue_vue_type_script_setup_true_lang.CpzGxsmy.js","sources":["../../../vue2/src/components/tutorial/components/tutorial-popover/components/tutorial-indicator/tutorial-indicator.vue","../../../ui-assets/icons-16/dist/vue/blocked.vue","../../../vue2/src/components/tutorial/components/tutorial-popover/tutorial-popover.vue","../../../vue2/src/components/tutorial/tutorial.vue"],"sourcesContent":["<template>\n <popper-container\n :target-element=\"targetElement\"\n :middleware=\"middleware\"\n position=\"top-start\"\n fixed-positioning\n disabled-focus-trap\n class=\"b-tutorial-indicator\"\n data-testid=\"tutorial-indicator\"\n >\n <div class=\"b-tutorial-indicator__highlight\" :style=\"computedStyles\"></div>\n </popper-container>\n</template>\n\n<script setup lang=\"ts\">\n import { ref } from 'vue';\n import { hide, type Middleware, offset } from '@floating-ui/vue';\n import { PopperContainer } from '@/components/popper-container';\n\n const BORDER_OFFSET = 2;\n\n defineProps({\n /**\n * Tutorial indicator's target element.\n * The indicator will position itself around the target element.\n */\n targetElement: {\n type: PopperContainer.props?.targetElement.type,\n required: true,\n },\n });\n\n const computedStyles = ref({\n width: '0',\n height: '0',\n borderRadius: '0',\n });\n\n function getBorderRadius(element: HTMLElement) {\n try {\n const radius = parseFloat(getComputedStyle(element).getPropertyValue('border-radius'));\n return Number.isNaN(radius) ? '' : `${radius + 2 * BORDER_OFFSET}px`;\n } catch {\n return '';\n }\n }\n\n const middleware = [\n hide(),\n offset({\n mainAxis: BORDER_OFFSET,\n alignmentAxis: -BORDER_OFFSET,\n }),\n {\n name: 'updateIndicatorSize',\n fn: ({ x, y, elements }) => {\n const target = elements.reference as HTMLElement;\n computedStyles.value.width = `${target.offsetWidth + 4 * BORDER_OFFSET}px`;\n computedStyles.value.height = `${target.offsetHeight + 4 * BORDER_OFFSET}px`;\n computedStyles.value.borderRadius = getBorderRadius(target);\n return { x, y };\n },\n } as Middleware,\n ];\n</script>\n\n<style lang=\"scss\" scoped src=\"./tutorial-indicator.scss\" />\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><g :clip-path=\"'url(#uia-ui-assets/icons-16-blocked__a' + uuid + ')'\"><path fill=\"#001222\" d=\"M9.51195 0.398918C8.00859 0.0998821 6.45033 0.253358 5.0342 0.839937C3.61808 1.42652 2.40769 2.41985 1.55611 3.69433C0.704529 4.96881 0.25 6.4672 0.25 8C0.25 10.0554 1.06652 12.0267 2.51992 13.4801C3.97333 14.9335 5.94457 15.75 8 15.75C9.53281 15.75 11.0312 15.2955 12.3057 14.4439C13.5801 13.5923 14.5735 12.3819 15.1601 10.9658C15.7466 9.54967 15.9001 7.99141 15.6011 6.48805C15.3021 4.9847 14.5639 3.60378 13.4801 2.51993C12.3962 1.43607 11.0153 0.697953 9.51195 0.398918ZM5.60823 2.22576C6.75027 1.75271 8.00693 1.62894 9.21931 1.8701C10.4317 2.11125 11.5453 2.70651 12.4194 3.58059C13.2935 4.45466 13.8887 5.56831 14.1299 6.78069C14.3711 7.99307 14.2473 9.24974 13.7742 10.3918C13.5555 10.9198 13.2667 11.4124 12.9177 11.8573L4.14271 3.0823C4.58761 2.73333 5.08018 2.44448 5.60823 2.22576ZM3.08208 4.14298L11.857 12.9179C11.7327 13.0154 11.6044 13.1085 11.4723 13.1967C10.4445 13.8834 9.23613 14.25 8 14.25C6.3424 14.25 4.75268 13.5915 3.58058 12.4194C2.40848 11.2473 1.75 9.65761 1.75 8C1.75 6.76387 2.11656 5.5555 2.80331 4.52769C2.89155 4.39564 2.98456 4.26733 3.08208 4.14298Z\"/></g><defs><clipPath :id=\"'uia-ui-assets/icons-16-blocked__a' + uuid\"><rect width=\"16\" height=\"16\" fill=\"#fff\"/></clipPath></defs></svg>\n</template>\n<script setup>\n import { getCurrentInstance } from 'vue';\n import '../css/main.css';\n\n const instance = getCurrentInstance();\n const uuid = String(instance?.uid ?? instance?.proxy?._uid);\n</script>\n","<template>\n <div v-if=\"active && targetElement\">\n <tutorial-indicator v-if=\"isIndicatorVisible && targetElement\" :target-element=\"targetElement\" />\n\n <bento-popover\n :target-element=\"targetElement\"\n :position=\"position\"\n :open=\"isPopoverOpen\"\n :aria-label=\"title\"\n fixed-positioning\n class=\"b-tutorial-popover\"\n @keydown.esc.native=\"emit('finish')\"\n >\n <template v-if=\"image\" #image>\n <bento-image v-bind=\"image\" aspect-ratio=\"landscape\" class=\"b-tutorial-popover__image\" />\n </template>\n\n <div aria-hidden=\"true\" class=\"b-tutorial-popover__ripple\"></div>\n\n <div class=\"b-tutorial-popover__header\">\n <bento-typography variant=\"title\" el=\"span\"> {{ title }} </bento-typography>\n\n <bento-typography v-if=\"showSteps\" el=\"span\" class=\"b-tutorial-popover__steps\">\n {{ t('stepsOfTotal', { step, totalSteps }) }}\n </bento-typography>\n </div>\n\n <bento-typography>\n <slot />\n </bento-typography>\n\n <div class=\"b-tutorial-popover__footer\">\n <bento-menu\n v-if=\"!isFirstStep\"\n :data=\"menuData\"\n class=\"b-tutorial-popover__menu\"\n data-testid=\"menu-button\"\n />\n <div class=\"b-tutorial-popover__actions\">\n <bento-button-actions :actions=\"computedActions\" layout=\"buttons-end\" />\n </div>\n </div>\n </bento-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, isRef, nextTick, type PropType, ref, type default as Vue, watch } from 'vue';\n import { BentoMenu } from '@/components/menu';\n import { BentoPopover, BentoPopoverPositions } from '@/components/popover';\n import { BentoTypography } from '@/components/typography';\n import { type BentoButtonActionObject, BentoButtonActions } from '@/components/button';\n import { BentoImage } from '@/components/image';\n import { TutorialIndicator } from './components/tutorial-indicator';\n import { useI18n } from '@/utils/ts/i18n';\n import type { BentoMenuItem } from '@/components/menu/components';\n import type { VueNodeElement } from '@/types/elements';\n import type { BentoTutorialScrollOptions, BentoTutorialStep } from '../../tutorial.types';\n import RefreshIcon from '@adyen/ui-assets-icons-16/vue/refresh';\n import BlockedIcon from '@adyen/ui-assets-icons-16/vue/blocked';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const DEFAULT_SCROLL_OPTIONS: BentoTutorialScrollOptions = { behavior: 'smooth' };\n\n const props = defineProps({\n /**\n * Optional configuration for the secondary action.\n * In tour tutorials, this is ignored for the introductory step.\n */\n action: {\n type: Object as PropType<BentoButtonActionObject>,\n default: null,\n },\n\n /**\n * Indicates whether this popover is the active step (and should be visible).\n */\n active: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Optional illustration to display at the top of the popover.\n */\n image: {\n type: Object as PropType<BentoTutorialStep['image']>,\n default: null,\n },\n\n /**\n * Popover's position relative to the target element.\n * Possible values are:\n * 'auto', 'auto-start', 'auto-end',\n * 'top', 'top-start', 'top-end'\n * 'right', 'right-start', 'right-end'\n * 'bottom', 'bottom-start', 'bottom-end'\n * 'left', 'left-start', 'left-end'\n */\n position: {\n type: String as PropType<`${BentoPopoverPositions}`>,\n default: BentoPopoverPositions.BOTTOM_START,\n validator: (value: BentoPopoverPositions) => Object.values(BentoPopoverPositions).includes(value),\n },\n\n /**\n * Options to control the scroll into view behavior.\n * Takes the same options as the `scrollIntoView` function\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView}\n */\n scrollOptions: {\n type: [Boolean, Object] as PropType<BentoTutorialScrollOptions>,\n default: null,\n },\n\n /**\n * Indicates whether this popover is a single tutorial or a tour.\n */\n single: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The tutorial step number.\n * In tour tutorials, `0` is the introductory step, and is displayed next\n * to the title.\n */\n step: {\n type: Number,\n default: null,\n },\n\n /**\n * Tutorial popover's target element.\n * The popover will position itself relatively to target element.\n */\n targetElement: {\n type: [Element, Object] as PropType<VueNodeElement>,\n required: true,\n },\n\n /**\n * The tutorial step title.\n */\n title: {\n type: String,\n required: true,\n },\n\n /**\n * Total count of steps.\n * In tour tutorials, this does not include the introductory step, and is\n * displayed next to the title.\n */\n totalSteps: {\n type: Number,\n default: null,\n },\n });\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const emit = defineEmits<{\n /**\n * Emitted when the user clicks the primary action in popovers during introductory or intermediate steps of tour tutorials\n */\n (e: 'next'): void;\n\n /**\n * Emitted when the user clicks the primary action in a single tutorial, the last step of a tour, or skips the tutorial\n */\n (e: 'finish'): void;\n\n /**\n * Emitted when the user selects the restart tour option\n */\n (e: 'restart'): void;\n }>();\n\n const ACTION_SKIP = computed<BentoButtonActionObject>(() => ({\n title: t('skipTour') as string,\n event: () => emit('finish'),\n }));\n\n const ACTION_START = computed<BentoButtonActionObject>(() => ({\n title: t('startTour') as string,\n event: () => emit('next'),\n }));\n\n const ACTION_NEXT = computed<BentoButtonActionObject>(() => ({\n title: t('next') as string,\n event: () => emit('next'),\n }));\n\n const ACTION_FINISH = computed<BentoButtonActionObject>(() => ({\n title: t('finish') as string,\n event: () => emit('finish'),\n }));\n\n const ACTION_OK = computed<BentoButtonActionObject>(() => ({\n title: t('ok') as string,\n event: () => emit('finish'),\n }));\n\n const isPopoverOpen = ref(false);\n const isIndicatorVisible = ref(false);\n\n const targetElement = computed(() => {\n if (isRef(props.targetElement)) {\n return ((props.targetElement.value as Vue)?.$el || props.targetElement.value) as HTMLElement;\n }\n return ((props.targetElement as Vue).$el || props.targetElement) as HTMLElement;\n });\n\n const isFirstStep = computed(() => props.step === 0);\n const isLastStep = computed(() => props.step === props.totalSteps);\n\n const showSteps = computed(() => !isFirstStep.value);\n\n const menuData = computed<Array<BentoMenuItem>>(() => [\n {\n text: t('restartTour'),\n handler: () => emit('restart'),\n icon: RefreshIcon,\n },\n ...(isLastStep.value\n ? []\n : [\n {\n text: t('skipTour'),\n handler: () => emit('finish'),\n icon: BlockedIcon,\n },\n ]),\n ]);\n\n const computedActions = computed(() => {\n let primaryAction: BentoButtonActionObject;\n if (isFirstStep.value) {\n primaryAction = props.single ? ACTION_OK.value : ACTION_START.value;\n } else if (isLastStep.value) {\n primaryAction = ACTION_FINISH.value;\n } else {\n primaryAction = ACTION_NEXT.value;\n }\n\n const actions = [primaryAction];\n if (isFirstStep.value && !props.single) {\n actions.push(ACTION_SKIP.value);\n } else if (props.action) {\n actions.push(props.action);\n }\n\n return actions;\n });\n\n watch(\n () => props.active,\n async isActive => {\n if (isActive && targetElement.value?.scrollIntoView) {\n targetElement.value?.scrollIntoView(\n props.scrollOptions != null ? props.scrollOptions : DEFAULT_SCROLL_OPTIONS\n );\n\n // Skip to next tick to preserve popover appear animation\n await nextTick();\n }\n\n isPopoverOpen.value = isActive;\n isIndicatorVisible.value = isActive;\n },\n { immediate: true }\n );\n</script>\n\n<script lang=\"ts\">\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./tutorial-popover.scss\" />\n","<template>\n <div class=\"b-tutorial\">\n <tutorial-popover\n v-for=\"(step, i) in steps\"\n v-bind=\"getPopoverProps(step, i)\"\n :key=\"step.title\"\n @finish=\"currentStep = -1\"\n @next=\"currentStep += 1\"\n @restart=\"currentStep = 0\"\n >\n {{ step.description }}\n </tutorial-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, type PropType, ref, watch } from 'vue';\n import { TutorialPopover } from './components/tutorial-popover';\n import type { BentoTutorialScrollOptions, BentoTutorialStep } from './tutorial.types';\n\n const props = defineProps({\n /**\n * The current step index. If provided, will start the tutorial in that step.\n */\n index: {\n type: Number,\n default: null,\n },\n\n /**\n * The steps configuration for the tutorial.\n *\n */\n steps: {\n type: Array as PropType<Array<BentoTutorialStep>>,\n required: true,\n validator: (value: Array<BentoTutorialStep>) => value.length > 0,\n },\n\n /**\n * Options to control the scroll into view behavior.\n * Takes the same options as the `scrollIntoView` function\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView}\n */\n scrollOptions: {\n type: [Boolean, Object] as PropType<BentoTutorialScrollOptions>,\n default: null,\n },\n });\n\n const emit = defineEmits<{\n /**\n * Fired every time the step index is changed. `-1` value means the tutorial is finished/skipped.\n */\n (e: 'update:index', value: number);\n }>();\n\n const currentStep = ref(props.index || 0);\n\n const totalSteps = computed(() => props.steps.length - 1);\n const isSingleTutorial = computed(() => totalSteps.value === 0);\n\n function getPopoverProps(step: BentoTutorialStep, index: number) {\n return {\n // Visual\n targetElement: step.target,\n image: step.image,\n title: step.title,\n step: index,\n totalSteps: totalSteps.value,\n action: step.action,\n scrollOptions: props.scrollOptions,\n\n // Config\n active: index === currentStep.value,\n single: isSingleTutorial.value,\n position: step.position,\n };\n }\n\n watch(currentStep, step => {\n emit('update:index', step);\n });\n\n watch(\n () => props.index,\n value => {\n if (value >= -1 && value <= totalSteps.value) {\n currentStep.value = value;\n }\n }\n );\n</script>\n\n<script lang=\"ts\">\n /**\n * The Tutorial is a temporary popover that should be used to educate users about\n * new or unfamiliar features or experiences.\n *\n * You can use single tutorial or chain them into a tour.\n *\n * Only use this component for new features/experiences that are not obvious and\n * self-explanatory on their own.\n *\n * @example\n * import { BentoTutorial } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoTutorial },\n * template: `\n * <bento-tutorial\n * :steps=\"[\n * {\n * target: targetElement1,\n * title: 'Tutorial intro title',\n * description: 'Intro body content',\n * image: { src: imageSource, alt: 'Alt text' }\n * },\n * {\n * target: targetElement1,\n * title: 'Tutorial intro title',\n * description: 'Intro body content',\n * action: { title: 'Action label', event: () => {} }\n * },\n * ]\"\n * />\n * `\n * }\n */\n export default {};\n</script>\n"],"names":["BORDER_OFFSET","computedStyles","ref","getBorderRadius","element","radius","middleware","hide","offset","x","y","elements","target","instance","getCurrentInstance","uuid","__default__$1","messages","DEFAULT_SCROLL_OPTIONS","props","__props","useI18n","emit","__emit","ACTION_SKIP","computed","ACTION_START","ACTION_NEXT","ACTION_FINISH","ACTION_OK","isPopoverOpen","isIndicatorVisible","targetElement","isRef","isFirstStep","isLastStep","showSteps","menuData","_sfc_main$4","_sfc_main$2","computedActions","primaryAction","actions","watch","isActive","nextTick","__default__","currentStep","totalSteps","isSingleTutorial","getPopoverProps","step","index","value"],"mappings":";;;;;;;;;;;AAmBI,MAAAA,IAAA;;;;;;;;;;;;;AAaA,UAAAC,IAAAC,EAAA;AAAA,MAA2B,OAAA;AAAA,MAChB,QAAA;AAAA,MACC,cAAA;AAAA,IACM,CAAA;AAGlB,aAAAC,EAAAC,GAAA;AACI,UAAA;AACI,cAAAC,IAAA,WAAA,iBAAAD,CAAA,EAAA,iBAAA,eAAA,CAAA;AACA,eAAA,OAAA,MAAAC,CAAA,IAAA,KAAA,GAAAA,IAAA,IAAAL,CAAA;AAAA,MAAgE,QAAA;AAEhE,eAAA;AAAA,MAAO;AAAA,IACX;AAGJ,UAAAM,IAAA;AAAA,MAAmBC,GAAA;AAAA,MACVC,GAAA;AAAA,QACE,UAAAR;AAAA,QACO,eAAA,CAAAA;AAAA,MACM,CAAA;AAAA,MACnB;AAAA,QACD,MAAA;AAAA,QACU,IAAA,CAAA,EAA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AA,iBAAA,OAAAA,EAAA,gBAAAD;AAAA,QACmC,GAIxD,MAAA2B,EAAA,IAGJf,EAAA,QAAAc,GACAb,EAAA,QAAAa;AAAA,MAA2B;AAAA,MAC/B,EAAA,WAAA,GAAA;AAAA,IACkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kGClJtBE,KAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA7GA,UAAA3B,IAAAC,GA8BAE,IAAAC,GAOAwB,IAAA7C,EAAAiB,EAAA,SAAA,CAAA,GAEA6B,IAAAvB,EAAA,MAAAN,EAAA,MAAA,SAAA,CAAA,GACA8B,IAAAxB,EAAA,MAAAuB,EAAA,UAAA,CAAA;AAEA,aAAAE,EAAAC,GAAAC,GAAA;AACI,aAAA;AAAA;AAAA,QAAO,eAAAD,EAAA;AAAA,QAEiB,OAAAA,EAAA;AAAA,QACR,OAAAA,EAAA;AAAA,QACA,MAAAC;AAAA,QACN,YAAAJ,EAAA;AAAA,QACiB,QAAAG,EAAA;AAAA,QACV,eAAAhC,EAAA;AAAA;AAAA,QACQ,QAAAiC,MAAAL,EAAA;AAAA,QAGS,QAAAE,EAAA;AAAA,QACL,UAAAE,EAAA;AAAA,MACV;AAAA,IACnB;AAGJ,WAAAR,EAAAI,GAAA,CAAAI,MAAA;AACI,MAAA7B,EAAA,gBAAA6B,CAAA;AAAA,IAAyB,CAAA,GAG7BR;AAAA,MAAA,MAAAxB,EAAA;AAAA,MACgB,CAAAkC,MAAA;AAER,QAAAA,KAAA,MAAAA,KAAAL,EAAA,UACID,EAAA,QAAAM;AAAA,MACJ;AAAA,IACJ;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typography.B6elnWpr.js","sources":["../../../vue2/src/utils/ts/dev-environment.ts","../../../vue2/src/utils/ts/print-development-warning.ts","../../../vue2/src/utils/ts/deprecate.ts","../../../vue2/src/components/typography/typography.types.ts","../../../vue2/src/components/typography/typography.vue"],"sourcesContent":["const DEV_ENVIROMENT_NAMES = ['development', 'DEVELOPMENT', 'dev', 'DEV'];\n\nexport const isDevelopmentEnviroment = () => DEV_ENVIROMENT_NAMES.includes(process.env.NODE_ENV);\n","import { isDevelopmentEnviroment } from '@/utils/ts/dev-environment';\n\n/**\n * Prints console.warn messages in development mode only.\n *\n * @see console.warn for what parameters you can use\n */\n\nexport function printDevelopmentWarning(...args: Parameters<typeof console.warn>) {\n if (isDevelopmentEnviroment()) {\n // eslint-disable-next-line no-console\n console.warn(...args);\n }\n}\n","import { printDevelopmentWarning } from './print-development-warning';\n\nconst DEPRECATION_STYLES = ['color: red', 'background: yellow'].join(';');\nconst shownMessages = new Set<string>();\n\n/**\n * Informs users about the deprecations in development mode only.\n *\n * @param title Indicates what is being deprecated.\n * @param deprecationMessage How to avoid the deprecation by giving an example of the alternatives. Backticks can be used to multi-line the message.\n * @param toBeRemovedInVersion The version it will be removed. Must be in X.Y.Z format.\n */\nexport function deprecate(title: string, deprecationMessage: string, toBeRemovedInVersion: string) {\n // If the message is already showing, don't show it again\n if (!shownMessages.has(title)) {\n printDevelopmentWarning(`%cDEPRECATED:\\x1b[0m ${title}`, DEPRECATION_STYLES);\n // Format multi-line descriptions with the backtick\n printDevelopmentWarning(`${deprecationMessage.replaceAll(' ', '').trim()}`);\n printDevelopmentWarning(`To be removed in: %c${toBeRemovedInVersion}`, DEPRECATION_STYLES);\n shownMessages.add(title);\n }\n}\n\n/**\n * Reset shownMessages set\n *\n * @deprecated Since v0.0.0. Do not use.\n */\nexport function resetShownMessages() {\n shownMessages.clear();\n}\n","/**\n * @deprecated Since v3.0.0. Use string literal instead.\n */\nexport enum BentoTypographyVariant {\n CAPTION = 'caption',\n BODY = 'body',\n /** @deprecated Since v3.0.0. Use `TITLE` instead. */\n SUBTITLE = 'subtitle',\n TITLE = 'title',\n}\n\nexport enum BentoTypographyModifier {\n WIDE = 'wide',\n STRONGER = 'stronger',\n STRONGER_WIDE = 'stronger-wide',\n STRONGEST = 'strongest',\n STRONGEST_WIDE = 'strongest-wide',\n MEDIUM = 'm',\n LARGE = 'l',\n MOBILE = 'mobile',\n MONOSPACE = 'monospace',\n}\n\n/**\n * @deprecated Since v3.0.0. Use string literal instead.\n */\nexport enum BentoTypographyElement {\n H1 = 'h1',\n H2 = 'h2',\n H3 = 'h3',\n H4 = 'h4',\n H5 = 'h5',\n H6 = 'h6',\n DIV = 'div',\n PARAGRAPH = 'p',\n SPAN = 'span',\n}\n\nexport interface BentoTypographyProps {\n /**\n * Sets the HTML DOM element.\n * @values h1, h2, h3, h4, h5, h6, div, p, span\n */\n el?: BentoTypographyElement | `${BentoTypographyElement}`;\n\n /**\n * Adds the large class modifier.\n * Applicable to the Title variant.\n */\n large?: boolean;\n\n /**\n * Adds the medium class modifier.\n * Applicable to the Title variant.\n */\n medium?: boolean;\n\n /**\n * Changes the font family to monospace.\n * Applicable to all variants.\n */\n monospace?: boolean;\n\n /**\n * Adds the rich-text modifier, which allows for the use of HTML tags inside typography.\n */\n richText?: boolean;\n\n /**\n * Adds the stronger class modifier.\n * Applicable to Caption, Body and Subtitle variants.\n */\n stronger?: boolean;\n\n /**\n * Adds the strongest class modifier.\n * Applicable to Caption, Body and Subtitle variants.\n */\n strongest?: boolean;\n\n /**\n * Sets the type of typography variant.\n * @values caption, body, title.\n */\n variant?: BentoTypographyVariant | `${BentoTypographyVariant}`;\n\n /**\n * Adds the medium class modifier.\n * Applicable to the Body variant.\n */\n wide?: boolean;\n}\n","<template>\n <component :is=\"el\" class=\"b-typography\" :class=\"conditionalClasses\" data-testid=\"typography\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, onMounted } from 'vue';\n import { deprecate } from '@/utils/ts/deprecate';\n import {\n BentoTypographyElement,\n BentoTypographyModifier,\n type BentoTypographyProps,\n BentoTypographyVariant,\n } from './typography.types';\n\n const props = withDefaults(defineProps<BentoTypographyProps>(), {\n el: BentoTypographyElement.PARAGRAPH,\n large: false,\n medium: false,\n monospace: false,\n stronger: false,\n strongest: false,\n variant: BentoTypographyVariant.BODY,\n wide: false,\n });\n\n if (props.variant === BentoTypographyVariant.SUBTITLE) {\n deprecate(\n 'BentoTypography \"subtitle\" variant (BentoTypographyVariant.SUBTITLE)',\n `Use the \"title\" or \"BentoTypographyVariant.TITLE\" variant and (optionally) combine it with a size property. e.g. medium / large.\n <bento-typography :variant=\"BentoTypographyVariant.TITLE\" medium>`,\n '3.0.0'\n );\n }\n\n const conditionalClasses = computed(() => ({\n // Rich text\n ['b-typography--rich-text']: props.richText,\n // Monospace\n [`b-typography--${BentoTypographyModifier.MONOSPACE}`]: props.monospace,\n\n // Caption\n [`b-typography--${BentoTypographyVariant.CAPTION}`]: props.variant === BentoTypographyVariant.CAPTION,\n [`b-typography--${BentoTypographyVariant.CAPTION}-${BentoTypographyModifier.WIDE}`]:\n props.variant === BentoTypographyVariant.CAPTION && props.wide,\n [`b-typography--${BentoTypographyVariant.CAPTION}-${BentoTypographyModifier.STRONGER}`]:\n props.variant === BentoTypographyVariant.CAPTION && props.stronger,\n\n // Body\n [`b-typography--${BentoTypographyVariant.BODY}`]: props.variant === BentoTypographyVariant.BODY,\n [`b-typography--${BentoTypographyVariant.BODY}-${BentoTypographyModifier.WIDE}`]:\n props.variant === BentoTypographyVariant.BODY && props.wide,\n [`b-typography--${BentoTypographyVariant.BODY}-${BentoTypographyModifier.STRONGER}`]:\n props.variant === BentoTypographyVariant.BODY && props.stronger,\n [`b-typography--${BentoTypographyVariant.BODY}-${BentoTypographyModifier.STRONGEST}`]:\n props.variant === BentoTypographyVariant.BODY && props.strongest,\n\n // Subtitle\n [`b-typography--${BentoTypographyVariant.SUBTITLE}`]: props.variant === BentoTypographyVariant.SUBTITLE,\n [`b-typography--${BentoTypographyVariant.SUBTITLE}-${BentoTypographyModifier.STRONGER}`]:\n props.variant === BentoTypographyVariant.SUBTITLE && props.stronger,\n\n // Title\n [`b-typography--${BentoTypographyVariant.TITLE}`]:\n props.variant === BentoTypographyVariant.TITLE && !props.medium && !props.large,\n [`b-typography--${BentoTypographyVariant.TITLE}-${BentoTypographyModifier.MEDIUM}`]:\n props.variant === BentoTypographyVariant.TITLE && props.medium,\n [`b-typography--${BentoTypographyVariant.TITLE}-${BentoTypographyModifier.LARGE}`]:\n props.variant === BentoTypographyVariant.TITLE && props.large,\n }));\n\n onMounted(() => {\n if (props.richText && props.el !== 'div') {\n throw new Error('Rich-text prop must be used with el=\"div\" for correct HTML semantics');\n }\n\n if (props.richText && props.variant === 'title') {\n throw new Error('Rich-text prop cannot be used with the title variant.');\n }\n\n if (props.richText && props.variant === 'subtitle') {\n throw new Error('Rich-text prop cannot be used with the subtitle variant.');\n }\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * The Typography component makes it easy to apply a default set of font weights, sizes and other text styles\n * easily to text. The variants and properties match with those found in Figma.\n *\n * For example, seeing text with the typography styling of\n *\n * @example\n * import { BentoTypography } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoTypography },\n * template: `\n * <bento-typography>\n * ... text content\n * </bento-typography>\n * `\n * }\n */\n export default {\n name: 'bento-typography',\n inheritAttrs: true,\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./typography.scss\" />\n"],"names":["DEV_ENVIROMENT_NAMES","isDevelopmentEnviroment","printDevelopmentWarning","args","DEPRECATION_STYLES","shownMessages","deprecate","title","deprecationMessage","toBeRemovedInVersion","BentoTypographyVariant","BentoTypographyVariant2","BentoTypographyModifier","BentoTypographyModifier2","BentoTypographyElement","BentoTypographyElement2","__default__","props","__props","conditionalClasses","computed","onMounted"],"mappings":";;;AAAA,MAAAA,IAAA,CAAA,eAAA,eAAA,OAAA,KAAA,GAEOC,IAAA,MAAAD,EAAA,SAAA,QAAA,IAAA,QAAA;ACMA,SAAAE,KAAAC,GAAA;AACH,EAAAF,EAAA,KAEI,QAAA,KAAA,GAAAE,CAAA;AAER;ACX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,YAAAA,EAAA,OAAA;AACI,cAAA,IAAA,MAAA,sEAAA;AAGJ,UAAAA,EAAA,YAAAA,EAAA,YAAA;AACI,cAAA,IAAA,MAAA,uDAAA;AAGJ,UAAAA,EAAA,YAAAA,EAAA,YAAA;AACI,cAAA,IAAA,MAAA,0DAAA;AAAA,IACJ,CAAA;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"typography.B6elnWpr.js","sources":["../../../vue2/src/utils/ts/dev-environment.ts","../../../vue2/src/utils/ts/print-development-warning.ts","../../../vue2/src/utils/ts/deprecate.ts","../../../vue2/src/components/typography/typography.types.ts","../../../vue2/src/components/typography/typography.vue"],"sourcesContent":["const DEV_ENVIROMENT_NAMES = ['development', 'DEVELOPMENT', 'dev', 'DEV'];\n\nexport const isDevelopmentEnviroment = () => DEV_ENVIROMENT_NAMES.includes(process.env.NODE_ENV);\n","import { isDevelopmentEnviroment } from '@/utils/ts/dev-environment';\n\n/**\n * Prints console.warn messages in development mode only.\n *\n * @see console.warn for what parameters you can use\n */\n\nexport function printDevelopmentWarning(...args: Parameters<typeof console.warn>) {\n if (isDevelopmentEnviroment()) {\n // eslint-disable-next-line no-console\n console.warn(...args);\n }\n}\n","import { printDevelopmentWarning } from './print-development-warning';\n\nconst DEPRECATION_STYLES = ['color: red', 'background: yellow'].join(';');\nconst shownMessages = new Set<string>();\n\n/**\n * Informs users about the deprecations in development mode only.\n *\n * @param title Indicates what is being deprecated.\n * @param deprecationMessage How to avoid the deprecation by giving an example of the alternatives. Backticks can be used to multi-line the message.\n * @param toBeRemovedInVersion The version it will be removed. Must be in X.Y.Z format.\n */\nexport function deprecate(title: string, deprecationMessage: string, toBeRemovedInVersion: string) {\n // If the message is already showing, don't show it again\n if (!shownMessages.has(title)) {\n printDevelopmentWarning(`%cDEPRECATED:\\x1b[0m ${title}`, DEPRECATION_STYLES);\n // Format multi-line descriptions with the backtick\n printDevelopmentWarning(`${deprecationMessage.replaceAll(' ', '').trim()}`);\n printDevelopmentWarning(`To be removed in: %c${toBeRemovedInVersion}`, DEPRECATION_STYLES);\n shownMessages.add(title);\n }\n}\n\n/**\n * Reset shownMessages set\n *\n * @deprecated Since v0.0.0. Do not use.\n */\nexport function resetShownMessages() {\n shownMessages.clear();\n}\n","/**\n * @deprecated Since v3.0.0. Use string literal instead.\n */\nexport enum BentoTypographyVariant {\n CAPTION = 'caption',\n BODY = 'body',\n /** @deprecated Since v3.0.0. Use `TITLE` instead. */\n SUBTITLE = 'subtitle',\n TITLE = 'title',\n}\n\nexport enum BentoTypographyModifier {\n WIDE = 'wide',\n STRONGER = 'stronger',\n STRONGER_WIDE = 'stronger-wide',\n STRONGEST = 'strongest',\n STRONGEST_WIDE = 'strongest-wide',\n MEDIUM = 'm',\n LARGE = 'l',\n MOBILE = 'mobile',\n MONOSPACE = 'monospace',\n}\n\n/**\n * @deprecated Since v3.0.0. Use string literal instead.\n */\nexport enum BentoTypographyElement {\n H1 = 'h1',\n H2 = 'h2',\n H3 = 'h3',\n H4 = 'h4',\n H5 = 'h5',\n H6 = 'h6',\n DIV = 'div',\n PARAGRAPH = 'p',\n SPAN = 'span',\n}\n\nexport interface BentoTypographyProps {\n /**\n * Sets the HTML DOM element.\n * @values h1, h2, h3, h4, h5, h6, div, p, span\n */\n el?: BentoTypographyElement | `${BentoTypographyElement}`;\n\n /**\n * Adds the large class modifier.\n * Applicable to the Title variant.\n */\n large?: boolean;\n\n /**\n * Adds the medium class modifier.\n * Applicable to the Title variant.\n */\n medium?: boolean;\n\n /**\n * Changes the font family to monospace.\n * Applicable to all variants.\n */\n monospace?: boolean;\n\n /**\n * Adds the rich-text modifier, which allows for the use of HTML tags inside typography.\n */\n richText?: boolean;\n\n /**\n * Adds the stronger class modifier.\n * Applicable to Caption, Body and Subtitle variants.\n */\n stronger?: boolean;\n\n /**\n * Adds the strongest class modifier.\n * Applicable to Caption, Body and Subtitle variants.\n */\n strongest?: boolean;\n\n /**\n * Sets the type of typography variant.\n * @values caption, body, title.\n */\n variant?: BentoTypographyVariant | `${BentoTypographyVariant}`;\n\n /**\n * Adds the wide class modifier.\n * Applicable to the Caption and Body variants.\n */\n wide?: boolean;\n}\n","<template>\n <component :is=\"el\" class=\"b-typography\" :class=\"conditionalClasses\" data-testid=\"typography\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, onMounted } from 'vue';\n import { deprecate } from '@/utils/ts/deprecate';\n import {\n BentoTypographyElement,\n BentoTypographyModifier,\n type BentoTypographyProps,\n BentoTypographyVariant,\n } from './typography.types';\n\n const props = withDefaults(defineProps<BentoTypographyProps>(), {\n el: BentoTypographyElement.PARAGRAPH,\n large: false,\n medium: false,\n monospace: false,\n stronger: false,\n strongest: false,\n variant: BentoTypographyVariant.BODY,\n wide: false,\n });\n\n if (props.variant === BentoTypographyVariant.SUBTITLE) {\n deprecate(\n 'BentoTypography \"subtitle\" variant (BentoTypographyVariant.SUBTITLE)',\n `Use the \"title\" or \"BentoTypographyVariant.TITLE\" variant and (optionally) combine it with a size property. e.g. medium / large.\n <bento-typography :variant=\"BentoTypographyVariant.TITLE\" medium>`,\n '3.0.0'\n );\n }\n\n const conditionalClasses = computed(() => ({\n // Rich text\n ['b-typography--rich-text']: props.richText,\n // Monospace\n [`b-typography--${BentoTypographyModifier.MONOSPACE}`]: props.monospace,\n\n // Caption\n [`b-typography--${BentoTypographyVariant.CAPTION}`]: props.variant === BentoTypographyVariant.CAPTION,\n [`b-typography--${BentoTypographyVariant.CAPTION}-${BentoTypographyModifier.WIDE}`]:\n props.variant === BentoTypographyVariant.CAPTION && props.wide,\n [`b-typography--${BentoTypographyVariant.CAPTION}-${BentoTypographyModifier.STRONGER}`]:\n props.variant === BentoTypographyVariant.CAPTION && props.stronger,\n\n // Body\n [`b-typography--${BentoTypographyVariant.BODY}`]: props.variant === BentoTypographyVariant.BODY,\n [`b-typography--${BentoTypographyVariant.BODY}-${BentoTypographyModifier.WIDE}`]:\n props.variant === BentoTypographyVariant.BODY && props.wide,\n [`b-typography--${BentoTypographyVariant.BODY}-${BentoTypographyModifier.STRONGER}`]:\n props.variant === BentoTypographyVariant.BODY && props.stronger,\n [`b-typography--${BentoTypographyVariant.BODY}-${BentoTypographyModifier.STRONGEST}`]:\n props.variant === BentoTypographyVariant.BODY && props.strongest,\n\n // Subtitle\n [`b-typography--${BentoTypographyVariant.SUBTITLE}`]: props.variant === BentoTypographyVariant.SUBTITLE,\n [`b-typography--${BentoTypographyVariant.SUBTITLE}-${BentoTypographyModifier.STRONGER}`]:\n props.variant === BentoTypographyVariant.SUBTITLE && props.stronger,\n\n // Title\n [`b-typography--${BentoTypographyVariant.TITLE}`]:\n props.variant === BentoTypographyVariant.TITLE && !props.medium && !props.large,\n [`b-typography--${BentoTypographyVariant.TITLE}-${BentoTypographyModifier.MEDIUM}`]:\n props.variant === BentoTypographyVariant.TITLE && props.medium,\n [`b-typography--${BentoTypographyVariant.TITLE}-${BentoTypographyModifier.LARGE}`]:\n props.variant === BentoTypographyVariant.TITLE && props.large,\n }));\n\n onMounted(() => {\n if (props.richText && props.el !== 'div') {\n throw new Error('Rich-text prop must be used with el=\"div\" for correct HTML semantics');\n }\n\n if (props.richText && props.variant === 'title') {\n throw new Error('Rich-text prop cannot be used with the title variant.');\n }\n\n if (props.richText && props.variant === 'subtitle') {\n throw new Error('Rich-text prop cannot be used with the subtitle variant.');\n }\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * The Typography component makes it easy to apply a default set of font weights, sizes and other text styles\n * easily to text. The variants and properties match with those found in Figma.\n *\n * For example, seeing text with the typography styling of\n *\n * @example\n * import { BentoTypography } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoTypography },\n * template: `\n * <bento-typography>\n * ... text content\n * </bento-typography>\n * `\n * }\n */\n export default {\n name: 'bento-typography',\n inheritAttrs: true,\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./typography.scss\" />\n"],"names":["DEV_ENVIROMENT_NAMES","isDevelopmentEnviroment","printDevelopmentWarning","args","DEPRECATION_STYLES","shownMessages","deprecate","title","deprecationMessage","toBeRemovedInVersion","BentoTypographyVariant","BentoTypographyVariant2","BentoTypographyModifier","BentoTypographyModifier2","BentoTypographyElement","BentoTypographyElement2","__default__","props","__props","conditionalClasses","computed","onMounted"],"mappings":";;;AAAA,MAAAA,IAAA,CAAA,eAAA,eAAA,OAAA,KAAA,GAEOC,IAAA,MAAAD,EAAA,SAAA,QAAA,IAAA,QAAA;ACMA,SAAAE,KAAAC,GAAA;AACH,EAAAF,EAAA,KAEI,QAAA,KAAA,GAAAE,CAAA;AAER;ACXA,MAAAC,IAAA,CAAA,cAAA,oBAAA,EAAA,KAAA,GAAA,GACAC,IAAA,oBAAA,IAAA;AASO,SAAAC,EAAAC,GAAAC,GAAAC,GAAA;AAEH,EAAAJ,EAAA,IAAAE,CAAA,MACIL,EAAA,wBAAAK,CAAA,IAAAH,CAAA,GAEAF,EAAA,GAAAM,EAAA,WAAA,MAAA,EAAA,EAAA,KAAA,CAAA,EAAA,GACAN,EAAA,uBAAAO,CAAA,IAAAL,CAAA,GACAC,EAAA,IAAAE,CAAA;AAER;AClBO,IAAAG,IAAA,kBAAAC,OACHA,EAAA,UAAA,WACAA,EAAA,OAAA,QAEAA,EAAA,WAAA,YACAA,EAAA,QAAA,SALQA,IAAAD,KAAA,CAAA,CAAA,GAQLE,IAAA,kBAAAC,OACHA,EAAA,OAAA,QACAA,EAAA,WAAA,YACAA,EAAA,gBAAA,iBACAA,EAAA,YAAA,aACAA,EAAA,iBAAA,kBACAA,EAAA,SAAA,KACAA,EAAA,QAAA,KACAA,EAAA,SAAA,UACAA,EAAA,YAAA,aATQA,IAAAD,KAAA,CAAA,CAAA,GAeLE,IAAA,kBAAAC,OACHA,EAAA,KAAA,MACAA,EAAA,KAAA,MACAA,EAAA,KAAA,MACAA,EAAA,KAAA,MACAA,EAAA,KAAA,MACAA,EAAA,KAAA,MACAA,EAAA,MAAA,OACAA,EAAA,YAAA,KACAA,EAAA,OAAA,QATQA,IAAAD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,EAAA,KAAA,EAAA,GAAAO,EAAA,YAAAP,EAAA,SAAA,CAAAO,EAAA,UAAA,CAAAA,EAAA;AAAA,MAIe,CAAA,iBAAAP,EAAA,KAAA,IAAAE,EAAA,MAAA,EAAA,GAAAK,EAAA,YAAAP,EAAA,SAAAO,EAAA;AAAA,MAElB,CAAA,iBAAAP,EAAA,KAAA,IAAAE,EAAA,KAAA,EAAA,GAAAK,EAAA,YAAAP,EAAA,SAAAO,EAAA;AAAA,IAEA,EAAA;AAGhE,WAAAI,EAAA,MAAA;AACI,UAAAJ,EAAA,YAAAA,EAAA,OAAA;AACI,cAAA,IAAA,MAAA,sEAAA;AAGJ,UAAAA,EAAA,YAAAA,EAAA,YAAA;AACI,cAAA,IAAA,MAAA,uDAAA;AAGJ,UAAAA,EAAA,YAAAA,EAAA,YAAA;AACI,cAAA,IAAA,MAAA,0DAAA;AAAA,IACJ,CAAA;;;;;;;;;;;"}
|
package/dist/chunks/{use-date-input-formatter.deZ3kB0L.js → use-date-input-formatter.COZBxMaZ.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as U,
|
|
1
|
+
import { C as U, A as I, n as J } from "./calendar.BhoyTBN1.js";
|
|
2
2
|
import { computed as C } from "vue";
|
|
3
3
|
import { t as x, c as p, s as L, g as E, u as S, r as ee, v as te, j as Q, k as re } from "./en-US.C412g-7U.js";
|
|
4
4
|
import { s as T } from "./startOfWeek.CzdYFzXX.js";
|
|
@@ -1626,4 +1626,4 @@ export {
|
|
|
1626
1626
|
Pt as u,
|
|
1627
1627
|
v as w
|
|
1628
1628
|
};
|
|
1629
|
-
//# sourceMappingURL=use-date-input-formatter.
|
|
1629
|
+
//# sourceMappingURL=use-date-input-formatter.COZBxMaZ.js.map
|