const t=window.EdelElements.h;import{a as e}from"./chunk-69f58b19.js";class a{constructor(){this.autofocus=!1}hostData(){return{class:"input"}}handleChange(t){this.value=this.numberOf(t.target.value),this.valueChange.emit(this.value)}handleBlur(){this.afterEdit.emit(this.value)}render(){const e=null==this.value?void 0:this.value.toString();return t("input",{value:e,type:"number",placeholder:this.placeholder,onInput:this.handleChange.bind(this),onBlur:this.handleBlur.bind(this),autofocus:this.autofocus,disabled:this.disabled})}componentDidLoad(){this.valueDidChange(this.value,0),this.updateAutoFocus(),this.updateInGroupDidChange(),this.updateCss()}updateAutoFocus(){if(this.autofocus){const t=this.hostElement.getElementsByTagName("input").item(0);t&&requestAnimationFrame(()=>t.focus())}}updateCss(){this.disabled?this.hostElement.classList.add("input--off"):this.hostElement.classList.remove("input--off")}valueDidChange(t,e){if(void 0===t)return;const a=this.numberOf(t);isNaN(a)&&(this.value=e)}updateInGroupDidChange(){e(this.inGroup,this.hostElement)}numberOf(t){return Number(t)}static get is(){return"edel-input-number"}static get properties(){return{autofocus:{type:Boolean,attr:"autofocus",watchCallbacks:["updateAutoFocus"]},disabled:{type:Boolean,attr:"disabled",watchCallbacks:["updateCss"]},hostElement:{elementRef:!0},inGroup:{type:Boolean,attr:"in-group",watchCallbacks:["updateInGroupDidChange"]},placeholder:{type:String,attr:"placeholder"},value:{type:Number,attr:"value",mutable:!0,watchCallbacks:["valueDidChange"]}}}static get events(){return[{name:"valueChange",method:"valueChange",bubbles:!0,cancelable:!0,composed:!0},{name:"afterEdit",method:"afterEdit",bubbles:!0,cancelable:!0,composed:!0}]}}export{a as EdelInputNumber};