@@ -19,8 +19,8 @@ import { EventService } from "carbon-components-angular/utils";
1919} )
2020export class BaseTabHeader {
2121 /**
22- * Set to ' true' to have `Tab` items cached and not reloaded on tab switching.
23- * Duplicate from `n -tabs` to support standalone headers
22+ * Set to ` true` to have `Tab` items cached and not reloaded on tab switching.
23+ * Duplicated from `cds -tabs` to support standalone headers.
2424 */
2525 @Input ( ) cacheActive = false ;
2626 /**
@@ -36,19 +36,68 @@ export class BaseTabHeader {
3636 */
3737 @Input ( ) ariaLabelledby : string ;
3838
39+ /**
40+ * Template projected before tab items inside the tab list.
41+ */
3942 @Input ( ) contentBefore : TemplateRef < any > ;
43+ /**
44+ * Template projected after tab items inside the tab list.
45+ */
4046 @Input ( ) contentAfter : TemplateRef < any > ;
4147
48+ /**
49+ * Visual style of the tab list: `line` or `contained`.
50+ */
4251 @Input ( ) type : "line" | "contained" = "line" ;
52+ /**
53+ * Theme for contained tabs: `dark` or `light`.
54+ */
4355 @Input ( ) theme : "dark" | "light" = "dark" ;
4456
57+ /**
58+ * When using icon-only tabs, icon size: `default` (16px) or `lg` (20px).
59+ */
60+ @Input ( ) iconSize : "default" | "lg" ;
61+
62+ /**
63+ * **Contained only**: Evenly sized tabs across the row (**must** have fewer than 9 tabs).
64+ */
65+ @Input ( ) fullWidth = false ;
66+
67+ /**
68+ * Show a close control on each tab.
69+ */
70+ @Input ( ) dismissable = false ;
71+
72+ /**
73+ * Scroll the active tab into view on focus/select.
74+ */
75+ @Input ( ) scrollIntoView = false ;
76+
77+ /**
78+ * Debounce (ms) for tab list scroll events; affects overflow chevron updates.
79+ */
80+ @Input ( ) scrollDebounceWait = 200 ;
81+
4582 @HostBinding ( "class.cds--tabs" ) tabsClass = true ;
4683 @HostBinding ( "class.cds--tabs--contained" ) get containedClass ( ) {
4784 return this . type === "contained" ;
4885 }
4986 @HostBinding ( "class.cds--tabs--light" ) get themeClass ( ) {
5087 return this . theme === "light" ;
5188 }
89+ @HostBinding ( "class.cds--tabs--dismissable" ) get dismissableClass ( ) {
90+ return this . dismissable ;
91+ }
92+ @HostBinding ( "class.cds--tabs__icon--default" ) get iconSizeDefaultClass ( ) {
93+ return this . iconSize === "default" ;
94+ }
95+ @HostBinding ( "class.cds--tabs__icon--lg" ) get iconSizeLgClass ( ) {
96+ return this . iconSize === "lg" ;
97+ }
98+ @HostBinding ( "class.cds--layout--size-lg" ) get layoutSizeLgClass ( ) {
99+ return this . iconSize === "lg" ;
100+ }
52101
53102 /**
54103 * Gets the Unordered List element that holds the `Tab` headings from the view DOM.
@@ -66,6 +115,7 @@ export class BaseTabHeader {
66115
67116 protected longPressInterval = null ;
68117 protected tickInterval = null ;
118+ protected scrollDebounceTimer : any = null ;
69119
70120 get hasHorizontalOverflow ( ) {
71121 const tabList = this . headerContainer . nativeElement ;
@@ -91,7 +141,16 @@ export class BaseTabHeader {
91141 ) { }
92142
93143 handleScroll ( ) {
94- this . changeDetectorRef . markForCheck ( ) ;
144+ // Debounce the change detection trigger so the scroll arrow visibility
145+ // updates do not fire on every scroll tick.
146+ if ( this . scrollDebounceWait <= 0 ) {
147+ this . changeDetectorRef . markForCheck ( ) ;
148+ return ;
149+ }
150+ clearTimeout ( this . scrollDebounceTimer ) ;
151+ this . scrollDebounceTimer = setTimeout ( ( ) => {
152+ this . changeDetectorRef . markForCheck ( ) ;
153+ } , this . scrollDebounceWait ) ;
95154 }
96155
97156 handleOverflowNavClick ( direction : number , numOftabs = 0 ) {
0 commit comments