import{r as s,c as t,h as e,H as i,g as a}from"./p-a6030c6e.js";const o=":host{display:-ms-flexbox;display:flex;position:relative}:host:focus-visible{outline:none}.card{display:-ms-flexbox;display:flex;width:100%}.card_hover:hover{-webkit-transform:scale(1.02);transform:scale(1.02);-webkit-transition:all 0.3s;transition:all 0.3s;cursor:pointer}.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 h=o;const r=class{constructor(e){s(this,e);this.bdsClick=t(this,"bdsClick",7);this.height=null;this.width="fit-content";this.clickable=false;this.dataTest=null;this.isHovered=false;this.isPressed=false;this.elevation="primary"}componentDidLoad(){this.cardElement=this.element.shadowRoot.querySelector(".card");if(this.cardElement&&this.clickable===true){this.cardElement.addEventListener("mouseenter",(()=>{this.isHovered=true}));this.cardElement.addEventListener("mouseleave",(()=>{this.isHovered=false}));this.cardElement.addEventListener("mousedown",(()=>{this.isPressed=true;this.bdsClick.emit()}));document.addEventListener("mouseup",(()=>{this.isPressed=false}));this.cardElement.addEventListener("keydown",(s=>{if(s.key==="Enter"){this.isPressed=true;this.bdsClick.emit()}}));this.cardElement.addEventListener("keyup",(s=>{if(s.key==="Enter"){this.isPressed=false}}))}}componentDidUpdate(){if(this.isPressed){this.elevation="static"}else if(this.isHovered){this.elevation="secondary"}}handleKeyDown(s){if(s.key=="Enter"){this.isPressed=true;this.bdsClick.emit(s)}}render(){const s={width:this.width};return e(i,{key:"c0bfc28467468500871a62a1af9f37a0ab4f8b07",style:s},e("bds-paper",{key:"b0bc889271ffac10d06e998aec258206faf9ded7",elevation:this.elevation,class:{card:true,card_hover:this.clickable},height:this.height,width:this.width,"data-test":this.dataTest},e("div",{key:"31c9dcebb325c1ee1fd305ef071f61973cea33e0",tabindex:"0",class:"focus",onKeyDown:this.handleKeyDown.bind(this)}),e("bds-grid",{key:"3949a6141f8a4b1ac4638e608d31f758e4e2ecfc",xxs:"12",direction:"column",gap:"2",padding:"2"},e("slot",{key:"b7b8df56fc879b88efa49587804b721b59aca24a"}))))}get element(){return a(this)}};r.style=h;export{r as bds_card};
//# sourceMappingURL=p-b9e227b8.entry.js.map