import{a as u}from"./chunk.CGQ2BPPZ.js";import{a as i}from"./chunk.UFTAQNZB.js";import{a as o}from"./chunk.NYKJXI3Q.js";import{a as h,b as a,c as r,d,h as n}from"./chunk.XJAJO727.js";import{b as c,e as l}from"./chunk.OBAEIKIV.js";import{e as t}from"./chunk.6EV4YU6C.js";var e=class extends n{constructor(){super(...arguments);this.hasSlotController=new u(this,"default","left","right");this.current=!1;this.selected=!1;this.hasHover=!1;this.isKeyboardFocus=!1;this.size="lg";this.checkbox=!1;this.disabled=!1;this.value=""}connectedCallback(){super.connectedCallback(),this.setAttribute("role","option"),this.setAttribute("aria-selected","false")}handleDefaultSlotChange(){let s=this.getTextLabel();if(typeof this.cachedTextLabel=="undefined"){this.cachedTextLabel=s;return}s!==this.cachedTextLabel&&(this.cachedTextLabel=s,this.emit("slotchange",{bubbles:!0,composed:!1,cancelable:!1}))}handleMouseEnter(){this.hasHover=!0}handleMouseLeave(){this.hasHover=!1}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}handleSelectedChange(){this.setAttribute("aria-selected",this.selected?"true":"false")}handleValueChange(){this.value.includes(" ")&&(console.error("Option values cannot include a space. All spaces have been replaced with underscores.",this),this.value=this.value.replace(/ /g,"_"))}getTextLabel(){var s;return((s=this.textContent)!=null?s:"").trim()}render(){let s={default:this.hasSlotController.test("default"),left:this.hasSlotController.test("left"),right:this.hasSlotController.test("right")};return l`<div part="base" style="word-break:break-word" class="${i("px-4 flex items-start w-full transition-colors duration-fast ease-in-out text-left text-base relative",{sm:"text-base py-1",md:"text-base py-2",lg:"text-base py-3"}[this.size],this.disabled?"text-neutral-500 cursor-not-allowed":"text-black cursor-pointer",this.hasHover&&!this.disabled?"bg-neutral-200":"",this.isKeyboardFocus?"focus-outline focus-outline-offset":"",this.current&&"bg-neutral-200")}" @mouseenter="${this.handleMouseEnter}" @mouseleave="${this.handleMouseLeave}"><span class="${i("absolute w-full left-0 top-0 pointer-events-none transition-[height,top] duration-fast ease-in-out border-l-4 h-[calc(100%-8px)]",this.selected&&!this.checkbox?"border-accent":"border-transparent",this.disabled&&"border-neutral-500 top-1",!this.disabled&&this.hasHover?"h-full top-0":"top-1")}"></span> ${this.checkbox?l`<span id="control" part="control ${this.selected?" control--checked":"control--unchecked"}" class="${i("relative flex flex-shrink-0 items-center justify-center border sd-6-22-0-checkbox-border-width rounded-sm h-4 w-4 mr-2",{sm:"mt-0.5",md:"mt-1",lg:"mt-1"}[this.size],this.disabled?"sd-6-22-0-option--disabled-color-border":this.selected?"bg-accent border-accent":"bg-white form-control-color-border")}">${this.selected?l`<sd-6-22-0-icon part="checked-icon" class="text-white w-3 h-3" library="_internal" name="status-check"></sd-6-22-0-icon>`:""}</span>`:""} ${s.left?l`<slot name="left" part="left" class="inline-flex mr-2"></slot>`:""}<slot part="label" class="inline-block flex-grow" @slotchange="${this.handleDefaultSlotChange}"></slot>${s.right?l`<slot name="right" part="right" class="inline-flex ml-2"></slot>`:""}</div>`}};e.styles=[...n.styles,c`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */@layer theme,base,components,utilities;
:host{position:relative;display:block;width:100%;--tw-outline-style:none!important;outline-style:none!important}.focus-outline-offset{outline-offset:-2px}.sd-6-22-0-option--disabled-color-border{border-color:rgb(var(--sd-option--disabled-color-border))}`],t([d('[part="base"]')],e.prototype,"defaultSlot",2),t([r()],e.prototype,"current",2),t([r()],e.prototype,"selected",2),t([r()],e.prototype,"hasHover",2),t([r()],e.prototype,"isKeyboardFocus",2),t([a({type:String,reflect:!0})],e.prototype,"size",2),t([a({type:Boolean,reflect:!0})],e.prototype,"checkbox",2),t([a({type:Boolean,reflect:!0})],e.prototype,"disabled",2),t([a({type:String,reflect:!0})],e.prototype,"value",2),t([o("disabled")],e.prototype,"handleDisabledChange",1),t([o("selected")],e.prototype,"handleSelectedChange",1),t([o("value")],e.prototype,"handleValueChange",1),e=t([h("sd-6-22-0-option")],e);export{e as a};
