import{__decorate as t}from"../../_virtual/_tslib.js";import'./../../external/@lit/reactive-element/reactive-element.js';import{html as e}from'./../../external/lit-html/lit-html.js';import{LitElement as i}from'./../../external/lit-element/lit-element.js';import{customElement as s}from'./../../external/@lit/reactive-element/decorators/custom-element.js';import{property as o}from'./../../external/@lit/reactive-element/decorators/property.js';import{state as r}from'./../../external/@lit/reactive-element/decorators/state.js';import'./../../external/@lit/reactive-element/decorators/query-assigned-elements.js';import{queryAssignedNodes as n}from'./../../external/@lit/reactive-element/decorators/query-assigned-nodes.js';import{ifDefined as l}from'./../../external/lit-html/directives/if-defined.js';import{classMap as d}from'./../../external/lit-html/directives/class-map.js';import{BUTTON_TYPES as a,BUTTON_KINDS as h,BUTTON_SIZES as p,BUTTON_ICON_POSITION as m}from"./defs.js";import c from"./button.scss.js";let y=class extends i{constructor(){super(...arguments),this.internals=this.attachInternals(),this.description="",this.type=a.BUTTON,this.kind=h.PRIMARY_APP,this.href="",this.size=p.MEDIUM,this.iconPosition=m.CENTER,this.disabled=!1,this.destructive=!1}render(){const t=this._slottedEls.filter((t=>""!==t.textContent.trim())),i={[h.PRIMARY_APP]:"primary-app",[h.PRIMARY_WEB]:"primary-web",[h.SECONDARY]:"secondary",[h.TERTIARY]:"tertiary"}[this.kind],s={[`kd-btn--${i}${this.destructive?"-destructive":""}`]:!0,[`kd-btn--${i}`]:!this.destructive,"kd-btn--large":this.size===p.LARGE,"kd-btn--small":this.size===p.SMALL,"kd-btn--medium":this.size===p.MEDIUM,[`kd-btn--icon-${this.iconPosition}`]:!!this.iconPosition,"icon-only":this._iconEls.length&&!t.length};return e`
      ${""!==this.href?e`
            <a
              class=${d(s)}
              href=${this.href}
              ?disabled=${this.disabled}
              aria-label=${l(this.description||void 0)}
              title=${l(this.description||void 0)}
              @click=${t=>this.handleClick(t)}
            >
              <span>
                <slot @slotchange=${()=>this._handleSlotChange()}></slot>
                <slot
                  name="icon"
                  @slotchange=${()=>this._handleSlotChange()}
                ></slot>
              </span>
            </a>
          `:e`
            <button
              class=${d(s)}
              type=${this.type}
              ?disabled=${this.disabled}
              aria-label=${l(this.description||void 0)}
              title=${l(this.description||void 0)}
              value=${l(this.value)}
              formmethod=${l(this.formmethod)}
              @click=${t=>this.handleClick(t)}
            >
              <span>
                <slot @slotchange=${()=>this._handleSlotChange()}></slot>
                <slot
                  name="icon"
                  @slotchange=${()=>this._handleSlotChange()}
                ></slot>
              </span>
            </button>
          `}
    `}handleClick(t){this.internals.form&&("submit"===this.type?this.internals.form.submit():"reset"===this.type&&this.internals.form.reset());const e=new CustomEvent("on-click",{detail:{origEvent:t}});this.dispatchEvent(e)}_handleSlotChange(){this.requestUpdate()}firstUpdated(){this._handleSlotChange()}};y.styles=[c],y.formAssociated=!0,t([r()],y.prototype,"internals",void 0),t([o({type:String})],y.prototype,"description",void 0),t([o({type:String})],y.prototype,"type",void 0),t([o({type:String})],y.prototype,"kind",void 0),t([o({type:String})],y.prototype,"href",void 0),t([o({type:String})],y.prototype,"size",void 0),t([o({type:String})],y.prototype,"iconPosition",void 0),t([o({type:Boolean,reflect:!0})],y.prototype,"disabled",void 0),t([o({type:Boolean,reflect:!0})],y.prototype,"destructive",void 0),t([o({type:String})],y.prototype,"value",void 0),t([o({type:String})],y.prototype,"formmethod",void 0),t([n()],y.prototype,"_slottedEls",void 0),t([n({slot:"icon"})],y.prototype,"_iconEls",void 0),y=t([s("kd-button")],y);export{y as Button};
//# sourceMappingURL=button.js.map
