@dialpad/dialtone
Version:
Dialpad's Dialtone design system monorepo
225 lines (224 loc) • 6.42 kB
JavaScript
import g from "../item-layout/item-layout.js";
import h from "../avatar/avatar.js";
import { resolveComponent as m, createBlock as i, openBlock as n, createSlots as u, withCtx as o, createElementVNode as l, renderSlot as c, createElementBlock as _, Fragment as p, renderList as S, resolveDynamicComponent as k } from "vue";
import { _ as b } from "../../_plugin-vue_export-helper-CHgC5LLL.js";
const C = {
compatConfig: { MODE: 3 },
name: "DtRecipeContactInfo",
components: {
DtAvatar: h,
DtItemLayout: g
},
/* 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: !0
},
/**
* 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");
}
}
}, z = ["aria-labelledby"], L = {
key: 0,
class: "d-recipe-contact-info__avatars"
}, q = {
class: "d-recipe-contact-info__header",
"data-qa": "contact-info-header"
}, B = {
class: "d-recipe-contact-info__subtitle",
"data-qa": "contact-info-subtitle"
}, D = {
class: "d-recipe-contact-info__bottom",
"data-qa": "contact-info-bottom"
}, I = { "data-qa": "contact-info-right" };
function A(a, r, t, N, w, s) {
const d = m("dt-avatar"), v = m("dt-item-layout");
return n(), i(v, {
role: t.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: ""
}, u({
default: o(() => [
l("div", q, [
c(a.$slots, "header")
])
]),
subtitle: o(() => [
l("div", B, [
c(a.$slots, "subtitle")
])
]),
_: 2
}, [
t.showAvatar ? {
name: "left",
fn: o(() => [
l("button", {
class: "d-recipe-contact-info__left",
"data-qa": "contact-info-left",
"aria-labelledby": t.avatarLabelledBy,
onClick: r[0] || (r[0] = (...e) => s.avatarClick && s.avatarClick(...e))
}, [
t.avatarList ? (n(), _("span", L, [
(n(!0), _(p, null, S(t.avatarList, (e, f) => (n(), i(d, {
key: f,
size: t.avatarSize,
seed: e.seed,
"full-name": e.fullName,
"image-src": e.src,
"image-alt": "",
"overlay-text": e.text,
"avatar-class": [
{
"d-recipe-contact-info__avatar-stacked": f > 0,
"d-recipe-contact-info__avatar-halo": !!e.halo
}
]
}, u({
icon: o(({ iconSize: y }) => [
c(a.$slots, "avatarIcon", { iconSize: y })
]),
_: 2
}, [
e.icon ? {
name: "overlayIcon",
fn: o(() => [
(n(), i(k(e.icon)))
]),
key: "0"
} : void 0
]), 1032, ["size", "seed", "full-name", "image-src", "overlay-text", "avatar-class"]))), 128))
])) : (n(), i(d, {
key: 1,
size: t.avatarSize,
"full-name": t.avatarFullName,
"image-src": t.avatarSrc,
"image-alt": "",
seed: t.avatarSeed,
color: t.avatarColor,
presence: t.presence
}, {
icon: o(({ iconSize: e }) => [
c(a.$slots, "avatarIcon", { iconSize: e })
]),
_: 3
}, 8, ["size", "full-name", "image-src", "seed", "color", "presence"]))
], 8, z)
]),
key: "0"
} : void 0,
a.$slots.bottom ? {
name: "bottom",
fn: o(() => [
l("div", D, [
c(a.$slots, "bottom")
])
]),
key: "1"
} : void 0,
a.$slots.right ? {
name: "right",
fn: o(() => [
l("div", I, [
c(a.$slots, "right")
])
]),
key: "2"
} : void 0
]), 1032, ["role"]);
}
const R = /* @__PURE__ */ b(C, [["render", A]]);
export {
R as default
};
//# sourceMappingURL=contact-info.js.map