@adyen/bento-vue3 1.43.0 → 1.44.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/packages/vue2/src/components/button/components/button-actions/composables/use-stack-buttons/use-stack-buttons.d.ts +10 -0
- package/dist/@types/packages/vue2/src/components/card/card.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/checkbox/checkbox.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/checkbox/components/checkbox-group/checkbox-group.vue.d.ts +8 -8
- package/dist/@types/packages/vue2/src/components/code-snippet/code-snippet.vue.d.ts +50 -32
- package/dist/@types/packages/vue2/src/components/data-grid/components/data-grid-config-settings/data-grid-config-settings.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/data-grid/data-grid.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/date-picker/date-picker.vue.d.ts +21 -15
- package/dist/@types/packages/vue2/src/components/date-range-picker/components/date-range-picker-calendar/date-range-picker-calendar.vue.d.ts +56 -38
- package/dist/@types/packages/vue2/src/components/date-range-picker/date-range-picker.vue.d.ts +77 -53
- package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-base-textbox/dropdown-base-textbox.vue.d.ts +6 -4
- package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-default-textbox/dropdown-default-textbox.vue.d.ts +4 -2
- package/dist/@types/packages/vue2/src/components/dropdown/components/dropdown-small-textbox/dropdown-small-textbox.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/dropdown/dropdown.vue.d.ts +20 -12
- package/dist/@types/packages/vue2/src/components/empty-state/empty-state.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/file-uploader/file-uploader.types.d.ts +6 -2
- package/dist/@types/packages/vue2/src/components/filter-bar/components/all-filters-modal/all-filters-modal.vue.d.ts +228 -180
- package/dist/@types/packages/vue2/src/components/filter-bar/components/base-filter/base-filter.vue.d.ts +6 -6
- package/dist/@types/packages/vue2/src/components/filter-bar/components/boolean-filter/boolean-filter.vue.d.ts +12 -12
- package/dist/@types/packages/vue2/src/components/filter-bar/components/date-filter/date-filter.vue.d.ts +27 -21
- package/dist/@types/packages/vue2/src/components/filter-bar/components/date-range-filter/date-range-filter.vue.d.ts +139 -97
- package/dist/@types/packages/vue2/src/components/filter-bar/components/filter-bar-button/filter-bar-button.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/filter-bar/components/input-filter/input-filter.vue.d.ts +15 -15
- package/dist/@types/packages/vue2/src/components/filter-bar/components/range-filter/range-filter.vue.d.ts +15 -15
- package/dist/@types/packages/vue2/src/components/filter-bar/filter-bar.vue.d.ts +208 -160
- package/dist/@types/packages/vue2/src/components/header/header.vue.d.ts +9 -0
- package/dist/@types/packages/vue2/src/components/input-field/input-field.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/input-field-password/input-field-password.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/internal/button-actions-with-menu/button-actions-with-menu.keys.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/internal/button-actions-with-menu/button-actions-with-menu.vue.d.ts +16 -1
- package/dist/@types/packages/vue2/src/components/internal/button-actions-with-menu/index.d.ts +2 -0
- package/dist/@types/packages/vue2/src/components/internal/checkbox-input/checkbox-input.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/internal/controls-group/controls-group.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/internal/field-label/field-label.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/internal/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/internal/listbox/components/listbox-multi-select/components/listbox-multi-select-options/components/listbox-multi-select-category/listbox-multi-select-category.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/internal/listbox/components/listbox-multi-select/components/listbox-multi-select-options/listbox-multi-select-options.vue.d.ts +6 -6
- package/dist/@types/packages/vue2/src/components/internal/listbox/components/listbox-multi-select/listbox-multi-select.vue.d.ts +9 -9
- package/dist/@types/packages/vue2/src/components/internal/listbox/listbox.vue.d.ts +15 -15
- package/dist/@types/packages/vue2/src/components/internal/radio-input/radio-input.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/internal/tooltip/tooltip.vue.d.ts +5 -5
- package/dist/@types/packages/vue2/src/components/menu/components/menu-item-list/menu-item-list.vue.d.ts +15 -0
- package/dist/@types/packages/vue2/src/components/menu/menu.vue.d.ts +48 -3
- package/dist/@types/packages/vue2/src/components/modal/components/base-modal/base-modal.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/modal/components/modal-default/modal-default.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/modal/components/modal-dialog/modal-dialog.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/modal/components/modal-page/modal-page.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/modal/modal.vue.d.ts +7 -7
- package/dist/@types/packages/vue2/src/components/modal-fullscreen/components/modal-fullscreen-page.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/modal-fullscreen/modal-fullscreen.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/popover/popover.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/popper-container/popper-container.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/promo-banner/promo-banner.vue.d.ts +2 -2
- package/dist/@types/packages/vue2/src/components/radio-group/radio-group.vue.d.ts +2 -2
- package/dist/@types/packages/vue2/src/components/selection-card/components/selection-card-group/selection-card-group.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/sidepanel/components/sidepanel-page.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/summary-grid/components/summary-grid-item/summary-grid-item.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/summary-grid/components/summary-grid-item-amount/summary-grid-item-amount.vue.d.ts +2 -2
- package/dist/@types/packages/vue2/src/components/summary-grid/components/summary-grid-item-custom/summary-grid-item-custom.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/summary-grid/components/summary-grid-item-numeric/summary-grid-item-numeric.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/summary-grid/components/summary-grid-item-percentage/summary-grid-item-percentage.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/summary-grid/components/summary-grid-item-text/summary-grid-item-text.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/textarea/textarea.vue.d.ts +6 -4
- package/dist/@types/packages/vue2/src/components/timeline/timeline.vue.d.ts +6 -4
- package/dist/@types/packages/vue2/src/composables/use-form-validate/use-form.d.ts +9 -6
- package/dist/@types/packages/vue2/src/composables/use-form-validate/use-form.types.d.ts +5 -1
- 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/base-modal.css +1 -1
- package/dist/assets/button-actions-with-menu.css +1 -1
- package/dist/assets/button-actions.css +1 -1
- package/dist/assets/card.css +1 -1
- package/dist/assets/data-grid.css +1 -1
- package/dist/assets/dialog-page.css +1 -1
- package/dist/assets/dropdown-default-textbox.css +1 -1
- package/dist/assets/dropdown.css +1 -1
- package/dist/assets/file-uploader.css +1 -1
- package/dist/assets/header.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/selection-card-group.css +1 -1
- package/dist/assets/sidepanel.css +1 -1
- package/dist/assets/textarea.css +1 -1
- package/dist/button.js +7 -8
- package/dist/button.js.map +1 -1
- package/dist/card.js +1 -1
- package/dist/checkbox.js +2 -2
- package/dist/chunks/{action-bar.COQrEUYU.js → action-bar.B-_JS43H.js} +10 -9
- package/dist/chunks/action-bar.B-_JS43H.js.map +1 -0
- package/dist/chunks/{base-modal.ku0lyHOs.js → base-modal.BR_pB6eH.js} +2 -2
- package/dist/chunks/{base-modal.ku0lyHOs.js.map → base-modal.BR_pB6eH.js.map} +1 -1
- package/dist/chunks/button-actions-with-menu.GT_kNv28.js +119 -0
- package/dist/chunks/button-actions-with-menu.GT_kNv28.js.map +1 -0
- package/dist/chunks/button-actions.BjlQS6tm.js +322 -0
- package/dist/chunks/button-actions.BjlQS6tm.js.map +1 -0
- package/dist/chunks/{card.D_XL2TWr.js → card.BrEfcUoE.js} +2 -2
- package/dist/chunks/{card.D_XL2TWr.js.map → card.BrEfcUoE.js.map} +1 -1
- package/dist/chunks/{checkbox-group.BUmkYc2R.js → checkbox-group.C5IweVVx.js} +2 -2
- package/dist/chunks/{checkbox-group.BUmkYc2R.js.map → checkbox-group.C5IweVVx.js.map} +1 -1
- package/dist/chunks/{checkbox.L94hTcPY.js → checkbox.B72ok3Yu.js} +15 -15
- package/dist/chunks/{checkbox.L94hTcPY.js.map → checkbox.B72ok3Yu.js.map} +1 -1
- package/dist/chunks/{code-snippet.DbUGxmYi.js → code-snippet.S5NdUu0p.js} +4 -4
- package/dist/chunks/{code-snippet.DbUGxmYi.js.map → code-snippet.S5NdUu0p.js.map} +1 -1
- package/dist/chunks/{dashboard-section.YU5gKDEJ.js → dashboard-section.LWxBcOV_.js} +2 -2
- package/dist/chunks/{dashboard-section.YU5gKDEJ.js.map → dashboard-section.LWxBcOV_.js.map} +1 -1
- package/dist/chunks/{dashed-underline.BKfUevuM.js → dashed-underline.CRlWNPrd.js} +2 -2
- package/dist/chunks/{dashed-underline.BKfUevuM.js.map → dashed-underline.CRlWNPrd.js.map} +1 -1
- package/dist/chunks/{data-grid-template.DI27ou71.js → data-grid-template.BZVeRN6g.js} +2 -2
- package/dist/chunks/{data-grid-template.DI27ou71.js.map → data-grid-template.BZVeRN6g.js.map} +1 -1
- package/dist/chunks/{data-grid.DgPWs1hH.js → data-grid.CKDW-rbM.js} +10 -10
- package/dist/chunks/{data-grid.DgPWs1hH.js.map → data-grid.CKDW-rbM.js.map} +1 -1
- package/dist/chunks/{date-picker.DDsfecHp.js → date-picker.BrZ2X1nQ.js} +3 -3
- package/dist/chunks/{date-picker.DDsfecHp.js.map → date-picker.BrZ2X1nQ.js.map} +1 -1
- package/dist/chunks/{date-range-picker.DjPmRy0E.js → date-range-picker.4y2goCI8.js} +6 -6
- package/dist/chunks/{date-range-picker.DjPmRy0E.js.map → date-range-picker.4y2goCI8.js.map} +1 -1
- package/dist/chunks/{dropdown-default-textbox.CcRQ1f4U.js → dropdown-default-textbox.ZjVeMHVC.js} +131 -120
- package/dist/chunks/{dropdown-default-textbox.CcRQ1f4U.js.map → dropdown-default-textbox.ZjVeMHVC.js.map} +1 -1
- package/dist/chunks/{dropdown-tag.BKDmDRSv.js → dropdown-tag.ClKm4xAo.js} +2 -2
- package/dist/chunks/{dropdown-tag.BKDmDRSv.js.map → dropdown-tag.ClKm4xAo.js.map} +1 -1
- package/dist/chunks/dropdown.Sj2OLuEF.js +911 -0
- package/dist/chunks/{dropdown.DpjMobyf.js.map → dropdown.Sj2OLuEF.js.map} +1 -1
- package/dist/chunks/es6.C-HLzYPA.js +11 -0
- package/dist/chunks/{es6.b4enG1py.js.map → es6.C-HLzYPA.js.map} +1 -1
- package/dist/chunks/{file-uploader.cRbwpcAw.js → file-uploader.BgRbkW2V.js} +368 -365
- package/dist/chunks/file-uploader.BgRbkW2V.js.map +1 -0
- package/dist/chunks/{filter-bar.BwJTrH5U.js → filter-bar.CM1FZ02d.js} +16 -17
- package/dist/chunks/{filter-bar.BwJTrH5U.js.map → filter-bar.CM1FZ02d.js.map} +1 -1
- package/dist/chunks/{footer-actions.DvIVWqWv.js → footer-actions.Dvsb0g5Y.js} +2 -2
- package/dist/chunks/{footer-actions.DvIVWqWv.js.map → footer-actions.Dvsb0g5Y.js.map} +1 -1
- package/dist/chunks/{header.C0NBlBJv.js → header.8BzBNgxj.js} +23 -23
- package/dist/chunks/{header.C0NBlBJv.js.map → header.8BzBNgxj.js.map} +1 -1
- package/dist/chunks/{input-field-password.DxNS4MmO.js → input-field-password.CXsERnQX.js} +3 -3
- package/dist/chunks/{input-field-password.DxNS4MmO.js.map → input-field-password.CXsERnQX.js.map} +1 -1
- package/dist/chunks/{input-field.BQKEQIZd.js → input-field.C-7_iMIS.js} +2 -2
- package/dist/chunks/{input-field.BQKEQIZd.js.map → input-field.C-7_iMIS.js.map} +1 -1
- package/dist/chunks/{menu.BpqOdkxR.js → menu.hDynz4lc.js} +132 -104
- package/dist/chunks/menu.hDynz4lc.js.map +1 -0
- package/dist/chunks/{modal-fullscreen.DtgTb1Xh.js → modal-fullscreen.BCGaxVNb.js} +2 -2
- package/dist/chunks/{modal-fullscreen.DtgTb1Xh.js.map → modal-fullscreen.BCGaxVNb.js.map} +1 -1
- package/dist/chunks/{modal.vue_vue_type_script_setup_true_lang.CjD91zJo.js → modal.vue_vue_type_script_setup_true_lang.DJXx8ftn.js} +4 -4
- package/dist/chunks/{modal.vue_vue_type_script_setup_true_lang.CjD91zJo.js.map → modal.vue_vue_type_script_setup_true_lang.DJXx8ftn.js.map} +1 -1
- package/dist/chunks/{pagination.C34l_EYf.js → pagination.C9kqX5tD.js} +2 -2
- package/dist/chunks/{pagination.C34l_EYf.js.map → pagination.C9kqX5tD.js.map} +1 -1
- package/dist/chunks/{popover.D9Zw4w9l.js → popover.DwGgnCyn.js} +2 -2
- package/dist/chunks/{popover.D9Zw4w9l.js.map → popover.DwGgnCyn.js.map} +1 -1
- package/dist/chunks/{search-bar.Dy0dBek2.js → search-bar.DPC0amNg.js} +3 -3
- package/dist/chunks/{search-bar.Dy0dBek2.js.map → search-bar.DPC0amNg.js.map} +1 -1
- package/dist/chunks/{secondary-nav.DYFnrUIK.js → secondary-nav.DH7aXddE.js} +3 -3
- package/dist/chunks/{secondary-nav.DYFnrUIK.js.map → secondary-nav.DH7aXddE.js.map} +1 -1
- package/dist/chunks/{selection-card-group.BY8o4PYF.js → selection-card-group.DDBJ423n.js} +19 -19
- package/dist/chunks/{selection-card-group.BY8o4PYF.js.map → selection-card-group.DDBJ423n.js.map} +1 -1
- package/dist/chunks/{sidepanel.BywianGe.js → sidepanel.8NclWh0V.js} +2 -2
- package/dist/chunks/{sidepanel.BywianGe.js.map → sidepanel.8NclWh0V.js.map} +1 -1
- package/dist/chunks/{teleport.CI0k6eaC.js → teleport.B255JhsV.js} +26 -17
- package/dist/chunks/teleport.B255JhsV.js.map +1 -0
- package/dist/chunks/{textarea.vAp6HFi9.js → textarea.D1weaQCC.js} +72 -68
- package/dist/chunks/{textarea.vAp6HFi9.js.map → textarea.D1weaQCC.js.map} +1 -1
- package/dist/chunks/{timeline-item.ND_EMuwP.js → timeline-item.BDYrjKhM.js} +3 -3
- package/dist/chunks/{timeline-item.ND_EMuwP.js.map → timeline-item.BDYrjKhM.js.map} +1 -1
- package/dist/chunks/{tutorial.vue_vue_type_script_setup_true_lang.LBw_ALfS.js → tutorial.vue_vue_type_script_setup_true_lang.ltZUbc6M.js} +4 -4
- package/dist/chunks/{tutorial.vue_vue_type_script_setup_true_lang.LBw_ALfS.js.map → tutorial.vue_vue_type_script_setup_true_lang.ltZUbc6M.js.map} +1 -1
- package/dist/chunks/{use-cached-selected-values.BOZK76mN.js → use-cached-selected-values.B6beyyvX.js} +3 -3
- package/dist/chunks/{use-cached-selected-values.BOZK76mN.js.map → use-cached-selected-values.B6beyyvX.js.map} +1 -1
- package/dist/code-snippet.js +1 -1
- package/dist/dashboard-template.js +1 -1
- package/dist/dashed-underline.js +1 -1
- package/dist/data-grid-template.js +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/date-picker.js +1 -1
- package/dist/date-range-picker.js +1 -1
- package/dist/dropdown.js +4 -4
- package/dist/file-uploader.js +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/header.js +1 -1
- package/dist/index.js +67 -68
- package/dist/index.js.map +1 -1
- package/dist/input-field-password.js +1 -1
- package/dist/input-field.js +1 -1
- package/dist/internal.js +28 -24
- package/dist/internal.js.map +1 -1
- package/dist/menu.js +1 -1
- package/dist/modal-fullscreen.js +1 -1
- package/dist/modal.js +2 -2
- package/dist/pagination.js +1 -1
- package/dist/popover.js +1 -1
- package/dist/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/textarea.js +1 -1
- package/dist/timeline.js +1 -1
- package/dist/tutorial.js +1 -1
- package/dist/web-types.json +1 -1
- package/package.json +2 -2
- package/dist/@types/packages/vue2/src/components/button/button.demo.d.ts +0 -6
- package/dist/assets/loading-button.css +0 -1
- package/dist/chunks/action-bar.COQrEUYU.js.map +0 -1
- package/dist/chunks/button-actions-with-menu.Bn7Kdx4v.js +0 -106
- package/dist/chunks/button-actions-with-menu.Bn7Kdx4v.js.map +0 -1
- package/dist/chunks/button-actions.Bjfo46Q_.js +0 -150
- package/dist/chunks/button-actions.Bjfo46Q_.js.map +0 -1
- package/dist/chunks/dropdown.DpjMobyf.js +0 -907
- package/dist/chunks/es6.b4enG1py.js +0 -10
- package/dist/chunks/file-uploader.cRbwpcAw.js.map +0 -1
- package/dist/chunks/loading-button.CNWhVIPK.js +0 -137
- package/dist/chunks/loading-button.CNWhVIPK.js.map +0 -1
- package/dist/chunks/menu.BpqOdkxR.js.map +0 -1
- package/dist/chunks/teleport.CI0k6eaC.js.map +0 -1
- package/dist/chunks/use-click-outside.D6aIgS15.js +0 -14
- package/dist/chunks/use-click-outside.D6aIgS15.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidepanel.BywianGe.js","sources":["../../../vue2/src/components/sidepanel/components/sidepanel-page.vue","../../../vue2/src/components/sidepanel/sidepanel.types.ts","../../../vue2/src/components/sidepanel/sidepanel.vue"],"sourcesContent":["<template>\n <dialog-page class=\"b-sidepanel-page\" :page-id=\"pageId\" :previous-page=\"previousPage\">\n <template #header>\n <div class=\"b-sidepanel-page__header\">\n <bento-typography class=\"b-sidepanel-page__title\" el=\"h2\" variant=\"title\">\n {{ title }}\n </bento-typography>\n </div>\n </template>\n <template #content>\n <div class=\"b-sidepanel-page__content\">\n <bento-typography el=\"div\" variant=\"body\">\n <slot />\n </bento-typography>\n </div>\n </template>\n <template v-if=\"actions && actions.length > 0\" #footer>\n <div class=\"b-sidepanel-page__actions\">\n <footer-actions\n :actions=\"actions\"\n :actions-label=\"actionsLabel\"\n :destructive-actions=\"destructiveActions\"\n />\n </div>\n </template>\n </dialog-page>\n</template>\n\n<script setup lang=\"ts\">\n import { PropType } from 'vue';\n\n import { BentoButtonActionsList } from '@/components/button';\n import { BentoTypography } from '@/components/typography';\n import { FooterActions } from '@/components/internal/footer-actions';\n import { DialogPage } from '@/internal';\n\n defineProps({\n /**\n * List of actions that will be used to render the buttons.\n * First element in the list will be rendered as \"primary\".\n * All elements after the first will be rendered as \"secondary\".\n *\n * ```\n * [{\n * title: 'Primary',\n * event: () => { ... },\n * icon: FourPeopleIcon\n * }, {\n * title: 'Secondary',\n * event: () => { ... }\n * }]\n * ```\n */\n actions: {\n type: Array as PropType<BentoButtonActionsList>,\n default: null,\n },\n\n /**\n * Text label that is displayed left to the action buttons\n */\n actionsLabel: {\n type: String,\n default: null,\n },\n\n /**\n * If passed - sets first button color to red\n */\n destructiveActions: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Identifier of the page, used with activePage prop to handle sidepanel navigation\n */\n pageId: {\n type: String,\n default: undefined,\n },\n\n /**\n * ID of the page for the back button to navigate to. Only use it to overwrite the default back behavior\n * Used when the back button should not take the user to the natural previous page\n * Set to `null` to hide back button in the page\n */\n previousPage: {\n type: String,\n default: undefined,\n },\n\n /**\n * Title of the sidepanel page\n */\n title: {\n type: String,\n default: null,\n },\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * SidepanelPage is used to render different pages of Sidepanel component\n *\n * @example\n * import { BentoSidepanel, BentoSidepanelPage } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoSidepanel, BentoSidepanelPage },\n * template: `\n * <bento-sidepanel active-page='step1' is-open='true'>\n * <bento-sidepanel-page\n * title='Step 1'\n * pageId='step1'\n * :actions=\"[\n * {\n * title: 'Next step',\n * event: () => {\n * activePage.value = 'step2';\n * },\n * }]\">\n * Step 1 info\n * </bento-sidepanel-page>\n * <bento-sidepanel-page\n * title='Step 2'\n * pageId='step2'\n * :actions=\"[\n * {\n * title: 'Save',\n * event: () => {},\n * }]\">\n * Step 2 info\n * </bento-sidepanel-page>\n * </bento-sidepanel>\n * `\n * }\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./sidepanel-page.scss\" />\n","export enum BentoSidepanelEvent {\n UPDATE_ACTIVE_PAGE = 'update:active-page',\n UPDATE_IS_OPEN = 'update:is-open',\n}\n","<template>\n <dialog\n ref=\"sidepanel\"\n class=\"b-sidepanel\"\n :class=\"conditionalClasses\"\n @animationend=\"closeSidepanelAfterAnimation\"\n @keydown.esc.prevent=\"isDismissible && startCloseSidepanelAnimation\"\n >\n <bento-focus-trap :id=\"sidepanelId\" v-bento-click-outside-directive=\"closeSidepanelOnClickOutside\">\n <div v-if=\"!computedHideCloseButton\" class=\"b-sidepanel__close-button\">\n <bento-button variant=\"tertiary\" @click=\"startCloseSidepanelAnimation\">\n <cross-icon :svg-title=\"t('close')\" />\n </bento-button>\n </div>\n <slot />\n </bento-focus-trap>\n </dialog>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, nextTick, provide, ref, toRefs, watch } from 'vue';\n\n import { BentoButton } from '@/components/button';\n import { BentoFocusTrap } from '@/components/focus-trap';\n import CrossIcon from '@adyen/ui-assets-icons-16/vue/cross';\n\n import { BentoSidepanelEvent } from './sidepanel.types';\n import {\n BentoDialogPageAnimation,\n BentoDialogPageConfigData,\n BentoDialogPageRegisterPage,\n DIALOG_PAGE_CONFIG_INJECTION_KEY,\n DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY,\n } from '@/internal';\n\n import { SIDEPANEL_DIALOG_ID_INJECTION_KEY } from './sidepanel.keys';\n\n import { BentoClickOutsideDirective as vBentoClickOutsideDirective } from '@/directives/click-outside';\n\n import { useI18n } from '@/utils/ts/i18n';\n\n import messages from './messages.json';\n import { generateUid } from '@/core/utils/ts';\n import { deprecate } from '@/utils/ts/deprecate';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n /**\n * The id of the current active page\n * Should be the same id as the BentoSidepanelPage to be displayed\n * If the component only has one page, it can be left null/undefined.\n */\n activePage: {\n type: String,\n default: null,\n },\n\n /**\n * If set to true, it allows the sidepanel to be closed.\n * Shows close button when `true` and hides close button when `false`.\n *\n * _Note: This property will not set the visibility of the close button in v2.0.0_\n */\n isDismissible: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Controls the sidepanel's state from the outside. Set it to true to open the sidepanel.\n */\n isOpen: {\n type: Boolean,\n default: null,\n },\n\n /**\n * Controls the visibility of close button on the sidepanel.\n * Defaults to `true` when `isDismissible=false`, and `true` when `isDimissible=true`.\n *\n * _Note: This property will be set to `false` by default, independent of `isDismissible` in v2.0.0_\n */\n hideCloseButton: {\n type: Boolean,\n default: null,\n },\n });\n\n const emit = defineEmits<{\n /**\n * Emits update event when page is changed internally\n */\n (e: BentoSidepanelEvent.UPDATE_ACTIVE_PAGE, page: string): void;\n /**\n * Emits close-sidepanel event when the sidepanel is closed\n */\n (e: BentoSidepanelEvent.UPDATE_IS_OPEN, isOpen: boolean): void;\n }>();\n\n // Refs\n const { activePage, isOpen } = toRefs(props);\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const sidepanel = ref(null);\n const pages = ref<string[]>([]);\n const previousPages = ref([]);\n const animation = ref(BentoDialogPageAnimation.TRANSITION_LEVEL_DEEPER);\n const isClosing = ref(false);\n const sidepanelId = generateUid('sidepanel');\n const internalIsOpen = ref(false);\n const isAnimationActive = ref(false);\n\n // Animation styling\n const conditionalClasses = computed(() => ({\n 'b-sidepanel--hide': isClosing.value,\n 'b-sidepanel--animation': isAnimationActive.value,\n }));\n\n // Handle closing and closing animation for dialog element\n const closeSidepanelAfterAnimation = () => {\n if (isClosing.value) {\n sidepanel.value.close();\n if (previousPages.value[0]) {\n emit(BentoSidepanelEvent.UPDATE_ACTIVE_PAGE, previousPages.value[0]);\n }\n previousPages.value = [];\n isClosing.value = false;\n internalIsOpen.value = false;\n emit(BentoSidepanelEvent.UPDATE_IS_OPEN, false);\n }\n };\n\n const startCloseSidepanelAnimation = () => {\n if (!sidepanel.value.open) {\n return;\n }\n isClosing.value = true;\n };\n\n const closeSidepanelOnClickOutside = () => {\n if (props.isDismissible) {\n startCloseSidepanelAnimation();\n }\n };\n\n // TODO: Remove in upcoming major. See properties `hideCloseButton` and `isDismissible`.\n const computedHideCloseButton = computed(() => {\n if (props.hideCloseButton !== null) {\n return props.hideCloseButton;\n }\n\n return !props.isDismissible;\n });\n\n // Watching isOpen prop to toggle open/close the dialog element\n watch(\n () => isOpen.value,\n async () => {\n // Wait for sidepanel ref to be created\n await nextTick();\n\n if (!sidepanel.value) {\n return;\n }\n\n if (isOpen.value) {\n internalIsOpen.value = true;\n sidepanel.value.showModal();\n if (!previousPages.value.length) {\n previousPages.value.push(activePage.value);\n }\n } else if (sidepanel.value.open) {\n startCloseSidepanelAnimation();\n }\n },\n { immediate: true }\n );\n\n // Pages\n const updatePage = page => emit(BentoSidepanelEvent.UPDATE_ACTIVE_PAGE, page);\n\n // unregister page if removed / destroyed\n const unregisterPage = (pageIdToRemove: string) => () => {\n pages.value = pages.value?.filter(pageId => pageId !== pageIdToRemove);\n };\n\n // Provide data and function to register page to subcomponent\n const registerPage: BentoDialogPageRegisterPage = pageId => {\n pages.value.push(pageId);\n\n return { unregisterPage: unregisterPage(pageId) };\n };\n\n provide<BentoDialogPageConfigData>(DIALOG_PAGE_CONFIG_INJECTION_KEY, {\n activePage,\n animation,\n isAnimationActive,\n isOpen: internalIsOpen,\n pages,\n previousPages,\n updatePage,\n });\n provide(DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY, registerPage);\n\n // Let's Children components know they are inside a SidePanel (dialog element)\n provide(SIDEPANEL_DIALOG_ID_INJECTION_KEY, sidepanelId);\n\n if (!props.isDismissible && props.hideCloseButton === null) {\n deprecate(\n 'BentoSidepanel \"isDismissible\" property’s behavior',\n 'BentoSidepanel \"isDismissible\" will no longer hide the close button. Use \"hideCloseButton=true\" instead.',\n '2.0.0'\n );\n }\n</script>\n\n<script lang=\"ts\">\n /**\n * Sidepanel component is a slide-in panel that should be used for presenting actions, settings or features that are directly associated with a specific task or interaction on the main screen.\n *\n * @example\n * import { BentoSidepanel, BentoSidepanelPage } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoSidepanel, BentoSidepanelPage },\n * template: `\n * <bento-sidepanel active-page='step1' is-open='true'>\n * <bento-sidepanel-page\n * title='Step 1'\n * pageId='step1'\n * :actions=\"[\n * {\n * title: 'Next step',\n * event: () => {\n * activePage.value = 'step2';\n * },\n * }]\">\n * Step 1 info\n * </bento-sidepanel-page>\n * <bento-sidepanel-page\n * title='Step 2'\n * pageId='step2'\n * :actions=\"[\n * {\n * title: 'Save',\n * event: () => {},\n * }]\">\n * Step 2 info\n * </bento-sidepanel-page>\n * </bento-sidepanel>\n * `\n * }\n */\n export default {\n i18n: { messages },\n };\n</script>\n<style lang=\"scss\" scoped src=\"./sidepanel.scss\" />\n"],"names":["__default__$1","BentoSidepanelEvent","BentoSidepanelEvent2","__default__","messages","props","__props","emit","__emit","activePage","isOpen","toRefs","t","useI18n","sidepanel","ref","pages","previousPages","animation","BentoDialogPageAnimation","isClosing","sidepanelId","generateUid","internalIsOpen","isAnimationActive","conditionalClasses","computed","closeSidepanelAfterAnimation","startCloseSidepanelAnimation","closeSidepanelOnClickOutside","computedHideCloseButton","watch","nextTick","updatePage","page","unregisterPage","pageIdToRemove","_a","pageId","registerPage","provide","DIALOG_PAGE_CONFIG_INJECTION_KEY","DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY","SIDEPANEL_DIALOG_ID_INJECTION_KEY","deprecate"],"mappings":";;;;;;;;;;;;;4IA2IIA,KAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,OACIA,EAAA,kBAGJ,CAAAA,EAAA,aAAc;AAIlB,IAAA0B;AAAA,MAAA,MAAArB,EAAA;AAAA,MACiB,YAAA;AAKT,QAFA,MAAAsB,EAAA,GAEAlB,EAAA,UAIAJ,EAAA,SACIa,EAAA,QAAA,IACAT,EAAA,MAAA,UAAA,GACAG,EAAA,MAAA,UACIA,EAAA,MAAA,KAAAR,EAAA,KAAA,KACJK,EAAA,MAAA,QAEAc,EAAA;AAAA,MACJ;AAAA,MACJ,EAAA,WAAA,GAAA;AAAA,IACkB;AAItB,UAAAK,IAAA,CAAAC,MAAA3B,EAAAN,EAAA,oBAAAiC,CAAA,GAGAC,IAAA,CAAAC,MAAA,MAAA;;AACI,MAAApB,EAAA,SAAAqB,IAAArB,EAAA,UAAA,gBAAAqB,EAAA,OAAA,CAAAC,MAAAA,MAAAF;AAAA,IAAqE,GAIzEG,IAAA,CAAAD,OACItB,EAAA,MAAA,KAAAsB,CAAA,GAEA,EAAA,gBAAAH,EAAAG,CAAA,EAAA;AAGJ,WAAAE,EAAAC,IAAA;AAAA,MAAqE,YAAAhC;AAAA,MACjE,WAAAS;AAAA,MACA,mBAAAM;AAAA,MACA,QAAAD;AAAA,MACQ,OAAAP;AAAA,MACR,eAAAC;AAAA,MACA,YAAAgB;AAAA,IACA,CAAA,GAEJO,EAAAE,IAAAH,CAAA,GAGAC,EAAAG,IAAAtB,CAAA,GAEA,CAAAhB,EAAA,iBAAAA,EAAA,oBAAA,QACIuC;AAAA,MAAA;AAAA,MACI;AAAA,MACA;AAAA,IACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"sidepanel.8NclWh0V.js","sources":["../../../vue2/src/components/sidepanel/components/sidepanel-page.vue","../../../vue2/src/components/sidepanel/sidepanel.types.ts","../../../vue2/src/components/sidepanel/sidepanel.vue"],"sourcesContent":["<template>\n <dialog-page class=\"b-sidepanel-page\" :page-id=\"pageId\" :previous-page=\"previousPage\">\n <template #header>\n <div class=\"b-sidepanel-page__header\">\n <bento-typography class=\"b-sidepanel-page__title\" el=\"h2\" variant=\"title\">\n {{ title }}\n </bento-typography>\n </div>\n </template>\n <template #content>\n <div class=\"b-sidepanel-page__content\">\n <bento-typography el=\"div\" variant=\"body\">\n <slot />\n </bento-typography>\n </div>\n </template>\n <template v-if=\"actions && actions.length > 0\" #footer>\n <div class=\"b-sidepanel-page__actions\">\n <footer-actions\n :actions=\"actions\"\n :actions-label=\"actionsLabel\"\n :destructive-actions=\"destructiveActions\"\n />\n </div>\n </template>\n </dialog-page>\n</template>\n\n<script setup lang=\"ts\">\n import { PropType } from 'vue';\n\n import { BentoButtonActionsList } from '@/components/button';\n import { BentoTypography } from '@/components/typography';\n import { FooterActions } from '@/components/internal/footer-actions';\n import { DialogPage } from '@/internal';\n\n defineProps({\n /**\n * List of actions that will be used to render the buttons.\n * First element in the list will be rendered as \"primary\".\n * All elements after the first will be rendered as \"secondary\".\n *\n * ```\n * [{\n * title: 'Primary',\n * event: () => { ... },\n * icon: FourPeopleIcon\n * }, {\n * title: 'Secondary',\n * event: () => { ... }\n * }]\n * ```\n */\n actions: {\n type: Array as PropType<BentoButtonActionsList>,\n default: null,\n },\n\n /**\n * Text label that is displayed left to the action buttons\n */\n actionsLabel: {\n type: String,\n default: null,\n },\n\n /**\n * If passed - sets first button color to red\n */\n destructiveActions: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Identifier of the page, used with activePage prop to handle sidepanel navigation\n */\n pageId: {\n type: String,\n default: undefined,\n },\n\n /**\n * ID of the page for the back button to navigate to. Only use it to overwrite the default back behavior\n * Used when the back button should not take the user to the natural previous page\n * Set to `null` to hide back button in the page\n */\n previousPage: {\n type: String,\n default: undefined,\n },\n\n /**\n * Title of the sidepanel page\n */\n title: {\n type: String,\n default: null,\n },\n });\n</script>\n\n<script lang=\"ts\">\n /**\n * SidepanelPage is used to render different pages of Sidepanel component\n *\n * @example\n * import { BentoSidepanel, BentoSidepanelPage } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoSidepanel, BentoSidepanelPage },\n * template: `\n * <bento-sidepanel active-page='step1' is-open='true'>\n * <bento-sidepanel-page\n * title='Step 1'\n * pageId='step1'\n * :actions=\"[\n * {\n * title: 'Next step',\n * event: () => {\n * activePage.value = 'step2';\n * },\n * }]\">\n * Step 1 info\n * </bento-sidepanel-page>\n * <bento-sidepanel-page\n * title='Step 2'\n * pageId='step2'\n * :actions=\"[\n * {\n * title: 'Save',\n * event: () => {},\n * }]\">\n * Step 2 info\n * </bento-sidepanel-page>\n * </bento-sidepanel>\n * `\n * }\n */\n export default {};\n</script>\n\n<style lang=\"scss\" scoped src=\"./sidepanel-page.scss\" />\n","export enum BentoSidepanelEvent {\n UPDATE_ACTIVE_PAGE = 'update:active-page',\n UPDATE_IS_OPEN = 'update:is-open',\n}\n","<template>\n <dialog\n ref=\"sidepanel\"\n class=\"b-sidepanel\"\n :class=\"conditionalClasses\"\n @animationend=\"closeSidepanelAfterAnimation\"\n @keydown.esc.prevent=\"isDismissible && startCloseSidepanelAnimation\"\n >\n <bento-focus-trap :id=\"sidepanelId\" v-bento-click-outside-directive=\"closeSidepanelOnClickOutside\">\n <div v-if=\"!computedHideCloseButton\" class=\"b-sidepanel__close-button\">\n <bento-button variant=\"tertiary\" @click=\"startCloseSidepanelAnimation\">\n <cross-icon :svg-title=\"t('close')\" />\n </bento-button>\n </div>\n <slot />\n </bento-focus-trap>\n </dialog>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, nextTick, provide, ref, toRefs, watch } from 'vue';\n\n import { BentoButton } from '@/components/button';\n import { BentoFocusTrap } from '@/components/focus-trap';\n import CrossIcon from '@adyen/ui-assets-icons-16/vue/cross';\n\n import { BentoSidepanelEvent } from './sidepanel.types';\n import {\n BentoDialogPageAnimation,\n BentoDialogPageConfigData,\n BentoDialogPageRegisterPage,\n DIALOG_PAGE_CONFIG_INJECTION_KEY,\n DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY,\n } from '@/internal';\n\n import { SIDEPANEL_DIALOG_ID_INJECTION_KEY } from './sidepanel.keys';\n\n import { BentoClickOutsideDirective as vBentoClickOutsideDirective } from '@/directives/click-outside';\n\n import { useI18n } from '@/utils/ts/i18n';\n\n import messages from './messages.json';\n import { generateUid } from '@/core/utils/ts';\n import { deprecate } from '@/utils/ts/deprecate';\n\n type MessageSchema = (typeof messages)['en-US'];\n\n const props = defineProps({\n /**\n * The id of the current active page\n * Should be the same id as the BentoSidepanelPage to be displayed\n * If the component only has one page, it can be left null/undefined.\n */\n activePage: {\n type: String,\n default: null,\n },\n\n /**\n * If set to true, it allows the sidepanel to be closed.\n * Shows close button when `true` and hides close button when `false`.\n *\n * _Note: This property will not set the visibility of the close button in v2.0.0_\n */\n isDismissible: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Controls the sidepanel's state from the outside. Set it to true to open the sidepanel.\n */\n isOpen: {\n type: Boolean,\n default: null,\n },\n\n /**\n * Controls the visibility of close button on the sidepanel.\n * Defaults to `true` when `isDismissible=false`, and `true` when `isDimissible=true`.\n *\n * _Note: This property will be set to `false` by default, independent of `isDismissible` in v2.0.0_\n */\n hideCloseButton: {\n type: Boolean,\n default: null,\n },\n });\n\n const emit = defineEmits<{\n /**\n * Emits update event when page is changed internally\n */\n (e: BentoSidepanelEvent.UPDATE_ACTIVE_PAGE, page: string): void;\n /**\n * Emits close-sidepanel event when the sidepanel is closed\n */\n (e: BentoSidepanelEvent.UPDATE_IS_OPEN, isOpen: boolean): void;\n }>();\n\n // Refs\n const { activePage, isOpen } = toRefs(props);\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const sidepanel = ref(null);\n const pages = ref<string[]>([]);\n const previousPages = ref([]);\n const animation = ref(BentoDialogPageAnimation.TRANSITION_LEVEL_DEEPER);\n const isClosing = ref(false);\n const sidepanelId = generateUid('sidepanel');\n const internalIsOpen = ref(false);\n const isAnimationActive = ref(false);\n\n // Animation styling\n const conditionalClasses = computed(() => ({\n 'b-sidepanel--hide': isClosing.value,\n 'b-sidepanel--animation': isAnimationActive.value,\n }));\n\n // Handle closing and closing animation for dialog element\n const closeSidepanelAfterAnimation = () => {\n if (isClosing.value) {\n sidepanel.value.close();\n if (previousPages.value[0]) {\n emit(BentoSidepanelEvent.UPDATE_ACTIVE_PAGE, previousPages.value[0]);\n }\n previousPages.value = [];\n isClosing.value = false;\n internalIsOpen.value = false;\n emit(BentoSidepanelEvent.UPDATE_IS_OPEN, false);\n }\n };\n\n const startCloseSidepanelAnimation = () => {\n if (!sidepanel.value.open) {\n return;\n }\n isClosing.value = true;\n };\n\n const closeSidepanelOnClickOutside = () => {\n if (props.isDismissible) {\n startCloseSidepanelAnimation();\n }\n };\n\n // TODO: Remove in upcoming major. See properties `hideCloseButton` and `isDismissible`.\n const computedHideCloseButton = computed(() => {\n if (props.hideCloseButton !== null) {\n return props.hideCloseButton;\n }\n\n return !props.isDismissible;\n });\n\n // Watching isOpen prop to toggle open/close the dialog element\n watch(\n () => isOpen.value,\n async () => {\n // Wait for sidepanel ref to be created\n await nextTick();\n\n if (!sidepanel.value) {\n return;\n }\n\n if (isOpen.value) {\n internalIsOpen.value = true;\n sidepanel.value.showModal();\n if (!previousPages.value.length) {\n previousPages.value.push(activePage.value);\n }\n } else if (sidepanel.value.open) {\n startCloseSidepanelAnimation();\n }\n },\n { immediate: true }\n );\n\n // Pages\n const updatePage = page => emit(BentoSidepanelEvent.UPDATE_ACTIVE_PAGE, page);\n\n // unregister page if removed / destroyed\n const unregisterPage = (pageIdToRemove: string) => () => {\n pages.value = pages.value?.filter(pageId => pageId !== pageIdToRemove);\n };\n\n // Provide data and function to register page to subcomponent\n const registerPage: BentoDialogPageRegisterPage = pageId => {\n pages.value.push(pageId);\n\n return { unregisterPage: unregisterPage(pageId) };\n };\n\n provide<BentoDialogPageConfigData>(DIALOG_PAGE_CONFIG_INJECTION_KEY, {\n activePage,\n animation,\n isAnimationActive,\n isOpen: internalIsOpen,\n pages,\n previousPages,\n updatePage,\n });\n provide(DIALOG_PAGE_REGISTER_PAGE_INJECTION_KEY, registerPage);\n\n // Let's Children components know they are inside a SidePanel (dialog element)\n provide(SIDEPANEL_DIALOG_ID_INJECTION_KEY, sidepanelId);\n\n if (!props.isDismissible && props.hideCloseButton === null) {\n deprecate(\n 'BentoSidepanel \"isDismissible\" property’s behavior',\n 'BentoSidepanel \"isDismissible\" will no longer hide the close button. Use \"hideCloseButton=true\" instead.',\n '2.0.0'\n );\n }\n</script>\n\n<script lang=\"ts\">\n /**\n * Sidepanel component is a slide-in panel that should be used for presenting actions, settings or features that are directly associated with a specific task or interaction on the main screen.\n *\n * @example\n * import { BentoSidepanel, BentoSidepanelPage } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoSidepanel, BentoSidepanelPage },\n * template: `\n * <bento-sidepanel active-page='step1' is-open='true'>\n * <bento-sidepanel-page\n * title='Step 1'\n * pageId='step1'\n * :actions=\"[\n * {\n * title: 'Next step',\n * event: () => {\n * activePage.value = 'step2';\n * },\n * }]\">\n * Step 1 info\n * </bento-sidepanel-page>\n * <bento-sidepanel-page\n * title='Step 2'\n * pageId='step2'\n * :actions=\"[\n * {\n * title: 'Save',\n * event: () => {},\n * }]\">\n * Step 2 info\n * </bento-sidepanel-page>\n * </bento-sidepanel>\n * `\n * }\n */\n export default {\n i18n: { messages },\n };\n</script>\n<style lang=\"scss\" scoped src=\"./sidepanel.scss\" />\n"],"names":["__default__$1","BentoSidepanelEvent","BentoSidepanelEvent2","__default__","messages","props","__props","emit","__emit","activePage","isOpen","toRefs","t","useI18n","sidepanel","ref","pages","previousPages","animation","BentoDialogPageAnimation","isClosing","sidepanelId","generateUid","internalIsOpen","isAnimationActive","conditionalClasses","computed","closeSidepanelAfterAnimation","startCloseSidepanelAnimation","closeSidepanelOnClickOutside","computedHideCloseButton","watch","nextTick","updatePage","page","unregisterPage","pageIdToRemove","_a","pageId","registerPage","provide","DIALOG_PAGE_CONFIG_INJECTION_KEY","DIALOG_PAGE_REGISTER_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|
2
|
+
import { onMounted as b, onUnmounted as f, defineComponent as d, unref as m, openBlock as o, createElementBlock as p, normalizeClass as n, renderSlot as a, createBlock as v, Teleport as O, inject as i } from "vue";
|
|
2
3
|
import { i as l } from "./index.CWuzEfiV.js";
|
|
3
|
-
import { M as
|
|
4
|
-
import { S as
|
|
5
|
-
import { M as
|
|
6
|
-
import { _ as
|
|
4
|
+
import { M as g } from "./base-modal.keys.C2PQXcE2.js";
|
|
5
|
+
import { S as C } from "./sidepanel.keys.R0DKQuYx.js";
|
|
6
|
+
import { M as _ } from "./modal-fullscreen.keys.CMba3hYp.js";
|
|
7
|
+
import { _ as w } from "./_plugin-vue_export-helper.CHgC5LLL.js";
|
|
7
8
|
import "../assets/teleport.css";
|
|
8
|
-
const
|
|
9
|
+
const T = (e, t, s = {}) => {
|
|
10
|
+
let r;
|
|
11
|
+
b(() => {
|
|
12
|
+
r = c(e, t, s);
|
|
13
|
+
}), f(() => {
|
|
14
|
+
r && (r(), r = null);
|
|
15
|
+
});
|
|
16
|
+
}, y = d({
|
|
9
17
|
name: "teleport",
|
|
10
18
|
props: {
|
|
11
19
|
to: {
|
|
@@ -33,7 +41,7 @@ const _ = d({
|
|
|
33
41
|
defaultTo() {
|
|
34
42
|
if (this.to)
|
|
35
43
|
return this.to;
|
|
36
|
-
const e =
|
|
44
|
+
const e = i(g, "") || i(_, "") || i(C, "");
|
|
37
45
|
return e ? `#${e}` : "body";
|
|
38
46
|
}
|
|
39
47
|
},
|
|
@@ -75,10 +83,10 @@ const _ = d({
|
|
|
75
83
|
onMutations(e) {
|
|
76
84
|
let t = !1;
|
|
77
85
|
for (let s = 0; s < e.length; s++) {
|
|
78
|
-
const
|
|
79
|
-
(
|
|
86
|
+
const r = e[s], h = Array.from(r.addedNodes).filter(
|
|
87
|
+
(u) => !this.nodes.includes(u)
|
|
80
88
|
);
|
|
81
|
-
Array.from(
|
|
89
|
+
Array.from(r.removedNodes).includes(this.parent) ? (this.disable(), this.waiting = !this.disabled) : this.waiting && h.length > 0 && (t = !0);
|
|
82
90
|
}
|
|
83
91
|
t && this.move();
|
|
84
92
|
},
|
|
@@ -104,15 +112,15 @@ const _ = d({
|
|
|
104
112
|
return [];
|
|
105
113
|
}
|
|
106
114
|
}
|
|
107
|
-
}),
|
|
108
|
-
...
|
|
115
|
+
}), N = /* @__PURE__ */ d({
|
|
116
|
+
...y,
|
|
109
117
|
setup(e) {
|
|
110
|
-
return (t, s) =>
|
|
118
|
+
return (t, s) => m(l) ? (o(), p("div", {
|
|
111
119
|
key: 0,
|
|
112
120
|
class: n(t.classes)
|
|
113
121
|
}, [
|
|
114
122
|
a(t.$slots, "default", {}, void 0, !0)
|
|
115
|
-
], 2)) : (o(),
|
|
123
|
+
], 2)) : (o(), v(O, {
|
|
116
124
|
key: 1,
|
|
117
125
|
to: t.defaultTo,
|
|
118
126
|
where: t.where,
|
|
@@ -122,8 +130,9 @@ const _ = d({
|
|
|
122
130
|
a(t.$slots, "default", {}, void 0, !0)
|
|
123
131
|
], 8, ["to", "where", "disabled", "class"]));
|
|
124
132
|
}
|
|
125
|
-
}),
|
|
133
|
+
}), S = /* @__PURE__ */ w(N, [["__scopeId", "data-v-824493f9"]]);
|
|
126
134
|
export {
|
|
127
|
-
|
|
135
|
+
S as B,
|
|
136
|
+
T as u
|
|
128
137
|
};
|
|
129
|
-
//# sourceMappingURL=teleport.
|
|
138
|
+
//# sourceMappingURL=teleport.B255JhsV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teleport.B255JhsV.js","sources":["../../../vue2/src/composables/use-click-outside/use-click-outside.ts","../../../vue2/src/components/internal/teleport/teleport.vue"],"sourcesContent":["import { onClickOutside } from '@/directives/click-outside/on-click-outside';\nimport { OnClickOutsideHandler, OnClickOutsideOptions } from '@/directives/click-outside/types';\nimport { MaybeElementRef } from '@/types';\nimport { onMounted, onUnmounted } from 'vue';\n\n/**\n * Composable to listen for clicks outside of an element ref.\n *\n * @param {MaybeElementRef} target - HTML Element or \"ref\" to an Element on which the click outside listener will be attached to\n * @param {OnClickOutsideHandler} handler - Function that will be called when the listener gets triggered\n * @param {OnClickOutsideOptions} options - Options to be passed to the listener\n */\nexport const useClickOutside = <T extends OnClickOutsideOptions>(\n target: MaybeElementRef,\n handler: OnClickOutsideHandler,\n options: T = {} as T\n) => {\n let onClickOutsideStop: () => void;\n\n onMounted(() => {\n onClickOutsideStop = onClickOutside(target, handler, options);\n });\n\n onUnmounted(() => {\n if (onClickOutsideStop) {\n onClickOutsideStop();\n\n onClickOutsideStop = null;\n }\n });\n};\n","<!-- 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 } 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</script>\n\n<script lang=\"ts\">\n export default defineComponent({\n name: 'teleport',\n props: {\n to: {\n type: String,\n default: '',\n },\n where: {\n type: String,\n default: 'after',\n },\n disabled: Boolean,\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 // eslint-disable-next-line no-plusplus\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":["useClickOutside","target","handler","options","onClickOutsideStop","onMounted","onClickOutside","onUnmounted","__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":";;;;;;;;AAYO,MAAAA,IAAA,CAAAC,GAAAC,GAAAC,IAAA,CAAA,MAAA;AAKH,MAAAC;AAEA,EAAAC,EAAA,MAAA;AACI,IAAAD,IAAAE,EAAAL,GAAAC,GAAAC,CAAA;AAAA,EAA4D,CAAA,GAGhEI,EAAA,MAAA;AACI,IAAAH,MACIA,EAAA,GAEAA,IAAA;AAAA,EACJ,CAAA;AAER,GCXII,IAAAC,EAAA;AAAA,EAA+B,MAAA;AAAA,EACrB,OAAA;AAAA,IACC,IA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AA,MAAA,QAAA,CAAAH,MAAAA,EAAA,cAAAA,EAAA,WAAA,YAAAA,CAAA,CAAA,GACA,KAAA,QAAA,KAAA,yBAAA,GACA,KAAA,UAAA;AAAA,MACJ,CAAA,GAGJ,KAAA,cAAA,QAAA,KAAA,KAAA;AAAA,QAAqC,WAAA;AAAA,QACtB,SAAA;AAAA,QACF,YAAA;AAAA,QACG,eAAA;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;AAIQ,aAAA,CAAA;AAAA,IAI+E;AAAA,EACvF;AAER,CAAA;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { B as
|
|
1
|
+
import { defineComponent as be, useAttrs as fe, toRefs as w, ref as v, toRef as me, computed as i, watch as I, nextTick as pe, onMounted as he, onUnmounted as ye, openBlock as c, createElementBlock as M, normalizeClass as L, createElementVNode as N, normalizeStyle as W, unref as t, createBlock as h, createCommentVNode as b, withCtx as E, createTextVNode as V, toDisplayString as z, createVNode as k, withKeys as H } from "vue";
|
|
2
|
+
import { B as ge } from "./button.pwNCxwPu.js";
|
|
3
3
|
import { B as O } from "./typography.DNzU41ah.js";
|
|
4
|
-
import { C as
|
|
5
|
-
import { g as
|
|
4
|
+
import { C as xe } from "./cross-circle-fill-small.BXO78Wde.js";
|
|
5
|
+
import { g as Le } from "./generate-uid.D-HFI38h.js";
|
|
6
6
|
import { o as q } from "./resize.Bqks3WUm.js";
|
|
7
|
-
import { u as
|
|
8
|
-
import { u as
|
|
9
|
-
import { u as
|
|
10
|
-
import { F as
|
|
11
|
-
import { _ as
|
|
7
|
+
import { u as Ee } from "./aria-label.CaUURpnB.js";
|
|
8
|
+
import { u as Ce } from "./i18n.CPGoe9tN.js";
|
|
9
|
+
import { u as _e } from "./use-form-layout-loading.D3lALhtC.js";
|
|
10
|
+
import { F as Ae, E as K } from "./error-message.BYXS0kUN.js";
|
|
11
|
+
import { _ as Se } from "./_plugin-vue_export-helper.CHgC5LLL.js";
|
|
12
12
|
import "../assets/textarea.css";
|
|
13
|
-
var T = /* @__PURE__ */ ((e) => (e.HORIZONTAL = "horizontal", e.VERTICAL = "vertical", e.BOTH = "both", e.NONE = "none", e))(T || {}),
|
|
13
|
+
var T = /* @__PURE__ */ ((e) => (e.HORIZONTAL = "horizontal", e.VERTICAL = "vertical", e.BOTH = "both", e.NONE = "none", e))(T || {}), f = /* @__PURE__ */ ((e) => (e.CLEARABLE = "clearable", e.DISABLED = "disabled", e.ERROR = "error", e.READONLY = "readonly", e))(f || {}), n = /* @__PURE__ */ ((e) => (e.BLUR = "blur", e.CHANGE = "change", e.CLEAR = "clear", e.ESCAPE_PRESSED = "escape-pressed", e.FOCUS = "focus", e.INPUT = "input", e))(n || {});
|
|
14
14
|
const Y = {
|
|
15
15
|
"en-US": {
|
|
16
16
|
clearText: "Clear text",
|
|
17
17
|
textarea: "textarea",
|
|
18
18
|
yourTextCanBenAtMost: "Your text can be at most {characterLimit} characters"
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, Re = ["id", "value", "aria-label", "aria-invalid", "readonly", "disabled", "placeholder"], Be = {
|
|
21
21
|
key: 0,
|
|
22
22
|
class: "b-textarea__clear-button"
|
|
23
|
-
},
|
|
23
|
+
}, Ie = {
|
|
24
24
|
i18n: { messages: Y },
|
|
25
25
|
name: "bento-textarea"
|
|
26
|
-
},
|
|
27
|
-
...
|
|
26
|
+
}, Ne = /* @__PURE__ */ be({
|
|
27
|
+
...Ie,
|
|
28
28
|
props: {
|
|
29
29
|
/**
|
|
30
30
|
* Text that labels an the input element
|
|
@@ -91,10 +91,10 @@ const Y = {
|
|
|
91
91
|
*/
|
|
92
92
|
value: { type: String, default: "" }
|
|
93
93
|
},
|
|
94
|
-
setup(e, {
|
|
95
|
-
const
|
|
94
|
+
setup(e, { expose: G, emit: j }) {
|
|
95
|
+
const Z = fe(), a = e, u = j, { height: d } = w(a), U = Le("textarea"), l = v(null), m = v(null), r = v(a.value), C = 44, p = v(a.height || `${C}px`), _ = v("100%");
|
|
96
96
|
let y = null, g = null;
|
|
97
|
-
const { t: $ } =
|
|
97
|
+
const { t: $ } = Ce({ messages: Y }), { isReadOnly: x } = _e(me(a, "readonly")), J = i(() => `${r.value.length} / ${a.characterLimit}`), A = i(
|
|
98
98
|
() => a.characterLimit && r.value.length > a.characterLimit
|
|
99
99
|
), S = () => {
|
|
100
100
|
l.value && l.value.scrollHeight > C && (p.value = `${l.value.scrollHeight + 3}px`);
|
|
@@ -110,73 +110,77 @@ const Y = {
|
|
|
110
110
|
), I(
|
|
111
111
|
() => r.value,
|
|
112
112
|
async () => {
|
|
113
|
-
var
|
|
114
|
-
if (!d.value && (!l.value || ((
|
|
113
|
+
var o, s;
|
|
114
|
+
if (!d.value && (!l.value || ((o = l.value) == null ? void 0 : o.scrollHeight) > ((s = l.value) == null ? void 0 : s.clientHeight))) {
|
|
115
115
|
if (p.value = `${C}px`, !r.value)
|
|
116
116
|
return;
|
|
117
|
-
await
|
|
117
|
+
await pe(), S();
|
|
118
118
|
}
|
|
119
119
|
},
|
|
120
120
|
{ immediate: !0 }
|
|
121
121
|
);
|
|
122
|
-
const D =
|
|
123
|
-
[`b-textarea--${
|
|
124
|
-
})),
|
|
125
|
-
[`b-textarea__input--${
|
|
126
|
-
[`b-textarea__input--${
|
|
127
|
-
[`b-textarea__input--${
|
|
122
|
+
const D = i(() => !!a.errorMessage || A.value), Q = i(() => ({
|
|
123
|
+
[`b-textarea--${f.DISABLED}`]: a.disabled
|
|
124
|
+
})), X = i(() => ({
|
|
125
|
+
[`b-textarea__input--${f.CLEARABLE}`]: a.clearable,
|
|
126
|
+
[`b-textarea__input--${f.READONLY}`]: x.value,
|
|
127
|
+
[`b-textarea__input--${f.ERROR}`]: D.value,
|
|
128
128
|
"b-textarea__input--dynamic-height": !d.value
|
|
129
|
-
})),
|
|
129
|
+
})), ee = i(() => ({
|
|
130
130
|
"b-textarea__label-box--no-label": !a.label
|
|
131
|
-
})),
|
|
132
|
-
[`b-textarea__label-item--${
|
|
133
|
-
})),
|
|
134
|
-
ariaLabel:
|
|
131
|
+
})), ae = i(() => ({
|
|
132
|
+
[`b-textarea__label-item--${f.ERROR}`]: A.value
|
|
133
|
+
})), te = i(() => $("yourTextCanBenAtMost", { characterLimit: a.characterLimit })), le = v(Z["aria-label"]), { ariaLabel: re, label: R } = w(a), oe = Ee({
|
|
134
|
+
ariaLabel: le.value,
|
|
135
135
|
// TODO: take this line away when the aria-label props is removed
|
|
136
|
-
label:
|
|
136
|
+
label: re,
|
|
137
137
|
defaultFallback: R
|
|
138
|
-
}), ie =
|
|
138
|
+
}), ie = i(
|
|
139
139
|
() => a.clearable && r.value && !a.disabled && !x.value
|
|
140
140
|
), B = () => {
|
|
141
141
|
r.value = "", u(n.CLEAR), u(n.INPUT, "");
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
}, se = () => {
|
|
145
|
-
l.value.scrollTop = 0, u(n.BLUR);
|
|
142
|
+
}, se = (o) => {
|
|
143
|
+
o.stopImmediatePropagation(), !a.disabled && !x.value && (r.value = o.target.value, u(n.INPUT, r.value));
|
|
146
144
|
}, ne = () => {
|
|
147
|
-
l.value.
|
|
145
|
+
l.value.scrollTop = 0, u(n.BLUR);
|
|
148
146
|
}, ue = () => {
|
|
149
|
-
u(n.
|
|
147
|
+
l.value.focus(), u(n.FOCUS);
|
|
150
148
|
}, ce = () => {
|
|
149
|
+
u(n.CHANGE);
|
|
150
|
+
}, de = () => {
|
|
151
151
|
u(n.ESCAPE_PRESSED);
|
|
152
|
-
}, F = (
|
|
152
|
+
}, F = (o = !1) => {
|
|
153
153
|
var P;
|
|
154
154
|
const s = l.value.style.width;
|
|
155
|
-
if (l.value.style.height && (p.value = l.value.style.height),
|
|
155
|
+
if (l.value.style.height && (p.value = l.value.style.height), o && !s)
|
|
156
156
|
return;
|
|
157
|
-
const
|
|
158
|
-
!s || parseInt(s, 10) >
|
|
157
|
+
const ve = (P = m == null ? void 0 : m.value) == null ? void 0 : P.offsetWidth;
|
|
158
|
+
!s || parseInt(s, 10) > ve ? _.value = "100%" : _.value = s;
|
|
159
159
|
};
|
|
160
|
-
return
|
|
160
|
+
return G({
|
|
161
|
+
focus: () => {
|
|
162
|
+
l.value.focus();
|
|
163
|
+
}
|
|
164
|
+
}), he(() => {
|
|
161
165
|
y = q(l.value, () => {
|
|
162
166
|
F(!0);
|
|
163
|
-
}), g = q(
|
|
167
|
+
}), g = q(m.value, () => {
|
|
164
168
|
F();
|
|
165
169
|
}), d.value || S();
|
|
166
|
-
}),
|
|
170
|
+
}), ye(() => {
|
|
167
171
|
y == null || y.disconnect(), g == null || g.disconnect();
|
|
168
|
-
}), (
|
|
172
|
+
}), (o, s) => (c(), M("div", {
|
|
169
173
|
ref_key: "textareaComponent",
|
|
170
|
-
ref:
|
|
171
|
-
class: L(["b-textarea",
|
|
174
|
+
ref: m,
|
|
175
|
+
class: L(["b-textarea", Q.value])
|
|
172
176
|
}, [
|
|
173
177
|
N("div", {
|
|
174
178
|
style: W({ width: _.value })
|
|
175
179
|
}, [
|
|
176
180
|
N("div", {
|
|
177
|
-
class: L(["b-textarea__label-box",
|
|
181
|
+
class: L(["b-textarea__label-box", ee.value])
|
|
178
182
|
}, [
|
|
179
|
-
t(R) ? (c(), h(t(
|
|
183
|
+
t(R) ? (c(), h(t(Ae), {
|
|
180
184
|
key: 0,
|
|
181
185
|
for: t(U),
|
|
182
186
|
label: t(R),
|
|
@@ -187,10 +191,10 @@ const Y = {
|
|
|
187
191
|
e.characterLimit ? (c(), h(t(O), {
|
|
188
192
|
key: 1,
|
|
189
193
|
el: "span",
|
|
190
|
-
class: L(["b-textarea__label-item",
|
|
194
|
+
class: L(["b-textarea__label-item", ae.value])
|
|
191
195
|
}, {
|
|
192
196
|
default: E(() => [
|
|
193
|
-
V(z(
|
|
197
|
+
V(z(J.value), 1)
|
|
194
198
|
]),
|
|
195
199
|
_: 1
|
|
196
200
|
}, 8, ["class"])) : b("", !0)
|
|
@@ -206,21 +210,21 @@ const Y = {
|
|
|
206
210
|
ref_key: "textareaElement",
|
|
207
211
|
ref: l,
|
|
208
212
|
value: r.value,
|
|
209
|
-
class: L(["b-textarea__input",
|
|
210
|
-
"aria-label": t(
|
|
213
|
+
class: L(["b-textarea__input", X.value]),
|
|
214
|
+
"aria-label": t(oe),
|
|
211
215
|
"aria-invalid": D.value,
|
|
212
216
|
readonly: t(x),
|
|
213
217
|
disabled: e.disabled,
|
|
214
218
|
placeholder: e.placeholder,
|
|
215
219
|
style: W({ resize: e.resizable, height: p.value }),
|
|
216
|
-
onBlur:
|
|
217
|
-
onChange:
|
|
218
|
-
onFocus:
|
|
219
|
-
onInput:
|
|
220
|
-
onKeydown: H(
|
|
221
|
-
}, " ", 46,
|
|
222
|
-
ie.value ? (c(), M("div",
|
|
223
|
-
k(t(
|
|
220
|
+
onBlur: ne,
|
|
221
|
+
onChange: ce,
|
|
222
|
+
onFocus: ue,
|
|
223
|
+
onInput: se,
|
|
224
|
+
onKeydown: H(de, ["esc"])
|
|
225
|
+
}, " ", 46, Re),
|
|
226
|
+
ie.value ? (c(), M("div", Be, [
|
|
227
|
+
k(t(ge), {
|
|
224
228
|
variant: "tertiary",
|
|
225
229
|
disabled: e.disabled,
|
|
226
230
|
onClick: B,
|
|
@@ -228,7 +232,7 @@ const Y = {
|
|
|
228
232
|
onKeyup: H(B, ["space"])
|
|
229
233
|
}, {
|
|
230
234
|
iconLeft: E(() => [
|
|
231
|
-
k(t(
|
|
235
|
+
k(t(xe), {
|
|
232
236
|
"svg-title": t($)("clearText")
|
|
233
237
|
}, null, 8, ["svg-title"])
|
|
234
238
|
]),
|
|
@@ -240,7 +244,7 @@ const Y = {
|
|
|
240
244
|
}, 8, ["aria-disabled"]),
|
|
241
245
|
A.value ? (c(), h(t(K), {
|
|
242
246
|
key: 0,
|
|
243
|
-
"error-message":
|
|
247
|
+
"error-message": te.value
|
|
244
248
|
}, null, 8, ["error-message"])) : b("", !0),
|
|
245
249
|
e.errorMessage ? (c(), h(t(K), {
|
|
246
250
|
key: 1,
|
|
@@ -259,8 +263,8 @@ const Y = {
|
|
|
259
263
|
], 4)
|
|
260
264
|
], 2));
|
|
261
265
|
}
|
|
262
|
-
}),
|
|
266
|
+
}), Ve = /* @__PURE__ */ Se(Ne, [["__scopeId", "data-v-8d67afab"]]);
|
|
263
267
|
export {
|
|
264
|
-
|
|
268
|
+
Ve as B
|
|
265
269
|
};
|
|
266
|
-
//# sourceMappingURL=textarea.
|
|
270
|
+
//# sourceMappingURL=textarea.D1weaQCC.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.vAp6HFi9.js","sources":["../../../vue2/src/components/textarea/textarea.types.ts","../../../vue2/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}\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 >\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 * Emitted when the element has lost focus\n */\n (e: BentoTextareaEvent.BLUR): void;\n\n /**\n * Emitted when the user modifies the element's value. Unlike the 'input' event, the change event is not necessarily fired for each alteration to an element's value\n */\n (e: BentoTextareaEvent.CHANGE): void;\n\n /**\n * Emitted when the \"Clear\" button was clicked\n */\n (e: BentoTextareaEvent.CLEAR): void;\n\n /**\n * Emitted when the \"ESC\" key is pressed\n */\n (e: BentoTextareaEvent.ESCAPE_PRESSED): void;\n\n /**\n * Emitted when the element has received focus\n */\n (e: BentoTextareaEvent.FOCUS): void;\n\n /**\n * Emitted when the component's model changes\n */\n (e: BentoTextareaEvent.INPUT, value: string): void;\n }>();\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 /**\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 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","props","__props","emit","__emit","height","toRefs","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","onInput","event","onBlur","onFocus","onChange","onPressEscape","resizeTextareaWrapper","isTextareaElement","textareaStyleWidth","textareaComponentWidth","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,SANQA,IAAAD,KAAA,CAAA,CAAA;;;;;;;;;;GCgYRE,KAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAAA,EACM,MAAA;AAErB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAvTA,UAAAC,IAAAC,GAAA,GAEAC,IAAAC,GAiFAC,IAAAC,GAgCA,EAAA,QAAAC,EAAA,I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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"textarea.D1weaQCC.js","sources":["../../../vue2/src/components/textarea/textarea.types.ts","../../../vue2/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}\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 >\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 * Emitted when the element has lost focus\n */\n (e: BentoTextareaEvent.BLUR): void;\n\n /**\n * Emitted when the user modifies the element's value. Unlike the 'input' event, the change event is not necessarily fired for each alteration to an element's value\n */\n (e: BentoTextareaEvent.CHANGE): void;\n\n /**\n * Emitted when the \"Clear\" button was clicked\n */\n (e: BentoTextareaEvent.CLEAR): void;\n\n /**\n * Emitted when the \"ESC\" key is pressed\n */\n (e: BentoTextareaEvent.ESCAPE_PRESSED): void;\n\n /**\n * Emitted when the element has received focus\n */\n (e: BentoTextareaEvent.FOCUS): void;\n\n /**\n * Emitted when the component's model changes\n */\n (e: BentoTextareaEvent.INPUT, value: string): void;\n }>();\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 /**\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","props","__props","emit","__emit","height","toRefs","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","onInput","event","onBlur","onFocus","onChange","onPressEscape","resizeTextareaWrapper","isTextareaElement","textareaStyleWidth","textareaComponentWidth","__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,SANQA,IAAAD,KAAA,CAAA,CAAA;;;;;;;;;;GCwYRE,KAAA;AAAA,EAAe,MAAA,EAAA,UAAAC,EAAA;AAAA,EACM,MAAA;AAErB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA/TA,UAAAC,IAAAC,GAAA,GAEAC,IAAAC,GAiFAC,IAAAC,GAgCA,EAAA,QAAAC,EAAA,IAAAC,EAAAL,CAAA,GAEAM,IAAAC,GAAA,UAAA,GACAC,IAAAC,EAAA,IAAA,GACAC,IAAAD,EAAA,IAAA,GACAE,IAAAF,EAAAT,EAAA,KAAA,GACAY,IAAA,IACAC,IAAAJ,EAAAT,EAAA,UAAA,GAAAY,CAAA,IAAA,GACAE,IAAAL,EAAA,MAAA;AACA,QAAAM,IAAA,MACAC,IAAA;AAEA,UAAA,EAAA,GAAAC,EAAA,IAAAC,GAAA,EAAA,UAAArB,EAAA,CAAA,GAEA,EAAA,YAAAsB,EAAA,IAAAC,GAAAC,GAAArB,GAAA,UAAA,CAAA,GAEAsB,IAAAC,EAAA,MAAA,GAAAZ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D,KAAA,MAAA;AACI,MAAA9C,EAAAR,EAAA,cAAA;AAAA,IAAsC,GAO1CuD,IAAA,CAAAC,IAAA,OAAA;;AAEI,YAAAC,IAAA3C,EAAA,MAAA,MAAA;AASA,UANAA,EAAA,MAAA,MAAA,WACIK,EAAA,QAAAL,EAAA,MAAA,MAAA,SAKJ0C,KAAA,CAAAC;AACI;AAIJ,YAAAC,MAAAzB,IAAAjB,KAAA,gBAAAA,EAAA,UAAA,gBAAAiB,EAAA;AAGA,MAAA,CAAAwB,KAAA,SAAAA,GAAA,EAAA,IAAAC,KACItC,EAAA,QAAA,SAGAA,EAAA,QAAAqC;AAAA,IACJ;AAOJ,WAAAE,EAAA;AAAA,MAAa,OAJb,MAAA;AACI,QAAA7C,EAAA,MAAA,MAAA;AAAA,MAA4B;AAAA,IAI5B,CAAA,GAGJ8C,GAAA,MAAA;AACI,MAAAvC,IAAAwC,EAAA/C,EAAA,OAAA,MAAA;AACI,QAAAyC,EAAA,EAAA;AAAA,MAA0B,CAAA,GAG9BjC,IAAAuC,EAAA7C,EAAA,OAAA,MAAA;AACI,QAAAuC,EAAA;AAAA,MAAsB,CAAA,GAG1B7C,EAAA,SACIqB,EAAA;AAAA,IACJ,CAAA,GAGJ+B,GAAA,MAAA;AACI,MAAAzC,KAAA,QAAAA,EAAA,cACAC,KAAA,QAAAA,EAAA;AAAA,IAAsC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent as ne, computed as m, ref as D, toRefs as ce, provide as z, resolveComponent as I, openBlock as i, createElementBlock as v, createBlock as T, withCtx as h, createTextVNode as w, toDisplayString as g, createCommentVNode as c, createVNode as S, createElementVNode as y, renderSlot as H, mergeProps as V, inject as K, onUnmounted as fe, normalizeClass as W, Fragment as Y, renderList as pe } from "vue";
|
|
2
2
|
import { B as oe } from "./button.pwNCxwPu.js";
|
|
3
|
-
import { B as ve } from "./textarea.
|
|
3
|
+
import { B as ve } from "./textarea.D1weaQCC.js";
|
|
4
4
|
import { u as ae } from "./i18n.CPGoe9tN.js";
|
|
5
|
-
import { B as _e } from "./button-actions.
|
|
5
|
+
import { B as _e } from "./button-actions.BjlQS6tm.js";
|
|
6
6
|
import { _ as q } from "./_plugin-vue_export-helper.CHgC5LLL.js";
|
|
7
7
|
import { B as be } from "./date.DVGj7WKQ.js";
|
|
8
8
|
import { B as he } from "./link.D7wA0jkY.js";
|
|
@@ -555,4 +555,4 @@ export {
|
|
|
555
555
|
se as d,
|
|
556
556
|
vt as t
|
|
557
557
|
};
|
|
558
|
-
//# sourceMappingURL=timeline-item.
|
|
558
|
+
//# sourceMappingURL=timeline-item.BDYrjKhM.js.map
|