import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-2bf16536.js";var cardCss=":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}";var BdsCardStyle0=cardCss;var Card=function(){function t(t){registerInstance(this,t);this.bdsClick=createEvent(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"}t.prototype.componentDidLoad=function(){var t=this;this.cardElement=this.element.shadowRoot.querySelector(".card");if(this.cardElement&&this.clickable===true){this.cardElement.addEventListener("mouseenter",(function(){t.isHovered=true}));this.cardElement.addEventListener("mouseleave",(function(){t.isHovered=false}));this.cardElement.addEventListener("mousedown",(function(){t.isPressed=true;t.bdsClick.emit()}));document.addEventListener("mouseup",(function(){t.isPressed=false}));this.cardElement.addEventListener("keydown",(function(e){if(e.key==="Enter"){t.isPressed=true;t.bdsClick.emit()}}));this.cardElement.addEventListener("keyup",(function(e){if(e.key==="Enter"){t.isPressed=false}}))}};t.prototype.componentDidUpdate=function(){if(this.isPressed){this.elevation="static"}else if(this.isHovered){this.elevation="secondary"}};t.prototype.handleKeyDown=function(t){if(t.key=="Enter"){this.isPressed=true;this.bdsClick.emit(t)}};t.prototype.render=function(){var t={width:this.width};return h(Host,{key:"c0bfc28467468500871a62a1af9f37a0ab4f8b07",style:t},h("bds-paper",{key:"b0bc889271ffac10d06e998aec258206faf9ded7",elevation:this.elevation,class:{card:true,card_hover:this.clickable},height:this.height,width:this.width,"data-test":this.dataTest},h("div",{key:"31c9dcebb325c1ee1fd305ef071f61973cea33e0",tabindex:"0",class:"focus",onKeyDown:this.handleKeyDown.bind(this)}),h("bds-grid",{key:"3949a6141f8a4b1ac4638e608d31f758e4e2ecfc",xxs:"12",direction:"column",gap:"2",padding:"2"},h("slot",{key:"b7b8df56fc879b88efa49587804b721b59aca24a"}))))};Object.defineProperty(t.prototype,"element",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();Card.style=BdsCardStyle0;export{Card as bds_card};
//# sourceMappingURL=bds-card.entry.js.map