@anypoint-web-components/anypoint-radio-button
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -228,3 +228,5 @@ import { LitElement, html, css } from 'lit-element'; | ||
connectedCallback() { | ||
super.connectedCallback(); | ||
if (super.connectedCallback) { | ||
super.connectedCallback(); | ||
} | ||
if (!this.hasAttribute('role')) { | ||
@@ -246,3 +248,5 @@ this.setAttribute('role', 'radio'); | ||
disconnectedCallback() { | ||
super.disconnectedCallback(); | ||
if (super.disconnectedCallback) { | ||
super.disconnectedCallback(); | ||
} | ||
this.addEventListener('keydown', this._keyDownHandler); | ||
@@ -249,0 +253,0 @@ this.addEventListener('click', this._clickHandler); |
@@ -54,8 +54,8 @@ /** | ||
this._radioAction = this._radioAction.bind(this); | ||
} | ||
connectedCallback() { | ||
this.style.display = 'inline-block'; | ||
this.style.verticalAlign = 'middle'; | ||
} | ||
connectedCallback() { | ||
this.setAttribute('role', 'radiogroup'); | ||
const config = { | ||
@@ -79,16 +79,17 @@ attributes: true, | ||
* Processes added and removed nodes and changes to attributes. | ||
* @param {Array<MutationRecord>} changes List of changes discovered by | ||
* @param {Array<MutationRecord>} mutationsList List of changes discovered by | ||
* `MutationObserver` | ||
*/ | ||
_nodesChanged(changes) { | ||
const record = changes[0]; | ||
switch (record.type) { | ||
case 'attributes': | ||
this._processNodeAttributeChange(record); | ||
break; | ||
case 'childList': | ||
this._processAddedNodes(record.addedNodes); | ||
this._processRemovedNodes(record.removedNodes); | ||
this._manageNodesSelection(record.addedNodes); | ||
break; | ||
_nodesChanged(mutationsList) { | ||
for (const mutation of mutationsList) { | ||
switch (mutation.type) { | ||
case 'attributes': | ||
this._processNodeAttributeChange(mutation); | ||
break; | ||
case 'childList': | ||
this._processAddedNodes(mutation.addedNodes); | ||
this._processRemovedNodes(mutation.removedNodes); | ||
this._manageNodesSelection(mutation.addedNodes); | ||
break; | ||
} | ||
} | ||
@@ -262,3 +263,3 @@ } | ||
const node = nodes[i]; | ||
if (node.name === name && node !== target && node.checked) { | ||
if (node.name !== name && node !== target && node.checked) { | ||
node.checked = false; | ||
@@ -265,0 +266,0 @@ } |
{ | ||
"name": "@anypoint-web-components/anypoint-radio-button", | ||
"description": "Anypoint styled radio button", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"license": "Apache-2.0", | ||
@@ -36,25 +36,25 @@ "main": "anypoint-radio-button.js", | ||
"devDependencies": { | ||
"@advanced-rest-client/a11y-suite": "^1.1.0", | ||
"@advanced-rest-client/arc-demo-helper": "^1.0.3", | ||
"@advanced-rest-client/testing-karma-sl": "^1.0.2", | ||
"@advanced-rest-client/arc-demo-helper": "^1.0.9", | ||
"@advanced-rest-client/eslint-config": "^1.0.6", | ||
"@advanced-rest-client/prettier-config": "^0.1.0", | ||
"@advanced-rest-client/testing-karma-sl": "^1.0.3", | ||
"@anypoint-web-components/anypoint-styles": "^1.0.0-preview.1", | ||
"@commitlint/cli": "^8.1.0", | ||
"@commitlint/config-conventional": "^7.0.0", | ||
"@open-wc/eslint-config": "^0.4.1", | ||
"@open-wc/prettier-config": "^0.1.0", | ||
"@open-wc/testing": "^0.11.1", | ||
"@open-wc/testing-karma": "^2.0.6", | ||
"@polymer/gen-typescript-declarations": "^1.6.1", | ||
"@open-wc/testing": "^2.2.1", | ||
"@open-wc/testing-karma": "^3.1.5", | ||
"@polymer/gen-typescript-declarations": "^1.6.2", | ||
"@polymer/iron-test-helpers": "^3.0.1", | ||
"@webcomponents/webcomponentsjs": "^2.2.7", | ||
"deepmerge": "^4.0.0", | ||
"es-dev-server": "^1.8.3", | ||
"husky": "^1.0.0", | ||
"lint-staged": "^8.0.0", | ||
"owc-dev-server": "^1.0.0", | ||
"sinon": "^7.3.2", | ||
"webpack-merge": "^4.1.5" | ||
"karma": "^4.2.0", | ||
"lint-staged": "^9.2.1", | ||
"sinon": "^7.3.2" | ||
}, | ||
"scripts": { | ||
"test": "karma start --coverage", | ||
"update-types": "gen-typescript-declarations --deleteExisting --outDir .", | ||
"start": "owc-dev-server --app-index demo/index.html --open --watch", | ||
"update-types": "gen-typescript-declarations --deleteExisting --outDir . --verify", | ||
"start": "es-dev-server --app-index demo/index.html --node-resolve --open --watch", | ||
"start:compatibility": "es-dev-server --app-index demo/index.html --compatibility all --node-resolve --open --watch", | ||
"lint:eslint": "eslint --ext .js,.html .", | ||
@@ -61,0 +61,0 @@ "format:eslint": "eslint --ext .js,.html . --fix", |
@@ -26,7 +26,7 @@ [![Published on NPM](https://img.shields.io/npm/v/@anypoint-web-components/anypoint-radio-button.svg)](https://www.npmjs.com/package/@anypoint-web-components/anypoint-radio-button) | ||
<body> | ||
<paper-radio-group selectable="anypoint-radio-button"> | ||
<anypoint-radio-group selectable="anypoint-radio-button"> | ||
<anypoint-radio-button name="a">Apple</anypoint-radio-button> | ||
<anypoint-radio-button name="b">Banana</anypoint-radio-button> | ||
<anypoint-radio-button name="c">Orange</anypoint-radio-button> | ||
</paper-radio-group> | ||
</anypoint-radio-group> | ||
</body> | ||
@@ -33,0 +33,0 @@ </html> |
25631
17
692
5