Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@material/mwc-radio

Package Overview
Dependencies
Maintainers
13
Versions
721
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@material/mwc-radio - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

mwc-radio-css.d.ts

7

mwc-radio-css.js

@@ -17,5 +17,4 @@ /**

*/
import {html} from '@polymer/lit-element/lit-element.js';
export const style = html`<style>@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}.mdc-ripple-surface--test-edge-var-bug{--mdc-ripple-surface-test-edge-var: 1px solid #000;visibility:hidden}.mdc-ripple-surface--test-edge-var-bug::before{border:var(--mdc-ripple-surface-test-edge-var)}.mdc-radio{--mdc-ripple-fg-size: 0;--mdc-ripple-left: 0;--mdc-ripple-top: 0;--mdc-ripple-fg-scale: 1;--mdc-ripple-fg-translate-end: 0;--mdc-ripple-fg-translate-start: 0;-webkit-tap-highlight-color:rgba(0,0,0,0);will-change:transform, opacity;display:inline-block;position:relative;flex:0 0 auto;box-sizing:border-box;width:40px;height:40px;padding:10px;cursor:pointer;will-change:opacity, transform, border-color, background-color, color}.mdc-radio .mdc-radio__native-control:enabled:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle{border-color:rgba(0,0,0,0.54)}.mdc-radio .mdc-radio__native-control:enabled:checked+.mdc-radio__background .mdc-radio__outer-circle{border-color:#018786;border-color:var(--mdc-theme-secondary, #018786)}.mdc-radio .mdc-radio__native-control:enabled+.mdc-radio__background .mdc-radio__inner-circle{background-color:#018786;background-color:var(--mdc-theme-secondary, #018786)}.mdc-radio .mdc-radio__background::before{background-color:#018786}@supports not (-ms-ime-align: auto){.mdc-radio .mdc-radio__background::before{background-color:var(--mdc-theme-secondary, #018786)}}.mdc-radio::before,.mdc-radio::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}.mdc-radio::before{transition:opacity 15ms linear;z-index:1}.mdc-radio.mdc-ripple-upgraded::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.mdc-radio.mdc-ripple-upgraded::after{top:0;left:0;transform:scale(0);transform-origin:center center}.mdc-radio.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.mdc-radio.mdc-ripple-upgraded--foreground-activation::after{animation:225ms mdc-ripple-fg-radius-in forwards,75ms mdc-ripple-fg-opacity-in forwards}.mdc-radio.mdc-ripple-upgraded--foreground-deactivation::after{animation:150ms mdc-ripple-fg-opacity-out;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.mdc-radio::before,.mdc-radio::after{top:calc(50% - 50%);left:calc(50% - 50%);width:100%;height:100%}.mdc-radio.mdc-ripple-upgraded::before,.mdc-radio.mdc-ripple-upgraded::after{top:var(--mdc-ripple-top, calc(50% - 50%));left:var(--mdc-ripple-left, calc(50% - 50%));width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-radio.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-radio::before,.mdc-radio::after{background-color:#018786}@supports not (-ms-ime-align: auto){.mdc-radio::before,.mdc-radio::after{background-color:var(--mdc-theme-secondary, #018786)}}.mdc-radio:hover::before{opacity:.04}.mdc-radio:not(.mdc-ripple-upgraded):focus::before,.mdc-radio.mdc-ripple-upgraded--background-focused::before{transition-duration:75ms;opacity:.12}.mdc-radio:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-radio:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:.16}.mdc-radio.mdc-ripple-upgraded{--mdc-ripple-fg-opacity: .16}.mdc-radio__background{display:inline-block;position:absolute;left:10px;box-sizing:border-box;width:50%;height:50%}.mdc-radio__background::before{position:absolute;top:0;left:0;width:100%;height:100%;transform:scale(0, 0);transition:opacity 120ms 0ms cubic-bezier(0.4, 0, 0.6, 1),transform 120ms 0ms cubic-bezier(0.4, 0, 0.6, 1);border-radius:50%;opacity:0;pointer-events:none;content:""}.mdc-radio__outer-circle{position:absolute;top:0;left:0;box-sizing:border-box;width:100%;height:100%;transition:border-color 120ms 0ms cubic-bezier(0.4, 0, 0.6, 1);border-width:2px;border-style:solid;border-radius:50%}.mdc-radio__inner-circle{position:absolute;top:0;left:0;box-sizing:border-box;width:100%;height:100%;transform:scale(0, 0);transition:transform 120ms 0ms cubic-bezier(0.4, 0, 0.6, 1),background-color 120ms 0ms cubic-bezier(0.4, 0, 0.6, 1);border-radius:50%}.mdc-radio__native-control{position:absolute;top:0;left:0;width:100%;height:100%;margin:0;padding:0;opacity:0;cursor:inherit;z-index:1}.mdc-radio.mdc-ripple-upgraded .mdc-radio__background::before{content:none}.mdc-radio__native-control:checked+.mdc-radio__background,.mdc-radio__native-control:disabled+.mdc-radio__background{transition:opacity 120ms 0ms cubic-bezier(0, 0, 0.2, 1),transform 120ms 0ms cubic-bezier(0, 0, 0.2, 1)}.mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__outer-circle,.mdc-radio__native-control:disabled+.mdc-radio__background .mdc-radio__outer-circle{transition:border-color 120ms 0ms cubic-bezier(0, 0, 0.2, 1)}.mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__inner-circle,.mdc-radio__native-control:disabled+.mdc-radio__background .mdc-radio__inner-circle{transition:transform 120ms 0ms cubic-bezier(0, 0, 0.2, 1),background-color 120ms 0ms cubic-bezier(0, 0, 0.2, 1)}.mdc-radio--disabled{cursor:default;pointer-events:none}.mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__inner-circle{transform:scale(0.5);transition:transform 120ms 0ms cubic-bezier(0, 0, 0.2, 1),background-color 120ms 0ms cubic-bezier(0, 0, 0.2, 1)}.mdc-radio__native-control:disabled+.mdc-radio__background,[aria-disabled="true"] .mdc-radio__native-control+.mdc-radio__background{cursor:default}.mdc-radio__native-control:disabled+.mdc-radio__background .mdc-radio__outer-circle,[aria-disabled="true"] .mdc-radio__native-control+.mdc-radio__background .mdc-radio__outer-circle{border-color:rgba(0,0,0,0.26)}.mdc-radio__native-control:disabled+.mdc-radio__background .mdc-radio__inner-circle,[aria-disabled="true"] .mdc-radio__native-control+.mdc-radio__background .mdc-radio__inner-circle{background-color:rgba(0,0,0,0.26)}.mdc-radio__native-control:focus+.mdc-radio__background::before{transform:scale(2, 2);transition:opacity 120ms 0ms cubic-bezier(0, 0, 0.2, 1),transform 120ms 0ms cubic-bezier(0, 0, 0.2, 1);opacity:.26}:host{display:inline-block}
</style>`;
import { html } from '@polymer/lit-element';
export const style = html `<style>@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}.mdc-ripple-surface--test-edge-var-bug{--mdc-ripple-surface-test-edge-var: 1px solid #000;visibility:hidden}.mdc-ripple-surface--test-edge-var-bug::before{border:var(--mdc-ripple-surface-test-edge-var)}.mdc-radio{--mdc-ripple-fg-size: 0;--mdc-ripple-left: 0;--mdc-ripple-top: 0;--mdc-ripple-fg-scale: 1;--mdc-ripple-fg-translate-end: 0;--mdc-ripple-fg-translate-start: 0;-webkit-tap-highlight-color:rgba(0,0,0,0);will-change:transform,opacity;display:inline-block;position:relative;flex:0 0 auto;box-sizing:border-box;width:40px;height:40px;padding:10px;cursor:pointer;will-change:opacity,transform,border-color,color}.mdc-radio .mdc-radio__native-control:enabled:not(:checked) + .mdc-radio__background .mdc-radio__outer-circle{border-color:rgba(0,0,0,.54)}.mdc-radio .mdc-radio__native-control:enabled:checked + .mdc-radio__background .mdc-radio__outer-circle{border-color:#018786;border-color:var(--mdc-theme-secondary, #018786)}.mdc-radio .mdc-radio__native-control:enabled + .mdc-radio__background .mdc-radio__inner-circle{border-color:#018786;border-color:var(--mdc-theme-secondary, #018786)}.mdc-radio .mdc-radio__background::before{background-color:#018786}@supports not (-ms-ime-align: auto){.mdc-radio .mdc-radio__background::before{background-color:var(--mdc-theme-secondary, #018786)}}.mdc-radio::before,.mdc-radio::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}.mdc-radio::before{transition:opacity 15ms linear;z-index:1}.mdc-radio.mdc-ripple-upgraded::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.mdc-radio.mdc-ripple-upgraded::after{top:0;left:0;transform:scale(0);transform-origin:center center}.mdc-radio.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.mdc-radio.mdc-ripple-upgraded--foreground-activation::after{animation:225ms mdc-ripple-fg-radius-in forwards,75ms mdc-ripple-fg-opacity-in forwards}.mdc-radio.mdc-ripple-upgraded--foreground-deactivation::after{animation:150ms mdc-ripple-fg-opacity-out;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.mdc-radio::before,.mdc-radio::after{top:calc(50% - 50%);left:calc(50% - 50%);width:100%;height:100%}.mdc-radio.mdc-ripple-upgraded::before,.mdc-radio.mdc-ripple-upgraded::after{top:var(--mdc-ripple-top, calc(50% - 50%));left:var(--mdc-ripple-left, calc(50% - 50%));width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-radio.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-radio::before,.mdc-radio::after{background-color:#018786}@supports not (-ms-ime-align: auto){.mdc-radio::before,.mdc-radio::after{background-color:var(--mdc-theme-secondary, #018786)}}.mdc-radio:hover::before{opacity:.04}.mdc-radio:not(.mdc-ripple-upgraded):focus::before,.mdc-radio.mdc-ripple-upgraded--background-focused::before{transition-duration:75ms;opacity:.12}.mdc-radio:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-radio:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:.16}.mdc-radio.mdc-ripple-upgraded{--mdc-ripple-fg-opacity: 0.16}.mdc-radio__background{display:inline-block;position:absolute;left:10px;box-sizing:border-box;width:50%;height:50%}.mdc-radio__background::before{position:absolute;top:0;left:0;width:100%;height:100%;transform:scale(0, 0);transition:opacity 120ms 0ms cubic-bezier(0.4, 0, 0.6, 1),transform 120ms 0ms cubic-bezier(0.4, 0, 0.6, 1);border-radius:50%;opacity:0;pointer-events:none;content:""}.mdc-radio__outer-circle{position:absolute;top:0;left:0;box-sizing:border-box;width:100%;height:100%;transition:border-color 120ms 0ms cubic-bezier(0.4, 0, 0.6, 1);border-width:2px;border-style:solid;border-radius:50%}.mdc-radio__inner-circle{position:absolute;top:0;left:0;box-sizing:border-box;width:100%;height:100%;transform:scale(0, 0);transition:transform 120ms 0ms cubic-bezier(0.4, 0, 0.6, 1),border-color 120ms 0ms cubic-bezier(0.4, 0, 0.6, 1);border-width:10px;border-style:solid;border-radius:50%}.mdc-radio__native-control{position:absolute;top:0;left:0;width:100%;height:100%;margin:0;padding:0;opacity:0;cursor:inherit;z-index:1}.mdc-radio.mdc-ripple-upgraded--background-focused .mdc-radio__background::before{content:none}.mdc-radio__native-control:checked + .mdc-radio__background,.mdc-radio__native-control:disabled + .mdc-radio__background{transition:opacity 120ms 0ms cubic-bezier(0, 0, 0.2, 1),transform 120ms 0ms cubic-bezier(0, 0, 0.2, 1)}.mdc-radio__native-control:checked + .mdc-radio__background .mdc-radio__outer-circle,.mdc-radio__native-control:disabled + .mdc-radio__background .mdc-radio__outer-circle{transition:border-color 120ms 0ms cubic-bezier(0, 0, 0.2, 1)}.mdc-radio__native-control:checked + .mdc-radio__background .mdc-radio__inner-circle,.mdc-radio__native-control:disabled + .mdc-radio__background .mdc-radio__inner-circle{transition:transform 120ms 0ms cubic-bezier(0, 0, 0.2, 1),border-color 120ms 0ms cubic-bezier(0, 0, 0.2, 1)}.mdc-radio--disabled{cursor:default;pointer-events:none}.mdc-radio__native-control:checked + .mdc-radio__background .mdc-radio__inner-circle{transform:scale(0.5);transition:transform 120ms 0ms cubic-bezier(0, 0, 0.2, 1),border-color 120ms 0ms cubic-bezier(0, 0, 0.2, 1)}.mdc-radio__native-control:disabled + .mdc-radio__background,[aria-disabled=true] .mdc-radio__native-control + .mdc-radio__background{cursor:default}.mdc-radio__native-control:disabled + .mdc-radio__background .mdc-radio__outer-circle,[aria-disabled=true] .mdc-radio__native-control + .mdc-radio__background .mdc-radio__outer-circle{border-color:rgba(0,0,0,.26)}.mdc-radio__native-control:disabled + .mdc-radio__background .mdc-radio__inner-circle,[aria-disabled=true] .mdc-radio__native-control + .mdc-radio__background .mdc-radio__inner-circle{border-color:rgba(0,0,0,.26)}.mdc-radio__native-control:focus + .mdc-radio__background::before{transform:scale(2, 2);transition:opacity 120ms 0ms cubic-bezier(0, 0, 0.2, 1),transform 120ms 0ms cubic-bezier(0, 0, 0.2, 1);opacity:.12}:host{display:inline-block;outline:none}</style>`;
//# sourceMappingURL=mwc-radio-css.js.map

