import{h}from"../edel-elements.core.js";import{a as applyInputgroupStyle}from"./chunk-69f58b19.js";var EdelInputNumberComponent=function(){function e(){this.autofocus=!1}return e.prototype.hostData=function(){return{class:"input"}},e.prototype.handleChange=function(e){this.value=this.numberOf(e.target.value),this.valueChange.emit(this.value)},e.prototype.handleBlur=function(){this.afterEdit.emit(this.value)},e.prototype.render=function(){var e=null==this.value?void 0:this.value.toString();return h("input",{value:e,type:"number",placeholder:this.placeholder,onInput:this.handleChange.bind(this),onBlur:this.handleBlur.bind(this),autofocus:this.autofocus,disabled:this.disabled})},e.prototype.componentDidLoad=function(){this.valueDidChange(this.value,0),this.updateAutoFocus(),this.updateInGroupDidChange(),this.updateCss()},e.prototype.updateAutoFocus=function(){if(this.autofocus){var e=this.hostElement.getElementsByTagName("input").item(0);e&&requestAnimationFrame(function(){return e.focus()})}},e.prototype.updateCss=function(){this.disabled?this.hostElement.classList.add("input--off"):this.hostElement.classList.remove("input--off")},e.prototype.valueDidChange=function(e,t){if(void 0!==e){var n=this.numberOf(e);isNaN(n)&&(this.value=t)}},e.prototype.updateInGroupDidChange=function(){applyInputgroupStyle(this.inGroup,this.hostElement)},e.prototype.numberOf=function(e){return Number(e)},Object.defineProperty(e,"is",{get:function(){return"edel-input-number"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"properties",{get:function(){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"]}}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"events",{get:function(){return[{name:"valueChange",method:"valueChange",bubbles:!0,cancelable:!0,composed:!0},{name:"afterEdit",method:"afterEdit",bubbles:!0,cancelable:!0,composed:!0}]},enumerable:!0,configurable:!0}),e}();export{EdelInputNumberComponent as EdelInputNumber};