Skip to content

Commit

Permalink
fix(material/legacy-chips): deprecate all ts symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalerba committed Sep 7, 2022
1 parent ab22cab commit 2cadc90
Show file tree
Hide file tree
Showing 16 changed files with 164 additions and 51 deletions.
12 changes: 10 additions & 2 deletions src/material/legacy-chips/chip-default-options.ts
Expand Up @@ -8,13 +8,21 @@

import {InjectionToken} from '@angular/core';

/** Default options, for the chips module, that can be overridden. */
/**
* Default options, for the chips module, that can be overridden.
* @deprecated Use `MatChipsDefaultOptions` from `@angular/material/chips` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface MatLegacyChipsDefaultOptions {
/** The list of key codes that will trigger a chipEnd event. */
separatorKeyCodes: readonly number[] | ReadonlySet<number>;
}

/** Injection token to be used to override the default options for the chips module. */
/**
* Injection token to be used to override the default options for the chips module.
* @deprecated Use `MAT_CHIPS_DEFAULT_OPTIONS` from `@angular/material/chips` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export const MAT_LEGACY_CHIPS_DEFAULT_OPTIONS = new InjectionToken<MatLegacyChipsDefaultOptions>(
'mat-chips-default-options',
);
8 changes: 7 additions & 1 deletion src/material/legacy-chips/chip-input.ts
Expand Up @@ -26,7 +26,11 @@ import {
import {MatLegacyChipList} from './chip-list';
import {MatLegacyChipTextControl} from './chip-text-control';

/** Represents an input event on a `matChipInput`. */
/**
* Represents an input event on a `matChipInput`.
* @deprecated Use `MatChipInputEvent` from `@angular/material/chips` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface MatLegacyChipInputEvent {
/**
* The native `<input>` element that the event is being fired for.
Expand All @@ -48,6 +52,8 @@ let nextUniqueId = 0;
/**
* Directive that adds chip-specific behaviors to an input element inside `<mat-form-field>`.
* May be placed inside or outside of an `<mat-chip-list>`.
* @deprecated Use `MatChipInput` from `@angular/material/chips` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Directive({
selector: 'input[matChipInputFor]',
Expand Down
8 changes: 7 additions & 1 deletion src/material/legacy-chips/chip-list.ts
Expand Up @@ -70,7 +70,11 @@ const _MatChipListBase = mixinErrorState(
// Increasing integer for generating unique ids for chip-list components.
let nextUniqueId = 0;

/** Change event object that is emitted when the chip list value has changed. */
/**
* Change event object that is emitted when the chip list value has changed.
* @deprecated Use `MatChipListChange` from `@angular/material/chips` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacyChipListChange {
constructor(
/** Chip list that emitted the event. */
Expand All @@ -82,6 +86,8 @@ export class MatLegacyChipListChange {

/**
* A material design chips component (named ChipList for its similarity to the List component).
* @deprecated Use `MatChipList` from `@angular/material/chips` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Component({
selector: 'mat-chip-list',
Expand Down
6 changes: 5 additions & 1 deletion src/material/legacy-chips/chip-text-control.ts
Expand Up @@ -6,7 +6,11 @@
* found in the LICENSE file at https://angular.io/license
*/

/** Interface for a text control that is used to drive interaction with a mat-chip-list. */
/**
* Interface for a text control that is used to drive interaction with a mat-chip-list.
* @deprecated Use `MatChipTextControl` from `@angular/material/chips` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface MatLegacyChipTextControl {
/** Unique identifier for the text control. */
id: string;
Expand Down
31 changes: 28 additions & 3 deletions src/material/legacy-chips/chip.ts
Expand Up @@ -44,13 +44,21 @@ import {ANIMATION_MODULE_TYPE} from '@angular/platform-browser/animations';
import {Subject} from 'rxjs';
import {take} from 'rxjs/operators';

/** Represents an event fired on an individual `mat-chip`. */
/**
* Represents an event fired on an individual `mat-chip`.
* @deprecated Use `MatChipEvent` from `@angular/material/chips` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface MatLegacyChipEvent {
/** The chip the event was fired on. */
chip: MatLegacyChip;
}

