@@ -2,8 +2,6 @@ import { animate, animateChild, AnimationEvent, query, state, style, transition,
2
2
import {
3
3
Component ,
4
4
computed ,
5
- HostBinding ,
6
- HostListener ,
7
5
inject ,
8
6
input ,
9
7
InputSignal ,
@@ -27,7 +25,10 @@ type VisibleChangeEvent = { itemKey: string | number; visible: boolean };
27
25
'[tabindex]' : 'visible() ? tabindex(): -1' ,
28
26
'[attr.aria-labelledby]' : 'attrAriaLabelledBy()' ,
29
27
'[id]' : 'propId()' ,
30
- role : 'tabpanel'
28
+ '[attr.role]' : 'role()' ,
29
+ '[@.disabled]' : '!transition()' ,
30
+ '[@fadeInOut]' : 'visible() ? "show" : "hide"' ,
31
+ '(@fadeInOut.done)' : 'onAnimationDone($event)'
31
32
} ,
32
33
animations : [
33
34
trigger ( 'fadeInOut' , [
@@ -64,6 +65,13 @@ export class TabPanelComponent {
64
65
*/
65
66
readonly itemKey : InputSignal < string | number > = input . required ( ) ;
66
67
68
+ /**
69
+ * Element role.
70
+ * @type string
71
+ * @default 'tabpanel'
72
+ */
73
+ readonly role : InputSignal < string > = input ( 'tabpanel' ) ;
74
+
67
75
/**
68
76
* tabindex attribute.
69
77
* @type number
@@ -98,25 +106,17 @@ export class TabPanelComponent {
98
106
( ) => this . ariaLabelledBy ( ) ?? `${ this . tabsService . id ( ) } -tab-${ this . itemKey ( ) } `
99
107
) ;
100
108
101
- readonly hostClasses = computed ( ( ) => ( {
102
- 'tab-pane' : true ,
103
- active : this . show ( ) ,
104
- fade : this . transition ( ) ,
105
- show : this . show ( ) ,
106
- invisible : this . tabsService . activeItem ( ) ?. disabled
107
- } ) as Record < string , boolean > ) ;
108
-
109
- @HostBinding ( '@.disabled' )
110
- get animationDisabled ( ) : boolean {
111
- return ! this . transition ( ) ;
112
- }
113
-
114
- @HostBinding ( '@fadeInOut' )
115
- get animateType ( ) : AnimateType {
116
- return this . visible ( ) ? 'show' : 'hide' ;
117
- }
109
+ readonly hostClasses = computed (
110
+ ( ) =>
111
+ ( {
112
+ 'tab-pane' : true ,
113
+ active : this . show ( ) ,
114
+ fade : this . transition ( ) ,
115
+ show : this . show ( ) ,
116
+ invisible : this . tabsService . activeItem ( ) ?. disabled
117
+ } ) as Record < string , boolean >
118
+ ) ;
118
119
119
- @HostListener ( '@fadeInOut.done' , [ '$event' ] )
120
120
onAnimationDone ( $event : AnimationEvent ) : void {
121
121
this . show . set ( this . visible ( ) ) ;
122
122
}
0 commit comments