UNPKG

@progress/kendo-vue-inputs

Version:
9 lines (8 loc) 1.57 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),r=require("./utils/color-parser.js"),s=require("./utils/misc.js"),o=require("../textbox/TextBox.js"),u=n.defineComponent({name:"KendoHexInput",emits:{hexchange:null,blur:null,focus:null},props:{tabIndex:Number,hex:String,disabled:Boolean,id:String,size:String},computed:{isHexValid(){return!!r.parseColor(this.currentHex,"rgba")}},data(){return{currentHex:this.$props.hex,originalHex:this.$props.hex}},mounted(){this._input=this.$refs.input._input},watch:{hex:function(e){this.currentHex=e}},render(){return n.createVNode(o.TextBox,{id:this.$props.id,value:this.currentHex,onInput:this.onChange,onChange:this.onChange,onFocus:this.onFocus,onBlur:this.onBlur,valid:this.isHexValid,disabled:this.$props.disabled,size:this.$props.size,tabIndex:this.tabIndex,ref:"input"},null)},methods:{onChange(e){const t=e.target.value,i=r.parseColor(t,"rgba");this.currentHex=t,s.isPresent(i)&&this.$emit("hexchange",{hex:t,value:i,event:e})},onBlur(e){s.isPresent(r.parseColor(this.hex,"rgba"))||(this.currentHex=this.originalHex),this.$emit("blur",e)},onFocus(e){this.$emit("focus",e)}}});exports.HexInput=u;