@@ -3,20 +3,19 @@ import {
33 ElementRef ,
44 HostBinding ,
55 Input ,
6- OnInit ,
76 Renderer2
87} from "@angular/core" ;
98
109@Directive ( {
1110 selector : "[cdsStack], [ibmStack]"
1211} )
13- export class StackDirective implements OnInit {
12+ export class StackDirective {
1413 @HostBinding ( "class.cds--stack-horizontal" ) get isHorizontal ( ) {
1514 return this . cdsStack === "horizontal" ;
1615 }
1716
1817 @HostBinding ( "class.cds--stack-vertical" ) get isVertical ( ) {
19- return this . cdsStack === "vertical" ;
18+ return this . cdsStack === "vertical" || ! this . cdsStack ;
2019 }
2120
2221 /**
@@ -28,8 +27,11 @@ export class StackDirective implements OnInit {
2827
2928 /**
3029 * Orientation of the items in the stack, defaults to `vertical`
30+ * Empty string is equivalent to "vertical"
31+ *
32+ * Empty string has been added as an option for Angular 16+ to resolve type errors
3133 */
32- @Input ( ) cdsStack : "vertical" | "horizontal" = "vertical" ;
34+ @Input ( ) cdsStack : "vertical" | "horizontal" | "" = "vertical" ;
3335
3436 /**
3537 * Gap in the layout, provide a custom value (string) or a step from the spacing scale (number)
@@ -44,15 +46,5 @@ export class StackDirective implements OnInit {
4446 // Used to track previous value of gap so we can dynamically remove class
4547 private _gap ;
4648
47- constructor ( private render : Renderer2 , private hostElement : ElementRef ) { }
48-
49- /**
50- * We need to make sure cdsStack is not an empty string since
51- * input name matches selector name.
52- */
53- ngOnInit ( ) : void {
54- if ( ! this . cdsStack ) {
55- this . cdsStack = "vertical" ;
56- }
57- }
49+ constructor ( private render : Renderer2 , private hostElement : ElementRef ) { }
5850}
0 commit comments