1
- import { booleanAttribute , Component , HostBinding , Input } from '@angular/core' ;
1
+ import { booleanAttribute , Component , HostBinding , input , InputSignal , InputSignalWithTransform } from '@angular/core' ;
2
2
import { NgClass } from '@angular/common' ;
3
3
4
- import { Colors , TextColors } from '../../coreui.types' ;
5
4
import { CardBodyComponent , CardComponent } from '../../card' ;
6
5
7
6
@Component ( {
@@ -12,51 +11,54 @@ import { CardBodyComponent, CardComponent } from '../../card';
12
11
imports : [ CardBodyComponent , NgClass ]
13
12
} )
14
13
export class WidgetStatBComponent extends CardComponent {
15
-
16
14
constructor ( ) {
17
15
super ( ) ;
18
16
}
19
17
20
18
/**
21
- * Sets the color context of the component to one of CoreUI’s themed colors.
19
+ * Sets the color context of the component to one of CoreUI themed colors.
22
20
* @type Colors
23
21
*/
24
- @Input ( ) override color ?: Colors ;
22
+ // override readonly color: InputSignal<Colors | undefined> = input();
23
+
25
24
/**
26
- * Sets the text-color context of the component to one of CoreUI’s themed colors.
27
- * @type Colors
25
+ * Sets the text-color context of the component to one of CoreUI themed colors.
26
+ * via TextColorDirective
27
+ * @type TextColors
28
28
*/
29
- @Input ( ) override textColor ?: TextColors ;
29
+ // override readonly textColor: InputSignal<TextColors | undefined> = input();
30
+
30
31
/**
31
32
* Title of the widget to display
32
33
* @type string
33
34
*/
34
- @Input ( ) title ?: string ;
35
+ readonly title : InputSignal < string | undefined > = input ( ) ;
36
+
35
37
/**
36
38
* Helper text for your widget.
37
39
* @type string
38
40
*/
39
- @Input ( ) text ?: string ;
41
+ readonly text : InputSignal < string | undefined > = input ( ) ;
42
+
40
43
/**
41
44
* Value for your widget to display
42
45
* @type string
43
46
*/
44
- @ Input ( ) value ?: string ;
47
+ readonly value : InputSignal < string | undefined > = input ( ) ;
45
48
46
49
/**
47
50
* Invert colors from their default dark shade.
48
51
* @type boolean
49
52
*/
50
- @ Input ( { transform : booleanAttribute } ) inverse : string | boolean = false ;
53
+ readonly inverse : InputSignalWithTransform < boolean , unknown > = input ( false , { transform : booleanAttribute } ) ;
51
54
52
55
@HostBinding ( 'class' )
53
56
override get hostClasses ( ) {
54
57
return {
55
- ' card' : true ,
56
- [ `bg-${ this . color } ` ] : ! ! this . color ,
57
- [ `text-${ this . textColor } ` ] : ! ! this . textColor ,
58
- 'text-white' : ! ! this . inverse
58
+ card : true ,
59
+ [ `bg-${ this . color ( ) } ` ] : ! ! this . color ( ) ,
60
+ [ `text-${ this . textColor ( ) } ` ] : ! ! this . textColor ( ) ,
61
+ 'text-white' : this . inverse ( )
59
62
} ;
60
63
}
61
-
62
64
}
0 commit comments