@clayui/tooltip 3.156.0 → 3.158.0
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/README.md +4 -4
- package/lib/Tooltip.d.ts +3 -3
- package/lib/TooltipProvider.d.ts +4 -4
- package/lib/cjs/Tooltip.js +67 -30
- package/lib/cjs/TooltipProvider.js +173 -151
- package/lib/cjs/index.js +25 -22
- package/lib/cjs/useAlign.js +84 -58
- package/lib/cjs/useClosestTitle.js +79 -61
- package/lib/cjs/useTooltipState.js +34 -22
- package/lib/esm/Tooltip.js +39 -27
- package/lib/esm/TooltipProvider.js +142 -135
- package/lib/esm/index.js +8 -8
- package/lib/esm/useAlign.js +62 -50
- package/lib/esm/useClosestTitle.js +59 -55
- package/lib/esm/useTooltipState.js +12 -14
- package/lib/index.d.ts +2 -2
- package/lib/useAlign.d.ts +3 -3
- package/lib/useClosestTitle.d.ts +3 -3
- package/lib/useTooltipState.d.ts +2 -2
- package/package.json +33 -34
package/lib/cjs/useAlign.js
CHANGED
|
@@ -1,37 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var useAlign_exports = {};
|
|
20
|
+
__export(useAlign_exports, {
|
|
21
|
+
useAlign: () => useAlign
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
23
|
+
module.exports = __toCommonJS(useAlign_exports);
|
|
24
|
+
var import_shared = require("@clayui/shared");
|
|
25
|
+
var import_dom_align = require("dom-align");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
const ALIGNMENTS = [
|
|
28
|
+
"top",
|
|
29
|
+
"top-right",
|
|
30
|
+
"right",
|
|
31
|
+
"bottom-right",
|
|
32
|
+
"bottom",
|
|
33
|
+
"bottom-left",
|
|
34
|
+
"left",
|
|
35
|
+
"top-left"
|
|
36
|
+
];
|
|
16
37
|
const ALIGNMENTS_MAP = {
|
|
17
|
-
bottom: [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
left: [
|
|
21
|
-
right: [
|
|
22
|
-
top: [
|
|
23
|
-
|
|
24
|
-
|
|
38
|
+
"bottom": ["tc", "bc"],
|
|
39
|
+
"bottom-left": ["tl", "bl"],
|
|
40
|
+
"bottom-right": ["tr", "br"],
|
|
41
|
+
"left": ["cr", "cl"],
|
|
42
|
+
"right": ["cl", "cr"],
|
|
43
|
+
"top": ["bc", "tc"],
|
|
44
|
+
"top-left": ["bl", "tl"],
|
|
45
|
+
"top-right": ["br", "tr"]
|
|
25
46
|
};
|
|
26
47
|
const ALIGNMENTS_INVERSE_MAP = {
|
|
27
|
-
bctc:
|
|
28
|
-
bltl:
|
|
29
|
-
brtr:
|
|
30
|
-
clcr:
|
|
31
|
-
crcl:
|
|
32
|
-
tcbc:
|
|
33
|
-
tlbl:
|
|
34
|
-
trbr:
|
|
48
|
+
bctc: "top",
|
|
49
|
+
bltl: "top-left",
|
|
50
|
+
brtr: "top-right",
|
|
51
|
+
clcr: "right",
|
|
52
|
+
crcl: "left",
|
|
53
|
+
tcbc: "bottom",
|
|
54
|
+
tlbl: "bottom-left",
|
|
55
|
+
trbr: "bottom-right"
|
|
35
56
|
};
|
|
36
57
|
const BOTTOM_OFFSET = [0, 7];
|
|
37
58
|
const LEFT_OFFSET = [-7, 0];
|
|
@@ -49,38 +70,41 @@ const OFFSET_MAP = {
|
|
|
49
70
|
};
|
|
50
71
|
const ALIGNMENTS_FORCE_MAP = {
|
|
51
72
|
...ALIGNMENTS_INVERSE_MAP,
|
|
52
|
-
bctc:
|
|
53
|
-
tcbc:
|
|
73
|
+
bctc: "top-left",
|
|
74
|
+
tcbc: "bottom-left"
|
|
54
75
|
};
|
|
55
|
-
function useAlign(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
(0, _react.useEffect)(() => {
|
|
76
|
+
function useAlign({
|
|
77
|
+
align,
|
|
78
|
+
autoAlign,
|
|
79
|
+
floating,
|
|
80
|
+
isOpen,
|
|
81
|
+
onAlign,
|
|
82
|
+
sourceElement,
|
|
83
|
+
targetElement,
|
|
84
|
+
title
|
|
85
|
+
}) {
|
|
86
|
+
const mousePosition = (0, import_shared.useMousePosition)(20);
|
|
87
|
+
(0, import_react.useEffect)(() => {
|
|
68
88
|
if (sourceElement.current && isOpen && floating) {
|
|
69
|
-
const points = ALIGNMENTS_MAP[align ||
|
|
89
|
+
const points = ALIGNMENTS_MAP[align || "top"];
|
|
70
90
|
const [clientX, clientY] = mousePosition;
|
|
71
|
-
(0,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
91
|
+
(0, import_dom_align.alignPoint)(
|
|
92
|
+
sourceElement.current,
|
|
93
|
+
{
|
|
94
|
+
clientX,
|
|
95
|
+
clientY
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
offset: OFFSET_MAP[points.join("")],
|
|
99
|
+
points
|
|
100
|
+
}
|
|
101
|
+
);
|
|
78
102
|
}
|
|
79
103
|
}, [isOpen, floating]);
|
|
80
|
-
(0,
|
|
104
|
+
(0, import_react.useEffect)(() => {
|
|
81
105
|
if (targetElement.current && sourceElement.current && isOpen && !floating) {
|
|
82
|
-
const points = ALIGNMENTS_MAP[align ||
|
|
83
|
-
const alignment = (0,
|
|
106
|
+
const points = ALIGNMENTS_MAP[align || "top"];
|
|
107
|
+
const alignment = (0, import_shared.doAlign)({
|
|
84
108
|
overflow: {
|
|
85
109
|
adjustX: autoAlign,
|
|
86
110
|
adjustY: autoAlign
|
|
@@ -89,8 +113,10 @@ function useAlign(_ref) {
|
|
|
89
113
|
sourceElement: sourceElement.current,
|
|
90
114
|
targetElement: targetElement.current
|
|
91
115
|
});
|
|
92
|
-
const alignmentString = alignment.points.join(
|
|
93
|
-
|
|
116
|
+
const alignmentString = alignment.points.join(
|
|
117
|
+
""
|
|
118
|
+
);
|
|
119
|
+
const pointsString = points.join("");
|
|
94
120
|
if (alignment.overflow.adjustX) {
|
|
95
121
|
onAlign(ALIGNMENTS_FORCE_MAP[alignmentString]);
|
|
96
122
|
} else if (pointsString !== alignmentString) {
|
|
@@ -98,4 +124,4 @@ function useAlign(_ref) {
|
|
|
98
124
|
}
|
|
99
125
|
}
|
|
100
126
|
}, [align, title, isOpen]);
|
|
101
|
-
}
|
|
127
|
+
}
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var useClosestTitle_exports = {};
|
|
20
|
+
__export(useClosestTitle_exports, {
|
|
21
|
+
useClosestTitle: () => useClosestTitle
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
/**
|
|
9
|
-
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
|
|
10
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/
|
|
12
|
-
|
|
23
|
+
module.exports = __toCommonJS(useClosestTitle_exports);
|
|
24
|
+
var import_react = require("react");
|
|
13
25
|
function matches(element, selectorString) {
|
|
14
26
|
if (element.matches) {
|
|
15
27
|
return element.matches(selectorString);
|
|
@@ -36,49 +48,50 @@ function closestAncestor(node, s) {
|
|
|
36
48
|
return null;
|
|
37
49
|
}
|
|
38
50
|
function useClosestTitle(props) {
|
|
39
|
-
const targetRef = (0,
|
|
40
|
-
const titleNodeRef = (0,
|
|
41
|
-
const saveTitle = (0,
|
|
42
|
-
const title = element.getAttribute(
|
|
51
|
+
const targetRef = (0, import_react.useRef)(null);
|
|
52
|
+
const titleNodeRef = (0, import_react.useRef)(null);
|
|
53
|
+
const saveTitle = (0, import_react.useCallback)((element) => {
|
|
54
|
+
const title = element.getAttribute("title");
|
|
43
55
|
if (title) {
|
|
44
|
-
element.setAttribute(
|
|
45
|
-
element.removeAttribute(
|
|
46
|
-
} else if (element.tagName ===
|
|
47
|
-
const titleTag = element.querySelector(
|
|
56
|
+
element.setAttribute("data-restore-title", title);
|
|
57
|
+
element.removeAttribute("title");
|
|
58
|
+
} else if (element.tagName === "svg") {
|
|
59
|
+
const titleTag = element.querySelector("title");
|
|
48
60
|
if (titleTag) {
|
|
49
|
-
element.setAttribute(
|
|
61
|
+
element.setAttribute("data-restore-title", titleTag.innerHTML);
|
|
50
62
|
titleTag.remove();
|
|
51
63
|
}
|
|
52
64
|
}
|
|
53
|
-
const hasParentTitle = element.closest(
|
|
65
|
+
const hasParentTitle = element.closest("[title]");
|
|
54
66
|
if (hasParentTitle) {
|
|
55
67
|
saveTitle(hasParentTitle);
|
|
56
68
|
}
|
|
57
69
|
}, []);
|
|
58
|
-
const restoreTitle = (0,
|
|
59
|
-
const title = element.getAttribute(
|
|
70
|
+
const restoreTitle = (0, import_react.useCallback)((element) => {
|
|
71
|
+
const title = element.getAttribute("data-restore-title");
|
|
60
72
|
if (title) {
|
|
61
|
-
if (element.tagName ===
|
|
62
|
-
const titleTag = document.createElement(
|
|
73
|
+
if (element.tagName === "svg") {
|
|
74
|
+
const titleTag = document.createElement("title");
|
|
63
75
|
titleTag.innerHTML = title;
|
|
64
76
|
element.appendChild(titleTag);
|
|
65
77
|
} else {
|
|
66
|
-
element.setAttribute(
|
|
78
|
+
element.setAttribute("title", title);
|
|
67
79
|
}
|
|
68
|
-
element.removeAttribute(
|
|
80
|
+
element.removeAttribute("data-restore-title");
|
|
69
81
|
}
|
|
70
|
-
const hasParentTitle = element.closest(
|
|
82
|
+
const hasParentTitle = element.closest(
|
|
83
|
+
"[data-restore-title]"
|
|
84
|
+
);
|
|
71
85
|
if (hasParentTitle) {
|
|
72
86
|
restoreTitle(hasParentTitle);
|
|
73
87
|
}
|
|
74
88
|
}, []);
|
|
75
|
-
const onClick = (0,
|
|
89
|
+
const onClick = (0, import_react.useCallback)((event) => {
|
|
76
90
|
props.onClick();
|
|
77
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
78
91
|
onHide(event);
|
|
79
92
|
}, []);
|
|
80
|
-
const onHide = (0,
|
|
81
|
-
if (event && !event.relatedTarget?.getAttribute(
|
|
93
|
+
const onHide = (0, import_react.useCallback)((event) => {
|
|
94
|
+
if (event && !event.relatedTarget?.getAttribute("title") && (props.tooltipRef.current?.contains(event.relatedTarget) || targetRef.current?.contains(event.relatedTarget))) {
|
|
82
95
|
return null;
|
|
83
96
|
}
|
|
84
97
|
props.onHide();
|
|
@@ -87,49 +100,54 @@ function useClosestTitle(props) {
|
|
|
87
100
|
titleNodeRef.current = null;
|
|
88
101
|
}
|
|
89
102
|
if (targetRef.current) {
|
|
90
|
-
targetRef.current.removeEventListener(
|
|
103
|
+
targetRef.current.removeEventListener("click", onClick);
|
|
91
104
|
targetRef.current = null;
|
|
92
105
|
}
|
|
93
106
|
}, []);
|
|
94
|
-
const forceHide = (0,
|
|
107
|
+
const forceHide = (0, import_react.useCallback)(() => {
|
|
95
108
|
props.forceHide();
|
|
96
109
|
if (titleNodeRef.current) {
|
|
97
110
|
restoreTitle(titleNodeRef.current);
|
|
98
111
|
titleNodeRef.current = null;
|
|
99
112
|
}
|
|
100
113
|
if (targetRef.current) {
|
|
101
|
-
targetRef.current.removeEventListener(
|
|
114
|
+
targetRef.current.removeEventListener("click", onClick);
|
|
102
115
|
targetRef.current = null;
|
|
103
116
|
}
|
|
104
117
|
}, []);
|
|
105
|
-
const getProps = (0,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
118
|
+
const getProps = (0, import_react.useCallback)(
|
|
119
|
+
(event, hideBrowserTitle) => {
|
|
120
|
+
if (targetRef.current) {
|
|
121
|
+
props.onClick();
|
|
122
|
+
if (onHide(event) === null) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
110
125
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
126
|
+
const target = event.target;
|
|
127
|
+
const hasTitle = target && (target.hasAttribute("[title]") || target.hasAttribute("[data-title]"));
|
|
128
|
+
const node = hasTitle ? target : closestAncestor(target, "[title], [data-title]");
|
|
129
|
+
const hasNonEmptyTitle = node?.getAttribute("title") !== "";
|
|
130
|
+
if (node && hasNonEmptyTitle) {
|
|
131
|
+
targetRef.current = target;
|
|
132
|
+
target.addEventListener("click", onClick);
|
|
133
|
+
const title = node.getAttribute("title") || node.getAttribute("data-title") || "";
|
|
134
|
+
titleNodeRef.current = node;
|
|
135
|
+
if (hideBrowserTitle) {
|
|
136
|
+
saveTitle(node);
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
align: node.getAttribute("data-tooltip-align"),
|
|
140
|
+
delay: node.getAttribute("data-tooltip-delay"),
|
|
141
|
+
floating: Boolean(
|
|
142
|
+
node.getAttribute("data-tooltip-floating")
|
|
143
|
+
),
|
|
144
|
+
setAsHTML: !!node.getAttribute("data-title-set-as-html"),
|
|
145
|
+
title
|
|
146
|
+
};
|
|
123
147
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
floating: Boolean(node.getAttribute('data-tooltip-floating')),
|
|
128
|
-
setAsHTML: !!node.getAttribute('data-title-set-as-html'),
|
|
129
|
-
title
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
}, []);
|
|
148
|
+
},
|
|
149
|
+
[]
|
|
150
|
+
);
|
|
133
151
|
return {
|
|
134
152
|
forceHide,
|
|
135
153
|
getProps,
|
|
@@ -137,4 +155,4 @@ function useClosestTitle(props) {
|
|
|
137
155
|
target: targetRef,
|
|
138
156
|
titleNode: titleNodeRef
|
|
139
157
|
};
|
|
140
|
-
}
|
|
158
|
+
}
|
|
@@ -1,32 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var useTooltipState_exports = {};
|
|
20
|
+
__export(useTooltipState_exports, {
|
|
21
|
+
useTooltipState: () => useTooltipState
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function useTooltipState(_ref) {
|
|
14
|
-
let {
|
|
15
|
-
delay = 600
|
|
16
|
-
} = _ref;
|
|
17
|
-
const [isOpen, setOpen] = (0, _react.useState)(false);
|
|
18
|
-
const timeoutIdRef = (0, _react.useRef)();
|
|
19
|
-
const open = (0, _react.useCallback)((immediate, customDelay) => {
|
|
23
|
+
module.exports = __toCommonJS(useTooltipState_exports);
|
|
24
|
+
var import_react = require("react");
|
|
25
|
+
function useTooltipState({ delay = 600 }) {
|
|
26
|
+
const [isOpen, setOpen] = (0, import_react.useState)(false);
|
|
27
|
+
const timeoutIdRef = (0, import_react.useRef)();
|
|
28
|
+
const open = (0, import_react.useCallback)((immediate, customDelay) => {
|
|
20
29
|
if (!immediate) {
|
|
21
30
|
clearTimeout(timeoutIdRef.current);
|
|
22
|
-
timeoutIdRef.current = setTimeout(
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
timeoutIdRef.current = setTimeout(
|
|
32
|
+
() => {
|
|
33
|
+
setOpen(true);
|
|
34
|
+
},
|
|
35
|
+
customDelay !== void 0 ? customDelay : delay
|
|
36
|
+
);
|
|
25
37
|
} else {
|
|
26
38
|
setOpen(true);
|
|
27
39
|
}
|
|
28
40
|
}, []);
|
|
29
|
-
const close = (0,
|
|
41
|
+
const close = (0, import_react.useCallback)(() => {
|
|
30
42
|
clearTimeout(timeoutIdRef.current);
|
|
31
43
|
setOpen(false);
|
|
32
44
|
}, []);
|
|
@@ -35,4 +47,4 @@ function useTooltipState(_ref) {
|
|
|
35
47
|
isOpen,
|
|
36
48
|
open
|
|
37
49
|
};
|
|
38
|
-
}
|
|
50
|
+
}
|
package/lib/esm/Tooltip.js
CHANGED
|
@@ -1,31 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import React from "react";
|
|
3
|
+
const ALIGN_POSITIONS = [
|
|
4
|
+
"top",
|
|
5
|
+
"top-left",
|
|
6
|
+
"top-right",
|
|
7
|
+
"bottom",
|
|
8
|
+
"bottom-left",
|
|
9
|
+
"bottom-right",
|
|
10
|
+
"left",
|
|
11
|
+
"right"
|
|
12
|
+
];
|
|
13
|
+
const Tooltip = React.forwardRef(
|
|
14
|
+
({
|
|
15
|
+
alignPosition = "bottom",
|
|
13
16
|
children,
|
|
14
17
|
className,
|
|
15
18
|
show,
|
|
16
19
|
...otherProps
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
20
|
+
}, ref) => {
|
|
21
|
+
return /* @__PURE__ */ React.createElement(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
className: classNames(
|
|
25
|
+
className,
|
|
26
|
+
"tooltip",
|
|
27
|
+
`clay-tooltip-${alignPosition}`,
|
|
28
|
+
{ show }
|
|
29
|
+
),
|
|
30
|
+
role: "tooltip",
|
|
31
|
+
...otherProps,
|
|
32
|
+
ref
|
|
33
|
+
},
|
|
34
|
+
/* @__PURE__ */ React.createElement("div", { className: "arrow" }),
|
|
35
|
+
/* @__PURE__ */ React.createElement("div", { className: "tooltip-inner" }, children)
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
Tooltip.displayName = "ClayTooltip";
|
|
40
|
+
export {
|
|
41
|
+
ALIGN_POSITIONS,
|
|
42
|
+
Tooltip
|
|
43
|
+
};
|