@dtjoy/dt-design 1.0.5 → 1.0.6

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.
@@ -0,0 +1,4 @@
1
+ import type { ReactNode } from 'react';
2
+ import { TooltipProps } from 'antd';
3
+ declare const convertToTooltipProps: <P extends TooltipProps>(tooltip: P | ReactNode) => P | null;
4
+ export default convertToTooltipProps;
@@ -0,0 +1,15 @@
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
+ import { isValidElement } from 'react';
3
+ import isNonNullable from "./isNonNullable";
4
+ var convertToTooltipProps = function convertToTooltipProps(tooltip) {
5
+ if (!isNonNullable(tooltip)) {
6
+ return null;
7
+ }
8
+ if (_typeof(tooltip) === 'object' && ! /*#__PURE__*/isValidElement(tooltip)) {
9
+ return tooltip;
10
+ }
11
+ return {
12
+ title: tooltip
13
+ };
14
+ };
15
+ export default convertToTooltipProps;
@@ -0,0 +1,8 @@
1
+ export declare type ZIndexContainer = 'Modal' | 'Drawer' | 'Popover' | 'Popconfirm' | 'Tooltip' | 'Tour' | 'FloatButton';
2
+ export declare type ZIndexConsumer = 'SelectLike' | 'Dropdown' | 'DatePicker' | 'Menu' | 'ImagePreview';
3
+ export declare const CONTAINER_MAX_OFFSET: number;
4
+ export declare const containerBaseZIndexOffset: Record<ZIndexContainer, number>;
5
+ export declare const consumerBaseZIndexOffset: Record<ZIndexConsumer, number>;
6
+ declare type ReturnResult = [zIndex: number | undefined, contextZIndex: number];
7
+ export declare const useZIndex: (componentType: ZIndexContainer | ZIndexConsumer, customZIndex?: number) => ReturnResult;
8
+ export {};
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import { devUseWarning } from "../warning";
3
+ import zIndexContext from "../zindexContext";
4
+ var DEFAULT_Z_INDEX_POPUP_BASE = 1000;
5
+ var CONTAINER_OFFSET = 100;
6
+ var CONTAINER_OFFSET_MAX_COUNT = 10;
7
+ export var CONTAINER_MAX_OFFSET = CONTAINER_OFFSET * CONTAINER_OFFSET_MAX_COUNT;
8
+ var CONTAINER_MAX_OFFSET_WITH_CHILDREN = CONTAINER_MAX_OFFSET + CONTAINER_OFFSET;
9
+ export var containerBaseZIndexOffset = {
10
+ Modal: CONTAINER_OFFSET,
11
+ Drawer: CONTAINER_OFFSET,
12
+ Popover: CONTAINER_OFFSET,
13
+ Popconfirm: CONTAINER_OFFSET,
14
+ Tooltip: CONTAINER_OFFSET,
15
+ Tour: CONTAINER_OFFSET,
16
+ FloatButton: CONTAINER_OFFSET
17
+ };
18
+ export var consumerBaseZIndexOffset = {
19
+ SelectLike: 50,
20
+ Dropdown: 50,
21
+ DatePicker: 50,
22
+ Menu: 50,
23
+ ImagePreview: 1
24
+ };
25
+ var isContainerType = function isContainerType(type) {
26
+ return type in containerBaseZIndexOffset;
27
+ };
28
+ export var useZIndex = function useZIndex(componentType, customZIndex) {
29
+ var zIndexPopupBase = DEFAULT_Z_INDEX_POPUP_BASE;
30
+ var parentZIndex = React.useContext(zIndexContext);
31
+ var isContainer = isContainerType(componentType);
32
+ var result;
33
+ if (customZIndex !== undefined) {
34
+ result = [customZIndex, customZIndex];
35
+ } else {
36
+ var _zIndex = parentZIndex !== null && parentZIndex !== void 0 ? parentZIndex : 0;
37
+ if (isContainer) {
38
+ _zIndex += (parentZIndex ? 0 : zIndexPopupBase) + containerBaseZIndexOffset[componentType];
39
+ } else {
40
+ _zIndex += consumerBaseZIndexOffset[componentType];
41
+ }
42
+ result = [customZIndex !== null && customZIndex !== void 0 ? customZIndex : _zIndex, _zIndex];
43
+ }
44
+ if (process.env.NODE_ENV !== 'production') {
45
+ var warning = devUseWarning(componentType);
46
+ var maxZIndex = zIndexPopupBase + CONTAINER_MAX_OFFSET_WITH_CHILDREN;
47
+ var currentZIndex = result[0] || 0;
48
+ warning(customZIndex !== undefined || currentZIndex <= maxZIndex, 'usage', '`zIndex` is over design token `zIndexPopupBase` too much. It may cause unexpected override.');
49
+ }
50
+ return result;
51
+ };
@@ -0,0 +1,31 @@
1
+ import * as React from 'react';
2
+ export declare function noop(): void;
3
+ export declare function resetWarned(): void;
4
+ declare type Warning = (valid: boolean, component: string, message?: string) => void;
5
+ declare const warning: Warning;
6
+ declare type BaseTypeWarning = (valid: boolean,
7
+ /**
8
+ * - deprecated: Some API will be removed in future but still support now.
9
+ * - usage: Some API usage is not correct.
10
+ * - breaking: Breaking change like API is removed.
11
+ */
12
+ type: 'deprecated' | 'usage' | 'breaking', message?: string) => void;
13
+ declare type TypeWarning = BaseTypeWarning & {
14
+ deprecated: (valid: boolean, oldProp: string, newProp: string, message?: string) => void;
15
+ };
16
+ export interface WarningContextProps {
17
+ /**
18
+ * @descCN 设置警告等级,设置 `false` 时会将废弃相关信息聚合为单条信息。
19
+ * @descEN Set the warning level. When set to `false`, discard related information will be aggregated into a single message.
20
+ * @since 5.10.0
21
+ */
22
+ strict?: boolean;
23
+ }
24
+ export declare const WarningContext: React.Context<WarningContextProps>;
25
+ /**
26
+ * This is a hook but we not named as `useWarning`
27
+ * since this is only used in development.
28
+ * We should always wrap this in `if (process.env.NODE_ENV !== 'production')` condition
29
+ */
30
+ export declare const devUseWarning: (component: string) => TypeWarning;
31
+ export default warning;
@@ -0,0 +1,63 @@
1
+ import * as React from 'react';
2
+ import rcWarning from 'rc-util/lib/warning';
3
+ export function noop() {}
4
+ var rcResetWarned = rcWarning.resetWarned;
5
+ var deprecatedWarnList = null;
6
+ export function resetWarned() {
7
+ deprecatedWarnList = null;
8
+ rcResetWarned();
9
+ }
10
+ var _warning = noop;
11
+ if (process.env.NODE_ENV !== 'production') {
12
+ _warning = function _warning(valid, component, message) {
13
+ rcWarning(valid, "[antd: ".concat(component, "] ").concat(message));
14
+
15
+ // StrictMode will inject console which will not throw warning in React 17.
16
+ if (process.env.NODE_ENV === 'test') {
17
+ resetWarned();
18
+ }
19
+ };
20
+ }
21
+ var warning = _warning;
22
+ export var WarningContext = /*#__PURE__*/React.createContext({});
23
+
24
+ /**
25
+ * This is a hook but we not named as `useWarning`
26
+ * since this is only used in development.
27
+ * We should always wrap this in `if (process.env.NODE_ENV !== 'production')` condition
28
+ */
29
+ export var devUseWarning = process.env.NODE_ENV !== 'production' ? function (component) {
30
+ var _React$useContext = React.useContext(WarningContext),
31
+ strict = _React$useContext.strict;
32
+ var typeWarning = function typeWarning(valid, type, message) {
33
+ if (!valid) {
34
+ if (strict === false && type === 'deprecated') {
35
+ var existWarning = deprecatedWarnList;
36
+ if (!deprecatedWarnList) {
37
+ deprecatedWarnList = {};
38
+ }
39
+ deprecatedWarnList[component] = deprecatedWarnList[component] || [];
40
+ if (!deprecatedWarnList[component].includes(message || '')) {
41
+ deprecatedWarnList[component].push(message || '');
42
+ }
43
+
44
+ // Warning for the first time
45
+ if (!existWarning) {
46
+ console.warn('[antd] There exists deprecated usage in your code:', deprecatedWarnList);
47
+ }
48
+ } else {
49
+ warning(valid, component, message);
50
+ }
51
+ }
52
+ };
53
+ typeWarning.deprecated = function (valid, oldProp, newProp) {
54
+ var message = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
55
+ typeWarning(valid, 'deprecated', "`".concat(oldProp, "` is deprecated. Please use `").concat(newProp, "` instead.").concat(message ? " ".concat(message) : ''));
56
+ };
57
+ return typeWarning;
58
+ } : function () {
59
+ var noopWarning = function noopWarning() {};
60
+ noopWarning.deprecated = noop;
61
+ return noopWarning;
62
+ };
63
+ export default warning;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const zIndexContext: React.Context<number | undefined>;
3
+ export default zIndexContext;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ var zIndexContext = /*#__PURE__*/React.createContext(undefined);
3
+ if (process.env.NODE_ENV !== 'production') {
4
+ zIndexContext.displayName = 'zIndexContext';
5
+ }
6
+ export default zIndexContext;
@@ -1,8 +1,9 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import './style';
3
3
  import { LabelTooltipType } from '../_util';