/** Event object emitted by MatChip when selected or deselected. */
/**
* Event object emitted by MatChip when selected or deselected.
* @deprecated Use `MatChipSelectionChange` from `@angular/material/chips` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacyChipSelectionChange {
constructor(
/** Reference to the chip that emitted the event. */
Expand All @@ -66,20 +74,26 @@ export class MatLegacyChipSelectionChange {
* Injection token that can be used to reference instances of `MatChipRemove`. It serves as
* alternative token to the actual `MatChipRemove` class which could cause unnecessary
* retention of the class and its directive metadata.
* @deprecated Use `MAT_CHIP_REMOVE` from `@angular/material/chips` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export const MAT_LEGACY_CHIP_REMOVE = new InjectionToken<MatLegacyChipRemove>('MatChipRemove');

/**
* Injection token that can be used to reference instances of `MatChipAvatar`. It serves as
* alternative token to the actual `MatChipAvatar` class which could cause unnecessary
* retention of the class and its directive metadata.
* @deprecated Use `MAT_CHIP_AVATAR` from `@angular/material/chips` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export const MAT_LEGACY_CHIP_AVATAR = new InjectionToken<MatLegacyChipAvatar>('MatChipAvatar');

/**
* Injection token that can be used to reference instances of `MatChipTrailingIcon`. It serves as
* alternative token to the actual `MatChipTrailingIcon` class which could cause unnecessary
* retention of the class and its directive metadata.
* @deprecated Use `MAT_CHIP_TRAILING_ICON` from `@angular/material/chips` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export const MAT_LEGACY_CHIP_TRAILING_ICON = new InjectionToken<MatLegacyChipTrailingIcon>(
'MatChipTrailingIcon',
Expand All @@ -97,6 +111,8 @@ const _MatChipMixinBase = mixinTabIndex(mixinColor(mixinDisableRipple(MatChipBas
/**
* Dummy directive to add CSS class to chip avatar.
* @docs-private
* @deprecated Use `MatChipAvatar` from `@angular/material/chips` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Directive({
selector: 'mat-chip-avatar, [matChipAvatar]',
Expand All @@ -108,6 +124,8 @@ export class MatLegacyChipAvatar {}
/**
* Dummy directive to add CSS class to chip trailing icon.
* @docs-private
* @deprecated Use `MatChipTrailingIcon` from `@angular/material/chips` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Directive({
selector: 'mat-chip-trailing-icon, [matChipTrailingIcon]',
Expand All @@ -116,7 +134,11 @@ export class MatLegacyChipAvatar {}
})
export class MatLegacyChipTrailingIcon {}

/** Material Design styled chip directive. Used inside the MatChipList component. */
/**
* Material Design styled chip directive. Used inside the MatChipList component.
* @deprecated Use `MatChip` from `@angular/material/chips` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Directive({
selector: `mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]`,
inputs: ['color', 'disableRipple', 'tabIndex'],
Expand Down Expand Up @@ -470,6 +492,9 @@ export class MatLegacyChip
*
* You *may* use a custom icon, but you may need to override the `mat-chip-remove` positioning
* styles to properly center the icon within the chip.
*
* @deprecated Use `MatChipRemove` from `@angular/material/chips` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Directive({
selector: '[matChipRemove]',
Expand Down
4 changes: 4 additions & 0 deletions src/material/legacy-chips/chips-module.ts
Expand Up @@ -31,6 +31,10 @@ const CHIP_DECLARATIONS = [
MatLegacyChipTrailingIcon,
];

/**
* @deprecated Use `MatChipsModule` from `@angular/material/chips` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@NgModule({
imports: [MatCommonModule],
exports: CHIP_DECLARATIONS,
Expand Down
6 changes: 5 additions & 1 deletion src/material/legacy-chips/testing/chip-avatar-harness.ts
Expand Up @@ -9,7 +9,11 @@
import {HarnessPredicate, ComponentHarness} from '@angular/cdk/testing';
import {LegacyChipAvatarHarnessFilters} from './chip-harness-filters';

/** Harness for interacting with a standard Material chip avatar in tests. */
/**
* Harness for interacting with a standard Material chip avatar in tests.
* @deprecated Use `MatChipAvatarHarness` from `@angular/material/chips/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacyChipAvatarHarness extends ComponentHarness {
static hostSelector = '.mat-chip-avatar';

Expand Down
42 changes: 35 additions & 7 deletions src/material/legacy-chips/testing/chip-harness-filters.ts
Expand Up @@ -7,7 +7,11 @@
*/
import {BaseHarnessFilters} from '@angular/cdk/testing';

/** A set of criteria that can be used to filter a list of chip instances. */
/**
* A set of criteria that can be used to filter a list of chip instances.
* @deprecated Use `ChipHarnessFilters` from `@angular/material/chips/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface LegacyChipHarnessFilters extends BaseHarnessFilters {
/** Only find instances whose text matches the given value. */
text?: string | RegExp;
Expand All @@ -19,28 +23,52 @@ export interface LegacyChipHarnessFilters extends BaseHarnessFilters {
selected?: boolean;
}

/** A set of criteria that can be used to filter a list of selectable chip instances. */
/**
* A set of criteria that can be used to filter a list of selectable chip instances.
* @deprecated Use `ChipOptionHarnessFilters` from `@angular/material/chips/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface LegacyChipOptionHarnessFilters extends LegacyChipHarnessFilters {
/** Only find chip instances whose selected state matches the given value. */
selected?: boolean;
}

