UNPKG

@dialpad/dialtone-vue

Version:

Vue component library for Dialpad's design system Dialtone

1 lines 6.51 kB
{"version":3,"file":"contact-row.cjs","sources":["../../../recipes/leftbar/contact_row/contact_row.vue"],"sourcesContent":["<template>\n <dt-recipe-general-row\n :unread-count=\"unreadCount\"\n :description=\"contactDescription\"\n :has-unreads=\"hasUnreads\"\n :selected=\"selected\"\n :has-call-button=\"hasCallButton\"\n :muted=\"muted\"\n :is-typing=\"isTyping\"\n v-bind=\"$attrs\"\n data-qa=\"contact-row\"\n v-on=\"$listeners\"\n >\n <template #left>\n <dt-avatar\n :full-name=\"name\"\n :image-src=\"avatarSrc\"\n :color=\"avatarColor\"\n image-alt=\"\"\n size=\"sm\"\n :seed=\"avatarSeed\"\n :presence=\"avatarPresence\"\n >\n <template\n v-if=\"noInitials\"\n #icon\n >\n <dt-icon-user\n size=\"200\"\n />\n </template>\n </dt-avatar>\n </template>\n <template #label>\n <dt-emoji-text-wrapper\n class=\"d-recipe-leftbar-row__description\"\n data-qa=\"dt-recipe-leftbar-row-description\"\n size=\"200\"\n >\n {{ name }}\n </dt-emoji-text-wrapper>\n <div class=\"d-recipe-leftbar-row__status\">\n <span\n v-if=\"presenceText\"\n data-qa=\"dt-recipe-leftbar-row-presence-text\"\n :class=\"['d-recipe-leftbar-row__meta-context', presenceFontColorClass]\"\n >\n {{ presenceText }}\n </span>\n <dt-emoji-text-wrapper\n v-if=\"userStatus\"\n size=\"100\"\n element-type=\"span\"\n data-qa=\"dt-recipe-leftbar-row-user-status\"\n class=\"d-recipe-leftbar-row__meta-custom\"\n >\n {{ userStatus }}\n </dt-emoji-text-wrapper>\n </div>\n </template>\n </dt-recipe-general-row>\n</template>\n\n<script>\nimport { DtRecipeGeneralRow } from '@/recipes/leftbar/general_row';\nimport { DtEmojiTextWrapper } from '@/components/emoji_text_wrapper';\nimport { DtAvatar } from '@/components/avatar';\nimport { safeConcatStrings } from '@/common/utils';\nimport { DtIconUser } from '@dialpad/dialtone-icons/vue2';\n\nexport default {\n name: 'DtRecipeContactRow',\n\n components: {\n DtAvatar,\n DtRecipeGeneralRow,\n DtEmojiTextWrapper,\n DtIconUser,\n },\n\n inheritAttrs: false,\n\n props: {\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 * Determines whether to show the presence indicator for\n * Avatar - accepts PRESENCE_STATES values: 'busy', 'away', 'offline',\n * or 'active'. By default, it's null and nothing is shown.\n * defer validation to avatar component.\n * @values null, busy, away, offline, active\n */\n avatarPresence: {\n type: String,\n default: null,\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: null,\n },\n\n /**\n * Avatar color to display if `avatarSrc` is empty.\n */\n avatarColor: {\n type: String,\n default: null,\n },\n\n /**\n * Text describing the user's presence, such as \"in a meeting\"\n */\n presenceText: {\n type: String,\n default: '',\n },\n\n /**\n * Name of the contact\n */\n name: {\n type: String,\n required: true,\n },\n\n /**\n * Status as set by the user.\n */\n userStatus: {\n type: String,\n default: '',\n },\n\n /**\n * Gives a faded style to be used when muted\n */\n muted: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Number of unread messages\n */\n unreadCount: {\n type: String,\n default: null,\n },\n\n /**\n * Styles the row with an increased font weight to convey it has unreads. This must be true to see\n * the unread count badge.\n */\n hasUnreads: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Determines if the row is selected\n */\n selected: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Initials will never be shown. Instead it will show a \"User\" icon.\n */\n noInitials: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Shows an \"is typing\" animation over the avatar when true.\n */\n isTyping: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Whether the contact row should display a call button when hovered.\n */\n hasCallButton: {\n type: Boolean,\n default: true,\n },\n },\n\n emits: [\n /**\n * Native click event on the row itself\n *\n * @event click\n * @type {PointerEvent | KeyboardEvent}\n */\n 'click',\n\n /**\n * Call button clicked\n *\n * @event call\n * @type {PointerEvent | KeyboardEvent}\n */\n 'call',\n ],\n\n computed: {\n presenceFontColorClass () {\n const presenceFontColors = {\n active: 'd-recipe-contact-row--active',\n busy: 'd-recipe-contact-row--busy',\n away: 'd-recipe-contact-row--away',\n };\n\n return presenceFontColors[this.avatarPresence];\n },\n\n contactDescription () {\n return safeConcatStrings([this.name, this.presenceText, this.userStatus]);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtAvatar","DtRecipeGeneralRow","DtEmojiTextWrapper","DtIconUser","safeConcatStrings"],"mappings":"sYAsEAA,EAAA,CACA,KAAA,qBAEA,WAAA,CACA,SAAAC,EAAAA,QACA,mBAAAC,EAAAA,QACA,mBAAAC,EAAAA,QACA,WAAAC,EAAAA,UACA,EAEA,aAAA,GAEA,MAAA,CAKA,UAAA,CACA,KAAA,OACA,QAAA,EACA,EASA,eAAA,CACA,KAAA,OACA,QAAA,IACA,EAKA,WAAA,CACA,KAAA,OACA,QAAA,IACA,EAKA,YAAA,CACA,KAAA,OACA,QAAA,IACA,EAKA,aAAA,CACA,KAAA,OACA,QAAA,EACA,EAKA,KAAA,CACA,KAAA,OACA,SAAA,EACA,EAKA,WAAA,CACA,KAAA,OACA,QAAA,EACA,EAKA,MAAA,CACA,KAAA,QACA,QAAA,EACA,EAKA,YAAA,CACA,KAAA,OACA,QAAA,IACA,EAMA,WAAA,CACA,KAAA,QACA,QAAA,EACA,EAKA,SAAA,CACA,KAAA,QACA,QAAA,EACA,EAKA,WAAA,CACA,KAAA,QACA,QAAA,EACA,EAKA,SAAA,CACA,KAAA,QACA,QAAA,EACA,EAKA,cAAA,CACA,KAAA,QACA,QAAA,EACA,CACA,EAEA,MAAA,CAOA,QAQA,MACA,EAEA,SAAA,CACA,wBAAA,CAOA,MANA,CACA,OAAA,+BACA,KAAA,6BACA,KAAA,4BACA,EAEA,KAAA,cAAA,CACA,EAEA,oBAAA,CACA,OAAAC,EAAAA,kBAAA,CAAA,KAAA,KAAA,KAAA,aAAA,KAAA,UAAA,CAAA,CACA,CACA,CACA"}