import{p as e,H as t,c as i,h as c,t as s}from"./p-Bpcl2TqF.js";import{d as a}from"./p-DRrF7tWE.js";import{d as l}from"./p-KvSIaMXJ.js";const h=()=>`.chip-item{display:flex;align-items:center;gap:8px;padding:8px 16px;user-select:none;transition:all 100ms ease;transition-property:background, color}.chip-item:hover{cursor:pointer;background-color:#EEEDED}.chip-item:active{background-color:#BFBBBB}.chip-item:focus{outline:2px solid #0A8276}.chip-item.chip-item--large{font:400 1rem/1.5rem "Source Sans 3"}.chip-item.chip-item--small{font:400 0.875rem/1.25rem "Source Sans 3"}.chip-item.chip-item--selected{color:#0A8276}.chip-item.chip-item--selected .chip-item__selected-indicator{display:block}.chip-item__selected-indicator{display:none;margin-left:auto}`;const n=e(class e extends t{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.ifxChipItemSelect=i(this,"ifxChipItemSelect",5)}get chipItem(){return this}ifxChipItemSelect;value=undefined;chipState={emitIfxChipItemSelect:true,variant:"multi",size:"large"};selected=false;updateItemSelection(e){if(this.chipState.variant==="single"){const t=e.target;if(this.chipItem!==t&&this.chipItem.parentElement===t.parentElement){this.selected=false}}}validateSelected(e,t){if(e!==t){if(this.chipState.emitIfxChipItemSelect){this.emitIfxChipItemSelectEvent()}else{this.chipState.emitIfxChipItemSelect=true}}}getItemLabel(){return this.chipItem.innerText}toggleItemSelection(){this.selected=!this.selected}emitIfxChipItemSelectEvent(e=true){this.ifxChipItemSelect.emit({emitIfxChange:e,key:this.chipState.key,label:this.getItemLabel(),selected:this.selected,value:this.value})}handleItemClick(){this.toggleItemSelection()}handleItemKeyDown(e){if(e.code==="Enter"||e.code==="Space"){this.toggleItemSelection()}}handleSelectedState(){if(this.selected){this.emitIfxChipItemSelectEvent(false)}}componentWillLoad(){this.handleSelectedState()}render(){return c("div",{key:"90480d07d5203ca7d4022d7e15a6654faa3fb210",class:`chip-item chip-item--${this.chipState.size} \n                    chip-item--${(this.selected&&this.chipState.variant)==="single"?"selected":""}`,tabIndex:0,onClick:()=>{this.handleItemClick()},onKeyDown:e=>{this.handleItemKeyDown(e)},role:"option","aria-selected":this.selected.toString()},this.chipState.variant==="multi"&&c("ifx-checkbox",{key:"bd978b1e89e38f782d305467ad297e6b13df5ccc",checked:this.selected,tabIndex:-1,size:"s"}),c("div",{key:"338c56bbd6bcf7a36222dfe4c7802fc287024b14",class:"chip-item__label"}," ",c("slot",{key:"324d9e83a55a1326f74922078bb5e35e74b43a55"})," "),c("div",{key:"252de182beef30bfc30fd552b0cf9df8d417c3eb",class:"chip-item__selected-indicator"},c("ifx-icon",{key:"f03867a3c520ebcb41fc9efbe3813a5e288d81f2",icon:"check-16"}," ")))}static get watchers(){return{selected:[{validateSelected:0}]}}static get style(){return h()}},[769,"ifx-chip-item",{value:[1],chipState:[16],selected:[1540]},[[16,"ifxChipItemSelect","updateItemSelection"]],{selected:[{validateSelected:0}]}]);function o(){if(typeof customElements==="undefined"){return}const e=["ifx-chip-item","ifx-checkbox","ifx-icon"];e.forEach((e=>{switch(e){case"ifx-chip-item":if(!customElements.get(s(e))){customElements.define(s(e),n)}break;case"ifx-checkbox":if(!customElements.get(s(e))){a()}break;case"ifx-icon":if(!customElements.get(s(e))){l()}break}}))}export{n as C,o as d};
//# sourceMappingURL=p-LqaG-_kD.js.map