4
+ import type { CollapsibleProps } from '../collapsible';
4
5
  export declare type SizeType = 'small' | 'middle' | 'large';
5
- export interface IBlockHeaderProps {
6
+ export interface IBlockHeaderProps extends CollapsibleProps {
6
7
  /** 标题 */
7
8
  title: ReactNode;
8
9
  /** 标题前的图标,默认是一个色块 */
@@ -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
+ var _excluded = ["title", "description", "tooltip", "size", "spaceBottom", "className", "contentClassName", "style", "contentStyle", "background", "defaultExpand", "addonAfter", "expand", "children", "addonBefore", "onExpand", "titleStyle"];
2
3
  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
4
  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; }
4
5
  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; }
@@ -11,6 +12,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
11
12
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
12
13
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
13
14
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
+ 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; }
16
+ 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; }
14
17
  import React, { useState } from 'react';
15
18
  import { QuestionCircleOutlined, UpOutlined } from '@ant-design/icons';
16
19
  import { Tooltip } from 'antd';
@@ -53,7 +56,8 @@ var BlockHeader = function BlockHeader(props) {
53
56
  className: "addon-before--default"
54
57
  }) : _props$addonBefore,
55
58
  onExpand = props.onExpand,
56
- titleStyle = props.titleStyle;
59
+ titleStyle = props.titleStyle,
60
+ rest = _objectWithoutProperties(props, _excluded);
57
61
  var _useState = useState(defaultExpand),
