list.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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 genListStyle = token => {
  10. const {
  11. componentCls,
  12. antCls,
  13. iconCls,
  14. fontSize,
  15. lineHeight
  16. } = token;
  17. const itemCls = `${componentCls}-list-item`;
  18. const actionsCls = `${itemCls}-actions`;
  19. const actionCls = `${itemCls}-action`;
  20. const listItemHeightSM = Math.round(fontSize * lineHeight);
  21. return {
  22. [`${componentCls}-wrapper`]: {
  23. [`${componentCls}-list`]: (0, _extends2.default)((0, _extends2.default)({}, (0, _style.clearFix)()), {
  24. lineHeight: token.lineHeight,
  25. [itemCls]: {
  26. position: 'relative',
  27. height: token.lineHeight * fontSize,
  28. marginTop: token.marginXS,
  29. fontSize,
  30. display: 'flex',
  31. alignItems: 'center',
  32. transition: `background-color ${token.motionDurationSlow}`,
  33. '&:hover': {
  34. backgroundColor: token.controlItemBgHover
  35. },
  36. [`${itemCls}-name`]: (0, _extends2.default)((0, _extends2.default)({}, _style.textEllipsis), {
  37. padding: `0 ${token.paddingXS}px`,
  38. lineHeight,
  39. flex: 'auto',
  40. transition: `all ${token.motionDurationSlow}`
  41. }),
  42. [actionsCls]: {
  43. [actionCls]: {
  44. opacity: 0
  45. },
  46. [`${actionCls}${antCls}-btn-sm`]: {
  47. height: listItemHeightSM,
  48. border: 0,
  49. lineHeight: 1,
  50. // FIXME: should not override small button
  51. '> span': {
  52. transform: 'scale(1)'
  53. }
  54. },
  55. [`
  56. ${actionCls}:focus,
  57. &.picture ${actionCls}
  58. `]: {
  59. opacity: 1
  60. },
  61. [iconCls]: {
  62. color: token.colorTextDescription,
  63. transition: `all ${token.motionDurationSlow}`
  64. },
  65. [`&:hover ${iconCls}`]: {
  66. color: token.colorText
  67. }
  68. },
  69. [`${componentCls}-icon ${iconCls}`]: {
  70. color: token.colorTextDescription,
  71. fontSize
  72. },
  73. [`${itemCls}-progress`]: {
  74. position: 'absolute',
  75. bottom: -token.uploadProgressOffset,
  76. width: '100%',
  77. paddingInlineStart: fontSize + token.paddingXS,
  78. fontSize,
  79. lineHeight: 0,
  80. pointerEvents: 'none',
  81. '> div': {
  82. margin: 0
  83. }
  84. }
  85. },
  86. [`${itemCls}:hover ${actionCls}`]: {
  87. opacity: 1,
  88. color: token.colorText
  89. },
  90. [`${itemCls}-error`]: {
  91. color: token.colorError,
  92. [`${itemCls}-name, ${componentCls}-icon ${iconCls}`]: {
  93. color: token.colorError
  94. },
  95. [actionsCls]: {
  96. [`${iconCls}, ${iconCls}:hover`]: {
  97. color: token.colorError
  98. },
  99. [actionCls]: {
  100. opacity: 1
  101. }
  102. }
  103. },
  104. [`${componentCls}-list-item-container`]: {
  105. transition: `opacity ${token.motionDurationSlow}, height ${token.motionDurationSlow}`,
  106. // For smooth removing animation
  107. '&::before': {
  108. display: 'table',
  109. width: 0,
  110. height: 0,
  111. content: '""'
  112. }
  113. }
  114. })
  115. }
  116. };
  117. };
  118. var _default = exports.default = genListStyle;