/** A set of criteria that can be used to filter chip list instances. */
/**
* A set of criteria that can be used to filter chip list instances.
* @deprecated Use `ChipListHarnessFilters` from `@angular/material/chips/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface LegacyChipListHarnessFilters extends BaseHarnessFilters {}

/** A set of criteria that can be used to filter selectable chip list instances. */
/**
* A set of criteria that can be used to filter selectable chip list instances.
* @deprecated Use `ChipListboxHarnessFilters` from `@angular/material/chips/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface LegacyChipListboxHarnessFilters extends BaseHarnessFilters {}

/** A set of criteria that can be used to filter a list of `MatChipListInputHarness` instances. */
/**
* A set of criteria that can be used to filter a list of `MatChipListInputHarness` instances.
* @deprecated Use `ChipInputHarnessFilters` from `@angular/material/chips/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface LegacyChipInputHarnessFilters extends BaseHarnessFilters {
/** Filters based on the value of the input. */
value?: string | RegExp;
/** Filters based on the placeholder text of the input. */
placeholder?: string | RegExp;
}

/** A set of criteria that can be used to filter a list of `MatChipRemoveHarness` instances. */
/**
* A set of criteria that can be used to filter a list of `MatChipRemoveHarness` instances.
* @deprecated Use `ChipRemoveHarnessFilters` from `@angular/material/chips/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface LegacyChipRemoveHarnessFilters extends BaseHarnessFilters {}

/** A set of criteria that can be used to filter a list of `MatChipAvatarHarness` instances. */
/**
* A set of criteria that can be used to filter a list of `MatChipAvatarHarness` instances.
* @deprecated Use `ChipAvatarHarnessFilters` from `@angular/material/chips/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface LegacyChipAvatarHarnessFilters extends BaseHarnessFilters {}
6 changes: 5 additions & 1 deletion src/material/legacy-chips/testing/chip-harness.ts
Expand Up @@ -15,7 +15,11 @@ import {
} from './chip-harness-filters';
import {MatLegacyChipRemoveHarness} from './chip-remove-harness';

/** Harness for interacting with a standard selectable Angular Material chip in tests. */
/**
* Harness for interacting with a standard selectable Angular Material chip in tests.
* @deprecated Use `MatChipHarness` from `@angular/material/chips/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacyChipHarness extends ContentContainerComponentHarness {
/** The selector for the host element of a `MatChip` instance. */
static hostSelector = '.mat-chip';
Expand Down
6 changes: 5 additions & 1 deletion src/material/legacy-chips/testing/chip-input-harness.ts
Expand Up @@ -9,7 +9,11 @@
import {HarnessPredicate, ComponentHarness, TestKey} from '@angular/cdk/testing';
import {LegacyChipInputHarnessFilters} from './chip-harness-filters';

