2024-04-08 14:04:08 +08:00
|
|
|
|
import { unit } from '@ant-design/cssinjs';
|
|
|
|
|
import type { CSSObject } from '@ant-design/cssinjs';
|
2023-11-13 14:18:23 +08:00
|
|
|
|
|
2023-06-02 01:27:30 +08:00
|
|
|
|
import { genFocusStyle, resetComponent, textEllipsis } from '../../style';
|
2023-11-13 14:18:23 +08:00
|
|
|
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
2023-11-29 17:23:45 +08:00
|
|
|
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
2022-08-08 19:08:43 +08:00
|
|
|
|
import genMotionStyle from './motion';
|
2022-04-07 22:07:18 +08:00
|
|
|
|
|
2022-06-02 19:28:06 +08:00
|
|
|
|
export interface ComponentToken {
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 下拉菜单 z-index
|
|
|
|
|
* @descEN z-index of dropdown menu
|
|
|
|
|
*/
|
2022-06-02 19:28:06 +08:00
|
|
|
|
zIndexPopup: number;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 卡片标签页背景色
|
|
|
|
|
* @descEN Background color of card tab
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
cardBg: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 卡片标签页高度
|
|
|
|
|
* @descEN Height of card tab
|
|
|
|
|
*/
|
2024-07-14 00:36:43 +08:00
|
|
|
|
cardHeight: number | string;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 卡片标签页内间距
|
|
|
|
|
* @descEN Padding of card tab
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
cardPadding: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 小号卡片标签页内间距
|
|
|
|
|
* @descEN Padding of small card tab
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
cardPaddingSM: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 大号卡片标签页内间距
|
|
|
|
|
* @descEN Padding of large card tab
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
cardPaddingLG: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
2024-08-20 23:51:35 +08:00
|
|
|
|
* @desc 标签页标题文本大小
|
2023-07-05 17:49:59 +08:00
|
|
|
|
* @descEN Font size of title
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
titleFontSize: number;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 大号标签页标题文本大小
|
|
|
|
|
* @descEN Font size of large title
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
titleFontSizeLG: number;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 小号标签页标题文本大小
|
|
|
|
|
* @descEN Font size of small title
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
titleFontSizeSM: number;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 指示条颜色
|
|
|
|
|
* @descEN Color of indicator
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
inkBarColor: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 横向标签页外间距
|
|
|
|
|
* @descEN Horizontal margin of horizontal tab
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
horizontalMargin: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 横向标签页标签间距
|
|
|
|
|
* @descEN Horizontal gutter of horizontal tab
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
horizontalItemGutter: number;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 横向标签页标签外间距
|
|
|
|
|
* @descEN Horizontal margin of horizontal tab item
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
horizontalItemMargin: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 横向标签页标签外间距(RTL)
|
|
|
|
|
* @descEN Horizontal margin of horizontal tab item (RTL)
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
horizontalItemMarginRTL: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 横向标签页标签内间距
|
|
|
|
|
* @descEN Horizontal padding of horizontal tab item
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
horizontalItemPadding: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 大号横向标签页标签内间距
|
|
|
|
|
* @descEN Horizontal padding of large horizontal tab item
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
horizontalItemPaddingLG: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 小号横向标签页标签内间距
|
|
|
|
|
* @descEN Horizontal padding of small horizontal tab item
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
horizontalItemPaddingSM: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 纵向标签页标签内间距
|
|
|
|
|
* @descEN Vertical padding of vertical tab item
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
verticalItemPadding: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 纵向标签页标签外间距
|
|
|
|
|
* @descEN Vertical margin of vertical tab item
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
verticalItemMargin: string;
|
2023-08-14 15:00:30 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 标签文本颜色
|
|
|
|
|
* @descEN Text color of tab
|
|
|
|
|
*/
|
|
|
|
|
itemColor: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 标签激活态文本颜色
|
|
|
|
|
* @descEN Text color of active tab
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
itemActiveColor: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 标签悬浮态文本颜色
|
|
|
|
|
* @descEN Text color of hover tab
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
itemHoverColor: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 标签选中态文本颜色
|
|
|
|
|
* @descEN Text color of selected tab
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
itemSelectedColor: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @desc 卡片标签间距
|
|
|
|
|
* @descEN Gutter of card tab
|
|
|
|
|
*/
|
2023-06-02 01:27:30 +08:00
|
|
|
|
cardGutter: number;
|
2022-06-02 19:28:06 +08:00
|
|
|
|
}
|
2022-04-07 22:07:18 +08:00
|
|
|
|
|
2022-08-08 19:08:43 +08:00
|
|
|
|
export interface TabsToken extends FullToken<'Tabs'> {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
tabsCardPadding: string;
|
2022-04-07 22:07:18 +08:00
|
|
|
|
dropdownEdgeChildVerticalPadding: number;
|
2022-06-02 19:28:06 +08:00
|
|
|
|
tabsNavWrapPseudoWidth: number;
|
|
|
|
|
tabsActiveTextShadow: string;
|
2024-07-14 00:36:43 +08:00
|
|
|
|
tabsDropdownHeight: number | string;
|
|
|
|
|
tabsDropdownWidth: number | string;
|
2023-06-02 01:27:30 +08:00
|
|
|
|
tabsHorizontalItemMargin: string;
|
|
|
|
|
tabsHorizontalItemMarginRTL: string;
|
2022-04-07 22:07:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const genCardStyle: GenerateStyle<TabsToken> = (token: TabsToken): CSSObject => {
|
|
|
|
|
const {
|
|
|
|
|
componentCls,
|
2023-06-02 01:27:30 +08:00
|
|
|
|
tabsCardPadding,
|
|
|
|
|
cardBg,
|
|
|
|
|
cardGutter,
|
2023-03-22 11:24:13 +08:00
|
|
|
|
colorBorderSecondary,
|
2023-06-02 01:27:30 +08:00
|
|
|
|
itemSelectedColor,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
} = token;
|
|
|
|
|
return {
|
|
|
|
|
[`${componentCls}-card`]: {
|
|
|
|
|
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
|
|
|
|
|
[`${componentCls}-tab`]: {
|
|
|
|
|
margin: 0,
|
2023-06-02 01:27:30 +08:00
|
|
|
|
padding: tabsCardPadding,
|
|
|
|
|
background: cardBg,
|
2023-11-13 14:18:23 +08:00
|
|
|
|
border: `${unit(token.lineWidth)} ${token.lineType} ${colorBorderSecondary}`,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
transition: `all ${token.motionDurationSlow} ${token.motionEaseInOut}`,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-tab-active`]: {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
color: itemSelectedColor,
|
2022-06-28 20:33:01 +08:00
|
|
|
|
background: token.colorBgContainer,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-ink-bar`]: {
|
|
|
|
|
visibility: 'hidden',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// ========================== Top & Bottom ==========================
|
|
|
|
|
[`&${componentCls}-top, &${componentCls}-bottom`]: {
|
|
|
|
|
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
|
|
|
|
|
[`${componentCls}-tab + ${componentCls}-tab`]: {
|
|
|
|
|
marginLeft: {
|
|
|
|
|
_skip_check_: true,
|
2023-11-13 14:18:23 +08:00
|
|
|
|
value: unit(cardGutter),
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`&${componentCls}-top`]: {
|
|
|
|
|
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
|
|
|
|
|
[`${componentCls}-tab`]: {
|
2023-11-13 14:18:23 +08:00
|
|
|
|
borderRadius: `${unit(token.borderRadiusLG)} ${unit(token.borderRadiusLG)} 0 0`,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-tab-active`]: {
|
2022-06-28 20:33:01 +08:00
|
|
|
|
borderBottomColor: token.colorBgContainer,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`&${componentCls}-bottom`]: {
|
|
|
|
|
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
|
|
|
|
|
[`${componentCls}-tab`]: {
|
2023-11-13 14:18:23 +08:00
|
|
|
|
borderRadius: `0 0 ${unit(token.borderRadiusLG)} ${unit(token.borderRadiusLG)}`,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-tab-active`]: {
|
2022-06-28 20:33:01 +08:00
|
|
|
|
borderTopColor: token.colorBgContainer,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// ========================== Left & Right ==========================
|
|
|
|
|
[`&${componentCls}-left, &${componentCls}-right`]: {
|
|
|
|
|
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
|
|
|
|
|
[`${componentCls}-tab + ${componentCls}-tab`]: {
|
2023-11-13 14:18:23 +08:00
|
|
|
|
marginTop: unit(cardGutter),
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`&${componentCls}-left`]: {
|
|
|
|
|
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
|
|
|
|
|
[`${componentCls}-tab`]: {
|
|
|
|
|
borderRadius: {
|
|
|
|
|
_skip_check_: true,
|
2023-11-13 14:18:23 +08:00
|
|
|
|
value: `${unit(token.borderRadiusLG)} 0 0 ${unit(token.borderRadiusLG)}`,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-tab-active`]: {
|
|
|
|
|
borderRightColor: {
|
|
|
|
|
_skip_check_: true,
|
2022-06-28 20:33:01 +08:00
|
|
|
|
value: token.colorBgContainer,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`&${componentCls}-right`]: {
|
|
|
|
|
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
|
|
|
|
|
[`${componentCls}-tab`]: {
|
|
|
|
|
borderRadius: {
|
|
|
|
|
_skip_check_: true,
|
2023-11-13 14:18:23 +08:00
|
|
|
|
value: `0 ${unit(token.borderRadiusLG)} ${unit(token.borderRadiusLG)} 0`,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-tab-active`]: {
|
|
|
|
|
borderLeftColor: {
|
|
|
|
|
_skip_check_: true,
|
2022-06-28 20:33:01 +08:00
|
|
|
|
value: token.colorBgContainer,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const genDropdownStyle: GenerateStyle<TabsToken> = (token: TabsToken): CSSObject => {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
const { componentCls, itemHoverColor, dropdownEdgeChildVerticalPadding } = token;
|
2022-04-07 22:07:18 +08:00
|
|
|
|
return {
|
|
|
|
|
[`${componentCls}-dropdown`]: {
|
|
|
|
|
...resetComponent(token),
|
|
|
|
|
|
|
|
|
|
position: 'absolute',
|
|
|
|
|
top: -9999,
|
|
|
|
|
left: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: -9999,
|
|
|
|
|
},
|
2022-06-02 19:28:06 +08:00
|
|
|
|
zIndex: token.zIndexPopup,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
display: 'block',
|
|
|
|
|
|
|
|
|
|
'&-hidden': {
|
|
|
|
|
display: 'none',
|
|
|
|
|
},
|
|
|
|
|
|
2022-06-02 20:22:42 +08:00
|
|
|
|
[`${componentCls}-dropdown-menu`]: {
|
2022-06-02 19:28:06 +08:00
|
|
|
|
maxHeight: token.tabsDropdownHeight,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
margin: 0,
|
2023-11-13 14:18:23 +08:00
|
|
|
|
padding: `${unit(dropdownEdgeChildVerticalPadding)} 0`,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
overflowX: 'hidden',
|
|
|
|
|
overflowY: 'auto',
|
|
|
|
|
textAlign: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: 'left',
|
|
|
|
|
},
|
|
|
|
|
listStyleType: 'none',
|
2022-06-28 20:33:01 +08:00
|
|
|
|
backgroundColor: token.colorBgContainer,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
backgroundClip: 'padding-box',
|
2022-11-01 15:06:38 +08:00
|
|
|
|
borderRadius: token.borderRadiusLG,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
outline: 'none',
|
2023-02-01 15:59:42 +08:00
|
|
|
|
boxShadow: token.boxShadowSecondary,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
|
|
|
|
|
'&-item': {
|
2022-10-28 16:44:19 +08:00
|
|
|
|
...textEllipsis,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
display: 'flex',
|
|
|
|
|
alignItems: 'center',
|
2022-06-02 19:28:06 +08:00
|
|
|
|
minWidth: token.tabsDropdownWidth,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
margin: 0,
|
2023-11-13 14:18:23 +08:00
|
|
|
|
padding: `${unit(token.paddingXXS)} ${unit(token.paddingSM)}`,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
color: token.colorText,
|
|
|
|
|
fontWeight: 'normal',
|
2022-06-02 19:28:06 +08:00
|
|
|
|
fontSize: token.fontSize,
|
|
|
|
|
lineHeight: token.lineHeight,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
cursor: 'pointer',
|
|
|
|
|
transition: `all ${token.motionDurationSlow}`,
|
|
|
|
|
|
|
|
|
|
'> span': {
|
|
|
|
|
flex: 1,
|
|
|
|
|
whiteSpace: 'nowrap',
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
'&-remove': {
|
|
|
|
|
flex: 'none',
|
|
|
|
|
marginLeft: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: token.marginSM,
|
|
|
|
|
},
|
2022-08-04 16:16:50 +08:00
|
|
|
|
color: token.colorTextDescription,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
fontSize: token.fontSizeSM,
|
|
|
|
|
background: 'transparent',
|
|
|
|
|
border: 0,
|
|
|
|
|
cursor: 'pointer',
|
|
|
|
|
|
|
|
|
|
'&:hover': {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
color: itemHoverColor,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
'&:hover': {
|
|
|
|
|
background: token.controlItemBgHover,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
'&-disabled': {
|
|
|
|
|
'&, &:hover': {
|
2022-06-02 19:28:06 +08:00
|
|
|
|
color: token.colorTextDisabled,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
background: 'transparent',
|
|
|
|
|
cursor: 'not-allowed',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const genPositionStyle: GenerateStyle<TabsToken> = (token: TabsToken): CSSObject => {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
const {
|
|
|
|
|
componentCls,
|
|
|
|
|
margin,
|
|
|
|
|
colorBorderSecondary,
|
|
|
|
|
horizontalMargin,
|
|
|
|
|
verticalItemPadding,
|
|
|
|
|
verticalItemMargin,
|
2023-11-22 20:53:48 +08:00
|
|
|
|
calc,
|
2023-06-02 01:27:30 +08:00
|
|
|
|
} = token;
|
2022-04-07 22:07:18 +08:00
|
|
|
|
return {
|
|
|
|
|
// ========================== Top & Bottom ==========================
|
|
|
|
|
[`${componentCls}-top, ${componentCls}-bottom`]: {
|
|
|
|
|
flexDirection: 'column',
|
|
|
|
|
|
|
|
|
|
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
margin: horizontalMargin,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
|
|
|
|
|
'&::before': {
|
|
|
|
|
position: 'absolute',
|
|
|
|
|
right: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: 0,
|
|
|
|
|
},
|
|
|
|
|
left: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: 0,
|
|
|
|
|
},
|
2023-11-13 14:18:23 +08:00
|
|
|
|
borderBottom: `${unit(token.lineWidth)} ${token.lineType} ${colorBorderSecondary}`,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
content: "''",
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-ink-bar`]: {
|
2022-06-02 19:28:06 +08:00
|
|
|
|
height: token.lineWidthBold,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
|
|
|
|
|
'&-animated': {
|
|
|
|
|
transition: `width ${token.motionDurationSlow}, left ${token.motionDurationSlow},
|
|
|
|
|
right ${token.motionDurationSlow}`,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-nav-wrap`]: {
|
|
|
|
|
'&::before, &::after': {
|
|
|
|
|
top: 0,
|
|
|
|
|
bottom: 0,
|
2022-06-02 19:28:06 +08:00
|
|
|
|
width: token.controlHeight,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
'&::before': {
|
|
|
|
|
left: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: 0,
|
|
|
|
|
},
|
2022-06-24 10:45:29 +08:00
|
|
|
|
boxShadow: token.boxShadowTabsOverflowLeft,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
'&::after': {
|
|
|
|
|
right: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: 0,
|
|
|
|
|
},
|
2022-06-24 10:45:29 +08:00
|
|
|
|
boxShadow: token.boxShadowTabsOverflowRight,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`&${componentCls}-nav-wrap-ping-left::before`]: {
|
|
|
|
|
opacity: 1,
|
|
|
|
|
},
|
|
|
|
|
[`&${componentCls}-nav-wrap-ping-right::after`]: {
|
|
|
|
|
opacity: 1,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-top`]: {
|
|
|
|
|
[`> ${componentCls}-nav,
|
|
|
|
|
> div > ${componentCls}-nav`]: {
|
|
|
|
|
'&::before': {
|
|
|
|
|
bottom: 0,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-ink-bar`]: {
|
|
|
|
|
bottom: 0,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-bottom`]: {
|
|
|
|
|
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
|
|
|
|
|
order: 1,
|
2023-11-13 14:18:23 +08:00
|
|
|
|
marginTop: margin,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
marginBottom: 0,
|
|
|
|
|
|
|
|
|
|
'&::before': {
|
|
|
|
|
top: 0,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-ink-bar`]: {
|
|
|
|
|
top: 0,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`> ${componentCls}-content-holder, > div > ${componentCls}-content-holder`]: {
|
|
|
|
|
order: 0,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// ========================== Left & Right ==========================
|
|
|
|
|
[`${componentCls}-left, ${componentCls}-right`]: {
|
|
|
|
|
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
|
|
|
|
|
flexDirection: 'column',
|
2023-11-22 20:53:48 +08:00
|
|
|
|
minWidth: calc(token.controlHeight).mul(1.25).equal(),
|
2022-04-07 22:07:18 +08:00
|
|
|
|
|
|
|
|
|
// >>>>>>>>>>> Tab
|
|
|
|
|
[`${componentCls}-tab`]: {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
padding: verticalItemPadding,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
textAlign: 'center',
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-tab + ${componentCls}-tab`]: {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
margin: verticalItemMargin,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// >>>>>>>>>>> Nav
|
|
|
|
|
[`${componentCls}-nav-wrap`]: {
|
|
|
|
|
flexDirection: 'column',
|
|
|
|
|
|
|
|
|
|
'&::before, &::after': {
|
|
|
|
|
right: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: 0,
|
|
|
|
|
},
|
|
|
|
|
left: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: 0,
|
|
|
|
|
},
|
2022-06-02 19:28:06 +08:00
|
|
|
|
height: token.controlHeight,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
'&::before': {
|
|
|
|
|
top: 0,
|
2022-06-24 10:45:29 +08:00
|
|
|
|
boxShadow: token.boxShadowTabsOverflowTop,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
'&::after': {
|
|
|
|
|
bottom: 0,
|
2022-06-24 10:45:29 +08:00
|
|
|
|
boxShadow: token.boxShadowTabsOverflowBottom,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`&${componentCls}-nav-wrap-ping-top::before`]: {
|
|
|
|
|
opacity: 1,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`&${componentCls}-nav-wrap-ping-bottom::after`]: {
|
|
|
|
|
opacity: 1,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// >>>>>>>>>>> Ink Bar
|
|
|
|
|
[`${componentCls}-ink-bar`]: {
|
2022-06-02 19:28:06 +08:00
|
|
|
|
width: token.lineWidthBold,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
|
|
|
|
|
'&-animated': {
|
|
|
|
|
transition: `height ${token.motionDurationSlow}, top ${token.motionDurationSlow}`,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-nav-list, ${componentCls}-nav-operations`]: {
|
|
|
|
|
flex: '1 0 auto', // fix safari scroll problem
|
|
|
|
|
flexDirection: 'column',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-left`]: {
|
|
|
|
|
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
|
|
|
|
|
[`${componentCls}-ink-bar`]: {
|
|
|
|
|
right: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: 0,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`> ${componentCls}-content-holder, > div > ${componentCls}-content-holder`]: {
|
|
|
|
|
marginLeft: {
|
|
|
|
|
_skip_check_: true,
|
2023-11-22 20:53:48 +08:00
|
|
|
|
value: unit(calc(token.lineWidth).mul(-1).equal()),
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
borderLeft: {
|
|
|
|
|
_skip_check_: true,
|
2023-11-13 14:18:23 +08:00
|
|
|
|
value: `${unit(token.lineWidth)} ${token.lineType} ${token.colorBorder}`,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`> ${componentCls}-content > ${componentCls}-tabpane`]: {
|
|
|
|
|
paddingLeft: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: token.paddingLG,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-right`]: {
|
|
|
|
|
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
|
|
|
|
|
order: 1,
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-ink-bar`]: {
|
|
|
|
|
left: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: 0,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`> ${componentCls}-content-holder, > div > ${componentCls}-content-holder`]: {
|
|
|
|
|
order: 0,
|
|
|
|
|
marginRight: {
|
|
|
|
|
_skip_check_: true,
|
2023-11-22 20:53:48 +08:00
|
|
|
|
value: calc(token.lineWidth).mul(-1).equal(),
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
borderRight: {
|
|
|
|
|
_skip_check_: true,
|
2023-11-13 14:18:23 +08:00
|
|
|
|
value: `${unit(token.lineWidth)} ${token.lineType} ${token.colorBorder}`,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`> ${componentCls}-content > ${componentCls}-tabpane`]: {
|
|
|
|
|
paddingRight: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: token.paddingLG,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const genSizeStyle: GenerateStyle<TabsToken> = (token: TabsToken): CSSObject => {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
const {
|
|
|
|
|
componentCls,
|
|
|
|
|
cardPaddingSM,
|
|
|
|
|
cardPaddingLG,
|
|
|
|
|
horizontalItemPaddingSM,
|
|
|
|
|
horizontalItemPaddingLG,
|
|
|
|
|
} = token;
|
2022-04-07 22:07:18 +08:00
|
|
|
|
return {
|
|
|
|
|
[componentCls]: {
|
|
|
|
|
'&-small': {
|
|
|
|
|
[`> ${componentCls}-nav`]: {
|
|
|
|
|
[`${componentCls}-tab`]: {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
padding: horizontalItemPaddingSM,
|
|
|
|
|
fontSize: token.titleFontSizeSM,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
'&-large': {
|
|
|
|
|
[`> ${componentCls}-nav`]: {
|
|
|
|
|
[`${componentCls}-tab`]: {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
padding: horizontalItemPaddingLG,
|
|
|
|
|
fontSize: token.titleFontSizeLG,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-card`]: {
|
|
|
|
|
[`&${componentCls}-small`]: {
|
|
|
|
|
[`> ${componentCls}-nav`]: {
|
|
|
|
|
[`${componentCls}-tab`]: {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
padding: cardPaddingSM,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
2022-08-19 10:10:51 +08:00
|
|
|
|
[`&${componentCls}-bottom`]: {
|
|
|
|
|
[`> ${componentCls}-nav ${componentCls}-tab`]: {
|
2023-11-13 14:18:23 +08:00
|
|
|
|
borderRadius: `0 0 ${unit(token.borderRadius)} ${unit(token.borderRadius)}`,
|
2022-08-19 10:10:51 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
[`&${componentCls}-top`]: {
|
|
|
|
|
[`> ${componentCls}-nav ${componentCls}-tab`]: {
|
2023-11-13 14:18:23 +08:00
|
|
|
|
borderRadius: `${unit(token.borderRadius)} ${unit(token.borderRadius)} 0 0`,
|
2022-08-19 10:10:51 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
[`&${componentCls}-right`]: {
|
|
|
|
|
[`> ${componentCls}-nav ${componentCls}-tab`]: {
|
|
|
|
|
borderRadius: {
|
|
|
|
|
_skip_check_: true,
|
2023-11-13 14:18:23 +08:00
|
|
|
|
value: `0 ${unit(token.borderRadius)} ${unit(token.borderRadius)} 0`,
|
2022-08-19 10:10:51 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
[`&${componentCls}-left`]: {
|
|
|
|
|
[`> ${componentCls}-nav ${componentCls}-tab`]: {
|
|
|
|
|
borderRadius: {
|
|
|
|
|
_skip_check_: true,
|
2023-11-13 14:18:23 +08:00
|
|
|
|
value: `${unit(token.borderRadius)} 0 0 ${unit(token.borderRadius)}`,
|
2022-08-19 10:10:51 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`&${componentCls}-large`]: {
|
|
|
|
|
[`> ${componentCls}-nav`]: {
|
|
|
|
|
[`${componentCls}-tab`]: {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
padding: cardPaddingLG,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const genTabStyle: GenerateStyle<TabsToken, CSSObject> = (token: TabsToken) => {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
const {
|
|
|
|
|
componentCls,
|
|
|
|
|
itemActiveColor,
|
|
|
|
|
itemHoverColor,
|
|
|
|
|
iconCls,
|
|
|
|
|
tabsHorizontalItemMargin,
|
|
|
|
|
horizontalItemPadding,
|
|
|
|
|
itemSelectedColor,
|
2023-08-14 15:00:30 +08:00
|
|
|
|
itemColor,
|
2023-06-02 01:27:30 +08:00
|
|
|
|
} = token;
|
2022-04-07 22:07:18 +08:00
|
|
|
|
|
|
|
|
|
const tabCls = `${componentCls}-tab`;
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
[tabCls]: {
|
|
|
|
|
position: 'relative',
|
2023-08-14 12:08:25 +08:00
|
|
|
|
WebkitTouchCallout: 'none',
|
|
|
|
|
WebkitTapHighlightColor: 'transparent',
|
2022-04-07 22:07:18 +08:00
|
|
|
|
display: 'inline-flex',
|
|
|
|
|
alignItems: 'center',
|
2023-06-02 01:27:30 +08:00
|
|
|
|
padding: horizontalItemPadding,
|
|
|
|
|
fontSize: token.titleFontSize,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
background: 'transparent',
|
|
|
|
|
border: 0,
|
|
|
|
|
outline: 'none',
|
|
|
|
|
cursor: 'pointer',
|
2023-08-14 15:00:30 +08:00
|
|
|
|
color: itemColor,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
'&-btn, &-remove': {
|
2022-09-09 10:53:03 +08:00
|
|
|
|
'&:focus:not(:focus-visible), &:active': {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
color: itemActiveColor,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
2022-09-09 10:53:03 +08:00
|
|
|
|
...genFocusStyle(token),
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
'&-btn': {
|
|
|
|
|
outline: 'none',
|
2024-04-07 15:19:16 +08:00
|
|
|
|
transition: `all ${token.motionDurationSlow}`,
|
2023-11-28 11:49:10 +08:00
|
|
|
|
[`${tabCls}-icon:not(:last-child)`]: {
|
|
|
|
|
marginInlineEnd: token.marginSM,
|
|
|
|
|
},
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
'&-remove': {
|
|
|
|
|
flex: 'none',
|
|
|
|
|
marginRight: {
|
|
|
|
|
_skip_check_: true,
|
2023-11-13 14:18:23 +08:00
|
|
|
|
value: token.calc(token.marginXXS).mul(-1).equal(),
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
marginLeft: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: token.marginXS,
|
|
|
|
|
},
|
2022-08-04 16:16:50 +08:00
|
|
|
|
color: token.colorTextDescription,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
fontSize: token.fontSizeSM,
|
|
|
|
|
background: 'transparent',
|
|
|
|
|
border: 'none',
|
|
|
|
|
outline: 'none',
|
|
|
|
|
cursor: 'pointer',
|
|
|
|
|
transition: `all ${token.motionDurationSlow}`,
|
|
|
|
|
'&:hover': {
|
|
|
|
|
color: token.colorTextHeading,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
'&:hover': {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
color: itemHoverColor,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`&${tabCls}-active ${tabCls}-btn`]: {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
color: itemSelectedColor,
|
2022-06-02 19:28:06 +08:00
|
|
|
|
textShadow: token.tabsActiveTextShadow,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`&${tabCls}-disabled`]: {
|
2022-06-02 19:28:06 +08:00
|
|
|
|
color: token.colorTextDisabled,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
cursor: 'not-allowed',
|
|
|
|
|
},
|
|
|
|
|
[`&${tabCls}-disabled ${tabCls}-btn, &${tabCls}-disabled ${componentCls}-remove`]: {
|
|
|
|
|
'&:focus, &:active': {
|
2022-06-02 19:28:06 +08:00
|
|
|
|
color: token.colorTextDisabled,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
[`& ${tabCls}-remove ${iconCls}`]: {
|
|
|
|
|
margin: 0,
|
|
|
|
|
},
|
2023-11-28 11:49:10 +08:00
|
|
|
|
[`${iconCls}:not(:last-child)`]: {
|
2022-04-07 22:07:18 +08:00
|
|
|
|
marginRight: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: token.marginSM,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${tabCls} + ${tabCls}`]: {
|
|
|
|
|
margin: {
|
|
|
|
|
_skip_check_: true,
|
2023-06-02 01:27:30 +08:00
|
|
|
|
value: tabsHorizontalItemMargin,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const genRtlStyle: GenerateStyle<TabsToken, CSSObject> = (token: TabsToken) => {
|
2023-11-22 20:53:48 +08:00
|
|
|
|
const { componentCls, tabsHorizontalItemMarginRTL, iconCls, cardGutter, calc } = token;
|
2022-04-07 22:07:18 +08:00
|
|
|
|
const rtlCls = `${componentCls}-rtl`;
|
|
|
|
|
return {
|
|
|
|
|
[rtlCls]: {
|
|
|
|
|
direction: 'rtl',
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-nav`]: {
|
|
|
|
|
[`${componentCls}-tab`]: {
|
|
|
|
|
margin: {
|
|
|
|
|
_skip_check_: true,
|
2023-06-02 01:27:30 +08:00
|
|
|
|
value: tabsHorizontalItemMarginRTL,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-tab:last-of-type`]: {
|
|
|
|
|
marginLeft: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: 0,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[iconCls]: {
|
|
|
|
|
marginRight: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: 0,
|
|
|
|
|
},
|
|
|
|
|
marginLeft: {
|
|
|
|
|
_skip_check_: true,
|
2023-11-13 14:18:23 +08:00
|
|
|
|
value: unit(token.marginSM),
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-tab-remove`]: {
|
|
|
|
|
marginRight: {
|
|
|
|
|
_skip_check_: true,
|
2023-11-13 14:18:23 +08:00
|
|
|
|
value: unit(token.marginXS),
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
marginLeft: {
|
|
|
|
|
_skip_check_: true,
|
2023-11-22 20:53:48 +08:00
|
|
|
|
value: unit(calc(token.marginXXS).mul(-1).equal()),
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[iconCls]: {
|
|
|
|
|
margin: 0,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`&${componentCls}-left`]: {
|
|
|
|
|
[`> ${componentCls}-nav`]: {
|
|
|
|
|
order: 1,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`> ${componentCls}-content-holder`]: {
|
|
|
|
|
order: 0,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`&${componentCls}-right`]: {
|
|
|
|
|
[`> ${componentCls}-nav`]: {
|
|
|
|
|
order: 0,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`> ${componentCls}-content-holder`]: {
|
|
|
|
|
order: 1,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// ====================== Card ======================
|
|
|
|
|
[`&${componentCls}-card${componentCls}-top, &${componentCls}-card${componentCls}-bottom`]: {
|
|
|
|
|
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
|
|
|
|
|
[`${componentCls}-tab + ${componentCls}-tab`]: {
|
|
|
|
|
marginRight: {
|
|
|
|
|
_skip_check_: true,
|
2023-06-02 01:27:30 +08:00
|
|
|
|
value: cardGutter,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
marginLeft: { _skip_check_: true, value: 0 },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-dropdown-rtl`]: {
|
|
|
|
|
direction: 'rtl',
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-menu-item`]: {
|
|
|
|
|
[`${componentCls}-dropdown-rtl`]: {
|
|
|
|
|
textAlign: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: 'right',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const genTabsStyle: GenerateStyle<TabsToken> = (token: TabsToken): CSSObject => {
|
|
|
|
|
const {
|
|
|
|
|
componentCls,
|
2023-06-02 01:27:30 +08:00
|
|
|
|
tabsCardPadding,
|
|
|
|
|
cardHeight,
|
|
|
|
|
cardGutter,
|
|
|
|
|
itemHoverColor,
|
|
|
|
|
itemActiveColor,
|
2023-03-22 11:24:13 +08:00
|
|
|
|
colorBorderSecondary,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
} = token;
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
[componentCls]: {
|
|
|
|
|
...resetComponent(token),
|
|
|
|
|
display: 'flex',
|
|
|
|
|
|
|
|
|
|
// ========================== Navigation ==========================
|
|
|
|
|
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
|
|
|
|
|
position: 'relative',
|
|
|
|
|
display: 'flex',
|
|
|
|
|
flex: 'none',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-nav-wrap`]: {
|
|
|
|
|
position: 'relative',
|
|
|
|
|
display: 'flex',
|
|
|
|
|
flex: 'auto',
|
|
|
|
|
alignSelf: 'stretch',
|
|
|
|
|
overflow: 'hidden',
|
|
|
|
|
whiteSpace: 'nowrap',
|
|
|
|
|
transform: 'translate(0)', // Fix chrome render bug
|
|
|
|
|
|
|
|
|
|
// >>>>> Ping shadow
|
|
|
|
|
'&::before, &::after': {
|
|
|
|
|
position: 'absolute',
|
|
|
|
|
zIndex: 1,
|
|
|
|
|
opacity: 0,
|
|
|
|
|
transition: `opacity ${token.motionDurationSlow}`,
|
|
|
|
|
content: "''",
|
|
|
|
|
pointerEvents: 'none',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-nav-list`]: {
|
|
|
|
|
position: 'relative',
|
|
|
|
|
display: 'flex',
|
|
|
|
|
transition: `opacity ${token.motionDurationSlow}`,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// >>>>>>>> Operations
|
|
|
|
|
[`${componentCls}-nav-operations`]: {
|
|
|
|
|
display: 'flex',
|
|
|
|
|
alignSelf: 'stretch',
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-nav-operations-hidden`]: {
|
|
|
|
|
position: 'absolute',
|
|
|
|
|
visibility: 'hidden',
|
|
|
|
|
pointerEvents: 'none',
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-nav-more`]: {
|
|
|
|
|
position: 'relative',
|
2023-06-02 01:27:30 +08:00
|
|
|
|
padding: tabsCardPadding,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
background: 'transparent',
|
|
|
|
|
border: 0,
|
2023-03-18 19:24:41 +08:00
|
|
|
|
color: token.colorText,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
|
|
|
|
|
'&::after': {
|
|
|
|
|
position: 'absolute',
|
|
|
|
|
right: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: 0,
|
|
|
|
|
},
|
|
|
|
|
bottom: 0,
|
|
|
|
|
left: {
|
|
|
|
|
_skip_check_: true,
|
|
|
|
|
value: 0,
|
|
|
|
|
},
|
2023-11-13 14:18:23 +08:00
|
|
|
|
height: token.calc(token.controlHeightLG).div(8).equal(),
|
2022-04-07 22:07:18 +08:00
|
|
|
|
transform: 'translateY(100%)',
|
|
|
|
|
content: "''",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-nav-add`]: {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
minWidth: cardHeight,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
marginLeft: {
|
|
|
|
|
_skip_check_: true,
|
2023-06-02 01:27:30 +08:00
|
|
|
|
value: cardGutter,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
2024-12-08 23:36:01 +08:00
|
|
|
|
padding: `${unit(token.paddingXS)}`,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
background: 'transparent',
|
2023-11-13 14:18:23 +08:00
|
|
|
|
border: `${unit(token.lineWidth)} ${token.lineType} ${colorBorderSecondary}`,
|
|
|
|
|
borderRadius: `${unit(token.borderRadiusLG)} ${unit(token.borderRadiusLG)} 0 0`,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
outline: 'none',
|
|
|
|
|
cursor: 'pointer',
|
2022-12-22 11:17:16 +08:00
|
|
|
|
color: token.colorText,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
transition: `all ${token.motionDurationSlow} ${token.motionEaseInOut}`,
|
|
|
|
|
|
|
|
|
|
'&:hover': {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
color: itemHoverColor,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
2022-09-09 10:53:03 +08:00
|
|
|
|
'&:active, &:focus:not(:focus-visible)': {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
color: itemActiveColor,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
2022-09-09 10:53:03 +08:00
|
|
|
|
|
|
|
|
|
...genFocusStyle(token),
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-extra-content`]: {
|
|
|
|
|
flex: 'none',
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// ============================ InkBar ============================
|
|
|
|
|
[`${componentCls}-ink-bar`]: {
|
|
|
|
|
position: 'absolute',
|
2023-06-02 01:27:30 +08:00
|
|
|
|
background: token.inkBarColor,
|
2022-04-07 22:07:18 +08:00
|
|
|
|
pointerEvents: 'none',
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// ============================= Tabs =============================
|
|
|
|
|
...genTabStyle(token),
|
|
|
|
|
|
|
|
|
|
// =========================== TabPanes ===========================
|
|
|
|
|
[`${componentCls}-content`]: {
|
2022-08-08 19:08:43 +08:00
|
|
|
|
position: 'relative',
|
2022-04-07 22:07:18 +08:00
|
|
|
|
width: '100%',
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-content-holder`]: {
|
|
|
|
|
flex: 'auto',
|
|
|
|
|
minWidth: 0,
|
|
|
|
|
minHeight: 0,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-tabpane`]: {
|
2022-09-22 11:47:05 +08:00
|
|
|
|
outline: 'none',
|
2022-08-08 19:08:43 +08:00
|
|
|
|
'&-hidden': {
|
|
|
|
|
display: 'none',
|
|
|
|
|
},
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
[`${componentCls}-centered`]: {
|
|
|
|
|
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
|
|
|
|
|
[`${componentCls}-nav-wrap`]: {
|
2024-11-13 11:07:31 +08:00
|
|
|
|
[`&:not([class*='${componentCls}-nav-wrap-ping']) > ${componentCls}-nav-list`]: {
|
|
|
|
|
margin: 'auto',
|
2022-04-07 22:07:18 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2023-11-13 14:18:23 +08:00
|
|
|
|
export const prepareComponentToken: GetDefaultToken<'Tabs'> = (token) => {
|
|
|
|
|
const cardHeight = token.controlHeightLG;
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
zIndexPopup: token.zIndexPopupBase + 50,
|
|
|
|
|
cardBg: token.colorFillAlter,
|
|
|
|
|
cardHeight,
|
|
|
|
|
// Initialize with empty string, because cardPadding will be calculated with cardHeight by default.
|
|
|
|
|
cardPadding: `${
|
|
|
|
|
(cardHeight - Math.round(token.fontSize * token.lineHeight)) / 2 - token.lineWidth
|
|
|
|
|
}px ${token.padding}px`,
|
|
|
|
|
cardPaddingSM: `${token.paddingXXS * 1.5}px ${token.padding}px`,
|
|
|
|
|
cardPaddingLG: `${token.paddingXS}px ${token.padding}px ${token.paddingXXS * 1.5}px`,
|
|
|
|
|
titleFontSize: token.fontSize,
|
|
|
|
|
titleFontSizeLG: token.fontSizeLG,
|
|
|
|
|
titleFontSizeSM: token.fontSize,
|
|
|
|
|
inkBarColor: token.colorPrimary,
|
|
|
|
|
horizontalMargin: `0 0 ${token.margin}px 0`,
|
|
|
|
|
horizontalItemGutter: 32, // Fixed Value
|
|
|
|
|
// Initialize with empty string, because horizontalItemMargin will be calculated with horizontalItemGutter by default.
|
|
|
|
|
horizontalItemMargin: ``,
|
|
|
|
|
horizontalItemMarginRTL: ``,
|
|
|
|
|
horizontalItemPadding: `${token.paddingSM}px 0`,
|
|
|
|
|
horizontalItemPaddingSM: `${token.paddingXS}px 0`,
|
|
|
|
|
horizontalItemPaddingLG: `${token.padding}px 0`,
|
|
|
|
|
verticalItemPadding: `${token.paddingXS}px ${token.paddingLG}px`,
|
|
|
|
|
verticalItemMargin: `${token.margin}px 0 0 0`,
|
|
|
|
|
itemColor: token.colorText,
|
|
|
|
|
itemSelectedColor: token.colorPrimary,
|
|
|
|
|
itemHoverColor: token.colorPrimaryHover,
|
|
|
|
|
itemActiveColor: token.colorPrimaryActive,
|
|
|
|
|
cardGutter: token.marginXXS / 2,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-04-07 22:07:18 +08:00
|
|
|
|
// ============================== Export ==============================
|
2023-11-29 17:23:45 +08:00
|
|
|
|
export default genStyleHooks(
|
2022-06-02 19:28:06 +08:00
|
|
|
|
'Tabs',
|
2022-11-19 13:47:33 +08:00
|
|
|
|
(token) => {
|
2022-06-02 19:28:06 +08:00
|
|
|
|
const tabsToken = mergeToken<TabsToken>(token, {
|
2023-06-02 01:27:30 +08:00
|
|
|
|
// `cardPadding` is empty by default, so we could calculate with dynamic `cardHeight`
|
2023-11-13 14:18:23 +08:00
|
|
|
|
tabsCardPadding: token.cardPadding,
|
2022-06-02 19:28:06 +08:00
|
|
|
|
dropdownEdgeChildVerticalPadding: token.paddingXXS,
|
|
|
|
|
tabsActiveTextShadow: '0 0 0.25px currentcolor',
|
|
|
|
|
tabsDropdownHeight: 200,
|
|
|
|
|
tabsDropdownWidth: 120,
|
2023-11-13 14:18:23 +08:00
|
|
|
|
tabsHorizontalItemMargin: `0 0 0 ${unit(token.horizontalItemGutter)}`,
|
|
|
|
|
tabsHorizontalItemMarginRTL: `0 0 0 ${unit(token.horizontalItemGutter)}`,
|
2022-06-02 19:28:06 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
genSizeStyle(tabsToken),
|
|
|
|
|
genRtlStyle(tabsToken),
|
|
|
|
|
genPositionStyle(tabsToken),
|
|
|
|
|
genDropdownStyle(tabsToken),
|
|
|
|
|
genCardStyle(tabsToken),
|
|
|
|
|
genTabsStyle(tabsToken),
|
2022-08-08 19:08:43 +08:00
|
|
|
|
genMotionStyle(tabsToken),
|
2022-06-02 19:28:06 +08:00
|
|
|
|
];
|
|
|
|
|
},
|
2023-11-13 14:18:23 +08:00
|
|
|
|
prepareComponentToken,
|
2022-06-02 19:28:06 +08:00
|
|
|
|
);
|