Skip to content

Commit 397710d

Browse files
authored
refactor(material-experimental/mdc-chips): switch imports to (#22239)
@material/chips/deprecated
1 parent d11e293 commit 397710d

File tree

8 files changed

+638
-639
lines changed

8 files changed

+638
-639
lines changed

package.json

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"@types/youtube": "^0.0.40",
6464
"@webcomponents/custom-elements": "^1.1.0",
6565
"core-js-bundle": "^3.8.2",
66+
"material-components-web": "11.0.0-canary.67d780c79.0",
6667
"rxjs": "^6.5.3",
6768
"rxjs-tslint-rules": "^4.33.1",
6869
"systemjs": "0.19.43",
@@ -91,53 +92,53 @@
9192
"@bazel/terser": "3.2.2",
9293
"@bazel/typescript": "3.2.1",
9394
"@firebase/app-types": "^0.6.1",
94-
"@material/animation": "`11.0.0-canary.f8579b7ea.0`",
95-
"@material/auto-init": "11.0.0-canary.f8579b7ea.0",
96-
"@material/banner": "11.0.0-canary.f8579b7ea.0",
97-
"@material/base": "11.0.0-canary.f8579b7ea.0",
98-
"@material/button": "11.0.0-canary.f8579b7ea.0",
99-
"@material/card": "11.0.0-canary.f8579b7ea.0",
100-
"@material/checkbox": "11.0.0-canary.f8579b7ea.0",
101-
"@material/chips": "11.0.0-canary.f8579b7ea.0",
102-
"@material/circular-progress": "11.0.0-canary.f8579b7ea.0",
103-
"@material/data-table": "11.0.0-canary.f8579b7ea.0",
104-
"@material/density": "11.0.0-canary.f8579b7ea.0",
105-
"@material/dialog": "11.0.0-canary.f8579b7ea.0",
106-
"@material/dom": "11.0.0-canary.f8579b7ea.0",
107-
"@material/drawer": "11.0.0-canary.f8579b7ea.0",
108-
"@material/elevation": "11.0.0-canary.f8579b7ea.0",
109-
"@material/fab": "11.0.0-canary.f8579b7ea.0",
110-
"@material/feature-targeting": "11.0.0-canary.f8579b7ea.0",
111-
"@material/floating-label": "11.0.0-canary.f8579b7ea.0",
112-
"@material/form-field": "11.0.0-canary.f8579b7ea.0",
113-
"@material/icon-button": "11.0.0-canary.f8579b7ea.0",
114-
"@material/image-list": "11.0.0-canary.f8579b7ea.0",
115-
"@material/layout-grid": "11.0.0-canary.f8579b7ea.0",
116-
"@material/line-ripple": "11.0.0-canary.f8579b7ea.0",
117-
"@material/linear-progress": "11.0.0-canary.f8579b7ea.0",
118-
"@material/list": "11.0.0-canary.f8579b7ea.0",
119-
"@material/menu": "11.0.0-canary.f8579b7ea.0",
120-
"@material/menu-surface": "11.0.0-canary.f8579b7ea.0",
121-
"@material/notched-outline": "11.0.0-canary.f8579b7ea.0",
122-
"@material/radio": "11.0.0-canary.f8579b7ea.0",
123-
"@material/ripple": "11.0.0-canary.f8579b7ea.0",
124-
"@material/rtl": "11.0.0-canary.f8579b7ea.0",
125-
"@material/segmented-button": "11.0.0-canary.f8579b7ea.0",
126-
"@material/select": "11.0.0-canary.f8579b7ea.0",
127-
"@material/shape": "11.0.0-canary.f8579b7ea.0",
128-
"@material/slider": "11.0.0-canary.f8579b7ea.0",
129-
"@material/snackbar": "11.0.0-canary.f8579b7ea.0",
130-
"@material/switch": "11.0.0-canary.f8579b7ea.0",
131-
"@material/tab": "11.0.0-canary.f8579b7ea.0",
132-
"@material/tab-bar": "11.0.0-canary.f8579b7ea.0",
133-
"@material/tab-indicator": "11.0.0-canary.f8579b7ea.0",
134-
"@material/tab-scroller": "11.0.0-canary.f8579b7ea.0",
135-
"@material/textfield": "11.0.0-canary.f8579b7ea.0",
136-
"@material/theme": "11.0.0-canary.f8579b7ea.0",
137-
"@material/tooltip": "11.0.0-canary.f8579b7ea.0",
138-
"@material/top-app-bar": "11.0.0-canary.f8579b7ea.0",
139-
"@material/touch-target": "11.0.0-canary.f8579b7ea.0",
140-
"@material/typography": "11.0.0-canary.f8579b7ea.0",
95+
"@material/animation": "11.0.0-canary.67d780c79.0",
96+
"@material/auto-init": "11.0.0-canary.67d780c79.0",
97+
"@material/banner": "11.0.0-canary.67d780c79.0",
98+
"@material/base": "11.0.0-canary.67d780c79.0",
99+
"@material/button": "11.0.0-canary.67d780c79.0",
100+
"@material/card": "11.0.0-canary.67d780c79.0",
101+
"@material/checkbox": "11.0.0-canary.67d780c79.0",
102+
"@material/chips": "11.0.0-canary.67d780c79.0",
103+
"@material/circular-progress": "11.0.0-canary.67d780c79.0",
104+
"@material/data-table": "11.0.0-canary.67d780c79.0",
105+
"@material/density": "11.0.0-canary.67d780c79.0",
106+
"@material/dialog": "11.0.0-canary.67d780c79.0",
107+
"@material/dom": "11.0.0-canary.67d780c79.0",
108+
"@material/drawer": "11.0.0-canary.67d780c79.0",
109+
"@material/elevation": "11.0.0-canary.67d780c79.0",
110+
"@material/fab": "11.0.0-canary.67d780c79.0",
111+
"@material/feature-targeting": "11.0.0-canary.67d780c79.0",
112+
"@material/floating-label": "11.0.0-canary.67d780c79.0",
113+
"@material/form-field": "11.0.0-canary.67d780c79.0",
114+
"@material/icon-button": "11.0.0-canary.67d780c79.0",
115+
"@material/image-list": "11.0.0-canary.67d780c79.0",
116+
"@material/layout-grid": "11.0.0-canary.67d780c79.0",
117+
"@material/line-ripple": "11.0.0-canary.67d780c79.0",
118+
"@material/linear-progress": "11.0.0-canary.67d780c79.0",
119+
"@material/list": "11.0.0-canary.67d780c79.0",
120+
"@material/menu": "11.0.0-canary.67d780c79.0",
121+
"@material/menu-surface": "11.0.0-canary.67d780c79.0",
122+
"@material/notched-outline": "11.0.0-canary.67d780c79.0",
123+
"@material/radio": "11.0.0-canary.67d780c79.0",
124+
"@material/ripple": "11.0.0-canary.67d780c79.0",
125+
"@material/rtl": "11.0.0-canary.67d780c79.0",
126+
"@material/segmented-button": "11.0.0-canary.67d780c79.0",
127+
"@material/select": "11.0.0-canary.67d780c79.0",
128+
"@material/shape": "11.0.0-canary.67d780c79.0",
129+
"@material/slider": "11.0.0-canary.67d780c79.0",
130+
"@material/snackbar": "11.0.0-canary.67d780c79.0",
131+
"@material/switch": "11.0.0-canary.67d780c79.0",
132+
"@material/tab": "11.0.0-canary.67d780c79.0",
133+
"@material/tab-bar": "11.0.0-canary.67d780c79.0",
134+
"@material/tab-indicator": "11.0.0-canary.67d780c79.0",
135+
"@material/tab-scroller": "11.0.0-canary.67d780c79.0",
136+
"@material/textfield": "11.0.0-canary.67d780c79.0",
137+
"@material/theme": "11.0.0-canary.67d780c79.0",
138+
"@material/tooltip": "11.0.0-canary.67d780c79.0",
139+
"@material/top-app-bar": "11.0.0-canary.67d780c79.0",
140+
"@material/touch-target": "11.0.0-canary.67d780c79.0",
141+
"@material/typography": "11.0.0-canary.67d780c79.0",
141142
"@octokit/rest": "18.3.5",
142143
"@schematics/angular": "^12.0.0-next.0",
143144
"@types/autoprefixer": "^9.7.2",
@@ -189,7 +190,6 @@
189190
"karma-sourcemap-loader": "^0.3.7",
190191
"madge": "^4.0.0",
191192
"marked": "^2.0.0",
192-
"material-components-web": "11.0.0-canary.f8579b7ea.0",
193193
"merge2": "^1.2.3",
194194
"minimatch": "^3.0.4",
195195
"minimist": "^1.2.0",

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ import {
1616
mixinDisabled,
1717
mixinTabIndex,
1818
} from '@angular/material-experimental/mdc-core';
19-
import {MDCChipTrailingActionAdapter, MDCChipTrailingActionFoundation} from '@material/chips';
19+
import {deprecated} from '@material/chips';
2020
import {Subject} from 'rxjs';
2121

22-
2322
/**
2423
* Injection token that can be used to reference instances of `MatChipAvatar`. It serves as
2524
* alternative token to the actual `MatChipAvatar` class which could cause unnecessary
@@ -73,8 +72,8 @@ export const MAT_CHIP_TRAILING_ICON =
7372
providers: [{provide: MAT_CHIP_TRAILING_ICON, useExisting: MatChipTrailingIcon}],
7473
})
7574
export class MatChipTrailingIcon implements OnDestroy {
76-
private _foundation: MDCChipTrailingActionFoundation;
77-
private _adapter: MDCChipTrailingActionAdapter = {
75+
private _foundation: deprecated.MDCChipTrailingActionFoundation;
76+
private _adapter: deprecated.MDCChipTrailingActionAdapter = {
7877
focus: () => this._elementRef.nativeElement.focus(),
7978
getAttribute: (name: string) =>
8079
this._elementRef.nativeElement.getAttribute(name),
@@ -106,7 +105,7 @@ export class MatChipTrailingIcon implements OnDestroy {
106105
// method is removed, we can't use the chip here, because it causes a
107106
// circular import. private _chip: MatChip
108107
) {
109-
this._foundation = new MDCChipTrailingActionFoundation(this._adapter);
108+
this._foundation = new deprecated.MDCChipTrailingActionFoundation(this._adapter);
110109
}
111110

112111
ngOnDestroy() {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
ViewEncapsulation
2626
} from '@angular/core';
2727
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
28-
import {MDCChipSetFoundation} from '@material/chips';
28+
import {deprecated} from '@material/chips';
2929
import {merge, Observable, Subscription} from 'rxjs';
3030
import {startWith, takeUntil} from 'rxjs/operators';
3131
import {MatChip, MatChipEvent} from './chip';
@@ -211,7 +211,7 @@ export class MatChipListbox extends MatChipSet implements AfterContentInit, Cont
211211
this._setSelected(index, selected);
212212
};
213213
// Reinitialize the foundation with our overridden adapter
214-
this._chipSetFoundation = new MDCChipSetFoundation(this._chipSetAdapter);
214+
this._chipSetFoundation = new deprecated.MDCChipSetFoundation(this._chipSetAdapter);
215215
this._updateMdcSelectionClasses();
216216
}
217217

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
RippleGlobalOptions,
99
} from '@angular/material-experimental/mdc-core';
1010
import {By} from '@angular/platform-browser';
11-
import {chipCssClasses} from '@material/chips';
11+
import {deprecated} from '@material/chips';
1212
import {Subject} from 'rxjs';
1313
import {
1414
MatChipEvent,
@@ -307,7 +307,7 @@ describe('MDC-based Option Chips', () => {
307307
chipInstance = chipDebugElement.injector.get<MatChipOption>(MatChipOption);
308308

309309
const avatar = fixture.nativeElement.querySelector('.avatar');
310-
expect(avatar.classList).toContain(chipCssClasses.HIDDEN_LEADING_ICON);
310+
expect(avatar.classList).toContain(deprecated.chipCssClasses.HIDDEN_LEADING_ICON);
311311
});
312312

313313
it('should have a focus indicator', () => {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
ViewEncapsulation,
1818
AfterContentInit
1919
} from '@angular/core';
20-
import {chipCssClasses} from '@material/chips';
20+
import {deprecated} from '@material/chips';
2121
import {take} from 'rxjs/operators';
2222
import {MatChip} from './chip';
2323

@@ -123,7 +123,7 @@ export class MatChipOption extends MatChip implements AfterContentInit {
123123
super.ngAfterContentInit();
124124

125125
if (this.selected && this.leadingIcon) {
126-
this.leadingIcon.setClass(chipCssClasses.HIDDEN_LEADING_ICON, true);
126+
this.leadingIcon.setClass(deprecated.chipCssClasses.HIDDEN_LEADING_ICON, true);
127127
}
128128
}
129129

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
ViewEncapsulation
2424
} from '@angular/core';
2525
import {HasTabIndex, HasTabIndexCtor, mixinTabIndex} from '@angular/material-experimental/mdc-core';
26-
import {MDCChipSetAdapter, MDCChipSetFoundation} from '@material/chips';
26+
import {deprecated} from '@material/chips';
2727
import {merge, Observable, Subject, Subscription} from 'rxjs';
2828
import {startWith, takeUntil} from 'rxjs/operators';
2929
import {MatChip, MatChipEvent} from './chip';
@@ -81,7 +81,7 @@ export class MatChipSet extends _MatChipSetMixinBase implements AfterContentInit
8181
protected _lastDestroyedChipIndex: number | null = null;
8282

8383
/** The MDC foundation containing business logic for MDC chip-set. */
84-
protected _chipSetFoundation: MDCChipSetFoundation;
84+
protected _chipSetFoundation: deprecated.MDCChipSetFoundation;
8585

8686
/** Subject that emits when the component has been destroyed. */
8787
protected _destroyed = new Subject<void>();
@@ -90,7 +90,7 @@ export class MatChipSet extends _MatChipSetMixinBase implements AfterContentInit
9090
* Implementation of the MDC chip-set adapter interface.
9191
* These methods are called by the chip set foundation.
9292
*/
93-
protected _chipSetAdapter: MDCChipSetAdapter = {
93+
protected _chipSetAdapter: deprecated.MDCChipSetAdapter = {
9494
hasClass: (className) => this._hasMdcClass(className),
9595
// No-op. We keep track of chips via ContentChildren, which will be updated when a chip is
9696
// removed.
@@ -175,7 +175,7 @@ export class MatChipSet extends _MatChipSetMixinBase implements AfterContentInit
175175
protected _changeDetectorRef: ChangeDetectorRef,
176176
@Optional() protected _dir: Directionality) {
177177
super(_elementRef);
178-
this._chipSetFoundation = new MDCChipSetFoundation(this._chipSetAdapter);
178+
this._chipSetFoundation = new deprecated.MDCChipSetFoundation(this._chipSetAdapter);
179179
}
180180

181181
ngAfterViewInit() {

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import {
4444
RippleAnimationConfig,
4545
RippleGlobalOptions,
4646
} from '@angular/material-experimental/mdc-core';
47-
import {MDCChipAdapter, MDCChipFoundation} from '@material/chips';
47+
import {deprecated} from '@material/chips';
4848
import {numbers} from '@material/ripple';
4949
import {SPACE, ENTER, hasModifierKey} from '@angular/cdk/keycodes';
5050
import {Subject} from 'rxjs';
@@ -223,7 +223,7 @@ export class MatChip extends _MatChipMixinBase implements AfterContentInit, Afte
223223
@Output() readonly removed: EventEmitter<MatChipEvent> = new EventEmitter<MatChipEvent>();
224224

225225
/** The MDC foundation containing business logic for MDC chip. */
226-
_chipFoundation: MDCChipFoundation;
226+
_chipFoundation: deprecated.MDCChipFoundation;
227227

228228
/** The unstyled chip selector for this component. */
229229
protected basicChipAttrName = 'mat-basic-chip';
@@ -244,7 +244,7 @@ export class MatChip extends _MatChipMixinBase implements AfterContentInit, Afte
244244
* Implementation of the MDC chip adapter interface.
245245
* These methods are called by the chip foundation.
246246
*/
247-
protected _chipAdapter: MDCChipAdapter = {
247+
protected _chipAdapter: deprecated.MDCChipAdapter = {
248248
addClass: (className) => this._setMdcClass(className, true),
249249
removeClass: (className) => this._setMdcClass(className, false),
250250
hasClass: (className) =>
@@ -343,7 +343,7 @@ export class MatChip extends _MatChipMixinBase implements AfterContentInit, Afte
343343
@Optional() @Inject(MAT_RIPPLE_GLOBAL_OPTIONS)
344344
private _globalRippleOptions?: RippleGlobalOptions) {
345345
super(_elementRef);
346-
this._chipFoundation = new MDCChipFoundation(this._chipAdapter);
346+
this._chipFoundation = new deprecated.MDCChipFoundation(this._chipAdapter);
347347
this._animationsDisabled = animationMode === 'NoopAnimations';
348348
this._isBasicChip = _elementRef.nativeElement.hasAttribute(this.basicChipAttrName) ||
349349
_elementRef.nativeElement.tagName.toLowerCase() === this.basicChipAttrName;

0 commit comments

Comments
 (0)