@adyen/bento-vue2 1.71.0 → 1.72.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/README.md +3 -1
- package/dist/@types/index.d.ts +405 -581
- package/dist/action-bar.js +1 -1
- package/dist/assets/accordion-item.css +1 -1
- package/dist/assets/action-bar.css +1 -1
- package/dist/assets/ai-button.css +1 -0
- package/dist/assets/base-button.css +1 -1
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/button-actions.css +1 -0
- package/dist/assets/calendar.css +1 -1
- package/dist/assets/card.css +1 -1
- package/dist/assets/code-snippet.css +1 -1
- package/dist/assets/dashboard-section.css +1 -1
- package/dist/assets/data-grid-template.css +1 -1
- package/dist/assets/data-grid.css +1 -1
- package/dist/assets/date-picker.css +1 -1
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/empty-state.css +1 -1
- package/dist/assets/field-label.css +1 -0
- package/dist/assets/file-uploader.css +1 -1
- package/dist/assets/filter-bar.css +1 -1
- package/dist/assets/focus-trap.css +1 -1
- package/dist/assets/input-field-phone-number.css +1 -1
- package/dist/assets/inspector.css +1 -1
- package/dist/assets/layout-row.css +1 -1
- package/dist/assets/modal-fullscreen.css +1 -1
- package/dist/assets/popper-container.css +1 -1
- package/dist/assets/selection-card-group.css +1 -1
- package/dist/assets/sidepanel.css +1 -1
- package/dist/assets/structured-list-item.css +1 -1
- package/dist/button.js +11 -9
- package/dist/button.js.map +1 -1
- package/dist/card.js +1 -1
- package/dist/checkbox.js +2 -2
- package/dist/chip.js +1 -1
- package/dist/chunks/{action-bar.C01Tjxh_.js → action-bar.Bxrtx1Vj.js} +3 -3
- package/dist/chunks/{action-bar.C01Tjxh_.js.map → action-bar.Bxrtx1Vj.js.map} +1 -1
- package/dist/chunks/ai-button.FRPkTHz6.js +67 -0
- package/dist/chunks/ai-button.FRPkTHz6.js.map +1 -0
- package/dist/chunks/{base-button.BB5tkzjh.js → base-button.Cv-1788W.js} +6 -6
- package/dist/chunks/base-button.Cv-1788W.js.map +1 -0
- package/dist/chunks/{base-modal.CnIt7hra.js → base-modal.DInbAZlp.js} +4 -4
- package/dist/chunks/{base-modal.CnIt7hra.js.map → base-modal.DInbAZlp.js.map} +1 -1
- package/dist/chunks/{button-actions-with-menu.B9R0J68W.js → button-actions-with-menu.BtWUxmSL.js} +2 -2
- package/dist/chunks/{button-actions-with-menu.B9R0J68W.js.map → button-actions-with-menu.BtWUxmSL.js.map} +1 -1
- package/dist/chunks/{toggle-button.B1Y2qhzJ.js → button-actions.55vIvDsX.js} +241 -239
- package/dist/chunks/button-actions.55vIvDsX.js.map +1 -0
- package/dist/chunks/button-actions.types.BptAXjD8.js.map +1 -1
- package/dist/chunks/{calendar.DjktWs25.js → calendar.M69sfyB9.js} +290 -287
- package/dist/chunks/{calendar.DjktWs25.js.map → calendar.M69sfyB9.js.map} +1 -1
- package/dist/chunks/{card.DTrBQQAm.js → card.C11dmth8.js} +2 -2
- package/dist/chunks/{card.DTrBQQAm.js.map → card.C11dmth8.js.map} +1 -1
- package/dist/chunks/{checkbox-group.lVv3mWHL.js → checkbox-group.Cr3WdkDM.js} +4 -4
- package/dist/chunks/{checkbox-group.lVv3mWHL.js.map → checkbox-group.Cr3WdkDM.js.map} +1 -1
- package/dist/chunks/{checkbox.C7Yu3rls.js → checkbox.D7-f9Y6w.js} +18 -18
- package/dist/chunks/{checkbox.C7Yu3rls.js.map → checkbox.D7-f9Y6w.js.map} +1 -1
- package/dist/chunks/{chevron-right.C--ZOC9j.js → chevron-left.BS24hEFa.js} +5 -5
- package/dist/chunks/chevron-left.BS24hEFa.js.map +1 -0
- package/dist/chunks/{chip.Bfi-ff5E.js → chip.omQX_Ziq.js} +2 -2
- package/dist/chunks/{chip.Bfi-ff5E.js.map → chip.omQX_Ziq.js.map} +1 -1
- package/dist/chunks/{code-snippet.BvhpH_JE.js → code-snippet.BGrwAxWy.js} +100 -91
- package/dist/chunks/code-snippet.BGrwAxWy.js.map +1 -0
- package/dist/chunks/{controls-group.DUr_o-vW.js → controls-group.CWeUgE2P.js} +2 -2
- package/dist/chunks/{controls-group.DUr_o-vW.js.map → controls-group.CWeUgE2P.js.map} +1 -1
- package/dist/chunks/{copy.CsyXGPuN.js → copy._BdbMnHK.js} +3 -3
- package/dist/chunks/{copy.CsyXGPuN.js.map → copy._BdbMnHK.js.map} +1 -1
- package/dist/chunks/{dashboard-section.CiFxBFnc.js → dashboard-section.e7ozaS9M.js} +3 -3
- package/dist/chunks/{dashboard-section.CiFxBFnc.js.map → dashboard-section.e7ozaS9M.js.map} +1 -1
- package/dist/chunks/{dashed-underline.CTtzy_vE.js → dashed-underline.CGU6o7ni.js} +3 -3
- package/dist/chunks/{dashed-underline.CTtzy_vE.js.map → dashed-underline.CGU6o7ni.js.map} +1 -1
- package/dist/chunks/{data-grid-template.CmfHBR3u.js → data-grid-template.BaPjUlZ2.js} +10 -10
- package/dist/chunks/data-grid-template.BaPjUlZ2.js.map +1 -0
- package/dist/chunks/{data-grid.D2AvGjyH.js → data-grid.B_Ha2vma.js} +772 -726
- package/dist/chunks/data-grid.B_Ha2vma.js.map +1 -0
- package/dist/chunks/{date-picker.Bhe5lCfr.js → date-picker.CGTMHUNH.js} +75 -69
- package/dist/chunks/date-picker.CGTMHUNH.js.map +1 -0
- package/dist/chunks/{date-range-picker.BsQ6kMzK.js → date-range-picker.ChGfJUPq.js} +7 -7
- package/dist/chunks/{date-range-picker.BsQ6kMzK.js.map → date-range-picker.ChGfJUPq.js.map} +1 -1
- package/dist/chunks/{dropdown-tag.DaVNZO_q.js → dropdown-tag.Bwl0fY7o.js} +3 -3
- package/dist/chunks/{dropdown-tag.DaVNZO_q.js.map → dropdown-tag.Bwl0fY7o.js.map} +1 -1
- package/dist/chunks/{dropdown.J5FaL_2T.js → dropdown.DQbTuKc5.js} +5 -5
- package/dist/chunks/{dropdown.J5FaL_2T.js.map → dropdown.DQbTuKc5.js.map} +1 -1
- package/dist/chunks/empty-state.DNTrhYUm.js +106 -0
- package/dist/chunks/empty-state.DNTrhYUm.js.map +1 -0
- package/dist/chunks/es6.MoTTyETW.js.map +1 -1
- package/dist/chunks/{error-message.BGuKk5tR.js → field-label.BKzuCnXr.js} +53 -53
- package/dist/chunks/field-label.BKzuCnXr.js.map +1 -0
- package/dist/chunks/{file-uploader.ZHBf2zwh.js → file-uploader.BEClGxsF.js} +3 -3
- package/dist/chunks/{file-uploader.ZHBf2zwh.js.map → file-uploader.BEClGxsF.js.map} +1 -1
- package/dist/chunks/{filter-bar.CNxqgSgM.js → filter-bar.Dnnv0rpV.js} +184 -185
- package/dist/chunks/filter-bar.Dnnv0rpV.js.map +1 -0
- package/dist/chunks/{fixed-scroller.DDYpO7Li.js → fixed-scroller.QCXpkadN.js} +2 -2
- package/dist/chunks/{fixed-scroller.DDYpO7Li.js.map → fixed-scroller.QCXpkadN.js.map} +1 -1
- package/dist/chunks/{focus-trap.COfrmVfx.js → focus-trap.BJfpIboH.js} +155 -144
- package/dist/chunks/{focus-trap.COfrmVfx.js.map → focus-trap.BJfpIboH.js.map} +1 -1
- package/dist/chunks/{footer-actions.CR8l2FSl.js → footer-actions.BTELM6rh.js} +2 -2
- package/dist/chunks/{footer-actions.CR8l2FSl.js.map → footer-actions.BTELM6rh.js.map} +1 -1
- package/dist/chunks/{header-meta.tZNYmQBF.js → header-meta.DZYH-qg-.js} +3 -3
- package/dist/chunks/{header-meta.tZNYmQBF.js.map → header-meta.DZYH-qg-.js.map} +1 -1
- package/dist/chunks/{header-with-views.BXZT6R6N.js → header-with-views.DjZa4Wob.js} +8 -8
- package/dist/chunks/{header-with-views.BXZT6R6N.js.map → header-with-views.DjZa4Wob.js.map} +1 -1
- package/dist/chunks/{header.CwlFMYus.js → header.CQMiTG7f.js} +3 -3
- package/dist/chunks/{header.CwlFMYus.js.map → header.CQMiTG7f.js.map} +1 -1
- package/dist/chunks/{info-icon.JAvdSXdT.js → info-icon.fB7jf3NJ.js} +3 -3
- package/dist/chunks/{info-icon.JAvdSXdT.js.map → info-icon.fB7jf3NJ.js.map} +1 -1
- package/dist/chunks/{input-field-password.C1bzrmje.js → input-field-password.BPujvbx8.js} +5 -5
- package/dist/chunks/{input-field-password.C1bzrmje.js.map → input-field-password.BPujvbx8.js.map} +1 -1
- package/dist/chunks/{input-field-phone-number.YTbO3djd.js → input-field-phone-number.bqUe_CVf.js} +5 -5
- package/dist/chunks/{input-field-phone-number.YTbO3djd.js.map → input-field-phone-number.bqUe_CVf.js.map} +1 -1
- package/dist/chunks/{input-field.o-Hie5W9.js → input-field.CwF6ldRY.js} +3 -3
- package/dist/chunks/{input-field.o-Hie5W9.js.map → input-field.CwF6ldRY.js.map} +1 -1
- package/dist/chunks/{inspector.DxteqciY.js → inspector.g3OErNAU.js} +2 -2
- package/dist/chunks/{inspector.DxteqciY.js.map → inspector.g3OErNAU.js.map} +1 -1
- package/dist/chunks/{listbox-option-tag.AsRozx37.js → listbox-option-tag.UaD4kmXc.js} +2 -2
- package/dist/chunks/{listbox-option-tag.AsRozx37.js.map → listbox-option-tag.UaD4kmXc.js.map} +1 -1
- package/dist/chunks/{modal-fullscreen.B_72Iyh-.js → modal-fullscreen.B-9Ke6Ya.js} +3 -3
- package/dist/chunks/{modal-fullscreen.B_72Iyh-.js.map → modal-fullscreen.B-9Ke6Ya.js.map} +1 -1
- package/dist/chunks/{modal.crwnBhJG.js → modal.qybFapnI.js} +4 -4
- package/dist/chunks/{modal.crwnBhJG.js.map → modal.qybFapnI.js.map} +1 -1
- package/dist/chunks/{pagination.B4SjTHnN.js → pagination.BWTyXMRW.js} +2 -2
- package/dist/chunks/{pagination.B4SjTHnN.js.map → pagination.BWTyXMRW.js.map} +1 -1
- package/dist/chunks/popover.types.iyDoIAOE.js +6 -0
- package/dist/chunks/popover.types.iyDoIAOE.js.map +1 -0
- package/dist/chunks/{popper-container.Dt0SuHXX.js → popper-container.C9KCAJxI.js} +12 -5
- package/dist/chunks/{popper-container.Dt0SuHXX.js.map → popper-container.C9KCAJxI.js.map} +1 -1
- package/dist/chunks/{radio-group.T5hXVLRz.js → radio-group.DHUa6baR.js} +4 -4
- package/dist/chunks/{radio-group.T5hXVLRz.js.map → radio-group.DHUa6baR.js.map} +1 -1
- package/dist/chunks/{rich-text-editor._5fF0vFL.js → rich-text-editor.C905JEDW.js} +4 -4
- package/dist/chunks/{rich-text-editor._5fF0vFL.js.map → rich-text-editor.C905JEDW.js.map} +1 -1
- package/dist/chunks/{search-bar.yIVTIbdP.js → search-bar.CKt_-tZH.js} +3 -3
- package/dist/chunks/{search-bar.yIVTIbdP.js.map → search-bar.CKt_-tZH.js.map} +1 -1
- package/dist/chunks/{secondary-nav.DBetOL_3.js → secondary-nav.B5L2bLmm.js} +2 -2
- package/dist/chunks/{secondary-nav.DBetOL_3.js.map → secondary-nav.B5L2bLmm.js.map} +1 -1
- package/dist/chunks/{segmented-control.DrShqTCa.js → segmented-control.Dc34mUMM.js} +2 -2
- package/dist/chunks/{segmented-control.DrShqTCa.js.map → segmented-control.Dc34mUMM.js.map} +1 -1
- package/dist/chunks/{selection-card-group.3QYPl3w3.js → selection-card-group.CBVKMu6b.js} +10 -10
- package/dist/chunks/{selection-card-group.3QYPl3w3.js.map → selection-card-group.CBVKMu6b.js.map} +1 -1
- package/dist/chunks/{sidepanel.U9XLcivw.js → sidepanel.uWNc58r7.js} +4 -4
- package/dist/chunks/{sidepanel.U9XLcivw.js.map → sidepanel.uWNc58r7.js.map} +1 -1
- package/dist/chunks/{step.DwXkOVky.js → step.D8blWwfR.js} +2 -2
- package/dist/chunks/{step.DwXkOVky.js.map → step.D8blWwfR.js.map} +1 -1
- package/dist/chunks/structured-list-item.BLalgOps.js +90 -0
- package/dist/chunks/structured-list-item.BLalgOps.js.map +1 -0
- package/dist/chunks/{summary-grid.types.BZlzUWVO.js → summary-grid.types.DqzYJ9_N.js} +5 -5
- package/dist/chunks/{summary-grid.types.BZlzUWVO.js.map → summary-grid.types.DqzYJ9_N.js.map} +1 -1
- package/dist/chunks/{tab.ClkH0GtX.js → tab.D8YyoNFV.js} +2 -2
- package/dist/chunks/{tab.ClkH0GtX.js.map → tab.D8YyoNFV.js.map} +1 -1
- package/dist/chunks/{tag.Dcm5YMUI.js → tag.Tjg4linG.js} +2 -2
- package/dist/chunks/{tag.Dcm5YMUI.js.map → tag.Tjg4linG.js.map} +1 -1
- package/dist/chunks/{textarea.B2jAycbX.js → textarea.DUPV-I-L.js} +2 -2
- package/dist/chunks/{textarea.B2jAycbX.js.map → textarea.DUPV-I-L.js.map} +1 -1
- package/dist/chunks/{timeline-item.Dhcs9a0S.js → timeline-item.DaRKHndA.js} +5 -5
- package/dist/chunks/{timeline-item.Dhcs9a0S.js.map → timeline-item.DaRKHndA.js.map} +1 -1
- package/dist/chunks/{tooltip.C94gYIPr.js → tooltip.DOD_4rkI.js} +2 -2
- package/dist/chunks/{tooltip.C94gYIPr.js.map → tooltip.DOD_4rkI.js.map} +1 -1
- package/dist/chunks/{tutorial.DAv_sABs.js → tutorial.BwnRyUoh.js} +4 -4
- package/dist/chunks/{tutorial.DAv_sABs.js.map → tutorial.BwnRyUoh.js.map} +1 -1
- package/dist/chunks/{use-cached-selected-values.DSDrNPbW.js → use-cached-selected-values.C7j6YhuC.js} +4 -4
- package/dist/chunks/use-cached-selected-values.C7j6YhuC.js.map +1 -0
- package/dist/code-snippet.js +1 -1
- package/dist/dashboard-template.js +1 -1
- package/dist/dashed-underline.js +1 -1
- package/dist/data-grid-template.js +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/date-picker.js +2 -2
- package/dist/date-range-picker.js +2 -2
- package/dist/dropdown.js +3 -3
- package/dist/empty-state.js +1 -1
- package/dist/file-uploader.js +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/focus-trap.js +1 -1
- package/dist/header-with-views.js +1 -1
- package/dist/header.js +1 -1
- package/dist/index.js +174 -172
- 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/inspector.js +1 -1
- package/dist/internal.js +11 -11
- package/dist/menu.js +1 -1
- package/dist/modal-fullscreen.js +1 -1
- package/dist/modal.js +2 -2
- package/dist/pagination.js +1 -1
- package/dist/popover.js +2 -2
- package/dist/popper-container.js +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/rich-text-editor.js +1 -1
- package/dist/search-bar.js +2 -2
- package/dist/secondary-nav.js +1 -1
- package/dist/segmented-control.js +1 -1
- package/dist/selection-card.js +1 -1
- package/dist/sidepanel.js +1 -1
- package/dist/stepper.js +1 -1
- package/dist/structured-list.js +1 -1
- package/dist/styles/bento-dark.css +35 -16
- package/dist/styles/bento-light.css +34 -11
- package/dist/styles/bento.css +34 -11
- package/dist/styles/legacy.css +2108 -0
- package/dist/styles/styleguide.css +34 -11
- package/dist/styles/utility.css +12 -0
- package/dist/summary-grid.js +1 -1
- package/dist/tabs.js +1 -1
- package/dist/tag.js +1 -1
- package/dist/textarea.js +1 -1
- package/dist/timeline.js +1 -1
- package/dist/tutorial.js +1 -1
- package/dist/web-types.json +186 -14
- package/package.json +3 -3
- package/dist/assets/error-message.css +0 -1
- package/dist/assets/toggle-button.css +0 -1
- package/dist/chunks/base-button.BB5tkzjh.js.map +0 -1
- package/dist/chunks/chevron-right.C--ZOC9j.js.map +0 -1
- package/dist/chunks/code-snippet.BvhpH_JE.js.map +0 -1
- package/dist/chunks/data-grid-template.CmfHBR3u.js.map +0 -1
- package/dist/chunks/data-grid.D2AvGjyH.js.map +0 -1
- package/dist/chunks/date-picker.Bhe5lCfr.js.map +0 -1
- package/dist/chunks/empty-state.DAbj9xWF.js +0 -151
- package/dist/chunks/empty-state.DAbj9xWF.js.map +0 -1
- package/dist/chunks/error-message.BGuKk5tR.js.map +0 -1
- package/dist/chunks/filter-bar.CNxqgSgM.js.map +0 -1
- package/dist/chunks/popover.types.BUM8GOuO.js +0 -6
- package/dist/chunks/popover.types.BUM8GOuO.js.map +0 -1
- package/dist/chunks/structured-list-item.DHklFEiK.js +0 -87
- package/dist/chunks/structured-list-item.DHklFEiK.js.map +0 -1
- package/dist/chunks/toggle-button.B1Y2qhzJ.js.map +0 -1
- package/dist/chunks/use-cached-selected-values.DSDrNPbW.js.map +0 -1
|
@@ -8,7 +8,7 @@ import { u as me } from "./aria-label.CaUURpnB.js";
|
|
|
8
8
|
import { u as _e } from "./i18n.BQkEbtPM.js";
|
|
9
9
|
import { u as he } from "./use-form-layout-loading.D3lALhtC.js";
|
|
10
10
|
import { B as ve } from "./es6.MoTTyETW.js";
|
|
11
|
-
import { F as ge, E as xe } from "./
|
|
11
|
+
import { F as ge, E as xe } from "./field-label.BKzuCnXr.js";
|
|
12
12
|
import { n as Ce } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
13
13
|
import "../assets/textarea.css";
|
|
14
14
|
var S = /* @__PURE__ */ ((t) => (t.HORIZONTAL = "horizontal", t.VERTICAL = "vertical", t.BOTH = "both", t.NONE = "none", t))(S || {}), d = /* @__PURE__ */ ((t) => (t.CLEARABLE = "clearable", t.DISABLED = "disabled", t.ERROR = "error", t.READONLY = "readonly", t))(d || {}), u = /* @__PURE__ */ ((t) => (t.BLUR = "blur", t.CHANGE = "change", t.CLEAR = "clear", t.ESCAPE_PRESSED = "escape-pressed", t.FOCUS = "focus", t.INPUT = "input", t.KEYDOWN = "keydown", t.KEYUP = "keyup", t))(u || {});
|
|
@@ -211,4 +211,4 @@ const We = Be.exports;
|
|
|
211
211
|
export {
|
|
212
212
|
We as B
|
|
213
213
|
};
|
|
214
|
-
//# sourceMappingURL=textarea.
|
|
214
|
+
//# sourceMappingURL=textarea.DUPV-I-L.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.B2jAycbX.js","sources":["../../src/components/textarea/textarea.types.ts","../../src/components/textarea/textarea.vue"],"sourcesContent":["/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoTextareaResizeOption {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n BOTH = 'both',\n NONE = 'none',\n}\n\nexport enum BentoTextareaStateClass {\n CLEARABLE = 'clearable',\n DISABLED = 'disabled',\n ERROR = 'error',\n READONLY = 'readonly',\n}\n\nexport enum BentoTextareaEvent {\n BLUR = 'blur',\n CHANGE = 'change',\n CLEAR = 'clear',\n ESCAPE_PRESSED = 'escape-pressed',\n FOCUS = 'focus',\n INPUT = 'input',\n KEYDOWN = 'keydown',\n KEYUP = 'keyup',\n}\n","<template>\n <div ref=\"textareaComponent\" class=\"b-textarea\" :class=\"conditionalClasses\">\n <div :style=\"{ width: textareaWrapperWidth }\">\n <div class=\"b-textarea__label-box\" :class=\"conditionalClassesLabelBox\">\n <field-label\n v-if=\"label\"\n :for=\"textareaId\"\n :label=\"label\"\n :tooltip-text=\"tooltipText\"\n :optional=\"optional\"\n :required=\"required\"\n />\n <bento-typography\n v-if=\"characterLimit\"\n el=\"span\"\n class=\"b-textarea__label-item\"\n :class=\"conditionalClassesLabelItem\"\n >\n {{ counter }}\n </bento-typography>\n </div>\n <bento-typography el=\"div\" class=\"b-textarea__input-box\" :aria-disabled=\"disabled\">\n <textarea\n :id=\"textareaId\"\n ref=\"textareaElement\"\n :value=\"textareaValue\"\n class=\"b-textarea__input\"\n :class=\"conditionalClassesInput\"\n :aria-label=\"computedAriaLabel\"\n :aria-invalid=\"invalidInput\"\n :readonly=\"isReadOnly\"\n :required=\"required\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder\"\n :style=\"{ resize: resizable, height: textareaHeight }\"\n @blur=\"onBlur\"\n @change=\"onChange\"\n @focus=\"onFocus\"\n @input=\"onInput\"\n @keydown.esc=\"onPressEscape\"\n @keydown=\"onKeyDown\"\n @keyup=\"onKeyUp\"\n @mousedown=\"onMouseDown\"\n @mouseup=\"onMouseUp\"\n >\n </textarea>\n\n <div v-if=\"showClearButton\" class=\"b-textarea__clear-button\">\n <bento-button\n variant=\"tertiary\"\n :disabled=\"disabled\"\n @click=\"onClear\"\n @keypress.enter=\"onClear\"\n @keyup.space=\"onClear\"\n >\n <template #iconLeft>\n <cross-circle-fill-small-icon :svg-title=\"t('clearText')\" />\n </template>\n </bento-button>\n </div>\n </bento-typography>\n\n <error-message v-if=\"isOverCharacterLimit\" :error-message=\"counterErrorText\" />\n\n <error-message v-if=\"errorMessage\" :error-message=\"errorMessage\" />\n\n <bento-typography v-if=\"description\" class=\"b-textarea__description\" el=\"span\">\n {{ description }}\n </bento-typography>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, nextTick, onMounted, onUnmounted, type PropType, ref, toRef, toRefs, useAttrs, watch } from 'vue';\n\n // Components\n import { BentoButton } from '@/components/button';\n import { BentoTypography } from '@/components/typography';\n import { ErrorMessage, FieldLabel } from '@/internal';\n import CrossCircleFillSmallIcon from '@adyen/ui-assets-icons-16/vue/cross-circle-fill-small';\n\n // Utils\n import { generateUid } from '@/core/utils/ts';\n import { observeSizeOfElement } from '@/utils/ts/resize';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { useI18n } from '@/utils/ts/i18n';\n\n // Composables\n import { useFormLayoutFieldLoading } from '@/composables/use-form-layout-loading/use-form-layout-loading';\n\n // Constants\n import { BTextareaInputFocusBorderWidth } from '@adyen/bento-design-tokens/dist/js/bento/es6';\n\n // Types\n import { BentoTextareaEvent, BentoTextareaResizeOption, BentoTextareaStateClass } from './textarea.types';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const attrs = useAttrs();\n\n const props = defineProps({\n /**\n * Text that labels an the input element\n */\n ariaLabel: { type: String, default: undefined },\n\n /**\n * Text that shows number of characters in textarea\n */\n characterLimit: { type: Number, default: undefined },\n\n /**\n * Text displayed as the help text of the textarea\n */\n description: { type: String, default: '' },\n\n /**\n * Disables the possibility of changing value in the textarea\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * If set to true, shows a button to clear all the text\n */\n clearable: { type: Boolean, default: false },\n\n /**\n * Adds error text\n */\n errorMessage: { type: String, default: '' },\n\n /**\n * Sets the height of the textarea, e.g 200px OR 20vh\n */\n height: { type: String, default: null },\n\n /**\n * Text displayed as the label of the textarea\n */\n label: { type: String, default: '' },\n\n /**\n * Highlights the textarea is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * Text displayed as the placeholder of the textarea\n */\n placeholder: { type: String, default: '' },\n\n /**\n * Set the textarea to read only state.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Indicates the possibility of resize the textarea\n */\n resizable: {\n type: String as PropType<BentoTextareaResizeOption | `${BentoTextareaResizeOption}`>,\n default: BentoTextareaResizeOption.BOTH,\n validator: (value: BentoTextareaResizeOption) => Object.values(BentoTextareaResizeOption).includes(value),\n },\n\n /**\n * Highlights the textarea is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Adds a info icon next to the label to display the passed tooltip message.\n */\n tooltipText: { type: String, default: null },\n\n /**\n * Text displayed as the value of the textarea\n */\n value: { type: String, default: '' },\n });\n\n const emit = defineEmits([]);\n\n const { height } = toRefs(props);\n\n const textareaId = generateUid('textarea');\n const textareaElement = ref<HTMLTextAreaElement>(null);\n const textareaComponent = ref<HTMLDivElement>(null);\n const textareaValue = ref(props.value);\n const defaultTextareaHeight = 44;\n const textareaHeight = ref(props.height || `${defaultTextareaHeight}px`);\n const userSetHeight = ref<number>(0);\n const textareaWrapperWidth = ref('100%'); // The width set to the wrapper of the label, textarea and description\n const isUserResizing = ref(false);\n let textareaElementObserver: ResizeObserver | null = null;\n let textareaComponentObserver: ResizeObserver | null = null;\n\n const { t, n } = useI18n<{ message: MessageSchema }>({ messages });\n\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n const counter = computed(() => `${n(textareaValue?.value?.length ?? 0)} / ${n(props.characterLimit)}`);\n const isDynamicHeight = computed(() => !height.value);\n const isOverCharacterLimit = computed(\n () => props.characterLimit && textareaValue.value.length > props.characterLimit\n );\n\n /**\n * Calculates and sets the height of the textarea.\n * The height is determined by the maximum of the following values:\n *\n * 1. The content's scroll height (with a minimum of `defaultTextareaHeight`) + the border width.\n * 2. The height set by the user manually resizing the textarea (`userSetHeight`).\n * 3. The default minimum height (`defaultTextareaHeight`).\n *\n * This ensures the textarea grows with content, shrinks when content is removed,\n * but never goes below the manually set height or the default height.\n */\n const calculateHeight = () => {\n if (textareaElement.value) {\n const newHeight = Math.max(\n textareaElement.value.scrollHeight <= defaultTextareaHeight\n ? defaultTextareaHeight\n : textareaElement.value.scrollHeight + TEXTAREA_BORDER_WIDTH * 2,\n userSetHeight.value,\n defaultTextareaHeight\n );\n textareaHeight.value = `${newHeight}px`;\n }\n };\n\n watch(height, () => {\n if (isDynamicHeight.value) {\n calculateHeight();\n } else {\n textareaHeight.value = height.value;\n }\n });\n\n watch(\n () => props.value,\n () => {\n textareaValue.value = props.value;\n },\n { immediate: true }\n );\n\n watch(\n () => textareaValue.value,\n async () => {\n if (isDynamicHeight.value) {\n // Hack to make the textarea calculate its height properly\n // Set the textarea back to the original value before calculating the height\n textareaHeight.value = `${defaultTextareaHeight}px`;\n if (!textareaValue.value) {\n return;\n }\n\n await nextTick();\n calculateHeight();\n }\n },\n { immediate: true }\n );\n\n const invalidInput = computed(() => !!props.errorMessage || isOverCharacterLimit.value);\n\n const conditionalClasses = computed(() => ({\n [`b-textarea--${BentoTextareaStateClass.DISABLED}`]: props.disabled,\n }));\n\n const conditionalClassesInput = computed(() => ({\n [`b-textarea__input--${BentoTextareaStateClass.CLEARABLE}`]: props.clearable,\n [`b-textarea__input--${BentoTextareaStateClass.READONLY}`]: isReadOnly.value,\n [`b-textarea__input--${BentoTextareaStateClass.ERROR}`]: invalidInput.value,\n [`b-textarea__input--dynamic-height`]: isDynamicHeight.value,\n }));\n\n const conditionalClassesLabelBox = computed(() => ({\n [`b-textarea__label-box--no-label`]: !props.label,\n }));\n\n const conditionalClassesLabelItem = computed(() => ({\n [`b-textarea__label-item--${BentoTextareaStateClass.ERROR}`]: isOverCharacterLimit.value,\n }));\n\n const counterErrorText = computed(() => t('yourTextCanBenAtMost', { characterLimit: props.characterLimit }));\n\n const ariaLabelAttribute = ref(attrs['aria-label']);\n const { ariaLabel, label } = toRefs(props);\n const computedAriaLabel = useAriaLabel({\n ariaLabel: ariaLabelAttribute.value as string,\n // TODO: take this line away when the aria-label props is removed\n label: ariaLabel,\n defaultFallback: label,\n });\n\n const showClearButton = computed(\n () => props.clearable && textareaValue.value && !props.disabled && !isReadOnly.value\n );\n\n const onClear = () => {\n textareaValue.value = '';\n emit(BentoTextareaEvent.CLEAR);\n emit(BentoTextareaEvent.INPUT, '');\n };\n\n const onInput = (event: InputEvent) => {\n event.stopImmediatePropagation();\n\n if (!props.disabled && !isReadOnly.value) {\n textareaValue.value = (event.target as HTMLInputElement).value;\n /**\n * Triggered when input value is changed\n *\n * @event input\n * @property {String} inputValue - the updated textarea value\n */\n emit(BentoTextareaEvent.INPUT, textareaValue.value);\n }\n };\n\n const onBlur = () => {\n textareaElement.value.scrollTop = 0;\n emit(BentoTextareaEvent.BLUR);\n };\n\n const onFocus = () => {\n textareaElement.value.focus();\n emit(BentoTextareaEvent.FOCUS);\n };\n\n const onChange = () => {\n emit(BentoTextareaEvent.CHANGE);\n };\n\n const onPressEscape = () => {\n emit(BentoTextareaEvent.ESCAPE_PRESSED);\n };\n\n const onKeyDown = (event: KeyboardEvent) => {\n event.stopPropagation();\n emit(BentoTextareaEvent.KEYDOWN, event);\n };\n\n const onKeyUp = (event: KeyboardEvent) => {\n event.stopPropagation();\n emit(BentoTextareaEvent.KEYUP, event);\n };\n\n const onMouseDown = () => {\n isUserResizing.value = true;\n };\n\n const onMouseUp = () => {\n isUserResizing.value = false;\n };\n\n /**\n * Updates the textarea width depending if the container or the user update its size.\n * @param isTextareaElement - sets to true if the element being observed is the textarea HTML element.\n */\n const resizeTextareaWrapper = (isTextareaElement = false) => {\n // Width assigned by the browser whenever the textarea is manually resized. String of the format `<value>px`.\n const textareaStyleWidth = textareaElement.value.style.width;\n\n // Make sure the tracked textareaHeight is always in sync with the height size in case we manually resize the textarea\n if (textareaElement.value.style.height) {\n if (isUserResizing.value) {\n userSetHeight.value = parseInt(textareaElement.value.style.height, 10);\n }\n textareaHeight.value = textareaElement.value.style.height;\n }\n\n // If the textarea element observer is being triggered, but there's no textareaStyleWidth, we want to ignore it, as no manual resize as happened yet\n // The component wrapper will handle the resizing logic instead\n if (isTextareaElement && !textareaStyleWidth) {\n return;\n }\n\n // Width of the whole bento-textarea component\n const textareaComponentWidth = textareaComponent?.value?.offsetWidth;\n\n // If there is no textareaStyleWidth or the textareaStyleWidth is larger than the component container, the wrapper should be 100% of the container\n if (!textareaStyleWidth || parseInt(textareaStyleWidth, 10) > textareaComponentWidth) {\n textareaWrapperWidth.value = '100%';\n } else {\n // Else the wrapper should always be as wide as the textarea element itself\n textareaWrapperWidth.value = textareaStyleWidth;\n }\n };\n\n const focus = () => {\n textareaElement.value.focus();\n };\n\n defineExpose({\n focus,\n });\n\n onMounted(() => {\n textareaElementObserver = observeSizeOfElement(textareaElement.value, () => {\n resizeTextareaWrapper(true);\n });\n\n textareaComponentObserver = observeSizeOfElement(textareaComponent.value, () => {\n resizeTextareaWrapper();\n });\n\n if (isDynamicHeight.value) {\n calculateHeight();\n }\n });\n\n onUnmounted(() => {\n textareaElementObserver?.disconnect();\n textareaComponentObserver?.disconnect();\n });\n</script>\n\n<script lang=\"ts\">\n const TEXTAREA_BORDER_WIDTH = parseFloat(BTextareaInputFocusBorderWidth);\n\n export default {\n i18n: { messages },\n name: 'bento-textarea',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./textarea.scss\" />\n"],"names":["BentoTextareaResizeOption","BentoTextareaResizeOption2","BentoTextareaStateClass","BentoTextareaStateClass2","BentoTextareaEvent","BentoTextareaEvent2","TEXTAREA_BORDER_WIDTH","BTextareaInputFocusBorderWidth","__default__","messages","attrs","useAttrs","height","toRefs","props","textareaId","generateUid","textareaElement","ref","textareaComponent","textareaValue","defaultTextareaHeight","textareaHeight","userSetHeight","textareaWrapperWidth","isUserResizing","textareaElementObserver","textareaComponentObserver","t","n","useI18n","isReadOnly","useFormLayoutFieldLoading","toRef","counter","computed","_a","isDynamicHeight","isOverCharacterLimit","calculateHeight","newHeight","watch","nextTick","invalidInput","conditionalClasses","conditionalClassesInput","conditionalClassesLabelBox","conditionalClassesLabelItem","counterErrorText","ariaLabelAttribute","ariaLabel","label","computedAriaLabel","useAriaLabel","showClearButton","onClear","emit","onInput","event","onBlur","onFocus","onChange","onPressEscape","onKeyDown","onKeyUp","onMouseDown","onMouseUp","resizeTextareaWrapper","isTextareaElement","textareaStyleWidth","textareaComponentWidth","focus","expose","onMounted","observeSizeOfElement","onUnmounted"],"mappings":";;;;;;;;;;;;;AAGY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,aAAA,cACAA,EAAA,WAAA,YACAA,EAAA,OAAA,QACAA,EAAA,OAAA,QAJQA,IAAAD,KAAA,CAAA,CAAA,GAOAE,IAAA,kBAAAC,OACRA,EAAA,YAAA,aACAA,EAAA,WAAA,YACAA,EAAA,QAAA,SACAA,EAAA,WAAA,YAJQA,IAAAD,KAAA,CAAA,CAAA,GAOAE,IAAA,kBAAAC,OACRA,EAAA,OAAA,QACAA,EAAA,SAAA,UACAA,EAAA,QAAA,SACAA,EAAA,iBAAA,kBACAA,EAAA,QAAA,SACAA,EAAA,QAAA,SACAA,EAAA,UAAA,WACAA,EAAA,QAAA,SARQA,IAAAD,KAAA,CAAA,CAAA;;;;;;;GCuZRE,IAAA,WAAAC,EAAA,GAEAC,KAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,GAAA;AAAA,EACM,MAAA;AAErB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAxUAC,IAAAC,GAAA,GAqFA,EAAA,QAAAC,EAAA,IAAAC,EAAAC,CAAA,GAEAC,IAAAC,GAAA,UAAA,GACAC,IAAAC,EAAA,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AAiC,KAAA,SAAAA,GAAA,EAAA,IAAAC,KACI9C,EAAA,QAAA,SAGAA,EAAA,QAAA6C;AAAA,IACJ,GAGJE,IAAA,MAAA;AACI,MAAAtD,EAAA,MAAA,MAAA;AAAA,IAA4B;AAGhC,WAAAuD,EAAA;AAAA,MAAa,OAAAD;AAAA,IACT,CAAA,GAGJE,GAAA,MAAA;AACI,MAAA/C,IAAAgD,EAAAzD,EAAA,OAAA,MAAA;AACI,QAAAkD,EAAA,EAAA;AAAA,MAA0B,CAAA,GAG9BxC,IAAA+C,EAAAvD,EAAA,OAAA,MAAA;AACI,QAAAgD,EAAA;AAAA,MAAsB,CAAA,GAG1B9B,EAAA,SACIE,EAAA;AAAA,IACJ,CAAA,GAGJoC,GAAA,MAAA;AACI,MAAAjD,KAAA,QAAAA,EAAA,cACAC,KAAA,QAAAA,EAAA;AAAA,IAAsC,CAAA;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"textarea.DUPV-I-L.js","sources":["../../src/components/textarea/textarea.types.ts","../../src/components/textarea/textarea.vue"],"sourcesContent":["/**\n * @deprecated for usage with properties since version 2.0. Use the string literal instead.\n */\nexport enum BentoTextareaResizeOption {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n BOTH = 'both',\n NONE = 'none',\n}\n\nexport enum BentoTextareaStateClass {\n CLEARABLE = 'clearable',\n DISABLED = 'disabled',\n ERROR = 'error',\n READONLY = 'readonly',\n}\n\nexport enum BentoTextareaEvent {\n BLUR = 'blur',\n CHANGE = 'change',\n CLEAR = 'clear',\n ESCAPE_PRESSED = 'escape-pressed',\n FOCUS = 'focus',\n INPUT = 'input',\n KEYDOWN = 'keydown',\n KEYUP = 'keyup',\n}\n","<template>\n <div ref=\"textareaComponent\" class=\"b-textarea\" :class=\"conditionalClasses\">\n <div :style=\"{ width: textareaWrapperWidth }\">\n <div class=\"b-textarea__label-box\" :class=\"conditionalClassesLabelBox\">\n <field-label\n v-if=\"label\"\n :for=\"textareaId\"\n :label=\"label\"\n :tooltip-text=\"tooltipText\"\n :optional=\"optional\"\n :required=\"required\"\n />\n <bento-typography\n v-if=\"characterLimit\"\n el=\"span\"\n class=\"b-textarea__label-item\"\n :class=\"conditionalClassesLabelItem\"\n >\n {{ counter }}\n </bento-typography>\n </div>\n <bento-typography el=\"div\" class=\"b-textarea__input-box\" :aria-disabled=\"disabled\">\n <textarea\n :id=\"textareaId\"\n ref=\"textareaElement\"\n :value=\"textareaValue\"\n class=\"b-textarea__input\"\n :class=\"conditionalClassesInput\"\n :aria-label=\"computedAriaLabel\"\n :aria-invalid=\"invalidInput\"\n :readonly=\"isReadOnly\"\n :required=\"required\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder\"\n :style=\"{ resize: resizable, height: textareaHeight }\"\n @blur=\"onBlur\"\n @change=\"onChange\"\n @focus=\"onFocus\"\n @input=\"onInput\"\n @keydown.esc=\"onPressEscape\"\n @keydown=\"onKeyDown\"\n @keyup=\"onKeyUp\"\n @mousedown=\"onMouseDown\"\n @mouseup=\"onMouseUp\"\n >\n </textarea>\n\n <div v-if=\"showClearButton\" class=\"b-textarea__clear-button\">\n <bento-button\n variant=\"tertiary\"\n :disabled=\"disabled\"\n @click=\"onClear\"\n @keypress.enter=\"onClear\"\n @keyup.space=\"onClear\"\n >\n <template #iconLeft>\n <cross-circle-fill-small-icon :svg-title=\"t('clearText')\" />\n </template>\n </bento-button>\n </div>\n </bento-typography>\n\n <error-message v-if=\"isOverCharacterLimit\" :error-message=\"counterErrorText\" />\n\n <error-message v-if=\"errorMessage\" :error-message=\"errorMessage\" />\n\n <bento-typography v-if=\"description\" class=\"b-textarea__description\" el=\"span\">\n {{ description }}\n </bento-typography>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, nextTick, onMounted, onUnmounted, type PropType, ref, toRef, toRefs, useAttrs, watch } from 'vue';\n\n // Components\n import { BentoButton } from '@/components/button';\n import { BentoTypography } from '@/components/typography';\n import { ErrorMessage, FieldLabel } from '@/internal';\n import CrossCircleFillSmallIcon from '@adyen/ui-assets-icons-16/vue/cross-circle-fill-small';\n\n // Utils\n import { generateUid } from '@/core/utils/ts';\n import { observeSizeOfElement } from '@/utils/ts/resize';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { useI18n } from '@/utils/ts/i18n';\n\n // Composables\n import { useFormLayoutFieldLoading } from '@/composables/use-form-layout-loading/use-form-layout-loading';\n\n // Constants\n import { BTextareaInputFocusBorderWidth } from '@adyen/bento-design-tokens/dist/js/bento/es6';\n\n // Types\n import { BentoTextareaEvent, BentoTextareaResizeOption, BentoTextareaStateClass } from './textarea.types';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const attrs = useAttrs();\n\n const props = defineProps({\n /**\n * Text that labels an the input element\n */\n ariaLabel: { type: String, default: undefined },\n\n /**\n * Text that shows number of characters in textarea\n */\n characterLimit: { type: Number, default: undefined },\n\n /**\n * Text displayed as the help text of the textarea\n */\n description: { type: String, default: '' },\n\n /**\n * Disables the possibility of changing value in the textarea\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * If set to true, shows a button to clear all the text\n */\n clearable: { type: Boolean, default: false },\n\n /**\n * Adds error text\n */\n errorMessage: { type: String, default: '' },\n\n /**\n * Sets the height of the textarea, e.g 200px OR 20vh\n */\n height: { type: String, default: null },\n\n /**\n * Text displayed as the label of the textarea\n */\n label: { type: String, default: '' },\n\n /**\n * Highlights the textarea is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * Text displayed as the placeholder of the textarea\n */\n placeholder: { type: String, default: '' },\n\n /**\n * Set the textarea to read only state.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Indicates the possibility of resize the textarea\n */\n resizable: {\n type: String as PropType<BentoTextareaResizeOption | `${BentoTextareaResizeOption}`>,\n default: BentoTextareaResizeOption.BOTH,\n validator: (value: BentoTextareaResizeOption) => Object.values(BentoTextareaResizeOption).includes(value),\n },\n\n /**\n * Highlights the textarea is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Adds a info icon next to the label to display the passed tooltip message.\n */\n tooltipText: { type: String, default: null },\n\n /**\n * Text displayed as the value of the textarea\n */\n value: { type: String, default: '' },\n });\n\n const emit = defineEmits([]);\n\n const { height } = toRefs(props);\n\n const textareaId = generateUid('textarea');\n const textareaElement = ref<HTMLTextAreaElement>(null);\n const textareaComponent = ref<HTMLDivElement>(null);\n const textareaValue = ref(props.value);\n const defaultTextareaHeight = 44;\n const textareaHeight = ref(props.height || `${defaultTextareaHeight}px`);\n const userSetHeight = ref<number>(0);\n const textareaWrapperWidth = ref('100%'); // The width set to the wrapper of the label, textarea and description\n const isUserResizing = ref(false);\n let textareaElementObserver: ResizeObserver | null = null;\n let textareaComponentObserver: ResizeObserver | null = null;\n\n const { t, n } = useI18n<{ message: MessageSchema }>({ messages });\n\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n const counter = computed(() => `${n(textareaValue?.value?.length ?? 0)} / ${n(props.characterLimit)}`);\n const isDynamicHeight = computed(() => !height.value);\n const isOverCharacterLimit = computed(\n () => props.characterLimit && textareaValue.value.length > props.characterLimit\n );\n\n /**\n * Calculates and sets the height of the textarea.\n * The height is determined by the maximum of the following values:\n *\n * 1. The content's scroll height (with a minimum of `defaultTextareaHeight`) + the border width.\n * 2. The height set by the user manually resizing the textarea (`userSetHeight`).\n * 3. The default minimum height (`defaultTextareaHeight`).\n *\n * This ensures the textarea grows with content, shrinks when content is removed,\n * but never goes below the manually set height or the default height.\n */\n const calculateHeight = () => {\n if (textareaElement.value) {\n const newHeight = Math.max(\n textareaElement.value.scrollHeight <= defaultTextareaHeight\n ? defaultTextareaHeight\n : textareaElement.value.scrollHeight + TEXTAREA_BORDER_WIDTH * 2,\n userSetHeight.value,\n defaultTextareaHeight\n );\n textareaHeight.value = `${newHeight}px`;\n }\n };\n\n watch(height, () => {\n if (isDynamicHeight.value) {\n calculateHeight();\n } else {\n textareaHeight.value = height.value;\n }\n });\n\n watch(\n () => props.value,\n () => {\n textareaValue.value = props.value;\n },\n { immediate: true }\n );\n\n watch(\n () => textareaValue.value,\n async () => {\n if (isDynamicHeight.value) {\n // Hack to make the textarea calculate its height properly\n // Set the textarea back to the original value before calculating the height\n textareaHeight.value = `${defaultTextareaHeight}px`;\n if (!textareaValue.value) {\n return;\n }\n\n await nextTick();\n calculateHeight();\n }\n },\n { immediate: true }\n );\n\n const invalidInput = computed(() => !!props.errorMessage || isOverCharacterLimit.value);\n\n const conditionalClasses = computed(() => ({\n [`b-textarea--${BentoTextareaStateClass.DISABLED}`]: props.disabled,\n }));\n\n const conditionalClassesInput = computed(() => ({\n [`b-textarea__input--${BentoTextareaStateClass.CLEARABLE}`]: props.clearable,\n [`b-textarea__input--${BentoTextareaStateClass.READONLY}`]: isReadOnly.value,\n [`b-textarea__input--${BentoTextareaStateClass.ERROR}`]: invalidInput.value,\n [`b-textarea__input--dynamic-height`]: isDynamicHeight.value,\n }));\n\n const conditionalClassesLabelBox = computed(() => ({\n [`b-textarea__label-box--no-label`]: !props.label,\n }));\n\n const conditionalClassesLabelItem = computed(() => ({\n [`b-textarea__label-item--${BentoTextareaStateClass.ERROR}`]: isOverCharacterLimit.value,\n }));\n\n const counterErrorText = computed(() => t('yourTextCanBenAtMost', { characterLimit: props.characterLimit }));\n\n const ariaLabelAttribute = ref(attrs['aria-label']);\n const { ariaLabel, label } = toRefs(props);\n const computedAriaLabel = useAriaLabel({\n ariaLabel: ariaLabelAttribute.value as string,\n // TODO: take this line away when the aria-label props is removed\n label: ariaLabel,\n defaultFallback: label,\n });\n\n const showClearButton = computed(\n () => props.clearable && textareaValue.value && !props.disabled && !isReadOnly.value\n );\n\n const onClear = () => {\n textareaValue.value = '';\n emit(BentoTextareaEvent.CLEAR);\n emit(BentoTextareaEvent.INPUT, '');\n };\n\n const onInput = (event: InputEvent) => {\n event.stopImmediatePropagation();\n\n if (!props.disabled && !isReadOnly.value) {\n textareaValue.value = (event.target as HTMLInputElement).value;\n /**\n * Triggered when input value is changed\n *\n * @event input\n * @property {String} inputValue - the updated textarea value\n */\n emit(BentoTextareaEvent.INPUT, textareaValue.value);\n }\n };\n\n const onBlur = () => {\n textareaElement.value.scrollTop = 0;\n emit(BentoTextareaEvent.BLUR);\n };\n\n const onFocus = () => {\n textareaElement.value.focus();\n emit(BentoTextareaEvent.FOCUS);\n };\n\n const onChange = () => {\n emit(BentoTextareaEvent.CHANGE);\n };\n\n const onPressEscape = () => {\n emit(BentoTextareaEvent.ESCAPE_PRESSED);\n };\n\n const onKeyDown = (event: KeyboardEvent) => {\n event.stopPropagation();\n emit(BentoTextareaEvent.KEYDOWN, event);\n };\n\n const onKeyUp = (event: KeyboardEvent) => {\n event.stopPropagation();\n emit(BentoTextareaEvent.KEYUP, event);\n };\n\n const onMouseDown = () => {\n isUserResizing.value = true;\n };\n\n const onMouseUp = () => {\n isUserResizing.value = false;\n };\n\n /**\n * Updates the textarea width depending if the container or the user update its size.\n * @param isTextareaElement - sets to true if the element being observed is the textarea HTML element.\n */\n const resizeTextareaWrapper = (isTextareaElement = false) => {\n // Width assigned by the browser whenever the textarea is manually resized. String of the format `<value>px`.\n const textareaStyleWidth = textareaElement.value.style.width;\n\n // Make sure the tracked textareaHeight is always in sync with the height size in case we manually resize the textarea\n if (textareaElement.value.style.height) {\n if (isUserResizing.value) {\n userSetHeight.value = parseInt(textareaElement.value.style.height, 10);\n }\n textareaHeight.value = textareaElement.value.style.height;\n }\n\n // If the textarea element observer is being triggered, but there's no textareaStyleWidth, we want to ignore it, as no manual resize as happened yet\n // The component wrapper will handle the resizing logic instead\n if (isTextareaElement && !textareaStyleWidth) {\n return;\n }\n\n // Width of the whole bento-textarea component\n const textareaComponentWidth = textareaComponent?.value?.offsetWidth;\n\n // If there is no textareaStyleWidth or the textareaStyleWidth is larger than the component container, the wrapper should be 100% of the container\n if (!textareaStyleWidth || parseInt(textareaStyleWidth, 10) > textareaComponentWidth) {\n textareaWrapperWidth.value = '100%';\n } else {\n // Else the wrapper should always be as wide as the textarea element itself\n textareaWrapperWidth.value = textareaStyleWidth;\n }\n };\n\n const focus = () => {\n textareaElement.value.focus();\n };\n\n defineExpose({\n focus,\n });\n\n onMounted(() => {\n textareaElementObserver = observeSizeOfElement(textareaElement.value, () => {\n resizeTextareaWrapper(true);\n });\n\n textareaComponentObserver = observeSizeOfElement(textareaComponent.value, () => {\n resizeTextareaWrapper();\n });\n\n if (isDynamicHeight.value) {\n calculateHeight();\n }\n });\n\n onUnmounted(() => {\n textareaElementObserver?.disconnect();\n textareaComponentObserver?.disconnect();\n });\n</script>\n\n<script lang=\"ts\">\n const TEXTAREA_BORDER_WIDTH = parseFloat(BTextareaInputFocusBorderWidth);\n\n export default {\n i18n: { messages },\n name: 'bento-textarea',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./textarea.scss\" />\n"],"names":["BentoTextareaResizeOption","BentoTextareaResizeOption2","BentoTextareaStateClass","BentoTextareaStateClass2","BentoTextareaEvent","BentoTextareaEvent2","TEXTAREA_BORDER_WIDTH","BTextareaInputFocusBorderWidth","__default__","messages","attrs","useAttrs","height","toRefs","props","textareaId","generateUid","textareaElement","ref","textareaComponent","textareaValue","defaultTextareaHeight","textareaHeight","userSetHeight","textareaWrapperWidth","isUserResizing","textareaElementObserver","textareaComponentObserver","t","n","useI18n","isReadOnly","useFormLayoutFieldLoading","toRef","counter","computed","_a","isDynamicHeight","isOverCharacterLimit","calculateHeight","newHeight","watch","nextTick","invalidInput","conditionalClasses","conditionalClassesInput","conditionalClassesLabelBox","conditionalClassesLabelItem","counterErrorText","ariaLabelAttribute","ariaLabel","label","computedAriaLabel","useAriaLabel","showClearButton","onClear","emit","onInput","event","onBlur","onFocus","onChange","onPressEscape","onKeyDown","onKeyUp","onMouseDown","onMouseUp","resizeTextareaWrapper","isTextareaElement","textareaStyleWidth","textareaComponentWidth","focus","expose","onMounted","observeSizeOfElement","onUnmounted"],"mappings":";;;;;;;;;;;;;AAGY,IAA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I,MAAAjD,KAAA,QAAAA,EAAA,cACAC,KAAA,QAAAA,EAAA;AAAA,IAAsC,CAAA;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { defineComponent as z, computed as o, ref as N, toRefs as G, watch as Q, provide as x, nextTick as X, inject as B, onUnmounted as ee } from "vue";
|
|
2
2
|
import { B as H } from "./button.CilT7NmM.js";
|
|
3
|
-
import { B as te } from "./textarea.
|
|
3
|
+
import { B as te } from "./textarea.DUPV-I-L.js";
|
|
4
4
|
import { u as q } from "./i18n.BQkEbtPM.js";
|
|
5
|
-
import { B as ae } from "./
|
|
5
|
+
import { B as ae } from "./button-actions.55vIvDsX.js";
|
|
6
6
|
import { n as O } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
7
7
|
import { B as ie } from "./date.BTdCYdkj.js";
|
|
8
8
|
import { B as se } from "./link.C4htMrDV.js";
|
|
9
|
-
import { B as ne } from "./tag.
|
|
9
|
+
import { B as ne } from "./tag.Tjg4linG.js";
|
|
10
10
|
import { B as oe, d as re } from "./typography.hlOAxsEn.js";
|
|
11
|
-
import { a as le, B as ce, S as me } from "./structured-list-item.
|
|
11
|
+
import { a as le, B as ce, S as me } from "./structured-list-item.BLalgOps.js";
|
|
12
12
|
/* empty css */
|
|
13
13
|
import { g as de } from "./generate-uid.NJ8tVoha.js";
|
|
14
14
|
import { u as ue } from "./use-has-slot.C9lQZ6nz.js";
|
|
@@ -384,4 +384,4 @@ export {
|
|
|
384
384
|
J as d,
|
|
385
385
|
We as t
|
|
386
386
|
};
|
|
387
|
-
//# sourceMappingURL=timeline-item.
|
|
387
|
+
//# sourceMappingURL=timeline-item.DaRKHndA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline-item.Dhcs9a0S.js","sources":["../../../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/formatDistanceStrict/index.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 getTimezoneOffsetInMilliseconds from \"../_lib/getTimezoneOffsetInMilliseconds/index.js\";\nimport compareAsc from \"../compareAsc/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport cloneObject from \"../_lib/cloneObject/index.js\";\nimport defaultLocale from \"../locale/en-US/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nvar MILLISECONDS_IN_MINUTE = 1000 * 60;\nvar MINUTES_IN_DAY = 60 * 24;\nvar MINUTES_IN_MONTH = MINUTES_IN_DAY * 30;\nvar MINUTES_IN_YEAR = MINUTES_IN_DAY * 365;\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 * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `distanceInWordsStrict` to `formatDistanceStrict`\n * to make its name consistent with `format` and `formatRelative`.\n *\n * - The order of arguments is swapped to make the function\n * consistent with `differenceIn...` functions.\n *\n * ```javascript\n * // Before v2.0.0\n *\n * distanceInWordsStrict(\n * new Date(2015, 0, 2),\n * new Date(2014, 6, 2)\n * ) //=> '6 months'\n *\n * // v2.0.0 onward\n *\n * formatDistanceStrict(\n * new Date(2014, 6, 2),\n * new Date(2015, 0, 2)\n * ) //=> '6 months'\n * ```\n *\n * - `partialMethod` option is renamed to `roundingMethod`.\n *\n * ```javascript\n * // Before v2.0.0\n *\n * distanceInWordsStrict(\n * new Date(1986, 3, 4, 10, 32, 0),\n * new Date(1986, 3, 4, 10, 33, 1),\n * { partialMethod: 'ceil' }\n * ) //=> '2 minutes'\n *\n * // v2.0.0 onward\n *\n * formatDistanceStrict(\n * new Date(1986, 3, 4, 10, 33, 1),\n * new Date(1986, 3, 4, 10, 32, 0),\n * { roundingMethod: 'ceil' }\n * ) //=> '2 minutes'\n * ```\n *\n * - If `roundingMethod` is not specified, it now defaults to `round` instead of `floor`.\n *\n * - `unit` option now accepts one of the strings:\n * 'second', 'minute', 'hour', 'day', 'month' or 'year' instead of 's', 'm', 'h', 'd', 'M' or 'Y'\n *\n * ```javascript\n * // Before v2.0.0\n *\n * distanceInWordsStrict(\n * new Date(1986, 3, 4, 10, 32, 0),\n * new Date(1986, 3, 4, 10, 33, 1),\n * { unit: 'm' }\n * )\n *\n * // v2.0.0 onward\n *\n * formatDistanceStrict(\n * new Date(1986, 3, 4, 10, 33, 1),\n * new Date(1986, 3, 4, 10, 32, 0),\n * { unit: 'minute' }\n * )\n * ```\n *\n * @param {Date|Number} date - the date\n * @param {Date|Number} baseDate - the date to compare with\n * @param {Object} [options] - an object with options.\n * @param {Boolean} [options.addSuffix=false] - result indicates if the second date is earlier or later than the first\n * @param {'second'|'minute'|'hour'|'day'|'month'|'year'} [options.unit] - if specified, will force a unit\n * @param {'floor'|'ceil'|'round'} [options.roundingMethod='round'] - which way to round partial units\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {String} the distance in words\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `date` must not be Invalid Date\n * @throws {RangeError} `baseDate` must not be Invalid Date\n * @throws {RangeError} `options.roundingMethod` must be 'floor', 'ceil' or 'round'\n * @throws {RangeError} `options.unit` must be 'second', 'minute', 'hour', 'day', 'month' or 'year'\n * @throws {RangeError} `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 default function formatDistanceStrict(dirtyDate, dirtyBaseDate) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n requiredArgs(2, arguments);\n var locale = options.locale || defaultLocale;\n\n if (!locale.formatDistance) {\n throw new RangeError('locale must contain localize.formatDistance property');\n }\n\n var comparison = compareAsc(dirtyDate, dirtyBaseDate);\n\n if (isNaN(comparison)) {\n throw new RangeError('Invalid time value');\n }\n\n var localizeOptions = cloneObject(options);\n localizeOptions.addSuffix = Boolean(options.addSuffix);\n localizeOptions.comparison = comparison;\n var dateLeft;\n var dateRight;\n\n if (comparison > 0) {\n dateLeft = toDate(dirtyBaseDate);\n dateRight = toDate(dirtyDate);\n } else {\n dateLeft = toDate(dirtyDate);\n dateRight = toDate(dirtyBaseDate);\n }\n\n var roundingMethod = options.roundingMethod == null ? 'round' : String(options.roundingMethod);\n var roundingMethodFn;\n\n if (roundingMethod === 'floor') {\n roundingMethodFn = Math.floor;\n } else if (roundingMethod === 'ceil') {\n roundingMethodFn = Math.ceil;\n } else if (roundingMethod === 'round') {\n roundingMethodFn = Math.round;\n } else {\n throw new RangeError(\"roundingMethod must be 'floor', 'ceil' or 'round'\");\n }\n\n var milliseconds = dateRight.getTime() - dateLeft.getTime();\n var minutes = milliseconds / MILLISECONDS_IN_MINUTE;\n var timezoneOffset = getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft); // Use DST-normalized difference in minutes for years, months and days;\n // use regular difference in minutes for hours, minutes and seconds.\n\n var dstNormalizedMinutes = (milliseconds - timezoneOffset) / MILLISECONDS_IN_MINUTE;\n var unit;\n\n if (options.unit == null) {\n if (minutes < 1) {\n unit = 'second';\n } else if (minutes < 60) {\n unit = 'minute';\n } else if (minutes < MINUTES_IN_DAY) {\n unit = 'hour';\n } else if (dstNormalizedMinutes < MINUTES_IN_MONTH) {\n unit = 'day';\n } else if (dstNormalizedMinutes < MINUTES_IN_YEAR) {\n unit = 'month';\n } else {\n unit = 'year';\n }\n } else {\n unit = String(options.unit);\n } // 0 up to 60 seconds\n\n\n if (unit === 'second') {\n var seconds = roundingMethodFn(milliseconds / 1000);\n return locale.formatDistance('xSeconds', seconds, localizeOptions); // 1 up to 60 mins\n } else if (unit === 'minute') {\n var roundedMinutes = roundingMethodFn(minutes);\n return locale.formatDistance('xMinutes', roundedMinutes, localizeOptions); // 1 up to 24 hours\n } else if (unit === 'hour') {\n var hours = roundingMethodFn(minutes / 60);\n return locale.formatDistance('xHours', hours, localizeOptions); // 1 up to 30 days\n } else if (unit === 'day') {\n var days = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_DAY);\n return locale.formatDistance('xDays', days, localizeOptions); // 1 up to 12 months\n } else if (unit === 'month') {\n var months = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_MONTH);\n return months === 12 && options.unit !== 'month' ? locale.formatDistance('xYears', 1, localizeOptions) : locale.formatDistance('xMonths', months, localizeOptions); // 1 year up to max Date\n } else if (unit === 'year') {\n var years = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_YEAR);\n return locale.formatDistance('xYears', years, localizeOptions);\n }\n\n throw new RangeError(\"unit must be 'second', 'minute', 'hour', 'day', 'month' or 'year'\");\n}","import { 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 \"variant\" prop was deprecated. Use \"status\" modifier 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}\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 from version 2.0.0.\n */\nexport type BentoTimelineRegisterEntry = (props: {\n title?: string | BentoTimelineItemTitle;\n description?: string;\n date: Date | number;\n}) => { timelineEntries: Ref<BentoTimelineEntry[]>; index: number; unregisterTimelineEntry: () => void };\n\n/**\n * @private\n */\nexport type BentoInternalTimelineRegisterEntry = (\n entry: BentoTimelineEntry\n) => { timelineEntries: Ref<BentoTimelineEntry[]>; unregisterTimelineEntry: () => void };\n\nexport interface BentoTimelineConfigData {\n showAll: Ref<boolean>;\n showMoreIndex: Ref<number>;\n hiddenItems: Ref<number>;\n visibleIndexes: Ref<number[]>;\n timegapLimit: Ref<BentoTimelineGapObject>;\n timelineEntries: Ref<BentoTimelineEntry[]>;\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 @input=\"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 lang=\"ts\">\n import { computed, defineComponent, nextTick, type PropType, 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 BentoTimelineGapObject,\n type BentoTimelineShowMoreObject,\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 /**\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 components: { BentoButton, BentoButtonActions, BentoTextarea },\n props: {\n /**\n * If set to true, gives the possibility to manually add notes to the timeline via a textarea\n */\n addNote: {\n type: Boolean,\n default: false,\n },\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: {\n type: Object as PropType<BentoTimelineShowMoreObject>,\n default: null,\n },\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: {\n type: Object as PropType<BentoTimelineGapObject>,\n default: null,\n },\n },\n\n emits: ['add-timeline-note'],\n\n setup(props, { emit }) {\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<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\n return {\n addNoteLabel,\n cancelLabel,\n toggleAddNote,\n updateNoteContent,\n addNoteToTimeline,\n showAddNoteTextArea,\n\n // refs\n addNoteTextareaRef,\n addNoteButtonRef,\n };\n },\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 {{ timestamp.value }}\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 {{ additionalTimestamp.value }}\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=\"entry in dataList\"\n :key=\"generateUid(entry.label)\"\n :label=\"entry.label\"\n >\n <bento-typography variant=\"caption\">{{ entry.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 lang=\"ts\">\n import { computed, defineComponent, inject, onUnmounted, type PropType, provide } from 'vue';\n // Components\n import { BentoButton } from '@/components/button';\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 BentoTimelineDataList,\n type BentoTimelineEntry,\n type BentoTimelineItemTitle,\n BentoTimelineItemVariant,\n type BentoTimelineRegisterEntry,\n BentoTimelineStatus,\n type BentoTimelineTagProps,\n type BentoTimelineTimestamp,\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 * 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 components: {\n BentoButton,\n BentoDate,\n BentoLink,\n BentoTag,\n BentoTypography,\n BentoStructuredList,\n BentoStructuredListItem,\n SquareSmallIcon,\n },\n i18n: { messages },\n props: {\n /**\n * Additional timestamp of the event\n */\n additionalTimestamp: {\n type: Object as PropType<BentoTimelineTimestamp>,\n default: null,\n },\n /**\n * Relevant key-value pair data to display in the event\n */\n dataList: {\n type: Array as PropType<BentoTimelineDataList>,\n default: null,\n },\n /**\n * Description of the event\n */\n description: {\n type: String,\n default: null,\n },\n /**\n * Modifier that changes the color of the timeline icon\n * @values blue, black, green, grey, orange, red, yellow\n */\n status: {\n type: String as PropType<`${BentoTimelineStatus}`>,\n default: 'black',\n validator: (value: BentoTimelineStatus) => Object.values(BentoTimelineStatus).includes(value),\n },\n /**\n * Tag props that will be passed down to inner tag component\n */\n tag: {\n type: Object as PropType<BentoTimelineTagProps>,\n default: undefined,\n },\n /**\n * Main timestamp of the event. Used for timegap detection.\n */\n timestamp: {\n type: Object as PropType<BentoTimelineTimestamp>,\n required: true,\n },\n /**\n * Title of the event\n */\n title: {\n type: [Object, String] as PropType<BentoTimelineItemTitle | string>,\n default: null,\n },\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: {\n type: String,\n default: 'milestone',\n validator: (value: string) => ['milestone', 'note'].includes(value),\n },\n /**\n * Variant for the timeline item\n * @values DEFAULT, SUCCESS, CRITICAL\n *\n * @deprecated Use \"status\" prop instead\n */\n variant: {\n type: String as PropType<BentoTimelineItemVariant | `${BentoTimelineItemVariant}`>,\n default: null,\n validator: (value: BentoTimelineItemVariant) => Object.values(BentoTimelineItemVariant).includes(value),\n },\n },\n setup(props, { slots }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\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(() =>\n allItemsShowing.value ? true : visibleIndexes.value.includes(index.value)\n );\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\n return {\n // Values\n isNoteType,\n iconConditionalClasses,\n conditionalClasses,\n displayShowMoreButton,\n showAll,\n hiddenItems,\n isVisible,\n isLinkTitle,\n linkTitleProps,\n timegap,\n timegapAriaLabel,\n isLastItem,\n\n // Methods\n generateUid,\n hasSlot: useHasSlot(slots),\n t,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./timeline-item.scss\" />\n"],"names":["MILLISECONDS_IN_MINUTE","MINUTES_IN_DAY","MINUTES_IN_MONTH","MINUTES_IN_YEAR","formatDistanceStrict","dirtyDate","dirtyBaseDate","options","requiredArgs","locale$1","locale","comparison","compareAsc","localizeOptions","cloneObject","dateLeft","dateRight","toDate","roundingMethod","roundingMethodFn","milliseconds","minutes","timezoneOffset","getTimezoneOffsetInMilliseconds","dstNormalizedMinutes","unit","seconds","roundedMinutes","hours","days","months","years","BentoTimelineShowMorePlacement","BentoTimelineShowMorePlacement2","BentoTimelineGapUnit","BentoTimelineGapUnit2","BentoTimelineItemVariant","BentoTimelineItemVariant2","BentoTimelineStatus","BentoTimelineStatus2","TIMELINE_REGISTER_ENTRY_INJECTION_KEY","TIMELINE_CONFIG_INJECTION_KEY","_sfc_main$2","defineComponent","messages$1","BentoButton","BentoButtonActions","BentoTextarea","props","emit","t","useI18n","addNoteLabel","computed","cancelLabel","newNoteContent","ref","updateNoteContent","newTimelineNoteContent","addNoteTextareaRef","addNoteButtonRef","showAddNoteTextArea","toggleAddNote","nextTick","_a","_b","addNoteToTimeline","timelineEntries","hiddenItems","showAll","timegapLimit","toRefs","timelineIndexes","visibleIndexes","showMoreIndex","sortEntries","a","b","unregisterTimelineEntry","entryToRemove","index","registerTimelineEntry","entry","watch","configData","provide","uuid","_sfc_main$1","_sfc_main","BentoDate","BentoLink","BentoTag","BentoTypography","BentoStructuredList","BentoStructuredListItem","SquareSmallIcon","messages","value","slots","isNoteType","computedStatus","deprecate","iconConditionalClasses","conditionalClasses","STRUCTURED_LIST_CONDENSED_INJECTION_KEY","inject","onUnmounted","allItemsShowing","isVisible","isLinkTitle","linkTitleProps","timegap","previousDate","isPreviousItemVisible","date","timegapInSelectedUnit","timegapAriaLabel","displayShowMoreButton","isLastItem","generateUid","useHasSlot"],"mappings":";;;;;;;;;;;;;;;;;AAMA,IAAAA,IAAA,MAAA,IACAC,IAAA,KAAA,IACAC,IAAAD,IAAA,IACAE,IAAAF,IAAA;AAwJe,SAAAG,EAAAC,GAAAC,GAAA;AACf,MAAAC,IAAA,UAAA,SAAA,KAAA,UAAA,CAAA,MAAA,SAAA,UAAA,CAAA,IAAA,CAAA;AACA,EAAAC,GAAA,GAAA,SAAA;AACA,MAAAC,IAAAF,EAAA,UAAAG;AAEA,MAAA,CAAAD,EAAA;AACA,UAAA,IAAA,WAAA,sDAAA;AAGA,MAAAE,IAAAC,GAAAP,GAAAC,CAAA;AAEA,MAAA,MAAAK,CAAA;AACA,UAAA,IAAA,WAAA,oBAAA;AAGA,MAAAE,IAAAC,GAAAP,CAAA;AACA,EAAAM,EAAA,YAAA,EAAAN,EAAA,WACAM,EAAA,aAAAF;AACA,MAAAI,GACAC;AAEA,EAAAL,IAAA,KACAI,IAAAE,EAAAX,CAAA,GACAU,IAAAC,EAAAZ,CAAA,MAEAU,IAAAE,EAAAZ,CAAA,GACAW,IAAAC,EAAAX,CAAA;AAGA,MAAAY,IAAAX,EAAA,kBAAA,O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,oBAAAC;AAAA,MACA,uBAAAc;AAAA,MACA,SAAAhD;AAAA,MACA,aAAAD;AAAA,MACA,WAAAwC;AAAA,MACA,aAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,SAAAC;AAAA,MACA,kBAAAK;AAAA,MACA,YAAAE;AAAA;AAAA,MACA,aAAAC;AAAA,MAGA,SAAAC,GAAAtB,CAAA;AAAA,MACA,GAAAhD;AAAA,IACA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"timeline-item.DaRKHndA.js","sources":["../../../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/formatDistanceStrict/index.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 getTimezoneOffsetInMilliseconds from \"../_lib/getTimezoneOffsetInMilliseconds/index.js\";\nimport compareAsc from \"../compareAsc/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport cloneObject from \"../_lib/cloneObject/index.js\";\nimport defaultLocale from \"../locale/en-US/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nvar MILLISECONDS_IN_MINUTE = 1000 * 60;\nvar MINUTES_IN_DAY = 60 * 24;\nvar MINUTES_IN_MONTH = MINUTES_IN_DAY * 30;\nvar MINUTES_IN_YEAR = MINUTES_IN_DAY * 365;\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 * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `distanceInWordsStrict` to `formatDistanceStrict`\n * to make its name consistent with `format` and `formatRelative`.\n *\n * - The order of arguments is swapped to make the function\n * consistent with `differenceIn...` functions.\n *\n * ```javascript\n * // Before v2.0.0\n *\n * distanceInWordsStrict(\n * new Date(2015, 0, 2),\n * new Date(2014, 6, 2)\n * ) //=> '6 months'\n *\n * // v2.0.0 onward\n *\n * formatDistanceStrict(\n * new Date(2014, 6, 2),\n * new Date(2015, 0, 2)\n * ) //=> '6 months'\n * ```\n *\n * - `partialMethod` option is renamed to `roundingMethod`.\n *\n * ```javascript\n * // Before v2.0.0\n *\n * distanceInWordsStrict(\n * new Date(1986, 3, 4, 10, 32, 0),\n * new Date(1986, 3, 4, 10, 33, 1),\n * { partialMethod: 'ceil' }\n * ) //=> '2 minutes'\n *\n * // v2.0.0 onward\n *\n * formatDistanceStrict(\n * new Date(1986, 3, 4, 10, 33, 1),\n * new Date(1986, 3, 4, 10, 32, 0),\n * { roundingMethod: 'ceil' }\n * ) //=> '2 minutes'\n * ```\n *\n * - If `roundingMethod` is not specified, it now defaults to `round` instead of `floor`.\n *\n * - `unit` option now accepts one of the strings:\n * 'second', 'minute', 'hour', 'day', 'month' or 'year' instead of 's', 'm', 'h', 'd', 'M' or 'Y'\n *\n * ```javascript\n * // Before v2.0.0\n *\n * distanceInWordsStrict(\n * new Date(1986, 3, 4, 10, 32, 0),\n * new Date(1986, 3, 4, 10, 33, 1),\n * { unit: 'm' }\n * )\n *\n * // v2.0.0 onward\n *\n * formatDistanceStrict(\n * new Date(1986, 3, 4, 10, 33, 1),\n * new Date(1986, 3, 4, 10, 32, 0),\n * { unit: 'minute' }\n * )\n * ```\n *\n * @param {Date|Number} date - the date\n * @param {Date|Number} baseDate - the date to compare with\n * @param {Object} [options] - an object with options.\n * @param {Boolean} [options.addSuffix=false] - result indicates if the second date is earlier or later than the first\n * @param {'second'|'minute'|'hour'|'day'|'month'|'year'} [options.unit] - if specified, will force a unit\n * @param {'floor'|'ceil'|'round'} [options.roundingMethod='round'] - which way to round partial units\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {String} the distance in words\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `date` must not be Invalid Date\n * @throws {RangeError} `baseDate` must not be Invalid Date\n * @throws {RangeError} `options.roundingMethod` must be 'floor', 'ceil' or 'round'\n * @throws {RangeError} `options.unit` must be 'second', 'minute', 'hour', 'day', 'month' or 'year'\n * @throws {RangeError} `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 default function formatDistanceStrict(dirtyDate, dirtyBaseDate) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n requiredArgs(2, arguments);\n var locale = options.locale || defaultLocale;\n\n if (!locale.formatDistance) {\n throw new RangeError('locale must contain localize.formatDistance property');\n }\n\n var comparison = compareAsc(dirtyDate, dirtyBaseDate);\n\n if (isNaN(comparison)) {\n throw new RangeError('Invalid time value');\n }\n\n var localizeOptions = cloneObject(options);\n localizeOptions.addSuffix = Boolean(options.addSuffix);\n localizeOptions.comparison = comparison;\n var dateLeft;\n var dateRight;\n\n if (comparison > 0) {\n dateLeft = toDate(dirtyBaseDate);\n dateRight = toDate(dirtyDate);\n } else {\n dateLeft = toDate(dirtyDate);\n dateRight = toDate(dirtyBaseDate);\n }\n\n var roundingMethod = options.roundingMethod == null ? 'round' : String(options.roundingMethod);\n var roundingMethodFn;\n\n if (roundingMethod === 'floor') {\n roundingMethodFn = Math.floor;\n } else if (roundingMethod === 'ceil') {\n roundingMethodFn = Math.ceil;\n } else if (roundingMethod === 'round') {\n roundingMethodFn = Math.round;\n } else {\n throw new RangeError(\"roundingMethod must be 'floor', 'ceil' or 'round'\");\n }\n\n var milliseconds = dateRight.getTime() - dateLeft.getTime();\n var minutes = milliseconds / MILLISECONDS_IN_MINUTE;\n var timezoneOffset = getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft); // Use DST-normalized difference in minutes for years, months and days;\n // use regular difference in minutes for hours, minutes and seconds.\n\n var dstNormalizedMinutes = (milliseconds - timezoneOffset) / MILLISECONDS_IN_MINUTE;\n var unit;\n\n if (options.unit == null) {\n if (minutes < 1) {\n unit = 'second';\n } else if (minutes < 60) {\n unit = 'minute';\n } else if (minutes < MINUTES_IN_DAY) {\n unit = 'hour';\n } else if (dstNormalizedMinutes < MINUTES_IN_MONTH) {\n unit = 'day';\n } else if (dstNormalizedMinutes < MINUTES_IN_YEAR) {\n unit = 'month';\n } else {\n unit = 'year';\n }\n } else {\n unit = String(options.unit);\n } // 0 up to 60 seconds\n\n\n if (unit === 'second') {\n var seconds = roundingMethodFn(milliseconds / 1000);\n return locale.formatDistance('xSeconds', seconds, localizeOptions); // 1 up to 60 mins\n } else if (unit === 'minute') {\n var roundedMinutes = roundingMethodFn(minutes);\n return locale.formatDistance('xMinutes', roundedMinutes, localizeOptions); // 1 up to 24 hours\n } else if (unit === 'hour') {\n var hours = roundingMethodFn(minutes / 60);\n return locale.formatDistance('xHours', hours, localizeOptions); // 1 up to 30 days\n } else if (unit === 'day') {\n var days = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_DAY);\n return locale.formatDistance('xDays', days, localizeOptions); // 1 up to 12 months\n } else if (unit === 'month') {\n var months = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_MONTH);\n return months === 12 && options.unit !== 'month' ? locale.formatDistance('xYears', 1, localizeOptions) : locale.formatDistance('xMonths', months, localizeOptions); // 1 year up to max Date\n } else if (unit === 'year') {\n var years = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_YEAR);\n return locale.formatDistance('xYears', years, localizeOptions);\n }\n\n throw new RangeError(\"unit must be 'second', 'minute', 'hour', 'day', 'month' or 'year'\");\n}","import { 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 \"variant\" prop was deprecated. Use \"status\" modifier 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}\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 from version 2.0.0.\n */\nexport type BentoTimelineRegisterEntry = (props: {\n title?: string | BentoTimelineItemTitle;\n description?: string;\n date: Date | number;\n}) => { timelineEntries: Ref<BentoTimelineEntry[]>; index: number; unregisterTimelineEntry: () => void };\n\n/**\n * @private\n */\nexport type BentoInternalTimelineRegisterEntry = (\n entry: BentoTimelineEntry\n) => { timelineEntries: Ref<BentoTimelineEntry[]>; unregisterTimelineEntry: () => void };\n\nexport interface BentoTimelineConfigData {\n showAll: Ref<boolean>;\n showMoreIndex: Ref<number>;\n hiddenItems: Ref<number>;\n visibleIndexes: Ref<number[]>;\n timegapLimit: Ref<BentoTimelineGapObject>;\n timelineEntries: Ref<BentoTimelineEntry[]>;\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 @input=\"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 lang=\"ts\">\n import { computed, defineComponent, nextTick, type PropType, 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 BentoTimelineGapObject,\n type BentoTimelineShowMoreObject,\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 /**\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 components: { BentoButton, BentoButtonActions, BentoTextarea },\n props: {\n /**\n * If set to true, gives the possibility to manually add notes to the timeline via a textarea\n */\n addNote: {\n type: Boolean,\n default: false,\n },\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: {\n type: Object as PropType<BentoTimelineShowMoreObject>,\n default: null,\n },\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: {\n type: Object as PropType<BentoTimelineGapObject>,\n default: null,\n },\n },\n\n emits: ['add-timeline-note'],\n\n setup(props, { emit }) {\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<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\n return {\n addNoteLabel,\n cancelLabel,\n toggleAddNote,\n updateNoteContent,\n addNoteToTimeline,\n showAddNoteTextArea,\n\n // refs\n addNoteTextareaRef,\n addNoteButtonRef,\n };\n },\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 {{ timestamp.value }}\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 {{ additionalTimestamp.value }}\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=\"entry in dataList\"\n :key=\"generateUid(entry.label)\"\n :label=\"entry.label\"\n >\n <bento-typography variant=\"caption\">{{ entry.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 lang=\"ts\">\n import { computed, defineComponent, inject, onUnmounted, type PropType, provide } from 'vue';\n // Components\n import { BentoButton } from '@/components/button';\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 BentoTimelineDataList,\n type BentoTimelineEntry,\n type BentoTimelineItemTitle,\n BentoTimelineItemVariant,\n type BentoTimelineRegisterEntry,\n BentoTimelineStatus,\n type BentoTimelineTagProps,\n type BentoTimelineTimestamp,\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 * 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 components: {\n BentoButton,\n BentoDate,\n BentoLink,\n BentoTag,\n BentoTypography,\n BentoStructuredList,\n BentoStructuredListItem,\n SquareSmallIcon,\n },\n i18n: { messages },\n props: {\n /**\n * Additional timestamp of the event\n */\n additionalTimestamp: {\n type: Object as PropType<BentoTimelineTimestamp>,\n default: null,\n },\n /**\n * Relevant key-value pair data to display in the event\n */\n dataList: {\n type: Array as PropType<BentoTimelineDataList>,\n default: null,\n },\n /**\n * Description of the event\n */\n description: {\n type: String,\n default: null,\n },\n /**\n * Modifier that changes the color of the timeline icon\n * @values blue, black, green, grey, orange, red, yellow\n */\n status: {\n type: String as PropType<`${BentoTimelineStatus}`>,\n default: 'black',\n validator: (value: BentoTimelineStatus) => Object.values(BentoTimelineStatus).includes(value),\n },\n /**\n * Tag props that will be passed down to inner tag component\n */\n tag: {\n type: Object as PropType<BentoTimelineTagProps>,\n default: undefined,\n },\n /**\n * Main timestamp of the event. Used for timegap detection.\n */\n timestamp: {\n type: Object as PropType<BentoTimelineTimestamp>,\n required: true,\n },\n /**\n * Title of the event\n */\n title: {\n type: [Object, String] as PropType<BentoTimelineItemTitle | string>,\n default: null,\n },\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: {\n type: String,\n default: 'milestone',\n validator: (value: string) => ['milestone', 'note'].includes(value),\n },\n /**\n * Variant for the timeline item\n * @values DEFAULT, SUCCESS, CRITICAL\n *\n * @deprecated Use \"status\" prop instead\n */\n variant: {\n type: String as PropType<BentoTimelineItemVariant | `${BentoTimelineItemVariant}`>,\n default: null,\n validator: (value: BentoTimelineItemVariant) => Object.values(BentoTimelineItemVariant).includes(value),\n },\n },\n setup(props, { slots }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\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(() =>\n allItemsShowing.value ? true : visibleIndexes.value.includes(index.value)\n );\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\n return {\n // Values\n isNoteType,\n iconConditionalClasses,\n conditionalClasses,\n displayShowMoreButton,\n showAll,\n hiddenItems,\n isVisible,\n isLinkTitle,\n linkTitleProps,\n timegap,\n timegapAriaLabel,\n isLastItem,\n\n // Methods\n generateUid,\n hasSlot: useHasSlot(slots),\n t,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./timeline-item.scss\" />\n"],"names":["MILLISECONDS_IN_MINUTE","MINUTES_IN_DAY","MINUTES_IN_MONTH","MINUTES_IN_YEAR","formatDistanceStrict","dirtyDate","dirtyBaseDate","options","requiredArgs","locale$1","locale","comparison","compareAsc","localizeOptions","cloneObject","dateLeft","dateRight","toDate","roundingMethod","roundingMethodFn","milliseconds","minutes","timezoneOffset","getTimezoneOffsetInMilliseconds","dstNormalizedMinutes","unit","seconds","roundedMinutes","hours","days","months","years","BentoTimelineShowMorePlacement","BentoTimelineShowMorePlacement2","BentoTimelineGapUnit","BentoTimelineGapUnit2","BentoTimelineItemVariant","BentoTimelineItemVariant2","BentoTimelineStatus","BentoTimelineStatus2","TIMELINE_REGISTER_ENTRY_INJECTION_KEY","TIMELINE_CONFIG_INJECTION_KEY","_sfc_main$2","defineComponent","messages$1","BentoButton","BentoButtonActions","BentoTextarea","props","emit","t","useI18n","addNoteLabel","computed","cancelLabel","newNoteContent","ref","updateNoteContent","newTimelineNoteContent","addNoteTextareaRef","addNoteButtonRef","showAddNoteTextArea","toggleAddNote","nextTick","_a","_b","addNoteToTimeline","timelineEntries","hiddenItems","showAll","timegapLimit","toRefs","timelineIndexes","visibleIndexes","showMoreIndex","sortEntries","a","b","unregisterTimelineEntry","entryToRemove","index","registerTimelineEntry","entry","watch","configData","provide","uuid","_sfc_main$1","_sfc_main","BentoDate","BentoLink","BentoTag","BentoTypography","BentoStructuredList","BentoStructuredListItem","SquareSmallIcon","messages","value","slots","isNoteType","computedStatus","deprecate","iconConditionalClasses","conditionalClasses","STRUCTURED_LIST_CONDENSED_INJECTION_KEY","inject","onUnmounted","allItemsShowing","isVisible","isLinkTitle","linkTitleProps","timegap","previousDate","isPreviousItemVisible","date","timegapInSelectedUnit","timegapAriaLabel","displayShowMoreButton","isLastItem","generateUid","useHasSlot"],"mappings":";;;;;;;;;;;;;;;;;AAMA,IAAAA,IAAA,MAAA,IACAC,IAAA,KAAA,IACAC,IAAAD,IAAA,IACAE,IAAAF,IAAA;AAwJe,SAAAG,EAAAC,GAAAC,GAAA;AACf,MAAAC,IAAA,UAAA,SAAA,KAAA,UAAA,CAAA,MAAA,SAAA,UAAA,CAAA,IAAA,CAAA;AAC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C,EAAA,MAAA,KAAA,CAAA;AAAA,QACA;AAAA,MACA;AAEA,aAAAA,EAAA,MAAA,SAAA6C,IAAA/G,EAAA4G,GAAAE,GAAA,EAAA,gBAAA,QAAA,CAAA,IAAA;AAAA,IAEA,CAAA,GAEAE,IAAA/D,EAAA,MAAA0D,EAAA,QAAA7D,EAAA,WAAA,EAAA,SAAA6D,EAAA,MAAA,CAAA,IAAA,EAAA,GACAM,IAAAhE,EAAA,MAAAe,EAAA,SAAAM,EAAA,UAAAM,EAAA,KAAA,GACAsC,IAAAjE,EAAA,MAEA2B,EAAA,UAAA,MAAAA,EAAA,UAAAb,EAAA,MAAA,SAAA,CAAA;AAGA,WAAA;AAAA;AAAA,MAAA,YAAAgC;AAAA,MAEA,wBAAAG;AAAA,MACA,oBAAAC;AAAA,MACA,uBAAAc;AAAA,MACA,SAAAhD;AAAA,MACA,aAAAD;AAAA,MACA,WAAAwC;AAAA,MACA,aAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,SAAAC;AAAA,MACA,kBAAAK;AAAA,MACA,YAAAE;AAAA;AAAA,MACA,aAAAC;AAAA,MAGA,SAAAC,GAAAtB,CAAA;AAAA,MACA,GAAAhD;AAAA,IACA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as O, computed as y, reactive as D, nextTick as C } from "vue";
|
|
2
2
|
import { l as a } from "./events.CMzGybJJ.js";
|
|
3
3
|
import { g as R } from "./generate-uid.NJ8tVoha.js";
|
|
4
|
-
import { a as g, P as B, c as N } from "./popper-container.
|
|
4
|
+
import { a as g, P as B, c as N } from "./popper-container.C9KCAJxI.js";
|
|
5
5
|
import { V as $ } from "./index.Cl4_42j5.js";
|
|
6
6
|
import { B as I } from "./typography.hlOAxsEn.js";
|
|
7
7
|
import { n as k } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
@@ -190,4 +190,4 @@ export {
|
|
|
190
190
|
T as c,
|
|
191
191
|
x as d
|
|
192
192
|
};
|
|
193
|
-
//# sourceMappingURL=tooltip.
|
|
193
|
+
//# sourceMappingURL=tooltip.DOD_4rkI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.C94gYIPr.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}\n\n/**\n * @deprecated `Event.keyCode` is deprecated. Use `EventKey` instead\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 lang=\"ts\">\n import type {} from '@floating-ui/vue';\n import { computed, defineComponent, 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';\n\n /**\n * Tooltip container, to be used internally to render the tooltip container where the text is shown.\n */\n export default defineComponent({\n name: 'tooltip',\n components: { BentoTypography, PopperContainer },\n props: {\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 setup(props) {\n const conditionalClasses = computed(() => ({\n [`b-tooltip--${BentoTooltipState.HIDDEN}`]: !props.isShown,\n }));\n\n return {\n // Enums\n PopperContainerAriaRole,\n\n // Values\n conditionalClasses,\n };\n },\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';\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 // Sets the target's tabindex so as to make the tooltip interactive via keyboard navigation\n el.setAttribute('tabindex', '0');\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.content || !el) {\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) {\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 tooltip.isShown = false;\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","_sfc_main","defineComponent","BentoTypography","PopperContainer","value","props","conditionalClasses","computed","PopperContainerAriaRole","tooltipInstances","ariaDescribedByAttr","tooltipId","generateUid","tooltip","open","tooltipProps","reactive","createTooltip","el","TooltipComponent","Vue2","Tooltip","destroyTooltip","getTooltipPosition","binding","getTooltipInstanceForTarget","ctx","showTooltip","tooltipInstance","isDialogOpen","node","nextTick","hideTooltip","_b","_a","_d","_c","tooltipBind","show","hide","listen","evt","tooltipUpdate","position","tooltipUnbind","context","removeListener","BentoTooltipDirective"],"mappings":";;;;;;;;AAOa,MAAAA,IAAA,EAAA,GAAAC,EAAA;AAGD,IAAAC,IAAA,kBAAAC,OACRA,EAAA,SAAA,UADQA,IAAAD,KAAA,CAAA,CAAA,GCCAE,IAAA,kBAAAC,OACRA,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,OAXQA,IAAAD,KAAA,CAAA,CAAA;ACTC,MAAAE,IAAA,EAAA,GAAAL,EAAA;AAGD,IAAAM,IAAA,kBAAAJ,OACRA,EAAA,SAAA,UADQA,IAAAI,KAAA,CAAA,CAAA;AC0BZ,MAAAC,IAAAC,EAAA;AAAA,EAAA,MAAA;AAAA,EACA,YAAA,EAAA,iBAAAC,GAAA,iBAAAC,EAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA,IACA,IAAA,EAAA,MAAA,QAAA,SAAA,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAIA,eAAA,EAAA,MAAA,CAAA,SAAA,MAAA,GAAA,UAAA,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EAAA,QAFAX,EAAA,UAAA,MAaZe,EAAA,aAAAJ,EAAA,KAAA;AACI,YAAAmB,IAAApB,EAAAC,CAAA;AACA,MAAAI,EAAA,WAAAe,GACA9B,EAAA,WAAA8B;AAAA,IAAmB;AAAA,QACvB,CAAA,CAAAf,KAAAJ,EAAA,SAGAa,EAAAnB,GAAAM,CAAA;AAER,GAEAoB,IAAA,CAAA1B,MAAA;AACI,QAAA2B,IAAApB,EAAAP,CAAA;AAGA,EAAA2B,MAIAA,EAAA,gBAAA,QAAA,CAAAC,MAAA;AACI,IAAAA,EAAA;AAAA,EAAe,CAAA,GAKnBd,EAAA,GAEAvB,EAAA,OAAAA,EAAA,QAAAoC,CAAA,GAAA,CAAA,GAIApC,EAAA,WAAA,KACIa,EAAA;AAER,GA4BOyB,IAAA;AAAA;AAAA,EAA8B,KAAA7B,GAAAM,GAAA;AAG7B,IAAAa,EAAAnB,GAAAM,CAAA;AAAA,EAAuB;AAAA,EAC3B,OAAAN,GAAAM,GAAA;AAEI,IAAAkB,EAAAxB,GAAAM,CAAA;AAAA,EAAyB;AAAA,EAC7B,OAAAN,GAAA;AAEI,IAAA0B,EAAA1B,CAAA;AAAA,EAAgB;AAAA;AAAA,EACpB,YAAAA,GAAAM,GAAA;AAGI,IAAAa,EAAAnB,GAAAM,CAAA;AAAA,EAAuB;AAAA,EAC3B,QAAAN,GAAAM,GAAA;AAEI,IAAAkB,EAAAxB,GAAAM,CAAA;AAAA,EAAyB;AAAA,EAC7B,QAAAN,GAAAM,GAAA;AAEI,IAAAkB,EAAAxB,GAAAM,CAAA;AAAA,EAAyB;AAAA,EAC7B,UAAAN,GAAA;AAEI,IAAA0B,EAAA1B,CAAA;AAAA,EAAgB;AAExB;"}
|
|
1
|
+
{"version":3,"file":"tooltip.DOD_4rkI.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}\n\n/**\n * @deprecated `Event.keyCode` is deprecated. Use `EventKey` instead\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 lang=\"ts\">\n import type {} from '@floating-ui/vue';\n import { computed, defineComponent, 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';\n\n /**\n * Tooltip container, to be used internally to render the tooltip container where the text is shown.\n */\n export default defineComponent({\n name: 'tooltip',\n components: { BentoTypography, PopperContainer },\n props: {\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 setup(props) {\n const conditionalClasses = computed(() => ({\n [`b-tooltip--${BentoTooltipState.HIDDEN}`]: !props.isShown,\n }));\n\n return {\n // Enums\n PopperContainerAriaRole,\n\n // Values\n conditionalClasses,\n };\n },\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';\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 // Sets the target's tabindex so as to make the tooltip interactive via keyboard navigation\n el.setAttribute('tabindex', '0');\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.content || !el) {\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) {\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 tooltip.isShown = false;\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","_sfc_main","defineComponent","BentoTypography","PopperContainer","value","props","conditionalClasses","computed","PopperContainerAriaRole","tooltipInstances","ariaDescribedByAttr","tooltipId","generateUid","tooltip","open","tooltipProps","reactive","createTooltip","el","TooltipComponent","Vue2","Tooltip","destroyTooltip","getTooltipPosition","binding","getTooltipInstanceForTarget","ctx","showTooltip","tooltipInstance","isDialogOpen","node","nextTick","hideTooltip","_b","_a","_d","_c","tooltipBind","show","hide","listen","evt","tooltipUpdate","position","tooltipUnbind","context","removeListener","BentoTooltipDirective"],"mappings":";;;;;;;;AAOa,MAAAA,IAAA,EAAA,GAAAC,EAAA;AAGD,IAAAC,IAAA,kBAAAC,OACRA,EAAA,SAAA,UADQA,IAAAD,KAAA,CAAA,CAAA,GCCAE,IAAA,kBAAAC,OACRA,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,OAXQA,IAAAD,KAAA,CAAA,CAAA;ACTC,MAAAE,IAAA,EAAA,GAAAL,EAAA;AAGD,IAAAM,IAAA,kBAAAJ,OACRA,EAAA,SAAA,UADQA,IAAAI,KAAA,CAAA,CAAA;AC0BZ,MAAAC,IAAAC,EAAA;AAAA,EAAA,MAAA;AAAA,EACA,YAAA,EAAA,iBAAAC,GAAA,iBAAAC,EAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA,IACA,IAAA,EAAA,MAAA,QAAA,SAAA,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAIA,eAAA,EAAA,MAAA,CAAA,SAAA,MAAA,GAAA,UAAA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,UAAA;AAAA,MAKA,MAAA;AAAA,MACA,SAAAL,EAAA;AAAA,MACA,WAAA,CAAAM,MAAA,OAAA,OAAAN,CAAA,EAAA,SAAAM,CAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IACA,QAAA,EAAA,MAAA,QAAA,SAAA,EAAA;AAAA;AAAA;AAAA;AAAA,IAMA,SAAA,EAAA,MAAA,QAAA,UAAA,GAAA;AAAA;AAA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,QAAA,CAAAC,MAAA;AACI,IAAAA,EAAA;AAAA,EAAe,CAAA,GAKnBd,EAAA,GAEAvB,EAAA,OAAAA,EAAA,QAAAoC,CAAA,GAAA,CAAA,GAIApC,EAAA,WAAA,KACIa,EAAA;AAER,GA4BOyB,IAAA;AAAA;AAAA,EAA8B,KAAA7B,GAAAM,GAAA;AAG7B,IAAAa,EAAAnB,GAAAM,CAAA;AAAA,EAAuB;AAAA,EAC3B,OAAAN,GAAAM,GAAA;AAEI,IAAAkB,EAAAxB,GAAAM,CAAA;AAAA,EAAyB;AAAA,EAC7B,OAAAN,GAAA;AAEI,IAAA0B,EAAA1B,CAAA;AAAA,EAAgB;AAAA;AAAA,EACpB,YAAAA,GAAAM,GAAA;AAGI,IAAAa,EAAAnB,GAAAM,CAAA;AAAA,EAAuB;AAAA,EAC3B,QAAAN,GAAAM,GAAA;AAEI,IAAAkB,EAAAxB,GAAAM,CAAA;AAAA,EAAyB;AAAA,EAC7B,QAAAN,GAAAM,GAAA;AAEI,IAAAkB,EAAAxB,GAAAM,CAAA;AAAA,EAAyB;AAAA,EAC7B,UAAAN,GAAA;AAEI,IAAA0B,EAAA1B,CAAA;AAAA,EAAgB;AAExB;"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { defineComponent as h, ref as d, computed as a, isRef as F, watch as g, nextTick as $ } from "vue";
|
|
2
|
-
import { B as k, h as I, f as w } from "./
|
|
3
|
-
import { B as S } from "./popover.types.
|
|
2
|
+
import { B as k, h as I, f as w } from "./button-actions.55vIvDsX.js";
|
|
3
|
+
import { B as S } from "./popover.types.iyDoIAOE.js";
|
|
4
4
|
import { B as N } from "./typography.hlOAxsEn.js";
|
|
5
5
|
import { B as A } from "./image.C2D2hKat.js";
|
|
6
6
|
import { u as D } from "./i18n.BQkEbtPM.js";
|
|
7
7
|
import { R as j } from "./refresh.arF7jP-l.js";
|
|
8
8
|
/* empty css */
|
|
9
9
|
import { n as f } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
10
|
-
import { P as b, h as L, o as M } from "./popper-container.
|
|
10
|
+
import { P as b, h as L, o as M } from "./popper-container.C9KCAJxI.js";
|
|
11
11
|
import "../assets/tutorial.css";
|
|
12
12
|
var B;
|
|
13
13
|
const K = /* @__PURE__ */ h({
|
|
@@ -344,4 +344,4 @@ const Ct = lt.exports;
|
|
|
344
344
|
export {
|
|
345
345
|
Ct as t
|
|
346
346
|
};
|
|
347
|
-
//# sourceMappingURL=tutorial.
|
|
347
|
+
//# sourceMappingURL=tutorial.BwnRyUoh.js.map
|