@dtjoy/dt-design 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/esm/_util/gapSize.d.ts +3 -0
  2. package/esm/_util/gapSize.js +10 -0
  3. package/esm/_util/hooks/index.d.ts +1 -0
  4. package/esm/_util/hooks/index.js +1 -0
  5. package/esm/_util/hooks/useOrientation.d.ts +2 -0
  6. package/esm/_util/hooks/useOrientation.js +19 -0
  7. package/esm/_util/isNonNullable.d.ts +2 -0
  8. package/esm/_util/isNonNullable.js +4 -0
  9. package/esm/_util/type.d.ts +2 -1
  10. package/esm/blockHeader/index.d.ts +1 -1
  11. package/esm/blockHeader/index.js +13 -10
  12. package/esm/blockHeader/style/index.d.ts +2 -0
  13. package/esm/blockHeader/style/index.js +2 -0
  14. package/esm/blockHeader/{style.less → style/index.less} +143 -141
  15. package/esm/button/index.d.ts +10 -0
  16. package/esm/button/index.js +29 -0
  17. package/esm/button/style/index.d.ts +2 -0
  18. package/esm/button/style/index.js +2 -0
  19. package/esm/button/style/index.less +134 -0
  20. package/esm/button/style/mixin.less +47 -0
  21. package/esm/collapsible/index.d.ts +97 -0
  22. package/esm/collapsible/index.js +234 -0
  23. package/esm/collapsible/style/index.d.ts +1 -0
  24. package/esm/collapsible/style/index.js +1 -0
  25. package/esm/collapsible/style/index.less +24 -0
  26. package/esm/collapsibleActionItems/index.d.ts +24 -0
  27. package/esm/collapsibleActionItems/index.js +74 -0
  28. package/esm/collapsibleActionItems/style/index.d.ts +2 -0
  29. package/esm/collapsibleActionItems/style/index.js +2 -0
  30. package/esm/collapsibleActionItems/style/index.less +7 -0
  31. package/esm/flex/index.d.ts +7 -0
  32. package/esm/flex/index.js +62 -0
  33. package/esm/flex/interface.d.ts +16 -0
  34. package/esm/flex/interface.js +1 -0
  35. package/esm/flex/style/index.d.ts +2 -0
  36. package/esm/flex/style/index.js +2 -0
  37. package/esm/flex/style/index.less +77 -0
  38. package/esm/flex/utils.d.ts +7 -0
  39. package/esm/flex/utils.js +33 -0
  40. package/esm/index.d.ts +10 -1
  41. package/esm/index.js +8 -7
  42. package/esm/resize/index.d.ts +8 -0
  43. package/esm/resize/index.js +29 -0
  44. package/esm/splitter/Panel.d.ts +7 -0
  45. package/esm/splitter/Panel.js +38 -0
  46. package/esm/splitter/SplitBar.d.ts +24 -0
  47. package/esm/splitter/SplitBar.js +185 -0
  48. package/esm/splitter/Splitter.d.ts +5 -0
  49. package/esm/splitter/Splitter.js +215 -0
  50. package/esm/splitter/hooks/sizeUtil.d.ts +3 -0
  51. package/esm/splitter/hooks/sizeUtil.js +63 -0
  52. package/esm/splitter/hooks/useItems.d.ts +14 -0
  53. package/esm/splitter/hooks/useItems.js +44 -0
  54. package/esm/splitter/hooks/useResizable.d.ts +10 -0
  55. package/esm/splitter/hooks/useResizable.js +73 -0
  56. package/esm/splitter/hooks/useResize.d.ts +6 -0
  57. package/esm/splitter/hooks/useResize.js +158 -0
  58. package/esm/splitter/hooks/useSizes.d.ts +4 -0
  59. package/esm/splitter/hooks/useSizes.js +80 -0
  60. package/esm/splitter/index.d.ts +8 -0
  61. package/esm/splitter/index.js +5 -0
  62. package/esm/splitter/interface.d.ts +68 -0
  63. package/esm/splitter/interface.js +1 -0
  64. package/esm/splitter/style/index.d.ts +2 -0
  65. package/esm/splitter/style/index.js +2 -0
  66. package/esm/splitter/style/index.less +312 -0
  67. package/esm/statusTag/index.d.ts +28 -0
  68. package/esm/statusTag/index.js +122 -0
  69. package/esm/statusTag/style/index.d.ts +2 -0
  70. package/esm/statusTag/style/index.js +2 -0
  71. package/esm/statusTag/style/index.less +70 -0
  72. package/esm/statusTag/style/mixin.less +39 -0
  73. package/esm/style/index.d.ts +1 -0
  74. package/esm/style/index.js +1 -0
  75. package/esm/style/index.less +1 -0
  76. package/esm/style/mixins/index.less +0 -0
  77. package/esm/style/themes/index.less +2 -0
  78. package/esm/style/themes/variable.less +1 -0
  79. package/lib/_util/gapSize.d.ts +3 -0
  80. package/lib/_util/gapSize.js +17 -0
  81. package/lib/_util/hooks/index.d.ts +1 -0
  82. package/lib/_util/hooks/index.js +16 -0
  83. package/lib/_util/hooks/useOrientation.d.ts +2 -0
  84. package/lib/_util/hooks/useOrientation.js +26 -0
  85. package/lib/_util/isNonNullable.d.ts +2 -0
  86. package/lib/_util/isNonNullable.js +10 -0
  87. package/lib/_util/type.d.ts +2 -1
  88. package/lib/blockHeader/index.d.ts +1 -1
  89. package/lib/blockHeader/index.js +13 -11
  90. package/lib/blockHeader/style/index.d.ts +2 -0
  91. package/lib/blockHeader/style/index.js +4 -0
  92. package/lib/blockHeader/{style.less → style/index.less} +143 -141
  93. package/lib/button/index.d.ts +10 -0
  94. package/lib/button/index.js +33 -0
  95. package/lib/button/style/index.d.ts +2 -0
  96. package/lib/button/style/index.js +4 -0
  97. package/lib/button/style/index.less +134 -0
  98. package/lib/button/style/mixin.less +47 -0
  99. package/lib/collapsible/index.d.ts +97 -0
  100. package/lib/collapsible/index.js +199 -0
  101. package/lib/collapsible/style/index.d.ts +1 -0
  102. package/lib/collapsible/style/index.js +3 -0
  103. package/lib/collapsible/style/index.less +24 -0
  104. package/lib/collapsibleActionItems/index.d.ts +24 -0
  105. package/lib/collapsibleActionItems/index.js +68 -0
  106. package/lib/collapsibleActionItems/style/index.d.ts +2 -0
  107. package/lib/collapsibleActionItems/style/index.js +4 -0
  108. package/lib/collapsibleActionItems/style/index.less +7 -0
  109. package/lib/flex/index.d.ts +7 -0
  110. package/lib/flex/index.js +60 -0
  111. package/lib/flex/interface.d.ts +16 -0
  112. package/lib/flex/interface.js +5 -0
  113. package/lib/flex/style/index.d.ts +2 -0
  114. package/lib/flex/style/index.js +4 -0
  115. package/lib/flex/style/index.less +77 -0
  116. package/lib/flex/utils.d.ts +7 -0
  117. package/lib/flex/utils.js +39 -0
  118. package/lib/index.d.ts +10 -1
  119. package/lib/index.js +72 -1
  120. package/lib/resize/index.d.ts +8 -0
  121. package/lib/resize/index.js +38 -0
  122. package/lib/splitter/Panel.d.ts +7 -0
  123. package/lib/splitter/Panel.js +44 -0
  124. package/lib/splitter/SplitBar.d.ts +24 -0
  125. package/lib/splitter/SplitBar.js +179 -0
  126. package/lib/splitter/Splitter.d.ts +5 -0
  127. package/lib/splitter/Splitter.js +202 -0
  128. package/lib/splitter/hooks/sizeUtil.d.ts +3 -0
  129. package/lib/splitter/hooks/sizeUtil.js +56 -0
  130. package/lib/splitter/hooks/useItems.d.ts +14 -0
  131. package/lib/splitter/hooks/useItems.js +46 -0
  132. package/lib/splitter/hooks/useResizable.d.ts +10 -0
  133. package/lib/splitter/hooks/useResizable.js +83 -0
  134. package/lib/splitter/hooks/useResize.d.ts +6 -0
  135. package/lib/splitter/hooks/useResize.js +142 -0
  136. package/lib/splitter/hooks/useSizes.d.ts +4 -0
  137. package/lib/splitter/hooks/useSizes.js +62 -0
  138. package/lib/splitter/index.d.ts +8 -0
  139. package/lib/splitter/index.js +12 -0
  140. package/lib/splitter/interface.d.ts +68 -0
  141. package/lib/splitter/interface.js +5 -0
  142. package/lib/splitter/style/index.d.ts +2 -0
  143. package/lib/splitter/style/index.js +4 -0
  144. package/lib/splitter/style/index.less +312 -0
  145. package/lib/statusTag/index.d.ts +28 -0
  146. package/lib/statusTag/index.js +125 -0
  147. package/lib/statusTag/style/index.d.ts +2 -0
  148. package/lib/statusTag/style/index.js +4 -0
  149. package/lib/statusTag/style/index.less +70 -0
  150. package/lib/statusTag/style/mixin.less +39 -0
  151. package/lib/style/index.d.ts +1 -0
  152. package/lib/style/index.js +3 -0
  153. package/lib/style/index.less +1 -0
  154. package/lib/style/mixins/index.less +0 -0
  155. package/lib/style/themes/index.less +2 -0
  156. package/lib/style/themes/variable.less +1 -0
  157. package/package.json +142 -141
  158. package/esm/styles/entry.less +0 -6
  159. package/esm/styles/variables.less +0 -1
  160. package/lib/styles/entry.less +0 -6
  161. package/lib/styles/variables.less +0 -1
