UNPKG

@dialpad/dialtone

Version:

Dialpad's Dialtone design system monorepo

234 lines (233 loc) 7.43 kB
import DtItemLayout from "../../../components/item_layout/item_layout.vue.js"; import DtAvatar from "../../../components/avatar/avatar.vue.js"; import { resolveComponent, openBlock, createBlock, createSlots, withCtx, createElementVNode, renderSlot, createElementBlock, Fragment, renderList, resolveDynamicComponent } from "vue"; import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.js"; const _sfc_main = { compatConfig: { MODE: 3 }, name: "DtRecipeContactInfo", components: { DtAvatar, DtItemLayout }, /* inheritAttrs: false is generally an option we want to set on library components. This allows any attributes passed in that are not recognized as props to be passed down to another element or component using v-bind:$attrs more info: https://vuejs.org/v2/api/#inheritAttrs */ // inheritAttrs: false, props: { /** * String to use for the item's role. */ role: { type: String, default: "" }, /** * Display avatar if `showAvatar` property is true. */ showAvatar: { type: Boolean, default: true }, /** * Optional avatar image url. */ avatarSrc: { type: String, default: "" }, /** * Avatar seed, set this to the user's ID to get the same avatar background gradient each time it is displayed. */ avatarSeed: { type: String, default: null }, /** * Avatar's full name, used to extract initials * to display in avatar if `avatarSrc` and `avatarIcon` are empty. */ avatarFullName: { type: String, default: "" }, /** * The size of the avatar * @values xs, sm, md, lg, xl */ avatarSize: { type: String, default: "lg" }, /** * The aria-labelledby of the button containing avatars */ avatarLabelledBy: { type: String, default: "" }, /** * Avatar color to display if `avatarSrc` is empty. */ avatarColor: { type: String, default: null }, /** * Determines whether to show the presence indicator for * Avatar - accepts PRESENCE_STATES values: 'busy', 'away', 'offline', * or 'active'. By default, it's null and nothing is shown. * @values null, busy, away, offline, active */ presence: { type: String, default: null }, /** * Showing multiple avatars in contact info. * The props of array items are: <br> * `src` - avatar image url (optional) <br> * `fullName` - full name, used to extract initials to display in avatar<br> * if `avatarSrc` and `avatarIcon` are empty<br> * `seed` - determines uniqueness of avatar background <br> * `text` - text that overlays the avatar (optional) <br> * `icon` - icon that overlays the avatar (optional) <br> * `halo` - halo highlight around the avatar. boolean true/false */ avatarList: { type: Array, default: null } }, emits: ["avatar-click"], methods: { avatarClick() { this.$emit("avatar-click"); } } }; const _hoisted_1 = ["aria-labelledby"]; const _hoisted_2 = { key: 0, class: "d-recipe-contact-info__avatars" }; const _hoisted_3 = { class: "d-recipe-contact-info__header", "data-qa": "contact-info-header" }; const _hoisted_4 = { class: "d-recipe-contact-info__subtitle", "data-qa": "contact-info-subtitle" }; const _hoisted_5 = { class: "d-recipe-contact-info__bottom", "data-qa": "contact-info-bottom" }; const _hoisted_6 = { "data-qa": "contact-info-right" }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_dt_avatar = resolveComponent("dt-avatar"); const _component_dt_item_layout = resolveComponent("dt-item-layout"); return openBlock(), createBlock(_component_dt_item_layout, { role: $props.role, "data-qa": "contact-info", class: "d-recipe-contact-info", "content-class": "d-recipe-contact-info__content", "right-class": "d-recipe-contact-info__right", unstyled: "" }, createSlots({ default: withCtx(() => [ createElementVNode("div", _hoisted_3, [ renderSlot(_ctx.$slots, "header") ]) ]), subtitle: withCtx(() => [ createElementVNode("div", _hoisted_4, [ renderSlot(_ctx.$slots, "subtitle") ]) ]), _: 2 }, [ $props.showAvatar ? { name: "left", fn: withCtx(() => [ createElementVNode("button", { class: "d-recipe-contact-info__left", "data-qa": "contact-info-left", "aria-labelledby": $props.avatarLabelledBy, onClick: _cache[0] || (_cache[0] = (...args) => $options.avatarClick && $options.avatarClick(...args)) }, [ $props.avatarList ? (openBlock(), createElementBlock("span", _hoisted_2, [ (openBlock(true), createElementBlock(Fragment, null, renderList($props.avatarList, (avatar, index) => { return openBlock(), createBlock(_component_dt_avatar, { key: index, size: $props.avatarSize, seed: avatar.seed, "full-name": avatar.fullName, "image-src": avatar.src, "image-alt": "", "overlay-text": avatar.text, "avatar-class": [ { "d-recipe-contact-info__avatar-stacked": index > 0, "d-recipe-contact-info__avatar-halo": !!avatar.halo } ] }, createSlots({ icon: withCtx(({ iconSize }) => [ renderSlot(_ctx.$slots, "avatarIcon", { iconSize }) ]), _: 2 }, [ avatar.icon ? { name: "overlayIcon", fn: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(avatar.icon))) ]), key: "0" } : void 0 ]), 1032, ["size", "seed", "full-name", "image-src", "overlay-text", "avatar-class"]); }), 128)) ])) : (openBlock(), createBlock(_component_dt_avatar, { key: 1, size: $props.avatarSize, "full-name": $props.avatarFullName, "image-src": $props.avatarSrc, "image-alt": "", seed: $props.avatarSeed, color: $props.avatarColor, presence: $props.presence }, { icon: withCtx(({ iconSize }) => [ renderSlot(_ctx.$slots, "avatarIcon", { iconSize }) ]), _: 3 }, 8, ["size", "full-name", "image-src", "seed", "color", "presence"])) ], 8, _hoisted_1) ]), key: "0" } : void 0, _ctx.$slots.bottom ? { name: "bottom", fn: withCtx(() => [ createElementVNode("div", _hoisted_5, [ renderSlot(_ctx.$slots, "bottom") ]) ]), key: "1" } : void 0, _ctx.$slots.right ? { name: "right", fn: withCtx(() => [ createElementVNode("div", _hoisted_6, [ renderSlot(_ctx.$slots, "right") ]) ]), key: "2" } : void 0 ]), 1032, ["role"]); } const contact_info = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); export { contact_info as default }; //# sourceMappingURL=contact_info.vue.js.map