@@ -13,6 +13,7 @@ import {
1313 WritableSignalLike ,
1414 computed ,
1515 linkedSignal ,
16+ signal ,
1617} from '../behaviors/signal-like/signal-like' ;
1718import { LabelControl , LabelControlOptionalInputs } from '../behaviors/label/label' ;
1819import { ListFocus } from '../behaviors/list-focus/list-focus' ;
@@ -83,9 +84,6 @@ export class TabPattern {
8384export interface TabPanelInputs extends LabelControlOptionalInputs {
8485 /** A global unique identifier for the tabpanel. */
8586 id : SignalLike < string > ;
86-
87- /** The tab that controls this tabpanel. */
88- tab : SignalLike < TabPattern | undefined > ;
8987}
9088
9189/** A tabpanel associated with a tab. */
@@ -96,8 +94,11 @@ export class TabPanelPattern {
9694 /** Controls label for this tabpanel. */
9795 readonly labelManager : LabelControl ;
9896
97+ /** The tab that controls this tabpanel. */
98+ readonly tab : WritableSignalLike < TabPattern | undefined > = signal ( undefined ) ;
99+
99100 /** Whether the tabpanel is hidden. */
100- readonly hidden = computed ( ( ) => this . inputs . tab ( ) ?. expanded ( ) === false ) ;
101+ readonly hidden = computed ( ( ) => this . tab ( ) ?. expanded ( ) === false ) ;
101102
102103 /** The tab index of this tabpanel. */
103104 readonly tabIndex = computed ( ( ) => ( this . hidden ( ) ? - 1 : 0 ) ) ;
@@ -112,7 +113,7 @@ export class TabPanelPattern {
112113 constructor ( readonly inputs : TabPanelInputs ) {
113114 this . labelManager = new LabelControl ( {
114115 ...inputs ,
115- defaultLabelledBy : computed ( ( ) => ( this . inputs . tab ( ) ? [ this . inputs . tab ( ) ! . id ( ) ] : [ ] ) ) ,
116+ defaultLabelledBy : computed ( ( ) => ( this . tab ( ) ? [ this . tab ( ) ! . id ( ) ] : [ ] ) ) ,
116117 } ) ;
117118 }
118119}
0 commit comments