inline.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. import _extends from "@babel/runtime/helpers/esm/extends";
  2. const genStepsInlineStyle = token => {
  3. const {
  4. componentCls,
  5. inlineDotSize,
  6. inlineTitleColor,
  7. inlineTailColor
  8. } = token;
  9. const containerPaddingTop = token.paddingXS + token.lineWidth;
  10. const titleStyle = {
  11. [`${componentCls}-item-container ${componentCls}-item-content ${componentCls}-item-title`]: {
  12. color: inlineTitleColor
  13. }
  14. };
  15. return {
  16. [`&${componentCls}-inline`]: {
  17. width: 'auto',
  18. display: 'inline-flex',
  19. [`${componentCls}-item`]: {
  20. flex: 'none',
  21. '&-container': {
  22. padding: `${containerPaddingTop}px ${token.paddingXXS}px 0`,
  23. margin: `0 ${token.marginXXS / 2}px`,
  24. borderRadius: token.borderRadiusSM,
  25. cursor: 'pointer',
  26. transition: `background-color ${token.motionDurationMid}`,
  27. '&:hover': {
  28. background: token.controlItemBgHover
  29. },
  30. [`&[role='button']:hover`]: {
  31. opacity: 1
  32. }
  33. },
  34. '&-icon': {
  35. width: inlineDotSize,
  36. height: inlineDotSize,
  37. marginInlineStart: `calc(50% - ${inlineDotSize / 2}px)`,
  38. [`> ${componentCls}-icon`]: {
  39. top: 0
  40. },
  41. [`${componentCls}-icon-dot`]: {
  42. borderRadius: token.fontSizeSM / 4
  43. }
  44. },
  45. '&-content': {
  46. width: 'auto',
  47. marginTop: token.marginXS - token.lineWidth
  48. },
  49. '&-title': {
  50. color: inlineTitleColor,
  51. fontSize: token.fontSizeSM,
  52. lineHeight: token.lineHeightSM,
  53. fontWeight: 'normal',
  54. marginBottom: token.marginXXS / 2
  55. },
  56. '&-description': {
  57. display: 'none'
  58. },
  59. '&-tail': {
  60. marginInlineStart: 0,
  61. top: containerPaddingTop + inlineDotSize / 2,
  62. transform: `translateY(-50%)`,
  63. '&:after': {
  64. width: '100%',
  65. height: token.lineWidth,
  66. borderRadius: 0,
  67. marginInlineStart: 0,
  68. background: inlineTailColor
  69. }
  70. },
  71. [`&:first-child ${componentCls}-item-tail`]: {
  72. width: '50%',
  73. marginInlineStart: '50%'
  74. },
  75. [`&:last-child ${componentCls}-item-tail`]: {
  76. display: 'block',
  77. width: '50%'
  78. },
  79. '&-wait': _extends({
  80. [`${componentCls}-item-icon ${componentCls}-icon ${componentCls}-icon-dot`]: {
  81. backgroundColor: token.colorBorderBg,
  82. border: `${token.lineWidth}px ${token.lineType} ${inlineTailColor}`
  83. }
  84. }, titleStyle),
  85. '&-finish': _extends({
  86. [`${componentCls}-item-tail::after`]: {
  87. backgroundColor: inlineTailColor
  88. },
  89. [`${componentCls}-item-icon ${componentCls}-icon ${componentCls}-icon-dot`]: {
  90. backgroundColor: inlineTailColor,
  91. border: `${token.lineWidth}px ${token.lineType} ${inlineTailColor}`
  92. }
  93. }, titleStyle),
  94. '&-error': titleStyle,
  95. '&-active, &-process': _extends({
  96. [`${componentCls}-item-icon`]: {
  97. width: inlineDotSize,
  98. height: inlineDotSize,
  99. marginInlineStart: `calc(50% - ${inlineDotSize / 2}px)`,
  100. top: 0
  101. }
  102. }, titleStyle),
  103. [`&:not(${componentCls}-item-active) > ${componentCls}-item-container[role='button']:hover`]: {
  104. [`${componentCls}-item-title`]: {
  105. color: inlineTitleColor
  106. }
  107. }
  108. }
  109. }
  110. };
  111. };
  112. export default genStepsInlineStyle;