/**
@license
Copyright (c) 2019 Vaadin Ltd.
This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
*/
import"../../../@polymer/polymer/polymer-element.js";import"../../../@polymer/polymer/lib/elements/custom-style.js";import{NumberFieldElement as e}from"./vaadin-number-field.js";import{html as t}from"../../../@polymer/polymer/lib/utils/html-tag.js";const n=t`<dom-module id="vaadin-integer-field-template">

  
</dom-module>`;document.head.appendChild(n.content);class IntegerFieldElement extends e{static get is(){return"vaadin-integer-field"}static get version(){return"2.10.0"}static get properties(){return{pattern:String,preventInvalidInput:Boolean,minlength:Number,maxlength:Number}}ready(){super.ready(),this._enabledCharPattern="[-+\\d]"}_valueChanged(e,t){if(""!==e&&!this.__isInteger(e))return console.warn(`Trying to set non-integer value "${e}" to <vaadin-integer-field>. Clearing the value.`),void(this.value="");super._valueChanged(e,t)}_stepChanged(e,t){if(!this.__hasOnlyDigits(e))return console.warn(`Trying to set invalid step size "${e}", which is not a positive integer, to <vaadin-integer-field>. Resetting the default value 1.`),void(this.step=1);super._stepChanged(e,t)}__isInteger(e){return/^(-\d)?\d*$/.test(String(e))}__hasOnlyDigits(e){return/^\d*$/.test(String(e))}}window.customElements.define(IntegerFieldElement.is,IntegerFieldElement);export{IntegerFieldElement};