Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidLoad() {
if (this.ripple) {
this.listItemRipple = MDCRipple.attachTo(this.listItem);
// this.listItemRipple.unbounded = true
}
}
componentDidUnload() {
attachRipple() {
if (this.props.ripple && this.control) {
MDCRipple.attachTo(this.control);
}
}
// Build the className based on component names and mdc props
initRipple() {
// a stupid hack for the test environment where this ends up undefined
if (process.env.NODE_ENV === 'test') {
this.el.dataset = {};
}
this.api = new MDCRipple(this.el);
this.checkProps(this.props);
}
MDCSwitch.prototype.createRipple_ = function () {
var _this = this;
var RIPPLE_SURFACE_SELECTOR = MDCSwitchFoundation.strings.RIPPLE_SURFACE_SELECTOR;
var rippleSurface = this.root_.querySelector(RIPPLE_SURFACE_SELECTOR);
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
var adapter = tslib_1.__assign({}, MDCRipple.createAdapter(this), { addClass: function (className) { return rippleSurface.classList.add(className); }, computeBoundingRect: function () { return rippleSurface.getBoundingClientRect(); }, deregisterInteractionHandler: function (evtType, handler) {
_this.nativeControl_.removeEventListener(evtType, handler, applyPassive());
}, isSurfaceActive: function () { return matches(_this.nativeControl_, ':active'); }, isUnbounded: function () { return true; }, registerInteractionHandler: function (evtType, handler) {
_this.nativeControl_.addEventListener(evtType, handler, applyPassive());
}, removeClass: function (className) { return rippleSurface.classList.remove(className); }, updateCssVariable: function (varName, value) {
rippleSurface.style.setProperty(varName, value);
} });
return new MDCRipple(this.root_, new MDCRippleFoundation(adapter));
};
Object.defineProperty(MDCSwitch.prototype, "nativeControl_", {
private createRipple_(): MDCRipple {
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
const adapter: MDCRippleAdapter = {
...MDCRipple.createAdapter(this),
deregisterInteractionHandler: (evtType, handler) => this.nativeControl_.removeEventListener(
evtType, handler, applyPassive()),
isSurfaceActive: () => matches(this.nativeControl_, ':active'),
isUnbounded: () => true,
registerInteractionHandler: (evtType, handler) => this.nativeControl_.addEventListener(
evtType, handler, applyPassive()),
};
return new MDCRipple(this.root_, new MDCRippleFoundation(adapter));
}
private createRipple_(): MDCRipple {
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
const adapter: MDCRippleAdapter = {
...MDCRipple.createAdapter(this),
registerInteractionHandler: (evtType, handler) => this.targetElement_.addEventListener(evtType, handler),
deregisterInteractionHandler: (evtType, handler) => this.targetElement_.removeEventListener(evtType, handler),
};
// tslint:enable:object-literal-sort-keys
return new MDCRipple(this.root_, new MDCRippleFoundation(adapter));
}
MDCCheckbox.prototype.createRipple_ = function () {
var _this = this;
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
var adapter = tslib_1.__assign({}, MDCRipple.createAdapter(this), { deregisterInteractionHandler: function (evtType, handler) { return _this.nativeControl_.removeEventListener(evtType, handler, applyPassive()); }, isSurfaceActive: function () { return matches(_this.nativeControl_, ':active'); }, isUnbounded: function () { return true; }, registerInteractionHandler: function (evtType, handler) { return _this.nativeControl_.addEventListener(evtType, handler, applyPassive()); } });
return new MDCRipple(this.root_, new MDCRippleFoundation(adapter));
};
MDCCheckbox.prototype.installPropertyChangeHooks_ = function () {
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
const adapter: MDCRippleAdapter = {
...MDCRipple.createAdapter(this),
registerInteractionHandler: (evtType, handler) => this.nativeControl_.addEventListener(
evtType, handler, applyPassive()),
deregisterInteractionHandler: (evtType, handler) => this.nativeControl_.removeEventListener(
evtType, handler, applyPassive()),
// Radio buttons technically go "active" whenever there is *any* keyboard interaction.
// This is not the UI we desire.
isSurfaceActive: () => false,
isUnbounded: () => true,
};
// tslint:enable:object-literal-sort-keys
return new MDCRipple(this.root_, new MDCRippleFoundation(adapter));
}
MDCSelect.prototype.createRipple_ = function () {
var _this = this;
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
var adapter = tslib_1.__assign({}, MDCRipple.createAdapter(this), { registerInteractionHandler: function (evtType, handler) { return _this.targetElement_.addEventListener(evtType, handler); }, deregisterInteractionHandler: function (evtType, handler) { return _this.targetElement_.removeEventListener(evtType, handler); } });
// tslint:enable:object-literal-sort-keys
return new MDCRipple(this.root_, new MDCRippleFoundation(adapter));
};
MDCSelect.prototype.getNativeSelectAdapterMethods_ = function () {
MDCChip.prototype.initialize = function (rippleFactory) {
var _this = this;
if (rippleFactory === void 0) { rippleFactory = function (el, foundation) { return new MDCRipple(el, foundation); }; }
this.leadingIcon_ = this.root_.querySelector(strings.LEADING_ICON_SELECTOR);
this.trailingIcon_ = this.root_.querySelector(strings.TRAILING_ICON_SELECTOR);
this.checkmark_ = this.root_.querySelector(strings.CHECKMARK_SELECTOR);
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial.
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
var rippleAdapter = tslib_1.__assign({}, MDCRipple.createAdapter(this), { computeBoundingRect: function () { return _this.foundation_.getDimensions(); } });
this.ripple_ = rippleFactory(this.root_, new MDCRippleFoundation(rippleAdapter));
};
MDCChip.prototype.initialSyncWithDOM = function () {