nav.js 4.1 KB

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