-
Notifications
You must be signed in to change notification settings - Fork 13.4k
feat(ripple-effect): add recipe and tokens #31203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
thetaPC
wants to merge
3
commits into
ionic-modular
Choose a base branch
from
FW-6856
base: ionic-modular
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 0 additions & 79 deletions
79
core/src/components/ripple-effect/ripple-effect.common.scss
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| export type IonRippleEffectRecipe = { | ||
| opacity?: string; | ||
| }; | ||
|
|
||
| export const ION_RIPPLE_EFFECT_TYPES = ['bounded', 'unbounded'] as const; | ||
| export type IonRippleEffectType = (typeof ION_RIPPLE_EFFECT_TYPES)[number]; |
49 changes: 0 additions & 49 deletions
49
core/src/components/ripple-effect/ripple-effect.ionic.scss
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| @use "../../themes/mixins" as mixins; | ||
|
|
||
| // Ripple Effect: Common Styles | ||
| // -------------------------------------------------- | ||
|
|
||
| /* | ||
| * Duration of the ripple scale animation in milliseconds. This MUST stay in | ||
| * sync with SCALE_DURATION in ripple-effect.tsx: the ripple cleanup is | ||
| * scheduled off this value, so changing one without the other desyncs the | ||
| * animation from the removal timing. | ||
| */ | ||
| $scale-duration: 225ms; | ||
| $fade-in-duration: 75ms; | ||
| $fade-out-duration: 150ms; | ||
|
|
||
| :host { | ||
| /** | ||
| * @prop --ion-ripple-effect-opacity: Peak opacity the ripple fades in to. | ||
| */ | ||
|
|
||
| @include mixins.position(0, 0, 0, 0); | ||
|
|
||
| position: absolute; | ||
|
|
||
| contain: strict; | ||
| pointer-events: none; | ||
| } | ||
|
|
||
| :host(.unbounded) { | ||
| contain: layout size style; | ||
| } | ||
|
|
||
| .ripple-effect { | ||
| @include mixins.border-radius(50%); | ||
|
|
||
| position: absolute; | ||
|
|
||
| /* | ||
| * Keep `background-color` and `color` as static keywords (never `var()`) | ||
| * for performance issues. A new .ripple-effect div is created and animated | ||
| * on every tap, so a custom property lookup for every ripple would be | ||
| * costly. The color is inherited from its host. | ||
| */ | ||
| background-color: currentColor; | ||
| color: inherit; | ||
|
|
||
| contain: strict; | ||
| opacity: 0; | ||
| animation: $scale-duration rippleAnimation forwards, $fade-in-duration fadeInAnimation forwards; | ||
|
|
||
| will-change: transform, opacity; | ||
| pointer-events: none; | ||
| } | ||
|
|
||
| .fade-out { | ||
| transform: translate(var(--internal-translate-end)) scale(var(--internal-final-scale, 1)); | ||
| animation: $fade-out-duration fadeOutAnimation forwards; | ||
| } | ||
|
|
||
| @keyframes rippleAnimation { | ||
| from { | ||
| animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); | ||
|
|
||
| transform: scale(1); | ||
| } | ||
|
|
||
| to { | ||
| transform: translate(var(--internal-translate-end)) scale(var(--internal-final-scale, 1)); | ||
| } | ||
| } | ||
|
|
||
| @keyframes fadeInAnimation { | ||
| from { | ||
| animation-timing-function: linear; | ||
|
|
||
| opacity: 0; | ||
| } | ||
|
|
||
| to { | ||
| opacity: var(--ion-ripple-effect-opacity, 0.16); | ||
| } | ||
| } | ||
|
|
||
| @keyframes fadeOutAnimation { | ||
| from { | ||
| animation-timing-function: linear; | ||
|
|
||
| opacity: var(--ion-ripple-effect-opacity, 0.16); | ||
| } | ||
|
|
||
| to { | ||
| opacity: 0; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While consolidating the ripple-effect theme files, the only difference in the
rippleAnimationkeyframe between ionic and ios/md was the easing curve:cubic-bezier(0.4, 0, 0.2, 1)directly$ion-transition-curve-expressiveThat ionic variable is defined as
var(--token-transition-curve-expressive, cubic-bezier(0.4, 0, 0.2, 1)), so it resolves to the exact same curve by default. All three themes animate identically.I chose to hardcode
cubic-bezier(0.4, 0, 0.2, 1)in the consolidated file rather than introduce a--ion-ripple-effect-*token for it, because:fadeInAnimation/fadeOutAnimationboth use linear) to avoid an arbitrary split — more surface area, still no visual difference.If we ever need the ripple easing to be theme-customizable, then we can create the token at that time.