/** Harness for interacting with a standard Material chip inputs in tests. */
/**
* Harness for interacting with a standard Material chip inputs in tests.
* @deprecated Use `MatChipInputHarness` from `@angular/material/chips/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacyChipInputHarness extends ComponentHarness {
static hostSelector = '.mat-chip-input';

Expand Down
12 changes: 10 additions & 2 deletions src/material/legacy-chips/testing/chip-list-harness.ts
Expand Up @@ -15,7 +15,11 @@ import {
LegacyChipInputHarnessFilters,
} from './chip-harness-filters';

/** Base class for chip list harnesses. */
/**
* Base class for chip list harnesses.
* @deprecated Use `class` from `@angular/material/chips/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export abstract class _MatChipListHarnessBase extends ComponentHarness {
/** Gets whether the chip list is disabled. */
async isDisabled(): Promise<boolean> {
Expand Down Expand Up @@ -44,7 +48,11 @@ export abstract class _MatChipListHarnessBase extends ComponentHarness {
}
}

/** Harness for interacting with a standard chip list in tests. */
/**
* Harness for interacting with a standard chip list in tests.
* @deprecated Use `MatChipListHarness` from `@angular/material/chips/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacyChipListHarness extends _MatChipListHarnessBase {
/** The selector for the host element of a `MatChipList` instance. */
static hostSelector = '.mat-chip-list';
Expand Down
6 changes: 5 additions & 1 deletion src/material/legacy-chips/testing/chip-listbox-harness.ts
Expand Up @@ -14,7 +14,11 @@ import {
} from './chip-harness-filters';
import {_MatChipListHarnessBase} from './chip-list-harness';

/** Harness for interacting with a standard selectable chip list in tests. */
/**
* Harness for interacting with a standard selectable chip list in tests.
* @deprecated Use `MatChipListboxHarness` from `@angular/material/chips/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacyChipListboxHarness extends _MatChipListHarnessBase {
/** The selector for the host element of a `MatChipList` instance. */
static hostSelector = '.mat-chip-list';
Expand Down
4 changes: 4 additions & 0 deletions src/material/legacy-chips/testing/chip-option-harness.ts
Expand Up @@ -10,6 +10,10 @@ import {HarnessPredicate} from '@angular/cdk/testing';
import {MatLegacyChipHarness} from './chip-harness';
import {LegacyChipOptionHarnessFilters} from './chip-harness-filters';

/**
* @deprecated Use `MatChipOptionHarness` from `@angular/material/chips/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacyChipOptionHarness extends MatLegacyChipHarness {
/** The selector for the host element of a selectable chip instance. */
static override hostSelector = '.mat-chip';
Expand Down
6 changes: 5 additions & 1 deletion src/material/legacy-chips/testing/chip-remove-harness.ts
Expand Up @@ -9,7 +9,11 @@
import {HarnessPredicate, ComponentHarness} from '@angular/cdk/testing';
import {LegacyChipRemoveHarnessFilters} from './chip-harness-filters';

/** Harness for interacting with a standard Material chip remove button in tests. */
/**
* Harness for interacting with a standard Material chip remove button in tests.
* @deprecated Use `MatChipRemoveHarness` from `@angular/material/chips/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacyChipRemoveHarness extends ComponentHarness {
static hostSelector = '.mat-chip-remove';

Expand Down

0 comments on commit 2cadc90

Please sign in to comment.