@angular/material 19.0.0-next.6 → 19.0.0-next.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/chips/index.d.ts CHANGED
@@ -169,6 +169,8 @@ export declare class MatChip implements OnInit, AfterViewInit, AfterContentInit,
169
169
  ariaDescription: string | null;
170
170
  /** Id of a span that contains this chip's aria description. */
171
171
  _ariaDescriptionId: string;
172
+ /** Whether the chip list is disabled. */
173
+ _chipListDisabled: boolean;
172
174
  private _textElement;
173
175
  /**
174
176
  * The value of the chip. Defaults to the content inside
@@ -196,7 +198,9 @@ export declare class MatChip implements OnInit, AfterViewInit, AfterContentInit,
196
198
  /** Whether the ripple effect is disabled or not. */
197
199
  disableRipple: boolean;
198
200
  /** Whether the chip is disabled. */
199
- disabled: boolean;
201
+ get disabled(): boolean;
202
+ set disabled(value: boolean);
203
+ private _disabled;
200
204
  /** Emitted when a chip is to be removed. */
201
205
  readonly removed: EventEmitter<MatChipEvent>;
202
206
  /** Emitted when the chip is destroyed. */
package/core/_core.scss CHANGED
@@ -6,6 +6,13 @@
6
6
 
7
7
  // Mixin that renders all of the core styles that are not theme-dependent.
8
8
  @mixin core() {
9
+ @include cdk.a11y-visually-hidden();
10
+ @include private.structural-styling();
11
+ }
12
+
13
+ // Emits the mat-app-background CSS class. This predefined class sets the
14
+ // background color and text color of an element.
15
+ @mixin app-background() {
9
16
  // TODO: Move ripple styles to be dynamically loaded instead of in core.
10
17
  // This variable is used as a fallback for the ripple element's
11
18
  // background color. However, if it isn't defined anywhere, then MSS
@@ -14,9 +21,6 @@
14
21
  --mat-app-on-surface: initial;
15
22
  }
16
23
 
17
- @include cdk.a11y-visually-hidden();
18
- @include private.structural-styling();
19
-
20
24
  // Wrapper element that provides the theme background when the
21
25
  // user's content isn't inside of a `mat-sidenav-container`.
22
26
  @at-root {
@@ -26,7 +30,17 @@
26
30
  @include token-utils.create-token-slot(background-color, background-color, transparent);
27
31
  @include token-utils.create-token-slot(color, text-color, inherit);
28
32
  }
33
+ }
34
+ }
35
+ }
29
36
 
37
+ // Emits CSS classes for applying elevation. These classes follow the pattern
38
+ // mat-elevation-z#, where # is the elevation number you want, from 0 to 24.
39
+ // These predefined classes use the CSS box-shadow settings defined by the
40
+ // Material Design specification.
41
+ @mixin elevation-classes() {
42
+ @at-root {
43
+ @include token-utils.use-tokens(tokens-mat-app.$prefix, tokens-mat-app.get-token-slots()) {
30
44
  // Provides external CSS classes for each elevation value. Each CSS class is formatted as
31
45
  // `mat-elevation-z$z-value` where `$z-value` corresponds to the z-space to which the element
32
46
  // is elevated.
@@ -42,9 +56,3 @@
42
56
  }
43
57
  }
44
58
  }
45
-
46
- // Mixin that provides the .mat-app-background class.
47
- @mixin app-background() {}
48
-
49
- // Mixin that provides the .mat-elevation-* classes.
50
- @mixin elevation-classes() {}
package/core/index.d.ts CHANGED
@@ -19,6 +19,7 @@ import { OnInit } from '@angular/core';
19
19
  import { Platform } from '@angular/cdk/platform';
20
20
  import { Provider } from '@angular/core';
21
21
  import { QueryList } from '@angular/core';
22
+ import { Signal } from '@angular/core';
22
23
  import { Subject } from 'rxjs';
23
24
  import { Version } from '@angular/core';
24
25
 
