index.js 2.7 KB

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