import{icon_button_styles_default as t}from"./chunk.7BLP64MK.js";import{SlIcon as o}from"./chunk.M4HIRIJ5.js";import{ShoelaceElement as s}from"./chunk.Z7XDKKOD.js";import{__decorateClass as i}from"./chunk.6M63UXML.js";import{classMap as e}from"../../../../lit/directives/class-map.js";import{html as r,literal as l}from"../../../../lit/static-html.js";import{ifDefined as a}from"../../../../lit/directives/if-defined.js";import{property as n,query as d,state as c}from"../../../../lit/decorators.js";var h=class extends s{constructor(){super(...arguments),this.hasFocus=!1,this.label="",this.disabled=!1}handleBlur(){this.hasFocus=!1,this.emit("sl-blur")}handleFocus(){this.hasFocus=!0,this.emit("sl-focus")}handleClick(t){this.disabled&&(t.preventDefault(),t.stopPropagation())}click(){this.button.click()}focus(t){this.button.focus(t)}blur(){this.button.blur()}render(){const t=!!this.href,o=t?l`a`:l`button`;return r`
      <${o}
        part="base"
        class=${e({"icon-button":!0,"icon-button--disabled":!t&&this.disabled,"icon-button--focused":this.hasFocus})}
        ?disabled=${a(t?void 0:this.disabled)}
        type=${a(t?void 0:"button")}
        href=${a(t?this.href:void 0)}
        target=${a(t?this.target:void 0)}
        download=${a(t?this.download:void 0)}
        rel=${a(t&&this.target?"noreferrer noopener":void 0)}
        role=${a(t?void 0:"button")}
        aria-disabled=${this.disabled?"true":"false"}
        aria-label="${this.label}"
        tabindex=${this.disabled?"-1":"0"}
        @blur=${this.handleBlur}
        @focus=${this.handleFocus}
        @click=${this.handleClick}
      >
        <sl-icon
          class="icon-button__icon"
          name=${a(this.name)}
          library=${a(this.library)}
          src=${a(this.src)}
          aria-hidden="true"
        ></sl-icon>
      </${o}>
    `}};h.styles=t,h.dependencies={"sl-icon":o},i([d(".icon-button")],h.prototype,"button",2),i([c()],h.prototype,"hasFocus",2),i([n()],h.prototype,"name",2),i([n()],h.prototype,"library",2),i([n()],h.prototype,"src",2),i([n()],h.prototype,"href",2),i([n()],h.prototype,"target",2),i([n()],h.prototype,"download",2),i([n()],h.prototype,"label",2),i([n({type:Boolean,reflect:!0})],h.prototype,"disabled",2);export{h as SlIconButton};