const t=window.EdelElements.h;import{a as e}from"./chunk-2e00f500.js";var s;!function(t){t.left="left",t.right="right"}(s||(s={}));class i{constructor(){this.hasHover=!0,this.full=!1,this.slim=!1,this.disabled=!1,this.icon=null,this.label=null,this.showImage=!1,this.plain=!1,this.iconPosition=s.left,this.type=e.default,this.autofocus=!1,this.submit=!1,this.noPointerEvents=!1}render(){return this.submit?t("button",{class:this.getClass(),onClick:t=>this.handleClick(t),type:"submit"},this.getIcon(this.icon),this.getLabel(this.label),this.getImage(this.showImage)):t("a",{class:this.getClass(),onClick:t=>this.handleClick(t)},this.getIcon(this.icon),this.getLabel(this.label),this.getImage(this.showImage))}componentDidLoad(){this.autofocus&&this.hostElement.focus()}getLabel(e){return null==e?null:t("span",{class:"button-label"},e)}getIcon(e){return null==e?null:t("span",{class:"button-icon"},t("i",{class:`fas fa-${e}`}))}getImage(e){return null==e?null:t("span",{class:"button-image"},t("slot",null))}getClass(){let t="button";return this.hasHover||(t=`${t} button--has-no-hover`),this.full&&(t=`${t} button--full`),this.slim&&(t=`${t} button--slim`),this.disabled&&(t=`${t} button--disabled`),this.plain&&(t=`${t} button--plain`),this.disabled||(t=`${t} button--${this.type}`),this.iconPosition===s.right&&null!=this.icon&&(t=`${t} button--reversed`),this.noPointerEvents&&(t=`${t} no-pointer-events`),t}handleClick(t){this.disabled||this.emit.emit(t)}handleKeyDown(t){13===t.which&&this.type===e.primary&&this.handleClick()}static get is(){return"edel-button"}static get properties(){return{autofocus:{type:Boolean,attr:"autofocus",watchCallbacks:["componentDidLoad"]},disabled:{type:Boolean,attr:"disabled"},full:{type:Boolean,attr:"full"},hasHover:{type:Boolean,attr:"has-hover"},hostElement:{elementRef:!0},icon:{type:String,attr:"icon"},iconPosition:{type:String,attr:"icon-position"},label:{type:String,attr:"label"},noPointerEvents:{type:Boolean,attr:"no-pointer-events"},plain:{type:Boolean,attr:"plain"},showImage:{type:Boolean,attr:"show-image"},slim:{type:Boolean,attr:"slim"},submit:{type:Boolean,attr:"submit"},type:{type:String,attr:"type"}}}static get events(){return[{name:"emit",method:"emit",bubbles:!0,cancelable:!0,composed:!0}]}static get listeners(){return[{name:"keydown",method:"handleKeyDown"}]}}export{i as EdelButton};