@@ -0,0 +1,70 @@
1
+ @import '../../style/themes/index.less';
2
+ @import './mixin.less';
3
+ @import './mixin.less';
4
+
5
+ @status-tag-prefix-cls: ~'@{ant-prefix}-status-tag';
6
+
7
+ @keyframes spin {
8
+ from {
9
+ transform: rotate(0deg);
10
+ }
11
+ to {
12
+ transform: rotate(360deg);
13
+ }
14
+ }
15
+
16
+ // 主选择器
17
+ .@{status-tag-prefix-cls} {
18
+ display: flex;
19
+ align-items: center;
20
+ width: fit-content;
21
+ height: 24px;
22
+ font-size: 12px;
23
+ color: #3d446e;
24
+
25
+ .ant-spin {
26
+ font-size: 14px; // 修复 antd 字体居中问题
27
+ }
28
+
29
+ &--border {
30
+ padding: 2px 12px;
31
+ border: 1px solid #d8dae2;
32
+ background-color: #fff;
33
+ }
34
+
35
+ &--fill {
36
+ padding: 2px 12px;
37
+ }
38
+
39
+ &--rounded {
40
+ border-radius: 14px;
41
+ }
42
+
43
+ &__icon {
44
+ display: flex;
45
+ align-items: center;
46
+ font-size: 16px;
47
+ margin-right: 8px;
48
+
49
+ &--default {
50
+ display: inline-block;
51
+ width: 6px;
52
+ height: 6px;
53
+ border-radius: 50%;
54
+ }
55
+
56
+ &--loading {
57
+ animation: spin 1s linear infinite;
58
+ }
59
+ }
60
+
61
+ &__text {
62
+ font-size: 12px;
63
+ font-weight: 400;
64
+ line-height: 22px;
65
+ white-space: nowrap;
66
+ }
67
+
68
+ // 调用颜色映射 Mixin,生成所有颜色的样式
69
+ .color-map();
70
+ }
@@ -0,0 +1,39 @@
1
+ .status-color(@color, @bg) {
2
+ &--icon {
3
+ color: @color;
4
+ }
5
+ &--fill {
6
+ color: @color;
7
+ background-color: @bg;
8
+ }
9
+ &--iconBg {
10
+ background: @color;
11
+ }
12
+ }
13
+
14
+ .color-map() {
15
+ &__yellow {
16
+ .status-color(#FBB310, #FFF4D9);
17
+ }
18
+ &__blue {
19
+ .status-color(#1d78ff, #E8F1FF);
20
+ }
21
+ &__green {
22
+ .status-color(#11d782, #E7FBF7);
23
+ }
24
+ &__gray {
25
+ .status-color(#B1B4C5, #F5F5F8);
26
+ }
27
+ &__red {
28
+ .status-color(#F96C5B, #FDE9E7);
29
+ }
30
+ &__purple {
31
+ .status-color(#AC9DFF, #EAE6FF);
32
+ }
33
+ &__cyan {
34
+ .status-color(#2cccdf, #E7F8FA);
35
+ }
36
+ &__pink {
37
+ .status-color(#FF82AE, #FFE6EF);
38
+ }
39
+ }
@@ -0,0 +1 @@
1
+ import './index.less';
@@ -0,0 +1 @@
1
+ import "./index.less";
@@ -0,0 +1 @@
1
+ @import "./themes/index.less";
File without changes
@@ -0,0 +1,2 @@
1
+ @import '~antd/es/style/themes/default.less';
2
+ @import './variable.less';
@@ -0,0 +1 @@
1
+ @primary-color-disabled: #f3f3f3;
@@ -0,0 +1,3 @@
1
+ import { SizeType } from 'antd/es/config-provider/SizeContext';
2
+ export declare function isPresetSize(size?: SizeType | string | number): size is SizeType;
3
+ export declare function isValidGapNumber(size?: SizeType | string | number): size is number;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isPresetSize = isPresetSize;
7
+ exports.isValidGapNumber = isValidGapNumber;
8
+ function isPresetSize(size) {
9
+ return ['small', 'middle', 'large'].includes(size);
10
+ }
11
+ function isValidGapNumber(size) {
12
+ if (!size) {
13
+ // The case of size = 0 is deliberately excluded here, because the default value of the gap attribute in CSS is 0, so if the user passes 0 in, we can directly ignore it.
14
+ return false;
15
+ }
16
+ return typeof size === 'number' && !Number.isNaN(size);
17
+ }
@@ -0,0 +1 @@
1
+ export * from './useOrientation';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _useOrientation = require("./useOrientation");
7
+ Object.keys(_useOrientation).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _useOrientation[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _useOrientation[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,2 @@
1
+ export declare type Orientation = 'horizontal' | 'vertical';
2
+ export declare const useOrientation: (orientation?: Orientation, vertical?: boolean, legacyDirection?: Orientation) => [Orientation, boolean];
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useOrientation = void 0;
7
+ var _react = require("react");
8
+ const isValidOrientation = orientation => {
9
+ return orientation === 'horizontal' || orientation === 'vertical';
10
+ };
11
+ const useOrientation = (orientation, vertical, legacyDirection) => {
12
+ return (0, _react.useMemo)(() => {
13
+ const validOrientation = isValidOrientation(orientation);
14
+ let mergedOrientation;
15
+ if (validOrientation) {
16
+ mergedOrientation = orientation || 'horizontal';
17
+ } else if (typeof vertical === 'boolean') {
18
+ mergedOrientation = vertical ? 'vertical' : 'horizontal';
19
+ } else {
20
+ const validLegacyDirection = isValidOrientation(legacyDirection);
21
+ mergedOrientation = validLegacyDirection ? legacyDirection || 'horizontal' : 'horizontal';
22
+ }
23
+ return [mergedOrientation, mergedOrientation === 'vertical'];
24
+ }, [legacyDirection, orientation, vertical]);
25
+ };
26
+ exports.useOrientation = useOrientation;
@@ -0,0 +1,2 @@
1
+ declare const isNonNullable: <T>(val: T) => val is NonNullable<T>;
2
+ export default isNonNullable;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ const isNonNullable = val => {
8
+ return val !== undefined && val !== null;
9
+ };
10
+ var _default = exports.default = isNonNullable;
@@ -1,6 +1,7 @@
1
1
  import type React from 'react';
2
+ export declare type Primitive = null | undefined | string | number | boolean | symbol | bigint;
2
3
  /** https://github.com/Microsoft/TypeScript/issues/29729 */
3
- export declare type LiteralUnion<T extends string> = T | (string & {});
4
+ export declare type LiteralUnion<T, U extends Primitive = string> = T | (U & Record<never, never>);
4
5
  export declare type AnyObject = Record<string, any>;
5
6
  export declare type CustomComponent<P = AnyObject> = React.ComponentType<P> | string;
6
7
  /**
@@ -1,6 +1,6 @@
1
1
  import React, { ReactNode } from 'react';
2
+ import './style';
2
3
  import { LabelTooltipType } from '../_util';
3
- import './style.less';
4
4
  export declare type SizeType = 'small' | 'middle' | 'large';
5
5
  export interface IBlockHeaderProps {
6
6
  /** 标题 */
@@ -9,13 +9,13 @@ var _reactIcons = require("@dtinsight/react-icons");
9
9
  var _antd = require("antd");
10
10
  var _configProvider = require("antd/es/config-provider");
11
11
  var _classnames = _interopRequireDefault(require("classnames"));
12
+ require("./style");
12
13
  var _util = require("../_util");
13
- require("./style.less");
14
+ var _collapsible = _interopRequireDefault(require("../collapsible"));
14
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
16
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
- // import useLocale from '../locale/useLocale';
18
-
18
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
19
19
  function isControlled(props) {
20
20
  return props.expand !== undefined;
21
21
  }
@@ -44,15 +44,13 @@ const BlockHeader = function (props) {
44
44
  titleStyle
45
45
  } = props;
46
46
  const [internalExpand, setInternalExpand] = (0, _react.useState)(defaultExpand);
47
- // const locale = useLocale('BlockHeader');
48
-
49
47
  const currentExpand = isControlled(props) ? expand : internalExpand;
50
48
 
51
49
  // 只有在有了 children 并且设置了 expand/defaultExpand 的时候才能够展开收起
52
50
  const showCollapse = (typeof expand === 'boolean' || typeof defaultExpand === 'boolean') && children;
53
51
  const tooltipProps = (0, _util.toTooltipProps)(tooltip);
54
52
  let bottomStyle;
55
- if (spaceBottom) bottomStyle = showCollapse && currentExpand ? {
53
+ if (spaceBottom) bottomStyle = showCollapse && !currentExpand ? {
56
54
  marginBottom: 0
57
55
  } : {
58
56
  marginBottom: spaceBottom
@@ -83,7 +81,9 @@ const BlockHeader = function (props) {
83
81
  className: "title__text"
84
82
  }, title), tooltipProps?.title ? /*#__PURE__*/_react.default.createElement("div", {
85
83
  className: `title__tooltip`
86
- }, /*#__PURE__*/_react.default.createElement(_antd.Tooltip, tooltipProps, /*#__PURE__*/_react.default.createElement(_reactIcons.QuestionOutlined, null))) : null, description ? /*#__PURE__*/_react.default.createElement("div", {
84
+ }, /*#__PURE__*/_react.default.createElement(_antd.Tooltip, _extends({}, tooltipProps, {
85
+ className: (0, _classnames.default)(tooltipProps?.className, 'anticon')
86
+ }), /*#__PURE__*/_react.default.createElement(_reactIcons.QuestionOutlined, null))) : null, description ? /*#__PURE__*/_react.default.createElement("div", {
87
87
  className: `title__description`
88
88
  }, description) : null), addonAfter && /*#__PURE__*/_react.default.createElement("div", {
89
89
  className: `title__addon-after`
@@ -91,16 +91,18 @@ const BlockHeader = function (props) {
91
91
  className: `title__collapse`
92
92
  }, /*#__PURE__*/_react.default.createElement("div", {
93
93
  className: "collapse__text"
94
- }), /*#__PURE__*/_react.default.createElement(_reactIcons.UpOutlined, {
95
- className: (0, _classnames.default)('collapse__icon', {
94
+ }, currentExpand ? '收起' : '展开'), /*#__PURE__*/_react.default.createElement(_reactIcons.UpOutlined, {
95
+ className: (0, _classnames.default)('collapse__icon', 'anticon', {
96
96
  'collapse__icon--up': currentExpand,
97
97
  'collapse__icon--down': !currentExpand
98
98
  })
99
- }))), children && /*#__PURE__*/_react.default.createElement("div", {
99
+ }))), /*#__PURE__*/_react.default.createElement(_collapsible.default, {
100
+ isOpen: !currentExpand
101
+ }, /*#__PURE__*/_react.default.createElement("div", {
100
102
  className: (0, _classnames.default)(`${prefixCls}__content`, contentClassName, {
101
103
  [`${prefixCls}__content--active`]: currentExpand || !showCollapse
102
104
  }),
103
105
  style: contentStyle
104
- }, children));
106
+ }, children)));
105
107
  };
106
108
  var _default = exports.default = BlockHeader;
@@ -0,0 +1,2 @@
1
+ import '../../style';
2
+ import './index.less';
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ require("../../style");
4
+ require("./index.less");
@@ -1,141 +1,143 @@
1
- // @card_prefix: ~'dt-block-header';
2
- @card_prefix: ~'@{ant-prefix}-block-header';
3
-
4
- .@{card_prefix} {
5
- &__title {
6
- border-radius: 4px;
7
- display: flex;
8
- align-items: center;
9
- justify-content: space-between;
10
- &--large {
11
- .title__box {
12
- line-height: 24px;
13
- .title__text {
14
- font-size: 16px;
15
- }
16
- }
17
- }
18
- &--middle {
19
- .title__box {
20
- line-height: 22px;
21
- .title__text {
22
- font-size: 14px;
23
- }
24
- }
25
- }
26
- &--small {
27
- .title__box {
28
- line-height: 20px;
29
- .title__text {
30
- font-size: 12px;
31
- }
32
- }
33
- }
34
- &--background {
35
- padding: 0 12px;
36
- background-color: #f9f9fa;
37
- &.@{card_prefix}__title {
38
- &--middle,
39
- &--large {
40
- height: 40px;
41
- }
42
- &--small {
43
- height: 32px;
44
- }
45
- }
46
- }
47
- &--pointer {
48
- cursor: pointer;
49
- }
50
- .title {
51
- &__box {
52
- flex: 1;
53
- display: flex;
54
- align-items: center;
55
- }
56
- &__addon-before {
57
- margin-right: 8px;
58
- color: @primary-color;
59
- &--middle {
60
- .addon-before--default {
61
- width: 4px;
62
- height: 16px;
63
- background-color: @primary-color;
64
- }
65
- font-size: 20px;
66
- }
67
- &--small {
68
- .addon-before--default {
69
- width: 4px;
70
- height: 16px;
71
- background-color: @primary-color;
72
- }
73
- font-size: 16px;
74
- }
75
- &--large {
76
- .addon-before--default {
77
- width: 4px;
78
- height: 20px;
79
- background-color: @primary-color;
80
- }
81
- font-size: 24px;
82
- }
83
- }
84
- &__tooltip {
85
- display: flex;
86
- margin-right: 4px;
87
- font-size: 16px;
88
- color: #b1b4c5;
89
- cursor: pointer;
90
- }
91
- &__text {
92
- color: @text-color;
93
- font-weight: 500;
94
- margin-right: 4px;
95
- }
96
- &__description {
97
- display: flex;
98
- align-items: center;
99
- color: @label-color;
100
- font-size: 12px;
101
- }
102
- &__addon-after {
103
- color: @label-color;
104
- }
105
- &__collapse {
106
- color: @label-color;
107
- display: flex;
108
- align-items: center;
109
- cursor: pointer;
110
- user-select: none;
111
- .collapse {
112
- &__text {
113
- font-size: 12px;
114
- margin: 0 4px;
115
- }
116
- &__icon {
117
- font-size: 16px;
118
- transition: transform 0.4s;
119
- &--down {
120
- transform: rotate(-180deg);
121
- }
122
- &--up {
123
- transform: rotate(0deg);
124
- }
125
- }
126
- }
127
- }
128
- }
129
- }
130
- &__content {
131
- opacity: 0;
132
- height: 0;
133
- overflow: hidden;
134
- transition: opacity 0.5s ease, height 0.5s ease;
135
- &--active {
136
- opacity: 1;
137
- padding: 16px 24px;
138
- height: auto;
139
- }
140
- }
141
- }
1
+ @import '../../style/themes/index.less';
2
+
3
+ @card_prefix: ~'@{ant-prefix}-block-header';
4
+
5
+ .@{card_prefix} {
6
+ &__title {
7
+ border-radius: 4px;
8
+ display: flex;
9
+ align-items: center;
10
+ justify-content: space-between;
11
+ &--large {
12
+ .title__box {
13
+ line-height: 24px;
14
+ .title__text {
15
+ font-size: 16px;
16
+ }
17
+ }
18
+ }
19
+ &--middle {
20
+ .title__box {
21
+ line-height: 22px;
22
+ .title__text {
23
+ font-size: 14px;
24
+ }
25
+ }
26
+ }
27
+ &--small {
28
+ .title__box {
29
+ line-height: 20px;
30
+ .title__text {
31
+ font-size: 12px;
32
+ }
33
+ }
34
+ }
35
+ &--background {
36
+ padding: 0 12px;
37
+ background-color: #f9f9fa;
38
+ &.@{card_prefix}__title {
39
+ &--middle,
40
+ &--large {
41
+ height: 40px;
42
+ }
43
+ &--small {
44
+ height: 32px;
45
+ }
46
+ }
47
+ }
48
+ &--pointer {
49
+ cursor: pointer;
50
+ }
51
+ .title {
52
+ &__box {
53
+ flex: 1;
54
+ display: flex;
55
+ align-items: center;
56
+ }
57
+ &__addon-before {
58
+ margin-right: 8px;
59
+ color: @primary-color;
60
+ &--middle {
61
+ .addon-before--default {
62
+ width: 4px;
63
+ height: 16px;
64
+ background-color: @primary-color;
65
+ }
66
+ font-size: 20px;
67
+ }
68
+ &--small {
69
+ .addon-before--default {
70
+ width: 4px;
71
+ height: 16px;
72
+ background-color: @primary-color;
73
+ }
74
+ font-size: 16px;
75
+ }
76
+ &--large {
77
+ .addon-before--default {
78
+ width: 4px;
79
+ height: 20px;
80
+ background-color: @primary-color;
81
+ }
82
+ font-size: 24px;
83
+ }
84
+ }
85
+ &__tooltip {
86
+ display: flex;
87
+ margin-right: 4px;
88
+ font-size: 16px;
89
+ color: #b1b4c5;
90
+ cursor: pointer;
91
+ }
92
+ &__text {
93
+ color: @text-color;
94
+ font-weight: 500;
95
+ margin-right: 4px;
96
+ }
97
+ &__description {
98
+ display: flex;
99
+ align-items: center;
100
+ color: @label-color;
101
+ font-size: 12px;
102
+ }
103
+ &__addon-after {
104
+ color: @label-color;
105
+ }
106
+ &__collapse {
107
+ color: @label-color;
108
+ display: flex;
109
+ align-items: center;
110
+ cursor: pointer;
111
+ user-select: none;
112
+ .collapse {
113
+ &__text {
114
+ font-size: 12px;
115
+ margin: 0 4px;
116
+ }
117
+ &__icon {
118
+ font-size: 16px;
119
+ transition: transform 0.4s;
120
+ &--down {
121
+ transform: rotate(-180deg);
122
+ }
123
+ &--up {
124
+ transform: rotate(0deg);
125
+ }
126
+ }
127
+ }
128
+ }
129
+ }
130
+ }
131
+ &__content {
132
+ padding: 16px 24px;
133
+
134
+ // opacity: 0;
135
+ // height: 0;
136
+ // overflow: hidden;
137
+ // transition: opacity 0.5s ease, height 0.5s ease;
138
+ &--active {
139
+ // opacity: 1;
140
+ // height: auto;
141
+ }
142
+ }
143
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { ButtonProps as AntdButtonProps } from 'antd';
3
+ import { ButtonType as AntdButtonType } from 'antd/es/button';
4
+ import './style';
5
+ declare type ButtonType = AntdButtonType | 'secondary' | 'tertiary';
6
+ export interface ButtonProps extends Omit<AntdButtonProps, 'type'> {
7
+ type?: ButtonType;
8
+ }
9
+ export default function Button({ className, icon, children, size, type, ...rest }: ButtonProps): React.JSX.Element;
10
+ export {};
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = Button;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _antd = require("antd");
9
+ var _configProvider = require("antd/es/config-provider");
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+ require("./style");
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
14
+ function Button({
15
+ className,
16
+ icon,
17
+ children,
18
+ size = 'middle',
19
+ type,
20
+ ...rest
21
+ }) {
22
+ const prefixCls = (0, _configProvider.globalConfig)().getPrefixCls('btn');
23
+ const typeClassName = type ? `${prefixCls}--${type}` : '';
24
+ return /*#__PURE__*/_react.default.createElement(_antd.Button, _extends({
25
+ className: (0, _classnames.default)(prefixCls, className, typeClassName),
26
+ size: size,
27
+ type: type
28
+ }, rest), icon && /*#__PURE__*/_react.default.createElement("span", {
29
+ className: `${prefixCls}__icon ${prefixCls}__icon--${size}`
30
+ }, icon), children && /*#__PURE__*/_react.default.createElement("span", {
31
+ className: `${prefixCls}__text ${prefixCls}__text--${size}`
32
+ }, children));
33
+ }
@@ -0,0 +1,2 @@
1
+ import '../../style/index.less';
2
+ import './index.less';