UNPKG

@dialpad/dialtone-vue

Version:

Vue component library for Dialpad's design system Dialtone

1 lines 6.38 kB
{"version":3,"file":"callbox.cjs","sources":["../../../recipes/leftbar/callbox/callbox.vue"],"sourcesContent":["<template>\n <div\n data-qa=\"dt-recipe-callbox\"\n class=\"d-recipe-callbox\"\n >\n <div\n v-if=\"$slots.video\"\n data-qa=\"dt-recipe-callbox__video-wrapper\"\n class=\"d-recipe-callbox__video\"\n >\n <!-- @slot Slot for video stream -->\n <slot name=\"video\" />\n </div>\n <div\n data-qa=\"dt-recipe-callbox__main-content\"\n :class=\"['d-recipe-callbox__main-content', borderClass, { 'd-recipe-callbox--clickable': clickable }]\"\n >\n <div\n class=\"d-recipe-callbox__main-content-top\"\n >\n <dt-avatar\n v-if=\"shouldShowAvatar\"\n avatar-class=\"d-recipe-callbox__avatar\"\n :image-src=\"avatarSrc\"\n image-alt=\"\"\n :full-name=\"avatarFullName\"\n :seed=\"avatarSeed\"\n :clickable=\"clickable\"\n size=\"sm\"\n @click=\"handleClick\"\n >\n <template\n v-if=\"isOnHold\"\n #overlayIcon\n >\n <dt-icon-pause />\n </template>\n </dt-avatar>\n <div class=\"d-recipe-callbox__content\">\n <component\n :is=\"clickable ? 'button' : 'span'\"\n v-dt-tooltip=\"title\"\n data-qa=\"dt-recipe-callbox__title\"\n class=\"d-recipe-callbox__content-title\"\n tabindex=\"0\"\n @click=\"handleClick\"\n >\n {{ title }}\n </component>\n <div\n v-if=\"$slots.badge || badgeText\"\n data-qa=\"dt-recipe-callbox__badge-wrapper\"\n class=\"d-recipe-callbox__content-badge\"\n >\n <!-- @slot Slot for call center badge -->\n <slot name=\"badge\">\n <dt-badge\n :class=\"badgeClass\"\n :text=\"badgeText\"\n />\n </slot>\n </div>\n <div\n v-if=\"$slots.subtitle\"\n data-qa=\"dt-recipe-callbox__subtitle-wrapper\"\n class=\"d-recipe-callbox__content-subtitle\"\n >\n <!-- @slot Slot for subtitle -->\n <slot name=\"subtitle\" />\n </div>\n </div>\n <div\n v-if=\"$slots.right\"\n data-qa=\"dt-recipe-callbox__right-wrapper\"\n class=\"d-recipe-callbox__right\"\n >\n <!-- @slot Slot for right icons -->\n <slot name=\"right\" />\n </div>\n </div>\n <div\n v-if=\"$slots.bottom\"\n data-qa=\"dt-recipe-callbox__bottom-wrapper\"\n class=\"d-recipe-callbox__main-content-bottom\"\n >\n <slot name=\"bottom\" />\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport { CALLBOX_BADGE_COLORS, CALLBOX_BORDER_COLORS } from './callbox_constants';\nimport DtAvatar from '@/components/avatar/avatar.vue';\nimport DtBadge from '@/components/badge/badge.vue';\nimport { DtIconPause } from '@dialpad/dialtone-icons/vue2';\n\nexport default {\n name: 'DtRecipeCallbox',\n\n components: { DtBadge, DtAvatar, DtIconPause },\n\n inheritAttrs: false,\n\n props: {\n /**\n * Text for the badge element\n */\n badgeText: {\n type: String,\n default: '',\n },\n\n /**\n * Color for the badge element\n * @values null, warning\n */\n badgeColor: {\n type: String,\n default: null,\n validator: (color) => color === null || Object.keys(CALLBOX_BADGE_COLORS).includes(color),\n },\n\n /**\n * Optional avatar image url.\n * If not provided it will use the initial of the name.\n */\n avatarSrc: {\n type: String,\n default: '',\n },\n\n /**\n * Avatar's full name, used to extract initials\n * to display if `avatarSrc` is empty.\n */\n avatarFullName: {\n type: String,\n default: '',\n },\n\n /**\n * Avatar seed, set this to the user's ID to get the same avatar background gradient each time it is displayed.\n */\n avatarSeed: {\n type: String,\n default: '',\n },\n\n /**\n * Callbox title\n */\n title: {\n type: String,\n default: '',\n },\n\n /**\n * Callbox border color\n * @values default, ai, critical\n */\n borderColor: {\n type: String,\n default: 'default',\n validator: (color) => Object.keys(CALLBOX_BORDER_COLORS).includes(color),\n },\n\n /**\n * Makes the callbox avatar and title clickable,\n * emits a click event when clicked.\n */\n clickable: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Controls the avatars overlay icon\n */\n isOnHold: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Callbox click event\n *\n * @event click\n * @type {PointerEvent | KeyboardEvent}\n */\n 'click',\n ],\n\n computed: {\n shouldShowAvatar () {\n return this.avatarFullName || this.avatarSrc;\n },\n\n badgeClass () {\n return CALLBOX_BADGE_COLORS[this.badgeColor];\n },\n\n borderClass () {\n return CALLBOX_BORDER_COLORS[this.borderColor];\n },\n },\n\n methods: {\n handleClick (e) {\n if (!this.clickable) return;\n this.$emit('click', e);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtBadge","DtAvatar","DtIconPause","color","CALLBOX_BADGE_COLORS","CALLBOX_BORDER_COLORS","e"],"mappings":"2TAiGAA,EAAA,CACA,KAAA,kBAEA,WAAA,CAAA,QAAAC,EAAAA,iBAAAC,EAAAA,QAAA,YAAAC,aAAA,EAEA,aAAA,GAEA,MAAA,CAIA,UAAA,CACA,KAAA,OACA,QAAA,EACA,EAMA,WAAA,CACA,KAAA,OACA,QAAA,KACA,UAAAC,GAAAA,IAAA,MAAA,OAAA,KAAAC,EAAAA,oBAAA,EAAA,SAAAD,CAAA,CACA,EAMA,UAAA,CACA,KAAA,OACA,QAAA,EACA,EAMA,eAAA,CACA,KAAA,OACA,QAAA,EACA,EAKA,WAAA,CACA,KAAA,OACA,QAAA,EACA,EAKA,MAAA,CACA,KAAA,OACA,QAAA,EACA,EAMA,YAAA,CACA,KAAA,OACA,QAAA,UACA,UAAAA,GAAA,OAAA,KAAAE,uBAAA,EAAA,SAAAF,CAAA,CACA,EAMA,UAAA,CACA,KAAA,QACA,QAAA,EACA,EAKA,SAAA,CACA,KAAA,QACA,QAAA,EACA,CACA,EAEA,MAAA,CAOA,OACA,EAEA,SAAA,CACA,kBAAA,CACA,OAAA,KAAA,gBAAA,KAAA,SACA,EAEA,YAAA,CACA,OAAAC,EAAAA,qBAAA,KAAA,UAAA,CACA,EAEA,aAAA,CACA,OAAAC,EAAAA,sBAAA,KAAA,WAAA,CACA,CACA,EAEA,QAAA,CACA,YAAAC,EAAA,CACA,KAAA,WACA,KAAA,MAAA,QAAAA,CAAA,CACA,CACA,CACA"}