@hanzogui/tooltip 3.0.2 → 7.3.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/LICENSE +40 -19
- package/dist/cjs/Tooltip.cjs +211 -194
- package/dist/cjs/Tooltip.native.js +30 -28
- package/dist/cjs/Tooltip.native.js.map +1 -1
- package/dist/cjs/TooltipSimple.cjs +40 -35
- package/dist/cjs/TooltipSimple.native.js +15 -13
- package/dist/cjs/TooltipSimple.native.js.map +1 -1
- package/dist/cjs/index.cjs +7 -5
- package/dist/cjs/index.native.js +7 -5
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/Tooltip.mjs +175 -160
- package/dist/esm/Tooltip.mjs.map +1 -1
- package/dist/esm/Tooltip.native.js +16 -16
- package/dist/esm/Tooltip.native.js.map +1 -1
- package/dist/esm/TooltipSimple.mjs +9 -6
- package/dist/esm/TooltipSimple.mjs.map +1 -1
- package/dist/esm/TooltipSimple.native.js +3 -3
- package/dist/esm/TooltipSimple.native.js.map +1 -1
- package/dist/jsx/Tooltip.mjs +175 -160
- package/dist/jsx/Tooltip.mjs.map +1 -1
- package/dist/jsx/Tooltip.native.js +30 -28
- package/dist/jsx/Tooltip.native.js.map +1 -1
- package/dist/jsx/TooltipSimple.mjs +9 -6
- package/dist/jsx/TooltipSimple.mjs.map +1 -1
- package/dist/jsx/TooltipSimple.native.js +15 -13
- package/dist/jsx/TooltipSimple.native.js.map +1 -1
- package/dist/jsx/index.native.js +7 -5
- package/package.json +21 -19
- package/types/Tooltip.d.ts +13 -13
- package/types/Tooltip.d.ts.map +1 -0
- package/types/Tooltip.native.d.ts.map +1 -0
- package/types/TooltipSimple.d.ts +1 -1
- package/types/TooltipSimple.d.ts.map +1 -0
- package/types/TooltipSimple.native.d.ts.map +1 -0
- package/types/index.d.ts.map +1 -0
|
@@ -2,43 +2,45 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
6
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
}), mod);
|
|
32
34
|
var TooltipSimple_exports = {};
|
|
33
35
|
__export(TooltipSimple_exports, {
|
|
34
36
|
TooltipSimple: () => TooltipSimple
|
|
35
37
|
});
|
|
36
38
|
module.exports = __toCommonJS(TooltipSimple_exports);
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
var import_get_token = require("@hanzogui/get-token");
|
|
40
|
+
var import_text = require("@hanzogui/text");
|
|
41
|
+
var React = __toESM(require("react"), 1);
|
|
42
|
+
var import_Tooltip = require("./Tooltip.cjs");
|
|
43
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
44
|
const TooltipSimple = React.forwardRef(({
|
|
43
45
|
label,
|
|
44
46
|
children,
|
|
@@ -49,18 +51,21 @@ const TooltipSimple = React.forwardRef(({
|
|
|
49
51
|
"use no memo";
|
|
50
52
|
|
|
51
53
|
const child = React.Children.only(children);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
if (!label) {
|
|
55
|
+
return children;
|
|
56
|
+
}
|
|
57
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_Tooltip.Tooltip, {
|
|
58
|
+
disableRTL: true,
|
|
54
59
|
offset: 15,
|
|
55
60
|
restMs: 40,
|
|
56
61
|
delay: 40,
|
|
57
62
|
zIndex: 1e6,
|
|
58
63
|
...tooltipProps,
|
|
59
64
|
...(disabled ? {
|
|
60
|
-
open:
|
|
65
|
+
open: false
|
|
61
66
|
} : null),
|
|
62
67
|
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Tooltip.Tooltip.Trigger, {
|
|
63
|
-
...(typeof label
|
|
68
|
+
...(typeof label === "string" && {
|
|
64
69
|
"aria-label": label
|
|
65
70
|
}),
|
|
66
71
|
asChild: "except-style",
|
|
@@ -82,17 +87,17 @@ const TooltipSimple = React.forwardRef(({
|
|
|
82
87
|
elevation: "$0.5",
|
|
83
88
|
opacity: 1,
|
|
84
89
|
pointerEvents: "none",
|
|
85
|
-
paddingVertical: (0,
|
|
90
|
+
paddingVertical: (0, import_get_token.getSpace)(tooltipProps.size || "$true", {
|
|
86
91
|
shift: -4
|
|
87
92
|
}),
|
|
88
93
|
animateOnly: ["transform", "opacity"],
|
|
89
94
|
transition: ["quicker", {
|
|
90
95
|
opacity: {
|
|
91
|
-
overshootClamping:
|
|
96
|
+
overshootClamping: true
|
|
92
97
|
}
|
|
93
98
|
}],
|
|
94
99
|
...contentProps,
|
|
95
|
-
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Tooltip.Tooltip.Arrow, {}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(
|
|
100
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Tooltip.Tooltip.Arrow, {}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_text.Paragraph, {
|
|
96
101
|
maxWidth: 350,
|
|
97
102
|
overflow: "hidden",
|
|
98
103
|
size: "$3",
|
|
@@ -103,5 +108,5 @@ const TooltipSimple = React.forwardRef(({
|
|
|
103
108
|
children: label
|
|
104
109
|
})]
|
|
105
110
|
})]
|
|
106
|
-
})
|
|
111
|
+
});
|
|
107
112
|
});
|
|
@@ -5,20 +5,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value:
|
|
23
|
+
value: true
|
|
22
24
|
}), mod);
|
|
23
25
|
var TooltipSimple_native_exports = {};
|
|
24
26
|
__export(TooltipSimple_native_exports, {
|
|
@@ -26,7 +28,7 @@ __export(TooltipSimple_native_exports, {
|
|
|
26
28
|
});
|
|
27
29
|
module.exports = __toCommonJS(TooltipSimple_native_exports);
|
|
28
30
|
var RenderChildren = function (props) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
return props.children;
|
|
32
|
+
};
|
|
33
|
+
var TooltipSimple = RenderChildren;
|
|
32
34
|
//# sourceMappingURL=TooltipSimple.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TooltipSimple_native_exports","__export","TooltipSimple","module","exports","__toCommonJS","RenderChildren","props","children"],"sources":["../../src/TooltipSimple.native.tsx"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["TooltipSimple_native_exports","__export","TooltipSimple","module","exports","__toCommonJS","RenderChildren","props","children"],"sources":["../../src/TooltipSimple.native.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,4BAAA;AAAAC,QAAA,CAAAD,4BAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAL,4BAAA;AAAA,IAAIM,cAAA,GAAiB,SAAAA,CAASC,KAAA,EAAO;EACjC,OAAOA,KAAA,CAAMC,QAAA;AACjB;AACO,IAAIN,aAAA,GAAgBI,cAAA","ignoreList":[]}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -3,15 +3,17 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
7
8
|
get: () => from[key],
|
|
8
9
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
9
10
|
});
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
13
15
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
14
|
-
value:
|
|
16
|
+
value: true
|
|
15
17
|
}), mod);
|
|
16
18
|
var index_exports = {};
|
|
17
19
|
module.exports = __toCommonJS(index_exports);
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -5,15 +5,17 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
9
10
|
get: () => from[key],
|
|
10
11
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
12
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
17
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
16
|
-
value:
|
|
18
|
+
value: true
|
|
17
19
|
}), mod);
|
|
18
20
|
var index_exports = {};
|
|
19
21
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports","__reExport","require"],"sources":["../../src/index.tsx"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports","__reExport","require"],"sources":["../../src/index.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA;AACdG,UAAA,CAAAH,aAAA,EAAcI,OAAA,yBAAAH,MADd,CAAAC,OAAA","ignoreList":[]}
|
package/dist/esm/Tooltip.mjs
CHANGED
|
@@ -8,180 +8,195 @@ import { Popper, PopperContentFrame } from "@hanzogui/popper";
|
|
|
8
8
|
import { useControllableState } from "@hanzogui/use-controllable-state";
|
|
9
9
|
import * as React from "react";
|
|
10
10
|
import { jsx } from "react/jsx-runtime";
|
|
11
|
-
const TOOLTIP_SCOPE = ""
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
11
|
+
const TOOLTIP_SCOPE = "";
|
|
12
|
+
const ALWAYS_DISABLE_TOOLTIP = {
|
|
13
|
+
focus: true,
|
|
14
|
+
"remove-scroll": true
|
|
15
|
+
// it's nice to hit escape to hide a tooltip
|
|
16
|
+
// dismiss: true
|
|
17
|
+
};
|
|
18
|
+
const TooltipContent = PopperContentFrame.styleable((props, ref) => {
|
|
19
|
+
const preventAnimation = React.useContext(PreventTooltipAnimationContext);
|
|
20
|
+
const zIndexFromContext = React.useContext(TooltipZIndexContext);
|
|
21
|
+
return /* @__PURE__ */jsx(PopoverContent, {
|
|
22
|
+
scope: props.scope || TOOLTIP_SCOPE,
|
|
23
|
+
alwaysDisable: ALWAYS_DISABLE_TOOLTIP,
|
|
24
|
+
...(!props.unstyled && {
|
|
25
|
+
backgroundColor: "$background",
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
pointerEvents: "none",
|
|
28
|
+
size: "$true"
|
|
29
|
+
}),
|
|
30
|
+
ref,
|
|
31
|
+
...(zIndexFromContext !== void 0 && {
|
|
32
|
+
zIndex: zIndexFromContext
|
|
33
|
+
}),
|
|
34
|
+
...props,
|
|
35
|
+
...(preventAnimation && {
|
|
36
|
+
transition: null
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
}, {
|
|
40
|
+
staticConfig: {
|
|
41
|
+
componentName: "Tooltip"
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const TooltipArrow = React.forwardRef((props, ref) => {
|
|
45
|
+
return /* @__PURE__ */jsx(PopoverArrow, {
|
|
45
46
|
scope: props.scope || TOOLTIP_SCOPE,
|
|
46
47
|
componentName: "Tooltip",
|
|
47
48
|
ref,
|
|
48
49
|
...props
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
const PreventTooltipAnimationContext = React.createContext(false);
|
|
53
|
+
const TooltipZIndexContext = React.createContext(void 0);
|
|
54
|
+
const TooltipGroup = ({
|
|
55
|
+
children,
|
|
56
|
+
delay,
|
|
57
|
+
preventAnimation = false,
|
|
58
|
+
timeoutMs
|
|
59
|
+
}) => {
|
|
60
|
+
return /* @__PURE__ */jsx(PreventTooltipAnimationContext.Provider, {
|
|
58
61
|
value: preventAnimation,
|
|
59
62
|
children: /* @__PURE__ */jsx(FloatingDelayGroup, {
|
|
60
63
|
timeoutMs,
|
|
61
64
|
delay: React.useMemo(() => delay, [JSON.stringify(delay)]),
|
|
62
65
|
children
|
|
63
66
|
})
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
const setOpens = /* @__PURE__ */new Set();
|
|
70
|
+
const closeOpenTooltips = () => {
|
|
71
|
+
setOpens.forEach(x => x(false));
|
|
72
|
+
};
|
|
73
|
+
const TooltipComponent = React.forwardRef(function Tooltip(props, ref) {
|
|
74
|
+
"use no memo";
|
|
71
75
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
76
|
+
const {
|
|
77
|
+
children,
|
|
78
|
+
delay: delayProp,
|
|
79
|
+
restMs: restMsProp,
|
|
80
|
+
onOpenChange: onOpenChangeProp,
|
|
81
|
+
focus,
|
|
82
|
+
open: openProp,
|
|
83
|
+
disableAutoCloseOnScroll,
|
|
84
|
+
zIndex,
|
|
85
|
+
scope = TOOLTIP_SCOPE,
|
|
86
|
+
...restProps
|
|
87
|
+
} = props;
|
|
88
|
+
const triggerRef = React.useRef(null);
|
|
89
|
+
const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
|
|
90
|
+
const {
|
|
91
|
+
delay: delayGroup,
|
|
92
|
+
setCurrentId
|
|
93
|
+
} = useDelayGroupContext();
|
|
94
|
+
const delay = delayProp !== void 0 ? delayProp : delayGroup ?? 400;
|
|
95
|
+
const restMs = restMsProp ?? (typeof delay === "number" ? delay : 0);
|
|
96
|
+
const [open, setOpen] = useControllableState({
|
|
97
|
+
prop: openProp,
|
|
98
|
+
defaultProp: false,
|
|
99
|
+
onChange: onOpenChangeProp
|
|
100
|
+
});
|
|
101
|
+
const id = props.groupId;
|
|
102
|
+
const onOpenChange = useEvent(open2 => {
|
|
103
|
+
if (open2) {
|
|
104
|
+
setCurrentId(id);
|
|
105
|
+
}
|
|
106
|
+
setOpen(open2);
|
|
107
|
+
});
|
|
108
|
+
React.useEffect(() => {
|
|
109
|
+
if (!open) return;
|
|
110
|
+
if (disableAutoCloseOnScroll) return;
|
|
111
|
+
if (typeof document === "undefined") return;
|
|
112
|
+
const closeIt = () => {
|
|
113
|
+
setOpen(false);
|
|
114
|
+
};
|
|
115
|
+
setOpens.add(setOpen);
|
|
116
|
+
document.documentElement.addEventListener("scroll", closeIt);
|
|
117
|
+
return () => {
|
|
118
|
+
setOpens.delete(setOpen);
|
|
119
|
+
document.documentElement.removeEventListener("scroll", closeIt);
|
|
120
|
+
};
|
|
121
|
+
}, [open, disableAutoCloseOnScroll]);
|
|
122
|
+
const floatingContext = useFloatingContext({
|
|
123
|
+
open,
|
|
124
|
+
setOpen: onOpenChange,
|
|
125
|
+
disable: false,
|
|
126
|
+
disableFocus: false,
|
|
127
|
+
hoverable: true,
|
|
128
|
+
role: "tooltip",
|
|
129
|
+
focus,
|
|
130
|
+
groupId: id,
|
|
131
|
+
delay,
|
|
132
|
+
restMs
|
|
133
|
+
});
|
|
134
|
+
const onCustomAnchorAdd = React.useCallback(() => setHasCustomAnchor(true), []);
|
|
135
|
+
const onCustomAnchorRemove = React.useCallback(() => setHasCustomAnchor(false), []);
|
|
136
|
+
const contentId = React.useId();
|
|
137
|
+
const smallerSize = props.unstyled ? null : getSize("$true", {
|
|
138
|
+
shift: -2,
|
|
139
|
+
bounds: [0]
|
|
140
|
+
});
|
|
141
|
+
const content = /* @__PURE__ */jsx(FloatingOverrideContext.Provider, {
|
|
142
|
+
value: floatingContext,
|
|
143
|
+
children: /* @__PURE__ */jsx(Popper, {
|
|
144
|
+
scope,
|
|
145
|
+
size: smallerSize?.key,
|
|
146
|
+
allowFlip: true,
|
|
147
|
+
stayInFrame: true,
|
|
148
|
+
open,
|
|
149
|
+
...restProps,
|
|
150
|
+
children: /* @__PURE__ */jsx(PopoverContextProvider, {
|
|
151
|
+
scope,
|
|
152
|
+
contentId,
|
|
153
|
+
triggerRef,
|
|
111
154
|
open,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
onCustomAnchorRemove = React.useCallback(() => setHasCustomAnchor(!1), []),
|
|
124
|
-
contentId = React.useId(),
|
|
125
|
-
smallerSize = props.unstyled ? null : getSize("$true", {
|
|
126
|
-
shift: -2,
|
|
127
|
-
bounds: [0]
|
|
128
|
-
}),
|
|
129
|
-
content = /* @__PURE__ */jsx(FloatingOverrideContext.Provider, {
|
|
130
|
-
value: floatingContext,
|
|
131
|
-
children: /* @__PURE__ */jsx(Popper, {
|
|
132
|
-
scope,
|
|
133
|
-
size: smallerSize?.key,
|
|
134
|
-
allowFlip: !0,
|
|
135
|
-
stayInFrame: !0,
|
|
136
|
-
open,
|
|
137
|
-
...restProps,
|
|
138
|
-
children: /* @__PURE__ */jsx(PopoverContextProvider, {
|
|
139
|
-
scope,
|
|
140
|
-
contentId,
|
|
141
|
-
triggerRef,
|
|
142
|
-
open,
|
|
143
|
-
onOpenChange: setOpen,
|
|
144
|
-
onOpenToggle: voidFn,
|
|
145
|
-
hasCustomAnchor,
|
|
146
|
-
onCustomAnchorAdd,
|
|
147
|
-
onCustomAnchorRemove,
|
|
148
|
-
children
|
|
149
|
-
})
|
|
150
|
-
})
|
|
151
|
-
});
|
|
152
|
-
return zIndex !== void 0 ? /* @__PURE__ */jsx(TooltipZIndexContext.Provider, {
|
|
155
|
+
onOpenChange: setOpen,
|
|
156
|
+
onOpenToggle: voidFn,
|
|
157
|
+
hasCustomAnchor,
|
|
158
|
+
onCustomAnchorAdd,
|
|
159
|
+
onCustomAnchorRemove,
|
|
160
|
+
children
|
|
161
|
+
})
|
|
162
|
+
})
|
|
163
|
+
});
|
|
164
|
+
if (zIndex !== void 0) {
|
|
165
|
+
return /* @__PURE__ */jsx(TooltipZIndexContext.Provider, {
|
|
153
166
|
value: zIndex,
|
|
154
167
|
children: content
|
|
155
|
-
}) : content;
|
|
156
|
-
}),
|
|
157
|
-
TooltipTrigger = React.forwardRef(function (props, ref) {
|
|
158
|
-
const {
|
|
159
|
-
scope,
|
|
160
|
-
...rest
|
|
161
|
-
} = props;
|
|
162
|
-
return /* @__PURE__ */jsx(PopoverTrigger, {
|
|
163
|
-
...rest,
|
|
164
|
-
scope: scope || TOOLTIP_SCOPE,
|
|
165
|
-
ref
|
|
166
|
-
});
|
|
167
|
-
}),
|
|
168
|
-
TooltipAnchor = React.forwardRef(function (props, ref) {
|
|
169
|
-
const {
|
|
170
|
-
scope,
|
|
171
|
-
...rest
|
|
172
|
-
} = props;
|
|
173
|
-
return /* @__PURE__ */jsx(PopoverAnchor, {
|
|
174
|
-
...rest,
|
|
175
|
-
scope: scope || TOOLTIP_SCOPE,
|
|
176
|
-
ref
|
|
177
168
|
});
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
169
|
+
}
|
|
170
|
+
return content;
|
|
171
|
+
});
|
|
172
|
+
const TooltipTrigger = React.forwardRef(function TooltipTrigger2(props, ref) {
|
|
173
|
+
const {
|
|
174
|
+
scope,
|
|
175
|
+
...rest
|
|
176
|
+
} = props;
|
|
177
|
+
return /* @__PURE__ */jsx(PopoverTrigger, {
|
|
178
|
+
...rest,
|
|
179
|
+
scope: scope || TOOLTIP_SCOPE,
|
|
180
|
+
ref
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
const TooltipAnchor = React.forwardRef(function TooltipAnchor2(props, ref) {
|
|
184
|
+
const {
|
|
185
|
+
scope,
|
|
186
|
+
...rest
|
|
187
|
+
} = props;
|
|
188
|
+
return /* @__PURE__ */jsx(PopoverAnchor, {
|
|
189
|
+
...rest,
|
|
190
|
+
scope: scope || TOOLTIP_SCOPE,
|
|
191
|
+
ref
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
const Tooltip2 = withStaticProperties(TooltipComponent, {
|
|
195
|
+
Anchor: TooltipAnchor,
|
|
196
|
+
Arrow: TooltipArrow,
|
|
197
|
+
Content: TooltipContent,
|
|
198
|
+
Trigger: TooltipTrigger
|
|
199
|
+
});
|
|
200
|
+
const voidFn = () => {};
|
|
186
201
|
export { Tooltip2 as Tooltip, TooltipGroup, closeOpenTooltips };
|
|
187
202
|
//# sourceMappingURL=Tooltip.mjs.map
|
package/dist/esm/Tooltip.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FloatingDelayGroup","useDelayGroupContext","useEvent","FloatingOverrideContext","getSize","withStaticProperties","PopoverAnchor","PopoverArrow","PopoverContent","PopoverContextProvider","PopoverTrigger","useFloatingContext","Popper","PopperContentFrame","useControllableState","React","jsx","TOOLTIP_SCOPE","ALWAYS_DISABLE_TOOLTIP","focus","TooltipContent","styleable","props","ref","preventAnimation","useContext","PreventTooltipAnimationContext","zIndexFromContext","TooltipZIndexContext","scope","alwaysDisable","unstyled","backgroundColor","alignItems","pointerEvents","size","zIndex","transition","staticConfig","componentName","TooltipArrow","forwardRef","createContext","TooltipGroup","children","delay","timeoutMs","Provider","value","useMemo","JSON","stringify","setOpens","Set","closeOpenTooltips","forEach","x","TooltipComponent","delayProp","restMs","restMsProp","onOpenChange","onOpenChangeProp","open","openProp","disableAutoCloseOnScroll","restProps","triggerRef","useRef","hasCustomAnchor","setHasCustomAnchor","useState","delayGroup","setCurrentId","setOpen","prop","defaultProp","onChange","id","groupId","
|
|
1
|
+
{"version":3,"names":["FloatingDelayGroup","useDelayGroupContext","useEvent","FloatingOverrideContext","getSize","withStaticProperties","PopoverAnchor","PopoverArrow","PopoverContent","PopoverContextProvider","PopoverTrigger","useFloatingContext","Popper","PopperContentFrame","useControllableState","React","jsx","TOOLTIP_SCOPE","ALWAYS_DISABLE_TOOLTIP","focus","TooltipContent","styleable","props","ref","preventAnimation","useContext","PreventTooltipAnimationContext","zIndexFromContext","TooltipZIndexContext","scope","alwaysDisable","unstyled","backgroundColor","alignItems","pointerEvents","size","zIndex","transition","staticConfig","componentName","TooltipArrow","forwardRef","createContext","TooltipGroup","children","delay","timeoutMs","Provider","value","useMemo","JSON","stringify","setOpens","Set","closeOpenTooltips","forEach","x","TooltipComponent","Tooltip","delayProp","restMs","restMsProp","onOpenChange","onOpenChangeProp","open","openProp","disableAutoCloseOnScroll","restProps","triggerRef","useRef","hasCustomAnchor","setHasCustomAnchor","useState","delayGroup","setCurrentId","setOpen","prop","defaultProp","onChange","id","groupId","useEffect","document","closeIt","add","documentElement","addEventListener","delete","removeEventListener","floatingContext","disable","disableFocus","hoverable","role","onCustomAnchorAdd","useCallback","onCustomAnchorRemove","contentId","useId","smallerSize","shift","bounds","content","key","allowFlip","stayInFrame","onOpenToggle","voidFn","TooltipTrigger","rest","TooltipAnchor","Tooltip2","Anchor","Arrow","Content","Trigger"],"sources":["../../src/Tooltip.tsx"],"sourcesContent":[null],"mappings":"AAEA,SAASA,kBAAA,EAAoBC,oBAAA,QAAwC;AAErE,SAASC,QAAA,QAAgB;AACzB,SAASC,uBAAA,QAA+B;AACxC,SAASC,OAAA,QAAe;AACxB,SAASC,oBAAA,QAA4B;AAMrC,SACEC,aAAA,EACAC,YAAA,EACAC,cAAA,EACAC,sBAAA,EACAC,cAAA,EACAC,kBAAA,QACK;AAEP,SAASC,MAAA,EAAQC,kBAAA,QAA0B;AAC3C,SAASC,oBAAA,QAA4B;AACrC,YAAYC,KAAA,MAAW;AA0BjB,SAAAC,GAAA;AAxBN,MAAMC,aAAA,GAAgB;AAWtB,MAAMC,sBAAA,GAAyB;EAC7BC,KAAA,EAAO;EACP,iBAAiB;EAAA;EAAA;AAGnB;AAEA,MAAMC,cAAA,GAAiBP,kBAAA,CAAmBQ,SAAA,CACxC,CAACC,KAAA,EAAOC,GAAA,KAAQ;EACd,MAAMC,gBAAA,GAAmBT,KAAA,CAAMU,UAAA,CAAWC,8BAA8B;EACxE,MAAMC,iBAAA,GAAoBZ,KAAA,CAAMU,UAAA,CAAWG,oBAAoB;EAE/D,OACE,eAAAZ,GAAA,CAACR,cAAA;IACCqB,KAAA,EAAOP,KAAA,CAAMO,KAAA,IAASZ,aAAA;IACtBa,aAAA,EAAeZ,sBAAA;IACd,IAAI,CAACI,KAAA,CAAMS,QAAA,IAAY;MACtBC,eAAA,EAAiB;MACjBC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