58
62
  _useState2 = _slicedToArray(_useState, 2),
59
63
  internalExpand = _useState2[0],
@@ -106,9 +110,9 @@ var BlockHeader = function BlockHeader(props) {
106
110
  'collapse__icon--up': currentExpand,
107
111
  'collapse__icon--down': !currentExpand
108
112
  })
109
- }))), /*#__PURE__*/React.createElement(Collapsible, {
113
+ }))), /*#__PURE__*/React.createElement(Collapsible, _extends({
110
114
  isOpen: !currentExpand
111
- }, /*#__PURE__*/React.createElement("div", {
115
+ }, rest), /*#__PURE__*/React.createElement("div", {
112
116
  className: classNames("".concat(prefixCls, "__content"), contentClassName, _defineProperty({}, "".concat(prefixCls, "__content--active"), currentExpand || !showCollapse)),
113
117
  style: contentStyle
114
118
  }, children)));
@@ -6,5 +6,5 @@ declare type ButtonType = AntdButtonType | 'secondary' | 'tertiary';
6
6
  export interface ButtonProps extends Omit<AntdButtonProps, 'type'> {
7
7
  type?: ButtonType;
8
8
  }
9
- export default function Button({ className, icon, children, size, type, ...rest }: ButtonProps): React.JSX.Element;
10
- export {};
9
+ declare const _default: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLElement>>;
10
+ export default _default;
@@ -1,29 +1,21 @@
1
- var _excluded = ["className", "icon", "children", "size", "type"];
1
+ var _excluded = ["className", "size", "type"];
2
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
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
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
5
  import React from 'react';
6
6
  import { Button as AntdButton } from 'antd';
7
- import { globalConfig } from 'antd/es/config-provider';
8
7
  import classNames from 'classnames';
9
8
  import "./style";
10
- export default function Button(_ref) {
9
+ function Button(_ref) {
11
10
  var className = _ref.className,
12
- icon = _ref.icon,
13
- children = _ref.children,
14
11
  _ref$size = _ref.size,
15
12
  size = _ref$size === void 0 ? 'middle' : _ref$size,
16
13
  type = _ref.type,
17
14
  rest = _objectWithoutProperties(_ref, _excluded);
18
- var prefixCls = globalConfig().getPrefixCls('btn');
19
- var typeClassName = type ? "".concat(prefixCls, "--").concat(type) : '';
20
15
  return /*#__PURE__*/React.createElement(AntdButton, _extends({
21
- className: classNames(prefixCls, className, typeClassName),
16
+ className: classNames(className),
22
17
  size: size,
23
18
  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
- }
19
+ }, rest));
20
+ }
21
+ export default Button;
@@ -3,132 +3,57 @@
3
3
 
4
4
  @btn-prefix-cls: ~'@{ant-prefix}-btn';
