@adyen/bento-vue2 1.97.0 → 1.98.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/index.d.ts +66 -1
- package/dist/action-bar.js +1 -1
- package/dist/ai-tag.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/calendar.css +1 -1
- package/dist/assets/card.css +1 -1
- package/dist/assets/data-grid.css +1 -1
- package/dist/assets/date.css +1 -1
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/draggable-handle.css +1 -1
- package/dist/assets/draggable.css +1 -0
- package/dist/assets/dropdown.css +1 -1
- package/dist/assets/file-uploader.css +1 -1
- package/dist/assets/filter-bar.css +1 -1
- package/dist/assets/header-meta.css +1 -1
- package/dist/assets/inspector.css +1 -1
- package/dist/assets/list-item.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.B890LCTe.js → action-bar.X-dXuOcv.js} +4 -4
- package/dist/chunks/{action-bar.B890LCTe.js.map → action-bar.X-dXuOcv.js.map} +1 -1
- package/dist/chunks/{ai-tag.C8RxACNj.js → ai-tag.Cdn4JK1m.js} +2 -2
- package/dist/chunks/{ai-tag.C8RxACNj.js.map → ai-tag.Cdn4JK1m.js.map} +1 -1
- package/dist/chunks/{anchor-scroller.B8VXotik.js → anchor-scroller.Bu7GtOqH.js} +5 -5
- package/dist/chunks/{anchor-scroller.B8VXotik.js.map → anchor-scroller.Bu7GtOqH.js.map} +1 -1
- package/dist/chunks/{base-modal.CDMoF3b_.js → base-modal.DgMSsQf3.js} +5 -5
- package/dist/chunks/{base-modal.CDMoF3b_.js.map → base-modal.DgMSsQf3.js.map} +1 -1
- package/dist/chunks/{button-actions-with-menu.DqDQ_gVX.js → button-actions-with-menu.BV5aDUCD.js} +3 -3
- package/dist/chunks/{button-actions-with-menu.DqDQ_gVX.js.map → button-actions-with-menu.BV5aDUCD.js.map} +1 -1
- package/dist/chunks/{button-actions.DKc63aCb.js → button-actions.BD4Dyp4U.js} +2 -2
- package/dist/chunks/{button-actions.DKc63aCb.js.map → button-actions.BD4Dyp4U.js.map} +1 -1
- package/dist/chunks/{calendar.BckAv9N_.js → calendar.B0GnBaAW.js} +154 -153
- package/dist/chunks/calendar.B0GnBaAW.js.map +1 -0
- package/dist/chunks/{card.ChBURa5R.js → card.Bm7JEsCC.js} +2 -2
- package/dist/chunks/{card.ChBURa5R.js.map → card.Bm7JEsCC.js.map} +1 -1
- package/dist/chunks/{checkbox-group.BAjvgXlc.js → checkbox-group.mgC7eJkE.js} +3 -3
- package/dist/chunks/{checkbox-group.BAjvgXlc.js.map → checkbox-group.mgC7eJkE.js.map} +1 -1
- package/dist/chunks/{checkbox.BAQDBNL6.js → checkbox.CBawZCc6.js} +2 -2
- package/dist/chunks/{checkbox.BAQDBNL6.js.map → checkbox.CBawZCc6.js.map} +1 -1
- package/dist/chunks/{code-snippet.nUo9bjhC.js → code-snippet.CpHbw0xj.js} +4 -4
- package/dist/chunks/{code-snippet.nUo9bjhC.js.map → code-snippet.CpHbw0xj.js.map} +1 -1
- package/dist/chunks/{controls-group.Bzpsrtcx.js → controls-group.BWzCb_GU.js} +2 -2
- package/dist/chunks/{controls-group.Bzpsrtcx.js.map → controls-group.BWzCb_GU.js.map} +1 -1
- package/dist/chunks/{copy.DVB6pQC8.js → copy.CWKdfVcd.js} +3 -3
- package/dist/chunks/{copy.DVB6pQC8.js.map → copy.CWKdfVcd.js.map} +1 -1
- package/dist/chunks/{dashboard-section.BDDVJpxY.js → dashboard-section.CRn7tlX_.js} +4 -4
- package/dist/chunks/{dashboard-section.BDDVJpxY.js.map → dashboard-section.CRn7tlX_.js.map} +1 -1
- package/dist/chunks/{dashed-underline.CfEmbgOv.js → dashed-underline.BoHt4iGu.js} +4 -4
- package/dist/chunks/{dashed-underline.CfEmbgOv.js.map → dashed-underline.BoHt4iGu.js.map} +1 -1
- package/dist/chunks/{data-grid-template.BUlLHTYe.js → data-grid-template.BYMLOzkm.js} +4 -4
- package/dist/chunks/{data-grid-template.BUlLHTYe.js.map → data-grid-template.BYMLOzkm.js.map} +1 -1
- package/dist/chunks/{data-grid.0OiCQjFc.js → data-grid.BRziyZ43.js} +19 -19
- package/dist/chunks/{data-grid.0OiCQjFc.js.map → data-grid.BRziyZ43.js.map} +1 -1
- package/dist/chunks/{date-picker.CsFSskqf.js → date-picker.CCJtLnE4.js} +7 -7
- package/dist/chunks/{date-picker.CsFSskqf.js.map → date-picker.CCJtLnE4.js.map} +1 -1
- package/dist/chunks/{date-range-picker.Bczgdu5X.js → date-range-picker.B2u5vm8m.js} +10 -10
- package/dist/chunks/{date-range-picker.Bczgdu5X.js.map → date-range-picker.B2u5vm8m.js.map} +1 -1
- package/dist/chunks/{date-time-picker.DT54TiG4.js → date-time-picker.CP-IrUwY.js} +5 -5
- package/dist/chunks/{date-time-picker.DT54TiG4.js.map → date-time-picker.CP-IrUwY.js.map} +1 -1
- package/dist/chunks/{date.B0m0sFP6.js → date.C1HnIyOv.js} +27 -25
- package/dist/chunks/date.C1HnIyOv.js.map +1 -0
- package/dist/chunks/{dialog-page.DYWnKdnP.js → dialog-page.BendBRv6.js} +10 -10
- package/dist/chunks/{dialog-page.DYWnKdnP.js.map → dialog-page.BendBRv6.js.map} +1 -1
- package/dist/chunks/draggable-handle.BnRkhlee.js +1611 -0
- package/dist/chunks/draggable-handle.BnRkhlee.js.map +1 -0
- package/dist/chunks/draggable.D5WFD5eX.js +193 -0
- package/dist/chunks/draggable.D5WFD5eX.js.map +1 -0
- package/dist/chunks/{drawer.WW7G9cSC.js → drawer.BuCNjIKQ.js} +2 -2
- package/dist/chunks/{drawer.WW7G9cSC.js.map → drawer.BuCNjIKQ.js.map} +1 -1
- package/dist/chunks/{dropdown-tag.BqSrkuwj.js → dropdown-tag.LIt7SdwS.js} +3 -3
- package/dist/chunks/{dropdown-tag.BqSrkuwj.js.map → dropdown-tag.LIt7SdwS.js.map} +1 -1
- package/dist/chunks/{dropdown.CIEm6MBB.js → dropdown.NTGSuWAw.js} +847 -822
- package/dist/chunks/dropdown.NTGSuWAw.js.map +1 -0
- package/dist/chunks/{field-label.CdVbAfK-.js → field-label.CkMM3cXO.js} +2 -2
- package/dist/chunks/{field-label.CdVbAfK-.js.map → field-label.CkMM3cXO.js.map} +1 -1
- package/dist/chunks/{file-uploader.DOvQMUHC.js → file-uploader.BLoJVqZQ.js} +3 -3
- package/dist/chunks/{file-uploader.DOvQMUHC.js.map → file-uploader.BLoJVqZQ.js.map} +1 -1
- package/dist/chunks/{filter-bar.DVRPM9tf.js → filter-bar.CftgpM7Z.js} +20 -20
- package/dist/chunks/filter-bar.CftgpM7Z.js.map +1 -0
- package/dist/chunks/{focus-trap.CBIb3SyN.js → focus-trap.CUZQ1kQD.js} +2 -2
- package/dist/chunks/{focus-trap.CBIb3SyN.js.map → focus-trap.CUZQ1kQD.js.map} +1 -1
- package/dist/chunks/{footer-actions.C1sXd7ti.js → footer-actions.C89dbDV4.js} +2 -2
- package/dist/chunks/{footer-actions.C1sXd7ti.js.map → footer-actions.C89dbDV4.js.map} +1 -1
- package/dist/chunks/generate-uid.NJ8tVoha.js.map +1 -1
- package/dist/chunks/{header-meta.D1eb37QJ.js → header-meta.Cpk3Z8c2.js} +56 -51
- package/dist/chunks/{header-meta.D1eb37QJ.js.map → header-meta.Cpk3Z8c2.js.map} +1 -1
- package/dist/chunks/{header-with-views.Bk6ly102.js → header-with-views.UmWf3dQd.js} +10 -10
- package/dist/chunks/{header-with-views.Bk6ly102.js.map → header-with-views.UmWf3dQd.js.map} +1 -1
- package/dist/chunks/{header.CszOmM16.js → header.BRBY9Ilh.js} +3 -3
- package/dist/chunks/{header.CszOmM16.js.map → header.BRBY9Ilh.js.map} +1 -1
- package/dist/chunks/{index.CJYgd0QI.js → index.BPUMyryR.js} +14 -14
- package/dist/chunks/{index.CJYgd0QI.js.map → index.BPUMyryR.js.map} +1 -1
- package/dist/chunks/{info-icon.9Nt7zg3D.js → info-icon.ZVQsMymB.js} +3 -3
- package/dist/chunks/{info-icon.9Nt7zg3D.js.map → info-icon.ZVQsMymB.js.map} +1 -1
- package/dist/chunks/{input-field-password.C4Wxsl16.js → input-field-password.bhLfqs6p.js} +5 -5
- package/dist/chunks/{input-field-password.C4Wxsl16.js.map → input-field-password.bhLfqs6p.js.map} +1 -1
- package/dist/chunks/{input-field-phone-number.BhYTU628.js → input-field-phone-number.cAROnxRW.js} +2 -2
- package/dist/chunks/{input-field-phone-number.BhYTU628.js.map → input-field-phone-number.cAROnxRW.js.map} +1 -1
- package/dist/chunks/{input-field.3tzX7t2y.js → input-field.BgVjWpiF.js} +3 -3
- package/dist/chunks/{input-field.3tzX7t2y.js.map → input-field.BgVjWpiF.js.map} +1 -1
- package/dist/chunks/{input-time.Bf-ZrCPX.js → input-time.C5qQ6S8d.js} +3 -3
- package/dist/chunks/{input-time.Bf-ZrCPX.js.map → input-time.C5qQ6S8d.js.map} +1 -1
- package/dist/chunks/{inspector.BY3SoX-l.js → inspector.8QKfd0HF.js} +3 -3
- package/dist/chunks/{inspector.BY3SoX-l.js.map → inspector.8QKfd0HF.js.map} +1 -1
- package/dist/chunks/{layout-row.BI9ZJa-9.js → layout-row.CTBhpBUq.js} +9 -9
- package/dist/chunks/{layout-row.BI9ZJa-9.js.map → layout-row.CTBhpBUq.js.map} +1 -1
- package/dist/chunks/list-item.BxQkbnLZ.js +193 -0
- package/dist/chunks/list-item.BxQkbnLZ.js.map +1 -0
- package/dist/chunks/{listbox-option-tag.Ddyl2vuc.js → listbox-option-tag.BFW39wpD.js} +2 -2
- package/dist/chunks/{listbox-option-tag.Ddyl2vuc.js.map → listbox-option-tag.BFW39wpD.js.map} +1 -1
- package/dist/chunks/{modal-fullscreen.Dg1Hi3jB.js → modal-fullscreen.CH2wwAtk.js} +4 -4
- package/dist/chunks/{modal-fullscreen.Dg1Hi3jB.js.map → modal-fullscreen.CH2wwAtk.js.map} +1 -1
- package/dist/chunks/{modal.DZTEFM_E.js → modal.e1Ym209E.js} +4 -4
- package/dist/chunks/{modal.DZTEFM_E.js.map → modal.e1Ym209E.js.map} +1 -1
- package/dist/chunks/{navigation-menu-group.Dv2_ZRRq.js → navigation-menu-group.E1Oam9-n.js} +3 -3
- package/dist/chunks/{navigation-menu-group.Dv2_ZRRq.js.map → navigation-menu-group.E1Oam9-n.js.map} +1 -1
- package/dist/chunks/{pagination.C6HIPq58.js → pagination.BzLKzijQ.js} +2 -2
- package/dist/chunks/{pagination.C6HIPq58.js.map → pagination.BzLKzijQ.js.map} +1 -1
- package/dist/chunks/popover.types.ZXsQ9bA6.js +6 -0
- package/dist/chunks/{popover.types.B9TXaqAt.js.map → popover.types.ZXsQ9bA6.js.map} +1 -1
- package/dist/chunks/{popper-container.CFYFCz6u.js → popper-container.dxpRn9a5.js} +2 -2
- package/dist/chunks/{popper-container.CFYFCz6u.js.map → popper-container.dxpRn9a5.js.map} +1 -1
- package/dist/chunks/{promo-banner.tljKS80K.js → promo-banner.BVBt9w4u.js} +2 -2
- package/dist/chunks/{promo-banner.tljKS80K.js.map → promo-banner.BVBt9w4u.js.map} +1 -1
- package/dist/chunks/{radio-group.cn4lZb8R.js → radio-group.D5fpHqkP.js} +3 -3
- package/dist/chunks/{radio-group.cn4lZb8R.js.map → radio-group.D5fpHqkP.js.map} +1 -1
- package/dist/chunks/{rich-text-editor.-B96ibAd.js → rich-text-editor.VWCBSRmM.js} +4 -4
- package/dist/chunks/{rich-text-editor.-B96ibAd.js.map → rich-text-editor.VWCBSRmM.js.map} +1 -1
- package/dist/chunks/{search-bar.DunTxVmZ.js → search-bar.Be3RlmLA.js} +3 -3
- package/dist/chunks/{search-bar.DunTxVmZ.js.map → search-bar.Be3RlmLA.js.map} +1 -1
- package/dist/chunks/{secondary-nav.CGGPkYpc.js → secondary-nav.Cy4ap53E.js} +4 -4
- package/dist/chunks/{secondary-nav.CGGPkYpc.js.map → secondary-nav.Cy4ap53E.js.map} +1 -1
- package/dist/chunks/{segmented-control.C0JtDa4q.js → segmented-control.BOyYIUEp.js} +2 -2
- package/dist/chunks/{segmented-control.C0JtDa4q.js.map → segmented-control.BOyYIUEp.js.map} +1 -1
- package/dist/chunks/{selection-card-group.ZZ_qF1L1.js → selection-card-group.lNZ8z318.js} +3 -3
- package/dist/chunks/{selection-card-group.ZZ_qF1L1.js.map → selection-card-group.lNZ8z318.js.map} +1 -1
- package/dist/chunks/{sidepanel.ChuW63J7.js → sidepanel.CN_u-b5X.js} +5 -5
- package/dist/chunks/{sidepanel.ChuW63J7.js.map → sidepanel.CN_u-b5X.js.map} +1 -1
- package/dist/chunks/{structured-list-item.DE0L0kvs.js → structured-list-item.CL1jhdTX.js} +4 -4
- package/dist/chunks/{structured-list-item.DE0L0kvs.js.map → structured-list-item.CL1jhdTX.js.map} +1 -1
- package/dist/chunks/{summary-grid.types.BnEhhDQz.js → summary-grid.types.Cjrwg4vd.js} +5 -5
- package/dist/chunks/{summary-grid.types.BnEhhDQz.js.map → summary-grid.types.Cjrwg4vd.js.map} +1 -1
- package/dist/chunks/{tab.QEKU5Udp.js → tab.B2qRfTqx.js} +2 -2
- package/dist/chunks/{tab.QEKU5Udp.js.map → tab.B2qRfTqx.js.map} +1 -1
- package/dist/chunks/{tag.CbNFG45Y.js → tag.XeZzHnx_.js} +2 -2
- package/dist/chunks/{tag.CbNFG45Y.js.map → tag.XeZzHnx_.js.map} +1 -1
- package/dist/chunks/{textarea.DJ7095b6.js → textarea.CbCrtcQ2.js} +2 -2
- package/dist/chunks/{textarea.DJ7095b6.js.map → textarea.CbCrtcQ2.js.map} +1 -1
- package/dist/chunks/{timeline-item.DzMh520x.js → timeline-item.BVOztUi9.js} +7 -7
- package/dist/chunks/{timeline-item.DzMh520x.js.map → timeline-item.BVOztUi9.js.map} +1 -1
- package/dist/chunks/{tooltip.CnkqMpOA.js → tooltip.CGeGVHyl.js} +3 -3
- package/dist/chunks/{tooltip.CnkqMpOA.js.map → tooltip.CGeGVHyl.js.map} +1 -1
- package/dist/chunks/{tutorial.CkeL_7Je.js → tutorial.WeP9PjhU.js} +4 -4
- package/dist/chunks/{tutorial.CkeL_7Je.js.map → tutorial.WeP9PjhU.js.map} +1 -1
- package/dist/chunks/{use-bento-delayed-hover.D4rfUUOr.js → use-bento-delayed-hover.CxJOLxok.js} +2 -2
- package/dist/chunks/{use-bento-delayed-hover.D4rfUUOr.js.map → use-bento-delayed-hover.CxJOLxok.js.map} +1 -1
- package/dist/chunks/{use-date-input-formatter.Dq9C0nc9.js → use-date-input-formatter.BMciZYTp.js} +2 -2
- package/dist/chunks/{use-date-input-formatter.Dq9C0nc9.js.map → use-date-input-formatter.BMciZYTp.js.map} +1 -1
- 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/date.js +1 -1
- package/dist/draggable.js +4 -3
- package/dist/draggable.js.map +1 -1
- package/dist/drawer.js +1 -1
- package/dist/dropdown.js +2 -2
- package/dist/file-uploader.js +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/focus-trap.js +1 -1
- package/dist/header-with-views.js +1 -1
- package/dist/header.js +1 -1
- package/dist/index.js +264 -263
- 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 +1 -1
- package/dist/inspector.js +1 -1
- package/dist/internal.js +11 -11
- package/dist/layout.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/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/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/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 +61 -1
- package/package.json +8 -8
- package/dist/chunks/calendar.BckAv9N_.js.map +0 -1
- package/dist/chunks/date.B0m0sFP6.js.map +0 -1
- package/dist/chunks/draggable-handle.DwJBaf5y.js +0 -1747
- package/dist/chunks/draggable-handle.DwJBaf5y.js.map +0 -1
- package/dist/chunks/dropdown.CIEm6MBB.js.map +0 -1
- package/dist/chunks/filter-bar.DVRPM9tf.js.map +0 -1
- package/dist/chunks/list-item.D2ZLiS_D.js +0 -76
- package/dist/chunks/list-item.D2ZLiS_D.js.map +0 -1
- package/dist/chunks/popover.types.B9TXaqAt.js +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline-item.DzMh520x.js","sources":["../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/formatDistanceStrict.js","../../src/components/timeline/timeline.types.ts","../../src/components/timeline/timeline.keys.ts","../../src/components/timeline/timeline.vue","../../../ui-assets/icons-16/dist/vue/square-small-fill.vue","../../src/components/timeline/components/timeline-item/timeline-item.vue"],"sourcesContent":["import { defaultLocale } from \"./_lib/defaultLocale.js\";\nimport { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { getRoundingMethod } from \"./_lib/getRoundingMethod.js\";\nimport { getTimezoneOffsetInMilliseconds } from \"./_lib/getTimezoneOffsetInMilliseconds.js\";\nimport { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { compareAsc } from \"./compareAsc.js\";\nimport {\n millisecondsInMinute,\n minutesInDay,\n minutesInMonth,\n minutesInYear,\n} from \"./constants.js\";\n\n/**\n * The {@link formatDistanceStrict} function options.\n */\n\n/**\n * The unit used to format the distance in {@link formatDistanceStrict}.\n */\n\n/**\n * @name formatDistanceStrict\n * @category Common Helpers\n * @summary Return the distance between the given dates in words.\n *\n * @description\n * Return the distance between the given dates in words, using strict units.\n * This is like `formatDistance`, but does not use helpers like 'almost', 'over',\n * 'less than' and the like.\n *\n * | Distance between dates | Result |\n * |------------------------|---------------------|\n * | 0 ... 59 secs | [0..59] seconds |\n * | 1 ... 59 mins | [1..59] minutes |\n * | 1 ... 23 hrs | [1..23] hours |\n * | 1 ... 29 days | [1..29] days |\n * | 1 ... 11 months | [1..11] months |\n * | 1 ... N years | [1..N] years |\n *\n * @param laterDate - The date\n * @param earlierDate - The date to compare with\n * @param options - An object with options\n *\n * @returns The distance in words\n *\n * @throws `date` must not be Invalid Date\n * @throws `baseDate` must not be Invalid Date\n * @throws `options.unit` must be 'second', 'minute', 'hour', 'day', 'month' or 'year'\n * @throws `options.locale` must contain `formatDistance` property\n *\n * @example\n * // What is the distance between 2 July 2014 and 1 January 2015?\n * const result = formatDistanceStrict(new Date(2014, 6, 2), new Date(2015, 0, 2))\n * //=> '6 months'\n *\n * @example\n * // What is the distance between 1 January 2015 00:00:15\n * // and 1 January 2015 00:00:00?\n * const result = formatDistanceStrict(\n * new Date(2015, 0, 1, 0, 0, 15),\n * new Date(2015, 0, 1, 0, 0, 0)\n * )\n * //=> '15 seconds'\n *\n * @example\n * // What is the distance from 1 January 2016\n * // to 1 January 2015, with a suffix?\n * const result = formatDistanceStrict(new Date(2015, 0, 1), new Date(2016, 0, 1), {\n * addSuffix: true\n * })\n * //=> '1 year ago'\n *\n * @example\n * // What is the distance from 1 January 2016\n * // to 1 January 2015, in minutes?\n * const result = formatDistanceStrict(new Date(2016, 0, 1), new Date(2015, 0, 1), {\n * unit: 'minute'\n * })\n * //=> '525600 minutes'\n *\n * @example\n * // What is the distance from 1 January 2015\n * // to 28 January 2015, in months, rounded up?\n * const result = formatDistanceStrict(new Date(2015, 0, 28), new Date(2015, 0, 1), {\n * unit: 'month',\n * roundingMethod: 'ceil'\n * })\n * //=> '1 month'\n *\n * @example\n * // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = formatDistanceStrict(new Date(2016, 7, 1), new Date(2015, 0, 1), {\n * locale: eoLocale\n * })\n * //=> '1 jaro'\n */\n\nexport function formatDistanceStrict(laterDate, earlierDate, options) {\n const defaultOptions = getDefaultOptions();\n const locale = options?.locale ?? defaultOptions.locale ?? defaultLocale;\n\n const comparison = compareAsc(laterDate, earlierDate);\n\n if (isNaN(comparison)) {\n throw new RangeError(\"Invalid time value\");\n }\n\n const localizeOptions = Object.assign({}, options, {\n addSuffix: options?.addSuffix,\n comparison: comparison,\n });\n\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n ...(comparison > 0 ? [earlierDate, laterDate] : [laterDate, earlierDate]),\n );\n\n const roundingMethod = getRoundingMethod(options?.roundingMethod ?? \"round\");\n\n const milliseconds = earlierDate_.getTime() - laterDate_.getTime();\n const minutes = milliseconds / millisecondsInMinute;\n\n const timezoneOffset =\n getTimezoneOffsetInMilliseconds(earlierDate_) -\n getTimezoneOffsetInMilliseconds(laterDate_);\n\n // Use DST-normalized difference in minutes for years, months and days;\n // use regular difference in minutes for hours, minutes and seconds.\n const dstNormalizedMinutes =\n (milliseconds - timezoneOffset) / millisecondsInMinute;\n\n const defaultUnit = options?.unit;\n let unit;\n if (!defaultUnit) {\n if (minutes < 1) {\n unit = \"second\";\n } else if (minutes < 60) {\n unit = \"minute\";\n } else if (minutes < minutesInDay) {\n unit = \"hour\";\n } else if (dstNormalizedMinutes < minutesInMonth) {\n unit = \"day\";\n } else if (dstNormalizedMinutes < minutesInYear) {\n unit = \"month\";\n } else {\n unit = \"year\";\n }\n } else {\n unit = defaultUnit;\n }\n\n // 0 up to 60 seconds\n if (unit === \"second\") {\n const seconds = roundingMethod(milliseconds / 1000);\n return locale.formatDistance(\"xSeconds\", seconds, localizeOptions);\n\n // 1 up to 60 mins\n } else if (unit === \"minute\") {\n const roundedMinutes = roundingMethod(minutes);\n return locale.formatDistance(\"xMinutes\", roundedMinutes, localizeOptions);\n\n // 1 up to 24 hours\n } else if (unit === \"hour\") {\n const hours = roundingMethod(minutes / 60);\n return locale.formatDistance(\"xHours\", hours, localizeOptions);\n\n // 1 up to 30 days\n } else if (unit === \"day\") {\n const days = roundingMethod(dstNormalizedMinutes / minutesInDay);\n return locale.formatDistance(\"xDays\", days, localizeOptions);\n\n // 1 up to 12 months\n } else if (unit === \"month\") {\n const months = roundingMethod(dstNormalizedMinutes / minutesInMonth);\n return months === 12 && defaultUnit !== \"month\"\n ? locale.formatDistance(\"xYears\", 1, localizeOptions)\n : locale.formatDistance(\"xMonths\", months, localizeOptions);\n\n // 1 year up to max Date\n } else {\n const years = roundingMethod(dstNormalizedMinutes / minutesInYear);\n return locale.formatDistance(\"xYears\", years, localizeOptions);\n }\n}\n\n// Fallback for modularized imports:\nexport default formatDistanceStrict;\n","import { type BentoDashedUnderlineProps } from '@/components/dashed-underline/dashed-underline.types';\nimport { type BentoDateFormat } from '@/components/date/date.types';\nimport { type BentoTag } from '@/components/tag';\nimport { type Ref } from 'vue';\nimport type { RouterLinkProps } from 'vue-router/types/router.d.ts';\n\nexport enum BentoTimelineShowMorePlacement {\n BOTTOM = 'bottom',\n AFTER_FIRST = 'after-first',\n BEFORE_LAST = 'before-last',\n}\n\nexport interface BentoTimelineShowMoreObject {\n limit: number;\n placement?: BentoTimelineShowMorePlacement;\n}\n\nexport enum BentoTimelineGapUnit {\n SECOND = 'second',\n MINUTE = 'minute',\n HOUR = 'hour',\n DAY = 'day',\n MONTH = 'month',\n YEAR = 'year',\n}\n\nexport interface BentoTimelineGapObject {\n amount: number;\n unit: BentoTimelineGapUnit;\n}\n\n/**\n * @deprecated Since v2.0.0. Do not use. Use the `status` prop instead.\n */\nexport enum BentoTimelineItemVariant {\n DEFAULT = 'SquareSmallIcon',\n SUCCESS = 'CheckedCircleIcon',\n CRITICAL = 'CrossCircleIcon',\n}\n\nexport enum BentoTimelineStatus {\n BLACK = 'black',\n BLUE = 'blue',\n GREEN = 'green',\n GREY = 'grey',\n ORANGE = 'orange',\n RED = 'red',\n YELLOW = 'yellow',\n}\n\nexport interface BentoTimelineItemTitle extends RouterLinkProps {\n /**\n * Link label.\n */\n title: string;\n /**\n * Set the rendered link to a regular external anchor link.\n */\n external?: boolean;\n\n /**\n * Sets the target of the rendered link.\n */\n target?: string;\n\n // This has been added to allow users to add HTML and Aria attribute\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [name: string]: any;\n}\n\nexport interface BentoTimelineTimestamp {\n date: Date | number;\n format?: BentoDateFormat;\n value?: string;\n description?: BentoDashedUnderlineProps;\n}\n\nexport interface BentoTimelineDataListObject {\n label: string;\n value: string;\n}\n\nexport type BentoTimelineDataList = Array<BentoTimelineDataListObject>;\n\nexport type BentoTimelineTagProps = InstanceType<typeof BentoTag>['$props'];\n\nexport interface BentoTimelineEntry {\n title?: string | BentoTimelineItemTitle;\n description?: string;\n date: Date | number;\n}\n\n/**\n * @deprecated Since v2.0.0. Do not use.\n */\nexport type BentoTimelineRegisterEntry = (props: {\n title?: string | BentoTimelineItemTitle;\n description?: string;\n date: Date | number;\n}) => { timelineEntries: Ref<Array<BentoTimelineEntry>>; index: number; unregisterTimelineEntry: () => void };\n\n/**\n * @private\n */\nexport type BentoInternalTimelineRegisterEntry = (\n entry: BentoTimelineEntry\n) => { timelineEntries: Ref<Array<BentoTimelineEntry>>; unregisterTimelineEntry: () => void };\n\nexport interface BentoTimelineConfigData {\n showAll: Ref<boolean>;\n showMoreIndex: Ref<number>;\n hiddenItems: Ref<number>;\n visibleIndexes: Ref<Array<number>>;\n timegapLimit: Ref<BentoTimelineGapObject>;\n timelineEntries: Ref<Array<BentoTimelineEntry>>;\n}\n\nexport interface BentoTimelineProps {\n /**\n * If set to true, gives the possibility to manually add notes to the timeline via a textarea\n */\n addNote?: boolean;\n /**\n * Object that determines the max number of items to show without clicking the show more button\n * and where in the timeline is the show more button placed\n */\n showMore?: BentoTimelineShowMoreObject;\n /**\n * Object that determines minimum amount of time for the automatic timegap indicator;\n * Define a unit (hour, day, month) and an amount (e.g. { amount: 7, unit: 'days' }).\n * If null, automatic timegap detection will be turned off\n */\n timegapLimit?: BentoTimelineGapObject;\n}\n\nexport interface BentoTimelineItemProps {\n /**\n * Additional timestamp of the event\n */\n additionalTimestamp?: BentoTimelineTimestamp;\n /**\n * Relevant key-value pair data to display in the event\n */\n dataList?: BentoTimelineDataList;\n /**\n * Description of the event\n */\n description?: string;\n /**\n * Modifier that changes the color of the timeline icon\n * @values blue, black, green, grey, orange, red, yellow\n */\n status?: string;\n /**\n * Tag props that will be passed down to inner tag component\n */\n tag?: BentoTimelineTagProps;\n /**\n * Main timestamp of the event. Used for timegap detection.\n */\n timestamp: BentoTimelineTimestamp;\n /**\n * Title of the event\n */\n title?: BentoTimelineItemTitle | string;\n /**\n * Type of the timeline item. If set to 'note', it renders a note item in the timeline. Defaults to 'milestone'.\n * @values milestone, note\n */\n type?: string;\n /**\n * Variant for the timeline item\n * @values DEFAULT, SUCCESS, CRITICAL\n *\n * @deprecated Since v2.0.0. Use `status` instead.\n */\n variant?: BentoTimelineItemVariant | `${BentoTimelineItemVariant}`;\n}\n","export const TIMELINE_REGISTER_ENTRY_INJECTION_KEY = Symbol('timeline register entry injection key');\nexport const TIMELINE_CONFIG_INJECTION_KEY = Symbol('timeline config obj injection key');\n","<template>\n <div class=\"b-timeline\">\n <div v-if=\"addNote\" class=\"b-timeline__add-note-section\">\n <bento-button\n v-if=\"!showAddNoteTextArea\"\n ref=\"addNoteButtonRef\"\n variant=\"tertiary\"\n @click=\"toggleAddNote\"\n >{{ addNoteLabel }}</bento-button\n >\n <div v-if=\"showAddNoteTextArea\">\n <bento-textarea\n ref=\"addNoteTextareaRef\"\n :label=\"addNoteLabel\"\n :character-limit=\"150\"\n resizable=\"vertical\"\n @update:model-value=\"updateNoteContent\"\n />\n <bento-button-actions\n :actions=\"[\n { title: addNoteLabel, event: addNoteToTimeline },\n { title: cancelLabel, event: toggleAddNote },\n ]\"\n />\n </div>\n </div>\n <ol class=\"b-timeline__items\">\n <slot />\n </ol>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, defineComponent, nextTick, provide, ref, type Ref, toRefs, watch } from 'vue';\n import { BentoButton, BentoButtonActions } from '@/components/button';\n import { BentoTextarea } from '@/components/textarea';\n import {\n type BentoInternalTimelineRegisterEntry,\n type BentoTimelineConfigData,\n type BentoTimelineEntry,\n type BentoTimelineProps,\n BentoTimelineShowMorePlacement,\n } from './timeline.types';\n import { TIMELINE_CONFIG_INJECTION_KEY, TIMELINE_REGISTER_ENTRY_INJECTION_KEY } from './timeline.keys';\n import messages from './messages.json';\n import { useI18n } from '@/utils/ts/i18n';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n addNote: { type: Boolean, default: false },\n showMore: { default: null },\n timegapLimit: { default: null }\n});\n\n const emit = defineEmits(['add-timeline-note']);\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const addNoteLabel = computed(() => t('addNote') as string);\n const cancelLabel = computed(() => t('cancel') as string);\n\n const newNoteContent: Ref<string> = ref();\n const updateNoteContent = (newTimelineNoteContent: string): void => {\n newNoteContent.value = newTimelineNoteContent;\n };\n\n const addNoteTextareaRef: Ref<InstanceType<typeof BentoTextarea>> = ref(null);\n const addNoteButtonRef: Ref<InstanceType<typeof BentoButton>> = ref(null);\n const showAddNoteTextArea = ref(false);\n const toggleAddNote = async () => {\n showAddNoteTextArea.value = !showAddNoteTextArea.value;\n\n await nextTick();\n\n if (showAddNoteTextArea.value) {\n (addNoteTextareaRef.value.$refs.textareaElement as HTMLTextAreaElement)?.focus();\n } else {\n (addNoteButtonRef.value.$el as HTMLButtonElement)?.focus();\n }\n };\n const addNoteToTimeline = () => {\n emit('add-timeline-note', {\n description: newNoteContent.value,\n timestamp: { date: new Date() },\n type: 'note',\n });\n toggleAddNote();\n };\n\n const timelineEntries = ref<Array<BentoTimelineEntry>>([]);\n const hiddenItems = computed(() =>\n props.showMore && timelineEntries.value.length > props.showMore.limit\n ? timelineEntries.value.length - props.showMore.limit\n : null\n );\n const showAll = ref(false);\n const { timegapLimit } = toRefs(props);\n\n const timelineIndexes = computed(() => Array.from(timelineEntries.value.keys()));\n\n const visibleIndexes = computed(() => {\n if (!props.showMore) {\n return null;\n }\n\n if (props.showMore.placement === BentoTimelineShowMorePlacement.BEFORE_LAST) {\n return [\n ...timelineIndexes.value.slice(0, props.showMore.limit - 1),\n timelineIndexes.value[timelineIndexes.value.length - 1],\n ];\n }\n\n if (props.showMore.placement === BentoTimelineShowMorePlacement.AFTER_FIRST) {\n return [timelineIndexes.value[0], ...timelineIndexes.value.slice(-(props.showMore.limit - 1))];\n }\n\n return timelineIndexes.value.slice(0, props.showMore.limit);\n });\n\n const showMoreIndex = computed(() => {\n if (!props.showMore) {\n return null;\n }\n\n switch (props.showMore.placement) {\n case BentoTimelineShowMorePlacement.BEFORE_LAST:\n return props.showMore.limit - 2;\n case BentoTimelineShowMorePlacement.AFTER_FIRST:\n return 0;\n case BentoTimelineShowMorePlacement.BOTTOM:\n default:\n return props.showMore.limit - 1;\n }\n });\n\n const sortEntries = () => {\n // Sorts timeline entries based on date in reverse chronological order (newest first).\n timelineEntries.value.sort((a, b) => {\n return new Date(b.date).getTime() - new Date(a.date).getTime();\n });\n };\n\n const unregisterTimelineEntry = (entryToRemove: BentoTimelineEntry) => () => {\n const index = timelineEntries.value.indexOf(entryToRemove);\n // The index can be -1 if the entry has already been removed by a parent re-render.\n if (index > -1) {\n timelineEntries.value.splice(index, 1);\n }\n };\n\n const registerTimelineEntry: BentoInternalTimelineRegisterEntry = entry => {\n timelineEntries.value.push(entry);\n return { timelineEntries, unregisterTimelineEntry: unregisterTimelineEntry(entry) };\n };\n\n watch(\n () => timelineEntries.value.length,\n () => sortEntries()\n );\n\n const configData: BentoTimelineConfigData = {\n showAll,\n showMoreIndex,\n hiddenItems,\n visibleIndexes,\n timegapLimit,\n timelineEntries,\n };\n\n // provide register timeline entry and config data timeline items\n provide(TIMELINE_REGISTER_ENTRY_INJECTION_KEY, registerTimelineEntry);\n provide(TIMELINE_CONFIG_INJECTION_KEY, configData);\n</script>\n<script lang=\"ts\">\n /**\n * Timeline displays a collection of events in a reverse chronological order (newest event is displayed on the top).\n *\n * @example\n * import { BentoDateFormat, BentoTimeline } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoTimeline },\n * template: `\n * <bento-timeline>\n * <bento-timeline-item\n * title=\"Milestone 1\"\n * :timestamp=\"{ date: new Date(), value: 'Created at' }\"\n * :additional-timestamp=\"{ date: new Date(), value: 'Modified at' }\"\n * description=\"Milestone description\"\n * :tag=\"{ label: 'Tag'}\"\n * />\n * <bento-timeline-item\n * title=\"Milestone 2\"\n * :timestamp=\"{\n * date: new Date(),\n * value: 'Created at',\n * format: BentoDateFormat.FULL_DATE_EXACT_TIME_WITHOUT_PERIOD\n * }\"\n * description=\"Milestone description\"\n * :data-list=\"[\n * { label: 'Label', value: 'Value' },\n * { label: 'Label', value: 'Value' },\n * ]\"\n * />\n * </bento-timeline>\n * `\n * }\n */\n export default defineComponent({\n i18n: { messages },\n name: 'bento-timeline',\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./timeline.scss\" />\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><path fill=\"#001222\" d=\"M10 3.25C11.5188 3.25 12.75 4.48122 12.75 6V10C12.75 11.5188 11.5188 12.75 10 12.75H6C4.48122 12.75 3.25 11.5188 3.25 10V6C3.25 4.48122 4.48122 3.25 6 3.25H10Z\"/></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 <li v-if=\"isVisible\" class=\"b-timeline-item\" :class=\"conditionalClasses\">\n <div v-if=\"timegap\" class=\"b-timeline-item__row\">\n <div class=\"b-timeline-item__marker\" aria-hidden=\"true\">\n <div class=\"b-timeline-item__icon b-timeline-item__icon--timegap\"></div>\n <div class=\"b-timeline-item__separator\"></div>\n </div>\n <div class=\"b-timeline-item__content\">\n <bento-typography class=\"b-timeline-item__timegap\" :aria-label=\"timegapAriaLabel\">\n {{ timegap }}\n </bento-typography>\n </div>\n </div>\n <div class=\"b-timeline-item__row\">\n <div class=\"b-timeline-item__marker\" aria-hidden=\"true\">\n <square-small-icon class=\"b-timeline-item__icon\" :class=\"iconConditionalClasses\" />\n <div\n v-if=\"!isLastItem\"\n class=\"b-timeline-item__separator\"\n data-testid=\"last-timeline-item-separator\"\n ></div>\n </div>\n <div class=\"b-timeline-item__content\">\n <bento-typography\n v-if=\"!isNoteType\"\n el=\"div\"\n variant=\"body\"\n strongest\n class=\"b-timeline-item__title\"\n role=\"heading\"\n aria-level=\"2\"\n >\n <bento-link v-if=\"isLinkTitle\" v-bind=\"linkTitleProps\" disable-typography>{{\n linkTitleProps.title\n }}</bento-link>\n <span v-else>{{ title }}</span>\n </bento-typography>\n\n <bento-typography\n v-if=\"isNoteType && (description || hasSlot('default'))\"\n el=\"div\"\n variant=\"body\"\n class=\"b-timeline-item__description\"\n >\n <slot>{{ description }}</slot>\n </bento-typography>\n\n <bento-typography v-if=\"timestamp\" class=\"b-timeline-item__timestamp\" el=\"div\" variant=\"caption\">\n <bento-date :date=\"timestamp.date\" :format=\"timestamp.format\" disable-typography />\n\n <bento-dashed-underline v-if=\"timestamp.description\" v-bind=\"timestamp.description\">\n {{ timestamp.value }}\n </bento-dashed-underline>\n\n <span v-else>{{ timestamp.value }}</span>\n </bento-typography>\n\n <bento-typography\n v-if=\"!isNoteType && additionalTimestamp\"\n class=\"b-timeline-item__timestamp\"\n el=\"div\"\n variant=\"caption\"\n >\n <bento-date\n :date=\"additionalTimestamp.date\"\n :format=\"additionalTimestamp.format\"\n disable-typography\n />\n\n <bento-dashed-underline\n v-if=\"additionalTimestamp.description\"\n v-bind=\"additionalTimestamp.description\"\n >\n {{ additionalTimestamp.value }}\n </bento-dashed-underline>\n\n <span v-else>\n {{ additionalTimestamp.value }}\n </span>\n </bento-typography>\n\n <bento-typography\n v-if=\"!isNoteType && (description || hasSlot('default'))\"\n el=\"div\"\n variant=\"body\"\n class=\"b-timeline-item__description\"\n >\n <slot>{{ description }}</slot>\n </bento-typography>\n\n <div v-if=\"!isNoteType && dataList\" class=\"b-timeline-item__data-list\">\n <bento-structured-list>\n <bento-structured-list-item\n v-for=\"listEntry in dataList\"\n :key=\"generateUid(listEntry.label)\"\n :label=\"listEntry.label\"\n >\n <bento-typography variant=\"caption\">{{ listEntry.value }}</bento-typography>\n </bento-structured-list-item>\n </bento-structured-list>\n </div>\n <bento-tag v-if=\"!isNoteType && tag\" v-bind=\"tag\" class=\"b-timeline-item__tag\" />\n </div>\n </div>\n <div v-if=\"displayShowMoreButton\" class=\"b-timeline-item__row\">\n <div class=\"b-timeline-item__marker\" aria-hidden=\"true\">\n <div class=\"b-timeline-item__separator\"></div>\n </div>\n <div class=\"b-timeline-item__content\">\n <bento-button class=\"b-timeline__show-more\" variant=\"tertiary\" @click=\"showAll = !showAll\">\n <template v-if=\"!showAll\">{{ t('showMore', { items: hiddenItems }) }}</template>\n <template v-else>{{ t('showLess') }}</template>\n </bento-button>\n </div>\n </div>\n </li>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, defineComponent, inject, onUnmounted, provide, useSlots } from 'vue';\n // Components\n import { BentoButton } from '@/components/button';\n import { BentoDashedUnderline } from '@/components/dashed-underline';\n import { BentoDate } from '@/components/date';\n import { BentoLink } from '@/components/link';\n import { BentoTag } from '@/components/tag';\n import { BentoTypography } from '@/components/typography';\n import { BentoStructuredList, BentoStructuredListItem } from '@/components/structured-list';\n import SquareSmallIcon from '@adyen/ui-assets-icons-16/vue/square-small-fill';\n // Utils\n import { deprecate } from '@/utils/ts/deprecate';\n import { generateUid } from '@/core/utils/ts';\n import { useI18n } from '@/utils/ts/i18n';\n import { useHasSlot } from '@/composables';\n import { formatDistanceStrict } from 'date-fns/formatDistanceStrict';\n // Types\n import {\n type BentoTimelineConfigData,\n type BentoTimelineEntry,\n type BentoTimelineItemProps,\n type BentoTimelineItemTitle,\n BentoTimelineItemVariant,\n type BentoTimelineRegisterEntry,\n } from '../../timeline.types';\n // Keys\n import { TIMELINE_CONFIG_INJECTION_KEY, TIMELINE_REGISTER_ENTRY_INJECTION_KEY } from '../../timeline.keys';\n import { STRUCTURED_LIST_CONDENSED_INJECTION_KEY } from '@/components/structured-list/structured-list.keys';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n additionalTimestamp: { default: null },\n dataList: { default: null },\n description: { default: null },\n status: { default: 'black' },\n tag: { default: undefined },\n timestamp: null,\n title: { default: null },\n type: { default: 'milestone' },\n variant: { default: null }\n});\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n\n const isNoteType = computed(() => props.type === 'note');\n\n // Handle variant deprecation, by setting `critical` and `success` variants to their respective colors\n const computedStatus = computed(() => {\n if (props.variant === BentoTimelineItemVariant.CRITICAL) {\n return 'red';\n }\n\n if (props.variant === BentoTimelineItemVariant.SUCCESS) {\n return 'green';\n }\n\n return props.status;\n });\n\n if (props.variant) {\n deprecate(\n 'BentoTimelineItem \"variant\" property',\n `Use the BentoTimelineItem \"status\" modifier instead to modify the color of the timeline icon.\n <bento-timeline-item status=\"red\" />`,\n '2.0.0'\n );\n }\n\n const iconConditionalClasses = computed(() => ({\n [`b-timeline-item__icon--${computedStatus.value}`]: computedStatus.value && !isNoteType.value,\n }));\n const conditionalClasses = computed(() => ({\n 'b-timeline-item--note': isNoteType.value,\n }));\n\n // Provide STRUCTURED_LIST_CONDENSED_INJECTION_KEY as true, to set the internal condensed style in the BentoStructuredList comp\n provide(STRUCTURED_LIST_CONDENSED_INJECTION_KEY, true);\n\n const entry: BentoTimelineEntry = {\n title: props.title,\n date: props.timestamp.date,\n };\n\n // Register timeline entry to the timeline entries array\n const registerTimelineEntry: BentoTimelineRegisterEntry = inject(TIMELINE_REGISTER_ENTRY_INJECTION_KEY);\n const { timelineEntries, unregisterTimelineEntry } = registerTimelineEntry(entry);\n\n // On unmounting timeline item, unregister it from the parent timeline component\n onUnmounted(() => unregisterTimelineEntry());\n\n // Get timeline config data from the parent Timeline comp\n const { showAll, showMoreIndex, hiddenItems, visibleIndexes, timegapLimit }: BentoTimelineConfigData =\n inject(TIMELINE_CONFIG_INJECTION_KEY);\n\n const index = computed(() => timelineEntries.value.indexOf(entry));\n\n const allItemsShowing = computed(() => showAll.value || !visibleIndexes.value);\n const isVisible = computed(() => (allItemsShowing.value ? true : visibleIndexes.value.includes(index.value)));\n const isLinkTitle = computed(() => typeof props.title === 'object');\n const linkTitleProps = computed(() => props.title as BentoTimelineItemTitle);\n const timegap = computed(() => {\n if (!timegapLimit.value) {\n return null;\n }\n const previousDate = timelineEntries.value[index.value - 1]?.date;\n const isPreviousItemVisible = allItemsShowing.value || visibleIndexes.value.includes(index.value - 1);\n if (!previousDate || !isPreviousItemVisible) {\n return null;\n }\n const { date } = timelineEntries.value[index.value];\n const timegapInSelectedUnit = parseInt(\n formatDistanceStrict(previousDate, date, { unit: timegapLimit.value.unit }),\n 10\n );\n return timegapLimit.value.amount < timegapInSelectedUnit\n ? formatDistanceStrict(previousDate, date, { roundingMethod: 'floor' })\n : null;\n });\n const timegapAriaLabel = computed(() => (timegap.value ? t('timegap', { timegap: timegap.value }) : ''));\n const displayShowMoreButton = computed(() => hiddenItems.value && showMoreIndex.value === index.value);\n const isLastItem = computed(() => {\n // The index can be -1 before the parent has had a chance to sort the array.\n return index.value !== -1 && index.value === timelineEntries.value.length - 1;\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * BentoTimelineItem renders each event in the Timeline component\n *\n * @example\n * import { BentoDateFormat, BentoTimelineItem } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoTimelineItem },\n * template: `\n * <bento-timeline-item\n * title=\"Milestone\"\n * :timestamp=\"{ date: new Date(), value: 'Created at', format: BentoDateFormat.FULL_DATE_EXACT_TIME_WITHOUT_PERIOD }\"\n * :additional-timestamp=\"{ date: new Date(), value: 'Modified at' }\"\n * description=\"Milestone description\"\n * :data-list=\"[\n * { label: 'Label', value: 'Value' },\n * { label: 'Label', value: 'Value' },\n * ]\"\n * :tag=\"{ label: 'Tag'}\"\n * />\n * `\n * }\n */\n export default defineComponent({\n name: 'bento-timeline-item',\n i18n: { messages },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./timeline-item.scss\" />\n"],"names":["formatDistanceStrict","laterDate","earlierDate","options","defaultOptions","getDefaultOptions","locale","enUS","comparison","compareAsc","localizeOptions","laterDate_","earlierDate_","normalizeDates","roundingMethod","getRoundingMethod","milliseconds","minutes","millisecondsInMinute","timezoneOffset","getTimezoneOffsetInMilliseconds","dstNormalizedMinutes","defaultUnit","unit","minutesInDay","minutesInMonth","minutesInYear","seconds","roundedMinutes","hours","days","months","years","BentoTimelineShowMorePlacement","BentoTimelineShowMorePlacement2","BentoTimelineGapUnit","BentoTimelineGapUnit2","BentoTimelineItemVariant","BentoTimelineItemVariant2","BentoTimelineStatus","BentoTimelineStatus2","TIMELINE_REGISTER_ENTRY_INJECTION_KEY","TIMELINE_CONFIG_INJECTION_KEY","__default__$1","defineComponent","messages$1","t","useI18n","addNoteLabel","computed","cancelLabel","newNoteContent","ref","updateNoteContent","newTimelineNoteContent","addNoteTextareaRef","addNoteButtonRef","showAddNoteTextArea","toggleAddNote","nextTick","_a","_b","addNoteToTimeline","emit","timelineEntries","hiddenItems","props","showAll","timegapLimit","toRefs","timelineIndexes","visibleIndexes","showMoreIndex","sortEntries","a","b","unregisterTimelineEntry","entryToRemove","index","registerTimelineEntry","entry","watch","configData","provide","uuid","_sfc_main$1","__default__","messages","slots","useSlots","hasSlot","useHasSlot","isNoteType","computedStatus","deprecate","iconConditionalClasses","conditionalClasses","STRUCTURED_LIST_CONDENSED_INJECTION_KEY","inject","onUnmounted","allItemsShowing","isVisible","isLinkTitle","linkTitleProps","timegap","previousDate","isPreviousItemVisible","date","timegapInSelectedUnit","timegapAriaLabel","displayShowMoreButton","isLastItem"],"mappings":";;;;;;;;;;;;;;;;;;AAmGO,SAAAA,EAAAC,GAAAC,GAAAC,GAAA;AACP,QAAAC,IAAAC,GAAA,GACAC,KAAAH,KAAA,gBAAAA,EAAA,WAAAC,EAAA,UAAAG,IAEAC,IAAAC,GAAAR,GAAAC,CAAA;AAEA,MAAA,MAAAM,CAAA;AACA,UAAA,IAAA,WAAA,oBAAA;AAGA,QAAAE,IAAA,OAAA,OAAA,CAAA,GAAAP,GAAA;AAAA,IACA,WAAAA,KAAA,gBAAAA,EAAA;AAAA,IACA,YAAAK;AAAA,EACA,CAAA,GAEA,CAAAG,GAAAC,CAAA,IAAAC;AAAA,IACAV,KAAA,gBAAAA,EAAA;AAAA,IACA,GAAAK,IAAA,IAAA,CAAAN,GAAAD,CAAA,IAAA,CAAAA,GAAAC,CAAA;AAAA,EACA,GAEAY,IAAAC,IAAAZ,KAAA,gBAAAA,EAAA,mBAAA,OAAA,GAEAa,IAAAJ,EAAA,QAAA,IAAAD,EAAA,QAAA,GACAM,IAAAD,IAAAE,GA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AA,MAAA,KAAA,CAAA;AAAA,QACgD;AAAA,MAC1E;AAEJ,aAAAA,EAAA,MAAA,SAAAwC,IAAA5G,EAAAyG,GAAAE,GAAA,EAAA,gBAAA,QAAA,CAAA,IAAA;AAAA,IAEM,CAAA,GAEVE,IAAA5D,EAAA,MAAAuD,EAAA,QAAA,EAAA,WAAA,EAAA,SAAAA,EAAA,MAAA,CAAA,IAAA,EAAA,GACAM,IAAA7D,EAAA,MAAAgB,EAAA,SAAAO,EAAA,UAAAM,EAAA,KAAA,GACAiC,IAAA9D,EAAA,MAEI6B,EAAA,UAAA,MAAAA,EAAA,UAAAd,EAAA,MAAA,SAAA,CAA4E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"timeline-item.BVOztUi9.js","sources":["../../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/formatDistanceStrict.js","../../src/components/timeline/timeline.types.ts","../../src/components/timeline/timeline.keys.ts","../../src/components/timeline/timeline.vue","../../../ui-assets/icons-16/dist/vue/square-small-fill.vue","../../src/components/timeline/components/timeline-item/timeline-item.vue"],"sourcesContent":["import { defaultLocale } from \"./_lib/defaultLocale.js\";\nimport { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { getRoundingMethod } from \"./_lib/getRoundingMethod.js\";\nimport { getTimezoneOffsetInMilliseconds } from \"./_lib/getTimezoneOffsetInMilliseconds.js\";\nimport { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { compareAsc } from \"./compareAsc.js\";\nimport {\n millisecondsInMinute,\n minutesInDay,\n minutesInMonth,\n minutesInYear,\n} from \"./constants.js\";\n\n/**\n * The {@link formatDistanceStrict} function options.\n */\n\n/**\n * The unit used to format the distance in {@link formatDistanceStrict}.\n */\n\n/**\n * @name formatDistanceStrict\n * @category Common Helpers\n * @summary Return the distance between the given dates in words.\n *\n * @description\n * Return the distance between the given dates in words, using strict units.\n * This is like `formatDistance`, but does not use helpers like 'almost', 'over',\n * 'less than' and the like.\n *\n * | Distance between dates | Result |\n * |------------------------|---------------------|\n * | 0 ... 59 secs | [0..59] seconds |\n * | 1 ... 59 mins | [1..59] minutes |\n * | 1 ... 23 hrs | [1..23] hours |\n * | 1 ... 29 days | [1..29] days |\n * | 1 ... 11 months | [1..11] months |\n * | 1 ... N years | [1..N] years |\n *\n * @param laterDate - The date\n * @param earlierDate - The date to compare with\n * @param options - An object with options\n *\n * @returns The distance in words\n *\n * @throws `date` must not be Invalid Date\n * @throws `baseDate` must not be Invalid Date\n * @throws `options.unit` must be 'second', 'minute', 'hour', 'day', 'month' or 'year'\n * @throws `options.locale` must contain `formatDistance` property\n *\n * @example\n * // What is the distance between 2 July 2014 and 1 January 2015?\n * const result = formatDistanceStrict(new Date(2014, 6, 2), new Date(2015, 0, 2))\n * //=> '6 months'\n *\n * @example\n * // What is the distance between 1 January 2015 00:00:15\n * // and 1 January 2015 00:00:00?\n * const result = formatDistanceStrict(\n * new Date(2015, 0, 1, 0, 0, 15),\n * new Date(2015, 0, 1, 0, 0, 0)\n * )\n * //=> '15 seconds'\n *\n * @example\n * // What is the distance from 1 January 2016\n * // to 1 January 2015, with a suffix?\n * const result = formatDistanceStrict(new Date(2015, 0, 1), new Date(2016, 0, 1), {\n * addSuffix: true\n * })\n * //=> '1 year ago'\n *\n * @example\n * // What is the distance from 1 January 2016\n * // to 1 January 2015, in minutes?\n * const result = formatDistanceStrict(new Date(2016, 0, 1), new Date(2015, 0, 1), {\n * unit: 'minute'\n * })\n * //=> '525600 minutes'\n *\n * @example\n * // What is the distance from 1 January 2015\n * // to 28 January 2015, in months, rounded up?\n * const result = formatDistanceStrict(new Date(2015, 0, 28), new Date(2015, 0, 1), {\n * unit: 'month',\n * roundingMethod: 'ceil'\n * })\n * //=> '1 month'\n *\n * @example\n * // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = formatDistanceStrict(new Date(2016, 7, 1), new Date(2015, 0, 1), {\n * locale: eoLocale\n * })\n * //=> '1 jaro'\n */\n\nexport function formatDistanceStrict(laterDate, earlierDate, options) {\n const defaultOptions = getDefaultOptions();\n const locale = options?.locale ?? defaultOptions.locale ?? defaultLocale;\n\n const comparison = compareAsc(laterDate, earlierDate);\n\n if (isNaN(comparison)) {\n throw new RangeError(\"Invalid time value\");\n }\n\n const localizeOptions = Object.assign({}, options, {\n addSuffix: options?.addSuffix,\n comparison: comparison,\n });\n\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n ...(comparison > 0 ? [earlierDate, laterDate] : [laterDate, earlierDate]),\n );\n\n const roundingMethod = getRoundingMethod(options?.roundingMethod ?? \"round\");\n\n const milliseconds = earlierDate_.getTime() - laterDate_.getTime();\n const minutes = milliseconds / millisecondsInMinute;\n\n const timezoneOffset =\n getTimezoneOffsetInMilliseconds(earlierDate_) -\n getTimezoneOffsetInMilliseconds(laterDate_);\n\n // Use DST-normalized difference in minutes for years, months and days;\n // use regular difference in minutes for hours, minutes and seconds.\n const dstNormalizedMinutes =\n (milliseconds - timezoneOffset) / millisecondsInMinute;\n\n const defaultUnit = options?.unit;\n let unit;\n if (!defaultUnit) {\n if (minutes < 1) {\n unit = \"second\";\n } else if (minutes < 60) {\n unit = \"minute\";\n } else if (minutes < minutesInDay) {\n unit = \"hour\";\n } else if (dstNormalizedMinutes < minutesInMonth) {\n unit = \"day\";\n } else if (dstNormalizedMinutes < minutesInYear) {\n unit = \"month\";\n } else {\n unit = \"year\";\n }\n } else {\n unit = defaultUnit;\n }\n\n // 0 up to 60 seconds\n if (unit === \"second\") {\n const seconds = roundingMethod(milliseconds / 1000);\n return locale.formatDistance(\"xSeconds\", seconds, localizeOptions);\n\n // 1 up to 60 mins\n } else if (unit === \"minute\") {\n const roundedMinutes = roundingMethod(minutes);\n return locale.formatDistance(\"xMinutes\", roundedMinutes, localizeOptions);\n\n // 1 up to 24 hours\n } else if (unit === \"hour\") {\n const hours = roundingMethod(minutes / 60);\n return locale.formatDistance(\"xHours\", hours, localizeOptions);\n\n // 1 up to 30 days\n } else if (unit === \"day\") {\n const days = roundingMethod(dstNormalizedMinutes / minutesInDay);\n return locale.formatDistance(\"xDays\", days, localizeOptions);\n\n // 1 up to 12 months\n } else if (unit === \"month\") {\n const months = roundingMethod(dstNormalizedMinutes / minutesInMonth);\n return months === 12 && defaultUnit !== \"month\"\n ? locale.formatDistance(\"xYears\", 1, localizeOptions)\n : locale.formatDistance(\"xMonths\", months, localizeOptions);\n\n // 1 year up to max Date\n } else {\n const years = roundingMethod(dstNormalizedMinutes / minutesInYear);\n return locale.formatDistance(\"xYears\", years, localizeOptions);\n }\n}\n\n// Fallback for modularized imports:\nexport default formatDistanceStrict;\n","import { type BentoDashedUnderlineProps } from '@/components/dashed-underline/dashed-underline.types';\nimport { type BentoDateFormat } from '@/components/date/date.types';\nimport { type BentoTag } from '@/components/tag';\nimport { type Ref } from 'vue';\nimport type { RouterLinkProps } from 'vue-router/types/router.d.ts';\n\nexport enum BentoTimelineShowMorePlacement {\n BOTTOM = 'bottom',\n AFTER_FIRST = 'after-first',\n BEFORE_LAST = 'before-last',\n}\n\nexport interface BentoTimelineShowMoreObject {\n limit: number;\n placement?: BentoTimelineShowMorePlacement;\n}\n\nexport enum BentoTimelineGapUnit {\n SECOND = 'second',\n MINUTE = 'minute',\n HOUR = 'hour',\n DAY = 'day',\n MONTH = 'month',\n YEAR = 'year',\n}\n\nexport interface BentoTimelineGapObject {\n amount: number;\n unit: BentoTimelineGapUnit;\n}\n\n/**\n * @deprecated Since v2.0.0. Do not use. Use the `status` prop instead.\n */\nexport enum BentoTimelineItemVariant {\n DEFAULT = 'SquareSmallIcon',\n SUCCESS = 'CheckedCircleIcon',\n CRITICAL = 'CrossCircleIcon',\n}\n\nexport enum BentoTimelineStatus {\n BLACK = 'black',\n BLUE = 'blue',\n GREEN = 'green',\n GREY = 'grey',\n ORANGE = 'orange',\n RED = 'red',\n YELLOW = 'yellow',\n}\n\nexport interface BentoTimelineItemTitle extends RouterLinkProps {\n /**\n * Link label.\n */\n title: string;\n /**\n * Set the rendered link to a regular external anchor link.\n */\n external?: boolean;\n\n /**\n * Sets the target of the rendered link.\n */\n target?: string;\n\n // This has been added to allow users to add HTML and Aria attribute\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [name: string]: any;\n}\n\nexport interface BentoTimelineTimestamp {\n date: Date | number;\n format?: BentoDateFormat;\n value?: string;\n description?: BentoDashedUnderlineProps;\n}\n\nexport interface BentoTimelineDataListObject {\n label: string;\n value: string;\n}\n\nexport type BentoTimelineDataList = Array<BentoTimelineDataListObject>;\n\nexport type BentoTimelineTagProps = InstanceType<typeof BentoTag>['$props'];\n\nexport interface BentoTimelineEntry {\n title?: string | BentoTimelineItemTitle;\n description?: string;\n date: Date | number;\n}\n\n/**\n * @deprecated Since v2.0.0. Do not use.\n */\nexport type BentoTimelineRegisterEntry = (props: {\n title?: string | BentoTimelineItemTitle;\n description?: string;\n date: Date | number;\n}) => { timelineEntries: Ref<Array<BentoTimelineEntry>>; index: number; unregisterTimelineEntry: () => void };\n\n/**\n * @private\n */\nexport type BentoInternalTimelineRegisterEntry = (\n entry: BentoTimelineEntry\n) => { timelineEntries: Ref<Array<BentoTimelineEntry>>; unregisterTimelineEntry: () => void };\n\nexport interface BentoTimelineConfigData {\n showAll: Ref<boolean>;\n showMoreIndex: Ref<number>;\n hiddenItems: Ref<number>;\n visibleIndexes: Ref<Array<number>>;\n timegapLimit: Ref<BentoTimelineGapObject>;\n timelineEntries: Ref<Array<BentoTimelineEntry>>;\n}\n\nexport interface BentoTimelineProps {\n /**\n * If set to true, gives the possibility to manually add notes to the timeline via a textarea\n */\n addNote?: boolean;\n /**\n * Object that determines the max number of items to show without clicking the show more button\n * and where in the timeline is the show more button placed\n */\n showMore?: BentoTimelineShowMoreObject;\n /**\n * Object that determines minimum amount of time for the automatic timegap indicator;\n * Define a unit (hour, day, month) and an amount (e.g. { amount: 7, unit: 'days' }).\n * If null, automatic timegap detection will be turned off\n */\n timegapLimit?: BentoTimelineGapObject;\n}\n\nexport interface BentoTimelineItemProps {\n /**\n * Additional timestamp of the event\n */\n additionalTimestamp?: BentoTimelineTimestamp;\n /**\n * Relevant key-value pair data to display in the event\n */\n dataList?: BentoTimelineDataList;\n /**\n * Description of the event\n */\n description?: string;\n /**\n * Modifier that changes the color of the timeline icon\n * @values blue, black, green, grey, orange, red, yellow\n */\n status?: string;\n /**\n * Tag props that will be passed down to inner tag component\n */\n tag?: BentoTimelineTagProps;\n /**\n * Main timestamp of the event. Used for timegap detection.\n */\n timestamp: BentoTimelineTimestamp;\n /**\n * Title of the event\n */\n title?: BentoTimelineItemTitle | string;\n /**\n * Type of the timeline item. If set to 'note', it renders a note item in the timeline. Defaults to 'milestone'.\n * @values milestone, note\n */\n type?: string;\n /**\n * Variant for the timeline item\n * @values DEFAULT, SUCCESS, CRITICAL\n *\n * @deprecated Since v2.0.0. Use `status` instead.\n */\n variant?: BentoTimelineItemVariant | `${BentoTimelineItemVariant}`;\n}\n","export const TIMELINE_REGISTER_ENTRY_INJECTION_KEY = Symbol('timeline register entry injection key');\nexport const TIMELINE_CONFIG_INJECTION_KEY = Symbol('timeline config obj injection key');\n","<template>\n <div class=\"b-timeline\">\n <div v-if=\"addNote\" class=\"b-timeline__add-note-section\">\n <bento-button\n v-if=\"!showAddNoteTextArea\"\n ref=\"addNoteButtonRef\"\n variant=\"tertiary\"\n @click=\"toggleAddNote\"\n >{{ addNoteLabel }}</bento-button\n >\n <div v-if=\"showAddNoteTextArea\">\n <bento-textarea\n ref=\"addNoteTextareaRef\"\n :label=\"addNoteLabel\"\n :character-limit=\"150\"\n resizable=\"vertical\"\n @update:model-value=\"updateNoteContent\"\n />\n <bento-button-actions\n :actions=\"[\n { title: addNoteLabel, event: addNoteToTimeline },\n { title: cancelLabel, event: toggleAddNote },\n ]\"\n />\n </div>\n </div>\n <ol class=\"b-timeline__items\">\n <slot />\n </ol>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, defineComponent, nextTick, provide, ref, type Ref, toRefs, watch } from 'vue';\n import { BentoButton, BentoButtonActions } from '@/components/button';\n import { BentoTextarea } from '@/components/textarea';\n import {\n type BentoInternalTimelineRegisterEntry,\n type BentoTimelineConfigData,\n type BentoTimelineEntry,\n type BentoTimelineProps,\n BentoTimelineShowMorePlacement,\n } from './timeline.types';\n import { TIMELINE_CONFIG_INJECTION_KEY, TIMELINE_REGISTER_ENTRY_INJECTION_KEY } from './timeline.keys';\n import messages from './messages.json';\n import { useI18n } from '@/utils/ts/i18n';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n addNote: { type: Boolean, default: false },\n showMore: { default: null },\n timegapLimit: { default: null }\n});\n\n const emit = defineEmits(['add-timeline-note']);\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const addNoteLabel = computed(() => t('addNote') as string);\n const cancelLabel = computed(() => t('cancel') as string);\n\n const newNoteContent: Ref<string> = ref();\n const updateNoteContent = (newTimelineNoteContent: string): void => {\n newNoteContent.value = newTimelineNoteContent;\n };\n\n const addNoteTextareaRef: Ref<InstanceType<typeof BentoTextarea>> = ref(null);\n const addNoteButtonRef: Ref<InstanceType<typeof BentoButton>> = ref(null);\n const showAddNoteTextArea = ref(false);\n const toggleAddNote = async () => {\n showAddNoteTextArea.value = !showAddNoteTextArea.value;\n\n await nextTick();\n\n if (showAddNoteTextArea.value) {\n (addNoteTextareaRef.value.$refs.textareaElement as HTMLTextAreaElement)?.focus();\n } else {\n (addNoteButtonRef.value.$el as HTMLButtonElement)?.focus();\n }\n };\n const addNoteToTimeline = () => {\n emit('add-timeline-note', {\n description: newNoteContent.value,\n timestamp: { date: new Date() },\n type: 'note',\n });\n toggleAddNote();\n };\n\n const timelineEntries = ref<Array<BentoTimelineEntry>>([]);\n const hiddenItems = computed(() =>\n props.showMore && timelineEntries.value.length > props.showMore.limit\n ? timelineEntries.value.length - props.showMore.limit\n : null\n );\n const showAll = ref(false);\n const { timegapLimit } = toRefs(props);\n\n const timelineIndexes = computed(() => Array.from(timelineEntries.value.keys()));\n\n const visibleIndexes = computed(() => {\n if (!props.showMore) {\n return null;\n }\n\n if (props.showMore.placement === BentoTimelineShowMorePlacement.BEFORE_LAST) {\n return [\n ...timelineIndexes.value.slice(0, props.showMore.limit - 1),\n timelineIndexes.value[timelineIndexes.value.length - 1],\n ];\n }\n\n if (props.showMore.placement === BentoTimelineShowMorePlacement.AFTER_FIRST) {\n return [timelineIndexes.value[0], ...timelineIndexes.value.slice(-(props.showMore.limit - 1))];\n }\n\n return timelineIndexes.value.slice(0, props.showMore.limit);\n });\n\n const showMoreIndex = computed(() => {\n if (!props.showMore) {\n return null;\n }\n\n switch (props.showMore.placement) {\n case BentoTimelineShowMorePlacement.BEFORE_LAST:\n return props.showMore.limit - 2;\n case BentoTimelineShowMorePlacement.AFTER_FIRST:\n return 0;\n case BentoTimelineShowMorePlacement.BOTTOM:\n default:\n return props.showMore.limit - 1;\n }\n });\n\n const sortEntries = () => {\n // Sorts timeline entries based on date in reverse chronological order (newest first).\n timelineEntries.value.sort((a, b) => {\n return new Date(b.date).getTime() - new Date(a.date).getTime();\n });\n };\n\n const unregisterTimelineEntry = (entryToRemove: BentoTimelineEntry) => () => {\n const index = timelineEntries.value.indexOf(entryToRemove);\n // The index can be -1 if the entry has already been removed by a parent re-render.\n if (index > -1) {\n timelineEntries.value.splice(index, 1);\n }\n };\n\n const registerTimelineEntry: BentoInternalTimelineRegisterEntry = entry => {\n timelineEntries.value.push(entry);\n return { timelineEntries, unregisterTimelineEntry: unregisterTimelineEntry(entry) };\n };\n\n watch(\n () => timelineEntries.value.length,\n () => sortEntries()\n );\n\n const configData: BentoTimelineConfigData = {\n showAll,\n showMoreIndex,\n hiddenItems,\n visibleIndexes,\n timegapLimit,\n timelineEntries,\n };\n\n // provide register timeline entry and config data timeline items\n provide(TIMELINE_REGISTER_ENTRY_INJECTION_KEY, registerTimelineEntry);\n provide(TIMELINE_CONFIG_INJECTION_KEY, configData);\n</script>\n<script lang=\"ts\">\n /**\n * Timeline displays a collection of events in a reverse chronological order (newest event is displayed on the top).\n *\n * @example\n * import { BentoDateFormat, BentoTimeline } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoTimeline },\n * template: `\n * <bento-timeline>\n * <bento-timeline-item\n * title=\"Milestone 1\"\n * :timestamp=\"{ date: new Date(), value: 'Created at' }\"\n * :additional-timestamp=\"{ date: new Date(), value: 'Modified at' }\"\n * description=\"Milestone description\"\n * :tag=\"{ label: 'Tag'}\"\n * />\n * <bento-timeline-item\n * title=\"Milestone 2\"\n * :timestamp=\"{\n * date: new Date(),\n * value: 'Created at',\n * format: BentoDateFormat.FULL_DATE_EXACT_TIME_WITHOUT_PERIOD\n * }\"\n * description=\"Milestone description\"\n * :data-list=\"[\n * { label: 'Label', value: 'Value' },\n * { label: 'Label', value: 'Value' },\n * ]\"\n * />\n * </bento-timeline>\n * `\n * }\n */\n export default defineComponent({\n i18n: { messages },\n name: 'bento-timeline',\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./timeline.scss\" />\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><path fill=\"#001222\" d=\"M10 3.25C11.5188 3.25 12.75 4.48122 12.75 6V10C12.75 11.5188 11.5188 12.75 10 12.75H6C4.48122 12.75 3.25 11.5188 3.25 10V6C3.25 4.48122 4.48122 3.25 6 3.25H10Z\"/></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 <li v-if=\"isVisible\" class=\"b-timeline-item\" :class=\"conditionalClasses\">\n <div v-if=\"timegap\" class=\"b-timeline-item__row\">\n <div class=\"b-timeline-item__marker\" aria-hidden=\"true\">\n <div class=\"b-timeline-item__icon b-timeline-item__icon--timegap\"></div>\n <div class=\"b-timeline-item__separator\"></div>\n </div>\n <div class=\"b-timeline-item__content\">\n <bento-typography class=\"b-timeline-item__timegap\" :aria-label=\"timegapAriaLabel\">\n {{ timegap }}\n </bento-typography>\n </div>\n </div>\n <div class=\"b-timeline-item__row\">\n <div class=\"b-timeline-item__marker\" aria-hidden=\"true\">\n <square-small-icon class=\"b-timeline-item__icon\" :class=\"iconConditionalClasses\" />\n <div\n v-if=\"!isLastItem\"\n class=\"b-timeline-item__separator\"\n data-testid=\"last-timeline-item-separator\"\n ></div>\n </div>\n <div class=\"b-timeline-item__content\">\n <bento-typography\n v-if=\"!isNoteType\"\n el=\"div\"\n variant=\"body\"\n strongest\n class=\"b-timeline-item__title\"\n role=\"heading\"\n aria-level=\"2\"\n >\n <bento-link v-if=\"isLinkTitle\" v-bind=\"linkTitleProps\" disable-typography>{{\n linkTitleProps.title\n }}</bento-link>\n <span v-else>{{ title }}</span>\n </bento-typography>\n\n <bento-typography\n v-if=\"isNoteType && (description || hasSlot('default'))\"\n el=\"div\"\n variant=\"body\"\n class=\"b-timeline-item__description\"\n >\n <slot>{{ description }}</slot>\n </bento-typography>\n\n <bento-typography v-if=\"timestamp\" class=\"b-timeline-item__timestamp\" el=\"div\" variant=\"caption\">\n <bento-date :date=\"timestamp.date\" :format=\"timestamp.format\" disable-typography />\n\n <bento-dashed-underline v-if=\"timestamp.description\" v-bind=\"timestamp.description\">\n {{ timestamp.value }}\n </bento-dashed-underline>\n\n <span v-else>{{ timestamp.value }}</span>\n </bento-typography>\n\n <bento-typography\n v-if=\"!isNoteType && additionalTimestamp\"\n class=\"b-timeline-item__timestamp\"\n el=\"div\"\n variant=\"caption\"\n >\n <bento-date\n :date=\"additionalTimestamp.date\"\n :format=\"additionalTimestamp.format\"\n disable-typography\n />\n\n <bento-dashed-underline\n v-if=\"additionalTimestamp.description\"\n v-bind=\"additionalTimestamp.description\"\n >\n {{ additionalTimestamp.value }}\n </bento-dashed-underline>\n\n <span v-else>\n {{ additionalTimestamp.value }}\n </span>\n </bento-typography>\n\n <bento-typography\n v-if=\"!isNoteType && (description || hasSlot('default'))\"\n el=\"div\"\n variant=\"body\"\n class=\"b-timeline-item__description\"\n >\n <slot>{{ description }}</slot>\n </bento-typography>\n\n <div v-if=\"!isNoteType && dataList\" class=\"b-timeline-item__data-list\">\n <bento-structured-list>\n <bento-structured-list-item\n v-for=\"listEntry in dataList\"\n :key=\"generateUid(listEntry.label)\"\n :label=\"listEntry.label\"\n >\n <bento-typography variant=\"caption\">{{ listEntry.value }}</bento-typography>\n </bento-structured-list-item>\n </bento-structured-list>\n </div>\n <bento-tag v-if=\"!isNoteType && tag\" v-bind=\"tag\" class=\"b-timeline-item__tag\" />\n </div>\n </div>\n <div v-if=\"displayShowMoreButton\" class=\"b-timeline-item__row\">\n <div class=\"b-timeline-item__marker\" aria-hidden=\"true\">\n <div class=\"b-timeline-item__separator\"></div>\n </div>\n <div class=\"b-timeline-item__content\">\n <bento-button class=\"b-timeline__show-more\" variant=\"tertiary\" @click=\"showAll = !showAll\">\n <template v-if=\"!showAll\">{{ t('showMore', { items: hiddenItems }) }}</template>\n <template v-else>{{ t('showLess') }}</template>\n </bento-button>\n </div>\n </div>\n </li>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, defineComponent, inject, onUnmounted, provide, useSlots } from 'vue';\n // Components\n import { BentoButton } from '@/components/button';\n import { BentoDashedUnderline } from '@/components/dashed-underline';\n import { BentoDate } from '@/components/date';\n import { BentoLink } from '@/components/link';\n import { BentoTag } from '@/components/tag';\n import { BentoTypography } from '@/components/typography';\n import { BentoStructuredList, BentoStructuredListItem } from '@/components/structured-list';\n import SquareSmallIcon from '@adyen/ui-assets-icons-16/vue/square-small-fill';\n // Utils\n import { deprecate } from '@/utils/ts/deprecate';\n import { generateUid } from '@/core/utils/ts';\n import { useI18n } from '@/utils/ts/i18n';\n import { useHasSlot } from '@/composables';\n import { formatDistanceStrict } from 'date-fns/formatDistanceStrict';\n // Types\n import {\n type BentoTimelineConfigData,\n type BentoTimelineEntry,\n type BentoTimelineItemProps,\n type BentoTimelineItemTitle,\n BentoTimelineItemVariant,\n type BentoTimelineRegisterEntry,\n } from '../../timeline.types';\n // Keys\n import { TIMELINE_CONFIG_INJECTION_KEY, TIMELINE_REGISTER_ENTRY_INJECTION_KEY } from '../../timeline.keys';\n import { STRUCTURED_LIST_CONDENSED_INJECTION_KEY } from '@/components/structured-list/structured-list.keys';\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n additionalTimestamp: { default: null },\n dataList: { default: null },\n description: { default: null },\n status: { default: 'black' },\n tag: { default: undefined },\n timestamp: null,\n title: { default: null },\n type: { default: 'milestone' },\n variant: { default: null }\n});\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const slots = useSlots();\n const hasSlot = useHasSlot(slots);\n\n const isNoteType = computed(() => props.type === 'note');\n\n // Handle variant deprecation, by setting `critical` and `success` variants to their respective colors\n const computedStatus = computed(() => {\n if (props.variant === BentoTimelineItemVariant.CRITICAL) {\n return 'red';\n }\n\n if (props.variant === BentoTimelineItemVariant.SUCCESS) {\n return 'green';\n }\n\n return props.status;\n });\n\n if (props.variant) {\n deprecate(\n 'BentoTimelineItem \"variant\" property',\n `Use the BentoTimelineItem \"status\" modifier instead to modify the color of the timeline icon.\n <bento-timeline-item status=\"red\" />`,\n '2.0.0'\n );\n }\n\n const iconConditionalClasses = computed(() => ({\n [`b-timeline-item__icon--${computedStatus.value}`]: computedStatus.value && !isNoteType.value,\n }));\n const conditionalClasses = computed(() => ({\n 'b-timeline-item--note': isNoteType.value,\n }));\n\n // Provide STRUCTURED_LIST_CONDENSED_INJECTION_KEY as true, to set the internal condensed style in the BentoStructuredList comp\n provide(STRUCTURED_LIST_CONDENSED_INJECTION_KEY, true);\n\n const entry: BentoTimelineEntry = {\n title: props.title,\n date: props.timestamp.date,\n };\n\n // Register timeline entry to the timeline entries array\n const registerTimelineEntry: BentoTimelineRegisterEntry = inject(TIMELINE_REGISTER_ENTRY_INJECTION_KEY);\n const { timelineEntries, unregisterTimelineEntry } = registerTimelineEntry(entry);\n\n // On unmounting timeline item, unregister it from the parent timeline component\n onUnmounted(() => unregisterTimelineEntry());\n\n // Get timeline config data from the parent Timeline comp\n const { showAll, showMoreIndex, hiddenItems, visibleIndexes, timegapLimit }: BentoTimelineConfigData =\n inject(TIMELINE_CONFIG_INJECTION_KEY);\n\n const index = computed(() => timelineEntries.value.indexOf(entry));\n\n const allItemsShowing = computed(() => showAll.value || !visibleIndexes.value);\n const isVisible = computed(() => (allItemsShowing.value ? true : visibleIndexes.value.includes(index.value)));\n const isLinkTitle = computed(() => typeof props.title === 'object');\n const linkTitleProps = computed(() => props.title as BentoTimelineItemTitle);\n const timegap = computed(() => {\n if (!timegapLimit.value) {\n return null;\n }\n const previousDate = timelineEntries.value[index.value - 1]?.date;\n const isPreviousItemVisible = allItemsShowing.value || visibleIndexes.value.includes(index.value - 1);\n if (!previousDate || !isPreviousItemVisible) {\n return null;\n }\n const { date } = timelineEntries.value[index.value];\n const timegapInSelectedUnit = parseInt(\n formatDistanceStrict(previousDate, date, { unit: timegapLimit.value.unit }),\n 10\n );\n return timegapLimit.value.amount < timegapInSelectedUnit\n ? formatDistanceStrict(previousDate, date, { roundingMethod: 'floor' })\n : null;\n });\n const timegapAriaLabel = computed(() => (timegap.value ? t('timegap', { timegap: timegap.value }) : ''));\n const displayShowMoreButton = computed(() => hiddenItems.value && showMoreIndex.value === index.value);\n const isLastItem = computed(() => {\n // The index can be -1 before the parent has had a chance to sort the array.\n return index.value !== -1 && index.value === timelineEntries.value.length - 1;\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * BentoTimelineItem renders each event in the Timeline component\n *\n * @example\n * import { BentoDateFormat, BentoTimelineItem } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoTimelineItem },\n * template: `\n * <bento-timeline-item\n * title=\"Milestone\"\n * :timestamp=\"{ date: new Date(), value: 'Created at', format: BentoDateFormat.FULL_DATE_EXACT_TIME_WITHOUT_PERIOD }\"\n * :additional-timestamp=\"{ date: new Date(), value: 'Modified at' }\"\n * description=\"Milestone description\"\n * :data-list=\"[\n * { label: 'Label', value: 'Value' },\n * { label: 'Label', value: 'Value' },\n * ]\"\n * :tag=\"{ label: 'Tag'}\"\n * />\n * `\n * }\n */\n export default defineComponent({\n name: 'bento-timeline-item',\n i18n: { messages },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./timeline-item.scss\" />\n"],"names":["formatDistanceStrict","laterDate","earlierDate","options","defaultOptions","getDefaultOptions","locale","enUS","comparison","compareAsc","localizeOptions","laterDate_","earlierDate_","normalizeDates","roundingMethod","getRoundingMethod","milliseconds","minutes","millisecondsInMinute","timezoneOffset","getTimezoneOffsetInMilliseconds","dstNormalizedMinutes","defaultUnit","unit","minutesInDay","minutesInMonth","minutesInYear","seconds","roundedMinutes","hours","days","months","years","BentoTimelineShowMorePlacement","BentoTimelineShowMorePlacement2","BentoTimelineGapUnit","BentoTimelineGapUnit2","BentoTimelineItemVariant","BentoTimelineItemVariant2","BentoTimelineStatus","BentoTimelineStatus2","TIMELINE_REGISTER_ENTRY_INJECTION_KEY","TIMELINE_CONFIG_INJECTION_KEY","__default__$1","defineComponent","messages$1","t","useI18n","addNoteLabel","computed","cancelLabel","newNoteContent","ref","updateNoteContent","newTimelineNoteContent","addNoteTextareaRef","addNoteButtonRef","showAddNoteTextArea","toggleAddNote","nextTick","_a","_b","addNoteToTimeline","emit","timelineEntries","hiddenItems","props","showAll","timegapLimit","toRefs","timelineIndexes","visibleIndexes","showMoreIndex","sortEntries","a","b","unregisterTimelineEntry","entryToRemove","index","registerTimelineEntry","entry","watch","configData","provide","uuid","_sfc_main$1","__default__","messages","slots","useSlots","hasSlot","useHasSlot","isNoteType","computedStatus","deprecate","iconConditionalClasses","conditionalClasses","STRUCTURED_LIST_CONDENSED_INJECTION_KEY","inject","onUnmounted","allItemsShowing","isVisible","isLinkTitle","linkTitleProps","timegap","previousDate","isPreviousItemVisible","date","timegapInSelectedUnit","timegapAriaLabel","displayShowMoreButton","isLastItem"],"mappings":";;;;;;;;;;;;;;;;;;AAmGO,SAAAA,EAAAC,GAAAC,GAAAC,GAAA;AACP,QAAAC,IAAAC,GAAA,GACAC,KAAAH,KAAA,gBAAAA,EAAA,WAAAC,EAAA,UAAAG,IAEAC,IAAAC,GAAAR,GAAAC,CAAA;AAEA,MAAA,MAAAM,CAAA;AACA,UAAA,IAAA,WAAA,oBAAA;AAGA,QAAAE,IAAA,OAAA,OAAA,CAAA,GAAAP,GAAA;AAAA,IACA,WAAAA,KAAA,gBAAAA,EAAA;AAAA,IACA,YAAAK;AAAA,EACA,CAAA,GAEA,CAAAG,GAAAC,CAAA,IAAAC;AAAA,IACAV,KAAA,gBAAAA,EAAA;AAAA,IACA,GAAAK,IAAA,IAAA,CAAAN,GAAAD,CAAA,IAAA,CAAAA,GAAAC,CAAA;AAAA,EACA,GAEAY,IAAAC,IAAAZ,KAAA,gBAAAA,EAAA,mBAAA,OAAA,GAEAa,IAAAJ,EAAA,QAAA,IAAAD,EAAA,QAAA,GACAM,IAAAD,IAAAE,GAEAC,IACAC,EAAAR,CAAA,IACAQ,EAAAT,CAAA,GAIAU,KACAL,IAAAG,KAAAD,GAEAI,IAAAnB,KAAA,gBAAAA,EAAA;AACA,MAAAoB;AAoBA,MAnBAD,IAeAC,IAAAD,IAdAL,IAAA,IACAM,IAAA,WACAN,IAAA,KACAM,IAAA,WACAN,IAAAO,IACAD,IAAA,SACAF,IAAAI,IACAF,IAAA,QACAF,IAAAK,IACAH,IAAA,UAEAA,IAAA,QAOAA,MAAA,UAAA;AACA,UAAAI,IAAAb,EAAAE,IAAA,GAAA;AACA,WAAAV,EAAA,eAAA,YAAAqB,GAAAjB,CAAA;AAAA,EAGA,WAAAa,MAAA,UAAA;AACA,UAAAK,IAAAd,EAAAG,CAAA;AACA,WAA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
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { defineComponent as O, computed as C, reactive as y, nextTick as D } from "vue";
|
|
2
2
|
import { l as r } from "./events.BQOQSSb7.js";
|
|
3
3
|
import { g as R } from "./generate-uid.NJ8tVoha.js";
|
|
4
|
-
import { c as b, a as B, P as N } from "./popper-container.
|
|
4
|
+
import { c as b, a as B, P as N } from "./popper-container.dxpRn9a5.js";
|
|
5
5
|
import { V as $ } from "./index.Cl4_42j5.js";
|
|
6
6
|
import { B as I } from "./typography.C8lPlsbD.js";
|
|
7
7
|
import { n as k } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
8
|
-
import { b as x } from "./focus-trap.
|
|
8
|
+
import { b as x } from "./focus-trap.CUZQ1kQD.js";
|
|
9
9
|
import "../assets/tooltip.css";
|
|
10
10
|
const h = { ...b };
|
|
11
11
|
var F = /* @__PURE__ */ ((t) => (t.HIDDEN = "hidden", t))(F || {}), g = /* @__PURE__ */ ((t) => (t.ESCAPE = "Escape", t.ENTER = "Enter", t.ARROW_LEFT = "ArrowLeft", t.ARROW_UP = "ArrowUp", t.ARROW_RIGHT = "ArrowRight", t.ARROW_DOWN = "ArrowDown", t.PAGE_UP = "PageUp", t.PAGE_DOWN = "PageDown", t.END = "End", t.HOME = "Home", t.TAB = "Tab", t.F2 = "F2", t))(g || {});
|
|
@@ -188,4 +188,4 @@ export {
|
|
|
188
188
|
h as c,
|
|
189
189
|
F as d
|
|
190
190
|
};
|
|
191
|
-
//# sourceMappingURL=tooltip.
|
|
191
|
+
//# sourceMappingURL=tooltip.CGeGVHyl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.CnkqMpOA.js","sources":["../../src/directives/tooltip/tooltip.types.ts","../../src/types/utils-events.ts","../../src/components/internal/tooltip/tooltip.types.ts","../../src/components/internal/tooltip/tooltip.vue","../../src/directives/tooltip/tooltip.ts"],"sourcesContent":["import type { DirectiveBinding } from 'vue/types/options';\nimport { PopperContainerPositionBasic } from '../../components/popper-container/popper-container.types';\n\nexport interface BentoTooltipDirectiveBinding extends Readonly<DirectiveBinding> {\n readonly value: string;\n}\n\nexport const BentoTooltipPosition = { ...PopperContainerPositionBasic };\nexport type BentoTooltipPosition = PopperContainerPositionBasic;\n\nexport enum BentoTooltipState {\n HIDDEN = 'hidden',\n}\n","import type { Vue } from 'vue-demi';\n\nexport interface ListenOptions {\n capture?: boolean;\n passive?: boolean;\n once?: boolean;\n self?: boolean;\n vm?: Vue;\n onCleanup?: () => void;\n}\n\nexport enum EventKey {\n ESCAPE = 'Escape',\n ENTER = 'Enter',\n ARROW_LEFT = 'ArrowLeft',\n ARROW_UP = 'ArrowUp',\n ARROW_RIGHT = 'ArrowRight',\n ARROW_DOWN = 'ArrowDown',\n PAGE_UP = 'PageUp',\n PAGE_DOWN = 'PageDown',\n END = 'End',\n HOME = 'Home',\n TAB = 'Tab',\n F2 = 'F2',\n}\n\n/**\n * @deprecated Since v2.0.0. Use `EventKey` instead.\n * @see EventKey\n */\nexport enum KeyCode {\n ESCAPE = 27,\n ENTER = 13,\n ARROW_LEFT = 37,\n ARROW_UP = 38,\n ARROW_RIGHT = 39,\n ARROW_DOWN = 40,\n PAGE_UP = 33,\n PAGE_DOWN = 34,\n END = 35,\n HOME = 36,\n}\n","import { PopperContainerPositionBasic } from '../../popper-container/popper-container.types';\n\nexport const BentoTooltipPosition = { ...PopperContainerPositionBasic };\nexport type BentoTooltipPosition = PopperContainerPositionBasic;\n\nexport enum BentoTooltipState {\n HIDDEN = 'hidden',\n}\n","<template>\n <popper-container\n :id=\"id\"\n :aria-role=\"PopperContainerAriaRole.TOOLTIP\"\n :arrow=\"{ classes: ['b-tooltip__arrow'] }\"\n :class=\"conditionalClasses\"\n :fallback-position=\"fallbackPosition\"\n :is-hidden=\"!isShown\"\n :offset=\"[0, 4]\"\n :position=\"position\"\n :target-element=\"targetElement\"\n :disabled-focus-trap=\"disabledFocusTrap\"\n class=\"b-tooltip\"\n >\n <bento-typography el=\"span\" variant=\"caption\">\n {{ content }}\n </bento-typography>\n </popper-container>\n</template>\n\n<script setup lang=\"ts\">\n import type {} from '@floating-ui/vue';\n import { computed, type PropType } from 'vue';\n import { BentoTooltipPosition, BentoTooltipState } from './tooltip.types';\n import { type FallbackPositionProp, PopperContainer, PopperContainerAriaRole } from '@/components/popper-container';\n import { BentoTypography } from '@/components/typography';\n import { type VueNodeElement } from '@/types/elements';\n\n const props = defineProps({\n /**\n * The tooltip's id. Necessary for accessibility purposes.\n */\n id: { type: String, default: null },\n /**\n * Tooltip's target reference to the DOM element or Vue component.\n * The tooltip will position itself relatively to target element, in the specified position.\n */\n targetElement: { type: [Element, Object] as PropType<VueNodeElement>, required: true },\n /**\n * Tooltip's position relative to the target element.\n * Possible values are: 'top', 'bottom', 'left' and 'right'.\n */\n position: {\n type: String as PropType<BentoTooltipPosition>,\n default: BentoTooltipPosition.TOP,\n validator: value => Object.values(BentoTooltipPosition).includes(value as BentoTooltipPosition),\n },\n /**\n * Tooltip's offset.\n * If specified, the tooltip will have an offset in pixels between it and the target element\n * in specified position.\n */\n offset: { type: Number, default: 0 },\n /**\n * Tooltip's text content.\n */\n content: { type: String, required: true },\n /**\n * Shows / Hides the Tooltip component\n */\n isShown: { type: Boolean, default: false },\n\n /**\n * Allows to configure to fallback position to the one specified, it could be 'auto' or ['right', 'top', ...].\n * Useful when not using auto as starting placement.\n * @see {@link https://floating-ui.com/docs/flip#fallbackplacements}\n */\n fallbackPosition: {\n type: [Array, String] as PropType<FallbackPositionProp>,\n default: () => ['top', 'bottom', 'right', 'left'],\n },\n\n /**\n * Disables focus-trap for tooltip.\n * Useful for maintaining focus on the target element.\n */\n disabledFocusTrap: { type: Boolean, default: false },\n });\n\n const conditionalClasses = computed(() => ({\n [`b-tooltip--${BentoTooltipState.HIDDEN}`]: !props.isShown,\n }));\n</script>\n\n<script lang=\"ts\">\n /**\n * Tooltip container, to be used internally to render the tooltip container where the text is shown.\n */\n export default {\n name: 'tooltip',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./tooltip.scss\" />\n","import { nextTick, reactive } from 'vue';\nimport { listen } from '@/utils/ts/events';\nimport { generateUid } from '@/core/utils/ts';\nimport { EventKey } from '@/types/utils-events';\nimport { BentoTooltipPosition } from './tooltip.types';\nimport { type BentoTooltipDirectiveBinding } from './tooltip.types';\nimport { createApp, h, isVue2, isVue3, Vue2 } from 'vue-demi';\nimport Tooltip from '@/internal/tooltip/tooltip.vue';\nimport { getFocusableIn } from 'focus-lock';\n\ninterface TooltipInstance {\n target: HTMLElement;\n content: string;\n position: BentoTooltipPosition;\n removeListeners: Array<() => void>;\n}\n\n/**\n * Tooltip directive to render a tooltip on a given HTML element or component.\n *\n * @usage\n * import { BentoTooltipDirective, BentoTooltipPosition } from '@adyen/bento-vue2';\n *\n * export default {\n * directives: { BentoTooltipDirective },\n * template: `\n * <bento-button\n * v-bento-tooltip-directive:BentoTooltipPosition.BOTTOM=\"refToTextContent\"\n * >\n * Button text\n * </bento-button>\n * `,\n * }\n */\nconst tooltipInstances: Array<TooltipInstance> = [];\nconst ariaDescribedByAttr = 'aria-describedby';\nconst tooltipId = generateUid('tooltip');\n\nlet tooltipVNode;\n\n// Reusable Tooltip component instance.\nlet tooltip;\n// Global visibility state to prevent tooltips from showing after it being instructed to hide\nlet open = false;\n\nconst tooltipProps = reactive({\n targetElement: null,\n content: 'START_MESSAGE',\n id: tooltipId,\n position: undefined,\n isShown: false,\n});\n\n/**\n * Creates a new Tooltip component instance and inserts it into DOM.\n * @param {HTMLElement} el the target element for the Tooltip\n * @internal\n */\nconst createTooltip = (el: HTMLElement) => {\n // Only set tabindex on elements that are not natively focusable, don't already\n // have one, and don't contain a focusable descendant. Wrapper elements (e.g. a\n // menu div around a button) should not become tabbable themselves -- the child\n // button already provides keyboard access.\n const focusableChildren = getFocusableIn(el).filter(item => item.node !== el);\n if (el.tabIndex < 0 && focusableChildren.length === 0) {\n el.setAttribute('tabindex', '0');\n }\n\n if (isVue2) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore: Type error for Vue method in Vue 3 but this code only executes in vue 2 so ignoring.\n const TooltipComponent = Vue2.extend(Tooltip);\n tooltip = new TooltipComponent({ propsData: { targetElement: el, content: '', id: tooltipId } }).$mount();\n document.body.appendChild(tooltip.$el);\n } else {\n tooltipProps.targetElement = el;\n tooltip = createApp({\n components: { Tooltip },\n setup() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore: Type error for h method in Vue 2 but this code only executes in vue 3 so ignoring.\n return () => h(Tooltip, { ...tooltipProps }, '');\n },\n });\n tooltipVNode = document.createElement('div');\n tooltipVNode.id = 'tooltip-parent';\n document.body.appendChild(tooltipVNode);\n tooltip.mount('#tooltip-parent');\n }\n};\n\n/**\n * Removes Tooltip component instance from the DOM and destroys it.\n * @internal\n */\nconst destroyTooltip = () => {\n if (isVue2) {\n if (document.contains(tooltip.$el)) {\n document.body.removeChild(tooltip.$el);\n }\n tooltip.$destroy();\n } else {\n tooltip.unmount();\n if (document.contains(tooltipVNode)) {\n document.body.removeChild(tooltipVNode);\n }\n }\n\n tooltip = undefined;\n};\n\n/**\n * Returns tooltip position based on the specified argument.\n * By default returns 'top' if no argument is specified.\n * @param {BentoTooltipDirectiveBinding} binding Directive binding object.\n * @returns {string} Tooltip position.\n * @internal\n */\nconst getTooltipPosition = (binding: BentoTooltipDirectiveBinding): BentoTooltipPosition =>\n Object.values(BentoTooltipPosition).includes(binding.arg as BentoTooltipPosition)\n ? (binding.arg as BentoTooltipPosition)\n : BentoTooltipPosition.TOP;\n\n/**\n * Get the correct Tooltip instance for the given target element\n * @param {HTMLElement} el the target element for the Tooltip\n * @returns\n */\nconst getTooltipInstanceForTarget = (el: HTMLElement): TooltipInstance =>\n tooltipInstances.find(\n ctx =>\n // isEqualNode doesn't work correct for svg element, hence the second check here\n ctx.target.isEqualNode(el) && ctx.target === el\n );\n\n/**\n * On mouse enter event updates tooltip with correct content and position, and shows tooltip.\n * @param {?HTMLElement} el - Target element\n * @internal\n */\nconst showTooltip = (el?: HTMLElement) => {\n const tooltipInstance = getTooltipInstanceForTarget(el);\n\n // If tooltip content is empty – do not show the tooltip\n if (!tooltipInstance || !tooltipInstance.content || !el || !tooltip) {\n return;\n }\n\n if (el) {\n el.setAttribute(ariaDescribedByAttr, tooltipId);\n }\n\n // If the Tooltip is inside a dialog, move tooltip element inside of it\n // It gets restored to <body> when it gets hidden\n let isDialogOpen = false;\n document.querySelectorAll('dialog').forEach(node => {\n isDialogOpen = node?.open || isDialogOpen;\n });\n\n if (isDialogOpen) {\n if (isVue2) {\n el.after(tooltip.$el);\n // eslint-disable-next-line no-underscore-dangle\n } else if (tooltip?._instance?.vnode?.el) {\n // eslint-disable-next-line no-underscore-dangle\n el.after(tooltip?._instance?.vnode?.el);\n }\n isDialogOpen = false;\n }\n\n open = true;\n\n tooltip.content = tooltipInstance.content;\n tooltip.position = tooltipInstance.position;\n\n tooltipProps.content = tooltipInstance.content;\n tooltipProps.position = tooltipInstance.position;\n\n // Do calculations on a next tick, otherwise tooltip position calculations will be wrong\n nextTick(() => {\n // Do not open tooltip if it has been instructed to hide in process\n if (!open || !tooltip) {\n return;\n }\n tooltip.targetElement = el;\n tooltip.isShown = true;\n\n tooltipProps.targetElement = el;\n tooltipProps.isShown = true;\n });\n};\n\n/**\n * On mouse leave event hides the tooltip.\n * @internal\n */\nconst hideTooltip = (el?: HTMLElement) => {\n // Restore the tooltip element to body if it got move out of <body>\n if (tooltip?.$el?.parentElement?.tagName && tooltip.$el.parentElement.tagName !== 'BODY') {\n document.body.appendChild(tooltip.$el);\n }\n\n open = false;\n if (tooltip) {\n tooltip.isShown = false;\n }\n tooltipProps.isShown = false;\n if (el) {\n el.removeAttribute(ariaDescribedByAttr);\n }\n};\n\nconst tooltipBind = (el: HTMLElement, binding: BentoTooltipDirectiveBinding) => {\n // eslint-disable-next-line no-prototype-builtins\n if (!binding.hasOwnProperty('value') || binding.value) {\n // Create Tooltip component singleton instance\n if (tooltipInstances.length === 0) {\n createTooltip(el);\n }\n\n const show = () => showTooltip(el);\n const hide = () => hideTooltip(el);\n\n // Create and store context object, which has directive related handlers and content.\n const tooltipInstance: TooltipInstance = {\n target: el,\n content: binding.value,\n position: getTooltipPosition(binding),\n removeListeners: [\n listen(el, 'mouseenter', show),\n listen(el, 'mouseleave', hide),\n listen(el, 'focus', () => {\n if (el.matches(':focus-visible')) {\n show();\n }\n }),\n listen(el, 'blur', evt => {\n const focusEvent = <FocusEvent>evt;\n\n // when blurred and it transitions to the tooltip via screenreader, it should not close\n if ((focusEvent.relatedTarget as Element)?.getAttribute('role') !== 'tooltip') {\n hide();\n }\n }),\n listen(el, 'keydown', evt => {\n const keyboardEvent = <KeyboardEvent>evt;\n if (keyboardEvent.key === EventKey.ESCAPE) {\n hide();\n }\n }),\n ],\n };\n\n tooltipInstances.push(tooltipInstance);\n }\n};\n\nconst tooltipUpdate = (el: HTMLElement, binding: BentoTooltipDirectiveBinding) => {\n const tooltipInstance = getTooltipInstanceForTarget(el);\n if (tooltipInstance) {\n // Update tooltip content value if it is changed\n if (tooltipInstance?.content !== binding.value) {\n tooltipInstance.content = binding.value;\n // If tooltip is currently shown for current element – update tooltip's content value\n if (tooltip.isShown && tooltip.targetElement.isEqualNode(el)) {\n if (!tooltipInstance.content) {\n tooltip.isShown = false;\n } else {\n tooltip.content = binding.value;\n }\n\n // This forces the tooltip to refresh and update content in Vue3\n if (isVue3) {\n hideTooltip(el);\n showTooltip(el);\n }\n }\n }\n // Update tooltip position if it is changed\n if (tooltipInstance.position !== binding.arg) {\n const position = getTooltipPosition(binding);\n tooltipInstance.position = position;\n tooltip.position = position;\n }\n } else if (!tooltipInstance && binding.value) {\n // If I don't have a tooltip instance yet but the value passed was updated\n tooltipBind(el, binding);\n }\n};\n\nconst tooltipUnbind = (el: HTMLElement) => {\n const context = getTooltipInstanceForTarget(el);\n\n // Prevent unbinding/removing when there's nothing to unbind, leads to stack overflow errors\n if (!context) {\n return;\n }\n\n context.removeListeners.forEach(removeListener => {\n removeListener();\n });\n\n // If el is removed while tooltip is displayed, the tooltip doesnt hide as\n // there is no el to trigger mouseleave/blur.\n hideTooltip();\n\n tooltipInstances.splice(tooltipInstances.indexOf(context), 1);\n\n // If all the elements using the directive are removed, then no point having\n // the component on the page.\n if (tooltipInstances.length === 0) {\n destroyTooltip();\n }\n};\n\n/**\n * This directive allows you to bind a tooltip to an element.\n * Tooltip can be configured to be shown in one of four positions: 'top', 'left', 'right' and 'bottom'.\n *\n * @example\n * import { BentoTooltipDirective as BentoTooltip, BentoTooltipPosition } from '@adyen/bento-vue2';\n *\n * export default {\n * directives: { BentoTooltip },\n * methods: {\n * contentExpression() {\n * return 'tooltip content';\n * },\n * },\n * template: `<div>\n * <div v-bento-tooltip:left=\"refToTooltipContent\"></div>\n * <div v-bento-tooltip:[TooltipPosition.BOTTOM]=\"refToTooltipContent\"></div>\n *\n * <!-- If you don't specify the position then by default it's `TooltipPosition.TOP` -->\n * <div v-bento-tooltip=\"refToTooltipContent\"></div>\n *\n * <!-- Tooltip content can also be a data property or a method or a computed property as well -->\n * <div v-bento-tooltip=\"contentExpression()\"></div>\n * </div>`,\n * };\n */\nexport const BentoTooltipDirective = {\n // Vue 2 Directive hooks\n bind(el, binding) {\n tooltipBind(el, binding);\n },\n update(el, binding) {\n tooltipUpdate(el, binding);\n },\n unbind(el) {\n tooltipUnbind(el);\n },\n // Vue 3 Directive hooks\n beforeMount(el, binding) {\n tooltipBind(el, binding);\n },\n mounted(el, binding) {\n tooltipUpdate(el, binding);\n },\n updated(el, binding) {\n tooltipUpdate(el, binding);\n },\n unmounted(el) {\n tooltipUnbind(el);\n },\n};\n"],"names":["BentoTooltipPosition$1","PopperContainerPositionBasic","BentoTooltipState$1","BentoTooltipState2","EventKey","EventKey2","BentoTooltipPosition","BentoTooltipState","__default__","conditionalClasses","computed","props","tooltipInstances","ariaDescribedByAttr","tooltipId","generateUid","tooltip","open","tooltipProps","reactive","createTooltip","el","focusableChildren","getFocusableIn","item","TooltipComponent","Vue2","Tooltip","destroyTooltip","getTooltipPosition","binding","getTooltipInstanceForTarget","ctx","showTooltip","tooltipInstance","isDialogOpen","node","nextTick","hideTooltip","_b","_a","tooltipBind","show","hide","listen","evt","tooltipUpdate","position","tooltipUnbind","context","removeListener","BentoTooltipDirective"],"mappings":";;;;;;;;;AAOO,MAAAA,IAAA,EAAA,GAAAC,EAAA;AAGA,IAAAC,IAAA,kBAAAC,OACHA,EAAA,SAAA,UADQA,IAAAD,KAAA,CAAA,CAAA,GCCLE,IAAA,kBAAAC,OACHA,EAAA,SAAA,UACAA,EAAA,QAAA,SACAA,EAAA,aAAA,aACAA,EAAA,WAAA,WACAA,EAAA,cAAA,cACAA,EAAA,aAAA,aACAA,EAAA,UAAA,UACAA,EAAA,YAAA,YACAA,EAAA,MAAA,OACAA,EAAA,OAAA,QACAA,EAAA,MAAA,OACAA,EAAA,KAAA,MAZQA,IAAAD,KAAA,CAAA,CAAA;ACTL,MAAAE,IAAA,EAAA,GAAAL,EAAA;AAGA,IAAAM,IAAA,kBAAAJ,OACHA,EAAA,SAAA,UADQA,IAAAI,KAAA,CAAA,CAAA;ACmFR,MAAAC,IAAA;AAAA,EAAe,MAAA;AAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAXAC,IAAAC,EAAA,OAAA;AAAA,MAA2C,CAAA,cAAAH,EAAA,MAAA,EAAA,GAAA,CAAAI,EAAA;AAAA,IACY,EAAA;;;;;;;;;;;;;;;qBC9C3DC,IAAA,CAAA,GACAC,IAAA,oBACAC,IAAAC,EAAA,SAAA;AAKA,IAAAC,GAEAC,IAAA;AAEA,MAAAC,IAAAC,EAAA;AAAA,EAA8B,eAAA;AAAA,EACX,SAAA;AAAA,EACN,IAAAL;AAAA,EACL,UAAA;AAAA,EACM,SAAA;AAEd,CAAA,GAOAM,IAAA,CAAAC,MAAA;AAKI,QAAAC,IAAAC,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B,GAAAS,CAAA;AAAA,EAAyB;AAAA,EAC7B,UAAAT,GAAA;AAEI,IAAA2B,EAAA3B,CAAA;AAAA,EAAgB;AAExB;"}
|
|
1
|
+
{"version":3,"file":"tooltip.CGeGVHyl.js","sources":["../../src/directives/tooltip/tooltip.types.ts","../../src/types/utils-events.ts","../../src/components/internal/tooltip/tooltip.types.ts","../../src/components/internal/tooltip/tooltip.vue","../../src/directives/tooltip/tooltip.ts"],"sourcesContent":["import type { DirectiveBinding } from 'vue/types/options';\nimport { PopperContainerPositionBasic } from '../../components/popper-container/popper-container.types';\n\nexport interface BentoTooltipDirectiveBinding extends Readonly<DirectiveBinding> {\n readonly value: string;\n}\n\nexport const BentoTooltipPosition = { ...PopperContainerPositionBasic };\nexport type BentoTooltipPosition = PopperContainerPositionBasic;\n\nexport enum BentoTooltipState {\n HIDDEN = 'hidden',\n}\n","import type { Vue } from 'vue-demi';\n\nexport interface ListenOptions {\n capture?: boolean;\n passive?: boolean;\n once?: boolean;\n self?: boolean;\n vm?: Vue;\n onCleanup?: () => void;\n}\n\nexport enum EventKey {\n ESCAPE = 'Escape',\n ENTER = 'Enter',\n ARROW_LEFT = 'ArrowLeft',\n ARROW_UP = 'ArrowUp',\n ARROW_RIGHT = 'ArrowRight',\n ARROW_DOWN = 'ArrowDown',\n PAGE_UP = 'PageUp',\n PAGE_DOWN = 'PageDown',\n END = 'End',\n HOME = 'Home',\n TAB = 'Tab',\n F2 = 'F2',\n}\n\n/**\n * @deprecated Since v2.0.0. Use `EventKey` instead.\n * @see EventKey\n */\nexport enum KeyCode {\n ESCAPE = 27,\n ENTER = 13,\n ARROW_LEFT = 37,\n ARROW_UP = 38,\n ARROW_RIGHT = 39,\n ARROW_DOWN = 40,\n PAGE_UP = 33,\n PAGE_DOWN = 34,\n END = 35,\n HOME = 36,\n}\n","import { PopperContainerPositionBasic } from '../../popper-container/popper-container.types';\n\nexport const BentoTooltipPosition = { ...PopperContainerPositionBasic };\nexport type BentoTooltipPosition = PopperContainerPositionBasic;\n\nexport enum BentoTooltipState {\n HIDDEN = 'hidden',\n}\n","<template>\n <popper-container\n :id=\"id\"\n :aria-role=\"PopperContainerAriaRole.TOOLTIP\"\n :arrow=\"{ classes: ['b-tooltip__arrow'] }\"\n :class=\"conditionalClasses\"\n :fallback-position=\"fallbackPosition\"\n :is-hidden=\"!isShown\"\n :offset=\"[0, 4]\"\n :position=\"position\"\n :target-element=\"targetElement\"\n :disabled-focus-trap=\"disabledFocusTrap\"\n class=\"b-tooltip\"\n >\n <bento-typography el=\"span\" variant=\"caption\">\n {{ content }}\n </bento-typography>\n </popper-container>\n</template>\n\n<script setup lang=\"ts\">\n import type {} from '@floating-ui/vue';\n import { computed, type PropType } from 'vue';\n import { BentoTooltipPosition, BentoTooltipState } from './tooltip.types';\n import { type FallbackPositionProp, PopperContainer, PopperContainerAriaRole } from '@/components/popper-container';\n import { BentoTypography } from '@/components/typography';\n import { type VueNodeElement } from '@/types/elements';\n\n const props = defineProps({\n /**\n * The tooltip's id. Necessary for accessibility purposes.\n */\n id: { type: String, default: null },\n /**\n * Tooltip's target reference to the DOM element or Vue component.\n * The tooltip will position itself relatively to target element, in the specified position.\n */\n targetElement: { type: [Element, Object] as PropType<VueNodeElement>, required: true },\n /**\n * Tooltip's position relative to the target element.\n * Possible values are: 'top', 'bottom', 'left' and 'right'.\n */\n position: {\n type: String as PropType<BentoTooltipPosition>,\n default: BentoTooltipPosition.TOP,\n validator: value => Object.values(BentoTooltipPosition).includes(value as BentoTooltipPosition),\n },\n /**\n * Tooltip's offset.\n * If specified, the tooltip will have an offset in pixels between it and the target element\n * in specified position.\n */\n offset: { type: Number, default: 0 },\n /**\n * Tooltip's text content.\n */\n content: { type: String, required: true },\n /**\n * Shows / Hides the Tooltip component\n */\n isShown: { type: Boolean, default: false },\n\n /**\n * Allows to configure to fallback position to the one specified, it could be 'auto' or ['right', 'top', ...].\n * Useful when not using auto as starting placement.\n * @see {@link https://floating-ui.com/docs/flip#fallbackplacements}\n */\n fallbackPosition: {\n type: [Array, String] as PropType<FallbackPositionProp>,\n default: () => ['top', 'bottom', 'right', 'left'],\n },\n\n /**\n * Disables focus-trap for tooltip.\n * Useful for maintaining focus on the target element.\n */\n disabledFocusTrap: { type: Boolean, default: false },\n });\n\n const conditionalClasses = computed(() => ({\n [`b-tooltip--${BentoTooltipState.HIDDEN}`]: !props.isShown,\n }));\n</script>\n\n<script lang=\"ts\">\n /**\n * Tooltip container, to be used internally to render the tooltip container where the text is shown.\n */\n export default {\n name: 'tooltip',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./tooltip.scss\" />\n","import { nextTick, reactive } from 'vue';\nimport { listen } from '@/utils/ts/events';\nimport { generateUid } from '@/core/utils/ts';\nimport { EventKey } from '@/types/utils-events';\nimport { BentoTooltipPosition } from './tooltip.types';\nimport { type BentoTooltipDirectiveBinding } from './tooltip.types';\nimport { createApp, h, isVue2, isVue3, Vue2 } from 'vue-demi';\nimport Tooltip from '@/internal/tooltip/tooltip.vue';\nimport { getFocusableIn } from 'focus-lock';\n\ninterface TooltipInstance {\n target: HTMLElement;\n content: string;\n position: BentoTooltipPosition;\n removeListeners: Array<() => void>;\n}\n\n/**\n * Tooltip directive to render a tooltip on a given HTML element or component.\n *\n * @usage\n * import { BentoTooltipDirective, BentoTooltipPosition } from '@adyen/bento-vue2';\n *\n * export default {\n * directives: { BentoTooltipDirective },\n * template: `\n * <bento-button\n * v-bento-tooltip-directive:BentoTooltipPosition.BOTTOM=\"refToTextContent\"\n * >\n * Button text\n * </bento-button>\n * `,\n * }\n */\nconst tooltipInstances: Array<TooltipInstance> = [];\nconst ariaDescribedByAttr = 'aria-describedby';\nconst tooltipId = generateUid('tooltip');\n\nlet tooltipVNode;\n\n// Reusable Tooltip component instance.\nlet tooltip;\n// Global visibility state to prevent tooltips from showing after it being instructed to hide\nlet open = false;\n\nconst tooltipProps = reactive({\n targetElement: null,\n content: 'START_MESSAGE',\n id: tooltipId,\n position: undefined,\n isShown: false,\n});\n\n/**\n * Creates a new Tooltip component instance and inserts it into DOM.\n * @param {HTMLElement} el the target element for the Tooltip\n * @internal\n */\nconst createTooltip = (el: HTMLElement) => {\n // Only set tabindex on elements that are not natively focusable, don't already\n // have one, and don't contain a focusable descendant. Wrapper elements (e.g. a\n // menu div around a button) should not become tabbable themselves -- the child\n // button already provides keyboard access.\n const focusableChildren = getFocusableIn(el).filter(item => item.node !== el);\n if (el.tabIndex < 0 && focusableChildren.length === 0) {\n el.setAttribute('tabindex', '0');\n }\n\n if (isVue2) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore: Type error for Vue method in Vue 3 but this code only executes in vue 2 so ignoring.\n const TooltipComponent = Vue2.extend(Tooltip);\n tooltip = new TooltipComponent({ propsData: { targetElement: el, content: '', id: tooltipId } }).$mount();\n document.body.appendChild(tooltip.$el);\n } else {\n tooltipProps.targetElement = el;\n tooltip = createApp({\n components: { Tooltip },\n setup() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore: Type error for h method in Vue 2 but this code only executes in vue 3 so ignoring.\n return () => h(Tooltip, { ...tooltipProps }, '');\n },\n });\n tooltipVNode = document.createElement('div');\n tooltipVNode.id = 'tooltip-parent';\n document.body.appendChild(tooltipVNode);\n tooltip.mount('#tooltip-parent');\n }\n};\n\n/**\n * Removes Tooltip component instance from the DOM and destroys it.\n * @internal\n */\nconst destroyTooltip = () => {\n if (isVue2) {\n if (document.contains(tooltip.$el)) {\n document.body.removeChild(tooltip.$el);\n }\n tooltip.$destroy();\n } else {\n tooltip.unmount();\n if (document.contains(tooltipVNode)) {\n document.body.removeChild(tooltipVNode);\n }\n }\n\n tooltip = undefined;\n};\n\n/**\n * Returns tooltip position based on the specified argument.\n * By default returns 'top' if no argument is specified.\n * @param {BentoTooltipDirectiveBinding} binding Directive binding object.\n * @returns {string} Tooltip position.\n * @internal\n */\nconst getTooltipPosition = (binding: BentoTooltipDirectiveBinding): BentoTooltipPosition =>\n Object.values(BentoTooltipPosition).includes(binding.arg as BentoTooltipPosition)\n ? (binding.arg as BentoTooltipPosition)\n : BentoTooltipPosition.TOP;\n\n/**\n * Get the correct Tooltip instance for the given target element\n * @param {HTMLElement} el the target element for the Tooltip\n * @returns\n */\nconst getTooltipInstanceForTarget = (el: HTMLElement): TooltipInstance =>\n tooltipInstances.find(\n ctx =>\n // isEqualNode doesn't work correct for svg element, hence the second check here\n ctx.target.isEqualNode(el) && ctx.target === el\n );\n\n/**\n * On mouse enter event updates tooltip with correct content and position, and shows tooltip.\n * @param {?HTMLElement} el - Target element\n * @internal\n */\nconst showTooltip = (el?: HTMLElement) => {\n const tooltipInstance = getTooltipInstanceForTarget(el);\n\n // If tooltip content is empty – do not show the tooltip\n if (!tooltipInstance || !tooltipInstance.content || !el || !tooltip) {\n return;\n }\n\n if (el) {\n el.setAttribute(ariaDescribedByAttr, tooltipId);\n }\n\n // If the Tooltip is inside a dialog, move tooltip element inside of it\n // It gets restored to <body> when it gets hidden\n let isDialogOpen = false;\n document.querySelectorAll('dialog').forEach(node => {\n isDialogOpen = node?.open || isDialogOpen;\n });\n\n if (isDialogOpen) {\n if (isVue2) {\n el.after(tooltip.$el);\n // eslint-disable-next-line no-underscore-dangle\n } else if (tooltip?._instance?.vnode?.el) {\n // eslint-disable-next-line no-underscore-dangle\n el.after(tooltip?._instance?.vnode?.el);\n }\n isDialogOpen = false;\n }\n\n open = true;\n\n tooltip.content = tooltipInstance.content;\n tooltip.position = tooltipInstance.position;\n\n tooltipProps.content = tooltipInstance.content;\n tooltipProps.position = tooltipInstance.position;\n\n // Do calculations on a next tick, otherwise tooltip position calculations will be wrong\n nextTick(() => {\n // Do not open tooltip if it has been instructed to hide in process\n if (!open || !tooltip) {\n return;\n }\n tooltip.targetElement = el;\n tooltip.isShown = true;\n\n tooltipProps.targetElement = el;\n tooltipProps.isShown = true;\n });\n};\n\n/**\n * On mouse leave event hides the tooltip.\n * @internal\n */\nconst hideTooltip = (el?: HTMLElement) => {\n // Restore the tooltip element to body if it got move out of <body>\n if (tooltip?.$el?.parentElement?.tagName && tooltip.$el.parentElement.tagName !== 'BODY') {\n document.body.appendChild(tooltip.$el);\n }\n\n open = false;\n if (tooltip) {\n tooltip.isShown = false;\n }\n tooltipProps.isShown = false;\n if (el) {\n el.removeAttribute(ariaDescribedByAttr);\n }\n};\n\nconst tooltipBind = (el: HTMLElement, binding: BentoTooltipDirectiveBinding) => {\n // eslint-disable-next-line no-prototype-builtins\n if (!binding.hasOwnProperty('value') || binding.value) {\n // Create Tooltip component singleton instance\n if (tooltipInstances.length === 0) {\n createTooltip(el);\n }\n\n const show = () => showTooltip(el);\n const hide = () => hideTooltip(el);\n\n // Create and store context object, which has directive related handlers and content.\n const tooltipInstance: TooltipInstance = {\n target: el,\n content: binding.value,\n position: getTooltipPosition(binding),\n removeListeners: [\n listen(el, 'mouseenter', show),\n listen(el, 'mouseleave', hide),\n listen(el, 'focus', () => {\n if (el.matches(':focus-visible')) {\n show();\n }\n }),\n listen(el, 'blur', evt => {\n const focusEvent = <FocusEvent>evt;\n\n // when blurred and it transitions to the tooltip via screenreader, it should not close\n if ((focusEvent.relatedTarget as Element)?.getAttribute('role') !== 'tooltip') {\n hide();\n }\n }),\n listen(el, 'keydown', evt => {\n const keyboardEvent = <KeyboardEvent>evt;\n if (keyboardEvent.key === EventKey.ESCAPE) {\n hide();\n }\n }),\n ],\n };\n\n tooltipInstances.push(tooltipInstance);\n }\n};\n\nconst tooltipUpdate = (el: HTMLElement, binding: BentoTooltipDirectiveBinding) => {\n const tooltipInstance = getTooltipInstanceForTarget(el);\n if (tooltipInstance) {\n // Update tooltip content value if it is changed\n if (tooltipInstance?.content !== binding.value) {\n tooltipInstance.content = binding.value;\n // If tooltip is currently shown for current element – update tooltip's content value\n if (tooltip.isShown && tooltip.targetElement.isEqualNode(el)) {\n if (!tooltipInstance.content) {\n tooltip.isShown = false;\n } else {\n tooltip.content = binding.value;\n }\n\n // This forces the tooltip to refresh and update content in Vue3\n if (isVue3) {\n hideTooltip(el);\n showTooltip(el);\n }\n }\n }\n // Update tooltip position if it is changed\n if (tooltipInstance.position !== binding.arg) {\n const position = getTooltipPosition(binding);\n tooltipInstance.position = position;\n tooltip.position = position;\n }\n } else if (!tooltipInstance && binding.value) {\n // If I don't have a tooltip instance yet but the value passed was updated\n tooltipBind(el, binding);\n }\n};\n\nconst tooltipUnbind = (el: HTMLElement) => {\n const context = getTooltipInstanceForTarget(el);\n\n // Prevent unbinding/removing when there's nothing to unbind, leads to stack overflow errors\n if (!context) {\n return;\n }\n\n context.removeListeners.forEach(removeListener => {\n removeListener();\n });\n\n // If el is removed while tooltip is displayed, the tooltip doesnt hide as\n // there is no el to trigger mouseleave/blur.\n hideTooltip();\n\n tooltipInstances.splice(tooltipInstances.indexOf(context), 1);\n\n // If all the elements using the directive are removed, then no point having\n // the component on the page.\n if (tooltipInstances.length === 0) {\n destroyTooltip();\n }\n};\n\n/**\n * This directive allows you to bind a tooltip to an element.\n * Tooltip can be configured to be shown in one of four positions: 'top', 'left', 'right' and 'bottom'.\n *\n * @example\n * import { BentoTooltipDirective as BentoTooltip, BentoTooltipPosition } from '@adyen/bento-vue2';\n *\n * export default {\n * directives: { BentoTooltip },\n * methods: {\n * contentExpression() {\n * return 'tooltip content';\n * },\n * },\n * template: `<div>\n * <div v-bento-tooltip:left=\"refToTooltipContent\"></div>\n * <div v-bento-tooltip:[TooltipPosition.BOTTOM]=\"refToTooltipContent\"></div>\n *\n * <!-- If you don't specify the position then by default it's `TooltipPosition.TOP` -->\n * <div v-bento-tooltip=\"refToTooltipContent\"></div>\n *\n * <!-- Tooltip content can also be a data property or a method or a computed property as well -->\n * <div v-bento-tooltip=\"contentExpression()\"></div>\n * </div>`,\n * };\n */\nexport const BentoTooltipDirective = {\n // Vue 2 Directive hooks\n bind(el, binding) {\n tooltipBind(el, binding);\n },\n update(el, binding) {\n tooltipUpdate(el, binding);\n },\n unbind(el) {\n tooltipUnbind(el);\n },\n // Vue 3 Directive hooks\n beforeMount(el, binding) {\n tooltipBind(el, binding);\n },\n mounted(el, binding) {\n tooltipUpdate(el, binding);\n },\n updated(el, binding) {\n tooltipUpdate(el, binding);\n },\n unmounted(el) {\n tooltipUnbind(el);\n },\n};\n"],"names":["BentoTooltipPosition$1","PopperContainerPositionBasic","BentoTooltipState$1","BentoTooltipState2","EventKey","EventKey2","BentoTooltipPosition","BentoTooltipState","__default__","conditionalClasses","computed","props","tooltipInstances","ariaDescribedByAttr","tooltipId","generateUid","tooltip","open","tooltipProps","reactive","createTooltip","el","focusableChildren","getFocusableIn","item","TooltipComponent","Vue2","Tooltip","destroyTooltip","getTooltipPosition","binding","getTooltipInstanceForTarget","ctx","showTooltip","tooltipInstance","isDialogOpen","node","nextTick","hideTooltip","_b","_a","tooltipBind","show","hide","listen","evt","tooltipUpdate","position","tooltipUnbind","context","removeListener","BentoTooltipDirective"],"mappings":";;;;;;;;;AAOO,MAAAA,IAAA,EAAA,GAAAC,EAAA;AAGA,IAAAC,IAAA,kBAAAC,OACHA,EAAA,SAAA,UADQA,IAAAD,KAAA,CAAA,CAAA,GCCLE,IAAA,kBAAAC,OACHA,EAAA,SAAA,UACAA,EAAA,QAAA,SACAA,EAAA,aAAA,aACAA,EAAA,WAAA,WACAA,EAAA,cAAA,cACAA,EAAA,aAAA,aACAA,EAAA,UAAA,UACAA,EAAA,YAAA,YACAA,EAAA,MAAA,OACAA,EAAA,OAAA,QACAA,EAAA,MAAA,OACAA,EAAA,KAAA,MAZQA,IAAAD,KAAA,CAAA,CAAA;ACTL,MAAAE,IAAA,EAAA,GAAAL,EAAA;AAGA,IAAAM,IAAA,kBAAAJ,OACHA,EAAA,SAAA,UADQA,IAAAI,KAAA,CAAA,CAAA;ACmFR,MAAAC,IAAA;AAAA,EAAe,MAAA;AAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAXAC,IAAAC,EAAA,OAAA;AAAA,MAA2C,CAAA,cAAAH,EAAA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,EAAAzB,GAAAS,CAAA;AAAA,EAAyB;AAAA,EAC7B,OAAAT,GAAA;AAEI,IAAA2B,EAAA3B,CAAA;AAAA,EAAgB;AAAA;AAAA,EACpB,YAAAA,GAAAS,GAAA;AAGI,IAAAW,EAAApB,GAAAS,CAAA;AAAA,EAAuB;AAAA,EAC3B,QAAAT,GAAAS,GAAA;AAEI,IAAAgB,EAAAzB,GAAAS,CAAA;AAAA,EAAyB;AAAA,EAC7B,QAAAT,GAAAS,GAAA;AAEI,IAAAgB,EAAAzB,GAAAS,CAAA;AAAA,EAAyB;AAAA,EAC7B,UAAAT,GAAA;AAEI,IAAA2B,EAAA3B,CAAA;AAAA,EAAgB;AAExB;"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { defineComponent as g, ref as f, computed as a, isRef as F, watch as T, nextTick as I } from "vue";
|
|
2
|
-
import { B as P, h as $, f as w } from "./button-actions.
|
|
3
|
-
import { B as y } from "./popover.types.
|
|
2
|
+
import { B as P, h as $, f as w } from "./button-actions.BD4Dyp4U.js";
|
|
3
|
+
import { B as y } from "./popover.types.ZXsQ9bA6.js";
|
|
4
4
|
import { B as N } from "./typography.C8lPlsbD.js";
|
|
5
5
|
import { B as A } from "./image.C2D2hKat.js";
|
|
6
6
|
import { u as D } from "./index.B6WW_F-J.js";
|
|
7
7
|
import { R as K } from "./refresh.arF7jP-l.js";
|
|
8
8
|
/* empty css */
|
|
9
9
|
import { n as d } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
10
|
-
import { P as x, h as j, o as M } from "./popper-container.
|
|
10
|
+
import { P as x, h as j, o as M } from "./popper-container.dxpRn9a5.js";
|
|
11
11
|
import "../assets/tutorial.css";
|
|
12
12
|
var R;
|
|
13
13
|
const L = /* @__PURE__ */ g({
|
|
@@ -413,4 +413,4 @@ const ht = lt.exports;
|
|
|
413
413
|
export {
|
|
414
414
|
ht as t
|
|
415
415
|
};
|
|
416
|
-
//# sourceMappingURL=tutorial.
|
|
416
|
+
//# sourceMappingURL=tutorial.WeP9PjhU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tutorial.CkeL_7Je.js","sources":["../../src/components/tutorial/components/tutorial-popover/components/tutorial-indicator/tutorial-indicator.vue","../../../ui-assets/icons-16/dist/vue/blocked.vue","../../src/components/tutorial/components/tutorial-popover/tutorial-popover.vue","../../src/components/tutorial/tutorial.vue"],"sourcesContent":["<template>\n <popper-container\n :target-element=\"targetElement\"\n :middleware=\"middleware\"\n position=\"top-start\"\n fixed-positioning\n disabled-focus-trap\n class=\"b-tutorial-indicator\"\n data-testid=\"tutorial-indicator\"\n >\n <div class=\"b-tutorial-indicator__highlight\" :style=\"computedStyles\"></div>\n </popper-container>\n</template>\n\n<script setup lang=\"ts\">\n import { ref } from 'vue';\n import { hide, type Middleware, offset } from '@floating-ui/vue';\n import { PopperContainer } from '@/components/popper-container';\n\n const BORDER_OFFSET = 2;\n\n defineProps({\n /**\n * Tutorial indicator's target element.\n * The indicator will position itself around the target element.\n */\n targetElement: {\n type: PopperContainer.props?.targetElement.type,\n required: true,\n },\n });\n\n const computedStyles = ref({\n width: '0',\n height: '0',\n borderRadius: '0',\n });\n\n function getBorderRadius(element: HTMLElement) {\n try {\n const radius = parseFloat(getComputedStyle(element).getPropertyValue('border-radius'));\n return Number.isNaN(radius) ? '' : `${radius + 2 * BORDER_OFFSET}px`;\n } catch {\n return '';\n }\n }\n\n const middleware = [\n hide(),\n offset({\n mainAxis: BORDER_OFFSET,\n alignmentAxis: -BORDER_OFFSET,\n }),\n {\n name: 'updateIndicatorSize',\n fn: ({ x, y, elements }) => {\n const target = elements.reference as HTMLElement;\n computedStyles.value.width = `${target.offsetWidth + 4 * BORDER_OFFSET}px`;\n computedStyles.value.height = `${target.offsetHeight + 4 * BORDER_OFFSET}px`;\n computedStyles.value.borderRadius = getBorderRadius(target);\n return { x, y };\n },\n } as Middleware,\n ];\n</script>\n\n<style lang=\"scss\" scoped src=\"./tutorial-indicator.scss\" />\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><g :clip-path=\"'url(#uia-ui-assets/icons-16-blocked__a' + uuid + ')'\"><path fill=\"#001222\" d=\"M9.51195 0.398918C8.00859 0.0998821 6.45033 0.253358 5.0342 0.839937C3.61808 1.42652 2.40769 2.41985 1.55611 3.69433C0.704529 4.96881 0.25 6.4672 0.25 8C0.25 10.0554 1.06652 12.0267 2.51992 13.4801C3.97333 14.9335 5.94457 15.75 8 15.75C9.53281 15.75 11.0312 15.2955 12.3057 14.4439C13.5801 13.5923 14.5735 12.3819 15.1601 10.9658C15.7466 9.54967 15.9001 7.99141 15.6011 6.48805C15.3021 4.9847 14.5639 3.60378 13.4801 2.51993C12.3962 1.43607 11.0153 0.697953 9.51195 0.398918ZM5.60823 2.22576C6.75027 1.75271 8.00693 1.62894 9.21931 1.8701C10.4317 2.11125 11.5453 2.70651 12.4194 3.58059C13.2935 4.45466 13.8887 5.56831 14.1299 6.78069C14.3711 7.99307 14.2473 9.24974 13.7742 10.3918C13.5555 10.9198 13.2667 11.4124 12.9177 11.8573L4.14271 3.0823C4.58761 2.73333 5.08018 2.44448 5.60823 2.22576ZM3.08208 4.14298L11.857 12.9179C11.7327 13.0154 11.6044 13.1085 11.4723 13.1967C10.4445 13.8834 9.23613 14.25 8 14.25C6.3424 14.25 4.75268 13.5915 3.58058 12.4194C2.40848 11.2473 1.75 9.65761 1.75 8C1.75 6.76387 2.11656 5.5555 2.80331 4.52769C2.89155 4.39564 2.98456 4.26733 3.08208 4.14298Z\"/></g><defs><clipPath :id=\"'uia-ui-assets/icons-16-blocked__a' + uuid\"><rect width=\"16\" height=\"16\" fill=\"#fff\"/></clipPath></defs></svg>\n</template>\n<script>\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 v-if=\"active && targetElement\">\n <tutorial-indicator v-if=\"isIndicatorVisible && targetElement\" :target-element=\"targetElement\" />\n\n <bento-popover\n :target-element=\"targetElement\"\n :position=\"position\"\n :open=\"isPopoverOpen\"\n :aria-label=\"title\"\n fixed-positioning\n class=\"b-tutorial-popover\"\n @keydown.esc.native=\"emit('finish')\"\n >\n <template v-if=\"image\" #image>\n <bento-image v-bind=\"image\" aspect-ratio=\"landscape\" class=\"b-tutorial-popover__image\" />\n </template>\n\n <div aria-hidden=\"true\" class=\"b-tutorial-popover__ripple\"></div>\n\n <div class=\"b-tutorial-popover__header\">\n <bento-typography variant=\"title\" el=\"span\"> {{ title }} </bento-typography>\n\n <bento-typography v-if=\"showSteps\" el=\"span\" class=\"b-tutorial-popover__steps\">\n {{ t('stepsOfTotal', { step, totalSteps }) }}\n </bento-typography>\n </div>\n\n <bento-typography>\n <slot />\n </bento-typography>\n\n <div class=\"b-tutorial-popover__footer\">\n <bento-menu\n v-if=\"!isFirstStep\"\n :data=\"menuData\"\n class=\"b-tutorial-popover__menu\"\n data-testid=\"menu-button\"\n />\n <div class=\"b-tutorial-popover__actions\">\n <bento-button-actions :actions=\"computedActions\" layout=\"buttons-end\" />\n </div>\n </div>\n </bento-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, isRef, nextTick, type PropType, ref, type default as Vue, watch } from 'vue';\n import { BentoMenu } from '@/components/menu';\n import { BentoPopover, BentoPopoverPositions } from '@/components/popover';\n import { BentoTypography } from '@/components/typography';\n import { type BentoButtonActionObject, BentoButtonActions } from '@/components/button';\n import { BentoImage } from '@/components/image';\n import { TutorialIndicator } from './components/tutorial-indicator';\n import { useI18n } from '@/utils/ts/i18n';\n import type { BentoMenuItem } from '@/components/menu/components';\n import type { VueNodeElement } from '@/types/elements';\n import type { BentoTutorialScrollOptions, BentoTutorialStep } from '../../tutorial.types';\n import RefreshIcon from '@adyen/ui-assets-icons-16/vue/refresh';\n import BlockedIcon from '@adyen/ui-assets-icons-16/vue/blocked';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const DEFAULT_SCROLL_OPTIONS: BentoTutorialScrollOptions = { behavior: 'smooth' };\n\n const props = defineProps({\n /**\n * Optional configuration for the secondary action.\n * In tour tutorials, this is ignored for the introductory step.\n */\n action: {\n type: Object as PropType<BentoButtonActionObject>,\n default: null,\n },\n\n /**\n * Indicates whether this popover is the active step (and should be visible).\n */\n active: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Optional illustration to display at the top of the popover.\n */\n image: {\n type: Object as PropType<BentoTutorialStep['image']>,\n default: null,\n },\n\n /**\n * Popover's position relative to the target element.\n * Possible values are:\n * 'auto', 'auto-start', 'auto-end',\n * 'top', 'top-start', 'top-end'\n * 'right', 'right-start', 'right-end'\n * 'bottom', 'bottom-start', 'bottom-end'\n * 'left', 'left-start', 'left-end'\n */\n position: {\n type: String as PropType<`${BentoPopoverPositions}`>,\n default: BentoPopoverPositions.BOTTOM_START,\n validator: (value: BentoPopoverPositions) => Object.values(BentoPopoverPositions).includes(value),\n },\n\n /**\n * Options to control the scroll into view behavior.\n * Takes the same options as the `scrollIntoView` function\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView}\n */\n scrollOptions: {\n type: [Boolean, Object] as PropType<BentoTutorialScrollOptions>,\n default: null,\n },\n\n /**\n * Indicates whether this popover is a single tutorial or a tour.\n */\n single: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The tutorial step number.\n * In tour tutorials, `0` is the introductory step, and is displayed next\n * to the title.\n */\n step: {\n type: Number,\n default: null,\n },\n\n /**\n * Tutorial popover's target element.\n * The popover will position itself relatively to target element.\n */\n targetElement: {\n type: [Element, Object] as PropType<VueNodeElement>,\n required: true,\n },\n\n /**\n * The tutorial step title.\n */\n title: {\n type: String,\n required: true,\n },\n\n /**\n * Total count of steps.\n * In tour tutorials, this does not include the introductory step, and is\n * displayed next to the title.\n */\n totalSteps: {\n type: Number,\n default: null,\n },\n });\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const emit = defineEmits([\"next\", \"finish\", \"restart\"]);\n\n const ACTION_SKIP = computed<BentoButtonActionObject>(() => ({\n title: t('skipTour') as string,\n event: () => emit('finish'),\n }));\n\n const ACTION_START = computed<BentoButtonActionObject>(() => ({\n title: t('startTour') as string,\n event: () => emit('next'),\n }));\n\n const ACTION_NEXT = computed<BentoButtonActionObject>(() => ({\n title: t('next') as string,\n event: () => emit('next'),\n }));\n\n const ACTION_FINISH = computed<BentoButtonActionObject>(() => ({\n title: t('finish') as string,\n event: () => emit('finish'),\n }));\n\n const ACTION_OK = computed<BentoButtonActionObject>(() => ({\n title: t('ok') as string,\n event: () => emit('finish'),\n }));\n\n const isPopoverOpen = ref(false);\n const isIndicatorVisible = ref(false);\n\n const targetElement = computed(() => {\n if (isRef(props.targetElement)) {\n return ((props.targetElement.value as Vue)?.$el || props.targetElement.value) as HTMLElement;\n }\n return ((props.targetElement as Vue).$el || props.targetElement) as HTMLElement;\n });\n\n const isFirstStep = computed(() => props.step === 0);\n const isLastStep = computed(() => props.step === props.totalSteps);\n\n const showSteps = computed(() => !isFirstStep.value);\n\n const menuData = computed<Array<BentoMenuItem>>(() => [\n {\n text: t('restartTour'),\n handler: () => emit('restart'),\n icon: RefreshIcon,\n },\n ...(isLastStep.value\n ? []\n : [\n {\n text: t('skipTour'),\n handler: () => emit('finish'),\n icon: BlockedIcon,\n },\n ]),\n ]);\n\n const computedActions = computed(() => {\n let primaryAction: BentoButtonActionObject;\n if (isFirstStep.value) {\n primaryAction = props.single ? ACTION_OK.value : ACTION_START.value;\n } else if (isLastStep.value) {\n primaryAction = ACTION_FINISH.value;\n } else {\n primaryAction = ACTION_NEXT.value;\n }\n\n const actions = [primaryAction];\n if (isFirstStep.value && !props.single) {\n actions.push(ACTION_SKIP.value);\n } else if (props.action) {\n actions.push(props.action);\n }\n\n return actions;\n });\n\n watch(\n () => props.active,\n async isActive => {\n if (isActive && targetElement.value?.scrollIntoView) {\n targetElement.value?.scrollIntoView(\n props.scrollOptions != null ? props.scrollOptions : DEFAULT_SCROLL_OPTIONS\n );\n\n // Skip to next tick to preserve popover appear animation\n await nextTick();\n }\n\n isPopoverOpen.value = isActive;\n isIndicatorVisible.value = isActive;\n },\n { immediate: true }\n );\n</script>\n\n<script lang=\"ts\">\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./tutorial-popover.scss\" />\n","<template>\n <div class=\"b-tutorial\">\n <tutorial-popover\n v-for=\"(step, i) in steps\"\n v-bind=\"getPopoverProps(step, i)\"\n :key=\"step.title\"\n @finish=\"currentStep = -1\"\n @next=\"currentStep += 1\"\n @restart=\"currentStep = 0\"\n >\n {{ step.description }}\n </tutorial-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, type PropType, ref, watch } from 'vue';\n import { TutorialPopover } from './components/tutorial-popover';\n import type { BentoTutorialScrollOptions, BentoTutorialStep } from './tutorial.types';\n\n const props = defineProps({\n /**\n * The current step index. If provided, will start the tutorial in that step.\n */\n index: {\n type: Number,\n default: null,\n },\n\n /**\n * The steps configuration for the tutorial.\n *\n */\n steps: {\n type: Array as PropType<Array<BentoTutorialStep>>,\n required: true,\n validator: (value: Array<BentoTutorialStep>) => value.length > 0,\n },\n\n /**\n * Options to control the scroll into view behavior.\n * Takes the same options as the `scrollIntoView` function\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView}\n */\n scrollOptions: {\n type: [Boolean, Object] as PropType<BentoTutorialScrollOptions>,\n default: null,\n },\n });\n\n const emit = defineEmits([\"update:index\"]);\n\n const currentStep = ref(props.index || 0);\n\n const totalSteps = computed(() => props.steps.length - 1);\n const isSingleTutorial = computed(() => totalSteps.value === 0);\n\n function getPopoverProps(step: BentoTutorialStep, index: number) {\n return {\n // Visual\n targetElement: step.target,\n image: step.image,\n title: step.title,\n step: index,\n totalSteps: totalSteps.value,\n action: step.action,\n scrollOptions: props.scrollOptions,\n\n // Config\n active: index === currentStep.value,\n single: isSingleTutorial.value,\n position: step.position,\n };\n }\n\n watch(currentStep, step => {\n emit('update:index', step);\n });\n\n watch(\n () => props.index,\n value => {\n if (value >= -1 && value <= totalSteps.value) {\n currentStep.value = value;\n }\n }\n );\n</script>\n\n<script lang=\"ts\">\n /**\n * The Tutorial is a temporary popover that should be used to educate users about\n * new or unfamiliar features or experiences.\n *\n * You can use single tutorial or chain them into a tour.\n *\n * Only use this component for new features/experiences that are not obvious and\n * self-explanatory on their own.\n *\n * @example\n * import { BentoTutorial } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoTutorial },\n * template: `\n * <bento-tutorial\n * :steps=\"[\n * {\n * target: targetElement1,\n * title: 'Tutorial intro title',\n * description: 'Intro body content',\n * image: { src: imageSource, alt: 'Alt text' }\n * },\n * {\n * target: targetElement1,\n * title: 'Tutorial intro title',\n * description: 'Intro body content',\n * action: { title: 'Action label', event: () => {} }\n * },\n * ]\"\n * />\n * `\n * }\n */\n export default {};\n</script>\n"],"names":["computedStyles","ref","getBorderRadius","element","radius","middleware","hide","offset","x","y","elements","target","uuid","_sfc_main$2","__default__$1","messages","DEFAULT_SCROLL_OPTIONS","t","useI18n","ACTION_SKIP","computed","emit","ACTION_START","ACTION_NEXT","ACTION_FINISH","ACTION_OK","isPopoverOpen","isIndicatorVisible","targetElement","isRef","props","_a","isFirstStep","isLastStep","showSteps","menuData","RefreshIcon","BlockedIcon","computedActions","primaryAction","actions","watch","isActive","_b","nextTick","__default__","currentStep","totalSteps","isSingleTutorial","getPopoverProps","step","index","value"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgCI,UAAAA,IAAAC,EAAA;AAAA,MAA2B,OAAA;AAAA,MAChB,QAAA;AAAA,MACC,cAAA;AAAA,IACM,CAAA;AAGlB,aAAAC,EAAAC,GAAA;AACI,UAAA;AACI,cAAAC,IAAA,W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AAAA,IAAyB,CAAA,GAG7BT;AAAA,MAAA,MAAAX,EAAA;AAAA,MACgB,CAAAsB,MAAA;AAER,QAAAA,KAAA,MAAAA,KAAAL,EAAA,UACID,EAAA,QAAAM;AAAA,MACJ;AAAA,IACJ;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"tutorial.WeP9PjhU.js","sources":["../../src/components/tutorial/components/tutorial-popover/components/tutorial-indicator/tutorial-indicator.vue","../../../ui-assets/icons-16/dist/vue/blocked.vue","../../src/components/tutorial/components/tutorial-popover/tutorial-popover.vue","../../src/components/tutorial/tutorial.vue"],"sourcesContent":["<template>\n <popper-container\n :target-element=\"targetElement\"\n :middleware=\"middleware\"\n position=\"top-start\"\n fixed-positioning\n disabled-focus-trap\n class=\"b-tutorial-indicator\"\n data-testid=\"tutorial-indicator\"\n >\n <div class=\"b-tutorial-indicator__highlight\" :style=\"computedStyles\"></div>\n </popper-container>\n</template>\n\n<script setup lang=\"ts\">\n import { ref } from 'vue';\n import { hide, type Middleware, offset } from '@floating-ui/vue';\n import { PopperContainer } from '@/components/popper-container';\n\n const BORDER_OFFSET = 2;\n\n defineProps({\n /**\n * Tutorial indicator's target element.\n * The indicator will position itself around the target element.\n */\n targetElement: {\n type: PopperContainer.props?.targetElement.type,\n required: true,\n },\n });\n\n const computedStyles = ref({\n width: '0',\n height: '0',\n borderRadius: '0',\n });\n\n function getBorderRadius(element: HTMLElement) {\n try {\n const radius = parseFloat(getComputedStyle(element).getPropertyValue('border-radius'));\n return Number.isNaN(radius) ? '' : `${radius + 2 * BORDER_OFFSET}px`;\n } catch {\n return '';\n }\n }\n\n const middleware = [\n hide(),\n offset({\n mainAxis: BORDER_OFFSET,\n alignmentAxis: -BORDER_OFFSET,\n }),\n {\n name: 'updateIndicatorSize',\n fn: ({ x, y, elements }) => {\n const target = elements.reference as HTMLElement;\n computedStyles.value.width = `${target.offsetWidth + 4 * BORDER_OFFSET}px`;\n computedStyles.value.height = `${target.offsetHeight + 4 * BORDER_OFFSET}px`;\n computedStyles.value.borderRadius = getBorderRadius(target);\n return { x, y };\n },\n } as Middleware,\n ];\n</script>\n\n<style lang=\"scss\" scoped src=\"./tutorial-indicator.scss\" />\n","\n<template>\n <svg role=\"img\" v-bind=\"$attrs\" class=\"ui-assets-icons-16\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\"><title v-if=\"$attrs['svg-title']\">{{ $attrs['svg-title'] }}</title><g :clip-path=\"'url(#uia-ui-assets/icons-16-blocked__a' + uuid + ')'\"><path fill=\"#001222\" d=\"M9.51195 0.398918C8.00859 0.0998821 6.45033 0.253358 5.0342 0.839937C3.61808 1.42652 2.40769 2.41985 1.55611 3.69433C0.704529 4.96881 0.25 6.4672 0.25 8C0.25 10.0554 1.06652 12.0267 2.51992 13.4801C3.97333 14.9335 5.94457 15.75 8 15.75C9.53281 15.75 11.0312 15.2955 12.3057 14.4439C13.5801 13.5923 14.5735 12.3819 15.1601 10.9658C15.7466 9.54967 15.9001 7.99141 15.6011 6.48805C15.3021 4.9847 14.5639 3.60378 13.4801 2.51993C12.3962 1.43607 11.0153 0.697953 9.51195 0.398918ZM5.60823 2.22576C6.75027 1.75271 8.00693 1.62894 9.21931 1.8701C10.4317 2.11125 11.5453 2.70651 12.4194 3.58059C13.2935 4.45466 13.8887 5.56831 14.1299 6.78069C14.3711 7.99307 14.2473 9.24974 13.7742 10.3918C13.5555 10.9198 13.2667 11.4124 12.9177 11.8573L4.14271 3.0823C4.58761 2.73333 5.08018 2.44448 5.60823 2.22576ZM3.08208 4.14298L11.857 12.9179C11.7327 13.0154 11.6044 13.1085 11.4723 13.1967C10.4445 13.8834 9.23613 14.25 8 14.25C6.3424 14.25 4.75268 13.5915 3.58058 12.4194C2.40848 11.2473 1.75 9.65761 1.75 8C1.75 6.76387 2.11656 5.5555 2.80331 4.52769C2.89155 4.39564 2.98456 4.26733 3.08208 4.14298Z\"/></g><defs><clipPath :id=\"'uia-ui-assets/icons-16-blocked__a' + uuid\"><rect width=\"16\" height=\"16\" fill=\"#fff\"/></clipPath></defs></svg>\n</template>\n<script>\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 v-if=\"active && targetElement\">\n <tutorial-indicator v-if=\"isIndicatorVisible && targetElement\" :target-element=\"targetElement\" />\n\n <bento-popover\n :target-element=\"targetElement\"\n :position=\"position\"\n :open=\"isPopoverOpen\"\n :aria-label=\"title\"\n fixed-positioning\n class=\"b-tutorial-popover\"\n @keydown.esc.native=\"emit('finish')\"\n >\n <template v-if=\"image\" #image>\n <bento-image v-bind=\"image\" aspect-ratio=\"landscape\" class=\"b-tutorial-popover__image\" />\n </template>\n\n <div aria-hidden=\"true\" class=\"b-tutorial-popover__ripple\"></div>\n\n <div class=\"b-tutorial-popover__header\">\n <bento-typography variant=\"title\" el=\"span\"> {{ title }} </bento-typography>\n\n <bento-typography v-if=\"showSteps\" el=\"span\" class=\"b-tutorial-popover__steps\">\n {{ t('stepsOfTotal', { step, totalSteps }) }}\n </bento-typography>\n </div>\n\n <bento-typography>\n <slot />\n </bento-typography>\n\n <div class=\"b-tutorial-popover__footer\">\n <bento-menu\n v-if=\"!isFirstStep\"\n :data=\"menuData\"\n class=\"b-tutorial-popover__menu\"\n data-testid=\"menu-button\"\n />\n <div class=\"b-tutorial-popover__actions\">\n <bento-button-actions :actions=\"computedActions\" layout=\"buttons-end\" />\n </div>\n </div>\n </bento-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, isRef, nextTick, type PropType, ref, type default as Vue, watch } from 'vue';\n import { BentoMenu } from '@/components/menu';\n import { BentoPopover, BentoPopoverPositions } from '@/components/popover';\n import { BentoTypography } from '@/components/typography';\n import { type BentoButtonActionObject, BentoButtonActions } from '@/components/button';\n import { BentoImage } from '@/components/image';\n import { TutorialIndicator } from './components/tutorial-indicator';\n import { useI18n } from '@/utils/ts/i18n';\n import type { BentoMenuItem } from '@/components/menu/components';\n import type { VueNodeElement } from '@/types/elements';\n import type { BentoTutorialScrollOptions, BentoTutorialStep } from '../../tutorial.types';\n import RefreshIcon from '@adyen/ui-assets-icons-16/vue/refresh';\n import BlockedIcon from '@adyen/ui-assets-icons-16/vue/blocked';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const DEFAULT_SCROLL_OPTIONS: BentoTutorialScrollOptions = { behavior: 'smooth' };\n\n const props = defineProps({\n /**\n * Optional configuration for the secondary action.\n * In tour tutorials, this is ignored for the introductory step.\n */\n action: {\n type: Object as PropType<BentoButtonActionObject>,\n default: null,\n },\n\n /**\n * Indicates whether this popover is the active step (and should be visible).\n */\n active: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Optional illustration to display at the top of the popover.\n */\n image: {\n type: Object as PropType<BentoTutorialStep['image']>,\n default: null,\n },\n\n /**\n * Popover's position relative to the target element.\n * Possible values are:\n * 'auto', 'auto-start', 'auto-end',\n * 'top', 'top-start', 'top-end'\n * 'right', 'right-start', 'right-end'\n * 'bottom', 'bottom-start', 'bottom-end'\n * 'left', 'left-start', 'left-end'\n */\n position: {\n type: String as PropType<`${BentoPopoverPositions}`>,\n default: BentoPopoverPositions.BOTTOM_START,\n validator: (value: BentoPopoverPositions) => Object.values(BentoPopoverPositions).includes(value),\n },\n\n /**\n * Options to control the scroll into view behavior.\n * Takes the same options as the `scrollIntoView` function\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView}\n */\n scrollOptions: {\n type: [Boolean, Object] as PropType<BentoTutorialScrollOptions>,\n default: null,\n },\n\n /**\n * Indicates whether this popover is a single tutorial or a tour.\n */\n single: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The tutorial step number.\n * In tour tutorials, `0` is the introductory step, and is displayed next\n * to the title.\n */\n step: {\n type: Number,\n default: null,\n },\n\n /**\n * Tutorial popover's target element.\n * The popover will position itself relatively to target element.\n */\n targetElement: {\n type: [Element, Object] as PropType<VueNodeElement>,\n required: true,\n },\n\n /**\n * The tutorial step title.\n */\n title: {\n type: String,\n required: true,\n },\n\n /**\n * Total count of steps.\n * In tour tutorials, this does not include the introductory step, and is\n * displayed next to the title.\n */\n totalSteps: {\n type: Number,\n default: null,\n },\n });\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const emit = defineEmits([\"next\", \"finish\", \"restart\"]);\n\n const ACTION_SKIP = computed<BentoButtonActionObject>(() => ({\n title: t('skipTour') as string,\n event: () => emit('finish'),\n }));\n\n const ACTION_START = computed<BentoButtonActionObject>(() => ({\n title: t('startTour') as string,\n event: () => emit('next'),\n }));\n\n const ACTION_NEXT = computed<BentoButtonActionObject>(() => ({\n title: t('next') as string,\n event: () => emit('next'),\n }));\n\n const ACTION_FINISH = computed<BentoButtonActionObject>(() => ({\n title: t('finish') as string,\n event: () => emit('finish'),\n }));\n\n const ACTION_OK = computed<BentoButtonActionObject>(() => ({\n title: t('ok') as string,\n event: () => emit('finish'),\n }));\n\n const isPopoverOpen = ref(false);\n const isIndicatorVisible = ref(false);\n\n const targetElement = computed(() => {\n if (isRef(props.targetElement)) {\n return ((props.targetElement.value as Vue)?.$el || props.targetElement.value) as HTMLElement;\n }\n return ((props.targetElement as Vue).$el || props.targetElement) as HTMLElement;\n });\n\n const isFirstStep = computed(() => props.step === 0);\n const isLastStep = computed(() => props.step === props.totalSteps);\n\n const showSteps = computed(() => !isFirstStep.value);\n\n const menuData = computed<Array<BentoMenuItem>>(() => [\n {\n text: t('restartTour'),\n handler: () => emit('restart'),\n icon: RefreshIcon,\n },\n ...(isLastStep.value\n ? []\n : [\n {\n text: t('skipTour'),\n handler: () => emit('finish'),\n icon: BlockedIcon,\n },\n ]),\n ]);\n\n const computedActions = computed(() => {\n let primaryAction: BentoButtonActionObject;\n if (isFirstStep.value) {\n primaryAction = props.single ? ACTION_OK.value : ACTION_START.value;\n } else if (isLastStep.value) {\n primaryAction = ACTION_FINISH.value;\n } else {\n primaryAction = ACTION_NEXT.value;\n }\n\n const actions = [primaryAction];\n if (isFirstStep.value && !props.single) {\n actions.push(ACTION_SKIP.value);\n } else if (props.action) {\n actions.push(props.action);\n }\n\n return actions;\n });\n\n watch(\n () => props.active,\n async isActive => {\n if (isActive && targetElement.value?.scrollIntoView) {\n targetElement.value?.scrollIntoView(\n props.scrollOptions != null ? props.scrollOptions : DEFAULT_SCROLL_OPTIONS\n );\n\n // Skip to next tick to preserve popover appear animation\n await nextTick();\n }\n\n isPopoverOpen.value = isActive;\n isIndicatorVisible.value = isActive;\n },\n { immediate: true }\n );\n</script>\n\n<script lang=\"ts\">\n export default {\n i18n: { messages },\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./tutorial-popover.scss\" />\n","<template>\n <div class=\"b-tutorial\">\n <tutorial-popover\n v-for=\"(step, i) in steps\"\n v-bind=\"getPopoverProps(step, i)\"\n :key=\"step.title\"\n @finish=\"currentStep = -1\"\n @next=\"currentStep += 1\"\n @restart=\"currentStep = 0\"\n >\n {{ step.description }}\n </tutorial-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, type PropType, ref, watch } from 'vue';\n import { TutorialPopover } from './components/tutorial-popover';\n import type { BentoTutorialScrollOptions, BentoTutorialStep } from './tutorial.types';\n\n const props = defineProps({\n /**\n * The current step index. If provided, will start the tutorial in that step.\n */\n index: {\n type: Number,\n default: null,\n },\n\n /**\n * The steps configuration for the tutorial.\n *\n */\n steps: {\n type: Array as PropType<Array<BentoTutorialStep>>,\n required: true,\n validator: (value: Array<BentoTutorialStep>) => value.length > 0,\n },\n\n /**\n * Options to control the scroll into view behavior.\n * Takes the same options as the `scrollIntoView` function\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView}\n */\n scrollOptions: {\n type: [Boolean, Object] as PropType<BentoTutorialScrollOptions>,\n default: null,\n },\n });\n\n const emit = defineEmits([\"update:index\"]);\n\n const currentStep = ref(props.index || 0);\n\n const totalSteps = computed(() => props.steps.length - 1);\n const isSingleTutorial = computed(() => totalSteps.value === 0);\n\n function getPopoverProps(step: BentoTutorialStep, index: number) {\n return {\n // Visual\n targetElement: step.target,\n image: step.image,\n title: step.title,\n step: index,\n totalSteps: totalSteps.value,\n action: step.action,\n scrollOptions: props.scrollOptions,\n\n // Config\n active: index === currentStep.value,\n single: isSingleTutorial.value,\n position: step.position,\n };\n }\n\n watch(currentStep, step => {\n emit('update:index', step);\n });\n\n watch(\n () => props.index,\n value => {\n if (value >= -1 && value <= totalSteps.value) {\n currentStep.value = value;\n }\n }\n );\n</script>\n\n<script lang=\"ts\">\n /**\n * The Tutorial is a temporary popover that should be used to educate users about\n * new or unfamiliar features or experiences.\n *\n * You can use single tutorial or chain them into a tour.\n *\n * Only use this component for new features/experiences that are not obvious and\n * self-explanatory on their own.\n *\n * @example\n * import { BentoTutorial } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoTutorial },\n * template: `\n * <bento-tutorial\n * :steps=\"[\n * {\n * target: targetElement1,\n * title: 'Tutorial intro title',\n * description: 'Intro body content',\n * image: { src: imageSource, alt: 'Alt text' }\n * },\n * {\n * target: targetElement1,\n * title: 'Tutorial intro title',\n * description: 'Intro body content',\n * action: { title: 'Action label', event: () => {} }\n * },\n * ]\"\n * />\n * `\n * }\n */\n export default {};\n</script>\n"],"names":["computedStyles","ref","getBorderRadius","element","radius","middleware","hide","offset","x","y","elements","target","uuid","_sfc_main$2","__default__$1","messages","DEFAULT_SCROLL_OPTIONS","t","useI18n","ACTION_SKIP","computed","emit","ACTION_START","ACTION_NEXT","ACTION_FINISH","ACTION_OK","isPopoverOpen","isIndicatorVisible","targetElement","isRef","props","_a","isFirstStep","isLastStep","showSteps","menuData","RefreshIcon","BlockedIcon","computedActions","primaryAction","actions","watch","isActive","_b","nextTick","__default__","currentStep","totalSteps","isSingleTutorial","getPopoverProps","step","index","value"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgCI,UAAAA,IAAAC,EA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AE,EAAA;AAAA,QACL,UAAAE,EAAA;AAAA,MACV;AAAA,IACnB;AAGJ,WAAAT,EAAAK,GAAA,CAAAI,MAAA;AACI,MAAA7B,EAAA,gBAAA6B,CAAA;AAAA,IAAyB,CAAA,GAG7BT;AAAA,MAAA,MAAAX,EAAA;AAAA,MACgB,CAAAsB,MAAA;AAER,QAAAA,KAAA,MAAAA,KAAAL,EAAA,UACID,EAAA,QAAAM;AAAA,MACJ;AAAA,IACJ;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/chunks/{use-bento-delayed-hover.D4rfUUOr.js → use-bento-delayed-hover.CxJOLxok.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref as u } from "vue";
|
|
2
|
-
import { u as a } from "./index.
|
|
2
|
+
import { u as a } from "./index.BPUMyryR.js";
|
|
3
3
|
const i = 200, f = (t = i) => {
|
|
4
4
|
const e = u(!1), { start: n, stop: r } = a(
|
|
5
5
|
() => {
|
|
@@ -27,4 +27,4 @@ const i = 200, f = (t = i) => {
|
|
|
27
27
|
export {
|
|
28
28
|
f as u
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=use-bento-delayed-hover.
|
|
30
|
+
//# sourceMappingURL=use-bento-delayed-hover.CxJOLxok.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-bento-delayed-hover.
|
|
1
|
+
{"version":3,"file":"use-bento-delayed-hover.CxJOLxok.js","sources":["../../src/composables/use-bento-delayed-hover/use-bento-delayed-hover.ts"],"sourcesContent":["import { useTimeoutFn } from '@vueuse/core';\nimport { ref } from 'vue';\n\nconst DEFAULT_CLOSING_DELAY_MS = 200;\n\n/**\n * A composable that provides the logic to open and close an element on hover and focus with a delay.\n * @param delay - Delay in milliseconds before closing the element after the cursor or focus\n * leaves the trigger. Prevents flickering when moving from the trigger to the content.\n * Defaults to 200.\n * @returns An object containing the `isOpen` ref, `open`/`close` helpers and a `hoverEvents`\n * object with the event handlers to bind on the trigger and, when the content is not a descendant\n * of the trigger, on a wrapper around the content. When using this with `BentoPopover`, pass\n * `disableFocusTrap` to prevent focus-trap behavior from interfering with delayed closing.\n */\nexport const useBentoDelayedHover = (delay: number = DEFAULT_CLOSING_DELAY_MS) => {\n const isOpen = ref(false);\n\n const { start: startClosingTimer, stop: stopClosingTimer } = useTimeoutFn(\n () => {\n isOpen.value = false;\n },\n delay,\n { immediate: false }\n );\n\n const open = () => {\n isOpen.value = true;\n stopClosingTimer();\n };\n\n const close = () => {\n startClosingTimer();\n };\n\n const hoverEvents = {\n mouseenter: open,\n mouseleave: close,\n focusin: open,\n focusout: close,\n };\n\n return {\n isOpen,\n open,\n close,\n hoverEvents,\n };\n};\n"],"names":["DEFAULT_CLOSING_DELAY_MS","useBentoDelayedHover","delay","isOpen","ref","startClosingTimer","stopClosingTimer","useTimeoutFn","open","close"],"mappings":";;AAGA,MAAMA,IAA2B,KAYpBC,IAAuB,CAACC,IAAgBF,MAA6B;AAC9E,QAAMG,IAASC,EAAI,EAAK,GAElB,EAAE,OAAOC,GAAmB,MAAMC,MAAqBC;AAAA,IACzD,MAAM;AACF,MAAAJ,EAAO,QAAQ;AAAA,IACnB;AAAA,IACAD;AAAA,IACA,EAAE,WAAW,GAAA;AAAA,EAAM,GAGjBM,IAAO,MAAM;AACf,IAAAL,EAAO,QAAQ,IACfG,EAAA;AAAA,EACJ,GAEMG,IAAQ,MAAM;AAChB,IAAAJ,EAAA;AAAA,EACJ;AASA,SAAO;AAAA,IACH,QAAAF;AAAA,IACA,MAAAK;AAAA,IACA,OAAAC;AAAA,IACA,aAXgB;AAAA,MAChB,YAAYD;AAAA,MACZ,YAAYC;AAAA,MACZ,SAASD;AAAA,MACT,UAAUC;AAAA,IAAA;AAAA,EAOV;AAER;"}
|
package/dist/chunks/{use-date-input-formatter.Dq9C0nc9.js → use-date-input-formatter.BMciZYTp.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var re = Object.defineProperty;
|
|
2
2
|
var se = (n, s, e) => s in n ? re(n, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[s] = e;
|
|
3
3
|
var i = (n, s, e) => se(n, typeof s != "symbol" ? s + "" : s, e);
|
|
4
|
-
import { C as ne, y as F, l as ae } from "./calendar.
|
|
4
|
+
import { C as ne, y as F, l as ae } from "./calendar.B0GnBaAW.js";
|
|
5
5
|
import { computed as K } from "vue";
|
|
6
6
|
import { t as Y, c as x, s as z, g as W, u as ie, r as oe, v as ce, k as V, j as ue } from "./en-US.BK5uiAND.js";
|
|
7
7
|
import { s as M } from "./startOfWeek.Br5KM4z_.js";
|
|
@@ -1729,4 +1729,4 @@ export {
|
|
|
1729
1729
|
qt as u,
|
|
1730
1730
|
X as w
|
|
1731
1731
|
};
|
|
1732
|
-
//# sourceMappingURL=use-date-input-formatter.
|
|
1732
|
+
//# sourceMappingURL=use-date-input-formatter.BMciZYTp.js.map
|