Skip to content

Commit fde3314

Browse files
committed
fixup! feat(material/core): switch option implementation to use MDC
1 parent 6d6495e commit fde3314

File tree

103 files changed

+219
-220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+219
-220
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969
/src/material/legacy-core/density/** @devversion
7070
/src/material/legacy-core/theming/** @andrewseguin @jelbourn
7171
/src/material/legacy-core/typography/** @crisbeto
72+
/src/material/legacy-core/option/** @crisbeto
73+
/src/material/legacy-core/testing/** @crisbeto
7274

7375
# Miscellaneous components
7476
/src/google-maps/** @crisbeto

src/dev-app/mdc-checkbox/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ ng_module(
1212
],
1313
deps = [
1414
"//src/material-experimental/mdc-checkbox",
15-
"//src/material-experimental/mdc-core",
1615
"//src/material-experimental/mdc-select",
16+
"//src/material/core",
1717
"//src/material/form-field",
1818
"//src/material/input",
1919
"@npm//@angular/forms",

src/dev-app/mdc-checkbox/mdc-checkbox-demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {MAT_CHECKBOX_DEFAULT_OPTIONS} from '@angular/material/checkbox';
1111
import {ANIMATION_MODULE_TYPE} from '@angular/platform-browser/animations';
1212
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
1313
import {MatCheckboxModule} from '@angular/material-experimental/mdc-checkbox';
14-
import {MatPseudoCheckboxModule, ThemePalette} from '@angular/material-experimental/mdc-core';
14+
import {MatPseudoCheckboxModule, ThemePalette} from '@angular/material/core';
1515
import {MatInputModule} from '@angular/material/input';
1616
import {MatSelectModule} from '@angular/material-experimental/mdc-select';
1717
import {CommonModule} from '@angular/common';

src/dev-app/mdc-chips/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ ng_module(
1313
"//src/material-experimental/mdc-button",
1414
"//src/material-experimental/mdc-checkbox",
1515
"//src/material-experimental/mdc-chips",
16-
"//src/material-experimental/mdc-core",
1716
"//src/material/card",
17+
"//src/material/core",
1818
"//src/material/form-field",
1919
"//src/material/icon",
2020
"//src/material/toolbar",

src/dev-app/mdc-chips/mdc-chips-demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import {Component} from '@angular/core';
1010
import {COMMA, ENTER} from '@angular/cdk/keycodes';
1111
import {CommonModule} from '@angular/common';
12-
import {ThemePalette} from '@angular/material-experimental/mdc-core';
12+
import {ThemePalette} from '@angular/material/core';
1313
import {
1414
MatChipInputEvent,
1515
MatChipEditedEvent,

src/dev-app/mdc-progress-bar/mdc-progress-bar-demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import {Component} from '@angular/core';
10-
import {ThemePalette} from '@angular/material-experimental/mdc-core';
10+
import {ThemePalette} from '@angular/material/core';
1111
import {CommonModule} from '@angular/common';
1212
import {FormsModule} from '@angular/forms';
1313
import {MatProgressBarModule} from '@angular/material/progress-bar';

src/dev-app/mdc-progress-spinner/mdc-progress-spinner-demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import {Component} from '@angular/core';
10-
import {ThemePalette} from '@angular/material-experimental/mdc-core';
10+
import {ThemePalette} from '@angular/material/core';
1111
import {MatProgressSpinnerModule} from '@angular/material-experimental/mdc-progress-spinner';
1212
import {MatButtonModule} from '@angular/material-experimental/mdc-button';
1313
import {MatCheckboxModule} from '@angular/material-experimental/mdc-checkbox';

src/dev-app/mdc-select/mdc-select-demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import {Component} from '@angular/core';
1010
import {FormControl, Validators, FormsModule, ReactiveFormsModule} from '@angular/forms';
11-
import {ErrorStateMatcher, ThemePalette} from '@angular/material-experimental/mdc-core';
11+
import {ErrorStateMatcher, ThemePalette} from '@angular/material/core';
1212
import {MatSelectChange, MatSelectModule} from '@angular/material-experimental/mdc-select';
1313
import {FloatLabelType} from '@angular/material/form-field';
1414
import {CommonModule} from '@angular/common';

src/material-experimental/config.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ entryPoints = [
88
"mdc-checkbox/testing",
99
"mdc-chips",
1010
"mdc-chips/testing",
11+
"mdc-core",
1112
"mdc-dialog",
1213
"mdc-dialog/testing",
1314
"mdc-list",

src/material-experimental/mdc-autocomplete/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ ng_module(
1616
deps = [
1717
"//src/cdk/overlay",
1818
"//src/cdk/scrolling",
19-
"//src/material/core",
2019
"//src/material/autocomplete",
20+
"//src/material/core",
2121
"@npm//@angular/common",
2222
],
2323
)

src/material-experimental/mdc-autocomplete/testing/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ ts_library(
1010
),
1111
deps = [
1212
"//src/cdk/testing",
13-
"//src/material/core/testing",
1413
"//src/material/autocomplete/testing",
14+
"//src/material/core/testing",
1515
],
1616
)
1717

src/material-experimental/mdc-button/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ ng_module(
2727
] + glob(["**/*.html"]),
2828
deps = [
2929
"//src/cdk/platform",
30-
"//src/material-experimental/mdc-core",
30+
"//src/material/core",
3131
],
3232
)
3333

