|
6 | 6 | * found in the LICENSE file at https://angular.dev/license
|
7 | 7 | */
|
8 | 8 |
|
9 |
| -import {FocusableOption, FocusKeyManager} from '@angular/cdk/a11y'; |
| 9 | +import {_IdGenerator, FocusableOption, FocusKeyManager} from '@angular/cdk/a11y'; |
10 | 10 | import {Direction, Directionality} from '@angular/cdk/bidi';
|
11 | 11 | import {ENTER, hasModifierKey, SPACE} from '@angular/cdk/keycodes';
|
12 | 12 | import {
|
@@ -46,9 +46,6 @@ import {startWith, takeUntil} from 'rxjs/operators';
|
46 | 46 | import {CdkStepHeader} from './step-header';
|
47 | 47 | import {CdkStepLabel} from './step-label';
|
48 | 48 |
|
49 |
| -/** Used to generate unique ID for each stepper component. */ |
50 |
| -let nextId = 0; |
51 |
| - |
52 | 49 | /**
|
53 | 50 | * Position state of the content of each step in stepper that is used for transitioning
|
54 | 51 | * the content into correct position upon step selection change.
|
@@ -324,7 +321,7 @@ export class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy {
|
324 | 321 | @Output() readonly selectedIndexChange: EventEmitter<number> = new EventEmitter<number>();
|
325 | 322 |
|
326 | 323 | /** Used to track unique ID for each stepper component. */
|
327 |
| - _groupId = nextId++; |
| 324 | + private _groupId = inject(_IdGenerator).getId('cdk-stepper-'); |
328 | 325 |
|
329 | 326 | /** Orientation of the stepper. */
|
330 | 327 | @Input()
|
@@ -434,12 +431,12 @@ export class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy {
|
434 | 431 |
|
435 | 432 | /** Returns a unique id for each step label element. */
|
436 | 433 | _getStepLabelId(i: number): string {
|
437 |
| - return `cdk-step-label-${this._groupId}-${i}`; |
| 434 | + return `${this._groupId}-label-${i}`; |
438 | 435 | }
|
439 | 436 |
|
440 | 437 | /** Returns unique id for each step content element. */
|
441 | 438 | _getStepContentId(i: number): string {
|
442 |
| - return `cdk-step-content-${this._groupId}-${i}`; |
| 439 | + return `${this._groupId}-content-${i}`; |
443 | 440 | }
|
444 | 441 |
|
445 | 442 | /** Marks the component to be change detected. */
|
|
0 commit comments