@adyen/bento-vue2 1.55.1 → 1.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/index.d.ts +799 -300
- package/dist/action-bar.js +1 -1
- package/dist/alert.js +1 -1
- package/dist/assets/accordion-item.css +1 -1
- package/dist/assets/action-bar.css +1 -1
- package/dist/assets/base-modal.css +1 -1
- package/dist/assets/button.css +1 -1
- package/dist/assets/card.css +1 -1
- package/dist/assets/code-snippet.css +1 -1
- package/dist/assets/dashed-underline.css +1 -1
- package/dist/assets/data-grid-template.css +1 -1
- package/dist/assets/data-grid.css +1 -1
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/file-uploader.css +1 -1
- package/dist/assets/filter-bar.css +1 -1
- package/dist/assets/input-field-password.css +1 -1
- package/dist/assets/inspector.css +1 -1
- package/dist/assets/menu.css +1 -1
- package/dist/assets/modal-fullscreen.css +1 -1
- package/dist/assets/popover.css +1 -1
- package/dist/assets/sidepanel.css +1 -1
- package/dist/assets/summary-grid.css +1 -1
- package/dist/assets/tabs.css +1 -1
- package/dist/assets/teleport.css +1 -1
- package/dist/assets/timeline-item.css +1 -1
- package/dist/button.js +3 -3
- package/dist/card.js +1 -1
- package/dist/checkbox.js +2 -2
- package/dist/chunks/{action-bar.DQ1JoKzt.js → action-bar.c68S34TI.js} +5 -5
- package/dist/chunks/{action-bar.DQ1JoKzt.js.map → action-bar.c68S34TI.js.map} +1 -1
- package/dist/chunks/{alert.C5Y5RBx9.js → alert.D8qqrobi.js} +2 -2
- package/dist/chunks/{alert.C5Y5RBx9.js.map → alert.D8qqrobi.js.map} +1 -1
- package/dist/chunks/{base-modal.CEHMcrwC.js → base-modal.B9JnRNty.js} +4 -4
- package/dist/chunks/{base-modal.CEHMcrwC.js.map → base-modal.B9JnRNty.js.map} +1 -1
- package/dist/chunks/{button-actions-with-menu.BehknT6F.js → button-actions-with-menu.DhPRdnSt.js} +4 -4
- package/dist/chunks/{button-actions-with-menu.BehknT6F.js.map → button-actions-with-menu.DhPRdnSt.js.map} +1 -1
- package/dist/chunks/{button-actions.C5Dp4DeK.js → button-actions.ZBlB7bp4.js} +2 -2
- package/dist/chunks/{button-actions.C5Dp4DeK.js.map → button-actions.ZBlB7bp4.js.map} +1 -1
- package/dist/chunks/{button.DUApwEu1.js → button.D7K0uXQm.js} +23 -23
- package/dist/chunks/button.D7K0uXQm.js.map +1 -0
- package/dist/chunks/{calendar.C9bRwE-l.js → calendar.CiLR27-B.js} +2 -2
- package/dist/chunks/{calendar.C9bRwE-l.js.map → calendar.CiLR27-B.js.map} +1 -1
- package/dist/chunks/{card.Ba5Jqezr.js → card.CZkqwnNe.js} +2 -2
- package/dist/chunks/{card.Ba5Jqezr.js.map → card.CZkqwnNe.js.map} +1 -1
- package/dist/chunks/{checkbox-group.COqNevz5.js → checkbox-group.C5JSUREN.js} +2 -2
- package/dist/chunks/{checkbox-group.COqNevz5.js.map → checkbox-group.C5JSUREN.js.map} +1 -1
- package/dist/chunks/{checkbox.LFeWM5p4.js → checkbox.DXP-ooRp.js} +17 -17
- package/dist/chunks/{checkbox.LFeWM5p4.js.map → checkbox.DXP-ooRp.js.map} +1 -1
- package/dist/chunks/code-snippet.DhxRuYQ7.js +259 -0
- package/dist/chunks/code-snippet.DhxRuYQ7.js.map +1 -0
- package/dist/chunks/{copy.C7gFAgeL.js → copy.JmRKnqLo.js} +2 -2
- package/dist/chunks/{copy.C7gFAgeL.js.map → copy.JmRKnqLo.js.map} +1 -1
- package/dist/chunks/{dashboard-section.Cn7UfGjF.js → dashboard-section.DJ39VLp3.js} +3 -3
- package/dist/chunks/{dashboard-section.Cn7UfGjF.js.map → dashboard-section.DJ39VLp3.js.map} +1 -1
- package/dist/chunks/dashed-underline.D29Z776j.js +65 -0
- package/dist/chunks/dashed-underline.D29Z776j.js.map +1 -0
- package/dist/chunks/data-grid-template.BrgmYdx9.js +84 -0
- package/dist/chunks/data-grid-template.BrgmYdx9.js.map +1 -0
- package/dist/chunks/{data-grid.C8S9cY5p.js → data-grid.NedqR1ap.js} +987 -959
- package/dist/chunks/data-grid.NedqR1ap.js.map +1 -0
- package/dist/chunks/{date-picker.DPSJvBlj.js → date-picker.2shSM0mi.js} +3 -3
- package/dist/chunks/{date-picker.DPSJvBlj.js.map → date-picker.2shSM0mi.js.map} +1 -1
- package/dist/chunks/{date-range-picker.B03wCOPP.js → date-range-picker.PzjjjdoC.js} +6 -6
- package/dist/chunks/{date-range-picker.B03wCOPP.js.map → date-range-picker.PzjjjdoC.js.map} +1 -1
- package/dist/chunks/{dialog-page.C8iNK4bf.js → dialog-page.BveDXzz1.js} +2 -2
- package/dist/chunks/{dialog-page.C8iNK4bf.js.map → dialog-page.BveDXzz1.js.map} +1 -1
- package/dist/chunks/{dropdown-tag.DUlkje2L.js → dropdown-tag.BuW-M1zn.js} +2 -2
- package/dist/chunks/{dropdown-tag.DUlkje2L.js.map → dropdown-tag.BuW-M1zn.js.map} +1 -1
- package/dist/chunks/{dropdown.DihPVajz.js → dropdown.aeiLxODy.js} +3 -3
- package/dist/chunks/{dropdown.DihPVajz.js.map → dropdown.aeiLxODy.js.map} +1 -1
- package/dist/chunks/{empty-state.aBO3bh4N.js → empty-state.Z97lmDoK.js} +2 -2
- package/dist/chunks/{empty-state.aBO3bh4N.js.map → empty-state.Z97lmDoK.js.map} +1 -1
- package/dist/chunks/es6.BtaxuP0b.js.map +1 -1
- package/dist/chunks/{file-uploader.P_s39Esv.js → file-uploader.DtiNK2cF.js} +340 -315
- package/dist/chunks/file-uploader.DtiNK2cF.js.map +1 -0
- package/dist/chunks/{filter-bar.Djv7J4G1.js → filter-bar.C3-x0K8J.js} +834 -741
- package/dist/chunks/filter-bar.C3-x0K8J.js.map +1 -0
- package/dist/chunks/{fixed-scroller.C7Eug22g.js → fixed-scroller.BJh4fxeV.js} +2 -2
- package/dist/chunks/{fixed-scroller.C7Eug22g.js.map → fixed-scroller.BJh4fxeV.js.map} +1 -1
- package/dist/chunks/{footer-actions.CNNRHYLb.js → footer-actions.Blk5X8z1.js} +3 -3
- package/dist/chunks/{footer-actions.CNNRHYLb.js.map → footer-actions.Blk5X8z1.js.map} +1 -1
- package/dist/chunks/{form-layout-title.C9P21KnX.js → form-layout-title.CbdwXVqj.js} +2 -2
- package/dist/chunks/{form-layout-title.C9P21KnX.js.map → form-layout-title.CbdwXVqj.js.map} +1 -1
- package/dist/chunks/{header-with-views.siHZ-MsA.js → header-with-views.C8yPUp97.js} +12 -12
- package/dist/chunks/{header-with-views.siHZ-MsA.js.map → header-with-views.C8yPUp97.js.map} +1 -1
- package/dist/chunks/{header.BXGTPqZK.js → header.DbB-XuIe.js} +4 -4
- package/dist/chunks/{header.BXGTPqZK.js.map → header.DbB-XuIe.js.map} +1 -1
- package/dist/chunks/{info-icon-with-popover.CdZ1_8hG.js → info-icon-with-popover.CzP2P-pl.js} +2 -2
- package/dist/chunks/{info-icon-with-popover.CdZ1_8hG.js.map → info-icon-with-popover.CzP2P-pl.js.map} +1 -1
- package/dist/chunks/{input-field-password.Dz_8fr0j.js → input-field-password.CbPAafAh.js} +48 -43
- package/dist/chunks/{input-field-password.Dz_8fr0j.js.map → input-field-password.CbPAafAh.js.map} +1 -1
- package/dist/chunks/{input-field-phone-number.CPlRrAGe.js → input-field-phone-number.DAE8TPO4.js} +3 -3
- package/dist/chunks/{input-field-phone-number.CPlRrAGe.js.map → input-field-phone-number.DAE8TPO4.js.map} +1 -1
- package/dist/chunks/{input-field.DcOnDLTc.js → input-field._ceh_k5o.js} +2 -2
- package/dist/chunks/{input-field.DcOnDLTc.js.map → input-field._ceh_k5o.js.map} +1 -1
- package/dist/chunks/{inspector.types.D1m792RZ.js → inspector.types.Cloa1Rnz.js} +2 -2
- package/dist/chunks/{inspector.types.D1m792RZ.js.map → inspector.types.Cloa1Rnz.js.map} +1 -1
- package/dist/chunks/{menu.DFatjXpw.js → menu.BKcBx2qB.js} +17 -16
- package/dist/chunks/{menu.DFatjXpw.js.map → menu.BKcBx2qB.js.map} +1 -1
- package/dist/chunks/{modal-fullscreen._NBj0IXu.js → modal-fullscreen.BwVQfDn1.js} +4 -4
- package/dist/chunks/{modal-fullscreen._NBj0IXu.js.map → modal-fullscreen.BwVQfDn1.js.map} +1 -1
- package/dist/chunks/{modal.CpZzd8fG.js → modal.BL-FWXsY.js} +5 -5
- package/dist/chunks/{modal.CpZzd8fG.js.map → modal.BL-FWXsY.js.map} +1 -1
- package/dist/chunks/{pagination.PQCpgVVF.js → pagination.DHFaDRoD.js} +3 -3
- package/dist/chunks/{pagination.PQCpgVVF.js.map → pagination.DHFaDRoD.js.map} +1 -1
- package/dist/chunks/{popover.BVLuUYSi.js → popover.Bb9JeZVy.js} +3 -3
- package/dist/chunks/{popover.BVLuUYSi.js.map → popover.Bb9JeZVy.js.map} +1 -1
- package/dist/chunks/{promo-banner.C4jiwSeA.js → promo-banner.D5QXTiEH.js} +2 -2
- package/dist/chunks/{promo-banner.C4jiwSeA.js.map → promo-banner.D5QXTiEH.js.map} +1 -1
- package/dist/chunks/{search-bar.BPnYyZ9S.js → search-bar.BxZHV9BD.js} +3 -3
- package/dist/chunks/{search-bar.BPnYyZ9S.js.map → search-bar.BxZHV9BD.js.map} +1 -1
- package/dist/chunks/{secondary-nav.CDykzeRU.js → secondary-nav.BDGDhhEE.js} +2 -2
- package/dist/chunks/{secondary-nav.CDykzeRU.js.map → secondary-nav.BDGDhhEE.js.map} +1 -1
- package/dist/chunks/{selection-card-group.Dj9wWfmY.js → selection-card-group.0nbaCMHW.js} +8 -8
- package/dist/chunks/{selection-card-group.Dj9wWfmY.js.map → selection-card-group.0nbaCMHW.js.map} +1 -1
- package/dist/chunks/{sidepanel.DcBdDgec.js → sidepanel.DMXzlqbw.js} +4 -4
- package/dist/chunks/{sidepanel.DcBdDgec.js.map → sidepanel.DMXzlqbw.js.map} +1 -1
- package/dist/chunks/{structured-list-item.w0GVxwQf.js → structured-list-item.DZ1_vy5W.js} +3 -3
- package/dist/chunks/{structured-list-item.w0GVxwQf.js.map → structured-list-item.DZ1_vy5W.js.map} +1 -1
- package/dist/chunks/summary-grid.types.D-OotxnX.js +301 -0
- package/dist/chunks/summary-grid.types.D-OotxnX.js.map +1 -0
- package/dist/chunks/{tabs.T3A3YNdF.js → tabs.BfL4CUD1.js} +12 -12
- package/dist/chunks/{tabs.T3A3YNdF.js.map → tabs.BfL4CUD1.js.map} +1 -1
- package/dist/chunks/{teleport.5oodkxuB.js → teleport.BV6zrDjA.js} +18 -27
- package/dist/chunks/teleport.BV6zrDjA.js.map +1 -0
- package/dist/chunks/{textarea.CrPdkIGL.js → textarea.BkUzMu8d.js} +2 -2
- package/dist/chunks/{textarea.CrPdkIGL.js.map → textarea.BkUzMu8d.js.map} +1 -1
- package/dist/chunks/timeline-item.DcutETie.js +386 -0
- package/dist/chunks/timeline-item.DcutETie.js.map +1 -0
- package/dist/chunks/{toast.CjJW9t4G.js → toast.BV0qP2AF.js} +2 -2
- package/dist/chunks/{toast.CjJW9t4G.js.map → toast.BV0qP2AF.js.map} +1 -1
- package/dist/chunks/{toggle-button.Dj2uoRyw.js → toggle-button.TDry-9iu.js} +2 -2
- package/dist/chunks/{toggle-button.Dj2uoRyw.js.map → toggle-button.TDry-9iu.js.map} +1 -1
- package/dist/chunks/{tutorial.CTzjDY6m.js → tutorial.AOMH-Jq3.js} +4 -4
- package/dist/chunks/{tutorial.CTzjDY6m.js.map → tutorial.AOMH-Jq3.js.map} +1 -1
- package/dist/chunks/{use-cached-selected-values.D6lOsd0o.js → use-cached-selected-values.DHN-_Me4.js} +4 -4
- package/dist/chunks/{use-cached-selected-values.D6lOsd0o.js.map → use-cached-selected-values.DHN-_Me4.js.map} +1 -1
- package/dist/chunks/use-click-outside.BnhTgpSt.js +14 -0
- package/dist/chunks/use-click-outside.BnhTgpSt.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/form-layout.js +1 -1
- package/dist/header-with-views.js +1 -1
- package/dist/header.js +1 -1
- package/dist/index.js +48 -48
- 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 +9 -9
- package/dist/menu.js +1 -1
- package/dist/modal-fullscreen.js +1 -1
- package/dist/modal.js +2 -2
- package/dist/pagination.js +1 -1
- package/dist/popover.js +1 -1
- package/dist/promo-banner.js +1 -1
- package/dist/search-bar.js +2 -2
- package/dist/secondary-nav.js +1 -1
- package/dist/selection-card.js +1 -1
- package/dist/sidepanel.js +1 -1
- package/dist/structured-list.js +1 -1
- package/dist/styles/bento-dark.css +13 -2
- package/dist/styles/bento-light.css +13 -2
- package/dist/styles/bento.css +13 -2
- package/dist/styles/legacy.css +14 -4
- package/dist/styles/styleguide.css +13 -2
- package/dist/summary-grid.js +1 -1
- package/dist/tabs.js +1 -1
- package/dist/textarea.js +1 -1
- package/dist/timeline.js +1 -1
- package/dist/toast.js +1 -1
- package/dist/tutorial.js +1 -1
- package/dist/web-types.json +291 -99
- package/package.json +8 -5
- package/dist/chunks/button.DUApwEu1.js.map +0 -1
- package/dist/chunks/code-snippet.Q1HB3T_K.js +0 -345
- package/dist/chunks/code-snippet.Q1HB3T_K.js.map +0 -1
- package/dist/chunks/dashed-underline.0K0Xbu6k.js +0 -59
- package/dist/chunks/dashed-underline.0K0Xbu6k.js.map +0 -1
- package/dist/chunks/data-grid-template.Bm08fIsa.js +0 -69
- package/dist/chunks/data-grid-template.Bm08fIsa.js.map +0 -1
- package/dist/chunks/data-grid.C8S9cY5p.js.map +0 -1
- package/dist/chunks/file-uploader.P_s39Esv.js.map +0 -1
- package/dist/chunks/filter-bar.Djv7J4G1.js.map +0 -1
- package/dist/chunks/summary-grid.types.DoD7Ls0O.js +0 -295
- package/dist/chunks/summary-grid.types.DoD7Ls0O.js.map +0 -1
- package/dist/chunks/teleport.5oodkxuB.js.map +0 -1
- package/dist/chunks/timeline-item.B6XTUyr8.js +0 -382
- package/dist/chunks/timeline-item.B6XTUyr8.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teleport.BV6zrDjA.js","sources":["../../src/components/internal/teleport/teleport.vue"],"sourcesContent":["<!-- Taken from: https://github.com/Mechazawa/vue2-teleport/blob/master/src/Teleport.vue -->\n<template>\n <div v-if=\"isVue2\" :class=\"classes\">\n <slot />\n </div>\n <Teleport v-else :to=\"defaultTo\" :where=\"where\" :disabled=\"disabled\" :class=\"classes\">\n <slot />\n </Teleport>\n</template>\n\n<script setup lang=\"ts\">\n import { isVue2 } from 'vue-demi';\n import { defineComponent, inject, PropType } from 'vue';\n import { MODAL_DIALOG_ID_INJECTION_KEY } from '@/components/modal/components/base-modal/base-modal.keys';\n import { SIDEPANEL_DIALOG_ID_INJECTION_KEY } from '@/components/sidepanel/sidepanel.keys';\n import { MODAL_FULLSCREEN_DIALOG_ID_INJECTION_KEY } from '@/components/modal-fullscreen/modal-fullscreen.keys';\n import type { BentoTeleportProps } from './teleport.types';\n</script>\n\n<script lang=\"ts\">\n export default defineComponent({\n name: 'teleport',\n props: {\n to: {\n type: String as PropType<BentoTeleportProps['to']>,\n default: '',\n },\n where: {\n type: String,\n default: 'after',\n },\n disabled: Boolean as PropType<BentoTeleportProps['disabled']>,\n },\n data: () => ({\n childObserver: null,\n nodes: [],\n waiting: false,\n observer: null,\n parent: null,\n isVue2,\n }),\n computed: {\n classes() {\n if (this.disabled) {\n return ['b-teleport'];\n }\n\n return ['b-teleport', 'b-teleport--hidden'];\n },\n defaultTo() {\n if (this.to) {\n return this.to;\n }\n\n const injectionKey =\n inject<string>(MODAL_DIALOG_ID_INJECTION_KEY, '') ||\n inject<string>(MODAL_FULLSCREEN_DIALOG_ID_INJECTION_KEY, '') ||\n inject<string>(SIDEPANEL_DIALOG_ID_INJECTION_KEY, '');\n\n const teleportElement = injectionKey ? `#${injectionKey}` : 'body';\n return teleportElement;\n },\n },\n watch: {\n to: 'maybeMove',\n where: 'maybeMove',\n disabled(value) {\n if (value) {\n this.disable();\n // Ensure all event done.\n this.$nextTick(() => {\n this.teardownObserver();\n });\n } else {\n this.bootObserver();\n this.move();\n }\n },\n },\n mounted() {\n // Store a reference to the nodes\n this.nodes = Array.from(this.$el.childNodes);\n\n if (!this.disabled) {\n this.bootObserver();\n }\n\n // Move slot content to target\n this.maybeMove();\n },\n beforeDestroy() {\n // Fix nodes reference\n this.nodes = this.getComponentChildrenNode();\n\n // Move back\n this.disable();\n\n // Stop observing\n this.teardownObserver();\n },\n methods: {\n // Using a fragment is faster because it'll trigger only a single reflow\n // See https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment\n getFragment(): DocumentFragment {\n const fragment = document.createDocumentFragment();\n\n this.nodes.forEach(node => fragment.appendChild(node));\n\n return fragment;\n },\n disable() {\n this.$el.appendChild(this.getFragment());\n this.parent = null;\n },\n move() {\n this.waiting = false;\n\n this.parent = document.querySelector(this.defaultTo);\n\n if (!this.parent) {\n this.disable();\n\n this.waiting = true;\n\n return;\n }\n\n if (this.where === 'before') {\n this.parent.prepend(this.getFragment());\n } else {\n this.parent.appendChild(this.getFragment());\n }\n },\n maybeMove() {\n if (!this.disabled) {\n this.move();\n }\n },\n onMutations(mutations) {\n // Makes sure the move operation is only done once\n let shouldMove = false;\n\n for (let i = 0; i < mutations.length; i++) {\n const mutation = mutations[i];\n const filteredAddedNodes = Array.from(mutation.addedNodes).filter(\n node => !this.nodes.includes(node)\n );\n\n if (Array.from(mutation.removedNodes).includes(this.parent)) {\n this.disable();\n this.waiting = !this.disabled;\n } else if (this.waiting && filteredAddedNodes.length > 0) {\n shouldMove = true;\n }\n }\n\n if (shouldMove) {\n this.move();\n }\n },\n bootObserver() {\n if (this.observer) {\n return;\n }\n\n this.observer = new MutationObserver(mutations => this.onMutations(mutations));\n\n this.observer.observe(document.body, {\n childList: true,\n subtree: true,\n attributes: false,\n characterData: false,\n });\n\n if (this.childObserver) {\n return;\n }\n // watch childNodes change\n this.childObserver = new MutationObserver(mutations => {\n const childChangeRecord = mutations.find(i => i.target === this.$el);\n if (childChangeRecord) {\n // Remove old nodes before update position.\n this.nodes.forEach(node => node.parentNode && node.parentNode.removeChild(node));\n this.nodes = this.getComponentChildrenNode();\n this.maybeMove();\n }\n });\n\n this.childObserver.observe(this.$el, {\n childList: true,\n subtree: false,\n attributes: false,\n characterData: false,\n });\n },\n teardownObserver() {\n if (this.observer) {\n this.observer.disconnect();\n this.observer = null;\n }\n if (this.childObserver) {\n this.childObserver.disconnect();\n this.childObserver = null;\n }\n },\n getComponentChildrenNode() {\n // Vue3\n if (!isVue2) {\n return [];\n }\n\n // Trick for Vue3 type checking\n return (this as any).$vnode.componentOptions.children.map(i => i.elm).filter(i => i);\n },\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./teleport.scss\" />\n"],"names":["__default__","defineComponent","isVue2","injectionKey","inject","MODAL_DIALOG_ID_INJECTION_KEY","MODAL_FULLSCREEN_DIALOG_ID_INJECTION_KEY","SIDEPANEL_DIALOG_ID_INJECTION_KEY","value","fragment","node","mutations","shouldMove","i","mutation","filteredAddedNodes"],"mappings":";;;;;;;AAoBI,MAAAA,IAAAC,EAAA;AAAA,EAA+B,MAAA;AAAA,EACrB,OAAA;AAAA,IACC,IAAA;AAAA,MACC,MAAA;AAAA,MACM,SAAA;AAAA,IACG;AAAA,IACb,OAAA;AAAA,MACO,MAAA;AAAA,MACG,SAAA;AAAA,IACG;AAAA,IACb,UAAA;AAAA,EACU;AAAA,EACd,MAAA,OAAA;AAAA,IACa,eAAA;AAAA,IACM,OAAA,CAAA;AAAA,IACP,SAAA;AAAA,IACC,UAAA;AAAA,IACC,QA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;AAAA,MACG,CAAA;AAAA,IAClB;AAAA,IACL,mBAAA;AAEI,MAAA,KAAA,aACI,KAAA,SAAA,WAAA,GACA,KAAA,WAAA,OAEJ,KAAA,kBACI,KAAA,cAAA,WAAA,GACA,KAAA,gBAAA;AAAA,IACJ;AAAA,IACJ,2BAAA;AAQI,aAAA,KAAA,OAAA,iBAAA,SAAA,IAAA,CAAAG,MAAAA,EAAA,GAAA,EAAA,OAAA,CAAAA,MAAAA,CAAA;AAAA,IAAmF;AAAA,EACvF;AAER,CAAA;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as X, useAttrs as ee, toRefs as U, ref as p, toRef as ae, computed as u, watch as E, nextTick as te, onMounted as le, onUnmounted as re } from "vue";
|
|
2
|
-
import { B as oe } from "./button.
|
|
2
|
+
import { B as oe } from "./button.D7K0uXQm.js";
|
|
3
3
|
import { B as se } from "./typography.J1v_SPG3.js";
|
|
4
4
|
import { C as ne } from "./cross-circle-fill-small.YhLgeipP.js";
|
|
5
5
|
import { g as ie } from "./generate-uid.NJ8tVoha.js";
|
|
@@ -197,4 +197,4 @@ const Pe = ge.exports;
|
|
|
197
197
|
export {
|
|
198
198
|
Pe as B
|
|
199
199
|
};
|
|
200
|
-
//# sourceMappingURL=textarea.
|
|
200
|
+
//# sourceMappingURL=textarea.BkUzMu8d.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.CrPdkIGL.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 :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 >\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, 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 // 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 textareaWrapperWidth = ref('100%'); // The width set to the wrapper of the label, textarea and description\n let textareaElementObserver: ResizeObserver | null = null;\n let textareaComponentObserver: ResizeObserver | null = null;\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n const counter = computed(() => `${textareaValue.value.length} / ${props.characterLimit}`);\n const isOverCharacterLimit = computed(\n () => props.characterLimit && textareaValue.value.length > props.characterLimit\n );\n\n const calculateHeight = () => {\n const borderWidth = 3;\n if (textareaElement.value && textareaElement.value.scrollHeight > defaultTextareaHeight) {\n textareaHeight.value = `${textareaElement.value.scrollHeight + borderWidth}px`;\n }\n };\n\n watch(height, () => {\n if (!height.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 // Auto-adjust height if the text area is overflowing\n if (\n !height.value &&\n (!textareaElement.value || textareaElement.value?.scrollHeight > textareaElement.value?.clientHeight)\n ) {\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`]: !height.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 /**\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 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 (!height.value) {\n calculateHeight();\n }\n });\n\n onUnmounted(() => {\n textareaElementObserver?.disconnect();\n textareaComponentObserver?.disconnect();\n });\n</script>\n\n<script lang=\"ts\">\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","__default__","messages","attrs","useAttrs","height","toRefs","props","textareaId","generateUid","textareaElement","ref","textareaComponent","textareaValue","defaultTextareaHeight","textareaHeight","textareaWrapperWidth","textareaElementObserver","textareaComponentObserver","t","useI18n","isReadOnly","useFormLayoutFieldLoading","toRef","counter","computed","isOverCharacterLimit","calculateHeight","watch","_a","_b","nextTick","invalidInput","conditionalClasses","conditionalClassesInput","conditionalClassesLabelBox","conditionalClassesLabelItem","counterErrorText","ariaLabelAttribute","ariaLabel","label","computedAriaLabel","useAriaLabel","showClearButton","onClear","emit","onInput","event","onBlur","onFocus","onChange","onPressEscape","onKeyDown","onKeyUp","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,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AGJE,IAAA,MAAA;AACI,MAAAhD,EAAA,MAAA,MAAA;AAAA,IAA4B;AAGhC,WAAAiD,EAAA;AAAA,MAAa,OAAAD;AAAA,IACT,CAAA,GAGJE,GAAA,MAAA;AACI,MAAA3C,IAAA4C,EAAAnD,EAAA,OAAA,MAAA;AACI,QAAA4C,EAAA,EAAA;AAAA,MAA0B,CAAA,GAG9BpC,IAAA2C,EAAAjD,EAAA,OAAA,MAAA;AACI,QAAA0C,EAAA;AAAA,MAAsB,CAAA,GAG1BjD,EAAA,SACIsB,EAAA;AAAA,IACJ,CAAA,GAGJmC,GAAA,MAAA;AACI,MAAA7C,KAAA,QAAAA,EAAA,cACAC,KAAA,QAAAA,EAAA;AAAA,IAAsC,CAAA;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"textarea.BkUzMu8d.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 :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 >\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, 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 // 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 textareaWrapperWidth = ref('100%'); // The width set to the wrapper of the label, textarea and description\n let textareaElementObserver: ResizeObserver | null = null;\n let textareaComponentObserver: ResizeObserver | null = null;\n\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n const counter = computed(() => `${textareaValue.value.length} / ${props.characterLimit}`);\n const isOverCharacterLimit = computed(\n () => props.characterLimit && textareaValue.value.length > props.characterLimit\n );\n\n const calculateHeight = () => {\n const borderWidth = 3;\n if (textareaElement.value && textareaElement.value.scrollHeight > defaultTextareaHeight) {\n textareaHeight.value = `${textareaElement.value.scrollHeight + borderWidth}px`;\n }\n };\n\n watch(height, () => {\n if (!height.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 // Auto-adjust height if the text area is overflowing\n if (\n !height.value &&\n (!textareaElement.value || textareaElement.value?.scrollHeight > textareaElement.value?.clientHeight)\n ) {\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`]: !height.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 /**\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 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 (!height.value) {\n calculateHeight();\n }\n });\n\n onUnmounted(() => {\n textareaElementObserver?.disconnect();\n textareaComponentObserver?.disconnect();\n });\n</script>\n\n<script lang=\"ts\">\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","__default__","messages","attrs","useAttrs","height","toRefs","props","textareaId","generateUid","textareaElement","ref","textareaComponent","textareaValue","defaultTextareaHeight","textareaHeight","textareaWrapperWidth","textareaElementObserver","textareaComponentObserver","t","useI18n","isReadOnly","useFormLayoutFieldLoading","toRef","counter","computed","isOverCharacterLimit","calculateHeight","watch","_a","_b","nextTick","invalidInput","conditionalClasses","conditionalClassesInput","conditionalClassesLabelBox","conditionalClassesLabelItem","counterErrorText","ariaLabelAttribute","ariaLabel","label","computedAriaLabel","useAriaLabel","showClearButton","onClear","emit","onInput","event","onBlur","onFocus","onChange","onPressEscape","onKeyDown","onKeyUp","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;;;;;;;GCsXRE,KAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,GAAA;AAAA,EACM,MAAA;AAErB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA3SAC,IAAAC,GAAA,GAqFA,EAAA,QAAAC,EAAA,IAAAC,EAAAC,CAAA,GAEAC,IAAAC,GAAA,UAAA,GACAC,IAAAC,EAAA,IAAA,GACAC,IAAAD,EAAA,IAAA,GACAE,IAAAF,EAAAJ,EAAA,KAAA,GACAO,IAAA,IACAC,IAAAJ,EAAAJ,EAAA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A7C,KAAA,QAAAA,EAAA,cACAC,KAAA,QAAAA,EAAA;AAAA,IAAsC,CAAA;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { defineComponent as P, computed as r, ref as T, toRefs as Z, provide as R, nextTick as G, inject as D, onUnmounted as Q } from "vue";
|
|
2
|
+
import { B as z } from "./button.D7K0uXQm.js";
|
|
3
|
+
import { B as X } from "./textarea.BkUzMu8d.js";
|
|
4
|
+
import { u as H } from "./i18n.BQkEbtPM.js";
|
|
5
|
+
import { B as ee } from "./button-actions.ZBlB7bp4.js";
|
|
6
|
+
import { n as x } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
|
|
7
|
+
import { B as te } from "./date.dYFFEunA.js";
|
|
8
|
+
import { B as ie } from "./link.BH3eB_7E.js";
|
|
9
|
+
import { B as ae } from "./tag.C7ATWnRW.js";
|
|
10
|
+
import { B as se, d as ne } from "./typography.J1v_SPG3.js";
|
|
11
|
+
import { a as oe, B as re, S as le } from "./structured-list-item.DZ1_vy5W.js";
|
|
12
|
+
/* empty css */
|
|
13
|
+
import { g as me } from "./generate-uid.NJ8tVoha.js";
|
|
14
|
+
import { u as ce } from "./use-has-slot.C9lQZ6nz.js";
|
|
15
|
+
import { r as de, l as ue, t as M, a as B } from "./get-date-locale.BN8xEjY0.js";
|
|
16
|
+
import { c as _e } from "./index.DD7TppDb.js";
|
|
17
|
+
import { c as ve } from "./index.BxBB1rsx.js";
|
|
18
|
+
import "../assets/timeline-item.css";
|
|
19
|
+
var $ = 1e3 * 60, A = 60 * 24, j = A * 30, F = A * 365;
|
|
20
|
+
function U(t, e) {
|
|
21
|
+
var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
22
|
+
de(2, arguments);
|
|
23
|
+
var s = i.locale || ue;
|
|
24
|
+
if (!s.formatDistance)
|
|
25
|
+
throw new RangeError("locale must contain localize.formatDistance property");
|
|
26
|
+
var f = _e(t, e);
|
|
27
|
+
if (isNaN(f))
|
|
28
|
+
throw new RangeError("Invalid time value");
|
|
29
|
+
var l = ve(i);
|
|
30
|
+
l.addSuffix = !!i.addSuffix, l.comparison = f;
|
|
31
|
+
var p, _;
|
|
32
|
+
f > 0 ? (p = M(e), _ = M(t)) : (p = M(t), _ = M(e));
|
|
33
|
+
var c = i.roundingMethod == null ? "round" : String(i.roundingMethod), a;
|
|
34
|
+
if (c === "floor")
|
|
35
|
+
a = Math.floor;
|
|
36
|
+
else if (c === "ceil")
|
|
37
|
+
a = Math.ceil;
|
|
38
|
+
else if (c === "round")
|
|
39
|
+
a = Math.round;
|
|
40
|
+
else
|
|
41
|
+
throw new RangeError("roundingMethod must be 'floor', 'ceil' or 'round'");
|
|
42
|
+
var b = _.getTime() - p.getTime(), d = b / $, m = B(_) - B(p), u = (b - m) / $, n;
|
|
43
|
+
if (i.unit == null ? d < 1 ? n = "second" : d < 60 ? n = "minute" : d < A ? n = "hour" : u < j ? n = "day" : u < F ? n = "month" : n = "year" : n = String(i.unit), n === "second") {
|
|
44
|
+
var g = a(b / 1e3);
|
|
45
|
+
return s.formatDistance("xSeconds", g, l);
|
|
46
|
+
} else if (n === "minute") {
|
|
47
|
+
var C = a(d);
|
|
48
|
+
return s.formatDistance("xMinutes", C, l);
|
|
49
|
+
} else if (n === "hour") {
|
|
50
|
+
var E = a(d / 60);
|
|
51
|
+
return s.formatDistance("xHours", E, l);
|
|
52
|
+
} else if (n === "day") {
|
|
53
|
+
var I = a(u / A);
|
|
54
|
+
return s.formatDistance("xDays", I, l);
|
|
55
|
+
} else if (n === "month") {
|
|
56
|
+
var N = a(u / j);
|
|
57
|
+
return N === 12 && i.unit !== "month" ? s.formatDistance("xYears", 1, l) : s.formatDistance("xMonths", N, l);
|
|
58
|
+
} else if (n === "year") {
|
|
59
|
+
var y = a(u / F);
|
|
60
|
+
return s.formatDistance("xYears", y, l);
|
|
61
|
+
}
|
|
62
|
+
throw new RangeError("unit must be 'second', 'minute', 'hour', 'day', 'month' or 'year'");
|
|
63
|
+
}
|
|
64
|
+
var w = /* @__PURE__ */ ((t) => (t.BOTTOM = "bottom", t.AFTER_FIRST = "after-first", t.BEFORE_LAST = "before-last", t))(w || {}), fe = /* @__PURE__ */ ((t) => (t.SECOND = "second", t.MINUTE = "minute", t.HOUR = "hour", t.DAY = "day", t.MONTH = "month", t.YEAR = "year", t))(fe || {}), L = /* @__PURE__ */ ((t) => (t.DEFAULT = "SquareSmallIcon", t.SUCCESS = "CheckedCircleIcon", t.CRITICAL = "CrossCircleIcon", t))(L || {}), q = /* @__PURE__ */ ((t) => (t.BLACK = "black", t.BLUE = "blue", t.GREEN = "green", t.GREY = "grey", t.ORANGE = "orange", t.RED = "red", t.YELLOW = "yellow", t))(q || {});
|
|
65
|
+
const J = Symbol("timeline register entry injection key"), K = Symbol("timeline config obj injection key"), pe = {
|
|
66
|
+
"en-US": {
|
|
67
|
+
addNote: "Add note",
|
|
68
|
+
cancel: "Cancel"
|
|
69
|
+
},
|
|
70
|
+
"ja-JP": {
|
|
71
|
+
addNote: "メモを追加",
|
|
72
|
+
cancel: "キャンセル"
|
|
73
|
+
},
|
|
74
|
+
"pt-BR": {
|
|
75
|
+
addNote: "Adicionar anotação",
|
|
76
|
+
cancel: "Cancelar"
|
|
77
|
+
}
|
|
78
|
+
}, be = P({
|
|
79
|
+
i18n: { messages: pe },
|
|
80
|
+
name: "bento-timeline",
|
|
81
|
+
components: { BentoButton: z, BentoButtonActions: ee, BentoTextarea: X },
|
|
82
|
+
props: {
|
|
83
|
+
/**
|
|
84
|
+
* If set to true, gives the possibility to manually add notes to the timeline via a textarea
|
|
85
|
+
*/
|
|
86
|
+
addNote: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: !1
|
|
89
|
+
},
|
|
90
|
+
/**
|
|
91
|
+
* Object that determines the max number of items to show without clicking the show more button
|
|
92
|
+
* and where in the timeline is the show more button placed
|
|
93
|
+
*/
|
|
94
|
+
showMore: {
|
|
95
|
+
type: Object,
|
|
96
|
+
default: null
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* Object that determines minimum amount of time for the automatic timegap indicator;
|
|
100
|
+
* Define a unit (hour, day, month) and an amount (e.g. { amount: 7, unit: 'days' }).
|
|
101
|
+
* If null, automatic timegap detection will be turned off
|
|
102
|
+
*/
|
|
103
|
+
timegapLimit: {
|
|
104
|
+
type: Object,
|
|
105
|
+
default: null
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
emits: ["add-timeline-note"],
|
|
109
|
+
setup(t, { emit: e }) {
|
|
110
|
+
const { t: i } = H(), s = r(() => i("addNote")), f = r(() => i("cancel")), l = T(), p = (o) => {
|
|
111
|
+
l.value = o;
|
|
112
|
+
}, _ = T(null), c = T(null), a = T(!1), b = async () => {
|
|
113
|
+
var o, v;
|
|
114
|
+
a.value = !a.value, await G(), a.value ? (o = _.value.$refs.textareaElement) == null || o.focus() : (v = c.value.$el) == null || v.focus();
|
|
115
|
+
}, d = () => {
|
|
116
|
+
e("add-timeline-note", {
|
|
117
|
+
description: l.value,
|
|
118
|
+
timestamp: { date: /* @__PURE__ */ new Date() },
|
|
119
|
+
type: "note"
|
|
120
|
+
}), b();
|
|
121
|
+
}, m = T([]), u = r(
|
|
122
|
+
() => t.showMore && m.value.length > t.showMore.limit ? m.value.length - t.showMore.limit : null
|
|
123
|
+
), n = T(!1), { timegapLimit: g } = Z(t), C = r(() => {
|
|
124
|
+
if (!t.showMore)
|
|
125
|
+
return null;
|
|
126
|
+
const o = Array.from(m.value.keys());
|
|
127
|
+
return t.showMore.placement === w.BEFORE_LAST ? [
|
|
128
|
+
...o.slice(0, t.showMore.limit - 1),
|
|
129
|
+
o[o.length - 1]
|
|
130
|
+
] : t.showMore.placement === w.AFTER_FIRST ? [o[0], ...o.slice(-(t.showMore.limit - 1))] : o.slice(0, t.showMore.limit);
|
|
131
|
+
}), E = r(() => {
|
|
132
|
+
if (!t.showMore)
|
|
133
|
+
return null;
|
|
134
|
+
switch (t.showMore.placement) {
|
|
135
|
+
case w.BEFORE_LAST:
|
|
136
|
+
return t.showMore.limit - 2;
|
|
137
|
+
case w.AFTER_FIRST:
|
|
138
|
+
return 0;
|
|
139
|
+
case w.BOTTOM:
|
|
140
|
+
default:
|
|
141
|
+
return t.showMore.limit - 1;
|
|
142
|
+
}
|
|
143
|
+
}), I = (o) => () => {
|
|
144
|
+
var v;
|
|
145
|
+
m.value = (v = m.value) == null ? void 0 : v.filter((S, h) => h !== o);
|
|
146
|
+
}, N = ({ title: o, description: v, date: S }) => {
|
|
147
|
+
const h = m.value.length;
|
|
148
|
+
return m.value.push({ title: o, description: v, date: S }), { timelineEntries: m, index: h, unregisterTimelineEntry: I(h) };
|
|
149
|
+
}, y = {
|
|
150
|
+
showAll: n,
|
|
151
|
+
showMoreIndex: E,
|
|
152
|
+
hiddenItems: u,
|
|
153
|
+
visibleIndexes: C,
|
|
154
|
+
timegapLimit: g
|
|
155
|
+
};
|
|
156
|
+
return R(J, N), R(K, y), {
|
|
157
|
+
addNoteLabel: s,
|
|
158
|
+
cancelLabel: f,
|
|
159
|
+
toggleAddNote: b,
|
|
160
|
+
updateNoteContent: p,
|
|
161
|
+
addNoteToTimeline: d,
|
|
162
|
+
showAddNoteTextArea: a,
|
|
163
|
+
// refs
|
|
164
|
+
addNoteTextareaRef: _,
|
|
165
|
+
addNoteButtonRef: c
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
var he = function() {
|
|
170
|
+
var e = this, i = e._self._c;
|
|
171
|
+
return e._self._setupProxy, i("div", { staticClass: "b-timeline" }, [e.addNote ? i("div", { staticClass: "b-timeline__add-note-section" }, [e.showAddNoteTextArea ? e._e() : i("bento-button", { ref: "addNoteButtonRef", attrs: { variant: "tertiary" }, on: { click: e.toggleAddNote } }, [e._v(e._s(e.addNoteLabel))]), e.showAddNoteTextArea ? i("div", [i("bento-textarea", { ref: "addNoteTextareaRef", attrs: { label: e.addNoteLabel, "character-limit": 150, resizable: "vertical" }, on: { input: e.updateNoteContent } }), i("bento-button-actions", { attrs: { actions: [
|
|
172
|
+
{ title: e.addNoteLabel, event: e.addNoteToTimeline },
|
|
173
|
+
{ title: e.cancelLabel, event: e.toggleAddNote }
|
|
174
|
+
] } })], 1) : e._e()], 1) : e._e(), i("ol", { staticClass: "b-timeline__items" }, [e._t("default")], 2)]);
|
|
175
|
+
}, ge = [], ye = /* @__PURE__ */ x(
|
|
176
|
+
be,
|
|
177
|
+
he,
|
|
178
|
+
ge,
|
|
179
|
+
!1,
|
|
180
|
+
null,
|
|
181
|
+
"4e0a6d68"
|
|
182
|
+
);
|
|
183
|
+
const Ve = ye.exports;
|
|
184
|
+
let Y = 0;
|
|
185
|
+
const Ce = {
|
|
186
|
+
beforeCreate() {
|
|
187
|
+
this.uuid = Y.toString(), Y += 1;
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
var Ne = function() {
|
|
191
|
+
var e = this, i = e._self._c;
|
|
192
|
+
return i("svg", e._b({ staticClass: "ui-assets-icons-16", attrs: { role: "img", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "none" } }, "svg", e.$attrs, !1), [e.$attrs["svg-title"] ? i("title", [e._v(e._s(e.$attrs["svg-title"]))]) : e._e(), i("path", { attrs: { fill: "#00112C", d: "M5.5 3.25C4.25736 3.25 3.25 4.25736 3.25 5.5V10.5C3.25 11.7426 4.25736 12.75 5.5 12.75H10.5C11.7426 12.75 12.75 11.7426 12.75 10.5V5.5C12.75 4.25736 11.7426 3.25 10.5 3.25H5.5Z" } })]);
|
|
193
|
+
}, Te = [], we = /* @__PURE__ */ x(
|
|
194
|
+
Ce,
|
|
195
|
+
Ne,
|
|
196
|
+
Te,
|
|
197
|
+
!1,
|
|
198
|
+
null,
|
|
199
|
+
null
|
|
200
|
+
);
|
|
201
|
+
const Ee = we.exports, Ie = {
|
|
202
|
+
"en-US": {
|
|
203
|
+
showLess: "Show less",
|
|
204
|
+
showMore: "Show {items} more",
|
|
205
|
+
timegap: "{timegap} passed between the timeline events"
|
|
206
|
+
},
|
|
207
|
+
"ja-JP": {
|
|
208
|
+
showLess: "表示内容を減らす"
|
|
209
|
+
},
|
|
210
|
+
"pt-BR": {
|
|
211
|
+
showLess: "Mostrar menos"
|
|
212
|
+
}
|
|
213
|
+
}, Se = P({
|
|
214
|
+
name: "bento-timeline-item",
|
|
215
|
+
components: {
|
|
216
|
+
BentoButton: z,
|
|
217
|
+
BentoDate: te,
|
|
218
|
+
BentoLink: ie,
|
|
219
|
+
BentoTag: ae,
|
|
220
|
+
BentoTypography: se,
|
|
221
|
+
BentoStructuredList: re,
|
|
222
|
+
BentoStructuredListItem: oe,
|
|
223
|
+
SquareSmallIcon: Ee
|
|
224
|
+
},
|
|
225
|
+
i18n: { messages: Ie },
|
|
226
|
+
props: {
|
|
227
|
+
/**
|
|
228
|
+
* Additional timestamp of the event
|
|
229
|
+
*/
|
|
230
|
+
additionalTimestamp: {
|
|
231
|
+
type: Object,
|
|
232
|
+
default: null
|
|
233
|
+
},
|
|
234
|
+
/**
|
|
235
|
+
* Relevant key-value pair data to display in the event
|
|
236
|
+
*/
|
|
237
|
+
dataList: {
|
|
238
|
+
type: Array,
|
|
239
|
+
default: null
|
|
240
|
+
},
|
|
241
|
+
/**
|
|
242
|
+
* Description of the event
|
|
243
|
+
*/
|
|
244
|
+
description: {
|
|
245
|
+
type: String,
|
|
246
|
+
default: null
|
|
247
|
+
},
|
|
248
|
+
/**
|
|
249
|
+
* Modifier that changes the color of the timeline icon
|
|
250
|
+
* @values blue, black, green, grey, orange, red, yellow
|
|
251
|
+
*/
|
|
252
|
+
status: {
|
|
253
|
+
type: String,
|
|
254
|
+
default: "black",
|
|
255
|
+
validator: (t) => Object.values(q).includes(t)
|
|
256
|
+
},
|
|
257
|
+
/**
|
|
258
|
+
* Tag props that will be passed down to inner tag component
|
|
259
|
+
*/
|
|
260
|
+
tag: {
|
|
261
|
+
type: Object,
|
|
262
|
+
default: void 0
|
|
263
|
+
},
|
|
264
|
+
/**
|
|
265
|
+
* Main timestamp of the event. Used for timegap detection.
|
|
266
|
+
*/
|
|
267
|
+
timestamp: {
|
|
268
|
+
type: Object,
|
|
269
|
+
required: !0
|
|
270
|
+
},
|
|
271
|
+
/**
|
|
272
|
+
* Title of the event
|
|
273
|
+
*/
|
|
274
|
+
title: {
|
|
275
|
+
type: [Object, String],
|
|
276
|
+
default: null
|
|
277
|
+
},
|
|
278
|
+
/**
|
|
279
|
+
* Type of the timeline item. If set to 'note', it renders a note item in the timeline. Defaults to 'milestone'.
|
|
280
|
+
* @values milestone, note
|
|
281
|
+
*/
|
|
282
|
+
type: {
|
|
283
|
+
type: String,
|
|
284
|
+
default: "milestone",
|
|
285
|
+
validator: (t) => ["milestone", "note"].includes(t)
|
|
286
|
+
},
|
|
287
|
+
/**
|
|
288
|
+
* Variant for the timeline item
|
|
289
|
+
* @values DEFAULT, SUCCESS, CRITICAL
|
|
290
|
+
*
|
|
291
|
+
* @deprecated Use "status" prop instead
|
|
292
|
+
*/
|
|
293
|
+
variant: {
|
|
294
|
+
type: String,
|
|
295
|
+
default: null,
|
|
296
|
+
validator: (t) => Object.values(L).includes(t)
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
setup(t, { slots: e }) {
|
|
300
|
+
const { t: i } = H(), s = r(() => t.type === "note"), f = r(() => t.variant === L.CRITICAL ? "red" : t.variant === L.SUCCESS ? "green" : t.status);
|
|
301
|
+
t.variant && ne(
|
|
302
|
+
'BentoTimelineItem "variant" property',
|
|
303
|
+
`Use the BentoTimelineItem "status" modifier instead to modify the color of the timeline icon.
|
|
304
|
+
<bento-timeline-item status="red" />`,
|
|
305
|
+
"2.0.0"
|
|
306
|
+
);
|
|
307
|
+
const l = r(() => ({
|
|
308
|
+
[`b-timeline-item__icon--${f.value}`]: f.value && !s.value
|
|
309
|
+
})), p = r(() => ({
|
|
310
|
+
"b-timeline-item--note": s.value
|
|
311
|
+
}));
|
|
312
|
+
R(le, !0);
|
|
313
|
+
const _ = D(J), { timelineEntries: c, index: a, unregisterTimelineEntry: b } = _({
|
|
314
|
+
title: t.title,
|
|
315
|
+
date: t.timestamp.date
|
|
316
|
+
});
|
|
317
|
+
Q(() => b());
|
|
318
|
+
const { showAll: d, showMoreIndex: m, hiddenItems: u, visibleIndexes: n, timegapLimit: g } = D(K), C = r(() => d.value || !n.value), E = r(() => C.value ? !0 : n.value.includes(a)), I = r(() => typeof t.title == "object"), N = r(() => t.title), y = r(() => {
|
|
319
|
+
var k;
|
|
320
|
+
if (!g.value)
|
|
321
|
+
return null;
|
|
322
|
+
const h = (k = c.value[a - 1]) == null ? void 0 : k.date, V = C.value || n.value.includes(a - 1);
|
|
323
|
+
if (!h || !V)
|
|
324
|
+
return null;
|
|
325
|
+
const { date: O } = c.value[a], W = parseInt(
|
|
326
|
+
U(h, O, { unit: g.value.unit }),
|
|
327
|
+
10
|
|
328
|
+
);
|
|
329
|
+
return g.value.amount < W ? U(h, O, { roundingMethod: "floor" }) : null;
|
|
330
|
+
}), o = r(() => y.value ? i("timegap", { timegap: y.value }) : ""), v = r(() => u.value && m.value === a), S = r(() => a === c.value.length - 1);
|
|
331
|
+
return {
|
|
332
|
+
// Values
|
|
333
|
+
isNoteType: s,
|
|
334
|
+
iconConditionalClasses: l,
|
|
335
|
+
conditionalClasses: p,
|
|
336
|
+
displayShowMoreButton: v,
|
|
337
|
+
showAll: d,
|
|
338
|
+
hiddenItems: u,
|
|
339
|
+
isVisible: E,
|
|
340
|
+
isLinkTitle: I,
|
|
341
|
+
linkTitleProps: N,
|
|
342
|
+
timegap: y,
|
|
343
|
+
timegapAriaLabel: o,
|
|
344
|
+
isLastItem: S,
|
|
345
|
+
// Methods
|
|
346
|
+
generateUid: me,
|
|
347
|
+
hasSlot: ce(e),
|
|
348
|
+
t: i
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
var Me = function() {
|
|
353
|
+
var e = this, i = e._self._c;
|
|
354
|
+
return e._self._setupProxy, e.isVisible ? i("li", { staticClass: "b-timeline-item", class: e.conditionalClasses }, [e.timegap ? i("div", { staticClass: "b-timeline-item__row" }, [e._m(0), i("div", { staticClass: "b-timeline-item__content" }, [i("bento-typography", { staticClass: "b-timeline-item__timegap", attrs: { "aria-label": e.timegapAriaLabel } }, [e._v(" " + e._s(e.timegap) + " ")])], 1)]) : e._e(), i("div", { staticClass: "b-timeline-item__row" }, [i("div", { staticClass: "b-timeline-item__marker", attrs: { "aria-hidden": "true" } }, [i("square-small-icon", { staticClass: "b-timeline-item__icon", class: e.iconConditionalClasses }), e.isLastItem ? e._e() : i("div", { staticClass: "b-timeline-item__separator", attrs: { "data-testid": "last-timeline-item-separator" } })], 1), i("div", { staticClass: "b-timeline-item__content" }, [e.isNoteType ? e._e() : i("bento-typography", { staticClass: "b-timeline-item__title", attrs: { el: "div", variant: "body", strongest: "", role: "heading", "aria-level": "2" } }, [e.isLinkTitle ? i("bento-link", e._b({ attrs: { "disable-typography": "" } }, "bento-link", e.linkTitleProps, !1), [e._v(e._s(e.linkTitleProps.title))]) : i("span", [e._v(e._s(e.title))])], 1), e.isNoteType && (e.description || e.hasSlot("default")) ? i("bento-typography", { staticClass: "b-timeline-item__description", attrs: { el: "div", variant: "body" } }, [e._t("default", function() {
|
|
355
|
+
return [e._v(e._s(e.description))];
|
|
356
|
+
})], 2) : e._e(), e.timestamp ? i("bento-typography", { staticClass: "b-timeline-item__timestamp", attrs: { el: "div", variant: "caption" } }, [i("bento-date", { attrs: { date: e.timestamp.date, format: e.timestamp.format, "disable-typography": "" } }), e._v(" " + e._s(e.timestamp.value) + " ")], 1) : e._e(), !e.isNoteType && e.additionalTimestamp ? i("bento-typography", { staticClass: "b-timeline-item__timestamp", attrs: { el: "div", variant: "caption" } }, [i("bento-date", { attrs: { date: e.additionalTimestamp.date, format: e.additionalTimestamp.format, "disable-typography": "" } }), e._v(" " + e._s(e.additionalTimestamp.value) + " ")], 1) : e._e(), !e.isNoteType && (e.description || e.hasSlot("default")) ? i("bento-typography", { staticClass: "b-timeline-item__description", attrs: { el: "div", variant: "body" } }, [e._t("default", function() {
|
|
357
|
+
return [e._v(e._s(e.description))];
|
|
358
|
+
})], 2) : e._e(), !e.isNoteType && e.dataList ? i("div", { staticClass: "b-timeline-item__data-list" }, [i("bento-structured-list", e._l(e.dataList, function(s) {
|
|
359
|
+
return i("bento-structured-list-item", { key: e.generateUid(s.label), attrs: { label: s.label } }, [i("bento-typography", { attrs: { variant: "caption" } }, [e._v(e._s(s.value))])], 1);
|
|
360
|
+
}), 1)], 1) : e._e(), !e.isNoteType && e.tag ? i("bento-tag", e._b({ staticClass: "b-timeline-item__tag" }, "bento-tag", e.tag, !1)) : e._e()], 1)]), e.displayShowMoreButton ? i("div", { staticClass: "b-timeline-item__row" }, [e._m(1), i("div", { staticClass: "b-timeline-item__content" }, [i("bento-button", { staticClass: "b-timeline__show-more", attrs: { variant: "tertiary" }, on: { click: function(s) {
|
|
361
|
+
e.showAll = !e.showAll;
|
|
362
|
+
} } }, [e.showAll ? [e._v(e._s(e.t("showLess")))] : [e._v(e._s(e.t("showMore", { items: e.hiddenItems })))]], 2)], 1)]) : e._e()]) : e._e();
|
|
363
|
+
}, Le = [function() {
|
|
364
|
+
var t = this, e = t._self._c;
|
|
365
|
+
return t._self._setupProxy, e("div", { staticClass: "b-timeline-item__marker", attrs: { "aria-hidden": "true" } }, [e("div", { staticClass: "b-timeline-item__icon b-timeline-item__icon--timegap" }), e("div", { staticClass: "b-timeline-item__separator" })]);
|
|
366
|
+
}, function() {
|
|
367
|
+
var t = this, e = t._self._c;
|
|
368
|
+
return t._self._setupProxy, e("div", { staticClass: "b-timeline-item__marker", attrs: { "aria-hidden": "true" } }, [e("div", { staticClass: "b-timeline-item__separator" })]);
|
|
369
|
+
}], Ae = /* @__PURE__ */ x(
|
|
370
|
+
Se,
|
|
371
|
+
Me,
|
|
372
|
+
Le,
|
|
373
|
+
!1,
|
|
374
|
+
null,
|
|
375
|
+
"5626ecfd"
|
|
376
|
+
);
|
|
377
|
+
const We = Ae.exports;
|
|
378
|
+
export {
|
|
379
|
+
w as B,
|
|
380
|
+
We as a,
|
|
381
|
+
fe as b,
|
|
382
|
+
L as c,
|
|
383
|
+
q as d,
|
|
384
|
+
Ve as t
|
|
385
|
+
};
|
|
386
|
+
//# sourceMappingURL=timeline-item.DcutETie.js.map
|