Skip to content

Commit

Permalink
Update color input comments to standarize across the components
Browse files Browse the repository at this point in the history
  • Loading branch information
amysorto committed Jun 13, 2024
1 parent 5fa8f67 commit 3f805db
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/material/button/button-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ export class MatButtonBase implements AfterViewInit, OnDestroy {
}

/**
* Theme color palette of the button. This API is supported in M2 themes
* only, it has no effect in M3 themes.
* Theme color of the button. This API is supported in M2 themes only, it has
* no effect in M3 themes.
*
* For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants
* https://material.angular.io/guide/theming#using-component-color-variants.
*/
@Input() color?: string | null;

Expand Down
8 changes: 5 additions & 3 deletions src/material/checkbox/checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,11 @@ export class MatCheckbox
// TODO(crisbeto): this should be a ThemePalette, but some internal apps were abusing
// the lack of type checking previously and assigning random strings.
/**
* Palette color of the checkbox. This API is supported in M2 themes only, it has no effect in M3
* themes. For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants
* Theme color of the checkbox. This API is supported in M2 themes only, it
* has no effect in M3 themes.
*
* For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants.
*/
@Input() color: string | undefined;

Expand Down
8 changes: 5 additions & 3 deletions src/material/chips/chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,11 @@ export class MatChip implements OnInit, AfterViewInit, AfterContentInit, DoCheck

// TODO: should be typed as `ThemePalette` but internal apps pass in arbitrary strings.
/**
* Theme color palette of the chip. This API is supported in M2 themes only, it has no effect in
* M3 themes. For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants
* Theme color of the chip. This API is supported in M2 themes only, it has no
* effect in M3 themes.
*
* For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants.
*/
@Input() color?: string | null;

Expand Down
8 changes: 7 additions & 1 deletion src/material/datepicker/datepicker-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,13 @@ export class MatDatepickerContent<S, D = ExtractDateTypeFromSelection<S>>
/** Reference to the internal calendar component. */
@ViewChild(MatCalendar) _calendar: MatCalendar<D>;

/** Palette color of the internal calendar. */
/**
* Theme color of the internal calendar. This API is supported in M2 themes
* only, it has no effect in M3 themes.
*
* For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants.
*/
@Input() color: ThemePalette;

/** Reference to the datepicker that created the overlay. */
Expand Down
8 changes: 5 additions & 3 deletions src/material/form-field/form-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,11 @@ export class MatFormField
private _hideRequiredMarker = false;

/**
* The color palette for the form field. This API is supported in M2 themes only, it has no
* effect in M3 themes. For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants
* Theme color of the form field. This API is supported in M2 themes only, it
* has no effect in M3 themes.
*
* For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants.
*/
@Input() color: ThemePalette = 'primary';

Expand Down
9 changes: 8 additions & 1 deletion src/material/list/selection-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,14 @@ export class MatSelectionList
@Output() readonly selectionChange: EventEmitter<MatSelectionListChange> =
new EventEmitter<MatSelectionListChange>();

/** Theme color of the selection list. This sets the checkbox color for all list options. */
/**
* Theme color of the selection list. This sets the checkbox color for all
* list options. This API is supported in M2 themes only, it has no effect in
* M3 themes.
*
* For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants.
*/
@Input() color: ThemePalette = 'accent';

/**
Expand Down
8 changes: 7 additions & 1 deletion src/material/paginator/paginator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,13 @@ export class MatPaginator implements OnInit, OnDestroy {
private _isInitialized = false;
private _initializedStream = new ReplaySubject<void>(1);

/** Theme color to be used for the underlying form controls. */
/**
* Theme color of the underlying form controls. This API is supported in M2
* themes only,it has no effect in M3 themes.
*
* For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants.
*/
@Input() color: ThemePalette;

/** The zero-based page index of the displayed list of items. Defaulted to 0. */
Expand Down
8 changes: 7 additions & 1 deletion src/material/radio/radio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,13 @@ export class MatRadioGroup implements AfterContentInit, OnDestroy, ControlValueA
@ContentChildren(forwardRef(() => MatRadioButton), {descendants: true})
_radios: QueryList<MatRadioButton>;

/** Theme color for all of the radio buttons in the group. */
/**
* Theme color of the radio buttons in the group. This API is supported in M2
* themes only, it has no effect in M3 themes.
*
* For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants.
*/
@Input() color: ThemePalette;

/** Name of the radio button group. All radio buttons inside this group will use this name. */
Expand Down
8 changes: 7 additions & 1 deletion src/material/slide-toggle/slide-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,13 @@ export class MatSlideToggle

// TODO(crisbeto): this should be a ThemePalette, but some internal apps were abusing
// the lack of type checking previously and assigning random strings.
/** Palette color of slide toggle. */
/**
* Theme color of the slide toggle. This API is supported in M2 themes only,
* it has no effect in M3 themes.
*
* For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants.
*/
@Input() color: string | undefined;

/** Whether the slide toggle is disabled. */
Expand Down
8 changes: 7 additions & 1 deletion src/material/stepper/step-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@ export class MatStepHeader extends CdkStepHeader implements AfterViewInit, OnDes
/** Whether the ripple should be disabled. */
@Input() disableRipple: boolean;

/** Theme palette color of the step header. */
/**
* Theme color of the step header. This API is supported in M2 themes only, it
* has no effect in M3 themes.
*
* For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants.
*/
@Input() color: ThemePalette;

constructor(
Expand Down
15 changes: 13 additions & 2 deletions src/material/stepper/stepper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ export class MatStep extends CdkStep implements ErrorStateMatcher, AfterContentI
// We need an initializer here to avoid a TS error.
@ContentChild(MatStepLabel) override stepLabel: MatStepLabel = undefined!;

/** Theme color for the particular step. */
/**
* Theme color for the particular step. This API is supported in M2 themes
* only, it has no effect in M3 themes.
*
* For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants.
*/
@Input() color: ThemePalette;

/** Content that will be rendered lazily. */
Expand Down Expand Up @@ -180,7 +186,12 @@ export class MatStepper extends CdkStepper implements AfterContentInit {
/** Whether ripples should be disabled for the step headers. */
@Input() disableRipple: boolean;

/** Theme color for all of the steps in stepper. */
/** Theme color for all of the steps in stepper. This API is supported in M2
* themes only, it has no effect in M3 themes.
*
* For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants.
*/
@Input() color: ThemePalette;

/**
Expand Down
8 changes: 7 additions & 1 deletion src/material/tabs/tab-nav-bar/tab-nav-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,13 @@ export class MatTabNav
@Input({transform: booleanAttribute})
disableRipple: boolean = false;

/** Theme color of the nav bar. */
/**
* Theme color of the nav bar. This API is supported in M2 themes only, it has
* no effect in M3 themes.
*
* For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants.
*/
@Input() color: ThemePalette = 'primary';

/**
Expand Down
8 changes: 7 additions & 1 deletion src/material/toolbar/toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ export class MatToolbarRow {}
})
export class MatToolbar implements AfterViewInit {
// TODO: should be typed as `ThemePalette` but internal apps pass in arbitrary strings.
/** Palette color of the toolbar. */
/**
* Theme color of the toolbar. This API is supported in M2 themes only, it has
* no effect in M3 themes.
*
* For information on applying color variants in M3, see
* https://material.angular.io/guide/theming#using-component-color-variants.
*/
@Input() color?: string | null;

private _document: Document;
Expand Down

0 comments on commit 3f805db

Please sign in to comment.