5
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
- }
6
+ .ant-btn {
7
+ display: inline-flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+ transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
11
+ padding: 0;
12
+
13
+ .apply-btn-size(4px 16px; 14px; 16px; 8px);
14
+
15
+ &-sm {
16
+ .apply-btn-size(2px 12px; 12px; 12px; 2px);
17
+ }
18
+
19
+ &-lg {
20
+ .apply-btn-size(3px 40px; 14px; 18px; 8px);
21
+ }
22
+
23
+ &-circle {
24
+ padding-inline: 0;
25
+ border-radius: 50%;
26
+ }
27
+
28
+
29
+ // 主按钮
30
+ &-primary {
31
+ .btn-hover-variant(#fff; #225fdb; #225fdb);
32
+ .generate-btn-disabled(@disabled-color; #f9f9f9; @disabled-color);
33
+ }
34
+
35
+ // 次按钮
36
+ &-secondary {
37
+ color: @primary-color;
38
+ border-color: @primary-color;
39
+
40
+ .btn-hover-variant(@primary-color; fade(@primary-color, 10%); @primary-color);
41
+ .generate-btn-disabled(@primary-color-disabled; @disabled-color; @border-color-base);
42
+ }
43
+
44
+ // 三级按钮
45
+ &-tertiary {
46
+ background-color: #f3f3f3;
47
+ border-color: @border-color-base;
48
+
49
+ .btn-hover-variant(@primary-color; fade(@primary-color, 10%); @primary-color);
50
+ .generate-btn-disabled(@primary-color-disabled; @disabled-color; @border-color-base);
51
+ }
52
+
53
+ // 默认按钮
54
+ &-default {
55
+ .generate-btn-disabled(transparent; @disabled-color; @border-color-base);
56
+ }
57
+ }
124
58
 
125
- .btn-disabled-secondary-tertiary();
126
- .generate-btn-disabled(@bg, @color, @border);
127
- }
128
59
 
129
- // 默认按钮
130
- &-default {
131
- .btn-disabled-default();
132
- .generate-btn-disabled(@bg, @color, @border);
133
- }
134
- }
@@ -1,47 +1,39 @@
1
- .btn-size-small() {
2
- @padding: 2px 12px;
3
- @icon-font-size: 12px;
4
- @text-font-size: 12px;
5
- @icon-text-margin: 2px;
6
- }
7
- .btn-size-middle() {
8
- @padding: 4px 16px;
9
- @icon-font-size: 16px;
10
- @text-font-size: 14px;
11
- @icon-text-margin: 8px;
12
- }
13
- .btn-size-large() {
14
- @padding: 3px 40px;
15
- @icon-font-size: 18px;
16
- @text-font-size: 14px;
17
- @icon-text-margin: 8px;
18
- }
1
+ // ===================== 按钮尺寸处理 =====================
2
+ .apply-btn-size(@padding; @font-size; @icon-size: 16px; @gap: 8px) {
3
+ padding: @padding;
4
+ font-size: @font-size;
19
5
 
20
- // 禁用状态配置(同样用混入)
21
- .btn-disabled-primary() {
22
- @bg: @disabled-color;
23
- @color: #F9F9F9;
24
- @border: @disabled-color;
25
- }
26
- .btn-disabled-secondary-tertiary() {
27
- @bg: @primary-color-disabled;
28
- @color: @disabled-color;
29
- @border: @border-color-base;
6
+ .anticon {
7
+ font-size: @icon-size;
8
+ + span {
9
+ margin-left: @gap;
10
+ }
11
+ }
30
12
  }
31
- .btn-disabled-default() {
32
- @bg: transparent;
33
- @color: @disabled-color;
34
- @border: @border-color-base;
13
+
14
+ // ===================== 禁用状态生成器 =====================
15
+ // 参数: 背景色, 文字颜色, 边框颜色
16
+ .generate-btn-disabled(@bg; @color; @border) {
17
+ &[disabled],
18
+ &[disabled]:hover,
19
+ &[disabled]:active,
20
+ &[disabled]:focus {
21
+ color: @color;
22
+ background: @bg;
23
+ border-color: @border;
24
+ cursor: not-allowed;
25
+ opacity: 1;
26
+ box-shadow: none;
27
+ text-shadow: none;
28
+ }
35
29
  }
36
30
 
37
- // ===================== 工具混入 =====================
38
- .generate-btn-disabled(@bg, @color, @border) {
39
- &[disabled],
40
- &[disabled]:hover {
41
- background: @bg;
42
- color: @color;
43
- border-color: @border;
44
- cursor: not-allowed;
45
- opacity: 1;
46
- }
31
+ // ===================== 交互状态快捷配置 =====================
32
+ .btn-hover-variant(@color; @bg; @border) {
33
+ &:hover,
34
+ &:focus {
35
+ color: @color;
36
+ background: @bg;
37
+ border-color: @border;
38
+ }
47
39
  }
@@ -0,0 +1,4 @@
1
+ import type { ReactNode } from 'react';
2
+ import { TooltipProps } from 'antd';
3
+ declare const convertToTooltipProps: <P extends TooltipProps>(tooltip: P | ReactNode) => P | null;
4
+ export default convertToTooltipProps;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ var _isNonNullable = _interopRequireDefault(require("./isNonNullable"));
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ const convertToTooltipProps = tooltip => {
11
+ if (!(0, _isNonNullable.default)(tooltip)) {
12
+ return null;
13
+ }
14
+ if (typeof tooltip === 'object' && ! /*#__PURE__*/(0, _react.isValidElement)(tooltip)) {
15
+ return tooltip;
16
+ }
17
+ return {
18
+ title: tooltip
19
+ };
20
+ };
21
+ var _default = exports.default = convertToTooltipProps;
@@ -0,0 +1,8 @@
1
+ export declare type ZIndexContainer = 'Modal' | 'Drawer' | 'Popover' | 'Popconfirm' | 'Tooltip' | 'Tour' | 'FloatButton';
2
+ export declare type ZIndexConsumer = 'SelectLike' | 'Dropdown' | 'DatePicker' | 'Menu' | 'ImagePreview';
3
+ export declare const CONTAINER_MAX_OFFSET: number;
4
+ export declare const containerBaseZIndexOffset: Record<ZIndexContainer, number>;
5
+ export declare const consumerBaseZIndexOffset: Record<ZIndexConsumer, number>;
6
+ declare type ReturnResult = [zIndex: number | undefined, contextZIndex: number];
7
+ export declare const useZIndex: (componentType: ZIndexContainer | ZIndexConsumer, customZIndex?: number) => ReturnResult;
8
+ export {};
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useZIndex = exports.containerBaseZIndexOffset = exports.consumerBaseZIndexOffset = exports.CONTAINER_MAX_OFFSET = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _warning = require("../warning");
9
+ var _zindexContext = _interopRequireDefault(require("../zindexContext"));
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ const DEFAULT_Z_INDEX_POPUP_BASE = 1000;
12
+ const CONTAINER_OFFSET = 100;
13
+ const CONTAINER_OFFSET_MAX_COUNT = 10;
14
+ const CONTAINER_MAX_OFFSET = exports.CONTAINER_MAX_OFFSET = CONTAINER_OFFSET * CONTAINER_OFFSET_MAX_COUNT;
15
+ const CONTAINER_MAX_OFFSET_WITH_CHILDREN = CONTAINER_MAX_OFFSET + CONTAINER_OFFSET;
16
+ const containerBaseZIndexOffset = exports.containerBaseZIndexOffset = {
17
+ Modal: CONTAINER_OFFSET,
18
+ Drawer: CONTAINER_OFFSET,
19
+ Popover: CONTAINER_OFFSET,
20
+ Popconfirm: CONTAINER_OFFSET,
21
+ Tooltip: CONTAINER_OFFSET,
22
+ Tour: CONTAINER_OFFSET,
23
+ FloatButton: CONTAINER_OFFSET
24
+ };
25
+ const consumerBaseZIndexOffset = exports.consumerBaseZIndexOffset = {
26
+ SelectLike: 50,
27
+ Dropdown: 50,
28
+ DatePicker: 50,
29
+ Menu: 50,
30
+ ImagePreview: 1
31
+ };
32
+ const isContainerType = type => {
33
+ return type in containerBaseZIndexOffset;
34
+ };
35
+ const useZIndex = (componentType, customZIndex) => {
36
+ const zIndexPopupBase = DEFAULT_Z_INDEX_POPUP_BASE;
37
+ const parentZIndex = _react.default.useContext(_zindexContext.default);
38
+ const isContainer = isContainerType(componentType);
39
+ let result;
40
+ if (customZIndex !== undefined) {
41
+ result = [customZIndex, customZIndex];
42
+ } else {
43
+ let zIndex = parentZIndex ?? 0;
44
+ if (isContainer) {
45
+ zIndex += (parentZIndex ? 0 : zIndexPopupBase) + containerBaseZIndexOffset[componentType];
46
+ } else {
47
+ zIndex += consumerBaseZIndexOffset[componentType];
48
+ }
49
+ result = [customZIndex ?? zIndex, zIndex];
50
+ }
51
+ if (process.env.NODE_ENV !== 'production') {
52
+ const warning = (0, _warning.devUseWarning)(componentType);
53
+ const maxZIndex = zIndexPopupBase + CONTAINER_MAX_OFFSET_WITH_CHILDREN;
54
+ const currentZIndex = result[0] || 0;
55
+ warning(customZIndex !== undefined || currentZIndex <= maxZIndex, 'usage', '`zIndex` is over design token `zIndexPopupBase` too much. It may cause unexpected override.');
56
+ }
57
+ return result;
58
+ };
59
+ exports.useZIndex = useZIndex;
@@ -0,0 +1,31 @@
1
+ import * as React from 'react';
2
+ export declare function noop(): void;
3
+ export declare function resetWarned(): void;
4
+ declare type Warning = (valid: boolean, component: string, message?: string) => void;
5
+ declare const warning: Warning;
6
+ declare type BaseTypeWarning = (valid: boolean,
7
+ /**
8
+ * - deprecated: Some API will be removed in future but still support now.
9
+ * - usage: Some API usage is not correct.
10
+ * - breaking: Breaking change like API is removed.
11
+ */
12
+ type: 'deprecated' | 'usage' | 'breaking', message?: string) => void;
13
+ declare type TypeWarning = BaseTypeWarning & {
14
+ deprecated: (valid: boolean, oldProp: string, newProp: string, message?: string) => void;
15
+ };
16
+ export interface WarningContextProps {
17
+ /**
18
+ * @descCN 设置警告等级,设置 `false` 时会将废弃相关信息聚合为单条信息。
19
+ * @descEN Set the warning level. When set to `false`, discard related information will be aggregated into a single message.
20
+ * @since 5.10.0
21
+ */
22
+ strict?: boolean;
23
+ }
24
+ export declare const WarningContext: React.Context<WarningContextProps>;
25
+ /**
26
+ * This is a hook but we not named as `useWarning`
27
+ * since this is only used in development.
28
+ * We should always wrap this in `if (process.env.NODE_ENV !== 'production')` condition
29
+ */
30
+ export declare const devUseWarning: (component: string) => TypeWarning;
31
+ export default warning;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.devUseWarning = exports.default = exports.WarningContext = void 0;
7
+ exports.noop = noop;
8
+ exports.resetWarned = resetWarned;
9
+ var React = _interopRequireWildcard(require("react"));
10
+ var _warning2 = _interopRequireDefault(require("rc-util/lib/warning"));
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ 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); }
13
+ 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; }
14
+ function noop() {}
15
+ const {
16
+ resetWarned: rcResetWarned
17
+ } = _warning2.default;
18
+ let deprecatedWarnList = null;
19
+ function resetWarned() {
20
+ deprecatedWarnList = null;
21
+ rcResetWarned();
22
+ }
23
+ let _warning = noop;
24
+ if (process.env.NODE_ENV !== 'production') {
25
+ _warning = (valid, component, message) => {
26
+ (0, _warning2.default)(valid, `[antd: ${component}] ${message}`);
27
+
28
+ // StrictMode will inject console which will not throw warning in React 17.
29
+ if (process.env.NODE_ENV === 'test') {
30
+ resetWarned();
31
+ }
32
+ };
33
+ }
34
+ const warning = _warning;
35
+ const WarningContext = exports.WarningContext = /*#__PURE__*/React.createContext({});
36
+
37
+ /**
38
+ * This is a hook but we not named as `useWarning`
39
+ * since this is only used in development.
40
+ * We should always wrap this in `if (process.env.NODE_ENV !== 'production')` condition
41
+ */
42
+ const devUseWarning = exports.devUseWarning = process.env.NODE_ENV !== 'production' ? component => {
43
+ const {
44
+ strict
45
+ } = React.useContext(WarningContext);
46
+ const typeWarning = (valid, type, message) => {
47
+ if (!valid) {
48
+ if (strict === false && type === 'deprecated') {
49
+ const existWarning = deprecatedWarnList;
50
+ if (!deprecatedWarnList) {
51
+ deprecatedWarnList = {};
52
+ }
53
+ deprecatedWarnList[component] = deprecatedWarnList[component] || [];
54
+ if (!deprecatedWarnList[component].includes(message || '')) {
55
+ deprecatedWarnList[component].push(message || '');
56
+ }
57
+
58
+ // Warning for the first time
59
+ if (!existWarning) {
60
+ console.warn('[antd] There exists deprecated usage in your code:', deprecatedWarnList);
61
+ }
62
+ } else {
63
+ warning(valid, component, message);
64
+ }
65
+ }
66
+ };
67
+ typeWarning.deprecated = (valid, oldProp, newProp, message = '') => {
68
+ typeWarning(valid, 'deprecated', `\`${oldProp}\` is deprecated. Please use \`${newProp}\` instead.${message ? ` ${message}` : ''}`);
69
+ };
70
+ return typeWarning;
71
+ } : () => {
72
+ const noopWarning = () => {};
73
+ noopWarning.deprecated = noop;
74
+ return noopWarning;
75
+ };
76
+ var _default = exports.default = warning;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const zIndexContext: React.Context<number | undefined>;
3
+ export default zIndexContext;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const zIndexContext = /*#__PURE__*/_react.default.createContext(undefined);
10
+ if (process.env.NODE_ENV !== 'production') {
11
+ zIndexContext.displayName = 'zIndexContext';
12
+ }
13
+ var _default = exports.default = zIndexContext;
@@ -1,8 +1,9 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import './style';
3
3
  import { LabelTooltipType } from '../_util';
