"use strict";(self.webpackChunk_pixelpay_ui_core=self.webpackChunk_pixelpay_ui_core||[]).push([[9261],{"./dist/ui-stencil/p-df9e9a4c.entry.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{x_quantity:()=>a});var _p_d85247d2_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./dist/ui-stencil/p-d85247d2.js");const a=class{constructor(n){(0,_p_d85247d2_js__WEBPACK_IMPORTED_MODULE_0__.r)(this,n),this.onSubInputEvent=(0,_p_d85247d2_js__WEBPACK_IMPORTED_MODULE_0__.c)(this,"sub",7),this.onSumInputEvent=(0,_p_d85247d2_js__WEBPACK_IMPORTED_MODULE_0__.c)(this,"sum",7),this.onValidateInputEvent=(0,_p_d85247d2_js__WEBPACK_IMPORTED_MODULE_0__.c)(this,"validated",7),n.$hostElement$["s-ei"]?this.internals=n.$hostElement$["s-ei"]:(this.internals=n.$hostElement$.attachInternals(),n.$hostElement$["s-ei"]=this.internals),this.name=void 0,this.min=0,this.max=void 0,this.value=1,this.validate=void 0,this.required=void 0,this.number=void 0,this.isValid=!0,this.isDisabled=void 0}onValueChange(t){this.number="number"==typeof t?t:parseInt(t),this.internals.setFormValue(this.number.toString()),this.el.dispatchEvent(new InputEvent("input"))}async checkValidity(){return this.onValidate(),this.isValid}formDisabledCallback(t){this.isDisabled=t}formResetCallback(){this.isValid=!0,this.internals.setFormValue(""),this.el.dispatchEvent(new InputEvent("input"))}componentDidLoad(){this.min&&this.min>this.value&&(this.value=this.min),this.number=this.value,this.internals.setFormValue(this.number.toString()),this.el.dispatchEvent(new InputEvent("input"))}onBlurInput(){setTimeout((()=>this.onValidate()),50)}onValidate(){if(!this.validate)return;let t=null;["input","select","textarea"].forEach((i=>{null===t&&(t=this.el.querySelector(i))})),this.isValid=!(null==t?void 0:t.validity)||t.validity.valid,this.onValidateInputEvent.emit(t)}handleChange(t){const i=t.target;this.value=parseInt(i.value),this.internals.setFormValue(i.value),this.el.dispatchEvent(new InputEvent("input"))}onPlusClick(){!Number.isNaN(this.number)&&this.number+1>this.max||(this.number++,this.value=this.number,this.el.dispatchEvent(new InputEvent("input")),this.onSumInputEvent.emit(this.number))}onMinusClick(){!Number.isNaN(this.number)&&this.number-1<this.min||(this.number--,this.value=this.number,this.el.dispatchEvent(new InputEvent("input")),this.onSubInputEvent.emit(this.number))}render(){return(0,_p_d85247d2_js__WEBPACK_IMPORTED_MODULE_0__.h)(_p_d85247d2_js__WEBPACK_IMPORTED_MODULE_0__.H,{key:"968f07ea8b8993555309a4a6e1cd2f965e54b1da",class:{invalid:!this.isValid,disabled:this.isDisabled,required:this.required},"data-for":this.name},(0,_p_d85247d2_js__WEBPACK_IMPORTED_MODULE_0__.h)("x-chip",{key:"acea803fbd73f29d1acc6681cfc404022100db29",hoverable:!0},(0,_p_d85247d2_js__WEBPACK_IMPORTED_MODULE_0__.h)("x-button",{key:"5b87215fded27a02cf8876183cda6c7bf3a6e23a",icon:"plus",tabindex:"-1",onClick:this.onPlusClick.bind(this)}),(0,_p_d85247d2_js__WEBPACK_IMPORTED_MODULE_0__.h)("input",{key:"87ec301d8fa608ae5f985202f0e4f35fc1f7ee4f",type:"number",value:this.number,min:this.min,max:this.max,required:this.required,inputMode:"numeric",onInput:t=>this.handleChange(t)}),(0,_p_d85247d2_js__WEBPACK_IMPORTED_MODULE_0__.h)("x-button",{key:"342786e435dd6e03905b2c81be9c0dd722f472ae",icon:"minus",tabindex:"-1",onClick:this.onMinusClick.bind(this)})))}static get formAssociated(){return!0}get el(){return(0,_p_d85247d2_js__WEBPACK_IMPORTED_MODULE_0__.g)(this)}static get watchers(){return{value:["onValueChange"]}}};a.style="x-quantity x-chip x-button button{background-color:transparent !important}x-quantity x-button:focus{border-radius:50%;background-color:rgba(var(--color-primary-rgb, 66, 117, 242), 0.3);outline:0;-webkit-box-shadow:none !important;box-shadow:none !important}x-quantity input{width:2rem;-webkit-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;font-weight:bold;text-align:center;display:inline-block;position:relative;margin:0 0.25rem;border:none;background:transparent;outline:none;-moz-appearance:textfield;border-radius:0.25rem}x-quantity input::-webkit-outer-spin-button,x-quantity input::-webkit-inner-spin-button{-webkit-appearance:none}.is-dark-mode x-quantity input{color:var(--color-text-light, #FEFEFE)}"}}]);