Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/mdc-checkbox/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
@import "@material/feature-targeting/mixins";
@import "@material/ripple/mixins";
@import "@material/touch-target/mixins";
@import "@material/theme/functions";
@import "./functions";
@import "./keyframes";
@import "./variables";
Expand Down Expand Up @@ -297,7 +298,11 @@ $mdc-checkbox-ripple-target: ".mdc-checkbox__ripple";
}

@if $generate-keyframes {
$uid: unique-id();
$uid: mdc-theme-color-hash($unmarked-stroke-color) +
mdc-theme-color-hash($marked-stroke-color) +
mdc-theme-color-hash($unmarked-fill-color) +
mdc-theme-color-hash($marked-fill-color);

$anim-selector: if(&, "&.mdc-checkbox--anim", ".mdc-checkbox--anim");

@include mdc-feature-targets($feat-animation, $feat-color) {
Expand All @@ -306,7 +311,7 @@ $mdc-checkbox-ripple-target: ".mdc-checkbox__ripple";
$to-stroke-color: $marked-stroke-color,
$from-fill-color: $unmarked-fill-color,
$to-fill-color: $marked-fill-color,
$uid: $uid
$uid: #{$uid}
);
}

Expand Down
13 changes: 13 additions & 0 deletions packages/mdc-theme/_functions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,16 @@

@return var(#{$var}, $fallback);
}

///
/// @param $color Target color in any color format.
/// @return Returns hash in string format that uniquely represents
/// any given color format. Useful for generating unique keyframe names.
///
@function mdc-theme-color-hash($color) {
@if type-of($color) == "string" {
@return $color;
}

@return str-slice(ie-hex-str($color), 2);
}
26 changes: 13 additions & 13 deletions testing/dom/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@
* supported.
*/
export function emitEvent(
targetEl: Element, eventName: string, {bubbles, cancelable}: EventInit = {
bubbles: false,
cancelable: false
}) {
let event;
if (typeof(Event) === 'function') {
event = new Event(eventName, {bubbles, cancelable});
} else {
// IE11 support.
event = document.createEvent('Event');
event.initEvent(eventName, bubbles, cancelable);
}
targetEl.dispatchEvent(event);
targetEl: Element, eventName: string, {bubbles, cancelable}: EventInit = {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is being synced in PR #5401

bubbles: false,
cancelable: false
}) {
let event;
if (typeof(Event) === 'function') {
event = new Event(eventName, {bubbles, cancelable});
} else {
// IE11 support.
event = document.createEvent('Event');
event.initEvent(eventName, bubbles, cancelable);
}
targetEl.dispatchEvent(event);
}