@adyen/bento-vue2 1.89.2 → 1.90.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/components.d.ts +2 -0
- package/dist/@types/index.d.ts +198 -80
- package/dist/accordion.js +1 -1
- package/dist/action-bar.js +1 -1
- package/dist/ai-tag.js +1 -1
- package/dist/alert.js +1 -1
- package/dist/anchor-scroller.js +1 -1
- package/dist/assets/accordion-item.css +1 -1
- package/dist/assets/action-bar.css +1 -1
- package/dist/assets/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-range-picker.css +1 -1
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/file-uploader.css +1 -1
- package/dist/assets/input-time.css +1 -0
- package/dist/assets/inspector.css +1 -1
- package/dist/assets/modal-fullscreen.css +1 -1
- package/dist/assets/secondary-nav.css +1 -1
- package/dist/assets/sidepanel.css +1 -1
- package/dist/button.js +3 -3
- package/dist/card.js +1 -1
- package/dist/checkbox.js +2 -2
- package/dist/chip.js +1 -1
- package/dist/chunks/accordion-item.D0WVCLec.js +145 -0
- package/dist/chunks/{accordion-item.BZDSJamR.js.map → accordion-item.D0WVCLec.js.map} +1 -1
- package/dist/chunks/action-bar.B63qIiiH.js +334 -0
- package/dist/chunks/{action-bar.CYGUYI0V.js.map → action-bar.B63qIiiH.js.map} +1 -1
- package/dist/chunks/{ai-button.CR_ePQRR.js → ai-button.7L9bANlk.js} +2 -2
- package/dist/chunks/{ai-button.CR_ePQRR.js.map → ai-button.7L9bANlk.js.map} +1 -1
- package/dist/chunks/ai-tag.CCJCOdXu.js +110 -0
- package/dist/chunks/{ai-tag.Cjf38mjR.js.map → ai-tag.CCJCOdXu.js.map} +1 -1
- package/dist/chunks/alert.CXRb-Smf.js +160 -0
- package/dist/chunks/{alert.QVQ6Zjbm.js.map → alert.CXRb-Smf.js.map} +1 -1
- package/dist/chunks/{anchor-scroller.CjJ26PJS.js → anchor-scroller.DWaykZQj.js} +66 -39
- package/dist/chunks/{anchor-scroller.CjJ26PJS.js.map → anchor-scroller.DWaykZQj.js.map} +1 -1
- package/dist/chunks/{base-modal.DmWkavtf.js → base-modal.DpmeDmq-.js} +103 -66
- package/dist/chunks/{base-modal.DmWkavtf.js.map → base-modal.DpmeDmq-.js.map} +1 -1
- package/dist/chunks/{button-actions-with-menu.Bi_HXopk.js → button-actions-with-menu.ChTUOsZl.js} +2 -2
- package/dist/chunks/{button-actions-with-menu.Bi_HXopk.js.map → button-actions-with-menu.ChTUOsZl.js.map} +1 -1
- package/dist/chunks/{button-actions.BLk114As.js → button-actions.BmU1DngD.js} +221 -147
- package/dist/chunks/{button-actions.BLk114As.js.map → button-actions.BmU1DngD.js.map} +1 -1
- package/dist/chunks/{button.DxhJNOtr.js → button.C9b2AC9w.js} +2 -2
- package/dist/chunks/{button.DxhJNOtr.js.map → button.C9b2AC9w.js.map} +1 -1
- package/dist/chunks/{calendar.CXKhBF2f.js → calendar.uvIGF_jU.js} +283 -209
- package/dist/chunks/{calendar.CXKhBF2f.js.map → calendar.uvIGF_jU.js.map} +1 -1
- package/dist/chunks/card.WWUfBkqf.js +165 -0
- package/dist/chunks/{card.GjhsXOT0.js.map → card.WWUfBkqf.js.map} +1 -1
- package/dist/chunks/{checkbox-group.B2BjU3ZN.js → checkbox-group.CI0xDnql.js} +4 -4
- package/dist/chunks/{checkbox-group.B2BjU3ZN.js.map → checkbox-group.CI0xDnql.js.map} +1 -1
- package/dist/chunks/{checkbox.CIv8WgGp.js → checkbox.TsWA6O3Z.js} +93 -56
- package/dist/chunks/{checkbox.CIv8WgGp.js.map → checkbox.TsWA6O3Z.js.map} +1 -1
- package/dist/chunks/chip.BFY_-VCz.js +84 -0
- package/dist/chunks/{chip.DTpENaGC.js.map → chip.BFY_-VCz.js.map} +1 -1
- package/dist/chunks/{code-snippet.YIm2oO_o.js → code-snippet.4DX9iUV8.js} +133 -76
- package/dist/chunks/{code-snippet.YIm2oO_o.js.map → code-snippet.4DX9iUV8.js.map} +1 -1
- package/dist/chunks/{controls-group.CqotnNEF.js → controls-group.D_KE99mg.js} +2 -2
- package/dist/chunks/{controls-group.CqotnNEF.js.map → controls-group.D_KE99mg.js.map} +1 -1
- package/dist/chunks/copy.qqGYFbKJ.js +133 -0
- package/dist/chunks/{copy.BVGQcf22.js.map → copy.qqGYFbKJ.js.map} +1 -1
- package/dist/chunks/{country.D20NCLLG.js → country.BEwW8TQo.js} +3 -3
- package/dist/chunks/{country.D20NCLLG.js.map → country.BEwW8TQo.js.map} +1 -1
- package/dist/chunks/country.types.jjXwaoMl.js +2537 -0
- package/dist/chunks/country.types.jjXwaoMl.js.map +1 -0
- package/dist/chunks/{dashboard-section.BubZyu8i.js → dashboard-section.TWlLdQHG.js} +3 -3
- package/dist/chunks/{dashboard-section.BubZyu8i.js.map → dashboard-section.TWlLdQHG.js.map} +1 -1
- package/dist/chunks/{dashed-underline.pjYTS0m1.js → dashed-underline.CpDuQ3Fo.js} +3 -3
- package/dist/chunks/{dashed-underline.pjYTS0m1.js.map → dashed-underline.CpDuQ3Fo.js.map} +1 -1
- package/dist/chunks/{data-grid-template.D8RhngPj.js → data-grid-template.DZaE-kOS.js} +4 -4
- package/dist/chunks/{data-grid-template.D8RhngPj.js.map → data-grid-template.DZaE-kOS.js.map} +1 -1
- package/dist/chunks/data-grid.x6cEW0az.js +4069 -0
- package/dist/chunks/data-grid.x6cEW0az.js.map +1 -0
- package/dist/chunks/date-picker.Dln8ocL4.js +222 -0
- package/dist/chunks/{date-picker.CnazYcSX.js.map → date-picker.Dln8ocL4.js.map} +1 -1
- package/dist/chunks/date-range-picker.DPGy2h-9.js +1068 -0
- package/dist/chunks/date-range-picker.DPGy2h-9.js.map +1 -0
- package/dist/chunks/dialog-page.EdejG53a.js +143 -0
- package/dist/chunks/{dialog-page.oyG153fC.js.map → dialog-page.EdejG53a.js.map} +1 -1
- package/dist/chunks/{dropdown-default-textbox.Dvzg0StF.js → dropdown-default-textbox.CjhLIxVq.js} +63 -36
- package/dist/chunks/{dropdown-default-textbox.Dvzg0StF.js.map → dropdown-default-textbox.CjhLIxVq.js.map} +1 -1
- package/dist/chunks/{dropdown-tag.BRB-emd1.js → dropdown-tag.t3FlJUSy.js} +5 -5
- package/dist/chunks/{dropdown-tag.BRB-emd1.js.map → dropdown-tag.t3FlJUSy.js.map} +1 -1
- package/dist/chunks/{dropdown.Ct7uhPr6.js → dropdown.CvNI2V33.js} +329 -235
- package/dist/chunks/{dropdown.Ct7uhPr6.js.map → dropdown.CvNI2V33.js.map} +1 -1
- package/dist/chunks/{empty-state.D_Ac-XXH.js → empty-state.DMV23IZy.js} +2 -2
- package/dist/chunks/{empty-state.D_Ac-XXH.js.map → empty-state.DMV23IZy.js.map} +1 -1
- package/dist/chunks/error-message.BUNKRa_w.js +160 -0
- package/dist/chunks/{error-message.RxdStT3S.js.map → error-message.BUNKRa_w.js.map} +1 -1
- package/dist/chunks/{file-uploader.D5Rjsx4k.js → file-uploader.Cig5gDXT.js} +749 -468
- package/dist/chunks/{file-uploader.D5Rjsx4k.js.map → file-uploader.Cig5gDXT.js.map} +1 -1
- package/dist/chunks/{filter-bar.zD_ctViU.js → filter-bar.x445KK3y.js} +1301 -761
- package/dist/chunks/{filter-bar.zD_ctViU.js.map → filter-bar.x445KK3y.js.map} +1 -1
- package/dist/chunks/fixed-scroller.DR2E_No4.js +148 -0
- package/dist/chunks/{fixed-scroller.MerESbd_.js.map → fixed-scroller.DR2E_No4.js.map} +1 -1
- package/dist/chunks/{footer-actions.CiPj7hZG.js → footer-actions.CIkul1OD.js} +3 -3
- package/dist/chunks/{footer-actions.CiPj7hZG.js.map → footer-actions.CIkul1OD.js.map} +1 -1
- package/dist/chunks/{form-layout-title.Bw7VgOO5.js → form-layout-title.DR5M7GP3.js} +77 -48
- package/dist/chunks/{form-layout-title.Bw7VgOO5.js.map → form-layout-title.DR5M7GP3.js.map} +1 -1
- package/dist/chunks/{header-meta.Dq6TlNPw.js → header-meta.BC5fdpD1.js} +127 -73
- package/dist/chunks/{header-meta.Dq6TlNPw.js.map → header-meta.BC5fdpD1.js.map} +1 -1
- package/dist/chunks/{header-with-views.DaEhkSS8.js → header-with-views.-cvdi9-L.js} +1120 -679
- package/dist/chunks/{header-with-views.DaEhkSS8.js.map → header-with-views.-cvdi9-L.js.map} +1 -1
- package/dist/chunks/{header.DkC-KKWa.js → header.DtmZjxiU.js} +3 -3
- package/dist/chunks/{header.DkC-KKWa.js.map → header.DtmZjxiU.js.map} +1 -1
- package/dist/chunks/{info-icon.BF8KxU-k.js → info-icon.DCR42Kvm.js} +2 -2
- package/dist/chunks/{info-icon.BF8KxU-k.js.map → info-icon.DCR42Kvm.js.map} +1 -1
- package/dist/chunks/input-field-password.Bdlw4dzr.js +381 -0
- package/dist/chunks/{input-field-password.BKT1mYUw.js.map → input-field-password.Bdlw4dzr.js.map} +1 -1
- package/dist/chunks/{input-field-phone-number.BjRKjQOQ.js → input-field-phone-number.DPuWxBBz.js} +98 -71
- package/dist/chunks/{input-field-phone-number.BjRKjQOQ.js.map → input-field-phone-number.DPuWxBBz.js.map} +1 -1
- package/dist/chunks/input-field.DH25CU_G.js +207 -0
- package/dist/chunks/{input-field.m1PMwa4C.js.map → input-field.DH25CU_G.js.map} +1 -1
- package/dist/chunks/input-time.6eJ4-QdU.js +92 -0
- package/dist/chunks/input-time.6eJ4-QdU.js.map +1 -0
- package/dist/chunks/inspector.BzBPlz-5.js +172 -0
- package/dist/chunks/{inspector.Bnm0hl_D.js.map → inspector.BzBPlz-5.js.map} +1 -1
- package/dist/chunks/{link.MhoM3zQj.js → link.DB5g6d48.js} +56 -29
- package/dist/chunks/{link.MhoM3zQj.js.map → link.DB5g6d48.js.map} +1 -1
- package/dist/chunks/{list-item.BnzU1LIu.js → list-item.DqTHh8-Z.js} +2 -2
- package/dist/chunks/{list-item.BnzU1LIu.js.map → list-item.DqTHh8-Z.js.map} +1 -1
- package/dist/chunks/{listbox-option-tag.BhPVuAjJ.js → listbox-option-tag.CvbE-EuG.js} +2 -2
- package/dist/chunks/{listbox-option-tag.BhPVuAjJ.js.map → listbox-option-tag.CvbE-EuG.js.map} +1 -1
- package/dist/chunks/{modal-fullscreen.CXOq6_Cv.js → modal-fullscreen.CaxuXW-H.js} +63 -36
- package/dist/chunks/{modal-fullscreen.CXOq6_Cv.js.map → modal-fullscreen.CaxuXW-H.js.map} +1 -1
- package/dist/chunks/{modal.o0KddMiG.js → modal.Brif0vAy.js} +63 -36
- package/dist/chunks/{modal.o0KddMiG.js.map → modal.Brif0vAy.js.map} +1 -1
- package/dist/chunks/{pagination.ZISqB4M_.js → pagination.BmrU_sn_.js} +221 -99
- package/dist/chunks/{pagination.ZISqB4M_.js.map → pagination.BmrU_sn_.js.map} +1 -1
- package/dist/chunks/promo-banner.Dc_kK1x9.js +91 -0
- package/dist/chunks/{promo-banner.Db2kh2qK.js.map → promo-banner.Dc_kK1x9.js.map} +1 -1
- package/dist/chunks/{radio-group.DnMy7brs.js → radio-group.5oS-AeYN.js} +4 -4
- package/dist/chunks/{radio-group.DnMy7brs.js.map → radio-group.5oS-AeYN.js.map} +1 -1
- package/dist/chunks/{rich-text-editor.Cbv1DxXn.js → rich-text-editor.DSGTe8Zt.js} +1781 -1731
- package/dist/chunks/{rich-text-editor.Cbv1DxXn.js.map → rich-text-editor.DSGTe8Zt.js.map} +1 -1
- package/dist/chunks/search-bar.CNfoeLLt.js +126 -0
- package/dist/chunks/{search-bar.DPjYDhja.js.map → search-bar.CNfoeLLt.js.map} +1 -1
- package/dist/chunks/secondary-nav.IF5CgeIP.js +226 -0
- package/dist/chunks/secondary-nav.IF5CgeIP.js.map +1 -0
- package/dist/chunks/{segmented-control.BqIiX9hv.js → segmented-control.DDtjX-V5.js} +2 -2
- package/dist/chunks/{segmented-control.BqIiX9hv.js.map → segmented-control.DDtjX-V5.js.map} +1 -1
- package/dist/chunks/{selection-card-group.IPiouuot.js → selection-card-group.DZjFeQKR.js} +10 -10
- package/dist/chunks/{selection-card-group.IPiouuot.js.map → selection-card-group.DZjFeQKR.js.map} +1 -1
- package/dist/chunks/{sidepanel.BGMjjB3F.js → sidepanel.DZDXuyzg.js} +66 -39
- package/dist/chunks/{sidepanel.BGMjjB3F.js.map → sidepanel.DZDXuyzg.js.map} +1 -1
- package/dist/chunks/{step.QFER3tSj.js → step.TDm_ts1S.js} +92 -63
- package/dist/chunks/{step.QFER3tSj.js.map → step.TDm_ts1S.js.map} +1 -1
- package/dist/chunks/{structured-list-item.BDJKRC_8.js → structured-list-item.BBBtie1s.js} +58 -31
- package/dist/chunks/{structured-list-item.BDJKRC_8.js.map → structured-list-item.BBBtie1s.js.map} +1 -1
- package/dist/chunks/{summary-grid.types.CIkArZf5.js → summary-grid.types.CrPNQbX0.js} +5 -5
- package/dist/chunks/{summary-grid.types.CIkArZf5.js.map → summary-grid.types.CrPNQbX0.js.map} +1 -1
- package/dist/chunks/{tab.CaXF0dho.js → tab.CNIZyfZt.js} +2 -2
- package/dist/chunks/{tab.CaXF0dho.js.map → tab.CNIZyfZt.js.map} +1 -1
- package/dist/chunks/{tag.CocLKztJ.js → tag.D2xagTJv.js} +2 -2
- package/dist/chunks/{tag.CocLKztJ.js.map → tag.D2xagTJv.js.map} +1 -1
- package/dist/chunks/textarea.Bi53QF5Q.js +218 -0
- package/dist/chunks/{textarea.D4X6Ss9q.js.map → textarea.Bi53QF5Q.js.map} +1 -1
- package/dist/chunks/timeline-item.C6Bi0eam.js +322 -0
- package/dist/chunks/{timeline-item.C8BxWdy1.js.map → timeline-item.C6Bi0eam.js.map} +1 -1
- package/dist/chunks/{toast.BRI3G7TL.js → toast.d8vg71CB.js} +81 -54
- package/dist/chunks/{toast.BRI3G7TL.js.map → toast.d8vg71CB.js.map} +1 -1
- package/dist/chunks/{tooltip.CbsNGnhw.js → tooltip.BxtnF3is.js} +38 -36
- package/dist/chunks/tooltip.BxtnF3is.js.map +1 -0
- package/dist/chunks/{tutorial.BzV6bHQJ.js → tutorial.BCiZMLJE.js} +190 -103
- package/dist/chunks/{tutorial.BzV6bHQJ.js.map → tutorial.BCiZMLJE.js.map} +1 -1
- package/dist/chunks/{use-cached-selected-values.DqX2qsMC.js → use-cached-selected-values.Bn3Y8Iuq.js} +490 -359
- package/dist/chunks/{use-cached-selected-values.DqX2qsMC.js.map → use-cached-selected-values.Bn3Y8Iuq.js.map} +1 -1
- package/dist/chunks/{use-country-items.CI8C7MLU.js → use-country-items.B4j8pAvW.js} +3 -3
- package/dist/chunks/{use-country-items.CI8C7MLU.js.map → use-country-items.B4j8pAvW.js.map} +1 -1
- package/dist/chunks/use-country-phon-code.ByqnuIni.js +6386 -0
- package/dist/chunks/use-country-phon-code.ByqnuIni.js.map +1 -0
- package/dist/chunks/{use-date-input-formatter.BYaTO3vz.js → use-date-input-formatter.DRMt9yR2.js} +2 -2
- package/dist/chunks/{use-date-input-formatter.BYaTO3vz.js.map → use-date-input-formatter.DRMt9yR2.js.map} +1 -1
- package/dist/code-snippet.js +1 -1
- package/dist/country.js +3 -3
- 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/draggable-handle.js +160 -73
- package/dist/draggable-handle.js.map +1 -1
- package/dist/dropdown.js +4 -4
- package/dist/empty-state.js +1 -1
- package/dist/file-uploader.js +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/form-layout.js +1 -1
- package/dist/header-with-views.js +1 -1
- package/dist/header.js +1 -1
- package/dist/index.js +215 -213
- package/dist/index.js.map +1 -1
- package/dist/info-icon.js +1 -1
- package/dist/input-field-password.js +1 -1
- package/dist/input-field-phone-number.js +1 -1
- package/dist/input-field.js +1 -1
- package/dist/input-time.js +5 -0
- package/dist/input-time.js.map +1 -0
- package/dist/inspector.js +1 -1
- package/dist/internal.js +12 -12
- package/dist/link.js +1 -1
- 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/pagination.js +1 -1
- package/dist/popover.js +1 -1
- package/dist/promo-banner.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/stepper.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/toast.js +1 -1
- package/dist/tutorial.js +1 -1
- package/dist/web-types.json +198 -1
- package/package.json +9 -9
- package/dist/chunks/accordion-item.BZDSJamR.js +0 -108
- package/dist/chunks/action-bar.CYGUYI0V.js +0 -207
- package/dist/chunks/ai-tag.Cjf38mjR.js +0 -73
- package/dist/chunks/alert.QVQ6Zjbm.js +0 -93
- package/dist/chunks/card.GjhsXOT0.js +0 -128
- package/dist/chunks/chip.DTpENaGC.js +0 -57
- package/dist/chunks/copy.BVGQcf22.js +0 -86
- package/dist/chunks/country.types.DxKjyd0S.js +0 -20
- package/dist/chunks/country.types.DxKjyd0S.js.map +0 -1
- package/dist/chunks/data-grid.DJG8Ty0A.js +0 -3194
- package/dist/chunks/data-grid.DJG8Ty0A.js.map +0 -1
- package/dist/chunks/date-picker.CnazYcSX.js +0 -155
- package/dist/chunks/date-range-picker.Bf9pRNL7.js +0 -811
- package/dist/chunks/date-range-picker.Bf9pRNL7.js.map +0 -1
- package/dist/chunks/dialog-page.oyG153fC.js +0 -116
- package/dist/chunks/error-message.RxdStT3S.js +0 -106
- package/dist/chunks/fixed-scroller.MerESbd_.js +0 -111
- package/dist/chunks/input-field-password.BKT1mYUw.js +0 -234
- package/dist/chunks/input-field.m1PMwa4C.js +0 -170
- package/dist/chunks/inspector.Bnm0hl_D.js +0 -105
- package/dist/chunks/promo-banner.Db2kh2qK.js +0 -64
- package/dist/chunks/search-bar.DPjYDhja.js +0 -89
- package/dist/chunks/secondary-nav.CwJjkJkj.js +0 -112
- package/dist/chunks/secondary-nav.CwJjkJkj.js.map +0 -1
- package/dist/chunks/textarea.D4X6Ss9q.js +0 -169
- package/dist/chunks/timeline-item.C8BxWdy1.js +0 -238
- package/dist/chunks/tooltip.CbsNGnhw.js.map +0 -1
- package/dist/chunks/use-country-phon-code.C6orQNnM.js +0 -291
- package/dist/chunks/use-country-phon-code.C6orQNnM.js.map +0 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { defineComponent as v, useSlots as y, computed as c, onMounted as b } from "vue";
|
|
2
|
+
import { c as l, a as S, B as T } from "./typography.C8lPlsbD.js";
|
|
3
|
+
import { B as w } from "./button.C9b2AC9w.js";
|
|
4
|
+
import { C as H } from "./cross-small.CoQUe8SS.js";
|
|
5
|
+
import { W as L } from "./warning-filled.CbJ1pcB2.js";
|
|
6
|
+
import { C as B } from "./cross-circle-fill.DTDtgLMf.js";
|
|
7
|
+
import { C as E } from "./checkmark-circle-fill.BttTCjrM.js";
|
|
8
|
+
/* empty css */
|
|
9
|
+
import { n as u } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
10
|
+
import { u as R } from "./use-has-slot.C9lQZ6nz.js";
|
|
11
|
+
import { u as G } from "./index.B6WW_F-J.js";
|
|
12
|
+
import "../assets/alert.css";
|
|
13
|
+
var i = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.TIP = "tip", e))(i || {}), n = /* @__PURE__ */ ((e) => (e.WARNING = "warning", e.CRITICAL = "critical", e.HIGHLIGHT = "highlight", e.SUCCESS = "success", e))(n || {}), d = /* @__PURE__ */ ((e) => (e.CLOSE_ALERT = "close-alert", e))(d || {});
|
|
14
|
+
let C = 0;
|
|
15
|
+
const F = {
|
|
16
|
+
beforeCreate() {
|
|
17
|
+
this.uuid = C.toString(), C += 1;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var V = function() {
|
|
21
|
+
var s = this, t = s._self._c;
|
|
22
|
+
return t("svg", s._b({ staticClass: "ui-assets-icons-16", attrs: { role: "img", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "none" } }, "svg", s.$attrs, !1), [s.$attrs["svg-title"] ? t("title", [s._v(s._s(s.$attrs["svg-title"]))]) : s._e(), t("g", { attrs: { "clip-path": "url(#uia-ui-assets/icons-16-info_filled__a" + s.uuid + ")" } }, [t("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" } })]), t("defs", [t("clipPath", { attrs: { id: "uia-ui-assets/icons-16-info_filled__a" + s.uuid } }, [t("rect", { attrs: { width: "16", height: "16", fill: "#fff" } })])])]);
|
|
23
|
+
}, $ = [], x = /* @__PURE__ */ u(
|
|
24
|
+
F,
|
|
25
|
+
V,
|
|
26
|
+
$,
|
|
27
|
+
!1,
|
|
28
|
+
null,
|
|
29
|
+
null
|
|
30
|
+
);
|
|
31
|
+
const A = x.exports, P = {
|
|
32
|
+
"de-DE": {
|
|
33
|
+
close: "Schließen",
|
|
34
|
+
criticalIcon: "Kritisches Symbol",
|
|
35
|
+
highlightIcon: "Symbol hervorheben",
|
|
36
|
+
successIcon: "Erfolgssymbol",
|
|
37
|
+
warningIcon: "Warnungssymbol"
|
|
38
|
+
},
|
|
39
|
+
"en-GB": {
|
|
40
|
+
close: "Close",
|
|
41
|
+
criticalIcon: "Critical icon",
|
|
42
|
+
highlightIcon: "Highlight icon",
|
|
43
|
+
successIcon: "Success icon",
|
|
44
|
+
warningIcon: "Warning icon"
|
|
45
|
+
},
|
|
46
|
+
"en-US": {
|
|
47
|
+
close: "Close",
|
|
48
|
+
criticalIcon: "Critical icon",
|
|
49
|
+
highlightIcon: "Highlight icon",
|
|
50
|
+
successIcon: "Success icon",
|
|
51
|
+
warningIcon: "Warning icon"
|
|
52
|
+
},
|
|
53
|
+
"es-ES": {
|
|
54
|
+
close: "Cerrar",
|
|
55
|
+
criticalIcon: "Icono de error crítico",
|
|
56
|
+
highlightIcon: "Icono de resaltado",
|
|
57
|
+
successIcon: "Icono de éxito",
|
|
58
|
+
warningIcon: "Icono de advertencia"
|
|
59
|
+
},
|
|
60
|
+
"es-MX": {
|
|
61
|
+
close: "Cerrar",
|
|
62
|
+
criticalIcon: "Icono crítico",
|
|
63
|
+
highlightIcon: "Icono de resaltado",
|
|
64
|
+
successIcon: "Icono de éxito",
|
|
65
|
+
warningIcon: "Icono de advertencia"
|
|
66
|
+
},
|
|
67
|
+
"fr-FR": {
|
|
68
|
+
close: "Fermer",
|
|
69
|
+
criticalIcon: "Icône critique",
|
|
70
|
+
highlightIcon: "Icône de surbrillance",
|
|
71
|
+
successIcon: "Icône de réussite",
|
|
72
|
+
warningIcon: "Icône d'avertissement"
|
|
73
|
+
},
|
|
74
|
+
"it-IT": {
|
|
75
|
+
close: "Chiudi",
|
|
76
|
+
criticalIcon: "Icona critica",
|
|
77
|
+
highlightIcon: "Icona di evidenziazione",
|
|
78
|
+
successIcon: "Icona del successo",
|
|
79
|
+
warningIcon: "Icona di avviso"
|
|
80
|
+
},
|
|
81
|
+
"ja-JP": {
|
|
82
|
+
close: "閉じる",
|
|
83
|
+
criticalIcon: "重大アイコン",
|
|
84
|
+
highlightIcon: "ハイライトアイコン",
|
|
85
|
+
successIcon: "成功アイコン",
|
|
86
|
+
warningIcon: "警告アイコン"
|
|
87
|
+
},
|
|
88
|
+
"pt-BR": {
|
|
89
|
+
close: "Fechar",
|
|
90
|
+
criticalIcon: "Ícone crítico",
|
|
91
|
+
highlightIcon: "Ícone de destaque",
|
|
92
|
+
successIcon: "Ícone de sucesso",
|
|
93
|
+
warningIcon: "Ícone de aviso"
|
|
94
|
+
},
|
|
95
|
+
"zh-CN": {
|
|
96
|
+
close: "关闭",
|
|
97
|
+
criticalIcon: "关键图标",
|
|
98
|
+
highlightIcon: "高亮图标",
|
|
99
|
+
successIcon: "成功图标",
|
|
100
|
+
warningIcon: "警告图标"
|
|
101
|
+
}
|
|
102
|
+
}, W = {
|
|
103
|
+
i18n: { messages: P },
|
|
104
|
+
name: "bento-alert"
|
|
105
|
+
}, N = /* @__PURE__ */ v({
|
|
106
|
+
...W,
|
|
107
|
+
props: {
|
|
108
|
+
closeButton: { type: Boolean, default: !1 },
|
|
109
|
+
type: { default: n.HIGHLIGHT },
|
|
110
|
+
variant: { default: i.DEFAULT }
|
|
111
|
+
},
|
|
112
|
+
emits: ["close-alert"],
|
|
113
|
+
setup(e, { emit: s }) {
|
|
114
|
+
const t = e, o = y(), I = R(o), { t: r } = G(), a = c(() => t.variant === i.TIP), h = c(() => ({
|
|
115
|
+
[`b-alert--${t.type}`]: t.type,
|
|
116
|
+
[`b-alert--${i.TIP}`]: a.value
|
|
117
|
+
})), p = c(() => r(`${t.type}Icon`)), _ = c(() => {
|
|
118
|
+
switch (t.type) {
|
|
119
|
+
case n.CRITICAL:
|
|
120
|
+
return B;
|
|
121
|
+
case n.SUCCESS:
|
|
122
|
+
return E;
|
|
123
|
+
case n.WARNING:
|
|
124
|
+
return L;
|
|
125
|
+
case n.HIGHLIGHT:
|
|
126
|
+
default:
|
|
127
|
+
return A;
|
|
128
|
+
}
|
|
129
|
+
}), g = c(() => ({
|
|
130
|
+
el: S.DIV,
|
|
131
|
+
variant: a.value ? l.CAPTION : l.BODY,
|
|
132
|
+
wide: !0
|
|
133
|
+
})), f = c(() => t.type === n.HIGHLIGHT ? "status" : "alert"), m = () => {
|
|
134
|
+
s(d.CLOSE_ALERT);
|
|
135
|
+
};
|
|
136
|
+
return b(() => {
|
|
137
|
+
if (!o.default && !o.description)
|
|
138
|
+
throw new Error("Alert Component requires a title or a description");
|
|
139
|
+
}), { __sfc: !0, slots: o, hasSlot: I, emit: s, props: t, t: r, isTipVariant: a, alertConditionalClasses: h, iconSvgTitle: p, iconComponent: _, descriptionTypography: g, computedRole: f, onCloseButtonClick: m, BentoTypography: T, BentoButton: w, CrossSmall: H };
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
var k = function() {
|
|
143
|
+
var s = this, t = s._self._c, o = s._self._setupProxy;
|
|
144
|
+
return t("div", { staticClass: "b-alert", attrs: { role: o.computedRole } }, [t("div", { staticClass: "b-alert__inner-container", class: o.alertConditionalClasses }, [t("div", { staticClass: "b-alert__icon" }, [t(o.iconComponent, { tag: "component", attrs: { "aria-hidden": "true", "svg-title": o.iconSvgTitle } })], 1), t("div", { staticClass: "b-alert__content" }, [o.hasSlot("default") && !o.isTipVariant ? t(o.BentoTypography, { staticClass: "b-alert__title", attrs: { el: "div", variant: "body", strongest: "", wide: "" } }, [s._t("default")], 2) : s._e(), o.hasSlot("description") ? t(o.BentoTypography, s._b({ staticClass: "b-alert__description", attrs: { "data-testid": "alert-description" } }, "bento-typography", o.descriptionTypography, !1), [s._t("description")], 2) : s._e(), o.hasSlot("actions") && !o.isTipVariant ? t("div", { staticClass: "b-alert__actions", attrs: { "data-testid": "alert-actions" } }, [s._t("actions")], 2) : s._e()], 1), s.closeButton && !o.isTipVariant ? t(o.BentoButton, { staticClass: "b-alert__close-button", attrs: { variant: "tertiary", type: "button" }, on: { click: o.onCloseButtonClick } }, [t(o.CrossSmall, { attrs: { "svg-title": o.t("close") } })], 1) : s._e()], 1)]);
|
|
145
|
+
}, D = [], M = /* @__PURE__ */ u(
|
|
146
|
+
N,
|
|
147
|
+
k,
|
|
148
|
+
D,
|
|
149
|
+
!1,
|
|
150
|
+
null,
|
|
151
|
+
"2c793db1"
|
|
152
|
+
);
|
|
153
|
+
const tt = M.exports;
|
|
154
|
+
export {
|
|
155
|
+
tt as B,
|
|
156
|
+
d as a,
|
|
157
|
+
n as b,
|
|
158
|
+
i as c
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=alert.CXRb-Smf.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.QVQ6Zjbm.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 for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoAlertVariant {\n DEFAULT = 'default',\n TIP = 'tip',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoAlertTypeOption {\n WARNING = 'warning',\n CRITICAL = 'critical',\n HIGHLIGHT = 'highlight',\n SUCCESS = 'success',\n}\n\n/**\n * @deprecated from version 2.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>\n import '../css/main.css';\n\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\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 && !isTipVariant\"\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","uuid","_sfc_main$1","__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,K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AA;AACI,UAAA,CAAAtB,EAAA,WAAA,CAAAA,EAAA;AACI,cAAA,IAAA,MAAA,mDAAA;AAAA,IACJ,CAAA;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"alert.CXRb-Smf.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 for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoAlertVariant {\n DEFAULT = 'default',\n TIP = 'tip',\n}\n\n/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoAlertTypeOption {\n WARNING = 'warning',\n CRITICAL = 'critical',\n HIGHLIGHT = 'highlight',\n SUCCESS = 'success',\n}\n\n/**\n * @deprecated from version 2.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>\n import '../css/main.css';\n\n let uuid = 0;\n\n export default {\n beforeCreate() {\n this.uuid = uuid.toString();\n uuid += 1;\n },\n };\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 && !isTipVariant\"\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","uuid","_sfc_main$1","__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;ACdZ,IAAAE,IAAA;AAEA,MAAAC,IAAA;AAAA,EACA,eAAA;AACA,SAAA,OAAAD,EAAA,SAAA,GACAA,KAAA;AAAA,EACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GC8HIE,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,YAAAlB,EAAA,GAAA,GAEAmB,IAAAF,EAAA,OAAA;AAAA,MAAgD,CAAA,YAAAC,EAAA,IAAA,EAAA,GAAAA,EAAA;AAAA,MACV,CAAA,YAAAlB,EAAA,GAAA,EAAA,GAAAgB,EAAA;AAAA,IACkB,EAAA,GAGxDI,IAAAH,EAAA,MAAAH,EAAA,GAAAI,EAAA,IAAA,MAAA,CAAA,GAEAG,IAAAJ,EAAA,MAAA;AACI,cAAAC,EAAA,MAAA;AAAA,QAAoB,KAAAhB,EAAA;AAEZ,iBAAAoB;AAAA,QAAO,KAAApB,EAAA;AAEP,iBAAAqB;AAAA,QAAO,KAAArB,EAAA;AAEP,iBAAAsB;AAAA,QAAO,KAAAtB,EAAA;AAAA,QACe;AAEtB,iBAAAuB;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,SAAAhB,EAAA,YAAA,WAAA,OAAA,GAEA4B,IAAA,MAAA;AACI,MAAAC,EAAA3B,EAAA,WAAA;AAAA,IAAgC;AAGpC,WAAA4B,EAAA,MAAA;AACI,UAAA,CAAAtB,EAAA,WAAA,CAAAA,EAAA;AACI,cAAA,IAAA,MAAA,mDAAA;AAAA,IACJ,CAAA;;;;;;;;;;;;;;;"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { f as
|
|
3
|
-
import { p as
|
|
4
|
-
import { u as
|
|
5
|
-
import { g as
|
|
1
|
+
import { defineComponent as T, ref as x, computed as m, watch as h, watchEffect as C, toRef as k } from "vue";
|
|
2
|
+
import { f as j, d as B, u as A, g as R, t as y, h as D, r as F } from "./index.CwzYJHw2.js";
|
|
3
|
+
import { p as S, B as E } from "./typography.C8lPlsbD.js";
|
|
4
|
+
import { u as L } from "./index.B6WW_F-J.js";
|
|
5
|
+
import { g as M } from "./generate-uid.NJ8tVoha.js";
|
|
6
6
|
import { u as g } from "./utils.BzUwtTXc.js";
|
|
7
|
-
import { B as
|
|
8
|
-
import { n as
|
|
9
|
-
import { F as
|
|
7
|
+
import { B as N } from "./button.C9b2AC9w.js";
|
|
8
|
+
import { n as w } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
9
|
+
import { F as O } from "./fixed-scroller.DR2E_No4.js";
|
|
10
10
|
import "../assets/anchor-scroller.css";
|
|
11
|
-
const
|
|
11
|
+
const V = /* @__PURE__ */ T({
|
|
12
12
|
__name: "anchor-scroller-list",
|
|
13
13
|
props: {
|
|
14
14
|
activeIndex: { default: void 0 },
|
|
@@ -22,7 +22,7 @@ const H = /* @__PURE__ */ w({
|
|
|
22
22
|
state: c,
|
|
23
23
|
next: i,
|
|
24
24
|
prev: l
|
|
25
|
-
} =
|
|
25
|
+
} = j(t, {
|
|
26
26
|
initialValue: e.activeIndex ?? t.value[0]
|
|
27
27
|
});
|
|
28
28
|
return h(c, async (r) => {
|
|
@@ -33,7 +33,7 @@ const H = /* @__PURE__ */ w({
|
|
|
33
33
|
return;
|
|
34
34
|
const a = g(r);
|
|
35
35
|
if (!a) {
|
|
36
|
-
|
|
36
|
+
S("[bento-anchor-scroller] element ref not found");
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
if (!a.style.scrollMarginTop && e.scrollOffset) {
|
|
@@ -60,10 +60,10 @@ const H = /* @__PURE__ */ w({
|
|
|
60
60
|
r.preventDefault(), c.value = t.value.length - 1;
|
|
61
61
|
break;
|
|
62
62
|
}
|
|
63
|
-
}, BentoButton:
|
|
63
|
+
}, BentoButton: N };
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
-
var
|
|
66
|
+
var z = function() {
|
|
67
67
|
var e = this, n = e._self._c, t = e._self._setupProxy;
|
|
68
68
|
return n("ul", { staticClass: "b-anchor-scroller-list", on: { keydown: t.onKeydownNavigation } }, e._l(e.items, function({ title: c, disabled: i, elementRef: l }, d) {
|
|
69
69
|
return n("li", { key: d, staticClass: "b-anchor-scroller-list__item" }, [n(t.BentoButton, { ref: "listItemRefs", refInFor: !0, staticClass: "b-anchor-scroller-list__item-button", class: {
|
|
@@ -77,21 +77,48 @@ var V = function() {
|
|
|
77
77
|
return !s.type.indexOf("key") && e._k(s.keyCode, "enter", 13, s.key, "Enter") ? null : (s.preventDefault(), t.scrollToSection(l, i));
|
|
78
78
|
}] } }, [e._v(" " + e._s(c) + " ")])], 1);
|
|
79
79
|
}), 0);
|
|
80
|
-
},
|
|
81
|
-
H,
|
|
80
|
+
}, H = [], P = /* @__PURE__ */ w(
|
|
82
81
|
V,
|
|
83
|
-
|
|
82
|
+
z,
|
|
83
|
+
H,
|
|
84
84
|
!1,
|
|
85
85
|
null,
|
|
86
86
|
"5668c5f7"
|
|
87
87
|
);
|
|
88
|
-
const
|
|
89
|
-
"
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
const J = P.exports, K = {
|
|
89
|
+
"de-DE": {
|
|
90
|
+
jumpTo: "Springe zu"
|
|
91
|
+
},
|
|
92
|
+
"en-GB": {
|
|
93
|
+
jumpTo: "Jump to"
|
|
94
|
+
},
|
|
95
|
+
"en-US": {
|
|
96
|
+
jumpTo: "Jump to"
|
|
97
|
+
},
|
|
98
|
+
"es-ES": {
|
|
99
|
+
jumpTo: "Saltar a"
|
|
100
|
+
},
|
|
101
|
+
"es-MX": {
|
|
102
|
+
jumpTo: "Saltar a"
|
|
103
|
+
},
|
|
104
|
+
"fr-FR": {
|
|
105
|
+
jumpTo: "Passer à"
|
|
106
|
+
},
|
|
107
|
+
"it-IT": {
|
|
108
|
+
jumpTo: "Vai a"
|
|
109
|
+
},
|
|
110
|
+
"ja-JP": {
|
|
111
|
+
jumpTo: "移動先"
|
|
112
|
+
},
|
|
113
|
+
"pt-BR": {
|
|
114
|
+
jumpTo: "Ir para"
|
|
115
|
+
},
|
|
116
|
+
"zh-CN": {
|
|
117
|
+
jumpTo: "跳转到"
|
|
118
|
+
}
|
|
119
|
+
}, W = (p, e) => {
|
|
93
120
|
var l;
|
|
94
|
-
const n = x(((l = e.default) == null ? void 0 : l.value) ?? -1), { y: t } = B(), { height: c } =
|
|
121
|
+
const n = x(((l = e.default) == null ? void 0 : l.value) ?? -1), { y: t } = B(), { height: c } = A(), i = () => {
|
|
95
122
|
const d = y(p), s = c.value, r = s / 2;
|
|
96
123
|
let u = -1, a = 0;
|
|
97
124
|
for (let f = 0; f < d.length; f++) {
|
|
@@ -109,15 +136,15 @@ const W = P.exports, z = {
|
|
|
109
136
|
}
|
|
110
137
|
u !== -1 && n.value !== u && (n.value = u);
|
|
111
138
|
};
|
|
112
|
-
return
|
|
139
|
+
return R([t, c], i, { throttle: 100, trailing: !0 }), C(() => {
|
|
113
140
|
y(p).length && i();
|
|
114
141
|
}), {
|
|
115
142
|
activeIndex: n
|
|
116
143
|
};
|
|
117
144
|
}, U = {
|
|
118
|
-
i18n: { messages:
|
|
145
|
+
i18n: { messages: K },
|
|
119
146
|
name: "bento-anchor-scroller"
|
|
120
|
-
},
|
|
147
|
+
}, G = /* @__PURE__ */ T({
|
|
121
148
|
...U,
|
|
122
149
|
props: {
|
|
123
150
|
activeIndex: { default: void 0 },
|
|
@@ -125,7 +152,7 @@ const W = P.exports, z = {
|
|
|
125
152
|
},
|
|
126
153
|
emits: ["update:active-index"],
|
|
127
154
|
setup(p, { emit: e }) {
|
|
128
|
-
const n = p, { t } =
|
|
155
|
+
const n = p, { t } = L(), c = x(null), i = m(() => n.items.map((o) => ({ ...o }))), l = m(
|
|
129
156
|
() => n.items.map((o, _) => ({
|
|
130
157
|
element: g(o.elementRef),
|
|
131
158
|
originalIndex: _,
|
|
@@ -133,11 +160,11 @@ const W = P.exports, z = {
|
|
|
133
160
|
})).filter(
|
|
134
161
|
(o) => !o.disabled && !!o.element
|
|
135
162
|
)
|
|
136
|
-
), { top: d, bottom: s } =
|
|
163
|
+
), { top: d, bottom: s } = D(c), r = m(() => l.value.map((o) => o.element)), u = m(() => ({
|
|
137
164
|
"b-anchor-scroller__navigation--pinned": d.value <= 1
|
|
138
|
-
})), { activeIndex: a } =
|
|
139
|
-
default:
|
|
140
|
-
}), f =
|
|
165
|
+
})), { activeIndex: a } = W(r, {
|
|
166
|
+
default: k(n, "activeIndex")
|
|
167
|
+
}), f = F(a, 200), b = m(() => {
|
|
141
168
|
const o = l.value[f.value];
|
|
142
169
|
return o ? o.originalIndex : 0;
|
|
143
170
|
});
|
|
@@ -146,26 +173,26 @@ const W = P.exports, z = {
|
|
|
146
173
|
}), h(
|
|
147
174
|
() => n.activeIndex,
|
|
148
175
|
(o) => {
|
|
149
|
-
Number.isFinite(o) && i.value[o].disabled &&
|
|
176
|
+
Number.isFinite(o) && i.value[o].disabled && S("[bento-anchor-scroller] activeIndex should not be a disabled item");
|
|
150
177
|
}
|
|
151
178
|
);
|
|
152
|
-
const v =
|
|
153
|
-
return { __sfc: !0, t, props: n, emit: e, navigationRef: c, computedItems: i, enabledItems: l, top: d, bottom: s, scrollToTargets: r, navigationConditionalClasses: u, relativeActiveIndex: a, debouncedActiveIndex: f, currentActiveIndex: b, navLabelId: v, BentoTypography:
|
|
179
|
+
const v = M("bento-anchor-scroller-label");
|
|
180
|
+
return { __sfc: !0, t, props: n, emit: e, navigationRef: c, computedItems: i, enabledItems: l, top: d, bottom: s, scrollToTargets: r, navigationConditionalClasses: u, relativeActiveIndex: a, debouncedActiveIndex: f, currentActiveIndex: b, navLabelId: v, BentoTypography: E, FixedScroller: O, AnchorScrollerList: J };
|
|
154
181
|
}
|
|
155
182
|
});
|
|
156
|
-
var
|
|
183
|
+
var X = function() {
|
|
157
184
|
var e = this, n = e._self._c, t = e._self._setupProxy;
|
|
158
185
|
return t.computedItems.length ? n("div", { staticClass: "b-anchor-scroller" }, [n("nav", { ref: "navigationRef", staticClass: "b-anchor-scroller__navigation", class: t.navigationConditionalClasses, attrs: { "aria-labelledby": t.navLabelId } }, [n(t.FixedScroller, { attrs: { condensed: "", centered: "" } }, [n("div", { staticClass: "b-anchor-scroller__navigation-panel" }, [n(t.BentoTypography, { staticClass: "b-anchor-scroller__navigation-panel-label", attrs: { id: t.navLabelId, el: "span", stronger: "" } }, [e._v(" " + e._s(t.t("jumpTo")) + " ")]), n(t.AnchorScrollerList, { attrs: { items: t.computedItems, "active-index": t.currentActiveIndex, "scroll-offset": t.bottom } })], 1)])], 1), e._t("default")], 2) : e._e();
|
|
159
|
-
},
|
|
160
|
-
Y,
|
|
161
|
-
q,
|
|
186
|
+
}, Y = [], q = /* @__PURE__ */ w(
|
|
162
187
|
G,
|
|
188
|
+
X,
|
|
189
|
+
Y,
|
|
163
190
|
!1,
|
|
164
191
|
null,
|
|
165
192
|
"ae16e25c"
|
|
166
193
|
);
|
|
167
|
-
const se =
|
|
194
|
+
const se = q.exports;
|
|
168
195
|
export {
|
|
169
196
|
se as a
|
|
170
197
|
};
|
|
171
|
-
//# sourceMappingURL=anchor-scroller.
|
|
198
|
+
//# sourceMappingURL=anchor-scroller.DWaykZQj.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchor-scroller.CjJ26PJS.js","sources":["../../src/components/anchor-scroller/components/anchor-scroller-list/anchor-scroller-list.vue","../../src/components/anchor-scroller/composables/use-scroll-spy/use-scroll-spy.ts","../../src/components/anchor-scroller/anchor-scroller.vue"],"sourcesContent":["<template>\n <ul class=\"b-anchor-scroller-list\" @keydown=\"onKeydownNavigation\">\n <li v-for=\"({ title, disabled, elementRef }, index) in items\" :key=\"index\" class=\"b-anchor-scroller-list__item\">\n <bento-button\n ref=\"listItemRefs\"\n :aria-current=\"activeIndex === index ? 'location' : null\"\n class=\"b-anchor-scroller-list__item-button\"\n :class=\"{\n 'b-anchor-scroller-list__item-button--active': activeIndex === index,\n 'b-anchor-scroller-list__item-button--disabled': disabled,\n }\"\n :aria-disabled=\"disabled\"\n :tabindex=\"activeIndex === index ? null : '-1'\"\n variant=\"tertiary-with-background\"\n @click=\"scrollToSection(elementRef, disabled)\"\n @keydown.space.native.prevent=\"scrollToSection(elementRef, disabled)\"\n @keydown.enter.native.prevent=\"scrollToSection(elementRef, disabled)\"\n >\n {{ title }}\n </bento-button>\n </li>\n </ul>\n</template>\n\n<script setup lang=\"ts\">\n import BentoButton from '@/components/button/button.vue';\n import { unrefElement } from '@/directives/click-outside/utils';\n import { printDevelopmentWarning } from '@/utils/ts/print-development-warning';\n import { type BentoAnchorScrollerItem } from '../../anchor-scroller.types';\n import { type AnchorScrollerListProps } from './anchor-scroller-list.types';\n import { computed, ref, watch } from 'vue';\n import { useCycleList } from '@vueuse/core';\n\n const props = defineProps({\n activeIndex: { default: undefined },\n items: null,\n scrollOffset: { default: undefined }\n});\n\n const listItemRefs = ref([]);\n const listIndices = computed(() =>\n props.items\n .map((item, index) => ({ disabled: item.disabled, originalIndex: index }))\n .filter(({ disabled }) => !disabled)\n .map(({ originalIndex }) => originalIndex)\n );\n\n const {\n state: focusedIndex,\n next,\n prev,\n } = useCycleList(listIndices, {\n initialValue: props.activeIndex ?? listIndices.value[0],\n });\n\n watch(focusedIndex, async newIndex => {\n const targetComponent = listItemRefs.value[newIndex];\n const el = unrefElement(targetComponent); // Handles Component or DOM node\n\n if (el && typeof el.focus === 'function') {\n el.focus();\n }\n });\n\n const scrollToSection = (elementRef: BentoAnchorScrollerItem['elementRef'], disabled?: boolean) => {\n if (disabled) {\n return;\n }\n\n const el = unrefElement(elementRef);\n\n if (!el) {\n printDevelopmentWarning(`[bento-anchor-scroller] element ref not found`);\n return;\n }\n\n if (!el.style.scrollMarginTop && props.scrollOffset) {\n const currentScrollMargin = window.getComputedStyle(el).scrollMarginTop;\n\n if (currentScrollMargin === '0px' || currentScrollMargin === '') {\n el.style.scrollMarginTop = `${props.scrollOffset}px`;\n }\n }\n\n if (!el.hasAttribute('tabindex')) {\n el.setAttribute('tabindex', '-1');\n }\n\n el.scrollIntoView({\n behavior: 'smooth',\n block: 'start',\n inline: 'nearest',\n });\n\n el.focus({ preventScroll: true });\n };\n\n const onKeydownNavigation = (e: KeyboardEvent) => {\n switch (e.key) {\n case 'ArrowRight':\n e.preventDefault();\n next();\n break;\n case 'ArrowLeft':\n e.preventDefault();\n prev();\n break;\n case 'Home':\n e.preventDefault();\n focusedIndex.value = 0;\n break;\n case 'End':\n e.preventDefault();\n focusedIndex.value = listIndices.value.length - 1;\n break;\n }\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./anchor-scroller-list.scss\" />\n","import { type Ref, ref, watchEffect } from 'vue';\nimport { type MaybeRef, toValue, useWindowScroll, useWindowSize, watchThrottled } from '@vueuse/core';\n\n/**\n * Options for the useScrollSpy composable.\n */\nexport interface useScrollSpyOptions {\n /**\n * The default active index to use when no item is active or initially.\n */\n default?: Ref<number>;\n}\n\n/**\n * Composable to spy on scroll position and determine the active item based on visibility.\n *\n * @param items - The list of elements to spy on.\n * @param options - Configuration options for the scroll spy.\n * @returns An object containing the active index.\n */\nexport const useScrollSpy = (items: MaybeRef<Array<Element>>, options: useScrollSpyOptions) => {\n const activeIndex = ref(options.default?.value ?? -1);\n\n const { y: scrollY } = useWindowScroll();\n const { height: windowHeight } = useWindowSize();\n\n // Logic to find the \"winner\" when there are multiple items on the same page\n const calculateActiveIndex = () => {\n const list = toValue(items);\n const viewportHeight = windowHeight.value;\n const midpoint = viewportHeight / 2;\n\n let winnerIndex = -1;\n let maxVisibleRatio = 0;\n\n for (let i = 0; i < list.length; i++) {\n const item = list[i];\n const el = item;\n\n if (!el) {\n continue;\n }\n\n const rect = el.getBoundingClientRect();\n\n // Constraint 1: Must pass midpoint\n if (rect.top > midpoint) {\n continue;\n }\n\n // Constraint 2: Must be visible\n const visibleHeight = Math.min(rect.bottom, viewportHeight) - Math.max(rect.top, 0);\n if (visibleHeight <= 0) {\n continue;\n }\n\n // Constraint 3: Highest visible % wins\n const ratio = visibleHeight / rect.height;\n\n if (ratio > maxVisibleRatio) {\n maxVisibleRatio = ratio;\n winnerIndex = i;\n }\n }\n\n // Only update if changed to avoid unnecessary patch triggers\n if (winnerIndex !== -1 && activeIndex.value !== winnerIndex) {\n activeIndex.value = winnerIndex;\n }\n };\n\n watchThrottled([scrollY, windowHeight], calculateActiveIndex, { throttle: 100, trailing: true });\n\n watchEffect(() => {\n if (toValue(items).length) {\n calculateActiveIndex();\n }\n });\n\n return {\n activeIndex,\n };\n};\n","<template>\n <div v-if=\"computedItems.length\" class=\"b-anchor-scroller\">\n <nav\n ref=\"navigationRef\"\n class=\"b-anchor-scroller__navigation\"\n :class=\"navigationConditionalClasses\"\n :aria-labelledby=\"navLabelId\"\n >\n <fixed-scroller condensed centered>\n <div class=\"b-anchor-scroller__navigation-panel\">\n <bento-typography\n :id=\"navLabelId\"\n el=\"span\"\n class=\"b-anchor-scroller__navigation-panel-label\"\n stronger\n >\n {{ t('jumpTo') }}\n </bento-typography>\n\n <anchor-scroller-list\n :items=\"computedItems\"\n :active-index=\"currentActiveIndex\"\n :scroll-offset=\"bottom\"\n />\n </div>\n </fixed-scroller>\n </nav>\n\n <slot />\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, ref, toRef, watch } from 'vue';\n import { refDebounced, useElementBounding } from '@vueuse/core';\n import BentoTypography from '@/components/typography/typography.vue';\n import { FixedScroller } from '@/internal';\n import { type BentoAnchorScrollerItem, type BentoAnchorScrollerProps } from './anchor-scroller.types';\n import { AnchorScrollerList } from './components/anchor-scroller-list';\n import { useI18n } from '@/utils/ts/i18n';\n import { generateUid } from '@/core/utils/ts';\n import { unrefElement } from '@/directives/click-outside/utils';\n import messages from './messages.json';\n import { useScrollSpy } from './composables';\n import { printDevelopmentWarning } from '@/utils/ts/print-development-warning';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const props = defineProps({\n activeIndex: { default: undefined },\n items: null\n});\n\n const emit = defineEmits([\"update:active-index\"]);\n\n const navigationRef = ref(null);\n\n const computedItems = computed<Array<BentoAnchorScrollerItem>>(() => props.items.map(item => ({ ...item })));\n\n // Skip and cache only items that are enabled\n const enabledItems = computed(() =>\n props.items\n .map((item, originalIndex) => ({\n element: unrefElement(item.elementRef),\n originalIndex,\n disabled: item.disabled,\n }))\n .filter(\n (item): item is { element: Element; originalIndex: number; disabled: boolean } =>\n !item.disabled && !!item.element\n )\n );\n\n const { top, bottom } = useElementBounding(navigationRef);\n\n // Extract strictly the elements for the ScrollSpy to watch\n const scrollToTargets = computed(() => enabledItems.value.map(c => c.element));\n\n const navigationConditionalClasses = computed(() => ({\n 'b-anchor-scroller__navigation--pinned': top.value <= 1,\n }));\n\n const { activeIndex: relativeActiveIndex } = useScrollSpy(scrollToTargets, {\n default: toRef(props, 'activeIndex'),\n });\n\n const debouncedActiveIndex = refDebounced(relativeActiveIndex, 200);\n\n const currentActiveIndex = computed(() => {\n const candidate = enabledItems.value[debouncedActiveIndex.value];\n\n return candidate ? candidate.originalIndex : 0;\n });\n\n watch(currentActiveIndex, val => {\n if (Number.isFinite(val)) {\n emit('update:active-index', val);\n }\n });\n\n watch(\n () => props.activeIndex,\n val => {\n if (Number.isFinite(val) && computedItems.value[val].disabled) {\n printDevelopmentWarning(`[bento-anchor-scroller] activeIndex should not be a disabled item`);\n }\n }\n );\n\n const navLabelId = generateUid('bento-anchor-scroller-label');\n</script>\n\n<script lang=\"ts\">\n /**\n * A navigation component that tracks page scroll and allows jumping to sections.\n *\n * @example\n * import { BentoAnchorScroller } from '@adyen/bento-vue2';\n * import { ref } from 'vue';\n *\n * export default {\n * components: { BentoAnchorScroller },\n * template: `\n * <bento-anchor-scroller :items=\"items\">\n * <section ref=\"section1\">Section 1</section>\n * <section ref=\"section2\">Section 2</section>\n * </bento-anchor-scroller>\n * `,\n * setup() {\n * const section1 = ref(null);\n * const section2 = ref(null);\n * const items = ref([\n * { title: 'Section 1', elementRef: section1 },\n * { title: 'Section 2', elementRef: section2 },\n * ]);\n * return {\n * items,\n * section1,\n * section2,\n * }\n * }\n * }\n */\n export default {\n i18n: { messages },\n name: 'bento-anchor-scroller',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./anchor-scroller.scss\" />\n"],"names":["listItemRefs","ref","listIndices","computed","props","item","index","disabled","originalIndex","focusedIndex","next","prev","useCycleList","watch","newIndex","targetComponent","el","unrefElement","elementRef","printDevelopmentWarning","currentScrollMargin","e","useScrollSpy","items","options","activeIndex","_a","scrollY","useWindowScroll","windowHeight","useWindowSize","calculateActiveIndex","list","toValue","viewportHeight","midpoint","winnerIndex","maxVisibleRatio","i","rect","visibleHeight","ratio","watchThrottled","watchEffect","__default__","messages","useI18n","navigationRef","computedItems","enabledItems","top","bottom","useElementBounding","scrollToTargets","c","navigationConditionalClasses","relativeActiveIndex","toRef","debouncedActiveIndex","refDebounced","currentActiveIndex","candidate","val","emit","navLabelId","generateUid"],"mappings":";;;;;;;;;;;;;;;;;;iBAuCIA,IAAAC,EAAA,CAAA,CAAA,GACAC,IAAAC;AAAA,MAAoB,MAAAC,EAAA,MAAA,IAAA,CAAAC,GAAAC,OAAA,EAAA,UAAAD,EAAA,UAAA,eAAAC,EAAA,EAAA,EAAA,OAAA,CAAA,EAAA,UAAAC,EAAA,MAAA,CAAAA,CAAA,EAAA,IAAA,CAAA,EAAA,eAAAC,EAAA,MAAAA,CAAA;AAAA,IAI6B,GAGjD;AAAA,MAAM,OAAAC;AAAA,MACK,MAAAC;AAAA,MACP,MAAAC;AAAA,IACA,IAAAC,EAAAV,GAAA;AAAA,MAC0B,cAAAE,EAAA,eAAAF,EAAA,MAAA,CAAA;AAAA,IAC4B,CAAA;AAG1D,WAAAW,EAAAJ,GAAA,OAAAK,MAAA;AACI,YAAAC,IAAAf,EAAA,MAAAc,CAAA,GACAE,IAAAC,EAAAF,CAAA;AAEA,MAAAC,K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EgC;AAAA,IACjC,GAGR,EAAA,KAAA6C,GAAA,QAAAC,EAAA,IAAAC,EAAAL,CAAA,GAGAM,IAAAlD,EAAA,MAAA8C,EAAA,MAAA,IAAA,CAAAK,MAAAA,EAAA,OAAA,CAAA,GAEAC,IAAApD,EAAA,OAAA;AAAA,MAAqD,yCAAA+C,EAAA,SAAA;AAAA,IACK,EAAA,GAG1D,EAAA,aAAAM,EAAA,IAAAlC,EAAA+B,GAAA;AAAA,MAA2E,SAAAI,EAAArD,GAAA,aAAA;AAAA,IACpC,CAAA,GAGvCsD,IAAAC,EAAAH,GAAA,GAAA,GAEAI,IAAAzD,EAAA,MAAA;AACI,YAAA0D,IAAAZ,EAAA,MAAAS,EAAA,KAAA;AAEA,aAAAG,IAAAA,EAAA,gBAAA;AAAA,IAA6C,CAAA;AAGjD,IAAAhD,EAAA+C,GAAA,CAAAE,MAAA;AACI,MAAA,OAAA,SAAAA,CAAA,KACIC,EAAA,uBAAAD,CAAA;AAAA,IACJ,CAAA,GAGJjD;AAAA,MAAA,MAAAT,EAAA;AAAA,MACgB,CAAA0D,MAAA;AAER,QAAA,OAAA,SAAAA,CAAA,KAAAd,EAAA,MAAAc,CAAA,EAAA,YACI3C,EAAA,mEAAA;AAAA,MACJ;AAAA,IACJ;AAGJ,UAAA6C,IAAAC,EAAA,6BAAA;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"anchor-scroller.DWaykZQj.js","sources":["../../src/components/anchor-scroller/components/anchor-scroller-list/anchor-scroller-list.vue","../../src/components/anchor-scroller/composables/use-scroll-spy/use-scroll-spy.ts","../../src/components/anchor-scroller/anchor-scroller.vue"],"sourcesContent":["<template>\n <ul class=\"b-anchor-scroller-list\" @keydown=\"onKeydownNavigation\">\n <li v-for=\"({ title, disabled, elementRef }, index) in items\" :key=\"index\" class=\"b-anchor-scroller-list__item\">\n <bento-button\n ref=\"listItemRefs\"\n :aria-current=\"activeIndex === index ? 'location' : null\"\n class=\"b-anchor-scroller-list__item-button\"\n :class=\"{\n 'b-anchor-scroller-list__item-button--active': activeIndex === index,\n 'b-anchor-scroller-list__item-button--disabled': disabled,\n }\"\n :aria-disabled=\"disabled\"\n :tabindex=\"activeIndex === index ? null : '-1'\"\n variant=\"tertiary-with-background\"\n @click=\"scrollToSection(elementRef, disabled)\"\n @keydown.space.native.prevent=\"scrollToSection(elementRef, disabled)\"\n @keydown.enter.native.prevent=\"scrollToSection(elementRef, disabled)\"\n >\n {{ title }}\n </bento-button>\n </li>\n </ul>\n</template>\n\n<script setup lang=\"ts\">\n import BentoButton from '@/components/button/button.vue';\n import { unrefElement } from '@/directives/click-outside/utils';\n import { printDevelopmentWarning } from '@/utils/ts/print-development-warning';\n import { type BentoAnchorScrollerItem } from '../../anchor-scroller.types';\n import { type AnchorScrollerListProps } from './anchor-scroller-list.types';\n import { computed, ref, watch } from 'vue';\n import { useCycleList } from '@vueuse/core';\n\n const props = defineProps({\n activeIndex: { default: undefined },\n items: null,\n scrollOffset: { default: undefined }\n});\n\n const listItemRefs = ref([]);\n const listIndices = computed(() =>\n props.items\n .map((item, index) => ({ disabled: item.disabled, originalIndex: index }))\n .filter(({ disabled }) => !disabled)\n .map(({ originalIndex }) => originalIndex)\n );\n\n const {\n state: focusedIndex,\n next,\n prev,\n } = useCycleList(listIndices, {\n initialValue: props.activeIndex ?? listIndices.value[0],\n });\n\n watch(focusedIndex, async newIndex => {\n const targetComponent = listItemRefs.value[newIndex];\n const el = unrefElement(targetComponent); // Handles Component or DOM node\n\n if (el && typeof el.focus === 'function') {\n el.focus();\n }\n });\n\n const scrollToSection = (elementRef: BentoAnchorScrollerItem['elementRef'], disabled?: boolean) => {\n if (disabled) {\n return;\n }\n\n const el = unrefElement(elementRef);\n\n if (!el) {\n printDevelopmentWarning(`[bento-anchor-scroller] element ref not found`);\n return;\n }\n\n if (!el.style.scrollMarginTop && props.scrollOffset) {\n const currentScrollMargin = window.getComputedStyle(el).scrollMarginTop;\n\n if (currentScrollMargin === '0px' || currentScrollMargin === '') {\n el.style.scrollMarginTop = `${props.scrollOffset}px`;\n }\n }\n\n if (!el.hasAttribute('tabindex')) {\n el.setAttribute('tabindex', '-1');\n }\n\n el.scrollIntoView({\n behavior: 'smooth',\n block: 'start',\n inline: 'nearest',\n });\n\n el.focus({ preventScroll: true });\n };\n\n const onKeydownNavigation = (e: KeyboardEvent) => {\n switch (e.key) {\n case 'ArrowRight':\n e.preventDefault();\n next();\n break;\n case 'ArrowLeft':\n e.preventDefault();\n prev();\n break;\n case 'Home':\n e.preventDefault();\n focusedIndex.value = 0;\n break;\n case 'End':\n e.preventDefault();\n focusedIndex.value = listIndices.value.length - 1;\n break;\n }\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./anchor-scroller-list.scss\" />\n","import { type Ref, ref, watchEffect } from 'vue';\nimport { type MaybeRef, toValue, useWindowScroll, useWindowSize, watchThrottled } from '@vueuse/core';\n\n/**\n * Options for the useScrollSpy composable.\n */\nexport interface useScrollSpyOptions {\n /**\n * The default active index to use when no item is active or initially.\n */\n default?: Ref<number>;\n}\n\n/**\n * Composable to spy on scroll position and determine the active item based on visibility.\n *\n * @param items - The list of elements to spy on.\n * @param options - Configuration options for the scroll spy.\n * @returns An object containing the active index.\n */\nexport const useScrollSpy = (items: MaybeRef<Array<Element>>, options: useScrollSpyOptions) => {\n const activeIndex = ref(options.default?.value ?? -1);\n\n const { y: scrollY } = useWindowScroll();\n const { height: windowHeight } = useWindowSize();\n\n // Logic to find the \"winner\" when there are multiple items on the same page\n const calculateActiveIndex = () => {\n const list = toValue(items);\n const viewportHeight = windowHeight.value;\n const midpoint = viewportHeight / 2;\n\n let winnerIndex = -1;\n let maxVisibleRatio = 0;\n\n for (let i = 0; i < list.length; i++) {\n const item = list[i];\n const el = item;\n\n if (!el) {\n continue;\n }\n\n const rect = el.getBoundingClientRect();\n\n // Constraint 1: Must pass midpoint\n if (rect.top > midpoint) {\n continue;\n }\n\n // Constraint 2: Must be visible\n const visibleHeight = Math.min(rect.bottom, viewportHeight) - Math.max(rect.top, 0);\n if (visibleHeight <= 0) {\n continue;\n }\n\n // Constraint 3: Highest visible % wins\n const ratio = visibleHeight / rect.height;\n\n if (ratio > maxVisibleRatio) {\n maxVisibleRatio = ratio;\n winnerIndex = i;\n }\n }\n\n // Only update if changed to avoid unnecessary patch triggers\n if (winnerIndex !== -1 && activeIndex.value !== winnerIndex) {\n activeIndex.value = winnerIndex;\n }\n };\n\n watchThrottled([scrollY, windowHeight], calculateActiveIndex, { throttle: 100, trailing: true });\n\n watchEffect(() => {\n if (toValue(items).length) {\n calculateActiveIndex();\n }\n });\n\n return {\n activeIndex,\n };\n};\n","<template>\n <div v-if=\"computedItems.length\" class=\"b-anchor-scroller\">\n <nav\n ref=\"navigationRef\"\n class=\"b-anchor-scroller__navigation\"\n :class=\"navigationConditionalClasses\"\n :aria-labelledby=\"navLabelId\"\n >\n <fixed-scroller condensed centered>\n <div class=\"b-anchor-scroller__navigation-panel\">\n <bento-typography\n :id=\"navLabelId\"\n el=\"span\"\n class=\"b-anchor-scroller__navigation-panel-label\"\n stronger\n >\n {{ t('jumpTo') }}\n </bento-typography>\n\n <anchor-scroller-list\n :items=\"computedItems\"\n :active-index=\"currentActiveIndex\"\n :scroll-offset=\"bottom\"\n />\n </div>\n </fixed-scroller>\n </nav>\n\n <slot />\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, ref, toRef, watch } from 'vue';\n import { refDebounced, useElementBounding } from '@vueuse/core';\n import BentoTypography from '@/components/typography/typography.vue';\n import { FixedScroller } from '@/internal';\n import { type BentoAnchorScrollerItem, type BentoAnchorScrollerProps } from './anchor-scroller.types';\n import { AnchorScrollerList } from './components/anchor-scroller-list';\n import { useI18n } from '@/utils/ts/i18n';\n import { generateUid } from '@/core/utils/ts';\n import { unrefElement } from '@/directives/click-outside/utils';\n import messages from './messages.json';\n import { useScrollSpy } from './composables';\n import { printDevelopmentWarning } from '@/utils/ts/print-development-warning';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const props = defineProps({\n activeIndex: { default: undefined },\n items: null\n});\n\n const emit = defineEmits([\"update:active-index\"]);\n\n const navigationRef = ref(null);\n\n const computedItems = computed<Array<BentoAnchorScrollerItem>>(() => props.items.map(item => ({ ...item })));\n\n // Skip and cache only items that are enabled\n const enabledItems = computed(() =>\n props.items\n .map((item, originalIndex) => ({\n element: unrefElement(item.elementRef),\n originalIndex,\n disabled: item.disabled,\n }))\n .filter(\n (item): item is { element: Element; originalIndex: number; disabled: boolean } =>\n !item.disabled && !!item.element\n )\n );\n\n const { top, bottom } = useElementBounding(navigationRef);\n\n // Extract strictly the elements for the ScrollSpy to watch\n const scrollToTargets = computed(() => enabledItems.value.map(c => c.element));\n\n const navigationConditionalClasses = computed(() => ({\n 'b-anchor-scroller__navigation--pinned': top.value <= 1,\n }));\n\n const { activeIndex: relativeActiveIndex } = useScrollSpy(scrollToTargets, {\n default: toRef(props, 'activeIndex'),\n });\n\n const debouncedActiveIndex = refDebounced(relativeActiveIndex, 200);\n\n const currentActiveIndex = computed(() => {\n const candidate = enabledItems.value[debouncedActiveIndex.value];\n\n return candidate ? candidate.originalIndex : 0;\n });\n\n watch(currentActiveIndex, val => {\n if (Number.isFinite(val)) {\n emit('update:active-index', val);\n }\n });\n\n watch(\n () => props.activeIndex,\n val => {\n if (Number.isFinite(val) && computedItems.value[val].disabled) {\n printDevelopmentWarning(`[bento-anchor-scroller] activeIndex should not be a disabled item`);\n }\n }\n );\n\n const navLabelId = generateUid('bento-anchor-scroller-label');\n</script>\n\n<script lang=\"ts\">\n /**\n * A navigation component that tracks page scroll and allows jumping to sections.\n *\n * @example\n * import { BentoAnchorScroller } from '@adyen/bento-vue2';\n * import { ref } from 'vue';\n *\n * export default {\n * components: { BentoAnchorScroller },\n * template: `\n * <bento-anchor-scroller :items=\"items\">\n * <section ref=\"section1\">Section 1</section>\n * <section ref=\"section2\">Section 2</section>\n * </bento-anchor-scroller>\n * `,\n * setup() {\n * const section1 = ref(null);\n * const section2 = ref(null);\n * const items = ref([\n * { title: 'Section 1', elementRef: section1 },\n * { title: 'Section 2', elementRef: section2 },\n * ]);\n * return {\n * items,\n * section1,\n * section2,\n * }\n * }\n * }\n */\n export default {\n i18n: { messages },\n name: 'bento-anchor-scroller',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./anchor-scroller.scss\" />\n"],"names":["listItemRefs","ref","listIndices","computed","props","item","index","disabled","originalIndex","focusedIndex","next","prev","useCycleList","watch","newIndex","targetComponent","el","unrefElement","elementRef","printDevelopmentWarning","currentScrollMargin","e","useScrollSpy","items","options","activeIndex","_a","scrollY","useWindowScroll","windowHeight","useWindowSize","calculateActiveIndex","list","toValue","viewportHeight","midpoint","winnerIndex","maxVisibleRatio","i","rect","visibleHeight","ratio","watchThrottled","watchEffect","__default__","messages","useI18n","navigationRef","computedItems","enabledItems","top","bottom","useElementBounding","scrollToTargets","c","navigationConditionalClasses","relativeActiveIndex","toRef","debouncedActiveIndex","refDebounced","currentActiveIndex","candidate","val","emit","navLabelId","generateUid"],"mappings":";;;;;;;;;;;;;;;;;;iBAuCIA,IAAAC,EAAA,CAAA,CAAA,GACAC,IAAAC;AAAA,MAAoB,MAAAC,EAAA,MAAA,IAAA,CAAAC,GAAAC,OAAA,EAAA,UAAAD,EAAA,UAAA,eAAAC,EAAA,EAAA,EAAA,OAAA,CAAA,EAAA,UAAAC,EAAA,MAAA,CAAAA,CAAA,EAAA,IAAA,CAAA,EAAA,eAAAC,EAAA,MAAAA,CAAA;AAAA,IAI6B,GAGjD;AAAA,MAAM,OAAAC;AAAA,MACK,MAAAC;AAAA,MACP,MAAAC;AAAA,IACA,IAAAC,EAAAV,GAAA;AAAA,MAC0B,cAAAE,EAAA,eAAAF,EAAA,MAAA,CAAA;AAAA,IAC4B,CAAA;AAG1D,WAAAW,EAAAJ,GAAA,OAAAK,MAAA;AACI,YAAAC,IAAAf,EAAA,MAAAc,CAAA,GACAE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