Skip to content

Commit 93738a7

Browse files
committed
Style update again - adds animations for focus and hover - (unit tests not ready - ignore)
1 parent c0f58ff commit 93738a7

File tree

2 files changed

+37
-20
lines changed

2 files changed

+37
-20
lines changed

src/material-experimental/popover-edit/_popover-edit.scss

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@import '../../lib/core/style/variables';
12
@import '../../lib/core/style/elevation';
23
@import '../../lib/core/theming/palette';
34
@import '../../lib/core/theming/theming';
@@ -7,14 +8,6 @@
78
@return linear-gradient($direction, rgba($background-color, 0), $background-color 8px);
89
}
910

10-
@function mat-edit-focus-background($underline-color, $background-color) {
11-
@return linear-gradient(
12-
0deg,
13-
mat-color($underline-color),
14-
mat-color($underline-color) 2px,
15-
$background-color 2px);
16-
}
17-
1811
@mixin mat-edit-theme($theme) {
1912
$background: map-get($theme, background);
2013
$foreground: map-get($theme, foreground);
@@ -27,10 +20,12 @@
2720
background: mat-edit-hover-content-background(90deg, $background-color);
2821
bottom: 0;
2922
display: flex;
23+
opacity: 0;
3024
padding: 0 4px 1px;
3125
position: absolute;
3226
right: 0;
3327
top: 0;
28+
transition: opacity $swift-ease-in-duration $swift-ease-in-timing-function;
3429
}
3530

3631
.mat-row-hover-content-rtl {
@@ -39,23 +34,38 @@
3934
right: auto;
4035
}
4136

37+
.mat-row-hover-content-visible {
38+
opacity: 1;
39+
}
40+
4241
.mat-popover-edit-cell {
4342
position: relative;
4443

44+
&::after {
45+
background-color: mat-color($primary);
46+
bottom: 0;
47+
content: '';
48+
height: 2px;
49+
left: 0;
50+
opacity: 0;
51+
position: absolute;
52+
right: 0;
53+
transform-origin: 50%;
54+
transform: scaleX(0.5);
55+
transition: background-color $swift-ease-in-duration $swift-ease-in-timing-function;
56+
visibility: hidden;
57+
}
58+
4559
&:focus {
46-
background: mat-edit-focus-background($primary, $background-color);
4760
outline: none;
4861

49-
.mat-row-hover-content {
50-
background:
51-
mat-edit-focus-background($primary, transparent),
52-
mat-edit-hover-content-background(90deg, $background-color);
53-
}
54-
55-
.mat-row-hover-content-rtl {
56-
background:
57-
mat-edit-focus-background($primary, transparent),
58-
mat-edit-hover-content-background(270deg, $background-color);
62+
&::after {
63+
opacity: 1;
64+
transform: scaleX(1);
65+
transition: transform 300ms $swift-ease-out-timing-function,
66+
opacity 100ms $swift-ease-out-timing-function,
67+
background-color 300ms $swift-ease-out-timing-function;
68+
visibility: visible;
5969
}
6070
}
6171
}

src/material-experimental/popover-edit/table-directives.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88
import {Directive} from '@angular/core';
9-
109
import {
1110
CdkPopoverEdit,
1211
CdkPopoverEditTabOut,
@@ -92,6 +91,14 @@ export class MatRowHoverContent extends CdkRowHoverContent {
9291
} else {
9392
element.classList.remove(RTL_CLASS);
9493
}
94+
95+
const ANIMATE_CLASS = 'mat-row-hover-content-visible';
96+
element.classList.remove(ANIMATE_CLASS);
97+
this.services.ngZone.runOutsideAngular(() => {
98+
setTimeout(() => {
99+
element.classList.add(ANIMATE_CLASS);
100+
});
101+
});
95102
}
96103
}
97104

0 commit comments

Comments
 (0)