1
- import { booleanAttribute , computed , Directive , input , InputSignal , InputSignalWithTransform } from '@angular/core' ;
1
+ import {
2
+ booleanAttribute ,
3
+ computed ,
4
+ Directive ,
5
+ input ,
6
+ InputSignal ,
7
+ InputSignalWithTransform ,
8
+ numberAttribute
9
+ } from '@angular/core' ;
2
10
3
- import { ButtonType , Colors , Shapes } from '../coreui.types' ;
11
+ import { BooleanInput , ButtonType , Colors , Shapes } from '../coreui.types' ;
4
12
5
13
@Directive ( {
6
14
selector : '[cButton]' ,
@@ -16,6 +24,9 @@ import { ButtonType, Colors, Shapes } from '../coreui.types';
16
24
}
17
25
} )
18
26
export class ButtonDirective {
27
+ static ngAcceptInputType_active : BooleanInput ;
28
+ static ngAcceptInputType_disabled : BooleanInput ;
29
+
19
30
/**
20
31
* Toggle the active state for the component. [docs]
21
32
* @type InputSignalWithTransform<boolean, unknown>
@@ -46,6 +57,11 @@ export class ButtonDirective {
46
57
*/
47
58
readonly size : InputSignal < '' | 'sm' | 'lg' > = input < '' | 'sm' | 'lg' > ( '' ) ;
48
59
60
+ /**
61
+ * The tabindex attribute specifies the tab order of an element (when the "tab" button is used for navigating).
62
+ */
63
+ readonly tabindex = input ( undefined , { transform : numberAttribute } ) ;
64
+
49
65
/**
50
66
* Specifies the type of button. Always specify the type attribute for the `<button>` element.
51
67
* Different browsers may use different default types for the `<button>` element.
@@ -84,7 +100,7 @@ export class ButtonDirective {
84
100
} ) ;
85
101
86
102
readonly tabIndex = computed ( ( ) => {
87
- return this . _disabled ( ) ? '-1' : null ;
103
+ return this . _disabled ( ) ? '-1' : ( this . tabindex ( ) ?? null ) ;
88
104
} ) ;
89
105
90
106
readonly isActive = computed ( ( ) => {
0 commit comments