@oceanbase/design 0.2.14 → 0.2.16
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/config-provider/index.js +3 -1
- package/es/modal/Modal.d.ts +30 -0
- package/es/modal/Modal.js +50 -0
- package/es/modal/Progress.d.ts +10 -0
- package/es/modal/Progress.js +46 -0
- package/es/modal/index.d.ts +7 -30
- package/es/modal/index.js +4 -55
- package/es/modal/style/index.js +25 -5
- package/es/spin/style/index.js +11 -11
- package/es/tooltip/index.d.ts +2 -0
- package/es/tooltip/index.js +70 -7
- package/es/tooltip/style/index.d.ts +9 -0
- package/es/tooltip/style/index.js +29 -0
- package/lib/config-provider/index.js +2 -1
- package/lib/modal/Modal.d.ts +30 -0
- package/lib/modal/Modal.js +59 -0
- package/lib/modal/Progress.d.ts +10 -0
- package/lib/modal/Progress.js +71 -0
- package/lib/modal/index.d.ts +7 -30
- package/lib/modal/index.js +5 -44
- package/lib/modal/style/index.js +34 -0
- package/lib/spin/style/index.js +14 -11
- package/lib/tooltip/index.d.ts +2 -0
- package/lib/tooltip/index.js +44 -2
- package/lib/tooltip/style/index.d.ts +9 -0
- package/lib/tooltip/style/index.js +55 -0
- package/package.json +9 -9
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/modal/Modal.tsx
|
|
30
|
+
var Modal_exports = {};
|
|
31
|
+
__export(Modal_exports, {
|
|
32
|
+
default: () => Modal_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Modal_exports);
|
|
35
|
+
var import_antd = require("antd");
|
|
36
|
+
var import_classnames = __toESM(require("classnames"));
|
|
37
|
+
var import_react = __toESM(require("react"));
|
|
38
|
+
var import_config_provider = __toESM(require("../config-provider"));
|
|
39
|
+
var import_static_function = require("../static-function");
|
|
40
|
+
var import_style = __toESM(require("./style"));
|
|
41
|
+
var Modal = ({ prefixCls: customizePrefixCls, className, ...restProps }) => {
|
|
42
|
+
const { getPrefixCls } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
|
|
43
|
+
const prefixCls = getPrefixCls("modal", customizePrefixCls);
|
|
44
|
+
const { wrapSSR } = (0, import_style.default)(prefixCls);
|
|
45
|
+
const modalCls = (0, import_classnames.default)(className);
|
|
46
|
+
return wrapSSR(/* @__PURE__ */ import_react.default.createElement(import_antd.Modal, { prefixCls: customizePrefixCls, className: modalCls, ...restProps }));
|
|
47
|
+
};
|
|
48
|
+
Modal.info = (props) => import_static_function.modal.info(props);
|
|
49
|
+
Modal.success = (props) => import_static_function.modal.success(props);
|
|
50
|
+
Modal.error = (props) => import_static_function.modal.error(props);
|
|
51
|
+
Modal.warning = (props) => import_static_function.modal.warning(props);
|
|
52
|
+
Modal.confirm = (props) => import_static_function.modal.confirm(props);
|
|
53
|
+
Modal.useModal = import_antd.Modal.useModal;
|
|
54
|
+
Modal.destroyAll = import_antd.Modal.destroyAll;
|
|
55
|
+
Modal.config = import_antd.Modal.config;
|
|
56
|
+
if (process.env.NODE_ENV !== "production") {
|
|
57
|
+
Modal.displayName = import_antd.Modal.displayName;
|
|
58
|
+
}
|
|
59
|
+
var Modal_default = Modal;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ModalProps } from 'antd/es/modal';
|
|
3
|
+
import type { ProgressProps } from 'antd/es/progress';
|
|
4
|
+
export interface ModalProgressProps extends ModalProps {
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
progress?: ProgressProps;
|
|
7
|
+
description?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare const Progress: ({ prefixCls: customizePrefixCls, className, width, maskClosable, loading, progress, description, footer, ...restProps }: ModalProgressProps) => React.JSX.Element;
|
|
10
|
+
export default Progress;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/modal/Progress.tsx
|
|
30
|
+
var Progress_exports = {};
|
|
31
|
+
__export(Progress_exports, {
|
|
32
|
+
default: () => Progress_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Progress_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_classnames = __toESM(require("classnames"));
|
|
38
|
+
var import_config_provider = __toESM(require("../config-provider"));
|
|
39
|
+
var import_Modal = __toESM(require("./Modal"));
|
|
40
|
+
var import_icons = require("@oceanbase/icons");
|
|
41
|
+
var Progress = ({
|
|
42
|
+
prefixCls: customizePrefixCls,
|
|
43
|
+
className,
|
|
44
|
+
width = 567,
|
|
45
|
+
maskClosable = false,
|
|
46
|
+
loading,
|
|
47
|
+
progress,
|
|
48
|
+
description,
|
|
49
|
+
footer = null,
|
|
50
|
+
...restProps
|
|
51
|
+
}) => {
|
|
52
|
+
const { getPrefixCls } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
|
|
53
|
+
const prefixCls = getPrefixCls("modal", customizePrefixCls);
|
|
54
|
+
const progressModalCls = (0, import_classnames.default)(`${prefixCls}-progress`, className);
|
|
55
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
56
|
+
import_Modal.default,
|
|
57
|
+
{
|
|
58
|
+
prefixCls: customizePrefixCls,
|
|
59
|
+
className: progressModalCls,
|
|
60
|
+
width,
|
|
61
|
+
maskClosable,
|
|
62
|
+
footer,
|
|
63
|
+
...restProps
|
|
64
|
+
},
|
|
65
|
+
/* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, loading ? /* @__PURE__ */ import_react.default.createElement(import_icons.LoadingOutlined, { className: `${prefixCls}-progress-loading` }) : /* @__PURE__ */ import_react.default.createElement(import_antd.Progress, { type: "circle", size: 200, ...progress }), description && /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-progress-description` }, description))
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
if (process.env.NODE_ENV !== "production") {
|
|
69
|
+
import_Modal.default.displayName = "Modal.Progress";
|
|
70
|
+
}
|
|
71
|
+
var Progress_default = Progress;
|
package/lib/modal/index.d.ts
CHANGED
|
@@ -1,32 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import Progress from './Progress';
|
|
2
|
+
import OriginModal from './Modal';
|
|
3
3
|
export * from 'antd/es/modal';
|
|
4
|
-
export type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
info(props: any): {
|
|
8
|
-
destroy: () => void;
|
|
9
|
-
update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
|
|
10
|
-
};
|
|
11
|
-
success(props: any): {
|
|
12
|
-
destroy: () => void;
|
|
13
|
-
update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
|
|
14
|
-
};
|
|
15
|
-
error(props: any): {
|
|
16
|
-
destroy: () => void;
|
|
17
|
-
update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
|
|
18
|
-
};
|
|
19
|
-
warning(props: any): {
|
|
20
|
-
destroy: () => void;
|
|
21
|
-
update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
|
|
22
|
-
};
|
|
23
|
-
confirm(props: any): {
|
|
24
|
-
destroy: () => void;
|
|
25
|
-
update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
|
|
26
|
-
};
|
|
27
|
-
useModal: typeof import("antd/es/modal/useModal").default;
|
|
28
|
-
destroyAll: () => void;
|
|
29
|
-
config: typeof import("antd/es/modal/confirm").modalGlobalConfig;
|
|
30
|
-
displayName: string;
|
|
4
|
+
export type { ModalProgressProps } from './Progress';
|
|
5
|
+
export type ModalType = typeof OriginModal & {
|
|
6
|
+
Progress: typeof Progress;
|
|
31
7
|
};
|
|
32
|
-
|
|
8
|
+
declare const _default: ModalType;
|
|
9
|
+
export default _default;
|
package/lib/modal/index.js
CHANGED
|
@@ -27,56 +27,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
|
-
// src/modal/index.
|
|
30
|
+
// src/modal/index.ts
|
|
31
31
|
var modal_exports = {};
|
|
32
32
|
__export(modal_exports, {
|
|
33
33
|
default: () => modal_default
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(modal_exports);
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var import_react = __toESM(require("react"));
|
|
39
|
-
var import_config_provider = __toESM(require("../config-provider"));
|
|
40
|
-
var import_static_function = require("../static-function");
|
|
41
|
-
var import_style = __toESM(require("./style"));
|
|
36
|
+
var import_Progress = __toESM(require("./Progress"));
|
|
37
|
+
var import_Modal = __toESM(require("./Modal"));
|
|
42
38
|
__reExport(modal_exports, require("antd/es/modal"), module.exports);
|
|
43
|
-
var Modal =
|
|
44
|
-
|
|
45
|
-
className,
|
|
46
|
-
rootClassName,
|
|
47
|
-
title,
|
|
48
|
-
footer,
|
|
49
|
-
...restProps
|
|
50
|
-
}) => {
|
|
51
|
-
const { getPrefixCls } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
|
|
52
|
-
const prefixCls = getPrefixCls("modal", customizePrefixCls);
|
|
53
|
-
const { wrapSSR } = (0, import_style.default)(prefixCls);
|
|
54
|
-
const modalCls = (0, import_classnames.default)(className);
|
|
55
|
-
return wrapSSR(
|
|
56
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
57
|
-
import_antd.Modal,
|
|
58
|
-
{
|
|
59
|
-
prefixCls: customizePrefixCls,
|
|
60
|
-
className: modalCls,
|
|
61
|
-
rootClassName: (0, import_classnames.default)(rootClassName),
|
|
62
|
-
title,
|
|
63
|
-
footer,
|
|
64
|
-
...restProps
|
|
65
|
-
}
|
|
66
|
-
)
|
|
67
|
-
);
|
|
68
|
-
};
|
|
69
|
-
Modal.info = (props) => import_static_function.modal.info(props);
|
|
70
|
-
Modal.success = (props) => import_static_function.modal.success(props);
|
|
71
|
-
Modal.error = (props) => import_static_function.modal.error(props);
|
|
72
|
-
Modal.warning = (props) => import_static_function.modal.warning(props);
|
|
73
|
-
Modal.confirm = (props) => import_static_function.modal.confirm(props);
|
|
74
|
-
Modal.useModal = import_antd.Modal.useModal;
|
|
75
|
-
Modal.destroyAll = import_antd.Modal.destroyAll;
|
|
76
|
-
Modal.config = import_antd.Modal.config;
|
|
77
|
-
if (process.env.NODE_ENV !== "production") {
|
|
78
|
-
Modal.displayName = import_antd.Modal.displayName;
|
|
79
|
-
}
|
|
39
|
+
var Modal = import_Modal.default;
|
|
40
|
+
Modal.Progress = import_Progress.default;
|
|
80
41
|
var modal_default = Modal;
|
|
81
42
|
// Annotate the CommonJS export names for ESM import in node:
|
|
82
43
|
0 && (module.exports = {
|
package/lib/modal/style/index.js
CHANGED
|
@@ -26,6 +26,7 @@ module.exports = __toCommonJS(style_exports);
|
|
|
26
26
|
var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
|
|
27
27
|
var genModalStyle = (token) => {
|
|
28
28
|
const {
|
|
29
|
+
antCls,
|
|
29
30
|
componentCls,
|
|
30
31
|
marginSM,
|
|
31
32
|
marginLG,
|
|
@@ -39,6 +40,7 @@ var genModalStyle = (token) => {
|
|
|
39
40
|
const bottom = 100;
|
|
40
41
|
const titleHeight = fontSizeHeading5 * lineHeightHeading5;
|
|
41
42
|
return {
|
|
43
|
+
/* Modal */
|
|
42
44
|
[`${componentCls}:not(${componentCls}-confirm)`]: {
|
|
43
45
|
[`${componentCls}-header`]: {
|
|
44
46
|
marginBottom: marginLG
|
|
@@ -52,6 +54,38 @@ var genModalStyle = (token) => {
|
|
|
52
54
|
marginTop: marginLG
|
|
53
55
|
}
|
|
54
56
|
},
|
|
57
|
+
/* Modal.Progress */
|
|
58
|
+
[`${componentCls}${componentCls}-progress`]: {
|
|
59
|
+
[`${componentCls}-content`]: {
|
|
60
|
+
padding: `${token.paddingXL + token.padding}px ${token.paddingLG + token.padding}px`,
|
|
61
|
+
[`${componentCls}-header`]: {
|
|
62
|
+
textAlign: "center",
|
|
63
|
+
marginBottom: token.marginXXL,
|
|
64
|
+
[`${componentCls}-title`]: {
|
|
65
|
+
fontSize: token.fontSizeHeading4
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
[`${componentCls}-body`]: {
|
|
69
|
+
textAlign: "center",
|
|
70
|
+
[`${componentCls}-progress-loading`]: {
|
|
71
|
+
fontSize: 200,
|
|
72
|
+
color: token.colorInfo
|
|
73
|
+
},
|
|
74
|
+
[`${componentCls}-progress-description`]: {
|
|
75
|
+
marginTop: token.marginXXL,
|
|
76
|
+
color: token.colorTextTertiary
|
|
77
|
+
},
|
|
78
|
+
// should align to left for Alert
|
|
79
|
+
[`${antCls}-alert`]: {
|
|
80
|
+
textAlign: "left"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
[`${componentCls}-footer`]: {
|
|
84
|
+
textAlign: "center"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
/* Modal.method() */
|
|
55
89
|
[`${componentCls}-confirm`]: {
|
|
56
90
|
[`${componentCls}-body ${componentCls}-confirm-title +${componentCls}-confirm-content`]: {
|
|
57
91
|
marginBlockStart: marginSM
|
package/lib/spin/style/index.js
CHANGED
|
@@ -29,13 +29,16 @@ var genSizeStyle = (spinDotSize, token) => {
|
|
|
29
29
|
const spinDotWidth = spinDotSize;
|
|
30
30
|
const spinDotHight = spinDotWidth * (295 / 397);
|
|
31
31
|
return {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
// only work for oceanbase indicator
|
|
33
|
+
[`&${componentCls}-oceanbase`]: {
|
|
34
|
+
[`${componentCls}-dot`]: {
|
|
35
|
+
width: spinDotWidth,
|
|
36
|
+
height: spinDotHight
|
|
37
|
+
},
|
|
38
|
+
[`${componentCls}-text`]: {
|
|
39
|
+
width: spinDotWidth,
|
|
40
|
+
color: colorText
|
|
41
|
+
}
|
|
39
42
|
}
|
|
40
43
|
};
|
|
41
44
|
};
|
|
@@ -47,6 +50,7 @@ var genNestedSizeStyle = (spinDotSize, token) => {
|
|
|
47
50
|
const dotMarginTop = -spinDotHight / 2;
|
|
48
51
|
const textPaddingTop = (spinDotHight - fontSize) / 2 + 2;
|
|
49
52
|
return {
|
|
53
|
+
// only work for oceanbase indicator
|
|
50
54
|
[`&${componentCls}-oceanbase`]: {
|
|
51
55
|
[`${componentCls}-dot`]: {
|
|
52
56
|
marginLeft: dotMarginLeft,
|
|
@@ -64,11 +68,10 @@ var genNestedSizeStyle = (spinDotSize, token) => {
|
|
|
64
68
|
var genSpinStyle = (token) => {
|
|
65
69
|
const { componentCls, spinDotSize, spinDotSizeSM, spinDotSizeLG } = token;
|
|
66
70
|
return {
|
|
67
|
-
// only work for oceanbase indicator
|
|
68
71
|
[`${componentCls}`]: {
|
|
69
|
-
[
|
|
70
|
-
[`&-sm
|
|
71
|
-
[`&-lg
|
|
72
|
+
[`&`]: genSizeStyle(spinDotSize, token),
|
|
73
|
+
[`&-sm`]: genSizeStyle(spinDotSizeSM, token),
|
|
74
|
+
[`&-lg`]: genSizeStyle(spinDotSizeLG, token)
|
|
72
75
|
},
|
|
73
76
|
[`${componentCls}-nested-loading`]: {
|
|
74
77
|
[`> div > ${componentCls}`]: {
|
package/lib/tooltip/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export type TooltipType = 'default' | 'light' | 'success' | 'info' | 'warning' |
|
|
|
5
5
|
export interface TooltipProps extends AntTooltipPropsWithTitle {
|
|
6
6
|
type?: TooltipType;
|
|
7
7
|
mouseFollow?: boolean;
|
|
8
|
+
closeIcon?: boolean | React.ReactNode;
|
|
9
|
+
onClose?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
8
10
|
}
|
|
9
11
|
export declare const getTooltipTypeList: () => {
|
|
10
12
|
type: string;
|
package/lib/tooltip/index.js
CHANGED
|
@@ -36,8 +36,13 @@ __export(tooltip_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(tooltip_exports);
|
|
37
37
|
var import_antd = require("antd");
|
|
38
38
|
var import_react = __toESM(require("react"));
|
|
39
|
+
var import_icons = require("@oceanbase/icons");
|
|
40
|
+
var import_lodash = require("lodash");
|
|
39
41
|
var import_static_function = require("../static-function");
|
|
40
42
|
var import_MouseTooltip = __toESM(require("./MouseTooltip"));
|
|
43
|
+
var import_config_provider = __toESM(require("../config-provider"));
|
|
44
|
+
var import_style = __toESM(require("./style"));
|
|
45
|
+
var import_classnames = __toESM(require("classnames"));
|
|
41
46
|
__reExport(tooltip_exports, require("antd/es/tooltip"), module.exports);
|
|
42
47
|
var getTooltipTypeList = () => [
|
|
43
48
|
{
|
|
@@ -72,33 +77,70 @@ var Tooltip = ({
|
|
|
72
77
|
color,
|
|
73
78
|
overlayInnerStyle,
|
|
74
79
|
mouseFollow,
|
|
80
|
+
closeIcon = false,
|
|
81
|
+
onClose,
|
|
82
|
+
title,
|
|
83
|
+
className,
|
|
84
|
+
open: propOpen,
|
|
75
85
|
...restProps
|
|
76
86
|
}) => {
|
|
87
|
+
const { getPrefixCls } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
|
|
88
|
+
const { prefixCls: customizePrefixCls } = restProps;
|
|
89
|
+
const prefixCls = getPrefixCls("tooltip", customizePrefixCls);
|
|
90
|
+
const { wrapSSR, hashId } = (0, import_style.default)(prefixCls);
|
|
91
|
+
const tooltipCls = (0, import_classnames.default)(className, hashId);
|
|
92
|
+
const [innerOpen, setInnerOpen] = (0, import_react.useState)(void 0);
|
|
93
|
+
const open = (0, import_lodash.isNil)(propOpen) ? innerOpen : propOpen;
|
|
94
|
+
const handleCloseClick = (e) => {
|
|
95
|
+
e.stopPropagation();
|
|
96
|
+
onClose == null ? void 0 : onClose(e);
|
|
97
|
+
if (e.defaultPrevented) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
setInnerOpen(false);
|
|
101
|
+
};
|
|
102
|
+
const hasCloseIcon = !!closeIcon;
|
|
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]);
|
|
109
|
+
const titleNode = typeof title === "function" ? title() : title;
|
|
110
|
+
const titleWithCloseIcon = /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { className: `${prefixCls}-close-icon-wrap` }, titleNode, CloseIconNode);
|
|
77
111
|
const typeList = getTooltipTypeList();
|
|
78
112
|
const typeItem = typeList.find((item) => item.type === type);
|
|
79
|
-
return mouseFollow ? /* @__PURE__ */ import_react.default.createElement(
|
|
113
|
+
return wrapSSR(mouseFollow ? /* @__PURE__ */ import_react.default.createElement(
|
|
80
114
|
import_MouseTooltip.default,
|
|
81
115
|
{
|
|
116
|
+
title,
|
|
82
117
|
color: color || (typeItem == null ? void 0 : typeItem.backgroundColor),
|
|
83
118
|
overlayInnerStyle: {
|
|
84
119
|
color: typeItem == null ? void 0 : typeItem.color,
|
|
85
120
|
...overlayInnerStyle
|
|
86
121
|
},
|
|
122
|
+
className: tooltipCls,
|
|
87
123
|
...restProps
|
|
88
124
|
},
|
|
89
125
|
children
|
|
90
126
|
) : /* @__PURE__ */ import_react.default.createElement(
|
|
91
127
|
import_antd.Tooltip,
|
|
92
128
|
{
|
|
129
|
+
title: hasCloseIcon ? titleWithCloseIcon : title,
|
|
93
130
|
color: color || (typeItem == null ? void 0 : typeItem.backgroundColor),
|
|
131
|
+
open,
|
|
132
|
+
onOpenChange: (open2) => {
|
|
133
|
+
setInnerOpen(open2);
|
|
134
|
+
},
|
|
94
135
|
overlayInnerStyle: {
|
|
95
136
|
color: typeItem == null ? void 0 : typeItem.color,
|
|
96
137
|
...overlayInnerStyle
|
|
97
138
|
},
|
|
139
|
+
className: tooltipCls,
|
|
98
140
|
...restProps
|
|
99
141
|
},
|
|
100
142
|
children
|
|
101
|
-
);
|
|
143
|
+
));
|
|
102
144
|
};
|
|
103
145
|
if (process.env.NODE_ENV !== "production") {
|
|
104
146
|
Tooltip.displayName = import_antd.Tooltip.displayName;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FullToken, GenerateStyle } from 'antd/es/theme/internal';
|
|
3
|
+
export type TooltipToken = FullToken<'Tooltip'>;
|
|
4
|
+
export declare const genTooltipStyle: GenerateStyle<TooltipToken>;
|
|
5
|
+
declare const _default: (prefixCls: string) => {
|
|
6
|
+
wrapSSR: (node: import("react").ReactNode) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
7
|
+
hashId: string;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/tooltip/style/index.ts
|
|
20
|
+
var style_exports = {};
|
|
21
|
+
__export(style_exports, {
|
|
22
|
+
default: () => style_default,
|
|
23
|
+
genTooltipStyle: () => genTooltipStyle
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(style_exports);
|
|
26
|
+
var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
|
|
27
|
+
var genTooltipStyle = (token) => {
|
|
28
|
+
const { componentCls } = token;
|
|
29
|
+
return {
|
|
30
|
+
[componentCls]: {
|
|
31
|
+
[`${componentCls}-close-icon-wrap`]: {
|
|
32
|
+
display: "flex",
|
|
33
|
+
justifyContent: "space-between",
|
|
34
|
+
alignItems: "flex-start",
|
|
35
|
+
wordBreak: "break-all",
|
|
36
|
+
[`${componentCls}-close-icon`]: {
|
|
37
|
+
cursor: "pointer"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
var style_default = (prefixCls) => {
|
|
44
|
+
const useStyle = (0, import_genComponentStyleHook.genComponentStyleHook)("Tooltip", (token) => {
|
|
45
|
+
return [genTooltipStyle(token)];
|
|
46
|
+
}, ({ zIndexPopupBase, colorBgSpotlight }) => ({
|
|
47
|
+
zIndexPopup: zIndexPopupBase + 70,
|
|
48
|
+
colorBgDefault: colorBgSpotlight
|
|
49
|
+
}));
|
|
50
|
+
return useStyle(prefixCls);
|
|
51
|
+
};
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
genTooltipStyle
|
|
55
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oceanbase/design",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
4
4
|
"description": "The Design System of OceanBase",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"OceanBase",
|
|
@@ -36,25 +36,25 @@
|
|
|
36
36
|
"postbuild": "cp src/style/reset.css dist/"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@ant-design/cssinjs": "^1.
|
|
40
|
-
"@oceanbase/icons": "^0.2.
|
|
41
|
-
"@oceanbase/util": "^0.2.
|
|
39
|
+
"@ant-design/cssinjs": "^1.17.0",
|
|
40
|
+
"@oceanbase/icons": "^0.2.5",
|
|
41
|
+
"@oceanbase/util": "^0.2.7",
|
|
42
42
|
"ahooks": "^2.10.14",
|
|
43
|
-
"antd": "^5.
|
|
43
|
+
"antd": "^5.9.0",
|
|
44
44
|
"classnames": "^2.3.2",
|
|
45
45
|
"lodash": "^4.17.21",
|
|
46
46
|
"lottie-web": "^5.12.2",
|
|
47
|
-
"rc-util": "^5.
|
|
47
|
+
"rc-util": "^5.37.0",
|
|
48
48
|
"react-sticky-mouse-tooltip": "^0.0.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@babel/cli": "^7.22.
|
|
52
|
-
"@babel/preset-env": "^7.22.
|
|
51
|
+
"@babel/cli": "^7.22.15",
|
|
52
|
+
"@babel/preset-env": "^7.22.15",
|
|
53
53
|
"antd-token-previewer": "^1.1.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"react": "^16.9.0",
|
|
57
57
|
"react-dom": "^16.9.0"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "52f5d009120b001c9c0408ec96ff954e120b20f1"
|
|
60
60
|
}
|