123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872 |
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.prepareComponentToken = exports.default = void 0;
- var _cssinjs = require("@ant-design/cssinjs");
- var _style = require("../../style");
- var _internal = require("../../theme/internal");
- var _motion = _interopRequireDefault(require("./motion"));
- const genCardStyle = token => {
- const {
- componentCls,
- tabsCardPadding,
- cardBg,
- cardGutter,
- colorBorderSecondary,
- itemSelectedColor
- } = token;
- return {
- [`${componentCls}-card`]: {
- [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
- [`${componentCls}-tab`]: {
- margin: 0,
- padding: tabsCardPadding,
- background: cardBg,
- border: `${(0, _cssinjs.unit)(token.lineWidth)} ${token.lineType} ${colorBorderSecondary}`,
- transition: `all ${token.motionDurationSlow} ${token.motionEaseInOut}`
- },
- [`${componentCls}-tab-active`]: {
- color: itemSelectedColor,
- background: token.colorBgContainer
- },
- [`${componentCls}-tab-focus:has(${componentCls}-tab-btn:focus-visible)`]: (0, _style.genFocusOutline)(token, -3),
- [`& ${componentCls}-tab${componentCls}-tab-focus ${componentCls}-tab-btn:focus-visible`]: {
- outline: 'none'
- },
- [`${componentCls}-ink-bar`]: {
- visibility: 'hidden'
- }
- },
- // ========================== Top & Bottom ==========================
- [`&${componentCls}-top, &${componentCls}-bottom`]: {
- [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
- [`${componentCls}-tab + ${componentCls}-tab`]: {
- marginLeft: {
- _skip_check_: true,
- value: (0, _cssinjs.unit)(cardGutter)
- }
- }
- }
- },
- [`&${componentCls}-top`]: {
- [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
- [`${componentCls}-tab`]: {
- borderRadius: `${(0, _cssinjs.unit)(token.borderRadiusLG)} ${(0, _cssinjs.unit)(token.borderRadiusLG)} 0 0`
- },
- [`${componentCls}-tab-active`]: {
- borderBottomColor: token.colorBgContainer
- }
- }
- },
- [`&${componentCls}-bottom`]: {
- [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
- [`${componentCls}-tab`]: {
- borderRadius: `0 0 ${(0, _cssinjs.unit)(token.borderRadiusLG)} ${(0, _cssinjs.unit)(token.borderRadiusLG)}`
- },
- [`${componentCls}-tab-active`]: {
- borderTopColor: token.colorBgContainer
- }
- }
- },
- // ========================== Left & Right ==========================
- [`&${componentCls}-left, &${componentCls}-right`]: {
- [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
- [`${componentCls}-tab + ${componentCls}-tab`]: {
- marginTop: (0, _cssinjs.unit)(cardGutter)
- }
- }
- },
- [`&${componentCls}-left`]: {
- [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
- [`${componentCls}-tab`]: {
- borderRadius: {
- _skip_check_: true,
- value: `${(0, _cssinjs.unit)(token.borderRadiusLG)} 0 0 ${(0, _cssinjs.unit)(token.borderRadiusLG)}`
- }
- },
- [`${componentCls}-tab-active`]: {
- borderRightColor: {
- _skip_check_: true,
- value: token.colorBgContainer
- }
- }
- }
- },
- [`&${componentCls}-right`]: {
- [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
- [`${componentCls}-tab`]: {
- borderRadius: {
- _skip_check_: true,
- value: `0 ${(0, _cssinjs.unit)(token.borderRadiusLG)} ${(0, _cssinjs.unit)(token.borderRadiusLG)} 0`
- }
- },
- [`${componentCls}-tab-active`]: {
- borderLeftColor: {
- _skip_check_: true,
- value: token.colorBgContainer
- }
- }
- }
- }
- }
- };
- };
- const genDropdownStyle = token => {
- const {
- componentCls,
- itemHoverColor,
- dropdownEdgeChildVerticalPadding
- } = token;
- return {
- [`${componentCls}-dropdown`]: Object.assign(Object.assign({}, (0, _style.resetComponent)(token)), {
- position: 'absolute',
- top: -9999,
- left: {
- _skip_check_: true,
- value: -9999
- },
- zIndex: token.zIndexPopup,
- display: 'block',
- '&-hidden': {
- display: 'none'
- },
- [`${componentCls}-dropdown-menu`]: {
- maxHeight: token.tabsDropdownHeight,
- margin: 0,
- padding: `${(0, _cssinjs.unit)(dropdownEdgeChildVerticalPadding)} 0`,
- overflowX: 'hidden',
- overflowY: 'auto',
- textAlign: {
- _skip_check_: true,
- value: 'left'
- },
- listStyleType: 'none',
- backgroundColor: token.colorBgContainer,
- backgroundClip: 'padding-box',
- borderRadius: token.borderRadiusLG,
- outline: 'none',
- boxShadow: token.boxShadowSecondary,
- '&-item': Object.assign(Object.assign({}, _style.textEllipsis), {
- display: 'flex',
- alignItems: 'center',
- minWidth: token.tabsDropdownWidth,
- margin: 0,
- padding: `${(0, _cssinjs.unit)(token.paddingXXS)} ${(0, _cssinjs.unit)(token.paddingSM)}`,
- color: token.colorText,
- fontWeight: 'normal',
- fontSize: token.fontSize,
- lineHeight: token.lineHeight,
- cursor: 'pointer',
- transition: `all ${token.motionDurationSlow}`,
- '> span': {
- flex: 1,
- whiteSpace: 'nowrap'
- },
- '&-remove': {
- flex: 'none',
- marginLeft: {
- _skip_check_: true,
- value: token.marginSM
- },
- color: token.colorIcon,
- fontSize: token.fontSizeSM,
- background: 'transparent',
- border: 0,
- cursor: 'pointer',
- '&:hover': {
- color: itemHoverColor
- }
- },
- '&:hover': {
- background: token.controlItemBgHover
- },
- '&-disabled': {
- '&, &:hover': {
- color: token.colorTextDisabled,
- background: 'transparent',
- cursor: 'not-allowed'
- }
- }
- })
- }
- })
- };
- };
- const genPositionStyle = token => {
- const {
- componentCls,
- margin,
- colorBorderSecondary,
- horizontalMargin,
- verticalItemPadding,
- verticalItemMargin,
- calc
- } = token;
- return {
- // ========================== Top & Bottom ==========================
- [`${componentCls}-top, ${componentCls}-bottom`]: {
- flexDirection: 'column',
- [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
- margin: horizontalMargin,
- '&::before': {
- position: 'absolute',
- right: {
- _skip_check_: true,
- value: 0
- },
- left: {
- _skip_check_: true,
- value: 0
- },
- borderBottom: `${(0, _cssinjs.unit)(token.lineWidth)} ${token.lineType} ${colorBorderSecondary}`,
- content: "''"
- },
- [`${componentCls}-ink-bar`]: {
- height: token.lineWidthBold,
- '&-animated': {
- transition: `width ${token.motionDurationSlow}, left ${token.motionDurationSlow},
- right ${token.motionDurationSlow}`
- }
- },
- [`${componentCls}-nav-wrap`]: {
- '&::before, &::after': {
- top: 0,
- bottom: 0,
- width: token.controlHeight
- },
- '&::before': {
- left: {
- _skip_check_: true,
- value: 0
- },
- boxShadow: token.boxShadowTabsOverflowLeft
- },
- '&::after': {
- right: {
- _skip_check_: true,
- value: 0
- },
- boxShadow: token.boxShadowTabsOverflowRight
- },
- [`&${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,
- marginTop: margin,
- 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',
- minWidth: calc(token.controlHeight).mul(1.25).equal(),
- // >>>>>>>>>>> Tab
- [`${componentCls}-tab`]: {
- padding: verticalItemPadding,
- textAlign: 'center'
- },
- [`${componentCls}-tab + ${componentCls}-tab`]: {
- margin: verticalItemMargin
- },
- // >>>>>>>>>>> Nav
- [`${componentCls}-nav-wrap`]: {
- flexDirection: 'column',
- '&::before, &::after': {
- right: {
- _skip_check_: true,
- value: 0
- },
- left: {
- _skip_check_: true,
- value: 0
- },
- height: token.controlHeight
- },
- '&::before': {
- top: 0,
- boxShadow: token.boxShadowTabsOverflowTop
- },
- '&::after': {
- bottom: 0,
- boxShadow: token.boxShadowTabsOverflowBottom
- },
- [`&${componentCls}-nav-wrap-ping-top::before`]: {
- opacity: 1
- },
- [`&${componentCls}-nav-wrap-ping-bottom::after`]: {
- opacity: 1
- }
- },
- // >>>>>>>>>>> Ink Bar
- [`${componentCls}-ink-bar`]: {
- width: token.lineWidthBold,
- '&-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,
- value: (0, _cssinjs.unit)(calc(token.lineWidth).mul(-1).equal())
- },
- borderLeft: {
- _skip_check_: true,
- value: `${(0, _cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`
- },
- [`> ${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,
- value: calc(token.lineWidth).mul(-1).equal()
- },
- borderRight: {
- _skip_check_: true,
- value: `${(0, _cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`
- },
- [`> ${componentCls}-content > ${componentCls}-tabpane`]: {
- paddingRight: {
- _skip_check_: true,
- value: token.paddingLG
- }
- }
- }
- }
- };
- };
- const genSizeStyle = token => {
- const {
- componentCls,
- cardPaddingSM,
- cardPaddingLG,
- cardHeightSM,
- cardHeightLG,
- horizontalItemPaddingSM,
- horizontalItemPaddingLG
- } = token;
- return {
- // >>>>> shared
- [componentCls]: {
- '&-small': {
- [`> ${componentCls}-nav`]: {
- [`${componentCls}-tab`]: {
- padding: horizontalItemPaddingSM,
- fontSize: token.titleFontSizeSM
- }
- }
- },
- '&-large': {
- [`> ${componentCls}-nav`]: {
- [`${componentCls}-tab`]: {
- padding: horizontalItemPaddingLG,
- fontSize: token.titleFontSizeLG,
- lineHeight: token.lineHeightLG
- }
- }
- }
- },
- // >>>>> card
- [`${componentCls}-card`]: {
- // Small
- [`&${componentCls}-small`]: {
- [`> ${componentCls}-nav`]: {
- [`${componentCls}-tab`]: {
- padding: cardPaddingSM
- },
- [`${componentCls}-nav-add`]: {
- minWidth: cardHeightSM,
- minHeight: cardHeightSM
- }
- },
- [`&${componentCls}-bottom`]: {
- [`> ${componentCls}-nav ${componentCls}-tab`]: {
- borderRadius: `0 0 ${(0, _cssinjs.unit)(token.borderRadius)} ${(0, _cssinjs.unit)(token.borderRadius)}`
- }
- },
- [`&${componentCls}-top`]: {
- [`> ${componentCls}-nav ${componentCls}-tab`]: {
- borderRadius: `${(0, _cssinjs.unit)(token.borderRadius)} ${(0, _cssinjs.unit)(token.borderRadius)} 0 0`
- }
- },
- [`&${componentCls}-right`]: {
- [`> ${componentCls}-nav ${componentCls}-tab`]: {
- borderRadius: {
- _skip_check_: true,
- value: `0 ${(0, _cssinjs.unit)(token.borderRadius)} ${(0, _cssinjs.unit)(token.borderRadius)} 0`
- }
- }
- },
- [`&${componentCls}-left`]: {
- [`> ${componentCls}-nav ${componentCls}-tab`]: {
- borderRadius: {
- _skip_check_: true,
- value: `${(0, _cssinjs.unit)(token.borderRadius)} 0 0 ${(0, _cssinjs.unit)(token.borderRadius)}`
- }
- }
- }
- },
- // Large
- [`&${componentCls}-large`]: {
- [`> ${componentCls}-nav`]: {
- [`${componentCls}-tab`]: {
- padding: cardPaddingLG
- },
- [`${componentCls}-nav-add`]: {
- minWidth: cardHeightLG,
- minHeight: cardHeightLG
- }
- }
- }
- }
- };
- };
- const genTabStyle = token => {
- const {
- componentCls,
- itemActiveColor,
- itemHoverColor,
- iconCls,
- tabsHorizontalItemMargin,
- horizontalItemPadding,
- itemSelectedColor,
- itemColor
- } = token;
- const tabCls = `${componentCls}-tab`;
- return {
- [tabCls]: {
- position: 'relative',
- WebkitTouchCallout: 'none',
- WebkitTapHighlightColor: 'transparent',
- display: 'inline-flex',
- alignItems: 'center',
- padding: horizontalItemPadding,
- fontSize: token.titleFontSize,
- background: 'transparent',
- border: 0,
- outline: 'none',
- cursor: 'pointer',
- color: itemColor,
- '&-btn, &-remove': {
- '&:focus:not(:focus-visible), &:active': {
- color: itemActiveColor
- }
- },
- '&-btn': {
- outline: 'none',
- transition: `all ${token.motionDurationSlow}`,
- [`${tabCls}-icon:not(:last-child)`]: {
- marginInlineEnd: token.marginSM
- }
- },
- '&-remove': Object.assign({
- flex: 'none',
- lineHeight: 1,
- marginRight: {
- _skip_check_: true,
- value: token.calc(token.marginXXS).mul(-1).equal()
- },
- marginLeft: {
- _skip_check_: true,
- value: token.marginXS
- },
- color: token.colorIcon,
- fontSize: token.fontSizeSM,
- background: 'transparent',
- border: 'none',
- outline: 'none',
- cursor: 'pointer',
- transition: `all ${token.motionDurationSlow}`,
- '&:hover': {
- color: token.colorTextHeading
- }
- }, (0, _style.genFocusStyle)(token)),
- '&:hover': {
- color: itemHoverColor
- },
- [`&${tabCls}-active ${tabCls}-btn`]: {
- color: itemSelectedColor,
- textShadow: token.tabsActiveTextShadow
- },
- [`&${tabCls}-focus ${tabCls}-btn:focus-visible`]: (0, _style.genFocusOutline)(token),
- [`&${tabCls}-disabled`]: {
- color: token.colorTextDisabled,
- cursor: 'not-allowed'
- },
- [`&${tabCls}-disabled ${tabCls}-btn, &${tabCls}-disabled ${componentCls}-remove`]: {
- '&:focus, &:active': {
- color: token.colorTextDisabled
- }
- },
- [`& ${tabCls}-remove ${iconCls}`]: {
- margin: 0,
- verticalAlign: 'middle'
- },
- [`${iconCls}:not(:last-child)`]: {
- marginRight: {
- _skip_check_: true,
- value: token.marginSM
- }
- }
- },
- [`${tabCls} + ${tabCls}`]: {
- margin: {
- _skip_check_: true,
- value: tabsHorizontalItemMargin
- }
- }
- };
- };
- const genRtlStyle = token => {
- const {
- componentCls,
- tabsHorizontalItemMarginRTL,
- iconCls,
- cardGutter,
- calc
- } = token;
- const rtlCls = `${componentCls}-rtl`;
- return {
- [rtlCls]: {
- direction: 'rtl',
- [`${componentCls}-nav`]: {
- [`${componentCls}-tab`]: {
- margin: {
- _skip_check_: true,
- value: tabsHorizontalItemMarginRTL
- },
- [`${componentCls}-tab:last-of-type`]: {
- marginLeft: {
- _skip_check_: true,
- value: 0
- }
- },
- [iconCls]: {
- marginRight: {
- _skip_check_: true,
- value: 0
- },
- marginLeft: {
- _skip_check_: true,
- value: (0, _cssinjs.unit)(token.marginSM)
- }
- },
- [`${componentCls}-tab-remove`]: {
- marginRight: {
- _skip_check_: true,
- value: (0, _cssinjs.unit)(token.marginXS)
- },
- marginLeft: {
- _skip_check_: true,
- value: (0, _cssinjs.unit)(calc(token.marginXXS).mul(-1).equal())
- },
- [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,
- value: cardGutter
- },
- 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 = token => {
- const {
- componentCls,
- tabsCardPadding,
- cardHeight,
- cardGutter,
- itemHoverColor,
- itemActiveColor,
- colorBorderSecondary
- } = token;
- return {
- [componentCls]: Object.assign(Object.assign(Object.assign(Object.assign({}, (0, _style.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',
- padding: tabsCardPadding,
- background: 'transparent',
- border: 0,
- color: token.colorText,
- '&::after': {
- position: 'absolute',
- right: {
- _skip_check_: true,
- value: 0
- },
- bottom: 0,
- left: {
- _skip_check_: true,
- value: 0
- },
- height: token.calc(token.controlHeightLG).div(8).equal(),
- transform: 'translateY(100%)',
- content: "''"
- }
- },
- [`${componentCls}-nav-add`]: Object.assign({
- minWidth: cardHeight,
- minHeight: cardHeight,
- marginLeft: {
- _skip_check_: true,
- value: cardGutter
- },
- background: 'transparent',
- border: `${(0, _cssinjs.unit)(token.lineWidth)} ${token.lineType} ${colorBorderSecondary}`,
- borderRadius: `${(0, _cssinjs.unit)(token.borderRadiusLG)} ${(0, _cssinjs.unit)(token.borderRadiusLG)} 0 0`,
- outline: 'none',
- cursor: 'pointer',
- color: token.colorText,
- transition: `all ${token.motionDurationSlow} ${token.motionEaseInOut}`,
- '&:hover': {
- color: itemHoverColor
- },
- '&:active, &:focus:not(:focus-visible)': {
- color: itemActiveColor
- }
- }, (0, _style.genFocusStyle)(token, -3))
- },
- [`${componentCls}-extra-content`]: {
- flex: 'none'
- },
- // ============================ InkBar ============================
- [`${componentCls}-ink-bar`]: {
- position: 'absolute',
- background: token.inkBarColor,
- pointerEvents: 'none'
- }
- }), genTabStyle(token)), {
- // =========================== TabPanes ===========================
- [`${componentCls}-content`]: {
- position: 'relative',
- width: '100%'
- },
- [`${componentCls}-content-holder`]: {
- flex: 'auto',
- minWidth: 0,
- minHeight: 0
- },
- [`${componentCls}-tabpane`]: Object.assign(Object.assign({}, (0, _style.genFocusStyle)(token)), {
- '&-hidden': {
- display: 'none'
- }
- })
- }),
- [`${componentCls}-centered`]: {
- [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
- [`${componentCls}-nav-wrap`]: {
- [`&:not([class*='${componentCls}-nav-wrap-ping']) > ${componentCls}-nav-list`]: {
- margin: 'auto'
- }
- }
- }
- }
- };
- };
- const prepareComponentToken = token => {
- const {
- cardHeight,
- cardHeightSM,
- cardHeightLG,
- controlHeight,
- controlHeightLG
- } = token;
- const mergedCardHeight = cardHeight || controlHeightLG;
- const mergedCardHeightSM = cardHeightSM || controlHeight;
- // `controlHeight` missing XL variable, so we directly write it here:
- const mergedCardHeightLG = cardHeightLG || controlHeightLG + 8;
- return {
- zIndexPopup: token.zIndexPopupBase + 50,
- cardBg: token.colorFillAlter,
- // We can not pass this as valid value,
- // Since `cardHeight` will lock nav add button height.
- cardHeight: mergedCardHeight,
- cardHeightSM: mergedCardHeightSM,
- cardHeightLG: mergedCardHeightLG,
- // Initialize with empty string, because cardPadding will be calculated with cardHeight by default.
- cardPadding: `${(mergedCardHeight - token.fontHeight) / 2 - token.lineWidth}px ${token.padding}px`,
- cardPaddingSM: `${(mergedCardHeightSM - token.fontHeight) / 2 - token.lineWidth}px ${token.paddingXS}px`,
- cardPaddingLG: `${(mergedCardHeightLG - token.fontHeightLG) / 2 - token.lineWidth}px ${token.padding}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
- };
- };
- // ============================== Export ==============================
- exports.prepareComponentToken = prepareComponentToken;
- var _default = exports.default = (0, _internal.genStyleHooks)('Tabs', token => {
- const tabsToken = (0, _internal.mergeToken)(token, {
- // `cardPadding` is empty by default, so we could calculate with dynamic `cardHeight`
- tabsCardPadding: token.cardPadding,
- dropdownEdgeChildVerticalPadding: token.paddingXXS,
- tabsActiveTextShadow: '0 0 0.25px currentcolor',
- tabsDropdownHeight: 200,
- tabsDropdownWidth: 120,
- tabsHorizontalItemMargin: `0 0 0 ${(0, _cssinjs.unit)(token.horizontalItemGutter)}`,
- tabsHorizontalItemMarginRTL: `0 0 0 ${(0, _cssinjs.unit)(token.horizontalItemGutter)}`
- });
- return [genSizeStyle(tabsToken), genRtlStyle(tabsToken), genPositionStyle(tabsToken), genDropdownStyle(tabsToken), genCardStyle(tabsToken), genTabsStyle(tabsToken), (0, _motion.default)(tabsToken)];
- }, prepareComponentToken);
|