@spectrum-web-components/menu-item
Advanced tools
Comparing version 0.1.4 to 0.2.0
@@ -6,2 +6,8 @@ # Change Log | ||
# [0.2.0](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/menu-item@0.1.4...@spectrum-web-components/menu-item@0.2.0) (2019-10-16) | ||
### Features | ||
- **menu-item:** added 'value' and 'itemText' properties ([2c187b5](https://github.com/adobe/spectrum-web-components/commit/2c187b5)) | ||
## [0.1.4](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/menu-item@0.1.3...@spectrum-web-components/menu-item@0.1.4) (2019-10-14) | ||
@@ -8,0 +14,0 @@ |
@@ -15,2 +15,5 @@ import { CSSResultArray, TemplateResult } from 'lit-element'; | ||
tabIndex: number; | ||
private _value; | ||
value: string; | ||
readonly itemText: string; | ||
protected readonly buttonContent: TemplateResult[]; | ||
@@ -17,0 +20,0 @@ connectedCallback(): void; |
@@ -28,2 +28,3 @@ /* | ||
this.tabIndex = -1; | ||
this._value = ''; | ||
} | ||
@@ -33,2 +34,20 @@ static get styles() { | ||
} | ||
get value() { | ||
return this._value || this.itemText; | ||
} | ||
set value(value) { | ||
if (value === this.value) { | ||
return; | ||
} | ||
this._value = value || ''; | ||
if (this.value) { | ||
this.setAttribute('value', this.value); | ||
} | ||
else { | ||
this.removeAttribute('value'); | ||
} | ||
} | ||
get itemText() { | ||
return (this.textContent || /* istanbul ignore next */ '').trim(); | ||
} | ||
get buttonContent() { | ||
@@ -68,2 +87,5 @@ const content = super.buttonContent; | ||
], MenuItem.prototype, "tabIndex", void 0); | ||
__decorate([ | ||
property({ type: String }) | ||
], MenuItem.prototype, "value", null); | ||
//# sourceMappingURL=menu-item.js.map |
@@ -21,3 +21,3 @@ { | ||
], | ||
"version": "0.1.4", | ||
"version": "0.2.0", | ||
"description": "", | ||
@@ -40,3 +40,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@spectrum-web-components/button": "^0.2.0", | ||
"@spectrum-web-components/button": "^0.2.1", | ||
"@spectrum-web-components/icon": "^0.2.0", | ||
@@ -47,3 +47,3 @@ "@spectrum-web-components/icons": "^0.1.4", | ||
}, | ||
"gitHead": "7c3e131bc2bc3b1195e736ff65d3c4e044590ace" | ||
"gitHead": "75a470cca6e8e415c5e9868bc0b37314d61d1be5" | ||
} |
@@ -39,2 +39,24 @@ /* | ||
private _value = ''; | ||
@property({ type: String }) | ||
public get value(): string { | ||
return this._value || this.itemText; | ||
} | ||
public set value(value) { | ||
if (value === this.value) { | ||
return; | ||
} | ||
this._value = value || ''; | ||
if (this.value) { | ||
this.setAttribute('value', this.value); | ||
} else { | ||
this.removeAttribute('value'); | ||
} | ||
} | ||
public get itemText(): string { | ||
return (this.textContent || /* istanbul ignore next */ '').trim(); | ||
} | ||
protected get buttonContent(): TemplateResult[] { | ||
@@ -41,0 +63,0 @@ const content = super.buttonContent; |
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
73954
6
774