import{radio_button_styles_default as t}from"./chunk.6HJKL75R.js";import{HasSlotController as e}from"./chunk.NYIIDP5N.js";import{watch as s}from"./chunk.C7FWPEOY.js";import{ShoelaceElement as i}from"./chunk.Z7XDKKOD.js";import{__decorateClass as o}from"./chunk.6M63UXML.js";import{classMap as l}from"../../../../lit/directives/class-map.js";import{html as r}from"../../../../lit/static-html.js";import{ifDefined as a}from"../../../../lit/directives/if-defined.js";import{property as h,query as u,state as n}from"../../../../lit/decorators.js";var d=class extends i{constructor(){super(...arguments),this.hasSlotController=new e(this,"[default]","prefix","suffix"),this.hasFocus=!1,this.checked=!1,this.disabled=!1,this.size="medium",this.pill=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("role","presentation")}handleBlur(){this.hasFocus=!1,this.emit("sl-blur")}handleClick(t){if(this.disabled)return t.preventDefault(),void t.stopPropagation();this.checked=!0}handleFocus(){this.hasFocus=!0,this.emit("sl-focus")}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}focus(t){this.input.focus(t)}blur(){this.input.blur()}render(){return r`
      <div part="base" role="presentation">
        <button
          part="${"button"+(this.checked?" button--checked":"")}"
          role="radio"
          aria-checked="${this.checked}"
          class=${l({button:!0,"button--default":!0,"button--small":"small"===this.size,"button--medium":"medium"===this.size,"button--large":"large"===this.size,"button--checked":this.checked,"button--disabled":this.disabled,"button--focused":this.hasFocus,"button--outline":!0,"button--pill":this.pill,"button--has-label":this.hasSlotController.test("[default]"),"button--has-prefix":this.hasSlotController.test("prefix"),"button--has-suffix":this.hasSlotController.test("suffix")})}
          aria-disabled=${this.disabled}
          type="button"
          value=${a(this.value)}
          tabindex="${this.checked?"0":"-1"}"
          @blur=${this.handleBlur}
          @focus=${this.handleFocus}
          @click=${this.handleClick}
        >
          <slot name="prefix" part="prefix" class="button__prefix"></slot>
          <slot part="label" class="button__label"></slot>
          <slot name="suffix" part="suffix" class="button__suffix"></slot>
        </button>
      </div>
    `}};d.styles=t,o([u(".button")],d.prototype,"input",2),o([u(".hidden-input")],d.prototype,"hiddenInput",2),o([n()],d.prototype,"hasFocus",2),o([h({type:Boolean,reflect:!0})],d.prototype,"checked",2),o([h()],d.prototype,"value",2),o([h({type:Boolean,reflect:!0})],d.prototype,"disabled",2),o([h({reflect:!0})],d.prototype,"size",2),o([h({type:Boolean,reflect:!0})],d.prototype,"pill",2),o([s("disabled",{waitUntilFirstUpdate:!0})],d.prototype,"handleDisabledChange",1);export{d as SlRadioButton};