@easymais-ui/text-input
Advanced tools
Comparing version 1.0.0-next.18 to 1.0.0-next.19
{ | ||
"name": "@easymais-ui/text-input", | ||
"version": "1.0.0-next.18", | ||
"version": "1.0.0-next.19", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
@@ -1,8 +0,9 @@ | ||
var __decorate=this&&this.__decorate||function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)if(d=decorators[i])r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r;return c>3&&r&&Object.defineProperty(target,key,r),r};import{LitElement,html}from"lit";import{property}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import IMask from"imask";const textInputTypes=["text","tel","password"];export class TextInputBase extends LitElement{static get formAssociated(){return true}get form(){return this._internals?.form}set value(value){if(value===this.value){return}const oldValue=this._value;this._value=value;this.requestUpdate("value",oldValue)}get value(){if(this.keepMask&&this.mask){return IMask.pipe(this._value,{mask:this.mask,lazy:true})}return this._value}displayValue(){if(this.mask){return IMask.pipe(this._value,{mask:this.mask,lazy:true})}return this._value}firstUpdated(changes){if(changes.has("value")){this._internals?.setFormValue(this.value)}}updated(changes){if(changes.has("value")){this._internals?.setFormValue(this.value)}}render(){return html` | ||
var __decorate=this&&this.__decorate||function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)if(d=decorators[i])r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r;return c>3&&r&&Object.defineProperty(target,key,r),r};import{LitElement,html}from"lit";import{property}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import IMask from"imask";import{live}from"lit/directives/live.js";const textInputTypes=["text","tel","password"];export class TextInputBase extends LitElement{static get formAssociated(){return true}get form(){return this._internals?.form}set value(value){if(value===this.value){return}const oldValue=this._value;this._value=value;this.requestUpdate("value",oldValue)}get value(){if(this.keepMask&&this.mask){return IMask.pipe(this._value,{mask:this.mask,lazy:true})}return this._value}displayValue(){if(this.mask){return IMask.pipe(this._value,{mask:this.mask,lazy:true})}return this._value?this._value:""}firstUpdated(changes){if(changes.has("value")){this._internals?.setFormValue(this.value)}}willUpdate(changes){if(changes.has("value")){this._internals?.setFormValue(this.value||"")}}render(){return html` | ||
<input | ||
class="input" | ||
autocomplete="off" | ||
aria-disabled=${ifDefined(this.disabled||undefined)} | ||
aria-invalid=${ifDefined(this.invalid||undefined)} | ||
placeholder=${ifDefined(this.placeholder||undefined)} | ||
.value=${this.displayValue()} | ||
.value=${live(this.displayValue())} | ||
@change=${this.handleChange} | ||
@@ -15,2 +16,2 @@ @input=${this.handleInput} | ||
/> | ||
`}handleChange(){this._internals?.setFormValue(this.value);this.dispatchEvent(new Event("change",{bubbles:true,composed:true}))}handleInput(event){const inputTarget=event.target;if(this.mask){this._value=IMask.pipe(inputTarget.value,{mask:this.mask},"value","unmaskedValue")}else{this._value=inputTarget.value}inputTarget.value=this.displayValue()}handleKeypress(event){if(event.key==="Enter"&&this.form){this._internals?.setFormValue(this.value);this.form.requestSubmit()}}constructor(){super();this.type="text";this._value="";this.required=false;this.readonly=false;this.invalid=false;this.disabled=false;this._internals=this.attachInternals();this._internals?.setFormValue(this.value)}}__decorate([property()],TextInputBase.prototype,"placeholder",void 0);__decorate([property({type:String})],TextInputBase.prototype,"value",null);__decorate([property()],TextInputBase.prototype,"mask",void 0);__decorate([property({type:Boolean,attribute:"keep-mask"})],TextInputBase.prototype,"keepMask",void 0);__decorate([property({type:Boolean,reflect:true})],TextInputBase.prototype,"required",void 0);__decorate([property({type:Boolean,reflect:true})],TextInputBase.prototype,"readonly",void 0);__decorate([property({type:Boolean,reflect:true})],TextInputBase.prototype,"invalid",void 0);__decorate([property({type:Boolean,reflect:true})],TextInputBase.prototype,"disabled",void 0); | ||
`}formResetCallback(){this.value=""}handleChange(){this._internals?.setFormValue(this.value);this.dispatchEvent(new Event("change",{bubbles:true,composed:true}))}handleInput(event){const inputTarget=event.target;if(this.mask){this._value=IMask.pipe(inputTarget.value,{mask:this.mask},"value","unmaskedValue")}else{this._value=inputTarget.value}inputTarget.value=this.displayValue()}handleKeypress(event){if(event.key==="Enter"&&this.form){this._internals?.setFormValue(this.value);this.form.requestSubmit()}}constructor(){super();this.type="text";this._value="";this.required=false;this.readonly=false;this.invalid=false;this.disabled=false;this._internals=this.attachInternals();this._internals?.setFormValue(this.value||"")}}__decorate([property()],TextInputBase.prototype,"placeholder",void 0);__decorate([property({type:String})],TextInputBase.prototype,"value",null);__decorate([property()],TextInputBase.prototype,"mask",void 0);__decorate([property({type:Boolean,attribute:"keep-mask"})],TextInputBase.prototype,"keepMask",void 0);__decorate([property({type:Boolean,reflect:true})],TextInputBase.prototype,"required",void 0);__decorate([property({type:Boolean,reflect:true})],TextInputBase.prototype,"readonly",void 0);__decorate([property({type:Boolean,reflect:true})],TextInputBase.prototype,"invalid",void 0);__decorate([property({type:Boolean,reflect:true})],TextInputBase.prototype,"disabled",void 0); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51932
746
113
22
22
79
9