@@ -24,7 +24,8 @@ import "@ui5/webcomponents-icons/dist/sys-enter-2.js";
2424import SemanticColor from "./types/SemanticColor.js" ;
2525import ListItemType from "./types/ListItemType.js" ;
2626import TabContainer from "./TabContainer.js" ;
27- import type { ITab } from "./TabContainer.js" ;
27+ import type TabSeparator from "./TabSeparator.js" ;
28+ import type { TabContainerStripInfo , TabContainerOverflowInfo } from "./TabContainer.js" ;
2829import Icon from "./Icon.js" ;
2930import Button from "./Button.js" ;
3031import CustomListItem from "./CustomListItem.js" ;
@@ -47,6 +48,14 @@ const DESIGN_DESCRIPTIONS = {
4748[ SemanticColor . Critical ] : TAB_ARIA_DESIGN_CRITICAL ,
4849} ;
4950
51+ interface TabInStrip extends HTMLElement {
52+ realTabReference : Tab ;
53+ }
54+
55+ interface TabInOverflow extends CustomListItem {
56+ realTabReference : Tab ;
57+ }
58+
5059/**
5160 * @class
5261 * The `ui5-tab` represents a selectable item inside a `ui5-tabcontainer`.
@@ -55,7 +64,6 @@ const DESIGN_DESCRIPTIONS = {
5564 * @abstract
5665 * @constructor
5766 * @extends UI5Element
58- * @implements {ITab}
5967 * @public
6068 */
6169@customElement ( {
@@ -70,7 +78,7 @@ const DESIGN_DESCRIPTIONS = {
7078CustomListItem ,
7179] ,
7280} )
73- class Tab extends UI5Element implements ITab , ITabbable {
81+ class Tab extends UI5Element implements ITabbable {
7482/**
7583 * The text to be displayed for the item.
7684 * @default ""
@@ -143,11 +151,8 @@ class Tab extends UI5Element implements ITab, ITabbable {
143151@property ( { type : Boolean } )
144152forcedSelected ! : boolean ;
145153
146- @property ( { type : Object , defaultValue : null } )
147- realTabReference ! : Tab ;
148-
149154@property ( { type : Boolean } )
150- isTopLevelTab ! : boolean ;
155+ _isTopLevelTab ! : boolean ;
151156
152157@property ( { type : Object , defaultValue : null } )
153158_selectedTabReference ! : Tab ;
@@ -180,12 +185,15 @@ class Tab extends UI5Element implements ITab, ITabbable {
180185slots : false ,
181186} ,
182187} )
183- items ! : Array < ITab >
188+ items ! : Array < Tab | TabSeparator >
184189
185- isInline ?: boolean ;
186- forcedMixedMode ?: boolean ;
187- getElementInStrip ?: ( ) => ITab | null ;
190+ _isInline ?: boolean ;
191+ _forcedMixedMode ?: boolean ;
192+ _getElementInStrip ?: ( ) => HTMLElement | undefined ;
188193_individualSlot ! : string ;
194+ _forcedPosinset ?: number ;
195+ _forcedSetsize ?: number ;
196+ _forcedStyleInOverflow ?: Record < string , any > ;
189197
190198static i18nBundle : I18nBundle ;
191199
@@ -200,7 +208,7 @@ class Tab extends UI5Element implements ITab, ITabbable {
200208get displayText ( ) {
201209let text = this . text ;
202210
203- if ( this . isInline && this . additionalText ) {
211+ if ( this . _isInline && this . additionalText ) {
204212text += ` (${ this . additionalText } )` ;
205213}
206214
@@ -224,15 +232,15 @@ class Tab extends UI5Element implements ITab, ITabbable {
224232}
225233
226234get requiresExpandButton ( ) {
227- return this . items . length > 0 && this . isTopLevelTab && this . hasOwnContent ;
235+ return this . items . length > 0 && this . _isTopLevelTab && this . hasOwnContent ;
228236}
229237
230238get isSingleClickArea ( ) {
231- return this . items . length > 0 && this . isTopLevelTab && ! this . hasOwnContent ;
239+ return this . items . length > 0 && this . _isTopLevelTab && ! this . hasOwnContent ;
232240}
233241
234242get isTwoClickArea ( ) {
235- return this . items . length > 0 && this . isTopLevelTab && this . hasOwnContent ;
243+ return this . items . length > 0 && this . _isTopLevelTab && this . hasOwnContent ;
236244}
237245
238246get isOnSelectedTabPath ( ) : boolean {
@@ -251,6 +259,21 @@ class Tab extends UI5Element implements ITab, ITabbable {
251259return willShowContent ( this . content ) ;
252260}
253261
262+ receiveStripInfo ( {
263+ getElementInStrip, posinset, setsize, isInline, isTopLevelTab, mixedMode,
264+ } : TabContainerStripInfo ) {
265+ this . _getElementInStrip = getElementInStrip ;
266+ this . _forcedPosinset = posinset ;
267+ this . _forcedSetsize = setsize ;
268+ this . _forcedMixedMode = mixedMode ;
269+ this . _isInline = isInline ;
270+ this . _isTopLevelTab = ! ! isTopLevelTab ;
271+ }
272+
273+ receiveOverflowInfo ( { style } : TabContainerOverflowInfo ) {
274+ this . _forcedStyleInOverflow = style ;
275+ }
276+
254277/**
255278 * Returns the DOM reference of the tab that is placed in the header.
256279 *
@@ -260,19 +283,19 @@ class Tab extends UI5Element implements ITab, ITabbable {
260283 * @public
261284 * @since 1.0.0-rc.16
262285 */
263- getTabInStripDomRef ( ) : ITab | null {
264- if ( this . getElementInStrip ) {
265- return this . getElementInStrip ( ) ;
286+ getTabInStripDomRef ( ) : HTMLElement | undefined {
287+ if ( this . _getElementInStrip ) {
288+ return this . _getElementInStrip ( ) ;
266289}
267290
268- return null ;
291+ return undefined ;
269292}
270293
271294getFocusDomRef ( ) {
272295let focusedDomRef = super . getFocusDomRef ( ) ;
273296
274- if ( this . getElementInStrip && this . getElementInStrip ( ) ) {
275- focusedDomRef = this . getElementInStrip ( ) ! ;
297+ if ( this . _getElementInStrip && this . _getElementInStrip ( ) ) {
298+ focusedDomRef = this . _getElementInStrip ( ) ! ;
276299}
277300
278301return focusedDomRef ;
@@ -284,11 +307,11 @@ class Tab extends UI5Element implements ITab, ITabbable {
284307}
285308
286309get isMixedModeTab ( ) {
287- return ! this . icon && this . forcedMixedMode ;
310+ return ! this . icon && this . _forcedMixedMode ;
288311}
289312
290313get isTextOnlyTab ( ) {
291- return ! this . icon && ! this . forcedMixedMode ;
314+ return ! this . icon && ! this . _forcedMixedMode ;
292315}
293316
294317get isIconTab ( ) {
@@ -345,23 +368,23 @@ class Tab extends UI5Element implements ITab, ITabbable {
345368classes . push ( "ui5-tab-strip-item--disabled" ) ;
346369}
347370
348- if ( this . isInline ) {
371+ if ( this . _isInline ) {
349372classes . push ( "ui5-tab-strip-item--inline" ) ;
350373}
351374
352375if ( this . additionalText ) {
353376classes . push ( "ui5-tab-strip-item--withAdditionalText" ) ;
354377}
355378
356- if ( ! this . icon && ! this . forcedMixedMode ) {
379+ if ( ! this . icon && ! this . _forcedMixedMode ) {
357380classes . push ( "ui5-tab-strip-item--textOnly" ) ;
358381}
359382
360383if ( this . icon ) {
361384classes . push ( "ui5-tab-strip-item--withIcon" ) ;
362385}
363386
364- if ( ! this . icon && this . forcedMixedMode ) {
387+ if ( ! this . icon && this . _forcedMixedMode ) {
365388classes . push ( "ui5-tab-strip-item--mixedMode" ) ;
366389}
367390
@@ -493,3 +516,7 @@ TabContainer.registerTabStyles(draggableElementStyles);
493516TabContainer . registerTabStyles ( overflowCss ) ;
494517
495518export default Tab ;
519+ export type {
520+ TabInStrip ,
521+ TabInOverflow ,
522+ } ;
0 commit comments