import{r as a,c as t,h as i,H as r}from"./p-a6030c6e.js";const e=".host{position:relative;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.avatar__group{display:-ms-flexbox;display:flex}.avatar__group>*:nth-child(1){z-index:1}.avatar__group>*:nth-child(2){z-index:2}.avatar__group>*:nth-child(3){z-index:3}.avatar__group>*:nth-child(4){z-index:4}.avatar__group>*:nth-child(5){z-index:5}.avatar__group>*:nth-child(6){z-index:6;width:auto}.avatar__group>*:nth-child(6) div{background-color:#1a2437;padding:0 16px;width:auto}.avatar__group__click--true{cursor:pointer}.avatar__group .avatar{position:relative}.avatar__group__size--extra-small{margin-left:8px}.avatar__group__size--extra-small>*{margin-left:-8px}.avatar__group__size--extra-small>*:nth-child(6) div{padding:0 8px}.avatar__group__size--extra-small .avatar{height:32px}.avatar__group__size--small{margin-left:8px}.avatar__group__size--small>*{margin-left:-8px}.avatar__group__size--small .avatar{height:40px}.avatar__group__size--standard{margin-left:16px}.avatar__group__size--standard>*{margin-left:-16px}.avatar__group__size--standard .avatar{height:56px}.avatar__group__size--large{margin-left:16px}.avatar__group__size--large>*{margin-left:-16px}.avatar__group__size--large .avatar{height:64px}.avatar__group__size--extra-large{margin-left:16px}.avatar__group__size--extra-large>*{margin-left:-16px}.avatar__group__size--extra-large .avatar{height:72px}.focus:focus-visible{display:-ms-flexbox;display:flex;position:absolute;border:2px solid var(--color-focus, #c226fb);border-radius:4px;width:100%;height:100%;top:-4px;left:-4px;padding-right:4px;padding-bottom:4px;outline:none}";const s=e;const _=class{constructor(i){a(this,i);this.bdsClickAvatarGroup=t(this,"bdsClickAvatarGroup",7);this.avatarBgColor=a=>{const t=["system","success","warning","error","info"];return t[a]};this.internalUsers=undefined;this.leftoversUsers=undefined;this.size="standard";this.users=undefined;this.canClick=undefined}handleClickGroup(a){a.preventDefault();this.bdsClickAvatarGroup.emit(a)}handleClickKey(a){if((a.key==="Enter"||a.key===" ")&&this.canClick){a.preventDefault();this.bdsClickAvatarGroup.emit()}}parseUsers(){if(this.users){try{this.internalUsers=typeof this.users==="string"?JSON.parse(this.users):this.users}catch(a){this.internalUsers=[]}}}componentWillLoad(){this.users&&this.parseUsers();this.leftoversUsers=this.internalUsers.length-5}render(){return i(r,{key:"be25d5e80705769f25c1fff5b82724f42e20a3c2",class:"host"},i("div",{key:"128216ce7924b434370b0787c0b1bbff057802cb",class:{avatar__group:true,[`avatar__group__size--${this.size}`]:true,[`avatar__group__click--${this.canClick}`]:true},onClick:()=>this.handleClickGroup},this.internalUsers?this.internalUsers.slice(0,6).map(((a,t,r)=>t+1===r.length&&this.internalUsers.length>5?i("bds-avatar",{key:t,name:a.name,color:"surface",size:this.size,ellipsis:this.leftoversUsers}):i("bds-avatar",{key:t,id:a.id,name:a.name,thumbnail:a.thumbnail,color:this.avatarBgColor(t),size:this.size}))):i("slot",null)),this.canClick?i("div",{class:"focus",tabindex:"0",onClick:()=>this.handleClickKey}):"")}};_.style=s;export{_ as bds_avatar_group};
//# sourceMappingURL=p-518a4e36.entry.js.map