@oceanbase/design 1.0.0-alpha.10 → 1.0.0-alpha.11
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/index.js +1 -0
- package/es/_util/styleChecker.js +1 -0
- package/es/affix/index.js +1 -0
- package/es/alert/index.d.ts +1 -1
- package/es/alert/index.js +5 -2
- package/es/alert/style/index.js +17 -8
- package/es/anchor/index.js +1 -0
- package/es/app/index.js +1 -0
- package/es/auto-complete/index.js +1 -0
- package/es/avatar/index.js +1 -0
- package/es/badge/index.d.ts +2 -0
- package/es/badge/index.js +26 -10
- package/es/badge/style/index.js +3 -1
- package/es/breadcrumb/Breadcrumb.js +1 -0
- package/es/breadcrumb/index.js +1 -0
- package/es/button/index.js +1 -0
- package/es/calendar/index.js +1 -0
- package/es/card/index.js +2 -0
- package/es/card/style/index.js +3 -1
- package/es/carousel/index.js +1 -0
- package/es/cascader/index.js +1 -0
- package/es/checkbox/index.js +1 -0
- package/es/collapse/index.js +1 -0
- package/es/color-picker/index.js +1 -0
- package/es/config-provider/DefaultRenderEmpty.js +1 -0
- package/es/config-provider/index.js +1 -0
- package/es/date-picker/index.js +1 -0
- package/es/descriptions/hooks/useItems.d.ts +4 -4
- package/es/descriptions/hooks/useItems.js +1 -0
- package/es/descriptions/index.js +1 -0
- package/es/divider/index.js +1 -0
- package/es/drawer/index.js +1 -0
- package/es/dropdown/dropdown-button.js +1 -0
- package/es/dropdown/index.js +1 -0
- package/es/empty/colored.js +1 -0
- package/es/empty/database.js +1 -0
- package/es/empty/default.js +1 -0
- package/es/empty/guide.js +1 -0
- package/es/empty/index.js +1 -0
- package/es/float-button/index.js +1 -0
- package/es/form/FormItem.js +1 -0
- package/es/form/index.js +1 -0
- package/es/grid/col.js +1 -0
- package/es/grid/index.js +1 -0
- package/es/grid/row.js +1 -0
- package/es/image/index.js +1 -0
- package/es/index.js +1 -0
- package/es/input/Input.js +1 -0
- package/es/input/Password.js +1 -0
- package/es/input/Search.js +1 -0
- package/es/input/TextArea.js +1 -0
- package/es/input/index.js +1 -0
- package/es/input-number/index.js +1 -0
- package/es/layout/index.js +1 -0
- package/es/list/index.js +1 -0
- package/es/locale/index.js +1 -0
- package/es/lottie/index.js +1 -0
- package/es/mentions/index.js +1 -0
- package/es/menu/index.js +1 -0
- package/es/message/index.js +1 -0
- package/es/modal/Modal.d.ts +1 -1
- package/es/modal/Modal.js +7 -4
- package/es/modal/Progress.js +1 -0
- package/es/modal/index.js +1 -0
- package/es/modal/style/index.js +9 -5
- package/es/notification/index.js +1 -0
- package/es/pagination/index.js +1 -0
- package/es/popconfirm/index.js +1 -0
- package/es/popover/index.js +1 -0
- package/es/progress/index.js +1 -0
- package/es/qrcode/index.js +1 -0
- package/es/radio/index.js +1 -0
- package/es/rate/index.js +1 -0
- package/es/result/403.js +1 -0
- package/es/result/404.js +1 -0
- package/es/result/500.js +1 -0
- package/es/result/Error.js +1 -0
- package/es/result/Processing.js +1 -0
- package/es/result/Success.js +1 -0
- package/es/result/Warning.js +1 -0
- package/es/result/index.js +1 -0
- package/es/segmented/index.js +1 -0
- package/es/select/index.js +1 -0
- package/es/skeleton/index.js +1 -0
- package/es/slider/index.js +1 -0
- package/es/space/index.js +1 -0
- package/es/spin/index.js +1 -0
- package/es/static-function/index.js +1 -0
- package/es/statistic/index.js +1 -0
- package/es/steps/index.js +1 -0
- package/es/style/cssVariables.js +2 -1
- package/es/style/cssVariablesMeta.js +7 -7
- package/es/style/global.js +1 -0
- package/es/switch/index.js +1 -0
- package/es/table/index.js +38 -61
- package/es/table/style/index.js +23 -17
- package/es/tabs/TabPane.js +1 -0
- package/es/tabs/hooks/useLegacyItems.js +1 -0
- package/es/tabs/index.js +1 -0
- package/es/tag/index.js +1 -0
- package/es/tag/style/index.js +4 -1
- package/es/theme/index.js +1 -0
- package/es/theme/interface.d.ts +7 -0
- package/es/theme/style/aliyun.less +1 -1
- package/es/theme/style/compact.less +3 -3
- package/es/theme/style/dark.less +1 -1
- package/es/theme/style/default.less +3 -3
- package/es/time-picker/index.js +1 -0
- package/es/timeline/index.js +1 -0
- package/es/tooltip/MouseTooltip.js +1 -0
- package/es/tooltip/ReactStickyMouseTooltip.js +1 -0
- package/es/tooltip/index.js +1 -0
- package/es/tour/index.js +1 -0
- package/es/transfer/index.js +1 -0
- package/es/tree/index.js +1 -0
- package/es/tree-select/index.js +1 -0
- package/es/typography/Link.js +1 -0
- package/es/typography/Paragraph.js +1 -0
- package/es/typography/Text.js +1 -0
- package/es/typography/Title.js +1 -0
- package/es/typography/index.js +1 -0
- package/es/upload/index.js +1 -0
- package/es/watermark/index.js +1 -0
- package/lib/_util/genComponentStyleHook.js +52 -59
- package/lib/_util/getEllipsisConfig.js +16 -39
- package/lib/_util/index.js +13 -29
- package/lib/_util/styleChecker.js +33 -53
- package/lib/_util/type.js +4 -16
- package/lib/_util/useFlexGapSupport.js +11 -36
- package/lib/affix/index.js +15 -21
- package/lib/alert/index.d.ts +1 -1
- package/lib/alert/index.js +63 -82
- package/lib/alert/style/index.js +111 -108
- package/lib/anchor/index.js +26 -23
- package/lib/app/index.js +47 -54
- package/lib/app/style/index.js +13 -32
- package/lib/auto-complete/index.js +15 -21
- package/lib/avatar/index.js +26 -23
- package/lib/badge/index.d.ts +2 -0
- package/lib/badge/index.js +108 -110
- package/lib/badge/style/index.js +21 -40
- package/lib/breadcrumb/Breadcrumb.js +15 -21
- package/lib/breadcrumb/index.js +31 -31
- package/lib/button/index.js +50 -60
- package/lib/button/style/index.js +35 -57
- package/lib/calendar/index.js +15 -21
- package/lib/card/Card.js +14 -21
- package/lib/card/index.js +246 -255
- package/lib/card/style/index.js +50 -61
- package/lib/carousel/index.js +15 -21
- package/lib/cascader/index.js +15 -21
- package/lib/checkbox/index.js +52 -69
- package/lib/checkbox/style/index.js +20 -35
- package/lib/collapse/index.js +15 -21
- package/lib/color-picker/index.js +15 -21
- package/lib/color-picker/interface.js +14 -21
- package/lib/config-provider/DefaultRenderEmpty.js +34 -48
- package/lib/config-provider/SizeContext.js +14 -21
- package/lib/config-provider/context.js +14 -21
- package/lib/config-provider/index.js +200 -233
- package/lib/config-provider/navigate.js +4 -16
- package/lib/date-picker/index.js +15 -21
- package/lib/descriptions/Item.js +6 -24
- package/lib/descriptions/hooks/useItems.d.ts +4 -4
- package/lib/descriptions/hooks/useItems.js +50 -73
- package/lib/descriptions/index.js +83 -101
- package/lib/descriptions/style/index.js +46 -64
- package/lib/divider/index.js +15 -21
- package/lib/drawer/index.js +108 -127
- package/lib/drawer/style/index.js +36 -51
- package/lib/dropdown/dropdown-button.js +30 -57
- package/lib/dropdown/index.js +30 -46
- package/lib/dropdown/style/index.js +13 -32
- package/lib/empty/colored.js +198 -314
- package/lib/empty/database.js +117 -185
- package/lib/empty/default.js +53 -48
- package/lib/empty/guide.js +145 -224
- package/lib/empty/index.js +77 -95
- package/lib/empty/style/index.js +28 -43
- package/lib/float-button/index.js +15 -21
- package/lib/float-button/interface.js +14 -21
- package/lib/form/FormItem.js +78 -84
- package/lib/form/index.js +57 -77
- package/lib/form/interface.js +14 -21
- package/lib/form/style/index.js +16 -35
- package/lib/grid/col.js +28 -45
- package/lib/grid/index.js +26 -44
- package/lib/grid/row.js +30 -45
- package/lib/image/index.js +15 -21
- package/lib/index.js +333 -154
- package/lib/input/Input.js +65 -78
- package/lib/input/Password.js +59 -76
- package/lib/input/Search.js +59 -76
- package/lib/input/TextArea.js +59 -76
- package/lib/input/index.js +30 -49
- package/lib/input/style/index.js +19 -36
- package/lib/input-number/index.js +56 -76
- package/lib/input-number/style/index.js +13 -32
- package/lib/layout/index.js +15 -21
- package/lib/list/index.js +52 -59
- package/lib/locale/en-US.js +22 -49
- package/lib/locale/index.js +25 -38
- package/lib/locale/ja-JP.js +22 -49
- package/lib/locale/useLocale.js +6 -24
- package/lib/locale/zh-CN.js +22 -49
- package/lib/locale/zh-TW.js +22 -49
- package/lib/lottie/index.js +61 -80
- package/lib/mentions/index.js +15 -21
- package/lib/menu/index.js +15 -21
- package/lib/menu/interface.js +14 -21
- package/lib/message/index.js +15 -21
- package/lib/message/interface.js +14 -21
- package/lib/modal/Modal.d.ts +1 -1
- package/lib/modal/Modal.js +69 -80
- package/lib/modal/Progress.js +44 -61
- package/lib/modal/index.js +23 -42
- package/lib/modal/interface.js +14 -21
- package/lib/modal/style/index.js +34 -46
- package/lib/notification/index.js +15 -21
- package/lib/notification/interface.js +14 -21
- package/lib/pagination/index.js +15 -21
- package/lib/popconfirm/index.js +15 -21
- package/lib/popover/index.js +15 -21
- package/lib/progress/index.js +26 -23
- package/lib/progress/progress.js +14 -21
- package/lib/qrcode/index.js +15 -21
- package/lib/qrcode/interface.js +14 -21
- package/lib/radio/index.js +53 -62
- package/lib/radio/interface.js +14 -21
- package/lib/radio/style/index.js +18 -33
- package/lib/rate/index.js +15 -21
- package/lib/result/403.js +164 -195
- package/lib/result/404.js +291 -354
- package/lib/result/500.js +156 -259
- package/lib/result/Error.js +127 -161
- package/lib/result/Processing.js +320 -252
- package/lib/result/Success.js +202 -261
- package/lib/result/Warning.js +302 -434
- package/lib/result/index.js +65 -80
- package/lib/result/style/index.js +15 -35
- package/lib/segmented/index.js +86 -83
- package/lib/segmented/style/index.js +19 -36
- package/lib/select/index.js +63 -81
- package/lib/select/style/index.js +12 -32
- package/lib/skeleton/index.js +15 -21
- package/lib/slider/index.js +48 -58
- package/lib/slider/style/index.js +19 -37
- package/lib/space/index.js +63 -69
- package/lib/space/style/index.js +16 -36
- package/lib/spin/index.js +58 -76
- package/lib/spin/style/index.js +48 -52
- package/lib/static-function/index.js +48 -73
- package/lib/statistic/index.js +15 -21
- package/lib/steps/index.js +15 -21
- package/lib/style/cssVariables.js +237 -256
- package/lib/style/cssVariablesMeta.js +978 -1057
- package/lib/style/global.js +119 -155
- package/lib/switch/index.js +52 -60
- package/lib/switch/style/index.js +12 -32
- package/lib/table/hooks/useDefaultPagination.js +18 -46
- package/lib/table/index.js +179 -219
- package/lib/table/interface.js +14 -21
- package/lib/table/style/index.js +59 -73
- package/lib/tabs/TabPane.js +7 -24
- package/lib/tabs/hooks/useLegacyItems.js +27 -43
- package/lib/tabs/index.js +107 -124
- package/lib/tabs/style/index.js +23 -38
- package/lib/tag/index.js +78 -98
- package/lib/tag/style/index.js +35 -57
- package/lib/theme/aliyun.js +7 -34
- package/lib/theme/compact.js +9 -36
- package/lib/theme/dark.js +9 -36
- package/lib/theme/default.js +130 -232
- package/lib/theme/index.js +48 -55
- package/lib/theme/interface.d.ts +7 -0
- package/lib/theme/interface.js +14 -21
- package/lib/theme/internal.js +14 -21
- package/lib/theme/style/aliyun.less +1 -1
- package/lib/theme/style/compact.less +3 -3
- package/lib/theme/style/dark.less +1 -1
- package/lib/theme/style/default.less +3 -3
- package/lib/theme/themes/compact/index.js +19 -39
- package/lib/theme/themes/dark/index.js +19 -39
- package/lib/theme/themes/default/index.js +19 -39
- package/lib/theme/themes/seed.js +24 -43
- package/lib/theme/util/alias.js +19 -39
- package/lib/theme/util/format.js +15 -35
- package/lib/time-picker/index.js +15 -21
- package/lib/timeline/index.js +15 -21
- package/lib/tooltip/MouseTooltip.js +84 -98
- package/lib/tooltip/ReactStickyMouseTooltip.js +63 -88
- package/lib/tooltip/hooks/useTooltipTypeList.js +28 -61
- package/lib/tooltip/index.js +123 -137
- package/lib/tooltip/style/index.js +26 -47
- package/lib/tour/index.js +15 -21
- package/lib/tour/interface.js +14 -21
- package/lib/transfer/index.js +15 -21
- package/lib/transfer/interface.js +14 -21
- package/lib/tree/index.js +15 -21
- package/lib/tree-select/index.js +67 -85
- package/lib/tree-select/style/index.js +9 -31
- package/lib/typography/Link.js +54 -68
- package/lib/typography/Paragraph.js +54 -68
- package/lib/typography/Text.js +55 -68
- package/lib/typography/Title.js +54 -68
- package/lib/typography/hooks/useClassName.js +12 -43
- package/lib/typography/index.js +89 -58
- package/lib/typography/style/index.js +29 -45
- package/lib/upload/index.js +15 -21
- package/lib/upload/interface.js +14 -21
- package/lib/watermark/index.js +15 -21
- package/package.json +3 -3
|
@@ -1,43 +1,19 @@
|
|
|
1
|
-
|
|
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);
|
|
1
|
+
"use strict";
|
|
28
2
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
__export(MouseTooltip_exports, {
|
|
32
|
-
default: () => MouseTooltip_default
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
33
5
|
});
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _ahooks = require("ahooks");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _ReactStickyMouseTooltip = _interopRequireDefault(require("./ReactStickyMouseTooltip"));
|
|
10
|
+
var _theme = _interopRequireDefault(require("../theme"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
"use client";
|
|
16
|
+
const MouseTooltip = ({
|
|
41
17
|
children,
|
|
42
18
|
title,
|
|
43
19
|
color: backgroundColor,
|
|
@@ -50,73 +26,83 @@ var MouseTooltip = ({
|
|
|
50
26
|
mouseLeaveDelay = 0.1,
|
|
51
27
|
...restProps
|
|
52
28
|
}) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
const
|
|
29
|
+
const {
|
|
30
|
+
token
|
|
31
|
+
} = _theme.default.useToken();
|
|
32
|
+
const [visible, setVisible] = (0, _react.useState)(false);
|
|
33
|
+
const {
|
|
34
|
+
color: textColor,
|
|
35
|
+
...restOverlayInnerStyle
|
|
36
|
+
} = overlayInnerStyle || {};
|
|
37
|
+
const handleVisibleChange = value => {
|
|
58
38
|
setVisible(value);
|
|
59
|
-
onOpenChange
|
|
60
|
-
onVisibleChange
|
|
39
|
+
onOpenChange?.(value);
|
|
40
|
+
onVisibleChange?.(value);
|
|
61
41
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
const
|
|
42
|
+
|
|
43
|
+
// 获取鼠标位置
|
|
44
|
+
const mouseInfo = (0, _ahooks.useMouse)();
|
|
45
|
+
// clientX and clientY maybe NaN, should use 0 as fallback value
|
|
46
|
+
// ref: https://github.com/oceanbase/oceanbase-design/pull/968
|
|
47
|
+
const clientX = mouseInfo?.clientX || 0;
|
|
48
|
+
const clientY = mouseInfo?.clientY || 0;
|
|
49
|
+
const ref = (0, _react.useRef)(null);
|
|
50
|
+
const size = (0, _ahooks.useSize)(ref);
|
|
51
|
+
// tooltip 宽高,由于 ref 是设置在内容区上的,因此还需要加上外部的 padding
|
|
52
|
+
const tooltipWidth = (size?.width || 0) + 16;
|
|
53
|
+
const tooltipHeight = (size?.height || 0) + 12;
|
|
54
|
+
// 页面宽高
|
|
69
55
|
const pageWidth = document.body.clientWidth || 0;
|
|
70
56
|
const pageHeight = document.body.clientHeight || 0;
|
|
57
|
+
|
|
58
|
+
// 是否横向超出浏览器,需要留出 8px 缓冲区,避免到达页面边界时位置调整不生效
|
|
71
59
|
const isOverWidth = clientX + tooltipWidth + 8 > pageWidth;
|
|
60
|
+
// 是否纵向超出浏览器,需要留出 8px 缓冲区,避免到达页面边界时位置调整不生效
|
|
72
61
|
const isOverHeight = clientY + tooltipHeight + 8 > pageHeight;
|
|
62
|
+
|
|
63
|
+
// tooltip 和鼠标之间的偏移
|
|
73
64
|
const offset = 8;
|
|
74
|
-
return
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
onMouseEnter: () => {
|
|
79
|
-
if (outerOpen || outerVisible) {
|
|
80
|
-
setTimeout(() => {
|
|
81
|
-
handleVisibleChange(true);
|
|
82
|
-
}, mouseEnterDelay * 1e3);
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
onMouseLeave: () => {
|
|
65
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
66
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
67
|
+
onMouseEnter: () => {
|
|
68
|
+
if (outerOpen || outerVisible) {
|
|
86
69
|
setTimeout(() => {
|
|
87
|
-
handleVisibleChange(
|
|
88
|
-
},
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
70
|
+
handleVisibleChange(true);
|
|
71
|
+
}, mouseEnterDelay * 1000);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
onMouseLeave: () => {
|
|
75
|
+
setTimeout(() => {
|
|
76
|
+
handleVisibleChange(false);
|
|
77
|
+
}, mouseLeaveDelay * 1000);
|
|
78
|
+
},
|
|
79
|
+
children: children
|
|
80
|
+
}), title && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ReactStickyMouseTooltip.default, {
|
|
81
|
+
visible: visible,
|
|
82
|
+
style: {
|
|
83
|
+
// 需要大于 Popover 的 1030 zIndex 值,否则会被遮挡
|
|
84
|
+
zIndex: 1100,
|
|
85
|
+
padding: '6px 8px',
|
|
86
|
+
boxShadow: token.boxShadowSecondary,
|
|
87
|
+
borderRadius: token.borderRadius,
|
|
88
|
+
// @ts-ignore
|
|
89
|
+
color: textColor || token.Tooltip?.colorTextLightSolid || token.colorTextLightSolid,
|
|
90
|
+
backgroundColor:
|
|
91
|
+
// @ts-ignore
|
|
92
|
+
backgroundColor || token.Tooltip?.colorBgSpotlight || token.colorBgSpotlight,
|
|
93
|
+
left: isOverWidth ? clientX - tooltipWidth - offset : clientX + offset,
|
|
94
|
+
top: isOverHeight ? clientY - tooltipHeight - offset : clientY + offset,
|
|
95
|
+
...restOverlayInnerStyle
|
|
96
|
+
},
|
|
97
|
+
...restProps,
|
|
98
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
99
|
+
ref: ref,
|
|
100
|
+
children: typeof title === 'function' ? title() : title
|
|
101
|
+
})
|
|
102
|
+
})]
|
|
103
|
+
});
|
|
118
104
|
};
|
|
119
|
-
if (process.env.NODE_ENV !==
|
|
120
|
-
MouseTooltip.displayName =
|
|
105
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
106
|
+
MouseTooltip.displayName = 'MouseTooltip';
|
|
121
107
|
}
|
|
122
|
-
var
|
|
108
|
+
var _default = exports.default = MouseTooltip;
|
|
@@ -1,72 +1,25 @@
|
|
|
1
|
-
|
|
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);
|
|
1
|
+
"use strict";
|
|
28
2
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
__export(ReactStickyMouseTooltip_exports, {
|
|
32
|
-
default: () => ReactStickyMouseTooltip_default
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
33
5
|
});
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
this.addListener = () => {
|
|
54
|
-
window.addEventListener("mousemove", this.getTooltipPosition);
|
|
55
|
-
this.setState({ listenerActive: true });
|
|
56
|
-
};
|
|
57
|
-
this.removeListener = () => {
|
|
58
|
-
window.removeEventListener("mousemove", this.getTooltipPosition);
|
|
59
|
-
this.setState({ listenerActive: false });
|
|
60
|
-
};
|
|
61
|
-
this.updateListener = () => {
|
|
62
|
-
if (!this.state.listenerActive && this.props.visible) {
|
|
63
|
-
this.addListener();
|
|
64
|
-
}
|
|
65
|
-
if (this.state.listenerActive && !this.props.visible) {
|
|
66
|
-
this.removeListener();
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
}
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
"use client";
|
|
11
|
+
class ReactStickyMouseTooltip extends _react.default.PureComponent {
|
|
12
|
+
static defaultProps = {
|
|
13
|
+
visible: true,
|
|
14
|
+
offsetX: 0,
|
|
15
|
+
offsetY: 0
|
|
16
|
+
};
|
|
17
|
+
state = {
|
|
18
|
+
xPosition: 0,
|
|
19
|
+
yPosition: 0,
|
|
20
|
+
mouseMoved: false,
|
|
21
|
+
listenerActive: false
|
|
22
|
+
};
|
|
70
23
|
componentDidMount() {
|
|
71
24
|
this.addListener();
|
|
72
25
|
}
|
|
@@ -76,26 +29,48 @@ var ReactStickyMouseTooltip = class extends import_react.default.PureComponent {
|
|
|
76
29
|
componentWillUnmount() {
|
|
77
30
|
this.removeListener();
|
|
78
31
|
}
|
|
32
|
+
getTooltipPosition = ({
|
|
33
|
+
clientX: xPosition,
|
|
34
|
+
clientY: yPosition
|
|
35
|
+
}) => {
|
|
36
|
+
this.setState({
|
|
37
|
+
xPosition,
|
|
38
|
+
yPosition,
|
|
39
|
+
mouseMoved: true
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
addListener = () => {
|
|
43
|
+
window.addEventListener('mousemove', this.getTooltipPosition);
|
|
44
|
+
this.setState({
|
|
45
|
+
listenerActive: true
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
removeListener = () => {
|
|
49
|
+
window.removeEventListener('mousemove', this.getTooltipPosition);
|
|
50
|
+
this.setState({
|
|
51
|
+
listenerActive: false
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
updateListener = () => {
|
|
55
|
+
if (!this.state.listenerActive && this.props.visible) {
|
|
56
|
+
this.addListener();
|
|
57
|
+
}
|
|
58
|
+
if (this.state.listenerActive && !this.props.visible) {
|
|
59
|
+
this.removeListener();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
79
62
|
render() {
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
{
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
children: this.props.children
|
|
92
|
-
}
|
|
93
|
-
);
|
|
63
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
64
|
+
className: this.props.className,
|
|
65
|
+
style: {
|
|
66
|
+
display: this.props.visible && this.state.mouseMoved ? 'block' : 'none',
|
|
67
|
+
position: 'fixed',
|
|
68
|
+
top: this.state.yPosition + this.props.offsetY,
|
|
69
|
+
left: this.state.xPosition + this.props.offsetX,
|
|
70
|
+
...this.props.style
|
|
71
|
+
},
|
|
72
|
+
children: this.props.children
|
|
73
|
+
});
|
|
94
74
|
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
visible: true,
|
|
98
|
-
offsetX: 0,
|
|
99
|
-
offsetY: 0
|
|
100
|
-
};
|
|
101
|
-
var ReactStickyMouseTooltip_default = ReactStickyMouseTooltip;
|
|
75
|
+
}
|
|
76
|
+
var _default = exports.default = ReactStickyMouseTooltip;
|
|
@@ -1,64 +1,31 @@
|
|
|
1
|
-
|
|
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);
|
|
1
|
+
"use strict";
|
|
28
2
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
__export(useTooltipTypeList_exports, {
|
|
32
|
-
useTooltipTypeList: () => useTooltipTypeList
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
33
5
|
});
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
];
|
|
6
|
+
exports.useTooltipTypeList = void 0;
|
|
7
|
+
var _theme = _interopRequireDefault(require("../../theme"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const useTooltipTypeList = () => {
|
|
10
|
+
const {
|
|
11
|
+
token
|
|
12
|
+
} = _theme.default.useToken();
|
|
13
|
+
return [{
|
|
14
|
+
type: 'success',
|
|
15
|
+
color: token.colorSuccess,
|
|
16
|
+
backgroundColor: token.colorSuccessBg
|
|
17
|
+
}, {
|
|
18
|
+
type: 'info',
|
|
19
|
+
color: token.colorInfo,
|
|
20
|
+
backgroundColor: token.colorInfoBg
|
|
21
|
+
}, {
|
|
22
|
+
type: 'warning',
|
|
23
|
+
color: token.colorWarning,
|
|
24
|
+
backgroundColor: token.colorWarningBg
|
|
25
|
+
}, {
|
|
26
|
+
type: 'error',
|
|
27
|
+
color: token.colorError,
|
|
28
|
+
backgroundColor: token.colorErrorBg
|
|
29
|
+
}];
|
|
60
30
|
};
|
|
61
|
-
|
|
62
|
-
0 && (module.exports = {
|
|
63
|
-
useTooltipTypeList
|
|
64
|
-
});
|
|
31
|
+
exports.useTooltipTypeList = useTooltipTypeList;
|