index.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 _internal = require("../../theme/internal");
  9. var _mixins = require("./mixins");
  10. var _style = require("../../style");
  11. const genTypographyStyle = token => {
  12. const {
  13. componentCls,
  14. sizeMarginHeadingVerticalStart
  15. } = token;
  16. return {
  17. [componentCls]: (0, _extends2.default)((0, _extends2.default)((0, _extends2.default)((0, _extends2.default)((0, _extends2.default)((0, _extends2.default)((0, _extends2.default)((0, _extends2.default)((0, _extends2.default)({
  18. color: token.colorText,
  19. wordBreak: 'break-word',
  20. lineHeight: token.lineHeight,
  21. [`&${componentCls}-secondary`]: {
  22. color: token.colorTextDescription
  23. },
  24. [`&${componentCls}-success`]: {
  25. color: token.colorSuccess
  26. },
  27. [`&${componentCls}-warning`]: {
  28. color: token.colorWarning
  29. },
  30. [`&${componentCls}-danger`]: {
  31. color: token.colorError,
  32. 'a&:active, a&:focus': {
  33. color: token.colorErrorActive
  34. },
  35. 'a&:hover': {
  36. color: token.colorErrorHover
  37. }
  38. },
  39. [`&${componentCls}-disabled`]: {
  40. color: token.colorTextDisabled,
  41. cursor: 'not-allowed',
  42. userSelect: 'none'
  43. },
  44. [`
  45. div&,
  46. p
  47. `]: {
  48. marginBottom: '1em'
  49. }
  50. }, (0, _mixins.getTitleStyles)(token)), {
  51. [`
  52. & + h1${componentCls},
  53. & + h2${componentCls},
  54. & + h3${componentCls},
  55. & + h4${componentCls},
  56. & + h5${componentCls}
  57. `]: {
  58. marginTop: sizeMarginHeadingVerticalStart
  59. },
  60. [`
  61. div,
  62. ul,
  63. li,
  64. p,
  65. h1,
  66. h2,
  67. h3,
  68. h4,
  69. h5`]: {
  70. [`
  71. + h1,
  72. + h2,
  73. + h3,
  74. + h4,
  75. + h5
  76. `]: {
  77. marginTop: sizeMarginHeadingVerticalStart
  78. }
  79. }
  80. }), (0, _mixins.getResetStyles)()), (0, _mixins.getLinkStyles)(token)), {
  81. // Operation
  82. [`
  83. ${componentCls}-expand,
  84. ${componentCls}-edit,
  85. ${componentCls}-copy
  86. `]: (0, _extends2.default)((0, _extends2.default)({}, (0, _style.operationUnit)(token)), {
  87. marginInlineStart: token.marginXXS
  88. })
  89. }), (0, _mixins.getEditableStyles)(token)), (0, _mixins.getCopiableStyles)(token)), (0, _mixins.getEllipsisStyles)()), {
  90. '&-rtl': {
  91. direction: 'rtl'
  92. }
  93. })
  94. };
  95. };
  96. // ============================== Export ==============================
  97. var _default = exports.default = (0, _internal.genComponentStyleHook)('Typography', token => [genTypographyStyle(token)], {
  98. sizeMarginHeadingVerticalStart: '1.2em',
  99. sizeMarginHeadingVerticalEnd: '0.5em'
  100. });