@@ -2,6 +2,7 @@ import classNames from 'classnames';
2
2
import * as React from 'react' ;
3
3
import type { EditableConfig , Tab } from '../interface' ;
4
4
import { genDataNodeKey , getRemovable } from '../util' ;
5
+ import type { SemanticName } from '@/Tabs' ;
5
6
6
7
export interface TabNodeProps {
7
8
id : string ;
@@ -23,8 +24,8 @@ export interface TabNodeProps {
23
24
onMouseUp : React . MouseEventHandler ;
24
25
onFocus : React . FocusEventHandler ;
25
26
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' > ;
28
29
}
29
30
30
31
const TabNode : React . FC < TabNodeProps > = props => {
@@ -44,8 +45,8 @@ const TabNode: React.FC<TabNodeProps> = props => {
44
45
onKeyDown,
45
46
onMouseDown,
46
47
onMouseUp,
47
- style ,
48
- className ,
48
+ styles ,
49
+ classNames : tabNodeClassNames ,
49
50
tabCount,
50
51
currentPosition,
51
52
} = props ;
@@ -83,13 +84,13 @@ const TabNode: React.FC<TabNodeProps> = props => {
83
84
< div
84
85
key = { key }
85
86
data-node-key = { genDataNodeKey ( key ) }
86
- className = { classNames ( tabPrefix , className , {
87
+ className = { classNames ( tabPrefix , tabNodeClassNames ?. item , {
87
88
[ `${ tabPrefix } -with-remove` ] : removable ,
88
89
[ `${ tabPrefix } -active` ] : active ,
89
90
[ `${ tabPrefix } -disabled` ] : disabled ,
90
91
[ `${ tabPrefix } -focus` ] : focus ,
91
92
} ) }
92
- style = { style }
93
+ style = { styles ?. item }
93
94
onClick = { onInternalClick }
94
95
>
95
96
{ /* Primary Tab Button */ }
@@ -130,7 +131,8 @@ const TabNode: React.FC<TabNodeProps> = props => {
130
131
type = "button"
131
132
aria-label = { removeAriaLabel || 'remove' }
132
133
tabIndex = { active ? 0 : - 1 }
133
- className = { `${ tabPrefix } -remove` }
134
+ className = { classNames ( `${ tabPrefix } -remove` , tabNodeClassNames ?. close ) }
135
+ style = { styles ?. close }
134
136
onClick = { e => {
135
137
e . stopPropagation ( ) ;
136
138
onRemoveTab ( e ) ;
0 commit comments