import{r as t,i as e,h as i}from"./p-ee1e0eb4.js";const s=class{constructor(i){t(this,i),this.valueChanged=e(this,"valueChanged",7),this.checkedChanged=e(this,"checkedChanged",7)}arrayDataWatcher(t){this._options="string"==typeof t?JSON.parse(t):t}componentWillLoad(){"select"==this.type&&this.arrayDataWatcher(this.options)}handleChange(t){const e="checkbox"===this.type?t.target.checked:t.target.value;this.value=e,this.valueChanged.emit(e),"checkbox"===this.type&&this.checkedChanged.emit(e)}render(){switch(this.type){case"text":return i("div",null,i("ion-item",null,i("ion-label",null,this.label),i("ion-input",{type:this.type,value:this.value,placeholder:this.placeholder,onInput:t=>this.handleChange(t),required:!0})));case"textarea":return i("div",null,i("ion-item",null,i("ion-label",null,this.label),i("ion-textarea",{value:this.value,placeholder:this.placeholder,onInput:t=>this.handleChange(t),required:!0})));case"checkbox":return i("div",null,i("ion-item",null,i("ion-checkbox",{slot:"start",checked:this.checked,onChange:t=>this.handleChange(t)}),i("ion-label",null,this.label)));case"select":return i("div",null,i("ion-item",null,i("ion-select",{value:this.value,placeholder:this.label,onIonChange:t=>this.handleChange(t)},this._options.map((t=>i("ion-select-option",{key:t.value,value:t.value},t.label))))));default:return null}}static get watchers(){return{options:["arrayDataWatcher"]}}};s.style="";export{s as sparkle_input}