@dialpad/dialtone 9.133.0 → 9.135.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/css/dialtone-default-theme.css +92 -54
- package/dist/css/dialtone-default-theme.min.css +1 -1
- package/dist/css/dialtone.css +92 -54
- package/dist/css/dialtone.min.css +1 -1
- package/dist/css/tokens-docs.json +1 -1
- package/dist/tokens/doc.json +42748 -42748
- package/dist/vue2/common/emoji/index.cjs +1 -1
- package/dist/vue2/common/emoji/index.cjs.map +1 -1
- package/dist/vue2/common/emoji/index.js +46 -39
- package/dist/vue2/common/emoji/index.js.map +1 -1
- package/dist/vue2/component-documentation.json +1 -1
- package/dist/vue2/dialtone-vue.cjs +1 -1
- package/dist/vue2/dialtone-vue.js +360 -359
- package/dist/vue2/lib/avatar/utils.cjs +1 -1
- package/dist/vue2/lib/avatar/utils.cjs.map +1 -1
- package/dist/vue2/lib/avatar/utils.js +6 -5
- package/dist/vue2/lib/avatar/utils.js.map +1 -1
- package/dist/vue2/lib/emoji-row/emoji-row.cjs +1 -1
- package/dist/vue2/lib/emoji-row/emoji-row.cjs.map +1 -1
- package/dist/vue2/lib/emoji-row/emoji-row.js +34 -32
- package/dist/vue2/lib/emoji-row/emoji-row.js.map +1 -1
- package/dist/vue2/lib/message-input/message-input.cjs +1 -1
- package/dist/vue2/lib/message-input/message-input.cjs.map +1 -1
- package/dist/vue2/lib/message-input/message-input.js +4 -4
- package/dist/vue2/lib/message-input/message-input.js.map +1 -1
- package/dist/vue2/lib/modal/modal.cjs +1 -1
- package/dist/vue2/lib/modal/modal.cjs.map +1 -1
- package/dist/vue2/lib/modal/modal.js +25 -25
- package/dist/vue2/lib/modal/modal.js.map +1 -1
- package/dist/vue2/lib/tooltip-directive/tooltip.cjs +1 -1
- package/dist/vue2/lib/tooltip-directive/tooltip.cjs.map +1 -1
- package/dist/vue2/lib/tooltip-directive/tooltip.js +59 -29
- package/dist/vue2/lib/tooltip-directive/tooltip.js.map +1 -1
- package/dist/vue2/localization/en-US.cjs +14 -1
- package/dist/vue2/localization/en-US.cjs.map +1 -1
- package/dist/vue2/localization/en-US.js +14 -1
- package/dist/vue2/localization/en-US.js.map +1 -1
- package/dist/vue2/localization/es-LA.cjs +8 -1
- package/dist/vue2/localization/es-LA.cjs.map +1 -1
- package/dist/vue2/localization/es-LA.js +8 -1
- package/dist/vue2/localization/es-LA.js.map +1 -1
- package/dist/vue2/types/common/emoji/index.d.ts +1 -0
- package/dist/vue2/types/common/emoji/index.d.ts.map +1 -1
- package/dist/vue2/types/components/avatar/utils.d.ts +1 -1
- package/dist/vue2/types/components/avatar/utils.d.ts.map +1 -1
- package/dist/vue2/types/components/modal/modal.vue.d.ts.map +1 -1
- package/dist/vue2/types/directives/tooltip_directive/tooltip.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/emoji_row/emoji_row.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
- package/dist/vue3/common/emoji/index.cjs +1 -1
- package/dist/vue3/common/emoji/index.cjs.map +1 -1
- package/dist/vue3/common/emoji/index.js +46 -39
- package/dist/vue3/common/emoji/index.js.map +1 -1
- package/dist/vue3/component-documentation.json +1 -1
- package/dist/vue3/dialtone-vue.cjs +1 -1
- package/dist/vue3/dialtone-vue.js +363 -362
- package/dist/vue3/lib/avatar/utils.cjs +1 -1
- package/dist/vue3/lib/avatar/utils.cjs.map +1 -1
- package/dist/vue3/lib/avatar/utils.js +6 -5
- package/dist/vue3/lib/avatar/utils.js.map +1 -1
- package/dist/vue3/lib/emoji-row/emoji-row.cjs +1 -1
- package/dist/vue3/lib/emoji-row/emoji-row.cjs.map +1 -1
- package/dist/vue3/lib/emoji-row/emoji-row.js +50 -39
- package/dist/vue3/lib/emoji-row/emoji-row.js.map +1 -1
- package/dist/vue3/lib/emoji-text-wrapper/emoji-text-wrapper.cjs +1 -1
- package/dist/vue3/lib/emoji-text-wrapper/emoji-text-wrapper.cjs.map +1 -1
- package/dist/vue3/lib/emoji-text-wrapper/emoji-text-wrapper.js +1 -0
- package/dist/vue3/lib/emoji-text-wrapper/emoji-text-wrapper.js.map +1 -1
- package/dist/vue3/lib/message-input/message-input.cjs +1 -1
- package/dist/vue3/lib/message-input/message-input.cjs.map +1 -1
- package/dist/vue3/lib/message-input/message-input.js +31 -28
- package/dist/vue3/lib/message-input/message-input.js.map +1 -1
- package/dist/vue3/lib/modal/modal.cjs +1 -1
- package/dist/vue3/lib/modal/modal.cjs.map +1 -1
- package/dist/vue3/lib/modal/modal.js +39 -39
- package/dist/vue3/lib/modal/modal.js.map +1 -1
- package/dist/vue3/lib/toast/toast.cjs +1 -1
- package/dist/vue3/lib/toast/toast.cjs.map +1 -1
- package/dist/vue3/lib/toast/toast.js +96 -88
- package/dist/vue3/lib/toast/toast.js.map +1 -1
- package/dist/vue3/lib/tooltip-directive/tooltip.cjs +1 -1
- package/dist/vue3/lib/tooltip-directive/tooltip.cjs.map +1 -1
- package/dist/vue3/lib/tooltip-directive/tooltip.js +66 -36
- package/dist/vue3/lib/tooltip-directive/tooltip.js.map +1 -1
- package/dist/vue3/localization/en-US.cjs +14 -1
- package/dist/vue3/localization/en-US.cjs.map +1 -1
- package/dist/vue3/localization/en-US.js +14 -1
- package/dist/vue3/localization/en-US.js.map +1 -1
- package/dist/vue3/localization/es-LA.cjs +8 -1
- package/dist/vue3/localization/es-LA.cjs.map +1 -1
- package/dist/vue3/localization/es-LA.js +8 -1
- package/dist/vue3/localization/es-LA.js.map +1 -1
- package/dist/vue3/types/common/emoji/index.d.ts +1 -0
- package/dist/vue3/types/common/emoji/index.d.ts.map +1 -1
- package/dist/vue3/types/components/avatar/utils.d.ts +1 -1
- package/dist/vue3/types/components/avatar/utils.d.ts.map +1 -1
- package/dist/vue3/types/components/emoji_text_wrapper/emoji_text_wrapper.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/modal/modal.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/toast/layouts/toast_layout_alternate.vue.d.ts +3 -0
- package/dist/vue3/types/components/toast/layouts/toast_layout_alternate.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/toast/layouts/toast_layout_default.vue.d.ts +3 -0
- package/dist/vue3/types/components/toast/layouts/toast_layout_default.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/toast/toast.vue.d.ts +6 -0
- package/dist/vue3/types/directives/tooltip_directive/tooltip.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/emoji_row/emoji_row.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.js","sources":["../../../components/modal/modal.vue"],"sourcesContent":["<template>\n <dt-lazy-show\n transition=\"d-zoom\"\n :show=\"show\"\n :class=\"[\n 'd-modal',\n MODAL_KIND_MODIFIERS[kind],\n MODAL_SIZE_MODIFIERS[size],\n modalClass,\n ]\"\n data-qa=\"dt-modal\"\n :aria-hidden=\"open\"\n v-on=\"modalListeners\"\n >\n <div\n v-if=\"show && (hasSlotContent($slots.banner) || bannerTitle)\"\n data-qa=\"dt-modal-banner\"\n :class=\"[\n 'd-modal__banner',\n bannerClass,\n bannerKindClass,\n ]\"\n >\n <!-- @slot Slot for the banner, defaults to bannerTitle prop -->\n <slot name=\"banner\">\n {{ bannerTitle }}\n </slot>\n </div>\n <transition\n appear\n name=\"d-modal__dialog\"\n >\n <div\n v-show=\"show\"\n :class=\"[\n 'd-modal__dialog',\n { 'd-modal__dialog--scrollable': fixedHeaderFooter },\n dialogClass,\n ]\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-describedby=\"describedById\"\n :aria-labelledby=\"labelledById\"\n >\n <div\n v-if=\"hasSlotContent($slots.header)\"\n :id=\"labelledById\"\n class=\"d-modal__header\"\n data-qa=\"dt-modal-title\"\n >\n <!-- @slot Slot for dialog header section, taking the place of any \"title\" text prop -->\n <slot name=\"header\" />\n </div>\n <h2\n v-else\n :id=\"labelledById\"\n class=\"d-modal__header\"\n data-qa=\"dt-modal-title\"\n >\n {{ title }}\n </h2>\n <div\n v-if=\"hasSlotContent($slots.default)\"\n :class=\"[\n 'd-modal__content',\n contentClass,\n ]\"\n data-qa=\"dt-modal-copy\"\n >\n <!-- @slot Default slot for dialog body section, taking the place of any \"copy\" text prop -->\n <slot />\n </div>\n <p\n v-else\n :class=\"[\n 'd-modal__content',\n contentClass,\n ]\"\n data-qa=\"dt-modal-copy\"\n >\n {{ copy }}\n </p>\n <footer\n v-if=\"hasFooterSlot\"\n class=\"d-modal__footer\"\n >\n <!-- @slot Slot for dialog footer content, often containing cancel and confirm buttons. -->\n <slot name=\"footer\" />\n </footer>\n <sr-only-close-button\n v-if=\"hideClose\"\n @close=\"close\"\n />\n <dt-button\n v-else\n class=\"d-modal__close\"\n data-qa=\"dt-modal-close-button\"\n circle\n size=\"lg\"\n importance=\"clear\"\n :aria-label=\"closeButtonTitle\"\n :title=\"closeButtonTitle\"\n @click=\"close\"\n >\n <template #icon>\n <dt-icon-close\n size=\"400\"\n />\n </template>\n </dt-button>\n </div>\n </transition>\n </dt-lazy-show>\n</template>\n\n<script>\n/* eslint-disable max-lines */\nimport { DtButton } from '@/components/button';\nimport { DtIconClose } from '@dialpad/dialtone-icons/vue3';\nimport Modal from '@/common/mixins/modal';\nimport {\n MODAL_BANNER_KINDS,\n MODAL_KIND_MODIFIERS,\n MODAL_SIZE_MODIFIERS,\n} from './modal_constants';\nimport { returnFirstEl, getUniqueString, hasSlotContent, disableRootScrolling, enableRootScrolling } from '@/common/utils';\nimport { DtLazyShow } from '@/components/lazy_show';\nimport { EVENT_KEYNAMES } from '@/common/constants';\nimport SrOnlyCloseButton from '@/common/sr_only_close_button.vue';\nimport { NOTICE_KINDS } from '@/components/notice';\nimport { DialtoneLocalization } from '@/localization';\n\n/**\n * Modals focus the user’s attention exclusively on one task or piece of information\n * via a window that sits on top of the page content.\n * @see https://dialtone.dialpad.com/components/modal.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtModal',\n\n components: {\n DtLazyShow,\n DtButton,\n DtIconClose,\n SrOnlyCloseButton,\n },\n\n mixins: [Modal],\n\n props: {\n /**\n * Body text to display as the modal's main content.\n */\n copy: {\n type: String,\n default: '',\n },\n\n /**\n * Id to use for the dialog's aria-describedby.\n * Recommended only if the dialog content itself isn't enough to give full context,\n * as screen readers should recite the dialog contents by default before any aria-description.\n */\n describedById: {\n type: String,\n default: '',\n },\n\n /**\n * Id to use for the dialog's aria-labelledby.\n */\n labelledById: {\n type: String,\n default: function () { return getUniqueString(); },\n },\n\n /**\n * Whether the modal should be shown.\n * Parent component can sync on this value to control the modal's visibility.\n * @values true, false\n */\n show: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Title text to display in the modal header.\n */\n title: {\n type: String,\n default: '',\n },\n\n /**\n * Title text to display in the modal banner.\n */\n bannerTitle: {\n type: String,\n default: '',\n },\n\n /**\n * The theme of the modal. kind - default or danger,\n * @values default, danger\n */\n kind: {\n type: String,\n default: 'default',\n validator: (k) => Object.keys(MODAL_KIND_MODIFIERS).includes(k),\n },\n\n /**\n * The size of the modal. size - default or full,\n * @values default, full\n */\n size: {\n type: String,\n default: 'default',\n validator: (s) => Object.keys(MODAL_SIZE_MODIFIERS).includes(s),\n },\n\n /**\n * Additional class name for the root modal element.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n modalClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the dialog element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n dialogClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the content element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n contentClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Sets the color of the banner.\n * @values base, error, info, success, warning\n */\n bannerKind: {\n type: String,\n default: 'warning',\n validate (kind) {\n return NOTICE_KINDS.includes(kind);\n },\n },\n\n /**\n * Additional class name for the banner element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n bannerClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Hides the close button on the modal\n * @values true, false\n */\n hideClose: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Whether the modal will close when you click outside of the dialog on the overlay.\n * @values true, false\n */\n closeOnClick: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Scrollable modal that allows scroll the modal content keeping the header and footer fixed\n * @values true, false\n */\n fixedHeaderFooter: {\n type: Boolean,\n default: true,\n },\n\n /**\n * The element that is focused when the modal is opened. This can be an\n * HTMLElement within the modal, a string starting with '#' which will\n * find the element by ID. 'first' which will automatically focus\n * the first element, or 'dialog' which will focus the dialog window itself.\n * If the dialog is modal this prop cannot be 'none'.\n */\n initialFocusElement: {\n type: [String, HTMLElement],\n default: 'first',\n validator: initialFocusElement => {\n return initialFocusElement === 'first' ||\n (initialFocusElement instanceof HTMLElement) ||\n initialFocusElement.startsWith('#');\n },\n },\n },\n\n emits: [\n /**\n * Native button click event\n *\n * @event click\n * @type {PointerEvent | KeyboardEvent}\n */\n 'click',\n\n /**\n * Native keydown event\n *\n * @event keydown\n * @type {KeyboardEvent}\n */\n 'keydown',\n\n /**\n * The modal will emit a \"false\" boolean value for this event when the user performs a modal-closing action.\n * Parent components can sync on this value to create a 2-way binding to control modal visibility.\n *\n * @event update:show\n * @type {Boolean}\n */\n 'update:show',\n ],\n\n data () {\n return {\n MODAL_KIND_MODIFIERS,\n MODAL_SIZE_MODIFIERS,\n MODAL_BANNER_KINDS,\n EVENT_KEYNAMES,\n hasSlotContent,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n modalListeners () {\n return {\n click: event => {\n // Handle backdrop clicks for closing modal\n if (this.closeOnClick && event.target === event.currentTarget) {\n this.close();\n } else if (this.show && event.target !== event.currentTarget) {\n // Ensure focus stays within modal when clicking inside it\n this.handleModalClick(event);\n }\n\n this.$emit('click', event);\n },\n\n keydown: event => {\n switch (event.code) {\n case EVENT_KEYNAMES.esc:\n case EVENT_KEYNAMES.escape:\n this.close();\n break;\n case EVENT_KEYNAMES.tab:\n this.trapFocus(event);\n break;\n }\n this.$emit('keydown', event);\n },\n\n 'after-enter': async () => {\n this.$emit('update:show', true);\n await this.setFocusAfterTransition();\n },\n\n focusin: event => {\n // Ensure focus stays within modal\n if (this.show && !this.$el.contains(event.target)) {\n event.preventDefault();\n this.focusFirstElement();\n }\n },\n };\n },\n\n open () {\n return `${!this.show}`;\n },\n\n hasFooterSlot () {\n return !!this.$slots.footer;\n },\n\n bannerKindClass () {\n return MODAL_BANNER_KINDS[this.bannerKind];\n },\n\n closeButtonTitle () {\n return this.i18n.$t('DIALTONE_CLOSE_BUTTON');\n },\n },\n\n watch: {\n show: {\n handler (isShowing) {\n if (isShowing) {\n // Set a reference to the previously-active element, to which we'll return focus on modal close.\n this.previousActiveElement = document.activeElement;\n disableRootScrolling(returnFirstEl(this.$el).getRootNode().host);\n } else {\n enableRootScrolling(returnFirstEl(this.$el).getRootNode().host);\n // Modal is being hidden, so return focus to the previously active element before clearing the reference.\n this.previousActiveElement?.focus();\n this.previousActiveElement = null;\n }\n },\n },\n },\n\n methods: {\n close () {\n this.$emit('update:show', false);\n },\n\n async setFocusAfterTransition () {\n if (this.initialFocusElement === 'first') {\n await this.focusFirstElement();\n } else if (this.initialFocusElement.startsWith('#')) {\n await this.focusElementById(this.initialFocusElement);\n } else if (this.initialFocusElement instanceof HTMLElement) {\n this.initialFocusElement.focus();\n }\n },\n\n trapFocus (e) {\n if (this.show) {\n this.focusTrappedTabPress(e);\n }\n },\n\n handleModalClick (event) {\n // Ensure focus stays within modal when clicking inside it\n const clickedElement = event.target;\n const focusableElements = this._getFocusableElements();\n\n // If the clicked element is not focusable, ensure focus stays in modal\n if (focusableElements.length && !focusableElements.includes(clickedElement)) {\n // Check if current active element is still within the modal\n if (!focusableElements.includes(document.activeElement)) {\n this.focusFirstElement();\n }\n }\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtLazyShow","DtButton","DtIconClose","SrOnlyCloseButton","Modal","getUniqueString","k","MODAL_KIND_MODIFIERS","s","MODAL_SIZE_MODIFIERS","kind","NOTICE_KINDS","initialFocusElement","MODAL_BANNER_KINDS","EVENT_KEYNAMES","hasSlotContent","DialtoneLocalization","event","isShowing","disableRootScrolling","returnFirstEl","enableRootScrolling","_a","clickedElement","focusableElements","_hoisted_1","_hoisted_2","_hoisted_3","_openBlock","_createBlock","_component_dt_lazy_show","_mergeProps","$props","$data","$options","_toHandlers","_withCtx","_ctx","_createElementBlock","_normalizeClass","_renderSlot","_createTextVNode","_toDisplayString","_createCommentVNode","_createVNode","_Transition","_createElementVNode","_hoisted_4","_component_sr_only_close_button","_component_dt_button","_component_dt_icon_close"],"mappings":";;;;;;;;;;;;AAyIA,MAAKA,IAAU;AAAA,EACb,cAAc,EAAE,MAAM;EACtB,MAAM;AAAA,EAEN,YAAY;AAAA,IACV,YAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,mBAAAC;AAAA;EAGF,QAAQ,CAACC,CAAK;AAAA,EAEd,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;IAQX,eAAe;AAAA,MACb,MAAM;AAAA,MACN,SAAS;AAAA;;;;IAMX,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,SAAS,WAAY;AAAE,eAAOC,EAAe;AAAA,MAAI;AAAA;;;;;;IAQnD,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA;;;;IAMX,OAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA;;;;IAMX,aAAa;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAA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AA;cAGRQ,EAAQH,EAAA,QAAA,SAAA;AAAA,2BAEVC,EASI,KAAA;AAAA,cAjFZ,KAAA;AAAA,cA0EW,OA1EXC,EAAA;AAAA;gBA0EgEP,EAAA;AAAA;cAItD,WAAQ;AAAA,iBAELA,EAAA,IAAI,GAAA,CAAA;AAAA,YAGDE,EAAA,iBADRN,KAAAU,EAMS,UANTS,GAMS;AAAA,cADPP,EAAsBH,EAAA,QAAA,QAAA;AAAA,kBAvFhCM,EAAA,IAAA,EAAA;AAAA,YA0FgBX,EAAA,kBADRH,EAGEmB,GAAA;AAAA,cA5FV,KAAA;AAAA,cA2FW,SAAOd,EAAA;AAAA,8CAEVL,EAgBYoB,GAAA;AAAA,cA7GpB,KAAA;AAAA,cA+FU,OAAM;AAAA,cACN,WAAQ;AAAA,cACR,QAAA;AAAA,cACA,MAAK;AAAA,cACL,YAAW;AAAA,cACV,cAAYf,EAAA;AAAA,cACZ,OAAOA,EAAA;AAAA,cACP,SAAOA,EAAA;AAAA;cAEG,QACT,MAEE;AAAA,gBAFFU,EAEEM,GAAA,EADA,MAAK,MAAK,CAAA;AAAA;cA1GxB,GAAA;AAAA;UAAA,GAAA,IAAAzB,CAAA,GAAA;AAAA,gBAiCgBO,EAAA,IAAI;AAAA;;QAjCpB,GAAA;AAAA;;IAAA,GAAA;AAAA;;;"}
|
|
1
|
+
{"version":3,"file":"modal.js","sources":["../../../components/modal/modal.vue"],"sourcesContent":["<template>\n <dt-lazy-show\n transition=\"d-zoom\"\n :show=\"show\"\n :class=\"[\n 'd-modal',\n MODAL_KIND_MODIFIERS[kind],\n MODAL_SIZE_MODIFIERS[size],\n modalClass,\n ]\"\n data-qa=\"dt-modal\"\n :aria-hidden=\"open\"\n v-on=\"modalListeners\"\n >\n <div\n v-if=\"show && (hasSlotContent($slots.banner) || bannerTitle)\"\n data-qa=\"dt-modal-banner\"\n :class=\"[\n 'd-modal__banner',\n bannerClass,\n bannerKindClass,\n ]\"\n >\n <!-- @slot Slot for the banner, defaults to bannerTitle prop -->\n <slot name=\"banner\">\n {{ bannerTitle }}\n </slot>\n </div>\n <transition\n appear\n name=\"d-modal__dialog\"\n >\n <div\n v-show=\"show\"\n :class=\"[\n 'd-modal__dialog',\n { 'd-modal__dialog--scrollable': fixedHeaderFooter },\n dialogClass,\n ]\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-describedby=\"describedById\"\n :aria-labelledby=\"labelledById\"\n >\n <div\n v-if=\"hasSlotContent($slots.header)\"\n :id=\"labelledById\"\n class=\"d-modal__header\"\n data-qa=\"dt-modal-title\"\n >\n <!-- @slot Slot for dialog header section, taking the place of any \"title\" text prop -->\n <slot name=\"header\" />\n </div>\n <h2\n v-else\n :id=\"labelledById\"\n class=\"d-modal__header\"\n data-qa=\"dt-modal-title\"\n >\n {{ title }}\n </h2>\n <div\n v-if=\"hasSlotContent($slots.default)\"\n :class=\"[\n 'd-modal__content',\n contentClass,\n ]\"\n data-qa=\"dt-modal-copy\"\n >\n <!-- @slot Default slot for dialog body section, taking the place of any \"copy\" text prop -->\n <slot />\n </div>\n <p\n v-else\n :class=\"[\n 'd-modal__content',\n contentClass,\n ]\"\n data-qa=\"dt-modal-copy\"\n >\n {{ copy }}\n </p>\n <footer\n v-if=\"hasFooterSlot\"\n class=\"d-modal__footer\"\n >\n <!-- @slot Slot for dialog footer content, often containing cancel and confirm buttons. -->\n <slot name=\"footer\" />\n </footer>\n <sr-only-close-button\n v-if=\"hideClose\"\n @close=\"close\"\n />\n <dt-button\n v-else\n class=\"d-modal__close\"\n data-qa=\"dt-modal-close-button\"\n size=\"md\"\n kind=\"muted\"\n importance=\"clear\"\n :aria-label=\"closeButtonTitle\"\n :title=\"closeButtonTitle\"\n @click=\"close\"\n >\n <template #icon=\"{ iconSize }\">\n <dt-icon-close\n :size=\"iconSize\"\n />\n </template>\n </dt-button>\n </div>\n </transition>\n </dt-lazy-show>\n</template>\n\n<script>\n/* eslint-disable max-lines */\nimport { DtButton } from '@/components/button';\nimport { DtIconClose } from '@dialpad/dialtone-icons/vue3';\nimport Modal from '@/common/mixins/modal';\nimport {\n MODAL_BANNER_KINDS,\n MODAL_KIND_MODIFIERS,\n MODAL_SIZE_MODIFIERS,\n} from './modal_constants';\nimport { returnFirstEl, getUniqueString, hasSlotContent, disableRootScrolling, enableRootScrolling } from '@/common/utils';\nimport { DtLazyShow } from '@/components/lazy_show';\nimport { EVENT_KEYNAMES } from '@/common/constants';\nimport SrOnlyCloseButton from '@/common/sr_only_close_button.vue';\nimport { NOTICE_KINDS } from '@/components/notice';\nimport { DialtoneLocalization } from '@/localization';\n\n/**\n * Modals focus the user’s attention exclusively on one task or piece of information\n * via a window that sits on top of the page content.\n * @see https://dialtone.dialpad.com/components/modal.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtModal',\n\n components: {\n DtLazyShow,\n DtButton,\n DtIconClose,\n SrOnlyCloseButton,\n },\n\n mixins: [Modal],\n\n props: {\n /**\n * Body text to display as the modal's main content.\n */\n copy: {\n type: String,\n default: '',\n },\n\n /**\n * Id to use for the dialog's aria-describedby.\n * Recommended only if the dialog content itself isn't enough to give full context,\n * as screen readers should recite the dialog contents by default before any aria-description.\n */\n describedById: {\n type: String,\n default: '',\n },\n\n /**\n * Id to use for the dialog's aria-labelledby.\n */\n labelledById: {\n type: String,\n default: function () { return getUniqueString(); },\n },\n\n /**\n * Whether the modal should be shown.\n * Parent component can sync on this value to control the modal's visibility.\n * @values true, false\n */\n show: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Title text to display in the modal header.\n */\n title: {\n type: String,\n default: '',\n },\n\n /**\n * Title text to display in the modal banner.\n */\n bannerTitle: {\n type: String,\n default: '',\n },\n\n /**\n * The theme of the modal. kind - default or danger,\n * @values default, danger\n */\n kind: {\n type: String,\n default: 'default',\n validator: (k) => Object.keys(MODAL_KIND_MODIFIERS).includes(k),\n },\n\n /**\n * The size of the modal. size - default or full,\n * @values default, full\n */\n size: {\n type: String,\n default: 'default',\n validator: (s) => Object.keys(MODAL_SIZE_MODIFIERS).includes(s),\n },\n\n /**\n * Additional class name for the root modal element.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n modalClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the dialog element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n dialogClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Additional class name for the content element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n contentClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Sets the color of the banner.\n * @values base, error, info, success, warning\n */\n bannerKind: {\n type: String,\n default: 'warning',\n validate (kind) {\n return NOTICE_KINDS.includes(kind);\n },\n },\n\n /**\n * Additional class name for the banner element within the modal.\n * Can accept String, Object, and Array, i.e. has the\n * same API as Vue's built-in handling of the class attribute.\n */\n bannerClass: {\n type: [String, Object, Array],\n default: '',\n },\n\n /**\n * Hides the close button on the modal\n * @values true, false\n */\n hideClose: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Whether the modal will close when you click outside of the dialog on the overlay.\n * @values true, false\n */\n closeOnClick: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Scrollable modal that allows scroll the modal content keeping the header and footer fixed\n * @values true, false\n */\n fixedHeaderFooter: {\n type: Boolean,\n default: true,\n },\n\n /**\n * The element that is focused when the modal is opened. This can be an\n * HTMLElement within the modal, a string starting with '#' which will\n * find the element by ID. 'first' which will automatically focus\n * the first element, or 'dialog' which will focus the dialog window itself.\n * If the dialog is modal this prop cannot be 'none'.\n */\n initialFocusElement: {\n type: [String, HTMLElement],\n default: 'first',\n validator: initialFocusElement => {\n return initialFocusElement === 'first' ||\n (initialFocusElement instanceof HTMLElement) ||\n initialFocusElement.startsWith('#');\n },\n },\n },\n\n emits: [\n /**\n * Native button click event\n *\n * @event click\n * @type {PointerEvent | KeyboardEvent}\n */\n 'click',\n\n /**\n * Native keydown event\n *\n * @event keydown\n * @type {KeyboardEvent}\n */\n 'keydown',\n\n /**\n * The modal will emit a \"false\" boolean value for this event when the user performs a modal-closing action.\n * Parent components can sync on this value to create a 2-way binding to control modal visibility.\n *\n * @event update:show\n * @type {Boolean}\n */\n 'update:show',\n ],\n\n data () {\n return {\n MODAL_KIND_MODIFIERS,\n MODAL_SIZE_MODIFIERS,\n MODAL_BANNER_KINDS,\n EVENT_KEYNAMES,\n hasSlotContent,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n modalListeners () {\n return {\n click: event => {\n // Handle backdrop clicks for closing modal\n if (this.closeOnClick && event.target === event.currentTarget) {\n this.close();\n } else if (this.show && event.target !== event.currentTarget) {\n // Ensure focus stays within modal when clicking inside it\n this.handleModalClick(event);\n }\n\n this.$emit('click', event);\n },\n\n keydown: event => {\n switch (event.code) {\n case EVENT_KEYNAMES.esc:\n case EVENT_KEYNAMES.escape:\n this.close();\n break;\n case EVENT_KEYNAMES.tab:\n this.trapFocus(event);\n break;\n }\n this.$emit('keydown', event);\n },\n\n 'after-enter': async () => {\n this.$emit('update:show', true);\n await this.setFocusAfterTransition();\n },\n\n focusin: event => {\n // Ensure focus stays within modal\n if (this.show && !this.$el.contains(event.target)) {\n event.preventDefault();\n this.focusFirstElement();\n }\n },\n };\n },\n\n open () {\n return `${!this.show}`;\n },\n\n hasFooterSlot () {\n return !!this.$slots.footer;\n },\n\n bannerKindClass () {\n return MODAL_BANNER_KINDS[this.bannerKind];\n },\n\n closeButtonTitle () {\n return this.i18n.$t('DIALTONE_CLOSE_BUTTON');\n },\n },\n\n watch: {\n show: {\n handler (isShowing) {\n if (isShowing) {\n // Set a reference to the previously-active element, to which we'll return focus on modal close.\n this.previousActiveElement = document.activeElement;\n disableRootScrolling(returnFirstEl(this.$el).getRootNode().host);\n } else {\n enableRootScrolling(returnFirstEl(this.$el).getRootNode().host);\n // Modal is being hidden, so return focus to the previously active element before clearing the reference.\n this.previousActiveElement?.focus();\n this.previousActiveElement = null;\n }\n },\n },\n },\n\n methods: {\n close () {\n this.$emit('update:show', false);\n },\n\n async setFocusAfterTransition () {\n if (this.initialFocusElement === 'first') {\n await this.focusFirstElement();\n } else if (this.initialFocusElement.startsWith('#')) {\n await this.focusElementById(this.initialFocusElement);\n } else if (this.initialFocusElement instanceof HTMLElement) {\n this.initialFocusElement.focus();\n }\n },\n\n trapFocus (e) {\n if (this.show) {\n this.focusTrappedTabPress(e);\n }\n },\n\n handleModalClick (event) {\n // Ensure focus stays within modal when clicking inside it\n const clickedElement = event.target;\n const focusableElements = this._getFocusableElements();\n\n // If the clicked element is not focusable, ensure focus stays in modal\n if (focusableElements.length && !focusableElements.includes(clickedElement)) {\n // Check if current active element is still within the modal\n if (!focusableElements.includes(document.activeElement)) {\n this.focusFirstElement();\n }\n }\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtLazyShow","DtButton","DtIconClose","SrOnlyCloseButton","Modal","getUniqueString","k","MODAL_KIND_MODIFIERS","s","MODAL_SIZE_MODIFIERS","kind","NOTICE_KINDS","initialFocusElement","MODAL_BANNER_KINDS","EVENT_KEYNAMES","hasSlotContent","DialtoneLocalization","event","isShowing","disableRootScrolling","returnFirstEl","enableRootScrolling","_a","clickedElement","focusableElements","_hoisted_1","_hoisted_2","_hoisted_3","_openBlock","_createBlock","_component_dt_lazy_show","_mergeProps","$props","$data","$options","_toHandlers","_withCtx","_ctx","_createElementBlock","_normalizeClass","_renderSlot","_createTextVNode","_toDisplayString","_createCommentVNode","_createVNode","_Transition","_createElementVNode","_hoisted_4","_component_sr_only_close_button","_component_dt_button","iconSize","_component_dt_icon_close"],"mappings":";;;;;;;;;;;;AAyIA,MAAKA,IAAU;AAAA,EACb,cAAc,EAAE,MAAM;EACtB,MAAM;AAAA,EAEN,YAAY;AAAA,IACV,YAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,mBAAAC;AAAA;EAGF,QAAQ,CAAC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AAAA,gBAiCgBO,EAAA,IAAI;AAAA;;QAjCpB,GAAA;AAAA;;IAAA,GAAA;AAAA;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("./toast-constants.cjs"),l=require("../../common/utils/index.cjs"),e=require("vue"),r=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),S=require("../notice/notice-action.cjs"),g=require("../notice/notice-content.cjs"),I=require("../notice/notice-icon.cjs"),C=require("../notice/notice-constants.cjs"),i=require("@dialpad/dialtone-icons/vue3"),k=require("../icon/icon-constants.cjs"),T={name:"ToastLayoutDefault",components:{DtNoticeIcon:I.default,DtNoticeContent:g.default,DtNoticeAction:S.default},inheritAttrs:!1,props:{isShown:{type:Boolean,default:!1},titleId:{type:String,default(){return l.default.getUniqueString()}},contentId:{type:String,default(){return l.default.getUniqueString()}},title:{type:String,default:""},message:{type:String,default:""},role:{type:String,default:"status",validator:t=>s.TOAST_ROLES.includes(t)},kind:{type:String,default:"base",validator:t=>C.NOTICE_KINDS.includes(t)},important:{type:Boolean,default:!1},hideClose:{type:Boolean,default:!1},hideIcon:{type:Boolean,default:!1},hideAction:{type:Boolean,default:!1}},emits:["close"],computed:{kindClass(){return{error:"d-toast--error",info:"d-toast--info",success:"d-toast--success",warning:"d-toast--warning",base:"d-toast--base"}[this.kind]},toastListeners(){return l.extractVueListeners(this.$attrs)}}},p=["aria-hidden"],D={class:"d-toast__dialog"};function v(t,a,n,c,d,o){const u=e.resolveComponent("dt-notice-icon"),f=e.resolveComponent("dt-notice-content"),m=e.resolveComponent("dt-notice-action");return n.isShown?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["d-toast",o.kindClass,t.$attrs.class,{"d-toast--important":n.important}]),"data-qa":"dt-toast","aria-hidden":(!n.isShown).toString()},[e.createElementVNode("div",D,[n.hideIcon?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(u,e.mergeProps({key:0,kind:n.kind},o.toastListeners),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"icon")]),_:3},16,["kind"])),e.createVNode(f,e.mergeProps({"title-id":n.titleId,"content-id":n.contentId,title:n.title,role:n.role},o.toastListeners),{titleOverride:e.withCtx(()=>[e.renderSlot(t.$slots,"titleOverride")]),default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(n.message),1)])]),_:3},16,["title-id","content-id","title","role"]),e.createVNode(m,e.mergeProps({"hide-action":n.hideAction,"hide-close":n.hideClose},o.toastListeners,{onClose:a[0]||(a[0]=y=>t.$emit("close"))}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"action")]),_:3},16,["hide-action","hide-close"])])],10,p)):e.createCommentVNode("",!0)}const h=r._(T,[["render",v]]),w=new Map([["info",i.DtIconInfo],["success",i.DtIconInfo],["warning",i.DtIconAlertTriangle],["error",i.DtIconInfo],["base",i.DtIconBell],["gradient",i.DtIconSparkle]]),N={compatConfig:{MODE:3},name:"DtToastLayoutAlternateIcon",components:{DtIconInfo:i.DtIconInfo,DtIconAlertTriangle:i.DtIconAlertTriangle,DtIconBell:i.DtIconBell,DtIconSparkle:i.DtIconSparkle},props:{kind:{type:String,default:"base",validate(t){return s.TOAST_ALTERNATE_KINDS.includes(t)}},size:{type:String,default:"400",validator:t=>Object.keys(k.ICON_SIZE_MODIFIERS).includes(t)}},computed:{defaultIcon(){return w.get(this.kind)}}},A={"aria-hidden":"true",class:"d-toast-layout-alternate__icon"};function B(t,a,n,c,d,o){return e.openBlock(),e.createElementBlock("div",A,[e.renderSlot(t.$slots,"default",{},()=>[o.defaultIcon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.defaultIcon),{key:0,size:n.size},null,8,["size"])):e.createCommentVNode("",!0)])])}const O=r._(N,[["render",B]]),L={name:"ToastLayoutAlternate",components:{DtNoticeAction:S.default,DtNoticeContent:g.default,DtToastLayoutAlternateIcon:O},inheritAttrs:!1,props:{isShown:{type:Boolean,default:!1},titleId:{type:String,default(){return l.default.getUniqueString()}},contentId:{type:String,default(){return l.default.getUniqueString()}},title:{type:String,default:""},message:{type:String,default:""},role:{type:String,default:"status",validator:t=>s.TOAST_ROLES.includes(t)},kind:{type:String,default:"base",validator:t=>s.TOAST_ALTERNATE_KINDS.includes(t)},hideClose:{type:Boolean,default:!1},hideIcon:{type:Boolean,default:!1}},computed:{kindClass(){return{error:"d-toast-alternate--error",info:"d-toast-alternate--info",success:"d-toast-alternate--success",warning:"d-toast-alternate--warning",gradient:"d-toast-alternate--gradient"}[this.kind]},toastListeners(){return l.extractVueListeners(this.$attrs)}}},V=["aria-hidden"],E={class:"d-toast-alternate__dialog"},b={class:"d-toast-alternate__header"},q={class:"d-toast-alternate__content"};function z(t,a,n,c,d,o){const u=e.resolveComponent("dt-toast-layout-alternate-icon"),f=e.resolveComponent("dt-notice-content"),m=e.resolveComponent("dt-notice-action");return n.isShown?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["d-toast-alternate",t.$attrs.class,o.kindClass]),"data-qa":"dt-toast","aria-hidden":(!n.isShown).toString()},[e.createElementVNode("div",E,[e.createElementVNode("div",b,[n.hideIcon?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(u,e.mergeProps({key:0,kind:n.kind,size:"200"},o.toastListeners),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"icon")]),_:3},16,["kind"])),e.createVNode(f,e.mergeProps({"title-id":n.titleId,"content-id":n.contentId,title:n.title,role:n.role},o.toastListeners),{titleOverride:e.withCtx(()=>[e.renderSlot(t.$slots,"titleOverride")]),_:3},16,["title-id","content-id","title","role"]),e.createVNode(m,e.mergeProps({"hide-action":!0,"hide-close":n.hideClose,"button-size":"xs"},o.toastListeners,{onClose:a[0]||(a[0]=y=>t.$emit("close"))}),null,16,["hide-close"])]),e.createElementVNode("div",q,[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(n.message),1)])])])],10,V)):e.createCommentVNode("",!0)}const _=r._(L,[["render",z]]),M={compatConfig:{MODE:3},name:"DtToast",components:{ToastLayoutDefault:h,ToastLayoutAlternate:_},inheritAttrs:!1,props:{titleId:{type:String,default:void 0},contentId:{type:String,default:void 0},title:{type:String,default:void 0},message:{type:String,default:void 0},role:{type:String,default:"status"},kind:{type:String,default:void 0},important:{type:Boolean,default:!1},show:{type:Boolean,default:!1},hideClose:{type:Boolean,default:void 0},hideIcon:{type:Boolean,default:void 0},hideAction:{type:Boolean,default:void 0},duration:{type:Number,default:null,validator:t=>t>=s.TOAST_MIN_DURATION},layout:{type:String,default:"default",validator:t=>s.TOAST_LAYOUTS.includes(t)}},emits:["close","update:show"],data(){return{isShown:!1,minDuration:s.TOAST_MIN_DURATION}},computed:{shouldSetTimeout(){return!!this.duration&&this.duration>=this.minDuration},selectedLayout(){return this.layout==="alternate"?_:h}},watch:{show:{handler:function(t){this.isShown=t,t?this.setTimeout():clearTimeout(this.displayTimer)},immediate:!0}},unmounted(){clearTimeout(this.displayTimer)},methods:{setTimeout(){this.shouldSetTimeout&&(this.displayTimer=setTimeout(()=>{this.isShown=!1,this.$emit("update:show",!1)},this.duration))},handleClose(){this.isShown=!1,this.$emit("close"),this.$emit("update:show",!1)}}};function P(t,a,n,c,d,o){return e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.selectedLayout),e.mergeProps({"is-shown":d.isShown,"title-id":n.titleId,"content-id":n.contentId,title:n.title,message:n.message,role:n.role,kind:n.kind,important:n.important,"hide-close":n.hideClose,"hide-icon":n.hideIcon,"hide-action":n.hideAction},t.$attrs,{onClose:o.handleClose}),{icon:e.withCtx(()=>[e.renderSlot(t.$slots,"icon")]),titleOverride:e.withCtx(()=>[e.renderSlot(t.$slots,"titleOverride")]),action:e.withCtx(()=>[e.renderSlot(t.$slots,"action")]),default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(n.message),1)])]),_:3},16,["is-shown","title-id","content-id","title","message","role","kind","important","hide-close","hide-icon","hide-action","onClose"])}const R=r._(M,[["render",P]]);exports.default=R;
|
|
2
2
|
//# sourceMappingURL=toast.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.cjs","sources":["../../../components/toast/layouts/toast_layout_default.vue","../../../components/toast/layouts/toast_layout_alternate_icon.vue","../../../components/toast/layouts/toast_layout_alternate.vue","../../../components/toast/toast.vue"],"sourcesContent":["<template>\n <div\n v-if=\"isShown\"\n :class=\"[\n 'd-toast',\n kindClass,\n { 'd-toast--important': important },\n ]\"\n data-qa=\"dt-toast\"\n :aria-hidden=\"(!isShown).toString()\"\n >\n <div class=\"d-toast__dialog\">\n <dt-notice-icon\n v-if=\"!hideIcon\"\n :kind=\"kind\"\n v-bind=\"$attrs\"\n >\n <!-- @slot Slot for custom icon -->\n <slot name=\"icon\" />\n </dt-notice-icon>\n <dt-notice-content\n :title-id=\"titleId\"\n :content-id=\"contentId\"\n :title=\"title\"\n :role=\"role\"\n v-bind=\"$attrs\"\n >\n <template #titleOverride>\n <!-- @slot Allows you to override the title, only use this if you need to override\n with something other than text. Otherwise use the \"title\" prop. -->\n <slot name=\"titleOverride\" />\n </template>\n <!-- @slot the main textual content of the toast -->\n <slot>\n {{ message }}\n </slot>\n </dt-notice-content>\n <dt-notice-action\n :hide-action=\"hideAction\"\n :hide-close=\"hideClose\"\n v-bind=\"$attrs\"\n @close=\"$emit('close')\"\n >\n <!-- @slot Enter a possible action for the user to take, such as a link to another page -->\n <slot name=\"action\" />\n </dt-notice-action>\n </div>\n </div>\n</template>\n\n<script>\nimport utils from '@/common/utils';\nimport { DtNoticeIcon, DtNoticeContent, DtNoticeAction, NOTICE_KINDS } from '@/components/notice';\nimport { TOAST_ROLES } from '../toast_constants.js';\nexport default {\n name: 'ToastLayoutDefault',\n\n components: {\n DtNoticeIcon,\n DtNoticeContent,\n DtNoticeAction,\n },\n\n inheritAttrs: false,\n\n props: {\n isShown: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Sets an ID on the title element of the component. Useful for aria-describedby\n * or aria-labelledby or any other reason you may need an id to refer to the title.\n */\n titleId: {\n type: String,\n default () { return utils.getUniqueString(); },\n },\n\n /**\n * Sets an ID on the content element of the component. Useful for aria-describedby\n * or aria-labelledby or any other reason you may need an id to refer to the content.\n */\n contentId: {\n type: String,\n default () { return utils.getUniqueString(); },\n },\n\n /**\n * Title header of the toast. This can be left blank to remove the title from the toast entirely.\n */\n title: {\n type: String,\n default: '',\n },\n\n /**\n * Message of the toast. Overridden by default slot.\n */\n message: {\n type: String,\n default: '',\n },\n\n /**\n * Provides a role for the toast. 'status' is used by default to communicate a message. 'alert' is used to\n * communicate an important message like an error that does not contain any interactive elements.\n * @values status, alert\n */\n role: {\n type: String,\n default: 'status',\n validator: (role) => {\n return TOAST_ROLES.includes(role);\n },\n },\n\n /**\n * Severity level of the toast, sets the icon and background\n * @values base, error, info, success, warning\n */\n kind: {\n type: String,\n default: 'base',\n validator: (kind) => {\n return NOTICE_KINDS.includes(kind);\n },\n },\n\n /**\n * Used in scenarios where the message needs to visually dominate the screen.\n * @values true, false\n */\n important: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Hides the close button from the toast\n * @values true, false\n */\n hideClose: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Hides the icon from the notice\n * @values true, false\n */\n hideIcon: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Hides the action from the notice\n * @values true, false\n */\n hideAction: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: ['close'],\n\n computed: {\n kindClass () {\n const kindClasses = {\n error: 'd-toast--error',\n info: 'd-toast--info',\n success: 'd-toast--success',\n warning: 'd-toast--warning',\n base: 'd-toast--base',\n };\n\n return kindClasses[this.kind];\n },\n },\n};\n</script>\n","<template>\n <div\n aria-hidden=\"true\"\n class=\"d-toast-layout-alternate__icon\"\n >\n <slot>\n <component\n :is=\"defaultIcon\"\n v-if=\"defaultIcon\"\n :size=\"size\"\n />\n </slot>\n </div>\n</template>\n\n<script>\nimport {\n DtIconInfo,\n DtIconAlertTriangle,\n DtIconBell,\n DtIconSparkle,\n} from '@dialpad/dialtone-icons/vue3';\nimport { TOAST_ALTERNATE_KINDS } from '../toast_constants.js';\nimport { ICON_SIZE_MODIFIERS } from '@/components/icon/icon_constants.js';\n\nconst kindToIcon = new Map([\n ['info', DtIconInfo],\n ['success', DtIconInfo],\n ['warning', DtIconAlertTriangle],\n ['error', DtIconInfo],\n ['base', DtIconBell],\n ['gradient', DtIconSparkle],\n]);\n\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtToastLayoutAlternateIcon',\n\n components: {\n DtIconInfo,\n DtIconAlertTriangle,\n DtIconBell,\n DtIconSparkle,\n },\n\n props: {\n /**\n * Kind of icon\n * @values base, error, info, success, warning\n */\n kind: {\n type: String,\n default: 'base',\n validate (kind) {\n return TOAST_ALTERNATE_KINDS.includes(kind);\n },\n },\n\n size: {\n type: String,\n default: '400',\n validator: (s) => Object.keys(ICON_SIZE_MODIFIERS).includes(s),\n },\n },\n\n computed: {\n defaultIcon () {\n return kindToIcon.get(this.kind);\n },\n },\n};\n</script>\n","<template>\n <div\n v-if=\"isShown\"\n :class=\"[\n 'd-toast-alternate',\n kindClass,\n ]\"\n data-qa=\"dt-toast\"\n :aria-hidden=\"(!isShown).toString()\"\n >\n <div class=\"d-toast-alternate__dialog\">\n <div class=\"d-toast-alternate__header\">\n <dt-toast-layout-alternate-icon\n v-if=\"!hideIcon\"\n :kind=\"kind\"\n size=\"200\"\n v-bind=\"$attrs\"\n >\n <slot name=\"icon\" />\n </dt-toast-layout-alternate-icon>\n <dt-notice-content\n :title-id=\"titleId\"\n :content-id=\"contentId\"\n :title=\"title\"\n :role=\"role\"\n v-bind=\"$attrs\"\n >\n <template #titleOverride>\n <slot name=\"titleOverride\" />\n </template>\n </dt-notice-content>\n\n <!-- Close Button -->\n <dt-notice-action\n :hide-action=\"true\"\n :hide-close=\"hideClose\"\n button-size=\"xs\"\n v-bind=\"$attrs\"\n @close=\"$emit('close')\"\n />\n </div>\n <!-- Content Section -->\n <div class=\"d-toast-alternate__content\">\n <slot>\n {{ message }}\n </slot>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport utils from '@/common/utils';\nimport DtToastLayoutAlternateIcon from './toast_layout_alternate_icon.vue';\nimport { DtNoticeAction, DtNoticeContent } from '@/components/notice';\nimport { TOAST_ROLES, TOAST_ALTERNATE_KINDS } from '../toast_constants.js';\nexport default {\n name: 'ToastLayoutAlternate',\n\n components: {\n DtNoticeAction,\n DtNoticeContent,\n DtToastLayoutAlternateIcon,\n },\n\n inheritAttrs: false,\n\n props: {\n isShown: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Sets an ID on the title element of the component. Useful for aria-describedby\n * or aria-labelledby or any other reason you may need an id to refer to the title.\n */\n titleId: {\n type: String,\n default () { return utils.getUniqueString(); },\n },\n\n /**\n * Sets an ID on the content element of the component. Useful for aria-describedby\n * or aria-labelledby or any other reason you may need an id to refer to the content.\n */\n contentId: {\n type: String,\n default () { return utils.getUniqueString(); },\n },\n\n /**\n * Title header of the toast. This can be left blank to remove the title from the toast entirely.\n */\n title: {\n type: String,\n default: '',\n },\n\n /**\n * Message of the toast. Overridden by default slot.\n */\n message: {\n type: String,\n default: '',\n },\n\n /**\n * Provides a role for the toast. 'status' is used by default to communicate a message. 'alert' is used to\n * communicate an important message like an error that does not contain any interactive elements.\n * @values status, alert\n */\n role: {\n type: String,\n default: 'status',\n validator: (role) => {\n return TOAST_ROLES.includes(role);\n },\n },\n\n /**\n * Severity level of the toast, sets the icon and background\n * @values base, error, info, success, warning, gradient\n */\n kind: {\n type: String,\n default: 'base',\n validator: (kind) => {\n return TOAST_ALTERNATE_KINDS.includes(kind);\n },\n },\n\n /**\n * Hides the close button from the toast\n * @values true, false\n */\n hideClose: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Hides the icon from the notice\n * @values true, false\n */\n hideIcon: {\n type: Boolean,\n default: false,\n },\n },\n\n computed: {\n kindClass () {\n const kindClasses = {\n error: 'd-toast-alternate--error',\n info: 'd-toast-alternate--info',\n success: 'd-toast-alternate--success',\n warning: 'd-toast-alternate--warning',\n gradient: 'd-toast-alternate--gradient',\n };\n\n return kindClasses[this.kind];\n },\n },\n};\n</script>\n","<template>\n <component\n :is=\"selectedLayout\"\n :is-shown=\"isShown\"\n :title-id=\"titleId\"\n :content-id=\"contentId\"\n :title=\"title\"\n :message=\"message\"\n :role=\"role\"\n :kind=\"kind\"\n :important=\"important\"\n :hide-close=\"hideClose\"\n :hide-icon=\"hideIcon\"\n :hide-action=\"hideAction\"\n v-bind=\"$attrs\"\n @close=\"handleClose\"\n >\n <!-- @slot Slot for custom icon -->\n <template #icon>\n <slot name=\"icon\" />\n </template>\n <template #titleOverride>\n <!-- @slot Allows you to override the title, only use this if you need to override\n with something other than text. Otherwise use the \"title\" prop. -->\n <slot name=\"titleOverride\" />\n </template>\n <!-- @slot the main textual content of the toast -->\n <slot>\n {{ message }}\n </slot>\n <!-- @slot Enter a possible action for the user to take, such as a link to another page -->\n <template #action>\n <slot name=\"action\" />\n </template>\n </component>\n</template>\n\n<script>\nimport { TOAST_MIN_DURATION, TOAST_LAYOUTS } from './toast_constants.js';\nimport ToastLayoutDefault from './layouts/toast_layout_default.vue';\nimport ToastLayoutAlternate from './layouts/toast_layout_alternate.vue';\n\n/**\n * A toast notice, sometimes called a snackbar, is a time-based message that appears based on users' actions.\n * It contains at-a-glance information about outcomes and can be paired with actions.\n * @see https://dialtone.dialpad.com/components/toast.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtToast',\n\n components: {\n ToastLayoutDefault,\n ToastLayoutAlternate,\n },\n\n inheritAttrs: false,\n\n props: {\n /**\n * Sets an ID on the title element of the component. Useful for aria-describedby\n * or aria-labelledby or any other reason you may need an id to refer to the title.\n */\n titleId: {\n type: String,\n default: undefined,\n },\n\n /**\n * Sets an ID on the content element of the component. Useful for aria-describedby\n * or aria-labelledby or any other reason you may need an id to refer to the content.\n */\n contentId: {\n type: String,\n default: undefined,\n },\n\n /**\n * Title header of the toast. This can be left blank to remove the title from the toast entirely.\n */\n title: {\n type: String,\n default: undefined,\n },\n\n /**\n * Message of the toast. Overridden by default slot.\n */\n message: {\n type: String,\n default: undefined,\n },\n\n /**\n * Provides a role for the toast. 'status' is used by default to communicate a message. 'alert' is used to\n * communicate an important message like an error that does not contain any interactive elements.\n * @values status, alert\n */\n role: {\n type: String,\n default: 'status',\n },\n\n /**\n * Severity level of the toast, could be different depending on which toast layout is used.\n * @values base, error, info, success, warning, gradient\n */\n kind: {\n type: String,\n default: undefined,\n },\n\n /**\n * Used in scenarios where the message needs to visually dominate the screen.\n * @values true, false\n */\n important: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Controls whether the toast is shown. If a valid duration is provided, the toast will disappear\n * after reaching the duration time, so it's convenient to use `v-model` with this prop to update\n * the data in your component.\n * Supports v-model\n * @values true, false\n */\n show: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Hides the close button from the toast\n * @values true, false\n */\n hideClose: {\n type: Boolean,\n default: undefined,\n },\n\n /**\n * Hides the icon from the notice\n * @values true, false\n */\n hideIcon: {\n type: Boolean,\n default: undefined,\n },\n\n /**\n * Hides the action from the notice\n * @values true, false\n */\n hideAction: {\n type: Boolean,\n default: undefined,\n },\n\n /**\n * The duration in ms the toast will display before disappearing.\n * The toast won't disappear if the duration is not provided.\n * If it's provided, it should be equal to or greater than 6000.\n */\n duration: {\n type: Number,\n default: null,\n validator: (duration) => {\n return duration >= TOAST_MIN_DURATION;\n },\n },\n\n /**\n * The layout / styling you wish to use for the toast.\n * @values default, alternate\n */\n layout: {\n type: String,\n default: 'default',\n validator: (layout) => {\n return TOAST_LAYOUTS.includes(layout);\n },\n },\n },\n\n emits: [\n /**\n * Close button click event\n *\n * @event close\n */\n 'close',\n\n /**\n * Sync show value\n *\n * @event update:show\n */\n 'update:show',\n ],\n\n data () {\n return {\n isShown: false,\n minDuration: TOAST_MIN_DURATION,\n };\n },\n\n computed: {\n shouldSetTimeout () {\n return !!this.duration && this.duration >= this.minDuration;\n },\n\n selectedLayout () {\n return this.layout === 'alternate' ? ToastLayoutAlternate : ToastLayoutDefault;\n },\n },\n\n watch: {\n show: {\n handler: function (show) {\n this.isShown = show;\n if (show) {\n this.setTimeout();\n } else {\n clearTimeout(this.displayTimer);\n }\n },\n\n immediate: true,\n },\n },\n\n unmounted () {\n clearTimeout(this.displayTimer);\n },\n\n methods: {\n setTimeout () {\n if (this.shouldSetTimeout) {\n this.displayTimer = setTimeout(() => {\n this.isShown = false;\n this.$emit('update:show', false);\n }, this.duration);\n }\n },\n\n handleClose () {\n this.isShown = false;\n this.$emit('close');\n this.$emit('update:show', false);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtNoticeIcon","DtNoticeContent","DtNoticeAction","utils","role","TOAST_ROLES","kind","NOTICE_KINDS","_hoisted_1","_hoisted_2","$props","_createElementBlock","_normalizeClass","$options","_createElementVNode","_createCommentVNode","_openBlock","_createBlock","_component_dt_notice_icon","_mergeProps","_ctx","_withCtx","_renderSlot","_createVNode","_component_dt_notice_content","_createTextVNode","_toDisplayString","_component_dt_notice_action","kindToIcon","DtIconInfo","DtIconAlertTriangle","DtIconBell","DtIconSparkle","TOAST_ALTERNATE_KINDS","s","ICON_SIZE_MODIFIERS","_resolveDynamicComponent","DtToastLayoutAlternateIcon","_hoisted_3","_hoisted_4","_component_dt_toast_layout_alternate_icon","ToastLayoutDefault","ToastLayoutAlternate","duration","TOAST_MIN_DURATION","layout","TOAST_LAYOUTS","show","$data"],"mappings":"kgBAsDKA,EAAU,CACb,KAAM,qBAEN,WAAY,cACVC,EAAAA,QACA,gBAAAC,EAAAA,QACA,eAAAC,EAAAA,SAGF,aAAc,GAEd,MAAO,CACL,QAAS,CACP,KAAM,QACN,QAAS,IA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EAAA,OAAM,CACb,QAAOP,EAAA,WAAW,CAAA,EAAA,CAGR,eACT,IAAoB,CAApBS,aAAoBF,EAAA,OAAA,MAAA,IAEX,wBAGT,IAA6B,CAA7BE,aAA6BF,EAAA,OAAA,eAAA,IAOpB,iBACT,IAAsB,CAAtBE,aAAsBF,EAAA,OAAA,QAAA,IAhC5B,QAAAC,EAAAA,QA2BI,IAEO,CAFPC,EAAAA,WAEOF,sBAFP,IAEO,CA7BXK,EAAAA,gBAAAC,EAAAA,gBA4BShB,EAAA,OAAO,EAAA,CAAA,MA5BhB,EAAA"}
|
|
1
|
+
{"version":3,"file":"toast.cjs","sources":["../../../components/toast/layouts/toast_layout_default.vue","../../../components/toast/layouts/toast_layout_alternate_icon.vue","../../../components/toast/layouts/toast_layout_alternate.vue","../../../components/toast/toast.vue"],"sourcesContent":["<template>\n <div\n v-if=\"isShown\"\n :class=\"[\n 'd-toast',\n kindClass,\n $attrs.class,\n { 'd-toast--important': important },\n ]\"\n data-qa=\"dt-toast\"\n :aria-hidden=\"(!isShown).toString()\"\n >\n <div class=\"d-toast__dialog\">\n <dt-notice-icon\n v-if=\"!hideIcon\"\n :kind=\"kind\"\n v-bind=\"toastListeners\"\n >\n <!-- @slot Slot for custom icon -->\n <slot name=\"icon\" />\n </dt-notice-icon>\n <dt-notice-content\n :title-id=\"titleId\"\n :content-id=\"contentId\"\n :title=\"title\"\n :role=\"role\"\n v-bind=\"toastListeners\"\n >\n <template #titleOverride>\n <!-- @slot Allows you to override the title, only use this if you need to override\n with something other than text. Otherwise use the \"title\" prop. -->\n <slot name=\"titleOverride\" />\n </template>\n <!-- @slot the main textual content of the toast -->\n <slot>\n {{ message }}\n </slot>\n </dt-notice-content>\n <dt-notice-action\n :hide-action=\"hideAction\"\n :hide-close=\"hideClose\"\n v-bind=\"toastListeners\"\n @close=\"$emit('close')\"\n >\n <!-- @slot Enter a possible action for the user to take, such as a link to another page -->\n <slot name=\"action\" />\n </dt-notice-action>\n </div>\n </div>\n</template>\n\n<script>\nimport utils from '@/common/utils';\nimport { DtNoticeIcon, DtNoticeContent, DtNoticeAction, NOTICE_KINDS } from '@/components/notice';\nimport { TOAST_ROLES } from '../toast_constants.js';\nimport { extractVueListeners } from \"@/common/utils/index.js\";\n\nexport default {\n name: 'ToastLayoutDefault',\n\n components: {\n DtNoticeIcon,\n DtNoticeContent,\n DtNoticeAction,\n },\n\n inheritAttrs: false,\n\n props: {\n isShown: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Sets an ID on the title element of the component. Useful for aria-describedby\n * or aria-labelledby or any other reason you may need an id to refer to the title.\n */\n titleId: {\n type: String,\n default () { return utils.getUniqueString(); },\n },\n\n /**\n * Sets an ID on the content element of the component. Useful for aria-describedby\n * or aria-labelledby or any other reason you may need an id to refer to the content.\n */\n contentId: {\n type: String,\n default () { return utils.getUniqueString(); },\n },\n\n /**\n * Title header of the toast. This can be left blank to remove the title from the toast entirely.\n */\n title: {\n type: String,\n default: '',\n },\n\n /**\n * Message of the toast. Overridden by default slot.\n */\n message: {\n type: String,\n default: '',\n },\n\n /**\n * Provides a role for the toast. 'status' is used by default to communicate a message. 'alert' is used to\n * communicate an important message like an error that does not contain any interactive elements.\n * @values status, alert\n */\n role: {\n type: String,\n default: 'status',\n validator: (role) => {\n return TOAST_ROLES.includes(role);\n },\n },\n\n /**\n * Severity level of the toast, sets the icon and background\n * @values base, error, info, success, warning\n */\n kind: {\n type: String,\n default: 'base',\n validator: (kind) => {\n return NOTICE_KINDS.includes(kind);\n },\n },\n\n /**\n * Used in scenarios where the message needs to visually dominate the screen.\n * @values true, false\n */\n important: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Hides the close button from the toast\n * @values true, false\n */\n hideClose: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Hides the icon from the notice\n * @values true, false\n */\n hideIcon: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Hides the action from the notice\n * @values true, false\n */\n hideAction: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: ['close'],\n\n computed: {\n kindClass () {\n const kindClasses = {\n error: 'd-toast--error',\n info: 'd-toast--info',\n success: 'd-toast--success',\n warning: 'd-toast--warning',\n base: 'd-toast--base',\n };\n\n return kindClasses[this.kind];\n },\n\n toastListeners () {\n return extractVueListeners(this.$attrs);\n },\n },\n};\n</script>\n","<template>\n <div\n aria-hidden=\"true\"\n class=\"d-toast-layout-alternate__icon\"\n >\n <slot>\n <component\n :is=\"defaultIcon\"\n v-if=\"defaultIcon\"\n :size=\"size\"\n />\n </slot>\n </div>\n</template>\n\n<script>\nimport {\n DtIconInfo,\n DtIconAlertTriangle,\n DtIconBell,\n DtIconSparkle,\n} from '@dialpad/dialtone-icons/vue3';\nimport { TOAST_ALTERNATE_KINDS } from '../toast_constants.js';\nimport { ICON_SIZE_MODIFIERS } from '@/components/icon/icon_constants.js';\n\nconst kindToIcon = new Map([\n ['info', DtIconInfo],\n ['success', DtIconInfo],\n ['warning', DtIconAlertTriangle],\n ['error', DtIconInfo],\n ['base', DtIconBell],\n ['gradient', DtIconSparkle],\n]);\n\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtToastLayoutAlternateIcon',\n\n components: {\n DtIconInfo,\n DtIconAlertTriangle,\n DtIconBell,\n DtIconSparkle,\n },\n\n props: {\n /**\n * Kind of icon\n * @values base, error, info, success, warning\n */\n kind: {\n type: String,\n default: 'base',\n validate (kind) {\n return TOAST_ALTERNATE_KINDS.includes(kind);\n },\n },\n\n size: {\n type: String,\n default: '400',\n validator: (s) => Object.keys(ICON_SIZE_MODIFIERS).includes(s),\n },\n },\n\n computed: {\n defaultIcon () {\n return kindToIcon.get(this.kind);\n },\n },\n};\n</script>\n","<template>\n <div\n v-if=\"isShown\"\n :class=\"[\n 'd-toast-alternate',\n $attrs.class,\n kindClass,\n ]\"\n data-qa=\"dt-toast\"\n :aria-hidden=\"(!isShown).toString()\"\n >\n <div class=\"d-toast-alternate__dialog\">\n <div class=\"d-toast-alternate__header\">\n <dt-toast-layout-alternate-icon\n v-if=\"!hideIcon\"\n :kind=\"kind\"\n size=\"200\"\n v-bind=\"toastListeners\"\n >\n <slot name=\"icon\" />\n </dt-toast-layout-alternate-icon>\n <dt-notice-content\n :title-id=\"titleId\"\n :content-id=\"contentId\"\n :title=\"title\"\n :role=\"role\"\n v-bind=\"toastListeners\"\n >\n <template #titleOverride>\n <slot name=\"titleOverride\" />\n </template>\n </dt-notice-content>\n\n <!-- Close Button -->\n <dt-notice-action\n :hide-action=\"true\"\n :hide-close=\"hideClose\"\n button-size=\"xs\"\n v-bind=\"toastListeners\"\n @close=\"$emit('close')\"\n />\n </div>\n <!-- Content Section -->\n <div class=\"d-toast-alternate__content\">\n <slot>\n {{ message }}\n </slot>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport utils from '@/common/utils';\nimport DtToastLayoutAlternateIcon from './toast_layout_alternate_icon.vue';\nimport { DtNoticeAction, DtNoticeContent } from '@/components/notice';\nimport { TOAST_ROLES, TOAST_ALTERNATE_KINDS } from '../toast_constants.js';\nimport { extractVueListeners } from \"@/common/utils/index.js\";\n\nexport default {\n name: 'ToastLayoutAlternate',\n\n components: {\n DtNoticeAction,\n DtNoticeContent,\n DtToastLayoutAlternateIcon,\n },\n\n inheritAttrs: false,\n\n props: {\n isShown: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Sets an ID on the title element of the component. Useful for aria-describedby\n * or aria-labelledby or any other reason you may need an id to refer to the title.\n */\n titleId: {\n type: String,\n default () { return utils.getUniqueString(); },\n },\n\n /**\n * Sets an ID on the content element of the component. Useful for aria-describedby\n * or aria-labelledby or any other reason you may need an id to refer to the content.\n */\n contentId: {\n type: String,\n default () { return utils.getUniqueString(); },\n },\n\n /**\n * Title header of the toast. This can be left blank to remove the title from the toast entirely.\n */\n title: {\n type: String,\n default: '',\n },\n\n /**\n * Message of the toast. Overridden by default slot.\n */\n message: {\n type: String,\n default: '',\n },\n\n /**\n * Provides a role for the toast. 'status' is used by default to communicate a message. 'alert' is used to\n * communicate an important message like an error that does not contain any interactive elements.\n * @values status, alert\n */\n role: {\n type: String,\n default: 'status',\n validator: (role) => {\n return TOAST_ROLES.includes(role);\n },\n },\n\n /**\n * Severity level of the toast, sets the icon and background\n * @values base, error, info, success, warning, gradient\n */\n kind: {\n type: String,\n default: 'base',\n validator: (kind) => {\n return TOAST_ALTERNATE_KINDS.includes(kind);\n },\n },\n\n /**\n * Hides the close button from the toast\n * @values true, false\n */\n hideClose: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Hides the icon from the notice\n * @values true, false\n */\n hideIcon: {\n type: Boolean,\n default: false,\n },\n },\n\n computed: {\n kindClass () {\n const kindClasses = {\n error: 'd-toast-alternate--error',\n info: 'd-toast-alternate--info',\n success: 'd-toast-alternate--success',\n warning: 'd-toast-alternate--warning',\n gradient: 'd-toast-alternate--gradient',\n };\n\n return kindClasses[this.kind];\n },\n\n toastListeners () {\n return extractVueListeners(this.$attrs);\n },\n },\n};\n</script>\n","<template>\n <component\n :is=\"selectedLayout\"\n :is-shown=\"isShown\"\n :title-id=\"titleId\"\n :content-id=\"contentId\"\n :title=\"title\"\n :message=\"message\"\n :role=\"role\"\n :kind=\"kind\"\n :important=\"important\"\n :hide-close=\"hideClose\"\n :hide-icon=\"hideIcon\"\n :hide-action=\"hideAction\"\n v-bind=\"$attrs\"\n @close=\"handleClose\"\n >\n <!-- @slot Slot for custom icon -->\n <template #icon>\n <slot name=\"icon\" />\n </template>\n <template #titleOverride>\n <!-- @slot Allows you to override the title, only use this if you need to override\n with something other than text. Otherwise use the \"title\" prop. -->\n <slot name=\"titleOverride\" />\n </template>\n <!-- @slot the main textual content of the toast -->\n <slot>\n {{ message }}\n </slot>\n <!-- @slot Enter a possible action for the user to take, such as a link to another page -->\n <template #action>\n <slot name=\"action\" />\n </template>\n </component>\n</template>\n\n<script>\nimport { TOAST_MIN_DURATION, TOAST_LAYOUTS } from './toast_constants.js';\nimport ToastLayoutDefault from './layouts/toast_layout_default.vue';\nimport ToastLayoutAlternate from './layouts/toast_layout_alternate.vue';\n\n/**\n * A toast notice, sometimes called a snackbar, is a time-based message that appears based on users' actions.\n * It contains at-a-glance information about outcomes and can be paired with actions.\n * @see https://dialtone.dialpad.com/components/toast.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtToast',\n\n components: {\n ToastLayoutDefault,\n ToastLayoutAlternate,\n },\n\n inheritAttrs: false,\n\n props: {\n /**\n * Sets an ID on the title element of the component. Useful for aria-describedby\n * or aria-labelledby or any other reason you may need an id to refer to the title.\n */\n titleId: {\n type: String,\n default: undefined,\n },\n\n /**\n * Sets an ID on the content element of the component. Useful for aria-describedby\n * or aria-labelledby or any other reason you may need an id to refer to the content.\n */\n contentId: {\n type: String,\n default: undefined,\n },\n\n /**\n * Title header of the toast. This can be left blank to remove the title from the toast entirely.\n */\n title: {\n type: String,\n default: undefined,\n },\n\n /**\n * Message of the toast. Overridden by default slot.\n */\n message: {\n type: String,\n default: undefined,\n },\n\n /**\n * Provides a role for the toast. 'status' is used by default to communicate a message. 'alert' is used to\n * communicate an important message like an error that does not contain any interactive elements.\n * @values status, alert\n */\n role: {\n type: String,\n default: 'status',\n },\n\n /**\n * Severity level of the toast, could be different depending on which toast layout is used.\n * @values base, error, info, success, warning, gradient\n */\n kind: {\n type: String,\n default: undefined,\n },\n\n /**\n * Used in scenarios where the message needs to visually dominate the screen.\n * @values true, false\n */\n important: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Controls whether the toast is shown. If a valid duration is provided, the toast will disappear\n * after reaching the duration time, so it's convenient to use `v-model` with this prop to update\n * the data in your component.\n * Supports v-model\n * @values true, false\n */\n show: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Hides the close button from the toast\n * @values true, false\n */\n hideClose: {\n type: Boolean,\n default: undefined,\n },\n\n /**\n * Hides the icon from the notice\n * @values true, false\n */\n hideIcon: {\n type: Boolean,\n default: undefined,\n },\n\n /**\n * Hides the action from the notice\n * @values true, false\n */\n hideAction: {\n type: Boolean,\n default: undefined,\n },\n\n /**\n * The duration in ms the toast will display before disappearing.\n * The toast won't disappear if the duration is not provided.\n * If it's provided, it should be equal to or greater than 6000.\n */\n duration: {\n type: Number,\n default: null,\n validator: (duration) => {\n return duration >= TOAST_MIN_DURATION;\n },\n },\n\n /**\n * The layout / styling you wish to use for the toast.\n * @values default, alternate\n */\n layout: {\n type: String,\n default: 'default',\n validator: (layout) => {\n return TOAST_LAYOUTS.includes(layout);\n },\n },\n },\n\n emits: [\n /**\n * Close button click event\n *\n * @event close\n */\n 'close',\n\n /**\n * Sync show value\n *\n * @event update:show\n */\n 'update:show',\n ],\n\n data () {\n return {\n isShown: false,\n minDuration: TOAST_MIN_DURATION,\n };\n },\n\n computed: {\n shouldSetTimeout () {\n return !!this.duration && this.duration >= this.minDuration;\n },\n\n selectedLayout () {\n return this.layout === 'alternate' ? ToastLayoutAlternate : ToastLayoutDefault;\n },\n },\n\n watch: {\n show: {\n handler: function (show) {\n this.isShown = show;\n if (show) {\n this.setTimeout();\n } else {\n clearTimeout(this.displayTimer);\n }\n },\n\n immediate: true,\n },\n },\n\n unmounted () {\n clearTimeout(this.displayTimer);\n },\n\n methods: {\n setTimeout () {\n if (this.shouldSetTimeout) {\n this.displayTimer = setTimeout(() => {\n this.isShown = false;\n this.$emit('update:show', false);\n }, this.duration);\n }\n },\n\n handleClose () {\n this.isShown = false;\n this.$emit('close');\n this.$emit('update:show', false);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtNoticeIcon","DtNoticeContent","DtNoticeAction","utils","role","TOAST_ROLES","kind","NOTICE_KINDS","extractVueListeners","_hoisted_1","_hoisted_2","$props","_createElementBlock","_normalizeClass","$options","_ctx","_createElementVNode","_createCommentVNode","_openBlock","_createBlock","_component_dt_notice_icon","_mergeProps","_withCtx","_renderSlot","_createVNode","_component_dt_notice_content","_createTextVNode","_toDisplayString","_component_dt_notice_action","kindToIcon","DtIconInfo","DtIconAlertTriangle","DtIconBell","DtIconSparkle","TOAST_ALTERNATE_KINDS","s","ICON_SIZE_MODIFIERS","_resolveDynamicComponent","DtToastLayoutAlternateIcon","_hoisted_3","_hoisted_4","_component_dt_toast_layout_alternate_icon","ToastLayoutDefault","ToastLayoutAlternate","duration","TOAST_MIN_DURATION","layout","TOAST_LAYOUTS","show","$data"],"mappings":"kgBAyDKA,EAAU,CACb,KAAM,qBAEN,WAAY,cACVC,EAAAA,QACA,gBAAAC,EAAAA,QACA,eAAAC,EAAAA,SAGF,aAAc,GAEd,MAAO,CACL,QAAS,CACP,KAAM,QACN,QAAS,IAOX,QAAS,CACP,KAAM,OACN,SAAW,CAAE,OAAOC,EAAAA,QAAM,gBAAe,CAAI,GAO/C,UAAW,CACT,KAAM,OACN,SAAW,CAAE,OAAOA,EAAAA,QAAM,gBAAe,CAAI,GAM/C,MAAO,CACL,KAAM,OACN,QAAS,IAMX,QAAS,CACP,KAAM,OACN,QAAS,IAQX,KAAM,CACJ,KAAM,OACN,QAAS,SACT,UAAYC,GACHC,EAAAA,YAAY,SAASD,CAAI,GAQpC,KAAM,CACJ,KAAM,OACN,QAAS,OACT,UAAYE,GACHC,EAAAA,aAAa,SAASD,CAAI,GAQrC,UAAW,CACT,KAAM,QACN,QAAS,IAOX,UAAW,CACT,KAAM,QACN,QAAS,IAOX,SAAU,CACR,KAAM,QACN,QAAS,IAOX,WAAY,CACV,KAAM,QACN,QAAS,KAIb,MAAO,CAAC,OAAO,EAEf,SAAU,CACR,WAAa,CASX,MARoB,CAClB,MAAO,iBACP,KAAM,gBACN,QAAS,mBACT,QAAS,mBACT,KAAM,iBAGW,KAAK,IAAI,CAC9B,EAEA,gBAAkB,CAChB,OAAOE,EAAAA,oBAAoB,KAAK,MAAM,CACxC,EAEJ,EA7LAC,EAAA,CAAA,aAAA,EAYSC,EAAA,CAAA,MAAM,iBAAiB,iKAVtBC,EAAA,uBADRC,EAAAA,mBA+CM,MAAA,CAhDR,IAAA,EAGK,MAHLC,EAAAA,eAAA,WAGqCC,EAAA,UAAiBC,EAAA,O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K,mBACP,KAAK,aAAe,WAAW,IAAM,CACnC,KAAK,QAAU,GACf,KAAK,MAAM,cAAe,EAAK,CACjC,EAAG,KAAK,QAAQ,EAEpB,EAEA,aAAe,CACb,KAAK,QAAU,GACf,KAAK,MAAM,OAAO,EAClB,KAAK,MAAM,cAAe,EAAK,CACjC,EAEJ,0BA7PE,OAAA9B,EAAAA,UAAA,EAAAC,cAiCYkB,EAAAA,wBAhCLvB,EAAA,cAAc,EADrBO,aAiCY,CA/BT,WAAU4B,EAAA,QACV,WAAUtC,EAAA,QACV,aAAYA,EAAA,UACZ,MAAOA,EAAA,MACP,QAASA,EAAA,QACT,KAAMA,EAAA,KACN,KAAMA,EAAA,KACN,UAAWA,EAAA,UACX,aAAYA,EAAA,UACZ,YAAWA,EAAA,SACX,cAAaA,EAAA,YACNI,EAAA,OAAM,CACb,QAAOD,EAAA,WAAW,CAAA,EAAA,CAGR,eACT,IAAoB,CAApBS,aAAoBR,EAAA,OAAA,MAAA,IAEX,wBAGT,IAA6B,CAA7BQ,aAA6BR,EAAA,OAAA,eAAA,IAOpB,iBACT,IAAsB,CAAtBQ,aAAsBR,EAAA,OAAA,QAAA,IAhC5B,QAAAO,EAAAA,QA2BI,IAEO,CAFPC,EAAAA,WAEOR,sBAFP,IAEO,CA7BXW,EAAAA,gBAAAC,EAAAA,gBA4BShB,EAAA,OAAO,EAAA,CAAA,MA5BhB,EAAA"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { TOAST_ROLES as A, TOAST_ALTERNATE_KINDS as
|
|
2
|
-
import m from "../../common/utils/index.js";
|
|
3
|
-
import { resolveComponent as l, createElementBlock as
|
|
1
|
+
import { TOAST_ROLES as A, TOAST_ALTERNATE_KINDS as L, TOAST_MIN_DURATION as v, TOAST_LAYOUTS as V } from "./toast-constants.js";
|
|
2
|
+
import m, { extractVueListeners as O } from "../../common/utils/index.js";
|
|
3
|
+
import { resolveComponent as l, createElementBlock as T, createCommentVNode as r, openBlock as d, normalizeClass as B, createElementVNode as u, createBlock as _, createVNode as h, mergeProps as s, withCtx as o, renderSlot as i, createTextVNode as C, toDisplayString as p, resolveDynamicComponent as N } from "vue";
|
|
4
4
|
import { _ as y } from "../../_plugin-vue_export-helper-CHgC5LLL.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { NOTICE_KINDS as
|
|
9
|
-
import { DtIconSparkle as
|
|
10
|
-
import { ICON_SIZE_MODIFIERS as
|
|
11
|
-
const
|
|
5
|
+
import E from "../notice/notice-action.js";
|
|
6
|
+
import b from "../notice/notice-content.js";
|
|
7
|
+
import R from "../notice/notice-icon.js";
|
|
8
|
+
import { NOTICE_KINDS as K } from "../notice/notice-constants.js";
|
|
9
|
+
import { DtIconSparkle as z, DtIconBell as q, DtIconAlertTriangle as U, DtIconInfo as f } from "@dialpad/dialtone-icons/vue3";
|
|
10
|
+
import { ICON_SIZE_MODIFIERS as $ } from "../icon/icon-constants.js";
|
|
11
|
+
const j = {
|
|
12
12
|
name: "ToastLayoutDefault",
|
|
13
13
|
components: {
|
|
14
|
-
DtNoticeIcon:
|
|
15
|
-
DtNoticeContent:
|
|
16
|
-
DtNoticeAction:
|
|
14
|
+
DtNoticeIcon: R,
|
|
15
|
+
DtNoticeContent: b,
|
|
16
|
+
DtNoticeAction: E
|
|
17
17
|
},
|
|
18
18
|
inheritAttrs: !1,
|
|
19
19
|
props: {
|
|
@@ -72,7 +72,7 @@ const K = {
|
|
|
72
72
|
kind: {
|
|
73
73
|
type: String,
|
|
74
74
|
default: "base",
|
|
75
|
-
validator: (t) =>
|
|
75
|
+
validator: (t) => K.includes(t)
|
|
76
76
|
},
|
|
77
77
|
/**
|
|
78
78
|
* Used in scenarios where the message needs to visually dominate the screen.
|
|
@@ -117,28 +117,32 @@ const K = {
|
|
|
117
117
|
warning: "d-toast--warning",
|
|
118
118
|
base: "d-toast--base"
|
|
119
119
|
}[this.kind];
|
|
120
|
+
},
|
|
121
|
+
toastListeners() {
|
|
122
|
+
return O(this.$attrs);
|
|
120
123
|
}
|
|
121
124
|
}
|
|
122
|
-
},
|
|
123
|
-
function
|
|
125
|
+
}, F = ["aria-hidden"], P = { class: "d-toast__dialog" };
|
|
126
|
+
function Y(t, a, e, g, c, n) {
|
|
124
127
|
const S = l("dt-notice-icon"), I = l("dt-notice-content"), k = l("dt-notice-action");
|
|
125
|
-
return e.isShown ? (d(),
|
|
128
|
+
return e.isShown ? (d(), T("div", {
|
|
126
129
|
key: 0,
|
|
127
130
|
class: B([
|
|
128
131
|
"d-toast",
|
|
129
|
-
|
|
132
|
+
n.kindClass,
|
|
133
|
+
t.$attrs.class,
|
|
130
134
|
{ "d-toast--important": e.important }
|
|
131
135
|
]),
|
|
132
136
|
"data-qa": "dt-toast",
|
|
133
137
|
"aria-hidden": (!e.isShown).toString()
|
|
134
138
|
}, [
|
|
135
|
-
u("div",
|
|
139
|
+
u("div", P, [
|
|
136
140
|
e.hideIcon ? r("", !0) : (d(), _(S, s({
|
|
137
141
|
key: 0,
|
|
138
142
|
kind: e.kind
|
|
139
|
-
},
|
|
140
|
-
default:
|
|
141
|
-
|
|
143
|
+
}, n.toastListeners), {
|
|
144
|
+
default: o(() => [
|
|
145
|
+
i(t.$slots, "icon")
|
|
142
146
|
]),
|
|
143
147
|
_: 3
|
|
144
148
|
}, 16, ["kind"])),
|
|
@@ -147,13 +151,13 @@ function P(t, a, e, g, c, o) {
|
|
|
147
151
|
"content-id": e.contentId,
|
|
148
152
|
title: e.title,
|
|
149
153
|
role: e.role
|
|
150
|
-
},
|
|
151
|
-
titleOverride:
|
|
152
|
-
|
|
154
|
+
}, n.toastListeners), {
|
|
155
|
+
titleOverride: o(() => [
|
|
156
|
+
i(t.$slots, "titleOverride")
|
|
153
157
|
]),
|
|
154
|
-
default:
|
|
155
|
-
|
|
156
|
-
|
|
158
|
+
default: o(() => [
|
|
159
|
+
i(t.$slots, "default", {}, () => [
|
|
160
|
+
C(p(e.message), 1)
|
|
157
161
|
])
|
|
158
162
|
]),
|
|
159
163
|
_: 3
|
|
@@ -161,32 +165,32 @@ function P(t, a, e, g, c, o) {
|
|
|
161
165
|
h(k, s({
|
|
162
166
|
"hide-action": e.hideAction,
|
|
163
167
|
"hide-close": e.hideClose
|
|
164
|
-
},
|
|
165
|
-
onClose: a[0] || (a[0] = (
|
|
168
|
+
}, n.toastListeners, {
|
|
169
|
+
onClose: a[0] || (a[0] = (M) => t.$emit("close"))
|
|
166
170
|
}), {
|
|
167
|
-
default:
|
|
168
|
-
|
|
171
|
+
default: o(() => [
|
|
172
|
+
i(t.$slots, "action")
|
|
169
173
|
]),
|
|
170
174
|
_: 3
|
|
171
175
|
}, 16, ["hide-action", "hide-close"])
|
|
172
176
|
])
|
|
173
|
-
], 10,
|
|
177
|
+
], 10, F)) : r("", !0);
|
|
174
178
|
}
|
|
175
|
-
const w = /* @__PURE__ */ y(
|
|
179
|
+
const w = /* @__PURE__ */ y(j, [["render", Y]]), Z = /* @__PURE__ */ new Map([
|
|
176
180
|
["info", f],
|
|
177
181
|
["success", f],
|
|
178
|
-
["warning",
|
|
182
|
+
["warning", U],
|
|
179
183
|
["error", f],
|
|
180
|
-
["base",
|
|
181
|
-
["gradient",
|
|
182
|
-
]),
|
|
184
|
+
["base", q],
|
|
185
|
+
["gradient", z]
|
|
186
|
+
]), G = {
|
|
183
187
|
compatConfig: { MODE: 3 },
|
|
184
188
|
name: "DtToastLayoutAlternateIcon",
|
|
185
189
|
components: {
|
|
186
190
|
DtIconInfo: f,
|
|
187
|
-
DtIconAlertTriangle:
|
|
188
|
-
DtIconBell:
|
|
189
|
-
DtIconSparkle:
|
|
191
|
+
DtIconAlertTriangle: U,
|
|
192
|
+
DtIconBell: q,
|
|
193
|
+
DtIconSparkle: z
|
|
190
194
|
},
|
|
191
195
|
props: {
|
|
192
196
|
/**
|
|
@@ -197,40 +201,40 @@ const w = /* @__PURE__ */ y(K, [["render", P]]), Y = /* @__PURE__ */ new Map([
|
|
|
197
201
|
type: String,
|
|
198
202
|
default: "base",
|
|
199
203
|
validate(t) {
|
|
200
|
-
return
|
|
204
|
+
return L.includes(t);
|
|
201
205
|
}
|
|
202
206
|
},
|
|
203
207
|
size: {
|
|
204
208
|
type: String,
|
|
205
209
|
default: "400",
|
|
206
|
-
validator: (t) => Object.keys(
|
|
210
|
+
validator: (t) => Object.keys($).includes(t)
|
|
207
211
|
}
|
|
208
212
|
},
|
|
209
213
|
computed: {
|
|
210
214
|
defaultIcon() {
|
|
211
|
-
return
|
|
215
|
+
return Z.get(this.kind);
|
|
212
216
|
}
|
|
213
217
|
}
|
|
214
|
-
},
|
|
218
|
+
}, H = {
|
|
215
219
|
"aria-hidden": "true",
|
|
216
220
|
class: "d-toast-layout-alternate__icon"
|
|
217
221
|
};
|
|
218
|
-
function
|
|
219
|
-
return d(),
|
|
220
|
-
|
|
221
|
-
|
|
222
|
+
function J(t, a, e, g, c, n) {
|
|
223
|
+
return d(), T("div", H, [
|
|
224
|
+
i(t.$slots, "default", {}, () => [
|
|
225
|
+
n.defaultIcon ? (d(), _(N(n.defaultIcon), {
|
|
222
226
|
key: 0,
|
|
223
227
|
size: e.size
|
|
224
228
|
}, null, 8, ["size"])) : r("", !0)
|
|
225
229
|
])
|
|
226
230
|
]);
|
|
227
231
|
}
|
|
228
|
-
const
|
|
232
|
+
const Q = /* @__PURE__ */ y(G, [["render", J]]), W = {
|
|
229
233
|
name: "ToastLayoutAlternate",
|
|
230
234
|
components: {
|
|
231
|
-
DtNoticeAction:
|
|
232
|
-
DtNoticeContent:
|
|
233
|
-
DtToastLayoutAlternateIcon:
|
|
235
|
+
DtNoticeAction: E,
|
|
236
|
+
DtNoticeContent: b,
|
|
237
|
+
DtToastLayoutAlternateIcon: Q
|
|
234
238
|
},
|
|
235
239
|
inheritAttrs: !1,
|
|
236
240
|
props: {
|
|
@@ -289,7 +293,7 @@ const J = /* @__PURE__ */ y(Z, [["render", H]]), Q = {
|
|
|
289
293
|
kind: {
|
|
290
294
|
type: String,
|
|
291
295
|
default: "base",
|
|
292
|
-
validator: (t) =>
|
|
296
|
+
validator: (t) => L.includes(t)
|
|
293
297
|
},
|
|
294
298
|
/**
|
|
295
299
|
* Hides the close button from the toast
|
|
@@ -317,29 +321,33 @@ const J = /* @__PURE__ */ y(Z, [["render", H]]), Q = {
|
|
|
317
321
|
warning: "d-toast-alternate--warning",
|
|
318
322
|
gradient: "d-toast-alternate--gradient"
|
|
319
323
|
}[this.kind];
|
|
324
|
+
},
|
|
325
|
+
toastListeners() {
|
|
326
|
+
return O(this.$attrs);
|
|
320
327
|
}
|
|
321
328
|
}
|
|
322
|
-
},
|
|
323
|
-
function
|
|
329
|
+
}, X = ["aria-hidden"], x = { class: "d-toast-alternate__dialog" }, tt = { class: "d-toast-alternate__header" }, et = { class: "d-toast-alternate__content" };
|
|
330
|
+
function nt(t, a, e, g, c, n) {
|
|
324
331
|
const S = l("dt-toast-layout-alternate-icon"), I = l("dt-notice-content"), k = l("dt-notice-action");
|
|
325
|
-
return e.isShown ? (d(),
|
|
332
|
+
return e.isShown ? (d(), T("div", {
|
|
326
333
|
key: 0,
|
|
327
334
|
class: B([
|
|
328
335
|
"d-toast-alternate",
|
|
329
|
-
|
|
336
|
+
t.$attrs.class,
|
|
337
|
+
n.kindClass
|
|
330
338
|
]),
|
|
331
339
|
"data-qa": "dt-toast",
|
|
332
340
|
"aria-hidden": (!e.isShown).toString()
|
|
333
341
|
}, [
|
|
334
|
-
u("div",
|
|
335
|
-
u("div",
|
|
342
|
+
u("div", x, [
|
|
343
|
+
u("div", tt, [
|
|
336
344
|
e.hideIcon ? r("", !0) : (d(), _(S, s({
|
|
337
345
|
key: 0,
|
|
338
346
|
kind: e.kind,
|
|
339
347
|
size: "200"
|
|
340
|
-
},
|
|
341
|
-
default:
|
|
342
|
-
|
|
348
|
+
}, n.toastListeners), {
|
|
349
|
+
default: o(() => [
|
|
350
|
+
i(t.$slots, "icon")
|
|
343
351
|
]),
|
|
344
352
|
_: 3
|
|
345
353
|
}, 16, ["kind"])),
|
|
@@ -348,9 +356,9 @@ function et(t, a, e, g, c, o) {
|
|
|
348
356
|
"content-id": e.contentId,
|
|
349
357
|
title: e.title,
|
|
350
358
|
role: e.role
|
|
351
|
-
},
|
|
352
|
-
titleOverride:
|
|
353
|
-
|
|
359
|
+
}, n.toastListeners), {
|
|
360
|
+
titleOverride: o(() => [
|
|
361
|
+
i(t.$slots, "titleOverride")
|
|
354
362
|
]),
|
|
355
363
|
_: 3
|
|
356
364
|
}, 16, ["title-id", "content-id", "title", "role"]),
|
|
@@ -358,19 +366,19 @@ function et(t, a, e, g, c, o) {
|
|
|
358
366
|
"hide-action": !0,
|
|
359
367
|
"hide-close": e.hideClose,
|
|
360
368
|
"button-size": "xs"
|
|
361
|
-
},
|
|
362
|
-
onClose: a[0] || (a[0] = (
|
|
369
|
+
}, n.toastListeners, {
|
|
370
|
+
onClose: a[0] || (a[0] = (M) => t.$emit("close"))
|
|
363
371
|
}), null, 16, ["hide-close"])
|
|
364
372
|
]),
|
|
365
|
-
u("div",
|
|
366
|
-
|
|
367
|
-
|
|
373
|
+
u("div", et, [
|
|
374
|
+
i(t.$slots, "default", {}, () => [
|
|
375
|
+
C(p(e.message), 1)
|
|
368
376
|
])
|
|
369
377
|
])
|
|
370
378
|
])
|
|
371
|
-
], 10,
|
|
379
|
+
], 10, X)) : r("", !0);
|
|
372
380
|
}
|
|
373
|
-
const D = /* @__PURE__ */ y(
|
|
381
|
+
const D = /* @__PURE__ */ y(W, [["render", nt]]), it = {
|
|
374
382
|
compatConfig: { MODE: 3 },
|
|
375
383
|
name: "DtToast",
|
|
376
384
|
components: {
|
|
@@ -486,7 +494,7 @@ const D = /* @__PURE__ */ y(Q, [["render", et]]), nt = {
|
|
|
486
494
|
layout: {
|
|
487
495
|
type: String,
|
|
488
496
|
default: "default",
|
|
489
|
-
validator: (t) =>
|
|
497
|
+
validator: (t) => V.includes(t)
|
|
490
498
|
}
|
|
491
499
|
},
|
|
492
500
|
emits: [
|
|
@@ -539,8 +547,8 @@ const D = /* @__PURE__ */ y(Q, [["render", et]]), nt = {
|
|
|
539
547
|
}
|
|
540
548
|
}
|
|
541
549
|
};
|
|
542
|
-
function
|
|
543
|
-
return d(), _(N(
|
|
550
|
+
function ot(t, a, e, g, c, n) {
|
|
551
|
+
return d(), _(N(n.selectedLayout), s({
|
|
544
552
|
"is-shown": c.isShown,
|
|
545
553
|
"title-id": e.titleId,
|
|
546
554
|
"content-id": e.contentId,
|
|
@@ -552,26 +560,26 @@ function it(t, a, e, g, c, o) {
|
|
|
552
560
|
"hide-close": e.hideClose,
|
|
553
561
|
"hide-icon": e.hideIcon,
|
|
554
562
|
"hide-action": e.hideAction
|
|
555
|
-
}, t.$attrs, { onClose:
|
|
556
|
-
icon:
|
|
557
|
-
|
|
563
|
+
}, t.$attrs, { onClose: n.handleClose }), {
|
|
564
|
+
icon: o(() => [
|
|
565
|
+
i(t.$slots, "icon")
|
|
558
566
|
]),
|
|
559
|
-
titleOverride:
|
|
560
|
-
|
|
567
|
+
titleOverride: o(() => [
|
|
568
|
+
i(t.$slots, "titleOverride")
|
|
561
569
|
]),
|
|
562
|
-
action:
|
|
563
|
-
|
|
570
|
+
action: o(() => [
|
|
571
|
+
i(t.$slots, "action")
|
|
564
572
|
]),
|
|
565
|
-
default:
|
|
566
|
-
|
|
567
|
-
|
|
573
|
+
default: o(() => [
|
|
574
|
+
i(t.$slots, "default", {}, () => [
|
|
575
|
+
C(p(e.message), 1)
|
|
568
576
|
])
|
|
569
577
|
]),
|
|
570
578
|
_: 3
|
|
571
579
|
}, 16, ["is-shown", "title-id", "content-id", "title", "message", "role", "kind", "important", "hide-close", "hide-icon", "hide-action", "onClose"]);
|
|
572
580
|
}
|
|
573
|
-
const
|
|
581
|
+
const _t = /* @__PURE__ */ y(it, [["render", ot]]);
|
|
574
582
|
export {
|
|
575
|
-
|
|
583
|
+
_t as default
|
|
576
584
|
};
|
|
577
585
|
//# sourceMappingURL=toast.js.map
|