index.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786
  1. import _extends from "@babel/runtime/helpers/esm/extends";
  2. import '../../_util/cssinjs';
  3. import { genComponentStyleHook, mergeToken } from '../../theme/internal';
  4. import { genFocusStyle, resetComponent, textEllipsis } from '../../style';
  5. import genMotionStyle from './motion';
  6. const genCardStyle = token => {
  7. const {
  8. componentCls,
  9. tabsCardHorizontalPadding,
  10. tabsCardHeadBackground,
  11. tabsCardGutter,
  12. colorSplit
  13. } = token;
  14. return {
  15. [`${componentCls}-card`]: {
  16. [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
  17. [`${componentCls}-tab`]: {
  18. margin: 0,
  19. padding: tabsCardHorizontalPadding,
  20. background: tabsCardHeadBackground,
  21. border: `${token.lineWidth}px ${token.lineType} ${colorSplit}`,
  22. transition: `all ${token.motionDurationSlow} ${token.motionEaseInOut}`
  23. },
  24. [`${componentCls}-tab-active`]: {
  25. color: token.colorPrimary,
  26. background: token.colorBgContainer
  27. },
  28. [`${componentCls}-ink-bar`]: {
  29. visibility: 'hidden'
  30. }
  31. },
  32. // ========================== Top & Bottom ==========================
  33. [`&${componentCls}-top, &${componentCls}-bottom`]: {
  34. [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
  35. [`${componentCls}-tab + ${componentCls}-tab`]: {
  36. marginLeft: {
  37. _skip_check_: true,
  38. value: `${tabsCardGutter}px`
  39. }
  40. }
  41. }
  42. },
  43. [`&${componentCls}-top`]: {
  44. [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
  45. [`${componentCls}-tab`]: {
  46. borderRadius: `${token.borderRadiusLG}px ${token.borderRadiusLG}px 0 0`
  47. },
  48. [`${componentCls}-tab-active`]: {
  49. borderBottomColor: token.colorBgContainer
  50. }
  51. }
  52. },
  53. [`&${componentCls}-bottom`]: {
  54. [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
  55. [`${componentCls}-tab`]: {
  56. borderRadius: `0 0 ${token.borderRadiusLG}px ${token.borderRadiusLG}px`
  57. },
  58. [`${componentCls}-tab-active`]: {
  59. borderTopColor: token.colorBgContainer
  60. }
  61. }
  62. },
  63. // ========================== Left & Right ==========================
  64. [`&${componentCls}-left, &${componentCls}-right`]: {
  65. [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
  66. [`${componentCls}-tab + ${componentCls}-tab`]: {
  67. marginTop: `${tabsCardGutter}px`
  68. }
  69. }
  70. },
  71. [`&${componentCls}-left`]: {
  72. [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
  73. [`${componentCls}-tab`]: {
  74. borderRadius: {
  75. _skip_check_: true,
  76. value: `${token.borderRadiusLG}px 0 0 ${token.borderRadiusLG}px`
  77. }
  78. },
  79. [`${componentCls}-tab-active`]: {
  80. borderRightColor: {
  81. _skip_check_: true,
  82. value: token.colorBgContainer
  83. }
  84. }
  85. }
  86. },
  87. [`&${componentCls}-right`]: {
  88. [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
  89. [`${componentCls}-tab`]: {
  90. borderRadius: {
  91. _skip_check_: true,
  92. value: `0 ${token.borderRadiusLG}px ${token.borderRadiusLG}px 0`
  93. }
  94. },
  95. [`${componentCls}-tab-active`]: {
  96. borderLeftColor: {
  97. _skip_check_: true,
  98. value: token.colorBgContainer
  99. }
  100. }
  101. }
  102. }
  103. }
  104. };
  105. };
  106. const genDropdownStyle = token => {
  107. const {
  108. componentCls,
  109. tabsHoverColor,
  110. dropdownEdgeChildVerticalPadding
  111. } = token;
  112. return {
  113. [`${componentCls}-dropdown`]: _extends(_extends({}, resetComponent(token)), {
  114. position: 'absolute',
  115. top: -9999,
  116. left: {
  117. _skip_check_: true,
  118. value: -9999
  119. },
  120. zIndex: token.zIndexPopup,
  121. display: 'block',
  122. '&-hidden': {
  123. display: 'none'
  124. },
  125. [`${componentCls}-dropdown-menu`]: {
  126. maxHeight: token.tabsDropdownHeight,
  127. margin: 0,
  128. padding: `${dropdownEdgeChildVerticalPadding}px 0`,
  129. overflowX: 'hidden',
  130. overflowY: 'auto',
  131. textAlign: {
  132. _skip_check_: true,
  133. value: 'left'
  134. },
  135. listStyleType: 'none',
  136. backgroundColor: token.colorBgContainer,
  137. backgroundClip: 'padding-box',
  138. borderRadius: token.borderRadiusLG,
  139. outline: 'none',
  140. boxShadow: token.boxShadowSecondary,
  141. '&-item': _extends(_extends({}, textEllipsis), {
  142. display: 'flex',
  143. alignItems: 'center',
  144. minWidth: token.tabsDropdownWidth,
  145. margin: 0,
  146. padding: `${token.paddingXXS}px ${token.paddingSM}px`,
  147. color: token.colorText,
  148. fontWeight: 'normal',
  149. fontSize: token.fontSize,
  150. lineHeight: token.lineHeight,
  151. cursor: 'pointer',
  152. transition: `all ${token.motionDurationSlow}`,
  153. '> span': {
  154. flex: 1,
  155. whiteSpace: 'nowrap'
  156. },
  157. '&-remove': {
  158. flex: 'none',
  159. marginLeft: {
  160. _skip_check_: true,
  161. value: token.marginSM
  162. },
  163. color: token.colorTextDescription,
  164. fontSize: token.fontSizeSM,
  165. background: 'transparent',
  166. border: 0,
  167. cursor: 'pointer',
  168. '&:hover': {
  169. color: tabsHoverColor
  170. }
  171. },
  172. '&:hover': {
  173. background: token.controlItemBgHover
  174. },
  175. '&-disabled': {
  176. '&, &:hover': {
  177. color: token.colorTextDisabled,
  178. background: 'transparent',
  179. cursor: 'not-allowed'
  180. }
  181. }
  182. })
  183. }
  184. })
  185. };
  186. };
  187. const genPositionStyle = token => {
  188. const {
  189. componentCls,
  190. margin,
  191. colorSplit
  192. } = token;
  193. return {
  194. // ========================== Top & Bottom ==========================
  195. [`${componentCls}-top, ${componentCls}-bottom`]: {
  196. flexDirection: 'column',
  197. [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
  198. margin: `0 0 ${margin}px 0`,
  199. '&::before': {
  200. position: 'absolute',
  201. right: {
  202. _skip_check_: true,
  203. value: 0
  204. },
  205. left: {
  206. _skip_check_: true,
  207. value: 0
  208. },
  209. borderBottom: `${token.lineWidth}px ${token.lineType} ${colorSplit}`,
  210. content: "''"
  211. },
  212. [`${componentCls}-ink-bar`]: {
  213. height: token.lineWidthBold,
  214. '&-animated': {
  215. transition: `width ${token.motionDurationSlow}, left ${token.motionDurationSlow},
  216. right ${token.motionDurationSlow}`
  217. }
  218. },
  219. [`${componentCls}-nav-wrap`]: {
  220. '&::before, &::after': {
  221. top: 0,
  222. bottom: 0,
  223. width: token.controlHeight
  224. },
  225. '&::before': {
  226. left: {
  227. _skip_check_: true,
  228. value: 0
  229. },
  230. boxShadow: token.boxShadowTabsOverflowLeft
  231. },
  232. '&::after': {
  233. right: {
  234. _skip_check_: true,
  235. value: 0
  236. },
  237. boxShadow: token.boxShadowTabsOverflowRight
  238. },
  239. [`&${componentCls}-nav-wrap-ping-left::before`]: {
  240. opacity: 1
  241. },
  242. [`&${componentCls}-nav-wrap-ping-right::after`]: {
  243. opacity: 1
  244. }
  245. }
  246. }
  247. },
  248. [`${componentCls}-top`]: {
  249. [`> ${componentCls}-nav,
  250. > div > ${componentCls}-nav`]: {
  251. '&::before': {
  252. bottom: 0
  253. },
  254. [`${componentCls}-ink-bar`]: {
  255. bottom: 0
  256. }
  257. }
  258. },
  259. [`${componentCls}-bottom`]: {
  260. [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
  261. order: 1,
  262. marginTop: `${margin}px`,
  263. marginBottom: 0,
  264. '&::before': {
  265. top: 0
  266. },
  267. [`${componentCls}-ink-bar`]: {
  268. top: 0
  269. }
  270. },
  271. [`> ${componentCls}-content-holder, > div > ${componentCls}-content-holder`]: {
  272. order: 0
  273. }
  274. },
  275. // ========================== Left & Right ==========================
  276. [`${componentCls}-left, ${componentCls}-right`]: {
  277. [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
  278. flexDirection: 'column',
  279. minWidth: token.controlHeight * 1.25,
  280. // >>>>>>>>>>> Tab
  281. [`${componentCls}-tab`]: {
  282. padding: `${token.paddingXS}px ${token.paddingLG}px`,
  283. textAlign: 'center'
  284. },
  285. [`${componentCls}-tab + ${componentCls}-tab`]: {
  286. margin: `${token.margin}px 0 0 0`
  287. },
  288. // >>>>>>>>>>> Nav
  289. [`${componentCls}-nav-wrap`]: {
  290. flexDirection: 'column',
  291. '&::before, &::after': {
  292. right: {
  293. _skip_check_: true,
  294. value: 0
  295. },
  296. left: {
  297. _skip_check_: true,
  298. value: 0
  299. },
  300. height: token.controlHeight
  301. },
  302. '&::before': {
  303. top: 0,
  304. boxShadow: token.boxShadowTabsOverflowTop
  305. },
  306. '&::after': {
  307. bottom: 0,
  308. boxShadow: token.boxShadowTabsOverflowBottom
  309. },
  310. [`&${componentCls}-nav-wrap-ping-top::before`]: {
  311. opacity: 1
  312. },
  313. [`&${componentCls}-nav-wrap-ping-bottom::after`]: {
  314. opacity: 1
  315. }
  316. },
  317. // >>>>>>>>>>> Ink Bar
  318. [`${componentCls}-ink-bar`]: {
  319. width: token.lineWidthBold,
  320. '&-animated': {
  321. transition: `height ${token.motionDurationSlow}, top ${token.motionDurationSlow}`
  322. }
  323. },
  324. [`${componentCls}-nav-list, ${componentCls}-nav-operations`]: {
  325. flex: '1 0 auto',
  326. flexDirection: 'column'
  327. }
  328. }
  329. },
  330. [`${componentCls}-left`]: {
  331. [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
  332. [`${componentCls}-ink-bar`]: {
  333. right: {
  334. _skip_check_: true,
  335. value: 0
  336. }
  337. }
  338. },
  339. [`> ${componentCls}-content-holder, > div > ${componentCls}-content-holder`]: {
  340. marginLeft: {
  341. _skip_check_: true,
  342. value: `-${token.lineWidth}px`
  343. },
  344. borderLeft: {
  345. _skip_check_: true,
  346. value: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`
  347. },
  348. [`> ${componentCls}-content > ${componentCls}-tabpane`]: {
  349. paddingLeft: {
  350. _skip_check_: true,
  351. value: token.paddingLG
  352. }
  353. }
  354. }
  355. },
  356. [`${componentCls}-right`]: {
  357. [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
  358. order: 1,
  359. [`${componentCls}-ink-bar`]: {
  360. left: {
  361. _skip_check_: true,
  362. value: 0
  363. }
  364. }
  365. },
  366. [`> ${componentCls}-content-holder, > div > ${componentCls}-content-holder`]: {
  367. order: 0,
  368. marginRight: {
  369. _skip_check_: true,
  370. value: -token.lineWidth
  371. },
  372. borderRight: {
  373. _skip_check_: true,
  374. value: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`
  375. },
  376. [`> ${componentCls}-content > ${componentCls}-tabpane`]: {
  377. paddingRight: {
  378. _skip_check_: true,
  379. value: token.paddingLG
  380. }
  381. }
  382. }
  383. }
  384. };
  385. };
  386. const genSizeStyle = token => {
  387. const {
  388. componentCls,
  389. padding
  390. } = token;
  391. return {
  392. [componentCls]: {
  393. '&-small': {
  394. [`> ${componentCls}-nav`]: {
  395. [`${componentCls}-tab`]: {
  396. padding: `${token.paddingXS}px 0`,
  397. fontSize: token.fontSize
  398. }
  399. }
  400. },
  401. '&-large': {
  402. [`> ${componentCls}-nav`]: {
  403. [`${componentCls}-tab`]: {
  404. padding: `${padding}px 0`,
  405. fontSize: token.fontSizeLG
  406. }
  407. }
  408. }
  409. },
  410. [`${componentCls}-card`]: {
  411. [`&${componentCls}-small`]: {
  412. [`> ${componentCls}-nav`]: {
  413. [`${componentCls}-tab`]: {
  414. padding: `${token.paddingXXS * 1.5}px ${padding}px`
  415. }
  416. },
  417. [`&${componentCls}-bottom`]: {
  418. [`> ${componentCls}-nav ${componentCls}-tab`]: {
  419. borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`
  420. }
  421. },
  422. [`&${componentCls}-top`]: {
  423. [`> ${componentCls}-nav ${componentCls}-tab`]: {
  424. borderRadius: `${token.borderRadius}px ${token.borderRadius}px 0 0`
  425. }
  426. },
  427. [`&${componentCls}-right`]: {
  428. [`> ${componentCls}-nav ${componentCls}-tab`]: {
  429. borderRadius: {
  430. _skip_check_: true,
  431. value: `0 ${token.borderRadius}px ${token.borderRadius}px 0`
  432. }
  433. }
  434. },
  435. [`&${componentCls}-left`]: {
  436. [`> ${componentCls}-nav ${componentCls}-tab`]: {
  437. borderRadius: {
  438. _skip_check_: true,
  439. value: `${token.borderRadius}px 0 0 ${token.borderRadius}px`
  440. }
  441. }
  442. }
  443. },
  444. [`&${componentCls}-large`]: {
  445. [`> ${componentCls}-nav`]: {
  446. [`${componentCls}-tab`]: {
  447. padding: `${token.paddingXS}px ${padding}px ${token.paddingXXS * 1.5}px`
  448. }
  449. }
  450. }
  451. }
  452. };
  453. };
  454. const genTabStyle = token => {
  455. const {
  456. componentCls,
  457. tabsActiveColor,
  458. tabsHoverColor,
  459. iconCls,
  460. tabsHorizontalGutter
  461. } = token;
  462. const tabCls = `${componentCls}-tab`;
  463. return {
  464. [tabCls]: {
  465. position: 'relative',
  466. display: 'inline-flex',
  467. alignItems: 'center',
  468. padding: `${token.paddingSM}px 0`,
  469. fontSize: `${token.fontSize}px`,
  470. background: 'transparent',
  471. border: 0,
  472. outline: 'none',
  473. cursor: 'pointer',
  474. '&-btn, &-remove': _extends({
  475. '&:focus:not(:focus-visible), &:active': {
  476. color: tabsActiveColor
  477. }
  478. }, genFocusStyle(token)),
  479. '&-btn': {
  480. outline: 'none',
  481. transition: 'all 0.3s'
  482. },
  483. '&-remove': {
  484. flex: 'none',
  485. marginRight: {
  486. _skip_check_: true,
  487. value: -token.marginXXS
  488. },
  489. marginLeft: {
  490. _skip_check_: true,
  491. value: token.marginXS
  492. },
  493. color: token.colorTextDescription,
  494. fontSize: token.fontSizeSM,
  495. background: 'transparent',
  496. border: 'none',
  497. outline: 'none',
  498. cursor: 'pointer',
  499. transition: `all ${token.motionDurationSlow}`,
  500. '&:hover': {
  501. color: token.colorTextHeading
  502. }
  503. },
  504. '&:hover': {
  505. color: tabsHoverColor
  506. },
  507. [`&${tabCls}-active ${tabCls}-btn`]: {
  508. color: token.colorPrimary,
  509. textShadow: token.tabsActiveTextShadow
  510. },
  511. [`&${tabCls}-disabled`]: {
  512. color: token.colorTextDisabled,
  513. cursor: 'not-allowed'
  514. },
  515. [`&${tabCls}-disabled ${tabCls}-btn, &${tabCls}-disabled ${componentCls}-remove`]: {
  516. '&:focus, &:active': {
  517. color: token.colorTextDisabled
  518. }
  519. },
  520. [`& ${tabCls}-remove ${iconCls}`]: {
  521. margin: 0
  522. },
  523. [iconCls]: {
  524. marginRight: {
  525. _skip_check_: true,
  526. value: token.marginSM
  527. }
  528. }
  529. },
  530. [`${tabCls} + ${tabCls}`]: {
  531. margin: {
  532. _skip_check_: true,
  533. value: `0 0 0 ${tabsHorizontalGutter}px`
  534. }
  535. }
  536. };
  537. };
  538. const genRtlStyle = token => {
  539. const {
  540. componentCls,
  541. tabsHorizontalGutter,
  542. iconCls,
  543. tabsCardGutter
  544. } = token;
  545. const rtlCls = `${componentCls}-rtl`;
  546. return {
  547. [rtlCls]: {
  548. direction: 'rtl',
  549. [`${componentCls}-nav`]: {
  550. [`${componentCls}-tab`]: {
  551. margin: {
  552. _skip_check_: true,
  553. value: `0 0 0 ${tabsHorizontalGutter}px`
  554. },
  555. [`${componentCls}-tab:last-of-type`]: {
  556. marginLeft: {
  557. _skip_check_: true,
  558. value: 0
  559. }
  560. },
  561. [iconCls]: {
  562. marginRight: {
  563. _skip_check_: true,
  564. value: 0
  565. },
  566. marginLeft: {
  567. _skip_check_: true,
  568. value: `${token.marginSM}px`
  569. }
  570. },
  571. [`${componentCls}-tab-remove`]: {
  572. marginRight: {
  573. _skip_check_: true,
  574. value: `${token.marginXS}px`
  575. },
  576. marginLeft: {
  577. _skip_check_: true,
  578. value: `-${token.marginXXS}px`
  579. },
  580. [iconCls]: {
  581. margin: 0
  582. }
  583. }
  584. }
  585. },
  586. [`&${componentCls}-left`]: {
  587. [`> ${componentCls}-nav`]: {
  588. order: 1
  589. },
  590. [`> ${componentCls}-content-holder`]: {
  591. order: 0
  592. }
  593. },
  594. [`&${componentCls}-right`]: {
  595. [`> ${componentCls}-nav`]: {
  596. order: 0
  597. },
  598. [`> ${componentCls}-content-holder`]: {
  599. order: 1
  600. }
  601. },
  602. // ====================== Card ======================
  603. [`&${componentCls}-card${componentCls}-top, &${componentCls}-card${componentCls}-bottom`]: {
  604. [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
  605. [`${componentCls}-tab + ${componentCls}-tab`]: {
  606. marginRight: {
  607. _skip_check_: true,
  608. value: `${tabsCardGutter}px`
  609. },
  610. marginLeft: {
  611. _skip_check_: true,
  612. value: 0
  613. }
  614. }
  615. }
  616. }
  617. },
  618. [`${componentCls}-dropdown-rtl`]: {
  619. direction: 'rtl'
  620. },
  621. [`${componentCls}-menu-item`]: {
  622. [`${componentCls}-dropdown-rtl`]: {
  623. textAlign: {
  624. _skip_check_: true,
  625. value: 'right'
  626. }
  627. }
  628. }
  629. };
  630. };
  631. const genTabsStyle = token => {
  632. const {
  633. componentCls,
  634. tabsCardHorizontalPadding,
  635. tabsCardHeight,
  636. tabsCardGutter,
  637. tabsHoverColor,
  638. tabsActiveColor,
  639. colorSplit
  640. } = token;
  641. return {
  642. [componentCls]: _extends(_extends(_extends(_extends({}, resetComponent(token)), {
  643. display: 'flex',
  644. // ========================== Navigation ==========================
  645. [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
  646. position: 'relative',
  647. display: 'flex',
  648. flex: 'none',
  649. alignItems: 'center',
  650. [`${componentCls}-nav-wrap`]: {
  651. position: 'relative',
  652. display: 'flex',
  653. flex: 'auto',
  654. alignSelf: 'stretch',
  655. overflow: 'hidden',
  656. whiteSpace: 'nowrap',
  657. transform: 'translate(0)',
  658. // >>>>> Ping shadow
  659. '&::before, &::after': {
  660. position: 'absolute',
  661. zIndex: 1,
  662. opacity: 0,
  663. transition: `opacity ${token.motionDurationSlow}`,
  664. content: "''",
  665. pointerEvents: 'none'
  666. }
  667. },
  668. [`${componentCls}-nav-list`]: {
  669. position: 'relative',
  670. display: 'flex',
  671. transition: `opacity ${token.motionDurationSlow}`
  672. },
  673. // >>>>>>>> Operations
  674. [`${componentCls}-nav-operations`]: {
  675. display: 'flex',
  676. alignSelf: 'stretch'
  677. },
  678. [`${componentCls}-nav-operations-hidden`]: {
  679. position: 'absolute',
  680. visibility: 'hidden',
  681. pointerEvents: 'none'
  682. },
  683. [`${componentCls}-nav-more`]: {
  684. position: 'relative',
  685. padding: tabsCardHorizontalPadding,
  686. background: 'transparent',
  687. border: 0,
  688. '&::after': {
  689. position: 'absolute',
  690. right: {
  691. _skip_check_: true,
  692. value: 0
  693. },
  694. bottom: 0,
  695. left: {
  696. _skip_check_: true,
  697. value: 0
  698. },
  699. height: token.controlHeightLG / 8,
  700. transform: 'translateY(100%)',
  701. content: "''"
  702. }
  703. },
  704. [`${componentCls}-nav-add`]: _extends({
  705. minWidth: `${tabsCardHeight}px`,
  706. marginLeft: {
  707. _skip_check_: true,
  708. value: `${tabsCardGutter}px`
  709. },
  710. padding: `0 ${token.paddingXS}px`,
  711. background: 'transparent',
  712. border: `${token.lineWidth}px ${token.lineType} ${colorSplit}`,
  713. borderRadius: `${token.borderRadiusLG}px ${token.borderRadiusLG}px 0 0`,
  714. outline: 'none',
  715. cursor: 'pointer',
  716. color: token.colorText,
  717. transition: `all ${token.motionDurationSlow} ${token.motionEaseInOut}`,
  718. '&:hover': {
  719. color: tabsHoverColor
  720. },
  721. '&:active, &:focus:not(:focus-visible)': {
  722. color: tabsActiveColor
  723. }
  724. }, genFocusStyle(token))
  725. },
  726. [`${componentCls}-extra-content`]: {
  727. flex: 'none'
  728. },
  729. // ============================ InkBar ============================
  730. [`${componentCls}-ink-bar`]: {
  731. position: 'absolute',
  732. background: token.colorPrimary,
  733. pointerEvents: 'none'
  734. }
  735. }), genTabStyle(token)), {
  736. // =========================== TabPanes ===========================
  737. [`${componentCls}-content`]: {
  738. position: 'relative',
  739. display: 'flex',
  740. width: '100%',
  741. ['&-animated']: {
  742. transition: 'margin 0.3s'
  743. }
  744. },
  745. [`${componentCls}-content-holder`]: {
  746. flex: 'auto',
  747. minWidth: 0,
  748. minHeight: 0
  749. },
  750. [`${componentCls}-tabpane`]: {
  751. outline: 'none',
  752. flex: 'none',
  753. width: '100%'
  754. }
  755. }),
  756. [`${componentCls}-centered`]: {
  757. [`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
  758. [`${componentCls}-nav-wrap`]: {
  759. [`&:not([class*='${componentCls}-nav-wrap-ping'])`]: {
  760. justifyContent: 'center'
  761. }
  762. }
  763. }
  764. }
  765. };
  766. };
  767. // ============================== Export ==============================
  768. export default genComponentStyleHook('Tabs', token => {
  769. const tabsCardHeight = token.controlHeightLG;
  770. const tabsToken = mergeToken(token, {
  771. tabsHoverColor: token.colorPrimaryHover,
  772. tabsActiveColor: token.colorPrimaryActive,
  773. tabsCardHorizontalPadding: `${(tabsCardHeight - Math.round(token.fontSize * token.lineHeight)) / 2 - token.lineWidth}px ${token.padding}px`,
  774. tabsCardHeight,
  775. tabsCardGutter: token.marginXXS / 2,
  776. tabsHorizontalGutter: 32,
  777. tabsCardHeadBackground: token.colorFillAlter,
  778. dropdownEdgeChildVerticalPadding: token.paddingXXS,
  779. tabsActiveTextShadow: '0 0 0.25px currentcolor',
  780. tabsDropdownHeight: 200,
  781. tabsDropdownWidth: 120
  782. });
  783. return [genSizeStyle(tabsToken), genRtlStyle(tabsToken), genPositionStyle(tabsToken), genDropdownStyle(tabsToken), genCardStyle(tabsToken), genTabsStyle(tabsToken), genMotionStyle(tabsToken)];
  784. }, token => ({
  785. zIndexPopup: token.zIndexPopupBase + 50
  786. }));