import{r as t,c as e,h as s,H as o,g as h}from"./p-21516f8c.js";const i=":host{display:inline-block}:host button{padding:0;display:flex;border:none;outline:none;background-color:transparent;font-size:1em;line-height:1.5;text-align:var(--lu-checkbox-button-text-align, center);cursor:pointer}:host(:focus),:host(:hover){outline:none}:host(:focus) button,:host(:hover) button{color:#256EC1}:host(:focus) button .checkbox .box,:host(:hover) button .checkbox .box{stroke:#256EC1}.checkbox{display:inline-block;position:relative;cursor:pointer}.checkbox svg{margin:0 0.5em 0 0;position:relative;bottom:-2px;width:1.125em;height:1.125em}.checkbox .box{fill:none;stroke:#256EC1;stroke-width:2;transition:stroke 0.09s ease-out}.checkbox polyline{fill:none;stroke:#256EC1;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:20;stroke-dashoffset:21;transition:stroke-dashoffset 0.09s ease-in-out}.checkbox.checked svg .box{fill:none;stroke:#256EC1}.checkbox.checked polyline{stroke-dashoffset:0}:host([disabled]) .checkbox .box{stroke:#909090}:host([disabled]) button{color:#909090}:host([disabled]:focus) button .checkbox .box,:host([disabled]:hover) button .checkbox .box{stroke:#909090 !important}";const c=class{constructor(s){t(this,s);this.luCheckboxChange=e(this,"luCheckboxChange",7);this.luFocus=e(this,"luFocus",7);this.luCheckboxBlur=e(this,"luCheckboxBlur",7);this.luCheckboxClicked=e(this,"luCheckboxClicked",7);this.checkboxId=`lu-checkbox-${n++}`;this.keyFocus=false;this.checked=false;this.disabled=false;this.isExternallyManaged=false;this.value="on";this.onClick=()=>{if(!this.isExternallyManaged){this.normalCheckedFlow()}else{this.luCheckboxClicked.emit({value:this.value,checked:!this.checked,name:this.name})}};this.onKeyDown=t=>{if(t.key===" "&&!this.isExternallyManaged){this.normalCheckedFlow()}else{this.luCheckboxClicked.emit({value:this.value,checked:!this.checked,name:this.name})}};this.setCheckboxClasses=()=>{let t="checkbox";if(this.checked)t+=" checked";return t};this.onKeyUp=()=>{this.keyFocus=true};this.onFocus=()=>{this.hasFocus=true;this.luFocus.emit()};this.onBlur=()=>{this.hasFocus=false;this.luCheckboxBlur.emit()}}checkedChanged(){this.luCheckboxChange.emit({value:this.value,checked:!this.checked,name:this.name});this.setCheckboxClasses()}normalCheckedFlow(){if(this.disabled)return;this.checked=!this.checked}render(){let t;if(this.labeledById){t=this.labeledById+"-lbl"}return s(o,{"aria-checked":this.checked,"aria-disabled":this.disabled?"true":null,"aria-labelledby":t,class:{"checkbox-checked":this.checked,"checkbox-disabled":this.disabled,"checkbox-key":this.keyFocus,interactive:true},"data-is-checked":this.checked,"has-focus":this.hasFocus,id:this.checkboxId,onBlur:this.onBlur,onClick:this.onClick,onFocus:this.onFocus,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,role:"checkbox",tabindex:"0"},s("button",{tabindex:"-1",type:"button"},s("div",{class:this.setCheckboxClasses()},s("svg",{class:"checkbox-icon",viewBox:"0 0 24 24"},s("path",{class:"box",d:"M22 2v20h-20v-20h20zm2-2h-24v24h24v-24z"}),s("polyline",{points:"4 11 8 15 16 6",transform:"translate(2, 1)"}))),s("slot",null)))}get el(){return h(this)}static get watchers(){return{checked:["checkedChanged"]}}};let n=0;c.style=i;export{c as lu_checkbox};
//# sourceMappingURL=p-98ac52e1.entry.js.map