@@ -6,9 +6,10 @@ import {
6
6
inject ,
7
7
input ,
8
8
InputSignal ,
9
- InputSignalWithTransform
9
+ InputSignalWithTransform ,
10
+ numberAttribute
10
11
} from '@angular/core' ;
11
- import { Colors } from '../coreui.types' ;
12
+ import { BooleanInput , Colors } from '../coreui.types' ;
12
13
13
14
@Directive ( {
14
15
selector :'[cListGroupItem], c-list-group-item' ,
@@ -22,13 +23,16 @@ import { Colors } from '../coreui.types';
22
23
}
23
24
} )
24
25
export class ListGroupItemDirective {
26
+ static ngAcceptInputType_active :BooleanInput ;
27
+ static ngAcceptInputType_disabled :BooleanInput ;
28
+
25
29
readonly hostElement = inject ( ElementRef ) ;
26
30
27
31
/**
28
32
* Toggle the active state for the component.
29
- *@type InputSignal <boolean | undefined >
33
+ *@type InputSignalWithTransform <boolean, unknown >
30
34
*/
31
- readonly active :InputSignal < boolean | undefined > = input ( ) ;
35
+ readonly active :InputSignalWithTransform < boolean , unknown > = input ( false , { transform : booleanAttribute } ) ;
32
36
33
37
/**
34
38
* Sets the color context of the component to one of CoreUI’s themed colors.
@@ -42,12 +46,17 @@ export class ListGroupItemDirective {
42
46
*/
43
47
readonly disabled :InputSignalWithTransform < boolean , unknown > = input ( false , { transform :booleanAttribute } ) ;
44
48
49
+ /**
50
+ * The tabindex attribute specifies the tab order of an element (when the "tab" button is used for navigating).
51
+ */
52
+ readonly tabindex = input ( undefined , { transform :numberAttribute } ) ;
53
+
45
54
readonly hostClasses = computed ( ( ) => {
46
55
const host :HTMLElement = this . hostElement . nativeElement ;
47
56
return {
48
57
'list-group-item' :true ,
49
58
'list-group-item-action' :host . nodeName === 'A' || host . nodeName === 'BUTTON' ,
50
- active :! ! this . active ( ) ,
59
+ active :this . active ( ) ,
51
60
disabled :this . _disabled ( ) ,
52
61
[ `list-group-item-${ this . color ( ) } ` ] :! ! this . color ( )
53
62
} as Record < string , boolean > ;
@@ -64,10 +73,10 @@ export class ListGroupItemDirective {
64
73
} ) ;
65
74
66
75
readonly tabIndex = computed ( ( ) => {
67
- return this . _disabled ( ) ?'-1' :null ;
76
+ return this . _disabled ( ) ?'-1' :( this . tabindex ( ) ?? null ) ;
68
77
} ) ;
69
78
70
79
readonly ariaCurrent = computed ( ( ) => {
71
- return < boolean > this . active ( ) || null ;
80
+ return this . active ( ) || null ;
72
81
} ) ;
73
82
}