@oceanbase/design 0.2.23 → 0.2.25
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/_util/genComponentStyleHook.js +1 -1
- package/es/alert/index.js +3 -3
- package/es/alert/style/index.js +1 -1
- package/es/badge/index.js +3 -3
- package/es/badge/style/index.js +1 -1
- package/es/button/index.js +3 -3
- package/es/button/style/index.js +1 -1
- package/es/card/index.js +3 -3
- package/es/card/style/index.js +3 -3
- package/es/config-provider/index.js +3 -3
- package/es/descriptions/index.js +3 -3
- package/es/descriptions/style/index.js +3 -3
- package/es/form/FormItem.d.ts +1 -1
- package/es/form/FormItem.js +5 -5
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -0
- package/es/locale/en-US.js +3 -3
- package/es/locale/zh-CN.js +3 -3
- package/es/locale/zh-TW.js +3 -3
- package/es/lottie/index.js +4 -4
- package/es/modal/Modal.js +3 -3
- package/es/modal/Progress.js +3 -3
- package/es/modal/style/index.js +1 -1
- package/es/select/index.d.ts +4 -0
- package/es/select/index.js +39 -1
- package/es/select/style/index.d.ts +9 -0
- package/es/select/style/index.js +17 -0
- package/es/spin/index.js +3 -3
- package/es/spin/style/index.js +3 -3
- package/es/static-function/index.js +3 -3
- package/es/table/index.js +7 -7
- package/es/table/style/index.js +9 -8
- package/es/tabs/hooks/useLegacyItems.js +3 -3
- package/es/tabs/index.js +3 -3
- package/es/tabs/style/index.js +1 -1
- package/es/tag/index.d.ts +11 -0
- package/es/tag/index.js +54 -1
- package/es/tag/style/index.d.ts +9 -0
- package/es/tag/style/index.js +55 -0
- package/es/theme/index.js +3 -3
- package/es/tooltip/MouseTooltip.js +9 -7
- package/es/tooltip/hooks/useTooltipTypeList.d.ts +5 -0
- package/es/tooltip/hooks/useTooltipTypeList.js +26 -0
- package/es/tooltip/index.d.ts +0 -5
- package/es/tooltip/index.js +46 -59
- package/es/tooltip/style/index.js +1 -1
- package/lib/form/FormItem.d.ts +1 -1
- package/lib/form/FormItem.js +2 -2
- package/lib/index.d.ts +2 -0
- package/lib/index.js +6 -0
- package/lib/select/index.d.ts +4 -0
- package/lib/select/index.js +37 -1
- package/lib/select/style/index.d.ts +9 -0
- package/lib/select/style/index.js +46 -0
- package/lib/static-function/index.d.ts +1 -1
- package/lib/table/index.js +1 -1
- package/lib/table/style/index.js +8 -5
- package/lib/tag/index.d.ts +11 -0
- package/lib/tag/index.js +55 -1
- package/lib/tag/style/index.d.ts +9 -0
- package/lib/tag/style/index.js +92 -0
- package/lib/tooltip/MouseTooltip.js +6 -5
- package/lib/tooltip/hooks/useTooltipTypeList.d.ts +5 -0
- package/lib/tooltip/hooks/useTooltipTypeList.js +69 -0
- package/lib/tooltip/index.d.ts +0 -5
- package/lib/tooltip/index.js +30 -50
- package/package.json +6 -6
package/lib/tooltip/index.js
CHANGED
|
@@ -30,58 +30,35 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/tooltip/index.tsx
|
|
31
31
|
var tooltip_exports = {};
|
|
32
32
|
__export(tooltip_exports, {
|
|
33
|
-
default: () => tooltip_default
|
|
34
|
-
getTooltipTypeList: () => getTooltipTypeList
|
|
33
|
+
default: () => tooltip_default
|
|
35
34
|
});
|
|
36
35
|
module.exports = __toCommonJS(tooltip_exports);
|
|
37
36
|
var import_antd = require("antd");
|
|
38
37
|
var import_react = __toESM(require("react"));
|
|
39
38
|
var import_icons = require("@oceanbase/icons");
|
|
39
|
+
var import_classnames = __toESM(require("classnames"));
|
|
40
40
|
var import_lodash = require("lodash");
|
|
41
|
-
var import_static_function = require("../static-function");
|
|
42
41
|
var import_MouseTooltip = __toESM(require("./MouseTooltip"));
|
|
43
42
|
var import_config_provider = __toESM(require("../config-provider"));
|
|
44
43
|
var import_style = __toESM(require("./style"));
|
|
45
|
-
var
|
|
44
|
+
var import_useTooltipTypeList = require("./hooks/useTooltipTypeList");
|
|
46
45
|
__reExport(tooltip_exports, require("antd/es/tooltip"), module.exports);
|
|
47
|
-
var getTooltipTypeList = () => [
|
|
48
|
-
{
|
|
49
|
-
type: "light",
|
|
50
|
-
color: import_static_function.token.colorText,
|
|
51
|
-
backgroundColor: import_static_function.token.colorBgElevated
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
type: "success",
|
|
55
|
-
color: import_static_function.token.colorSuccess,
|
|
56
|
-
backgroundColor: import_static_function.token.colorSuccessBg
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
type: "info",
|
|
60
|
-
color: import_static_function.token.colorInfo,
|
|
61
|
-
backgroundColor: import_static_function.token.colorInfoBg
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
type: "warning",
|
|
65
|
-
color: import_static_function.token.colorWarning,
|
|
66
|
-
backgroundColor: import_static_function.token.colorWarningBg
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
type: "error",
|
|
70
|
-
color: import_static_function.token.colorError,
|
|
71
|
-
backgroundColor: import_static_function.token.colorErrorBg
|
|
72
|
-
}
|
|
73
|
-
];
|
|
74
46
|
var Tooltip = ({
|
|
75
47
|
children,
|
|
48
|
+
title,
|
|
76
49
|
type = "default",
|
|
77
50
|
color,
|
|
78
|
-
overlayInnerStyle,
|
|
79
51
|
mouseFollow,
|
|
80
52
|
closeIcon = false,
|
|
81
53
|
onClose,
|
|
82
|
-
|
|
54
|
+
open,
|
|
55
|
+
defaultOpen,
|
|
56
|
+
onOpenChange,
|
|
57
|
+
visible,
|
|
58
|
+
defaultVisible,
|
|
59
|
+
onVisibleChange,
|
|
60
|
+
overlayInnerStyle,
|
|
83
61
|
className,
|
|
84
|
-
open: propOpen,
|
|
85
62
|
...restProps
|
|
86
63
|
}) => {
|
|
87
64
|
const { getPrefixCls } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
|
|
@@ -89,8 +66,15 @@ var Tooltip = ({
|
|
|
89
66
|
const prefixCls = getPrefixCls("tooltip", customizePrefixCls);
|
|
90
67
|
const { wrapSSR, hashId } = (0, import_style.default)(prefixCls);
|
|
91
68
|
const tooltipCls = (0, import_classnames.default)(className, hashId);
|
|
92
|
-
const [innerOpen, setInnerOpen] = (0, import_react.useState)(
|
|
93
|
-
const
|
|
69
|
+
const [innerOpen, setInnerOpen] = (0, import_react.useState)(open ?? visible ?? defaultOpen ?? defaultVisible);
|
|
70
|
+
const newOpen = open ?? visible ?? innerOpen;
|
|
71
|
+
(0, import_react.useEffect)(() => {
|
|
72
|
+
if (!(0, import_lodash.isNil)(open)) {
|
|
73
|
+
setInnerOpen(open);
|
|
74
|
+
} else if (!(0, import_lodash.isNil)(visible)) {
|
|
75
|
+
setInnerOpen(visible);
|
|
76
|
+
}
|
|
77
|
+
}, [open, visible]);
|
|
94
78
|
const handleCloseClick = (e) => {
|
|
95
79
|
e.stopPropagation();
|
|
96
80
|
onClose == null ? void 0 : onClose(e);
|
|
@@ -99,16 +83,10 @@ var Tooltip = ({
|
|
|
99
83
|
}
|
|
100
84
|
setInnerOpen(false);
|
|
101
85
|
};
|
|
102
|
-
const
|
|
103
|
-
const CloseIconNode = (0, import_react.useMemo)(() => {
|
|
104
|
-
if (!hasCloseIcon) {
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
return closeIcon === true ? /* @__PURE__ */ import_react.default.createElement(import_icons.CloseOutlined, { className: `${prefixCls}-close-icon`, onClick: handleCloseClick }) : /* @__PURE__ */ import_react.default.createElement("span", { className: `${prefixCls}-close-icon`, onClick: handleCloseClick }, closeIcon);
|
|
108
|
-
}, [closeIcon]);
|
|
86
|
+
const closeIconNode = closeIcon ? closeIcon === true ? /* @__PURE__ */ import_react.default.createElement(import_icons.CloseOutlined, { className: `${prefixCls}-close-icon`, onClick: handleCloseClick }) : /* @__PURE__ */ import_react.default.createElement("span", { className: `${prefixCls}-close-icon`, onClick: handleCloseClick }, closeIcon) : null;
|
|
109
87
|
const titleNode = typeof title === "function" ? title() : title;
|
|
110
|
-
const
|
|
111
|
-
const typeList =
|
|
88
|
+
const newTitle = closeIcon ? /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { className: `${prefixCls}-close-icon-wrap` }, titleNode, closeIconNode) : titleNode;
|
|
89
|
+
const typeList = (0, import_useTooltipTypeList.useTooltipTypeList)();
|
|
112
90
|
const typeItem = typeList.find((item) => item.type === type);
|
|
113
91
|
return wrapSSR(
|
|
114
92
|
mouseFollow ? /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -127,11 +105,14 @@ var Tooltip = ({
|
|
|
127
105
|
) : /* @__PURE__ */ import_react.default.createElement(
|
|
128
106
|
import_antd.Tooltip,
|
|
129
107
|
{
|
|
130
|
-
title:
|
|
108
|
+
title: newTitle,
|
|
131
109
|
color: color || (typeItem == null ? void 0 : typeItem.backgroundColor),
|
|
132
|
-
open,
|
|
133
|
-
|
|
134
|
-
|
|
110
|
+
open: newOpen,
|
|
111
|
+
defaultOpen,
|
|
112
|
+
onOpenChange: (value) => {
|
|
113
|
+
setInnerOpen(value);
|
|
114
|
+
onVisibleChange == null ? void 0 : onVisibleChange(value);
|
|
115
|
+
onOpenChange == null ? void 0 : onOpenChange(value);
|
|
135
116
|
},
|
|
136
117
|
overlayInnerStyle: {
|
|
137
118
|
color: typeItem == null ? void 0 : typeItem.color,
|
|
@@ -151,6 +132,5 @@ Tooltip.__ANT_TOOLTIP = true;
|
|
|
151
132
|
var tooltip_default = Tooltip;
|
|
152
133
|
// Annotate the CommonJS export names for ESM import in node:
|
|
153
134
|
0 && (module.exports = {
|
|
154
|
-
getTooltipTypeList,
|
|
155
135
|
...require("antd/es/tooltip")
|
|
156
136
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oceanbase/design",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.25",
|
|
4
4
|
"description": "The Design System of OceanBase",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"oceanbase",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"homepage": "https://github.com/oceanbase/oceanbase-design/packages/design",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
|
-
"url": "git@github.com:oceanbase/design.git"
|
|
15
|
+
"url": "git@github.com:oceanbase/oceanbase-design.git"
|
|
16
16
|
},
|
|
17
17
|
"publishConfig": {
|
|
18
18
|
"registry": "https://registry.npmjs.org",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@ant-design/cssinjs": "^1.17.2",
|
|
39
|
-
"@oceanbase/icons": "^0.2.
|
|
40
|
-
"@oceanbase/util": "^0.2.
|
|
39
|
+
"@oceanbase/icons": "^0.2.9",
|
|
40
|
+
"@oceanbase/util": "^0.2.11",
|
|
41
41
|
"ahooks": "^2.10.14",
|
|
42
|
-
"antd": "^5.10.
|
|
42
|
+
"antd": "^5.10.3",
|
|
43
43
|
"classnames": "^2.3.2",
|
|
44
44
|
"lodash": "^4.17.21",
|
|
45
45
|
"lottie-web": "^5.12.2",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"react": ">=16.9.0",
|
|
57
57
|
"react-dom": ">=16.9.0"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "98cd4d8a2af9b6e5dcde6210fc61f9efb74c7e01"
|
|
60
60
|
}
|