@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,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,10 @@
1
+ export function isPresetSize(size) {
2
+ return ['small', 'middle', 'large'].includes(size);
3
+ }
4
+ export function isValidGapNumber(size) {
5
+ if (!size) {
6
+ // 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.
7
+ return false;
8
+ }
9
+ return typeof size === 'number' && !Number.isNaN(size);
10
+ }
@@ -0,0 +1 @@
1
+ export * from './useOrientation';
@@ -0,0 +1 @@
1
+ export * from "./useOrientation";
@@ -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,19 @@
1
+ import { useMemo } from 'react';
2
+ var isValidOrientation = function isValidOrientation(orientation) {
3
+ return orientation === 'horizontal' || orientation === 'vertical';
4
+ };
5
+ export var useOrientation = function useOrientation(orientation, vertical, legacyDirection) {
6
+ return useMemo(function () {
7
+ var validOrientation = isValidOrientation(orientation);
8
+ var mergedOrientation;
9
+ if (validOrientation) {
10
+ mergedOrientation = orientation || 'horizontal';
11
+ } else if (typeof vertical === 'boolean') {
12
+ mergedOrientation = vertical ? 'vertical' : 'horizontal';
13
+ } else {
14
+ var validLegacyDirection = isValidOrientation(legacyDirection);
15
+ mergedOrientation = validLegacyDirection ? legacyDirection || 'horizontal' : 'horizontal';
16
+ }
17
+ return [mergedOrientation, mergedOrientation === 'vertical'];
18
+ }, [legacyDirection, orientation, vertical]);
19
+ };
@@ -0,0 +1,2 @@
1
+ declare const isNonNullable: <T>(val: T) => val is NonNullable<T>;
2
+ export default isNonNullable;
@@ -0,0 +1,4 @@
1
+ var isNonNullable = function isNonNullable(val) {
2
+ return val !== undefined && val !== null;
3
+ };
4
+ export 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
  /** 标题 */
@@ -1,4 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ 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); }
2
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -15,9 +16,9 @@ import { QuestionOutlined, UpOutlined } from '@dtinsight/react-icons';
15
16
  import { Tooltip } from 'antd';
16
17
  import { globalConfig } from 'antd/es/config-provider';
17
18
  import classNames from 'classnames';
19
+ import "./style";
18
20
  import { toTooltipProps } from "../_util";
19
- // import useLocale from '../locale/useLocale';
20
- import "./style.less";
21
+ import Collapsible from "../collapsible";
21
22
  function isControlled(props) {
22
23
  return props.expand !== undefined;
23
24
  }
@@ -57,15 +58,13 @@ var BlockHeader = function BlockHeader(props) {
57
58
  _useState2 = _slicedToArray(_useState, 2),
58
59
  internalExpand = _useState2[0],
59
60
  setInternalExpand = _useState2[1];
60
- // const locale = useLocale('BlockHeader');
61
-
62
61
  var currentExpand = isControlled(props) ? expand : internalExpand;
63
62
 
64
63
  // 只有在有了 children 并且设置了 expand/defaultExpand 的时候才能够展开收起
65
64
  var showCollapse = (typeof expand === 'boolean' || typeof defaultExpand === 'boolean') && children;
66
65
  var tooltipProps = toTooltipProps(tooltip);
67
66
  var bottomStyle;
68
- if (spaceBottom) bottomStyle = showCollapse && currentExpand ? {
67
+ if (spaceBottom) bottomStyle = showCollapse && !currentExpand ? {
69
68
  marginBottom: 0
70
69
  } : {
71
70
  marginBottom: spaceBottom
@@ -92,7 +91,9 @@ var BlockHeader = function BlockHeader(props) {
92
91
  className: "title__text"
93
92
  }, title), tooltipProps !== null && tooltipProps !== void 0 && tooltipProps.title ? /*#__PURE__*/React.createElement("div", {
94
93
  className: "title__tooltip"
95
- }, /*#__PURE__*/React.createElement(Tooltip, tooltipProps, /*#__PURE__*/React.createElement(QuestionOutlined, null))) : null, description ? /*#__PURE__*/React.createElement("div", {
94
+ }, /*#__PURE__*/React.createElement(Tooltip, _extends({}, tooltipProps, {
95
+ className: classNames(tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.className, 'anticon')
96
+ }), /*#__PURE__*/React.createElement(QuestionOutlined, null))) : null, description ? /*#__PURE__*/React.createElement("div", {
96
97
  className: "title__description"
97
98
  }, description) : null), addonAfter && /*#__PURE__*/React.createElement("div", {
98
99
  className: "title__addon-after"
@@ -100,14 +101,16 @@ var BlockHeader = function BlockHeader(props) {
100
101
  className: "title__collapse"
101
102
  }, /*#__PURE__*/React.createElement("div", {
102
103
  className: "collapse__text"
103
- }), /*#__PURE__*/React.createElement(UpOutlined, {
104
- className: classNames('collapse__icon', {
104
+ }, currentExpand ? '收起' : '展开'), /*#__PURE__*/React.createElement(UpOutlined, {
105
+ className: classNames('collapse__icon', 'anticon', {
105
106
  'collapse__icon--up': currentExpand,
106
107
  'collapse__icon--down': !currentExpand
107
108
  })
108
- }))), children && /*#__PURE__*/React.createElement("div", {
109
+ }))), /*#__PURE__*/React.createElement(Collapsible, {
110
+ isOpen: !currentExpand
111
+ }, /*#__PURE__*/React.createElement("div", {
109
112
  className: classNames("".concat(prefixCls, "__content"), contentClassName, _defineProperty({}, "".concat(prefixCls, "__content--active"), currentExpand || !showCollapse)),
110
113
  style: contentStyle
111
- }, children));
114
+ }, children)));
112
115
  };
