@adyen/bento-vue2 2.0.0 → 2.0.1-rc.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/action-bar.js +1 -1
- package/dist/ai-tag.js +1 -1
- package/dist/alert.js +1 -1
- package/dist/assets/accordion-item.css +1 -1
- package/dist/assets/action-bar.css +1 -1
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/button-actions.css +1 -1
- package/dist/assets/card.css +1 -1
- package/dist/assets/data-grid.css +1 -1
- package/dist/assets/date-filter.css +1 -0
- package/dist/assets/date-range-filter.css +1 -0
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/file-uploader.css +1 -1
- package/dist/assets/filter-bar.css +1 -1
- package/dist/assets/input-with-dropdown-filter.css +1 -0
- package/dist/assets/inspector.css +1 -1
- package/dist/assets/modal-fullscreen.css +1 -1
- package/dist/assets/navigation-menu-group.css +1 -1
- package/dist/assets/secondary-nav.css +1 -1
- package/dist/assets/sidepanel.css +1 -1
- package/dist/button.js +1 -1
- package/dist/card.js +1 -1
- package/dist/checkbox.js +2 -2
- package/dist/chunks/{action-bar.BsXW7BI2.js → action-bar.KJSfr89B.js} +3 -3
- package/dist/chunks/{action-bar.BsXW7BI2.js.map → action-bar.KJSfr89B.js.map} +1 -1
- package/dist/chunks/{ai-tag.D2Q0xhFK.js → ai-tag.TLrUno9t.js} +2 -2
- package/dist/chunks/{ai-tag.D2Q0xhFK.js.map → ai-tag.TLrUno9t.js.map} +1 -1
- package/dist/chunks/{alert.DJDHwVeR.js → alert.DT6T5Uxb.js} +52 -70
- package/dist/chunks/alert.DT6T5Uxb.js.map +1 -0
- package/dist/chunks/{base-modal.CcmoTJdc.js → base-modal.CGHkdr9t.js} +4 -4
- package/dist/chunks/{base-modal.CcmoTJdc.js.map → base-modal.CGHkdr9t.js.map} +1 -1
- package/dist/chunks/{button-actions-with-menu.BY394ars.js → button-actions-with-menu.CjTaZoYW.js} +2 -2
- package/dist/chunks/{button-actions-with-menu.BY394ars.js.map → button-actions-with-menu.CjTaZoYW.js.map} +1 -1
- package/dist/chunks/{button-actions.bkcLUE1G.js → button-actions.sLmpjWGK.js} +2 -2
- package/dist/chunks/{button-actions.bkcLUE1G.js.map → button-actions.sLmpjWGK.js.map} +1 -1
- package/dist/chunks/{calendar.CXdLEeN4.js → calendar.BNRImpE_.js} +18 -18
- package/dist/chunks/{calendar.CXdLEeN4.js.map → calendar.BNRImpE_.js.map} +1 -1
- package/dist/chunks/{card.b9PEJ7hm.js → card.DmnYYMmv.js} +3 -3
- package/dist/chunks/{card.b9PEJ7hm.js.map → card.DmnYYMmv.js.map} +1 -1
- package/dist/chunks/{checkbox-group.UYN1ljai.js → checkbox-group.D1SE-hz6.js} +3 -3
- package/dist/chunks/{checkbox-group.UYN1ljai.js.map → checkbox-group.D1SE-hz6.js.map} +1 -1
- package/dist/chunks/{checkbox.Co4HoHKF.js → checkbox.CyGdeEdp.js} +14 -14
- package/dist/chunks/{checkbox.Co4HoHKF.js.map → checkbox.CyGdeEdp.js.map} +1 -1
- package/dist/chunks/{code-snippet.CnThWqVb.js → code-snippet.BwswvtkY.js} +4 -4
- package/dist/chunks/{code-snippet.CnThWqVb.js.map → code-snippet.BwswvtkY.js.map} +1 -1
- package/dist/chunks/{controls-group.fdGc6epa.js → controls-group.DUNvd6DZ.js} +2 -2
- package/dist/chunks/{controls-group.fdGc6epa.js.map → controls-group.DUNvd6DZ.js.map} +1 -1
- package/dist/chunks/{copy.CSk1rCRo.js → copy.DSnfQU_F.js} +3 -3
- package/dist/chunks/{copy.CSk1rCRo.js.map → copy.DSnfQU_F.js.map} +1 -1
- package/dist/chunks/{dashboard-section.CYEoNH9Q.js → dashboard-section.CowwqnVA.js} +3 -3
- package/dist/chunks/{dashboard-section.CYEoNH9Q.js.map → dashboard-section.CowwqnVA.js.map} +1 -1
- package/dist/chunks/{dashed-underline.CzKc-fJW.js → dashed-underline.dNu0qaf7.js} +3 -3
- package/dist/chunks/{dashed-underline.CzKc-fJW.js.map → dashed-underline.dNu0qaf7.js.map} +1 -1
- package/dist/chunks/{data-grid-template.DCwzh2G7.js → data-grid-template.D5699UWb.js} +4 -4
- package/dist/chunks/{data-grid-template.DCwzh2G7.js.map → data-grid-template.D5699UWb.js.map} +1 -1
- package/dist/chunks/{data-grid.B1lI07ze.js → data-grid.CN25cWaQ.js} +18 -18
- package/dist/chunks/{data-grid.B1lI07ze.js.map → data-grid.CN25cWaQ.js.map} +1 -1
- package/dist/chunks/date-filter.BZVe74cH.js +117 -0
- package/dist/chunks/date-filter.BZVe74cH.js.map +1 -0
- package/dist/chunks/{date-picker.gDsw8bn1.js → date-picker.DhIMx1wH.js} +7 -7
- package/dist/chunks/{date-picker.gDsw8bn1.js.map → date-picker.DhIMx1wH.js.map} +1 -1
- package/dist/chunks/date-range-filter.CDrrP22U.js +868 -0
- package/dist/chunks/date-range-filter.CDrrP22U.js.map +1 -0
- package/dist/chunks/{date-range-picker.CqixIJxG.js → date-range-picker.Cz6ijJAa.js} +39 -39
- package/dist/chunks/{date-range-picker.CqixIJxG.js.map → date-range-picker.Cz6ijJAa.js.map} +1 -1
- package/dist/chunks/{date-time-picker.Bktntun4.js → date-time-picker.CHELyYSN.js} +5 -5
- package/dist/chunks/{date-time-picker.Bktntun4.js.map → date-time-picker.CHELyYSN.js.map} +1 -1
- package/dist/chunks/{draggable-handle.DgVdGC1V.js → draggable-handle.C75v14oN.js} +2 -2
- package/dist/chunks/{draggable-handle.DgVdGC1V.js.map → draggable-handle.C75v14oN.js.map} +1 -1
- package/dist/chunks/{draggable.DYKdXdbj.js → draggable.COHEAPF5.js} +2 -2
- package/dist/chunks/{draggable.DYKdXdbj.js.map → draggable.COHEAPF5.js.map} +1 -1
- package/dist/chunks/{dropdown-tag.Dk7SooVv.js → dropdown-tag.DKGloEzh.js} +3 -3
- package/dist/chunks/{dropdown-tag.Dk7SooVv.js.map → dropdown-tag.DKGloEzh.js.map} +1 -1
- package/dist/chunks/{dropdown.Bnq4kP7k.js → dropdown.QLkWJ9zk.js} +5 -5
- package/dist/chunks/{dropdown.Bnq4kP7k.js.map → dropdown.QLkWJ9zk.js.map} +1 -1
- package/dist/chunks/{empty-state.C2wjdE3y.js → empty-state.CRdHhJLl.js} +2 -2
- package/dist/chunks/{empty-state.C2wjdE3y.js.map → empty-state.CRdHhJLl.js.map} +1 -1
- package/dist/chunks/{field-label.C7BCsofY.js → field-label.CEp7WMYe.js} +2 -2
- package/dist/chunks/{field-label.C7BCsofY.js.map → field-label.CEp7WMYe.js.map} +1 -1
- package/dist/chunks/{file-uploader.DllKBmP8.js → file-uploader.2MeaNIlv.js} +7 -6
- package/dist/chunks/{file-uploader.DllKBmP8.js.map → file-uploader.2MeaNIlv.js.map} +1 -1
- package/dist/chunks/filter-bar.DUw139BE.js +1867 -0
- package/dist/chunks/filter-bar.DUw139BE.js.map +1 -0
- package/dist/chunks/{focus-trap.fd6_d2EW.js → focus-trap.BDpcWIxI.js} +1 -2
- package/dist/chunks/{focus-trap.fd6_d2EW.js.map → focus-trap.BDpcWIxI.js.map} +1 -1
- package/dist/chunks/{footer-actions.C9STwwcv.js → footer-actions.B5YZ95jM.js} +2 -2
- package/dist/chunks/{footer-actions.C9STwwcv.js.map → footer-actions.B5YZ95jM.js.map} +1 -1
- package/dist/chunks/{form-layout-title.C0lwzPZz.js → form-layout-title.BStxZj9d.js} +2 -2
- package/dist/chunks/{form-layout-title.C0lwzPZz.js.map → form-layout-title.BStxZj9d.js.map} +1 -1
- package/dist/chunks/{header-with-views.HwbE278X.js → header-with-views.DQh7mz0T.js} +10 -10
- package/dist/chunks/{header-with-views.HwbE278X.js.map → header-with-views.DQh7mz0T.js.map} +1 -1
- package/dist/chunks/{header.CmyqVXuG.js → header.DeRBttdY.js} +4 -4
- package/dist/chunks/{header.CmyqVXuG.js.map → header.DeRBttdY.js.map} +1 -1
- package/dist/chunks/{info-icon-with-popover.BvYyGm4D.js → info-icon-with-popover.8pL3B3m3.js} +3 -3
- package/dist/chunks/{info-icon-with-popover.BvYyGm4D.js.map → info-icon-with-popover.8pL3B3m3.js.map} +1 -1
- package/dist/chunks/{info-icon.B-FAeceD.js → info-icon.CmWiZXvc.js} +3 -3
- package/dist/chunks/{info-icon.B-FAeceD.js.map → info-icon.CmWiZXvc.js.map} +1 -1
- package/dist/chunks/{input-field-password.9bWhLud0.js → input-field-password.BiPMXS1j.js} +4 -4
- package/dist/chunks/{input-field-password.9bWhLud0.js.map → input-field-password.BiPMXS1j.js.map} +1 -1
- package/dist/chunks/{input-field-phone-number.CCn1N9St.js → input-field-phone-number.GK1UAt7-.js} +2 -2
- package/dist/chunks/{input-field-phone-number.CCn1N9St.js.map → input-field-phone-number.GK1UAt7-.js.map} +1 -1
- package/dist/chunks/{input-field.D912rZS_.js → input-field.BT5tx_DM.js} +3 -3
- package/dist/chunks/{input-field.D912rZS_.js.map → input-field.BT5tx_DM.js.map} +1 -1
- package/dist/chunks/{input-time.CXMuvF9N.js → input-time.DGaMMWxj.js} +3 -3
- package/dist/chunks/{input-time.CXMuvF9N.js.map → input-time.DGaMMWxj.js.map} +1 -1
- package/dist/chunks/input-with-dropdown-filter.axFutymM.js +80 -0
- package/dist/chunks/input-with-dropdown-filter.axFutymM.js.map +1 -0
- package/dist/chunks/{inspector-page.BRC_7uro.js → inspector-page.C5VCiyLD.js} +2 -2
- package/dist/chunks/{inspector-page.BRC_7uro.js.map → inspector-page.C5VCiyLD.js.map} +1 -1
- package/dist/chunks/{inspector.IOtNex1r.js → inspector.BoZBD8_z.js} +2 -2
- package/dist/chunks/{inspector.IOtNex1r.js.map → inspector.BoZBD8_z.js.map} +1 -1
- package/dist/chunks/{list-item.HjabBEb8.js → list-item.Bh5Z1f0K.js} +3 -3
- package/dist/chunks/{list-item.HjabBEb8.js.map → list-item.Bh5Z1f0K.js.map} +1 -1
- package/dist/chunks/{listbox-option-tag.DhNxvqRO.js → listbox-option-tag.BY6i9YgP.js} +2 -2
- package/dist/chunks/{listbox-option-tag.DhNxvqRO.js.map → listbox-option-tag.BY6i9YgP.js.map} +1 -1
- package/dist/chunks/{modal-fullscreen.Bi1bQs4Z.js → modal-fullscreen.Bteroyik.js} +3 -3
- package/dist/chunks/{modal-fullscreen.Bi1bQs4Z.js.map → modal-fullscreen.Bteroyik.js.map} +1 -1
- package/dist/chunks/{modal.B3-pmL5s.js → modal.C6OJMJ_D.js} +4 -4
- package/dist/chunks/{modal.B3-pmL5s.js.map → modal.C6OJMJ_D.js.map} +1 -1
- package/dist/chunks/{navigation-menu-group.B-AV49Bn.js → navigation-menu-group.uqIv5yZG.js} +2 -2
- package/dist/chunks/{navigation-menu-group.B-AV49Bn.js.map → navigation-menu-group.uqIv5yZG.js.map} +1 -1
- package/dist/chunks/{pagination.cI_pc6oE.js → pagination.CGiu-kog.js} +2 -2
- package/dist/chunks/{pagination.cI_pc6oE.js.map → pagination.CGiu-kog.js.map} +1 -1
- package/dist/chunks/popover.types.CoDfZgDc.js +6 -0
- package/dist/chunks/{popover.types.DvIwSAAp.js.map → popover.types.CoDfZgDc.js.map} +1 -1
- package/dist/chunks/{popper-container.Cj3AWXSd.js → popper-container.Co4j6qME.js} +2 -2
- package/dist/chunks/{popper-container.Cj3AWXSd.js.map → popper-container.Co4j6qME.js.map} +1 -1
- package/dist/chunks/{progress-bar.RlF3a0Gb.js → progress-bar.CJ6j8lIr.js} +2 -2
- package/dist/chunks/{progress-bar.RlF3a0Gb.js.map → progress-bar.CJ6j8lIr.js.map} +1 -1
- package/dist/chunks/{radio-group.CvsQDlHi.js → radio-group.CQfxWRbM.js} +3 -3
- package/dist/chunks/{radio-group.CvsQDlHi.js.map → radio-group.CQfxWRbM.js.map} +1 -1
- package/dist/chunks/{rich-text-editor.DNmVJilP.js → rich-text-editor.CDrX-0g1.js} +5 -5
- package/dist/chunks/{rich-text-editor.DNmVJilP.js.map → rich-text-editor.CDrX-0g1.js.map} +1 -1
- package/dist/chunks/{search-bar.--4KVNkf.js → search-bar.CFscAHEn.js} +3 -3
- package/dist/chunks/{search-bar.--4KVNkf.js.map → search-bar.CFscAHEn.js.map} +1 -1
- package/dist/chunks/{secondary-nav.CXtDQAay.js → secondary-nav.Ba7pNe_-.js} +3 -3
- package/dist/chunks/{secondary-nav.CXtDQAay.js.map → secondary-nav.Ba7pNe_-.js.map} +1 -1
- package/dist/chunks/{segmented-control.nYpRQTGc.js → segmented-control.Dp7Xd5Oa.js} +2 -2
- package/dist/chunks/{segmented-control.nYpRQTGc.js.map → segmented-control.Dp7Xd5Oa.js.map} +1 -1
- package/dist/chunks/select-avatar-filter.EG4IpfbR.js +51 -0
- package/dist/chunks/select-avatar-filter.EG4IpfbR.js.map +1 -0
- package/dist/chunks/select-country-filter.BtUlbnFP.js +55 -0
- package/dist/chunks/select-country-filter.BtUlbnFP.js.map +1 -0
- package/dist/chunks/select-currency-filter.B__ByL7N.js +89 -0
- package/dist/chunks/select-currency-filter.B__ByL7N.js.map +1 -0
- package/dist/chunks/select-payment-method-filter.DndRc65T.js +51 -0
- package/dist/chunks/select-payment-method-filter.DndRc65T.js.map +1 -0
- package/dist/chunks/select-tag-filter.DiWow_m7.js +59 -0
- package/dist/chunks/select-tag-filter.DiWow_m7.js.map +1 -0
- package/dist/chunks/{selection-card-group.DjFWMqVZ.js → selection-card-group.B2IEfuke.js} +9 -9
- package/dist/chunks/{selection-card-group.DjFWMqVZ.js.map → selection-card-group.B2IEfuke.js.map} +1 -1
- package/dist/chunks/{sidepanel.CntIcmx-.js → sidepanel.B9QGoXGV.js} +4 -4
- package/dist/chunks/{sidepanel.CntIcmx-.js.map → sidepanel.B9QGoXGV.js.map} +1 -1
- package/dist/chunks/{structured-list-item.Bhe0CH1M.js → structured-list-item.Cp1OuRJJ.js} +4 -4
- package/dist/chunks/{structured-list-item.Bhe0CH1M.js.map → structured-list-item.Cp1OuRJJ.js.map} +1 -1
- package/dist/chunks/{summary-grid.types.C70ED6WD.js → summary-grid.types.Ddf7FShu.js} +5 -5
- package/dist/chunks/{summary-grid.types.C70ED6WD.js.map → summary-grid.types.Ddf7FShu.js.map} +1 -1
- package/dist/chunks/{tab.BK1sIJAJ.js → tab.DavwEprr.js} +2 -2
- package/dist/chunks/{tab.BK1sIJAJ.js.map → tab.DavwEprr.js.map} +1 -1
- package/dist/chunks/{tag.Dz1FQSZb.js → tag.HGmLa47S.js} +2 -2
- package/dist/chunks/{tag.Dz1FQSZb.js.map → tag.HGmLa47S.js.map} +1 -1
- package/dist/chunks/{textarea.CcV9U3I7.js → textarea.CFCNYWVT.js} +2 -2
- package/dist/chunks/{textarea.CcV9U3I7.js.map → textarea.CFCNYWVT.js.map} +1 -1
- package/dist/chunks/{timeline-item.BG2by0xf.js → timeline-item.BIDEQCUw.js} +6 -6
- package/dist/chunks/{timeline-item.BG2by0xf.js.map → timeline-item.BIDEQCUw.js.map} +1 -1
- package/dist/chunks/{title-details.ChwPP7C5.js → title-details.kDWlIY1W.js} +2 -2
- package/dist/chunks/{title-details.ChwPP7C5.js.map → title-details.kDWlIY1W.js.map} +1 -1
- package/dist/chunks/{tooltip.DFYc5NKM.js → tooltip.D9Nqxoyp.js} +3 -3
- package/dist/chunks/{tooltip.DFYc5NKM.js.map → tooltip.D9Nqxoyp.js.map} +1 -1
- package/dist/chunks/{tutorial.K0aOQWIg.js → tutorial.dS_oywbu.js} +4 -4
- package/dist/chunks/{tutorial.K0aOQWIg.js.map → tutorial.dS_oywbu.js.map} +1 -1
- package/dist/chunks/{use-date-input-formatter.MgbFwUqJ.js → use-date-input-formatter.5r7srQZU.js} +2 -2
- package/dist/chunks/{use-date-input-formatter.MgbFwUqJ.js.map → use-date-input-formatter.5r7srQZU.js.map} +1 -1
- package/dist/chunks/warning-filled.DI6aB6vH.js +26 -0
- package/dist/chunks/warning-filled.DI6aB6vH.js.map +1 -0
- package/dist/code-snippet.js +1 -1
- package/dist/dashboard-template.js +1 -1
- package/dist/dashed-underline.js +1 -1
- package/dist/data-grid-template.js +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/date-picker.js +2 -2
- package/dist/date-range-picker.js +2 -2
- package/dist/date-time-picker.js +1 -1
- package/dist/draggable.js +2 -2
- package/dist/dropdown.js +2 -2
- package/dist/empty-state.js +1 -1
- package/dist/file-uploader.js +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/focus-trap.js +1 -1
- package/dist/form-layout.js +1 -1
- package/dist/header-with-views.js +1 -1
- package/dist/header.js +1 -1
- package/dist/index.js +56 -56
- package/dist/info-icon.js +1 -1
- package/dist/input-field-password.js +1 -1
- package/dist/input-field-phone-number.js +1 -1
- package/dist/input-field.js +1 -1
- package/dist/input-time.js +1 -1
- package/dist/inspector.js +2 -2
- package/dist/internal.js +11 -11
- package/dist/list.js +1 -1
- package/dist/menu.js +1 -1
- package/dist/modal-fullscreen.js +1 -1
- package/dist/modal.js +2 -2
- package/dist/navigation-menu.js +1 -1
- package/dist/pagination.js +1 -1
- package/dist/popover.js +2 -2
- package/dist/popper-container.js +1 -1
- package/dist/progress-bar.js +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/rich-text-editor.js +1 -1
- package/dist/search-bar.js +2 -2
- package/dist/secondary-nav.js +1 -1
- package/dist/segmented-control.js +1 -1
- package/dist/selection-card.js +1 -1
- package/dist/sidepanel.js +1 -1
- package/dist/structured-list.js +1 -1
- package/dist/summary-grid.js +1 -1
- package/dist/tabs.js +1 -1
- package/dist/tag.js +1 -1
- package/dist/textarea.js +1 -1
- package/dist/timeline.js +1 -1
- package/dist/tutorial.js +1 -1
- package/dist/web-types.json +9 -1
- package/package.json +6 -6
- package/dist/chunks/alert.DJDHwVeR.js.map +0 -1
- package/dist/chunks/filter-bar.DXpLhnxG.js +0 -3131
- package/dist/chunks/filter-bar.DXpLhnxG.js.map +0 -1
- package/dist/chunks/popover.types.DvIwSAAp.js +0 -6
|
@@ -1,52 +1,35 @@
|
|
|
1
|
-
import { getCurrentInstance as
|
|
2
|
-
import { c as
|
|
3
|
-
import { B as
|
|
1
|
+
import { getCurrentInstance as m, defineComponent as v, useSlots as y, computed as c, onMounted as S } from "vue";
|
|
2
|
+
import { c as l, a as b, B as T } from "./typography.D1OZJbEa.js";
|
|
3
|
+
import { B as w } from "./button.DII5Ifwa.js";
|
|
4
4
|
import { C as H } from "./cross-small.B9l4YLVX.js";
|
|
5
|
+
import { W as L } from "./warning-filled.DI6aB6vH.js";
|
|
6
|
+
import { C as B } from "./cross-circle-fill.D3dEmLeQ.js";
|
|
7
|
+
import { C as E } from "./checkmark-circle-fill.Ds9Mwqpi.js";
|
|
5
8
|
/* empty css */
|
|
6
|
-
import { n as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { u as $ } from "./use-has-slot.C9lQZ6nz.js";
|
|
10
|
-
import { u as x } from "./index.CPOlyau9.js";
|
|
9
|
+
import { n as C } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
10
|
+
import { u as R } from "./use-has-slot.C9lQZ6nz.js";
|
|
11
|
+
import { u as G } from "./index.CPOlyau9.js";
|
|
11
12
|
import "../assets/alert.css";
|
|
12
|
-
var i = /* @__PURE__ */ ((
|
|
13
|
-
const
|
|
14
|
-
__name: "warning-filled",
|
|
15
|
-
setup(o) {
|
|
16
|
-
const t = u(), s = String(t?.uid ?? t?.proxy?._uid);
|
|
17
|
-
return { __sfc: !0, instance: t, uuid: s };
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
var R = function() {
|
|
21
|
-
var t = this, s = t._self._c;
|
|
22
|
-
return t._self._setupProxy, s("svg", t._b({ staticClass: "ui-assets-icons-16", attrs: { role: "img", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "none" } }, "svg", t.$attrs, !1), [t.$attrs["svg-title"] ? s("title", [t._v(t._s(t.$attrs["svg-title"]))]) : t._e(), s("path", { attrs: { fill: "#001222", d: "M5.72456 2.45856C6.84306 0.797505 9.35301 0.852915 10.3789 2.62457L15 10.6246C16.0585 12.4537 14.7382 14.7493 12.6201 14.7496H3.37984C1.26177 14.7493 -0.0573711 12.4537 1.00093 10.6246L5.62105 2.62457L5.72456 2.45856ZM8.20991 10.3492C8.02 10.3092 7.80975 10.3298 7.62984 10.4097C7.44993 10.4897 7.28964 10.61 7.17964 10.7798C7.06984 10.9397 7.00984 11.1397 7.00972 11.3394C7.00972 11.6092 7.11997 11.8594 7.29976 12.0494C7.48973 12.2394 7.73976 12.3394 8.00972 12.3394L7.99995 12.3297C8.19979 12.3296 8.38964 12.2696 8.55952 12.1597C8.71947 12.0497 8.84966 11.8895 8.92964 11.7095C9.00952 11.5296 9.03016 11.3293 8.99019 11.1295C8.95014 10.9396 8.85955 10.7596 8.71968 10.6197C8.57975 10.4799 8.39975 10.3792 8.20991 10.3492ZM7.24995 4.57965V9.07965H8.74995V4.57965H7.24995Z" } })]);
|
|
23
|
-
}, F = [], G = /* @__PURE__ */ a(
|
|
24
|
-
E,
|
|
25
|
-
R,
|
|
26
|
-
F,
|
|
27
|
-
!1,
|
|
28
|
-
null,
|
|
29
|
-
null
|
|
30
|
-
);
|
|
31
|
-
const V = G.exports, P = {
|
|
13
|
+
var i = /* @__PURE__ */ ((s) => (s.DEFAULT = "default", s.TIP = "tip", s))(i || {}), n = /* @__PURE__ */ ((s) => (s.WARNING = "warning", s.CRITICAL = "critical", s.HIGHLIGHT = "highlight", s.SUCCESS = "success", s))(n || {}), u = /* @__PURE__ */ ((s) => (s.CLOSE_ALERT = "close-alert", s))(u || {});
|
|
14
|
+
const x = {
|
|
32
15
|
__name: "info-filled",
|
|
33
|
-
setup(
|
|
34
|
-
const t =
|
|
35
|
-
return { __sfc: !0, instance: t, uuid:
|
|
16
|
+
setup(s) {
|
|
17
|
+
const t = m(), o = String(t?.uid ?? t?.proxy?._uid);
|
|
18
|
+
return { __sfc: !0, instance: t, uuid: o };
|
|
36
19
|
}
|
|
37
20
|
};
|
|
38
|
-
var
|
|
39
|
-
var t = this,
|
|
40
|
-
return
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
21
|
+
var F = function() {
|
|
22
|
+
var t = this, o = t._self._c, e = t._self._setupProxy;
|
|
23
|
+
return o("svg", t._b({ staticClass: "ui-assets-icons-16", attrs: { role: "img", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "none" } }, "svg", t.$attrs, !1), [t.$attrs["svg-title"] ? o("title", [t._v(t._s(t.$attrs["svg-title"]))]) : t._e(), o("g", { attrs: { "clip-path": "url(#uia-ui-assets/icons-16-info_filled__a" + e.uuid + ")" } }, [o("path", { attrs: { fill: "#001222", "fill-rule": "evenodd", d: "M5.03418 0.839544C6.45015 0.253058 8.00853 0.0992122 9.51172 0.398138C11.015 0.697159 12.3966 1.43547 13.4805 2.51923C14.5642 3.60301 15.3025 4.98476 15.6016 6.48798C15.9005 7.99113 15.7466 9.54958 15.1602 10.9655C14.5736 12.3816 13.5801 13.5925 12.3057 14.444C11.1109 15.2423 9.71924 15.6917 8.28711 15.7448L8 15.7497C5.94458 15.7497 3.97294 14.9336 2.51953 13.4802C1.06623 12.0268 0.250005 10.055 0.25 7.9997C0.250066 6.4671 0.70424 4.96838 1.55566 3.69404C2.40724 2.41967 3.61814 1.42609 5.03418 0.839544ZM6.25 6.2497V7.7497H7.25V10.2497H6.25V11.7497H9.75V10.2497H8.75V6.2497H6.25ZM7.75 3.4997C7.58674 3.4997 7.42763 3.54211 7.28418 3.61786C7.25386 3.63389 7.22303 3.64949 7.19434 3.66865L7.07812 3.75947C7.04744 3.78732 7.01817 3.817 6.99121 3.84833C6.97917 3.86236 6.96827 3.8776 6.95703 3.89228C6.93942 3.91522 6.9228 3.93915 6.90723 3.96357C6.90005 3.97485 6.89248 3.98618 6.88574 3.99775C6.86351 4.03594 6.84324 4.07574 6.82617 4.11689L6.78027 4.25751C6.77017 4.29795 6.7628 4.33927 6.75781 4.38056C6.75552 4.39961 6.75411 4.41902 6.75293 4.43818C6.75166 4.45856 6.75196 4.47926 6.75195 4.4997C6.75195 4.52207 6.75144 4.54472 6.75293 4.56708C6.75579 4.60979 6.76114 4.65273 6.76953 4.69501L6.80859 4.83661C6.82299 4.87685 6.84098 4.91584 6.86035 4.9538C6.86847 4.96971 6.87775 4.98522 6.88672 5.00068C6.89748 5.01922 6.90895 5.03753 6.9209 5.05536C6.93323 5.07376 6.94544 5.09248 6.95898 5.11005C6.98495 5.14371 7.01269 5.17643 7.04297 5.20673L7.1543 5.30341C7.19021 5.33003 7.2285 5.35325 7.26758 5.3747C7.27775 5.38031 7.28847 5.38508 7.29883 5.39033C7.32903 5.40554 7.35995 5.41924 7.3916 5.43134C7.40264 5.43559 7.41361 5.44018 7.4248 5.44404C7.46721 5.45855 7.51041 5.47134 7.55469 5.48017C7.59672 5.48853 7.63919 5.49291 7.68164 5.49579C7.70021 5.49707 7.71872 5.49751 7.7373 5.49775C7.76179 5.49804 7.78614 5.49729 7.81055 5.49579C7.82982 5.49462 7.84899 5.4932 7.86816 5.49091C7.90982 5.48592 7.95139 5.47962 7.99219 5.46943L8.13281 5.42353C8.1739 5.40649 8.21283 5.38517 8.25098 5.36298C8.2626 5.35623 8.27383 5.3487 8.28516 5.3415C8.30964 5.32589 8.33345 5.30934 8.35645 5.29169C8.37116 5.28043 8.38633 5.26958 8.40039 5.25751C8.43176 5.23053 8.46235 5.20229 8.49023 5.17158L8.58105 5.05536C8.69084 4.89096 8.75 4.6974 8.75 4.4997C8.74992 4.2346 8.64449 3.98013 8.45703 3.79267C8.26951 3.60523 8.01514 3.4997 7.75 3.4997Z", "clip-rule": "evenodd" } })]), o("defs", [o("clipPath", { attrs: { id: "uia-ui-assets/icons-16-info_filled__a" + e.uuid } }, [o("rect", { attrs: { width: "16", height: "16", fill: "#fff" } })])])]);
|
|
24
|
+
}, $ = [], V = /* @__PURE__ */ C(
|
|
25
|
+
x,
|
|
26
|
+
F,
|
|
27
|
+
$,
|
|
45
28
|
!1,
|
|
46
29
|
null,
|
|
47
30
|
null
|
|
48
31
|
);
|
|
49
|
-
const
|
|
32
|
+
const P = V.exports, A = {
|
|
50
33
|
"de-DE": { close: "Schließen", criticalIcon: "Kritisches Symbol", highlightIcon: "Symbol hervorheben", successIcon: "Erfolgssymbol", warningIcon: "Warnungssymbol" },
|
|
51
34
|
"en-GB": { close: "Close", criticalIcon: "Critical icon", highlightIcon: "Highlight icon", successIcon: "Success icon", warningIcon: "Warning icon" },
|
|
52
35
|
"en-US": { close: "Close", criticalIcon: "Critical icon", highlightIcon: "Highlight icon", successIcon: "Success icon", warningIcon: "Warning icon" },
|
|
@@ -58,63 +41,62 @@ const N = W.exports, Z = {
|
|
|
58
41
|
"ja-JP": { close: "閉じる", criticalIcon: "重大アイコン", highlightIcon: "ハイライトアイコン", successIcon: "成功アイコン", warningIcon: "警告アイコン" },
|
|
59
42
|
"pt-BR": { close: "Fechar", criticalIcon: "Ícone crítico", highlightIcon: "Ícone de destaque", successIcon: "Ícone de sucesso", warningIcon: "Ícone de aviso" },
|
|
60
43
|
"zh-CN": { close: "关闭", criticalIcon: "关键图标", highlightIcon: "高亮图标", successIcon: "成功图标", warningIcon: "警告图标" }
|
|
61
|
-
},
|
|
62
|
-
i18n: { messages:
|
|
44
|
+
}, W = {
|
|
45
|
+
i18n: { messages: A },
|
|
63
46
|
name: "bento-alert"
|
|
64
|
-
},
|
|
65
|
-
...
|
|
47
|
+
}, N = /* @__PURE__ */ v({
|
|
48
|
+
...W,
|
|
66
49
|
props: {
|
|
67
50
|
closeButton: { type: Boolean, default: !1 },
|
|
68
51
|
type: { default: n.HIGHLIGHT },
|
|
69
52
|
variant: { default: i.DEFAULT }
|
|
70
53
|
},
|
|
71
54
|
emits: ["close-alert"],
|
|
72
|
-
setup(
|
|
73
|
-
const
|
|
74
|
-
[`b-alert--${
|
|
75
|
-
[`b-alert--${i.TIP}`]:
|
|
76
|
-
})),
|
|
77
|
-
switch (
|
|
55
|
+
setup(s, { emit: t }) {
|
|
56
|
+
const o = s, e = y(), d = R(e), { t: r } = G(), a = c(() => o.variant === i.TIP), I = c(() => ({
|
|
57
|
+
[`b-alert--${o.type}`]: o.type,
|
|
58
|
+
[`b-alert--${i.TIP}`]: a.value
|
|
59
|
+
})), _ = c(() => r(`${o.type}Icon`)), p = c(() => {
|
|
60
|
+
switch (o.type) {
|
|
78
61
|
case n.CRITICAL:
|
|
79
|
-
return L;
|
|
80
|
-
case n.SUCCESS:
|
|
81
62
|
return B;
|
|
63
|
+
case n.SUCCESS:
|
|
64
|
+
return E;
|
|
82
65
|
case n.WARNING:
|
|
83
|
-
return
|
|
66
|
+
return L;
|
|
84
67
|
case n.HIGHLIGHT:
|
|
85
68
|
default:
|
|
86
|
-
return
|
|
69
|
+
return P;
|
|
87
70
|
}
|
|
88
71
|
}), h = c(() => ({
|
|
89
|
-
el:
|
|
90
|
-
variant:
|
|
72
|
+
el: b.DIV,
|
|
73
|
+
variant: a.value ? l.CAPTION : l.BODY,
|
|
91
74
|
wide: !0
|
|
92
|
-
})),
|
|
93
|
-
t(
|
|
75
|
+
})), g = c(() => o.type === n.HIGHLIGHT ? "status" : "alert"), f = () => {
|
|
76
|
+
t(u.CLOSE_ALERT);
|
|
94
77
|
};
|
|
95
|
-
return
|
|
78
|
+
return S(() => {
|
|
96
79
|
if (!e.default && !e.description)
|
|
97
80
|
throw new Error("Alert Component requires a title or a description");
|
|
98
|
-
}), { __sfc: !0, slots: e, hasSlot: d, emit: t, props:
|
|
81
|
+
}), { __sfc: !0, slots: e, hasSlot: d, emit: t, props: o, t: r, isTipVariant: a, alertConditionalClasses: I, iconSvgTitle: _, iconComponent: p, descriptionTypography: h, computedRole: g, onCloseButtonClick: f, BentoTypography: T, BentoButton: w, CrossSmall: H };
|
|
99
82
|
}
|
|
100
83
|
});
|
|
101
|
-
var
|
|
102
|
-
var t = this,
|
|
103
|
-
return
|
|
104
|
-
},
|
|
84
|
+
var k = function() {
|
|
85
|
+
var t = this, o = t._self._c, e = t._self._setupProxy;
|
|
86
|
+
return o("div", { staticClass: "b-alert", attrs: { role: e.computedRole } }, [o("div", { staticClass: "b-alert__inner-container", class: e.alertConditionalClasses }, [o("div", { staticClass: "b-alert__icon" }, [o(e.iconComponent, { tag: "component", attrs: { "aria-hidden": "true", "svg-title": e.iconSvgTitle } })], 1), o("div", { staticClass: "b-alert__content" }, [e.hasSlot("default") && !e.isTipVariant ? o(e.BentoTypography, { staticClass: "b-alert__title", attrs: { el: "div", variant: "body", strongest: "", wide: "" } }, [t._t("default")], 2) : t._e(), e.hasSlot("description") ? o(e.BentoTypography, t._b({ staticClass: "b-alert__description", attrs: { "data-testid": "alert-description" } }, "bento-typography", e.descriptionTypography, !1), [t._t("description")], 2) : t._e(), e.hasSlot("actions") && !e.isTipVariant ? o("div", { staticClass: "b-alert__actions", attrs: { "data-testid": "alert-actions" } }, [t._t("actions")], 2) : t._e()], 1), t.closeButton ? o(e.BentoButton, { staticClass: "b-alert__close-button", attrs: { variant: "tertiary", type: "button" }, on: { click: e.onCloseButtonClick } }, [o(e.CrossSmall, { attrs: { "svg-title": e.t("close") } })], 1) : t._e()], 1)]);
|
|
87
|
+
}, D = [], M = /* @__PURE__ */ C(
|
|
88
|
+
N,
|
|
89
|
+
k,
|
|
105
90
|
D,
|
|
106
|
-
U,
|
|
107
|
-
z,
|
|
108
91
|
!1,
|
|
109
92
|
null,
|
|
110
93
|
"a8d6af45"
|
|
111
94
|
);
|
|
112
|
-
const
|
|
95
|
+
const tt = M.exports;
|
|
113
96
|
export {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
_ as a,
|
|
97
|
+
tt as B,
|
|
98
|
+
u as a,
|
|
117
99
|
n as b,
|
|
118
100
|
i as c
|
|
119
101
|
};
|
|
120
|
-
//# sourceMappingURL=alert.
|
|
102
|
+
//# sourceMappingURL=alert.DT6T5Uxb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.DT6T5Uxb.js","sources":["../../src/components/alert/alert.types.ts","../../../ui-assets/icons-16/dist/vue/info-filled.vue","../../src/components/alert/alert.vue"],"sourcesContent":["/**\n * @deprecated Since v2.0.0. Use string literal instead.\n */\nexport enum BentoAlertVariant {\n DEFAULT = 'default',\n TIP = 'tip',\n}\n\n/**\n * @deprecated Since v2.0.0. Use string literal instead.\n */\nexport enum BentoAlertTypeOption {\n WARNING = 'warning',\n CRITICAL = 'critical',\n HIGHLIGHT = 'highlight',\n SUCCESS = 'success',\n}\n\n/**\n * @deprecated Since v2.0.0. Use `@close-alert` instead.\n */\nexport enum BentoAlertEvent {\n CLOSE_ALERT = 'close-alert',\n}\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><g :clip-path=\"'url(#uia-ui-assets/icons-16-info_filled__a' + uuid + ')'\"><path fill=\"#001222\" fill-rule=\"evenodd\" d=\"M5.03418 0.839544C6.45015 0.253058 8.00853 0.0992122 9.51172 0.398138C11.015 0.697159 12.3966 1.43547 13.4805 2.51923C14.5642 3.60301 15.3025 4.98476 15.6016 6.48798C15.9005 7.99113 15.7466 9.54958 15.1602 10.9655C14.5736 12.3816 13.5801 13.5925 12.3057 14.444C11.1109 15.2423 9.71924 15.6917 8.28711 15.7448L8 15.7497C5.94458 15.7497 3.97294 14.9336 2.51953 13.4802C1.06623 12.0268 0.250005 10.055 0.25 7.9997C0.250066 6.4671 0.70424 4.96838 1.55566 3.69404C2.40724 2.41967 3.61814 1.42609 5.03418 0.839544ZM6.25 6.2497V7.7497H7.25V10.2497H6.25V11.7497H9.75V10.2497H8.75V6.2497H6.25ZM7.75 3.4997C7.58674 3.4997 7.42763 3.54211 7.28418 3.61786C7.25386 3.63389 7.22303 3.64949 7.19434 3.66865L7.07812 3.75947C7.04744 3.78732 7.01817 3.817 6.99121 3.84833C6.97917 3.86236 6.96827 3.8776 6.95703 3.89228C6.93942 3.91522 6.9228 3.93915 6.90723 3.96357C6.90005 3.97485 6.89248 3.98618 6.88574 3.99775C6.86351 4.03594 6.84324 4.07574 6.82617 4.11689L6.78027 4.25751C6.77017 4.29795 6.7628 4.33927 6.75781 4.38056C6.75552 4.39961 6.75411 4.41902 6.75293 4.43818C6.75166 4.45856 6.75196 4.47926 6.75195 4.4997C6.75195 4.52207 6.75144 4.54472 6.75293 4.56708C6.75579 4.60979 6.76114 4.65273 6.76953 4.69501L6.80859 4.83661C6.82299 4.87685 6.84098 4.91584 6.86035 4.9538C6.86847 4.96971 6.87775 4.98522 6.88672 5.00068C6.89748 5.01922 6.90895 5.03753 6.9209 5.05536C6.93323 5.07376 6.94544 5.09248 6.95898 5.11005C6.98495 5.14371 7.01269 5.17643 7.04297 5.20673L7.1543 5.30341C7.19021 5.33003 7.2285 5.35325 7.26758 5.3747C7.27775 5.38031 7.28847 5.38508 7.29883 5.39033C7.32903 5.40554 7.35995 5.41924 7.3916 5.43134C7.40264 5.43559 7.41361 5.44018 7.4248 5.44404C7.46721 5.45855 7.51041 5.47134 7.55469 5.48017C7.59672 5.48853 7.63919 5.49291 7.68164 5.49579C7.70021 5.49707 7.71872 5.49751 7.7373 5.49775C7.76179 5.49804 7.78614 5.49729 7.81055 5.49579C7.82982 5.49462 7.84899 5.4932 7.86816 5.49091C7.90982 5.48592 7.95139 5.47962 7.99219 5.46943L8.13281 5.42353C8.1739 5.40649 8.21283 5.38517 8.25098 5.36298C8.2626 5.35623 8.27383 5.3487 8.28516 5.3415C8.30964 5.32589 8.33345 5.30934 8.35645 5.29169C8.37116 5.28043 8.38633 5.26958 8.40039 5.25751C8.43176 5.23053 8.46235 5.20229 8.49023 5.17158L8.58105 5.05536C8.69084 4.89096 8.75 4.6974 8.75 4.4997C8.74992 4.2346 8.64449 3.98013 8.45703 3.79267C8.26951 3.60523 8.01514 3.4997 7.75 3.4997Z\" clip-rule=\"evenodd\"/></g><defs><clipPath :id=\"'uia-ui-assets/icons-16-info_filled__a' + uuid\"><rect width=\"16\" height=\"16\" fill=\"#fff\"/></clipPath></defs></svg>\n</template>\n<script setup>\n import { getCurrentInstance } from 'vue';\n import '../css/main.css';\n\n const instance = getCurrentInstance();\n const uuid = String(instance?.uid ?? instance?.proxy?._uid);\n</script>\n","<template>\n <div class=\"b-alert\" :role=\"computedRole\">\n <div class=\"b-alert__inner-container\" :class=\"alertConditionalClasses\">\n <div class=\"b-alert__icon\">\n <component :is=\"iconComponent\" aria-hidden=\"true\" :svg-title=\"iconSvgTitle\" />\n </div>\n\n <div class=\"b-alert__content\">\n <bento-typography\n v-if=\"hasSlot('default') && !isTipVariant\"\n class=\"b-alert__title\"\n el=\"div\"\n variant=\"body\"\n strongest\n wide\n >\n <slot />\n </bento-typography>\n\n <bento-typography\n v-if=\"hasSlot('description')\"\n class=\"b-alert__description\"\n v-bind=\"descriptionTypography\"\n data-testid=\"alert-description\"\n >\n <slot name=\"description\" />\n </bento-typography>\n\n <div v-if=\"hasSlot('actions') && !isTipVariant\" class=\"b-alert__actions\" data-testid=\"alert-actions\">\n <slot name=\"actions\" />\n </div>\n </div>\n\n <bento-button\n v-if=\"closeButton\"\n class=\"b-alert__close-button\"\n variant=\"tertiary\"\n type=\"button\"\n @click=\"onCloseButtonClick\"\n >\n <cross-small :svg-title=\"t('close')\" />\n </bento-button>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, onMounted, useSlots } from 'vue';\n\n // Component\n import { BentoAlertEvent, BentoAlertTypeOption, BentoAlertVariant } from '@/components/alert/alert.types';\n import { BentoTypography, BentoTypographyElement, BentoTypographyVariant } from '@/components/typography';\n import { BentoButton } from '@/components/button';\n\n import CrossSmall from '@adyen/ui-assets-icons-16/vue/cross-small';\n import Warning from '@adyen/ui-assets-icons-16/vue/warning-filled';\n import CrossCircle from '@adyen/ui-assets-icons-16/vue/cross-circle-fill';\n import CheckedCircle from '@adyen/ui-assets-icons-16/vue/checkmark-circle-fill';\n import Info from '@adyen/ui-assets-icons-16/vue/info-filled';\n\n // Utils\n import { useHasSlot } from '@/composables';\n import { useI18n } from '@/utils/ts/i18n';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n\n const emit = defineEmits([\"close-alert\"]);\n\n const props = defineProps({\n closeButton: { type: Boolean, default: false },\n type: { default: BentoAlertTypeOption.HIGHLIGHT },\n variant: { default: BentoAlertVariant.DEFAULT }\n});\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const isTipVariant = computed(() => props.variant === BentoAlertVariant.TIP);\n\n const alertConditionalClasses = computed(() => ({\n [`b-alert--${props.type}`]: props.type,\n [`b-alert--${BentoAlertVariant.TIP}`]: isTipVariant.value,\n }));\n\n const iconSvgTitle = computed(() => t(`${props.type}Icon`));\n\n const iconComponent = computed(() => {\n switch (props.type) {\n case BentoAlertTypeOption.CRITICAL:\n return CrossCircle;\n case BentoAlertTypeOption.SUCCESS:\n return CheckedCircle;\n case BentoAlertTypeOption.WARNING:\n return Warning;\n case BentoAlertTypeOption.HIGHLIGHT:\n default:\n return Info;\n }\n });\n\n const descriptionTypography = computed(() => ({\n el: BentoTypographyElement.DIV,\n variant: isTipVariant.value ? BentoTypographyVariant.CAPTION : BentoTypographyVariant.BODY,\n wide: true,\n }));\n\n const computedRole = computed(() => (props.type === BentoAlertTypeOption.HIGHLIGHT ? 'status' : 'alert'));\n\n const onCloseButtonClick = () => {\n emit(BentoAlertEvent.CLOSE_ALERT);\n };\n\n onMounted(() => {\n if (!slots.default && !slots.description) {\n throw new Error('Alert Component requires a title or a description');\n }\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * An Alert component is used to display a persistent\n * notification containing information important to the user\n *\n * @example\n * import { BentoAlert, BentoAlertTypeOption } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoAlert },\n * template: `\n * <bento-alert type=\"highlight\">\n * Title of the Alert\n * </bento-alert>\n * `\n * }\n */\n export default {\n i18n: { messages },\n name: 'bento-alert',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./alert.scss\" />\n"],"names":["BentoAlertVariant","BentoAlertVariant2","BentoAlertTypeOption","BentoAlertTypeOption2","BentoAlertEvent","BentoAlertEvent2","instance","getCurrentInstance","uuid","__default__","messages","slots","useSlots","hasSlot","useHasSlot","t","useI18n","isTipVariant","computed","props","alertConditionalClasses","iconSvgTitle","iconComponent","CrossCircleFillIcon","CheckmarkCircleFillIcon","WarningFilledIcon","Info","descriptionTypography","BentoTypographyElement","BentoTypographyVariant","computedRole","onCloseButtonClick","emit","onMounted"],"mappings":";;;;;;;;;;;;AAGO,IAAAA,IAAA,kBAAAC,OACHA,EAAA,UAAA,WACAA,EAAA,MAAA,OAFQA,IAAAD,KAAA,CAAA,CAAA,GAQLE,IAAA,kBAAAC,OACHA,EAAA,UAAA,WACAA,EAAA,WAAA,YACAA,EAAA,YAAA,aACAA,EAAA,UAAA,WAJQA,IAAAD,KAAA,CAAA,CAAA,GAULE,IAAA,kBAAAC,OACHA,EAAA,cAAA,eADQA,IAAAD,KAAA,CAAA,CAAA;;;;AChBZ,UAAAE,IAAAC,EAAA,GAIAC,IAAA,OAAAF,GAAA,OAAAA,GAAA,OAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GCmIIG,IAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAAA,EACM,MAAA;AAErB;;;;;;;;;iBA3EAC,IAAAC,EAAA,GACAC,IAAAC,EAAAH,CAAA,GAUA,EAAA,GAAAI,EAAA,IAAAC,EAAA,GAEAC,IAAAC,EAAA,MAAAC,EAAA,YAAAnB,EAAA,GAAA,GAEAoB,IAAAF,EAAA,OAAA;AAAA,MAAgD,CAAA,YAAAC,EAAA,IAAA,EAAA,GAAAA,EAAA;AAAA,MACV,CAAA,YAAAnB,EAAA,GAAA,EAAA,GAAAiB,EAAA;AAAA,IACkB,EAAA,GAGxDI,IAAAH,EAAA,MAAAH,EAAA,GAAAI,EAAA,IAAA,MAAA,CAAA,GAEAG,IAAAJ,EAAA,MAAA;AACI,cAAAC,EAAA,MAAA;AAAA,QAAoB,KAAAjB,EAAA;AAEZ,iBAAAqB;AAAA,QAAO,KAAArB,EAAA;AAEP,iBAAAsB;AAAA,QAAO,KAAAtB,EAAA;AAEP,iBAAAuB;AAAA,QAAO,KAAAvB,EAAA;AAAA,QACe;AAEtB,iBAAAwB;AAAA,MAAO;AAAA,IACf,CAAA,GAGJC,IAAAT,EAAA,OAAA;AAAA,MAA8C,IAAAU,EAAA;AAAA,MACf,SAAAX,EAAA,QAAAY,EAAA,UAAAA,EAAA;AAAA,MAC2D,MAAA;AAAA,IAChF,EAAA,GAGVC,IAAAZ,EAAA,MAAAC,EAAA,SAAAjB,EAAA,YAAA,WAAA,OAAA,GAEA6B,IAAA,MAAA;AACI,MAAAC,EAAA5B,EAAA,WAAA;AAAA,IAAgC;AAGpC,WAAA6B,EAAA,MAAA;AACI,UAAA,CAAAtB,EAAA,WAAA,CAAAA,EAAA;AACI,cAAA,IAAA,MAAA,mDAAA;AAAA,IACJ,CAAA;;;;;;;;;;;;;;;"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useAttrs as q, defineComponent as I, useSlots as W, ref as u, computed as l, inject as Q, watch as G, nextTick as X, onUnmounted as Z, onMounted as V, provide as O, toRefs as tt } from "vue";
|
|
2
2
|
import { B as et } from "./button.DII5Ifwa.js";
|
|
3
|
-
import { B as at } from "./focus-trap.
|
|
3
|
+
import { B as at } from "./focus-trap.BDpcWIxI.js";
|
|
4
4
|
import { u as j } from "./use-has-slot.C9lQZ6nz.js";
|
|
5
5
|
import { u as ot } from "./index.CPOlyau9.js";
|
|
6
|
-
import { l as st } from "./button-actions.
|
|
6
|
+
import { l as st } from "./button-actions.sLmpjWGK.js";
|
|
7
7
|
import { g as nt } from "./generate-uid.DBWe4g6T.js";
|
|
8
8
|
import { C as lt } from "./cross.szJ_ZUTI.js";
|
|
9
9
|
import { B as it, D as rt, a as ct } from "./dialog-page.keys.Dym9e6k3.js";
|
|
10
10
|
import { B as ut } from "./typography.D1OZJbEa.js";
|
|
11
|
-
import { F as dt } from "./footer-actions.
|
|
11
|
+
import { F as dt } from "./footer-actions.B5YZ95jM.js";
|
|
12
12
|
import { D as mt } from "./dialog-page.Bct3zOQO.js";
|
|
13
13
|
import { o as pt } from "./resize.Bqks3WUm.js";
|
|
14
14
|
import { a as ft, G as gt } from "./grid-layout.BeCrjPgT.js";
|
|
@@ -309,4 +309,4 @@ export {
|
|
|
309
309
|
bt as g,
|
|
310
310
|
Xt as h
|
|
311
311
|
};
|
|
312
|
-
//# sourceMappingURL=base-modal.
|
|
312
|
+
//# sourceMappingURL=base-modal.CGHkdr9t.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-modal.CcmoTJdc.js","sources":["../../src/composables/use-attribute-routing/use-attribute-routing.ts","../../src/components/modal/modal.types.ts","../../src/components/modal/modal.keys.ts","../../src/components/modal/components/modal-page/modal-page.vue","../../src/components/modal/components/base-modal/base-modal.vue"],"sourcesContent":["import { type SetupContext, useAttrs } from 'vue';\n\nexport type Attributes = SetupContext['attrs'];\n\nexport interface AttributeRouting {\n getAriaAttributes: (attrs?: Attributes) => Attributes;\n getRootAttributes: (attrs?: Attributes) => Attributes;\n}\n\n/**\n * Routes ARIA attributes away from a component root to its semantic element.\n *\n * @returns Functions that return ARIA and root attribute groups.\n */\nexport const useAttributeRouting = (): AttributeRouting => {\n const attrs = useAttrs();\n\n const filterAttrs = (attrsArg: Attributes, shouldInclude: (key: string) => boolean): Attributes =>\n Object.fromEntries(Object.entries(attrsArg).filter(([key]) => shouldInclude(key)));\n\n return {\n getAriaAttributes: overrideAttrs => filterAttrs(overrideAttrs ?? attrs, key => key.startsWith('aria-')),\n getRootAttributes: overrideAttrs => filterAttrs(overrideAttrs ?? attrs, key => !key.startsWith('aria-')),\n };\n};\n","/**\n * @deprecated Since v2.0.0. Use string literal instead.\n */\nexport enum BentoModalVariant {\n DEFAULT = 'default',\n DIALOG = 'dialog',\n}\n\n/**\n * @deprecated Since v2.0.0. Use string literal instead.\n */\nexport enum BentoModalVariantMapping {\n DEFAULT = 'BentoModalDefault',\n DIALOG = 'BentoModalDialog',\n}\n\n/**\n * @deprecated Since v2.0.0. Use string literal instead.\n */\nexport enum BentoModalSize {\n SMALL = 'small',\n MEDIUM = 'medium',\n LARGE = 'large',\n}\n\n/**\n * @deprecated Since v2.0.0. Use string literal instead.\n */\nexport enum BentoModalColumnLayoutVariant {\n SMALLER = 'smaller',\n EQUAL = 'equal',\n BIGGER = 'bigger',\n}\n\nexport enum BentoModalRole {\n DIALOG = 'dialog',\n ALERT_DIALOG = 'alertdialog',\n}\n\n/**\n * @deprecated Since v2.0.0. Use string literal instead.\n */\nexport enum BentoModalDialogType {\n CONFIRMATION = 'confirmation',\n DESTRUCTIVE = 'destructive',\n INFO = 'info',\n ACKNOWLEDGEMENT = 'acknowledgement',\n}\n\nexport enum BentoModalEvent {\n CLOSE_MODAL = 'close-modal',\n}\n","export const MODAL_CONFIG_INJECTION_KEY = Symbol('modal config data injection key');\n","<template>\n <dialog-page\n ref=\"page\"\n class=\"b-modal-page\"\n :class=\"modalPageConditionalClasses\"\n :page-id=\"pageId\"\n :always-show-border=\"hasColumnLayout\"\n :back-button-styling=\"customPaddingStyles?.backButton\"\n :previous-page=\"previousPage\"\n @animationend=\"isAnimationActive = false\"\n >\n <template v-if=\"hasSlot('default') || showCloseButton\" #header>\n <div class=\"b-modal-page__header-container\" :style=\"customPaddingStyles.header\">\n <div class=\"b-modal-page__header\">\n <bento-typography class=\"b-modal-page__title\" el=\"span\" variant=\"title\" stronger>\n <slot v-if=\"hasSlot('default')\" />\n </bento-typography>\n </div>\n </div>\n </template>\n\n <template #content>\n <div\n class=\"b-modal-page__content\"\n :class=\"modalContentConditionalClasses\"\n :style=\"customPaddingStyles.content\"\n >\n <bento-typography\n v-if=\"hasSlot('content') || (hasSlot('content-col-1') && hasSlot('content-col-2'))\"\n el=\"div\"\n >\n <grid-layout\n v-if=\"hasColumnLayout\"\n :column-width=\"computedColumnWidth\"\n :container-type=\"GridLayoutContainerType.NORMAL\"\n no-gap\n class=\"b-modal-page__grid\"\n >\n <template #col-1><slot name=\"content-col-1\"></slot></template>\n <template #col-2><slot name=\"content-col-2\"></slot></template>\n </grid-layout>\n <slot v-else name=\"content\" />\n </bento-typography>\n </div>\n </template>\n <template v-if=\"hasSlot('actions')\" #footer>\n <div class=\"b-modal-page__actions-container\" :style=\"customPaddingStyles.actions\">\n <div aria-label=\"modal actions\" class=\"b-modal-page__actions\">\n <slot name=\"actions\" />\n </div>\n </div>\n </template>\n <template v-else-if=\"actions && actions.length > 0\" #footer>\n <div class=\"b-modal-page__actions-container\" :style=\"customPaddingStyles.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 { computed, defineComponent, inject, nextTick, onUnmounted, ref, useSlots, watch } from 'vue';\n import { BentoModalColumnLayoutVariant, BentoModalSize } from '@/components/modal/modal.types';\n import { type BentoModalConfigData } from '@/components/modal/modal.internal.types';\n import { BentoTypography } from '@/components/typography';\n import { GridLayout, GridLayoutContainerType } from '@/internal';\n import { useHasSlot } from '@/composables';\n\n import { FooterActions } from '@/components/internal/footer-actions';\n\n import DialogPage from '@/internal/dialog-page/dialog-page.vue';\n import { MODAL_CONFIG_INJECTION_KEY } from '../../modal.keys';\n import { observeSizeOfElement } from '@/utils/ts/resize';\n import type { BentoModalPageProps } from './modal-page.types';\n\n const CLOSE_BUTTON_ICON_WIDTH = 26;\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n const page = ref<InstanceType<typeof DialogPage>>(null);\n\n const props = defineProps({\n actions: { default: null },\n actionsLabel: { default: null },\n columnsSize: { default: BentoModalColumnLayoutVariant.SMALLER },\n customPadding: { default: null },\n destructiveActions: { type: Boolean, default: false },\n withColumnLayout: { type: Boolean, default: false },\n pageId: { default: undefined },\n previousPage: { default: undefined }\n});\n\n const modalPageConditionalClasses = computed(() => ({\n 'b-modal-page--custom-padding': props.customPadding,\n }));\n\n const modalContentConditionalClasses = computed(() => ({\n 'b-modal-page__content--with-header': hasSlot('default'),\n 'b-modal-page__content--with-actions': hasSlot('actions') || props.actions?.length,\n }));\n\n // Setting custom padding styles\n const customPaddingStyles = computed(() => {\n if (!props.customPadding) {\n return {};\n }\n\n const xPadding = {\n paddingLeft: props.customPadding,\n paddingRight: props.customPadding,\n };\n\n const content = { ...xPadding, paddingTop: undefined, paddingBottom: undefined };\n\n if (!hasSlot('default')) {\n content.paddingTop = props.customPadding;\n }\n\n if (!hasSlot('actions')) {\n content.paddingBottom = props.customPadding;\n }\n\n return {\n header: {\n ...xPadding,\n paddingTop: props.customPadding,\n paddingRight: `${parseInt(props.customPadding, 10) + CLOSE_BUTTON_ICON_WIDTH}px`,\n flex: 1,\n },\n content,\n actions: { ...xPadding, paddingBottom: props.customPadding },\n backButton: { top: props.customPadding, paddingLeft: props.customPadding },\n };\n });\n\n // Column layout styles\n const hasColumnLayout = computed(() => props.withColumnLayout && size.value === BentoModalSize.LARGE);\n\n const computedColumnWidth = computed(() => {\n if (props.columnsSize === BentoModalColumnLayoutVariant.SMALLER) {\n return [\n { small: 4, medium: 4, large: 4 },\n { small: 8, medium: 8, large: 8 },\n ];\n }\n if (props.columnsSize === BentoModalColumnLayoutVariant.BIGGER) {\n return [\n { small: 8, medium: 8, large: 8 },\n { small: 4, medium: 4, large: 4 },\n ];\n }\n return [\n { small: 6, medium: 6, large: 6 },\n { small: 6, medium: 6, large: 6 },\n ];\n });\n\n // Register page to parent component and inject data from parent component\n const { activePage, height, isAnimationActive, pageCustomPadding, showCloseButton, size } =\n inject<BentoModalConfigData>(MODAL_CONFIG_INJECTION_KEY);\n\n const isCurrentPage = computed(() => activePage.value === props.pageId || !activePage.value);\n\n // Animation\n // Set resize observer on mount of update the height of the dialog on resize\n let pageElementObserver: ResizeObserver | null = null;\n\n // Watching activePage changes to set the height of the page and set isAnimationActive\n watch(\n () => activePage.value,\n async (value, oldValue) => {\n if (isCurrentPage.value) {\n await nextTick();\n height.value = `${page.value?.$el?.clientHeight}px`;\n pageCustomPadding.value = props.customPadding;\n // only set isAnimationActive to true if its going from two different pages and not from null to the first page\n isAnimationActive.value = oldValue !== undefined;\n\n pageElementObserver = observeSizeOfElement(page.value, () => {\n const pageHeight = `${page.value?.$el?.clientHeight}px`;\n if (pageHeight && pageHeight !== height.value) {\n height.value = pageHeight;\n }\n });\n }\n },\n { immediate: true }\n );\n\n // Disconnect observer on unmounting the page\n onUnmounted(() => {\n pageElementObserver?.disconnect();\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * ModalPage is used to render different pages of the Modal component\n *\n * @example\n * import { BentoModal, BentoModalPage } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoModal, BentoModalPage },\n * template: `\n * <bento-modal active-page='page1' :is-open='true'>\n * <bento-modal-page\n * pageId='page1'\n * actions-label='Move to next page'\n * :actions=\"[\n * {\n * title: 'Next page',\n * event: () => {\n * activePage.value = 'page2';\n * },\n * }]\">\n * Page 1\n * <template #content>\n * Page 1 content\n * </template>\n * </bento-modal-page>\n * <bento-modal-page\n * pageId='page2'\n * :actions=\"[\n * {\n * title: 'Save',\n * event: () => {},\n * }]\">\n * Page 2\n * <template #content>\n * Page 2 content\n * </template>\n * </bento-modal-page>\n * </bento-modal>\n * `\n * }\n */\n export default defineComponent({});\n</script>\n\n<style lang=\"scss\" scoped src=\"./modal-page.scss\" />\n","<template>\n <div v-bind=\"getRootAttributes($attrs)\" class=\"b-modal-base\">\n <dialog\n ref=\"modal\"\n :role=\"modalRole\"\n :aria-label=\"$attrs?.['aria-label'] ?? t('ariaLabelFallback')\"\n :style=\"{ height: height }\"\n class=\"b-modal-base__container\"\n :class=\"modalConditionalClasses\"\n :open=\"initiallyOpen\"\n @animationend=\"closeModalAfterAnimation\"\n @keydown.esc=\"internalModalActionClose\"\n >\n <bento-focus-trap\n v-if=\"isOpen || initiallyOpen\"\n :id=\"modalId\"\n v-bento-click-outside-directive=\"closeModalOnClickOutside\"\n >\n <bento-button\n v-if=\"showCloseButton\"\n class=\"b-modal-base__close-button\"\n variant=\"tertiary\"\n type=\"button\"\n :style=\"customPaddingStyles\"\n @click=\"internalModalActionClose\"\n >\n <cross-icon :svg-title=\"t('close')\" />\n </bento-button>\n <template v-if=\"props.activePage\">\n <slot />\n </template>\n <bento-modal-page\n v-else\n :with-column-layout=\"withColumnLayout\"\n :size=\"size\"\n :custom-padding=\"customPadding\"\n :columns-size=\"columnsSize\"\n >\n <template v-if=\"hasSlot('default')\" #default>\n <slot></slot>\n </template>\n <template v-if=\"hasSlot('content-col-1')\" #content-col-1\n ><slot name=\"content-col-1\"></slot\n ></template>\n <template v-if=\"hasSlot('content-col-2')\" #content-col-2\n ><slot name=\"content-col-2\"></slot\n ></template>\n <template v-if=\"hasSlot('content')\" #content><slot name=\"content\"></slot></template>\n <template v-if=\"hasSlot('actions')\" #actions><slot name=\"actions\"></slot></template>\n </bento-modal-page>\n </bento-focus-trap>\n </dialog>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, defineComponent, onMounted, type PropType, provide, ref, toRefs, useSlots, watch } from 'vue';\n import { BentoModalColumnLayoutVariant, BentoModalRole, BentoModalSize } from '@/components/modal/modal.types';\n import { type BentoModalConfigData } from '@/components/modal/modal.internal.types';\n import { BentoButton, type BentoButtonActionsList } from '@/components/button';\n import { BentoFocusTrap } from '@/components/focus-trap';\n import { useAttributeRouting, useHasSlot } from '@/composables';\n import { useI18n } from '@/utils/ts/i18n';\n import { MODAL_DIALOG_ID_INJECTION_KEY } from '@/components/modal/components/base-modal/base-modal.keys';\n import { generateUid } from '@/utils/ts/generate-uid';\n import { BentoClickOutsideDirective as vBentoClickOutsideDirective } from '@/directives/click-outside';\n import messages from './messages.json';\n\n import { BentoModalPage } from '@/components/modal/components/modal-page';\n import CrossIcon from '@adyen/ui-assets-icons-16/vue/cross';\n\n import { MODAL_CONFIG_INJECTION_KEY } from '../../modal.keys';\n import {\n BentoDialogPageAnimation,\n type BentoDialogPageConfigData,\n type BentoDialogPageRegisterPage,\n DIALOG_PAGE_CONFIG_INJECTION_KEY,\n DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY,\n } from '@/internal';\n\n type MessageSchema = (typeof messages)['en-US'];\n const LOADING_BTN_CLOSE_AFTER_SUCCESS_DELAY_TIME = 500;\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const { getRootAttributes } = useAttributeRouting();\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n const modal = ref<HTMLDialogElement>(null);\n const isClosing = ref(false);\n const modalId = generateUid('modal');\n\n const emit = defineEmits([\"update:active-page\", \"close-modal\"]);\n\n const props = 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 * But you may change the color of 1-st action to red with 'critial' key\n * Not more than 3 action buttons can be provided\n * Or 2 action buttons and 1 Label for them\n *\n * Each object in the list should have a `title`, an `event` and\n * (optional) a Vue `icon` from the library `@adyen/ui-assets-icons-16`.\n *\n * `title`: Button's text.\n *\n * `event`: Event triggered when clicking the Button.\n *\n * `icon`: Vue Icon from the library `@adyen/ui-assets-icons-16`.\n *\n * ```\n * [{\n * title: 'Primary',2\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 * The id of the current active page\n * Should be the same id as the BentoModalPage to be displayed\n */\n activePage: {\n type: String,\n default: null,\n },\n\n /**\n * If a column layout is provided, it renders the respective left column width variant. This can be smaller than the second column, the same size as the second column or bigger than the second column.\n */\n columnsSize: {\n type: String as PropType<BentoModalColumnLayoutVariant>,\n default: BentoModalColumnLayoutVariant.SMALLER,\n },\n\n /**\n * If provided, manages the padding of the whole modal container\n */\n customPadding: { type: String, default: null },\n\n /**\n * If passed - sets first button color to red\n */\n destructiveActions: { type: Boolean, default: false },\n\n /**\n * Hides a cross icon on the right side of the title\n */\n hideCloseButton: { type: Boolean, required: true },\n\n /**\n * Sets the open attribute on the dialog element, use isOpen instead to toggle modal visbility.\n */\n initiallyOpen: { type: Boolean, default: false },\n\n /**\n * If set to true, it allows the modal to be closed by clicking outside of it\n */\n isDismissible: { type: Boolean, required: true },\n\n /**\n * Controls the modal's state from the outside. Set it to true to open the modal\n */\n isOpen: { type: Boolean, required: true },\n\n /**\n * Defines whether the modal will be an alert modal\n */\n modalRole: { type: String, default: BentoModalRole.DIALOG },\n\n /**\n * Sets the width of the modal\n */\n size: {\n type: String as PropType<BentoModalSize | `${BentoModalSize}`>,\n default: BentoModalSize.SMALL,\n },\n\n /**\n * If provided, renders the modal's content in a two-column layout an wth dividers separating its content\n */\n withColumnLayout: { type: Boolean, default: false },\n });\n\n const showCloseButton = computed(() => props.isDismissible && !props.hideCloseButton);\n\n const pageCustomPadding = ref(props.customPadding);\n\n const customPaddingStyles = computed(() => {\n if (!pageCustomPadding.value) {\n return {};\n }\n\n return { top: pageCustomPadding.value, right: pageCustomPadding.value };\n });\n\n const hasColumnLayout = computed(() => props.withColumnLayout && props.size === BentoModalSize.LARGE);\n\n const openModal = (): void => {\n modal.value.showModal();\n };\n\n const emitCloseEvent = (): void => {\n emit('close-modal');\n };\n\n // Handle closing and closing animation for dialog element\n const closeModalAfterAnimation = () => {\n if (isClosing.value && modal.value) {\n modal.value.close();\n if (previousPages.value[0]) {\n emit('update:active-page', previousPages.value[0]);\n }\n previousPages.value = [];\n isClosing.value = false;\n emitCloseEvent();\n }\n };\n\n const startCloseModalAnimation = () => {\n if (!modal.value.open) {\n return;\n }\n isClosing.value = true;\n };\n\n /**\n * If the user has pressed escape, clicked outside or clicked the close icon.\n * Needs to be called from outside, following the \"dialog.close()\" pattern,\n * when the closing event is triggered outside of the \"base-modal\"\n * component (e.g. from a closing action).\n */\n const internalModalActionClose = (event?: Event) => {\n if (event) {\n event.preventDefault();\n }\n if (!props.isDismissible && props.modalRole === BentoModalRole.DIALOG) {\n return;\n }\n startCloseModalAnimation();\n };\n\n const closeModalOnClickOutside = () => {\n if (props.isDismissible) {\n internalModalActionClose();\n }\n };\n\n const modalConditionalClasses = computed(() => ({\n [`b-modal-base__container--${props.size}`]: props.size,\n 'b-modal-base__container--hide': isClosing.value,\n 'b-modal-base__container--column-layout': hasColumnLayout.value,\n 'b-modal-base__container--animation': isAnimationActive.value,\n }));\n\n watch(\n () => [props.isOpen, modal.value],\n ([newIsOpen, newModalValue], [, oldModalValue]): void => {\n if (!newModalValue) {\n return;\n }\n\n const isFirstMutation = !oldModalValue;\n if (newIsOpen) {\n openModal();\n // add the first page to the array when the modal opens\n if (!previousPages.value.length) {\n previousPages.value.push(activePage.value);\n }\n } else if (!isFirstMutation) {\n startCloseModalAnimation();\n }\n }\n );\n\n // If the first button is a loading button then close the modal have 0.5 seconds\n // if the state is changed to 'success'.\n watch(\n () => props.actions,\n () => {\n if (props.actions?.[0]?.state === 'success') {\n setTimeout(startCloseModalAnimation, LOADING_BTN_CLOSE_AFTER_SUCCESS_DELAY_TIME);\n }\n },\n { deep: true }\n );\n\n onMounted(() => {\n if (props.isOpen && modal.value) {\n openModal();\n }\n });\n\n /**\n * Expose methods through its 'ref'\n */\n defineExpose({\n internalModalActionClose,\n });\n\n // Let's Children components know they are inside a Modal (dialog element)\n provide(MODAL_DIALOG_ID_INJECTION_KEY, modalId);\n\n // Modal pagination\n const { activePage, isOpen, size } = toRefs(props);\n const animation = ref(BentoDialogPageAnimation.TRANSITION_LEVEL_DEEPER);\n\n const pages = ref<Array<string>>([]);\n const previousPages = ref([]);\n\n const updatePage = page => emit('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 if (pageId) {\n pages.value.push(pageId);\n }\n\n return { unregisterPage: unregisterPage(pageId) };\n };\n\n const height = ref('');\n const isAnimationActive = ref(false);\n\n provide<BentoModalConfigData>(MODAL_CONFIG_INJECTION_KEY, {\n activePage,\n height,\n isAnimationActive,\n pageCustomPadding,\n showCloseButton,\n size,\n });\n\n provide<BentoDialogPageConfigData>(DIALOG_PAGE_CONFIG_INJECTION_KEY, {\n activePage,\n animation,\n isOpen,\n pages,\n previousPages,\n updatePage,\n });\n\n provide(DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY, registerPage);\n</script>\n\n<script lang=\"ts\">\n /**\n * Dialog container. It creates a dialog HTML element for the modal to use.\n *\n * @example\n * import BaseModal from './components/base-modal/base-modal.vue';\n *\n * export default {\n * components: { BaseModal },\n * template: `\n * <base-modal\n * :hide-close-button=\"true\"\n * :is-dismissible=\"false\"\n * :is-open=\"isOpen\"\n * @close-modal=\"isOpen = false\"\n * >\n * <template #content-col-1>\n * // Content on the left side column\n * </template>\n *\n * <template #content-col-2>\n * // Content on the right side column\n * </template>\n *\n * <template v-if=\"actions\" #actions>\n * <footer-actions :actions=\"actions\" />\n * </template>\n * </base-modal>\n * `,\n * setup() {\n * const isOpen = ref(true)\n * const footerActions = [{\n * title: 'Primary action',\n * event: () => { ... }\n * }]\n * }\n * }\n */\n export default defineComponent({\n i18n: { messages },\n name: 'base-modal',\n inheritAttrs: false,\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./base-modal.scss\" />\n"],"names":["useAttributeRouting","attrs","useAttrs","filterAttrs","attrsArg","shouldInclude","key","overrideAttrs","BentoModalVariant","BentoModalVariant2","BentoModalVariantMapping","BentoModalVariantMapping2","BentoModalSize","BentoModalSize2","BentoModalColumnLayoutVariant","BentoModalColumnLayoutVariant2","BentoModalRole","BentoModalRole2","BentoModalDialogType","BentoModalDialogType2","BentoModalEvent","BentoModalEvent2","MODAL_CONFIG_INJECTION_KEY","__default__$1","defineComponent","CLOSE_BUTTON_ICON_WIDTH","slots","useSlots","hasSlot","useHasSlot","page","ref","modalPageConditionalClasses","computed","props","modalContentConditionalClasses","customPaddingStyles","xPadding","content","hasColumnLayout","size","computedColumnWidth","activePage","height","isAnimationActive","pageCustomPadding","showCloseButton","inject","isCurrentPage","pageElementObserver","watch","value","oldValue","nextTick","observeSizeOfElement","pageHeight","onUnmounted","__default__","messages","LOADING_BTN_CLOSE_AFTER_SUCCESS_DELAY_TIME","t","useI18n","getRootAttributes","modal","isClosing","modalId","generateUid","openModal","emitCloseEvent","emit","closeModalAfterAnimation","previousPages","startCloseModalAnimation","internalModalActionClose","event","closeModalOnClickOutside","modalConditionalClasses","newIsOpen","newModalValue","oldModalValue","onMounted","expose","provide","MODAL_DIALOG_ID_INJECTION_KEY","isOpen","toRefs","animation","BentoDialogPageAnimation","pages","updatePage","unregisterPage","pageIdToRemove","pageId","registerPage","DIALOG_PAGE_CONFIG_INJECTION_KEY","DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY"],"mappings":";;;;;;;;;;;;;;;;;AAcO,MAAAA,KAAA,MAAA;AACH,QAAAC,IAAAC,EAAA,GAEAC,IAAA,CAAAC,GAAAC,MAAA,OAAA,YAAA,OAAA,QAAAD,CAAA,EAAA,OAAA,CAAA,CAAAE,CAAA,MAAAD,EAAAC,CAAA,CAAA,CAAA;AAGA,SAAA;AAAA,IAAO,mBAAA,CAAAC,MAAAJ,EAAAI,KAAAN,GAAA,CAAAK,MAAAA,EAAA,WAAA,OAAA,CAAA;AAAA,IACmG,mBAAA,CAAAC,MAAAJ,EAAAI,KAAAN,GAAA,CAAAK,MAAA,CAAAA,EAAA,WAAA,OAAA,CAAA;AAAA,EACC;AAE/G;ACrBO,IAAAE,KAAA,kBAAAC,OACHA,EAAA,UAAA,WACAA,EAAA,SAAA,UAFQA,IAAAD,MAAA,CAAA,CAAA,GAQLE,KAAA,kBAAAC,OACHA,EAAA,UAAA,qBACAA,EAAA,SAAA,oBAFQA,IAAAD,M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EAAAC,IAAAlB,CAAA;AAGA,UAAA,EAAA,YAAAvB,GAAA,QAAA0C,GAAA,MAAA5C,EAAA,IAAA6C,GAAAnD,CAAA,GACAoD,IAAAvD,EAAAwD,GAAA,uBAAA,GAEAC,IAAAzD,EAAA,CAAA,CAAA,GACAwC,IAAAxC,EAAA,CAAA,CAAA,GAEA0D,IAAA,CAAA3D,MAAAuC,EAAA,sBAAAvC,CAAA,GAGA4D,IAAA,CAAAC,MAAA,MAAA;AACI,MAAAH,EAAA,QAAAA,EAAA,OAAA,OAAA,CAAAI,MAAAA,MAAAD,CAAA;AAAA,IAAqE,GAIzEE,IAAA,CAAAD,OACIA,KACIJ,EAAA,MAAA,KAAAI,CAAA,GAGJ,EAAA,gBAAAF,EAAAE,CAAA,EAAA,IAGJjD,IAAAZ,EAAA,EAAA,GACAa,IAAAb,EAAA,EAAA;AAEA,WAAAmD,EAAA5D,GAAA;AAAA,MAA0D,YAAAoB;AAAA,MACtD,QAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,iBAAAC;AAAA,MACA,MAAAN;AAAA,IACA,CAAA,GAGJ0C,EAAAY,IAAA;AAAA,MAAqE,YAAApD;AAAA,MACjE,WAAA4C;AAAA,MACA,QAAAF;AAAA,MACA,OAAAI;AAAA,MACA,eAAAjB;AAAA,MACA,YAAAkB;AAAA,IACA,CAAA,GAGJP,EAAAa,IAAAF,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"base-modal.CGHkdr9t.js","sources":["../../src/composables/use-attribute-routing/use-attribute-routing.ts","../../src/components/modal/modal.types.ts","../../src/components/modal/modal.keys.ts","../../src/components/modal/components/modal-page/modal-page.vue","../../src/components/modal/components/base-modal/base-modal.vue"],"sourcesContent":["import { type SetupContext, useAttrs } from 'vue';\n\nexport type Attributes = SetupContext['attrs'];\n\nexport interface AttributeRouting {\n getAriaAttributes: (attrs?: Attributes) => Attributes;\n getRootAttributes: (attrs?: Attributes) => Attributes;\n}\n\n/**\n * Routes ARIA attributes away from a component root to its semantic element.\n *\n * @returns Functions that return ARIA and root attribute groups.\n */\nexport const useAttributeRouting = (): AttributeRouting => {\n const attrs = useAttrs();\n\n const filterAttrs = (attrsArg: Attributes, shouldInclude: (key: string) => boolean): Attributes =>\n Object.fromEntries(Object.entries(attrsArg).filter(([key]) => shouldInclude(key)));\n\n return {\n getAriaAttributes: overrideAttrs => filterAttrs(overrideAttrs ?? attrs, key => key.startsWith('aria-')),\n getRootAttributes: overrideAttrs => filterAttrs(overrideAttrs ?? attrs, key => !key.startsWith('aria-')),\n };\n};\n","/**\n * @deprecated Since v2.0.0. Use string literal instead.\n */\nexport enum BentoModalVariant {\n DEFAULT = 'default',\n DIALOG = 'dialog',\n}\n\n/**\n * @deprecated Since v2.0.0. Use string literal instead.\n */\nexport enum BentoModalVariantMapping {\n DEFAULT = 'BentoModalDefault',\n DIALOG = 'BentoModalDialog',\n}\n\n/**\n * @deprecated Since v2.0.0. Use string literal instead.\n */\nexport enum BentoModalSize {\n SMALL = 'small',\n MEDIUM = 'medium',\n LARGE = 'large',\n}\n\n/**\n * @deprecated Since v2.0.0. Use string literal instead.\n */\nexport enum BentoModalColumnLayoutVariant {\n SMALLER = 'smaller',\n EQUAL = 'equal',\n BIGGER = 'bigger',\n}\n\nexport enum BentoModalRole {\n DIALOG = 'dialog',\n ALERT_DIALOG = 'alertdialog',\n}\n\n/**\n * @deprecated Since v2.0.0. Use string literal instead.\n */\nexport enum BentoModalDialogType {\n CONFIRMATION = 'confirmation',\n DESTRUCTIVE = 'destructive',\n INFO = 'info',\n ACKNOWLEDGEMENT = 'acknowledgement',\n}\n\nexport enum BentoModalEvent {\n CLOSE_MODAL = 'close-modal',\n}\n","export const MODAL_CONFIG_INJECTION_KEY = Symbol('modal config data injection key');\n","<template>\n <dialog-page\n ref=\"page\"\n class=\"b-modal-page\"\n :class=\"modalPageConditionalClasses\"\n :page-id=\"pageId\"\n :always-show-border=\"hasColumnLayout\"\n :back-button-styling=\"customPaddingStyles?.backButton\"\n :previous-page=\"previousPage\"\n @animationend=\"isAnimationActive = false\"\n >\n <template v-if=\"hasSlot('default') || showCloseButton\" #header>\n <div class=\"b-modal-page__header-container\" :style=\"customPaddingStyles.header\">\n <div class=\"b-modal-page__header\">\n <bento-typography class=\"b-modal-page__title\" el=\"span\" variant=\"title\" stronger>\n <slot v-if=\"hasSlot('default')\" />\n </bento-typography>\n </div>\n </div>\n </template>\n\n <template #content>\n <div\n class=\"b-modal-page__content\"\n :class=\"modalContentConditionalClasses\"\n :style=\"customPaddingStyles.content\"\n >\n <bento-typography\n v-if=\"hasSlot('content') || (hasSlot('content-col-1') && hasSlot('content-col-2'))\"\n el=\"div\"\n >\n <grid-layout\n v-if=\"hasColumnLayout\"\n :column-width=\"computedColumnWidth\"\n :container-type=\"GridLayoutContainerType.NORMAL\"\n no-gap\n class=\"b-modal-page__grid\"\n >\n <template #col-1><slot name=\"content-col-1\"></slot></template>\n <template #col-2><slot name=\"content-col-2\"></slot></template>\n </grid-layout>\n <slot v-else name=\"content\" />\n </bento-typography>\n </div>\n </template>\n <template v-if=\"hasSlot('actions')\" #footer>\n <div class=\"b-modal-page__actions-container\" :style=\"customPaddingStyles.actions\">\n <div aria-label=\"modal actions\" class=\"b-modal-page__actions\">\n <slot name=\"actions\" />\n </div>\n </div>\n </template>\n <template v-else-if=\"actions && actions.length > 0\" #footer>\n <div class=\"b-modal-page__actions-container\" :style=\"customPaddingStyles.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 { computed, defineComponent, inject, nextTick, onUnmounted, ref, useSlots, watch } from 'vue';\n import { BentoModalColumnLayoutVariant, BentoModalSize } from '@/components/modal/modal.types';\n import { type BentoModalConfigData } from '@/components/modal/modal.internal.types';\n import { BentoTypography } from '@/components/typography';\n import { GridLayout, GridLayoutContainerType } from '@/internal';\n import { useHasSlot } from '@/composables';\n\n import { FooterActions } from '@/components/internal/footer-actions';\n\n import DialogPage from '@/internal/dialog-page/dialog-page.vue';\n import { MODAL_CONFIG_INJECTION_KEY } from '../../modal.keys';\n import { observeSizeOfElement } from '@/utils/ts/resize';\n import type { BentoModalPageProps } from './modal-page.types';\n\n const CLOSE_BUTTON_ICON_WIDTH = 26;\n\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n const page = ref<InstanceType<typeof DialogPage>>(null);\n\n const props = defineProps({\n actions: { default: null },\n actionsLabel: { default: null },\n columnsSize: { default: BentoModalColumnLayoutVariant.SMALLER },\n customPadding: { default: null },\n destructiveActions: { type: Boolean, default: false },\n withColumnLayout: { type: Boolean, default: false },\n pageId: { default: undefined },\n previousPage: { default: undefined }\n});\n\n const modalPageConditionalClasses = computed(() => ({\n 'b-modal-page--custom-padding': props.customPadding,\n }));\n\n const modalContentConditionalClasses = computed(() => ({\n 'b-modal-page__content--with-header': hasSlot('default'),\n 'b-modal-page__content--with-actions': hasSlot('actions') || props.actions?.length,\n }));\n\n // Setting custom padding styles\n const customPaddingStyles = computed(() => {\n if (!props.customPadding) {\n return {};\n }\n\n const xPadding = {\n paddingLeft: props.customPadding,\n paddingRight: props.customPadding,\n };\n\n const content = { ...xPadding, paddingTop: undefined, paddingBottom: undefined };\n\n if (!hasSlot('default')) {\n content.paddingTop = props.customPadding;\n }\n\n if (!hasSlot('actions')) {\n content.paddingBottom = props.customPadding;\n }\n\n return {\n header: {\n ...xPadding,\n paddingTop: props.customPadding,\n paddingRight: `${parseInt(props.customPadding, 10) + CLOSE_BUTTON_ICON_WIDTH}px`,\n flex: 1,\n },\n content,\n actions: { ...xPadding, paddingBottom: props.customPadding },\n backButton: { top: props.customPadding, paddingLeft: props.customPadding },\n };\n });\n\n // Column layout styles\n const hasColumnLayout = computed(() => props.withColumnLayout && size.value === BentoModalSize.LARGE);\n\n const computedColumnWidth = computed(() => {\n if (props.columnsSize === BentoModalColumnLayoutVariant.SMALLER) {\n return [\n { small: 4, medium: 4, large: 4 },\n { small: 8, medium: 8, large: 8 },\n ];\n }\n if (props.columnsSize === BentoModalColumnLayoutVariant.BIGGER) {\n return [\n { small: 8, medium: 8, large: 8 },\n { small: 4, medium: 4, large: 4 },\n ];\n }\n return [\n { small: 6, medium: 6, large: 6 },\n { small: 6, medium: 6, large: 6 },\n ];\n });\n\n // Register page to parent component and inject data from parent component\n const { activePage, height, isAnimationActive, pageCustomPadding, showCloseButton, size } =\n inject<BentoModalConfigData>(MODAL_CONFIG_INJECTION_KEY);\n\n const isCurrentPage = computed(() => activePage.value === props.pageId || !activePage.value);\n\n // Animation\n // Set resize observer on mount of update the height of the dialog on resize\n let pageElementObserver: ResizeObserver | null = null;\n\n // Watching activePage changes to set the height of the page and set isAnimationActive\n watch(\n () => activePage.value,\n async (value, oldValue) => {\n if (isCurrentPage.value) {\n await nextTick();\n height.value = `${page.value?.$el?.clientHeight}px`;\n pageCustomPadding.value = props.customPadding;\n // only set isAnimationActive to true if its going from two different pages and not from null to the first page\n isAnimationActive.value = oldValue !== undefined;\n\n pageElementObserver = observeSizeOfElement(page.value, () => {\n const pageHeight = `${page.value?.$el?.clientHeight}px`;\n if (pageHeight && pageHeight !== height.value) {\n height.value = pageHeight;\n }\n });\n }\n },\n { immediate: true }\n );\n\n // Disconnect observer on unmounting the page\n onUnmounted(() => {\n pageElementObserver?.disconnect();\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * ModalPage is used to render different pages of the Modal component\n *\n * @example\n * import { BentoModal, BentoModalPage } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoModal, BentoModalPage },\n * template: `\n * <bento-modal active-page='page1' :is-open='true'>\n * <bento-modal-page\n * pageId='page1'\n * actions-label='Move to next page'\n * :actions=\"[\n * {\n * title: 'Next page',\n * event: () => {\n * activePage.value = 'page2';\n * },\n * }]\">\n * Page 1\n * <template #content>\n * Page 1 content\n * </template>\n * </bento-modal-page>\n * <bento-modal-page\n * pageId='page2'\n * :actions=\"[\n * {\n * title: 'Save',\n * event: () => {},\n * }]\">\n * Page 2\n * <template #content>\n * Page 2 content\n * </template>\n * </bento-modal-page>\n * </bento-modal>\n * `\n * }\n */\n export default defineComponent({});\n</script>\n\n<style lang=\"scss\" scoped src=\"./modal-page.scss\" />\n","<template>\n <div v-bind=\"getRootAttributes($attrs)\" class=\"b-modal-base\">\n <dialog\n ref=\"modal\"\n :role=\"modalRole\"\n :aria-label=\"$attrs?.['aria-label'] ?? t('ariaLabelFallback')\"\n :style=\"{ height: height }\"\n class=\"b-modal-base__container\"\n :class=\"modalConditionalClasses\"\n :open=\"initiallyOpen\"\n @animationend=\"closeModalAfterAnimation\"\n @keydown.esc=\"internalModalActionClose\"\n >\n <bento-focus-trap\n v-if=\"isOpen || initiallyOpen\"\n :id=\"modalId\"\n v-bento-click-outside-directive=\"closeModalOnClickOutside\"\n >\n <bento-button\n v-if=\"showCloseButton\"\n class=\"b-modal-base__close-button\"\n variant=\"tertiary\"\n type=\"button\"\n :style=\"customPaddingStyles\"\n @click=\"internalModalActionClose\"\n >\n <cross-icon :svg-title=\"t('close')\" />\n </bento-button>\n <template v-if=\"props.activePage\">\n <slot />\n </template>\n <bento-modal-page\n v-else\n :with-column-layout=\"withColumnLayout\"\n :size=\"size\"\n :custom-padding=\"customPadding\"\n :columns-size=\"columnsSize\"\n >\n <template v-if=\"hasSlot('default')\" #default>\n <slot></slot>\n </template>\n <template v-if=\"hasSlot('content-col-1')\" #content-col-1\n ><slot name=\"content-col-1\"></slot\n ></template>\n <template v-if=\"hasSlot('content-col-2')\" #content-col-2\n ><slot name=\"content-col-2\"></slot\n ></template>\n <template v-if=\"hasSlot('content')\" #content><slot name=\"content\"></slot></template>\n <template v-if=\"hasSlot('actions')\" #actions><slot name=\"actions\"></slot></template>\n </bento-modal-page>\n </bento-focus-trap>\n </dialog>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, defineComponent, onMounted, type PropType, provide, ref, toRefs, useSlots, watch } from 'vue';\n import { BentoModalColumnLayoutVariant, BentoModalRole, BentoModalSize } from '@/components/modal/modal.types';\n import { type BentoModalConfigData } from '@/components/modal/modal.internal.types';\n import { BentoButton, type BentoButtonActionsList } from '@/components/button';\n import { BentoFocusTrap } from '@/components/focus-trap';\n import { useAttributeRouting, useHasSlot } from '@/composables';\n import { useI18n } from '@/utils/ts/i18n';\n import { MODAL_DIALOG_ID_INJECTION_KEY } from '@/components/modal/components/base-modal/base-modal.keys';\n import { generateUid } from '@/utils/ts/generate-uid';\n import { BentoClickOutsideDirective as vBentoClickOutsideDirective } from '@/directives/click-outside';\n import messages from './messages.json';\n\n import { BentoModalPage } from '@/components/modal/components/modal-page';\n import CrossIcon from '@adyen/ui-assets-icons-16/vue/cross';\n\n import { MODAL_CONFIG_INJECTION_KEY } from '../../modal.keys';\n import {\n BentoDialogPageAnimation,\n type BentoDialogPageConfigData,\n type BentoDialogPageRegisterPage,\n DIALOG_PAGE_CONFIG_INJECTION_KEY,\n DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY,\n } from '@/internal';\n\n type MessageSchema = (typeof messages)['en-US'];\n const LOADING_BTN_CLOSE_AFTER_SUCCESS_DELAY_TIME = 500;\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const { getRootAttributes } = useAttributeRouting();\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n const modal = ref<HTMLDialogElement>(null);\n const isClosing = ref(false);\n const modalId = generateUid('modal');\n\n const emit = defineEmits([\"update:active-page\", \"close-modal\"]);\n\n const props = 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 * But you may change the color of 1-st action to red with 'critial' key\n * Not more than 3 action buttons can be provided\n * Or 2 action buttons and 1 Label for them\n *\n * Each object in the list should have a `title`, an `event` and\n * (optional) a Vue `icon` from the library `@adyen/ui-assets-icons-16`.\n *\n * `title`: Button's text.\n *\n * `event`: Event triggered when clicking the Button.\n *\n * `icon`: Vue Icon from the library `@adyen/ui-assets-icons-16`.\n *\n * ```\n * [{\n * title: 'Primary',2\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 * The id of the current active page\n * Should be the same id as the BentoModalPage to be displayed\n */\n activePage: {\n type: String,\n default: null,\n },\n\n /**\n * If a column layout is provided, it renders the respective left column width variant. This can be smaller than the second column, the same size as the second column or bigger than the second column.\n */\n columnsSize: {\n type: String as PropType<BentoModalColumnLayoutVariant>,\n default: BentoModalColumnLayoutVariant.SMALLER,\n },\n\n /**\n * If provided, manages the padding of the whole modal container\n */\n customPadding: { type: String, default: null },\n\n /**\n * If passed - sets first button color to red\n */\n destructiveActions: { type: Boolean, default: false },\n\n /**\n * Hides a cross icon on the right side of the title\n */\n hideCloseButton: { type: Boolean, required: true },\n\n /**\n * Sets the open attribute on the dialog element, use isOpen instead to toggle modal visbility.\n */\n initiallyOpen: { type: Boolean, default: false },\n\n /**\n * If set to true, it allows the modal to be closed by clicking outside of it\n */\n isDismissible: { type: Boolean, required: true },\n\n /**\n * Controls the modal's state from the outside. Set it to true to open the modal\n */\n isOpen: { type: Boolean, required: true },\n\n /**\n * Defines whether the modal will be an alert modal\n */\n modalRole: { type: String, default: BentoModalRole.DIALOG },\n\n /**\n * Sets the width of the modal\n */\n size: {\n type: String as PropType<BentoModalSize | `${BentoModalSize}`>,\n default: BentoModalSize.SMALL,\n },\n\n /**\n * If provided, renders the modal's content in a two-column layout an wth dividers separating its content\n */\n withColumnLayout: { type: Boolean, default: false },\n });\n\n const showCloseButton = computed(() => props.isDismissible && !props.hideCloseButton);\n\n const pageCustomPadding = ref(props.customPadding);\n\n const customPaddingStyles = computed(() => {\n if (!pageCustomPadding.value) {\n return {};\n }\n\n return { top: pageCustomPadding.value, right: pageCustomPadding.value };\n });\n\n const hasColumnLayout = computed(() => props.withColumnLayout && props.size === BentoModalSize.LARGE);\n\n const openModal = (): void => {\n modal.value.showModal();\n };\n\n const emitCloseEvent = (): void => {\n emit('close-modal');\n };\n\n // Handle closing and closing animation for dialog element\n const closeModalAfterAnimation = () => {\n if (isClosing.value && modal.value) {\n modal.value.close();\n if (previousPages.value[0]) {\n emit('update:active-page', previousPages.value[0]);\n }\n previousPages.value = [];\n isClosing.value = false;\n emitCloseEvent();\n }\n };\n\n const startCloseModalAnimation = () => {\n if (!modal.value.open) {\n return;\n }\n isClosing.value = true;\n };\n\n /**\n * If the user has pressed escape, clicked outside or clicked the close icon.\n * Needs to be called from outside, following the \"dialog.close()\" pattern,\n * when the closing event is triggered outside of the \"base-modal\"\n * component (e.g. from a closing action).\n */\n const internalModalActionClose = (event?: Event) => {\n if (event) {\n event.preventDefault();\n }\n if (!props.isDismissible && props.modalRole === BentoModalRole.DIALOG) {\n return;\n }\n startCloseModalAnimation();\n };\n\n const closeModalOnClickOutside = () => {\n if (props.isDismissible) {\n internalModalActionClose();\n }\n };\n\n const modalConditionalClasses = computed(() => ({\n [`b-modal-base__container--${props.size}`]: props.size,\n 'b-modal-base__container--hide': isClosing.value,\n 'b-modal-base__container--column-layout': hasColumnLayout.value,\n 'b-modal-base__container--animation': isAnimationActive.value,\n }));\n\n watch(\n () => [props.isOpen, modal.value],\n ([newIsOpen, newModalValue], [, oldModalValue]): void => {\n if (!newModalValue) {\n return;\n }\n\n const isFirstMutation = !oldModalValue;\n if (newIsOpen) {\n openModal();\n // add the first page to the array when the modal opens\n if (!previousPages.value.length) {\n previousPages.value.push(activePage.value);\n }\n } else if (!isFirstMutation) {\n startCloseModalAnimation();\n }\n }\n );\n\n // If the first button is a loading button then close the modal have 0.5 seconds\n // if the state is changed to 'success'.\n watch(\n () => props.actions,\n () => {\n if (props.actions?.[0]?.state === 'success') {\n setTimeout(startCloseModalAnimation, LOADING_BTN_CLOSE_AFTER_SUCCESS_DELAY_TIME);\n }\n },\n { deep: true }\n );\n\n onMounted(() => {\n if (props.isOpen && modal.value) {\n openModal();\n }\n });\n\n /**\n * Expose methods through its 'ref'\n */\n defineExpose({\n internalModalActionClose,\n });\n\n // Let's Children components know they are inside a Modal (dialog element)\n provide(MODAL_DIALOG_ID_INJECTION_KEY, modalId);\n\n // Modal pagination\n const { activePage, isOpen, size } = toRefs(props);\n const animation = ref(BentoDialogPageAnimation.TRANSITION_LEVEL_DEEPER);\n\n const pages = ref<Array<string>>([]);\n const previousPages = ref([]);\n\n const updatePage = page => emit('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 if (pageId) {\n pages.value.push(pageId);\n }\n\n return { unregisterPage: unregisterPage(pageId) };\n };\n\n const height = ref('');\n const isAnimationActive = ref(false);\n\n provide<BentoModalConfigData>(MODAL_CONFIG_INJECTION_KEY, {\n activePage,\n height,\n isAnimationActive,\n pageCustomPadding,\n showCloseButton,\n size,\n });\n\n provide<BentoDialogPageConfigData>(DIALOG_PAGE_CONFIG_INJECTION_KEY, {\n activePage,\n animation,\n isOpen,\n pages,\n previousPages,\n updatePage,\n });\n\n provide(DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY, registerPage);\n</script>\n\n<script lang=\"ts\">\n /**\n * Dialog container. It creates a dialog HTML element for the modal to use.\n *\n * @example\n * import BaseModal from './components/base-modal/base-modal.vue';\n *\n * export default {\n * components: { BaseModal },\n * template: `\n * <base-modal\n * :hide-close-button=\"true\"\n * :is-dismissible=\"false\"\n * :is-open=\"isOpen\"\n * @close-modal=\"isOpen = false\"\n * >\n * <template #content-col-1>\n * // Content on the left side column\n * </template>\n *\n * <template #content-col-2>\n * // Content on the right side column\n * </template>\n *\n * <template v-if=\"actions\" #actions>\n * <footer-actions :actions=\"actions\" />\n * </template>\n * </base-modal>\n * `,\n * setup() {\n * const isOpen = ref(true)\n * const footerActions = [{\n * title: 'Primary action',\n * event: () => { ... }\n * }]\n * }\n * }\n */\n export default defineComponent({\n i18n: { messages },\n name: 'base-modal',\n inheritAttrs: false,\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./base-modal.scss\" />\n"],"names":["useAttributeRouting","attrs","useAttrs","filterAttrs","attrsArg","shouldInclude","key","overrideAttrs","BentoModalVariant","BentoModalVariant2","BentoModalVariantMapping","BentoModalVariantMapping2","BentoModalSize","BentoModalSize2","BentoModalColumnLayoutVariant","BentoModalColumnLayoutVariant2","BentoModalRole","BentoModalRole2","BentoModalDialogType","BentoModalDialogType2","BentoModalEvent","BentoModalEvent2","MODAL_CONFIG_INJECTION_KEY","__default__$1","defineComponent","CLOSE_BUTTON_ICON_WIDTH","slots","useSlots","hasSlot","useHasSlot","page","ref","modalPageConditionalClasses","computed","props","modalContentConditionalClasses","customPaddingStyles","xPadding","content","hasColumnLayout","size","computedColumnWidth","activePage","height","isAnimationActive","pageCustomPadding","showCloseButton","inject","isCurrentPage","pageElementObserver","watch","value","oldValue","nextTick","observeSizeOfElement","pageHeight","onUnmounted","__default__","messages","LOADING_BTN_CLOSE_AFTER_SUCCESS_DELAY_TIME","t","useI18n","getRootAttributes","modal","isClosing","modalId","generateUid","openModal","emitCloseEvent","emit","closeModalAfterAnimation","previousPages","startCloseModalAnimation","internalModalActionClose","event","closeModalOnClickOutside","modalConditionalClasses","newIsOpen","newModalValue","oldModalValue","onMounted","expose","provide","MODAL_DIALOG_ID_INJECTION_KEY","isOpen","toRefs","animation","BentoDialogPageAnimation","pages","updatePage","unregisterPage","pageIdToRemove","pageId","registerPage","DIALOG_PAGE_CONFIG_INJECTION_KEY","DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY"],"mappings":";;;;;;;;;;;;;;;;;AAcO,MAAAA,KAAA,MAAA;AACH,QAAAC,IAAAC,EAAA,GAEAC,IAAA,CAAAC,GAAAC,M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YAAApD;AAAA,MACjE,WAAA4C;AAAA,MACA,QAAAF;AAAA,MACA,OAAAI;AAAA,MACA,eAAAjB;AAAA,MACA,YAAAkB;AAAA,IACA,CAAA,GAGJP,EAAAa,IAAAF,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/chunks/{button-actions-with-menu.BY394ars.js → button-actions-with-menu.CjTaZoYW.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref as _, watch as m, nextTick as v, defineComponent as h, toRef as b, computed as f, provide as A } from "vue";
|
|
2
|
-
import { M as w, d as y, f as B, B as C } from "./button-actions.
|
|
2
|
+
import { M as w, d as y, f as B, B as C } from "./button-actions.sLmpjWGK.js";
|
|
3
3
|
import { b as M } from "./index.CL3TXc0a.js";
|
|
4
4
|
import { n as T } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
5
5
|
import "../assets/button-actions-with-menu.css";
|
|
@@ -74,4 +74,4 @@ const S = k.exports;
|
|
|
74
74
|
export {
|
|
75
75
|
S as B
|
|
76
76
|
};
|
|
77
|
-
//# sourceMappingURL=button-actions-with-menu.
|
|
77
|
+
//# sourceMappingURL=button-actions-with-menu.CjTaZoYW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-actions-with-menu.BY394ars.js","sources":["../../src/components/internal/button-actions-with-menu/composables/use-responsive-actions.ts","../../src/components/internal/button-actions-with-menu/button-actions-with-menu.vue"],"sourcesContent":["import { useWindowSize } from '@vueuse/core';\nimport { nextTick, ref, type Ref, watch } from 'vue';\n\ninterface UseResponsiveActionsProps {\n breakpoint?: number;\n container: Ref<HTMLElement>;\n defaultActionsCount: Ref<number>;\n offset?: Ref<HTMLElement>;\n}\n\nexport const useResponsiveActions = (props: UseResponsiveActionsProps) => {\n const { breakpoint, container, defaultActionsCount, offset } = props;\n\n const { width: windowWidth } = useWindowSize();\n\n const displayedActionsCount = ref(defaultActionsCount.value);\n\n const AVERAGE_BUTTON_WIDTH = 150; // button size + gap\n\n const showActions = async () => {\n await nextTick();\n\n const availableSpace = container.value.clientWidth;\n const totalActionWidth =\n AVERAGE_BUTTON_WIDTH * displayedActionsCount.value +\n (offset?.value?.offsetWidth ?? 0) +\n AVERAGE_BUTTON_WIDTH;\n\n // Only add actions if there's enough space and we haven't reached max\n if (availableSpace >= totalActionWidth && displayedActionsCount.value < defaultActionsCount.value) {\n displayedActionsCount.value += 1;\n\n await showActions(); // keep trying to show more\n }\n };\n\n const hideActions = async () => {\n await nextTick();\n\n const availableSpace = container.value.clientWidth;\n const totalActionWidth = AVERAGE_BUTTON_WIDTH * displayedActionsCount.value + (offset?.value?.offsetWidth ?? 0);\n\n // Hide actions if they overflow the container\n if (availableSpace < totalActionWidth && displayedActionsCount.value > 0) {\n displayedActionsCount.value -= 1;\n\n await hideActions(); // keep hiding until it fits\n }\n };\n\n watch([windowWidth, container], async ([newWidth, containerEl], [oldWidth]) => {\n if (!containerEl || !defaultActionsCount || newWidth > breakpoint) {\n return;\n }\n\n await nextTick();\n\n const isIncreasing = newWidth > oldWidth;\n\n if (isIncreasing) {\n await showActions();\n } else {\n await hideActions();\n }\n });\n\n watch(defaultActionsCount, async count => {\n displayedActionsCount.value = count;\n\n if (breakpoint && windowWidth.value <= breakpoint && container.value) {\n await hideActions();\n }\n });\n\n return {\n displayedActionsCount,\n };\n};\n","<template>\n <div class=\"b-button-actions-with-menu\">\n <div\n ref=\"buttonActionsWithMenu\"\n role=\"group\"\n class=\"b-button-actions-with-menu__container-wrapper\"\n :class=\"conditionalClasses\"\n >\n <bento-button-actions :actions=\"computedActions\" :inverse=\"inverse\" :layout=\"actionsLayout\" />\n <bento-menu\n v-if=\"computedMenuActions.length\"\n ref=\"menu\"\n :data=\"computedMenuActions\"\n :menu-position=\"menuPosition\"\n />\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoButtonActions } from '@/components/button';\n import { type BentoMenuItem } from '@/components/menu/components/menu-item/menu-item.types';\n import { MENU_INVERSE_INJECTION_KEY } from '@/components/menu/menu.keys';\n import BentoMenu from '@/components/menu/menu.vue';\n import { computed, provide, ref, toRef } from 'vue';\n import { BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY } from './button-actions-with-menu.keys';\n import { type ButtonActionsWithMenuProps } from './button-actions-with-menu.types';\n import { useResponsiveActions } from './composables/use-responsive-actions';\n\n const props = defineProps({\n actions: null,\n actionsLayout: { default: 'buttons-end' },\n disableResponsiveBehavior: { type: Boolean, default: false },\n displayedActions: { default: undefined },\n inverse: { type: Boolean, default: false },\n hideDisplayedActionsBreakpoint: { default: 0 },\n menuPosition: { default: 'bottom-start' }\n});\n\n const inverseRef = toRef(props, 'inverse');\n const buttonActionsWithMenu = ref<HTMLDivElement>(null);\n const menu = ref(null);\n const stackButtons = ref(false);\n\n const computedActions = computed(() => {\n const displayedActionsLimit = props.hideDisplayedActionsBreakpoint\n ? displayedActionsCount.value\n : props.displayedActions;\n\n return props.actions.slice(0, displayedActionsLimit);\n });\n const computedMenuRef = computed(() => menu?.value?.$el);\n\n const { displayedActionsCount } = useResponsiveActions({\n breakpoint: props.hideDisplayedActionsBreakpoint,\n container: buttonActionsWithMenu,\n defaultActionsCount: toRef(props, 'displayedActions'),\n offset: computedMenuRef,\n });\n\n provide(MENU_INVERSE_INJECTION_KEY, inverseRef);\n\n if (!props.disableResponsiveBehavior) {\n provide(BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY, { buttonActionsWithMenu, menu, stackButtons });\n }\n\n const conditionalClasses = computed(() => ({\n [`b-button-actions-with-menu__container-wrapper--buttons-end`]: props.actionsLayout === 'buttons-end',\n [`b-button-actions-with-menu__container-wrapper--buttons-start`]: props.actionsLayout === 'buttons-start',\n [`b-button-actions-with-menu__container-wrapper--stacked-buttons`]: stackButtons.value,\n }));\n\n const computedMenuActions = computed(() => {\n if (displayedActionsCount.value === undefined || displayedActionsCount.value >= props.actions.length) {\n return [];\n }\n\n const actionsToProcess = props.actions.slice(displayedActionsCount.value, props.actions.length);\n\n return actionsToProcess.flatMap<BentoMenuItem>(action => {\n if (!action.data) {\n return {\n text: action.title,\n handler: () => action.event?.({} as Event),\n icon: action.icon,\n critical: action.critical,\n disabled: action.disabled,\n };\n }\n\n return action.data;\n });\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * An internal button actions component with the option to display some of the actions in a menu.\n *\n * @example\n * <button-actions-with-menu\n * :actions=\"[\n * {\n * title: 'Primary',\n * event: () => { ... },\n * icon: FourPeopleIcon,\n * link: {\n * variant: 'default',\n * external: true,\n * to: 'https://www.adyen.com/'\n * },\n * },\n * {\n * title: 'Secondary',\n * event: () => { ... }\n * disabled: true,\n * variant: BentoButtonVariant.PRIMARY,\n * critical: true\n * }]\"\n * :displayedActions=\"2\"\n * />\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./button-actions-with-menu.scss\" />\n"],"names":["useResponsiveActions","props","breakpoint","container","defaultActionsCount","offset","windowWidth","useWindowSize","displayedActionsCount","ref","AVERAGE_BUTTON_WIDTH","showActions","nextTick","availableSpace","totalActionWidth","hideActions","watch","newWidth","containerEl","oldWidth","count","__default__","inverseRef","toRef","buttonActionsWithMenu","menu","stackButtons","computedActions","computed","displayedActionsLimit","computedMenuRef","provide","MENU_INVERSE_INJECTION_KEY","BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY","conditionalClasses","computedMenuActions","action"],"mappings":";;;;;AAUO,MAAAA,IAAA,CAAAC,MAAA;AACH,QAAA,EAAA,YAAAC,GAAA,WAAAC,GAAA,qBAAAC,GAAA,QAAAC,EAAA,IAAAJ,GAEA,EAAA,OAAAK,EAAA,IAAAC,EAAA,GAEAC,IAAAC,EAAAL,EAAA,KAAA,GAEAM,IAAA,KAEAC,IAAA,YAAA;AACI,UAAAC,EAAA;AAEA,UAAAC,IAAAV,EAAA,MAAA,aACAW,IAAAJ,IAAAF,EAAA,SAAAH,GAAA,OAAA,eAAA,KAAAK;AAMA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,IAC5C,CAAA;AAGZ,IAAAC,EAAAC,GAAAV,CAAA,GAEArB,EAAA,6BACI8B,EAAAE,GAAA,EAAA,uBAAAT,GAAA,MAAAC,GAAA,cAAAC,EAAA,CAAA;AAGJ,UAAAQ,IAAAN,EAAA,OAAA;AAAA,MAA2C,8DAAA3B,EAAA,kBAAA;AAAA,MACiD,gEAAAA,EAAA,kBAAA;AAAA,MACE,kEAAAyB,EAAA;AAAA,IACT,EAAA,GAGrFS,IAAAP,EAAA,MACIpB,EAAA,UAAA,UAAAA,EAAA,SAAAP,EAAA,QAAA,SACI,CAAA,IAGJA,EAAA,QAAA,MAAAO,EAAA,OAAAP,EAAA,QAAA,MAAA,EAEA,QAAA,CAAAmC,MACIA,EAAA,OAUAA,EAAA,OATI;AAAA,MAAO,MAAAA,EAAA;AAAA,MACU,SAAA,MAAAA,EAAA,QAAA,CAAA,CAAA;AAAA,MAC4B,MAAAA,EAAA;AAAA,MAC5B,UAAAA,EAAA;AAAA,MACI,UAAAA,EAAA;AAAA,IACA,CAIX,CACjB;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"button-actions-with-menu.CjTaZoYW.js","sources":["../../src/components/internal/button-actions-with-menu/composables/use-responsive-actions.ts","../../src/components/internal/button-actions-with-menu/button-actions-with-menu.vue"],"sourcesContent":["import { useWindowSize } from '@vueuse/core';\nimport { nextTick, ref, type Ref, watch } from 'vue';\n\ninterface UseResponsiveActionsProps {\n breakpoint?: number;\n container: Ref<HTMLElement>;\n defaultActionsCount: Ref<number>;\n offset?: Ref<HTMLElement>;\n}\n\nexport const useResponsiveActions = (props: UseResponsiveActionsProps) => {\n const { breakpoint, container, defaultActionsCount, offset } = props;\n\n const { width: windowWidth } = useWindowSize();\n\n const displayedActionsCount = ref(defaultActionsCount.value);\n\n const AVERAGE_BUTTON_WIDTH = 150; // button size + gap\n\n const showActions = async () => {\n await nextTick();\n\n const availableSpace = container.value.clientWidth;\n const totalActionWidth =\n AVERAGE_BUTTON_WIDTH * displayedActionsCount.value +\n (offset?.value?.offsetWidth ?? 0) +\n AVERAGE_BUTTON_WIDTH;\n\n // Only add actions if there's enough space and we haven't reached max\n if (availableSpace >= totalActionWidth && displayedActionsCount.value < defaultActionsCount.value) {\n displayedActionsCount.value += 1;\n\n await showActions(); // keep trying to show more\n }\n };\n\n const hideActions = async () => {\n await nextTick();\n\n const availableSpace = container.value.clientWidth;\n const totalActionWidth = AVERAGE_BUTTON_WIDTH * displayedActionsCount.value + (offset?.value?.offsetWidth ?? 0);\n\n // Hide actions if they overflow the container\n if (availableSpace < totalActionWidth && displayedActionsCount.value > 0) {\n displayedActionsCount.value -= 1;\n\n await hideActions(); // keep hiding until it fits\n }\n };\n\n watch([windowWidth, container], async ([newWidth, containerEl], [oldWidth]) => {\n if (!containerEl || !defaultActionsCount || newWidth > breakpoint) {\n return;\n }\n\n await nextTick();\n\n const isIncreasing = newWidth > oldWidth;\n\n if (isIncreasing) {\n await showActions();\n } else {\n await hideActions();\n }\n });\n\n watch(defaultActionsCount, async count => {\n displayedActionsCount.value = count;\n\n if (breakpoint && windowWidth.value <= breakpoint && container.value) {\n await hideActions();\n }\n });\n\n return {\n displayedActionsCount,\n };\n};\n","<template>\n <div class=\"b-button-actions-with-menu\">\n <div\n ref=\"buttonActionsWithMenu\"\n role=\"group\"\n class=\"b-button-actions-with-menu__container-wrapper\"\n :class=\"conditionalClasses\"\n >\n <bento-button-actions :actions=\"computedActions\" :inverse=\"inverse\" :layout=\"actionsLayout\" />\n <bento-menu\n v-if=\"computedMenuActions.length\"\n ref=\"menu\"\n :data=\"computedMenuActions\"\n :menu-position=\"menuPosition\"\n />\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { BentoButtonActions } from '@/components/button';\n import { type BentoMenuItem } from '@/components/menu/components/menu-item/menu-item.types';\n import { MENU_INVERSE_INJECTION_KEY } from '@/components/menu/menu.keys';\n import BentoMenu from '@/components/menu/menu.vue';\n import { computed, provide, ref, toRef } from 'vue';\n import { BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY } from './button-actions-with-menu.keys';\n import { type ButtonActionsWithMenuProps } from './button-actions-with-menu.types';\n import { useResponsiveActions } from './composables/use-responsive-actions';\n\n const props = defineProps({\n actions: null,\n actionsLayout: { default: 'buttons-end' },\n disableResponsiveBehavior: { type: Boolean, default: false },\n displayedActions: { default: undefined },\n inverse: { type: Boolean, default: false },\n hideDisplayedActionsBreakpoint: { default: 0 },\n menuPosition: { default: 'bottom-start' }\n});\n\n const inverseRef = toRef(props, 'inverse');\n const buttonActionsWithMenu = ref<HTMLDivElement>(null);\n const menu = ref(null);\n const stackButtons = ref(false);\n\n const computedActions = computed(() => {\n const displayedActionsLimit = props.hideDisplayedActionsBreakpoint\n ? displayedActionsCount.value\n : props.displayedActions;\n\n return props.actions.slice(0, displayedActionsLimit);\n });\n const computedMenuRef = computed(() => menu?.value?.$el);\n\n const { displayedActionsCount } = useResponsiveActions({\n breakpoint: props.hideDisplayedActionsBreakpoint,\n container: buttonActionsWithMenu,\n defaultActionsCount: toRef(props, 'displayedActions'),\n offset: computedMenuRef,\n });\n\n provide(MENU_INVERSE_INJECTION_KEY, inverseRef);\n\n if (!props.disableResponsiveBehavior) {\n provide(BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY, { buttonActionsWithMenu, menu, stackButtons });\n }\n\n const conditionalClasses = computed(() => ({\n [`b-button-actions-with-menu__container-wrapper--buttons-end`]: props.actionsLayout === 'buttons-end',\n [`b-button-actions-with-menu__container-wrapper--buttons-start`]: props.actionsLayout === 'buttons-start',\n [`b-button-actions-with-menu__container-wrapper--stacked-buttons`]: stackButtons.value,\n }));\n\n const computedMenuActions = computed(() => {\n if (displayedActionsCount.value === undefined || displayedActionsCount.value >= props.actions.length) {\n return [];\n }\n\n const actionsToProcess = props.actions.slice(displayedActionsCount.value, props.actions.length);\n\n return actionsToProcess.flatMap<BentoMenuItem>(action => {\n if (!action.data) {\n return {\n text: action.title,\n handler: () => action.event?.({} as Event),\n icon: action.icon,\n critical: action.critical,\n disabled: action.disabled,\n };\n }\n\n return action.data;\n });\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * An internal button actions component with the option to display some of the actions in a menu.\n *\n * @example\n * <button-actions-with-menu\n * :actions=\"[\n * {\n * title: 'Primary',\n * event: () => { ... },\n * icon: FourPeopleIcon,\n * link: {\n * variant: 'default',\n * external: true,\n * to: 'https://www.adyen.com/'\n * },\n * },\n * {\n * title: 'Secondary',\n * event: () => { ... }\n * disabled: true,\n * variant: BentoButtonVariant.PRIMARY,\n * critical: true\n * }]\"\n * :displayedActions=\"2\"\n * />\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./button-actions-with-menu.scss\" />\n"],"names":["useResponsiveActions","props","breakpoint","container","defaultActionsCount","offset","windowWidth","useWindowSize","displayedActionsCount","ref","AVERAGE_BUTTON_WIDTH","showActions","nextTick","availableSpace","totalActionWidth","hideActions","watch","newWidth","containerEl","oldWidth","count","__default__","inverseRef","toRef","buttonActionsWithMenu","menu","stackButtons","computedActions","computed","displayedActionsLimit","computedMenuRef","provide","MENU_INVERSE_INJECTION_KEY","BUTTON_ACTIONS_WITH_MENU_CONTAINER_INJECTION_KEY","conditionalClasses","computedMenuActions","action"],"mappings":";;;;;AAUO,MAAAA,IAAA,CAAAC,MAAA;AACH,QAAA,EAAA,YAAAC,GAAA,WAAAC,GAAA,qBAAAC,GAAA,QAAAC,EAAA,IAAAJ,GAEA,EAAA,OAAAK,EAAA,IAAAC,EAAA,GAEAC,IAAAC,EAAAL,EAAA,KAAA,GAEAM,IAAA,KAEAC,IAAA,YAAA;AACI,UAAAC,EAAA;AAEA,UAAAC,IAAAV,EAAA,MAAA,aACAW,IAAAJ,IAAAF,EAAA,SAAAH,GAAA,OAAA,eAAA,KAAAK;AAMA,IAAAG,KAAAC,KAAAN,EAAA,QAAAJ,EAAA,UACII,EAAA,SAAA,GAEA,MAAAG,EAAA;AAAA,EACJ,GAGJI,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GAAA,MAAAC,GAAA,cAAAC,EAAA,CAAA;AAGJ,UAAAQ,IAAAN,EAAA,OAAA;AAAA,MAA2C,8DAAA3B,EAAA,kBAAA;AAAA,MACiD,gEAAAA,EAAA,kBAAA;AAAA,MACE,kEAAAyB,EAAA;AAAA,IACT,EAAA,GAGrFS,IAAAP,EAAA,MACIpB,EAAA,UAAA,UAAAA,EAAA,SAAAP,EAAA,QAAA,SACI,CAAA,IAGJA,EAAA,QAAA,MAAAO,EAAA,OAAAP,EAAA,QAAA,MAAA,EAEA,QAAA,CAAAmC,MACIA,EAAA,OAUAA,EAAA,OATI;AAAA,MAAO,MAAAA,EAAA;AAAA,MACU,SAAA,MAAAA,EAAA,QAAA,CAAA,CAAA;AAAA,MAC4B,MAAAA,EAAA;AAAA,MAC5B,UAAAA,EAAA;AAAA,MACI,UAAAA,EAAA;AAAA,IACA,CAIX,CACjB;;;;;;;;;;;;;;;;"}
|
|
@@ -10,7 +10,7 @@ import { i as G } from "./index.Cl4_42j5.js";
|
|
|
10
10
|
import { B as Y, D as ue } from "./divider.KxXy6nzJ.js";
|
|
11
11
|
import { C as ce } from "./cross.szJ_ZUTI.js";
|
|
12
12
|
import { B as J, c as D, p as de } from "./typography.D1OZJbEa.js";
|
|
13
|
-
import { a as fe, P as pe, b as me } from "./popper-container.
|
|
13
|
+
import { a as fe, P as pe, b as me } from "./popper-container.Co4j6qME.js";
|
|
14
14
|
import { o as _e } from "./on-click-outside.BgIzQ2G1.js";
|
|
15
15
|
import { g as ve } from "./generate-uid.DBWe4g6T.js";
|
|
16
16
|
import { C as ye } from "./chevron-down.B_QiVCoO.js";
|
|
@@ -1084,4 +1084,4 @@ export {
|
|
|
1084
1084
|
H as l,
|
|
1085
1085
|
Je as u
|
|
1086
1086
|
};
|
|
1087
|
-
//# sourceMappingURL=button-actions.
|
|
1087
|
+
//# sourceMappingURL=button-actions.sLmpjWGK.js.map
|