@@ -0,1 +1,7 @@

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;
};
/**

@@ -17,64 +23,69 @@ @license

*/
import {FormableComponentElement, MDCWebComponentMixin, html} from '@material/mwc-base/formable-component-element.js';
import {style} from './mwc-radio-css.js';
import {SelectionController} from '@material/mwc-base/selection-controller.js';
import {MDCRadio} from '@material/radio';
export class MDCWCRadio extends MDCWebComponentMixin(MDCRadio) {}
export class Radio extends FormableComponentElement {
static get ComponentClass() {
return MDCWCRadio;
}
static get componentSelector() {
return '.mdc-radio';
}
static get properties() {
return {
checked: {type: Boolean},
disabled: {type: Boolean},
value: {type: String},
name: {type: String},
};
}
constructor() {
super();
this._asyncComponent = true;
this.checked = false;
this.disabled = false;
this.name = '';
this.value = '';
this._boundInputChangeHandler = this._inputChangeHandler.bind(this);
this._boundInputFocusHandler = this._inputFocusHandler.bind(this);
this._boundInputBlurHandler = this._inputBlurHandler.bind(this);
}
connectedCallback() {
super.connectedCallback();
this._selectionController = SelectionController.getController(this);
this._selectionController.register(this);
this._selectionController.update(this);
}
disconnectedCallback() {
this._selectionController.unregister(this);
}
renderStyle() {
return style;
}
render() {
const {checked, value, name} = this;
return html`
import { FormElement, query, customElement, property, html, observer } from '@material/mwc-base/form-element';
import { style } from './mwc-radio-css';
import { SelectionController } from './selection-controller';
import { ripple } from '@material/mwc-ripple/ripple-directive';
import MDCRadioFoundation from '@material/radio/foundation';
let Radio = class Radio extends FormElement {
constructor() {
super();
this.checked = false;
this.disabled = false;
this.value = '';
this.name = '';
this.mdcFoundationClass = MDCRadioFoundation;
this._selectionController = null;
this._changeHandler = () => {
this.checked = this.formElement.checked;
if (this._selectionController) {
this._selectionController.update(this);
}
};
this._focusHandler = () => {
if (this._selectionController) {
this._selectionController.focus(this);
}
};
this._clickHandler = () => {
// Firefox has weird behavior with radios if they are not focused
this.formElement.focus();
};
// Selection Controller is only needed for native ShadowDOM
if (!window['ShadyDOM'] || !window['ShadyDOM']['inUse']) {
this._selectionController = SelectionController.getController(this);
}
}
connectedCallback() {
super.connectedCallback();
if (this._selectionController) {
this._selectionController.register(this);
}
}
disconnectedCallback() {
if (this._selectionController) {
this._selectionController.unregister(this);
}
}
focusNative() {
this.formElement.focus();
}
renderStyle() {
return style;
}
get ripple() {
return this.mdcRoot.ripple;
}
createAdapter() {
return Object.assign({}, super.createAdapter(), { getNativeControl: () => {
return this.formElement;
} });
}
render() {
return html `
${this.renderStyle()}
<div class="mdc-radio">
<input class="mdc-radio__native-control" type="radio"
.checked="${checked}" .name="${name}" .value="${value}"
@change="${this._boundInputChangeHandler}"
@focus="${this._boundInputFocusHandler}"
@blur="${this._boundInputBlurHandler}">
<div class="mdc-radio" .ripple="${ripple()}">
<input class="mdc-radio__native-control" type="radio" name="${this.name}" .checked="${this.checked}" .value="${this.value}"
@change="${this._changeHandler}"
@focus="${this._focusHandler}"
@click="${this._clickHandler}">
<div class="mdc-radio__background">

@@ -85,55 +96,41 @@ <div class="mdc-radio__outer-circle"></div>

</div>`;
}
get disabled() {
return this._component && this._component.disabled;
}
set disabled(value) {
this.componentReady().then((component) => component.disabled = value);
}
get checked() {
return this.__checked;
}
set checked(value) {
const old = this.checked;
this.__checked = value;
this.requestUpdate('checked', old);
if (this._selectionController) {
this._selectionController.update(this);
}
}
_inputChangeHandler(e) {
this.checked = e.target.checked;
}
_inputFocusHandler(e) {
this._selectionController.focus(e, this);
}
_inputBlurHandler(e) {
this._selectionController.blur(this);
}
get name() {
return this.__name;
}
set name(value) {
if (this._selectionController) {
this._selectionController.unregister(this);
firstUpdated() {
super.firstUpdated();
if (this._selectionController) {
this._selectionController.update(this);
}
}
const old = this.name;
this.__name = value;
this.requestUpdate('name', old);
if (this._selectionController) {
this._selectionController.register(this);
this._selectionController.update(this);
}
}
}
customElements.define('mwc-radio', Radio);
};
__decorate([
query('.mdc-radio')
], Radio.prototype, "mdcRoot", void 0);
__decorate([
query('input')
], Radio.prototype, "formElement", void 0);
__decorate([
property({ type: Boolean }),
observer(function (checked) {
this.mdcFoundation.setChecked(checked);
})
], Radio.prototype, "checked", void 0);
__decorate([
property({ type: Boolean }),
observer(function (disabled) {
this.mdcFoundation.setDisabled(disabled);
})
], Radio.prototype, "disabled", void 0);
__decorate([
property({ type: String }),
observer(function (value) {
this.mdcFoundation.setValue(value);
})
], Radio.prototype, "value", void 0);
__decorate([
property({ type: String })
], Radio.prototype, "name", void 0);
Radio = __decorate([
customElement('mwc-radio')
], Radio);
export { Radio };
//# sourceMappingURL=mwc-radio.js.map
{
"name": "@material/mwc-radio",
"version": "0.2.1",
"version": "0.3.0",
"description": "",

@@ -16,9 +16,7 @@ "main": "mwc-radio.js",

"dependencies": {
"@material/mwc-base": "^0.2.1",
"@material/radio": "^0.35.0",
"@polymer/lit-element": "^0.6.0"
"@material/mwc-base": "^0.3.0",
"@material/mwc-ripple": "^0.3.0",
"@material/radio": "^0.40.0",
"@polymer/lit-element": "^0.6.1"
},
"devDependencies": {
"@material/mwc-sass-render": "^0.2.1"
},
"publishConfig": {

@@ -25,0 +23,0 @@ "access": "public"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc