@oceanbase/design 0.2.6 → 0.2.7
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.
- package/dist/design.min.js +1 -1
- package/es/card/style/index.d.ts +11 -0
- package/es/card/style/index.js +5 -8
- package/es/tooltip/MouseTooltip.d.ts +9 -0
- package/es/tooltip/MouseTooltip.js +9 -8
- package/lib/card/style/index.d.ts +11 -0
- package/lib/card/style/index.js +4 -4
- package/lib/tooltip/MouseTooltip.d.ts +9 -0
- package/lib/tooltip/MouseTooltip.js +8 -7
- package/package.json +2 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FullToken, GenerateStyle } from 'antd/es/theme/internal';
|
|
2
|
+
export declare type CardToken = FullToken<'Card'> & {
|
|
3
|
+
tabsComponentCls: string;
|
|
4
|
+
tabsPrefixCls: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const genCardStyle: GenerateStyle<CardToken>;
|
|
7
|
+
declare const _default: (prefixCls: string, tabsPrefixCls: string) => {
|
|
8
|
+
wrapSSR: (node: import("react").ReactNode) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
9
|
+
hashId: string;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
package/es/card/style/index.js
CHANGED
|
@@ -7,23 +7,20 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
7
7
|
import { genTagStyle } from "../../tabs/style";
|
|
8
8
|
import { genComponentStyleHook } from "../../_util/genComponentStyleHook";
|
|
9
9
|
export var genCardStyle = function genCardStyle(token) {
|
|
10
|
-
var
|
|
10
|
+
var _ref;
|
|
11
11
|
var componentCls = token.componentCls,
|
|
12
12
|
tabsComponentCls = token.tabsComponentCls,
|
|
13
13
|
tabsPrefixCls = token.tabsPrefixCls,
|
|
14
14
|
padding = token.padding,
|
|
15
15
|
paddingSM = token.paddingSM,
|
|
16
16
|
paddingLG = token.paddingLG;
|
|
17
|
-
return _ref = {}, _defineProperty(_ref, "".concat(componentCls).concat(componentCls, "-no-divider"), (
|
|
17
|
+
return _ref = {}, _defineProperty(_ref, "".concat(componentCls).concat(componentCls, "-no-divider"), _defineProperty({}, "".concat(componentCls, "-head"), {
|
|
18
18
|
borderBottom: 'none'
|
|
19
|
-
}), _defineProperty(
|
|
19
|
+
})), _defineProperty(_ref, "".concat(componentCls).concat(componentCls, "-no-divider:not(").concat(componentCls, "-contain-tabs)"), _defineProperty({}, "".concat(componentCls, "-body"), {
|
|
20
20
|
padding: "0 ".concat(paddingLG, "px ").concat(padding, "px ").concat(paddingLG, "px")
|
|
21
|
-
})
|
|
21
|
+
})), _defineProperty(_ref, "".concat(componentCls, "-small").concat(componentCls, "-no-divider:not(").concat(componentCls, "-contain-tabs)"), _defineProperty({}, "".concat(componentCls, "-body"), {
|
|
22
22
|
padding: "0 ".concat(paddingSM, "px 12px ").concat(paddingSM, "px")
|
|
23
|
-
})), _defineProperty(_ref, "".concat(componentCls).concat(componentCls, "-contain-tabs"), _defineProperty({}, "".concat(componentCls, "-head"), _objectSpread({
|
|
24
|
-
// 包含页签时,去掉 head 的底部分割线
|
|
25
|
-
borderBottom: 'none'
|
|
26
|
-
}, genTagStyle(_objectSpread(_objectSpread({}, token), {}, {
|
|
23
|
+
})), _defineProperty(_ref, "".concat(componentCls).concat(componentCls, "-contain-tabs"), _defineProperty({}, "".concat(componentCls, "-head"), _objectSpread({}, genTagStyle(_objectSpread(_objectSpread({}, token), {}, {
|
|
27
24
|
componentCls: tabsComponentCls,
|
|
28
25
|
prefixCls: tabsPrefixCls
|
|
29
26
|
}))))), _ref;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TooltipPropsWithTitle as AntTooltipPropsWithTitle } from 'antd/es/tooltip';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface MouseTooltipProps extends AntTooltipPropsWithTitle {
|
|
4
|
+
visible?: boolean;
|
|
5
|
+
offsetX?: number;
|
|
6
|
+
offsetY?: number;
|
|
7
|
+
}
|
|
8
|
+
declare const MouseTooltip: React.FC<MouseTooltipProps>;
|
|
9
|
+
export default MouseTooltip;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
var _excluded = ["children", "title", "visible", "open", "onOpenChange", "onVisibleChange", "overlayInnerStyle", "mouseEnterDelay", "mouseLeaveDelay"],
|
|
2
|
+
var _excluded = ["children", "title", "color", "visible", "open", "onOpenChange", "onVisibleChange", "overlayInnerStyle", "mouseEnterDelay", "mouseLeaveDelay"],
|
|
3
3
|
_excluded2 = ["color"];
|
|
4
4
|
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); }
|
|
5
5
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -22,6 +22,7 @@ import { token } from "../static-function";
|
|
|
22
22
|
var MouseTooltip = function MouseTooltip(_ref) {
|
|
23
23
|
var children = _ref.children,
|
|
24
24
|
title = _ref.title,
|
|
25
|
+
backgroundColor = _ref.color,
|
|
25
26
|
_ref$visible = _ref.visible,
|
|
26
27
|
outerVisible = _ref$visible === void 0 ? true : _ref$visible,
|
|
27
28
|
_ref$open = _ref.open,
|
|
@@ -39,12 +40,12 @@ var MouseTooltip = function MouseTooltip(_ref) {
|
|
|
39
40
|
visible = _useState2[0],
|
|
40
41
|
setVisible = _useState2[1];
|
|
41
42
|
var _ref2 = overlayInnerStyle || {},
|
|
42
|
-
|
|
43
|
+
textColor = _ref2.color,
|
|
43
44
|
restOverlayInnerStyle = _objectWithoutProperties(_ref2, _excluded2);
|
|
44
45
|
var handleVisibleChange = function handleVisibleChange(value) {
|
|
45
46
|
setVisible(value);
|
|
46
|
-
onOpenChange(value);
|
|
47
|
-
onVisibleChange(value);
|
|
47
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(value);
|
|
48
|
+
onVisibleChange === null || onVisibleChange === void 0 ? void 0 : onVisibleChange(value);
|
|
48
49
|
};
|
|
49
50
|
|
|
50
51
|
// 获取鼠标位置
|
|
@@ -76,9 +77,9 @@ var MouseTooltip = function MouseTooltip(_ref) {
|
|
|
76
77
|
onMouseLeave: function onMouseLeave() {
|
|
77
78
|
setTimeout(function () {
|
|
78
79
|
handleVisibleChange(false);
|
|
79
|
-
}, mouseLeaveDelay);
|
|
80
|
+
}, mouseLeaveDelay * 1000);
|
|
80
81
|
}
|
|
81
|
-
}, children), /*#__PURE__*/React.createElement(ReactStickyMouseTooltip, _extends({
|
|
82
|
+
}, children), title && /*#__PURE__*/React.createElement(ReactStickyMouseTooltip, _extends({
|
|
82
83
|
visible: visible,
|
|
83
84
|
style: _objectSpread({
|
|
84
85
|
// 需要大于 Popover 的 1030 zIndex 值,否则会被遮挡
|
|
@@ -86,8 +87,8 @@ var MouseTooltip = function MouseTooltip(_ref) {
|
|
|
86
87
|
padding: '6px 8px',
|
|
87
88
|
boxShadow: token.boxShadowSecondary,
|
|
88
89
|
borderRadius: token.borderRadius,
|
|
89
|
-
color:
|
|
90
|
-
backgroundColor: token.colorBgSpotlight,
|
|
90
|
+
color: textColor || token.colorTextLightSolid,
|
|
91
|
+
backgroundColor: backgroundColor || token.colorBgSpotlight,
|
|
91
92
|
left: isOverWidth ? mouse.clientX - tooltipWidth - offset : mouse.clientX + offset,
|
|
92
93
|
top: isOverHeight ? mouse.clientY - tooltipHeight - offset : mouse.clientY + offset
|
|
93
94
|
}, restOverlayInnerStyle)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FullToken, GenerateStyle } from 'antd/es/theme/internal';
|
|
2
|
+
export declare type CardToken = FullToken<'Card'> & {
|
|
3
|
+
tabsComponentCls: string;
|
|
4
|
+
tabsPrefixCls: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const genCardStyle: GenerateStyle<CardToken>;
|
|
7
|
+
declare const _default: (prefixCls: string, tabsPrefixCls: string) => {
|
|
8
|
+
wrapSSR: (node: import("react").ReactNode) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
9
|
+
hashId: string;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
package/lib/card/style/index.js
CHANGED
|
@@ -31,20 +31,20 @@ var genCardStyle = (token) => {
|
|
|
31
31
|
[`${componentCls}${componentCls}-no-divider`]: {
|
|
32
32
|
[`${componentCls}-head`]: {
|
|
33
33
|
borderBottom: "none"
|
|
34
|
-
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
[`${componentCls}${componentCls}-no-divider:not(${componentCls}-contain-tabs)`]: {
|
|
35
37
|
[`${componentCls}-body`]: {
|
|
36
38
|
padding: `0 ${paddingLG}px ${padding}px ${paddingLG}px`
|
|
37
39
|
}
|
|
38
40
|
},
|
|
39
|
-
[`${componentCls}-small${componentCls}-no-divider`]: {
|
|
41
|
+
[`${componentCls}-small${componentCls}-no-divider:not(${componentCls}-contain-tabs)`]: {
|
|
40
42
|
[`${componentCls}-body`]: {
|
|
41
43
|
padding: `0 ${paddingSM}px 12px ${paddingSM}px`
|
|
42
44
|
}
|
|
43
45
|
},
|
|
44
46
|
[`${componentCls}${componentCls}-contain-tabs`]: {
|
|
45
47
|
[`${componentCls}-head`]: {
|
|
46
|
-
// 包含页签时,去掉 head 的底部分割线
|
|
47
|
-
borderBottom: "none",
|
|
48
48
|
...(0, import_style.genTagStyle)({
|
|
49
49
|
...token,
|
|
50
50
|
componentCls: tabsComponentCls,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TooltipPropsWithTitle as AntTooltipPropsWithTitle } from 'antd/es/tooltip';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface MouseTooltipProps extends AntTooltipPropsWithTitle {
|
|
4
|
+
visible?: boolean;
|
|
5
|
+
offsetX?: number;
|
|
6
|
+
offsetY?: number;
|
|
7
|
+
}
|
|
8
|
+
declare const MouseTooltip: React.FC<MouseTooltipProps>;
|
|
9
|
+
export default MouseTooltip;
|
|
@@ -39,6 +39,7 @@ var import_static_function = require("../static-function");
|
|
|
39
39
|
var MouseTooltip = ({
|
|
40
40
|
children,
|
|
41
41
|
title,
|
|
42
|
+
color: backgroundColor,
|
|
42
43
|
visible: outerVisible = true,
|
|
43
44
|
open: outerOpen = true,
|
|
44
45
|
onOpenChange,
|
|
@@ -49,11 +50,11 @@ var MouseTooltip = ({
|
|
|
49
50
|
...restProps
|
|
50
51
|
}) => {
|
|
51
52
|
const [visible, setVisible] = (0, import_react.useState)(false);
|
|
52
|
-
const { color, ...restOverlayInnerStyle } = overlayInnerStyle || {};
|
|
53
|
+
const { color: textColor, ...restOverlayInnerStyle } = overlayInnerStyle || {};
|
|
53
54
|
const handleVisibleChange = (value) => {
|
|
54
55
|
setVisible(value);
|
|
55
|
-
onOpenChange(value);
|
|
56
|
-
onVisibleChange(value);
|
|
56
|
+
onOpenChange == null ? void 0 : onOpenChange(value);
|
|
57
|
+
onVisibleChange == null ? void 0 : onVisibleChange(value);
|
|
57
58
|
};
|
|
58
59
|
const mouse = (0, import_ahooks.useMouse)();
|
|
59
60
|
const ref = (0, import_react.useRef)(null);
|
|
@@ -78,11 +79,11 @@ var MouseTooltip = ({
|
|
|
78
79
|
onMouseLeave: () => {
|
|
79
80
|
setTimeout(() => {
|
|
80
81
|
handleVisibleChange(false);
|
|
81
|
-
}, mouseLeaveDelay);
|
|
82
|
+
}, mouseLeaveDelay * 1e3);
|
|
82
83
|
}
|
|
83
84
|
},
|
|
84
85
|
children
|
|
85
|
-
), /* @__PURE__ */ import_react.default.createElement(
|
|
86
|
+
), title && /* @__PURE__ */ import_react.default.createElement(
|
|
86
87
|
import_react_sticky_mouse_tooltip.default,
|
|
87
88
|
{
|
|
88
89
|
visible,
|
|
@@ -92,8 +93,8 @@ var MouseTooltip = ({
|
|
|
92
93
|
padding: "6px 8px",
|
|
93
94
|
boxShadow: import_static_function.token.boxShadowSecondary,
|
|
94
95
|
borderRadius: import_static_function.token.borderRadius,
|
|
95
|
-
color:
|
|
96
|
-
backgroundColor: import_static_function.token.colorBgSpotlight,
|
|
96
|
+
color: textColor || import_static_function.token.colorTextLightSolid,
|
|
97
|
+
backgroundColor: backgroundColor || import_static_function.token.colorBgSpotlight,
|
|
97
98
|
left: isOverWidth ? mouse.clientX - tooltipWidth - offset : mouse.clientX + offset,
|
|
98
99
|
top: isOverHeight ? mouse.clientY - tooltipHeight - offset : mouse.clientY + offset,
|
|
99
100
|
...restOverlayInnerStyle
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oceanbase/design",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "The Design System for OceanBase",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"OceanBase",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"react": "^16.9.0",
|
|
57
57
|
"react-dom": "^16.9.0"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "aee73083e592c5060c9b72173664153783e97e23"
|
|
60
60
|
}
|