Skip to content

Commit

Permalink
fix(material/tooltip): remove remaining animation dependencies
Browse files Browse the repository at this point in the history
Removes the remaning dependencies on `@angular/animations` from the package.
  • Loading branch information
crisbeto committed Feb 2, 2025
1 parent a437b93 commit 0dd5f21
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 20 deletions.
1 change: 0 additions & 1 deletion src/material/tooltip/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ ng_test_library(
"//src/cdk/overlay",
"//src/cdk/platform",
"//src/cdk/testing/private",
"@npm//@angular/animations",
"@npm//@angular/platform-browser",
"@npm//rxjs",
],
Expand Down
55 changes: 38 additions & 17 deletions src/material/tooltip/tooltip-animations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {
animate,
AnimationTriggerMetadata,
state,
style,
transition,
trigger,
} from '@angular/animations';

/**
* Animations used by MatTooltip.
Expand All @@ -21,15 +13,44 @@ import {
* @breaking-change 21.0.0
*/
export const matTooltipAnimations: {
readonly tooltipState: AnimationTriggerMetadata;
readonly tooltipState: any;
} = {
// Represents:
// trigger('state', [
// state('initial, void, hidden', style({opacity: 0, transform: 'scale(0.8)'})),
// state('visible', style({transform: 'scale(1)'})),
// transition('* => visible', animate('150ms cubic-bezier(0, 0, 0.2, 1)')),
// transition('* => hidden', animate('75ms cubic-bezier(0.4, 0, 1, 1)')),
// ])

/** Animation that transitions a tooltip in and out. */
tooltipState: trigger('state', [
// TODO(crisbeto): these values are based on MDC's CSS.
// We should be able to use their styles directly once we land #19432.
state('initial, void, hidden', style({opacity: 0, transform: 'scale(0.8)'})),
state('visible', style({transform: 'scale(1)'})),
transition('* => visible', animate('150ms cubic-bezier(0, 0, 0.2, 1)')),
transition('* => hidden', animate('75ms cubic-bezier(0.4, 0, 1, 1)')),
]),
tooltipState: {
type: 7,
name: 'state',
definitions: [
{
type: 0,
name: 'initial, void, hidden',
styles: {type: 6, styles: {opacity: 0, transform: 'scale(0.8)'}, offset: null},
},
{
type: 0,
name: 'visible',
styles: {type: 6, styles: {transform: 'scale(1)'}, offset: null},
},
{
type: 1,
expr: '* => visible',
animation: {type: 4, styles: null, timings: '150ms cubic-bezier(0, 0, 0.2, 1)'},
options: null,
},
{
type: 1,
expr: '* => hidden',
animation: {type: 4, styles: null, timings: '75ms cubic-bezier(0.4, 0, 1, 1)'},
options: null,
},
],
options: {},
},
};
3 changes: 1 addition & 2 deletions tools/public_api_guard/material/tooltip.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
```ts

import { AfterViewInit } from '@angular/core';
import { AnimationTriggerMetadata } from '@angular/animations';
import { BooleanInput } from '@angular/cdk/coercion';
import { ConnectedPosition } from '@angular/cdk/overlay';
import { Directionality } from '@angular/cdk/bidi';
Expand Down Expand Up @@ -105,7 +104,7 @@ export class MatTooltip implements OnDestroy, AfterViewInit {

// @public @deprecated
export const matTooltipAnimations: {
readonly tooltipState: AnimationTriggerMetadata;
readonly tooltipState: any;
};

// @public
Expand Down

0 comments on commit 0dd5f21

Please sign in to comment.