@@ -99,8 +99,8 @@ ng_test_library(
9999
":mdc-button",
100100
"//src/cdk/platform",
101101
"//src/cdk/testing/private",
102-
"//src/material-experimental/mdc-core",
103102
"//src/material/button",
103+
"//src/material/core",
104104
"@npm//@angular/platform-browser",
105105
],
106106
)

src/material-experimental/mdc-button/button-base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
mixinColor,
1717
mixinDisabled,
1818
mixinDisableRipple,
19-
} from '@angular/material-experimental/mdc-core';
19+
} from '@angular/material/core';
2020
import {FocusOrigin} from '@angular/cdk/a11y';
2121

2222
/** Inputs common to all buttons. */

src/material-experimental/mdc-button/button.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {waitForAsync, ComponentFixture, TestBed} from '@angular/core/testing';
22
import {ApplicationRef, Component, DebugElement} from '@angular/core';
33
import {By} from '@angular/platform-browser';
44
import {MatButtonModule, MatButton, MatFabDefaultOptions, MAT_FAB_DEFAULT_OPTIONS} from './index';
5-
import {MatRipple, ThemePalette} from '@angular/material-experimental/mdc-core';
5+
import {MatRipple, ThemePalette} from '@angular/material/core';
66
import {createMouseEvent, dispatchEvent} from '@angular/cdk/testing/private';
77

