nav.js 4.3 KB

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