Socket
Socket
Sign inDemoInstall

@material/mwc-base

Package Overview
Dependencies
Maintainers
21
Versions
721
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@material/mwc-base - npm Package Compare versions

Comparing version 0.23.0-canary.5cd4bcdb.0 to 0.23.0-canary.61fe5b17.0

4

aria-property.d.ts

@@ -7,2 +7,6 @@ /**

/**
* A value for the `aria-haspopup` ARIA attribute.
*/
export declare type AriaHasPopup = 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';
/**
* A property decorator proxies an aria attribute to an internal node

@@ -9,0 +13,0 @@ *

@@ -8,3 +8,11 @@ /**

import { RippleInterface } from './utils';
export { addHasRemoveClass, BaseElement, CustomEventListener, EventType, RippleInterface, SpecificEventListener, };
export { addHasRemoveClass, BaseElement, CustomEventListener, EventType, RippleInterface, SpecificEventListener };
declare global {
interface FormDataEvent extends Event {
formData: FormData;
}
interface HTMLElementEventMap {
formdata: FormDataEvent;
}
}
/** @soyCompatible */

@@ -20,8 +28,24 @@ export declare abstract class FormElement extends BaseElement {

/**
* Disabled state for the component. When `disabled` is set to `true`, the
* component will not be added to form submission.
*/
disabled: boolean;
/**
* Implement ripple getter for Ripple integration with mwc-formfield
*/
readonly ripple?: Promise<RippleInterface | null>;
/**
* Form element that contains this element
*/
protected containingForm: HTMLFormElement | null;
protected formDataListener: (ev: FormDataEvent) => void;
protected findFormElement(): HTMLFormElement | null;
/**
* Implement this callback to submit form data
*/
protected abstract setFormData(formData: FormData): void;
connectedCallback(): void;
disconnectedCallback(): void;
click(): void;
setAriaLabel(label: string): void;
protected firstUpdated(): void;
}

@@ -6,10 +6,60 @@ /**

*/
var _a, _b;
import { __decorate } from "tslib";
// Style preference for leading underscores.
// tslint:disable:strip-private-property-underscore
import { property } from 'lit-element';
import { addHasRemoveClass, BaseElement } from './base-element';
export { addHasRemoveClass, BaseElement, };
export { addHasRemoveClass, BaseElement };
// ShadyDOM should submit <input> elements in component internals
const USING_SHADY_DOM = (_b = (_a = window.ShadyDOM) === null || _a === void 0 ? void 0 : _a.inUse) !== null && _b !== void 0 ? _b : false;
/** @soyCompatible */
export class FormElement extends BaseElement {
constructor() {
super(...arguments);
/**
* Disabled state for the component. When `disabled` is set to `true`, the
* component will not be added to form submission.
*/
this.disabled = false;
/**
* Form element that contains this element
*/
this.containingForm = null;
this.formDataListener = (ev) => {
if (!this.disabled) {
this.setFormData(ev.formData);
}
};
}
findFormElement() {
// If the component internals are not in Shadow DOM, subscribing to form
// data events could lead to duplicated data, which may not work correctly
// on the server side.
if (!this.shadowRoot || USING_SHADY_DOM) {
return null;
}
const root = this.getRootNode();
const forms = root.querySelectorAll('form');
for (const form of Array.from(forms)) {
if (form.contains(this)) {
return form;
}
}
return null;
}
connectedCallback() {
var _a;
super.connectedCallback();
this.containingForm = this.findFormElement();
(_a = this.containingForm) === null || _a === void 0 ? void 0 : _a.addEventListener('formdata', this.formDataListener);
}
disconnectedCallback() {
var _a;
super.disconnectedCallback();
(_a = this.containingForm) === null || _a === void 0 ? void 0 : _a.removeEventListener('formdata', this.formDataListener);
this.containingForm = null;
}
click() {
if (this.formElement) {
if (this.formElement && !this.disabled) {
this.formElement.focus();

@@ -19,7 +69,2 @@ this.formElement.click();

}
setAriaLabel(label) {
if (this.formElement) {
this.formElement.setAttribute('aria-label', label);
}
}
firstUpdated() {

@@ -35,2 +80,5 @@ super.firstUpdated();

FormElement.shadowRootOptions = { mode: 'open', delegatesFocus: true };
__decorate([
property({ type: Boolean })
], FormElement.prototype, "disabled", void 0);
//# sourceMappingURL=form-element.js.map

16

package.json
{
"name": "@material/mwc-base",
"version": "0.23.0-canary.5cd4bcdb.0",
"version": "0.23.0-canary.61fe5b17.0",
"description": "",

@@ -14,4 +14,4 @@ "main": "base-element.js",

"dependencies": {
"@material/base": "=12.0.0-canary.9f68a932e.0",
"@material/dom": "=12.0.0-canary.9f68a932e.0",
"@material/base": "=13.0.0-canary.15981e9d9.0",
"@material/dom": "=13.0.0-canary.15981e9d9.0",
"lit-element": "^2.5.1",

@@ -21,6 +21,6 @@ "tslib": "^2.0.1"

"devDependencies": {
"@material/elevation": "=12.0.0-canary.9f68a932e.0",
"@material/feature-targeting": "=12.0.0-canary.9f68a932e.0",
"@material/ripple": "=12.0.0-canary.9f68a932e.0",
"@material/theme": "=12.0.0-canary.9f68a932e.0"
"@material/elevation": "=13.0.0-canary.15981e9d9.0",
"@material/feature-targeting": "=13.0.0-canary.15981e9d9.0",
"@material/ripple": "=13.0.0-canary.15981e9d9.0",
"@material/theme": "=13.0.0-canary.15981e9d9.0"
},

@@ -30,3 +30,3 @@ "publishConfig": {

},
"gitHead": "5c053f1de07d32aeb409f327470360f0b5c02ae4"
"gitHead": "8d712401a1af774c1e4dfbf07ceadfd36aaeb5ff"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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