@hanzogui/tooltip 7.0.0 → 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 +241 -0
- package/dist/cjs/Tooltip.native.js +50 -0
- package/dist/cjs/Tooltip.native.js.map +1 -0
- package/dist/cjs/TooltipSimple.cjs +112 -0
- package/dist/cjs/TooltipSimple.native.js +34 -0
- package/dist/cjs/TooltipSimple.native.js.map +1 -0
- package/dist/cjs/index.cjs +21 -0
- package/dist/cjs/index.native.js +24 -0
- package/dist/cjs/index.native.js.map +1 -0
- package/dist/esm/Tooltip.mjs +202 -0
- package/dist/esm/Tooltip.mjs.map +1 -0
- package/dist/esm/Tooltip.native.js +20 -0
- package/dist/esm/Tooltip.native.js.map +1 -0
- package/dist/esm/TooltipSimple.mjs +76 -0
- package/dist/esm/TooltipSimple.mjs.map +1 -0
- package/dist/esm/TooltipSimple.native.js +6 -0
- package/dist/esm/TooltipSimple.native.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/index.mjs +3 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/index.native.js +3 -0
- package/dist/esm/index.native.js.map +1 -0
- package/dist/jsx/Tooltip.mjs +202 -0
- package/dist/jsx/Tooltip.mjs.map +1 -0
- package/dist/jsx/Tooltip.native.js +50 -0
- package/dist/jsx/Tooltip.native.js.map +1 -0
- package/dist/jsx/TooltipSimple.mjs +76 -0
- package/dist/jsx/TooltipSimple.mjs.map +1 -0
- package/dist/jsx/TooltipSimple.native.js +34 -0
- package/dist/jsx/TooltipSimple.native.js.map +1 -0
- package/dist/jsx/index.js +3 -0
- package/dist/jsx/index.js.map +1 -0
- package/dist/jsx/index.mjs +3 -0
- package/dist/jsx/index.mjs.map +1 -0
- package/dist/jsx/index.native.js +24 -0
- package/dist/jsx/index.native.js.map +1 -0
- package/package.json +22 -20
- package/src/Tooltip.tsx +2 -2
- package/types/Tooltip.d.ts +6 -6
- package/types/Tooltip.d.ts.map +1 -0
- package/types/Tooltip.native.d.ts.map +1 -0
- 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
package/LICENSE
CHANGED
|
@@ -1,21 +1,42 @@
|
|
|
1
|
-
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-present, Hanzo AI, Inc.
|
|
4
|
+
|
|
5
|
+
Portions of this software are derived from upstream code originally licensed under
|
|
6
|
+
the MIT License, with the following copyright notices retained per its terms:
|
|
2
7
|
|
|
3
8
|
Copyright (c) 2020 Nate Wienert
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
Copyright (c) 2015-present, Nicolas Gallagher.
|
|
10
|
+
Copyright (c) 2015-present, Facebook, Inc.
|
|
11
|
+
Copyright (c) 2021 Radix
|
|
12
|
+
Copyright (c) 2017 Carmelo Pullara
|
|
13
|
+
Copyright (c) 2018 Framer B.V.
|
|
14
|
+
Copyright (c) 2022 WorkOS
|
|
15
|
+
|
|
16
|
+
All rights reserved.
|
|
17
|
+
|
|
18
|
+
Redistribution and use in source and binary forms, with or without
|
|
19
|
+
modification, are permitted provided that the following conditions are met:
|
|
20
|
+
|
|
21
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
22
|
+
list of conditions and the following disclaimer.
|
|
23
|
+
|
|
24
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
25
|
+
this list of conditions and the following disclaimer in the documentation
|
|
26
|
+
and/or other materials provided with the distribution.
|
|
27
|
+
|
|
28
|
+
3. Neither the name of the copyright holder nor the names of its contributors
|
|
29
|
+
may be used to endorse or promote products derived from this software
|
|
30
|
+
without specific prior written permission.
|
|
31
|
+
|
|
32
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
33
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
34
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
35
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
36
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
37
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
38
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
39
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
40
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
41
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
42
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,241 @@
|
|
|
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) __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, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
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);
|
|
34
|
+
var Tooltip_exports = {};
|
|
35
|
+
__export(Tooltip_exports, {
|
|
36
|
+
Tooltip: () => Tooltip2,
|
|
37
|
+
TooltipGroup: () => TooltipGroup,
|
|
38
|
+
closeOpenTooltips: () => closeOpenTooltips
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(Tooltip_exports);
|
|
41
|
+
var import_polyfill_dev = require("@hanzogui/polyfill-dev");
|
|
42
|
+
var import_floating = require("@hanzogui/floating");
|
|
43
|
+
var import_core = require("@hanzogui/core");
|
|
44
|
+
var import_floating2 = require("@hanzogui/floating");
|
|
45
|
+
var import_get_token = require("@hanzogui/get-token");
|
|
46
|
+
var import_helpers = require("@hanzogui/helpers");
|
|
47
|
+
var import_popover = require("@hanzogui/popover");
|
|
48
|
+
var import_popper = require("@hanzogui/popper");
|
|
49
|
+
var import_use_controllable_state = require("@hanzogui/use-controllable-state");
|
|
50
|
+
var React = __toESM(require("react"), 1);
|
|
51
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
52
|
+
const TOOLTIP_SCOPE = "";
|
|
53
|
+
const ALWAYS_DISABLE_TOOLTIP = {
|
|
54
|
+
focus: true,
|
|
55
|
+
"remove-scroll": true
|
|
56
|
+
// it's nice to hit escape to hide a tooltip
|
|
57
|
+
// dismiss: true
|
|
58
|
+
};
|
|
59
|
+
const TooltipContent = import_popper.PopperContentFrame.styleable((props, ref) => {
|
|
60
|
+
const preventAnimation = React.useContext(PreventTooltipAnimationContext);
|
|
61
|
+
const zIndexFromContext = React.useContext(TooltipZIndexContext);
|
|
62
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_popover.PopoverContent, {
|
|
63
|
+
scope: props.scope || TOOLTIP_SCOPE,
|
|
64
|
+
alwaysDisable: ALWAYS_DISABLE_TOOLTIP,
|
|
65
|
+
...(!props.unstyled && {
|
|
66
|
+
backgroundColor: "$background",
|
|
67
|
+
alignItems: "center",
|
|
68
|
+
pointerEvents: "none",
|
|
69
|
+
size: "$true"
|
|
70
|
+
}),
|
|
71
|
+
ref,
|
|
72
|
+
...(zIndexFromContext !== void 0 && {
|
|
73
|
+
zIndex: zIndexFromContext
|
|
74
|
+
}),
|
|
75
|
+
...props,
|
|
76
|
+
...(preventAnimation && {
|
|
77
|
+
transition: null
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
}, {
|
|
81
|
+
staticConfig: {
|
|
82
|
+
componentName: "Tooltip"
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const TooltipArrow = React.forwardRef((props, ref) => {
|
|
86
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_popover.PopoverArrow, {
|
|
87
|
+
scope: props.scope || TOOLTIP_SCOPE,
|
|
88
|
+
componentName: "Tooltip",
|
|
89
|
+
ref,
|
|
90
|
+
...props
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
const PreventTooltipAnimationContext = React.createContext(false);
|
|
94
|
+
const TooltipZIndexContext = React.createContext(void 0);
|
|
95
|
+
const TooltipGroup = ({
|
|
96
|
+
children,
|
|
97
|
+
delay,
|
|
98
|
+
preventAnimation = false,
|
|
99
|
+
timeoutMs
|
|
100
|
+
}) => {
|
|
101
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(PreventTooltipAnimationContext.Provider, {
|
|
102
|
+
value: preventAnimation,
|
|
103
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_floating.FloatingDelayGroup, {
|
|
104
|
+
timeoutMs,
|
|
105
|
+
delay: React.useMemo(() => delay, [JSON.stringify(delay)]),
|
|
106
|
+
children
|
|
107
|
+
})
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
const setOpens = /* @__PURE__ */new Set();
|
|
111
|
+
const closeOpenTooltips = () => {
|
|
112
|
+
setOpens.forEach(x => x(false));
|
|
113
|
+
};
|
|
114
|
+
const TooltipComponent = React.forwardRef(function Tooltip(props, ref) {
|
|
115
|
+
"use no memo";
|
|
116
|
+
|
|
117
|
+
const {
|
|
118
|
+
children,
|
|
119
|
+
delay: delayProp,
|
|
120
|
+
restMs: restMsProp,
|
|
121
|
+
onOpenChange: onOpenChangeProp,
|
|
122
|
+
focus,
|
|
123
|
+
open: openProp,
|
|
124
|
+
disableAutoCloseOnScroll,
|
|
125
|
+
zIndex,
|
|
126
|
+
scope = TOOLTIP_SCOPE,
|
|
127
|
+
...restProps
|
|
128
|
+
} = props;
|
|
129
|
+
const triggerRef = React.useRef(null);
|
|
130
|
+
const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
|
|
131
|
+
const {
|
|
132
|
+
delay: delayGroup,
|
|
133
|
+
setCurrentId
|
|
134
|
+
} = (0, import_floating.useDelayGroupContext)();
|
|
135
|
+
const delay = delayProp !== void 0 ? delayProp : delayGroup ?? 400;
|
|
136
|
+
const restMs = restMsProp ?? (typeof delay === "number" ? delay : 0);
|
|
137
|
+
const [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
|
|
138
|
+
prop: openProp,
|
|
139
|
+
defaultProp: false,
|
|
140
|
+
onChange: onOpenChangeProp
|
|
141
|
+
});
|
|
142
|
+
const id = props.groupId;
|
|
143
|
+
const onOpenChange = (0, import_core.useEvent)(open2 => {
|
|
144
|
+
if (open2) {
|
|
145
|
+
setCurrentId(id);
|
|
146
|
+
}
|
|
147
|
+
setOpen(open2);
|
|
148
|
+
});
|
|
149
|
+
React.useEffect(() => {
|
|
150
|
+
if (!open) return;
|
|
151
|
+
if (disableAutoCloseOnScroll) return;
|
|
152
|
+
if (typeof document === "undefined") return;
|
|
153
|
+
const closeIt = () => {
|
|
154
|
+
setOpen(false);
|
|
155
|
+
};
|
|
156
|
+
setOpens.add(setOpen);
|
|
157
|
+
document.documentElement.addEventListener("scroll", closeIt);
|
|
158
|
+
return () => {
|
|
159
|
+
setOpens.delete(setOpen);
|
|
160
|
+
document.documentElement.removeEventListener("scroll", closeIt);
|
|
161
|
+
};
|
|
162
|
+
}, [open, disableAutoCloseOnScroll]);
|
|
163
|
+
const floatingContext = (0, import_popover.useFloatingContext)({
|
|
164
|
+
open,
|
|
165
|
+
setOpen: onOpenChange,
|
|
166
|
+
disable: false,
|
|
167
|
+
disableFocus: false,
|
|
168
|
+
hoverable: true,
|
|
169
|
+
role: "tooltip",
|
|
170
|
+
focus,
|
|
171
|
+
groupId: id,
|
|
172
|
+
delay,
|
|
173
|
+
restMs
|
|
174
|
+
});
|
|
175
|
+
const onCustomAnchorAdd = React.useCallback(() => setHasCustomAnchor(true), []);
|
|
176
|
+
const onCustomAnchorRemove = React.useCallback(() => setHasCustomAnchor(false), []);
|
|
177
|
+
const contentId = React.useId();
|
|
178
|
+
const smallerSize = props.unstyled ? null : (0, import_get_token.getSize)("$true", {
|
|
179
|
+
shift: -2,
|
|
180
|
+
bounds: [0]
|
|
181
|
+
});
|
|
182
|
+
const content = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_floating2.FloatingOverrideContext.Provider, {
|
|
183
|
+
value: floatingContext,
|
|
184
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_popper.Popper, {
|
|
185
|
+
scope,
|
|
186
|
+
size: smallerSize?.key,
|
|
187
|
+
allowFlip: true,
|
|
188
|
+
stayInFrame: true,
|
|
189
|
+
open,
|
|
190
|
+
...restProps,
|
|
191
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_popover.PopoverContextProvider, {
|
|
192
|
+
scope,
|
|
193
|
+
contentId,
|
|
194
|
+
triggerRef,
|
|
195
|
+
open,
|
|
196
|
+
onOpenChange: setOpen,
|
|
197
|
+
onOpenToggle: voidFn,
|
|
198
|
+
hasCustomAnchor,
|
|
199
|
+
onCustomAnchorAdd,
|
|
200
|
+
onCustomAnchorRemove,
|
|
201
|
+
children
|
|
202
|
+
})
|
|
203
|
+
})
|
|
204
|
+
});
|
|
205
|
+
if (zIndex !== void 0) {
|
|
206
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(TooltipZIndexContext.Provider, {
|
|
207
|
+
value: zIndex,
|
|
208
|
+
children: content
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
return content;
|
|
212
|
+
});
|
|
213
|
+
const TooltipTrigger = React.forwardRef(function TooltipTrigger2(props, ref) {
|
|
214
|
+
const {
|
|
215
|
+
scope,
|
|
216
|
+
...rest
|
|
217
|
+
} = props;
|
|
218
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_popover.PopoverTrigger, {
|
|
219
|
+
...rest,
|
|
220
|
+
scope: scope || TOOLTIP_SCOPE,
|
|
221
|
+
ref
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
const TooltipAnchor = React.forwardRef(function TooltipAnchor2(props, ref) {
|
|
225
|
+
const {
|
|
226
|
+
scope,
|
|
227
|
+
...rest
|
|
228
|
+
} = props;
|
|
229
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_popover.PopoverAnchor, {
|
|
230
|
+
...rest,
|
|
231
|
+
scope: scope || TOOLTIP_SCOPE,
|
|
232
|
+
ref
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
const Tooltip2 = (0, import_helpers.withStaticProperties)(TooltipComponent, {
|
|
236
|
+
Anchor: TooltipAnchor,
|
|
237
|
+
Arrow: TooltipArrow,
|
|
238
|
+
Content: TooltipContent,
|
|
239
|
+
Trigger: TooltipTrigger
|
|
240
|
+
});
|
|
241
|
+
const voidFn = () => {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
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, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var Tooltip_native_exports = {};
|
|
26
|
+
__export(Tooltip_native_exports, {
|
|
27
|
+
Tooltip: () => Tooltip,
|
|
28
|
+
TooltipGroup: () => TooltipGroup,
|
|
29
|
+
closeOpenTooltips: () => closeOpenTooltips
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(Tooltip_native_exports);
|
|
32
|
+
var import_helpers = require("@hanzogui/helpers");
|
|
33
|
+
var RenderChildren = function (props) {
|
|
34
|
+
return props.children;
|
|
35
|
+
};
|
|
36
|
+
var RenderNull = function (props) {
|
|
37
|
+
return null;
|
|
38
|
+
};
|
|
39
|
+
var TooltipGroup = function () {
|
|
40
|
+
return null;
|
|
41
|
+
};
|
|
42
|
+
var closeOpenTooltips = function () {};
|
|
43
|
+
var Tooltip = (0, import_helpers.withStaticProperties)(RenderChildren, {
|
|
44
|
+
Anchor: RenderChildren,
|
|
45
|
+
Arrow: RenderNull,
|
|
46
|
+
Close: RenderNull,
|
|
47
|
+
Content: RenderNull,
|
|
48
|
+
Trigger: RenderChildren
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=Tooltip.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Tooltip_native_exports","__export","Tooltip","TooltipGroup","closeOpenTooltips","module","exports","__toCommonJS","import_helpers","require","RenderChildren","props","children","RenderNull","withStaticProperties","Anchor","Arrow","Close","Content","Trigger"],"sources":["../../src/Tooltip.native.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,sBAAA;AAAAC,QAAA,CAAAD,sBAAA;EAAAE,OAAA,EAAAA,CAAA,KAAAA,OAAA;EAAAC,YAAA,EAAAA,CAAA,KAAAA,YAAA;EAAAC,iBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAP,sBAAA;AAAA,IAAAQ,cAAA,GAAqCC,OAAA;AAGrC,IAAIC,cAAA,GAAiB,SAAAA,CAASC,KAAA,EAAO;EACjC,OAAOA,KAAA,CAAMC,QAAA;AACjB;AACA,IAAIC,UAAA,GAAa,SAAAA,CAASF,KAAA,EAAO;EAC7B,OAAO;AACX;AACO,IAAIR,YAAA,GAAe,SAAAA,CAAA,EAAW;EACjC,OAAO;AACX;AACO,IAAIC,iBAAA,GAAoB,SAAAA,CAAA,EAAW,CAAC;AACzB,IAAIF,OAAA,OAAUM,cAAA,CAAAM,oBAAA,EAAqBJ,cAAA,EAAgB;EACjEK,MAAA,EAAQL,cAAA;EACRM,KAAA,EAAOH,UAAA;EACPI,KAAA,EAAOJ,UAAA;EACPK,OAAA,EAASL,UAAA;EACTM,OAAA,EAAST;AACb,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,112 @@
|
|
|
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) __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, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
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);
|
|
34
|
+
var TooltipSimple_exports = {};
|
|
35
|
+
__export(TooltipSimple_exports, {
|
|
36
|
+
TooltipSimple: () => TooltipSimple
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(TooltipSimple_exports);
|
|
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");
|
|
44
|
+
const TooltipSimple = React.forwardRef(({
|
|
45
|
+
label,
|
|
46
|
+
children,
|
|
47
|
+
contentProps,
|
|
48
|
+
disabled,
|
|
49
|
+
...tooltipProps
|
|
50
|
+
}, ref) => {
|
|
51
|
+
"use no memo";
|
|
52
|
+
|
|
53
|
+
const child = React.Children.only(children);
|
|
54
|
+
if (!label) {
|
|
55
|
+
return children;
|
|
56
|
+
}
|
|
57
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_Tooltip.Tooltip, {
|
|
58
|
+
disableRTL: true,
|
|
59
|
+
offset: 15,
|
|
60
|
+
restMs: 40,
|
|
61
|
+
delay: 40,
|
|
62
|
+
zIndex: 1e6,
|
|
63
|
+
...tooltipProps,
|
|
64
|
+
...(disabled ? {
|
|
65
|
+
open: false
|
|
66
|
+
} : null),
|
|
67
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Tooltip.Tooltip.Trigger, {
|
|
68
|
+
...(typeof label === "string" && {
|
|
69
|
+
"aria-label": label
|
|
70
|
+
}),
|
|
71
|
+
asChild: "except-style",
|
|
72
|
+
children: ref && React.isValidElement(child) ? React.cloneElement(child, {
|
|
73
|
+
ref
|
|
74
|
+
}) : child
|
|
75
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_Tooltip.Tooltip.Content, {
|
|
76
|
+
enterStyle: {
|
|
77
|
+
y: -4,
|
|
78
|
+
opacity: 0,
|
|
79
|
+
scale: 0.96
|
|
80
|
+
},
|
|
81
|
+
exitStyle: {
|
|
82
|
+
y: -4,
|
|
83
|
+
opacity: 0,
|
|
84
|
+
scale: 0.96
|
|
85
|
+
},
|
|
86
|
+
scale: 1,
|
|
87
|
+
elevation: "$0.5",
|
|
88
|
+
opacity: 1,
|
|
89
|
+
pointerEvents: "none",
|
|
90
|
+
paddingVertical: (0, import_get_token.getSpace)(tooltipProps.size || "$true", {
|
|
91
|
+
shift: -4
|
|
92
|
+
}),
|
|
93
|
+
animateOnly: ["transform", "opacity"],
|
|
94
|
+
transition: ["quicker", {
|
|
95
|
+
opacity: {
|
|
96
|
+
overshootClamping: true
|
|
97
|
+
}
|
|
98
|
+
}],
|
|
99
|
+
...contentProps,
|
|
100
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Tooltip.Tooltip.Arrow, {}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_text.Paragraph, {
|
|
101
|
+
maxWidth: 350,
|
|
102
|
+
overflow: "hidden",
|
|
103
|
+
size: "$3",
|
|
104
|
+
textAlign: "center",
|
|
105
|
+
"$platform-web": {
|
|
106
|
+
textWrap: "balance"
|
|
107
|
+
},
|
|
108
|
+
children: label
|
|
109
|
+
})]
|
|
110
|
+
})]
|
|
111
|
+
});
|
|
112
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
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, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var TooltipSimple_native_exports = {};
|
|
26
|
+
__export(TooltipSimple_native_exports, {
|
|
27
|
+
TooltipSimple: () => TooltipSimple
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(TooltipSimple_native_exports);
|
|
30
|
+
var RenderChildren = function (props) {
|
|
31
|
+
return props.children;
|
|
32
|
+
};
|
|
33
|
+
var TooltipSimple = RenderChildren;
|
|
34
|
+
//# sourceMappingURL=TooltipSimple.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
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, {
|
|
8
|
+
get: () => from[key],
|
|
9
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
16
|
+
value: true
|
|
17
|
+
}), mod);
|
|
18
|
+
var index_exports = {};
|
|
19
|
+
module.exports = __toCommonJS(index_exports);
|
|
20
|
+
__reExport(index_exports, require("./Tooltip.cjs"), module.exports);
|
|
21
|
+
__reExport(index_exports, require("./TooltipSimple.cjs"), module.exports);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __copyProps = (to, from, except, desc) => {
|
|
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, {
|
|
10
|
+
get: () => from[key],
|
|
11
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
17
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
18
|
+
value: true
|
|
19
|
+
}), mod);
|
|
20
|
+
var index_exports = {};
|
|
21
|
+
module.exports = __toCommonJS(index_exports);
|
|
22
|
+
__reExport(index_exports, require("./Tooltip.native.js"), module.exports);
|
|
23
|
+
__reExport(index_exports, require("./TooltipSimple.native.js"), module.exports);
|
|
24
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|