@@ -2,6 +2,7 @@ import classNames from 'classnames';
22import * as React from 'react' ;
33import type { EditableConfig , Tab } from '../interface' ;
44import { genDataNodeKey , getRemovable } from '../util' ;
5+ import type { SemanticName } from '@/Tabs' ;
56
67export interface TabNodeProps {
78 id : string ;
@@ -23,8 +24,8 @@ export interface TabNodeProps {
2324 onMouseUp : React . MouseEventHandler ;
2425 onFocus : React . FocusEventHandler ;
2526 onBlur : React . FocusEventHandler ;
26- style ?: React . CSSProperties ;
27- className ?: string ;
27+ styles ?: Pick < Record < SemanticName , React . CSSProperties > , 'item' | 'close' > ;
28+ classNames ?: Pick < Record < SemanticName , string > , 'item' | 'close' > ;
2829}
2930
3031const TabNode : React . FC < TabNodeProps > = props => {
@@ -44,8 +45,8 @@ const TabNode: React.FC<TabNodeProps> = props => {
4445 onKeyDown,
4546 onMouseDown,
4647 onMouseUp,
47- style ,
48- className ,
48+ styles ,
49+ classNames : tabNodeClassNames ,
4950 tabCount,
5051 currentPosition,
5152 } = props ;
@@ -83,13 +84,13 @@ const TabNode: React.FC<TabNodeProps> = props => {
8384 < div
8485 key = { key }
8586 data-node-key = { genDataNodeKey ( key ) }
86- className = { classNames ( tabPrefix , className , {
87+ className = { classNames ( tabPrefix , tabNodeClassNames ?. item , {
8788 [ `${ tabPrefix } -with-remove` ] : removable ,
8889 [ `${ tabPrefix } -active` ] : active ,
8990 [ `${ tabPrefix } -disabled` ] : disabled ,
9091 [ `${ tabPrefix } -focus` ] : focus ,
9192 } ) }
92- style = { style }
93+ style = { styles ?. item }
9394 onClick = { onInternalClick }
9495 >
9596 { /* Primary Tab Button */ }
@@ -130,7 +131,8 @@ const TabNode: React.FC<TabNodeProps> = props => {
130131 type = "button"
131132 aria-label = { removeAriaLabel || 'remove' }
132133 tabIndex = { active ? 0 : - 1 }
133- className = { `${ tabPrefix } -remove` }
134+ className = { classNames ( `${ tabPrefix } -remove` , tabNodeClassNames ?. close ) }
135+ style = { styles ?. close }
134136 onClick = { e => {
135137 e . stopPropagation ( ) ;
136138 onRemoveTab ( e ) ;
0 commit comments