1- import { booleanAttribute , Component , HostBinding , Input } from '@angular/core' ;
1+ import { booleanAttribute , Component , computed , input , InputSignal , InputSignalWithTransform } from '@angular/core' ;
22
33import { IContainer } from './container.type' ;
44import { Breakpoints } from '../coreui.types' ;
@@ -7,27 +7,30 @@ import { Breakpoints } from '../coreui.types';
77 selector : 'c-container, [cContainer]' ,
88 template : '<ng-content />' ,
99 styleUrls : [ './container.component.scss' ] ,
10- standalone : true
10+ standalone : true ,
11+ host : { '[class]' : 'hostClasses()' }
1112} )
1213export class ContainerComponent implements IContainer {
13-
1414 /**
1515 * Set container 100% wide until a breakpoint.
1616 */
17- @ Input ( ) breakpoint : Exclude < Breakpoints , 'xs' > = '' ;
17+ readonly breakpoint : InputSignal < Exclude < Breakpoints , 'xs' > > = input < Exclude < Breakpoints , 'xs' > > ( '' ) ;
1818
1919 /**
2020 * Set container 100% wide, spanning the entire width of the viewport.
21- * @type boolean | string
21+ * @type InputSignalWithTransform<unknown, boolean>
2222 */
23- @Input ( { transform : booleanAttribute } ) fluid : string | boolean = false ;
23+ readonly fluid : InputSignalWithTransform < unknown , boolean > = input < unknown , boolean > ( false , {
24+ transform : booleanAttribute
25+ } ) ;
2426
25- @HostBinding ( 'class' )
26- get hostClasses ( ) : any {
27+ readonly hostClasses = computed ( ( ) => {
28+ const breakpoint = this . breakpoint ( ) ;
29+ const fluid = this . fluid ( ) ;
2730 return {
28- container : ! this . fluid && ! this . breakpoint ,
29- 'container-fluid' : ! ! this . fluid ,
30- [ `container-${ this . breakpoint } ` ] : ! ! this . breakpoint
31- } ;
32- }
31+ container : ! fluid && ! breakpoint ,
32+ 'container-fluid' : ! ! fluid ,
33+ [ `container-${ breakpoint } ` ] : ! ! breakpoint
34+ } as Record < string , boolean > ;
35+ } ) ;
3336}
0 commit comments