@material/switch
Advanced tools
Comparing version 15.0.0-canary.c0a11ef0d.0 to 15.0.0-canary.c0d21ecc9.0
@@ -6,4 +6,8 @@ # Change Log | ||
# [15.0.0-canary.c0a11ef0d.0](https://github.com/material-components/material-components-web/compare/v14.0.0...v15.0.0-canary.c0a11ef0d.0) (2022-05-18) | ||
# [15.0.0-canary.c0d21ecc9.0](https://github.com/material-components/material-components-web/compare/v14.0.0...v15.0.0-canary.c0d21ecc9.0) (2023-10-09) | ||
**Note:** Version bump only for package @material/switch | ||
### Bug Fixes | ||
* Makes material component to depend on https://github.com/google/safevalues and be Trusted Type compatible. ([a44241e](https://github.com/material-components/material-components-web/commit/a44241e5428e7f83733b2bd8ab7acc851fc2fb85)) | ||
* **switch:** Attribute `hidden` now correctly hides the switch. ([6432d8f](https://github.com/material-components/material-components-web/commit/6432d8fd7862fb39258a7970119f8db9eb8fbdb0)) |
@@ -79,3 +79,3 @@ /** | ||
setAriaChecked: function (ariaChecked) { | ||
return _this.root.setAttribute('aria-checked', ariaChecked); | ||
_this.root.setAttribute('aria-checked', ariaChecked); | ||
}, | ||
@@ -82,0 +82,0 @@ setDisabled: function (disabled) { |
@@ -27,2 +27,3 @@ /** | ||
import { MDCSwitchFoundation } from './foundation'; | ||
/** MDC Switch */ | ||
export declare class MDCSwitch extends MDCComponent<MDCSwitchFoundation> implements MDCRippleCapableSurface { | ||
@@ -29,0 +30,0 @@ static attachTo(root: HTMLElement): MDCSwitch; |
@@ -23,3 +23,3 @@ /** | ||
*/ | ||
import { __assign, __extends, __read, __spreadArray } from "tslib"; | ||
import { __assign, __extends, __makeTemplateObject, __read, __spreadArray } from "tslib"; | ||
import { MDCComponent } from '@material/base/component'; | ||
@@ -30,3 +30,6 @@ import { applyPassive } from '@material/dom/events'; | ||
import { MDCRippleFoundation } from '@material/ripple/foundation'; | ||
import { safeAttrPrefix } from 'safevalues'; | ||
import { safeElement } from 'safevalues/dom'; | ||
import { MDCSwitchFoundation } from './foundation'; | ||
/** MDC Switch */ | ||
var MDCSwitch = /** @class */ (function (_super) { | ||
@@ -65,7 +68,12 @@ __extends(MDCSwitch, _super); | ||
var _this = this; | ||
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. | ||
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. | ||
// DO NOT INLINE this variable. For backward compatibility, foundations take | ||
// a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any | ||
// methods, we need a separate, strongly typed adapter variable. | ||
var adapter = { | ||
addClass: function (className) { return _this.root.classList.add(className); }, | ||
removeClass: function (className) { return _this.root.classList.remove(className); }, | ||
addClass: function (className) { | ||
_this.root.classList.add(className); | ||
}, | ||
removeClass: function (className) { | ||
_this.root.classList.remove(className); | ||
}, | ||
setNativeControlChecked: function (checked) { return _this.nativeControl.checked = | ||
@@ -76,3 +84,3 @@ checked; }, | ||
setNativeControlAttr: function (attr, value) { | ||
_this.nativeControl.setAttribute(attr, value); | ||
safeElement.setPrefixedAttribute([safeAttrPrefix(templateObject_1 || (templateObject_1 = __makeTemplateObject(["aria-"], ["aria-"])))], _this.nativeControl, attr, value); | ||
}, | ||
@@ -113,8 +121,11 @@ }; | ||
var rippleSurface = this.root.querySelector(RIPPLE_SURFACE_SELECTOR); | ||
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. | ||
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. | ||
var adapter = __assign(__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()); | ||
// DO NOT INLINE this variable. For backward compatibility, foundations take | ||
// a Partial<MDCFooAdapter>. To ensure we don't accidentally omit any | ||
// methods, we need a separate, strongly typed adapter variable. | ||
var adapter = __assign(__assign({}, MDCRipple.createAdapter(this)), { addClass: function (className) { | ||
rippleSurface.classList.add(className); | ||
}, computeBoundingRect: function () { return rippleSurface.getBoundingClientRect(); }, deregisterInteractionHandler: function (eventType, handler) { | ||
_this.nativeControl.removeEventListener(eventType, handler, applyPassive()); | ||
}, isSurfaceActive: function () { return matches(_this.nativeControl, ':active'); }, isUnbounded: function () { return true; }, registerInteractionHandler: function (eventType, handler) { | ||
_this.nativeControl.addEventListener(eventType, handler, applyPassive()); | ||
}, removeClass: function (className) { | ||
@@ -138,2 +149,3 @@ rippleSurface.classList.remove(className); | ||
export { MDCSwitch }; | ||
var templateObject_1; | ||
//# sourceMappingURL=component.js.map |
@@ -36,5 +36,7 @@ /** | ||
NATIVE_CONTROL_SELECTOR: string; | ||
/** A CSS selector used to locate the ripple surface element for the switch. */ | ||
/** | ||
* A CSS selector used to locate the ripple surface element for the switch. | ||
*/ | ||
RIPPLE_SURFACE_SELECTOR: string; | ||
}; | ||
export { cssClasses, strings }; |
@@ -36,3 +36,5 @@ /** | ||
NATIVE_CONTROL_SELECTOR: '.mdc-switch__native-control', | ||
/** A CSS selector used to locate the ripple surface element for the switch. */ | ||
/** | ||
* A CSS selector used to locate the ripple surface element for the switch. | ||
*/ | ||
RIPPLE_SURFACE_SELECTOR: '.mdc-switch__thumb-underlay', | ||
@@ -39,0 +41,0 @@ }; |
@@ -25,2 +25,3 @@ /** | ||
import { MDCSwitchAdapter } from './adapter'; | ||
/** MDC Switch Foundation */ | ||
export declare class MDCSwitchFoundation extends MDCFoundation<MDCSwitchAdapter> { | ||
@@ -46,3 +47,3 @@ /** The string constants used by the switch. */ | ||
/** Handles the change event for the switch native control. */ | ||
handleChange(evt: Event): void; | ||
handleChange(event: Event): void; | ||
/** Updates the styling of the switch based on its checked state. */ | ||
@@ -49,0 +50,0 @@ private updateCheckedStyling; |
@@ -26,2 +26,3 @@ /** | ||
import { cssClasses, strings } from './constants'; | ||
/** MDC Switch Foundation */ | ||
var MDCSwitchFoundation = /** @class */ (function (_super) { | ||
@@ -79,4 +80,4 @@ __extends(MDCSwitchFoundation, _super); | ||
/** Handles the change event for the switch native control. */ | ||
MDCSwitchFoundation.prototype.handleChange = function (evt) { | ||
var nativeControl = evt.target; | ||
MDCSwitchFoundation.prototype.handleChange = function (event) { | ||
var nativeControl = event.target; | ||
this.updateAriaChecked(nativeControl.checked); | ||
@@ -83,0 +84,0 @@ this.updateCheckedStyling(nativeControl.checked); |
{ | ||
"name": "@material/switch", | ||
"description": "The Material Components for the web switch component", | ||
"version": "15.0.0-canary.c0a11ef0d.0", | ||
"version": "15.0.0-canary.c0d21ecc9.0", | ||
"license": "MIT", | ||
@@ -20,14 +20,15 @@ "keywords": [ | ||
"dependencies": { | ||
"@material/animation": "15.0.0-canary.c0a11ef0d.0", | ||
"@material/base": "15.0.0-canary.c0a11ef0d.0", | ||
"@material/density": "15.0.0-canary.c0a11ef0d.0", | ||
"@material/dom": "15.0.0-canary.c0a11ef0d.0", | ||
"@material/elevation": "15.0.0-canary.c0a11ef0d.0", | ||
"@material/feature-targeting": "15.0.0-canary.c0a11ef0d.0", | ||
"@material/focus-ring": "15.0.0-canary.c0a11ef0d.0", | ||
"@material/ripple": "15.0.0-canary.c0a11ef0d.0", | ||
"@material/rtl": "15.0.0-canary.c0a11ef0d.0", | ||
"@material/shape": "15.0.0-canary.c0a11ef0d.0", | ||
"@material/theme": "15.0.0-canary.c0a11ef0d.0", | ||
"@material/tokens": "15.0.0-canary.c0a11ef0d.0", | ||
"@material/animation": "15.0.0-canary.c0d21ecc9.0", | ||
"@material/base": "15.0.0-canary.c0d21ecc9.0", | ||
"@material/density": "15.0.0-canary.c0d21ecc9.0", | ||
"@material/dom": "15.0.0-canary.c0d21ecc9.0", | ||
"@material/elevation": "15.0.0-canary.c0d21ecc9.0", | ||
"@material/feature-targeting": "15.0.0-canary.c0d21ecc9.0", | ||
"@material/focus-ring": "15.0.0-canary.c0d21ecc9.0", | ||
"@material/ripple": "15.0.0-canary.c0d21ecc9.0", | ||
"@material/rtl": "15.0.0-canary.c0d21ecc9.0", | ||
"@material/shape": "15.0.0-canary.c0d21ecc9.0", | ||
"@material/theme": "15.0.0-canary.c0d21ecc9.0", | ||
"@material/tokens": "15.0.0-canary.c0d21ecc9.0", | ||
"safevalues": "^0.3.4", | ||
"tslib": "^2.1.0" | ||
@@ -38,3 +39,3 @@ }, | ||
}, | ||
"gitHead": "a97df68c1dadba0530f5fcda79fb8bc3082d963a" | ||
"gitHead": "0a932ea790a12d359ce4ec7c5c4c7aec7edf565d" | ||
} |
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
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1076422
8395
14
+ Addedsafevalues@^0.3.4
+ Added@material/animation@15.0.0-canary.c0d21ecc9.0(transitive)
+ Added@material/base@15.0.0-canary.c0d21ecc9.0(transitive)
+ Added@material/density@15.0.0-canary.c0d21ecc9.0(transitive)
+ Added@material/dom@15.0.0-canary.c0d21ecc9.0(transitive)
+ Added@material/elevation@15.0.0-canary.c0d21ecc9.0(transitive)
+ Added@material/feature-targeting@15.0.0-canary.c0d21ecc9.0(transitive)
+ Added@material/focus-ring@15.0.0-canary.c0d21ecc9.0(transitive)
+ Added@material/ripple@15.0.0-canary.c0d21ecc9.0(transitive)
+ Added@material/rtl@15.0.0-canary.c0d21ecc9.0(transitive)
+ Added@material/shape@15.0.0-canary.c0d21ecc9.0(transitive)
+ Added@material/theme@15.0.0-canary.c0d21ecc9.0(transitive)
+ Added@material/tokens@15.0.0-canary.c0d21ecc9.0(transitive)
+ Addedsafevalues@0.3.4(transitive)
- Removed@material/animation@15.0.0-canary.c0a11ef0d.0(transitive)
- Removed@material/base@15.0.0-canary.c0a11ef0d.0(transitive)
- Removed@material/density@15.0.0-canary.c0a11ef0d.0(transitive)
- Removed@material/dom@15.0.0-canary.c0a11ef0d.0(transitive)
- Removed@material/elevation@15.0.0-canary.c0a11ef0d.0(transitive)
- Removed@material/feature-targeting@15.0.0-canary.c0a11ef0d.0(transitive)
- Removed@material/focus-ring@15.0.0-canary.c0a11ef0d.0(transitive)
- Removed@material/ripple@15.0.0-canary.c0a11ef0d.0(transitive)
- Removed@material/rtl@15.0.0-canary.c0a11ef0d.0(transitive)
- Removed@material/shape@15.0.0-canary.c0a11ef0d.0(transitive)
- Removed@material/theme@15.0.0-canary.c0a11ef0d.0(transitive)
- Removed@material/tokens@15.0.0-canary.c0a11ef0d.0(transitive)
Updated@material/feature-targeting@15.0.0-canary.c0d21ecc9.0