@@ -198,6 +199,42 @@ export declare abstract class DateAdapter<D, L = any> {
198
199
  * @returns An invalid date.
199
200
  */
200
201
  abstract invalid(): D;
202
+ /**
203
+ * Sets the time of one date to the time of another.
204
+ * @param target Date whose time will be set.
205
+ * @param hours New hours to set on the date object.
206
+ * @param minutes New minutes to set on the date object.
207
+ * @param seconds New seconds to set on the date object.
208
+ */
209
+ setTime(target: D, hours: number, minutes: number, seconds: number): D;
210
+ /**
211
+ * Gets the hours component of the given date.
212
+ * @param date The date to extract the hours from.
213
+ */
214
+ getHours(date: D): number;
215
+ /**
216
+ * Gets the minutes component of the given date.
217
+ * @param date The date to extract the minutes from.
218
+ */
219
+ getMinutes(date: D): number;
220
+ /**
221
+ * Gets the seconds component of the given date.
222
+ * @param date The date to extract the seconds from.
223
+ */
224
+ getSeconds(date: D): number;
225
+ /**
226
+ * Parses a date with a specific time from a user-provided value.
227
+ * @param value The value to parse.
228
+ * @param parseFormat The expected format of the value being parsed
229
+ * (type is implementation-dependent).
230
+ */
231
+ parseTime(value: any, parseFormat: any): D | null;
232
+ /**
233
+ * Adds an amount of seconds to the specified date.
234
+ * @param date Date to which to add the seconds.
235
+ * @param amount Amount of seconds to add to the date.
236
+ */
237
+ addSeconds(date: D, amount: number): D;
201
238
  /**
202
239
  * Given a potential date object, returns that same date object if it is
203
240
  * a valid date, or `null` if it's not a valid date.
@@ -231,6 +268,14 @@ export declare abstract class DateAdapter<D, L = any> {
231
268
  * a number greater than 0 if the first date is later.
232
269
  */
233
270
  compareDate(first: D, second: D): number;
271
+ /**
272
+ * Compares the time values of two dates.
273
+ * @param first First date to compare.
274
+ * @param second Second date to compare.
275
+ * @returns 0 if the times are equal, a number less than 0 if the first time is earlier,
276
+ * a number greater than 0 if the first time is later.
277
+ */
278
+ compareTime(first: D, second: D): number;
234
279
  /**
235
280
  * Checks if two dates are equal.
236
281
  * @param first The first date to check.
@@ -239,6 +284,14 @@ export declare abstract class DateAdapter<D, L = any> {
239
284
  * Null dates are considered equal to other null dates.
240
285
  */
241
286
  sameDate(first: D | null, second: D | null): boolean;
287
+ /**
288
+ * Checks if the times of two dates are equal.
289
+ * @param first The first date to check.
290
+ * @param second The second date to check.
291
+ * @returns Whether the times of the two dates are equal.
292
+ * Null dates are considered equal to other null dates.
293
+ */
294
+ sameTime(first: D | null, second: D | null): boolean;
242
295
  /**
243
296
  * Clamp the given date between min and max dates.
244
297
  * @param date The date to clamp.
@@ -414,6 +467,7 @@ export declare class MatCommonModule {
414
467
  export declare type MatDateFormats = {
415
468
  parse: {
416
469
  dateInput: any;
470
+ timeInput?: any;
417
471
  };
418
472
  display: {
419
473
  dateInput: any;
@@ -421,6 +475,8 @@ export declare type MatDateFormats = {
421
475
  monthYearLabel: any;
422
476
  dateA11yLabel: any;
423
477
  monthYearA11yLabel: any;
478
+ timeInput?: any;
479
+ timeOptionLabel?: any;
424
480
  };
425
481
  };
426
482
 
@@ -491,6 +547,7 @@ export declare class MatOption<T = any> implements FocusableOption, AfterViewChe
491
547
  _changeDetectorRef: ChangeDetectorRef;
492
548
  private _parent;
493
549
  group: MatOptgroup | null;
550
+ private _signalDisableRipple;
494
551
  private _selected;
495
552
  private _active;
496
553
  private _disabled;
@@ -581,7 +638,7 @@ export declare class MatOptionModule {
581
638
  * @docs-private
582
639
  */
583
640
  export declare interface MatOptionParentComponent {
584
- disableRipple?: boolean;
641
+ disableRipple?: boolean | Signal<boolean>;
585
642
  multiple?: boolean;
586
643
  inertGroups?: boolean;
587
644
  hideSingleSelectionIndicator?: boolean;
@@ -809,6 +866,12 @@ export declare class NativeDateAdapter extends DateAdapter<Date> {
809
866
  isDateInstance(obj: any): obj is Date;
810
867
  isValid(date: Date): boolean;
811
868
  invalid(): Date;
869
+ setTime(target: Date, hours: number, minutes: number, seconds: number): Date;
870
+ getHours(date: Date): number;
871
+ getMinutes(date: Date): number;
872
+ getSeconds(date: Date): number;
873
+ parseTime(userValue: any, parseFormat?: any): Date | null;
874
+ addSeconds(date: Date, amount: number): Date;
812
875
  /** Creates a date but allows the month and date to overflow. */
813
876
  private _createDateWithOverflow;
814
877
  /**
@@ -254,6 +254,13 @@ class MatChip {
254
254
  set value(value) {
255
255
  this._value = value;
256
256
  }
257
+ /** Whether the chip is disabled. */
258
+ get disabled() {
259
+ return this._disabled || this._chipListDisabled;
260
+ }
261
+ set disabled(value) {
262
+ this._disabled = value;
263
+ }
257
264
  constructor() {
258
265
  this._changeDetectorRef = inject(ChangeDetectorRef);
259
266
  this._elementRef = inject(ElementRef);
@@ -285,6 +292,8 @@ class MatChip {
285
292
  this.ariaDescription = null;
286
293
  /** Id of a span that contains this chip's aria description. */
287
294
  this._ariaDescriptionId = `${this.id}-aria-description`;
295
+ /** Whether the chip list is disabled. */
296
+ this._chipListDisabled = false;
288
297
  /**
289
298
  * Determines whether or not the chip displays the remove styling and emits (removed) events.
290
299
  */
@@ -295,8 +304,7 @@ class MatChip {
295
304
  this.highlighted = false;
296
305
  /** Whether the ripple effect is disabled or not. */
297
306
  this.disableRipple = false;
298
- /** Whether the chip is disabled. */
299
- this.disabled = false;
307
+ this._disabled = false;
300
308
  /** Emitted when a chip is to be removed. */
301
309
  this.removed = new EventEmitter();
302
310
  /** Emitted when the chip is destroyed. */
@@ -959,12 +967,10 @@ class MatChipSet {
959
967
  }
960
968
  /** Syncs the chip-set's state with the individual chips. */
961
969
  _syncChipsState() {
962
- if (this._chips) {
963
- this._chips.forEach(chip => {
964
- chip.disabled = this._disabled;
965
- chip._changeDetectorRef.markForCheck();
966
- });
967
- }
970
+ this._chips?.forEach(chip => {
971
+ chip._chipListDisabled = this._disabled;
972
+ chip._changeDetectorRef.markForCheck();
973
+ });
968
974
  }
969
975
  /** Dummy method for subclasses to override. Base chip set cannot be focused. */
970
976
  focus() { }
@@ -989,16 +995,15 @@ class MatChipSet {
989
995
  * it back to the first chip, creating a focus trap, if it user tries to tab away.
990
996
  */
991
997
  _allowFocusEscape() {
992
- if (this.tabIndex !== -1) {
993
- const previousTabIndex = this.tabIndex;
994
- this.tabIndex = -1;
995
- this._changeDetectorRef.markForCheck();
998
+ const previous = this._elementRef.nativeElement.tabIndex;
999
+ if (previous !== -1) {
1000
+ // Set the tabindex directly on the element, instead of going through
1001
+ // the data binding, because we aren't guaranteed that change detection
1002
+ // will run quickly enough to allow focus to escape.
1003
+ this._elementRef.nativeElement.tabIndex = -1;
996
1004
  // Note that this needs to be a `setTimeout`, because a `Promise.resolve`
997
1005
  // doesn't allow enough time for the focus to escape.
998
- setTimeout(() => {
999
- this.tabIndex = previousTabIndex;
1000
- this._changeDetectorRef.markForCheck();
1001
- });
1006
+ setTimeout(() => (this._elementRef.nativeElement.tabIndex = previous));
1002
1007
  }
1003
1008
  }
1004
1009
  /**
@@ -1704,8 +1709,14 @@ class MatChipGrid extends MatChipSet {
1704
1709
  // error if the input does something on focus (e.g. opens an autocomplete).
1705
1710
  Promise.resolve().then(() => this._chipInput.focus());
1706
1711
  }
1707
- else if (this._chips.length && this._keyManager.activeItemIndex !== 0) {
1708
- this._keyManager.setFirstItemActive();
1712
+ else {
1713
+ const activeItem = this._keyManager.activeItem;
1714
+ if (activeItem) {
1715
+ activeItem.focus();
1716
+ }
1717
+ else {
1718
+ this._keyManager.setFirstItemActive();
1719
+ }
1709
1720
  }
1710
1721
  this.stateChanges.next();
1711
1722
  }