4
+ import type { CollapsibleProps } from '../collapsible';
4
5
  export declare type SizeType = 'small' | 'middle' | 'large';
5
- export interface IBlockHeaderProps {
6
+ export interface IBlockHeaderProps extends CollapsibleProps {
6
7
  /** 标题 */
7
8
  title: ReactNode;
8
9
  /** 标题前的图标,默认是一个色块 */
@@ -41,7 +41,8 @@ const BlockHeader = function (props) {
41
41
  className: "addon-before--default"
42
42
  }),
43
43
  onExpand,
44
- titleStyle
44
+ titleStyle,
45
+ ...rest
45
46
  } = props;
46
47
  const [internalExpand, setInternalExpand] = (0, _react.useState)(defaultExpand);
47
48
  const currentExpand = isControlled(props) ? expand : internalExpand;
@@ -96,9 +97,9 @@ const BlockHeader = function (props) {
96
97
  'collapse__icon--up': currentExpand,
97
98
  'collapse__icon--down': !currentExpand
98
99
  })
99
- }))), /*#__PURE__*/_react.default.createElement(_collapsible.default, {
100
+ }))), /*#__PURE__*/_react.default.createElement(_collapsible.default, _extends({
100
101
  isOpen: !currentExpand
101
- }, /*#__PURE__*/_react.default.createElement("div", {
102
+ }, rest), /*#__PURE__*/_react.default.createElement("div", {
102
103
  className: (0, _classnames.default)(`${prefixCls}__content`, contentClassName, {
103
104
  [`${prefixCls}__content--active`]: currentExpand || !showCollapse
104
105
  }),
@@ -6,5 +6,5 @@ declare type ButtonType = AntdButtonType | 'secondary' | 'tertiary';
6
6
  export interface ButtonProps extends Omit<AntdButtonProps, 'type'> {
7
7
  type?: ButtonType;
8
8
  }
9
- export default function Button({ className, icon, children, size, type, ...rest }: ButtonProps): React.JSX.Element;
10
- export {};
9
+ declare const _default: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLElement>>;
10
+ export default _default;
@@ -3,31 +3,23 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = Button;
6
+ exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _antd = require("antd");
9
- var _configProvider = require("antd/es/config-provider");
10
9
  var _classnames = _interopRequireDefault(require("classnames"));
11
10
  require("./style");
12
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
12
  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
13
  function Button({
15
14
  className,
16
- icon,
17
- children,
18
15
  size = 'middle',
19
16
  type,
20
17
  ...rest
21
18
  }) {
22
- const prefixCls = (0, _configProvider.globalConfig)().getPrefixCls('btn');
23
- const typeClassName = type ? `${prefixCls}--${type}` : '';
24
19
  return /*#__PURE__*/_react.default.createElement(_antd.Button, _extends({
25
- className: (0, _classnames.default)(prefixCls, className, typeClassName),
20
+ className: (0, _classnames.default)(className),
26
21
  size: size,
27
22
  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
- }
23
+ }, rest));
24
+ }
25
+ var _default = exports.default = Button;
@@ -3,132 +3,57 @@
3
3
 
4
4
  @btn-prefix-cls: ~'@{ant-prefix}-btn';
5
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
- }
6
+ .ant-btn {
7
+ display: inline-flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+ transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
11
+ padding: 0;
12
+
13
+ .apply-btn-size(4px 16px; 14px; 16px; 8px);
14
+
15
+ &-sm {
16
+ .apply-btn-size(2px 12px; 12px; 12px; 2px);
17
+ }
18
+
19
+ &-lg {
20
+ .apply-btn-size(3px 40px; 14px; 18px; 8px);
21
+ }
22
+
23
+ &-circle {
24
+ padding-inline: 0;
25
+ border-radius: 50%;
26
+ }
27
+
28
+
29
+ // 主按钮
30
+ &-primary {
31
+ .btn-hover-variant(#fff; #225fdb; #225fdb);
32
+ .generate-btn-disabled(@disabled-color; #f9f9f9; @disabled-color);
33
+ }
34
+
35
+ // 次按钮
36
+ &-secondary {
37
+ color: @primary-color;
38
+ border-color: @primary-color;
39
+
40
+ .btn-hover-variant(@primary-color; fade(@primary-color, 10%); @primary-color);
41
+ .generate-btn-disabled(@primary-color-disabled; @disabled-color; @border-color-base);
42
+ }
43
+
44
+ // 三级按钮
45
+ &-tertiary {
46
+ background-color: #f3f3f3;
47
+ border-color: @border-color-base;
48
+
49
+ .btn-hover-variant(@primary-color; fade(@primary-color, 10%); @primary-color);
50
+ .generate-btn-disabled(@primary-color-disabled; @disabled-color; @border-color-base);
51
+ }
52
+
53
+ // 默认按钮
54
+ &-default {
55
+ .generate-btn-disabled(transparent; @disabled-color; @border-color-base);
56
+ }
57
+ }
124
58
 
125
- .btn-disabled-secondary-tertiary();
126
- .generate-btn-disabled(@bg, @color, @border);
127
- }
128
59
 
129
- // 默认按钮
130
- &-default {
131
- .btn-disabled-default();
132
- .generate-btn-disabled(@bg, @color, @border);
133
- }
134
- }
@@ -1,47 +1,39 @@
1
- .btn-size-small() {
2
- @padding: 2px 12px;
3
- @icon-font-size: 12px;
4
- @text-font-size: 12px;
5
- @icon-text-margin: 2px;
6
- }
7
- .btn-size-middle() {
8
- @padding: 4px 16px;
9
- @icon-font-size: 16px;
10
- @text-font-size: 14px;
11
- @icon-text-margin: 8px;
12
- }
13
- .btn-size-large() {
14
- @padding: 3px 40px;
15
- @icon-font-size: 18px;
16
- @text-font-size: 14px;
17
- @icon-text-margin: 8px;
18
- }
1
+ // ===================== 按钮尺寸处理 =====================
2
+ .apply-btn-size(@padding; @font-size; @icon-size: 16px; @gap: 8px) {
3
+ padding: @padding;
4
+ font-size: @font-size;
19
5
 
20
- // 禁用状态配置(同样用混入)
21
- .btn-disabled-primary() {
22
- @bg: @disabled-color;
23
- @color: #F9F9F9;
24
- @border: @disabled-color;
25
- }
26
- .btn-disabled-secondary-tertiary() {
27
- @bg: @primary-color-disabled;
28
- @color: @disabled-color;
29
- @border: @border-color-base;
6
+ .anticon {
7
+ font-size: @icon-size;
8
+ + span {
9
+ margin-left: @gap;
10
+ }
11
+ }
30
12
  }
31
- .btn-disabled-default() {
32
- @bg: transparent;
33
- @color: @disabled-color;
34
- @border: @border-color-base;
13
+
14
+ // ===================== 禁用状态生成器 =====================
15
+ // 参数: 背景色, 文字颜色, 边框颜色
16
+ .generate-btn-disabled(@bg; @color; @border) {
17
+ &[disabled],
18
+ &[disabled]:hover,
19
+ &[disabled]:active,
20
+ &[disabled]:focus {
21
+ color: @color;
22
+ background: @bg;
23
+ border-color: @border;
24
+ cursor: not-allowed;
25
+ opacity: 1;
26
+ box-shadow: none;
27
+ text-shadow: none;
28
+ }
35
29
  }
36
30
 
37
- // ===================== 工具混入 =====================
38
- .generate-btn-disabled(@bg, @color, @border) {
39
- &[disabled],
40
- &[disabled]:hover {
41
- background: @bg;
42
- color: @color;
43
- border-color: @border;
44
- cursor: not-allowed;
45
- opacity: 1;
46
- }
31
+ // ===================== 交互状态快捷配置 =====================
32
+ .btn-hover-variant(@color; @bg; @border) {
33
+ &:hover,
34
+ &:focus {
35
+ color: @color;
36
+ background: @bg;
37
+ border-color: @border;
38
+ }
47
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dtjoy/dt-design",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "react-component",
5
5
  "repository": "https://github.com/ZhaoFxxkSky/dt-design",
6
6
  "main": "lib/index.js",