@spectrum-web-components/textfield
Advanced tools
Comparing version 0.3.7 to 0.3.8
@@ -6,2 +6,8 @@ # Change Log | ||
## [0.3.8](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/textfield@0.3.7...@spectrum-web-components/textfield@0.3.8) (2020-05-08) | ||
### Bug Fixes | ||
- **textfield:** add maxlength and minlength attributes ([5326649](https://github.com/adobe/spectrum-web-components/commit/5326649daac788e922a4493b9172cc20518b8abb)) | ||
## [0.3.7](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/textfield@0.3.6...@spectrum-web-components/textfield@0.3.7) (2020-04-16) | ||
@@ -8,0 +14,0 @@ |
@@ -38,2 +38,10 @@ { | ||
{ | ||
"name": "maxlength", | ||
"type": "number | undefined" | ||
}, | ||
{ | ||
"name": "minlength", | ||
"type": "number | undefined" | ||
}, | ||
{ | ||
"name": "multiline", | ||
@@ -105,2 +113,12 @@ "type": "boolean", | ||
{ | ||
"name": "maxlength", | ||
"attribute": "maxlength", | ||
"type": "number | undefined" | ||
}, | ||
{ | ||
"name": "minlength", | ||
"attribute": "minlength", | ||
"type": "number | undefined" | ||
}, | ||
{ | ||
"name": "multiline", | ||
@@ -107,0 +125,0 @@ "attribute": "multiline", |
@@ -14,2 +14,4 @@ import { CSSResultArray, TemplateResult, PropertyValues } from 'lit-element'; | ||
grows: boolean; | ||
maxlength?: number; | ||
minlength?: number; | ||
multiline: boolean; | ||
@@ -16,0 +18,0 @@ valid: boolean; |
@@ -96,2 +96,4 @@ /* | ||
id="input" | ||
maxlength=${ifDefined(this.maxlength)} | ||
minlength=${ifDefined(this.minlength)} | ||
pattern=${ifDefined(this.pattern)} | ||
@@ -114,2 +116,4 @@ placeholder=${this.placeholder} | ||
id="input" | ||
maxlength=${ifDefined(this.maxlength)} | ||
minlength=${ifDefined(this.minlength)} | ||
pattern=${ifDefined(this.pattern)} | ||
@@ -134,4 +138,4 @@ placeholder=${this.placeholder} | ||
checkValidity() { | ||
let validity = this.inputElement.checkValidity(); | ||
if (this.required || (this.value && this.pattern)) { | ||
let validity = this.inputElement.checkValidity(); | ||
if ((this.disabled || this.multiline) && this.pattern) { | ||
@@ -141,13 +145,6 @@ const regex = new RegExp(this.pattern); | ||
} | ||
if (validity) { | ||
this.valid = true; | ||
this.invalid = false; | ||
} | ||
else { | ||
this.valid = false; | ||
this.invalid = true; | ||
} | ||
return this.valid; | ||
this.valid = validity; | ||
this.invalid = !validity; | ||
} | ||
return true; | ||
return validity; | ||
} | ||
@@ -177,2 +174,8 @@ } | ||
__decorate([ | ||
property({ type: Number }) | ||
], Textfield.prototype, "maxlength", void 0); | ||
__decorate([ | ||
property({ type: Number }) | ||
], Textfield.prototype, "minlength", void 0); | ||
__decorate([ | ||
property({ type: Boolean, reflect: true }) | ||
@@ -179,0 +182,0 @@ ], Textfield.prototype, "multiline", void 0); |
@@ -21,3 +21,3 @@ { | ||
], | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"description": "", | ||
@@ -49,8 +49,8 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@spectrum-web-components/icon": "^0.4.6", | ||
"@spectrum-web-components/icons-ui": "^0.1.0", | ||
"@spectrum-web-components/icon": "^0.4.7", | ||
"@spectrum-web-components/icons-ui": "^0.1.1", | ||
"@spectrum-web-components/shared": "^0.4.6", | ||
"tslib": "^1.10.0" | ||
}, | ||
"gitHead": "c8a769e3b24974f722054bc121f9a896d66e0bf1" | ||
"gitHead": "4068602ee6a355db24878fad4762815eacc0a730" | ||
} |
@@ -66,2 +66,8 @@ /* | ||
@property({ type: Number }) | ||
public maxlength?: number; | ||
@property({ type: Number }) | ||
public minlength?: number; | ||
@property({ type: Boolean, reflect: true }) | ||
@@ -147,2 +153,4 @@ public multiline = false; | ||
id="input" | ||
maxlength=${ifDefined(this.maxlength)} | ||
minlength=${ifDefined(this.minlength)} | ||
pattern=${ifDefined(this.pattern)} | ||
@@ -165,2 +173,4 @@ placeholder=${this.placeholder} | ||
id="input" | ||
maxlength=${ifDefined(this.maxlength)} | ||
minlength=${ifDefined(this.minlength)} | ||
pattern=${ifDefined(this.pattern)} | ||
@@ -189,4 +199,4 @@ placeholder=${this.placeholder} | ||
public checkValidity(): boolean { | ||
let validity = this.inputElement.checkValidity(); | ||
if (this.required || (this.value && this.pattern)) { | ||
let validity = this.inputElement.checkValidity(); | ||
if ((this.disabled || this.multiline) && this.pattern) { | ||
@@ -196,14 +206,7 @@ const regex = new RegExp(this.pattern); | ||
} | ||
if (validity) { | ||
this.valid = true; | ||
this.invalid = false; | ||
} else { | ||
this.valid = false; | ||
this.invalid = true; | ||
} | ||
return this.valid; | ||
this.valid = validity; | ||
this.invalid = !validity; | ||
} | ||
return true; | ||
return validity; | ||
} | ||
} |
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
173270
1762