@material/checkbox
Advanced tools
Comparing version 15.0.0-canary.d71935c8b.0 to 15.0.0-canary.d76666ad4.0
@@ -6,3 +6,3 @@ # Change Log | ||
# [15.0.0-canary.d71935c8b.0](https://github.com/material-components/material-components-web/compare/v14.0.0...v15.0.0-canary.d71935c8b.0) (2022-10-06) | ||
# [15.0.0-canary.d76666ad4.0](https://github.com/material-components/material-components-web/compare/v14.0.0...v15.0.0-canary.d76666ad4.0) (2023-11-27) | ||
@@ -13,1 +13,6 @@ | ||
* **checkbox:** Attribute `hidden` now correctly hides the checkbox. ([63d3a14](https://github.com/material-components/material-components-web/commit/63d3a146e4ce16867f742ce41b1760da7233ed66)) | ||
### Features | ||
* **checkbox:** Support state-layer-color theming for GM2 checkboxes ([9cec940](https://github.com/material-components/material-components-web/commit/9cec9409719681ad4e33b7369fb402f7e4b787b1)) |
@@ -27,5 +27,7 @@ /** | ||
import { MDCCheckboxFoundation } from './foundation'; | ||
export declare type MDCCheckboxFactory = (el: Element, foundation?: MDCCheckboxFoundation) => MDCCheckbox; | ||
/** MDC Checkbox Factory */ | ||
export declare type MDCCheckboxFactory = (el: HTMLElement, foundation?: MDCCheckboxFoundation) => MDCCheckbox; | ||
/** MDC Checkbox */ | ||
export declare class MDCCheckbox extends MDCComponent<MDCCheckboxFoundation> implements MDCRippleCapableSurface { | ||
static attachTo(root: Element): MDCCheckbox; | ||
static attachTo(root: HTMLElement): MDCCheckbox; | ||
get ripple(): MDCRipple; | ||
@@ -32,0 +34,0 @@ get checked(): boolean; |
@@ -33,2 +33,3 @@ /** | ||
var CB_PROTO_PROPS = ['checked', 'indeterminate']; | ||
/** MDC Checkbox */ | ||
var MDCCheckbox = /** @class */ (function (_super) { | ||
@@ -119,6 +120,9 @@ __extends(MDCCheckbox, _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); }, | ||
addClass: function (className) { | ||
_this.root.classList.add(className); | ||
}, | ||
forceLayout: function () { return _this.root.offsetWidth; }, | ||
@@ -136,3 +140,3 @@ hasNativeControl: function () { return !!_this.getNativeControl(); }, | ||
setNativeControlAttr: function (attr, value) { | ||
_this.getNativeControl().setAttribute(attr, value); | ||
_this.safeSetAttribute(_this.getNativeControl(), attr, value); | ||
}, | ||
@@ -147,8 +151,9 @@ setNativeControlDisabled: function (disabled) { | ||
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. | ||
var adapter = __assign(__assign({}, MDCRipple.createAdapter(this)), { deregisterInteractionHandler: function (evtType, handler) { | ||
_this.getNativeControl().removeEventListener(evtType, handler, applyPassive()); | ||
}, isSurfaceActive: function () { return matches(_this.getNativeControl(), ':active'); }, isUnbounded: function () { return true; }, registerInteractionHandler: function (evtType, handler) { | ||
_this.getNativeControl().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)), { deregisterInteractionHandler: function (eventType, handler) { | ||
_this.getNativeControl().removeEventListener(eventType, handler, applyPassive()); | ||
}, isSurfaceActive: function () { return matches(_this.getNativeControl(), ':active'); }, isUnbounded: function () { return true; }, registerInteractionHandler: function (eventType, handler) { | ||
_this.getNativeControl().addEventListener(eventType, handler, applyPassive()); | ||
} }); | ||
@@ -164,8 +169,8 @@ return new MDCRipple(this.root, new MDCRippleFoundation(adapter)); | ||
var desc = Object.getOwnPropertyDescriptor(cbProto, controlState); | ||
// We have to check for this descriptor, since some browsers (Safari) don't support its return. | ||
// See: https://bugs.webkit.org/show_bug.cgi?id=49739 | ||
// We have to check for this descriptor, since some browsers (Safari) | ||
// don't support its return. See: | ||
// https://bugs.webkit.org/show_bug.cgi?id=49739 | ||
if (!validDescriptor(desc)) { | ||
return { value: void 0 }; | ||
} | ||
// Type cast is needed for compatibility with Closure Compiler. | ||
var nativeGetter = desc.get; | ||
@@ -172,0 +177,0 @@ var nativeCbDesc = { |
@@ -25,2 +25,3 @@ /** | ||
import { MDCCheckboxAdapter } from './adapter'; | ||
/** MDC Checkbox Foundation */ | ||
export declare class MDCCheckboxFoundation extends MDCFoundation<MDCCheckboxAdapter> { | ||
@@ -27,0 +28,0 @@ static get cssClasses(): { |
@@ -26,2 +26,3 @@ /** | ||
import { cssClasses, numbers, strings } from './constants'; | ||
/** MDC Checkbox Foundation */ | ||
var MDCCheckboxFoundation = /** @class */ (function (_super) { | ||
@@ -131,4 +132,5 @@ __extends(MDCCheckboxFoundation, _super); | ||
} | ||
// Check to ensure that there isn't a previously existing animation class, in case for example | ||
// the user interacted with the checkbox before the animation was finished. | ||
// Check to ensure that there isn't a previously existing animation class, | ||
// in case for example the user interacted with the checkbox before the | ||
// animation was finished. | ||
if (this.currentAnimationClass.length > 0) { | ||
@@ -142,4 +144,4 @@ clearTimeout(this.animEndLatchTimer); | ||
this.currentCheckState = newState; | ||
// Check for parentNode so that animations are only run when the element is attached | ||
// to the DOM. | ||
// Check for parentNode so that animations are only run when the element is | ||
// attached to the DOM. | ||
if (this.adapter.isAttachedToDOM() && | ||
@@ -167,13 +169,22 @@ this.currentAnimationClass.length > 0) { | ||
} | ||
return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED; | ||
return newState === TRANSITION_STATE_CHECKED ? | ||
ANIM_INDETERMINATE_CHECKED : | ||
ANIM_INDETERMINATE_UNCHECKED; | ||
case TRANSITION_STATE_UNCHECKED: | ||
return newState === TRANSITION_STATE_CHECKED ? ANIM_UNCHECKED_CHECKED : ANIM_UNCHECKED_INDETERMINATE; | ||
return newState === TRANSITION_STATE_CHECKED ? | ||
ANIM_UNCHECKED_CHECKED : | ||
ANIM_UNCHECKED_INDETERMINATE; | ||
case TRANSITION_STATE_CHECKED: | ||
return newState === TRANSITION_STATE_UNCHECKED ? ANIM_CHECKED_UNCHECKED : ANIM_CHECKED_INDETERMINATE; | ||
return newState === TRANSITION_STATE_UNCHECKED ? | ||
ANIM_CHECKED_UNCHECKED : | ||
ANIM_CHECKED_INDETERMINATE; | ||
default: // TRANSITION_STATE_INDETERMINATE | ||
return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED; | ||
return newState === TRANSITION_STATE_CHECKED ? | ||
ANIM_INDETERMINATE_CHECKED : | ||
ANIM_INDETERMINATE_UNCHECKED; | ||
} | ||
}; | ||
MDCCheckboxFoundation.prototype.updateAriaChecked = function () { | ||
// Ensure aria-checked is set to mixed if checkbox is in indeterminate state. | ||
// Ensure aria-checked is set to mixed if checkbox is in indeterminate | ||
// state. | ||
if (this.adapter.isIndeterminate()) { | ||
@@ -180,0 +191,0 @@ this.adapter.setNativeControlAttr(strings.ARIA_CHECKED_ATTR, strings.ARIA_CHECKED_INDETERMINATE_VALUE); |
{ | ||
"name": "@material/checkbox", | ||
"description": "The Material Components for the web checkbox component", | ||
"version": "15.0.0-canary.d71935c8b.0", | ||
"version": "15.0.0-canary.d76666ad4.0", | ||
"license": "MIT", | ||
@@ -20,14 +20,15 @@ "keywords": [ | ||
"dependencies": { | ||
"@material/animation": "15.0.0-canary.d71935c8b.0", | ||
"@material/base": "15.0.0-canary.d71935c8b.0", | ||
"@material/density": "15.0.0-canary.d71935c8b.0", | ||
"@material/dom": "15.0.0-canary.d71935c8b.0", | ||
"@material/feature-targeting": "15.0.0-canary.d71935c8b.0", | ||
"@material/focus-ring": "15.0.0-canary.d71935c8b.0", | ||
"@material/ripple": "15.0.0-canary.d71935c8b.0", | ||
"@material/theme": "15.0.0-canary.d71935c8b.0", | ||
"@material/touch-target": "15.0.0-canary.d71935c8b.0", | ||
"@material/animation": "15.0.0-canary.d76666ad4.0", | ||
"@material/base": "15.0.0-canary.d76666ad4.0", | ||
"@material/density": "15.0.0-canary.d76666ad4.0", | ||
"@material/dom": "15.0.0-canary.d76666ad4.0", | ||
"@material/feature-targeting": "15.0.0-canary.d76666ad4.0", | ||
"@material/focus-ring": "15.0.0-canary.d76666ad4.0", | ||
"@material/ripple": "15.0.0-canary.d76666ad4.0", | ||
"@material/rtl": "15.0.0-canary.d76666ad4.0", | ||
"@material/theme": "15.0.0-canary.d76666ad4.0", | ||
"@material/touch-target": "15.0.0-canary.d76666ad4.0", | ||
"tslib": "^2.1.0" | ||
}, | ||
"gitHead": "0e9f697d8ab3c0b93969f61d22a2b06760934fa3" | ||
"gitHead": "8fc3640e389fda0098b42091a9a1ab8653fc6470" | ||
} |
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 too big to display
Sorry, the diff of this file is not supported yet
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
1118523
7447
11
+ Added@material/animation@15.0.0-canary.d76666ad4.0(transitive)
+ Added@material/base@15.0.0-canary.d76666ad4.0(transitive)
+ Added@material/density@15.0.0-canary.d76666ad4.0(transitive)
+ Added@material/dom@15.0.0-canary.d76666ad4.0(transitive)
+ Added@material/feature-targeting@15.0.0-canary.d76666ad4.0(transitive)
+ Added@material/focus-ring@15.0.0-canary.d76666ad4.0(transitive)
+ Added@material/ripple@15.0.0-canary.d76666ad4.0(transitive)
+ Added@material/rtl@15.0.0-canary.d76666ad4.0(transitive)
+ Added@material/theme@15.0.0-canary.d76666ad4.0(transitive)
+ Added@material/touch-target@15.0.0-canary.d76666ad4.0(transitive)
- Removed@material/animation@15.0.0-canary.d71935c8b.0(transitive)
- Removed@material/base@15.0.0-canary.d71935c8b.0(transitive)
- Removed@material/density@15.0.0-canary.d71935c8b.0(transitive)
- Removed@material/dom@15.0.0-canary.d71935c8b.0(transitive)
- Removed@material/feature-targeting@15.0.0-canary.d71935c8b.0(transitive)
- Removed@material/focus-ring@15.0.0-canary.d71935c8b.0(transitive)
- Removed@material/ripple@15.0.0-canary.d71935c8b.0(transitive)
- Removed@material/rtl@15.0.0-canary.d71935c8b.0(transitive)
- Removed@material/theme@15.0.0-canary.d71935c8b.0(transitive)
- Removed@material/touch-target@15.0.0-canary.d71935c8b.0(transitive)
Updated@material/feature-targeting@15.0.0-canary.d76666ad4.0