113
116
  export default BlockHeader;
@@ -0,0 +1,2 @@
1
+ import '../../style';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import "../../style";
2
+ import "./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,29 @@
1
+ var _excluded = ["className", "icon", "children", "size", "type"];
2
+ 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); }
3
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
+ import React from 'react';
6
+ import { Button as AntdButton } from 'antd';
7
+ import { globalConfig } from 'antd/es/config-provider';
8
+ import classNames from 'classnames';
9
+ import "./style";
10
+ export default function Button(_ref) {
11
+ var className = _ref.className,
12
+ icon = _ref.icon,
13
+ children = _ref.children,
14
+ _ref$size = _ref.size,
15
+ size = _ref$size === void 0 ? 'middle' : _ref$size,
16
+ type = _ref.type,
17
+ rest = _objectWithoutProperties(_ref, _excluded);
18
+ var prefixCls = globalConfig().getPrefixCls('btn');
19
+ var typeClassName = type ? "".concat(prefixCls, "--").concat(type) : '';
20
+ return /*#__PURE__*/React.createElement(AntdButton, _extends({
21
+ className: classNames(prefixCls, className, typeClassName),
22
+ size: size,
23
+ type: type
24
+ }, rest), icon && /*#__PURE__*/React.createElement("span", {
25
+ className: "".concat(prefixCls, "__icon ").concat(prefixCls, "__icon--").concat(size)
26
+ }, icon), children && /*#__PURE__*/React.createElement("span", {
27
+ className: "".concat(prefixCls, "__text ").concat(prefixCls, "__text--").concat(size)
28
+ }, children));
29
+ }
@@ -0,0 +1,2 @@
1
+ import '../../style/index.less';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import "../../style/index.less";
2
+ import "./index.less";
@@ -0,0 +1,134 @@
1
+ @import '../../style/themes/index.less';
2
+ @import './mixin.less';
3
+
4
+ @btn-prefix-cls: ~'@{ant-prefix}-btn';
5
+
6
+ .@{btn-prefix-cls} {
7
+ display: inline-flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+
11
+ // 引用中尺寸配置(核心:先调用混入,再取值)
12
+ .btn-size-middle();
13
+ padding: @padding;
14
+
15
+ // 图标样式
16
+ &__icon {
17
+ display: inline-flex;
18
+ align-items: center;
19
+ justify-content: center;
20
+ font-size: inherit;
21
+ line-height: 0;
22
+
23
+ .dtstack-icon {
24
+ font-size: inherit;
25
+ }
26
+
27
+ // 小尺寸图标
28
+ &--small {
29
+ .btn-size-small();
30
+ font-size: @icon-font-size;
31
+ }
32
+ // 中尺寸图标
33
+ &--middle {
34
+ .btn-size-middle();
35
+ font-size: @icon-font-size;
36
+ }
37
+ // 大尺寸图标
38
+ &--large {
39
+ .btn-size-large();
40
+ font-size: @icon-font-size;
41
+ }
42
+
43
+ // 图标与文字间距
44
+ & + .@{btn-prefix-cls}__text {
45
+ &--small {
46
+ .btn-size-small();
47
+ margin-left: @icon-text-margin;
48
+ }
49
+ &--middle {
50
+ .btn-size-middle();
51
+ margin-left: @icon-text-margin;
52
+ }
53
+ &--large {
54
+ .btn-size-large();
55
+ margin-left: @icon-text-margin;
56
+ }
57
+ }
58
+ }
59
+
60
+ // 文字样式
61
+ &__text {
62
+ display: inline-block;
63
+
64
+ &--small {
65
+ .btn-size-small();
66
+ font-size: @text-font-size;
67
+ }
68
+ &--middle {
69
+ .btn-size-middle();
70
+ font-size: @text-font-size;
71
+ }
72
+ &--large {
73
+ .btn-size-large();
74
+ font-size: @text-font-size;
75
+ }
76
+ }
77
+
78
+ // 尺寸变体
79
+ &-sm {
80
+ .btn-size-small();
81
+ padding: @padding;
82
+ }
83
+ &-lg {
84
+ .btn-size-large();
85
+ padding: @padding;
86
+ }
87
+
88
+ // 主要按钮
89
+ &-primary {
90
+ .btn-disabled-primary();
91
+ .generate-btn-disabled(@bg, @color, @border);
92
+
93
+ &:hover,
94
+ &:focus {
95
+ background-color: #225fdb;
96
+ }
97
+ }
98
+
99
+ // 次要按钮
100
+ &-secondary {
101
+ border-color: @primary-color;
102
+ color: @primary-color;
103
+
104
+ &:hover,
105
+ &:focus {
106
+ background-color: fade(@primary-color, 10%);
107
+ }
108
+
109
+ .btn-disabled-secondary-tertiary();
110
+ .generate-btn-disabled(@bg, @color, @border);
111
+ }
112
+
113
+ // 三级按钮
114
+ &-tertiary {
115
+ background-color: #f3f3f3;
116
+ border-color: @border-color-base;
117
+
118
+ &:hover,
119
+ &:focus {
120
+ background-color: fade(@primary-color, 10%);
121
+ border-color: @primary-color;
122
+ color: @primary-color;
123
+ }
124
+
125
+ .btn-disabled-secondary-tertiary();
126
+ .generate-btn-disabled(@bg, @color, @border);
127
+ }
128
+
129
+ // 默认按钮
130
+ &-default {
131
+ .btn-disabled-default();
132
+ .generate-btn-disabled(@bg, @color, @border);
133
+ }
134
+ }