UNPKG

@dialpad/dialtone

Version:

Dialpad's Dialtone design system monorepo

3 lines (2 loc) 5.07 kB
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("./feed-item-row-constants.cjs"),m=require("../../common/mixins/modal.cjs"),_=require("@dialpad/dialtone-icons/vue3"),e=require("vue"),u=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),f=require("../badge/badge.cjs"),h=require("../list-item/list-item.cjs"),p=require("../lazy-show/lazy-show.cjs"),w=require("../avatar/avatar.cjs"),v={compatConfig:{MODE:3},name:"DtRecipeFeedItemRow",components:{DtAvatar:w.default,DtLazyShow:p.default,DtListItem:h.default,DtBadge:f.default,DtIconUser:_.DtIconUser},mixins:[m.default],inheritAttrs:!1,props:{avatarSeed:{type:String,default:null},showHeader:{type:Boolean,default:!1},avatarImageUrl:{type:String,default:""},displayName:{type:String,default:""},noInitials:{type:Boolean,default:!1},time:{type:String,default:""},shortTime:{type:String,default:""},labelText:{type:String,default:""},isActive:{type:Boolean,default:!1},state:{type:String,default:o.DEFAULT_FEED_ROW_STATE,validator:t=>Object.keys(o.FEED_ROW_STATE_BACKGROUND_COLOR).includes(t)}},emits:["hover","focus","keydown"],data(){return{transitionActive:!1}},computed:{feedListeners(){return{mouseenter:()=>this.setHover(!0),mouseleave:()=>this.setHover(!1),focusin:()=>this.setFocus(!0),focusout:()=>this.setFocus(!1),transitionend:()=>this.transitionComplete(),keydown:t=>{switch(t.code){case"Tab":this.trapFocus(t);break}this.$emit("keydown",t)}}},listItemClasses(){return["d-recipe-feed-item-row",{"d-recipe-feed-item-row--active":this.isActive&&this.state===o.DEFAULT_FEED_ROW_STATE},{"d-recipe-feed-item-row__state-transition":this.transitionActive},o.FEED_ROW_STATE_BACKGROUND_COLOR[this.state]]}},watch:{state:{immediate:!0,handler:function(t){t!==o.DEFAULT_FEED_ROW_STATE&&(this.transitionActive=!0)}}},methods:{transitionComplete(){this.state===o.DEFAULT_FEED_ROW_STATE&&(this.transitionActive=!1)},trapFocus(t){this.focusTrappedTabPress(t)},setFocus(t){this.$emit("focus",t)},setHover(t){this.$emit("hover",t)}}},y={key:0,class:"d-recipe-feed-item-row__avatar-container"},E={class:"d-recipe-feed-item-row__content"},S={key:0,"data-qa":"dt-recipe-feed-item-row--header",class:"d-recipe-feed-item-row__header"},g={class:"d-recipe-feed-item-row__header-name"},k={class:"d-recipe-feed-item-row__header-time"},C={"data-qa":"dt-recipe-feed-item-row--content"},D={key:1,"data-qa":"dt-recipe-feed-item-row--attachment",class:"d-recipe-feed-item-row__attachment"},T={key:0,class:"d-recipe-feed-item-row__reactions","data-qa":"dt-recipe-feed-item-row--reactions"},A={key:1,class:"d-recipe-feed-item-row__threading"},B={"data-qa":"dt-recipe-feed-item-row--menu",class:"d-recipe-feed-item-row__menu"};function N(t,F,a,q,V,i){const s=e.resolveComponent("dt-icon-user"),r=e.resolveComponent("dt-avatar"),n=e.resolveComponent("dt-badge"),d=e.resolveComponent("dt-lazy-show"),l=e.resolveComponent("dt-list-item");return e.openBlock(),e.createBlock(l,e.mergeProps({ref:"FeedItemRef","navigation-type":"none"},t.$attrs,{class:i.listItemClasses,"data-qa":"dt-recipe-feed-item-row"},e.toHandlers(i.feedListeners)),{left:e.withCtx(()=>[a.showHeader?(e.openBlock(),e.createElementBlock("div",y,[e.renderSlot(t.$slots,"avatar",{},()=>[e.createVNode(r,{"full-name":a.displayName,"image-src":a.avatarImageUrl,"image-alt":"",seed:a.avatarSeed},e.createSlots({_:2},[a.noInitials?{name:"icon",fn:e.withCtx(({iconSize:c})=>[e.createVNode(s,{size:c},null,8,["size"])]),key:"0"}:void 0]),1032,["full-name","image-src","seed"])])])):e.createCommentVNode("",!0),a.showHeader?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("span",{key:1,class:"d-recipe-feed-item-row__left-time","data-qa":"dt-recipe-feed-item-row--left-time"},e.toDisplayString(a.shortTime),513)),[[e.vShow,a.isActive]])]),bottom:e.withCtx(()=>[t.$slots.reactions?(e.openBlock(),e.createElementBlock("div",T,[e.renderSlot(t.$slots,"reactions")])):e.createCommentVNode("",!0),t.$slots.threading?(e.openBlock(),e.createElementBlock("div",A,[e.renderSlot(t.$slots,"threading")])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",B,[e.createVNode(d,{appear:!0,transition:"fade",show:a.isActive},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"menu")]),_:3},8,["show"])],512),[[e.vShow,a.isActive]])]),default:e.withCtx(()=>[e.createElementVNode("article",E,[a.showHeader?(e.openBlock(),e.createElementBlock("div",S,[e.renderSlot(t.$slots,"displayName",{},()=>[e.createElementVNode("p",g,e.toDisplayString(a.displayName),1)]),e.createElementVNode("time",k,e.toDisplayString(a.time),1),a.labelText?(e.openBlock(),e.createBlock(n,{key:0,text:a.labelText},null,8,["text"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("span",C,[e.renderSlot(t.$slots,"default")]),t.$slots.attachment?(e.openBlock(),e.createElementBlock("div",D,[e.renderSlot(t.$slots,"attachment")])):e.createCommentVNode("",!0)])]),_:3},16,["class"])}const b=u._(v,[["render",N]]);exports.default=b; //# sourceMappingURL=feed-item-row.cjs.map