Skip to content

Commit acdbc37

Browse files
authored
Merge branch 'angular:main' into talkback-double-swipe-issue-fix
2 parents 4d4b33b + d283622 commit acdbc37

File tree

14 files changed

+183
-207
lines changed

14 files changed

+183
-207
lines changed

.ng-dev/google-sync-config.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"src/material/module.ts",
3434
"src/material/core/index.ts",
3535
"src/material/core/theming/tests/**/*",
36-
"src/material/core/tokens/tests/**",
3736
"src/material/expansion/index.ts",
3837
"src/material-experimental/theming/_format-tokens.scss",
3938
"**/*import.scss"

CHANGELOG.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,56 @@
1+
<a name="18.1.1"></a>
2+
# 18.1.1 "tantalum-tale" (2024-07-17)
3+
### cdk
4+
| Commit | Type | Description |
5+
| -- | -- | -- |
6+
| [ca634cb7b](https://github.com/angular/components/commit/ca634cb7ba6800b2dc23b15b319d8aef6ede64df) | fix | **drag-drop:** remove preview after animate to placeholder animation completes ([#29439](https://github.com/angular/components/pull/29439)) |
7+
### material
8+
| Commit | Type | Description |
9+
| -- | -- | -- |
10+
| [b7959c241](https://github.com/angular/components/commit/b7959c241d56ebfbcfb09c2fdce12ebdc6e2d6ad) | fix | **button:** support palettes for icon button in M3 ([#29433](https://github.com/angular/components/pull/29433)) |
11+
| [ffe1c35c0](https://github.com/angular/components/commit/ffe1c35c0b2b59acfbc49bfc345e477f680e1f44) | fix | **chips:** fix focus issue ([#29427](https://github.com/angular/components/pull/29427)) |
12+
| [57cc0b04b](https://github.com/angular/components/commit/57cc0b04b4be19b3cba08ae509e066f7ba40e61d) | fix | **core:** require theme for option typography ([#29416](https://github.com/angular/components/pull/29416)) |
13+
| [2e5e415ec](https://github.com/angular/components/commit/2e5e415ec573b2fd6593b116429080fbe7b24dc2) | fix | **tabs:** prevent tab header from collapsing when empty inside a drop list ([#29418](https://github.com/angular/components/pull/29418)) |
14+
15+
<!-- CHANGELOG SPLIT MARKER -->
16+
17+
<a name="18.2.0-next.1"></a>
18+
# 18.2.0-next.1 "osmium-opal" (2024-07-17)
19+
## Deprecations
20+
### material
21+
- Tree controller deprecated. Use one of levelAccessor or childrenAccessor instead. To be removed in a future version.
22+
* BaseTreeControl, TreeControl, FlatTreeControl, and NestedTreeControl deprecated
23+
* CdkTree#treeControl deprecated. Provide one of CdkTree#levelAccessor or CdkTree#childrenAccessor instead.
24+
* MatTreeFlattener deprecated. Use MatTree#childrenAccessor and MatTreeNode#isExpandable instead.
25+
* MatTreeFlatDataSource deprecated. Use one of levelAccessor or childrenAccessor instead of TreeControl.
26+
27+
Note when upgrading: isExpandable works differently on Trees using treeControl than trees using childrenAccessor or levelAccessor. Nodes on trees that have a treeControl are expandable by default. Nodes on trees using childrenAccessor or levelAccessor are *not* expandable by default. Provide isExpandable to override default behavior.
28+
- Setting tabindex of tree nodes deprecated. By default, Tree ignores tabindex passed to tree nodes.
29+
* MatTreeNode#tabIndex deprecated. MatTreeNode ignores Input tabIndex and manages its own focus behavior.
30+
* MatTreeNode#defaultTabIndex deprecated. MatTreeNode ignores defaultTabIndex and manages its own focus behavior.
31+
* MatNestedTreeNode#tabIndex deprecated. MatTreeNode ignores Input defaultTabIndex and manages its own focus behavior.
32+
* LegacyTreeKeyManager and LEGACY_TREE_KEY_MANAGER_FACTORY_PROVIDER deprecated. Inject a TreeKeyManagerFactory to customize keyboard behavior.
33+
34+
Note when upgrading: an opt-out is available for keyboard functionality changes. Provide LEGACY_TREE_KEY_MANAGER_FACTORY_PROVIDER to opt-out of Tree managing its own focus. When provided, Tree does not manage it’s own focus and respects tabindex passed to TreeNode. When provided, have the same focus behavior as before this commit is applied.
35+
36+
Add Legacy Keyboard Interface demo, which shows usage of LEGACY_TREE_KEY_MANAGER_FACTORY_PROVIDER. Add Custom Key Manager, which shows usage of injecting a TreeKeyManagerStrategy
37+
- disabled renamed to isDisabled.
38+
* CdkTreeNode#disabled deprecated and alias to CdkTreeNode#isDisabled
39+
### material
40+
| Commit | Type | Description |
41+
| -- | -- | -- |
42+
| [095947c8c](https://github.com/angular/components/commit/095947c8c3a79fecf4e56fc39ab61b0cc6e03eea) | fix | **button:** support palettes for icon button in M3 ([#29433](https://github.com/angular/components/pull/29433)) |
43+
| [e69b2b09e](https://github.com/angular/components/commit/e69b2b09efaf577cd5fe92b70808479f975913af) | fix | **chips:** fix focus issue ([#29427](https://github.com/angular/components/pull/29427)) |
44+
| [b116643a0](https://github.com/angular/components/commit/b116643a062749fa2c964820ae9f9c0e76c40717) | fix | **core:** require theme for option typography ([#29416](https://github.com/angular/components/pull/29416)) |
45+
| [92ab713a6](https://github.com/angular/components/commit/92ab713a65e2d622f975a6e610f981563a12b592) | fix | **tabs:** prevent tab header from collapsing when empty inside a drop list ([#29418](https://github.com/angular/components/pull/29418)) |
46+
| [ff36c80f9](https://github.com/angular/components/commit/ff36c80f9c7a14f0e9f36eafc3e1423d34e7c916) | fix | **tree:** add levelAccessor, childrenAccessor, TreeKeyManager; a11y and docs improvements ([#29062](https://github.com/angular/components/pull/29062)) |
47+
### cdk
48+
| Commit | Type | Description |
49+
| -- | -- | -- |
50+
| [565566151](https://github.com/angular/components/commit/565566151a7a68ee2956b96a5b8d6b48d4762ef9) | fix | **drag-drop:** remove preview after animate to placeholder animation completes ([#29439](https://github.com/angular/components/pull/29439)) |
51+
52+
<!-- CHANGELOG SPLIT MARKER -->
53+
154
<a name="18.2.0-next.0"></a>
255
# 18.2.0-next.0 "pumice-reverie" (2024-07-10)
356
### cdk

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"ci-notify-slack-failure": "node --no-warnings=ExperimentalWarning --loader ts-node/esm/transpile-only scripts/circleci/notify-slack-job-failure.mts",
5555
"prepare": "husky"
5656
},
57-
"version": "18.2.0-next.0",
57+
"version": "18.2.0-next.1",
5858
"dependencies": {
5959
"@angular/animations": "^18.1.0",
6060
"@angular/common": "^18.1.0",

src/cdk/drag-drop/drag-ref.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,9 @@ export class DragRef<T = any> {
11061106
const handler = ((event: TransitionEvent) => {
11071107
if (
11081108
!event ||
1109-
(_getEventTarget(event) === this._preview && event.propertyName === 'transform')
1109+
(this._preview &&
1110+
_getEventTarget(event) === this._preview.element &&
1111+
event.propertyName === 'transform')
11101112
) {
11111113
this._preview?.removeEventListener('transitionend', handler);
11121114
resolve();

src/cdk/drag-drop/preview-ref.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ export class PreviewRef {
3939
/** Reference to the preview element. */
4040
private _preview: HTMLElement;
4141

42+
get element(): HTMLElement {
43+
return this._preview;
44+
}
45+
4246
constructor(
4347
private _document: Document,
4448
private _rootElement: HTMLElement,

src/material/button/_icon-button-theme.scss

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@
3737
@include token-utils.create-token-values(tokens-mat-icon-button.$prefix, $mat-tokens);
3838
}
3939

40-
@mixin color($theme) {
40+
/// Outputs color theme styles for the mat-icon-button.
41+
/// @param {Map} $theme The theme to generate color styles for.
42+
/// @param {ArgList} Additional optional arguments (only supported for M3 themes):
43+
/// $color-variant: The color variant to use for the button: primary, secondary, tertiary, or error.
44+
@mixin color($theme, $options...) {
4145
@if inspection.get-theme-version($theme) == 1 {
42-
@include _theme-from-tokens(inspection.get-theme-tokens($theme, color));
46+
@include _theme-from-tokens(inspection.get-theme-tokens($theme, color), $options...);
4347
}
4448
@else {
4549
@include sass-utils.current-selector-or-root() {
@@ -122,10 +126,14 @@
122126
);
123127
}
124128

125-
@mixin theme($theme) {
129+
/// Outputs all (base, color, typography, and density) theme styles for the mat-icon-button.
130+
/// @param {Map} $theme The theme to generate styles for.
131+
/// @param {ArgList} Additional optional arguments (only supported for M3 themes):
132+
/// $color-variant: The color variant to use for the button: primary, secondary, tertiary, or error.
133+
@mixin theme($theme, $options...) {
126134
@include theming.private-check-duplicate-theme-styles($theme, 'mat-icon-button') {
127135
@if inspection.get-theme-version($theme) == 1 {
128-
@include _theme-from-tokens(inspection.get-theme-tokens($theme));
136+
@include _theme-from-tokens(inspection.get-theme-tokens($theme), $options...);
129137
}
130138
@else {
131139
@include base($theme);
@@ -142,13 +150,14 @@
142150
}
143151
}
144152

145-
@mixin _theme-from-tokens($tokens) {
153+
@mixin _theme-from-tokens($tokens, $options...) {
146154
@include validation.selector-defined(
147155
'Calls to Angular Material theme mixins with an M3 theme must be wrapped in a selector');
148156
@if ($tokens != ()) {
149-
@include token-utils.create-token-values(
150-
tokens-mdc-icon-button.$prefix, map.get($tokens, tokens-mdc-icon-button.$prefix));
151-
@include token-utils.create-token-values(
152-
tokens-mat-icon-button.$prefix, map.get($tokens, tokens-mat-icon-button.$prefix));
157+
$mdc-tokens: token-utils.get-tokens-for($tokens, tokens-mdc-icon-button.$prefix, $options...);
158+
$mat-tokens: token-utils.get-tokens-for($tokens, tokens-mat-icon-button.$prefix, $options...);
159+
160+
@include token-utils.create-token-values(tokens-mdc-icon-button.$prefix, $mdc-tokens);
161+
@include token-utils.create-token-values(tokens-mat-icon-button.$prefix, $mat-tokens);
153162
}
154163
}

src/material/core/theming/_color-api-backwards-compatibility.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@use '../../badge/badge-theme';
22
@use '../../button/button-theme';
33
@use '../../button/fab-theme';
4+
@use '../../button/icon-button-theme';
45
@use '../../checkbox/checkbox-theme';
56
@use '../../chips/chips-theme';
67
@use '../../datepicker/datepicker-theme';
@@ -80,6 +81,7 @@ $_overrides-only: true;
8081

8182
&.mat-mdc-button-base {
8283
@include button-theme.color($theme, $primary-options...);
84+
@include icon-button-theme.color($theme, $primary-options...);
8385
}
8486

8587
&.mat-mdc-standard-chip {

src/material/core/tokens/_token-utils.scss

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
@use 'sass:list';
22
@use 'sass:map';
33
@use 'sass:meta';
4-
@use '@material/theme/custom-properties' as mdc-custom-properties;
5-
@use '@material/theme/theme' as mdc-theme;
6-
@use '@material/theme/keys' as mdc-keys;
4+
@use 'sass:string';
75
@use '@material/tokens/v0_161' as mdc-tokens;
86
@use '../style/elevation';
97
@use '../style/sass-utils';
@@ -57,27 +55,33 @@ $placeholder-density-config: 0;
5755
$_tokens: null;
5856
$_component-prefix: null;
5957

60-
@mixin _configure-token-prefix($first, $rest...) {
61-
$_component-prefix: '' !global;
62-
@each $item in $rest {
63-
$_component-prefix:
64-
if($_component-prefix == '', $item, '#{$_component-prefix}-#{$item}') !global;
65-
}
66-
@include mdc-custom-properties.configure($varname-prefix: $first) {
67-
@content;
68-
}
69-
$_component-prefix: null !global;
70-
}
71-
7258
// Sets the token prefix and map to use when creating token slots.
7359
@mixin use-tokens($prefix, $tokens) {
60+
$_component-prefix: $prefix !global;
7461
$_tokens: $tokens !global;
75-
@include _configure-token-prefix($prefix...) {
76-
@content;
77-
}
62+
63+
@content;
64+
65+
$_component-prefix: null !global;
7866
$_tokens: null !global;
7967
}
8068

69+
// Combines a prefix and a string to generate a CSS variable name for a token.
70+
@function _get-css-variable($prefix, $name) {
71+
@if $prefix == null or $name == null {
72+
@error 'Must specify both prefix and name when generating token';
73+
}
74+
75+
$string-prefix: '';
76+
77+
// Prefixes are lists so we need to combine them.
78+
@each $part in $prefix {
79+
$string-prefix: if($string-prefix == '', $part, '#{$string-prefix}-#{$part}');
80+
}
81+
82+
@return string.unquote('--#{$string-prefix}-#{$name}');
83+
}
84+
8185
// Emits a slot for the given token, provided that it has a non-null value in the token map passed
8286
// to `use-tokens`.
8387
@mixin create-token-slot($property, $token, $emit-fallback: false) {
@@ -97,8 +101,9 @@ $_component-prefix: null;
97101
$fallback: $emit-fallback;
98102
}
99103

100-
$value: mdc-custom-properties.create('#{$_component-prefix}-#{$token}', $fallback: $fallback);
101-
@include mdc-theme.property($property, $value);
104+
$var-name: _get-css-variable($_component-prefix, $token);
105+
$var-reference: if($fallback == null, var(#{$var-name}), var(#{$var-name}, #{$fallback}));
106+
#{$property}: #{$var-reference};
102107
}
103108
}
104109

@@ -112,7 +117,7 @@ $_component-prefix: null;
112117
@error 'Token #{$token} does not exist. Configured tokens are: #{map.keys($_tokens)}';
113118
}
114119

115-
@return mdc-custom-properties.create-varname('#{$_component-prefix}-#{$token}');
120+
@return _get-css-variable($_component-prefix, $token);
116121
}
117122

118123
// TODO(crisbeto): should be able to replace the usages of `get-token-variable` with this.
@@ -137,9 +142,14 @@ $_component-prefix: null;
137142
}
138143
}
139144

145+
// Outputs a map of tokens under a specific prefix.
140146
@mixin create-token-values($prefix, $tokens) {
141-
@include _configure-token-prefix($prefix...) {
142-
@include mdc-keys.declare-custom-properties($tokens, $_component-prefix);
147+
@if $tokens != null {
148+
@each $key, $value in $tokens {
149+
@if $value != null {
150+
#{_get-css-variable($prefix, $key)}: #{$value};
151+
}
152+
}
143153
}
144154
}
145155

src/material/core/tokens/m2/mdc/_switch.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ $prefix: (mdc, switch);
8989
disabled-unselected-icon-color: $icon-color,
9090
// Color of track when disabled.
9191
disabled-unselected-track-color: $on-surface,
92+
// TODO(crisbeto): `handle-surface-color` was hardcoded to `var(--mdc-surface-color, #fff)`
93+
// which made it basically hardcoded to #fff. Should it be based on the theme?
9294
// Color of slide-toggle handle's surface.
93-
handle-surface-color: surface,
95+
handle-surface-color: #fff,
9496
// Color of icon (ex. checkmark) when selected
9597
selected-icon-color: $icon-color,
9698
// Color of handle when unselected and focused.

src/material/core/tokens/m3/mat/_icon-button.scss

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ $prefix: (mat, icon-button);
1111
/// @param {Map} $token-slots Possible token slots
1212
/// @return {Map} A set of custom tokens for the mat-icon-button
1313
@function get-tokens($systems, $exclude-hardcoded, $token-slots) {
14-
$tokens: (
14+
$tokens: ((
1515
state-layer-color: map.get($systems, md-sys-color, on-surface-variant),
1616
disabled-state-layer-color: map.get($systems, md-sys-color, on-surface-variant),
1717
ripple-color: sass-utils.safe-color-change(
@@ -21,7 +21,36 @@ $prefix: (mat, icon-button);
2121
hover-state-layer-opacity: map.get($systems, md-sys-state, hover-state-layer-opacity),
2222
focus-state-layer-opacity: map.get($systems, md-sys-state, focus-state-layer-opacity),
2323
pressed-state-layer-opacity: map.get($systems, md-sys-state, pressed-state-layer-opacity),
24-
);
24+
), (
25+
primary: (
26+
state-layer-color: map.get($systems, md-sys-color, primary),
27+
ripple-color: sass-utils.safe-color-change(
28+
map.get($systems, md-sys-color, primary),
29+
$alpha: map.get($systems, md-sys-state, pressed-state-layer-opacity)
30+
),
31+
),
32+
secondary: (
33+
state-layer-color: map.get($systems, md-sys-color, secondary),
34+
ripple-color: sass-utils.safe-color-change(
35+
map.get($systems, md-sys-color, secondary),
36+
$alpha: map.get($systems, md-sys-state, pressed-state-layer-opacity)
37+
),
38+
),
39+
tertiary: (
40+
state-layer-color: map.get($systems, md-sys-color, tertiary),
41+
ripple-color: sass-utils.safe-color-change(
42+
map.get($systems, md-sys-color, tertiary),
43+
$alpha: map.get($systems, md-sys-state, pressed-state-layer-opacity)
44+
),
45+
),
46+
error: (
47+
state-layer-color: map.get($systems, md-sys-color, error),
48+
ripple-color: sass-utils.safe-color-change(
49+
map.get($systems, md-sys-color, error),
50+
$alpha: map.get($systems, md-sys-state, pressed-state-layer-opacity)
51+
),
52+
)
53+
));
2554

2655
@return token-utils.namespace-tokens($prefix, $tokens, $token-slots);
2756
}

src/material/core/tokens/m3/mdc/_icon-button.scss

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@use 'sass:map';
2+
@use 'sass:meta';
13
@use '../../token-utils';
24

35
// The prefix used to generate the fully qualified name for tokens in this file.
@@ -9,9 +11,26 @@ $prefix: (mdc, icon-button);
911
/// @param {Map} $token-slots Possible token slots
1012
/// @return {Map} A set of tokens for the MDC icon-button
1113
@function get-tokens($systems, $exclude-hardcoded, $token-slots) {
12-
$mdc-tokens: token-utils.get-mdc-tokens('icon-button', $systems, $exclude-hardcoded);
14+
$tokens: token-utils.get-mdc-tokens('icon-button', $systems, $exclude-hardcoded);
15+
$variant-tokens: (
16+
primary: (
17+
icon-color: map.get($systems, md-sys-color, primary)
18+
),
19+
secondary: (
20+
icon-color: map.get($systems, md-sys-color, secondary)
21+
),
22+
tertiary: (
23+
icon-color: map.get($systems, md-sys-color, tertiary)
24+
),
25+
error: (
26+
icon-color: map.get($systems, md-sys-color, error)
27+
)
28+
);
1329

14-
@return token-utils.namespace-tokens($prefix, _fix-tokens($mdc-tokens), $token-slots);
30+
@return token-utils.namespace-tokens($prefix, (
31+
_fix-tokens($tokens),
32+
token-utils.map-values($variant-tokens, meta.get-function(_fix-tokens))
33+
), $token-slots);
1534
}
1635

1736
/// Fixes inconsistent values in the icon button tokens so that they can produce valid styles.

src/material/core/tokens/tests/BUILD.bazel

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)