progress-dot.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. const genStepsProgressDotStyle = token => {
  7. const {
  8. componentCls,
  9. descriptionWidth,
  10. lineHeight,
  11. stepsCurrentDotSize,
  12. stepsDotSize,
  13. motionDurationSlow
  14. } = token;
  15. return {
  16. [`&${componentCls}-dot, &${componentCls}-dot${componentCls}-small`]: {
  17. [`${componentCls}-item`]: {
  18. '&-title': {
  19. lineHeight
  20. },
  21. '&-tail': {
  22. top: Math.floor((token.stepsDotSize - token.lineWidth * 3) / 2),
  23. width: '100%',
  24. marginTop: 0,
  25. marginBottom: 0,
  26. marginInline: `${descriptionWidth / 2}px 0`,
  27. padding: 0,
  28. '&::after': {
  29. width: `calc(100% - ${token.marginSM * 2}px)`,
  30. height: token.lineWidth * 3,
  31. marginInlineStart: token.marginSM
  32. }
  33. },
  34. '&-icon': {
  35. width: stepsDotSize,
  36. height: stepsDotSize,
  37. marginInlineStart: (token.descriptionWidth - stepsDotSize) / 2,
  38. paddingInlineEnd: 0,
  39. lineHeight: `${stepsDotSize}px`,
  40. background: 'transparent',
  41. border: 0,
  42. [`${componentCls}-icon-dot`]: {
  43. position: 'relative',
  44. float: 'left',
  45. width: '100%',
  46. height: '100%',
  47. borderRadius: 100,
  48. transition: `all ${motionDurationSlow}`,
  49. /* expand hover area */
  50. '&::after': {
  51. position: 'absolute',
  52. top: -token.marginSM,
  53. insetInlineStart: (stepsDotSize - token.controlHeightLG * 1.5) / 2,
  54. width: token.controlHeightLG * 1.5,
  55. height: token.controlHeight,
  56. background: 'transparent',
  57. content: '""'
  58. }
  59. }
  60. },
  61. '&-content': {
  62. width: descriptionWidth
  63. },
  64. [`&-process ${componentCls}-item-icon`]: {
  65. position: 'relative',
  66. top: (stepsDotSize - stepsCurrentDotSize) / 2,
  67. width: stepsCurrentDotSize,
  68. height: stepsCurrentDotSize,
  69. lineHeight: `${stepsCurrentDotSize}px`,
  70. background: 'none',
  71. marginInlineStart: (token.descriptionWidth - stepsCurrentDotSize) / 2
  72. },
  73. [`&-process ${componentCls}-icon`]: {
  74. [`&:first-child ${componentCls}-icon-dot`]: {
  75. insetInlineStart: 0
  76. }
  77. }
  78. }
  79. },
  80. [`&${componentCls}-vertical${componentCls}-dot`]: {
  81. [`${componentCls}-item-icon`]: {
  82. marginTop: (token.controlHeight - stepsDotSize) / 2,
  83. marginInlineStart: 0,
  84. background: 'none'
  85. },
  86. [`${componentCls}-item-process ${componentCls}-item-icon`]: {
  87. marginTop: (token.controlHeight - stepsCurrentDotSize) / 2,
  88. top: 0,
  89. insetInlineStart: (stepsDotSize - stepsCurrentDotSize) / 2,
  90. marginInlineStart: 0
  91. },
  92. // https://github.com/ant-design/ant-design/issues/18354
  93. [`${componentCls}-item > ${componentCls}-item-container > ${componentCls}-item-tail`]: {
  94. top: (token.controlHeight - stepsDotSize) / 2,
  95. insetInlineStart: 0,
  96. margin: 0,
  97. padding: `${stepsDotSize + token.paddingXS}px 0 ${token.paddingXS}px`,
  98. '&::after': {
  99. marginInlineStart: (stepsDotSize - token.lineWidth) / 2
  100. }
  101. },
  102. [`&${componentCls}-small`]: {
  103. [`${componentCls}-item-icon`]: {
  104. marginTop: (token.controlHeightSM - stepsDotSize) / 2
  105. },
  106. [`${componentCls}-item-process ${componentCls}-item-icon`]: {
  107. marginTop: (token.controlHeightSM - stepsCurrentDotSize) / 2
  108. },
  109. [`${componentCls}-item > ${componentCls}-item-container > ${componentCls}-item-tail`]: {
  110. top: (token.controlHeightSM - stepsDotSize) / 2
  111. }
  112. },
  113. [`${componentCls}-item:first-child ${componentCls}-icon-dot`]: {
  114. insetInlineStart: 0
  115. },
  116. [`${componentCls}-item-content`]: {
  117. width: 'inherit'
  118. }
  119. }
  120. };
  121. };
  122. var _default = exports.default = genStepsProgressDotStyle;