import{radio_styles_default as e}from"./chunk.FGNNVMLF.js";import{SlIcon as t}from"./chunk.M4HIRIJ5.js";import{watch as s}from"./chunk.C7FWPEOY.js";import{ShoelaceElement as i}from"./chunk.Z7XDKKOD.js";import{__decorateClass as a}from"./chunk.6M63UXML.js";import{classMap as r}from"../../../../lit/directives/class-map.js";import{html as d}from"../../../../lit/index.js";import{property as h,state as c}from"../../../../lit/decorators.js";var l=class extends i{constructor(){super(),this.checked=!1,this.hasFocus=!1,this.size="medium",this.disabled=!1,this.handleBlur=()=>{this.hasFocus=!1,this.emit("sl-blur")},this.handleClick=()=>{this.disabled||(this.checked=!0)},this.handleFocus=()=>{this.hasFocus=!0,this.emit("sl-focus")},this.addEventListener("blur",this.handleBlur),this.addEventListener("click",this.handleClick),this.addEventListener("focus",this.handleFocus)}connectedCallback(){super.connectedCallback(),this.setInitialAttributes()}setInitialAttributes(){this.setAttribute("role","radio"),this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled",this.disabled?"true":"false")}handleCheckedChange(){this.setAttribute("aria-checked",this.checked?"true":"false"),this.setAttribute("tabindex",this.checked?"0":"-1")}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}render(){return d`
      <span
        part="base"
        class=${r({radio:!0,"radio--checked":this.checked,"radio--disabled":this.disabled,"radio--focused":this.hasFocus,"radio--small":"small"===this.size,"radio--medium":"medium"===this.size,"radio--large":"large"===this.size})}
      >
        <span part="${"control"+(this.checked?" control--checked":"")}" class="radio__control">
          ${this.checked?d` <sl-icon part="checked-icon" class="radio__checked-icon" library="system" name="radio"></sl-icon> `:""}
        </span>

        <slot part="label" class="radio__label"></slot>
      </span>
    `}};l.styles=e,l.dependencies={"sl-icon":t},a([c()],l.prototype,"checked",2),a([c()],l.prototype,"hasFocus",2),a([h()],l.prototype,"value",2),a([h({reflect:!0})],l.prototype,"size",2),a([h({type:Boolean,reflect:!0})],l.prototype,"disabled",2),a([s("checked")],l.prototype,"handleCheckedChange",1),a([s("disabled",{waitUntilFirstUpdate:!0})],l.prototype,"handleDisabledChange",1);export{l as SlRadio};