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

@material/mwc-formfield

Package Overview
Dependencies
Maintainers
13
Versions
720
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@material/mwc-formfield - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

tsconfig.json

34

mwc-formfield.js

@@ -18,4 +18,4 @@ /**

import {ComponentElement, html, MDCWebComponentMixin} from '@material/mwc-base/component-element.js';
import {callWhenReady, findAssignedNode, afterNextRender} from '@material/mwc-base/utils.js';
import {classString as c$} from '@polymer/lit-element/lit-element.js';
import {classMap} from 'lit-html/directives/classMap.js';
import {callWhenReady, findAssignedNode} from '@material/mwc-base/utils.js';
import {style} from './mwc-formfield-css.js';

@@ -38,4 +38,4 @@ import {MDCFormField} from '@material/form-field';

return {
label: String,
alignEnd: Boolean,
label: {type: String},
alignEnd: {type: Boolean},
};

@@ -49,25 +49,23 @@ }

this.alignEnd = false;
this._setProperty('_labelClickHandler', (e) => {
this._labelClickHandler(e);
});
}
_renderStyle() {
renderStyle() {
return style;
}
_render({label, alignEnd, _labelClickHandler}) {
return html`${this._renderStyle()}
<div class$="mdc-form-field ${alignEnd ? 'mdc-form-field--align-end' : ''}">
render() {
const {label, alignEnd} = this;
return html`${this.renderStyle()}
<div class="mdc-form-field ${classMap({'mdc-form-field--align-end': alignEnd})}">
<slot></slot>
<label class="mdc-label" on-click="${_labelClickHandler}">${label}</label>
<label class="mdc-label" @click="${(e) => this._labelClickHandler(e)}">${label}</label>
</div>`;
}
_didRender(props, changed) {
if ('label' in changed && this._input) {
updated(changedProps) {
if (changedProps.has('label') && this._input) {
if (this._input.localName == 'input') {
this._input.setAttribute('aria-label', props.label);
this._input.setAttribute('aria-label', this.label);
} else {
callWhenReady(this._input, 'setAriaLabel', [props.label]);
callWhenReady(this._input, 'setAriaLabel', [this.label]);
}

@@ -77,3 +75,3 @@ }

_labelClickHandler(e) {
_labelClickHandler() {
if (this._input) {

@@ -87,3 +85,3 @@ this._input.focus();

return this.__input = this.__input ||
findAssignedNode(this._root.querySelector('slot'), '*');
findAssignedNode(this.shadowRoot.querySelector('slot'), '*');
}

@@ -90,0 +88,0 @@ }

{
"name": "@material/mwc-formfield",
"version": "0.1.2",
"version": "0.2.0",
"description": "",

@@ -13,4 +13,4 @@ "main": "mwc-formfield.js",

"@material/form-field": "^0.35.0",
"@material/mwc-base": "^0.1.2",
"@polymer/lit-element": "^0.5.2"
"@material/mwc-base": "^0.2.0",
"@polymer/lit-element": "^0.6.0"
},

@@ -17,0 +17,0 @@ "devDependencies": {

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