Skip to content

Commit c7c9a25

Browse files
authored
refactor(material/tooltip): switch to new theming API (#25402)
Switches the tooltip to use the new MDC theming API based on CSS variables.
1 parent e3b679d commit c7c9a25

File tree

5 files changed

+656
-636
lines changed

5 files changed

+656
-636
lines changed

package.json

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -97,53 +97,53 @@
9797
"@bazel/terser": "5.5.3",
9898
"@bazel/worker": "5.5.3",
9999
"@firebase/app-types": "^0.7.0",
100-
"@material/animation": "15.0.0-canary.69fd619d0.0",
101-
"@material/auto-init": "15.0.0-canary.69fd619d0.0",
102-
"@material/banner": "15.0.0-canary.69fd619d0.0",
103-
"@material/base": "15.0.0-canary.69fd619d0.0",
104-
"@material/button": "15.0.0-canary.69fd619d0.0",
105-
"@material/card": "15.0.0-canary.69fd619d0.0",
106-
"@material/checkbox": "15.0.0-canary.69fd619d0.0",
107-
"@material/chips": "15.0.0-canary.69fd619d0.0",
108-
"@material/circular-progress": "15.0.0-canary.69fd619d0.0",
109-
"@material/data-table": "15.0.0-canary.69fd619d0.0",
110-
"@material/density": "15.0.0-canary.69fd619d0.0",
111-
"@material/dialog": "15.0.0-canary.69fd619d0.0",
112-
"@material/dom": "15.0.0-canary.69fd619d0.0",
113-
"@material/drawer": "15.0.0-canary.69fd619d0.0",
114-
"@material/elevation": "15.0.0-canary.69fd619d0.0",
115-
"@material/fab": "15.0.0-canary.69fd619d0.0",
116-
"@material/feature-targeting": "15.0.0-canary.69fd619d0.0",
117-
"@material/floating-label": "15.0.0-canary.69fd619d0.0",
118-
"@material/form-field": "15.0.0-canary.69fd619d0.0",
119-
"@material/icon-button": "15.0.0-canary.69fd619d0.0",
120-
"@material/image-list": "15.0.0-canary.69fd619d0.0",
121-
"@material/layout-grid": "15.0.0-canary.69fd619d0.0",
122-
"@material/line-ripple": "15.0.0-canary.69fd619d0.0",
123-
"@material/linear-progress": "15.0.0-canary.69fd619d0.0",
124-
"@material/list": "15.0.0-canary.69fd619d0.0",
125-
"@material/menu": "15.0.0-canary.69fd619d0.0",
126-
"@material/menu-surface": "15.0.0-canary.69fd619d0.0",
127-
"@material/notched-outline": "15.0.0-canary.69fd619d0.0",
128-
"@material/radio": "15.0.0-canary.69fd619d0.0",
129-
"@material/ripple": "15.0.0-canary.69fd619d0.0",
130-
"@material/rtl": "15.0.0-canary.69fd619d0.0",
131-
"@material/segmented-button": "15.0.0-canary.69fd619d0.0",
132-
"@material/select": "15.0.0-canary.69fd619d0.0",
133-
"@material/shape": "15.0.0-canary.69fd619d0.0",
134-
"@material/slider": "15.0.0-canary.69fd619d0.0",
135-
"@material/snackbar": "15.0.0-canary.69fd619d0.0",
136-
"@material/switch": "15.0.0-canary.69fd619d0.0",
137-
"@material/tab": "15.0.0-canary.69fd619d0.0",
138-
"@material/tab-bar": "15.0.0-canary.69fd619d0.0",
139-
"@material/tab-indicator": "15.0.0-canary.69fd619d0.0",
140-
"@material/tab-scroller": "15.0.0-canary.69fd619d0.0",
141-
"@material/textfield": "15.0.0-canary.69fd619d0.0",
142-
"@material/theme": "15.0.0-canary.69fd619d0.0",
143-
"@material/tooltip": "15.0.0-canary.69fd619d0.0",
144-
"@material/top-app-bar": "15.0.0-canary.69fd619d0.0",
145-
"@material/touch-target": "15.0.0-canary.69fd619d0.0",
146-
"@material/typography": "15.0.0-canary.69fd619d0.0",
100+
"@material/animation": "15.0.0-canary.10196647d.0",
101+
"@material/auto-init": "15.0.0-canary.10196647d.0",
102+
"@material/banner": "15.0.0-canary.10196647d.0",
103+
"@material/base": "15.0.0-canary.10196647d.0",
104+
"@material/button": "15.0.0-canary.10196647d.0",
105+
"@material/card": "15.0.0-canary.10196647d.0",
106+
"@material/checkbox": "15.0.0-canary.10196647d.0",
107+
"@material/chips": "15.0.0-canary.10196647d.0",
108+
"@material/circular-progress": "15.0.0-canary.10196647d.0",
109+
"@material/data-table": "15.0.0-canary.10196647d.0",
110+
"@material/density": "15.0.0-canary.10196647d.0",
111+
"@material/dialog": "15.0.0-canary.10196647d.0",
112+
"@material/dom": "15.0.0-canary.10196647d.0",
113+
"@material/drawer": "15.0.0-canary.10196647d.0",
114+
"@material/elevation": "15.0.0-canary.10196647d.0",
115+
"@material/fab": "15.0.0-canary.10196647d.0",
116+
"@material/feature-targeting": "15.0.0-canary.10196647d.0",
117+
"@material/floating-label": "15.0.0-canary.10196647d.0",
118+
"@material/form-field": "15.0.0-canary.10196647d.0",
119+
"@material/icon-button": "15.0.0-canary.10196647d.0",
120+
"@material/image-list": "15.0.0-canary.10196647d.0",
121+
"@material/layout-grid": "15.0.0-canary.10196647d.0",
122+
"@material/line-ripple": "15.0.0-canary.10196647d.0",
123+
"@material/linear-progress": "15.0.0-canary.10196647d.0",
124+
"@material/list": "15.0.0-canary.10196647d.0",
125+
"@material/menu": "15.0.0-canary.10196647d.0",
126+
"@material/menu-surface": "15.0.0-canary.10196647d.0",
127+
"@material/notched-outline": "15.0.0-canary.10196647d.0",
128+
"@material/radio": "15.0.0-canary.10196647d.0",
129+
"@material/ripple": "15.0.0-canary.10196647d.0",
130+
"@material/rtl": "15.0.0-canary.10196647d.0",
131+
"@material/segmented-button": "15.0.0-canary.10196647d.0",
132+
"@material/select": "15.0.0-canary.10196647d.0",
133+
"@material/shape": "15.0.0-canary.10196647d.0",
134+
"@material/slider": "15.0.0-canary.10196647d.0",
135+
"@material/snackbar": "15.0.0-canary.10196647d.0",
136+
"@material/switch": "15.0.0-canary.10196647d.0",
137+
"@material/tab": "15.0.0-canary.10196647d.0",
138+
"@material/tab-bar": "15.0.0-canary.10196647d.0",
139+
"@material/tab-indicator": "15.0.0-canary.10196647d.0",
140+
"@material/tab-scroller": "15.0.0-canary.10196647d.0",
141+
"@material/textfield": "15.0.0-canary.10196647d.0",
142+
"@material/theme": "15.0.0-canary.10196647d.0",
143+
"@material/tooltip": "15.0.0-canary.10196647d.0",
144+
"@material/top-app-bar": "15.0.0-canary.10196647d.0",
145+
"@material/touch-target": "15.0.0-canary.10196647d.0",
146+
"@material/typography": "15.0.0-canary.10196647d.0",
147147
"@octokit/rest": "18.3.5",
148148
"@rollup/plugin-commonjs": "^21.0.0",
149149
"@rollup/plugin-node-resolve": "^13.1.3",

packages.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# all in-sync. This map is passed to each ng_package rule to stamp out the appropriate
33
# version for the placeholders.
44
ANGULAR_PACKAGE_VERSION = "^14.0.0 || ^15.0.0"
5-
MDC_PACKAGE_VERSION = "15.0.0-canary.69fd619d0.0"
5+
MDC_PACKAGE_VERSION = "15.0.0-canary.10196647d.0"
66
TSLIB_PACKAGE_VERSION = "^2.3.0"
77
RXJS_PACKAGE_VERSION = "^6.5.3 || ^7.4.0"
88

src/material/tooltip/_tooltip-theme.scss

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@use 'sass:map';
2-
@use '@material/tooltip/tooltip';
3-
@use '@material/tooltip' as tooltip-theme;
2+
@use '@material/tooltip/plain-tooltip-theme';
3+
@use '@material/theme/theme-color' as mdc-theme-color;
4+
@use '@material/typography/typography' as mdc-typography;
45
@use '../core/theming/theming';
56
@use '../core/theming/palette';
67
@use '../core/mdc-helpers/mdc-helpers';
@@ -9,20 +10,27 @@
910
@mixin color($config-or-theme) {
1011
$config: theming.get-color-config($config-or-theme);
1112
@include mdc-helpers.using-mdc-theme($config) {
12-
@include tooltip.core-styles($query: mdc-helpers.$mdc-theme-styles-query);
13-
// We are defining our own tooltip background color because of concerns
14-
// surrounding the 0.6 background color opacity of the MDC tooltip styles.
15-
@include tooltip-theme.fill-color(
16-
map.get(palette.$light-theme-background-palette, tooltip)
17-
);
13+
.mat-mdc-tooltip {
14+
@include plain-tooltip-theme.theme((
15+
container-color: map.get(palette.$light-theme-background-palette, tooltip),
16+
supporting-text-color: mdc-theme-color.prop-value(text-primary-on-dark)
17+
));
18+
}
1819
}
1920
}
2021

2122
@mixin typography($config-or-theme) {
2223
$config: typography.private-typography-to-2018-config(
2324
theming.get-typography-config($config-or-theme));
2425
@include mdc-helpers.using-mdc-typography($config) {
25-
@include tooltip.core-styles($query: mdc-helpers.$mdc-typography-styles-query);
26+
.mat-mdc-tooltip {
27+
@include plain-tooltip-theme.theme((
28+
supporting-text-font: mdc-typography.get-font(caption),
29+
supporting-text-size: mdc-typography.get-size(caption),
30+
supporting-text-weight: mdc-typography.get-weight(caption),
31+
supporting-text-tracking: mdc-typography.get-tracking(caption),
32+
));
33+
}
2634
}
2735
}
2836

src/material/tooltip/tooltip.scss

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
@use '@material/tooltip/tooltip';
2+
@use '@material/tooltip/tooltip-theme';
3+
@use '@material/tooltip/plain-tooltip-theme';
4+
@use '../core/mdc-helpers/mdc-helpers';
25

3-
// Only include the structural styles, because we handle the animation ourselves.
4-
@include tooltip.core-styles($query: structure);
6+
@include mdc-helpers.disable-mdc-fallback-declarations {
7+
// Only include the structural styles, because we handle the animation ourselves.
8+
@include tooltip.static-styles($query: structure);
9+
@include plain-tooltip-theme.theme-styles((
10+
container-shape: tooltip-theme.$border-radius,
11+
container-color: #fff,
12+
supporting-text-color: #000,
13+
supporting-text-font: inherit,
14+
supporting-text-size: inherit,
15+
supporting-text-tracking: inherit,
16+
supporting-text-weight: inherit,
17+
));
18+
}
519

620
.mat-mdc-tooltip {
721
// We don't use MDC's positioning so this has to be relative.

0 commit comments

Comments
 (0)