88
describe('MDC-based MatButton', () => {

src/material-experimental/mdc-button/fab.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
MAT_BUTTON_INPUTS,
2828
MatButtonBase,
2929
} from './button-base';
30-
import {ThemePalette} from '@angular/material-experimental/mdc-core';
30+
import {ThemePalette} from '@angular/material/core';
3131
import {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion';
3232

3333
/** Default FAB options that can be overridden. */

src/material-experimental/mdc-button/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import {NgModule} from '@angular/core';
10-
import {MatCommonModule, MatRippleModule} from '@angular/material-experimental/mdc-core';
10+
import {MatCommonModule, MatRippleModule} from '@angular/material/core';
1111
import {MatAnchor, MatButton} from './button';
1212
import {MatFabAnchor, MatFabButton, MatMiniFabAnchor, MatMiniFabButton} from './fab';
1313
import {MatIconAnchor, MatIconButton} from './icon-button';

src/material-experimental/mdc-checkbox/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ ng_module(
2222
assets = [":checkbox_scss"] + glob(["**/*.html"]),
2323
deps = [
2424
"//src/cdk/coercion",
25-
"//src/material-experimental/mdc-core",
2625
"//src/material/checkbox",
26+
"//src/material/core",
2727
"@npm//@angular/animations",
2828
"@npm//@angular/core",
2929
"@npm//@angular/forms",
@@ -62,8 +62,8 @@ ng_test_library(
6262
":mdc-checkbox",
6363
"//src/cdk/testing/private",
6464
"//src/cdk/testing/testbed",
65-
"//src/material-experimental/mdc-core",
6665
"//src/material/checkbox",
66+
"//src/material/core",
6767
"@npm//@angular/forms",
6868
"@npm//@angular/platform-browser",
6969
],

src/material-experimental/mdc-checkbox/checkbox.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {dispatchFakeEvent} from '../../cdk/testing/private';
22
import {ChangeDetectionStrategy, Component, DebugElement, Type} from '@angular/core';
33
import {ComponentFixture, fakeAsync, flush, flushMicrotasks, TestBed} from '@angular/core/testing';
4-
import {ThemePalette} from '@angular/material-experimental/mdc-core';
4+
import {ThemePalette} from '@angular/material/core';
55
import {FormControl, FormsModule, NgModel, ReactiveFormsModule} from '@angular/forms';
66
import {By} from '@angular/platform-browser';
77
import {MatCheckbox, MatCheckboxChange, MatCheckboxModule} from './index';

src/material-experimental/mdc-checkbox/checkbox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
MatCheckboxDefaultOptions,
2525
_MatCheckboxBase,
2626
} from '@angular/material/checkbox';
27-
import {CanColor, CanDisable} from '@angular/material-experimental/mdc-core';
27+
import {CanColor, CanDisable} from '@angular/material/core';
2828
import {ANIMATION_MODULE_TYPE} from '@angular/platform-browser/animations';
2929

3030
export const MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR: any = {

src/material-experimental/mdc-checkbox/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import {NgModule} from '@angular/core';
1010
import {_MatCheckboxRequiredValidatorModule} from '@angular/material/checkbox';
11-
import {MatCommonModule, MatRippleModule} from '@angular/material-experimental/mdc-core';
11+
import {MatCommonModule, MatRippleModule} from '@angular/material/core';
1212
import {MatCheckbox} from './checkbox';
1313

1414
@NgModule({

src/material-experimental/mdc-chips/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ng_module(
2323
] + glob(["**/*.html"]),
2424
deps = [
2525
"//src:dev_mode_types",
26-
"//src/material-experimental/mdc-core",
26+
"//src/material/core",
2727
"//src/material/form-field",
2828
"@npm//@angular/animations",
2929
"@npm//@angular/common",
@@ -77,7 +77,7 @@ ng_test_library(
7777
"//src/cdk/platform",
7878
"//src/cdk/testing",
7979
"//src/cdk/testing/private",
80-
"//src/material-experimental/mdc-core",
80+
"//src/material/core",
8181
"//src/material/form-field",
8282
"//src/material/input",
8383
"@npm//@angular/animations",

src/material-experimental/mdc-chips/chip-action.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion';
1010
import {ENTER, SPACE} from '@angular/cdk/keycodes';
1111
import {Directive, ElementRef, Inject, Input} from '@angular/core';
12-
import {HasTabIndex, mixinTabIndex} from '@angular/material-experimental/mdc-core';
12+
import {HasTabIndex, mixinTabIndex} from '@angular/material/core';
1313
import {MAT_CHIP} from './tokens';
1414

1515
abstract class _MatChipActionBase {

src/material-experimental/mdc-chips/chip-grid.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ import {
3333
NgForm,
3434
Validators,
3535
} from '@angular/forms';
36-
import {
37-
CanUpdateErrorState,
38-
ErrorStateMatcher,
39-
mixinErrorState,
40-
} from '@angular/material-experimental/mdc-core';
36+
import {CanUpdateErrorState, ErrorStateMatcher, mixinErrorState} from '@angular/material/core';
4137
import {MatFormFieldControl} from '@angular/material/form-field';
4238
import {MatChipTextControl} from './chip-text-control';
4339
import {Observable, Subject, merge} from 'rxjs';

src/material-experimental/mdc-chips/chip-option.spec.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ import {Directionality} from '@angular/cdk/bidi';
22
import {dispatchFakeEvent, dispatchKeyboardEvent} from '@angular/cdk/testing/private';
33
import {Component, DebugElement, ViewChild} from '@angular/core';
44
import {waitForAsync, ComponentFixture, fakeAsync, flush, TestBed} from '@angular/core/testing';
5-
import {
6-
MAT_RIPPLE_GLOBAL_OPTIONS,
7-
RippleGlobalOptions,
8-
} from '@angular/material-experimental/mdc-core';
5+
import {MAT_RIPPLE_GLOBAL_OPTIONS, RippleGlobalOptions} from '@angular/material/core';
96
import {By} from '@angular/platform-browser';
107
import {Subject} from 'rxjs';
118
import {

src/material-experimental/mdc-chips/chip-row.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ import {
2626
ViewEncapsulation,
2727
} from '@angular/core';
2828
import {DOCUMENT} from '@angular/common';
29-
import {
30-
MAT_RIPPLE_GLOBAL_OPTIONS,
31-
RippleGlobalOptions,
32-
} from '@angular/material-experimental/mdc-core';
29+
import {MAT_RIPPLE_GLOBAL_OPTIONS, RippleGlobalOptions} from '@angular/material/core';
3330
import {FocusMonitor} from '@angular/cdk/a11y';
3431
import {MatChip, MatChipEvent} from './chip';
3532
import {MatChipEditInput} from './chip-edit-input';

src/material-experimental/mdc-chips/chip-set.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
QueryList,
2323
ViewEncapsulation,
2424
} from '@angular/core';
25-
import {HasTabIndex, mixinTabIndex} from '@angular/material-experimental/mdc-core';
25+
import {HasTabIndex, mixinTabIndex} from '@angular/material/core';
2626
import {merge, Observable, Subject} from 'rxjs';
2727
import {startWith, switchMap, takeUntil} from 'rxjs/operators';
2828
import {MatChip, MatChipEvent} from './chip';

src/material-experimental/mdc-chips/chip.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {Directionality} from '@angular/cdk/bidi';
22
import {Component, DebugElement, ViewChild} from '@angular/core';
33
import {waitForAsync, ComponentFixture, TestBed} from '@angular/core/testing';
4-
import {MatRipple} from '@angular/material-experimental/mdc-core';
4+
import {MatRipple} from '@angular/material/core';
55
import {By} from '@angular/platform-browser';
66
import {Subject} from 'rxjs';
77
import {MatChip, MatChipEvent, MatChipSet, MatChipsModule} from './index';

src/material-experimental/mdc-chips/chip.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import {
3939
mixinTabIndex,
4040
mixinDisabled,
4141
RippleGlobalOptions,
42-
} from '@angular/material-experimental/mdc-core';
42+
} from '@angular/material/core';
4343
import {FocusMonitor} from '@angular/cdk/a11y';
4444
import {Subject} from 'rxjs';
4545
import {take} from 'rxjs/operators';

src/material-experimental/mdc-chips/module.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@
99
import {ENTER} from '@angular/cdk/keycodes';
1010
import {CommonModule} from '@angular/common';
1111
import {NgModule} from '@angular/core';
12-
import {
13-
ErrorStateMatcher,
14-
MatCommonModule,
15-
MatRippleModule,
16-
} from '@angular/material-experimental/mdc-core';
12+
import {ErrorStateMatcher, MatCommonModule, MatRippleModule} from '@angular/material/core';
1713
import {MatChip} from './chip';
1814
import {MAT_CHIPS_DEFAULT_OPTIONS, MatChipsDefaultOptions} from './tokens';
1915
import {MatChipEditInput} from './chip-edit-input';
Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
load(
22
"//tools:defaults.bzl",
33
"ng_module",
4-
"ng_test_library",
5-
"ng_web_test_suite",
6-
"sass_binary",
74
"sass_library",
85
)
96

@@ -32,25 +29,3 @@ sass_library(
3229
"//src/material/core:core_scss_lib",
3330
],
3431
)
35-
36-
#################
37-
# Test targets
38-
#################
39-
40-
ng_test_library(
41-
name = "unit_test_sources",
42-
srcs = glob(
43-
["**/*.spec.ts"],
44-
),
45-
deps = [
46-
":mdc-core",
47-
"//src/cdk/keycodes",
48-
"//src/cdk/testing/private",
49-
"@npm//@angular/platform-browser",
50-
],
51-
)
52-
53-
ng_web_test_suite(
54-
name = "unit_tests",
55-
deps = [":unit_test_sources"],
56-
)

src/material-experimental/mdc-core/_core-theme.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
@mixin color($config-or-theme) {
88
$config: mat.get-color-config($config-or-theme);
99

10+
@include mat.option-color($config);
11+
@include mat.optgroup-color($config);
12+
1013
@if $config != null {
1114
// Provides external CSS classes for each elevation value. Each CSS class is formatted as
1215
// `mat-mdc-elevation-z$zValue` where `$zValue` corresponds to the z-space to which the
@@ -36,10 +39,16 @@
3639
@mixin typography($config-or-theme) {
3740
$config: mat.private-typography-to-2018-config(
3841
mat.get-typography-config($config-or-theme));
42+
43+
@include mat.option-typography($config-or-theme);
44+
@include mat.optgroup-typography($config-or-theme);
3945
}
4046

4147
@mixin density($config-or-theme) {
4248
$density-scale: mat.get-density-config($config-or-theme);
49+
50+
@include mat.private-option-density($density-scale);
51+
@include mat.private-optgroup-density($density-scale);
4352
}
4453

4554
// Mixin that renders all of the core styles that depend on the theme.

src/material-experimental/mdc-core/public-api.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ export {
5454
ShowOnDirtyErrorStateMatcher,
5555
ThemePalette,
5656
VERSION,
57+
MatOptionModule,
58+
MatOptionSelectionChange,
59+
MatOption,
60+
MatOptgroup,
61+
MatOptionParentComponent,
62+
MAT_OPTION_PARENT_COMPONENT,
5763
// Note: These need to be exposed privately for cross-package type inference. e.g. if the
5864
// experimental package uses a mixin, TS will try to write an explicit type reference that
5965
// is equivalent to e.g. `CanColorCtor`. For this it needs these two helpers as otherwise it

src/material-experimental/mdc-dialog/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ng_module(
2121
deps = [
2222
"//src/cdk/overlay",
2323
"//src/cdk/portal",
24-
"//src/material-experimental/mdc-core",
24+
"//src/material/core",
2525
"//src/material/dialog",
2626
"@npm//@material/dialog",
2727
],

0 commit comments

Comments
 (0)