nav.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. import _extends from "@babel/runtime/helpers/esm/extends";
  2. import { textEllipsis } from '../../style';
  3. const genStepsNavStyle = token => {
  4. const {
  5. componentCls,
  6. stepsNavContentMaxWidth,
  7. stepsNavArrowColor,
  8. stepsNavActiveColor,
  9. motionDurationSlow
  10. } = token;
  11. return {
  12. [`&${componentCls}-navigation`]: {
  13. paddingTop: token.paddingSM,
  14. [`&${componentCls}-small`]: {
  15. [`${componentCls}-item`]: {
  16. '&-container': {
  17. marginInlineStart: -token.marginSM
  18. }
  19. }
  20. },
  21. [`${componentCls}-item`]: {
  22. overflow: 'visible',
  23. textAlign: 'center',
  24. '&-container': {
  25. display: 'inline-block',
  26. height: '100%',
  27. marginInlineStart: -token.margin,
  28. paddingBottom: token.paddingSM,
  29. textAlign: 'start',
  30. transition: `opacity ${motionDurationSlow}`,
  31. [`${componentCls}-item-content`]: {
  32. maxWidth: stepsNavContentMaxWidth
  33. },
  34. [`${componentCls}-item-title`]: _extends(_extends({
  35. maxWidth: '100%',
  36. paddingInlineEnd: 0
  37. }, textEllipsis), {
  38. '&::after': {
  39. display: 'none'
  40. }
  41. })
  42. },
  43. [`&:not(${componentCls}-item-active)`]: {
  44. [`${componentCls}-item-container[role='button']`]: {
  45. cursor: 'pointer',
  46. '&:hover': {
  47. opacity: 0.85
  48. }
  49. }
  50. },
  51. '&:last-child': {
  52. flex: 1,
  53. '&::after': {
  54. display: 'none'
  55. }
  56. },
  57. '&::after': {
  58. position: 'absolute',
  59. top: `calc(50% - ${token.paddingSM / 2}px)`,
  60. insetInlineStart: '100%',
  61. display: 'inline-block',
  62. width: token.fontSizeIcon,
  63. height: token.fontSizeIcon,
  64. borderTop: `${token.lineWidth}px ${token.lineType} ${stepsNavArrowColor}`,
  65. borderBottom: 'none',
  66. borderInlineStart: 'none',
  67. borderInlineEnd: `${token.lineWidth}px ${token.lineType} ${stepsNavArrowColor}`,
  68. transform: 'translateY(-50%) translateX(-50%) rotate(45deg)',
  69. content: '""'
  70. },
  71. '&::before': {
  72. position: 'absolute',
  73. bottom: 0,
  74. insetInlineStart: '50%',
  75. display: 'inline-block',
  76. width: 0,
  77. height: token.lineWidthBold,
  78. backgroundColor: stepsNavActiveColor,
  79. transition: `width ${motionDurationSlow}, inset-inline-start ${motionDurationSlow}`,
  80. transitionTimingFunction: 'ease-out',
  81. content: '""'
  82. }
  83. },
  84. [`${componentCls}-item${componentCls}-item-active::before`]: {
  85. insetInlineStart: 0,
  86. width: '100%'
  87. }
  88. },
  89. [`&${componentCls}-navigation${componentCls}-vertical`]: {
  90. [`> ${componentCls}-item`]: {
  91. marginInlineEnd: 0,
  92. '&::before': {
  93. display: 'none'
  94. },
  95. [`&${componentCls}-item-active::before`]: {
  96. top: 0,
  97. insetInlineEnd: 0,
  98. insetInlineStart: 'unset',
  99. display: 'block',
  100. width: token.lineWidth * 3,
  101. height: `calc(100% - ${token.marginLG}px)`
  102. },
  103. '&::after': {
  104. position: 'relative',
  105. insetInlineStart: '50%',
  106. display: 'block',
  107. width: token.controlHeight * 0.25,
  108. height: token.controlHeight * 0.25,
  109. marginBottom: token.marginXS,
  110. textAlign: 'center',
  111. transform: 'translateY(-50%) translateX(-50%) rotate(135deg)'
  112. },
  113. [`> ${componentCls}-item-container > ${componentCls}-item-tail`]: {
  114. visibility: 'hidden'
  115. }
  116. }
  117. },
  118. [`&${componentCls}-navigation${componentCls}-horizontal`]: {
  119. [`> ${componentCls}-item > ${componentCls}-item-container > ${componentCls}-item-tail`]: {
  120. visibility: 'hidden'
  121. }
  122. }
  123. };
  124. };
  125. export default genStepsNavStyle;