@adyen/bento-vue2 1.45.0 → 1.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/index.d.ts +16661 -18774
- package/dist/accordion.js +1 -1
- package/dist/action-bar.js +1 -1
- package/dist/alert.js +1 -1
- package/dist/assets/accordion-item.css +1 -1
- package/dist/assets/action-bar.css +1 -1
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/card.css +1 -1
- package/dist/assets/data-grid.css +1 -1
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/dropdown.css +1 -1
- package/dist/assets/file-uploader.css +1 -1
- package/dist/assets/input-field.css +1 -1
- package/dist/assets/inspector.css +1 -1
- package/dist/assets/menu.css +1 -1
- package/dist/assets/modal-fullscreen.css +1 -1
- package/dist/assets/popover.css +1 -1
- package/dist/assets/sidepanel.css +1 -1
- package/dist/assets/step.css +1 -1
- package/dist/avatar.js +1 -1
- package/dist/button.js +3 -3
- package/dist/card.js +1 -1
- package/dist/checkbox.js +2 -2
- package/dist/chunks/{accordion-item.CzKttO4w.js → accordion-item.BjXzREaK.js} +5 -5
- package/dist/chunks/{accordion-item.CzKttO4w.js.map → accordion-item.BjXzREaK.js.map} +1 -1
- package/dist/chunks/{action-bar.BXemSuq4.js → action-bar.e_2fmyN_.js} +7 -7
- package/dist/chunks/{action-bar.BXemSuq4.js.map → action-bar.e_2fmyN_.js.map} +1 -1
- package/dist/chunks/{alert.CAIp-87f.js → alert.BcfhueIA.js} +3 -3
- package/dist/chunks/{alert.CAIp-87f.js.map → alert.BcfhueIA.js.map} +1 -1
- package/dist/chunks/{avatar.BgwjpLQO.js → avatar.DXzyWKsI.js} +2 -2
- package/dist/chunks/{avatar.BgwjpLQO.js.map → avatar.DXzyWKsI.js.map} +1 -1
- package/dist/chunks/{base-button.-gx_u8Bd.js → base-button.BeMKxkgK.js} +2 -2
- package/dist/chunks/{base-button.-gx_u8Bd.js.map → base-button.BeMKxkgK.js.map} +1 -1
- package/dist/chunks/{base-modal.4JSNBM4T.js → base-modal.UPLi477L.js} +18 -18
- package/dist/chunks/{base-modal.4JSNBM4T.js.map → base-modal.UPLi477L.js.map} +1 -1
- package/dist/chunks/{button-actions-with-menu.ieopdfI7.js → button-actions-with-menu.CyNvhDxN.js} +4 -4
- package/dist/chunks/{button-actions-with-menu.ieopdfI7.js.map → button-actions-with-menu.CyNvhDxN.js.map} +1 -1
- package/dist/chunks/{button-actions.CtFB6iRj.js → button-actions.BaypoF5i.js} +3 -3
- package/dist/chunks/{button-actions.CtFB6iRj.js.map → button-actions.BaypoF5i.js.map} +1 -1
- package/dist/chunks/{button.BX6ZJxF7.js → button.Bx8WC-dy.js} +3 -3
- package/dist/chunks/{button.BX6ZJxF7.js.map → button.Bx8WC-dy.js.map} +1 -1
- package/dist/chunks/{calendar.BouORZfb.js → calendar.LXRuFfcw.js} +9 -9
- package/dist/chunks/{calendar.BouORZfb.js.map → calendar.LXRuFfcw.js.map} +1 -1
- package/dist/chunks/{card.BabmUkTG.js → card.INSvvGNH.js} +6 -6
- package/dist/chunks/{card.BabmUkTG.js.map → card.INSvvGNH.js.map} +1 -1
- package/dist/chunks/{checkbox-group.DbLznnsa.js → checkbox-group.BNVnOYKH.js} +7 -7
- package/dist/chunks/{checkbox-group.DbLznnsa.js.map → checkbox-group.BNVnOYKH.js.map} +1 -1
- package/dist/chunks/{checkbox.fhQLs-NN.js → checkbox.CcwY2CMn.js} +5 -5
- package/dist/chunks/{checkbox.fhQLs-NN.js.map → checkbox.CcwY2CMn.js.map} +1 -1
- package/dist/chunks/{chevron-left.PIu6yPqe.js → chevron-left.CtnrsqUy.js} +3 -3
- package/dist/chunks/{chevron-left.PIu6yPqe.js.map → chevron-left.CtnrsqUy.js.map} +1 -1
- package/dist/chunks/{chevron-up.DVfo78kV.js → chevron-up.B2uWhZf7.js} +3 -3
- package/dist/chunks/{chevron-up.DVfo78kV.js.map → chevron-up.B2uWhZf7.js.map} +1 -1
- package/dist/chunks/{code-snippet.5iJcUZSo.js → code-snippet.Bs7wIGi8.js} +113 -83
- package/dist/chunks/code-snippet.Bs7wIGi8.js.map +1 -0
- package/dist/chunks/{codemirror.CXFEqvAi.js → codemirror.OjJ-3ixa.js} +5180 -4862
- package/dist/chunks/codemirror.OjJ-3ixa.js.map +1 -0
- package/dist/chunks/{controls-group.CnXzOQkX.js → controls-group.CIdhlTk3.js} +3 -3
- package/dist/chunks/{controls-group.CnXzOQkX.js.map → controls-group.CIdhlTk3.js.map} +1 -1
- package/dist/chunks/{copy.DN0tClPm.js → copy.BakPR7GI.js} +4 -4
- package/dist/chunks/{copy.DN0tClPm.js.map → copy.BakPR7GI.js.map} +1 -1
- package/dist/chunks/{country.Bft91V1L.js → country.BegULkAC.js} +3 -3
- package/dist/chunks/{country.Bft91V1L.js.map → country.BegULkAC.js.map} +1 -1
- package/dist/chunks/{currency.BmI4Sqy5.js → currency.P7Psn_SK.js} +2 -2
- package/dist/chunks/{currency.BmI4Sqy5.js.map → currency.P7Psn_SK.js.map} +1 -1
- package/dist/chunks/{dashboard-section.DYXZhtop.js → dashboard-section.DUN8FB74.js} +5 -5
- package/dist/chunks/{dashboard-section.DYXZhtop.js.map → dashboard-section.DUN8FB74.js.map} +1 -1
- package/dist/chunks/{dashed-underline.BvSZS1-m.js → dashed-underline.BDK3yEtw.js} +4 -4
- package/dist/chunks/{dashed-underline.BvSZS1-m.js.map → dashed-underline.BDK3yEtw.js.map} +1 -1
- package/dist/chunks/{data-grid-template.Du92TEFY.js → data-grid-template.BO2v-T1n.js} +4 -4
- package/dist/chunks/{data-grid-template.Du92TEFY.js.map → data-grid-template.BO2v-T1n.js.map} +1 -1
- package/dist/chunks/{data-grid.Kwtf1DMq.js → data-grid.NkQC0etq.js} +44 -44
- package/dist/chunks/{data-grid.Kwtf1DMq.js.map → data-grid.NkQC0etq.js.map} +1 -1
- package/dist/chunks/{date-picker.B7mTNghB.js → date-picker.DFgjvQgX.js} +11 -11
- package/dist/chunks/{date-picker.B7mTNghB.js.map → date-picker.DFgjvQgX.js.map} +1 -1
- package/dist/chunks/{date-range-picker.DPLri9D-.js → date-range-picker.BBC3TGYw.js} +241 -241
- package/dist/chunks/{date-range-picker.DPLri9D-.js.map → date-range-picker.BBC3TGYw.js.map} +1 -1
- package/dist/chunks/{date.1zs9CRhw.js → date.BQ29-2L1.js} +4 -2
- package/dist/chunks/{date.1zs9CRhw.js.map → date.BQ29-2L1.js.map} +1 -1
- package/dist/chunks/{dialog-page.DcJ7LaOE.js → dialog-page.Da2cxzZm.js} +31 -32
- package/dist/chunks/{dialog-page.DcJ7LaOE.js.map → dialog-page.Da2cxzZm.js.map} +1 -1
- package/dist/chunks/{dropdown-default-textbox.DBoSso4J.js → dropdown-default-textbox.CrylDCEX.js} +5 -5
- package/dist/chunks/{dropdown-default-textbox.DBoSso4J.js.map → dropdown-default-textbox.CrylDCEX.js.map} +1 -1
- package/dist/chunks/{dropdown-tag.XIlES6IT.js → dropdown-tag.xVgcIWXL.js} +6 -6
- package/dist/chunks/{dropdown-tag.XIlES6IT.js.map → dropdown-tag.xVgcIWXL.js.map} +1 -1
- package/dist/chunks/{dropdown.BqsoncJr.js → dropdown.BkLc07G8.js} +196 -192
- package/dist/chunks/dropdown.BkLc07G8.js.map +1 -0
- package/dist/chunks/{empty-state.1TyzB5ju.js → empty-state.B6wjtgR0.js} +5 -5
- package/dist/chunks/{empty-state.1TyzB5ju.js.map → empty-state.B6wjtgR0.js.map} +1 -1
- package/dist/chunks/{error-message.Ccc1sTTp.js → error-message.Brg-AZjT.js} +3 -3
- package/dist/chunks/{error-message.Ccc1sTTp.js.map → error-message.Brg-AZjT.js.map} +1 -1
- package/dist/chunks/{es6.jIyAPBgt.js → es6.D11bE5vq.js} +6 -6
- package/dist/chunks/{es6.jIyAPBgt.js.map → es6.D11bE5vq.js.map} +1 -1
- package/dist/chunks/file-uploader.BePx7fcJ.js +1879 -0
- package/dist/chunks/file-uploader.BePx7fcJ.js.map +1 -0
- package/dist/chunks/{filter-bar.DT_-lVmf.js → filter-bar.BbVGpEJx.js} +48 -48
- package/dist/chunks/{filter-bar.DT_-lVmf.js.map → filter-bar.BbVGpEJx.js.map} +1 -1
- package/dist/chunks/{fixed-scroller.IPM3AzHS.js → fixed-scroller.BE1hWLr6.js} +4 -4
- package/dist/chunks/{fixed-scroller.IPM3AzHS.js.map → fixed-scroller.BE1hWLr6.js.map} +1 -1
- package/dist/chunks/{focus-trap.CGypVwG6.js → focus-trap.DA_1lCcM.js} +2 -2
- package/dist/chunks/{focus-trap.CGypVwG6.js.map → focus-trap.DA_1lCcM.js.map} +1 -1
- package/dist/chunks/{footer-actions.D0uH9JWq.js → footer-actions.O24MYRgM.js} +4 -4
- package/dist/chunks/{footer-actions.D0uH9JWq.js.map → footer-actions.O24MYRgM.js.map} +1 -1
- package/dist/chunks/{form-layout-title.DN0jonFa.js → form-layout-title.DRuBsptB.js} +3 -3
- package/dist/chunks/{form-layout-title.DN0jonFa.js.map → form-layout-title.DRuBsptB.js.map} +1 -1
- package/dist/chunks/{generate-uid.NJ8tVoha.js → generate-uid.D-HFI38h.js} +2 -2
- package/dist/chunks/{generate-uid.NJ8tVoha.js.map → generate-uid.D-HFI38h.js.map} +1 -1
- package/dist/chunks/{header.BvZxtIOD.js → header.Bbwnv6Ei.js} +66 -66
- package/dist/chunks/{header.BvZxtIOD.js.map → header.Bbwnv6Ei.js.map} +1 -1
- package/dist/chunks/{index.D8ivUe7P.js → index.B5Tq465X.js} +5 -5
- package/dist/chunks/{index.D8ivUe7P.js.map → index.B5Tq465X.js.map} +1 -1
- package/dist/chunks/{info-icon-with-popover.DEjsASNU.js → info-icon-with-popover.Cd3RQWUu.js} +4 -4
- package/dist/chunks/{info-icon-with-popover.DEjsASNU.js.map → info-icon-with-popover.Cd3RQWUu.js.map} +1 -1
- package/dist/chunks/{info-icon.0d0GzDe2.js → info-icon.BnSZeQm8.js} +3 -3
- package/dist/chunks/{info-icon.0d0GzDe2.js.map → info-icon.BnSZeQm8.js.map} +1 -1
- package/dist/chunks/{input-field-password.HRDEb0jL.js → input-field-password.CvKC9xjJ.js} +10 -10
- package/dist/chunks/{input-field-password.HRDEb0jL.js.map → input-field-password.CvKC9xjJ.js.map} +1 -1
- package/dist/chunks/input-field.Dgop3JWW.js +231 -0
- package/dist/chunks/input-field.Dgop3JWW.js.map +1 -0
- package/dist/chunks/{inspector.types.2YEArjPi.js → inspector.types.j1usQ6FN.js} +5 -5
- package/dist/chunks/{inspector.types.2YEArjPi.js.map → inspector.types.j1usQ6FN.js.map} +1 -1
- package/dist/chunks/{layout-row.BfS-cPky.js → layout-row.DAeZh7Rv.js} +3 -3
- package/dist/chunks/{layout-row.BfS-cPky.js.map → layout-row.DAeZh7Rv.js.map} +1 -1
- package/dist/chunks/{link.UOEUR35A.js → link.B2DE2ryp.js} +2 -2
- package/dist/chunks/{link.UOEUR35A.js.map → link.B2DE2ryp.js.map} +1 -1
- package/dist/chunks/{listbox-option-tag.Co0ycEdQ.js → listbox-option-tag.drC_50fU.js} +3 -3
- package/dist/chunks/{listbox-option-tag.Co0ycEdQ.js.map → listbox-option-tag.drC_50fU.js.map} +1 -1
- package/dist/chunks/{menu.CLaN9Eys.js → menu.DCRfI10M.js} +9 -9
- package/dist/chunks/{menu.CLaN9Eys.js.map → menu.DCRfI10M.js.map} +1 -1
- package/dist/chunks/{modal-fullscreen.B-qr1Szh.js → modal-fullscreen.DgDk6uxS.js} +7 -7
- package/dist/chunks/{modal-fullscreen.B-qr1Szh.js.map → modal-fullscreen.DgDk6uxS.js.map} +1 -1
- package/dist/chunks/{modal.wU3uUJKq.js → modal.B7giFLek.js} +6 -6
- package/dist/chunks/{modal.wU3uUJKq.js.map → modal.B7giFLek.js.map} +1 -1
- package/dist/chunks/{pagination.BM3FhtxJ.js → pagination.Dc0VbxFL.js} +5 -5
- package/dist/chunks/{pagination.BM3FhtxJ.js.map → pagination.Dc0VbxFL.js.map} +1 -1
- package/dist/chunks/{payment-method.UaERFtej.js → payment-method.CoXB0ZAW.js} +2 -2
- package/dist/chunks/{payment-method.UaERFtej.js.map → payment-method.CoXB0ZAW.js.map} +1 -1
- package/dist/chunks/{popover.DsUymZWJ.js → popover.D8pR_dbl.js} +5 -5
- package/dist/chunks/{popover.DsUymZWJ.js.map → popover.D8pR_dbl.js.map} +1 -1
- package/dist/chunks/{popper-container.B1iB2ovW.js → popper-container.B9qZTf2V.js} +3 -3
- package/dist/chunks/{popper-container.B1iB2ovW.js.map → popper-container.B9qZTf2V.js.map} +1 -1
- package/dist/chunks/{promo-banner.BXtIM4C9.js → promo-banner.Dd-JQMUD.js} +7 -7
- package/dist/chunks/{promo-banner.BXtIM4C9.js.map → promo-banner.Dd-JQMUD.js.map} +1 -1
- package/dist/chunks/{radio-group.DMob8x2J.js → radio-group.D5GEIgYv.js} +15 -15
- package/dist/chunks/{radio-group.DMob8x2J.js.map → radio-group.D5GEIgYv.js.map} +1 -1
- package/dist/chunks/{search-bar.rubkdbcD.js → search-bar.BN4grqVO.js} +3 -3
- package/dist/chunks/{search-bar.rubkdbcD.js.map → search-bar.BN4grqVO.js.map} +1 -1
- package/dist/chunks/{secondary-nav.DKSjc5bn.js → secondary-nav.C8UE8xly.js} +8 -8
- package/dist/chunks/{secondary-nav.DKSjc5bn.js.map → secondary-nav.C8UE8xly.js.map} +1 -1
- package/dist/chunks/{segmented-control.DL0W7lJ_.js → segmented-control.C6HPgkVm.js} +4 -4
- package/dist/chunks/{segmented-control.DL0W7lJ_.js.map → segmented-control.C6HPgkVm.js.map} +1 -1
- package/dist/chunks/{selection-card-group.iYyZ9yX4.js → selection-card-group.BT7FOlbF.js} +9 -9
- package/dist/chunks/{selection-card-group.iYyZ9yX4.js.map → selection-card-group.BT7FOlbF.js.map} +1 -1
- package/dist/chunks/{sidepanel.CQnLpV8A.js → sidepanel.PEMSN4Hj.js} +11 -11
- package/dist/chunks/{sidepanel.CQnLpV8A.js.map → sidepanel.PEMSN4Hj.js.map} +1 -1
- package/dist/chunks/{status.types.Cv6hHRMu.js → status.types.B0jtv0c7.js} +2 -2
- package/dist/chunks/{status.types.Cv6hHRMu.js.map → status.types.B0jtv0c7.js.map} +1 -1
- package/dist/chunks/{step.BsIdWhaZ.js → step.Dq4w23dP.js} +3 -3
- package/dist/chunks/{step.BsIdWhaZ.js.map → step.Dq4w23dP.js.map} +1 -1
- package/dist/chunks/{structured-list-item.BhBbmkbw.js → structured-list-item.-ch3UkPz.js} +6 -6
- package/dist/chunks/{structured-list-item.BhBbmkbw.js.map → structured-list-item.-ch3UkPz.js.map} +1 -1
- package/dist/chunks/{summary-grid-item-custom.CicAOBVQ.js → summary-grid-item-custom.CLVYmhnp.js} +5 -5
- package/dist/chunks/{summary-grid-item-custom.CicAOBVQ.js.map → summary-grid-item-custom.CLVYmhnp.js.map} +1 -1
- package/dist/chunks/{tabs.9kObZry9.js → tabs.B0f1qiMR.js} +4 -4
- package/dist/chunks/{tabs.9kObZry9.js.map → tabs.B0f1qiMR.js.map} +1 -1
- package/dist/chunks/{tag.-YNhsBv7.js → tag.d36UYSWd.js} +3 -3
- package/dist/chunks/{tag.-YNhsBv7.js.map → tag.d36UYSWd.js.map} +1 -1
- package/dist/chunks/{textarea.Cf21WMwL.js → textarea.DORWuAZn.js} +6 -6
- package/dist/chunks/{textarea.Cf21WMwL.js.map → textarea.DORWuAZn.js.map} +1 -1
- package/dist/chunks/{timeline-item.Cu5b-Mqj.js → timeline-item.CUm_n51y.js} +12 -12
- package/dist/chunks/{timeline-item.Cu5b-Mqj.js.map → timeline-item.CUm_n51y.js.map} +1 -1
- package/dist/chunks/{toast.DgJbW9CL.js → toast.DCaWC_wv.js} +4 -4
- package/dist/chunks/{toast.DgJbW9CL.js.map → toast.DCaWC_wv.js.map} +1 -1
- package/dist/chunks/{toggle-button.Cf8C7p6e.js → toggle-button.DJqs599a.js} +2 -2
- package/dist/chunks/{toggle-button.Cf8C7p6e.js.map → toggle-button.DJqs599a.js.map} +1 -1
- package/dist/chunks/{toggle.CnS7qszG.js → toggle.INRYdQzz.js} +3 -3
- package/dist/chunks/{toggle.CnS7qszG.js.map → toggle.INRYdQzz.js.map} +1 -1
- package/dist/chunks/{tooltip.R2sqydIE.js → tooltip.CQGwmwt9.js} +4 -4
- package/dist/chunks/{tooltip.R2sqydIE.js.map → tooltip.CQGwmwt9.js.map} +1 -1
- package/dist/chunks/{tutorial.w2ZqeOh1.js → tutorial.B_8XNKvM.js} +9 -9
- package/dist/chunks/{tutorial.w2ZqeOh1.js.map → tutorial.B_8XNKvM.js.map} +1 -1
- package/dist/chunks/{typography.J1v_SPG3.js → typography.Bu_WAKdf.js} +1 -2
- package/dist/chunks/{typography.J1v_SPG3.js.map → typography.Bu_WAKdf.js.map} +1 -1
- package/dist/chunks/{use-bento-toast-controller.Cn_2Eogn.js → use-bento-toast-controller.BVVMh0wc.js} +3 -3
- package/dist/chunks/{use-bento-toast-controller.Cn_2Eogn.js.map → use-bento-toast-controller.BVVMh0wc.js.map} +1 -1
- package/dist/chunks/{use-cached-selected-values.impKjAIS.js → use-cached-selected-values.DJl7FKT5.js} +19 -19
- package/dist/chunks/{use-cached-selected-values.impKjAIS.js.map → use-cached-selected-values.DJl7FKT5.js.map} +1 -1
- package/dist/code-snippet.js +1 -1
- package/dist/country.js +1 -1
- package/dist/currency.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.js +1 -1
- package/dist/dropdown.js +4 -4
- 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.js +1 -1
- package/dist/index.js +67 -67
- package/dist/index.js.map +1 -1
- package/dist/info-icon.js +1 -1
- package/dist/input-field-password.js +1 -1
- package/dist/input-field.js +1 -1
- package/dist/inspector.js +1 -1
- package/dist/internal.js +12 -12
- package/dist/layout.js +1 -1
- package/dist/link.js +1 -1
- package/dist/menu.js +1 -1
- package/dist/modal-fullscreen.js +1 -1
- package/dist/modal.js +2 -2
- package/dist/pagination.js +1 -1
- package/dist/payment-method.js +1 -1
- package/dist/popover.js +1 -1
- package/dist/popper-container.js +1 -1
- package/dist/promo-banner.js +1 -1
- package/dist/radio-group.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/status.js +1 -1
- package/dist/stepper.js +1 -1
- package/dist/structured-list.js +1 -1
- package/dist/styles/bento-dark.css +1 -0
- package/dist/styles/bento-light.css +1 -0
- package/dist/styles/bento.css +1 -0
- package/dist/styles/legacy.css +6 -5
- package/dist/styles/styleguide.css +1 -0
- 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/toast.js +1 -1
- package/dist/toggle.js +1 -1
- package/dist/tutorial.js +1 -1
- package/dist/typography.js +1 -1
- package/dist/web-types.json +3 -3
- package/package.json +11 -7
- package/dist/chunks/code-snippet.5iJcUZSo.js.map +0 -1
- package/dist/chunks/codemirror.CXFEqvAi.js.map +0 -1
- package/dist/chunks/dropdown.BqsoncJr.js.map +0 -1
- package/dist/chunks/file-uploader.C6kcnhqp.js +0 -729
- package/dist/chunks/file-uploader.C6kcnhqp.js.map +0 -1
- package/dist/chunks/input-field.D6N2kt7s.js +0 -228
- package/dist/chunks/input-field.D6N2kt7s.js.map +0 -1
package/dist/chunks/{selection-card-group.iYyZ9yX4.js.map → selection-card-group.BT7FOlbF.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection-card-group.iYyZ9yX4.js","sources":["../../src/components/selection-card/selection-card.types.ts","../../src/components/selection-card/selection-card.keys.ts","../../src/components/selection-card/selection-card.vue","../../src/components/selection-card/components/selection-card-group/selection-card-group.vue"],"sourcesContent":["import { RadioInputValue } from '@/components/internal/radio-input';\nimport { BentoCheckboxType } from '@/core/components/checkbox/checkbox.types';\nimport { VueNodeElement } from '@/types';\n\nexport enum BentoSelectionCardState {\n DISABLED = 'disabled',\n READONLY = 'readonly',\n ERROR = 'error',\n}\n\nexport type BentoSelectionCardValue = string | number;\n\nexport type BentoSelectionCardModelValue = BentoCheckboxType | RadioInputValue;\n\nexport interface BentoSelectionCardItem {\n content?: string | object;\n description?: string;\n disabled?: boolean;\n dynamicContent?: string | object;\n fullyClickable?: boolean;\n hasError?: boolean;\n icon?: VueNodeElement;\n readonly?: boolean;\n subtitle?: string;\n title: string;\n value: BentoSelectionCardValue;\n}\n","export const SELECTION_CARD_RADIO_INPUT_INJECTION_KEY = Symbol('selection card radio input injection key');\n","<template>\n <div class=\"b-selection-card\" :class=\"conditionalClasses\" @click=\"handleCardClick\">\n <div class=\"b-selection-card__container\" :class=\"containerConditionalClasses\">\n <div class=\"b-selection-card__checkbox-container\" :class=\"checkboxContainerConditionalClasses\">\n <div class=\"b-selection-card__checkbox-container-text\" :class=\"checkboxContainerTextConditionalClasses\">\n <div v-if=\"hasSlot('icon')\" class=\"b-selection-card__icon\" role=\"presentation\">\n <slot name=\"icon\" />\n </div>\n <label :for=\"inputId\" class=\"b-selection-card__text\" @click.stop.prevent=\"handleCardClick\">\n <bento-typography\n v-if=\"subtitle\"\n class=\"b-selection-card__description\"\n el=\"span\"\n variant=\"caption\"\n >\n {{ subtitle }}\n </bento-typography>\n <bento-typography el=\"span\" variant=\"title\">{{ title }}</bento-typography>\n <bento-typography\n v-if=\"description\"\n id=\"descriptionId\"\n class=\"b-selection-card__description\"\n el=\"span\"\n variant=\"body\"\n >\n {{ description }}\n </bento-typography>\n </label>\n </div>\n <radio-input\n v-if=\"isRadioInput\"\n :id=\"inputId\"\n ref=\"inputRef\"\n :aria-label=\"ariaLabel\"\n :aria-describedby=\"description ? descriptionId : undefined\"\n :disabled=\"disabled\"\n :has-error=\"hasError\"\n :aria-readonly=\"readonly ?? undefined\"\n :value=\"value\"\n :readonly=\"readonly\"\n :model-value=\"computedRadioInputModelValue\"\n />\n <checkbox-input\n v-else\n :id=\"inputId\"\n ref=\"inputRef\"\n :aria-label=\"ariaLabel\"\n :aria-describedby=\"description ? descriptionId : undefined\"\n :disabled=\"disabled\"\n :has-error=\"hasError\"\n :aria-readonly=\"readonly ?? undefined\"\n :value=\"value\"\n :readonly=\"readonly\"\n :model-value=\"computedCheckboxInputModelValue\"\n />\n </div>\n <bento-typography\n v-if=\"hasSlot('content')\"\n ref=\"slotRef\"\n el=\"div\"\n class=\"b-selection-card__slot\"\n :class=\"slotConditionalClasses\"\n >\n <slot name=\"content\" />\n </bento-typography>\n <bento-typography\n v-if=\"hasSlot('dynamicContent') && isChecked\"\n ref=\"dynamicSlotRef\"\n el=\"div\"\n class=\"b-selection-card__slot\"\n :class=\"slotConditionalClasses\"\n >\n <slot name=\"dynamicContent\" />\n </bento-typography>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoTypography } from '@/components/typography';\n import { BentoCheckboxType, BentoMultiCheckboxType, CheckboxInput } from '../internal/checkbox-input';\n import { RadioInput, RadioInputValue } from '../internal/radio-input';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { generateUid } from '@/core/utils/ts';\n import { computed, ComputedRef, inject, PropType, Ref, ref, useSlots } from 'vue';\n import { useHasSlot } from '@/composables';\n import type { BentoSelectionCardModelValue, BentoSelectionCardValue } from './selection-card.types';\n import { BentoSelectionCardState } from './selection-card.types';\n import { SELECTION_CARD_RADIO_INPUT_INJECTION_KEY } from './selection-card.keys';\n\n const props = defineProps({\n /**\n * The description of the selection card\n */\n description: {\n type: String,\n default: undefined,\n },\n\n /**\n * Disables the selection card\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Makes the entire selection card clickable. Clicking over interactive elements inside the card with this prop enabled will not be possible.\n */\n fullyClickable: { type: Boolean, default: false },\n\n /**\n * Shows the selection card in error state\n */\n hasError: { type: Boolean, default: false },\n\n /**\n * This property should not be used directly.\n * It will be used by v-model directive on selection card component.\n *\n * When handling a single input, use a string or a number.\n *\n * When handling multiple inputs, use an array of keys.\n * These keys exist as a set \"value\" prop for each input.\n */\n modelValue: {\n type: [Boolean, String, Array] as PropType<BentoSelectionCardModelValue>,\n default: null,\n },\n\n /**\n * Sets the selection card to readonly\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * The subtitle of the selection card\n */\n subtitle: {\n type: String,\n default: undefined,\n },\n\n /**\n * The title of the selection card\n */\n title: {\n type: String,\n required: true,\n },\n\n /**\n * Indicates the value of the input that will be returned when it's checked.\n */\n value: {\n type: [String, Number] as PropType<BentoSelectionCardValue>,\n required: true,\n },\n });\n\n const emit = defineEmits([\"input\", \"update:model-value\"]);\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n\n const inputId = generateUid('selection-card-input-id');\n const descriptionId = generateUid('selection-card-description');\n\n const computedRadioInputModelValue: ComputedRef<RadioInputValue> = computed(\n () => props.modelValue as RadioInputValue\n );\n const computedCheckboxInputModelValue: ComputedRef<BentoCheckboxType> = computed(\n () => props.modelValue as BentoCheckboxType\n );\n\n const conditionalClasses = computed(() => ({\n 'b-selection-card--checked': isChecked.value,\n 'b-selection-card--fully-clickable': props.fullyClickable,\n }));\n\n const containerConditionalClasses = computed(() => ({\n [`b-selection-card--${BentoSelectionCardState.DISABLED}`]: props.disabled,\n [`b-selection-card--${BentoSelectionCardState.ERROR}`]: props.hasError,\n [`b-selection-card--${BentoSelectionCardState.READONLY}`]: props.readonly,\n 'b-selection-card--center-aligned': isTitleOnly.value,\n }));\n\n const checkboxContainerConditionalClasses = computed(() => ({\n 'b-selection-card__checkbox-container--center-aligned': isTitleOnly.value,\n }));\n\n const checkboxContainerTextConditionalClasses = computed(() => ({\n 'b-selection-card__checkbox-container-text--center-aligned': isTitleOnly.value,\n }));\n\n const slotConditionalClasses = computed(() => ({\n 'b-selection-card__slot--with-icon': hasSlot('icon'),\n }));\n\n const ariaLabel = useAriaLabel({\n ariaLabel: props.title,\n label: props.value as string,\n });\n\n const isCheckboxGroup = computed(() => Array.isArray(props.modelValue));\n\n const isChecked: ComputedRef<boolean> = computed(() => {\n if (isRadioInput.value) {\n return props.value === props.modelValue;\n }\n if (!isCheckboxGroup.value) {\n return props.modelValue as boolean;\n }\n\n return (props.modelValue as BentoMultiCheckboxType).some(item => item === props.value);\n });\n\n const isRadioInput: Ref<boolean> = inject(SELECTION_CARD_RADIO_INPUT_INJECTION_KEY, ref(false));\n\n const isTitleOnly = computed(() => !props.subtitle && !props.description);\n\n const inputRef = ref<InstanceType<typeof RadioInput> | InstanceType<typeof CheckboxInput>>(null);\n const slotRef = ref(null);\n const dynamicSlotRef = ref(null);\n\n // Handle click on the whole card area\n const handleCardClick = (event: Event) => {\n if (inputRef.value.$refs.inputRef === event.target) {\n const newValue = toggleInput();\n onChange(newValue);\n return;\n }\n\n // Do nothing if disabled or readonly\n if (props.disabled && props.readonly) {\n return;\n }\n\n // If it's not fully clickable prevent selecting the card if the click\n // originated in a slot\n if (!props.fullyClickable) {\n // Check if the click originated from the slot - in that case, do nothng\n if (slotRef.value && slotRef.value?.$el?.contains(event.target)) {\n return;\n }\n // Check if the click originated from the dynamic slot - in that case, do nothng\n if (dynamicSlotRef.value && dynamicSlotRef.value?.$el?.contains(event.target)) {\n return;\n }\n // Check if the click originated from the input - in that case do nothing, as the input will emit the event already\n if (inputRef.value && inputRef.value?.$el?.contains(event.target as Node)) {\n return;\n }\n }\n\n // If the click originated outside of these two areas, emit the change event\n const newValue = toggleInput();\n\n onChange(newValue);\n };\n\n const toggleInput = (): BentoSelectionCardModelValue => {\n const currentValue: boolean = (inputRef.value?.$refs.inputRef as HTMLInputElement).checked;\n\n if (isCheckboxGroup.value) {\n const newCheckedList = [...(props.modelValue as BentoMultiCheckboxType)];\n const index = newCheckedList.indexOf(props.value);\n\n if (index === -1) {\n newCheckedList.push(props.value);\n } else {\n newCheckedList.splice(index, 1);\n }\n return newCheckedList;\n }\n\n if (isRadioInput.value) {\n return props.value;\n }\n return currentValue;\n };\n\n const onChange = newValue => {\n if (!props.disabled && !props.readonly) {\n emit('update:model-value', newValue);\n emit('input', newValue);\n }\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * Selection card component. If used standalone, only the checkbox variant can be used. If the checkbox variant is needed, please use the bento-selection-card-group component.\n *\n * @example\n * import { BentoSelectionCard } from '@adyen/bento-vue2';\n * import EmoticonHappyIcon from '@adyen/ui-assets-icons-16/vue/emoticon-happy';\n *\n * export default {\n * components: { BentoSelectionCard, EmoticonHappyIcon },\n * template: `\n * <bento-selection-card title=\"Card title\" :model-value.sync=\"yourModelValue\">\n * <template #icon>\n * <emoticon-happy-icon />\n * </template>\n * </bento-selection-card>\n * `\n * }\n */\n export default {\n name: 'bento-selection-card',\n };\n</script>\n<style lang=\"scss\" scoped src=\"./selection-card.scss\" />\n","<template>\n <controls-group\n ref=\"containerRef\"\n :aria-describedby=\"shouldShowGroupError ? errorMessageId : null\"\n :label=\"label\"\n :hide-label=\"hideLabel\"\n :description=\"description\"\n :disabled=\"disabled\"\n :tooltip-text=\"tooltipText\"\n :readonly=\"readonly\"\n :required=\"required\"\n :optional=\"optional\"\n class=\"b-selection-card-group\"\n component-name=\"selection-card-group\"\n >\n <div\n v-if=\"!itemsPerRow || layout === 'vertical'\"\n class=\"b-selection-card-group__items\"\n :class=\"conditionalItemsClasses\"\n >\n <bento-selection-card\n v-for=\"item in items\"\n :key=\"`selection-card-${item.value}`\"\n class=\"b-selection-card-group__item\"\n v-bind=\"item\"\n :model-value=\"inputValue\"\n :readonly=\"readonly || item.readonly\"\n :has-error=\"shouldShowGroupError\"\n :disabled=\"disabled || item.disabled\"\n @update:model-value=\"onInput\"\n >\n <template v-if=\"hasSlot('icon') && item.icon\" #icon>\n <slot name=\"icon\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('content') && item.content\" #content>\n <slot name=\"content\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('dynamicContent') && item.dynamicContent\" #dynamicContent>\n <slot name=\"dynamicContent\" v-bind=\"item\"></slot>\n </template>\n </bento-selection-card>\n </div>\n <template v-else>\n <div :key=\"`selection-card-group-layout-breakpoint-${currentBreakpoint}`\">\n <grid-layout\n v-for=\"(row, rowIndex) in computedRows\"\n :key=\"`selection-card-group-row-${rowIndex}-cols-${computedItemsPerRow}`\"\n class=\"b-selection-card-group__items--wrap\"\n :column-width=\"computedColumnWidth\"\n >\n <template v-for=\"(item, columnIndex) in row\" #[`col-${columnIndex+1}`]>\n <bento-selection-card\n :key=\"`selection-card-${item.value}`\"\n class=\"b-selection-card-group__item b-selection-card-group__item--full-height\"\n v-bind=\"item\"\n :model-value=\"inputValue\"\n :readonly=\"readonly || item.readonly\"\n :has-error=\"shouldShowGroupError\"\n :disabled=\"disabled || item.disabled\"\n @update:model-value=\"onInput\"\n >\n <template v-if=\"hasSlot('icon') && item.icon\" #icon>\n <slot name=\"icon\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('content') && item.content\" #content>\n <slot name=\"content\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('dynamicContent') && item.dynamicContent\" #dynamicContent>\n <slot name=\"dynamicContent\" v-bind=\"item\"></slot>\n </template>\n </bento-selection-card>\n </template>\n </grid-layout>\n </div>\n </template>\n <error-message\n v-if=\"shouldShowGroupError\"\n :id=\"errorMessageId\"\n :error-message=\"errorMessage\"\n class=\"b-selection-card-group__error-message\"\n />\n </controls-group>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, onMounted, PropType, provide, ref, useSlots, watch } from 'vue';\n import { useElementSize } from '@vueuse/core';\n import { BMediaQueryMMax, BMediaQuerySMax } from '@adyen/bento-design-tokens/dist/js/bento/es6';\n import {\n BentoSelectionCardGroupItemsPerRow,\n BentoSelectionCardGroupLayout,\n BentoSelectionCardGroupVariant,\n } from './selection-card-group.types';\n import BentoSelectionCard from '../../selection-card.vue';\n import { ControlsGroup, ErrorMessage, GridLayout } from '../../../internal';\n import { BentoSelectionCardItem, BentoSelectionCardModelValue } from '../../selection-card.types';\n import { SELECTION_CARD_RADIO_INPUT_INJECTION_KEY } from '../../selection-card.keys';\n import { generateUid } from '@/core/utils/ts';\n\n const props = defineProps({\n /**\n * Descriptive supporting text visbile underneath the label.\n */\n description: { type: String, default: null },\n\n /**\n * If set to true, renders all cards in the group in a disabled state.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Renders all cards in an error state with an error message.\n */\n errorMessage: { type: String, default: null },\n\n /**\n * The form id the selection card group is associated with. Defaults to null, as a selection card group can also be used standalone.\n */\n formId: { type: String, default: null },\n\n /**\n * Shows/hides the group label.\n */\n hideLabel: { type: Boolean, default: null },\n\n /**\n * Label of the group. Required for accessibility purposes, even if it's not shown\n */\n label: {\n type: String,\n required: true,\n },\n\n /**\n * The selection card group's layout. It can be vertical or horizontal. Defaults to vertical.\n * @values horizontal, vertical\n */\n layout: {\n type: String as PropType<BentoSelectionCardGroupLayout>,\n default: 'vertical',\n },\n\n /**\n * The selection card group's items.\n */\n items: {\n type: Array as PropType<BentoSelectionCardItem[]>,\n required: true,\n },\n\n /**\n * Sets the responsive number of items rendered in each row.\n */\n itemsPerRow: {\n type: Object as PropType<BentoSelectionCardGroupItemsPerRow>,\n default: undefined,\n },\n\n /**\n * Determines the initially selected value of the group. Corresponds to the BentoSelectionCardItem's value.\n * Defaults to no value selected.\n */\n modelValue: {\n type: [Array, String, Number] as PropType<BentoSelectionCardModelValue>,\n default: null,\n },\n\n /**\n * Indicates the field is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * Indicates the field is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Tooltip message.\n */\n tooltipText: { type: String, default: null },\n\n /**\n * If set to true, renders all cards in the group in a readonly state.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Renders the cards with a checkbox or a radio input. Selection logic will also apply in accordance.\n * @values checkbox, radio\n */\n variant: { type: String as PropType<BentoSelectionCardGroupVariant>, default: 'checkbox' },\n });\n\n const emit = defineEmits([\"input\", \"update:model-value\"]);\n const slots = useSlots();\n // Slots logic\n // Temporary, use-has-slots composable doesn't currently work for vue3 named scoped slots\n // We do the same in bento-checkbox-group\n const hasSlot = name => !!slots[name];\n\n const conditionalItemsClasses = computed(() => ({\n 'b-selection-card-group__items--horizontal': props.layout === 'horizontal',\n }));\n\n const inputValue = ref(props.modelValue);\n watch(\n () => props.modelValue,\n () => {\n inputValue.value = props.modelValue;\n }\n );\n\n // Error message logic\n const errorMessageId = generateUid('error');\n const shouldShowGroupError = computed(() => !props.disabled && !props.readonly && !!props.errorMessage);\n\n // itemsPerRow logic\n const containerRef = ref<HTMLElement | null>(null);\n const { width } = useElementSize(containerRef);\n\n const smallBreakpoint = computed(() => BMediaQuerySMax.split('px')[0]);\n const mediumBreakpoint = computed(() => BMediaQueryMMax.split('px')[0]);\n\n const currentBreakpoint = computed(() => {\n if (width.value < smallBreakpoint.value) {\n return 'small';\n }\n if (width.value >= smallBreakpoint.value && width.value < mediumBreakpoint.value) {\n return 'medium';\n }\n return 'large';\n });\n\n const computedItemsPerRow = computed(() => {\n return (props.itemsPerRow?.[currentBreakpoint?.value] as number) || props.items.length;\n });\n\n const computedRows = computed(() => {\n if (!props.itemsPerRow) {\n return [];\n }\n const rows = [];\n for (let i = 0; i < props.items.length; i += computedItemsPerRow?.value) {\n rows.push(props.items.slice(i, i + computedItemsPerRow?.value));\n }\n return rows;\n });\n\n // We need to compute the column width on 12 because we're using a 12-column system for out grid-layout logic\n const itemColumnWidth = computed(() => 12 / computedItemsPerRow?.value);\n\n /**\n * Filling the columnWidth array with the same parameters per item to pass\n * to the `grid-layout` layout so the each card can have\n * the same width according to the screen size.\n */\n const computedColumnWidth = computed(() => {\n return computedItemsPerRow?.value\n ? new Array(computedItemsPerRow?.value).fill({\n // Instead of passing the actual screen sizes values, passing the same values per each screen size and recomputing it makes sure visually the change is smoother and not laggy\n small: itemColumnWidth.value,\n medium: itemColumnWidth.value,\n large: itemColumnWidth.value,\n })\n : [];\n });\n\n const onInput = value => {\n inputValue.value = value;\n emit('update:model-value', value);\n emit('input', value);\n };\n\n const isRadioVariant = computed(() => props.variant === 'radio');\n\n provide(SELECTION_CARD_RADIO_INPUT_INJECTION_KEY, isRadioVariant);\n\n onMounted(() => {\n if (props.itemsPerRow) {\n Object.values(props.itemsPerRow).forEach(el => {\n if (el && (el < 2 || el > 6)) {\n throw new Error(\n 'itemsPerRow values must have a value between 2 and 6 items per row. Read the documentation for more information.'\n );\n }\n });\n }\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * Group of bento-selection-cards.\n *\n * @example\n * import { BentoSelectionCardGroup } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoSelectionCardGroup },\n * template: `\n * <bento-selection-card-group\n * :items=\"[\n * {\n * title: 'Card 1',\n * value: 'card-1',\n * content: 'Slot content 1',\n * icon: RetailIcon,\n * },\n * {\n * title: 'Card 2',\n * value: 'card-2',\n * content: 'Slot content 2',\n * icon: LeafIcon,\n * },\n * ]\"\n * >\n * <template #icon=\"{ icon }\">\n * <component :is=\"icon\"/>\n * </template>\n * <template #content=\"{ content }\">\n * <div>{{ content }}</div>\n * </template>\n * </bento-selection-card-group>\n * `,\n * }\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./selection-card-group.scss\" />\n"],"names":["BentoSelectionCardState","BentoSelectionCardState2","SELECTION_CARD_RADIO_INPUT_INJECTION_KEY","__default__$1","slots","useSlots","hasSlot","useHasSlot","inputId","generateUid","descriptionId","computedRadioInputModelValue","computed","props","computedCheckboxInputModelValue","conditionalClasses","isChecked","containerConditionalClasses","isTitleOnly","checkboxContainerConditionalClasses","checkboxContainerTextConditionalClasses","slotConditionalClasses","ariaLabel","useAriaLabel","isCheckboxGroup","isRadioInput","item","inject","ref","inputRef","slotRef","dynamicSlotRef","handleCardClick","event","newValue2","toggleInput","onChange","_b","_a","_d","_c","_f","_e","newValue","currentValue","newCheckedList","index","emit","__default__","name","conditionalItemsClasses","inputValue","watch","errorMessageId","shouldShowGroupError","containerRef","width","useElementSize","smallBreakpoint","BMediaQuerySMax","mediumBreakpoint","BMediaQueryMMax","currentBreakpoint","computedItemsPerRow","computedRows","rows","i","itemColumnWidth","computedColumnWidth","onInput","value","isRadioVariant","provide","onMounted","el"],"mappings":";;;;;;;;;;;;;;AAIY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,WAAA,YACAA,EAAA,WAAA,YACAA,EAAA,QAAA,SAHQA,IAAAD,KAAA,CAAA,CAAA;ACJC,MAAAE,IAAA,OAAA,0CAAA,GCmTTC,KAAA;AAAA,EAAe,MAAA;AAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBArJAC,IAAAC,EAAA,GACAC,IAAAC,EAAAH,CAAA,GAEAI,IAAAC,EAAA,yBAAA,GACAC,IAAAD,EAAA,4BAAA,GAEAE,IAAAC;AAAA,MAAmE,MAAAC,EAAA;AAAA,IACnD,GAEhBC,IAAAF;AAAA,MAAwE,MAAAC,EAAA;AAAA,IACxD,GAGhBE,IAAAH,EAAA,OAAA;AAAA,MAA2C,6BAAAI,EAAA;AAAA,MACA,qCAAAH,EAAA;AAAA,IACI,EAAA,GAG/CI,IAAAL,EAAA,OAAA;AAAA,MAAoD,CAAA,qBAAAZ,EAAA,QAAA,EAAA,GAAAa,EAAA;AAAA,MACiB,CAAA,qBAAAb,EAAA,KAAA,EAAA,GAAAa,EAAA;AAAA,MACH,CAAA,qBAAAb,EAAA,QAAA,EAAA,GAAAa,EAAA;AAAA,MACG,oCAAAK,EAAA;AAAA,IACjB,EAAA,GAGpDC,IAAAP,EAAA,OAAA;AAAA,MAA4D,wDAAAM,EAAA;AAAA,IACY,EAAA,GAGxEE,IAAAR,EAAA,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;AAAA,UACN;AAAA,MAER,CAAA;AAAA,IAER,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"selection-card-group.BT7FOlbF.js","sources":["../../src/components/selection-card/selection-card.types.ts","../../src/components/selection-card/selection-card.keys.ts","../../src/components/selection-card/selection-card.vue","../../src/components/selection-card/components/selection-card-group/selection-card-group.vue"],"sourcesContent":["import { RadioInputValue } from '@/components/internal/radio-input';\nimport { BentoCheckboxType } from '@/core/components/checkbox/checkbox.types';\nimport { VueNodeElement } from '@/types';\n\nexport enum BentoSelectionCardState {\n DISABLED = 'disabled',\n READONLY = 'readonly',\n ERROR = 'error',\n}\n\nexport type BentoSelectionCardValue = string | number;\n\nexport type BentoSelectionCardModelValue = BentoCheckboxType | RadioInputValue;\n\nexport interface BentoSelectionCardItem {\n content?: string | object;\n description?: string;\n disabled?: boolean;\n dynamicContent?: string | object;\n fullyClickable?: boolean;\n hasError?: boolean;\n icon?: VueNodeElement;\n readonly?: boolean;\n subtitle?: string;\n title: string;\n value: BentoSelectionCardValue;\n}\n","export const SELECTION_CARD_RADIO_INPUT_INJECTION_KEY = Symbol('selection card radio input injection key');\n","<template>\n <div class=\"b-selection-card\" :class=\"conditionalClasses\" @click=\"handleCardClick\">\n <div class=\"b-selection-card__container\" :class=\"containerConditionalClasses\">\n <div class=\"b-selection-card__checkbox-container\" :class=\"checkboxContainerConditionalClasses\">\n <div class=\"b-selection-card__checkbox-container-text\" :class=\"checkboxContainerTextConditionalClasses\">\n <div v-if=\"hasSlot('icon')\" class=\"b-selection-card__icon\" role=\"presentation\">\n <slot name=\"icon\" />\n </div>\n <label :for=\"inputId\" class=\"b-selection-card__text\" @click.stop.prevent=\"handleCardClick\">\n <bento-typography\n v-if=\"subtitle\"\n class=\"b-selection-card__description\"\n el=\"span\"\n variant=\"caption\"\n >\n {{ subtitle }}\n </bento-typography>\n <bento-typography el=\"span\" variant=\"title\">{{ title }}</bento-typography>\n <bento-typography\n v-if=\"description\"\n id=\"descriptionId\"\n class=\"b-selection-card__description\"\n el=\"span\"\n variant=\"body\"\n >\n {{ description }}\n </bento-typography>\n </label>\n </div>\n <radio-input\n v-if=\"isRadioInput\"\n :id=\"inputId\"\n ref=\"inputRef\"\n :aria-label=\"ariaLabel\"\n :aria-describedby=\"description ? descriptionId : undefined\"\n :disabled=\"disabled\"\n :has-error=\"hasError\"\n :aria-readonly=\"readonly ?? undefined\"\n :value=\"value\"\n :readonly=\"readonly\"\n :model-value=\"computedRadioInputModelValue\"\n />\n <checkbox-input\n v-else\n :id=\"inputId\"\n ref=\"inputRef\"\n :aria-label=\"ariaLabel\"\n :aria-describedby=\"description ? descriptionId : undefined\"\n :disabled=\"disabled\"\n :has-error=\"hasError\"\n :aria-readonly=\"readonly ?? undefined\"\n :value=\"value\"\n :readonly=\"readonly\"\n :model-value=\"computedCheckboxInputModelValue\"\n />\n </div>\n <bento-typography\n v-if=\"hasSlot('content')\"\n ref=\"slotRef\"\n el=\"div\"\n class=\"b-selection-card__slot\"\n :class=\"slotConditionalClasses\"\n >\n <slot name=\"content\" />\n </bento-typography>\n <bento-typography\n v-if=\"hasSlot('dynamicContent') && isChecked\"\n ref=\"dynamicSlotRef\"\n el=\"div\"\n class=\"b-selection-card__slot\"\n :class=\"slotConditionalClasses\"\n >\n <slot name=\"dynamicContent\" />\n </bento-typography>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoTypography } from '@/components/typography';\n import { BentoCheckboxType, BentoMultiCheckboxType, CheckboxInput } from '../internal/checkbox-input';\n import { RadioInput, RadioInputValue } from '../internal/radio-input';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { generateUid } from '@/core/utils/ts';\n import { computed, ComputedRef, inject, PropType, Ref, ref, useSlots } from 'vue';\n import { useHasSlot } from '@/composables';\n import type { BentoSelectionCardModelValue, BentoSelectionCardValue } from './selection-card.types';\n import { BentoSelectionCardState } from './selection-card.types';\n import { SELECTION_CARD_RADIO_INPUT_INJECTION_KEY } from './selection-card.keys';\n\n const props = defineProps({\n /**\n * The description of the selection card\n */\n description: {\n type: String,\n default: undefined,\n },\n\n /**\n * Disables the selection card\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Makes the entire selection card clickable. Clicking over interactive elements inside the card with this prop enabled will not be possible.\n */\n fullyClickable: { type: Boolean, default: false },\n\n /**\n * Shows the selection card in error state\n */\n hasError: { type: Boolean, default: false },\n\n /**\n * This property should not be used directly.\n * It will be used by v-model directive on selection card component.\n *\n * When handling a single input, use a string or a number.\n *\n * When handling multiple inputs, use an array of keys.\n * These keys exist as a set \"value\" prop for each input.\n */\n modelValue: {\n type: [Boolean, String, Array] as PropType<BentoSelectionCardModelValue>,\n default: null,\n },\n\n /**\n * Sets the selection card to readonly\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * The subtitle of the selection card\n */\n subtitle: {\n type: String,\n default: undefined,\n },\n\n /**\n * The title of the selection card\n */\n title: {\n type: String,\n required: true,\n },\n\n /**\n * Indicates the value of the input that will be returned when it's checked.\n */\n value: {\n type: [String, Number] as PropType<BentoSelectionCardValue>,\n required: true,\n },\n });\n\n const emit = defineEmits([\"input\", \"update:model-value\"]);\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n\n const inputId = generateUid('selection-card-input-id');\n const descriptionId = generateUid('selection-card-description');\n\n const computedRadioInputModelValue: ComputedRef<RadioInputValue> = computed(\n () => props.modelValue as RadioInputValue\n );\n const computedCheckboxInputModelValue: ComputedRef<BentoCheckboxType> = computed(\n () => props.modelValue as BentoCheckboxType\n );\n\n const conditionalClasses = computed(() => ({\n 'b-selection-card--checked': isChecked.value,\n 'b-selection-card--fully-clickable': props.fullyClickable,\n }));\n\n const containerConditionalClasses = computed(() => ({\n [`b-selection-card--${BentoSelectionCardState.DISABLED}`]: props.disabled,\n [`b-selection-card--${BentoSelectionCardState.ERROR}`]: props.hasError,\n [`b-selection-card--${BentoSelectionCardState.READONLY}`]: props.readonly,\n 'b-selection-card--center-aligned': isTitleOnly.value,\n }));\n\n const checkboxContainerConditionalClasses = computed(() => ({\n 'b-selection-card__checkbox-container--center-aligned': isTitleOnly.value,\n }));\n\n const checkboxContainerTextConditionalClasses = computed(() => ({\n 'b-selection-card__checkbox-container-text--center-aligned': isTitleOnly.value,\n }));\n\n const slotConditionalClasses = computed(() => ({\n 'b-selection-card__slot--with-icon': hasSlot('icon'),\n }));\n\n const ariaLabel = useAriaLabel({\n ariaLabel: props.title,\n label: props.value as string,\n });\n\n const isCheckboxGroup = computed(() => Array.isArray(props.modelValue));\n\n const isChecked: ComputedRef<boolean> = computed(() => {\n if (isRadioInput.value) {\n return props.value === props.modelValue;\n }\n if (!isCheckboxGroup.value) {\n return props.modelValue as boolean;\n }\n\n return (props.modelValue as BentoMultiCheckboxType).some(item => item === props.value);\n });\n\n const isRadioInput: Ref<boolean> = inject(SELECTION_CARD_RADIO_INPUT_INJECTION_KEY, ref(false));\n\n const isTitleOnly = computed(() => !props.subtitle && !props.description);\n\n const inputRef = ref<InstanceType<typeof RadioInput> | InstanceType<typeof CheckboxInput>>(null);\n const slotRef = ref(null);\n const dynamicSlotRef = ref(null);\n\n // Handle click on the whole card area\n const handleCardClick = (event: Event) => {\n if (inputRef.value.$refs.inputRef === event.target) {\n const newValue = toggleInput();\n onChange(newValue);\n return;\n }\n\n // Do nothing if disabled or readonly\n if (props.disabled && props.readonly) {\n return;\n }\n\n // If it's not fully clickable prevent selecting the card if the click\n // originated in a slot\n if (!props.fullyClickable) {\n // Check if the click originated from the slot - in that case, do nothng\n if (slotRef.value && slotRef.value?.$el?.contains(event.target)) {\n return;\n }\n // Check if the click originated from the dynamic slot - in that case, do nothng\n if (dynamicSlotRef.value && dynamicSlotRef.value?.$el?.contains(event.target)) {\n return;\n }\n // Check if the click originated from the input - in that case do nothing, as the input will emit the event already\n if (inputRef.value && inputRef.value?.$el?.contains(event.target as Node)) {\n return;\n }\n }\n\n // If the click originated outside of these two areas, emit the change event\n const newValue = toggleInput();\n\n onChange(newValue);\n };\n\n const toggleInput = (): BentoSelectionCardModelValue => {\n const currentValue: boolean = (inputRef.value?.$refs.inputRef as HTMLInputElement).checked;\n\n if (isCheckboxGroup.value) {\n const newCheckedList = [...(props.modelValue as BentoMultiCheckboxType)];\n const index = newCheckedList.indexOf(props.value);\n\n if (index === -1) {\n newCheckedList.push(props.value);\n } else {\n newCheckedList.splice(index, 1);\n }\n return newCheckedList;\n }\n\n if (isRadioInput.value) {\n return props.value;\n }\n return currentValue;\n };\n\n const onChange = newValue => {\n if (!props.disabled && !props.readonly) {\n emit('update:model-value', newValue);\n emit('input', newValue);\n }\n };\n</script>\n\n<script lang=\"ts\">\n /**\n * Selection card component. If used standalone, only the checkbox variant can be used. If the checkbox variant is needed, please use the bento-selection-card-group component.\n *\n * @example\n * import { BentoSelectionCard } from '@adyen/bento-vue2';\n * import EmoticonHappyIcon from '@adyen/ui-assets-icons-16/vue/emoticon-happy';\n *\n * export default {\n * components: { BentoSelectionCard, EmoticonHappyIcon },\n * template: `\n * <bento-selection-card title=\"Card title\" :model-value.sync=\"yourModelValue\">\n * <template #icon>\n * <emoticon-happy-icon />\n * </template>\n * </bento-selection-card>\n * `\n * }\n */\n export default {\n name: 'bento-selection-card',\n };\n</script>\n<style lang=\"scss\" scoped src=\"./selection-card.scss\" />\n","<template>\n <controls-group\n ref=\"containerRef\"\n :aria-describedby=\"shouldShowGroupError ? errorMessageId : null\"\n :label=\"label\"\n :hide-label=\"hideLabel\"\n :description=\"description\"\n :disabled=\"disabled\"\n :tooltip-text=\"tooltipText\"\n :readonly=\"readonly\"\n :required=\"required\"\n :optional=\"optional\"\n class=\"b-selection-card-group\"\n component-name=\"selection-card-group\"\n >\n <div\n v-if=\"!itemsPerRow || layout === 'vertical'\"\n class=\"b-selection-card-group__items\"\n :class=\"conditionalItemsClasses\"\n >\n <bento-selection-card\n v-for=\"item in items\"\n :key=\"`selection-card-${item.value}`\"\n class=\"b-selection-card-group__item\"\n v-bind=\"item\"\n :model-value=\"inputValue\"\n :readonly=\"readonly || item.readonly\"\n :has-error=\"shouldShowGroupError\"\n :disabled=\"disabled || item.disabled\"\n @update:model-value=\"onInput\"\n >\n <template v-if=\"hasSlot('icon') && item.icon\" #icon>\n <slot name=\"icon\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('content') && item.content\" #content>\n <slot name=\"content\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('dynamicContent') && item.dynamicContent\" #dynamicContent>\n <slot name=\"dynamicContent\" v-bind=\"item\"></slot>\n </template>\n </bento-selection-card>\n </div>\n <template v-else>\n <div :key=\"`selection-card-group-layout-breakpoint-${currentBreakpoint}`\">\n <grid-layout\n v-for=\"(row, rowIndex) in computedRows\"\n :key=\"`selection-card-group-row-${rowIndex}-cols-${computedItemsPerRow}`\"\n class=\"b-selection-card-group__items--wrap\"\n :column-width=\"computedColumnWidth\"\n >\n <template v-for=\"(item, columnIndex) in row\" #[`col-${columnIndex+1}`]>\n <bento-selection-card\n :key=\"`selection-card-${item.value}`\"\n class=\"b-selection-card-group__item b-selection-card-group__item--full-height\"\n v-bind=\"item\"\n :model-value=\"inputValue\"\n :readonly=\"readonly || item.readonly\"\n :has-error=\"shouldShowGroupError\"\n :disabled=\"disabled || item.disabled\"\n @update:model-value=\"onInput\"\n >\n <template v-if=\"hasSlot('icon') && item.icon\" #icon>\n <slot name=\"icon\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('content') && item.content\" #content>\n <slot name=\"content\" v-bind=\"item\"></slot>\n </template>\n <template v-if=\"hasSlot('dynamicContent') && item.dynamicContent\" #dynamicContent>\n <slot name=\"dynamicContent\" v-bind=\"item\"></slot>\n </template>\n </bento-selection-card>\n </template>\n </grid-layout>\n </div>\n </template>\n <error-message\n v-if=\"shouldShowGroupError\"\n :id=\"errorMessageId\"\n :error-message=\"errorMessage\"\n class=\"b-selection-card-group__error-message\"\n />\n </controls-group>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, onMounted, PropType, provide, ref, useSlots, watch } from 'vue';\n import { useElementSize } from '@vueuse/core';\n import { BMediaQueryMMax, BMediaQuerySMax } from '@adyen/bento-design-tokens/dist/js/bento/es6';\n import {\n BentoSelectionCardGroupItemsPerRow,\n BentoSelectionCardGroupLayout,\n BentoSelectionCardGroupVariant,\n } from './selection-card-group.types';\n import BentoSelectionCard from '../../selection-card.vue';\n import { ControlsGroup, ErrorMessage, GridLayout } from '../../../internal';\n import { BentoSelectionCardItem, BentoSelectionCardModelValue } from '../../selection-card.types';\n import { SELECTION_CARD_RADIO_INPUT_INJECTION_KEY } from '../../selection-card.keys';\n import { generateUid } from '@/core/utils/ts';\n\n const props = defineProps({\n /**\n * Descriptive supporting text visbile underneath the label.\n */\n description: { type: String, default: null },\n\n /**\n * If set to true, renders all cards in the group in a disabled state.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Renders all cards in an error state with an error message.\n */\n errorMessage: { type: String, default: null },\n\n /**\n * The form id the selection card group is associated with. Defaults to null, as a selection card group can also be used standalone.\n */\n formId: { type: String, default: null },\n\n /**\n * Shows/hides the group label.\n */\n hideLabel: { type: Boolean, default: null },\n\n /**\n * Label of the group. Required for accessibility purposes, even if it's not shown\n */\n label: {\n type: String,\n required: true,\n },\n\n /**\n * The selection card group's layout. It can be vertical or horizontal. Defaults to vertical.\n * @values horizontal, vertical\n */\n layout: {\n type: String as PropType<BentoSelectionCardGroupLayout>,\n default: 'vertical',\n },\n\n /**\n * The selection card group's items.\n */\n items: {\n type: Array as PropType<BentoSelectionCardItem[]>,\n required: true,\n },\n\n /**\n * Sets the responsive number of items rendered in each row.\n */\n itemsPerRow: {\n type: Object as PropType<BentoSelectionCardGroupItemsPerRow>,\n default: undefined,\n },\n\n /**\n * Determines the initially selected value of the group. Corresponds to the BentoSelectionCardItem's value.\n * Defaults to no value selected.\n */\n modelValue: {\n type: [Array, String, Number] as PropType<BentoSelectionCardModelValue>,\n default: null,\n },\n\n /**\n * Indicates the field is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * Indicates the field is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Tooltip message.\n */\n tooltipText: { type: String, default: null },\n\n /**\n * If set to true, renders all cards in the group in a readonly state.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Renders the cards with a checkbox or a radio input. Selection logic will also apply in accordance.\n * @values checkbox, radio\n */\n variant: { type: String as PropType<BentoSelectionCardGroupVariant>, default: 'checkbox' },\n });\n\n const emit = defineEmits([\"input\", \"update:model-value\"]);\n const slots = useSlots();\n // Slots logic\n // Temporary, use-has-slots composable doesn't currently work for vue3 named scoped slots\n // We do the same in bento-checkbox-group\n const hasSlot = name => !!slots[name];\n\n const conditionalItemsClasses = computed(() => ({\n 'b-selection-card-group__items--horizontal': props.layout === 'horizontal',\n }));\n\n const inputValue = ref(props.modelValue);\n watch(\n () => props.modelValue,\n () => {\n inputValue.value = props.modelValue;\n }\n );\n\n // Error message logic\n const errorMessageId = generateUid('error');\n const shouldShowGroupError = computed(() => !props.disabled && !props.readonly && !!props.errorMessage);\n\n // itemsPerRow logic\n const containerRef = ref<HTMLElement | null>(null);\n const { width } = useElementSize(containerRef);\n\n const smallBreakpoint = computed(() => BMediaQuerySMax.split('px')[0]);\n const mediumBreakpoint = computed(() => BMediaQueryMMax.split('px')[0]);\n\n const currentBreakpoint = computed(() => {\n if (width.value < smallBreakpoint.value) {\n return 'small';\n }\n if (width.value >= smallBreakpoint.value && width.value < mediumBreakpoint.value) {\n return 'medium';\n }\n return 'large';\n });\n\n const computedItemsPerRow = computed(() => {\n return (props.itemsPerRow?.[currentBreakpoint?.value] as number) || props.items.length;\n });\n\n const computedRows = computed(() => {\n if (!props.itemsPerRow) {\n return [];\n }\n const rows = [];\n for (let i = 0; i < props.items.length; i += computedItemsPerRow?.value) {\n rows.push(props.items.slice(i, i + computedItemsPerRow?.value));\n }\n return rows;\n });\n\n // We need to compute the column width on 12 because we're using a 12-column system for out grid-layout logic\n const itemColumnWidth = computed(() => 12 / computedItemsPerRow?.value);\n\n /**\n * Filling the columnWidth array with the same parameters per item to pass\n * to the `grid-layout` layout so the each card can have\n * the same width according to the screen size.\n */\n const computedColumnWidth = computed(() => {\n return computedItemsPerRow?.value\n ? new Array(computedItemsPerRow?.value).fill({\n // Instead of passing the actual screen sizes values, passing the same values per each screen size and recomputing it makes sure visually the change is smoother and not laggy\n small: itemColumnWidth.value,\n medium: itemColumnWidth.value,\n large: itemColumnWidth.value,\n })\n : [];\n });\n\n const onInput = value => {\n inputValue.value = value;\n emit('update:model-value', value);\n emit('input', value);\n };\n\n const isRadioVariant = computed(() => props.variant === 'radio');\n\n provide(SELECTION_CARD_RADIO_INPUT_INJECTION_KEY, isRadioVariant);\n\n onMounted(() => {\n if (props.itemsPerRow) {\n Object.values(props.itemsPerRow).forEach(el => {\n if (el && (el < 2 || el > 6)) {\n throw new Error(\n 'itemsPerRow values must have a value between 2 and 6 items per row. Read the documentation for more information.'\n );\n }\n });\n }\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * Group of bento-selection-cards.\n *\n * @example\n * import { BentoSelectionCardGroup } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoSelectionCardGroup },\n * template: `\n * <bento-selection-card-group\n * :items=\"[\n * {\n * title: 'Card 1',\n * value: 'card-1',\n * content: 'Slot content 1',\n * icon: RetailIcon,\n * },\n * {\n * title: 'Card 2',\n * value: 'card-2',\n * content: 'Slot content 2',\n * icon: LeafIcon,\n * },\n * ]\"\n * >\n * <template #icon=\"{ icon }\">\n * <component :is=\"icon\"/>\n * </template>\n * <template #content=\"{ content }\">\n * <div>{{ content }}</div>\n * </template>\n * </bento-selection-card-group>\n * `,\n * }\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./selection-card-group.scss\" />\n"],"names":["BentoSelectionCardState","BentoSelectionCardState2","SELECTION_CARD_RADIO_INPUT_INJECTION_KEY","__default__$1","slots","useSlots","hasSlot","useHasSlot","inputId","generateUid","descriptionId","computedRadioInputModelValue","computed","props","computedCheckboxInputModelValue","conditionalClasses","isChecked","containerConditionalClasses","isTitleOnly","checkboxContainerConditionalClasses","checkboxContainerTextConditionalClasses","slotConditionalClasses","ariaLabel","useAriaLabel","isCheckboxGroup","isRadioInput","item","inject","ref","inputRef","slotRef","dynamicSlotRef","handleCardClick","event","newValue2","toggleInput","onChange","_b","_a","_d","_c","_f","_e","newValue","currentValue","newCheckedList","index","emit","__default__","name","conditionalItemsClasses","inputValue","watch","errorMessageId","shouldShowGroupError","containerRef","width","useElementSize","smallBreakpoint","BMediaQuerySMax","mediumBreakpoint","BMediaQueryMMax","currentBreakpoint","computedItemsPerRow","computedRows","rows","i","itemColumnWidth","computedColumnWidth","onInput","value","isRadioVariant","provide","onMounted","el"],"mappings":";;;;;;;;;;;;;;AAIY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,WAAA,YACAA,EAAA,WAAA,YACAA,EAAA,QAAA,SAHQA,IAAAD,KAAA,CAAA,CAAA;ACJC,MAAAE,IAAA,OAAA,0CAAA,GCmTTC,KAAA;AAAA,EAAe,MAAA;AAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBArJAC,IAAAC,EAAA,GACAC,IAAAC,EAAAH,CAAA,GAEAI,IAAAC,EAAA,yBAAA,GACAC,IAAAD,EAAA,4BAAA,GAEAE,IAAAC;AAAA,MAAmE,MAAAC,EAAA;AAAA,IACnD,GAEhBC,IAAAF;AAAA,MAAwE,MAAAC,EAAA;AAAA,IACxD,GAGhBE,IAAAH,EAAA,OAAA;AAAA,MAA2C,6BAAAI,EAAA;AAAA,MACA,qCAAAH,EAAA;AAAA,IACI,EAAA,GAG/CI,IAAAL,EAAA,OAAA;AAAA,MAAoD,CAAA,qBAAAZ,EAAA,QAAA,EAAA,GAAAa,EAAA;AAAA,MACiB,CAAA,qBAAAb,EAAA,KAAA,EAAA,GAAAa,EAAA;AAAA,MACH,CAA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E,GAAAqE,CAAA,GAEAE,EAAA,MAAA;AACI,MAAA5D,EAAA,eACI,OAAA,OAAAA,EAAA,WAAA,EAAA,QAAA,CAAA6D,MAAA;AACI,YAAAA,MAAAA,IAAA,KAAAA,IAAA;AACI,gBAAA,IAAA;AAAA,YAAU;AAAA,UACN;AAAA,MAER,CAAA;AAAA,IAER,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { defineComponent as P, toRefs as k, ref as o, computed as B, watch as N, nextTick as x, provide as v } from "vue";
|
|
2
|
-
import { B as G, d as F } from "./typography.
|
|
3
|
-
import { F as L } from "./footer-actions.
|
|
4
|
-
import { D as R, B as U, b as w, a as J } from "./dialog-page.
|
|
2
|
+
import { B as G, d as F } from "./typography.Bu_WAKdf.js";
|
|
3
|
+
import { F as L } from "./footer-actions.O24MYRgM.js";
|
|
4
|
+
import { D as R, B as U, b as w, a as J } from "./dialog-page.Da2cxzZm.js";
|
|
5
5
|
import { n as b } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
6
|
-
import { B as V } from "./button.
|
|
7
|
-
import { B as K } from "./focus-trap.
|
|
6
|
+
import { B as V } from "./button.Bx8WC-dy.js";
|
|
7
|
+
import { B as K } from "./focus-trap.DA_1lCcM.js";
|
|
8
8
|
import { C as Y } from "./cross.CsUPDmaA.js";
|
|
9
9
|
import { S as H } from "./sidepanel.keys.R0DKQuYx.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { B as $ } from "./directive.O3yEdalv.js";
|
|
11
|
+
import { u as j } from "./i18n.BQkEbtPM.js";
|
|
12
|
+
import { g as z } from "./generate-uid.D-HFI38h.js";
|
|
13
13
|
import "../assets/sidepanel.css";
|
|
14
14
|
const M = {}, q = /* @__PURE__ */ P({
|
|
15
15
|
...M,
|
|
@@ -151,7 +151,7 @@ const Z = {
|
|
|
151
151
|
},
|
|
152
152
|
emits: [],
|
|
153
153
|
setup(a, { emit: e }) {
|
|
154
|
-
const t = a, { activePage: s, isOpen: i } = k(t), { t: I } =
|
|
154
|
+
const t = a, { activePage: s, isOpen: i } = k(t), { t: I } = j(), l = o(null), u = o([]), n = o([]), m = o(U.TRANSITION_LEVEL_DEEPER), c = o(!1), g = z("sidepanel"), p = o(!1), _ = o(!1), D = B(() => ({
|
|
155
155
|
"b-sidepanel--hide": c.value,
|
|
156
156
|
"b-sidepanel--animation": _.value
|
|
157
157
|
})), h = () => {
|
|
@@ -184,7 +184,7 @@ const Z = {
|
|
|
184
184
|
'BentoSidepanel "isDismissible" property’s behavior',
|
|
185
185
|
'BentoSidepanel "isDismissible" will no longer hide the close button. Use "hideCloseButton=true" instead.',
|
|
186
186
|
"2.0.0"
|
|
187
|
-
), { __sfc: !0, props: t, emit: e, activePage: s, isOpen: i, t: I, sidepanel: l, pages: u, previousPages: n, animation: m, isClosing: c, sidepanelId: g, internalIsOpen: p, isAnimationActive: _, conditionalClasses: D, closeSidepanelAfterAnimation: h, startCloseSidepanelAnimation: f, closeSidepanelOnClickOutside: O, computedHideCloseButton: S, updatePage: C, unregisterPage: y, registerPage: A, BentoButton: V, BentoFocusTrap: K, CrossIcon: Y, vBentoClickOutsideDirective:
|
|
187
|
+
), { __sfc: !0, props: t, emit: e, activePage: s, isOpen: i, t: I, sidepanel: l, pages: u, previousPages: n, animation: m, isClosing: c, sidepanelId: g, internalIsOpen: p, isAnimationActive: _, conditionalClasses: D, closeSidepanelAfterAnimation: h, startCloseSidepanelAnimation: f, closeSidepanelOnClickOutside: O, computedHideCloseButton: S, updatePage: C, unregisterPage: y, registerPage: A, BentoButton: V, BentoFocusTrap: K, CrossIcon: Y, vBentoClickOutsideDirective: $ };
|
|
188
188
|
}
|
|
189
189
|
});
|
|
190
190
|
var se = function() {
|
|
@@ -207,4 +207,4 @@ export {
|
|
|
207
207
|
Ce as a,
|
|
208
208
|
ge as s
|
|
209
209
|
};
|
|
210
|
-
//# sourceMappingURL=sidepanel.
|
|
210
|
+
//# sourceMappingURL=sidepanel.PEMSN4Hj.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidepanel.CQnLpV8A.js","sources":["../../src/components/sidepanel/components/sidepanel-page.vue","../../src/components/sidepanel/sidepanel.types.ts","../../src/components/sidepanel/sidepanel.vue"],"sourcesContent":["<template>\n <dialog-page class=\"b-sidepanel-page\" :page-id=\"pageId\" :previous-page=\"previousPage\">\n <template #header>\n <div class=\"b-sidepanel-page__header\">\n <bento-typography class=\"b-sidepanel-page__title\" el=\"h2\" variant=\"title\">\n {{ title }}\n </bento-typography>\n </div>\n </template>\n <template #content>\n <div class=\"b-sidepanel-page__content\">\n <bento-typography el=\"div\" variant=\"body\">\n <slot />\n </bento-typography>\n </div>\n </template>\n <template v-if=\"actions && actions.length > 0\" #footer>\n <div class=\"b-sidepanel-page__actions\">\n <footer-actions\n :actions=\"actions\"\n :actions-label=\"actionsLabel\"\n :destructive-actions=\"destructiveActions\"\n />\n </div>\n </template>\n </dialog-page>\n</template>\n\n<script setup lang=\"ts\">\n import { PropType } from 'vue';\n\n import { BentoButtonActionsList } from '@/components/button';\n import { BentoTypography } from '@/components/typography';\n import { FooterActions } from '@/components/internal/footer-actions';\n import { DialogPage } from '@/internal';\n\n defineProps({\n /**\n * List of actions that will be used to render the buttons.\n * First element in the list will be rendered as \"primary\".\n * All elements after the first will be rendered as \"secondary\".\n *\n * ```\n * [{\n * title: 'Primary',\n * event: () => { ... },\n * icon: FourPeopleIcon\n * }, {\n * title: 'Secondary',\n * event: () => { ... }\n * }]\n * ```\n */\n actions: {\n type: Array as PropType<BentoButtonActionsList>,\n default: null,\n },\n\n /**\n * Text label that is displayed left to the action buttons\n */\n actionsLabel: {\n type: String,\n default: null,\n },\n\n /**\n * If passed - sets first button color to red\n */\n destructiveActions: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Identifier of the page, used with activePage prop to handle sidepanel navigation\n */\n pageId: {\n type: String,\n default: undefined,\n },\n\n /**\n * ID of the page for the back button to navigate to. Only use it to overwrite the default back behavior\n * Used when the back button should not take the user to the natural previous page\n * Set to `null` to hide back button in the page\n */\n previousPage: {\n type: String,\n default: undefined,\n },\n\n /**\n * Title of the sidepanel page\n */\n title: {\n type: String,\n default: null,\n },\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * SidepanelPage is used to render different pages of Sidepanel component\n *\n * @example\n * import { BentoSidepanel, BentoSidepanelPage } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoSidepanel, BentoSidepanelPage },\n * template: `\n * <bento-sidepanel active-page='step1' is-open='true'>\n * <bento-sidepanel-page\n * title='Step 1'\n * pageId='step1'\n * :actions=\"[\n * {\n * title: 'Next step',\n * event: () => {\n * activePage.value = 'step2';\n * },\n * }]\">\n * Step 1 info\n * </bento-sidepanel-page>\n * <bento-sidepanel-page\n * title='Step 2'\n * pageId='step2'\n * :actions=\"[\n * {\n * title: 'Save',\n * event: () => {},\n * }]\">\n * Step 2 info\n * </bento-sidepanel-page>\n * </bento-sidepanel>\n * `\n * }\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./sidepanel-page.scss\" />\n","export enum BentoSidepanelEvent {\n UPDATE_ACTIVE_PAGE = 'update:active-page',\n UPDATE_IS_OPEN = 'update:is-open',\n}\n","<template>\n <dialog\n ref=\"sidepanel\"\n class=\"b-sidepanel\"\n :class=\"conditionalClasses\"\n @animationend=\"closeSidepanelAfterAnimation\"\n @keydown.esc.prevent=\"isDismissible && startCloseSidepanelAnimation\"\n >\n <bento-focus-trap :id=\"sidepanelId\" v-bento-click-outside-directive=\"closeSidepanelOnClickOutside\">\n <div v-if=\"!computedHideCloseButton\" class=\"b-sidepanel__close-button\">\n <bento-button variant=\"tertiary\" @click=\"startCloseSidepanelAnimation\">\n <cross-icon :svg-title=\"t('close')\" />\n </bento-button>\n </div>\n <slot />\n </bento-focus-trap>\n </dialog>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, nextTick, provide, ref, toRefs, watch } from 'vue';\n\n import { BentoButton } from '@/components/button';\n import { BentoFocusTrap } from '@/components/focus-trap';\n import CrossIcon from '@adyen/ui-assets-icons-16/vue/cross';\n\n import { BentoSidepanelEvent } from './sidepanel.types';\n import {\n BentoDialogPageAnimation,\n BentoDialogPageConfigData,\n BentoDialogPageRegisterPage,\n DIALOG_PAGE_CONFIG_INJECTION_KEY,\n DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY,\n } from '@/internal';\n\n import { SIDEPANEL_DIALOG_ID_INJECTION_KEY } from './sidepanel.keys';\n\n import { BentoClickOutsideDirective as vBentoClickOutsideDirective } from '@/directives/click-outside';\n\n import { useI18n } from '@/utils/ts/i18n';\n\n import messages from './messages.json';\n import { generateUid } from '@/core/utils/ts';\n import { deprecate } from '@/utils/ts/deprecate';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n /**\n * The id of the current active page\n * Should be the same id as the BentoSidepanelPage to be displayed\n * If the component only has one page, it can be left null/undefined.\n */\n activePage: {\n type: String,\n default: null,\n },\n\n /**\n * If set to true, it allows the sidepanel to be closed.\n * Shows close button when `true` and hides close button when `false`.\n *\n * _Note: This property will not set the visibility of the close button in v2.0.0_\n */\n isDismissible: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Controls the sidepanel's state from the outside. Set it to true to open the sidepanel.\n */\n isOpen: {\n type: Boolean,\n default: null,\n },\n\n /**\n * Controls the visibility of close button on the sidepanel.\n * Defaults to `true` when `isDismissible=false`, and `true` when `isDimissible=true`.\n *\n * _Note: This property will be set to `false` by default, independent of `isDismissible` in v2.0.0_\n */\n hideCloseButton: {\n type: Boolean,\n default: null,\n },\n });\n\n const emit = defineEmits([]);\n\n // Refs\n const { activePage, isOpen } = toRefs(props);\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const sidepanel = ref(null);\n const pages = ref<string[]>([]);\n const previousPages = ref([]);\n const animation = ref(BentoDialogPageAnimation.TRANSITION_LEVEL_DEEPER);\n const isClosing = ref(false);\n const sidepanelId = generateUid('sidepanel');\n const internalIsOpen = ref(false);\n const isAnimationActive = ref(false);\n\n // Animation styling\n const conditionalClasses = computed(() => ({\n 'b-sidepanel--hide': isClosing.value,\n 'b-sidepanel--animation': isAnimationActive.value,\n }));\n\n // Handle closing and closing animation for dialog element\n const closeSidepanelAfterAnimation = () => {\n if (isClosing.value) {\n sidepanel.value.close();\n if (previousPages.value[0]) {\n emit(BentoSidepanelEvent.UPDATE_ACTIVE_PAGE, previousPages.value[0]);\n }\n previousPages.value = [];\n isClosing.value = false;\n internalIsOpen.value = false;\n emit(BentoSidepanelEvent.UPDATE_IS_OPEN, false);\n }\n };\n\n const startCloseSidepanelAnimation = () => {\n if (!sidepanel.value.open) {\n return;\n }\n isClosing.value = true;\n };\n\n const closeSidepanelOnClickOutside = () => {\n if (props.isDismissible) {\n startCloseSidepanelAnimation();\n }\n };\n\n // TODO: Remove in upcoming major. See properties `hideCloseButton` and `isDismissible`.\n const computedHideCloseButton = computed(() => {\n if (props.hideCloseButton !== null) {\n return props.hideCloseButton;\n }\n\n return !props.isDismissible;\n });\n\n // Watching isOpen prop to toggle open/close the dialog element\n watch(\n () => isOpen.value,\n async () => {\n // Wait for sidepanel ref to be created\n await nextTick();\n\n if (!sidepanel.value) {\n return;\n }\n\n if (isOpen.value) {\n internalIsOpen.value = true;\n sidepanel.value.showModal();\n if (!previousPages.value.length) {\n previousPages.value.push(activePage.value);\n }\n } else if (sidepanel.value.open) {\n startCloseSidepanelAnimation();\n }\n },\n { immediate: true }\n );\n\n // Pages\n const updatePage = page => emit(BentoSidepanelEvent.UPDATE_ACTIVE_PAGE, page);\n\n // unregister page if removed / destroyed\n const unregisterPage = (pageIdToRemove: string) => () => {\n pages.value = pages.value?.filter(pageId => pageId !== pageIdToRemove);\n };\n\n // Provide data and function to register page to subcomponent\n const registerPage: BentoDialogPageRegisterPage = pageId => {\n pages.value.push(pageId);\n\n return { unregisterPage: unregisterPage(pageId) };\n };\n\n provide<BentoDialogPageConfigData>(DIALOG_PAGE_CONFIG_INJECTION_KEY, {\n activePage,\n animation,\n isAnimationActive,\n isOpen: internalIsOpen,\n pages,\n previousPages,\n updatePage,\n });\n provide(DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY, registerPage);\n\n // Let's Children components know they are inside a SidePanel (dialog element)\n provide(SIDEPANEL_DIALOG_ID_INJECTION_KEY, sidepanelId);\n\n if (!props.isDismissible && props.hideCloseButton === null) {\n deprecate(\n 'BentoSidepanel \"isDismissible\" property’s behavior',\n 'BentoSidepanel \"isDismissible\" will no longer hide the close button. Use \"hideCloseButton=true\" instead.',\n '2.0.0'\n );\n }\n</script>\n\n<script lang=\"ts\">\n /**\n * Sidepanel component is a slide-in panel that should be used for presenting actions, settings or features that are directly associated with a specific task or interaction on the main screen.\n *\n * @example\n * import { BentoSidepanel, BentoSidepanelPage } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoSidepanel, BentoSidepanelPage },\n * template: `\n * <bento-sidepanel active-page='step1' is-open='true'>\n * <bento-sidepanel-page\n * title='Step 1'\n * pageId='step1'\n * :actions=\"[\n * {\n * title: 'Next step',\n * event: () => {\n * activePage.value = 'step2';\n * },\n * }]\">\n * Step 1 info\n * </bento-sidepanel-page>\n * <bento-sidepanel-page\n * title='Step 2'\n * pageId='step2'\n * :actions=\"[\n * {\n * title: 'Save',\n * event: () => {},\n * }]\">\n * Step 2 info\n * </bento-sidepanel-page>\n * </bento-sidepanel>\n * `\n * }\n */\n export default {\n i18n: { messages },\n };\n</script>\n<style lang=\"scss\" scoped src=\"./sidepanel.scss\" />\n"],"names":["__default__$1","BentoSidepanelEvent","BentoSidepanelEvent2","__default__","messages","activePage","isOpen","toRefs","props","t","useI18n","sidepanel","ref","pages","previousPages","animation","BentoDialogPageAnimation","isClosing","sidepanelId","generateUid","internalIsOpen","isAnimationActive","conditionalClasses","computed","closeSidepanelAfterAnimation","emit","startCloseSidepanelAnimation","closeSidepanelOnClickOutside","computedHideCloseButton","watch","nextTick","updatePage","page","unregisterPage","pageIdToRemove","_a","pageId","registerPage","provide","DIALOG_PAGE_CONFIG_INJECTION_KEY","DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY","SIDEPANEL_DIALOG_ID_INJECTION_KEY","deprecate"],"mappings":";;;;;;;;;;;;;AA2II,MAAAA,IAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC3IQ,IAAAC,IAAA,kBAAAC,OACRA,EAAA,qBAAA,sBACAA,EAAA,iBAAA,kBAFQA,IAAAD,KAAA,CAAA,CAAA;;;;;;;;;;;GCoPRE,KAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA1JA,EAAA,YAAAC,GAAA,QAAAC,EAAA,IAAAC,EAAAC,CAAA,GACA,EAAA,GAAAC,EAAA,IAAAC,EAAA,GACAC,IAAAC,EAAA,IAAA,GACAC,IAAAD,EAAA,CAAA,CAAA,GACAE,IAAAF,EAAA,CAAA,CAAA,GACAG,IAAAH,EAAAI,EAAA,uBAAA,GACAC,IAAAL,EAAA,EAAA,GACAM,IAAAC,EAAA,WAAA,GACAC,IAAAR,EAAA,EAAA,GACAS,IAAAT,EAAA,EAAA,GAGAU,IAAAC,EAAA,OAAA;AAAA,MAA2C,qBAAAN,EAAA;AAAA,MACR,0BAAAI,EAAA;AAAA,IACa,EAAA,GAIhDG,IAAA,MAAA;AACI,MAAAP,EAAA,UACIN,EAAA,MAAA,MAAA,GACAG,EAAA,MAAA,CAAA,KACIW,EAAAxB,EAAA,oBAAAa,EAAA,MAAA,CAAA,CAAA,GAEJA,EAAA,QAAA,CAAA,GACAG,EAAA,QAAA,IACAG,EAAA,QAAA,IACAK,EAAAxB,EAAA,gBAAA,EAAA;AAAA,IACJ,GAGJyB,IA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page.vue","../../src/components/sidepanel/sidepanel.types.ts","../../src/components/sidepanel/sidepanel.vue"],"sourcesContent":["<template>\n <dialog-page class=\"b-sidepanel-page\" :page-id=\"pageId\" :previous-page=\"previousPage\">\n <template #header>\n <div class=\"b-sidepanel-page__header\">\n <bento-typography class=\"b-sidepanel-page__title\" el=\"h2\" variant=\"title\">\n {{ title }}\n </bento-typography>\n </div>\n </template>\n <template #content>\n <div class=\"b-sidepanel-page__content\">\n <bento-typography el=\"div\" variant=\"body\">\n <slot />\n </bento-typography>\n </div>\n </template>\n <template v-if=\"actions && actions.length > 0\" #footer>\n <div class=\"b-sidepanel-page__actions\">\n <footer-actions\n :actions=\"actions\"\n :actions-label=\"actionsLabel\"\n :destructive-actions=\"destructiveActions\"\n />\n </div>\n </template>\n </dialog-page>\n</template>\n\n<script setup lang=\"ts\">\n import { PropType } from 'vue';\n\n import { BentoButtonActionsList } from '@/components/button';\n import { BentoTypography } from '@/components/typography';\n import { FooterActions } from '@/components/internal/footer-actions';\n import { DialogPage } from '@/internal';\n\n defineProps({\n /**\n * List of actions that will be used to render the buttons.\n * First element in the list will be rendered as \"primary\".\n * All elements after the first will be rendered as \"secondary\".\n *\n * ```\n * [{\n * title: 'Primary',\n * event: () => { ... },\n * icon: FourPeopleIcon\n * }, {\n * title: 'Secondary',\n * event: () => { ... }\n * }]\n * ```\n */\n actions: {\n type: Array as PropType<BentoButtonActionsList>,\n default: null,\n },\n\n /**\n * Text label that is displayed left to the action buttons\n */\n actionsLabel: {\n type: String,\n default: null,\n },\n\n /**\n * If passed - sets first button color to red\n */\n destructiveActions: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Identifier of the page, used with activePage prop to handle sidepanel navigation\n */\n pageId: {\n type: String,\n default: undefined,\n },\n\n /**\n * ID of the page for the back button to navigate to. Only use it to overwrite the default back behavior\n * Used when the back button should not take the user to the natural previous page\n * Set to `null` to hide back button in the page\n */\n previousPage: {\n type: String,\n default: undefined,\n },\n\n /**\n * Title of the sidepanel page\n */\n title: {\n type: String,\n default: null,\n },\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * SidepanelPage is used to render different pages of Sidepanel component\n *\n * @example\n * import { BentoSidepanel, BentoSidepanelPage } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoSidepanel, BentoSidepanelPage },\n * template: `\n * <bento-sidepanel active-page='step1' is-open='true'>\n * <bento-sidepanel-page\n * title='Step 1'\n * pageId='step1'\n * :actions=\"[\n * {\n * title: 'Next step',\n * event: () => {\n * activePage.value = 'step2';\n * },\n * }]\">\n * Step 1 info\n * </bento-sidepanel-page>\n * <bento-sidepanel-page\n * title='Step 2'\n * pageId='step2'\n * :actions=\"[\n * {\n * title: 'Save',\n * event: () => {},\n * }]\">\n * Step 2 info\n * </bento-sidepanel-page>\n * </bento-sidepanel>\n * `\n * }\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./sidepanel-page.scss\" />\n","export enum BentoSidepanelEvent {\n UPDATE_ACTIVE_PAGE = 'update:active-page',\n UPDATE_IS_OPEN = 'update:is-open',\n}\n","<template>\n <dialog\n ref=\"sidepanel\"\n class=\"b-sidepanel\"\n :class=\"conditionalClasses\"\n @animationend=\"closeSidepanelAfterAnimation\"\n @keydown.esc.prevent=\"isDismissible && startCloseSidepanelAnimation\"\n >\n <bento-focus-trap :id=\"sidepanelId\" v-bento-click-outside-directive=\"closeSidepanelOnClickOutside\">\n <div v-if=\"!computedHideCloseButton\" class=\"b-sidepanel__close-button\">\n <bento-button variant=\"tertiary\" @click=\"startCloseSidepanelAnimation\">\n <cross-icon :svg-title=\"t('close')\" />\n </bento-button>\n </div>\n <slot />\n </bento-focus-trap>\n </dialog>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, nextTick, provide, ref, toRefs, watch } from 'vue';\n\n import { BentoButton } from '@/components/button';\n import { BentoFocusTrap } from '@/components/focus-trap';\n import CrossIcon from '@adyen/ui-assets-icons-16/vue/cross';\n\n import { BentoSidepanelEvent } from './sidepanel.types';\n import {\n BentoDialogPageAnimation,\n BentoDialogPageConfigData,\n BentoDialogPageRegisterPage,\n DIALOG_PAGE_CONFIG_INJECTION_KEY,\n DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY,\n } from '@/internal';\n\n import { SIDEPANEL_DIALOG_ID_INJECTION_KEY } from './sidepanel.keys';\n\n import { BentoClickOutsideDirective as vBentoClickOutsideDirective } from '@/directives/click-outside';\n\n import { useI18n } from '@/utils/ts/i18n';\n\n import messages from './messages.json';\n import { generateUid } from '@/core/utils/ts';\n import { deprecate } from '@/utils/ts/deprecate';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n /**\n * The id of the current active page\n * Should be the same id as the BentoSidepanelPage to be displayed\n * If the component only has one page, it can be left null/undefined.\n */\n activePage: {\n type: String,\n default: null,\n },\n\n /**\n * If set to true, it allows the sidepanel to be closed.\n * Shows close button when `true` and hides close button when `false`.\n *\n * _Note: This property will not set the visibility of the close button in v2.0.0_\n */\n isDismissible: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Controls the sidepanel's state from the outside. Set it to true to open the sidepanel.\n */\n isOpen: {\n type: Boolean,\n default: null,\n },\n\n /**\n * Controls the visibility of close button on the sidepanel.\n * Defaults to `true` when `isDismissible=false`, and `true` when `isDimissible=true`.\n *\n * _Note: This property will be set to `false` by default, independent of `isDismissible` in v2.0.0_\n */\n hideCloseButton: {\n type: Boolean,\n default: null,\n },\n });\n\n const emit = defineEmits([]);\n\n // Refs\n const { activePage, isOpen } = toRefs(props);\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const sidepanel = ref(null);\n const pages = ref<string[]>([]);\n const previousPages = ref([]);\n const animation = ref(BentoDialogPageAnimation.TRANSITION_LEVEL_DEEPER);\n const isClosing = ref(false);\n const sidepanelId = generateUid('sidepanel');\n const internalIsOpen = ref(false);\n const isAnimationActive = ref(false);\n\n // Animation styling\n const conditionalClasses = computed(() => ({\n 'b-sidepanel--hide': isClosing.value,\n 'b-sidepanel--animation': isAnimationActive.value,\n }));\n\n // Handle closing and closing animation for dialog element\n const closeSidepanelAfterAnimation = () => {\n if (isClosing.value) {\n sidepanel.value.close();\n if (previousPages.value[0]) {\n emit(BentoSidepanelEvent.UPDATE_ACTIVE_PAGE, previousPages.value[0]);\n }\n previousPages.value = [];\n isClosing.value = false;\n internalIsOpen.value = false;\n emit(BentoSidepanelEvent.UPDATE_IS_OPEN, false);\n }\n };\n\n const startCloseSidepanelAnimation = () => {\n if (!sidepanel.value.open) {\n return;\n }\n isClosing.value = true;\n };\n\n const closeSidepanelOnClickOutside = () => {\n if (props.isDismissible) {\n startCloseSidepanelAnimation();\n }\n };\n\n // TODO: Remove in upcoming major. See properties `hideCloseButton` and `isDismissible`.\n const computedHideCloseButton = computed(() => {\n if (props.hideCloseButton !== null) {\n return props.hideCloseButton;\n }\n\n return !props.isDismissible;\n });\n\n // Watching isOpen prop to toggle open/close the dialog element\n watch(\n () => isOpen.value,\n async () => {\n // Wait for sidepanel ref to be created\n await nextTick();\n\n if (!sidepanel.value) {\n return;\n }\n\n if (isOpen.value) {\n internalIsOpen.value = true;\n sidepanel.value.showModal();\n if (!previousPages.value.length) {\n previousPages.value.push(activePage.value);\n }\n } else if (sidepanel.value.open) {\n startCloseSidepanelAnimation();\n }\n },\n { immediate: true }\n );\n\n // Pages\n const updatePage = page => emit(BentoSidepanelEvent.UPDATE_ACTIVE_PAGE, page);\n\n // unregister page if removed / destroyed\n const unregisterPage = (pageIdToRemove: string) => () => {\n pages.value = pages.value?.filter(pageId => pageId !== pageIdToRemove);\n };\n\n // Provide data and function to register page to subcomponent\n const registerPage: BentoDialogPageRegisterPage = pageId => {\n pages.value.push(pageId);\n\n return { unregisterPage: unregisterPage(pageId) };\n };\n\n provide<BentoDialogPageConfigData>(DIALOG_PAGE_CONFIG_INJECTION_KEY, {\n activePage,\n animation,\n isAnimationActive,\n isOpen: internalIsOpen,\n pages,\n previousPages,\n updatePage,\n });\n provide(DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY, registerPage);\n\n // Let's Children components know they are inside a SidePanel (dialog element)\n provide(SIDEPANEL_DIALOG_ID_INJECTION_KEY, sidepanelId);\n\n if (!props.isDismissible && props.hideCloseButton === null) {\n deprecate(\n 'BentoSidepanel \"isDismissible\" property’s behavior',\n 'BentoSidepanel \"isDismissible\" will no longer hide the close button. Use \"hideCloseButton=true\" instead.',\n '2.0.0'\n );\n }\n</script>\n\n<script lang=\"ts\">\n /**\n * Sidepanel component is a slide-in panel that should be used for presenting actions, settings or features that are directly associated with a specific task or interaction on the main screen.\n *\n * @example\n * import { BentoSidepanel, BentoSidepanelPage } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoSidepanel, BentoSidepanelPage },\n * template: `\n * <bento-sidepanel active-page='step1' is-open='true'>\n * <bento-sidepanel-page\n * title='Step 1'\n * pageId='step1'\n * :actions=\"[\n * {\n * title: 'Next step',\n * event: () => {\n * activePage.value = 'step2';\n * },\n * }]\">\n * Step 1 info\n * </bento-sidepanel-page>\n * <bento-sidepanel-page\n * title='Step 2'\n * pageId='step2'\n * :actions=\"[\n * {\n * title: 'Save',\n * event: () => {},\n * }]\">\n * Step 2 info\n * </bento-sidepanel-page>\n * </bento-sidepanel>\n * `\n * }\n */\n export default {\n i18n: { messages },\n };\n</script>\n<style lang=\"scss\" scoped src=\"./sidepanel.scss\" />\n"],"names":["__default__$1","BentoSidepanelEvent","BentoSidepanelEvent2","__default__","messages","activePage","isOpen","toRefs","props","t","useI18n","sidepanel","ref","pages","previousPages","animation","BentoDialogPageAnimation","isClosing","sidepanelId","generateUid","internalIsOpen","isAnimationActive","conditionalClasses","computed","closeSidepanelAfterAnimation","emit","startCloseSidepanelAnimation","closeSidepanelOnClickOutside","computedHideCloseButton","watch","nextTick","updatePage","page","unregisterPage","pageIdToRemove","_a","pageId","registerPage","provide","DIALOG_PAGE_CONFIG_INJECTION_KEY","DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY","SIDEPANEL_DIALOG_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,oBAAA,OACIA,EAAA,kBAGJ,CAAAA,EAAA,aAAc;AAIlB,IAAAqB;AAAA,MAAA,MAAAvB,EAAA;AAAA,MACiB,YAAA;AAKT,QAFA,MAAAwB,EAAA,GAEAnB,EAAA,UAIAL,EAAA,SACIc,EAAA,QAAA,IACAT,EAAA,MAAA,UAAA,GACAG,EAAA,MAAA,UACIA,EAAA,MAAA,KAAAT,EAAA,KAAA,KACJM,EAAA,MAAA,QAEAe,EAAA;AAAA,MACJ;AAAA,MACJ,EAAA,WAAA,GAAA;AAAA,IACkB;AAItB,UAAAK,IAAA,CAAAC,MAAAP,EAAAxB,EAAA,oBAAA+B,CAAA,GAGAC,IAAA,CAAAC,MAAA,MAAA;;AACI,MAAArB,EAAA,SAAAsB,IAAAtB,EAAA,UAAA,gBAAAsB,EAAA,OAAA,CAAAC,MAAAA,MAAAF;AAAA,IAAqE,GAIzEG,IAAA,CAAAD,OACIvB,EAAA,MAAA,KAAAuB,CAAA,GAEA,EAAA,gBAAAH,EAAAG,CAAA,EAAA;AAGJ,WAAAE,EAAAC,GAAA;AAAA,MAAqE,YAAAlC;AAAA,MACjE,WAAAU;AAAA,MACA,mBAAAM;AAAA,MACA,QAAAD;AAAA,MACQ,OAAAP;AAAA,MACR,eAAAC;AAAA,MACA,YAAAiB;AAAA,IACA,CAAA,GAEJO,EAAAE,GAAAH,CAAA,GAGAC,EAAAG,GAAAvB,CAAA,GAEA,CAAAV,EAAA,iBAAAA,EAAA,oBAAA,QACIkC;AAAA,MAAA;AAAA,MACI;AAAA,MACA;AAAA,IACA;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as e, computed as o } from "vue";
|
|
2
|
-
import { B as n } from "./typography.
|
|
2
|
+
import { B as n } from "./typography.Bu_WAKdf.js";
|
|
3
3
|
import { n as _ } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
4
4
|
import "../assets/status.css";
|
|
5
5
|
const l = {
|
|
@@ -33,4 +33,4 @@ export {
|
|
|
33
33
|
u as B,
|
|
34
34
|
b as s
|
|
35
35
|
};
|
|
36
|
-
//# sourceMappingURL=status.types.
|
|
36
|
+
//# sourceMappingURL=status.types.B0jtv0c7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.types.
|
|
1
|
+
{"version":3,"file":"status.types.B0jtv0c7.js","sources":["../../src/components/status/status.vue","../../src/components/status/status.types.ts"],"sourcesContent":["<template>\n <div class=\"b-status\" role=\"status\">\n <div class=\"b-status__indicator-wrapper\">\n <span class=\"b-status__indicator\" :class=\"conditionalClass\" role=\"presentation\"></span>\n </div>\n <bento-typography class=\"b-status__label\" el=\"span\" variant=\"body\">\n <slot></slot>\n </bento-typography>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed } from 'vue';\n import { BentoTypography } from '@/components/typography';\n import { BentoStatusVariant } from './status.types';\n\n const props = defineProps({\n variant: null\n});\n\n const conditionalClass = computed(() => ({\n [`b-status__indicator--${props.variant}`]: true,\n }));\n</script>\n\n<script lang=\"ts\">\n /**\n * A Status component is used to indicate a\n * passage of time or a particular step of a process.\n *\n * @example\n * import { BentoStatus } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoStatus },\n * template: `\n * <bento-status variant=\"red\">\n * 1 week ago\n * </bento-status>\n * `\n * }\n */\n export default {\n name: 'bento-status',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./status.scss\" />\n","/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoStatusVariant {\n BLUE = 'blue',\n GREEN = 'green',\n GREY = 'grey',\n ORANGE = 'orange',\n RED = 'red',\n YELLOW = 'yellow',\n}\n"],"names":["__default__","conditionalClass","computed","props","BentoStatusVariant","BentoStatusVariant2"],"mappings":";;;;AA0CI,MAAAA,IAAA;AAAA,EAAe,MAAA;AAEf;;;;;;iBAxBAC,IAAAC,EAAA,OAAA;AAAA,MAAyC,CAAA,wBAAAC,EAAA,OAAA,EAAA,GAAA;AAAA,IACM,EAAA;;;;;;;;;;;;;;;;AClBvC,IAAAC,IAAA,kBAAAC,OACRA,EAAA,OAAA,QACAA,EAAA,QAAA,SACAA,EAAA,OAAA,QACAA,EAAA,SAAA,UACAA,EAAA,MAAA,OACAA,EAAA,SAAA,UANQA,IAAAD,KAAA,CAAA,CAAA;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { defineComponent as V, ref as p, computed as o, watch as N, provide as L, readonly as W, useSlots as z, inject as U, onMounted as Z, onBeforeUnmount as j } from "vue";
|
|
2
|
-
import { B as D } from "./typography.
|
|
2
|
+
import { B as D } from "./typography.Bu_WAKdf.js";
|
|
3
3
|
import { u as G } from "./i18n.BQkEbtPM.js";
|
|
4
4
|
import { B as A, a as M } from "./keyboard-navigation.Clz1jOaA.js";
|
|
5
5
|
import { n as k } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
6
|
-
import { B as q } from "./base-button
|
|
6
|
+
import { B as q } from "./base-button.BeMKxkgK.js";
|
|
7
7
|
import { C as J } from "./checkmark-small.BtF8b2gE.js";
|
|
8
8
|
import { D as Q } from "./dot.BCX4w7eT.js";
|
|
9
9
|
import "../assets/step.css";
|
|
@@ -214,4 +214,4 @@ export {
|
|
|
214
214
|
O as b,
|
|
215
215
|
ye as s
|
|
216
216
|
};
|
|
217
|
-
//# sourceMappingURL=step.
|
|
217
|
+
//# sourceMappingURL=step.Dq4w23dP.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.BsIdWhaZ.js","sources":["../../src/components/stepper/composables/use-keyboard-navigation/use-keyboard-navigation.ts","../../src/components/stepper/composables/use-step-register/use-step-register.ts","../../src/components/stepper/stepper.keys.ts","../../src/components/stepper/stepper.types.ts","../../src/components/stepper/stepper.vue","../../src/components/stepper/components/step/step.vue"],"sourcesContent":["import { Ref, UnwrapRef } from 'vue';\n\nimport { BentoKeyboardNavigationKeyDownEvent } from '@/types';\n\n/**\n * Returns keyboard navigation's event handlers to navigate through the steps\n *\n * @param steps the list of bento-steps DOM elements to focus on the navigation\n * @returns\n */\nexport const useKeyboardNavigation = (steps: Ref<UnwrapRef<HTMLButtonElement[]>>) => {\n // Returns the event handler that moves the focus on a given step offset\n function focusOnStep(indexOffset: number) {\n return ({ detail: event }) => {\n event.preventDefault();\n\n const currentIndex = steps.value.indexOf(document.activeElement as HTMLButtonElement);\n if (currentIndex < 0) {\n return;\n }\n\n steps.value[currentIndex + indexOffset]?.focus();\n };\n }\n\n const focusOnPreviousStep = focusOnStep(-1);\n const focusOnNextStep = focusOnStep(1);\n\n return {\n [BentoKeyboardNavigationKeyDownEvent.ARROW_DOWN]: focusOnNextStep,\n [BentoKeyboardNavigationKeyDownEvent.ARROW_RIGHT]: focusOnNextStep,\n [BentoKeyboardNavigationKeyDownEvent.ARROW_UP]: focusOnPreviousStep,\n [BentoKeyboardNavigationKeyDownEvent.ARROW_LEFT]: focusOnPreviousStep,\n };\n};\n","import type { Ref, UnwrapRef } from 'vue';\nimport type { BentoStepperStepExposeState } from '../../stepper.types';\n\n/**\n * Gets the position of a `bento-step` element within its `bento-stepper` parent.\n * @param stepState The `bento-step` state.\n * @returns The index of the element.\n */\nconst getStepPosition = (stepState: BentoStepperStepExposeState) => {\n // Button is wrapped by <li> element\n const listItemElement = (stepState.buttonElement as Ref<UnwrapRef<HTMLButtonElement>>).value.parentElement;\n const listElement = listItemElement.parentElement;\n return Array.from(listElement.children).indexOf(listItemElement);\n};\n\n/**\n * Provides methods to register/unregister `bento-step` elements to/from the `bento-stepper` step state.\n * These methods allow for tracking the child step elements, including their position in the DOM tree.\n * @param childrenSteps The `bento-stepper` (or `bento-step` if substeps) step state.\n */\nexport const useStepRegister = (childrenSteps: Ref<BentoStepperStepExposeState[]>) => {\n /**\n * Registers a step's HTML element in the stepper state.\n * Should be called by a `bento-step` when it is mounted.\n * @param stepState The `bento-step` state.\n */\n const registerStep = (stepState: BentoStepperStepExposeState) => {\n const position = getStepPosition(stepState);\n childrenSteps.value.splice(position, 0, {\n stepContent: stepState.stepContent as string,\n buttonElement: stepState.buttonElement as HTMLButtonElement,\n substeps: stepState.substeps as BentoStepperStepExposeState[],\n });\n };\n\n /**\n * Unregisters a step's HTML element in the stepper state.\n * Should be called by a `bento-step` before it is unmounted.\n * @param stepState The `bento-step` state.\n */\n const removeStep = (stepState: BentoStepperStepExposeState) => {\n childrenSteps.value.splice(\n childrenSteps.value.findIndex(step => step.buttonElement === stepState.buttonElement.value),\n 1\n );\n };\n\n return { registerStep, removeStep };\n};\n","export const STEPPER_STATE = Symbol('stepper state');\n","import type { ComputedRef, Ref, UnwrapRef } from 'vue';\n\nexport enum BentoStepperTypeOption {\n LINEAR = 'linear',\n NON_LINEAR = 'non-linear',\n}\n\nexport enum BentoStepperVariantOption {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n}\n\nexport interface BentoStepperStepExposeState {\n buttonElement: HTMLButtonElement | Ref<UnwrapRef<HTMLButtonElement>>;\n substeps: BentoStepperStepExposeState[] | Ref<BentoStepperStepExposeState[]>;\n stepContent: string | ComputedRef<string>;\n}\n\nexport type BentoStepperState = Ref<{\n activeStepIndex: number;\n latestActiveStep: number;\n type: `${BentoStepperTypeOption}`;\n variant: `${BentoStepperVariantOption}`;\n steps: HTMLElement[];\n isParentStep?: boolean;\n navigateToStep: (index: number) => void;\n registerStep: (stepState: BentoStepperStepExposeState) => void;\n removeStep: (stepState: BentoStepperStepExposeState) => void;\n}>;\n","<template>\n <nav class=\"b-stepper\">\n <ol\n v-bento-keyboard-navigation-directive\n class=\"b-stepper__list\"\n :class=\"conditionalClasses\"\n v-on=\"keyboardNavigationListeners\"\n >\n <slot></slot>\n </ol>\n\n <bento-typography el=\"span\" variant=\"body\" stronger class=\"b-stepper__text-stepper\"\n >{{\n t('step', { currentIndex: activeStepIndex + 1, totalSteps: stepsAmount, content: currentStepContent })\n }}\n </bento-typography>\n </nav>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoTypography } from '@/components/typography';\n\n import { computed, type DeepReadonly, PropType, provide, readonly, ref, watch } from 'vue';\n import { BentoKeyboardNavigationDirective as vBentoKeyboardNavigationDirective } from '@/directives';\n\n import { useKeyboardNavigation, useStepRegister } from './composables';\n import { useI18n } from '@/utils/ts/i18n';\n\n import { STEPPER_STATE } from './stepper.keys';\n import {\n BentoStepperState,\n BentoStepperStepExposeState,\n BentoStepperTypeOption,\n BentoStepperVariantOption,\n } from './stepper.types';\n\n import messages from './messages.json';\n\n const props = defineProps({\n /**\n * Type of stepper; defines how the stepper should behave. Default: linear\n * @values linear, non-linear\n */\n type: {\n type: String as PropType<`${BentoStepperTypeOption}`>,\n default: 'linear',\n },\n /**\n * Stepper variant; defines how the stepper should be displayed. Default: vertical\n * @values vertical, horizontal\n */\n variant: {\n type: String as PropType<`${BentoStepperVariantOption}`>,\n default: 'vertical',\n },\n /**\n * Active step index\n */\n index: {\n type: Number,\n default: 0,\n },\n });\n\n const emit = defineEmits([\"update:index\"]);\n\n type MessageSchema = (typeof messages)['en-US'];\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const childrenSteps = ref<BentoStepperStepExposeState[]>([]);\n const activeStepIndex = ref(props.index);\n const latestActiveStep = ref(activeStepIndex.value);\n\n const navigateToStep = (index: number) => {\n // Stores latest active step index so users can navigate backwards and forwards on linear stepper\n if (index > latestActiveStep.value) {\n latestActiveStep.value = index;\n }\n activeStepIndex.value = index;\n };\n\n const currentStepContent = computed(() => childrenSteps.value[activeStepIndex.value]?.stepContent);\n const stepsAmount = computed(() => childrenSteps.value.length);\n const childrenStepsElements = computed(() => childrenSteps.value.map(({ buttonElement }) => buttonElement));\n const isHorizontalVariant = computed(() => props.variant === BentoStepperVariantOption.HORIZONTAL);\n\n // List of all visible steps nested on the stepper, including the substeps of the children steps\n // Flattening the steps on a single list makes the keyboard navigation easier to be handled\n const allVisibleStepsElements = computed(() =>\n childrenSteps.value\n .map(({ buttonElement, substeps }, index) => {\n const isStepActive = activeStepIndex.value === index;\n const isSubstepsVisible = !isHorizontalVariant.value && isStepActive;\n\n if (!isSubstepsVisible) {\n return [buttonElement];\n }\n\n return [buttonElement].concat(substeps.map(step => step.buttonElement));\n })\n .flat()\n );\n\n const { registerStep, removeStep } = useStepRegister(childrenSteps);\n\n const stepperState: BentoStepperState = ref({\n activeStepIndex,\n latestActiveStep,\n steps: childrenStepsElements,\n type: props.type,\n variant: props.variant,\n navigateToStep,\n registerStep,\n removeStep,\n });\n\n const conditionalClasses = computed(() => ({\n 'b-stepper__list--horizontal': isHorizontalVariant.value,\n }));\n\n watch(() => props.index, navigateToStep);\n watch(activeStepIndex, index => {\n emit('update:index', index);\n });\n\n const keyboardNavigationListeners = useKeyboardNavigation(allVisibleStepsElements);\n\n // Provides stepper state to BentoStep children components\n provide<DeepReadonly<BentoStepperState>>(STEPPER_STATE, readonly(stepperState));\n</script>\n\n<script lang=\"ts\">\n /**\n * Steppers break down complex processes into manageable steps to guide users through a sequential or multi-step process.\n *\n * @example\n * import { BentoStep, BentoStepper } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoStep, BentoStepper },\n * template: `\n * <bento-stepper :index=\"1\">\n * <bento-step>Step 1</bento-step>\n * <bento-step>Step 2</bento-step>\n * <bento-step>Step 3</bento-step>\n * </bento-stepper>\n * `\n * }\n */\n\n export default {\n i18n: { messages },\n name: 'stepper',\n };\n</script>\n\n<style scoped src=\"./stepper.scss\" />\n","<template>\n <li :class=\"conditionalClasses\" class=\"b-step\">\n <base-button\n ref=\"buttonComponent\"\n :aria-current=\"ariaCurrentValue\"\n :aria-disabled=\"ariaDisabledValue\"\n class=\"b-step__button\"\n type=\"button\"\n :tabindex=\"tabIndexValue\"\n :disabled=\"isDisabled\"\n @click=\"navigateToStep\"\n @focus=\"isFocused = true\"\n @blur=\"isFocused = false\"\n >\n <template #iconLeft>\n <bento-typography el=\"span\" variant=\"body\" stronger class=\"b-step__index\" aria-hidden=\"true\">\n <checkmark-small-icon v-if=\"isCompleted\" />\n <template v-else-if=\"!isSubstep\">{{ index + 1 }}</template>\n <dot-icon v-else />\n </bento-typography>\n </template>\n\n <bento-typography ref=\"stepContent\" el=\"span\" variant=\"body\" :stronger=\"isActive\" class=\"b-step__content\">\n <slot></slot>\n </bento-typography>\n </base-button>\n\n <ul v-show=\"isSubstepsVisible\" ref=\"substepList\" class=\"b-step__substep-list\">\n <slot name=\"substeps\"></slot>\n </ul>\n </li>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, inject, onBeforeUnmount, onMounted, provide, ref, useSlots, watch } from 'vue';\n import { BaseButton } from '@/components/internal/base-button';\n import { BentoTypography } from '@/components/typography';\n import CheckmarkSmallIcon from '@adyen/ui-assets-icons-16/vue/checkmark-small';\n import DotIcon from '@adyen/ui-assets-icons-16/vue/dot';\n\n import { useStepRegister } from '../../composables';\n import { STEPPER_STATE } from '../../stepper.keys';\n import {\n BentoStepperState,\n BentoStepperStepExposeState,\n BentoStepperTypeOption,\n BentoStepperVariantOption,\n } from '../../stepper.types';\n import { Booleanish } from '@/types';\n\n const slots = useSlots();\n\n const props = defineProps({\n /**\n * Completed status. Used on non-linear steppers to indicate if the step is completed.\n */\n completed: {\n type: Boolean,\n default: false,\n },\n /**\n * Active substep index\n */\n substepIndex: {\n type: Number,\n default: 0,\n },\n });\n\n const emit = defineEmits([\"update:substep-index\"]);\n\n // Element refs\n const buttonComponent = ref<InstanceType<typeof BaseButton> | null>(null);\n const stepContent = ref<InstanceType<typeof BentoTypography> | null>(null);\n const substeps = ref<BentoStepperStepExposeState[]>([]);\n\n // Injects parent BentoStepper state data\n const stepper = inject<BentoStepperState>(STEPPER_STATE);\n\n const buttonElement = computed(() => buttonComponent.value?.$el as HTMLButtonElement);\n const index = computed(() => stepper?.value.steps.indexOf(buttonElement.value));\n\n const stepContentValue = computed(() => stepContent.value?.$el.textContent);\n\n // Substep logic\n const substepsButtonElements = computed(() => substeps.value.map(({ buttonElement }) => buttonElement));\n\n const activeSubStepIndex = ref(props.substepIndex);\n const latestActiveSubStepIndex = ref(activeSubStepIndex.value);\n\n const navigateToSubstep = (value: number) => {\n if (value > latestActiveSubStepIndex.value) {\n latestActiveSubStepIndex.value = value;\n }\n\n activeSubStepIndex.value = value;\n };\n\n const { registerStep, removeStep } = useStepRegister(substeps);\n\n const stepState: BentoStepperState = ref({\n activeStepIndex: activeSubStepIndex,\n latestActiveStep: latestActiveSubStepIndex,\n type: stepper.value.type,\n variant: stepper.value.variant,\n steps: substepsButtonElements,\n isParentStep: true,\n navigateToStep: navigateToSubstep,\n registerStep,\n removeStep,\n });\n\n provide(STEPPER_STATE, stepState);\n\n watch(() => props.substepIndex, navigateToSubstep);\n watch(activeSubStepIndex, value => {\n emit('update:substep-index', value);\n });\n\n onMounted(() => {\n if (!stepper) {\n throw new Error(\n 'BentoStep components should only be used inside BentoStepper or other BentoStep components.'\n );\n }\n\n stepper.value.registerStep({\n buttonElement,\n stepContent: stepContentValue,\n substeps,\n });\n });\n\n onBeforeUnmount(() => {\n stepper.value.removeStep({\n buttonElement,\n stepContent: stepContentValue,\n substeps,\n });\n });\n\n // Step states\n const isSubstep = computed(() => stepper.value.isParentStep);\n const isFocused = ref(false);\n const isActive = computed(() => stepper?.value.activeStepIndex === index.value);\n const isSubstepsVisible = computed(\n () =>\n isActive.value &&\n stepper.value.variant !== BentoStepperVariantOption.HORIZONTAL &&\n !isSubstep.value &&\n slots.substeps\n );\n const isCompleted = computed(() => {\n if (stepper?.value.type === BentoStepperTypeOption.NON_LINEAR) {\n return props.completed;\n }\n\n return stepper?.value.latestActiveStep > index.value;\n });\n const isDisabled = computed(\n () => stepper?.value.type === BentoStepperTypeOption.LINEAR && index.value > stepper?.value.latestActiveStep\n );\n\n const navigateToStep = () => {\n if (isDisabled.value) {\n return;\n }\n\n stepper.value.navigateToStep(index.value);\n };\n\n // Styling and a11y\n const ariaCurrentValue = computed(() => (isActive.value ? 'step' : ('false' as Booleanish)));\n const ariaDisabledValue = computed(() => isDisabled.value.toString() as Booleanish);\n const tabIndexValue = computed(() => (isFocused.value || (index.value === 0 && !isSubstep.value) ? '0' : '-1'));\n\n const conditionalClasses = computed(() => ({\n 'b-step--active': isActive.value,\n 'b-step--completed': isCompleted.value,\n 'b-step--substep': isSubstep.value,\n }));\n</script>\n\n<script lang=\"ts\">\n /**\n * Steps are components placed inside BentoSteppers to break down complex processes\n *\n * @example\n * import { BentoStep } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoStep },\n * template: `\n * <bento-stepper>\n * <bento-step>Step 1</bento-step>\n * <bento-step>\n * Step 2\n * <template #substeps>\n * <bento-step>Substep 1</bento-step>\n * <bento-step>Substep 2</bento-step>\n * </template>\n * </bento-step>\n * </bento-stepper>\n * `\n * }\n */\n\n export default {\n name: 'step',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./step.scss\" />\n"],"names":["useKeyboardNavigation","steps","focusOnStep","indexOffset","event","currentIndex","_a","focusOnPreviousStep","focusOnNextStep","BentoKeyboardNavigationKeyDownEvent","getStepPosition","stepState","listItemElement","listElement","useStepRegister","childrenSteps","position","step","STEPPER_STATE","BentoStepperTypeOption","BentoStepperTypeOption2","BentoStepperVariantOption","BentoStepperVariantOption2","__default__$1","messages","t","useI18n","ref","activeStepIndex","props","latestActiveStep","navigateToStep","index","currentStepContent","computed","stepsAmount","childrenStepsElements","buttonElement","isHorizontalVariant","allVisibleStepsElements","substeps","isStepActive","registerStep","removeStep","stepperState","conditionalClasses","watch","emit","keyboardNavigationListeners","provide","readonly","__default__","slots","useSlots","buttonComponent","stepContent","stepper","inject","stepContentValue","substepsButtonElements","buttonElement2","activeSubStepIndex","latestActiveSubStepIndex","navigateToSubstep","value","onMounted","onBeforeUnmount","isSubstep","isFocused","isActive","isSubstepsVisible","isCompleted","isDisabled","ariaCurrentValue","ariaDisabledValue","tabIndexValue"],"mappings":";;;;;;;;;AAUa,MAAAA,IAAA,CAAAC,MAAA;AAET,WAAAC,EAAAC,GAAA;AACI,WAAA,CAAA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B,EAAA,MAAA,eAAAxB,EAAA,KAAA;AAAA,IAAwC,GAI5CyC,IAAAvC,EAAA,MAAAmC,EAAA,QAAA,SAAA,OAAA,GACAK,IAAAxC,EAAA,MAAAsC,EAAA,MAAA,SAAA,CAAA,GACAG,IAAAzC,EAAA,MAAAkC,EAAA,SAAApC,EAAA,UAAA,KAAA,CAAAmC,EAAA,QAAA,MAAA,IAAA,GAEAtB,IAAAX,EAAA,OAAA;AAAA,MAA2C,kBAAAmC,EAAA;AAAA,MACZ,qBAAAE,EAAA;AAAA,MACM,mBAAAJ,EAAA;AAAA,IACJ,EAAA;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"step.Dq4w23dP.js","sources":["../../src/components/stepper/composables/use-keyboard-navigation/use-keyboard-navigation.ts","../../src/components/stepper/composables/use-step-register/use-step-register.ts","../../src/components/stepper/stepper.keys.ts","../../src/components/stepper/stepper.types.ts","../../src/components/stepper/stepper.vue","../../src/components/stepper/components/step/step.vue"],"sourcesContent":["import { Ref, UnwrapRef } from 'vue';\n\nimport { BentoKeyboardNavigationKeyDownEvent } from '@/types';\n\n/**\n * Returns keyboard navigation's event handlers to navigate through the steps\n *\n * @param steps the list of bento-steps DOM elements to focus on the navigation\n * @returns\n */\nexport const useKeyboardNavigation = (steps: Ref<UnwrapRef<HTMLButtonElement[]>>) => {\n // Returns the event handler that moves the focus on a given step offset\n function focusOnStep(indexOffset: number) {\n return ({ detail: event }) => {\n event.preventDefault();\n\n const currentIndex = steps.value.indexOf(document.activeElement as HTMLButtonElement);\n if (currentIndex < 0) {\n return;\n }\n\n steps.value[currentIndex + indexOffset]?.focus();\n };\n }\n\n const focusOnPreviousStep = focusOnStep(-1);\n const focusOnNextStep = focusOnStep(1);\n\n return {\n [BentoKeyboardNavigationKeyDownEvent.ARROW_DOWN]: focusOnNextStep,\n [BentoKeyboardNavigationKeyDownEvent.ARROW_RIGHT]: focusOnNextStep,\n [BentoKeyboardNavigationKeyDownEvent.ARROW_UP]: focusOnPreviousStep,\n [BentoKeyboardNavigationKeyDownEvent.ARROW_LEFT]: focusOnPreviousStep,\n };\n};\n","import type { Ref, UnwrapRef } from 'vue';\nimport type { BentoStepperStepExposeState } from '../../stepper.types';\n\n/**\n * Gets the position of a `bento-step` element within its `bento-stepper` parent.\n * @param stepState The `bento-step` state.\n * @returns The index of the element.\n */\nconst getStepPosition = (stepState: BentoStepperStepExposeState) => {\n // Button is wrapped by <li> element\n const listItemElement = (stepState.buttonElement as Ref<UnwrapRef<HTMLButtonElement>>).value.parentElement;\n const listElement = listItemElement.parentElement;\n return Array.from(listElement.children).indexOf(listItemElement);\n};\n\n/**\n * Provides methods to register/unregister `bento-step` elements to/from the `bento-stepper` step state.\n * These methods allow for tracking the child step elements, including their position in the DOM tree.\n * @param childrenSteps The `bento-stepper` (or `bento-step` if substeps) step state.\n */\nexport const useStepRegister = (childrenSteps: Ref<BentoStepperStepExposeState[]>) => {\n /**\n * Registers a step's HTML element in the stepper state.\n * Should be called by a `bento-step` when it is mounted.\n * @param stepState The `bento-step` state.\n */\n const registerStep = (stepState: BentoStepperStepExposeState) => {\n const position = getStepPosition(stepState);\n childrenSteps.value.splice(position, 0, {\n stepContent: stepState.stepContent as string,\n buttonElement: stepState.buttonElement as HTMLButtonElement,\n substeps: stepState.substeps as BentoStepperStepExposeState[],\n });\n };\n\n /**\n * Unregisters a step's HTML element in the stepper state.\n * Should be called by a `bento-step` before it is unmounted.\n * @param stepState The `bento-step` state.\n */\n const removeStep = (stepState: BentoStepperStepExposeState) => {\n childrenSteps.value.splice(\n childrenSteps.value.findIndex(step => step.buttonElement === stepState.buttonElement.value),\n 1\n );\n };\n\n return { registerStep, removeStep };\n};\n","export const STEPPER_STATE = Symbol('stepper state');\n","import type { ComputedRef, Ref, UnwrapRef } from 'vue';\n\nexport enum BentoStepperTypeOption {\n LINEAR = 'linear',\n NON_LINEAR = 'non-linear',\n}\n\nexport enum BentoStepperVariantOption {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n}\n\nexport interface BentoStepperStepExposeState {\n buttonElement: HTMLButtonElement | Ref<UnwrapRef<HTMLButtonElement>>;\n substeps: BentoStepperStepExposeState[] | Ref<BentoStepperStepExposeState[]>;\n stepContent: string | ComputedRef<string>;\n}\n\nexport type BentoStepperState = Ref<{\n activeStepIndex: number;\n latestActiveStep: number;\n type: `${BentoStepperTypeOption}`;\n variant: `${BentoStepperVariantOption}`;\n steps: HTMLElement[];\n isParentStep?: boolean;\n navigateToStep: (index: number) => void;\n registerStep: (stepState: BentoStepperStepExposeState) => void;\n removeStep: (stepState: BentoStepperStepExposeState) => void;\n}>;\n","<template>\n <nav class=\"b-stepper\">\n <ol\n v-bento-keyboard-navigation-directive\n class=\"b-stepper__list\"\n :class=\"conditionalClasses\"\n v-on=\"keyboardNavigationListeners\"\n >\n <slot></slot>\n </ol>\n\n <bento-typography el=\"span\" variant=\"body\" stronger class=\"b-stepper__text-stepper\"\n >{{\n t('step', { currentIndex: activeStepIndex + 1, totalSteps: stepsAmount, content: currentStepContent })\n }}\n </bento-typography>\n </nav>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoTypography } from '@/components/typography';\n\n import { computed, type DeepReadonly, PropType, provide, readonly, ref, watch } from 'vue';\n import { BentoKeyboardNavigationDirective as vBentoKeyboardNavigationDirective } from '@/directives';\n\n import { useKeyboardNavigation, useStepRegister } from './composables';\n import { useI18n } from '@/utils/ts/i18n';\n\n import { STEPPER_STATE } from './stepper.keys';\n import {\n BentoStepperState,\n BentoStepperStepExposeState,\n BentoStepperTypeOption,\n BentoStepperVariantOption,\n } from './stepper.types';\n\n import messages from './messages.json';\n\n const props = defineProps({\n /**\n * Type of stepper; defines how the stepper should behave. Default: linear\n * @values linear, non-linear\n */\n type: {\n type: String as PropType<`${BentoStepperTypeOption}`>,\n default: 'linear',\n },\n /**\n * Stepper variant; defines how the stepper should be displayed. Default: vertical\n * @values vertical, horizontal\n */\n variant: {\n type: String as PropType<`${BentoStepperVariantOption}`>,\n default: 'vertical',\n },\n /**\n * Active step index\n */\n index: {\n type: Number,\n default: 0,\n },\n });\n\n const emit = defineEmits([\"update:index\"]);\n\n type MessageSchema = (typeof messages)['en-US'];\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const childrenSteps = ref<BentoStepperStepExposeState[]>([]);\n const activeStepIndex = ref(props.index);\n const latestActiveStep = ref(activeStepIndex.value);\n\n const navigateToStep = (index: number) => {\n // Stores latest active step index so users can navigate backwards and forwards on linear stepper\n if (index > latestActiveStep.value) {\n latestActiveStep.value = index;\n }\n activeStepIndex.value = index;\n };\n\n const currentStepContent = computed(() => childrenSteps.value[activeStepIndex.value]?.stepContent);\n const stepsAmount = computed(() => childrenSteps.value.length);\n const childrenStepsElements = computed(() => childrenSteps.value.map(({ buttonElement }) => buttonElement));\n const isHorizontalVariant = computed(() => props.variant === BentoStepperVariantOption.HORIZONTAL);\n\n // List of all visible steps nested on the stepper, including the substeps of the children steps\n // Flattening the steps on a single list makes the keyboard navigation easier to be handled\n const allVisibleStepsElements = computed(() =>\n childrenSteps.value\n .map(({ buttonElement, substeps }, index) => {\n const isStepActive = activeStepIndex.value === index;\n const isSubstepsVisible = !isHorizontalVariant.value && isStepActive;\n\n if (!isSubstepsVisible) {\n return [buttonElement];\n }\n\n return [buttonElement].concat(substeps.map(step => step.buttonElement));\n })\n .flat()\n );\n\n const { registerStep, removeStep } = useStepRegister(childrenSteps);\n\n const stepperState: BentoStepperState = ref({\n activeStepIndex,\n latestActiveStep,\n steps: childrenStepsElements,\n type: props.type,\n variant: props.variant,\n navigateToStep,\n registerStep,\n removeStep,\n });\n\n const conditionalClasses = computed(() => ({\n 'b-stepper__list--horizontal': isHorizontalVariant.value,\n }));\n\n watch(() => props.index, navigateToStep);\n watch(activeStepIndex, index => {\n emit('update:index', index);\n });\n\n const keyboardNavigationListeners = useKeyboardNavigation(allVisibleStepsElements);\n\n // Provides stepper state to BentoStep children components\n provide<DeepReadonly<BentoStepperState>>(STEPPER_STATE, readonly(stepperState));\n</script>\n\n<script lang=\"ts\">\n /**\n * Steppers break down complex processes into manageable steps to guide users through a sequential or multi-step process.\n *\n * @example\n * import { BentoStep, BentoStepper } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoStep, BentoStepper },\n * template: `\n * <bento-stepper :index=\"1\">\n * <bento-step>Step 1</bento-step>\n * <bento-step>Step 2</bento-step>\n * <bento-step>Step 3</bento-step>\n * </bento-stepper>\n * `\n * }\n */\n\n export default {\n i18n: { messages },\n name: 'stepper',\n };\n</script>\n\n<style scoped src=\"./stepper.scss\" />\n","<template>\n <li :class=\"conditionalClasses\" class=\"b-step\">\n <base-button\n ref=\"buttonComponent\"\n :aria-current=\"ariaCurrentValue\"\n :aria-disabled=\"ariaDisabledValue\"\n class=\"b-step__button\"\n type=\"button\"\n :tabindex=\"tabIndexValue\"\n :disabled=\"isDisabled\"\n @click=\"navigateToStep\"\n @focus=\"isFocused = true\"\n @blur=\"isFocused = false\"\n >\n <template #iconLeft>\n <bento-typography el=\"span\" variant=\"body\" stronger class=\"b-step__index\" aria-hidden=\"true\">\n <checkmark-small-icon v-if=\"isCompleted\" />\n <template v-else-if=\"!isSubstep\">{{ index + 1 }}</template>\n <dot-icon v-else />\n </bento-typography>\n </template>\n\n <bento-typography ref=\"stepContent\" el=\"span\" variant=\"body\" :stronger=\"isActive\" class=\"b-step__content\">\n <slot></slot>\n </bento-typography>\n </base-button>\n\n <ul v-show=\"isSubstepsVisible\" ref=\"substepList\" class=\"b-step__substep-list\">\n <slot name=\"substeps\"></slot>\n </ul>\n </li>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, inject, onBeforeUnmount, onMounted, provide, ref, useSlots, watch } from 'vue';\n import { BaseButton } from '@/components/internal/base-button';\n import { BentoTypography } from '@/components/typography';\n import CheckmarkSmallIcon from '@adyen/ui-assets-icons-16/vue/checkmark-small';\n import DotIcon from '@adyen/ui-assets-icons-16/vue/dot';\n\n import { useStepRegister } from '../../composables';\n import { STEPPER_STATE } from '../../stepper.keys';\n import {\n BentoStepperState,\n BentoStepperStepExposeState,\n BentoStepperTypeOption,\n BentoStepperVariantOption,\n } from '../../stepper.types';\n import { Booleanish } from '@/types';\n\n const slots = useSlots();\n\n const props = defineProps({\n /**\n * Completed status. Used on non-linear steppers to indicate if the step is completed.\n */\n completed: {\n type: Boolean,\n default: false,\n },\n /**\n * Active substep index\n */\n substepIndex: {\n type: Number,\n default: 0,\n },\n });\n\n const emit = defineEmits([\"update:substep-index\"]);\n\n // Element refs\n const buttonComponent = ref<InstanceType<typeof BaseButton> | null>(null);\n const stepContent = ref<InstanceType<typeof BentoTypography> | null>(null);\n const substeps = ref<BentoStepperStepExposeState[]>([]);\n\n // Injects parent BentoStepper state data\n const stepper = inject<BentoStepperState>(STEPPER_STATE);\n\n const buttonElement = computed(() => buttonComponent.value?.$el as HTMLButtonElement);\n const index = computed(() => stepper?.value.steps.indexOf(buttonElement.value));\n\n const stepContentValue = computed(() => stepContent.value?.$el.textContent);\n\n // Substep logic\n const substepsButtonElements = computed(() => substeps.value.map(({ buttonElement }) => buttonElement));\n\n const activeSubStepIndex = ref(props.substepIndex);\n const latestActiveSubStepIndex = ref(activeSubStepIndex.value);\n\n const navigateToSubstep = (value: number) => {\n if (value > latestActiveSubStepIndex.value) {\n latestActiveSubStepIndex.value = value;\n }\n\n activeSubStepIndex.value = value;\n };\n\n const { registerStep, removeStep } = useStepRegister(substeps);\n\n const stepState: BentoStepperState = ref({\n activeStepIndex: activeSubStepIndex,\n latestActiveStep: latestActiveSubStepIndex,\n type: stepper.value.type,\n variant: stepper.value.variant,\n steps: substepsButtonElements,\n isParentStep: true,\n navigateToStep: navigateToSubstep,\n registerStep,\n removeStep,\n });\n\n provide(STEPPER_STATE, stepState);\n\n watch(() => props.substepIndex, navigateToSubstep);\n watch(activeSubStepIndex, value => {\n emit('update:substep-index', value);\n });\n\n onMounted(() => {\n if (!stepper) {\n throw new Error(\n 'BentoStep components should only be used inside BentoStepper or other BentoStep components.'\n );\n }\n\n stepper.value.registerStep({\n buttonElement,\n stepContent: stepContentValue,\n substeps,\n });\n });\n\n onBeforeUnmount(() => {\n stepper.value.removeStep({\n buttonElement,\n stepContent: stepContentValue,\n substeps,\n });\n });\n\n // Step states\n const isSubstep = computed(() => stepper.value.isParentStep);\n const isFocused = ref(false);\n const isActive = computed(() => stepper?.value.activeStepIndex === index.value);\n const isSubstepsVisible = computed(\n () =>\n isActive.value &&\n stepper.value.variant !== BentoStepperVariantOption.HORIZONTAL &&\n !isSubstep.value &&\n slots.substeps\n );\n const isCompleted = computed(() => {\n if (stepper?.value.type === BentoStepperTypeOption.NON_LINEAR) {\n return props.completed;\n }\n\n return stepper?.value.latestActiveStep > index.value;\n });\n const isDisabled = computed(\n () => stepper?.value.type === BentoStepperTypeOption.LINEAR && index.value > stepper?.value.latestActiveStep\n );\n\n const navigateToStep = () => {\n if (isDisabled.value) {\n return;\n }\n\n stepper.value.navigateToStep(index.value);\n };\n\n // Styling and a11y\n const ariaCurrentValue = computed(() => (isActive.value ? 'step' : ('false' as Booleanish)));\n const ariaDisabledValue = computed(() => isDisabled.value.toString() as Booleanish);\n const tabIndexValue = computed(() => (isFocused.value || (index.value === 0 && !isSubstep.value) ? '0' : '-1'));\n\n const conditionalClasses = computed(() => ({\n 'b-step--active': isActive.value,\n 'b-step--completed': isCompleted.value,\n 'b-step--substep': isSubstep.value,\n }));\n</script>\n\n<script lang=\"ts\">\n /**\n * Steps are components placed inside BentoSteppers to break down complex processes\n *\n * @example\n * import { BentoStep } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoStep },\n * template: `\n * <bento-stepper>\n * <bento-step>Step 1</bento-step>\n * <bento-step>\n * Step 2\n * <template #substeps>\n * <bento-step>Substep 1</bento-step>\n * <bento-step>Substep 2</bento-step>\n * </template>\n * </bento-step>\n * </bento-stepper>\n * `\n * }\n */\n\n export default {\n name: 'step',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./step.scss\" />\n"],"names":["useKeyboardNavigation","steps","focusOnStep","indexOffset","event","currentIndex","_a","focusOnPreviousStep","focusOnNextStep","BentoKeyboardNavigationKeyDownEvent","getStepPosition","stepState","listItemElement","listElement","useStepRegister","childrenSteps","position","step","STEPPER_STATE","BentoStepperTypeOption","BentoStepperTypeOption2","BentoStepperVariantOption","BentoStepperVariantOption2","__default__$1","messages","t","useI18n","ref","activeStepIndex","props","latestActiveStep","navigateToStep","index","currentStepContent","computed","stepsAmount","childrenStepsElements","buttonElement","isHorizontalVariant","allVisibleStepsElements","substeps","isStepActive","registerStep","removeStep","stepperState","conditionalClasses","watch","emit","keyboardNavigationListeners","provide","readonly","__default__","slots","useSlots","buttonComponent","stepContent","stepper","inject","stepContentValue","substepsButtonElements","buttonElement2","activeSubStepIndex","latestActiveSubStepIndex","navigateToSubstep","value","onMounted","onBeforeUnmount","isSubstep","isFocused","isActive","isSubstepsVisible","isCompleted","isDisabled","ariaCurrentValue","ariaDisabledValue","tabIndexValue"],"mappings":";;;;;;;;;AAUa,MAAAA,IAAA,CAAAC,MAAA;AAET,WAAAC,EAAAC,GAAA;AACI,WAAA,CAAA,EAAA,QAAAC,EAAA,MAAA;;AACI,MAAAA,EAAA,eAAA;AAEA,YAAAC,IAAAJ,EAAA,MAAA,QAAA,SAAA,aAAA;AACA,MAAAI,IAAA,MAIAC,IAAAL,EAAA,MAAAI,IAAAF,CAAA,MAAA,QAAAG,EAAA;AAAA,IAA+C;AAAA,EACnD;AAGJ,QAAAC,IAAAL,EAAA,EAAA,GACAM,IAAAN,EAAA,CAAA;AAEA,SAAA;AAAA,IAAO,CAAAO,EAAA,UAAA,GAAAD;AAAA,IAC+C,CAAAC,EAAA,WAAA,GAAAD;AAAA,IACC,CAAAC,EAAA,QAAA,GAAAF;AAAA,IACH,CAAAE,EAAA,UAAA,GAAAF;AAAA,EACE;AAE1D,GC1BAG,IAAA,CAAAC,MAAA;AAEI,QAAAC,IAAAD,EAAA,cAAA,MAAA,eACAE,IAAAD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AAAA,QAAyB,eAAAnB;AAAA,QACrB,aAAAqB;AAAA,QACa,UAAAlB;AAAA,MACb,CAAA;AAAA,IACH,CAAA;AAIL,UAAA2B,IAAAjC,EAAA,MAAAsB,EAAA,MAAA,YAAA,GACAY,IAAAzC,EAAA,EAAA,GACA0C,IAAAnC,EAAA,OAAAsB,KAAA,gBAAAA,EAAA,MAAA,qBAAAxB,EAAA,KAAA,GACAsC,IAAApC;AAAA,MAA0B,MAAAmC,EAAA,SAAAb,EAAA,MAAA,YAAAnC,EAAA,cAAA,CAAA8C,EAAA,SAAAf,EAAA;AAAA,IAKZ,GAEdmB,IAAArC,EAAA,OACIsB,KAAA,gBAAAA,EAAA,MAAA,UAAArC,EAAA,aACIU,EAAA,aAGJ2B,KAAA,gBAAAA,EAAA,MAAA,oBAAAxB,EAAA,KAA+C,GAEnDwC,IAAAtC;AAAA,MAAmB,OAAAsB,KAAA,gBAAAA,EAAA,MAAA,UAAArC,EAAA,UAAAa,EAAA,SAAAwB,KAAA,gBAAAA,EAAA,MAAA;AAAA,IAC6E,GAGhGzB,IAAA,MAAA;AACI,MAAAyC,EAAA,SAIAhB,EAAA,MAAA,eAAAxB,EAAA,KAAA;AAAA,IAAwC,GAI5CyC,IAAAvC,EAAA,MAAAmC,EAAA,QAAA,SAAA,OAAA,GACAK,IAAAxC,EAAA,MAAAsC,EAAA,MAAA,SAAA,CAAA,GACAG,IAAAzC,EAAA,MAAAkC,EAAA,SAAApC,EAAA,UAAA,KAAA,CAAAmC,EAAA,QAAA,MAAA,IAAA,GAEAtB,IAAAX,EAAA,OAAA;AAAA,MAA2C,kBAAAmC,EAAA;AAAA,MACZ,qBAAAE,EAAA;AAAA,MACM,mBAAAJ,EAAA;AAAA,IACJ,EAAA;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { defineComponent as c, inject as n, computed as r, provide as y, ref as b } from "vue";
|
|
2
2
|
import { n as i } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
3
|
-
import { B as v } from "./button.
|
|
4
|
-
import { B as h } from "./info-icon.
|
|
5
|
-
import { B as C } from "./typography.
|
|
6
|
-
import { C as B } from "./copy.
|
|
3
|
+
import { B as v } from "./button.Bx8WC-dy.js";
|
|
4
|
+
import { B as h } from "./info-icon.BnSZeQm8.js";
|
|
5
|
+
import { B as C } from "./typography.Bu_WAKdf.js";
|
|
6
|
+
import { C as B } from "./copy.BakPR7GI.js";
|
|
7
7
|
import { S as T } from "./search.CBKhp7zB.js";
|
|
8
8
|
import { u as S } from "./i18n.BQkEbtPM.js";
|
|
9
|
-
import { B as I } from "./tooltip.
|
|
9
|
+
import { B as I } from "./tooltip.CQGwmwt9.js";
|
|
10
10
|
import "../assets/structured-list-item.css";
|
|
11
11
|
const u = Symbol("structured list condensed style injection key"), _ = Symbol("structured list labels width injection key"), L = ["25-75", "33-66", "42-58", "50-50"], x = {}, E = /* @__PURE__ */ c({
|
|
12
12
|
...x,
|
|
@@ -84,4 +84,4 @@ export {
|
|
|
84
84
|
u as S,
|
|
85
85
|
z as a
|
|
86
86
|
};
|
|
87
|
-
//# sourceMappingURL=structured-list-item.
|
|
87
|
+
//# sourceMappingURL=structured-list-item.-ch3UkPz.js.map
|
package/dist/chunks/{structured-list-item.BhBbmkbw.js.map → structured-list-item.-ch3UkPz.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structured-list-item.
|
|
1
|
+
{"version":3,"file":"structured-list-item.-ch3UkPz.js","sources":["../../src/components/structured-list/structured-list.keys.ts","../../src/components/structured-list/structured-list.types.ts","../../src/components/structured-list/structured-list.vue","../../src/components/structured-list/components/structered-list-item/structured-list-item.vue"],"sourcesContent":["export const STRUCTURED_LIST_CONDENSED_INJECTION_KEY = Symbol('structured list condensed style injection key');\nexport const STRUCTURED_LIST_LABELS_WIDTH_INJECTION_KEY = Symbol('structured list labels width injection key');\n","export type BentoStructuredListLayoutOptions = '25-75' | '33-66' | '42-58' | '50-50';\nexport const BentoStructuredListLayoutOptions = ['25-75', '33-66', '42-58', '50-50'];\n","<template>\n <dl class=\"b-structured-list\">\n <slot />\n </dl>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, inject, provide } from 'vue';\n import {\n STRUCTURED_LIST_CONDENSED_INJECTION_KEY,\n STRUCTURED_LIST_LABELS_WIDTH_INJECTION_KEY,\n } from '@/components/structured-list/structured-list.keys';\n import { BentoStructuredListLayoutOptions } from './structured-list.types';\n\n const props = defineProps({\n labelsWidth: { default: null },\n layout: { default: '33-66' }\n});\n\n const isCondensed = inject(STRUCTURED_LIST_CONDENSED_INJECTION_KEY, false);\n\n const computedLayout = computed(() =>\n BentoStructuredListLayoutOptions.includes(props.layout) ? props.layout : '33-66'\n );\n\n const computedLabelsWidth = computed(() => {\n if (isCondensed) {\n return '130px';\n }\n\n if (props.labelsWidth) {\n return `${props.labelsWidth}px`;\n }\n\n return `${computedLayout.value.split('-')[0]}%`;\n });\n\n provide(STRUCTURED_LIST_LABELS_WIDTH_INJECTION_KEY, computedLabelsWidth);\n</script>\n\n<script lang=\"ts\">\n /**\n * This is a list used to display pairs of information in a clear and organized manner.\n * `BentoStructureListItem` should be used to pass the label/value pairs to the list.\n *\n * @example\n * import { BentoStructuredListItem, BentoStructuredListItem } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoStructuredList, BentoStructuredListItem },\n * template: `\n * <bento-structured-list>\n * <bento-structured-list-item label=\"Payment\">\n * <bento-payment-method label=\"Klarna\" type=\"Klarna\" />\n * </bento-structured-list-item>\n * <bento-structured-list-item label=\"Amount\">\n * <bento-currency :currency=\"BentoCurrencyISOCode.USD\" :value=\"123456\" />\n * </bento-structured-list-item>\n * </bento-structured-list>\n * `\n * }\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./structured-list.scss\" />\n","<template>\n <div class=\"b-structured-list-item\" :class=\"conditionalClasses\">\n <dt class=\"b-structured-list-item__label\" :style=\"computedLabelStyle\">\n <bento-typography :variant=\"labelTypographyVariant\">{{ label }}</bento-typography>\n <bento-info-icon v-if=\"labelInfo\" class=\"b-structured-list-item__icon\" :tooltip-text=\"labelInfo\" />\n </dt>\n <dd class=\"b-structured-list-item__value\" :class=\"valueConditionalClasses\">\n <slot />\n <copy v-if=\"copy\" class=\"b-structured-list-item__icon\" :text=\"copy\" />\n <bento-button\n v-if=\"search\"\n v-bento-tooltip-directive:top=\"searchTooltip ? searchTooltip : t('search')\"\n class=\"b-structured-list-item__icon\"\n variant=\"tertiary\"\n @click=\"search\"\n >\n <template #iconLeft>\n <search-icon :svg-title=\"t('search')\" />\n </template>\n </bento-button>\n </dd>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, inject, ref, Ref } from 'vue';\n\n // Components\n import { BentoButton } from '@/components/button';\n import { BentoInfoIcon } from '@/components/info-icon';\n import { BentoTypography } from '@/components/typography';\n import Copy from '@/components/internal/copy/copy.vue';\n import SearchIcon from '@adyen/ui-assets-icons-16/vue/search';\n\n // Utils\n import { useI18n } from '@/utils/ts/i18n';\n\n // Directives\n import { BentoTooltipDirective as vBentoTooltipDirective } from '@/directives';\n\n // Keys\n import {\n STRUCTURED_LIST_CONDENSED_INJECTION_KEY,\n STRUCTURED_LIST_LABELS_WIDTH_INJECTION_KEY,\n } from '../../structured-list.keys';\n\n import messages from '../../messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const DEFAULT_LABELS_WIDTH = '33%';\n\n const props = defineProps({\n label: null,\n labelInfo: null,\n copy: null,\n search: { type: Function },\n searchTooltip: null,\n truncate: { type: Boolean }\n});\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const isCondensed = inject(STRUCTURED_LIST_CONDENSED_INJECTION_KEY, false);\n const labelsWidth = inject<Ref<string>>(STRUCTURED_LIST_LABELS_WIDTH_INJECTION_KEY, ref(DEFAULT_LABELS_WIDTH));\n const computedLabelStyle = computed(() => `flex-basis:${labelsWidth.value}`);\n const conditionalClasses = computed(() => ({\n 'b-structured-list-item--condensed': isCondensed,\n }));\n\n const valueConditionalClasses = computed(() => ({\n 'b-structured-list-item__value--truncate': props.truncate,\n }));\n\n const labelTypographyVariant = computed(() => (isCondensed ? 'caption' : 'body'));\n</script>\n\n<script lang=\"ts\">\n /**\n * This is an item of the `BentoStructuredList` meant to be used only with that component.\n * It consists of a label/value pair, and also the optional copy and search modifiers.\n *\n * @example\n * import { BentoCurrencyISOCode, BentoStructuredListItem, BentoStructuredListItem } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoStructuredListItem, BentoStructuredListItem },\n * template: `\n * <bento-structured-list>\n * <bento-structured-list-item label=\"Shopper\" search='searchShopper' search-tooltip='Find shopper'>\n * <bento-typography>\n * 143442642\n * </bento-status>\n * </bento-structured-list-item>\n * <bento-structured-list-item label=\"Amount\" copy='123456'>\n * <bento-currency :currency=\"BentoCurrencyISOCode.USD\" :value=\"123456\" />\n * </bento-structured-list-item>\n * </bento-structured-list>\n * `\n * }\n */\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./structured-list-item.scss\" />\n"],"names":["STRUCTURED_LIST_CONDENSED_INJECTION_KEY","STRUCTURED_LIST_LABELS_WIDTH_INJECTION_KEY","BentoStructuredListLayoutOptions","__default__$1","isCondensed","inject","computedLayout","computed","props","computedLabelsWidth","provide","__default__","messages","DEFAULT_LABELS_WIDTH","t","useI18n","labelsWidth","ref","computedLabelStyle","conditionalClasses","valueConditionalClasses","labelTypographyVariant"],"mappings":";;;;;;;;;;AAAa,MAAAA,IAAA,OAAA,+CAAA,GACAC,IAAA,OAAA,4CAAA,GCANC,IAAA,CAAA,SAAA,SAAA,SAAA,OAAA,GC6DHC,IAAA,CAAA;;;;;;;;iBA3CAC,IAAAC,EAAAL,GAAA,EAAA,GAEAM,IAAAC;AAAA,MAAuB,MAAAL,EAAA,SAAAM,EAAA,MAAA,IAAAA,EAAA,SAAA;AAAA,IACsD,GAG7EC,IAAAF,EAAA,MACIH,IACI,UAGJI,EAAA,cACI,GAAAA,EAAA,WAAA,OAGJ,GAAAF,EAAA,MAAA,MAAA,GAAA,EAAA,CAAA,CAAA,GAA4C;AAGhD,WAAAI,EAAAT,GAAAQ,CAAA;;;;;;;;;;;;;;;;;;;;;;;;GC+DAE,IAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAEf;;;;;;;;;;;;iBApDAC,IAAA,OAWA,EAAA,GAAAC,EAAA,IAAAC,EAAA,GACAX,IAAAC,EAAAL,GAAA,EAAA,GACAgB,IAAAX,EAAAJ,GAAAgB,EAAAJ,CAAA,CAAA,GACAK,IAAAX,EAAA,MAAA,cAAAS,EAAA,KAAA,EAAA,GACAG,IAAAZ,EAAA,OAAA;AAAA,MAA2C,qCAAAH;AAAA,IACF,EAAA,GAGzCgB,IAAAb,EAAA,OAAA;AAAA,MAAgD,2CAAAC,EAAA;AAAA,IACK,EAAA,GAGrDa,IAAAd,EAAA,MAAAH,IAAA,YAAA,MAAA;;;;;;;;;;;;;;;;;;"}
|
package/dist/chunks/{summary-grid-item-custom.CicAOBVQ.js → summary-grid-item-custom.CLVYmhnp.js}
RENAMED
|
@@ -3,10 +3,10 @@ import { u as v } from "./use-has-slot.C9lQZ6nz.js";
|
|
|
3
3
|
import { S as h } from "./summary-grid.keys.BBbFrFGF.js";
|
|
4
4
|
import { G as E } from "./grid-layout.HvTAa4to.js";
|
|
5
5
|
import { n as c } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
6
|
-
import { B as O } from "./info-icon.
|
|
7
|
-
import { B as L, a as g } from "./typography.
|
|
8
|
-
import { B as M, a as _ } from "./tag
|
|
9
|
-
import { C as P } from "./copy.
|
|
6
|
+
import { B as O } from "./info-icon.BnSZeQm8.js";
|
|
7
|
+
import { B as L, a as g } from "./typography.Bu_WAKdf.js";
|
|
8
|
+
import { B as M, a as _ } from "./tag.d36UYSWd.js";
|
|
9
|
+
import { C as P } from "./copy.BakPR7GI.js";
|
|
10
10
|
import "../assets/summary-grid-item-custom.css";
|
|
11
11
|
const R = l({
|
|
12
12
|
name: "bento-summary-grid",
|
|
@@ -570,4 +570,4 @@ export {
|
|
|
570
570
|
o as f,
|
|
571
571
|
ft as s
|
|
572
572
|
};
|
|
573
|
-
//# sourceMappingURL=summary-grid-item-custom.
|
|
573
|
+
//# sourceMappingURL=summary-grid-item-custom.CLVYmhnp.js.map
|